velocity_module.cc
Go to the documentation of this file.
1 //////////////////////////////////////////////////////////////////////////////
2 // Class: velocity ///
3 // File: velocity_module.cc ///
4 //Description: ///
5 //drift velocity calculation module ///
6 //dumps all the infomrmation in TTrees which needs to analysed ///
7 //contact person:apaudel@phys.ksu.edu ///
8 //////////////////////////////////////////////////////////////////////////////
13 #include "art_root_io/TFileService.h"
14 #include "art_root_io/TFileDirectory.h"
16 #include "canvas/Persistency/Common/FindManyP.h"
19 #include "fhiclcpp/ParameterSet.h"
21 #include "dune/Protodune/singlephase/DataUtils/ProtoDUNEDataUtils.h"
23 
33 #include "lardataobj/RawData/raw.h"
57 
58 #include "TFile.h"
59 #include "TTree.h"
60 #include "TDirectory.h"
61 #include "TH1.h"
62 #include "TH2.h"
63 #include "TF1.h"
64 #include "TProfile.h"
65 #include "TROOT.h"
66 #include "TStyle.h"
67 #include "TMath.h"
68 #include "TGraphErrors.h"
69 #include "TMinuit.h"
70 #include "TString.h"
71 #include "TTimeStamp.h"
72 #include "TVectorD.h"
73 #include "TCanvas.h"
74 #include "TFrame.h"
75 #include "TLine.h"
76 #include "TAxis.h"
77 #include "TTimeStamp.h"
78 
79 //Root and C++ include
80 #include "TVector3.h"
81 #include "TLorentzVector.h"
82 #include <vector>
83 #include <fstream>
84 #include "TPaveStats.h"
85 #include <iostream>
86 #include <string>
87 #include "math.h"
88 #include "stdio.h"
89 #include <iterator>
90 
91 //using namespace std;
92 
93 
94 namespace protoana{
95  class velocity : public art::EDAnalyzer {
96  public:
97  explicit velocity(fhicl::ParameterSet const& pset);
98  virtual ~velocity();
99 
100  void beginJob();
101  void endJob();
102  void beginRun(const art::Run& run);
103  void analyze(const art::Event& evt);
104  void reset();
105 
106  private:
108  TTree* fEventTree;
110 
111  //These are the tree variables I will be using
112  Int_t run;
113  Int_t subrun;
114  Int_t event;
115  Double_t evttime;
117  std::vector<float> trackthetaxz;
118  std::vector<float> trackthetayz;
119  std::vector<float> trkstartx;
120  std::vector<float> trkstarty;
121  std::vector<float> trkstartz;
122  std::vector< std::vector<float> > trkstartcosxyz;
123  std::vector< std::vector<float> > trkendcosxyz;
124  std::vector<float> trkendx;
125  std::vector<float> trkendy;
126  std::vector<float> trkendz;
127  std::vector<float> trklen;
128  std::vector<int> TrkID;
129  std::vector<float> xprojectedlen;
130  std::vector<double> T0_values;
131  std::vector<int> tot_trks;
132  std::vector< std::vector<float> > hit_peakT0;
133  std::vector< std::vector<int> > hit_tpc0;
134  std::vector< std::vector<int> > hit_wire0;
135  std::vector< std::vector<int> > hit_channel0;
136  std::vector< std::vector<float> > trkhitx0;
137  std::vector< std::vector<float> > trkhity0;
138  std::vector< std::vector<float> > trkhitz0;
139  std::vector< std::vector<float> > trkdq_amp0;
140  std::vector< std::vector<float> >trkdq_int0;
141  std::vector< std::vector<float> > hit_peakT1;
142  std::vector< std::vector<int> > hit_tpc1;
143  std::vector< std::vector<int> > hit_wire1;
144  std::vector< std::vector<int> > hit_channel1;
145  std::vector< std::vector<float> > trkhitx1;
146  std::vector< std::vector<float> > trkhity1;
147  std::vector< std::vector<float> > trkhitz1;
148  std::vector< std::vector<float> > trkdq_amp1;
149  std::vector< std::vector<float> > trkdq_int1;
150  std::vector< std::vector<float> > hit_peakT2;
151  std::vector< std::vector<int> > hit_tpc2;
152  std::vector< std::vector<int> > hit_wire2;
153  std::vector< std::vector<int> > hit_channel2;
154  std::vector< std::vector<float> > trkhitx2;
155  std::vector< std::vector<float> > trkhity2;
156  std::vector< std::vector<float> > trkhitz2;
157  std::vector< std::vector<float> > trkhitz_wire2;
158  std::vector< std::vector<float> > trkdq_amp2;
159  std::vector< std::vector<float> >trkdq_int2;
160  std::vector< std::vector<float> > trkhittruex0;
161  std::vector< std::vector<float> > trkhittruey0;
162  std::vector< std::vector<float> > trkhittruez0;
163  std::vector< std::vector<float> > trkhittruex1;
164  std::vector< std::vector<float> > trkhittruey1;
165  std::vector< std::vector<float> > trkhittruez1;
166  std::vector< std::vector<float> > trkhittruex2;
167  std::vector< std::vector<float> > trkhittruey2;
168  std::vector< std::vector<float> > trkhittruez2;
174  };
175 
176  //========================================================================
178  EDAnalyzer(pset),
179  fDataUtils (pset.get<fhicl::ParameterSet>("DataUtils")),
180  fHitsModuleLabel (pset.get< std::string >("HitsModuleLabel","") ),
181  fTrackModuleLabel (pset.get< std::string >("TrackModuleLabel","") ),
182  fCalorimetryModuleLabel (pset.get< std::string >("CalorimetryModuleLabel","") ),
183  fSaveTrackInfo (pset.get< bool>("SaveTrackInfo",false)),
184  fSaveCaloInfo (pset.get< bool>("SaveCaloInfo",false))
185 
186  {
187  if (fSaveTrackInfo == false) fSaveCaloInfo = false;
188  }
189 
190  //========================================================================
192  }
193  //========================================================================
194 
195  //========================================================================
197  std::cout<<"job begin..."<<std::endl;
199  fEventTree = tfs->make<TTree>("Event", "Event Tree from Reco");
200  fEventTree->Branch("event", &event,"event/I");
201  fEventTree->Branch("evttime",&evttime,"evttime/D");
202  fEventTree->Branch("run", &run,"run/I");
203  fEventTree->Branch("Nactivefembs",&fNactivefembs,"Nactivefembs[6]/I");
204  fEventTree->Branch("subrun", &subrun,"surbrun/I");
205  fEventTree->Branch("T0_values",&T0_values);
206  fEventTree->Branch("xprojectedlen",&xprojectedlen);
207  fEventTree->Branch("trackthetaxz",&trackthetaxz);
208  fEventTree->Branch("trackthetayz",&trackthetayz);
209  fEventTree->Branch("trkstartx",&trkstartx);
210  fEventTree->Branch("trkstarty",&trkstarty);
211  fEventTree->Branch("trkstartz",&trkstartz);
212  fEventTree->Branch("trkendx",&trkendx);
213  fEventTree->Branch("trkendy",&trkendy);
214  fEventTree->Branch("trkendz",&trkendz);
215  fEventTree->Branch("trklen",&trklen);
216  fEventTree->Branch("TrkID",&TrkID);
217  fEventTree->Branch("tot_trks",&tot_trks);
218  fEventTree->Branch("hit_peakT0",&hit_peakT0);
219  fEventTree->Branch("hit_tpc0",&hit_tpc0);
220  fEventTree->Branch("hit_wire0",&hit_wire0);
221  fEventTree->Branch("hit_channel0",&hit_channel0);
222  fEventTree->Branch("trkhitx0",&trkhitx0);
223  fEventTree->Branch("trkhity0",&trkhity0);
224  fEventTree->Branch("trkhitz0",&trkhitz0);
225  fEventTree->Branch("trkdq_int0",&trkdq_int0);
226  fEventTree->Branch("trkdq_amp0",&trkdq_amp0);
227  fEventTree->Branch("hit_peakT1",&hit_peakT1);
228  fEventTree->Branch("hit_tpc1",&hit_tpc1);
229  fEventTree->Branch("hit_wire1",&hit_wire1);
230  fEventTree->Branch("hit_channel1",&hit_channel1);
231  fEventTree->Branch("trkhitx1",&trkhitx1);
232  fEventTree->Branch("trkhity1",&trkhity1);
233  fEventTree->Branch("trkhitz1",&trkhitz1);
234  fEventTree->Branch("trkdq_int1",&trkdq_int1);
235  fEventTree->Branch("trkdq_amp1",&trkdq_amp1);
236  fEventTree->Branch("hit_peakT2",&hit_peakT2);
237  fEventTree->Branch("hit_tpc2",&hit_tpc2);
238  fEventTree->Branch("hit_wire2",&hit_wire2);
239  fEventTree->Branch("hit_channel2",&hit_channel2);
240  fEventTree->Branch("trkhitx2",&trkhitx2);
241  fEventTree->Branch("trkhity2",&trkhity2);
242  fEventTree->Branch("trkhitz2",&trkhitz2);
243  fEventTree->Branch("trkhitz_wire2",&trkhitz_wire2);
244  fEventTree->Branch("trkdq_int2",&trkdq_int2);
245  fEventTree->Branch("trkdq_amp2",&trkdq_amp2);
246  fEventTree->Branch("trkstartcosxyz",&trkstartcosxyz);
247  fEventTree->Branch("trkendcosxyz",&trkendcosxyz);
248  fEventTree->Branch("trkhittruex0",&trkhittruex0);
249  fEventTree->Branch("trkhittruey0",&trkhittruey0);
250  fEventTree->Branch("trkhittruez0",&trkhittruez0);
251  fEventTree->Branch("trkhittruex1",&trkhittruex1);
252  fEventTree->Branch("trkhittruey1",&trkhittruey1);
253  fEventTree->Branch("trkhittruez1",&trkhittruez1);
254  fEventTree->Branch("trkhittruex2",&trkhittruex2);
255  fEventTree->Branch("trkhittruey2",&trkhittruey2);
256  fEventTree->Branch("trkhittruez2",&trkhittruez2);
257 
258  }
259 
260  //========================================================================
262 
263  }
264 
265  //========================================================================
267  mf::LogInfo("velocity")<<"begin run..."<<std::endl;
268  }
269  //========================================================================
270 
271  //========================================================================
272 
273  //========================================================================
274 
275  void velocity::analyze( const art::Event& evt){//analyze
276  reset();
277 
278  // art::ServiceHandle<cheat::ParticleInventoryService> pi_serv;
281 
282  std::vector<art::Ptr<recob::Track> > tracklist;
283  auto trackListHandle = evt.getHandle< std::vector<recob::Track> >("pandoraTrack");
284  if(trackListHandle){
285  art::fill_ptr_vector(tracklist, trackListHandle);
286  }
287  else return;
288 
289 
290  std::vector<art::Ptr<recob::PFParticle> > pfplist;
291  auto PFPListHandle = evt.getHandle< std::vector<recob::PFParticle> >("pandora");
292  if(PFPListHandle) art::fill_ptr_vector(pfplist, PFPListHandle);
293 
294 
295  // get information about the hits
296  std::vector<art::Ptr<recob::Hit>> hitlist;
297  auto hitListHandle = evt.getHandle< std::vector<recob::Hit> >(fHitsModuleLabel);
298  if(hitListHandle) art::fill_ptr_vector(hitlist, hitListHandle);
299  art::FindManyP<recob::Hit, recob::TrackHitMeta> fmthm(trackListHandle, evt, fTrackModuleLabel); // to associate tracks and hits
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");
303 
304 
305  run = evt.run();
306  subrun = evt.subRun();
307  event = evt.id().event();
308  art::Timestamp ts = evt.time();
309  TTimeStamp tts(ts.timeHigh(), ts.timeLow());
310  evttime=tts.AsDouble();
311 
312 
313 
314  // Get number of active fembs
315  if(!evt.isRealData()){
316  for(int k=0; k < 6; k++)
317  fNactivefembs[k] = 20;
318  }
319  else{
320  for(int k=0; k < 6; k++)
322  }
323 
324 
325  //defining the 1D temporary storage vectors
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;
339 
340  auto const clockData = art::ServiceHandle<detinfo::DetectorClocksService>()->DataFor(evt);
341 
342  float max_value;
343  float min_value;
344  int trks=0;
345  size_t NTracks = tracklist.size();
346  for(size_t i=0; i<NTracks;++i){
347 
348  //clearing the 1D temporary storage vectors
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();
362 
363 
364 
365  art::Ptr<recob::Track> ptrack(trackListHandle, i);
366 
367  ///this block just saves the t0 values while I include entries with no T0s as well also this saves T0 coming from pandroaTrack alg only
368  double t_zero=-999999;
369  max_value=0.0;
370  min_value=0.0;
371  if(fTrackModuleLabel=="pandoraTrack"){
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());
375  // if(!t0s.size()) continue;
376  //auto t0 = t0s.at(0);
377  // double t_zero=t0->Time();
378  if(t0s.size()){
379  auto t0=t0s.at(0);
380  t_zero=t0->Time();
381  }
382  }
383 
384  /*
385  if(fTrackModuleLabel=="pmtrack"){
386  std::vector<art::Ptr<anab::T0>> T0s=fmT0.at(i);
387  if(T0s.size()==0)
388  continue;
389  }
390  */
391  // all_trks++;
392  const recob::Track& track = *ptrack;
393  auto pos = track.Vertex();
394  auto dir_start = track.VertexDirection();
395  auto dir_end = track.EndDirection();
396  auto end = track.End();
397  double theta_xz = std::atan2(dir_start.X(), dir_start.Z());
398  double theta_yz = std::atan2(dir_start.Y(), dir_start.Z());
399 
400  int planenum=999;
401  float xpos=-9999;
402  float ypos=-9999;
403  float zpos=-9999;
404 
405  //hits and calorimetry loop
406  if(fmthm.isValid()){
407  auto vhit=fmthm.at(i);
408  auto vmeta=fmthm.data(i);
409  for (size_t ii = 0; ii<vhit.size(); ++ii){ //loop over all meta data hit
410  bool fBadhit = false;
411  if (vmeta[ii]->Index() == static_cast<unsigned int>(std::numeric_limits<int>::max())){
412  fBadhit = true;
413  //cout<<"fBadHit"<<fBadhit<<endl;
414  continue;
415  }
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!!";
418  }
419  if (!tracklist[i]->HasValidPoint(vmeta[ii]->Index())){
420  fBadhit = true;
421  // cout<<"had valid point "<<fBadhit<<endl;
422  continue;
423  }
424 
425  auto loc = tracklist[i]->LocationAtPoint(vmeta[ii]->Index());
426  xpos=loc.X();
427  ypos=loc.Y();
428  zpos=loc.Z();
429  // cout<<"x, y, z "<<xpos<<" "<<ypos<<" "<<zpos<<endl;
430  // cout<<"BadHit"<<fBadhit<<endl;
431  if (fBadhit) continue; //HY::If BAD hit, skip this hit and go next
432  if (zpos<-100) continue; //hit not on track
433 
434  float truexpos = -9999;
435  float trueypos = -9999;
436  float truezpos = -9999;
437 
438  if (!evt.isRealData()){
439  auto simides = bt_serv->HitToSimIDEs_Ps(clockData, vhit[ii]);
440  std::map<int, float> idemap;
441  for (auto const & ide: simides){
442  idemap[ide->trackID]+=ide->energy;
443  }
444  int trackid = 0;
445  float maxe = -1;
446  for (auto ii = idemap.begin(); ii!=idemap.end(); ++ii){
447  if ((ii->second)>maxe){
448  maxe = ii->second;
449  trackid = ii->first;
450  }
451  }
452  if (trackid){
453  float xavg = 0;
454  float yavg = 0;
455  float zavg = 0;
456  float tote = 0;
457  for (auto const & ide: simides){
458  if (ide->trackID != trackid) continue;
459  tote += ide->energy;
460  xavg += ide->x*ide->energy;
461  yavg += ide->y*ide->energy;
462  zavg += ide->z*ide->energy;
463  }
464  if (tote){
465  truexpos = xavg/tote;
466  trueypos = yavg/tote;
467  truezpos = zavg/tote;
468  }
469  }
470  }
471 
472  planenum=vhit[ii]->WireID().Plane;
473  if(planenum==0){
474  peakT_0.push_back(vhit[ii]->PeakTime());
475  tpc_0.push_back(vhit[ii]->WireID().TPC);
476  wire_0.push_back(vhit[ii]->WireID().Wire);
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);
486  }//planenum 0
487  if(planenum==1){
488  peakT_1.push_back(vhit[ii]->PeakTime());
489  tpc_1.push_back(vhit[ii]->WireID().TPC);
490  wire_1.push_back(vhit[ii]->WireID().Wire);
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);
500  }//planenum 1
501  if(planenum==2){
502  peakT_2.push_back(vhit[ii]->PeakTime());
503  tpc_2.push_back(vhit[ii]->WireID().TPC);
504  wire_2.push_back(vhit[ii]->WireID().Wire);
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);
514  double xyzStart[3];
515  double xyzEnd[3];
516  unsigned int wireno=vhit[ii]->WireID().Wire;
517  fGeometry->WireEndPoints(0,vhit[ii]->WireID().TPC,2,wireno, xyzStart, xyzEnd);
518  hitz_wire2.push_back(xyzStart[2]);
519  //std::cout<<xpos<<" "<<ypos<<" "<<zpos<<" "<<truexpos<<" "<<trueypos<<" "<<truezpos<<std::endl;
520  }//planenum 2
521  }//loop over vhit
522  }//fmthm valid
523  //hits and calorimetry loop
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;
529  trks++;
530  hit_peakT0.push_back(peakT_0);
531  hit_tpc0.push_back(tpc_0);
532  hit_wire0.push_back(wire_0);
533  hit_channel0.push_back(channel_0);
534  trkhitx0.push_back(hitx_0);
535  trkhity0.push_back(hity_0);
536  trkhitz0.push_back(hitz_0);
537  trkhittruex0.push_back(hittruex_0);
538  trkhittruey0.push_back(hittruey_0);
539  trkhittruez0.push_back(hittruez_0);
540  trkdq_amp0.push_back(amp_0);
541  trkdq_int0.push_back(int_0);
542 
543  hit_peakT1.push_back(peakT_1);
544  hit_tpc1.push_back(tpc_1);
545  hit_wire1.push_back(wire_1);
546  hit_channel1.push_back(channel_1);
547  trkhitx1.push_back(hitx_1);
548  trkhity1.push_back(hity_1);
549  trkhitz1.push_back(hitz_1);
550  trkhittruex1.push_back(hittruex_1);
551  trkhittruey1.push_back(hittruey_1);
552  trkhittruez1.push_back(hittruez_1);
553  trkdq_amp1.push_back(amp_1);
554  trkdq_int1.push_back(int_1);
555 
556  hit_peakT2.push_back(peakT_2);
557  hit_tpc2.push_back(tpc_2);
558  hit_wire2.push_back(wire_2);
559  hit_channel2.push_back(channel_2);
560  trkhitx2.push_back(hitx_2);
561  trkhity2.push_back(hity_2);
562  trkhitz2.push_back(hitz_2);
563  trkhittruex2.push_back(hittruex_2);
564  trkhittruey2.push_back(hittruey_2);
565  trkhittruez2.push_back(hittruez_2);
566  trkhitz_wire2.push_back(hitz_wire2);
567  trkdq_amp2.push_back(amp_2);
568  trkdq_int2.push_back(int_2);
569 
570  xprojectedlen.push_back(TMath::Abs(end.X()-pos.X()));
571  trackthetaxz.push_back(theta_xz);
572  trackthetayz.push_back(theta_yz);
573  trkstartx.push_back(pos.X());
574  trkstarty.push_back(pos.Y());
575  trkstartz.push_back(pos.Z());
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());
582 
583  trkstartcosxyz.push_back(startcosxyz);
584  trkendcosxyz.push_back(endcosxyz);
585  trkendx.push_back(end.X());
586  trkendy.push_back(end.Y());
587  trkendz.push_back(end.Z());
588  trklen.push_back(track.Length());
589  TrkID.push_back(track.ID());
590  T0_values.push_back(t_zero);
591  } // loop over trks...
592  tot_trks.push_back(trks);
593  fEventTree->Fill();
594  } // end of analyze function
595 
596  /////////////////// Defintion of reset function ///////////
598  run = -9999;
599  subrun = -9999;
600  event = -9999;
601  evttime = -9999;
602  //all_trks = -9999;
603  for(int k=0; k < 6; k++)
604  fNactivefembs[k] = -9999;
605  trackthetaxz.clear();
606  trackthetayz.clear();
607  trkstartx.clear();
608  trkstarty.clear();
609  trkstartz.clear();
610  trkstartcosxyz.clear();
611  trkendcosxyz.clear();
612  trkendx.clear();
613  trkendy.clear();
614  trkendz.clear();
615  trklen.clear();
616  TrkID.clear();
617  tot_trks.clear();
618  T0_values.clear();
619  xprojectedlen.clear();
620  hit_peakT0.clear();
621  hit_tpc0.clear();
622  hit_wire0.clear();
623  trkhitx0.clear();
624  trkhity0.clear();
625  trkhitz0.clear();
626  trkdq_int0.clear();
627  trkdq_amp0.clear();
628  hit_channel0.clear();
629  hit_peakT1.clear();
630  hit_tpc1.clear();
631  hit_wire1.clear();
632  trkhitx1.clear();
633  trkhity1.clear();
634  trkhitz1.clear();
635  trkdq_int1.clear();
636  trkdq_amp1.clear();
637  hit_channel1.clear();
638  hit_peakT2.clear();
639  hit_tpc2.clear();
640  hit_wire2.clear();
641  trkhitx2.clear();
642  trkhity2.clear();
643  trkhitz2.clear();
644  trkhitz_wire2.clear();
645  trkdq_int2.clear();
646  trkdq_amp2.clear();
647  hit_channel2.clear();
648  trkhittruex0.clear();
649  trkhittruey0.clear();
650  trkhittruez0.clear();
651  trkhittruex1.clear();
652  trkhittruey1.clear();
653  trkhittruez1.clear();
654  trkhittruex2.clear();
655  trkhittruey2.clear();
656  trkhittruez2.clear();
657 
658  }
659  //////////////////////// End of definition ///////////////
660 
662 }
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
Definition: Timestamp.h:29
std::vector< std::vector< int > > hit_channel0
std::vector< int > TrkID
std::vector< std::vector< float > > trkhitz0
std::vector< float > trackthetaxz
std::vector< std::vector< float > > trkhitx0
std::string fHitsModuleLabel
TH3F * xpos
Definition: doAna.cpp:29
Handle< PROD > getHandle(SelectorBase const &) const
Definition: DataViewImpl.h:382
std::string string
Definition: nybbler.cc:12
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
Definition: Timestamp.h:34
velocity(fhicl::ParameterSet const &pset)
std::vector< std::vector< float > > trkhity0
std::vector< std::vector< int > > hit_wire0
Class to keep data related to recob::Hit associated with recob::Track.
Vector_t VertexDirection() const
Definition: Track.h:132
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
STL namespace.
unsigned int Index
std::string fTrackModuleLabel
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.h:25
std::vector< std::vector< float > > hit_peakT1
Particle class.
std::vector< std::vector< float > > trkhittruey0
object containing MC flux information
art framework interface to geometry description
Definition: Run.h:17
TH3F * ypos
Definition: doAna.cpp:30
std::vector< std::vector< int > > hit_channel1
std::vector< std::vector< float > > trkhittruey1
std::vector< std::vector< float > > trkdq_amp0
bool isRealData() const
std::vector< int > tot_trks
std::vector< std::vector< float > > trkdq_int1
std::vector< std::vector< float > > trkhittruez2
TH3F * zpos
Definition: doAna.cpp:31
std::vector< float > trkendx
std::vector< float > xprojectedlen
double Length(size_t p=0) const
Access to various track properties.
Definition: Track.h:167
Timestamp time() const
#define DEFINE_ART_MODULE(klass)
Definition: ModuleMacros.h:67
IDparameter< geo::WireID > WireID
Member type of validated geo::WireID parameter.
std::vector< float > trkstarty
def key(type, name=None)
Definition: graph.py:13
std::vector< std::vector< float > > trkhittruex2
std::vector< double > T0_values
std::vector< std::vector< float > > trkhitx2
Point_t const & Vertex() const
Definition: Track.h:124
std::vector< std::vector< float > > trkendcosxyz
SubRunNumber_t subRun() const
Definition: DataViewImpl.cc:78
std::vector< std::vector< float > > trkhittruez0
RunNumber_t run() const
Definition: DataViewImpl.cc:71
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
int ID() const
Definition: Track.h:198
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
Definition: Track.h:133
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
Definition: EventID.h:116
Point_t const & End() const
Definition: Track.h:125
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
TCEvent evt
Definition: DataStructs.cxx:7
auto const & get(AssnsNode< L, R, D > const &r)
Definition: AssnsNode.h:115
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Definition: Ptr.h:297
void analyze(const art::Event &evt)
std::vector< std::vector< int > > hit_wire1
std::vector< float > trklen
int bool
Definition: qglobal.h:345
std::vector< std::vector< float > > trkdq_amp1
std::vector< std::vector< float > > trkhity1
EventID id() const
Definition: Event.cc:34
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:
Definition: Track.h:49
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
QTextStream & endl(QTextStream &s)
Event finding and building.
std::vector< std::vector< float > > trkhitz2
geo::GeometryCore const * fGeometry