272 std::vector<art::Ptr<recob::Track> > tracklist;
273 auto trackListHandle = evt.
getHandle< std::vector<recob::Track> >(
"pandoraTrack");
274 if(trackListHandle) {
279 std::vector<art::Ptr<recob::PFParticle> > pfplist;
280 auto PFPListHandle = evt.
getHandle< std::vector<recob::PFParticle> >(
"pandora");
284 std::vector<art::Ptr<recob::Hit>> hitlist;
287 art::FindManyP<recob::Hit, recob::TrackHitMeta> fmthm(trackListHandle, evt,
fTrackModuleLabel);
288 art::FindManyP<anab::T0> trk_t0_assn_v(PFPListHandle, evt ,
"pandora");
289 art::FindManyP<recob::PFParticle> pfp_trk_assn(trackListHandle,evt,
"pandoraTrack");
290 art::FindManyP<anab::T0> fmT0(trackListHandle, evt ,
"pmtrack");
291 std::vector<const sim::SimChannel*> fSimChannels;
293 evt.
getView(
"largeant", fSimChannels);
309 for(
int k=0;
k < 6;
k++)
313 for(
int k=0;
k < 6;
k++)
319 std::vector< float> peakT_0; std::vector< float> peakT_1; std::vector< float> peakT_2;
320 std::vector< int > tpc_0; std::vector< int > tpc_1; std::vector<int> tpc_2;
321 std::vector< int > wire_0; std::vector< int > wire_1; std::vector<int> wire_2;
322 std::vector< float > int_0; std::vector< float > int_1; std::vector<float> int_2;
323 std::vector< float > amp_0; std::vector< float > amp_1; std::vector<float> amp_2;
324 std::vector<float> rms_0; std::vector<float> rms_1; std::vector<float> rms_2;
325 std::vector<float> hitx_0; std::vector<float> hitx_1; std::vector<float> hitx_2;
326 std::vector<float> hity_0; std::vector<float> hity_1; std::vector<float> hity_2;
327 std::vector<float> hitz_0; std::vector<float> hitz_1; std::vector<float> hitz_2;
328 std::vector<float> hitz_wire2; std::vector<float> startcosxyz; std::vector<float> endcosxyz;
329 std::vector<float> dT_buffer; std::vector<float> gof, multi,truerms;
334 size_t NTracks = tracklist.size();
335 for(
size_t i=0; i<NTracks;++i){
338 peakT_0.clear(); peakT_1.clear(); peakT_2.clear();
339 tpc_0.clear(); tpc_1.clear(); tpc_2.clear();
340 wire_0.clear(); wire_1.clear(); wire_2.clear();
341 int_0.clear(); int_1.clear() ; int_2.clear();
342 amp_0.clear(); amp_1.clear() ; amp_2.clear();
343 rms_0.clear(); rms_1.clear(); rms_2.clear();
344 hitx_0.clear(); hitx_1.clear(); hitx_2.clear();
345 hity_0.clear(); hity_1.clear(); hity_2.clear();
346 hitz_0.clear(); hitz_1.clear(); hitz_2.clear();
347 hitz_wire2.clear(); startcosxyz.clear();endcosxyz.clear();
348 dT_buffer.clear(); gof.clear(); multi.clear();
355 double t_zero=-999999;
359 std::vector<art::Ptr<recob::PFParticle>> pfps=pfp_trk_assn.at(i);
360 if(!pfps.size())
continue;
361 std::vector<art::Ptr<anab::T0>> t0s=trk_t0_assn_v.at(pfps[0].
key());
365 if(t0s.size()==0)
continue;
373 std::vector<art::Ptr<anab::T0>> T0s=fmT0.at(i);
383 double theta_xz = std::atan2(dir_start.X(), dir_start.Z());
384 double theta_yz = std::atan2(dir_start.Y(), dir_start.Z());
390 auto allHits=fmthm.at(i);
394 auto vhit=fmthm.at(i);
395 auto vmeta=fmthm.data(i);
396 for (
size_t ii = 0; ii<vhit.size(); ++ii){
397 bool fBadhit =
false;
403 if (vmeta[ii]->
Index()>=tracklist[i]->NumberTrajectoryPoints()){
404 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!!";
406 if (!tracklist[i]->HasValidPoint(vmeta[ii]->
Index())){
412 auto loc = tracklist[i]->LocationAtPoint(vmeta[ii]->
Index());
418 if (fBadhit)
continue;
419 if (zpos<-100)
continue;
420 planenum=vhit[ii]->WireID().Plane;
422 peakT_0.push_back(vhit[ii]->PeakTime());
425 int_0.push_back(vhit[ii]->Integral());
426 amp_0.push_back(vhit[ii]->PeakAmplitude());
427 rms_0.push_back(vhit[ii]->RMS());
428 hitx_0.push_back(xpos);
429 hity_0.push_back(ypos);
430 hitz_0.push_back(zpos);
433 peakT_1.push_back(vhit[ii]->PeakTime());
436 int_1.push_back(vhit[ii]->Integral());
437 amp_1.push_back(vhit[ii]->PeakAmplitude());
438 rms_1.push_back(vhit[ii]->RMS());
439 hitx_1.push_back(xpos);
440 hity_1.push_back(ypos);
441 hitz_1.push_back(zpos);
444 peakT_2.push_back(vhit[ii]->PeakTime());
447 int_2.push_back(vhit[ii]->Integral());
448 amp_2.push_back(vhit[ii]->PeakAmplitude());
449 rms_2.push_back(vhit[ii]->RMS());
450 dT_buffer.push_back(vhit[ii]->EndTick()-vhit[ii]->StartTick());
451 hitx_2.push_back(xpos);
452 hity_2.push_back(ypos);
453 hitz_2.push_back(zpos);
454 gof.push_back(vhit[ii]->GoodnessOfFit());
455 multi.push_back(vhit[ii]->Multiplicity());
458 unsigned int wireno=vhit[ii]->WireID().Wire;
460 hitz_wire2.push_back(xyzStart[2]);
464 unsigned int t0=vhit[ii]->PeakTime()-3*(vhit[ii]->RMS());
466 unsigned int t1=vhit[ii]->PeakTime()+3*(vhit[ii]->RMS());
467 if(t1>6000) t1=6000-1;
471 for(
size_t sc=0;sc<fSimChannels.size();++sc){
472 if(fSimChannels[sc]->Channel()==vhit[ii]->Channel()) chan=fSimChannels[sc];
475 const auto &tdcidemap = chan->
TDCIDEMap();
479 double hit_rmsvalue=0;
480 for(
auto mapitr = tdcidemap.begin(); mapitr != tdcidemap.end(); mapitr++){
481 if(!((*mapitr).first>t0 && (*mapitr).first<=t1))
continue;
484 const std::vector<sim::IDE> idevec = (*mapitr).second;
485 for(
size_t iv = 0; iv < idevec.size(); ++iv){
486 hit_nelec+=idevec[iv].numElectrons;
490 int j=(*mapitr).first;
491 mean_t+=double(j)*double(hit_nelec);
492 double jterm=double(j)*double(j)*double(hit_nelec);
493 mean_t2=mean_t2+jterm;
497 hit_rmsvalue=sqrt(mean_t2-mean_t*mean_t);
499 truermsb=hit_rmsvalue;
502 truerms.push_back(truermsb);
509 if(peakT_2.size()<10)
continue;
510 max_value=*std::max_element(peakT_2.begin(),peakT_2.end());
511 min_value=*std::min_element(peakT_2.begin(),peakT_2.end());
513 std::cout<<max_value<<
" "<<min_value<<
std::endl;
558 startcosxyz.push_back(dir_start.X());
559 startcosxyz.push_back(dir_start.Y());
560 startcosxyz.push_back(dir_start.Z());
561 endcosxyz.push_back(dir_end.X());
562 endcosxyz.push_back(dir_end.Y());
563 endcosxyz.push_back(dir_end.Z());
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
code to link reconstructed objects back to the MC truth information
std::vector< float > trkstarty
std::vector< std::vector< float > > hit_rms0
constexpr std::uint32_t timeLow() const
geo::GeometryCore const * fGeometry
std::vector< std::vector< int > > hit_tpc0
Energy deposited on a readout channel by simulated tracks.
Handle< PROD > getHandle(SelectorBase const &) const
std::vector< std::vector< float > > trkhitz2
std::vector< float > trkendy
std::vector< int > tot_trks
std::vector< std::vector< float > > multiplicity2
std::vector< std::vector< int > > hit_tpc2
std::vector< std::vector< int > > hit_wire0
constexpr std::uint32_t timeHigh() const
std::vector< double > T0_values
std::vector< std::vector< float > > hit_rms2
std::vector< std::vector< float > > trkdq_int2
std::vector< std::vector< float > > hit_peakT1
std::string fTrackModuleLabel
std::vector< std::vector< float > > trkhitx2
Vector_t VertexDirection() const
ProtoDUNEDataUtils fDataUtils
std::vector< std::vector< float > > trkhity0
std::vector< std::vector< float > > trkhitz1
std::vector< std::vector< float > > trkdq_amp0
std::vector< std::vector< float > > hit_peakT0
double Length(size_t p=0) const
Access to various track properties.
IDparameter< geo::WireID > WireID
Member type of validated geo::WireID parameter.
std::vector< std::vector< float > > trkhity2
std::vector< float > trkstartz
std::vector< std::vector< float > > trkdq_amp1
std::vector< float > trackthetaxz
std::string fHitsModuleLabel
Point_t const & Vertex() const
std::vector< std::vector< float > > trkdq_int0
std::vector< std::vector< float > > trkendcosxyz
SubRunNumber_t subRun() const
std::vector< std::vector< float > > trkhity1
std::vector< float > trkstartx
std::vector< float > trkendx
static int max(int a, int b)
std::vector< float > trkendz
std::vector< std::vector< float > > trkhitx0
std::vector< std::vector< float > > hit_peakT2
std::vector< std::vector< int > > hit_wire1
std::vector< std::vector< float > > trkhitz_wire2
std::vector< std::vector< float > > trkdq_int1
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
std::vector< std::vector< float > > trkdq_amp2
std::vector< std::vector< float > > trkhitx1
std::vector< std::vector< int > > hit_wire2
int GetNActiveFembsForAPA(art::Event const &evt, int apa) const
Get number of active fembs in an APA.
std::vector< float > trackthetayz
Vector_t EndDirection() const
std::vector< std::vector< int > > hit_tpc1
std::vector< std::vector< float > > trkhitz0
std::vector< std::vector< float > > hit_deltaT
std::vector< float > trklen
void WireEndPoints(geo::WireID const &wireid, double *xyzStart, double *xyzEnd) const
Fills two arrays with the coordinates of the wire end points.
EventNumber_t event() const
Point_t const & End() const
TDCIDEs_t const & TDCIDEMap() const
Returns all the deposited energy information as stored.
std::size_t getView(std::string const &moduleLabel, std::string const &productInstanceName, std::string const &processName, std::vector< ELEMENT const * > &result) const
std::vector< std::vector< float > > hit_rms1
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
std::vector< std::vector< float > > goodnessoffit2
std::vector< std::vector< float > > hit_rms_true
std::vector< std::vector< float > > trkstartcosxyz
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 > xprojectedlen