eventAnalysis  7.0-49-g0ac7482
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
TP0DReconModule.cxx
Go to the documentation of this file.
1 #include <functional>
2 #include <algorithm>
3 #include <cassert>
4 #include <string>
5 
6 #include "TString.h"
7 #include "TVector3.h"
8 
9 #include "TAlgorithmResult.hxx"
10 #include "TDatum.hxx"
11 #include "TG4PrimaryVertex.hxx"
12 #include "TGeomInfo.hxx"
13 #include "TGeometryId.hxx"
14 #include "THandle.hxx"
15 #include "THitSelection.hxx"
16 #include "TND280Event.hxx"
17 #include "TND280Log.hxx"
18 #include "TPIDState.hxx"
19 #include "TP0DGeom.hxx"
20 #include "TRealDatum.hxx"
21 #include "TIntegerDatum.hxx"
22 #include "TReconCluster.hxx"
23 #include "TReconNode.hxx"
24 #include "TReconPID.hxx"
25 #include "TReconShower.hxx"
26 #include "TReconTrack.hxx"
27 #include "TReconVertex.hxx"
28 #include "TReconState.hxx"
29 #include "TShowerState.hxx"
30 #include "TTrackState.hxx"
31 #include "TVertexState.hxx"
32 #include "TG4HitSegment.hxx"
33 #include "TTFBChannelId.hxx"
34 #include "retrieveHitTruthInfo.hxx"
35 
36 #include "TP0DReconModule.hxx"
37 #include "oaEvent_version.h"
38 
39 #if (oaEvent_MAJOR_VERSION>8)
40 #include "TReconStateUtilities.hxx"
41 #include "TShowerState.hxx"
42 #include "TPIDState.hxx"
43 using ND::TReconStateUtilities::GetPosition;
44 using ND::TReconStateUtilities::GetPositionVariance;
45 using ND::TReconStateUtilities::GetPositionIndex;
46 #endif
47 using namespace ND;
48 
51 
54 
57 
60 
63 
66 
69 
71 
72 #define CVSTAG "\
73  $Name: 7.0$"
74 #define CVSID "\
75  $Id: eventAnalysis TP0DReconModule.cxx,2024/03/20:09:46:10,Alexander_J_Finch,lapw.lancs.ac.uk $"
76 
78  const char *title) {
79  SetNameTitle(name, title);
80 
81  // Enable this module by default:
82  fIsEnabled = kTRUE;
83  fDescription = "P0D Recon Output";
84  fCVSTagName = CVSTAG;
85  fCVSID = CVSID;
86 
87  // Tree variables
88  fNAlgoResults = 0;
89  fNVertices = 0;
90  fNParticles = 0;
91  fNShowers = 0;
92  // Commented out this line to remove extraneous eventAnalysis output
93  // std::cout << "fNShowers:\tSta\t" << fNShowers << std::endl;
94  fNTracks = 0;
95  fNNodes = 0;
96  fNClusters = 0;
97  fNHits = 0;
98 
99  fAlgoResults = new TClonesArray("ND::TP0DReconModule::TP0DAlgoRes", 200);
100  fVertices = new TClonesArray("ND::TP0DReconModule::TP0DVertex", 200);
101  fParticles = new TClonesArray("ND::TP0DReconModule::TP0DParticle", 200);
102  fShowers = new TClonesArray("ND::TP0DReconModule::TP0DShower", 200);
103  fTracks = new TClonesArray("ND::TP0DReconModule::TP0DTrack", 200);
104  fNodes = new TClonesArray("ND::TP0DReconModule::TP0DNode", 200);
105  fHits = new TClonesArray("ND::TP0DReconModule::TP0DHit", 200);
106  fClusters = new TClonesArray("ND::TP0DReconModule::TP0DCluster", 200);
107 
108  fRejectAlgoResultList.clear();
109  fRejectAlgoResultList.push_back(TPRegexp("TP0DTrack$"));
110  fRejectAlgoResultList.push_back(TPRegexp("TP0DExpandSeeds$"));
111  fRejectAlgoResultList.push_back(TPRegexp("TP0D3DTrackMatching$"));
112  fRejectAlgoResultList.push_back(TPRegexp("TP0DPairwiseVertex$"));
113  fRejectAlgoResultList.push_back(TPRegexp("TP0D3DShowerMatching$"));
114  fRejectAlgoResultList.push_back(TPRegexp("TP0DShareCharge$"));
115  fRejectAlgoResultList.push_back(TPRegexp("-Expand$"));
116  fRejectAlgoResultList.push_back(TPRegexp("TP0DPairwiseVertexSingle$"));
117  fRejectAlgoResultList.push_back(TPRegexp("TP0DTrackVertex$"));
118  fRejectAlgoResultList.push_back(TPRegexp("TP0DTrackPID$"));
119  fRejectAlgoResultList.push_back(TPRegexp("TP0DShowerInputs$"));
120  fRejectAlgoResultList.push_back(TPRegexp("TP0DShowerVertex$"));
121  fRejectAlgoResultList.push_back(TPRegexp("TP0DShowerPID$"));
122 }
123 
124 
126 
127 Bool_t ND::TP0DReconModule::ProcessFirstEvent(ND::TND280Event&) {
128  return true;
129 }
130 
131 
133 
135 
136  // The number of objects that have been saved.
137  fOutputTree->Branch("NAlgoResults", &fNAlgoResults,
138  "NAlgoResults/S", fBufferSize)
139  ->SetTitle("The number of Algorithm Results ");
140  fOutputTree->Branch("NVertices", &fNVertices,
141  "NVertices/S", fBufferSize)
142  ->SetTitle(" The number of added vertices");
143  fOutputTree->Branch("NParticles", &fNParticles,
144  "NParticles/S", fBufferSize)
145  ->SetTitle(" The number of particles ");
146  fOutputTree->Branch("NShowers", &fNShowers,
147  "NShowers/S", fBufferSize)
148  ->SetTitle(" The number of showers");
149  fOutputTree->Branch("NTracks", &fNTracks,
150  "NTracks/S", fBufferSize)
151  ->SetTitle(" The number of tracks");
152  fOutputTree->Branch("NNodes", &fNNodes,
153  "NNodes/S", fBufferSize)
154  ->SetTitle(" The number of track nodes");
155  fOutputTree->Branch("NHits", &fNHits,
156  "NHits/S", fBufferSize)
157  ->SetTitle("The number of hits that are saved ");
158  fOutputTree->Branch("NClusters", &fNClusters,
159  "NClusters/S", fBufferSize)
160  ->SetTitle("The number of clusters ");
161 
162  // A branch for the clone array of P0D object information.
163  fOutputTree->Branch("AlgoResults", &fAlgoResults,
164  fBufferSize, fSplitLevel)
165  ->SetTitle("The TP0DAlgoRes vector of Algorithm Results. ");
166  fOutputTree->Branch("Vertices", &fVertices,
167  fBufferSize, fSplitLevel)
168  ->SetTitle(" The TP0DVertex vector of vertices.");
169  fOutputTree->Branch("Particles", &fParticles,
170  fBufferSize, fSplitLevel)
171  ->SetTitle("The TP0DParticle vector of particles. ");
172  fOutputTree->Branch("Showers", &fShowers,
173  fBufferSize, fSplitLevel)
174  ->SetTitle("The TP0DShower vector of showers. ");
175  fOutputTree->Branch("Tracks", &fTracks,
176  fBufferSize, fSplitLevel)
177  ->SetTitle(" The TP0DTrack vector of tracks.");
178  fOutputTree->Branch("Nodes", &fNodes,
179  fBufferSize, fSplitLevel)
180  ->SetTitle(" The TP0DNode vector of nodes.");
181  fOutputTree->Branch("Hits", &fHits,
182  fBufferSize, fSplitLevel)
183  ->SetTitle("The TP0DHit vector of hits. ");
184  fOutputTree->Branch("Clusters", &fClusters,
185  fBufferSize, fSplitLevel)
186  ->SetTitle("The TP0DCluster vector of clusters ");
187 }
188 
189 
190 bool ND::TP0DReconModule::FillTree(ND::TND280Event& event) {
191  // Clear variables
192  fNAlgoResults = 0;
193  fNVertices = 0;
194  fNParticles = 0;
195  fNShowers = 0;
196  fNTracks = 0;
197  fNNodes = 0;
198  fNClusters = 0;
199  fNHits = 0;
200 
201  fAlgoResults->Clear();
202  fVertices->Clear();
203  fParticles->Clear();
204  fShowers->Clear();
205  fTracks->Clear();
206  fNodes->Clear();
207  fClusters->Clear();
208  fHits->Clear();
209 
210  fTempHitMap.clear();
211 
212  //###############################################################
213 
214  // Get the main result to save.
215  ND::THandle<ND::TAlgorithmResult> p0dRecon = event.GetFit("p0dRecon");
216 
217  if (!p0dRecon) {
218  ND280Info("No p0dRecon in Event");
219  return true;
220  }
221 
222  FillAlgorithmResult(p0dRecon, -1);
223 
224  return true;
225 }
226 
227 template <class T>
229  ND::THandle<ND::TReconBase> baseObject,
230  bool saveHits){
231  // Algorithm Name
232  basePtr->AlgorithmName = baseObject->GetAlgorithmName();
233 
234  // Hit Based Information
235  ND::THandle<ND::THitSelection> baseHits = baseObject->GetHits();
236 
237  if(baseHits){
238  basePtr->Cycle = TP0DReconModule::GetCycle(baseHits);
239  basePtr->NHits = (short)baseHits->size();
240 
241  if(saveHits){
242  ND::THitSelection::const_iterator hit;
243  for(hit = baseHits->begin();
244  hit != baseHits->end(); ++hit){
245  short hitId = FillHit(*hit);
246  if(hitId >= 0)
247  basePtr->Hits.push_back(hitId);
248  }
249  }
250  } else {
251  basePtr->Cycle = -1;
252  basePtr->NHits = -1;
253  }
254  // Unique ID
255  basePtr->UniqueID = baseObject->GetUniqueID();
256 
257  // Daughter objects
258  ND::THandle<ND::TReconObjectContainer> objCont =
259  baseObject->GetConstituents();
260  if(objCont) {
261  ND::TReconObjectContainer::const_iterator constituent;
262  for (constituent = objCont->begin();
263  constituent != objCont->end();
264  constituent++){
265 
266  ObjectID conID = FillReconObject(*constituent, saveHits);
267  if(conID.type == ObjectID::kVertex){
268  basePtr->Vertices.push_back(conID.id);
269  }
270  else if(conID.type == ObjectID::kParticle){
271  basePtr->Particles.push_back(conID.id);
272  }
273  else if(conID.type == ObjectID::kTrack){
274  basePtr->Tracks.push_back(conID.id);
275  }
276  else if(conID.type == ObjectID::kShower){
277  basePtr->Showers.push_back(conID.id);
278  }
279  else if(conID.type == ObjectID::kCluster){
280  basePtr->Clusters.push_back(conID.id);
281  }
282  }
283  }
284 
285  // Nodes (probably only used by tracks, showers and particles, but
286  // technically valid for all TReconBase objects.
287  const ND::TReconNodeContainer& nodeCont = baseObject->GetNodes();
288  ND::TReconNodeContainer::const_iterator node;
289  for (node = nodeCont.begin();
290  node != nodeCont.end();
291  node++){
292 
293  int nodeID = FillNode(*node, saveHits);
294  basePtr->Nodes.push_back(nodeID);
295  }
296 
297  // Muon Decay Clusters
298  for (TDataVector::iterator d = baseObject->begin();
299  d != baseObject->end(); ++d) {
300 
301  if ( !(*d) ){continue;}
302  std::string sub_class_name = (*d)->ClassName();
303  std::string fullname = (*d)->GetFullName().Data();
304 
305  if ( (sub_class_name.find("ND::TReconObjectContainer") !=
306  std::string::npos) &&
307  (fullname.find("//unnamed/decays") != std::string::npos) ) {
308 
309  ND::THandle<ND::TReconObjectContainer> clusters
310  = (*d)->Get<ND::TReconObjectContainer>(".");
311  if(!clusters){continue;}
312 
313  ND::TReconObjectContainer::const_iterator clus;
314  for (clus = clusters->begin();
315  clus != clusters->end();
316  clus++){
317 
318  ObjectID conID = FillReconObject(*clus, saveHits);
319  if(conID.type == ObjectID::kCluster){
320  basePtr->Clusters.push_back(conID.id);
321  }
322  else{
323  ND280Error("Muon Decay object not a cluster");
324  }
325  }
326  }
327  }
328 };
329 
330 short
332  const ND::THandle<ND::TAlgorithmResult> algoRes,
333  short parent){
334 
335  TString fullName = algoRes->GetFullName();
336  TString baseName = fullName;
337  baseName.Remove(0,baseName.Last('/') + 1);
338 
339  // To save space, we're not going to save a number of the lower
340  // algorithm results. It is important to remember, that as soon as
341  // a result is not saved, none of it's daughter results will be
342  // saved either.
343  for(std::vector<TPRegexp>::iterator cut = fRejectAlgoResultList.begin();
344  cut != fRejectAlgoResultList.end(); ++cut){
345 
346  if(cut->MatchB(fullName, "", 0, 1)){
347  ND280Verbose("Rejecting:\t" << baseName
348  << " (" << cut->GetPattern() << ")");
349  return -1;
350  }
351  }
352 
353  ND280Verbose("Fill Algorithm Result:\t" << baseName);
354 
355  int algoResID = fNAlgoResults;
356 
357  TP0DAlgoRes* p0dAlgoResult =
358  new ((*fAlgoResults)[fNAlgoResults++]) TP0DAlgoRes;
359 
360  p0dAlgoResult->FullName = fullName;
361  p0dAlgoResult->AlgorithmName = baseName;
362  p0dAlgoResult->Parent = parent;
363 
364  // Get the used hits from the algo result
365  ND::THandle<ND::THitSelection> usedHits = algoRes->GetHitSelection("used");
366 
367  // Save the used hits to a cluster
368  if(usedHits && (!usedHits->empty())){
369  ND::THitSelection::const_iterator hit;
370 
371  for(hit = usedHits->begin();
372  hit != usedHits->end(); ++hit){
373 
374  short hitId = FillHit(*hit);
375  if(hitId >= 0){
376  p0dAlgoResult->Hits.push_back(hitId);
377  }
378  }
379  ND::THandle<ND::TReconCluster> usedCluster(new ND::TReconCluster);
380  usedCluster->FillFromHits((baseName+"Used").Data(), *usedHits);
381 
382  ObjectID clusterID = FillReconObject(usedCluster, true);
383  p0dAlgoResult->UsedHitCluster = clusterID.id;
384  }
385  else{ p0dAlgoResult->UsedHitCluster = -1;}
386 
387  // Get the unused hits from the algo result
388  ND::THandle<ND::THitSelection> unusedHits
389  = algoRes->GetHitSelection("unused");
390 
391  // Save the unused hits to a cluster
392  if(unusedHits && (!unusedHits->empty())){
393  ND::THandle<ND::TReconCluster> unusedCluster(new ND::TReconCluster);
394  unusedCluster->FillFromHits((baseName+"Unused").Data(), *unusedHits);
395 
396  // We don't want to save the unused hits. The 'false' prevents the
397  ObjectID clusterID = FillReconObject(unusedCluster, false);
398  p0dAlgoResult->UnusedHitCluster = clusterID.id;
399  }
400  else{ p0dAlgoResult->UnusedHitCluster = -1;}
401 
402  // Get the final recon object container
403  ND::THandle<ND::TReconObjectContainer> final
404  = algoRes->GetResultsContainer("final");
405  if (final) {
406  ND::TReconObjectContainer::const_iterator reconObject;
407  for (reconObject = final->begin();
408  reconObject != final->end(); reconObject++){
409 
410  ObjectID objID = FillReconObject(*reconObject, true);
411  if(objID.type == ObjectID::kVertex){
412  p0dAlgoResult->Vertices.push_back(objID.id);
413  }
414  else if(objID.type == ObjectID::kParticle){
415  p0dAlgoResult->Particles.push_back(objID.id);
416  }
417  else if(objID.type == ObjectID::kTrack){
418  p0dAlgoResult->Tracks.push_back(objID.id);
419  }
420  else if(objID.type == ObjectID::kShower){
421  p0dAlgoResult->Showers.push_back(objID.id);
422  }
423  else if(objID.type == ObjectID::kCluster){
424  p0dAlgoResult->Clusters.push_back(objID.id);
425  }
426  }
427  }
428 
429  // Get the clusters of non-reconstructed hits. This only happens in the
430  // cycle reconstruction.
431  ND::THandle<ND::TReconObjectContainer> clusters
432  = algoRes->GetResultsContainer("clusters");
433  if (clusters) {
434  ND::TReconObjectContainer::const_iterator reconObject;
435  for (reconObject = clusters->begin();
436  reconObject != clusters->end(); reconObject++){
437 
438  ObjectID objID = FillReconObject(*reconObject, true);
439  if (objID.type == ObjectID::kVertex) {
440  p0dAlgoResult->Vertices.push_back(objID.id);
441  }
442  else if (objID.type == ObjectID::kParticle) {
443  p0dAlgoResult->Particles.push_back(objID.id);
444  }
445  else if (objID.type == ObjectID::kTrack) {
446  p0dAlgoResult->Tracks.push_back(objID.id);
447  }
448  else if (objID.type == ObjectID::kShower) {
449  p0dAlgoResult->Showers.push_back(objID.id);
450  }
451  else if (objID.type == ObjectID::kCluster) {
452  p0dAlgoResult->Clusters.push_back(objID.id);
453  }
454  }
455  }
456 
457  for (TDataVector::iterator d = algoRes->begin();
458  d != algoRes->end(); ++d) {
459  if (!(*d)){continue;}
460  std::string class_name = (*d)->ClassName();
461 
462  if (class_name.find("ND::TAlgorithmResult") != std::string::npos) {
463  ND::THandle<ND::TAlgorithmResult> subResult =
464  (*d)->Get<ND::TAlgorithmResult>(".");
465  if(!subResult){continue;}
466  int daughterID = FillAlgorithmResult(subResult, algoResID);
467  if(daughterID != -1){
468  p0dAlgoResult->AlgoResults.push_back(daughterID);
469  }
470  }
471  }
472  return algoResID;
473 }
474 
477  const ND::THandle<ND::TReconBase> reconObject,
478  bool saveHits = true){
479 
480  std::string reco_class_name = reconObject->ClassName();
481 
482  if(reco_class_name.find("ND::TReconVertex") != std::string::npos){
483  ND280Verbose("Fill Vertex");
484  return FillVertexObject(reconObject, saveHits);
485  }
486  else if(reco_class_name.find("ND::TReconPID") != std::string::npos){
487  ND280Verbose("Fill PID");
488  return FillParticleObject(reconObject, saveHits);
489  }
490  else if(reco_class_name.find("ND::TReconTrack") != std::string::npos){
491  ND280Verbose("Fill Track");
492  return FillTrackObject(reconObject, saveHits);
493  }
494  else if(reco_class_name.find("ND::TReconShower") != std::string::npos){
495  ND280Verbose("Fill Shower");
496  return FillShowerObject(reconObject, saveHits);
497  }
498  else if(reco_class_name.find("ND::TReconCluster") != std::string::npos){
499  ND280Verbose("Fill Cluster");
500  return FillClusterObject(reconObject, saveHits);
501  }
502 
503  ND280Error("Unknown object passed to TP0DReconModule");
504  ObjectID blank;
505  return blank;
506 }
507 
510  const ND::THandle<ND::TReconVertex> vertex,
511  bool saveHits = true){
512 
513  ObjectID vertexID;
514  vertexID.id = fNVertices;
515  vertexID.type = ObjectID::kVertex;
516 
517  TP0DVertex* p0dVertex =
518  new ((*fVertices)[fNVertices++]) TP0DVertex;
519 
520  FillBaseObject(p0dVertex, vertex, saveHits);
521 
522  ND::THandle<ND::TVertexState> vertexState = vertex->GetState();
523 
524  p0dVertex->Status = vertex->GetStatus();
525  p0dVertex->Quality = vertex->GetQuality();
526  p0dVertex->NDOF = vertex->GetNDOF();
527  p0dVertex->Position = vertexState->GetPosition();
528  p0dVertex->PosVariance = vertexState->GetPositionVariance();
529  p0dVertex->Fiducial =
530  ND::TGeomInfo::P0D().WaterFiducialDistance(p0dVertex->Position.X(),
531  p0dVertex->Position.Y(),
532  p0dVertex->Position.Z());
533 
534  p0dVertex->ValidDimensions =
535  CountValidDimensions(p0dVertex->PosVariance.Vect());
536 
537  p0dVertex->Truth_TrajIDs.clear();
538  p0dVertex->Truth_HitCount.clear();
539  p0dVertex->Truth_ChargeShare.clear();
540 
541  ND::THandle<ND::THitSelection> vertexHits = vertex->GetHits();
542  if (vertexHits){
543 
544  std::map< int, std::pair<int, float> > hitInfo = HitTruthInfo(vertexHits);
545  std::map< int, std::pair< int, float > >::iterator parentID;
546 
547  for(parentID = hitInfo.begin(); parentID != hitInfo.end(); ++parentID){
548  p0dVertex->Truth_TrajIDs.push_back((*parentID).first);
549  p0dVertex->Truth_HitCount.push_back((*parentID).second.first);
550  p0dVertex->Truth_ChargeShare.push_back((*parentID).second.second);
551  }
552 
553  p0dVertex->Truth_PrimaryTrajIDs = HitTruthPrimaryInfo(vertexHits);
554  }
555 
556  return vertexID;
557 }
558 
561  const ND::THandle<ND::TReconPID> particle,
562  bool saveHits = true){
563 
564  ObjectID particleID;
565  particleID.id = fNParticles;
566  particleID.type = ObjectID::kParticle;
567 
568  TP0DParticle* p0dParticle =
569  new ((*fParticles)[fNParticles++]) TP0DParticle;
570 
571  FillBaseObject(p0dParticle, particle, saveHits);
572 
573  ND::THandle<ND::TPIDState> particleState = particle->GetState();
574 
575  p0dParticle->Status = particle->GetStatus();
576  p0dParticle->Quality = particle->GetQuality();
577  p0dParticle->NDOF = particle->GetNDOF();
578  p0dParticle->Position = particleState->GetPosition();
579  p0dParticle->PosVariance = particleState->GetPositionVariance();
580  p0dParticle->Direction = particleState->GetDirection();
581  p0dParticle->DirVariance = particleState->GetDirectionVariance();
582  p0dParticle->Momentum = particle->GetMomentum();
583  p0dParticle->Charge = particle->GetCharge();
584 
585  p0dParticle->ValidDimensions =
586  CountValidDimensions(p0dParticle->PosVariance.Vect());
587 
588  const ND::THandle<ND::THitSelection> particleHits = particle->GetHits();
589  if (particleHits){
590 
591  std::map< int, std::pair<int, float> > hitInfo = HitTruthInfo(particleHits);
592  std::map< int, std::pair< int, float > >::iterator parentID;
593 
594  for(parentID = hitInfo.begin(); parentID != hitInfo.end(); ++parentID){
595  p0dParticle->Truth_TrajIDs.push_back((*parentID).first);
596  p0dParticle->Truth_HitCount.push_back((*parentID).second.first);
597  p0dParticle->Truth_ChargeShare.push_back((*parentID).second.second);
598  }
599 
600  p0dParticle->Truth_PrimaryTrajIDs = HitTruthPrimaryInfo(particleHits);
601  }
602 
603  p0dParticle->SideDeposit = 0.0;
604  p0dParticle->EndDeposit = 0.0;
605 
606  ND::THitSelection::const_iterator hit;
607  for (hit = particleHits->begin();
608  hit != particleHits->end();
609  ++hit) {
610 
611  ND::TGeometryId geomid = (*hit)->GetGeomId();
612  if (!ND::GeomId::P0D::IsP0D(geomid)) continue;
613  int p0dule = ND::TGeomInfo::P0D().GetBar(geomid).GetP0Dule();
614  int layer = ND::TGeomInfo::P0D().GetBar(geomid).GetLayer();
615  int bar = ND::TGeomInfo::P0D().GetBar(geomid).GetNumber();
616 
617  if(p0dule > 38){
618  p0dParticle->EndDeposit += (*hit)->GetCharge();
619  }
620 
621  if(bar < 4 || (layer == 0 && bar > 121) || (layer == 1 && bar > 129)){
622  p0dParticle->SideDeposit += (*hit)->GetCharge();
623  }
624  }
625 
626  // The TReconPID may have extra PID variables stored as TReal- and
627  // TIntegerData. Check to see if they exist, and store the values if they
628  // do.
629 
630  // std::copy is required when the input vectors are doubles, but we
631  // only store floats. It is not required for integers, but it is
632  // easier to keep the code the same.
633 
634  // Currently we only have TRealDatums as inputs (although some could
635  // be stored as TIntegerDatums), but the code is included for
636  // completeness.
637 
638  for(ND::TDataVector::iterator dvIter = particle->begin();
639  dvIter != particle->end(); ++dvIter){
640  ND::TRealDatum *rDatum = dynamic_cast<ND::TRealDatum*>(*dvIter);
641  if(rDatum){
642  // Save the datum name, but remove the //unnamed/ at the beginning.
643  TString datumName = rDatum->GetFullName();
644  Ssiz_t lastSlash = datumName.Last('/');
645  TSubString pidAlgoName = datumName(lastSlash + 1, datumName.Length());
646 
647  std::vector<float> tempVector;
648  std::copy(rDatum->begin(),
649  rDatum->end(),
650  std::back_inserter(tempVector));
651 
652  p0dParticle->realPIDNames.push_back(pidAlgoName.Data());
653  p0dParticle->realPIDValues.push_back(tempVector);
654  }
655 
656 
657  ND::TIntegerDatum *iDatum = dynamic_cast<ND::TIntegerDatum*>(*dvIter);
658  if(iDatum){
659  // Save the datum name, but remove the //unnamed/ at the beginning.
660  TString datumName = iDatum->GetFullName();
661  Ssiz_t lastSlash = datumName.Last('/');
662  TSubString pidAlgoName = datumName(lastSlash + 1, datumName.Length());
663 
664  std::vector<short> tempVector;
665  std::copy(iDatum->begin(),
666  iDatum->end(),
667  std::back_inserter(tempVector));
668 
669  p0dParticle->integerPIDNames.push_back(pidAlgoName.Data());
670  p0dParticle->integerPIDValues.push_back(tempVector);
671  }
672  }
673 
674  // The most likely PID is available through particle->GetParticle,
675  // but it is also stored as one of the alternates. These are sorted
676  // in order of PID, so copy them directly into the TTree.
677  ND::TReconObjectContainer::const_iterator alternate;
678 
679  for(alternate = particle->GetAlternates().begin();
680  alternate != particle->GetAlternates().end();
681  alternate++){
682 
683  ND::THandle<ND::TReconPID> alt = (*alternate);
684  if(alt){
685  p0dParticle->PID.push_back(alt->GetParticleId());
686  p0dParticle->PID_weight.push_back(alt->GetPIDWeight());
687  }
688  else {ND280Warn("TReconPID alternate is not a TReconPID - Ignored");}
689  }
690 
691  return particleID;
692 }
693 
695 ND::TP0DReconModule::FillTrackObject(const ND::THandle<ND::TReconTrack> track,
696  bool saveHits = true){
697  ObjectID trackID;
698  trackID.id = fNTracks;
699  trackID.type = ObjectID::kTrack;
700 
701  TP0DTrack* p0dTrack =
702  new ((*fTracks)[fNTracks++]) TP0DTrack;
703 
704  FillBaseObject(p0dTrack, track, saveHits);
705 
706  ND::THandle<ND::TTrackState> trackState = track->GetState();
707 
708  p0dTrack->Status = track->GetStatus();
709  p0dTrack->Quality = track->GetQuality();
710  p0dTrack->NDOF = track->GetNDOF();
711  p0dTrack->Position = trackState->GetPosition();
712  p0dTrack->PosVariance = trackState->GetPositionVariance();
713  p0dTrack->Direction = trackState->GetDirection();
714  p0dTrack->DirVariance = trackState->GetDirectionVariance();
715  p0dTrack->EDeposit = trackState->GetEDeposit();
716 
717  p0dTrack->ValidDimensions =
718  CountValidDimensions(p0dTrack->PosVariance.Vect());
719 
720  const ND::THandle<ND::THitSelection> trackHits = track->GetHits();
721  if (trackHits) {
722 
723  std::map< int, std::pair<int, float> > hitInfo = HitTruthInfo(trackHits);
724  std::map< int, std::pair< int, float > >::iterator parentID;
725 
726  for(parentID = hitInfo.begin(); parentID != hitInfo.end(); ++parentID){
727  p0dTrack->Truth_TrajIDs.push_back((*parentID).first);
728  p0dTrack->Truth_HitCount.push_back((*parentID).second.first);
729  p0dTrack->Truth_ChargeShare.push_back((*parentID).second.second);
730  }
731 
732  p0dTrack->Truth_PrimaryTrajIDs = HitTruthPrimaryInfo(trackHits);
733  }
734 
735  p0dTrack->SideDeposit = 0.0;
736  p0dTrack->EndDeposit = 0.0;
737 
738  ND::THitSelection::const_iterator hit;
739  for (hit = trackHits->begin();
740  hit != trackHits->end();
741  ++hit) {
742 
743  ND::TGeometryId geomid = (*hit)->GetGeomId();
744  if (!ND::GeomId::P0D::IsP0D(geomid)) continue;
745  int p0dule = ND::TGeomInfo::P0D().GetBar(geomid).GetP0Dule();
746  int layer = ND::TGeomInfo::P0D().GetBar(geomid).GetLayer();
747  int bar = ND::TGeomInfo::P0D().GetBar(geomid).GetNumber();
748  if(p0dule > 38){
749  p0dTrack->EndDeposit += (*hit)->GetCharge();
750  }
751  if(bar < 4 || (layer == 0 && bar > 121) || (layer == 1 && bar > 129)){
752  p0dTrack->SideDeposit += (*hit)->GetCharge();
753  }
754 
755  }
756 
757  const ND::TReconNodeContainer& nodeCont = track->GetNodes();
758 
759  // Get the track length from the nodes
760  p0dTrack->Length = 0.0;
761  if (nodeCont.size() < 1) return trackID;
762 
763  ND::TReconNodeContainer::const_iterator node = nodeCont.begin();
764  ND::THandle<ND::TTrackState> nodeState = (*node)->GetState();
765  TVector3 frontPos = nodeState->GetPosition().Vect();
766  ++node;
767 
768  while(node != nodeCont.end()){
769 
770  // Check the node is valid
771  if (!(*node)) {
772  ++node;
773  continue;
774  }
775  nodeState = (*node)->GetState();
776 
777  p0dTrack->Length += (frontPos - nodeState->GetPosition().Vect()).Mag();
778  frontPos = nodeState->GetPosition().Vect();
779 
780  ++node;
781  }
782 
783  return trackID;
784 }
785 
788  const ND::THandle<ND::TReconShower> shower,
789  bool saveHits = true){
790 
791  ObjectID showerID;
792  showerID.id = fNShowers;
793  showerID.type = ObjectID::kShower;
794 
795  TP0DShower* p0dShower =
796  new ((*fShowers)[fNShowers++]) TP0DShower;
797 
798  FillBaseObject(p0dShower, shower, saveHits);
799 
800  // For Shower objects, the cluster information of the nodes is vital for the
801  // pi0 analysis. However, the cluster information for most nodes is
802  // useless. Therefore, rather than adding a "FillClusterObject" to each
803  // "FillNode", we will do a parallel fill, within the
804  // FillShowerObject. N.B. FillNode has already been run within
805  // FillBaseObject.
806 
807  const ND::TReconNodeContainer& nodeCont = shower->GetNodes();
808  ND::TReconNodeContainer::const_iterator node;
809  for (node = nodeCont.begin();
810  node != nodeCont.end();
811  node++){
812  ND::THandle<ND::TReconCluster> cluster = (*node)->GetObject();
813  ND280Verbose("Fill Cluster - Shower");
814  ObjectID clusterID = FillClusterObject(cluster, saveHits);
815  p0dShower->Clusters.push_back(clusterID.id);
816  }
817 
818  ND::THandle<ND::TShowerState> showerState = shower->GetState();
819 
820  p0dShower->Status = shower->GetStatus();
821  p0dShower->Quality = shower->GetQuality();
822  p0dShower->NDOF = shower->GetNDOF();
823  p0dShower->Position = showerState->GetPosition();
824  p0dShower->PosVariance = showerState->GetPositionVariance();
825  p0dShower->Direction = showerState->GetDirection();
826  p0dShower->DirVariance = showerState->GetDirectionVariance();
827  p0dShower->EDeposit = showerState->GetEDeposit();
828  p0dShower->Cone = showerState->GetCone()[0];
829 
830  p0dShower->ValidDimensions =
831  CountValidDimensions(p0dShower->PosVariance.Vect());
832 
833  p0dShower->Width = 0.0;
834  p0dShower->Length = 0.0;
835  p0dShower->SideDeposit = 0.0;
836  p0dShower->EndDeposit = 0.0;
837 
838  const ND::THandle<ND::THitSelection> showerHits = shower->GetHits();
839 
840  double totalCharge = 0.0;
841  float avgLen = 0.0;
842  float avgLen2 = 0.0;
843 
844  if (showerHits) {
845  std::map< int, std::pair<int, float> > hitInfo = HitTruthInfo(showerHits);
846 
847  std::map< int, std::pair< int, float > >::iterator parentID;
848  for(parentID = hitInfo.begin(); parentID != hitInfo.end(); ++parentID){
849  p0dShower->Truth_TrajIDs.push_back((*parentID).first);
850  p0dShower->Truth_HitCount.push_back((*parentID).second.first);
851  p0dShower->Truth_ChargeShare.push_back((*parentID).second.second);
852  }
853 
854  p0dShower->Truth_PrimaryTrajIDs = HitTruthPrimaryInfo(showerHits);
855 
856  ND::THitSelection::const_iterator hit;
857 
858  for (hit = showerHits->begin();
859  hit != showerHits->end();
860  ++hit) {
861 
862  // The distance vector between the hit and the shower position
863  TVector3 diff = (*hit)->GetPosition() - p0dShower->Position.Vect();
864 
865  // The distance vector along the shower direction
866  TVector3 para = (diff * p0dShower->Direction) * p0dShower->Direction;
867 
868  // The distance vector normal to the shower direction
869  TVector3 perp = diff - para;
870 
871  if ((*hit)->IsXHit()) {
872  diff.SetY(0.0);
873  perp.SetY(0.0);
874  }
875  else {
876  diff.SetX(0.0);
877  perp.SetX(0.0);
878  }
879 
880  float q = (*hit)->GetCharge();
881  totalCharge += q;
882 
883  p0dShower->Width += q * perp.Mag();
884 
885  avgLen += q * para.Mag();
886  avgLen2 += q * (para * para);
887 
888  // Get the side and end charge
889  ND::TGeometryId geomid = (*hit)->GetGeomId();
890  if (!ND::GeomId::P0D::IsP0D(geomid)) {continue;}
891  int p0dule = ND::TGeomInfo::P0D().GetBar(geomid).GetP0Dule();
892  int layer = ND::TGeomInfo::P0D().GetBar(geomid).GetLayer();
893  int bar = ND::TGeomInfo::P0D().GetBar(geomid).GetNumber();
894 
895  if(p0dule > 38){
896  p0dShower->EndDeposit += (*hit)->GetCharge();
897  }
898  if(bar < 4 || (layer == 0 && bar > 121) || (layer == 1 && bar > 129)){
899  p0dShower->SideDeposit += (*hit)->GetCharge();
900  }
901 
902  }
903  }
904 
905  p0dShower->Width /= std::max(totalCharge,1.0);
906 
907  avgLen /= std::max(totalCharge,1.0);
908  avgLen2 /= std::max(totalCharge,1.0);
909  double len2 = avgLen2 - avgLen*avgLen;
910 
911  p0dShower->Length = std::sqrt(std::max(0.0, len2));
912 
913  return showerID;
914 }
915 
918  const ND::THandle<ND::TReconCluster> cluster,
919  bool saveHits = true){
920 
921  ObjectID clusterID;
922  clusterID.id = fNClusters;
923  clusterID.type = ObjectID::kCluster;
924 
925  TP0DCluster* p0dCluster =
926  new ((*fClusters)[fNClusters++]) TP0DCluster;
927 
928  FillBaseObject(p0dCluster,cluster, saveHits);
929 
930  p0dCluster->NFiducialHits = -1;
931  p0dCluster->EDeposit = cluster->GetEDeposit();
932  p0dCluster->Position = cluster->GetPosition();
933  p0dCluster->PosVariance = cluster->GetPositionVariance();
934 
935  p0dCluster->ValidDimensions =
936  CountValidDimensions(p0dCluster->PosVariance.Vect());
937 
938  TMatrixF moments = cluster->GetMoments();
939  if( p0dCluster->arraySize ==
940  (moments.GetNrows() * moments.GetNcols()) ){
941  std::copy(moments.GetMatrixArray(),
942  moments.GetMatrixArray()+p0dCluster->arraySize,
943  p0dCluster->Moments);
944  }
945 
946  const ND::THandle<ND::THitSelection> clusterHits = cluster->GetHits();
947  if (clusterHits){
948 
949  std::map< int, std::pair<int, float> > hitInfo = HitTruthInfo(clusterHits);
950  std::map< int, std::pair< int, float > >::iterator parentID;
951 
952  for(parentID = hitInfo.begin(); parentID != hitInfo.end(); ++parentID){
953  p0dCluster->Truth_TrajIDs.push_back((*parentID).first);
954  p0dCluster->Truth_HitCount.push_back((*parentID).second.first);
955  p0dCluster->Truth_ChargeShare.push_back((*parentID).second.second);
956  }
957 
958  p0dCluster->Truth_PrimaryTrajIDs = HitTruthPrimaryInfo(clusterHits);
959  p0dCluster->NFiducialHits = 0;
960 
961  for (ND::THitSelection::const_iterator hit = clusterHits->begin();
962  hit != clusterHits->end(); ++hit){
963  TVector3 hitPosition = (*hit)->GetPosition();
964  float fiducial =
965  ND::TGeomInfo::P0D().WaterFiducialDistance(hitPosition.X(),
966  hitPosition.Y(),
967  hitPosition.Z());
968 
969  if (fiducial > 0){p0dCluster->NFiducialHits += 1;}
970  }
971  }
972  return clusterID;
973 }
974 
976  const ND::THandle<ND::TReconNode> node,
977  bool saveHits){
978 
979  short nodeID = fNNodes;
980  ND280Verbose("Fill Node");
981 
982  TP0DNode* p0dNode =
983  new ((*fNodes)[fNNodes++]) TP0DNode;
984 
985  // The node state may be a PIDState, TrackState or ShowerState, but
986  // they are all TMPositionDirectionStates, so we access the position
987  // and direction regardless.
988  ND::THandle<ND::TReconState> s1 = node->GetState();
989  if (s1) {
990  #if BEFORE_oaEvent(9,0,0)
991  const ND::TMPositionDirectionState* posDirState = NULL;
992  posDirState =
993  dynamic_cast<const ND::TMPositionDirectionState*>(ND::GetPointer(s1));
994  if(posDirState){
995  p0dNode->Position = posDirState->GetPosition();
996  p0dNode->PosVariance = posDirState->GetPositionVariance();
997  p0dNode->Direction = posDirState->GetDirection();
998  p0dNode->DirVariance = posDirState->GetDirectionVariance();
999  #else
1000  p0dNode->Position = GetPosition(s1);
1001  p0dNode->PosVariance = GetPositionVariance(s1);
1002  p0dNode->Direction = ND::TPIDState::GetStateDirection(s1);
1003  p0dNode->DirVariance = ND::TPIDState::GetStateDirectionVariance(s1);
1004  #endif
1005  p0dNode->ValidDimensions =
1006  CountValidDimensions(p0dNode->PosVariance.Vect());
1007  #if BEFORE_oaEvent(9,0,0)
1008  }
1009  #endif
1010  }
1011 
1012  // Every node should have an object
1013 
1014  ND::THandle<ND::TReconBase> nodeObject = node->GetObject();
1015  if(nodeObject){
1016  ND::THandle<ND::TReconState> objState = nodeObject->GetState();
1017  if(objState){
1018  #if BEFORE_oaEvent(9,0,0)
1019  const ND::TMEDepositState* eDepState = NULL;
1020  eDepState =
1021  dynamic_cast<const ND::TMEDepositState*>(ND::GetPointer(s1));
1022  if(eDepState){
1023  p0dNode->EDeposit = eDepState->GetEDeposit();
1024  }
1025  #else
1026  p0dNode->EDeposit = ND::TPIDState::GetStateEDeposit(objState);
1027  #endif
1028  }
1029 
1030  const ND::THandle<ND::THitSelection> nodeHits = nodeObject->GetHits();
1031  if (nodeHits){
1032  ND::THitSelection::const_iterator hit;
1033 
1034  for(hit = nodeHits->begin();
1035  hit != nodeHits->end(); ++hit){
1036 
1037  short hitId = FillHit(*hit);
1038  if(hitId >= 0){
1039  p0dNode->Hits.push_back(hitId);
1040  }
1041  }
1042 
1043  std::map< int, std::pair<int, float> > hitInfo = HitTruthInfo(nodeHits);
1044  std::map< int, std::pair< int, float > >::iterator parentID;
1045 
1046  for(parentID = hitInfo.begin(); parentID != hitInfo.end(); ++parentID){
1047  p0dNode->Truth_TrajIDs.push_back((*parentID).first);
1048  p0dNode->Truth_HitCount.push_back((*parentID).second.first);
1049  p0dNode->Truth_ChargeShare.push_back((*parentID).second.second);
1050  }
1051 
1052  p0dNode->Truth_PrimaryTrajIDs = HitTruthPrimaryInfo(nodeHits);
1053  }
1054  }
1055  return nodeID;
1056 }
1057 
1058 short
1059 ND::TP0DReconModule::FillHit(const ND::THandle<ND::THit> hit){
1060  if (!hit) {return -1;}
1061  ND::THandle<ND::TSingleHit> sh = hit;
1062  if (!sh) {return -1;}
1063 
1064  // Check if this Hit has already been filled, if so pass back the
1065  // reference, instead of creating a new one.
1066  UInt_t chanIdUInt = sh->GetChannelId().AsUInt();
1067  std::map<UInt_t, short>::const_iterator mapIter;
1068  mapIter = fTempHitMap.find(chanIdUInt);
1069  if( mapIter != fTempHitMap.end() ){
1070  return mapIter->second;
1071  }
1072 
1073  // We only want to save P0D hits at this time. If a hit is from
1074  // outside the P0D, skip and return -1.
1075  if(sh->GetChannelId().GetSubDetector() != ND::TChannelId::kP0D){
1076  return -1;
1077  }
1078 
1079  // Otherwise, make a new entry and save it in the TempHitMap
1080  short hitID = fNHits;
1081  fTempHitMap[chanIdUInt] = hitID;
1082 
1083  TP0DHit* p0dHit =
1084  new ((*fHits)[fNHits++]) TP0DHit;
1085 
1086  p0dHit->ChanID = sh->GetChannelId().AsUInt();
1087  p0dHit->GeomID = sh->GetGeomId().AsInt();
1088  p0dHit->Charge = sh->GetCharge();
1089  p0dHit->Time = sh->GetTime();
1090 
1091  return hitID;
1092 }
1093 
1094 std::map< int, std::pair<int, float> >
1095 ND::TP0DReconModule::HitTruthInfo(const ND::THandle<ND::THitSelection> hits){
1096 
1097  std::map< int, std::pair<int, float> > result;
1098 
1099  // then loop over everything and log the trajectory ids.
1100  for (ND::THitSelection::const_iterator hit = hits->begin();
1101  hit != hits->end(); hit++) {
1102 
1103  float hitCharge = (*hit)->GetCharge();
1104  std::map< int, int > hitCount;
1105  std::map< int, float > chargeShare;
1106 
1107  std::vector<ND::TG4VHit*> hitContribs = HitTruthInfo::GetHitTruthInfo(*hit);
1108 
1109  for (std::vector<ND::TG4VHit*>::const_iterator g4Hit = hitContribs.begin();
1110  g4Hit != hitContribs.end(); g4Hit++) {
1111 
1112  ND::TG4HitSegment* g4HitCast = dynamic_cast<ND::TG4HitSegment*>(*g4Hit);
1113 
1114  // For each contributing trajectory, increase the hit count and
1115  // give it an equal share of the energy deposit (the share may
1116  // not be equal, but that information is not currently
1117  // available).
1118  std::vector<int>::const_iterator trajIDIter;
1119  for (trajIDIter = g4HitCast->GetContributors().begin();
1120  trajIDIter != g4HitCast->GetContributors().end();
1121  ++trajIDIter){
1122 
1123  hitCount[(*trajIDIter)]++;
1124  chargeShare[(*trajIDIter)] +=
1125  g4HitCast->GetEnergyDeposit() / g4HitCast->GetContributors().size();
1126  }
1127  }
1128 
1129  for (std::map< int, int >::const_iterator hC = hitCount.begin();
1130  hC != hitCount.end(); ++hC){
1131  // If this hit had a contribution from a given ID, then increment that
1132  // ID's hitcount.
1133  if( (*hC).second > 0) {result[(*hC).first].first++;}
1134  }
1135 
1136  // Count up the contributed charge (this won't necessarily match the hit
1137  // Charge).
1138  float totalChargeShare = 0;
1139  for (std::map< int, float >::const_iterator cS = chargeShare.begin();
1140  cS != chargeShare.end(); ++cS){
1141  totalChargeShare += (*cS).second;
1142  }
1143 
1144  // For each entry, determine the contributed share.
1145  for (std::map< int, float >::const_iterator cS = chargeShare.begin();
1146  cS != chargeShare.end(); ++cS){
1147  result[(*cS).first].second += hitCharge * (*cS).second / totalChargeShare;
1148  }
1149  }
1150  return result;
1151 }
1152 
1153 std::vector<int>
1155  const ND::THandle<ND::THitSelection> hits){
1156 
1157  std::vector<int> result;
1158  // Loop over all hits, storing each primary ID which contributed
1159  for (ND::THitSelection::const_iterator hit = hits->begin();
1160  hit != hits->end(); hit++) {
1161  std::vector<ND::TG4VHit*> hitContribs = HitTruthInfo::GetHitTruthInfo(*hit);
1162 
1163  for (std::vector<ND::TG4VHit*>::const_iterator g4Hit = hitContribs.begin();
1164  g4Hit != hitContribs.end(); g4Hit++) {
1165  ND::TG4HitSegment* g4HitCast = dynamic_cast<ND::TG4HitSegment*>(*g4Hit);
1166 
1167  result.push_back(g4HitCast->GetPrimaryId());
1168  }
1169  }
1170 
1171  // Sort the list of primary IDs
1172  std::sort(result.begin(), result.end());
1173 
1174  // Remove duplicate IDs
1175  std::vector<int>::iterator newEnd =
1176  std::unique(result.begin(), result.end());
1177  result.erase(newEnd, result.end());
1178 
1179  return result;
1180 }
1181 
1182 short
1183 ND::TP0DReconModule::GetCycle(const ND::THandle<ND::THitSelection> hits){
1184  // As of July 2012, the p0dRecon results may contain objects from
1185  // outside the P0D. Currently, this is only due to the Incremental
1186  // matching with the TPC. Therefore, we consider all potential
1187  // hits, looking for a TFB hit.
1188 
1189  // Access the channel ID for each hit
1190  ND::TTFBChannelId chanID;//(hits->front()->GetChannelId());
1191  ND::THitSelection::const_iterator hit;
1192 
1193  for(hit = hits->begin(); hit != hits->end(); ++hit){
1194  ND::THandle<ND::TSingleHit> sh = (*hit);
1195  if (!sh){continue;}
1196  chanID = ND::TTFBChannelId(sh->GetChannelId());
1197  if( chanID.IsValid() && chanID.IsTFBChannel() &&
1198  (chanID.GetSubDetector() == ND::TChannelId::kP0D) ){
1199  break;
1200  }
1201  }
1202 
1203  // If the ID is invalid, return -1 as the cycle
1204  if(!chanID.IsValid() || !chanID.IsTFBChannel()){
1205  //ND280Error("Invalid P0D Event containing no cycles!");
1206  return -1;
1207  }
1208 
1209  // Otherwise, return the cycle of the channel ID
1210  short cycle = (short) chanID.GetCapacitor();
1211  return cycle;
1212 }
1213 
1214 short
1216  short valid = 0;
1217  if (std::abs(posVar.X()) < 1E+6) {valid += 1;}
1218  if (std::abs(posVar.Y()) < 1E+6) {valid += 2;}
1219  if (std::abs(posVar.Z()) < 1E+6) {valid += 4;}
1220  return valid;
1221 }
std::vector< short > Truth_HitCount
The number of THits that each truth trajectory contributed to.
virtual ObjectID FillTrackObject(const ND::THandle< ND::TReconTrack >, bool saveHits)
float Width
The &#39;width&#39; of the shower, the extent perpendicular to the direction.
std::vector< short > Clusters
Holds internal Ids of Clusters pertinent to this algorithm result.
UInt_t GeomID
Geometry Id of the TSingleHit.
float Moments[arraySize]
Moments of the cluster stored as a flat 3x3 matrix.
std::vector< float > Truth_ChargeShare
The weighted reconstructed charge deposited by each truth trajectory.
TLorentzVector Position
Position of the TMPositionDirectionState of the corresponding ND::TReconNode.
Contains a summary of the reconstruction information in a TSingleHit.
short Parent
The internal Id of the parent algorithm result of this one.
virtual ObjectID FillShowerObject(const ND::THandle< ND::TReconShower >, bool saveHits)
std::vector< short > Tracks
Holds internal Ids of Tracks pertinent to this algorithm result.
std::vector< int > Truth_PrimaryTrajIDs
The vector of primary true trajectory IDs which contribute to the ND::THits which are constituents of...
int NDOF
The Number of Degrees of Freedom in the reconstruction of the.
std::vector< short > Truth_HitCount
The number of THits that each truth trajectory contributed to.
float Fiducial
The distance to the outside of the fiducial volume.
std::vector< short > Vertices
Holds internal Ids of Vertices pertinent to this algorithm result.
ClassImp(ND::TBeamSummaryDataModule::TBeamSummaryData)
float Quality
The reported reconstruction &#39;quality&#39; of the corresponding ND::TReconShower.
short ValidDimensions
Bit flag demarkating valid dimensions for this cluster&#39;s positon.
TVector3 DirVariance
Variance on the TP0DParticle::Direction of the TPIDState of the corresponding ND::TReconPID.
virtual ObjectID FillParticleObject(const ND::THandle< ND::TReconPID >, bool saveHits)
short id
An internal Id for each Reconstruction object.
std::string AlgorithmName
The name of the p0dRecon algorithm that created this object.
std::vector< std::vector< float > > realPIDValues
Holds the PID variable values from ND::TRealDatum stored in the TReconPID.
float EndDeposit
The deposited charge in the end p0dules.
TVector3 Direction
Direction of the TPIDState of the corresponding ND::TReconPID.
std::vector< short > Truth_HitCount
The number of THits that each truth trajectory contributed to.
Contains a summary of the reconstruction information in a TReconShower.
std::vector< int > Truth_TrajIDs
The vector of true trajectory IDs which contribute to the ND::THits which are constituents of this sh...
TVector3 Direction
Direction of the TShowerState of the corresponding ND::TReconShower.
float EndDeposit
The deposited charge in the end p0dules.
#define CVSID
float Charge
The reconstructed charge of the corresponding TReconPID.
TLorentzVector PosVariance
Variance on the position of the TPIDState of the corresponding ND::TReconPID.
float Quality
The reported reconstruction &#39;quality&#39; of the corresponding ND::TReconPID.
std::vector< std::string > integerPIDNames
Holds the variable names of ND::TIntegerDatum stored in the TReconPID.
float SideDeposit
The deposited charge in the side bars.
TVector3 DirVariance
Variance on the TP0DShower::Direction of the TShowerState of the corresponding ND::TReconShower.
TLorentzVector PosVariance
Variance on the position of the TTrackState of the corresponding ND::TReconTrack. ...
std::vector< std::string > realPIDNames
Holds the variable names of ND::TRealDatum stored in the TReconPID.
TVector3 DirVariance
Variance on the TP0DTrack::Direction of the TTrackState of the corresponding ND::TReconTrack.
int NDOF
The Number of Degrees of Freedom in the reconstruction of the.
int NDOF
The Number of Degrees of Freedom in the reconstruction of the corresponding ND::TReconShower.
virtual void InitializeModule()
Initialize Module, override if necessary.
virtual std::map< int, std::pair< int, float > > HitTruthInfo(const ND::THandle< ND::THitSelection >)
int Status
The reported Status of the corresponding ND::TReconPID.
std::vector< int > Truth_TrajIDs
The vector of true trajectory IDs which contribute to the ND::THits which are constituents of this ve...
TLorentzVector PosVariance
Variance on the position of the corresponding ND::TReconCluster.
std::vector< short > Hits
Holds internal Ids of Hits pertinent to this algorithm result.
#define CVSTAG
std::vector< int > Truth_TrajIDs
The vector of true trajectory IDs which contribute to the ND::THits which are constituents of this ve...
TLorentzVector PosVariance
Variance on the position of the TShowerState of the corresponding ND::TReconShower.
std::vector< float > PID_weight
PID weights for each PID in TP0DParticle::PID.
Used to summarise the various reconstruction algorithm results that p0dRecon employs.
TVector3 Direction
Direction of the TTrackState of the corresponding ND::TReconTrack.
A summary of the reconstruction information in a TReconPID.
float SideDeposit
The deposited charge in the side bars.
TLorentzVector PosVariance
Variance on the position of the TMPositionDirectionState of the corresponding ND::TReconPID.
int Status
The reported Status of the corresponding ND::TReconShower.
short ValidDimensions
Bit flag demarkating valid dimensions for this track&#39;s position.
virtual ObjectID FillVertexObject(const ND::THandle< ND::TReconVertex >, bool saveHits)
float EDeposit
The total reconstructed energy deposit of the ND::TMEDepositState of the relevant ND::TReconNode...
virtual std::vector< int > HitTruthPrimaryInfo(const ND::THandle< ND::THitSelection >)
float Length
The length of the track calculated by summing over the distances.
std::vector< short > Truth_HitCount
The number of THits that each truth trajectory contributed to.
std::vector< int > Truth_PrimaryTrajIDs
The vector of primary true trajectory IDs which contribute to the ND::THits which are constituents of...
float SideDeposit
The deposited charge in the side bars.
virtual bool FillTree(ND::TND280Event &)
Fill all the stuff that goes in the output tree.
Contains a summary of the reconstruction information in a TReconVertex.
float Time
Reconstructed hit time from the corresponding TSingleHit.
Contains a summary of the reconstruction information in a TReconNode.
float Length
The RMS length of the shower, the extent parallel to the direction.
short ValidDimensions
Bit flag demarkating valid dimensions for this shower&#39;s position.
std::vector< float > Truth_ChargeShare
The weighted reconstructed charge deposited by each truth trajectory.
std::vector< short > Truth_HitCount
The number of THits that each truth trajectory contributed to.
static const int arraySize
Size of the TP0DCluster::Moments array.
std::vector< int > Truth_PrimaryTrajIDs
The vector of primary true trajectory IDs which contribute to the ND::THits which are constituents of...
std::vector< short > Hits
Holds internal Ids of Hits pertinent to this reconstruction node.
std::vector< int > Truth_PrimaryTrajIDs
The vector of primary true trajectory IDs which contribute to the ND::THits which are constituents of...
OType_t type
The reconstruction object type that this internal Id refers to.
std::vector< int > Truth_PrimaryTrajIDs
The vector of primary true trajectory IDs which contribute to the ND::THits which are constituents of...
virtual ObjectID FillClusterObject(const ND::THandle< ND::TReconCluster >, bool saveHits)
float EDeposit
The total reconstructed energy deposit of the corresponding ND::TReconTrack.
short ValidDimensions
Bit flag demarkating valid dimensions for this vertex&#39;s position.
float EndDeposit
The deposited charge in the end p0dules.
std::vector< short > Particles
Holds internal Ids of Particles pertinent to this algorithm result.
int NDOF
The Number of Degrees of Freedom in the reconstruction of the corresponding ND::TReconTrack.
std::string FullName
The name of the p0dRecon algorithm that corresponds to this.
std::vector< short > Truth_HitCount
The number of THits that each truth trajectory contributed to.
int Status
The reported Status of the corresponding ND::TReconTrack.
short ValidDimensions
Bit flag demarkating valid dimensions for this particle&#39;s position.
TLorentzVector PosVariance
Variance on the position of the TVertexState of the corresponding ND::TReconVertex.
Contains a summary of the reconstruction information in a TReconCluster. Contains a summary of the re...
std::vector< std::vector< short > > integerPIDValues
Holds the PID variable values from ND::TIntegerDatum stored in the TReconPID.
virtual Bool_t ProcessFirstEvent(ND::TND280Event &)
Is called after the first event is loaded in.
TP0DReconModule(const char *name="P0D", const char *title="P0D Recon Module")
TLorentzVector Position
Position of the TPIDState of the corresponding ND::TReconPID.
short FillHit(const ND::THandle< ND::THit >)
void FillBaseObject(T basePtr, ND::THandle< ND::TReconBase > baseObject, bool saveHits)
float Charge
Reconstructed hit charge without attenuation correction from the corresponding TSingleHit.
std::vector< short > Clusters
Holds internal Ids of Clusters pertinent to this reconstructed shower.
float EDeposit
The total reconstructed energy deposit of the corresponding ND::TReconShower.
short GetCycle(const ND::THandle< ND::THitSelection >)
float Quality
The reported reconstruction &#39;quality&#39; of the corresponding ND::TReconTrack.
std::vector< int > Truth_TrajIDs
The vector of true trajectory IDs which contribute to the ND::THits which are constituents of this ve...
TLorentzVector Position
Position of the corresponding ND::TReconCluster.
std::vector< float > Truth_ChargeShare
The weighted reconstructed charge deposited by each truth trajectory.
TVector3 DirVariance
Variance on the TP0DNode::Direction of the TMPositionDirectionState of the corresponding ND::TReconNo...
std::vector< float > Truth_ChargeShare
The weighted reconstructed charge deposited by each truth trajectory.
std::vector< float > Truth_ChargeShare
The weighted reconstructed charge deposited by each truth trajectory.
virtual ObjectID FillReconObject(const ND::THandle< ND::TReconBase >, bool saveHits)
std::vector< int > Truth_TrajIDs
The vector of true trajectory IDs which contribute to the ND::THits which are constituents of this tr...
short UsedHitCluster
The internal Id of the cluster of hits which were used in a.
float Momentum
The reconstructed momentum of the corresponding TReconPID.
float Cone
The opening angle of the TShowerState cone of the corresponding TReconShower.
short CountValidDimensions(TVector3 posVar)
short UnusedHitCluster
The internal Id of the cluster of hits which were not used in a.
virtual short FillNode(const ND::THandle< ND::TReconNode >, bool saveHits)
TLorentzVector Position
Position of the TShowerState of the corresponding ND::TReconShower.
short NFiducialHits
The number of THits in the cluster which are within the fiducial volume.
virtual short FillAlgorithmResult(const ND::THandle< ND::TAlgorithmResult >, short)
std::vector< float > Truth_ChargeShare
The weighted reconstructed charge deposited by each truth trajectory.
TLorentzVector Position
Position of the TVertexState of the corresponding ND::TReconVertex.
float Quality
The reported reconstruction &#39;quality&#39; of the corresponding ND::TReconVertex.
TLorentzVector Position
Position of the TTrackState of the corresponding ND::TReconTrack.
UInt_t ChanID
Channel Id of the TSingleHit.
virtual void InitializeBranches()
Initialize Branches. Don&#39;t do anything else in this function.
std::vector< short > AlgoResults
Holds internal Ids of daughter algorithm results to this one.
int Status
The reported Status of the corresponding ND::TReconVertex.
short ValidDimensions
Bit flag demarkating valid dimensions for this node&#39;s position.
TVector3 Direction
Direction of the TMPositionDirectionState of the corresponding ND::TReconNode.
std::vector< short > PID
Potential PIDs (ND::TReconPID::ParticleId) matching with.
An internal Id and object type for each Reconstruction object.
std::vector< short > Showers
Holds internal Ids of Showers pertinent to this algorithm result.
std::vector< int > Truth_PrimaryTrajIDs
The vector of primary true trajectory IDs which contribute to the ND::THits which are constituents of...
std::vector< int > Truth_TrajIDs
The vector of true trajectory IDs which contribute to the ND::THits which are constituents of this ve...
float EDeposit
The total reconstructed energy deposit of the corresponding ND::TReconCluster.

Package Summary
Package Name: eventAnalysis
Package Version: 7.0-49-g0ac7482
Package Manager:

Generated on Mon Mar 25 2024 14:43:59 for eventAnalysis by doxygen 1.8.5