Jpp test-rotations-new
the software that should make you happy
Loading...
Searching...
No Matches
JDarkroomNB.cc
Go to the documentation of this file.
1// c++ standard library
2#include <string>
3#include <iostream>
4#include <sstream>
5#include <iomanip>
6#include <cmath>
7
8// JPP
9#include "Jeep/JParser.hh"
12
13#include "JDAQ/JDAQEventIO.hh"
17#include "JROOT/JManager.hh"
18
20#include "JSupport/JSupport.hh"
25#include "JTrigger/JHitR0.hh"
26#include "JTrigger/JHitL0.hh"
30
31// root
32#include "TH1D.h"
33#include "TH2D.h"
34
35// namespaces
36using namespace std;
37using namespace KM3NETDAQ ; // for JDAQTimeSlice
38using namespace JSUPPORT; // for JFileScanner
39using namespace JLANG; // for JMultipleFileScanner
40using namespace JDETECTOR ;
41using namespace JPP ;
42
43int main(int argc , char** argv){
44
46 string detectorFile;
48 string outFile;
49 double frequency;
50 int PMTSelector;
51 int Stagger;
52
53 try {
54 JParser<> zap;
55
56 zap['f'] = make_field(inputFiles );
57 zap['a'] = make_field(detectorFile );
58 zap['o'] = make_field(outFile ); //outfile
59 zap['H'] = make_field(frequency ); //flashing frequency in kHz
60 zap['P'] = make_field(PMTSelector ) = 0; //Select a PMT to analyze
61 zap['S'] = make_field(Stagger ) = 3520; //Currently this is the stagger offset used
62
63 zap(argc,argv);
64 }
65 catch(const exception &error) {
66 ERROR(error.what() << endl);
67 }
68
69 load(detectorFile, detector);
70 JModuleRouter moduleRouter(detector);
71
72 JTriggerParameters triggerParameters;
73
74 int pulse_period = 1e9/(frequency*1e3); //pulse period in ns and frequency in kHz
75
76 JManager < string, TH2F >* Pulses; //time on x-axis and ToT on y axis
77 Pulses = new JManager < string, TH2F > ( new TH2F("%", "", Stagger, -0.5, Stagger-0.5, 256, -0.5, 255.5) );
78
79 while( inputFiles.hasNext() ) {
80
81 JDAQTimesliceL0 slice = *(inputFiles.next());
82 JTimesliceRouter timesliceRouter(triggerParameters.numberOfBins);
83
84 timesliceRouter.configure(slice);
85
86 for(JDetector::iterator module = detector.begin(); module != detector.end(); ++module){
87
88 int String = module->getString();
89 int Floor = module->getFloor();
90
91 if(timesliceRouter.hasSuperFrame( module->getID() )){
92 JDAQSuperFrame SuperFrame = timesliceRouter.getSuperFrame( module->getID() );
93 for(JDAQSuperFrame::const_iterator hit = SuperFrame.begin(); hit != SuperFrame.end(); ++hit){
94 int PMT = static_cast<int>(hit->getPMT());
95 if(PMT == PMTSelector){
96 double raw_time = hit->getT();
97 double time = raw_time - pulse_period * int(raw_time/pulse_period) - Stagger*(Floor - 1);
98 double ToT = hit->getToT();
99 (*Pulses)[ MAKE_STRING( "S"+to_string(String)+"F"+to_string(Floor) ).c_str() ]->Fill(time,ToT);
100 }
101 }
102 }
103 }
104 }
105
106 cout << " Writing histograms to output" << endl;
107 TFile output(outFile.c_str() , "recreate") ;
108 Pulses -> Write(output);
109
110}
JDAQPMTIdentifier PMT
Command line options.
KM3NeT DAQ constants, bit handling, etc.
int main(int argc, char **argv)
Data structure for detector geometry and calibration.
Basic data structure for L0 hit.
Basic data structure for L0 hit.
Tools for handling different hit types.
Dynamic ROOT object management.
Direct access to module in detector data structure.
Scanning of objects from multiple files according a format that follows from the extension of each fi...
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2142
#define MAKE_STRING(A)
Make string.
Definition JPrint.hh:63
ROOT TTree parameter settings of various packages.
Detector data structure.
Definition JDetector.hh:96
Router for direct addressing of module data in detector data structure.
Utility class to parse command line options.
Definition JParser.hh:1698
General purpose class for object reading from a list of file names.
virtual bool hasNext() override
Check availability of next element.
virtual const pointer_type & next() override
Get next element.
const_iterator end() const
Definition JDAQFrame.hh:166
const_iterator begin() const
Definition JDAQFrame.hh:165
Hit data structure.
Definition JDAQHit.hh:35
Data frame of one optical module.
file Auxiliary data structures and methods for detector calibration.
Definition JAnchor.hh:12
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
Auxiliary classes and methods for language specific functionality.
std::string to_string(const T &value)
Convert value to string.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Support classes and methods for experiment specific I/O.
KM3NeT DAQ data structures and auxiliaries.
Definition DataQueue.cc:39
General purpose string class.
Definition JHead.hh:152
Detector file.
Definition JHead.hh:227
Router for fast addressing of hits in KM3NETDAQ::JDAQTimeslice data structure as a function of the op...
void configure(const JDAQTimeslice &timeslice)
Configure.
const JDAQSuperFrame & getSuperFrame(const JDAQModuleIdentifier &module) const
Get super frame.
bool hasSuperFrame(const JDAQModuleIdentifier &module) const
Check presence of module.
Timeslice data structure for L0 data.