227 std::cout<<
"============================================"<<std::endl
228 <<
"Run = "<<
event.run()<<
", SubRun = "<<
event.subRun()<<
", Event = "<<
event.id().event()<<std::endl
229 <<
"============================================"<<std::endl;
232 fEvent =
event.id().event();
242 art::Handle<sbn::ExtraTriggerInfo> trigger_handle;
244 if( trigger_handle.isValid() ) {
250 m_trigger_gate_diff = trigger_handle->triggerTimestamp - trigger_handle->beamGateTimestamp;
253 mf::LogError(
"CRTTPCMatchingAna:") <<
"No raw::Trigger associated to label: " <<
fTriggerLabel.label() <<
"\n" ;
257 mf::LogError(
"CRTTPCMatchingAna:") <<
"Trigger Data product " <<
fTriggerLabel.label() <<
" not found!\n" ;
262 art::Handle< std::vector<sbn::crt::CRTHit>> crtHitHandle;
263 std::vector<art::Ptr<sbn::crt::CRTHit> > crtHitList;
265 art::fill_ptr_vector(crtHitList, crtHitHandle);
271 std::vector<sbn::crt::CRTHit> crtHits;
273 double minHitTime = 99999;
274 double maxHitTime = -99999;
276 for(
auto const&
hit : (*crtHitHandle)){
279 if(hitTime<-0.5e6) hitTime+=1e6;
280 else if(hitTime>0.5e6) hitTime-=1e6;
284 if(hitTime < minHitTime) minHitTime = hitTime;
285 if(hitTime > maxHitTime) maxHitTime = hitTime;
287 crtHits.push_back(
hit);
291 mf::LogError(
"CRTTPCMatchingAna:") <<
"# of TPC tracks: " <<
fTPCTrackLabel.size()
292 <<
" \t # of CRT Hits: " << crtHits.size() <<
"\n" ;
298 auto const clockData = art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(event);
299 auto const detProp = art::ServiceHandle<detinfo::DetectorPropertiesService const>()->DataFor(event, clockData);
306 auto it = &trackLabel - fTPCTrackLabel.data();
310 auto tpcTrackHandle =
event.getValidHandle<std::vector<recob::Track>>(trackLabel);
311 if (!tpcTrackHandle.isValid())
continue;
314 auto pfpListHandle =
event.getValidHandle<std::vector<recob::PFParticle> >(
fPFParticleLabel[it]);
315 if (!pfpListHandle.isValid())
continue;
321 art::FindManyP<recob::PFParticle> fmpfp(tpcTrackHandle, event, trackLabel);
324 art::FindManyP<anab::T0> fmt0pandora(pfpListHandle, event,
fPFParticleLabel[it]);
327 art::FindManyP<recob::Hit> findManyHits(tpcTrackHandle, event, trackLabel);
330 for (
auto const& tpcTrack : (*tpcTrackHandle)){
331 auto idx = &tpcTrack - (*tpcTrackHandle).data();
333 double t0 = -9999999;
336 auto pfps = fmpfp.at(tpcTrack.ID());
340 auto t0s = fmt0pandora.at(pfps[0].key());
351 std::vector<art::Ptr<recob::Hit>> hits = findManyHits.at(tpcTrack.ID());
352 if (hits.size() == 0)
continue;
356 int const cryoNumber = hits[0]->WireID().Cryostat;
366 mf::LogInfo(
"CRTTPCMatchingAna")
367 <<
"Track # " << idx <<
" Matched time = "<<closest.
t0<<
" [us] to track "<< tpcTrack.ID()<<
" with DCA = "<<closest.dca
368 <<
" for crt region " << closest.thishit.tagger;
374 double sin_angle = -99999;
375 if(closest.dca != -99999){
376 hDCA[closest.thishit.tagger]->Fill(closest.dca);
378 sin_angle = closest.dca/closest.extrapLen;
379 hDoL[closest.thishit.tagger]->Fill(sin_angle);
381 hT0[closest.thishit.tagger]->Fill(closest.t0);
382 fDCA.push_back(closest.dca);
383 fDOL.push_back(sin_angle);
384 fT0.push_back(closest.t0);
385 fcryo.push_back(cryoNumber);
int fEvent
number of the event being processed
std::vector< art::InputTag > fPFParticleLabel
labels for source of PFParticle
int fSubRun
number of the sub-run being processed
int fRun
number of the run being processed
std::vector< art::InputTag > fTPCTrackLabel
labels for source of tracks
vector< int > fCrtRegion
CRT hit region code.
int AuxDetRegionNameToNum(string reg)
std::map< std::string, TH1F * > hT0
std::string bitName(triggerSource bit)
Returns a mnemonic short name of the beam type.
vector< double > fDCA
Distance of closest approach between CRT hit and extended TPC track.
vector< double > fpandorat0
Track T0 based on Pandora (Cathode Crossing Track)
std::map< std::string, TH1F * > hDoL
uint64_t m_trigger_timestamp
vector< int > fcryo
cryo number
vector< double > fT0
Track T0 based on CRT hit and extended TPC Track match.
matchCand GetClosestCRTHit(detinfo::DetectorPropertiesData const &detProp, recob::Track tpcTrack, std::pair< double, double > t0MinMax, std::vector< sbn::crt::CRTHit > crtHits, int driftDirection, uint64_t &trigger_timestamp)
icarus::crt::CRTCommonUtils * fCrtutils
bool fVerbose
print information about what's going on
uint64_t m_trigger_gate_diff
uint64_t m_gate_start_timestamp
triggerSource
Type of beam or beam gate or other trigger source.
art::InputTag fCRTHitLabel
name of CRT producer
std::map< std::string, TH1F * > hDCA
BEGIN_PROLOG could also be cout
art::InputTag fTriggerLabel
labels for trigger