3737#include " sbnobj/SBND/Timing/DAQTimestamp.hh"
3838
3939#include " sbndcode/Geometry/GeometryWrappers/CRTGeoService.h"
40- #include " sbndcode/Geometry/GeometryWrappers/TPCGeoAlg.h"
4140#include " sbndcode/ChannelMaps/CRT/CRTChannelMapService.h"
4241#include " sbndcode/CRT/CRTBackTracker/CRTBackTrackerAlg.h"
4342#include " sbndcode/CRT/CRTUtils/CRTCommonUtils.h"
4443#include " sbndcode/CRT/CRTUtils/TPCGeoUtil.h"
4544#include " sbndcode/Decoders/PTB/sbndptb.h"
4645#include " sbndcode/Timing/SBNDRawTimingObj.h"
46+ #include " sbndcode/CRT/CRTReco/CRTClusterCharacterisationAlg.h"
4747
4848namespace sbnd ::crt {
4949 class CRTAnalysis ;
@@ -103,16 +103,14 @@ class sbnd::crt::CRTAnalysis : public art::EDAnalyzer {
103103 art::ServiceHandle<CRTGeoService> fCRTGeoService ;
104104 art::ServiceHandle<SBND::CRTChannelMapService> fCRTChannelMapService ;
105105
106- TPCGeoAlg fTPCGeoAlg ;
107- CRTBackTrackerAlg fCRTBackTrackerAlg ;
106+ CRTBackTrackerAlg fCRTBackTrackerAlg ;
107+ CRTClusterCharacterisationAlg fCRTClusterCharacAlg ;
108108
109109 std::string fMCParticleModuleLabel , fSimDepositModuleLabel , fFEBDataModuleLabel , fCRTStripHitModuleLabel ,
110110 fCRTClusterModuleLabel , fCRTSpacePointModuleLabel , fCRTTrackModuleLabel , fCRTBlobModuleLabel , fTPCTrackModuleLabel ,
111111 fCRTSpacePointMatchingModuleLabel , fCRTTrackMatchingModuleLabel , fPFPModuleLabel , fPTBModuleLabel ,
112112 fTDCModuleLabel , fTimingReferenceModuleLabel ;
113113 bool fDebug , fDataMode , fNoTPC , fHasPTB , fHasTDC , fHasBlobs , fTruthMatch ;
114- // ! Adding some of the reco parameters to save corrections
115- double fPEAttenuation , fTimeWalkNorm , fTimeWalkScale , fPropDelay ;
116114
117115 TTree* fTree ;
118116
@@ -197,11 +195,11 @@ class sbnd::crt::CRTAnalysis : public art::EDAnalyzer {
197195 std::vector<uint8_t > _cl_composition;
198196 std::vector<std::vector<uint32_t >> _cl_channel_set;
199197 std::vector<std::vector<uint16_t >> _cl_adc_set;
200- std::vector<std::vector<double >> _cl_sh_ts0_set; // ! To store t0 from x-y coincidences
201- std::vector<std::vector<double >> _cl_sh_ts1_set; // ! To store t1 from x-y coincidences
202- std::vector<std::vector<uint16_t >> _cl_sh_feb_mac5_set; // ! MAC5 addresses of StripHit FEBs
203- std::vector<std::vector<double >> _cl_sh_time_walk_set; // ! Time walk correction
204- std::vector<std::vector<double >> _cl_sh_prop_delay_set; // ! Light propagation correction
198+ std::vector<std::vector<double >> _cl_sh_ts0_set;
199+ std::vector<std::vector<double >> _cl_sh_ts1_set;
200+ std::vector<std::vector<uint16_t >> _cl_sh_feb_mac5_set;
201+ std::vector<std::vector<double >> _cl_sh_time_walk_set;
202+ std::vector<std::vector<double >> _cl_sh_prop_delay_set;
205203 std::vector<int > _cl_truth_trackid;
206204 std::vector<double > _cl_truth_completeness;
207205 std::vector<double > _cl_truth_purity;
@@ -372,6 +370,7 @@ class sbnd::crt::CRTAnalysis : public art::EDAnalyzer {
372370sbnd::crt::CRTAnalysis::CRTAnalysis (fhicl::ParameterSet const & p)
373371 : EDAnalyzer{p}
374372 , fCRTBackTrackerAlg (p.get<fhicl::ParameterSet>(" CRTBackTrackerAlg" , fhicl::ParameterSet()))
373+ , fCRTClusterCharacAlg (p.get<fhicl::ParameterSet>(" CRTClusterCharacterisationAlg" , fhicl::ParameterSet()))
375374{
376375 fMCParticleModuleLabel = p.get <std::string>(" MCParticleModuleLabel" , " largeant" );
377376 fSimDepositModuleLabel = p.get <std::string>(" SimDepositModuleLabel" , " genericcrt" );
@@ -395,10 +394,6 @@ sbnd::crt::CRTAnalysis::CRTAnalysis(fhicl::ParameterSet const& p)
395394 fHasTDC = p.get <bool >(" HasTDC" , false );
396395 fHasBlobs = p.get <bool >(" HasBlobs" , false );
397396 fTruthMatch = p.get <bool >(" TruthMatch" , true );
398- fPEAttenuation = p.get <double >(" PEAttenuation" , 1.0 );
399- fTimeWalkNorm = p.get <double >(" TimeWalkNorm" , 0.0 );
400- fTimeWalkScale = p.get <double >(" TimeWalkScale" , 0.0 );
401- fPropDelay = p.get <double >(" PropDelay" , 0.0 );
402397
403398 if (!fDataMode && fTruthMatch )
404399 fCRTBackTrackerAlg = CRTBackTrackerAlg (p.get <fhicl::ParameterSet>(" CRTBackTrackerAlg" , fhicl::ParameterSet ()));
@@ -1328,25 +1323,10 @@ void sbnd::crt::CRTAnalysis::AnalyseCRTClusters(const art::Event &e, const std::
13281323 _cl_sh_ts1_set[i][ii] = striphit->Ts1 ();
13291324 _cl_sh_feb_mac5_set[i][ii] = fCRTChannelMapService ->GetMAC5FromOfflineChannelID (striphit->Channel ());
13301325
1331- /*
1332- * The below segment reimplements the CorrectTime() method
1333- * from CRTReco/CRTClusterCharacterisationAlg.cc .
1334- * Because the Ts0(), Ts1() getters invoked in _cl_sp_ts*, _cl_sh_ts*_set are raw T0/1
1335- * counters, the time walk and propagation delay are saved as explicit branches here.
1336- */
13371326 if (spacepoints.size () == 1 )
13381327 {
1339- double pe0 = fCRTGeoService ->GetSiPM ( striphit->Channel () ).gain * striphit->ADC1 ();
1340- double pe1 = fCRTGeoService ->GetSiPM ( striphit->Channel () + 1 ).gain * striphit->ADC2 ();
1341- double pe = pe0 + pe1;
1342-
1343- double dist = fCRTGeoService ->DistanceDownStrip ( spacepoints[0 ]->Pos (), striphit->Channel () );
1344-
1345- double corr = std::pow ( dist - fPEAttenuation , 2.0 ) / std::pow ( fPEAttenuation , 2.0 );
1346- double tw_pe = pe * corr;
1347-
1348- _cl_sh_time_walk_set[i][ii] = fTimeWalkNorm * std::exp ( -fTimeWalkScale * tw_pe );
1349- _cl_sh_prop_delay_set[i][ii] = fPropDelay * dist;
1328+ _cl_sh_time_walk_set[i][ii] = fCRTClusterCharacAlg .TimeWalk (striphit, spacepoints[0 ]->Pos ());
1329+ _cl_sh_prop_delay_set[i][ii] = fCRTClusterCharacAlg .PropagationDelay (striphit, spacepoints[0 ]->Pos ());
13501330
13511331 ts0_set.push_back ({_cl_sh_feb_mac5_set[i][ii], _cl_sh_ts0_set[i][ii] - _cl_sh_time_walk_set[i][ii] - _cl_sh_prop_delay_set[i][ii]});
13521332 ts1_set.push_back ({_cl_sh_feb_mac5_set[i][ii], _cl_sh_ts1_set[i][ii] - _cl_sh_time_walk_set[i][ii] - _cl_sh_prop_delay_set[i][ii]});
0 commit comments