27 using namespace JDETECTOR;
28 using namespace KM3NETDAQ;
29 using namespace JNANOBEACON;
31 int main(
int argc ,
char** argv){
34 JLimit_t& numberOfEvents = inputFiles.getLimit();
53 zap[
'n'] =
make_field(numberOfEvents ) = JLimit::max();
55 zap[
'h'] =
make_field(depth ,
"detector depth [m]" ) = 2500.0;
56 zap[
'l'] =
make_field(wavelength ,
"LED wavelength [nm]") = 400.0;
57 zap[
'T'] =
make_field(selector ) = default_pmts;
61 catch(
const exception &error) {
62 ERROR(error.what() << endl);
70 JHitBuffer triggerBuffer;
71 JHitBuffer snapshotBuffer;
73 load(detectorFile , detector);
87 timeDifferences =
new JManager < int, TH2D > (
new TH2D(
"%",
"", npairs, 0.5, npairs+0.5, 501, -250.5, 250.5) );
93 triggerBuffer .clear();
94 snapshotBuffer.clear();
96 builder(*event, moduleRouter,
true , back_inserter(snapshotBuffer));
97 builder(*event, moduleRouter,
false , back_inserter( triggerBuffer));
99 JHitBuffer::iterator __end = partition(triggerBuffer.begin(), triggerBuffer.end(), selector);
100 if(triggerBuffer.begin() != __end){
102 sort(triggerBuffer.begin(), __end, less<JHit>());
103 JHitBuffer::iterator triggeredHit = triggerBuffer.begin();
105 if( moduleRouter.
hasModule( triggeredHit -> getModuleID() ) ){
106 const JModule& triggeredModule = moduleRouter.
getModule( triggeredHit -> getModuleID() );
108 for(JHitBuffer::const_iterator snapshotHit = snapshotBuffer.begin(); snapshotHit != snapshotBuffer.end(); ++snapshotHit){
110 if( moduleRouter.
hasModule( snapshotHit -> getModuleID() ) ){
111 const JModule& snapshotModule = moduleRouter.
getModule( snapshotHit -> getModuleID() );
116 double Dt = snapshotHit->getT() - triggeredHit->getT();
117 double ToF =
getDistance( triggeredHit->getPosition(), snapshotHit->getPosition() ) / cw;
121 (*timeDifferences)[triggeredModule.
getString()]->Fill(xbin,Dt-ToF);
125 FATAL(
"JModuleRouter trying to access non existing identifier: " << snapshotHit->getModuleID() );
130 FATAL(
"JModuleRouter trying to access non existing identifier: " << triggeredHit->getModuleID() );
134 TFile output(outFile.c_str() ,
"recreate") ;
135 timeDifferences -> Write(output);
Auxiliary class to set-up Hit.
Utility class to parse command line options.
int main(int argc, char *argv[])
ROOT TTree parameter settings of various packages.
int getFloor() const
Get floor number.
const JModule & getModule(const JObjectID &id) const
Get module parameters.
Data structure for a composite optical module.
Implementation of dispersion for water in deep sea.
Router for direct addressing of module data in detector data structure.
Dynamic ROOT object management.
Data structure for detector geometry and calibration.
double getDistance(const JFirst_t &first, const JSecond_t &second)
Get distance between objects.
Basic data structure for L0 hit.
Auxiliary class for defining the range of iterations of objects.
Auxiliary class to manage set of compatible ROOT objects (e.g. histograms) using unique keys...
virtual bool hasNext() override
Check availability of next element.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
int getNumberOfFloors(const JDetector &detector)
Get number of floors.
Scanning of objects from multiple files according a format that follows from the extension of each fi...
Direct access to module in detector data structure.
int getString() const
Get string number.
virtual double getIndexOfRefractionGroup(const double lambda) const
Index of refraction for group velocity.
const double getSpeedOfLight()
Get speed of light.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
General purpose class for object reading from a list of file names.
Utility class to parse command line options.
Data structure for L0 hit.
virtual const pointer_type & next() override
Get next element.
bool hasModule(const JObjectID &id) const
Has module.
bool comparepair(const pair_type &A, const pair_type &B)
do set_variable DETECTOR_TXT $WORKDIR detector
Auxiliary data structure for set of PMT identifiers.