24 #include "canvas/Persistency/Common/FindManyP.h" 25 #include "art_root_io/TFileService.h" 32 #include "nug4/ParticleNavigation/ParticleList.h" 74 #include "TPaveStats.h" 105 bool moduleMatcher(
int module1,
int module2);
107 void endJob()
override;
108 void createPNG(TH1D * histo);
109 double setAngle(
double angle);
110 int moduletoCTB(
int module2,
int module1);
135 double X_F, X_B, Y_F, Y_B,
Z_F, Z_B;
212 EDAnalyzer(p), fCRTLabel(p.
get <
art::InputTag > (
"CRTLabel")), fCTBLabel(p.
get<
art::InputTag>(
"CTBLabel")) {
213 consumes < std::vector < CRT::Trigger >> (
fCRTLabel);
214 consumes < std::vector < art::Assns < sim::AuxDetSimChannel, CRT::Trigger >>> (
fCRTLabel);
226 if ((module1 == 6 && (module2 == 10 || module2 == 11)) || (module1 == 14 && (module2 == 10 || module2 == 11)) || (module1 == 19 && (module2 == 26 || module2 == 27)) || (module1 == 31 && (module2 == 26 || module2 == 27)) || (module1 == 7 && (module2 == 12 || module2 == 13)) || (module1 == 15 && (module2 == 12 || module2 == 13)) || (module1 == 18 && (module2 == 24 || module2 == 25)) || (module1 == 30 && (module2 == 24 || module2 == 25)) || (module1 == 1 && (module2 == 4 || module2 == 5)) || (module1 == 9 && (module2 == 4 || module2 == 5)) || (module1 == 16 && (module2 == 20 || module2 == 21)) || (module1 == 28 && (module2 == 20 || module2 == 21)) || (module1 == 0 && (module2 == 2 || module2 == 3)) || (module1 == 8 && (module2 == 2 || module2 == 3)) || (module1 == 17 && (module2 == 22 || module2 == 23)) || (module1 == 29 && (module2 == 22 || module2 == 23)))
return 1;
233 if (module1 == 15 && module2 == 12 )
return 15;
234 else if (module1 == 15 && module2 == 13)
return 10;
235 else if (module1 == 7 && module2 == 12)
return 8;
236 else if (module1 == 7 && module2 == 13)
return 9;
237 else if (module1 == 19 && module2 == 26)
return 4;
238 else if (module1 == 19 && module2 == 27)
return 13;
239 else if (module1 == 31 && module2 == 26)
return 3;
240 else if (module1 == 31 && module2 == 27)
return 2;
241 else if (module1 == 30 && module2 == 24)
return 1;
242 else if (module1 == 30 && module2 == 25)
return 0;
243 else if (module1 == 18 && module2 == 24)
return 12;
244 else if (module1 == 18 && module2 == 25)
return 11;
245 else if (module1 == 6 && module2 == 11)
return 7;
246 else if (module1 == 6 && module2 == 10)
return 6;
247 else if (module1 == 14 && module2 == 11)
return 14;
248 else if (module1 == 14 && module2 == 10)
return 5;
249 else if (module1 == 0 && module2 == 3)
return 25;
250 else if (module1 == 0 && module2 == 2)
return 24;
251 else if (module1 == 8 && module2 == 3)
return 26;
252 else if (module1 == 8 && module2 == 2)
return 30;
253 else if (module1 == 17 && module2 == 23)
return 27;
254 else if (module1 == 17 && module2 == 22)
return 28;
255 else if (module1 == 29 && module2 == 23)
return 16;
256 else if (module1 == 29 && module2 == 22)
return 17;
257 else if (module1 == 28 && module2 == 21)
return 18;
258 else if (module1 == 28 && module2 == 20)
return 19;
259 else if (module1 == 16 && module2 == 21)
return 29;
260 else if (module1 == 16 && module2 == 20)
return 20;
261 else if (module1 == 9 && module2 == 5)
return 31;
262 else if (module1 == 9 && module2 == 4)
return 21;
263 else if (module1 == 1 && module2 == 5)
return 23;
264 else if (module1 == 1 && module2 == 4)
return 22;
271 TCanvas *
c =
new TCanvas;
274 TImage *
img = TImage::Create();
276 img -> WriteImage((
std::string(histo -> GetName()) +
".png").c_str());
284 angle += 3.14159265359;
286 angle *= 180.00 / 3.14159265359;
313 timeStamp=timingHandle->at(0).GetTimeStamp();
325 if(timeStamp.GetFlags()!= 13)
return;}
341 cout <<
"Getting triggers" <<
endl;
342 const auto & triggers =
event.getValidHandle < std::vector < CRT::Trigger >> (
fCRTLabel);
344 art::FindManyP < sim::AuxDetSimChannel > trigToSim(triggers, event,
fCRTLabel);
352 std::unordered_map < size_t, double > prevTimes;
354 cout <<
"Looking for hits in Triggers" <<
endl;
361 const auto& pdspctbs = *
event.getValidHandle<std::vector<raw::ctb::pdspctb>>(
fCTBLabel);
362 std::vector<int> uS, dS;
363 const size_t npdspctbs = pdspctbs.size();
364 for(
size_t j=0;j<npdspctbs;++j)
366 const std::vector<raw::ctb::Trigger> HLTriggers = pdspctbs[j].GetHLTriggers();
367 const std::vector<raw::ctb::ChStatus> chs = pdspctbs[j].GetChStatusAfterHLTs();
368 for (
size_t k=0;
k<HLTriggers.size(); ++
k)
371 int num = chs[
k].crt;
375 const auto crtmask=chs[
k].crt;
379 for (
int i = 0; i<32; ++i){
380 if (crtmask & (1<<i)){
389 if (pixel0!=-1 && pixel1!=-1) {
398 for (
const auto &
trigger: * triggers) {
399 const auto & hits =
trigger.Hits();
400 for (
const auto &
hit: hits) {
421 const auto & trigGeo = geom -> AuxDet(
trigger.Channel());
422 const auto & csens = trigGeo.SensitiveVolume(
hit.Channel());
423 const auto center = csens.GetCenter();
432 cout <<
"Hits compiled for event: " <<
nEvents <<
endl;
433 cout <<
"Number of Hits above Threshold: " << hitID <<
endl;
436 for (
unsigned int f_test = 0; f_test <
tempHits_F.size(); f_test++) {
438 const auto & trigGeo = geom -> AuxDet(
tempHits_F[
f].module);
439 const auto & trigGeo2 = geom -> AuxDet(
tempHits_F[f_test].module);
442 const auto hit1Center = hit1Geo.GetCenter();
444 const auto & hit2Geo = trigGeo2.SensitiveVolume(
tempHits_F[f_test].channel);
445 const auto hit2Center = hit2Geo.GetCenter();
450 double hitX = hit1Center.X();
455 double hitYPrelim=hit2Center.Y();
463 double hitY=hitYPrelim;
464 double hitZ = (hit1Center.Z() + hit2Center.Z()) / 2.
f;
485 for (
unsigned int f_test = 0; f_test <
tempHits_B.size(); f_test++) {
488 const auto & trigGeo = geom -> AuxDet(
tempHits_B[
f].module);
489 const auto & trigGeo2 = geom -> AuxDet(
tempHits_B[f_test].module);
491 const auto hit1Center = hit1Geo.GetCenter();
493 const auto & hit2Geo = trigGeo2.SensitiveVolume(
tempHits_B[f_test].channel);
494 const auto hit2Center = hit2Geo.GetCenter();
499 double hitX = hit1Center.X();
507 double hitYPrelim = hit2Center.Y();
513 double hitY=hitYPrelim;
516 double hitZ = (hit1Center.Z() + hit2Center.Z()) / 2.
f;
539 std::cout<<
"CTB Pixes: "<<pixel0<<
','<<pixel1<<
std::endl;
548 if (pixel0==-1 || pixel1==-1)
break;
553 if (crtPixel0!=pixel0 || crtPixel1!=pixel1)
continue;
593 fCRTTree = fileServiceHandle->make<TTree>(
"CRTCandidate",
"track by track info");
def analyze(root, level, gtrees, gbranches, doprint)
std::vector< recoHits > primaryHits_B
double setAngle(double angle)
int fFronttoBackTimingCut
std::vector< tempHits > tempHits_B
std::vector< recoHits > primaryHits_F
void analyze(art::Event const &e) override
std::vector< tempHits > tempHits_F
art framework interface to geometry description
int moduletoCTB(int module2, int module1)
#define DEFINE_ART_MODULE(klass)
T get(std::string const &key) const
TwoCRTReco(fhicl::ParameterSet const &p)
std::vector< tracksPair > allTracksPair
void Draw(const char *plot, const char *title)
Detector simulation of raw signals on wires.
bool moduleMatcher(int module1, int module2)
Declaration of signal hit object.
Provides recob::Track data product.
auto const & get(AssnsNode< L, R, D > const &r)
std::string to_string(ModuleType const mt)
void createPNG(TH1D *histo)
QTextStream & endl(QTextStream &s)
Event finding and building.
int fModuletoModuleTimingCut