13 #include "art_root_io/TFileService.h" 14 #include "art_root_io/TFileDirectory.h" 16 #include "canvas/Persistency/Common/FindManyP.h" 21 #include "dune/Protodune/singlephase/DataUtils/ProtoDUNEDataUtils.h" 60 #include "TDirectory.h" 68 #include "TGraphErrors.h" 71 #include "TTimeStamp.h" 77 #include "TTimeStamp.h" 81 #include "TLorentzVector.h" 84 #include "TPaveStats.h" 199 fEventTree = tfs->make<TTree>(
"Event",
"Event Tree from Reco");
282 std::vector<art::Ptr<recob::Track> > tracklist;
283 auto trackListHandle = evt.
getHandle< std::vector<recob::Track> >(
"pandoraTrack");
290 std::vector<art::Ptr<recob::PFParticle> > pfplist;
291 auto PFPListHandle = evt.
getHandle< std::vector<recob::PFParticle> >(
"pandora");
296 std::vector<art::Ptr<recob::Hit>> hitlist;
299 art::FindManyP<recob::Hit, recob::TrackHitMeta> fmthm(trackListHandle, evt,
fTrackModuleLabel);
300 art::FindManyP<anab::T0> trk_t0_assn_v(PFPListHandle, evt ,
"pandora");
301 art::FindManyP<recob::PFParticle> pfp_trk_assn(trackListHandle,evt,
"pandoraTrack");
302 art::FindManyP<anab::T0> fmT0(trackListHandle, evt ,
"pmtrack");
316 for(
int k=0;
k < 6;
k++)
320 for(
int k=0;
k < 6;
k++)
326 std::vector< float> peakT_0; std::vector< float> peakT_1; std::vector< float> peakT_2;
327 std::vector< int > tpc_0; std::vector< int > tpc_1; std::vector<int> tpc_2;
328 std::vector< int > wire_0; std::vector< int > wire_1; std::vector<int> wire_2;
329 std::vector< float > int_0; std::vector< float > int_1; std::vector<float> int_2;
330 std::vector< float > amp_0; std::vector< float > amp_1; std::vector<float> amp_2;
331 std::vector<int> channel_0; std::vector<int> channel_1; std::vector<int> channel_2;
332 std::vector<float> hitx_0; std::vector<float> hitx_1; std::vector<float> hitx_2;
333 std::vector<float> hity_0; std::vector<float> hity_1; std::vector<float> hity_2;
334 std::vector<float> hitz_0; std::vector<float> hitz_1; std::vector<float> hitz_2;
335 std::vector<float> hittruex_0; std::vector<float> hittruex_1; std::vector<float> hittruex_2;
336 std::vector<float> hittruey_0; std::vector<float> hittruey_1; std::vector<float> hittruey_2;
337 std::vector<float> hittruez_0; std::vector<float> hittruez_1; std::vector<float> hittruez_2;
338 std::vector<float> hitz_wire2; std::vector<float> startcosxyz; std::vector<float> endcosxyz;
345 size_t NTracks = tracklist.size();
346 for(
size_t i=0; i<NTracks;++i){
349 peakT_0.clear(); peakT_1.clear(); peakT_2.clear();
350 tpc_0.clear(); tpc_1.clear(); tpc_2.clear();
351 wire_0.clear(); wire_1.clear(); wire_2.clear();
352 int_0.clear(); int_1.clear() ; int_2.clear();
353 amp_0.clear(); amp_1.clear() ; amp_2.clear();
354 channel_0.clear(); channel_1.clear(); channel_2.clear();
355 hitx_0.clear(); hitx_1.clear(); hitx_2.clear();
356 hity_0.clear(); hity_1.clear(); hity_2.clear();
357 hitz_0.clear(); hitz_1.clear(); hitz_2.clear();
358 hittruex_0.clear(); hittruey_0.clear(); hittruez_0.clear();
359 hittruex_1.clear(); hittruey_1.clear(); hittruez_1.clear();
360 hittruex_2.clear(); hittruey_2.clear(); hittruez_2.clear();
361 hitz_wire2.clear(); startcosxyz.clear();endcosxyz.clear();
368 double t_zero=-999999;
372 std::vector<art::Ptr<recob::PFParticle>> pfps=pfp_trk_assn.at(i);
373 if(!pfps.size())
continue;
374 std::vector<art::Ptr<anab::T0>> t0s=trk_t0_assn_v.at(pfps[0].
key());
397 double theta_xz = std::atan2(dir_start.X(), dir_start.Z());
398 double theta_yz = std::atan2(dir_start.Y(), dir_start.Z());
407 auto vhit=fmthm.at(i);
408 auto vmeta=fmthm.data(i);
409 for (
size_t ii = 0; ii<vhit.size(); ++ii){
410 bool fBadhit =
false;
416 if (vmeta[ii]->
Index()>=tracklist[i]->NumberTrajectoryPoints()){
417 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!!";
419 if (!tracklist[i]->HasValidPoint(vmeta[ii]->
Index())){
425 auto loc = tracklist[i]->LocationAtPoint(vmeta[ii]->
Index());
431 if (fBadhit)
continue;
432 if (zpos<-100)
continue;
434 float truexpos = -9999;
435 float trueypos = -9999;
436 float truezpos = -9999;
440 std::map<int, float> idemap;
441 for (
auto const & ide: simides){
442 idemap[ide->trackID]+=ide->energy;
446 for (
auto ii = idemap.begin(); ii!=idemap.end(); ++ii){
447 if ((ii->second)>maxe){
457 for (
auto const & ide: simides){
458 if (ide->trackID != trackid)
continue;
460 xavg += ide->x*ide->energy;
461 yavg += ide->y*ide->energy;
462 zavg += ide->z*ide->energy;
465 truexpos = xavg/tote;
466 trueypos = yavg/tote;
467 truezpos = zavg/tote;
472 planenum=vhit[ii]->WireID().Plane;
474 peakT_0.push_back(vhit[ii]->PeakTime());
477 int_0.push_back(vhit[ii]->Integral());
478 amp_0.push_back(vhit[ii]->PeakAmplitude());
479 channel_0.push_back(vhit[ii]->Channel());
480 hitx_0.push_back(xpos);
481 hity_0.push_back(ypos);
482 hitz_0.push_back(zpos);
483 hittruex_0.push_back(truexpos);
484 hittruey_0.push_back(trueypos);
485 hittruez_0.push_back(truezpos);
488 peakT_1.push_back(vhit[ii]->PeakTime());
491 int_1.push_back(vhit[ii]->Integral());
492 amp_1.push_back(vhit[ii]->PeakAmplitude());
493 channel_1.push_back(vhit[ii]->Channel());
494 hitx_1.push_back(xpos);
495 hity_1.push_back(ypos);
496 hitz_1.push_back(zpos);
497 hittruex_1.push_back(truexpos);
498 hittruey_1.push_back(trueypos);
499 hittruez_1.push_back(truezpos);
502 peakT_2.push_back(vhit[ii]->PeakTime());
505 int_2.push_back(vhit[ii]->Integral());
506 amp_2.push_back(vhit[ii]->PeakAmplitude());
507 channel_2.push_back(vhit[ii]->Channel());
508 hitx_2.push_back(xpos);
509 hity_2.push_back(ypos);
510 hitz_2.push_back(zpos);
511 hittruex_2.push_back(truexpos);
512 hittruey_2.push_back(trueypos);
513 hittruez_2.push_back(truezpos);
516 unsigned int wireno=vhit[ii]->WireID().Wire;
518 hitz_wire2.push_back(xyzStart[2]);
524 if(peakT_2.size()<20)
continue;
525 max_value=*std::max_element(peakT_2.begin(),peakT_2.end());
526 min_value=*std::min_element(peakT_2.begin(),peakT_2.end());
527 if(max_value-min_value<4300)
continue;
528 std::cout<<max_value<<
" "<<min_value<<
std::endl;
576 startcosxyz.push_back(dir_start.X());
577 startcosxyz.push_back(dir_start.Y());
578 startcosxyz.push_back(dir_start.Z());
579 endcosxyz.push_back(dir_end.X());
580 endcosxyz.push_back(dir_end.Y());
581 endcosxyz.push_back(dir_end.Z());
603 for(
int k=0;
k < 6;
k++)
std::vector< float > trkstartx
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
std::vector< std::vector< int > > hit_tpc1
code to link reconstructed objects back to the MC truth information
std::vector< std::vector< int > > hit_tpc2
constexpr std::uint32_t timeLow() const
std::vector< std::vector< int > > hit_channel0
std::vector< std::vector< float > > trkhitz0
std::vector< float > trackthetaxz
std::vector< std::vector< float > > trkhitx0
std::string fHitsModuleLabel
Handle< PROD > getHandle(SelectorBase const &) const
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
std::vector< std::vector< float > > hit_peakT2
std::vector< std::vector< float > > trkhittruez1
ProtoDUNEDataUtils fDataUtils
constexpr std::uint32_t timeHigh() const
velocity(fhicl::ParameterSet const &pset)
std::vector< std::vector< float > > trkhity0
std::vector< std::vector< int > > hit_wire0
Vector_t VertexDirection() const
std::vector< std::vector< float > > trkhittruex0
std::vector< std::vector< int > > hit_wire2
std::vector< std::vector< int > > hit_tpc0
std::vector< std::vector< float > > trkhitz_wire2
std::vector< std::vector< float > > trkhitx1
std::string fTrackModuleLabel
EDAnalyzer(fhicl::ParameterSet const &pset)
std::vector< std::vector< float > > hit_peakT1
std::vector< std::vector< float > > trkhittruey0
object containing MC flux information
art framework interface to geometry description
std::vector< std::vector< int > > hit_channel1
std::vector< std::vector< float > > trkhittruey1
std::vector< std::vector< float > > trkdq_amp0
std::vector< int > tot_trks
std::vector< std::vector< float > > trkdq_int1
std::vector< std::vector< float > > trkhittruez2
std::vector< float > trkendx
std::vector< float > xprojectedlen
double Length(size_t p=0) const
Access to various track properties.
#define DEFINE_ART_MODULE(klass)
IDparameter< geo::WireID > WireID
Member type of validated geo::WireID parameter.
std::vector< float > trkstarty
std::vector< std::vector< float > > trkhittruex2
std::vector< double > T0_values
std::vector< std::vector< float > > trkhitx2
Point_t const & Vertex() const
std::vector< std::vector< float > > trkendcosxyz
SubRunNumber_t subRun() const
std::vector< std::vector< float > > trkhittruez0
static int max(int a, int b)
Description of geometry of one entire detector.
std::vector< std::vector< float > > trkdq_amp2
std::vector< std::vector< float > > trkhittruex1
Definition of data types for geometry description.
std::vector< std::vector< float > > trkdq_int2
std::vector< std::vector< float > > trkhity2
std::vector< float > trkendz
Declaration of signal hit object.
std::vector< std::vector< float > > trkstartcosxyz
int GetNActiveFembsForAPA(art::Event const &evt, int apa) const
Get number of active fembs in an APA.
std::string fCalorimetryModuleLabel
Vector_t EndDirection() const
std::vector< float > trackthetayz
std::vector< std::vector< float > > hit_peakT0
Provides recob::Track data product.
std::vector< std::vector< float > > trkhittruey2
void WireEndPoints(geo::WireID const &wireid, double *xyzStart, double *xyzEnd) const
Fills two arrays with the coordinates of the wire end points.
std::vector< float > trkstartz
EventNumber_t event() const
Point_t const & End() const
Declaration of basic channel signal object.
void beginRun(const art::Run &run)
std::vector< std::vector< float > > trkhitz1
std::vector< const sim::IDE * > HitToSimIDEs_Ps(detinfo::DetectorClocksData const &clockData, recob::Hit const &hit) const
std::vector< std::vector< float > > trkdq_int0
std::vector< std::vector< int > > hit_channel2
auto const & get(AssnsNode< L, R, D > const &r)
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
void analyze(const art::Event &evt)
std::vector< std::vector< int > > hit_wire1
std::vector< float > trklen
std::vector< std::vector< float > > trkdq_amp1
std::vector< std::vector< float > > trkhity1
std::vector< float > trkendy
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)
Event finding and building.
std::vector< std::vector< float > > trkhitz2
geo::GeometryCore const * fGeometry