michelremoving_module.cc
Go to the documentation of this file.
5 #include "art_root_io/TFileService.h"
6 #include "art_root_io/TFileDirectory.h"
8 #include "canvas/Persistency/Common/FindManyP.h"
11 #include "fhiclcpp/ParameterSet.h"
13 
14 
24 #include "lardataobj/RawData/raw.h"
47 
48 #include "TFile.h"
49 #include "TTree.h"
50 #include "TDirectory.h"
51 #include "TH1.h"
52 #include "TH2.h"
53 #include "TF1.h"
54 #include "TProfile.h"
55 #include "TROOT.h"
56 #include "TStyle.h"
57 #include "TMath.h"
58 #include "TGraphErrors.h"
59 #include "TMinuit.h"
60 #include "TString.h"
61 #include "TTimeStamp.h"
62 #include "TVectorD.h"
63 #include "TCanvas.h"
64 #include "TFrame.h"
65 #include "TLine.h"
66 #include "TAxis.h"
67 #include "TTimeStamp.h"
68 
69 #include <vector>
70 #include <fstream>
71 #include "TPaveStats.h"
72 #include <iostream>
73 #include <string>
74 #include "math.h"
75 #include "stdio.h"
76 #include <iterator>
77 
78 const int kMaxTracks = 30;
79 
80 using namespace std;
81 
82 namespace dune{
83 
85  public:
86 
87  explicit michelremoving(fhicl::ParameterSet const& pset);
88  virtual ~michelremoving();
89 
90  void beginJob();
91  void endJob();
92  void beginRun(const art::Run& run);
93  void analyze(const art::Event& evt);
94  void reset();
95 
96  private:
97  TTree* fEventTree;
98  Int_t run;
99  Int_t subrun;
100  Int_t event;
101  Double_t evttime;
104  Int_t cross_trks; //are the total number of good T0 tagged tracks stopping + crossing
106  Int_t all_trks;
107  Int_t unbroken_trks; //these are unbroken stopping tracks
108  Float_t trackthetaxz[kMaxTracks];
109  Float_t trackthetayz[kMaxTracks];
110  Float_t trkstartx[kMaxTracks];
111  Float_t trkstarty[kMaxTracks];
112  Float_t trkstartz[kMaxTracks];
113  Float_t trkendx[kMaxTracks];
114  Float_t trkendy[kMaxTracks];
115  Float_t trkendz[kMaxTracks];
116  Float_t trklen[kMaxTracks];
117  Int_t TrkID[kMaxTracks];
118  Float_t trkstartcosxyz[kMaxTracks][3];
119  Float_t trkendcosxyz[kMaxTracks][3];
120  Int_t ntrkhits[kMaxTracks][3];
121  Float_t trkdqdx[kMaxTracks][3][3000];
122  Float_t trkdedx[kMaxTracks][3][3000];
123  Float_t trkresrange[kMaxTracks][3][3000];
124  Float_t trkhitx[kMaxTracks][3][3000];
125  Float_t trkhity[kMaxTracks][3][3000];
126  Float_t trkhitz[kMaxTracks][3][3000];
127  Float_t trkpitch[kMaxTracks][3][3000];
128  Float_t peakT_max[kMaxTracks];
129  Float_t peakT_min[kMaxTracks];
130  Float_t dist_min[kMaxTracks];
131  Int_t adjacent_hits[kMaxTracks];
132  Int_t lastwire[kMaxTracks];
133  Int_t endtpc[kMaxTracks];
134  Float_t lastpeakt[kMaxTracks];
140  };
141 
142  //========================================================================
143  michelremoving::michelremoving(fhicl::ParameterSet const& pset) :
144  EDAnalyzer(pset),
145  fHitsModuleLabel (pset.get< std::string >("HitsModuleLabel","") ),
146  fTrackModuleLabel (pset.get< std::string >("TrackModuleLabel","") ),
147  fCalorimetryModuleLabel (pset.get< std::string >("CalorimetryModuleLabel","") ),
148  fSaveCaloInfo (pset.get< bool>("SaveCaloInfo",false)),
149  fSaveTrackInfo (pset.get< bool>("SaveTrackInfo",false))
150  {
151  if (fSaveTrackInfo == false) fSaveCaloInfo = false;
152  }
153 
154  //========================================================================
156  }
157  //========================================================================
158 
159  //========================================================================
161  std::cout<<"job begin..."<<std::endl;
163  fEventTree = tfs->make<TTree>("Event", "Event Tree from Reco");
164  fEventTree->Branch("event", &event,"event/I");
165  fEventTree->Branch("evttime",&evttime,"evttime/D");
166  fEventTree->Branch("run", &run,"run/I");
167  fEventTree->Branch("subrun", &subrun,"surbrun/I");
168  fEventTree->Branch("year_month_date", &year_month_date,"year_month_date/I");
169  fEventTree->Branch("hour_min_sec", &hour_min_sec,"hour_min_sec/I");
170  fEventTree->Branch("cross_trks",&cross_trks,"cross_trks/I");
171  fEventTree->Branch("stopping_trks",&stopping_trks,"stopping_trks/I");
172  fEventTree->Branch("all_trks",&all_trks,"all_trks/I");
173  fEventTree->Branch("unbroken_trks",&unbroken_trks,"unbroken_trks/I");
174  fEventTree->Branch("trackthetaxz",trackthetaxz,"trackthetaxz[cross_trks]/F");
175  fEventTree->Branch("trackthetayz",trackthetayz,"trackthetayz[cross_trks]/F");
176  fEventTree->Branch("trkstartx",trkstartx,"trkstartx[cross_trks]/F");
177  fEventTree->Branch("trkstarty",trkstarty,"trkstarty[cross_trks]/F");
178  fEventTree->Branch("trkstartz",trkstartz,"trkstartz[cross_trks]/F");
179  fEventTree->Branch("trkendx",trkendx,"trkendx[cross_trks]/F");
180  fEventTree->Branch("trkendy",trkendy,"trkendy[cross_trks]/F");
181  fEventTree->Branch("trkendz",trkendz,"trkendz[cross_trks]/F");
182  fEventTree->Branch("trklen",trklen,"trklen[cross_trks]/F");
183  fEventTree->Branch("peakT_max",peakT_max,"peakT_max[cross_trks]/F");
184  fEventTree->Branch("peakT_min",peakT_min,"peakT_min[cross_trks]/F");
185  fEventTree->Branch("TrkID",TrkID,"TrkID[cross_trks]/I");
186  fEventTree->Branch("trkstartcosxyz",trkstartcosxyz,"trkstartcosxyz[cross_trks][3]/F");
187  fEventTree->Branch("trkendcosxyz",trkendcosxyz,"trkendcosxyz[cross_trks][3]/F");
188  fEventTree->Branch("ntrkhits",ntrkhits,"ntrkhits[cross_trks][3]/I");
189  fEventTree->Branch("trkdqdx",trkdqdx,"trkdqdx[cross_trks][3][3000]/F");
190  fEventTree->Branch("trkdedx",trkdedx,"trkdedx[cross_trks][3][3000]/F");
191  fEventTree->Branch("trkresrange",trkresrange,"trkresrange[cross_trks][3][3000]/F");
192  fEventTree->Branch("trkhitx",trkhitx,"trkhitx[cross_trks][3][3000]/F");
193  fEventTree->Branch("trkhity",trkhity,"trkhity[cross_trks][3][3000]/F");
194  fEventTree->Branch("trkhitz",trkhitz,"trkhitz[cross_trks][3][3000]/F");
195  fEventTree->Branch("trkpitch",trkpitch,"trkpitch[cross_trks][3][3000]/F");
196  fEventTree->Branch("dist_min",dist_min,"dist_min[cross_trks]/F");
197  fEventTree->Branch("adjacent_hits",adjacent_hits,"adjacent_hits[cross_trks]/I");
198  fEventTree->Branch("lastwire",lastwire,"lastwire[cross_trks]/I");
199  fEventTree->Branch("lastpeakt",lastpeakt,"lastpeakt[cross_trks]/F");
200  fEventTree->Branch("endtpc",endtpc,"endtpc[cross_trks]/I");
201 
202  }
203 
204  //========================================================================
206 
207  }
208 
209  //========================================================================
211  mf::LogInfo("michelremoving")<<"begin run..."<<std::endl;
212  }
213  //========================================================================
214 
215  //========================================================================
216 
217  //========================================================================
218 
220  reset();
221  std::vector<art::Ptr<recob::Track> > tracklist;
222  auto trackListHandle = evt.getHandle< std::vector<recob::Track> >("pandoraTrack");
223  if (trackListHandle){
224  art::fill_ptr_vector(tracklist, trackListHandle);
225  }
226  else return;
227 
228  std::vector<art::Ptr<recob::PFParticle> > pfplist;
229  auto PFPListHandle = evt.getHandle< std::vector<recob::PFParticle> >("pandora");
230  if (PFPListHandle) art::fill_ptr_vector(pfplist, PFPListHandle);
231 
232  /******new lines*************************/
233  std::vector<art::Ptr<recob::Hit>> hitlist;
234  auto hitListHandle = evt.getHandle< std::vector<recob::Hit> >(fHitsModuleLabel) ; // to get information about the hits
235  if (hitListHandle) art::fill_ptr_vector(hitlist, hitListHandle);
236 
237  art::FindManyP<recob::Hit, recob::TrackHitMeta> fmthm(trackListHandle, evt, fTrackModuleLabel); // to associate tracks and hits
238 
239  art::FindManyP<recob::Hit> fmtht(trackListHandle, evt, fTrackModuleLabel); // to associate tracks and hits
240  // art::FindManyP<recob::Track, recob::TrackHitMeta> thass(hitListHandle, evt, fTrackModuleLabel); //to associate hit
241  art::FindManyP<recob::Track> thass(hitListHandle, evt, fTrackModuleLabel); //to associate hit just trying
242 
243  art::FindManyP<anab::Calorimetry> fmcal(trackListHandle, evt, fCalorimetryModuleLabel);
244  if (!fmcal.isValid()){
245  std::cout<<"art::Assns<recob::Track,anab::Calorimetry,void> with module label: "<<fCalorimetryModuleLabel<<" not found."<<std::endl;
246  return;
247  }
248 
249  art::FindManyP<anab::T0> trk_t0_assn_v(PFPListHandle, evt ,"pandora");
250 
251 
252  art::FindManyP<recob::PFParticle> pfp_trk_assn(trackListHandle,evt,"pandoraTrack");
253  art::FindManyP<anab::T0> fmT0(trackListHandle, evt ,"pmtrack");
254 
255 
256  run = evt.run();
257  subrun = evt.subRun();
258  event = evt.id().event();
259  art::Timestamp ts = evt.time();
260  TTimeStamp tts(ts.timeHigh(), ts.timeLow());
261  evttime=tts.AsDouble();
262 
263  UInt_t year=0;
264  UInt_t month=0;
265  UInt_t day=0;
266 
267  year_month_date=tts.GetDate(kTRUE,0,&year,&month,&day);
268 
269  UInt_t hour=0;
270  UInt_t min=0;
271  UInt_t sec=0;
272 
273  hour_min_sec=tts.GetTime(kTRUE,0,&hour,&min,&sec);
274 
275  cross_trks=0;
276  stopping_trks=0;
277  all_trks=0;
278  unbroken_trks=0;
279  // size_t NHits=hitlist.size();
280  size_t NTracks = tracklist.size();
281  for(size_t i=0; i<NTracks;++i){
282  art::Ptr<recob::Track> ptrack(trackListHandle, i);
283  if(fTrackModuleLabel=="pandoraTrack"){
284  std::vector<art::Ptr<recob::PFParticle>> pfps=pfp_trk_assn.at(i);
285  if(!pfps.size()) continue;
286  std::vector<art::Ptr<anab::T0>> t0s=trk_t0_assn_v.at(pfps[0].key());
287  if(!t0s.size()) continue;
288  //auto t0 = t0s.at(0);
289  // double t_zero=t0->Time();
290  }
291 
292 
293 
294 
295  if(fTrackModuleLabel=="pmtrack"){
296  std::vector<art::Ptr<anab::T0>> T0s=fmT0.at(i);
297  if(T0s.size()==0)
298  continue;
299  }
300  all_trks++;
301  std::vector<art::Ptr<anab::Calorimetry>> calos=fmcal.at(i);
302  const recob::Track& track = *ptrack;
303  //TVector3 pos, dir_start, dir_end, end;
304  auto pos = track.Vertex();
305  auto dir_start = track.VertexDirection();
306  auto dir_end = track.EndDirection();
307  auto end = track.End();
308  double theta_xz = std::atan2(dir_start.X(), dir_start.Z());
309  double theta_yz = std::atan2(dir_start.Y(), dir_start.Z());
310  float startx=pos.X();
311  float starty=pos.Y();
312  float startz=pos.Z();
313  float endx=end.X();
314  float endy=end.Y();
315  float endz=end.Z();
316 
317  float startcosx=dir_start.X();
318  float startcosy=dir_start.Y();
319  float startcosz=dir_start.Z();
320  float endcosx=dir_end.X();
321  float endcosy=dir_end.Y();
322  float endcosz=dir_end.Z();
323  float tracklength=track.Length();
324  size_t count = 0;
325  /********************************************************************************************************/
326 
327  /*********************storing hits for each tracks*******************************/
328 
329  std::vector<art::Ptr<recob::Hit>> allHits=fmtht.at(i); //storing hits for ith track
330  std::vector<float> hitpeakT;
331  for(size_t h1=0;h1<allHits.size();h1++){
332  hitpeakT.push_back(allHits[h1]->PeakTime());
333  // if(allHits[h1]->WireID().Plane==2 && allHits[h1]->PeakTime()>420 && allHits[h1]->PeakTime()<530 && allHits[h1]->WireID().TPC==9 && allHits[h1]->WireID().Wire>60 && allHits[h1]->WireID().Wire<80) cout<<"wire id and peak time from allHits this is from track hit association "<<allHits[h1]->WireID().Wire<<" "<<allHits[h1]->PeakTime()<<endl;
334  }
335  float max=-999999;
336  float min=-999999;
337  min=*min_element(hitpeakT.begin(),hitpeakT.end());
338  max=*max_element(hitpeakT.begin(),hitpeakT.end());
339  hitpeakT.clear();
340 
341  float dist0=99999;
342  float dist=99999;
343  float peaktime=-1;
344  int wireno=99999;
345  int counter1=99999;
346  int tpcno=-1;
347 
348  if(((std::abs(pos.X())>330 || pos.Y()<50 || pos.Y()>550 || pos.Z()<50 || pos.Z()>645) && !(std::abs(end.X())>330 || end.Y()<50 || end.Y()>550 || end.Z()<50 || end.Z()>645))||(!(std::abs(pos.X())>330 || pos.Y()<50 || pos.Y()>550 || pos.Z()<50 || pos.Z()>645) && (std::abs(end.X())>330 || end.Y()<50 || end.Y()>550 || end.Z()<50 || end.Z()>645))){
349  stopping_trks++; //these are total stopping tracks, could be broken as well
350 
351  /**********************************broken tracks removal**************************************************************************************/
352  for(size_t k=0;k<NTracks;++k){
353  art::Ptr<recob::Track> ptrack_k(trackListHandle, k);
354  const recob::Track& track_k = *ptrack_k;
355  // TVector3 pos_k, dir_pos_k, dir_end_k, end_k;
356  auto pos_k = track_k.Vertex();
357  auto dir_pos_k= track_k.VertexDirection();
358  auto dir_end_k = track_k.EndDirection();
359  auto end_k = track_k.End();
360  if(k==i) continue;
361  if((std::abs(((end_k.Y()-pos_k.Y())/(end_k.Z()-pos_k.Z()))*(endz-pos_k.Z())+pos_k.Y()-endy)<30||std::abs(((end_k.Y()-pos_k.Y())/(end_k.Z()-pos_k.Z()))*(startz-pos_k.Z())+pos_k.Y()-starty)<30)&&(std::abs(endcosx*dir_pos_k.X()+endcosy*dir_pos_k.Y()+endcosz*dir_pos_k.Z())>0.97||std::abs(startcosx*dir_pos_k.X()+startcosy*dir_pos_k.Y()+startcosz*dir_pos_k.Z())>0.97||std::abs(endcosx*dir_end_k.X()+endcosy*dir_end_k.Y()+endcosz*dir_end_k.Z())>0.97||std::abs(startcosx*dir_end_k.X()+startcosy*dir_end_k.Y()+startcosz*dir_end_k.Z())>0.97)) break;
362  if((std::abs(((end_k.Y()-pos_k.Y())/(end_k.Z()-pos_k.Z()))*(endz-pos_k.Z())+pos_k.Y()-endy)<50||std::abs(((end_k.Y()-pos_k.Y())/(end_k.Z()-pos_k.Z()))*(startz-pos_k.Z())+pos_k.Y()-starty)<50)&&(std::abs(endcosx*dir_pos_k.X()+endcosy*dir_pos_k.Y()+endcosz*dir_pos_k.Z())>0.998||std::abs(startcosx*dir_pos_k.X()+startcosy*dir_pos_k.Y()+startcosz*dir_pos_k.Z())>0.998||std::abs(endcosx*dir_end_k.X()+endcosy*dir_end_k.Y()+endcosz*dir_end_k.Z())>0.998||std::abs(startcosx*dir_end_k.X()+startcosy*dir_end_k.Y()+startcosz*dir_end_k.Z())>0.998)) break;
363  count++;
364  }
365 
366  if(!(count==NTracks-1)|| tracklength<100) continue;
367  unbroken_trks++;
368  //*******************************new stuff*****************************//
369 
370  std::vector<int> wirenos;
371  std::vector<float> peakts;
372 
373 
374 
375  int planenum1=999;
376  float xpos=-9999;
377  float ypos=-9999;
378  float zpos=-9999;
379  if(fmthm.isValid()){
380  auto vhit=fmthm.at(i);
381  auto vmeta=fmthm.data(i);
382  for (size_t ii = 0; ii<vhit.size(); ++ii){ //loop over all meta data hit
383  bool fBadhit = false;
384  if (vmeta[ii]->Index() == static_cast<unsigned int>(std::numeric_limits<int>::max())){
385  fBadhit = true;
386 
387  continue;
388  }
389  if (vmeta[ii]->Index()>=tracklist[i]->NumberTrajectoryPoints()){
390  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!!";
391  }
392  if (!tracklist[i]->HasValidPoint(vmeta[ii]->Index())){
393  fBadhit = true;
394  continue;
395  }
396  // TVector3 loc = tracklist[i]->LocationAtPoint(vmeta[ii]->Index());
397  auto loc = tracklist[i]->LocationAtPoint(vmeta[ii]->Index());
398 
399  xpos=loc.X();
400  ypos=loc.Y();
401  zpos=loc.Z();
402  if (fBadhit) continue; //HY::If BAD hit, skip this hit and go next
403  if (zpos<-100) continue; //hit not on track
404  planenum1=vhit[ii]->WireID().Plane;
405  if(planenum1==2){
406  if(starty<endy) dist=sqrt(pow(xpos-startx,2)+pow(ypos-starty,2)+pow(zpos-startz,2));
407  if(starty>endy) dist=sqrt(pow(xpos-endx,2)+pow(ypos-endy,2)+pow(zpos-endz,2));
408  //if(vhit[ii]->WireID().Plane==2 && vhit[ii]->PeakTime()>420 && vhit[ii]->PeakTime()<530 && vhit[ii]->WireID().TPC==9 && vhit[ii]->WireID().Wire>60 && vhit[ii]->WireID().Wire<80){
409  //cout<<"wire_no and peak time from metadata"<<vhit[ii]->WireID().Wire<<" "<<vhit[ii]->PeakTime()<<endl;
410 
411  wirenos.push_back(vhit[ii]->WireID().Wire);
412  peakts.push_back(vhit[ii]->PeakTime());
413  // }
414 
415  if(dist<dist0){
416  dist0=dist;
417  wireno=vhit[ii]->WireID().Wire;
418  peaktime=vhit[ii]->PeakTime();
419  tpcno=vhit[ii]->WireID().TPC;
420  }
421  }
422  }//loop over vhit
423  }//fmthm valid
424  /*************************************filling the values****************************/
425  counter1=0;
426  // bool test=false;
427  for(size_t hitl=0;hitl<hitlist.size();hitl++){
428  auto & tracks = thass.at(hitlist[hitl].key());
429  //auto & vmeta = thass.data(hitlist[hitl].key());
430  //if (!tracks.empty()&&tracks[0].key() == ptrack.key()&&vmeta[0]->Index()!=static_cast<unsigned int>(std::numeric_limits<int>::max())) continue;
431  //if (!tracks.empty()&&tracks[0].key() == ptrack.key()&&hitlist[hitl]->WireID().Plane==2)
432  //if(!(hitlist[hitl]->WireID().Plane==2 && tracks[0].key() != ptrack.key() && hitlist[hitl]->PeakTime()>420 && hitlist[hitl]->PeakTime()<530 && hitlist[hitl]->WireID().TPC==9 && hitlist[hitl]->WireID().Wire>60 && hitlist[hitl]->WireID().Wire<80)) continue;
433  //cout<<"wire no and peak time from hit to track association...................."<<hitlist[hitl]->WireID().Wire<<" "<<hitlist[hitl]->PeakTime()<<endl;
434  if (!tracks.empty() && tracks[0].key()!=ptrack.key() && tracklist[tracks[0].key()]->Length()>100) continue;
435  bool test=true;
436  float peakth1=hitlist[hitl]->PeakTime();
437  int wireh1=hitlist[hitl]->WireID().Wire;
438  for(size_t m=0;m<wirenos.size();m++){
439  if(wireh1==wirenos[m] && peakth1==peakts[m]){
440  test=false;
441  break;
442  }
443  }
444  if(!test) continue;
445 
446  int planeid=hitlist[hitl]->WireID().Plane;
447  int tpcid=hitlist[hitl]->WireID().TPC;
448  if(abs(wireh1-wireno)<6 && abs(peakth1-peaktime)<50 && planeid==2 && tpcid==tpcno){
449  counter1++;
450  }
451  }
452  // for(size_t t=0;t<peakts.size();t++) cout<<"wire numbers and peak times in the vector "<<wirenos[t]<<" "<<peakts[t]<<endl;
453 
454  wirenos.clear();
455  peakts.clear();
456 
457 
458  cout<<"no of hits closeby "<<counter1<<" "<<"event "<<event<<" TrkackID "<<track.ID()<<" startx, y, z "<<startx<<" "<<starty<<" "<<startz<<" wireno, peakt tpcno "<<wireno<<" "<<peaktime<<" "<<tpcno<<" dist "<<dist0<<"min T, max_T"<<min<<" "<<max<<endl;
459  }
460 
461 
462  cross_trks++; // these are good tracks unbroken
463  dist_min[cross_trks-1]=dist0;
464  adjacent_hits[cross_trks-1]=counter1;
465  lastwire[cross_trks-1]=wireno;
466  lastpeakt[cross_trks-1]=peaktime;
467  endtpc[cross_trks-1]=tpcno;
468 
469 
470 
471  trackthetaxz[cross_trks-1]=theta_xz;
472  trackthetayz[cross_trks-1]=theta_yz;
473  trkstartx[cross_trks-1]=pos.X();
474  trkstarty[cross_trks-1]=pos.Y();
475  trkstartz[cross_trks-1]=pos.Z();
476  trkendx[cross_trks-1]=end.X();
477  trkendy[cross_trks-1]=end.Y();
478  trkendz[cross_trks-1]=end.Z();
479  trklen[cross_trks-1]=track.Length();
480  TrkID[cross_trks-1]=track.ID();
483  trkstartcosxyz[cross_trks-1][0]=dir_start.X();
484  trkstartcosxyz[cross_trks-1][1]=dir_start.Y();
485  trkstartcosxyz[cross_trks-1][2]=dir_start.Z();
486  trkendcosxyz[cross_trks-1][0]=dir_end.X();
487  trkendcosxyz[cross_trks-1][1]=dir_end.Y();
488  trkendcosxyz[cross_trks-1][2]=dir_end.Z();
489  for(size_t ical = 0; ical<calos.size(); ++ical){
490  if(!calos[ical]) continue;
491  if(!calos[ical]->PlaneID().isValid) continue;
492  int planenum = calos[ical]->PlaneID().Plane;
493  if(planenum<0||planenum>2) continue;
494  const size_t NHits = calos[ical] -> dEdx().size();
495  ntrkhits[cross_trks-1][planenum]=int(NHits);
496  for(size_t iHit = 0; iHit < NHits; ++iHit){
497  const auto& TrkPos = (calos[ical] -> XYZ())[iHit];
498  trkdqdx[cross_trks-1][planenum][iHit]=(calos[ical] -> dQdx())[iHit];
499  trkdedx[cross_trks-1][planenum][iHit]=(calos[ical] -> dEdx())[iHit];
500  trkresrange[cross_trks-1][planenum][iHit]=(calos[ical]->ResidualRange())[iHit];
501  trkhitx[cross_trks-1][planenum][iHit]=TrkPos.X();
502  trkhity[cross_trks-1][planenum][iHit]=TrkPos.Y();
503  trkhitz[cross_trks-1][planenum][iHit]=TrkPos.Z();
504  trkpitch[cross_trks-1][planenum][iHit]=(calos[ical]->TrkPitchVec())[iHit];
505  } // loop over iHit..
506  } // loop over ical 2nd time...
507 
508 
509  } // loop over trks...
510 
511  fEventTree->Fill();
512  } // end of analyze function
513 
514  /////////////////// Defintion of reset function ///////////
516  run = -99999;
517  subrun = -99999;
518  event = -99999;
519  evttime = -99999;
520  cross_trks = -99999;
521  //all_trks = -99999;
522  //unbroken_trks=-99999;
523  year_month_date=-99999;
524  hour_min_sec=-99999;
525  for(int i=0; i<kMaxTracks; i++){
526  trackthetaxz[i]=-99999;
527  trackthetayz[i]=-99999;
528  trkstartx[i]=-99999;
529  trkstarty[i]=-99999;
530  trkstartz[i]=-99999;
531  trkendx[i]=-99999;
532  trkendy[i]=-99999;
533  trkendz[i]=-99999;
534  trklen[i]=-99999;
535  TrkID[i]=-99999;
536 
537  dist_min[i]=-1;
538  adjacent_hits[i]=-1;
539  lastwire[i]=-1;
540  lastpeakt[i]=-1;
541  endtpc[i]=-1;
542  peakT_max[i]=-99999;
543  peakT_min[i]=-99999;
544  trkstartcosxyz[i][0]=-99999;
545  trkstartcosxyz[i][1]=-99999;
546  trkstartcosxyz[i][2]=-99999;
547  trkendcosxyz[i][0]=-99999;
548  trkendcosxyz[i][1]=-99999;
549  trkendcosxyz[i][2]=-99999;
550  ntrkhits[i][0] = -99999;
551  ntrkhits[i][1] = -99999;
552  ntrkhits[i][2] = -99999;
553  for(int j=0; j<3; j++){
554  for(int k=0; k<3000; k++){
555  trkdqdx[i][j][k]=-99999;
556  trkdedx[i][j][k]=-99999;
557  trkresrange[i][j][k]=-99999;
558  trkhitx[i][j][k]=-99999;
559  trkhity[i][j][k]=-99999;
560  trkhitz[i][j][k]=-99999;
561  trkpitch[i][j][k]=-99999;
562  }
563  }
564  }
565  }
566  //////////////////////// End of definition ///////////////
567 
569 }
570 
571 
def analyze(root, level, gtrees, gbranches, doprint)
Definition: rootstat.py:69
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
Float_t lastpeakt[kMaxTracks]
constexpr std::uint32_t timeLow() const
Definition: Timestamp.h:29
Float_t trkhity[kMaxTracks][3][3000]
Float_t trkstartx[kMaxTracks]
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
Float_t trkhitx[kMaxTracks][3][3000]
constexpr std::uint32_t timeHigh() const
Definition: Timestamp.h:34
constexpr T pow(T x)
Definition: pow.h:72
Float_t trkstartcosxyz[kMaxTracks][3]
Float_t trkendcosxyz[kMaxTracks][3]
Class to keep data related to recob::Hit associated with recob::Track.
Vector_t VertexDirection() const
Definition: Track.h:132
STL namespace.
Float_t trkendx[kMaxTracks]
unsigned int Index
void beginRun(const art::Run &run)
Particle class.
Float_t trkdqdx[kMaxTracks][3][3000]
object containing MC flux information
art framework interface to geometry description
Definition: Run.h:17
TH3F * ypos
Definition: doAna.cpp:30
Float_t trkstarty[kMaxTracks]
const int kMaxTracks
Float_t trackthetayz[kMaxTracks]
T abs(T value)
Float_t trackthetaxz[kMaxTracks]
Float_t trkresrange[kMaxTracks][3][3000]
QTextStream & reset(QTextStream &s)
double dEdx(float dqdx, float Efield)
Definition: doAna.cpp:21
TH3F * zpos
Definition: doAna.cpp:31
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.
void beginJob()
Definition: Breakpoints.cc:14
def key(type, name=None)
Definition: graph.py:13
Float_t peakT_max[kMaxTracks]
Int_t ntrkhits[kMaxTracks][3]
key_type key() const noexcept
Definition: Ptr.h:216
Point_t const & Vertex() const
Definition: Track.h:124
Float_t dist_min[kMaxTracks]
SubRunNumber_t subRun() const
Definition: DataViewImpl.cc:78
Float_t peakT_min[kMaxTracks]
RunNumber_t run() const
Definition: DataViewImpl.cc:71
static int max(int a, int b)
Definition of data types for geometry description.
Float_t trkendy[kMaxTracks]
Float_t trkhitz[kMaxTracks][3][3000]
Definition: tracks.py:1
int ID() const
Definition: Track.h:198
Declaration of signal hit object.
Float_t trkdedx[kMaxTracks][3][3000]
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:55
constexpr double dist(const TReal *x, const TReal *y, const unsigned int dimension)
Vector_t EndDirection() const
Definition: Track.h:133
Int_t adjacent_hits[kMaxTracks]
Provides recob::Track data product.
Float_t trkstartz[kMaxTracks]
void analyze(const art::Event &evt)
EventNumber_t event() const
Definition: EventID.h:116
Point_t const & End() const
Definition: Track.h:125
Declaration of basic channel signal object.
detail::Node< FrameID, bool > PlaneID
Definition: CRTID.h:125
Float_t trkpitch[kMaxTracks][3][3000]
TCEvent evt
Definition: DataStructs.cxx:7
Float_t trkendz[kMaxTracks]
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
int bool
Definition: qglobal.h:345
EventID id() const
Definition: Event.cc:34
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
Float_t trklen[kMaxTracks]
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
QTextStream & endl(QTextStream &s)
Event finding and building.