37 int main(
int argc,
char **argv){
41 typedef JTriggeredFileScanner<> JTriggeredFileScanner_t;
42 typedef JTriggeredFileScanner_t::multi_pointer_type multi_pointer_type;
44 JTriggeredFileScanner_t inputFile;
47 JRange<double> t_res_ns;
60 zap[
'T'] =
make_field(t_res_ns) = JRange<double>(-100, 100);
61 zap[
'D'] =
make_field(D_m) = JRange<double>(0, 100);
62 zap[
'C'] =
make_field(cosT) = JRange<double>(-1, 1);
66 if (zap.read(argc, argv) != 0)
return 1;
68 catch(
const exception& error){
69 FATAL(error.what() << endl);
77 load(detectorFile, detector);
79 catch(
const JException& error){
83 const JPMTRouter pmtRouter(detector);
84 const JModuleRouter moduleRouter(detector);
86 typedef vector<JHitL0> JDataL0_t;
87 const JBuildL0<JHitL0> buildL0;
89 TFile *out =
new TFile(
outputFile.c_str(),
"RECREATE");
90 if ( !out->IsOpen() ) printf(
"Can't open outputfile\n");
92 TH2D hPDF2Dist(
"hPDF2Dist",
"PDF for ORCA Shower Position Fit; #delta t [ns]; D [m]",
93 2000, t_res_ns.getLowerLimit(), t_res_ns.getUpperLimit(),
94 700, D_m.getLowerLimit(), D_m.getUpperLimit());
96 while(inputFile.hasNext()){
98 multi_pointer_type ps = inputFile.next();
102 JTimeConverter converter(*
event, *tev);
106 cascade.pos =
event->mc_trks[1].pos;
107 cascade.pos -= Vec(0.0, 0.0, -117.164);
109 for (
unsigned int i = 1; i <
event->mc_trks.size(); i++) {
110 cascade.E +=
event->mc_trks[i].E;
111 cascade.dir +=
event->mc_trks[i].dir *
event->mc_trks[i].E;
113 cascade.dir.normalize();
116 double t_vx = converter.putTime(
event->mc_trks[1].t);
120 buildL0(
JDAQTimeslice(*tev,
true), moduleRouter, back_inserter(dataL0));
123 const JRotation3D R(dir);
126 for (vector<JHitL0>::const_iterator i = dataL0.begin(); i != dataL0.end(); ++i) {
129 hit.transform(R, vx);
131 const double D = hit.getLength();
133 const double dt = hit.getT() - t_expected;
134 const JDirection3D photonDir(hit.getPosition());
135 const double ct = photonDir.getDot(hit.getDirection());
137 if((D >= D_m.getLowerLimit() && D <= D_m.getUpperLimit()) &&
138 (dt >= t_res_ns.getLowerLimit() && dt <= t_res_ns.getUpperLimit()) &&
139 (ct >= cosT.getLowerLimit() && ct <= cosT.getUpperLimit())){
147 hPDF2Dist.Fill(dt, D, w);
Utility class to parse command line options.
Synchronously read DAQ events and Monte Carlo events (and optionally other events).
Structure to store the ToT mean and standard deviation of the hits produced by a nanobeacon in a sour...
Data structure for detector geometry and calibration.
Basic data structure for L0 hit.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
void load(const JString &file_name, JDetector &detector)
Load detector from input file.
Direct access to PMT in detector data structure.
General purpose messaging.
Direct access to module in detector data structure.
Utility class to parse command line options.
ROOT TTree parameter settings.
JDirection3D getDirection(const Vec &v)
Get direction.
Basic data structure for L1 hit.
JPosition3D getPosition(const Vec &v)
Get position.
int main(int argc, char *argv[])