298 std::vector<art::Ptr<recob::Track> > tracklist;
299 auto trackListHandle = evt.
getHandle< std::vector<recob::Track> >(
"pandoraTrack");
300 if(trackListHandle) {
305 std::vector<art::Ptr<recob::PFParticle> > pfplist;
306 auto PFPListHandle = evt.
getHandle< std::vector<recob::PFParticle> >(
"pandora");
309 std::vector<art::Ptr<recob::Hit>> hitlist;
312 art::FindManyP<recob::Hit, recob::TrackHitMeta> fmthm(trackListHandle, evt,
fTrackModuleLabel);
313 art::FindManyP<anab::T0> trk_t0_assn_v(PFPListHandle, evt ,
"pandora");
314 art::FindManyP<recob::PFParticle> pfp_trk_assn(trackListHandle,evt,
"pandoraTrack");
315 art::FindManyP<anab::T0> fmT0(trackListHandle, evt ,
"pmtrack");
316 std::vector<const sim::SimChannel*> fSimChannels;
318 evt.
getView(
"largeant", fSimChannels);
323 art::FindManyP<anab::T0> fmt0crt2(trackListHandle, evt,
"crtreco");
324 art::FindManyP<anab::CosmicTag> fmctcrt2(trackListHandle, evt,
"crtreco");
341 for(
int k=0;
k < 6;
k++)
345 for(
int k=0;
k < 6;
k++)
351 std::vector< float> peakT_0; std::vector< float> peakT_1; std::vector< float> peakT_2;
352 std::vector< int > tpc_0; std::vector< int > tpc_1; std::vector<int> tpc_2;
353 std::vector< int > wire_0; std::vector< int > wire_1; std::vector<int> wire_2;
354 std::vector< float > int_0; std::vector< float > int_1; std::vector<float> int_2;
355 std::vector< float > amp_0; std::vector< float > amp_1; std::vector<float> amp_2;
356 std::vector<float> rms_0; std::vector<float> rms_1; std::vector<float> rms_2;
357 std::vector<float> hitx_0; std::vector<float> hitx_1; std::vector<float> hitx_2;
358 std::vector<float> hity_0; std::vector<float> hity_1; std::vector<float> hity_2;
359 std::vector<float> hitz_0; std::vector<float> hitz_1; std::vector<float> hitz_2;
360 std::vector<float> hitz_wire2; std::vector<float> startcosxyz; std::vector<float> endcosxyz;
361 std::vector<float> dT_buffer; std::vector<float> gof, multi,truerms;
366 size_t NTracks = tracklist.size();
367 for(
size_t i=0; i<NTracks;++i){
370 peakT_0.clear(); peakT_1.clear(); peakT_2.clear();
371 tpc_0.clear(); tpc_1.clear(); tpc_2.clear();
372 wire_0.clear(); wire_1.clear(); wire_2.clear();
373 int_0.clear(); int_1.clear() ; int_2.clear();
374 amp_0.clear(); amp_1.clear() ; amp_2.clear();
375 rms_0.clear(); rms_1.clear(); rms_2.clear();
376 hitx_0.clear(); hitx_1.clear(); hitx_2.clear();
377 hity_0.clear(); hity_1.clear(); hity_2.clear();
378 hitz_0.clear(); hitz_1.clear(); hitz_2.clear();
379 hitz_wire2.clear(); startcosxyz.clear();endcosxyz.clear();
380 dT_buffer.clear(); gof.clear(); multi.clear();
387 double t_zero=-999999;
414 double this_t0crt2=-DBL_MAX;
416 double this_crt2x0 = -DBL_MAX;
417 double this_crt2x1 = -DBL_MAX;
418 double this_crt2y0 = -DBL_MAX;
419 double this_crt2y1 = -DBL_MAX;
420 double this_crt2z0 = -DBL_MAX;
421 double this_crt2z1 = -DBL_MAX;
425 if(fmt0crt2.isValid()){
426 auto const& vt0crt2 = fmt0crt2.at(i);
427 if (!vt0crt2.empty()){
428 this_t0crt2 = vt0crt2[0]->Time();
434 if (fmctcrt2.isValid()){
435 auto const& vctcrt2 = fmctcrt2.at(i);
436 if (!vctcrt2.empty()){
437 this_crt2x0 = vctcrt2[0]->EndPoint1()[0];
438 this_crt2x1 = vctcrt2[0]->EndPoint2()[0];
439 this_crt2y0 = vctcrt2[0]->EndPoint1()[1];
440 this_crt2y1 = vctcrt2[0]->EndPoint2()[1];
441 this_crt2z0 = vctcrt2[0]->EndPoint1()[2];
442 this_crt2z1 = vctcrt2[0]->EndPoint2()[2];
466 double theta_xz = std::atan2(dir_start.X(), dir_start.Z());
467 double theta_yz = std::atan2(dir_start.Y(), dir_start.Z());
473 auto allHits=fmthm.at(i);
474 double ticksoffset=0;
477 if (this_t0crt2 > -DBL_MAX) ticksoffset = this_t0crt2/500.+detProp.GetXTicksOffset (allHits[0]->
WireID().
Plane, allHits[0]->
WireID().
TPC, allHits[0]->
WireID().Cryostat);
479 xoffset = detProp.ConvertTicksToX(ticksoffset,allHits[0]->
WireID());
480 std::cout<<
"tickoffset , x offset "<<ticksoffset<<
" "<<xoffset<<
" default term "<<detProp.GetXTicksOffset (allHits[10]->
WireID().
Plane, allHits[10]->
WireID().
TPC, allHits[10]->
WireID().Cryostat)<<
std::endl;
486 auto vhit=fmthm.at(i);
487 auto vmeta=fmthm.data(i);
488 for (
size_t ii = 0; ii<vhit.size(); ++ii){
489 bool fBadhit =
false;
495 if (vmeta[ii]->
Index()>=tracklist[i]->NumberTrajectoryPoints()){
496 throw cet::exception(
"Calorimetry_module.cc") <<
"Requested track trajectory index "<<vmeta[ii]->Index()<<
" exceeds the total number of trajectory points "<<tracklist[i]->NumberTrajectoryPoints()<<
" for track index "<<i<<
". Something is wrong with the track reconstruction. Please contact tjyang@fnal.gov!!";
498 if (!tracklist[i]->HasValidPoint(vmeta[ii]->
Index())){
504 auto loc = tracklist[i]->LocationAtPoint(vmeta[ii]->
Index());
510 if (fBadhit)
continue;
511 if (zpos<-100)
continue;
512 planenum=vhit[ii]->WireID().Plane;
514 peakT_0.push_back(vhit[ii]->PeakTime());
517 int_0.push_back(vhit[ii]->Integral());
518 amp_0.push_back(vhit[ii]->PeakAmplitude());
519 rms_0.push_back(vhit[ii]->RMS());
520 hitx_0.push_back(xpos);
521 hity_0.push_back(ypos);
522 hitz_0.push_back(zpos);
525 peakT_1.push_back(vhit[ii]->PeakTime());
528 int_1.push_back(vhit[ii]->Integral());
529 amp_1.push_back(vhit[ii]->PeakAmplitude());
530 rms_1.push_back(vhit[ii]->RMS());
531 hitx_1.push_back(xpos);
532 hity_1.push_back(ypos);
533 hitz_1.push_back(zpos);
536 peakT_2.push_back(vhit[ii]->PeakTime()-this_t0crt2/500.0);
539 int_2.push_back(vhit[ii]->Integral());
540 amp_2.push_back(vhit[ii]->PeakAmplitude());
541 rms_2.push_back(vhit[ii]->RMS());
542 dT_buffer.push_back(vhit[ii]->EndTick()-vhit[ii]->StartTick());
543 hitx_2.push_back(xpos);
544 hity_2.push_back(ypos);
545 hitz_2.push_back(zpos);
546 gof.push_back(vhit[ii]->GoodnessOfFit());
547 multi.push_back(vhit[ii]->Multiplicity());
550 unsigned int wireno=vhit[ii]->WireID().Wire;
552 hitz_wire2.push_back(xyzStart[2]);
556 unsigned int t0=vhit[ii]->PeakTime()-3*(vhit[ii]->RMS());
558 unsigned int t1=vhit[ii]->PeakTime()+3*(vhit[ii]->RMS());
559 if(t1>6000) t1=6000-1;
563 for(
size_t sc=0;sc<fSimChannels.size();++sc){
564 if(fSimChannels[sc]->Channel()==vhit[ii]->Channel()) chan=fSimChannels[sc];
567 const auto &tdcidemap = chan->
TDCIDEMap();
571 double hit_rmsvalue=0;
572 for(
auto mapitr = tdcidemap.begin(); mapitr != tdcidemap.end(); mapitr++){
573 if(!((*mapitr).first>t0 && (*mapitr).first<=t1))
continue;
576 const std::vector<sim::IDE> idevec = (*mapitr).second;
577 for(
size_t iv = 0; iv < idevec.size(); ++iv){
578 hit_nelec+=idevec[iv].numElectrons;
582 int j=(*mapitr).first;
583 mean_t+=double(j)*double(hit_nelec);
584 double jterm=double(j)*double(j)*double(hit_nelec);
585 mean_t2=mean_t2+jterm;
589 hit_rmsvalue=sqrt(mean_t2-mean_t*mean_t);
591 truermsb=hit_rmsvalue;
594 truerms.push_back(truermsb);
601 if(peakT_2.size()<10)
continue;
602 max_value=*std::max_element(peakT_2.begin(),peakT_2.end());
603 min_value=*std::min_element(peakT_2.begin(),peakT_2.end());
605 std::cout<<max_value<<
" "<<min_value<<
std::endl;
651 startcosxyz.push_back(dir_start.X());
652 startcosxyz.push_back(dir_start.Y());
653 startcosxyz.push_back(dir_start.Z());
654 endcosxyz.push_back(dir_end.X());
655 endcosxyz.push_back(dir_end.Y());
656 endcosxyz.push_back(dir_end.Z());
675 t0crt2.push_back(this_t0crt2/500.0);
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
std::vector< float > trkendz
code to link reconstructed objects back to the MC truth information
std::vector< float > trkstartx
std::vector< float > trkendx
constexpr std::uint32_t timeLow() const
std::vector< double > crt2tickoffset
std::vector< std::vector< float > > trkdq_amp0
std::vector< std::vector< float > > trkdq_int0
Energy deposited on a readout channel by simulated tracks.
std::vector< std::vector< int > > hit_wire1
std::vector< std::vector< float > > trkhity2
Handle< PROD > getHandle(SelectorBase const &) const
std::vector< std::vector< int > > hit_tpc0
std::vector< std::vector< float > > trkhitx1
constexpr std::uint32_t timeHigh() const
std::vector< std::vector< float > > hit_rms_true
std::vector< std::vector< float > > trkhity1
std::vector< float > trkstarty
std::vector< int > tot_trks
std::vector< std::vector< float > > trkhity0
Vector_t VertexDirection() const
std::vector< std::vector< float > > trkstartcosxyz
std::string fTrackModuleLabel
std::vector< std::vector< float > > trkhitz2
std::vector< std::vector< float > > trkhitx0
std::vector< std::vector< float > > hit_peakT2
std::vector< float > trkstartx_crt2
std::vector< std::vector< float > > hit_rms1
std::vector< std::vector< float > > goodnessoffit2
std::vector< std::vector< float > > hit_rms0
std::string fHitsModuleLabel
std::vector< float > crtreco_x1
double Length(size_t p=0) const
Access to various track properties.
IDparameter< geo::WireID > WireID
Member type of validated geo::WireID parameter.
Point_t const & Vertex() const
std::vector< std::vector< float > > trkdq_int1
std::vector< std::vector< float > > trkdq_int2
std::vector< std::vector< float > > hit_deltaT
std::vector< std::vector< float > > hit_peakT1
std::vector< std::vector< float > > trkhitx2
std::vector< float > trackthetayz
std::vector< std::vector< int > > hit_tpc1
SubRunNumber_t subRun() const
std::vector< float > crtreco_z0
static int max(int a, int b)
std::vector< std::vector< float > > trkdq_amp1
std::vector< std::vector< float > > trkhitz_wire2
geo::GeometryCore const * fGeometry
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
std::vector< double > T0_values
std::vector< std::vector< float > > hit_peakT0
std::vector< double > t0crt2
std::vector< float > xprojectedlen
std::vector< std::vector< float > > trkendcosxyz
std::vector< float > crtreco_y1
int GetNActiveFembsForAPA(art::Event const &evt, int apa) const
Get number of active fembs in an APA.
Vector_t EndDirection() const
std::vector< float > trkendy
std::vector< std::vector< float > > trkhitz1
std::vector< float > trackthetaxz
std::vector< float > crtreco_y0
void WireEndPoints(geo::WireID const &wireid, double *xyzStart, double *xyzEnd) const
Fills two arrays with the coordinates of the wire end points.
std::vector< std::vector< int > > hit_wire2
EventNumber_t event() const
Point_t const & End() const
TDCIDEs_t const & TDCIDEMap() const
Returns all the deposited energy information as stored.
ProtoDUNEDataUtils fDataUtils
std::size_t getView(std::string const &moduleLabel, std::string const &productInstanceName, std::string const &processName, std::vector< ELEMENT const * > &result) const
std::vector< float > crtreco_x0
std::vector< std::vector< float > > trkhitz0
std::vector< std::vector< int > > hit_wire0
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
recob::tracking::Plane Plane
std::vector< std::vector< int > > hit_tpc2
std::vector< float > trklen
std::vector< float > trkendx_crt2
std::vector< float > trkstartz
std::vector< std::vector< float > > multiplicity2
std::vector< std::vector< float > > hit_rms2
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a "fitted" track:
cet::coded_exception< error, detail::translate > exception
QTextStream & endl(QTextStream &s)
std::vector< float > crtreco_z1
std::vector< std::vector< float > > trkdq_amp2