All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Processors.cxx
Go to the documentation of this file.
4 
5 #include "art/Framework/Services/Registry/ServiceHandle.h"
6 #include "art/Framework/Principal/Event.h"
7 
8 
9 #include "canvas/Persistency/Common/FindManyP.h"
10 #include "canvas/Persistency/Common/FindMany.h"
11 #include "canvas/Persistency/Common/FindOneP.h"
12 #include "canvas/Persistency/Common/FindOne.h"
13 
14 #include "messagefacility/MessageLogger/MessageLogger.h"
15 
16 #include "TGraph.h"
17 #include "TGraph2D.h"
18 #include "TGraphDelaunay.h"
19 
20 //May move this to Libaries
21 namespace single_photon
22 {
23 
24 
25  int spacecharge_correction(const art::Ptr<simb::MCParticle> & mcparticle, std::vector<double> & corrected, std::vector<double> & input){
26  corrected.resize(3);
27 
28  //CHECK double kx = input[0];
29  double ky = input[1];
30  double kz = input[2];
31  //CHECK
32  // auto scecorr = SCE->GetPosOffsets( geo::Point_t(kx,ky,kz));
33  // CHECK
34  // double g4Ticks = detClocks->TPCG4Time2Tick(mcparticle->T())+theDetector->GetXTicksOffset(0,0,0)-theDetector->trigger_offset();
35 
36  //CHECK double xtimeoffset = 0;//CHECK theDetector->ConvertTicksToX(g4Ticks,0,0,0);
37 
38  // double xOffset = -scecorr.X() +xtimeoffset+0.6;
39  double yOffset = 0;//CHECK scecorr.Y();
40  double zOffset = 0;//CHECK scecorr.Z();
41 
42  corrected[0]=0;//CHECK kx - scecorr.X() + xtimeoffset + 0.6; //due to sim/wirecell differences Seev https://cdcvs.fnal.gov/redmine/projects/uboone-physics-analysis/wiki/MCC9_Tutorials
43  corrected[1]=ky+yOffset;
44  corrected[2]=kz+zOffset;
45  return 0;
46  }
47 
48 
49 
50 
51 
52  int spacecharge_correction(const art::Ptr<simb::MCParticle> & mcparticle, std::vector<double> & corrected){
53  corrected.resize(3);
54 
55  double kx = mcparticle->Vx();
56  double ky = mcparticle->Vy();
57  double kz = mcparticle->Vz();
58 
59  //CHECK auto scecorr = SCE->GetPosOffsets( geo::Point_t(kx,ky,kz)); // to get position offsets to be used in ionization electron drift
60  //CHECK double g4Ticks = detClocks->TPCG4Time2Tick(mcparticle->T())+theDetector->GetXTicksOffset(0,0,0)-theDetector->trigger_offset();
61 
62  //CHECK double xtimeoffset = theDetector->ConvertTicksToX(g4Ticks,0,0,0);
63 
64  //double xOffset = -scecorr.X() +xtimeoffset+0.6;
65  double yOffset = 0;//CHECK scecorr.Y();
66  double zOffset = 0;//CHECK scecorr.Z();
67 
68  corrected[0]= kx;//CHECK- scecorr.X() + xtimeoffset + 0.6; //due to sim/wirecell differences Seev https://cdcvs.fnal.gov/redmine/projects/uboone-physics-analysis/wiki/MCC9_Tutorials
69  corrected[1]=ky+yOffset;
70  corrected[2]=kz+zOffset;
71 
72  return 0;
73  }
74 
75 
76 
77 
78 
79  int spacecharge_correction(const simb::MCParticle & mcparticle, std::vector<double> & corrected){
80  corrected.resize(3);
81  //Space Charge Effect! functionize this soon.
82  double kx = mcparticle.Vx();
83  double ky = mcparticle.Vy();
84  double kz = mcparticle.Vz();
85  //CHECK auto scecorr = SCE->GetPosOffsets( geo::Point_t(kx,ky,kz));
86  //CHECK double g4Ticks = detClocks->TPCG4Time2Tick(mcparticle.T())+theDetector->GetXTicksOffset(0,0,0)-theDetector->trigger_offset();
87 
88  //CHECK double xtimeoffset = 0;//CHECK theDetector->ConvertTicksToX(g4Ticks,0,0,0);
89 
90  corrected[0]=kx;//CHECK - scecorr.X() +xtimeoffset+0.6;
91  corrected[1]=ky;//CHECK + scecorr.Y();
92  corrected[2]=kz;//CHECK + scecorr.Z();
93  return 0;
94  }
95 
97  const art::Event &evt,
98  const std::string &label,
99  std::map< art::Ptr<simb::MCTruth>, std::vector<art::Ptr<simb::MCParticle>>> &truthToParticles,
100  std::map< art::Ptr<simb::MCParticle>, art::Ptr<simb::MCTruth>> &particlesToTruth,
101  std::map< int, art::Ptr<simb::MCParticle> > & MCParticleToTrackIdMap,
102  var_all& vars){
103 
104  // if (evt.isRealData())
105  // throw cet::exception("LArPandora") << " PandoraCollector::CollectMCParticles --- Trying to access MC truth from real data ";
106 
107  art::Handle< std::vector< simb::MCParticle> > theParticles;
108  evt.getByLabel(label, theParticles);
109 
110  if (!theParticles.isValid())
111  {
112  mf::LogDebug("LArPandora") << " Failed to find MC particles... " << std::endl;
113  return;
114  }
115  else
116  {
117  mf::LogDebug("LArPandora") << " Found: " << theParticles->size() << " MC particles " << std::endl;
118  }
119 
120  art::FindOneP<simb::MCTruth> theTruthAssns(theParticles, evt, label);
121 
122  for (unsigned int i = 0, iEnd = theParticles->size(); i < iEnd; ++i)
123  {
124  const art::Ptr<simb::MCParticle> particle(theParticles, i);
125  const art::Ptr<simb::MCTruth> truth(theTruthAssns.at(i));
126  truthToParticles[truth].push_back(particle);
127  particlesToTruth[particle] = truth;
128  MCParticleToTrackIdMap[particle->TrackId()] = particle;
129  }
130 
131  // std::cout<<"CollectMCParticles() \t||\t the number of MCParticles in the event is "<<theParticles->size()<<std::endl;
132  }
133 
134  void CollectSimChannels(const art::Event &evt, const std::string &label, std::vector< art::Ptr<sim::SimChannel> > &simChannelVector)
135  {
136  if (evt.isRealData())
137  throw cet::exception("LArPandora") << " PandoraCollector::CollectSimChannels --- Trying to access MC truth from real data ";
138 
139  art::Handle< std::vector<sim::SimChannel> > theSimChannels;
140  evt.getByLabel(label, theSimChannels);
141 
142  if (!theSimChannels.isValid())
143  {
144  mf::LogDebug("LArPandora") << " Failed to find sim channels... " << std::endl;
145  return;
146  }
147  else
148  {
149  mf::LogDebug("LArPandora") << " Found: " << theSimChannels->size() << " SimChannels " << std::endl;
150  }
151 
152  for (unsigned int i = 0; i < theSimChannels->size(); ++i)
153  {
154  const art::Ptr<sim::SimChannel> channel(theSimChannels, i);
155  simChannelVector.push_back(channel);
156  }
157  }
158 
159 
161  const art::Event &evt,
162  const std::string &label,
163  const std::vector<art::Ptr<recob::Hit>> &hitVector,
164  std::map< art::Ptr<simb::MCParticle>, std::vector<art::Ptr<recob::Hit> > > &particlesToHits,
165  std::map< art::Ptr<recob::Hit>, art::Ptr<simb::MCParticle> > &hitsToParticles,
167  std::map< int, art::Ptr<simb::MCParticle> > & MCParticleToTrackIdMap,
168  var_all& vars){
169  std::vector< art::Ptr<sim::SimChannel> > simChannelVector;
170  std::map< art::Ptr<simb::MCTruth>, std::vector<art::Ptr<simb::MCParticle>> > truthToParticles;
171  std::map< art::Ptr<simb::MCParticle>, art::Ptr<simb::MCTruth> > particlesToTruth;
172  std::map< art::Ptr<recob::Hit>, std::vector< sim::TrackIDE > > hitsToTrackIDEs;
173 
174  CollectSimChannels(evt, label, simChannelVector);
175  CollectMCParticles(evt, label, truthToParticles, particlesToTruth, MCParticleToTrackIdMap, vars);
176 
177  //Collect the links from reconstructed hits to their true energy deposits.
178  lar_pandora::LArPandoraHelper::BuildMCParticleHitMaps(evt, hitVector, simChannelVector, hitsToTrackIDEs);
179  //Build mapping between Hits and MCParticles, starting from Hit/TrackIDE/MCParticle information
180  lar_pandora::LArPandoraHelper::BuildMCParticleHitMaps(hitsToTrackIDEs, truthToParticles, particlesToHits, hitsToParticles, daughterMode);
181 
182 
183  }
184 
186 
187  if(vars.m_vertex_pos_x < paras.s_tpc_active_XMin|| vars.m_vertex_pos_x > paras.s_tpc_active_XMax) return false;
188  if(vars.m_vertex_pos_y < paras.s_tpc_active_YMin || vars.m_vertex_pos_y > paras.s_tpc_active_YMax) return false;
189  if(vars.m_vertex_pos_z < paras.s_tpc_active_ZMin|| vars.m_vertex_pos_z > paras.s_tpc_active_ZMax) return false;
190 
191  if(vars.m_reco_asso_showers!=2) return false;
192  if(vars.m_reco_asso_tracks!=1) return false;
193  if(vars.m_reco_vertex_size<1) return false;
194 
195  if(vars.m_reco_shower_conversion_distance.size()!=2) return false;
196  if(vars.m_reco_shower_conversion_distance[0]<1. || vars.m_reco_shower_conversion_distance[1]<1.) return false;
197 
198  return true;
199  }
200 
201 
202 
204  if(vars.m_vertex_pos_x < paras.s_tpc_active_XMin|| vars.m_vertex_pos_x > paras.s_tpc_active_XMax) return false;
205  if(vars.m_vertex_pos_y < paras.s_tpc_active_YMin || vars.m_vertex_pos_y > paras.s_tpc_active_YMax) return false;
206  if(vars.m_vertex_pos_z < paras.s_tpc_active_ZMin|| vars.m_vertex_pos_z > paras.s_tpc_active_ZMax) return false;
207 
208  if(vars.m_reco_asso_showers!=2) return false;
209  if(vars.m_reco_asso_tracks!=0) return false;
210  if(vars.m_reco_vertex_size<1) return false;
211 
212  if(vars.m_reco_shower_energy_max.size()!=2) return false;
213  //if the maximum energy of all showers on all planes is smaller than 30
214  if(vars.m_reco_shower_energy_max[vars.m_reco_shower_ordered_energy_index[0]]<30.) return false;
215 
216  return true;
217  }
218 
219  bool IsEventInList(int run, int subrun, int event, var_all& vars){
220  if(vars.m_selected_set.find( {run, subrun, event} ) == vars.m_selected_set.end()){
221  if(vars.m_selected_set.find({run, subrun}) == vars.m_selected_set.end() ){
222  if(vars.m_selected_set.find({run}) == vars.m_selected_set.end())
223  return false;
224  }
225  }
226  return true;
227  }
228 
229  //----------- Above are migrated from Singlephoton_module.cc
230 
231  //determines if a point is inside the rectangle by summing the areas of the four triangles made by
232  //if the point is inside, the sum of the triangles should exactly equal the area of the rectangle
233  //also returns true if the point is on the boundary
234  bool isInsidev2(std::vector<double> thishit_pos, std::vector<std::vector<double >> rectangle, para_all& paras){
235  int n_vertices = (int)rectangle.size();
236  //bool inside = false;
237  int i, j = 0;
238  double areas = 0;
239  //for each pair of vertices
240  for (i = 0, j = n_vertices-1; i < n_vertices; j = i++) {
241  //calculate the area of a triangle with the point and two vertices
242  double this_area = 0.5*abs(rectangle[i][0]*(rectangle[j][1] - thishit_pos[1])
243  + rectangle[j][0]*(thishit_pos[1] - rectangle[i][1])
244  + thishit_pos[0]*(rectangle[i][1] - rectangle[j][1]));
245  areas += this_area;
246  }
247  //calc area of the rectangle
248  double area_rectangle = paras.s_width_dqdx_box* paras.s_length_dqdx_box;
249 
250  //check the sum of areas match
251  if (abs(areas - area_rectangle) <= 0.001 ){
252  return true;
253  }
254  return false;
255  }
256 
257 
258  //helpers for calculating calometry
259 // double CalcEShower(const std::vector<art::Ptr<recob::Hit>> &hits, var_all& vars){
260 // double energy[3] = {0., 0., 0.};
261 //
262 // //std::cout<<"AnalyzeShowers() \t||\t Looking at shower with "<<hits.size() <<" hits on all planes"<<std::endl;
263 //
264 // //for each hit in the shower
265 // for (auto &thishitptr : hits){
266 // //check the plane
267 // int plane= thishitptr->View();
268 //
269 // //skip invalid planes
270 // if (plane > 2 || plane < 0) continue;
271 //
272 // //calc the energy of the hit
273 // double E = QtoEConversion(GetQHit(thishitptr, plane, vars), vars);
274 //
275 // //add the energy to the plane
276 // energy[plane] += E;
277 // }//for each hiti
278 //
279 // //find the max energy on a single plane
280 // double max = energy[0];
281 // for (double en: energy){
282 // if( en > max){
283 // max = en;
284 // }
285 // }
286 // // std::cout<<"AnalyzeShowers() \t||\t The energy on each plane for this shower is "<<energy[0]<<", "<<energy[1]<<", "<<energy[2]<<std::endl;
287 //
288 // //return the highest energy on any of the planes
289 // return max;
290 //
291 // }
292 
293  double CalcEShowerPlane(const std::vector<art::Ptr<recob::Hit>>& hits, int this_plane, para_all& paras){
294  double energy = 0.;
295 
296  //for each hit in the shower
297  for (auto &thishitptr : hits){
298  //check the plane
299  int plane= thishitptr->View();
300 
301  //skip invalid planes
302  if (plane != this_plane ) continue;
303 
304  //calc the energy of the hit
305  double E = QtoEConversion(GetQHit(thishitptr, plane, paras), paras);
306  //add the energy to the plane
307  energy += E;
308  }//for each hit
309 
310  return energy;
311 
312  }
313 
314 
315 
316 
317  double GetQHit(art::Ptr<recob::Hit> thishitptr, int plane, para_all& paras){
318  double gain;
319  //choose gain based on whether data/mc and by plane
320  if (paras.s_is_data == false && paras.s_is_overlayed == false){
321  gain = paras.s_gain_mc[plane] ;
322  //if (g_is_verbose) std::cout<<"the gain for mc on plane "<<plane<<" is "<<gain<<std::endl;
323  } if (paras.s_is_data == true || paras.s_is_overlayed == true){
324  gain = paras.s_gain_data[plane] ;
325  //if (g_is_verbose) std::cout<<"the gain for data on plane "<<plane<<" is "<<gain<<std::endl;
326 
327  }
328 
329  double Q = thishitptr->Integral()*gain;
330  return Q;
331  }
332 
333 
334  double QtoEConversion(double Q, para_all& paras){
335  //return the energy value converted to MeV (the factor of 1e-6)
336  double E = Q* paras.s_work_function *1e-6 /paras.s_recombination_factor;
337  return E;
338 
339  }
340 
341 
342  std::vector<double> CalcdEdxFromdQdx(std::vector<double> dqdx, para_all& paras){
343  int n = dqdx.size();
344  std::vector<double> dedx(n,0.0);
345  for (int i = 0; i < n; i++){
346  //std::cout<<"The dQ/dx is "<<dqdx[i]<<std::endl;
347  dedx[i] = QtoEConversion(dqdx[i], paras);
348  //std::cout<<"The dE/dx is "<<dedx[i]<<std::endl;
349  }
350  return dedx;
351  }
352 
353 
354  std::vector<double> CalcdQdxShower(
355  const art::Ptr<recob::Shower>& shower,
356  const std::vector<art::Ptr<recob::Cluster>> & clusters,
357  std::map<art::Ptr<recob::Cluster>, std::vector<art::Ptr<recob::Hit>> > & clusterToHitMap ,
358  int plane,
359  double triggeroffset,
360  detinfo::DetectorPropertiesData const & theDetector,
361  para_all & paras){
362 
363  //if(g_is_verbose) std::cout<<"AnalyzeShowers() \t||\t The number of clusters in this shower is "<<clusters.size()<<std::endl;
364  std::vector<double> dqdx;
365 
366  //get the 3D shower direction
367  //note: in previous versions of the code there was a check to fix cases where the shower direction was inverted - this hasn't been implemented
368  TVector3 shower_dir(shower->Direction().X(), shower->Direction().Y(),shower->Direction().Z());
369 
370  //calculate the pitch for this plane
371  //CHECK upgradable, see ./Calibration/TrackCaloSkimmer_module.cc line 746
372  double pitch = getPitch(shower_dir, paras)[plane];
373 
374  if(g_is_verbose) std::cout<<"AnalyzeShowers() \t||\t The pitch between the shower and plane "<<plane<<" is "<<pitch<<std::endl;
375 
376  //for all the clusters in the shower
377  for (const art::Ptr<recob::Cluster> &thiscluster: clusters){
378  //keep only clusters on the plane
379  if(thiscluster->View() != plane) continue;
380 
381  //calculate the cluster direction
382  std::vector<double> cluster_axis = {cos(thiscluster->StartAngle()), sin(thiscluster->StartAngle())};
383 
384  //get the cluster start and and in CM
385  //std::cout<<"for plane/tpc/cryo:"<<plane<<"/"<<paras.s_TPC<<"/"<<paras.s_Cryostat<<", fXTicksOffset: "<<theDetector->GetXTicksOffset(plane, paras.s_TPC, paras.s_Cryostat)<<" fXTicksCoefficient: "<<theDetector->GetXTicksCoefficient(paras.s_TPC, paras.s_Cryostat)<<std::endl;
386 
387  //convert the cluster start and end positions to time and wire coordinates
388  std::vector<double> cluster_start = {thiscluster->StartWire() * paras.s_wire_spacing,(thiscluster->StartTick() - triggeroffset)* paras._time2cm};
389  std::vector<double> cluster_end = {thiscluster->EndWire() * paras.s_wire_spacing,(thiscluster->EndTick() - triggeroffset)* paras._time2cm };
390 
391  //check that the cluster has non-zero length
392  double length = sqrt(pow(cluster_end[0] - cluster_start[0], 2) + pow(cluster_end[1] - cluster_start[1], 2));
393  //if(g_is_verbose) std::cout<<"AnalyzeShowers() \t||\t The cluster length is "<<length<<std::endl;
394  if (length <= 0){
395  std::cout<<"skipping cluster on plane "<<plane<<", length = "<<length<<std::endl;
396  continue;
397  }
398 
399 
400  //draw a rectangle around the cluster axis
401  std::vector<std::vector<double>> rectangle = buildRectangle(cluster_start, cluster_axis, paras.s_width_dqdx_box, paras.s_length_dqdx_box);
402 
403  //get all the hits for this cluster
404  std::vector<art::Ptr<recob::Hit>> hits = clusterToHitMap[thiscluster];
405 
406  //for each hit in the cluster
407  for (art::Ptr<recob::Hit> &thishit: hits){
408  //get the hit position in cm from the wire and time
409  std::vector<double> thishit_pos ={thishit->WireID().Wire * paras.s_wire_spacing, (thishit->PeakTime() - triggeroffset)* paras._time2cm};
410 
411  //check if inside the box
412  bool v2 = isInsidev2(thishit_pos, rectangle, paras);
413  if (v2){
414  double q = GetQHit(thishit, plane, paras);
415  double this_dqdx = q/pitch;
416  dqdx.push_back(this_dqdx);
417  }//if hit falls inside the box
418 
419  }//for each hit inthe cluster
420  }//for each cluster
421  return dqdx;
422  }
423 
424  std::vector<double> getPitch(TVector3 shower_dir, para_all& paras){
425 
426  std::vector<double> pitches;
427  for (geo::PlaneGeo const& plane: paras.s_geom->IteratePlanes()) {
428  //6 planes in SBND
429  //WireAngleToVertical : 30 ,150,90,150,30 ,90
430  //ub wire angles : 30 ,150,90 (respected to beam,z)
431  //Pitch : 0.3,0.3,0.3,0.3,0.3,0.3
432 
433  const double angToVert(paras.s_geom->WireAngleToVertical(plane.View(), plane.ID())+0.5*M_PI);//wire angle respected to z + pi/2
434 
435  TVector3 wire_vector;
436  if(abs(angToVert) < 1e-9 ){
437  wire_vector = {0,0,1};
438  } else{
439  wire_vector = { 0 , sin(angToVert) ,cos(angToVert) };
440  }
441 
442  // std::cout<<" Angle "<<angToVert<<" Get Vec y="<<wire_vector[1]<< " z= "<<wire_vector[2]<<std::endl;
443  double cos = abs(wire_vector.Dot(shower_dir))/(wire_vector.Mag()*shower_dir.Mag());
444 
445  pitches.push_back((cos==0)? std::numeric_limits<double>::max() : paras.s_wire_spacing/cos );
446 
447  if(pitches.size()==3) break;
448  }
449  return pitches;
450  }
451 
452 
453 
454  double getMeanHitWidthPlane(std::vector<art::Ptr<recob::Hit>> hits, int this_plane){
455  int nhits = 0;
456  double widths = 0;
457  for (art::Ptr<recob::Hit> thishitptr : hits){
458  //check the plane
459  int plane= thishitptr->View();
460 
461  //skip invalid planes
462  if (plane != this_plane) continue;
463 
464  widths += thishitptr->RMS(); // recob::Hit->RMS() returns RMS of the hit shape in tick units
465  nhits++;
466  }//for each hiti
467  return widths/(double)nhits;
468  }
469 
470 
471 
472  int getNHitsPlane(std::vector<art::Ptr<recob::Hit>> hits, int this_plane){
473  int nhits = 0;
474  for (art::Ptr<recob::Hit> thishitptr : hits){
475  //check the plane
476  int plane= thishitptr->View();
477 
478  //skip invalid planes
479  if (plane != this_plane) continue;
480 
481  nhits++;
482  }//for each hiti
483  return nhits;
484  }
485 
486 
487 
488  double triangle_area(double a1, double a2, double b1, double b2, double c1, double c2){
489  double m1 = 0.3;
490  double m2 = 1.0/25.0;
491 
492  return fabs((a1*m1*(b2*m2-c2*m2)+b1*m1*(c2*m2-a2*m2)+c1*m1*(a2*m2-b2*m2))/2.0);
493  }
494 
495  int quick_delaunay_fit(int n, double *X, double *Y, int *num_triangles, double * area){
496 
497  std::vector<double> z(n,0.0);
498 
499  TGraph2D *g = new TGraph2D(n,X,Y,&z[0]);
500  TGraphDelaunay delan(g);
501  delan.SetMarginBinsContent(0);
502  delan.ComputeZ(0,0);
503  delan.FindAllTriangles();
504  (*num_triangles)=delan.GetNdt(); // number of Delaunay triangles found
505 
506  //Grab the locations of all the trianges. These will be intergers referencing to position in X,Y arrays
507  Int_t *MT = delan.GetMTried();
508  Int_t *NT = delan.GetNTried();
509  Int_t *PT = delan.GetPTried();
510 
511  (*area)=0.0;
512  for(int i = 0; i<delan.GetNdt(); i++){
513  (*area)+=triangle_area(X[MT[i]-1],Y[MT[i]-1],X[NT[i]-1],Y[NT[i]-1],X[PT[i]-1],Y[PT[i]-1]);
514  }
515 
516  delete g;
517  return 0;
518  }
519 
520  int delaunay_hit_wrapper(const std::vector<art::Ptr<recob::Hit>>& hits, std::vector<int> & num_hits, std::vector<int>& num_triangles, std::vector<double> & area, para_all& paras){
521 
522  int n = hits.size();
523  std::vector<double> C0,T0;
524  std::vector<double> C1,T1;
525  std::vector<double> C2,T2;
526  size_t n_0=0;
527  size_t n_1=0;
528  size_t n_2=0;
529 
530  for(int i=0;i<n; i++){
531  const art::Ptr<recob::Hit> hit = hits[i];
532  switch(hit->View()){
533  case 0:
534  C0.push_back((double)hit->WireID().Wire);
535  T0.push_back(hit->PeakTime());
536  n_0++;
537  break;
538  case 1:
539  C1.push_back((double)hit->WireID().Wire);
540  T1.push_back(hit->PeakTime());
541  n_1++;
542  break;
543  case 2:
544  C2.push_back((double)hit->WireID().Wire);
545  T2.push_back(hit->PeakTime());
546  n_2++;
547  break;
548  default:
549  break;
550  }
551  }
552  if(paras.s_use_delaunay){
553  if(n_0>0 && (int)n_0 < paras.s_delaunay_max_hits) quick_delaunay_fit(n_0, &C0[0] , &T0[0] , &num_triangles[0], &area[0]);
554  if(n_1>0 && (int)n_1 < paras.s_delaunay_max_hits) quick_delaunay_fit(n_1, &C1[0] , &T1[0] , &num_triangles[1], &area[1]);
555  if(n_2>0 && (int)n_2 < paras.s_delaunay_max_hits) quick_delaunay_fit(n_2, &C2[0] , &T2[0] , &num_triangles[2], &area[2]);
556  }
557  num_hits[0] = n_0;
558  num_hits[1] = n_1;
559  num_hits[2] = n_2;
560 
561  //std::cout<<"Plane 0: "<<n_0<<" hits with "<<num_triangles[0]<<" triangles of area: "<< area[0]<<std::endl;
562  //std::cout<<"Plane 1: "<<n_1<<" hits with "<<num_triangles[1]<<" triangles of area: "<< area[1]<<std::endl;
563  //std::cout<<"Plane 2: "<<n_2<<" hits with "<<num_triangles[2]<<" triangles of area: "<< area[2]<<std::endl;
564 
565  return 0;
566  }
567 }
std::vector< double > CalcdEdxFromdQdx(std::vector< double > dqdx, para_all &paras)
Definition: Processors.cxx:342
process_name opflash particleana ie ie ie z
void CollectMCParticles(const art::Event &evt, const std::string &label, std::map< art::Ptr< simb::MCTruth >, std::vector< art::Ptr< simb::MCParticle >>> &truthToParticles, std::map< art::Ptr< simb::MCParticle >, art::Ptr< simb::MCTruth >> &particlesToTruth, std::map< int, art::Ptr< simb::MCParticle > > &MCParticleToTrackIdMap, var_all &vars)
Definition: Processors.cxx:96
std::set< std::vector< int > > m_selected_set
Definition: variables.h:314
int getNHitsPlane(std::vector< art::Ptr< recob::Hit >> hits, int this_plane)
Definition: Processors.cxx:472
IteratorBox< plane_iterator,&GeometryCore::begin_plane,&GeometryCore::end_plane > IteratePlanes() const
Enables ranged-for loops on all planes of the detector.
void BuildMCParticleHitMaps(const art::Event &evt, const std::string &label, const std::vector< art::Ptr< recob::Hit >> &hitVector, std::map< art::Ptr< simb::MCParticle >, std::vector< art::Ptr< recob::Hit > > > &particlesToHits, std::map< art::Ptr< recob::Hit >, art::Ptr< simb::MCParticle > > &hitsToParticles, const lar_pandora::LArPandoraHelper::DaughterMode daughterMode, std::map< int, art::Ptr< simb::MCParticle > > &MCParticleToTrackIdMap, var_all &vars)
Definition: Processors.cxx:160
process_name E
int delaunay_hit_wrapper(const std::vector< art::Ptr< recob::Hit >> &hits, std::vector< int > &num_hits, std::vector< int > &num_triangles, std::vector< double > &area, para_all &paras)
Definition: Processors.cxx:520
process_name hit
Definition: cheaterreco.fcl:51
then echo echo For and will not be changed by echo further linking echo echo B echo The symbol is in the uninitialized data multiple common symbols may appear with the echo same name If the symbol is defined the common echo symbols are treated as undefined references For more echo details on common see the discussion of warn common echo in *Note Linker see the discussion of warn common echo in *Note Linker such as a global int variable echo as opposed to a large global array echo echo I echo The symbol is an indirect reference to another symbol This echo is a GNU extension to the a out object file format which is echo rarely used echo echo N echo The symbol is a debugging symbol echo echo R echo The symbol is in a read only data section echo echo S echo The symbol is in an uninitialized data section for small echo objects echo echo T echo The symbol is in the the normal defined echo symbol is used with no error When a weak undefined symbol echo is linked and the symbol is not the value of the echo weak symbol becomes zero with no error echo echo W echo The symbol is a weak symbol that has not been specifically echo tagged as a weak object symbol When a weak defined symbol echo is linked with a normal defined the normal defined echo symbol is used with no error When a weak undefined symbol echo is linked and the symbol is not the value of the echo weak symbol becomes zero with no error echo echo echo The symbol is a stabs symbol in an a out object file In echo this the next values printed are the stabs other echo the stabs desc and the stab type Stabs symbols are echo used to hold debugging information For more echo see *Note or object file format specific echo echo For Mac OS X
bool isInsidev2(std::vector< double > thishit_pos, std::vector< std::vector< double >> rectangle, para_all &paras)
Definition: Processors.cxx:234
BEGIN_PROLOG g
process_name shower
Definition: cheaterreco.fcl:51
std::vector< double > s_gain_data
Definition: variables.h:130
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:265
#define a2
std::vector< double > s_gain_mc
Definition: variables.h:129
bool Pi0PreselectionFilter2g0p(var_all &vars, para_all &paras)
Definition: Processors.cxx:203
T abs(T value)
bool Pi0PreselectionFilter(var_all &vars, para_all &paras)
Definition: Processors.cxx:185
std::vector< double > m_reco_shower_energy_max
Definition: variables.h:988
void CollectSimChannels(const art::Event &evt, const std::string &label, std::vector< art::Ptr< sim::SimChannel > > &simChannelVector)
Definition: Processors.cxx:134
double getMeanHitWidthPlane(std::vector< art::Ptr< recob::Hit >> hits, int this_plane)
Definition: Processors.cxx:454
Geometry information for a single wire plane.The plane is represented in the geometry by a solid whic...
Definition: PlaneGeo.h:82
double triangle_area(double a1, double a2, double b1, double b2, double c1, double c2)
Definition: Processors.cxx:488
geo::GeometryCore const * s_geom
Definition: variables.h:143
std::vector< std::vector< double > > buildRectangle(std::vector< double > cluster_start, std::vector< double > cluster_axis, double width, double length)
Calculates the four corners of a rectangle of given length and width around a cluster given the start...
std::vector< double > CalcdQdxShower(const art::Ptr< recob::Shower > &shower, const std::vector< art::Ptr< recob::Cluster >> &clusters, std::map< art::Ptr< recob::Cluster >, std::vector< art::Ptr< recob::Hit >> > &clusterToHitMap, int plane, double triggeroffset, detinfo::DetectorPropertiesData const &theDetector, para_all &paras)
Definition: Processors.cxx:354
int spacecharge_correction(const art::Ptr< simb::MCParticle > &mcparticle, std::vector< double > &corrected, std::vector< double > &input)
Definition: Processors.cxx:25
DaughterMode
DaughterMode enumeration.
std::vector< size_t > m_reco_shower_ordered_energy_index
Definition: variables.h:1012
double CalcEShowerPlane(const std::vector< art::Ptr< recob::Hit >> &hits, int this_plane, para_all &paras)
Definition: Processors.cxx:293
std::vector< double > getPitch(TVector3 shower_dir, para_all &paras)
Definition: Processors.cxx:424
double GetQHit(art::Ptr< recob::Hit > thishitptr, int plane, para_all &paras)
Definition: Processors.cxx:317
do i e
double QtoEConversion(double Q, para_all &paras)
Definition: Processors.cxx:334
bool IsEventInList(int run, int subrun, int event, var_all &vars)
Definition: Processors.cxx:219
int quick_delaunay_fit(int n, double *X, double *Y, int *num_triangles, double *area)
Definition: Processors.cxx:495
TCEvent evt
Definition: DataStructs.cxx:8
static void BuildMCParticleHitMaps(const art::Event &evt, const HitVector &hitVector, const SimChannelVector &simChannelVector, HitsToTrackIDEs &hitsToTrackIDEs)
Collect the links from reconstructed hits to their true energy deposits.
std::vector< double > m_reco_shower_conversion_distance
Definition: variables.h:799
double WireAngleToVertical(geo::View_t view, geo::TPCID const &tpcid) const
Returns the angle of the wires in the specified view from vertical.
BEGIN_PROLOG could also be cout
process_name opdaq physics producers generator physics producers generator physics producers generator physics producers generator physics producers generator physics producers generator physics producers generator physics producers generator T0
Definition: gen_protons.fcl:45
#define a1