231 MF_LOG_DEBUG(
"CRTPMTMatching: ") <<
"beginning analyis" <<
'\n';
243 art::Handle<sbn::ExtraTriggerInfo> trigger_handle;
245 if( trigger_handle.isValid() ) {
251 m_trigger_gate_diff = trigger_handle->triggerTimestamp - trigger_handle->beamGateTimestamp;
255 mf::LogError(
"CRTPMTMatching:") <<
"No raw::Trigger associated to label: " <<
fTriggerLabel.label() <<
"\n" ;
264 art::Handle< std::vector<recob::OpHit> > opHitListHandle;
265 std::vector< art::Ptr<recob::OpHit> > opHitList;
267 art::fill_ptr_vector(opHitList, opHitListHandle);
271 map<int, art::Handle< std::vector<recob::OpFlash> > > flashHandles;
272 std::map<int,std::vector< art::Ptr<recob::OpFlash> >> opFlashLists;
274 for(
int i=0; i<2; i++) {
276 art::fill_ptr_vector(opFlashLists[i], flashHandles[i]);
281 art::Handle< std::vector<CRTHit> > crtHitListHandle;
282 std::vector< art::Ptr<CRTHit> > crtHitList;
284 art::fill_ptr_vector(crtHitList, crtHitListHandle);
286 fNCrt = crtHitList.size();
288 for(
auto const&
crt : crtHitList){
289 vector<double> xyzt, xyzerr;
290 TVector3 rcrt(
crt->x_pos,
crt->y_pos,
crt->z_pos);
292 xyzt.push_back(rcrt.X());
293 xyzt.push_back(rcrt.Y());
294 xyzt.push_back(rcrt.Z());
303 xyzt.push_back(tcrt);
306 xyzerr.push_back(
crt->x_err);
307 xyzerr.push_back(
crt->y_err);
308 xyzerr.push_back(
crt->z_err);
316 double tdiff = DBL_MAX, rdiff=DBL_MAX, peflash=DBL_MAX;
319 double flashHitT = DBL_MAX, flashHitPE=DBL_MAX, flashHitDiff=DBL_MAX;
320 vector<double> flashHitxyzt;
322 for(
auto const& flashList : opFlashLists) {
324 art::FindManyP<recob::OpHit> findManyHits(flashHandles[flashList.first],
e,
fFlashLabels[flashList.first]);
326 for(
size_t iflash=0; iflash<flashList.second.size(); iflash++) {
328 auto const& flash = flashList.second[iflash];
333 double tflash = flash->Time();
335 TVector3 rflash(0,flash->YCenter(),flash->ZCenter());
336 TVector3 vdiff = rcrt-rflash;
338 if(
abs(tcrt-tflash)<
abs(tdiff)) {
339 peflash = flash->TotalPE();
343 xyzt.push_back(rflash.X());
344 xyzt.push_back(rflash.Y());
345 xyzt.push_back(rflash.Z());
346 xyzt.push_back(tflash);
348 matchtpc = flashList.first;
350 vector<art::Ptr<recob::OpHit>> hits = findManyHits.at(iflash);
351 for(
auto const&
hit : hits) {
352 double tPmt =
hit->PeakTime();
353 if( tPmt < flashHitT) {
355 flashHitPE =
hit->PE();
359 flashHitxyzt.clear();
360 for(
int i=0; i<3; i++) flashHitxyzt.push_back(pos[i]);
361 flashHitxyzt.push_back(flashHitT);
364 TVector3 rflashHit(pos[0],pos[1],pos[2]);
365 TVector3 vdiffHit = rcrt-rflashHit;
366 flashHitDiff = vdiffHit.Mag();
374 for(
int i=0; i<4; i++) xyzt.push_back(DBL_MAX);
396 for(
auto const&
hit : opHitList) {
397 double thit =
hit->PeakTime();
412 TVector3 rhit (pos[0],pos[1],pos[2]);
413 TVector3 vdiff = rcrt-rhit;
418 for(
int i=0; i<3; i++) xyzt.push_back(pos[i]);
419 xyzt.push_back(thit);
422 std::cout <<
"thit: "<<thit <<
" , tcrt: " << tcrt <<
" , tdiff " << tdiff << std::endl;
430 for(
int i=0; i<4; i++) xyzt.push_back(DBL_MAX);
vector< vector< double > > fTofXYZTFlashHit
uint64_t m_gate_start_timestamp
vector< int > fTofTpcFlash
art::InputTag fOpHitModuleLabel
vector< double > fTofFlash
int fEvent
number of the event being processed
vector< double > fDistFlash
vector< double > fDistFlashHit
vector< bool > fMatchFlash
vector< double > fTofPeFlashHit
map< int, art::InputTag > fFlashLabels
vector< vector< double > > fTofXYZTHit
uint64_t m_trigger_timestamp
int AuxDetRegionNameToNum(string reg)
vector< double > fTofPeHit
std::string bitName(triggerSource bit)
Returns a mnemonic short name of the beam type.
vector< double > fDistHit
vector< vector< double > > fTofXYZTFlash
vector< double > fTofPeFlash
vector< vector< double > > fCrtXYZErr
int fSubRun
number of the sub-run being processed
vector< vector< double > > fCrtXYZT
int fRun
number of the run being processed
vector< double > fTofFlashHit
art::InputTag fTriggerLabel
art::InputTag fCrtHitModuleLabel
static double tdiff(const art::Timestamp &ts1, const art::Timestamp &ts2)
triggerSource
Type of beam or beam gate or other trigger source.
geo::GeometryCore const * fGeometryService
pointer to Geometry provider
uint64_t m_trigger_gate_diff
OpDetGeo const & OpDetGeoFromOpChannel(unsigned int OpChannel) const
Returns the geo::OpDetGeo object for the given channel number.
BEGIN_PROLOG could also be cout