@@ -1146,8 +1146,6 @@ void sbnd::crt::CRTAnalysis::AnalyseCRTClusters(const art::Event &e, const std::
11461146 _cl_sp_ets1.resize (nClusters);
11471147 _cl_sp_complete.resize (nClusters);
11481148
1149- art::ServiceHandle<SBND ::CRTChannelMapService> ChannelMapService;
1150-
11511149 for (unsigned i = 0 ; i < nClusters; ++i)
11521150 {
11531151 const auto cluster = CRTClusterVec[i];
@@ -1176,34 +1174,41 @@ void sbnd::crt::CRTAnalysis::AnalyseCRTClusters(const art::Event &e, const std::
11761174 _cl_channel_set[i][ii] = striphit->Channel ();
11771175 _cl_adc_set[i][2 *ii] = striphit->ADC1 ();
11781176 _cl_adc_set[i][2 *ii+1 ] = striphit->ADC2 ();
1179- _cl_sh_ts0_set[i][ii] = striphit->Ts0 ();
1180- _cl_sh_ts1_set[i][ii] = striphit->Ts1 ();
1181- SBND ::CRTChannelMapService::ModuleInfo_t module_info = ChannelMapService->GetModuleInfoFromOfflineID ( striphit->Channel () / 32 );
1182- _cl_sh_feb_mac5_set[i][ii] = ( module_info.valid ) ? module_info.feb_mac5 : 0 ;
1183-
1184- /*
1185- * The below segment reimplements the CorrectTime() method
1186- * from CRTReco/CRTClusterCharacterisationAlg.cc .
1187- * Because the Ts0(), Ts1() getters invoked in _cl_sp_ts*, _cl_sh_ts*_set are raw T0/1
1188- * counters, the time walk and propagation delay are saved as explicit branches here.
1189- */
1190- if (spacepoints.size () == 1 ) { // need unique position of spacepoint
1191- double pe0 = fCRTGeoAlg .GetSiPM ( striphit->Channel () ).gain * striphit->ADC1 ();
1192- double pe1 = fCRTGeoAlg .GetSiPM ( striphit->Channel () + 1 ).gain * striphit->ADC2 ();
1193- double pe = pe0 + pe1;
1194-
1195- double dist = fCRTGeoAlg .DistanceDownStrip ( spacepoints[0 ]->Pos (), striphit->Channel () );
1196-
1197- double corr = std::pow ( dist - fPEAttenuation , 2.0 ) / std::pow ( fPEAttenuation , 2.0 );
1198- double tw_pe = pe * corr;
1199-
1200- _cl_sh_time_walk_set[i][ii] = fTimeWalkNorm * std::exp ( -fTimeWalkScale * tw_pe );
1201- _cl_sh_prop_delay_set[i][ii] = fPropDelay * dist;
1202-
1203- } else { // fill with nonsense
1204- _cl_sh_time_walk_set[i][ii] = -999999 .;
1205- _cl_sh_prop_delay_set[i][ii] = -999999 .;
1206- }
1177+ _cl_sh_ts0_set[i][ii] = striphit->Ts0 ();
1178+ _cl_sh_ts1_set[i][ii] = striphit->Ts1 ();
1179+
1180+ if (fDataMode )
1181+ {
1182+ art::ServiceHandle<SBND ::CRTChannelMapService> ChannelMapService;
1183+ SBND ::CRTChannelMapService::ModuleInfo_t module_info = ChannelMapService->GetModuleInfoFromOfflineID ( striphit->Channel () / 32 );
1184+ _cl_sh_feb_mac5_set[i][ii] = ( module_info.valid ) ? module_info.feb_mac5 : 0 ;
1185+ }
1186+ else
1187+ _cl_sh_feb_mac5_set[i][ii] = striphit->Channel () / 32 ;
1188+
1189+ /*
1190+ * The below segment reimplements the CorrectTime() method
1191+ * from CRTReco/CRTClusterCharacterisationAlg.cc .
1192+ * Because the Ts0(), Ts1() getters invoked in _cl_sp_ts*, _cl_sh_ts*_set are raw T0/1
1193+ * counters, the time walk and propagation delay are saved as explicit branches here.
1194+ */
1195+ if (spacepoints.size () == 1 ) { // need unique position of spacepoint
1196+ double pe0 = fCRTGeoAlg .GetSiPM ( striphit->Channel () ).gain * striphit->ADC1 ();
1197+ double pe1 = fCRTGeoAlg .GetSiPM ( striphit->Channel () + 1 ).gain * striphit->ADC2 ();
1198+ double pe = pe0 + pe1;
1199+
1200+ double dist = fCRTGeoAlg .DistanceDownStrip ( spacepoints[0 ]->Pos (), striphit->Channel () );
1201+
1202+ double corr = std::pow ( dist - fPEAttenuation , 2.0 ) / std::pow ( fPEAttenuation , 2.0 );
1203+ double tw_pe = pe * corr;
1204+
1205+ _cl_sh_time_walk_set[i][ii] = fTimeWalkNorm * std::exp ( -fTimeWalkScale * tw_pe );
1206+ _cl_sh_prop_delay_set[i][ii] = fPropDelay * dist;
1207+
1208+ } else { // fill with nonsense
1209+ _cl_sh_time_walk_set[i][ii] = -999999 .;
1210+ _cl_sh_prop_delay_set[i][ii] = -999999 .;
1211+ }
12071212
12081213 }
12091214
0 commit comments