Skip to content

Commit 2b8362d

Browse files
committed
Add a few missing branches
1 parent 5e7f17d commit 2b8362d

1 file changed

Lines changed: 105 additions & 74 deletions

File tree

sbndcode/CRT/CRTAna/CRTTimingAnalysis_module.cc

Lines changed: 105 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -172,80 +172,87 @@ class sbnd::crt::CRTTimingAnalysis : public art::EDAnalyzer {
172172
std::vector<double> _sp_sh_cable_length_ts1_set;
173173
std::vector<double> _sp_sh_calib_offset_ts1_set;
174174

175-
double _tr_start_x;
176-
double _tr_start_y;
177-
double _tr_start_z;
178-
double _tr_end_x;
179-
double _tr_end_y;
180-
double _tr_end_z;
181-
double _tr_dir_x;
182-
double _tr_dir_y;
183-
double _tr_dir_z;
184-
double _tr_ts0;
185-
double _tr_ts0_rwm_ref;
186-
double _tr_ts0_ptb_hlt_beam_gate_ref;
187-
double _tr_ts1;
188-
double _tr_ts1_rwm_ref;
189-
double _tr_ts1_ptb_hlt_beam_gate_ref;
190-
double _tr_pe;
191-
double _tr_length;
192-
double _tr_length_tof;
193-
double _tr_tof_ts0;
194-
double _tr_tof_diff_ts0;
195-
double _tr_tof_ts1;
196-
double _tr_tof_diff_ts1;
197-
double _tr_theta;
198-
double _tr_phi;
199-
bool _tr_triple;
200-
int16_t _tr_tagger1;
201-
int16_t _tr_tagger2;
202-
int16_t _tr_tagger3;
203-
int16_t _tr_start_tagger;
204-
double _tr_start_dts0;
205-
double _tr_start_dts1;
206-
bool _tr_start_single_timing_chain;
207-
int16_t _tr_start_timing_chain;
208-
int16_t _tr_end_tagger;
209-
double _tr_end_dts0;
210-
double _tr_end_dts1;
211-
bool _tr_end_single_timing_chain;
212-
int16_t _tr_end_timing_chain;
213-
214-
bool _tpc_has_corrected_opflash;
215-
bool _tpc_has_crt_sp_match;
216-
double _tpc_opflash_t0;
217-
double _tpc_opflash_nutof_light;
218-
double _tpc_opflash_nutof_charge;
219-
double _tpc_opflash_t0_corrected;
220-
double _tpc_opflash_interaction_time_rwm;
221-
double _tpc_opflash_front_face_rwm;
222-
double _tpc_crt_sp_score;
223-
double _tpc_crt_sp_front_face_adjustment;
224-
double _tpc_crt_sp_interaction_time_adjustment;
225-
double _tpc_crt_sp_ts0;
226-
double _tpc_crt_sp_ts0_rwm_ref;
227-
double _tpc_crt_sp_ts0_ptb_hlt_beam_gate_ref;
228-
double _tpc_crt_sp_ts0_rwm_ref_front_face;
229-
double _tpc_crt_sp_ts0_ptb_hlt_beam_gate_ref_front_face;
230-
double _tpc_crt_sp_ts0_rwm_ref_interaction_time;
231-
double _tpc_crt_sp_ts0_ptb_hlt_beam_gate_ref_interaction_time;
232-
double _tpc_crt_sp_dts0;
233-
double _tpc_crt_sp_ts1;
234-
double _tpc_crt_sp_ts1_rwm_ref;
235-
double _tpc_crt_sp_ts1_ptb_hlt_beam_gate_ref;
236-
double _tpc_crt_sp_ts1_rwm_ref_front_face;
237-
double _tpc_crt_sp_ts1_ptb_hlt_beam_gate_ref_front_face;
238-
double _tpc_crt_sp_ts1_rwm_ref_interaction_time;
239-
double _tpc_crt_sp_ts1_ptb_hlt_beam_gate_ref_interaction_time;
240-
double _tpc_crt_sp_dts1;
241-
double _tpc_crt_ts0_pmt_diff;
242-
double _tpc_crt_ts1_pmt_diff;
175+
double _tr_start_x;
176+
double _tr_start_y;
177+
double _tr_start_z;
178+
double _tr_end_x;
179+
double _tr_end_y;
180+
double _tr_end_z;
181+
double _tr_dir_x;
182+
double _tr_dir_y;
183+
double _tr_dir_z;
184+
double _tr_ts0;
185+
double _tr_ts0_rwm_ref;
186+
double _tr_ts0_ptb_hlt_beam_gate_ref;
187+
double _tr_ts1;
188+
double _tr_ts1_rwm_ref;
189+
double _tr_ts1_ptb_hlt_beam_gate_ref;
190+
double _tr_pe;
191+
double _tr_length;
192+
double _tr_length_tof;
193+
double _tr_tof_ts0;
194+
double _tr_tof_diff_ts0;
195+
double _tr_tof_ts1;
196+
double _tr_tof_diff_ts1;
197+
double _tr_theta;
198+
double _tr_phi;
199+
bool _tr_triple;
200+
int16_t _tr_tagger1;
201+
int16_t _tr_tagger2;
202+
int16_t _tr_tagger3;
203+
int16_t _tr_start_tagger;
204+
uint16_t _tr_start_nhits;
205+
double _tr_start_dts0;
206+
double _tr_start_dts1;
207+
bool _tr_start_single_timing_chain;
208+
int16_t _tr_start_timing_chain;
209+
int16_t _tr_end_tagger;
210+
uint16_t _tr_end_nhits;
211+
double _tr_end_dts0;
212+
double _tr_end_dts1;
213+
bool _tr_end_single_timing_chain;
214+
int16_t _tr_end_timing_chain;
215+
216+
bool _tpc_has_corrected_opflash;
217+
bool _tpc_has_crt_sp_match;
218+
double _tpc_opflash_t0;
219+
double _tpc_opflash_nutof_light;
220+
double _tpc_opflash_nutof_charge;
221+
double _tpc_opflash_t0_corrected;
222+
double _tpc_opflash_interaction_time_rwm;
223+
double _tpc_opflash_front_face_rwm;
224+
double _tpc_crt_sp_score;
225+
int16_t _tpc_crt_sp_tagger;
226+
uint16_t _tpc_crt_sp_nhits;
227+
bool _tpc_crt_sp_single_timing_chain;
228+
int16_t _tpc_crt_sp_timing_chain;
229+
double _tpc_crt_sp_front_face_adjustment;
230+
double _tpc_crt_sp_interaction_time_adjustment;
231+
double _tpc_crt_sp_ts0;
232+
double _tpc_crt_sp_ts0_rwm_ref;
233+
double _tpc_crt_sp_ts0_ptb_hlt_beam_gate_ref;
234+
double _tpc_crt_sp_ts0_rwm_ref_front_face;
235+
double _tpc_crt_sp_ts0_ptb_hlt_beam_gate_ref_front_face;
236+
double _tpc_crt_sp_ts0_rwm_ref_interaction_time;
237+
double _tpc_crt_sp_ts0_ptb_hlt_beam_gate_ref_interaction_time;
238+
double _tpc_crt_sp_dts0;
239+
double _tpc_crt_sp_ts1;
240+
double _tpc_crt_sp_ts1_rwm_ref;
241+
double _tpc_crt_sp_ts1_ptb_hlt_beam_gate_ref;
242+
double _tpc_crt_sp_ts1_rwm_ref_front_face;
243+
double _tpc_crt_sp_ts1_ptb_hlt_beam_gate_ref_front_face;
244+
double _tpc_crt_sp_ts1_rwm_ref_interaction_time;
245+
double _tpc_crt_sp_ts1_ptb_hlt_beam_gate_ref_interaction_time;
246+
double _tpc_crt_sp_dts1;
247+
double _tpc_crt_ts0_pmt_diff;
248+
double _tpc_crt_ts1_pmt_diff;
243249

244250
// Maps
245-
std::map<unsigned int, int16_t> fSPTaggerMap;
246-
std::map<unsigned int, double> fSPdTs0Map;
247-
std::map<unsigned int, double> fSPdTs1Map;
248-
std::map<unsigned int, int16_t> fSPTimingChainMap;
251+
std::map<unsigned int, int16_t> fSPTaggerMap;
252+
std::map<unsigned int, uint16_t> fSPNHitsMap;
253+
std::map<unsigned int, double> fSPdTs0Map;
254+
std::map<unsigned int, double> fSPdTs1Map;
255+
std::map<unsigned int, int16_t> fSPTimingChainMap;
249256
};
250257

251258
sbnd::crt::CRTTimingAnalysis::CRTTimingAnalysis(fhicl::ParameterSet const& p)
@@ -364,11 +371,13 @@ sbnd::crt::CRTTimingAnalysis::CRTTimingAnalysis(fhicl::ParameterSet const& p)
364371
fTrTree->Branch("tr_tagger2", &_tr_tagger2);
365372
fTrTree->Branch("tr_tagger3", &_tr_tagger3);
366373
fTrTree->Branch("tr_start_tagger", &_tr_start_tagger);
374+
fTrTree->Branch("tr_start_nhits", &_tr_start_nhits);
367375
fTrTree->Branch("tr_start_dts0", &_tr_start_dts0);
368376
fTrTree->Branch("tr_start_dts1", &_tr_start_dts1);
369377
fTrTree->Branch("tr_start_single_timing_chain", &_tr_start_single_timing_chain);
370378
fTrTree->Branch("tr_start_timing_chain", &_tr_start_timing_chain);
371379
fTrTree->Branch("tr_end_tagger", &_tr_end_tagger);
380+
fTrTree->Branch("tr_end_nhits", &_tr_end_nhits);
372381
fTrTree->Branch("tr_end_dts0", &_tr_end_dts0);
373382
fTrTree->Branch("tr_end_dts1", &_tr_end_dts1);
374383
fTrTree->Branch("tr_end_single_timing_chain", &_tr_end_single_timing_chain);
@@ -400,6 +409,10 @@ sbnd::crt::CRTTimingAnalysis::CRTTimingAnalysis(fhicl::ParameterSet const& p)
400409
fTPCTree->Branch("tpc_opflash_interaction_time_rwm", &_tpc_opflash_interaction_time_rwm);
401410
fTPCTree->Branch("tpc_opflash_front_face_rwm", &_tpc_opflash_front_face_rwm);
402411
fTPCTree->Branch("tpc_crt_sp_score", &_tpc_crt_sp_score);
412+
fTPCTree->Branch("tpc_crt_sp_tagger", &_tpc_crt_sp_tagger);
413+
fTPCTree->Branch("tpc_crt_sp_nhits", &_tpc_crt_sp_nhits);
414+
fTPCTree->Branch("tpc_crt_sp_single_timing_chain", &_tpc_crt_sp_single_timing_chain);
415+
fTPCTree->Branch("tpc_crt_sp_timing_chain", &_tpc_crt_sp_timing_chain);
403416
fTPCTree->Branch("tpc_crt_sp_front_face_adjustment", &_tpc_crt_sp_front_face_adjustment);
404417
fTPCTree->Branch("tpc_crt_sp_interaction_time_adjustment", &_tpc_crt_sp_interaction_time_adjustment);
405418
fTPCTree->Branch("tpc_crt_sp_ts0", &_tpc_crt_sp_ts0);
@@ -556,6 +569,7 @@ void sbnd::crt::CRTTimingAnalysis::analyze(art::Event const& e)
556569
void sbnd::crt::CRTTimingAnalysis::ResetMaps()
557570
{
558571
fSPTaggerMap.clear();
572+
fSPNHitsMap.clear();
559573
fSPdTs0Map.clear();
560574
fSPdTs1Map.clear();
561575
fSPTimingChainMap.clear();
@@ -779,6 +793,7 @@ void sbnd::crt::CRTTimingAnalysis::AnalyseCRTSpacePoints(const std::vector<art::
779793
fSPTree->Fill();
780794

781795
fSPTaggerMap[sp.key()] = _sp_tagger;
796+
fSPNHitsMap[sp.key()] = _sp_nhits;
782797
fSPdTs0Map[sp.key()] = _sp_dts0;
783798
fSPdTs1Map[sp.key()] = _sp_dts1;
784799
fSPTimingChainMap[sp.key()] = _sp_timing_chain;
@@ -925,11 +940,13 @@ void sbnd::crt::CRTTimingAnalysis::AnalyseCRTTracks(const std::vector<art::Ptr<C
925940
_tr_tof_ts1 = end->Ts1() - start->Ts1();
926941
_tr_tof_diff_ts1 = _tr_tof_ts1 - _tr_length_tof;
927942
_tr_start_tagger = fSPTaggerMap[start.key()];
943+
_tr_start_nhits = fSPNHitsMap[start.key()];
928944
_tr_start_dts0 = fSPdTs0Map[start.key()];
929945
_tr_start_dts1 = fSPdTs1Map[start.key()];
930946
_tr_start_timing_chain = fSPTimingChainMap[start.key()];
931947
_tr_start_single_timing_chain = _tr_start_timing_chain != -1;
932948
_tr_end_tagger = fSPTaggerMap[end.key()];
949+
_tr_end_nhits = fSPNHitsMap[start.key()];
933950
_tr_end_dts0 = fSPdTs0Map[end.key()];
934951
_tr_end_dts1 = fSPdTs1Map[end.key()];
935952
_tr_end_timing_chain = fSPTimingChainMap[end.key()];
@@ -996,6 +1013,10 @@ void sbnd::crt::CRTTimingAnalysis::ResetTrVariables()
9961013
_tr_start_timing_chain = std::numeric_limits<int16_t>::lowest();
9971014
_tr_end_tagger = std::numeric_limits<int16_t>::lowest();
9981015
_tr_end_timing_chain = std::numeric_limits<int16_t>::lowest();
1016+
1017+
_tr_start_nhits = std::numeric_limits<uint16_t>::lowest();
1018+
_tr_end_nhits = std::numeric_limits<uint16_t>::lowest();
1019+
9991020
}
10001021

10011022
void sbnd::crt::CRTTimingAnalysis::AnalyseTPCSlices(const std::vector<art::Ptr<recob::Slice>> &TPCSliceVec,
@@ -1054,6 +1075,10 @@ void sbnd::crt::CRTTimingAnalysis::AnalyseTPCSlices(const std::vector<art::Ptr<r
10541075

10551076
_tpc_has_crt_sp_match = true;
10561077
_tpc_crt_sp_score = spMatch.TriggerConfidence();
1078+
_tpc_crt_sp_tagger = fSPTaggerMap[sp.key()];
1079+
_tpc_crt_sp_nhits = fSPNHitsMap[sp.key()];
1080+
_tpc_crt_sp_timing_chain = fSPTimingChainMap[sp.key()];
1081+
_tpc_crt_sp_single_timing_chain = _tpc_crt_sp_timing_chain != -1;
10571082
_tpc_crt_sp_front_face_adjustment = sp_pos.Z() * fSpeedOfLightNanosecondPerCentimeter;
10581083
_tpc_crt_sp_interaction_time_adjustment = dist * fSpeedOfLightNanosecondPerCentimeter;
10591084
_tpc_crt_sp_ts0 = sp->Ts0();
@@ -1088,8 +1113,9 @@ void sbnd::crt::CRTTimingAnalysis::AnalyseTPCSlices(const std::vector<art::Ptr<r
10881113

10891114
void sbnd::crt::CRTTimingAnalysis::ResetTPCVariables()
10901115
{
1091-
_tpc_has_corrected_opflash = false;
1092-
_tpc_has_crt_sp_match = false;
1116+
_tpc_has_corrected_opflash = false;
1117+
_tpc_has_crt_sp_match = false;
1118+
_tpc_crt_sp_single_timing_chain = false;
10931119

10941120
_tpc_opflash_t0 = std::numeric_limits<double>::lowest();
10951121
_tpc_opflash_nutof_light = std::numeric_limits<double>::lowest();
@@ -1118,6 +1144,11 @@ void sbnd::crt::CRTTimingAnalysis::ResetTPCVariables()
11181144
_tpc_crt_sp_dts1 = std::numeric_limits<double>::lowest();
11191145
_tpc_crt_ts0_pmt_diff = std::numeric_limits<double>::lowest();
11201146
_tpc_crt_ts1_pmt_diff = std::numeric_limits<double>::lowest();
1147+
1148+
_tpc_crt_sp_tagger = std::numeric_limits<int16_t>::lowest();
1149+
_tpc_crt_sp_timing_chain = std::numeric_limits<int16_t>::lowest();
1150+
1151+
_tpc_crt_sp_nhits = std::numeric_limits<uint16_t>::lowest();
11211152
}
11221153

11231154
DEFINE_ART_MODULE(sbnd::crt::CRTTimingAnalysis)

0 commit comments

Comments
 (0)