3333#include " sbnobj/SBND/CRT/CRTCluster.hh"
3434#include " sbnobj/SBND/CRT/CRTSpacePoint.hh"
3535#include " sbnobj/SBND/CRT/CRTTrack.hh"
36+ #include " sbnobj/SBND/CRT/CRTBlob.hh"
3637#include " sbnobj/SBND/Timing/DAQTimestamp.hh"
3738
3839#include " sbndcode/Geometry/GeometryWrappers/CRTGeoService.h"
@@ -87,6 +88,8 @@ class sbnd::crt::CRTAnalysis : public art::EDAnalyzer {
8788 void AnalyseCRTTracks (const art::Event &e, const std::vector<art::Ptr<CRTTrack>> &CRTTrackVec, const art::FindManyP<CRTSpacePoint> &tracksToSpacePoints,
8889 const art::FindOneP<CRTCluster> &spacePointsToClusters, const art::FindManyP<CRTStripHit> &clustersToStripHits);
8990
91+ void AnalyseCRTBlobs (std::vector<art::Ptr<CRTBlob>> &CRTBlobVec);
92+
9093 void AnalyseTPCMatching (const art::Event &e, const art::Handle<std::vector<recob::Track>> &TPCTrackHandle,
9194 const art::Handle<std::vector<CRTSpacePoint>> &CRTSpacePointHandle, const art::Handle<std::vector<CRTCluster>> &CRTClusterHandle,
9295 const art::Handle<std::vector<recob::PFParticle>> &PFPHandle,
@@ -104,10 +107,10 @@ class sbnd::crt::CRTAnalysis : public art::EDAnalyzer {
104107 CRTBackTrackerAlg fCRTBackTrackerAlg ;
105108
106109 std::string fMCParticleModuleLabel , fSimDepositModuleLabel , fFEBDataModuleLabel , fCRTStripHitModuleLabel ,
107- fCRTClusterModuleLabel , fCRTSpacePointModuleLabel , fCRTTrackModuleLabel , fTPCTrackModuleLabel ,
110+ fCRTClusterModuleLabel , fCRTSpacePointModuleLabel , fCRTTrackModuleLabel , fCRTBlobModuleLabel , fTPCTrackModuleLabel ,
108111 fCRTSpacePointMatchingModuleLabel , fCRTTrackMatchingModuleLabel , fPFPModuleLabel , fPTBModuleLabel ,
109112 fTDCModuleLabel , fTimingReferenceModuleLabel ;
110- bool fDebug , fDataMode , fNoTPC , fHasPTB , fHasTDC , fTruthMatch ;
113+ bool fDebug , fDataMode , fNoTPC , fHasPTB , fHasTDC , fHasBlobs , fTruthMatch ;
111114 // ! Adding some of the reco parameters to save corrections
112115 double fPEAttenuation , fTimeWalkNorm , fTimeWalkScale , fPropDelay ;
113116
@@ -296,6 +299,16 @@ class sbnd::crt::CRTAnalysis : public art::EDAnalyzer {
296299 std::vector<double > _tr_truth_theta;
297300 std::vector<double > _tr_truth_phi;
298301
302+ // crt blob information
303+ std::vector<double > _bl_ts0;
304+ std::vector<double > _bl_ets0;
305+ std::vector<double > _bl_ts1;
306+ std::vector<double > _bl_ets1;
307+ std::vector<double > _bl_pe;
308+ std::vector<int > _bl_nsps;
309+ std::vector<std::vector<int >> _bl_nsps_per_tagger;
310+
311+ // tpc track information (including crt matching)
299312 std::vector<double > _tpc_start_x;
300313 std::vector<double > _tpc_start_y;
301314 std::vector<double > _tpc_start_z;
@@ -341,12 +354,14 @@ class sbnd::crt::CRTAnalysis : public art::EDAnalyzer {
341354 std::vector<double > _tpc_tr_end_z;
342355 std::vector<double > _tpc_tr_score;
343356
357+ // ptb information (trigger board)
344358 std::vector<uint64_t > _ptb_hlt_trigger;
345359 std::vector<uint64_t > _ptb_hlt_timestamp;
346360
347361 std::vector<uint64_t > _ptb_llt_trigger;
348362 std::vector<uint64_t > _ptb_llt_timestamp;
349363
364+ // spec tdc information (timing board)
350365 std::vector<uint32_t > _tdc_channel;
351366 std::vector<uint64_t > _tdc_timestamp;
352367 std::vector<uint64_t > _tdc_offset;
@@ -364,6 +379,7 @@ sbnd::crt::CRTAnalysis::CRTAnalysis(fhicl::ParameterSet const& p)
364379 fCRTClusterModuleLabel = p.get <std::string>(" CRTClusterModuleLabel" , " crtclustering" );
365380 fCRTSpacePointModuleLabel = p.get <std::string>(" CRTSpacePointModuleLabel" , " crtspacepoints" );
366381 fCRTTrackModuleLabel = p.get <std::string>(" CRTTrackModuleLabel" , " crttracks" );
382+ fCRTBlobModuleLabel = p.get <std::string>(" CRTBlobModuleLabel" , " crtblobs" );
367383 fTPCTrackModuleLabel = p.get <std::string>(" TPCTrackModuleLabel" , " pandoraSCETrack" );
368384 fCRTSpacePointMatchingModuleLabel = p.get <std::string>(" CRTSpacePointMatchingModuleLabel" , " crtspacepointmatchingSCE" );
369385 fCRTTrackMatchingModuleLabel = p.get <std::string>(" CRTTrackMatchingModuleLabel" , " crttrackmatchingSCE" );
@@ -376,8 +392,8 @@ sbnd::crt::CRTAnalysis::CRTAnalysis(fhicl::ParameterSet const& p)
376392 fNoTPC = p.get <bool >(" NoTPC" , false );
377393 fHasPTB = p.get <bool >(" HasPTB" , false );
378394 fHasTDC = p.get <bool >(" HasTDC" , false );
395+ fHasBlobs = p.get <bool >(" HasBlobs" , false );
379396 fTruthMatch = p.get <bool >(" TruthMatch" , true );
380- // ! Adding some of the reco parameters to save corrections
381397 fPEAttenuation = p.get <double >(" PEAttenuation" , 1.0 );
382398 fTimeWalkNorm = p.get <double >(" TimeWalkNorm" , 0.0 );
383399 fTimeWalkScale = p.get <double >(" TimeWalkScale" , 0.0 );
@@ -578,6 +594,17 @@ sbnd::crt::CRTAnalysis::CRTAnalysis(fhicl::ParameterSet const& p)
578594 fTree ->Branch (" tr_truth_phi" , " std::vector<double>" , &_tr_truth_phi);
579595 }
580596
597+ if (fHasBlobs )
598+ {
599+ fTree ->Branch (" bl_ts0" , " std::vector<double>" , &_bl_ts0);
600+ fTree ->Branch (" bl_ets0" , " std::vector<double>" , &_bl_ets0);
601+ fTree ->Branch (" bl_ts1" , " std::vector<double>" , &_bl_ts1);
602+ fTree ->Branch (" bl_ets1" , " std::vector<double>" , &_bl_ets1);
603+ fTree ->Branch (" bl_pe" , " std::vector<double>" , &_bl_pe);
604+ fTree ->Branch (" bl_nsps" , " std::vector<int>" , &_bl_nsps);
605+ fTree ->Branch (" bl_nsps_per_tagger" , " std::vector<std::vector<int>>" , &_bl_nsps_per_tagger);
606+ }
607+
581608 if (!fNoTPC )
582609 {
583610 fTree ->Branch (" tpc_start_x" , " std::vector<double>" , &_tpc_start_x);
@@ -835,6 +862,23 @@ void sbnd::crt::CRTAnalysis::analyze(art::Event const& e)
835862 // Fill CRTTrack variables
836863 AnalyseCRTTracks (e, CRTTrackVec, tracksToSpacePoints, spacepointsToClusters, clustersToStripHits);
837864
865+ if (fHasBlobs )
866+ {
867+ // Get CRTBlobs
868+ art::Handle<std::vector<CRTBlob>> CRTBlobHandle;
869+ e.getByLabel (fCRTBlobModuleLabel , CRTBlobHandle);
870+ if (!CRTBlobHandle.isValid ()){
871+ std::cout << " CRTBlob product " << fCRTBlobModuleLabel << " not found..." << std::endl;
872+ throw std::exception ();
873+ }
874+
875+ std::vector<art::Ptr<CRTBlob>> CRTBlobVec;
876+ art::fill_ptr_vector (CRTBlobVec, CRTBlobHandle);
877+
878+ // Fill CRTBlob variables
879+ AnalyseCRTBlobs (CRTBlobVec);
880+ }
881+
838882 if (fNoTPC )
839883 {
840884 // Fill the Tree
@@ -1585,6 +1629,34 @@ void sbnd::crt::CRTAnalysis::AnalyseCRTTracks(const art::Event &e, const std::ve
15851629 }
15861630}
15871631
1632+ void sbnd::crt::CRTAnalysis::AnalyseCRTBlobs (std::vector<art::Ptr<CRTBlob>> &CRTBlobVec)
1633+ {
1634+ const unsigned nBlobs = CRTBlobVec.size ();
1635+
1636+ _bl_ts0.resize (nBlobs);
1637+ _bl_ets0.resize (nBlobs);
1638+ _bl_ts1.resize (nBlobs);
1639+ _bl_ets1.resize (nBlobs);
1640+ _bl_pe.resize (nBlobs);
1641+ _bl_nsps.resize (nBlobs);
1642+ _bl_nsps_per_tagger.resize (nBlobs, std::vector<int >(7 ));
1643+
1644+ for (unsigned i = 0 ; i < nBlobs; ++i)
1645+ {
1646+ const auto blob = CRTBlobVec[i];
1647+
1648+ _bl_ts0[i] = blob->Ts0 ();
1649+ _bl_ets0[i] = blob->Ts0Err ();
1650+ _bl_ts1[i] = blob->Ts1 ();
1651+ _bl_ets1[i] = blob->Ts1Err ();
1652+ _bl_pe[i] = blob->PE ();
1653+ _bl_nsps[i] = blob->TotalSpacePoints ();
1654+
1655+ for (unsigned j = 0 ; j < 7 ; ++j)
1656+ _bl_nsps_per_tagger[i][j] = blob->SpacePointsInTagger ((CRTTagger)j);
1657+ }
1658+ }
1659+
15881660void sbnd::crt::CRTAnalysis::AnalyseTPCMatching (const art::Event &e, const art::Handle<std::vector<recob::Track>> &TPCTrackHandle,
15891661 const art::Handle<std::vector<CRTSpacePoint>> &CRTSpacePointHandle, const art::Handle<std::vector<CRTCluster>> &CRTClusterHandle,
15901662 const art::Handle<std::vector<recob::PFParticle>> &PFPHandle,
0 commit comments