MCParticleCreator.cxx
Go to the documentation of this file.
2 #include "nug4/MagneticFieldServices/MagneticFieldService.h"
4 #include "canvas/Persistency/Common/FindManyP.h"
5 #include "canvas/Persistency/Common/FindOneP.h"
6 
7 #include "CoreUtils/ServiceUtil.h"
8 
9 #include "CaloHitCreator.h"
10 #include "MCParticleCreator.h"
11 #include "TrackCreator.h"
12 
13 #include "MCCheater/BackTracker.h"
14 
15 #include "Pandora/PdgTable.h"
16 
17 #include <cmath>
18 #include <limits>
19 
20 namespace gar {
21  namespace gar_pandora {
22 
23  MCParticleCreator::MCParticleCreator(const Settings &settings, const pandora::Pandora *const pPandora, const RotationTransformation *const pRotation)
24  : m_settings(settings),
25  m_pandora(*pPandora),
26  m_rotation(*pRotation)
27  {
28  fGeo = gar::providerFrom<geo::GeometryGAr>();
29  auto const *magFieldService = gar::providerFrom<mag::MagneticFieldService>();
30  G4ThreeVector zerovec(0, 0, 0);
31  G4ThreeVector magfield = magFieldService->FieldAtPoint(zerovec);
32  m_bField = magfield[0]; //x component at (0, 0, 0)
33  m_origin[0] = fGeo->GetOriginX();
34  m_origin[1] = fGeo->GetOriginY();
35  m_origin[2] = fGeo->GetOriginZ();
36  }
37 
38  //------------------------------------------------------------------------------------------------------------------------------------------
39 
41  {
42  }
43 
44  //------------------------------------------------------------------------------------------------------------------------------------------
45 
46  pandora::StatusCode MCParticleCreator::CreateMCParticles(const art::Event &pEvent)
47  {
48  PANDORA_RETURN_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, this->CollectMCParticles(pEvent, m_settings.m_geantModuleLabel, artMCParticleVector));
50  PANDORA_RETURN_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, this->CollectGeneratorMCParticles(pEvent, m_settings.m_generatorModuleLabel, generatorArtMCParticleVector));
51  PANDORA_RETURN_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, this->CollectMCParticles(pEvent, m_settings.m_geantModuleLabel, artMCTruthToMCParticles, artMCParticlesToMCTruth));
52  PANDORA_RETURN_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, this->CreateMCParticles());
53 
54  return pandora::STATUS_CODE_SUCCESS;
55  }
56 
57  //------------------------------------------------------------------------------------------------------------------------------------------
58 
59  pandora::StatusCode MCParticleCreator::CreateMCParticles() const
60  {
61  MCParticleMap particleMap;
62  for (MCParticlesToMCTruth::const_iterator iter = artMCParticlesToMCTruth.begin(), iterEnd = artMCParticlesToMCTruth.end(); iter != iterEnd; ++iter)
63  {
64  const art::Ptr<simb::MCParticle> particle = iter->first;
65  particleMap[particle->TrackId()] = particle;
66  }
67 
68  int neutrinoCounter(0);
69  for (MCTruthToMCParticles::const_iterator iter1 = artMCTruthToMCParticles.begin(), iterEnd1 = artMCTruthToMCParticles.end(); iter1 != iterEnd1; ++iter1)
70  {
71  const art::Ptr<simb::MCTruth> truth = iter1->first;
72  if (truth->NeutrinoSet())
73  {
74  const simb::MCNeutrino neutrino(truth->GetNeutrino());
75  ++neutrinoCounter;
76 
77  const pandora::CartesianVector momentum(neutrino.Nu().Px(), neutrino.Nu().Py(), neutrino.Nu().Pz());
78  const pandora::CartesianVector vertex( (neutrino.Nu().Vx() - m_origin[0]) * CLHEP::cm, (neutrino.Nu().Vy() - m_origin[1]) * CLHEP::cm, (neutrino.Nu().Vz() - m_origin[2]) * CLHEP::cm);
79  const pandora::CartesianVector endpoint( (neutrino.Nu().EndX() - m_origin[0]) * CLHEP::cm, (neutrino.Nu().EndY() - m_origin[1]) * CLHEP::cm, (neutrino.Nu().EndZ() - m_origin[2]) * CLHEP::cm);
80 
81  const pandora::CartesianVector newmomentum = m_rotation.MakeRotation(momentum);
82  const pandora::CartesianVector newvertex = m_rotation.MakeRotation(vertex);
83  const pandora::CartesianVector newendpoint = m_rotation.MakeRotation(endpoint);
84 
85  PandoraApi::MCParticle::Parameters mcParticleParameters;
86  mcParticleParameters.m_energy = neutrino.Nu().E();
87  mcParticleParameters.m_momentum = newmomentum;
88  mcParticleParameters.m_vertex = newvertex;
89  mcParticleParameters.m_endpoint = newendpoint;
90  mcParticleParameters.m_particleId = neutrino.Nu().PdgCode();
91  mcParticleParameters.m_mcParticleType = pandora::MC_3D;
92  mcParticleParameters.m_pParentAddress = &neutrino;
93 
94  PANDORA_THROW_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, PandoraApi::MCParticle::Create(m_pandora, mcParticleParameters));
95 
96  // Loop over associated particles
97  const MCParticleVector &particleVector = iter1->second;
98  for (MCParticleVector::const_iterator iter2 = particleVector.begin(), iterEnd2 = particleVector.end(); iter2 != iterEnd2; ++iter2)
99  {
100  const art::Ptr<simb::MCParticle> particle = *iter2;
101  // Mother/Daughter Links
102  if (particle->Mother() == 0)
103  {
104  try
105  {
106  PANDORA_THROW_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, PandoraApi::SetMCParentDaughterRelationship(m_pandora, &neutrino, particle.get()));
107  }
108  catch (const pandora::StatusCodeException &)
109  {
110  MF_LOG_WARNING("MCParticleCreator") << "CreatePandoraMCParticles - unable to create mc particle relationship, invalid information supplied " << std::endl;
111  continue;
112  }
113  }
114  }
115  }
116  }
117 
118  MF_LOG_DEBUG("MCParticleCreator") << " Number of Pandora neutrinos: " << neutrinoCounter << std::endl;
119 
120  for (MCParticleMap::const_iterator iterI = particleMap.begin(), iterEndI = particleMap.end(); iterI != iterEndI; ++iterI)
121  {
122  const art::Ptr<simb::MCParticle> pMcParticle = iterI->second;
123 
124  // Lookup position and kinematics at start and end points
125  const pandora::CartesianVector momentum(pMcParticle->Px(), pMcParticle->Py(), pMcParticle->Pz());
126  const pandora::CartesianVector vertex( (pMcParticle->Vx() - m_origin[0]) * CLHEP::cm, (pMcParticle->Vy() - m_origin[1]) * CLHEP::cm, (pMcParticle->Vz() - m_origin[2]) * CLHEP::cm);
127  const pandora::CartesianVector endpoint( (pMcParticle->EndX() - m_origin[0]) * CLHEP::cm, (pMcParticle->EndY() - m_origin[1]) * CLHEP::cm, (pMcParticle->EndZ() - m_origin[2]) * CLHEP::cm);
128 
129  const pandora::CartesianVector newmomentum = m_rotation.MakeRotation(momentum);
130  const pandora::CartesianVector newvertex = m_rotation.MakeRotation(vertex);
131  const pandora::CartesianVector newendpoint = m_rotation.MakeRotation(endpoint);
132 
133  PandoraApi::MCParticle::Parameters mcParticleParameters;
134  mcParticleParameters.m_energy = pMcParticle->E();
135  mcParticleParameters.m_particleId = pMcParticle->PdgCode();
136  mcParticleParameters.m_mcParticleType = pandora::MC_3D;
137  mcParticleParameters.m_pParentAddress = pMcParticle.get();
138  mcParticleParameters.m_momentum = newmomentum;
139  mcParticleParameters.m_vertex = newvertex;
140  mcParticleParameters.m_endpoint = newendpoint;
141 
142  MF_LOG_DEBUG("MCParticleCreator") << " Adding MC Particle with parameters "
143  << " mcParticleParameters.m_energy = " << mcParticleParameters.m_energy.Get()
144  << " mcParticleParameters.m_particleId = " << mcParticleParameters.m_particleId.Get()
145  << " mcParticleParameters.m_mcParticleType = " << mcParticleParameters.m_mcParticleType.Get()
146  << " mcParticleParameters.m_pParentAddress = " << mcParticleParameters.m_pParentAddress.Get()
147  << " mcParticleParameters.m_momentum = " << mcParticleParameters.m_momentum.Get()
148  << " mcParticleParameters.m_vertex = " << mcParticleParameters.m_vertex.Get()
149  << " mcParticleParameters.m_endpoint = " << mcParticleParameters.m_endpoint.Get();
150 
151  try
152  {
153  MF_LOG_DEBUG("MCParticleCreator::CreateMCParticles")
154  << " Creating mc particle " << pMcParticle.get()
155  << " of pdg " << pMcParticle->PdgCode()
156  << " with TrackID " << pMcParticle->TrackId()
157  << " and energy " << pMcParticle->E() << " GeV";
158 
159  PANDORA_THROW_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, PandoraApi::MCParticle::Create(m_pandora, mcParticleParameters));
160 
161  // Create parent-daughter relationships
162  const int id_mother(pMcParticle->Mother());
163  MCParticleMap::const_iterator iterJ = particleMap.find(id_mother);
164  if (iterJ != particleMap.end())
165  {
166  try
167  {
168  MF_LOG_DEBUG("MCParticleCreator::CreateMCParticles")
169  << " Adding daughter relation " << iterJ->second.get()
170  << " to mc particle " << pMcParticle.get();
171 
172  PANDORA_THROW_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, PandoraApi::SetMCParentDaughterRelationship(m_pandora, iterJ->second.get(), pMcParticle.get()));
173  }
174  catch (const pandora::StatusCodeException &)
175  {
176  MF_LOG_WARNING("MCParticleCreator") << "CreatePandoraMCParticles - Unable to create mc particle relationship, invalid information supplied " << std::endl;
177  continue;
178  }
179  }
180  }
181  catch (const pandora::StatusCodeException &)
182  {
183  MF_LOG_WARNING("MCParticleCreator") << "CreatePandoraMCParticles - Unable to create MCParticle " << std::endl;
184  continue;
185  }
186  }
187 
188  return pandora::STATUS_CODE_SUCCESS;
189  }
190 
191  //------------------------------------------------------------------------------------------------------------------------------------------
192 
193  pandora::StatusCode MCParticleCreator::CreateTrackToMCParticleRelationships(const TrackVector &trackVector) const
194  {
195  MCParticleMap particleMap;
196  for (MCParticlesToMCTruth::const_iterator iter = artMCParticlesToMCTruth.begin(), iterEnd = artMCParticlesToMCTruth.end(); iter != iterEnd; ++iter)
197  {
198  const art::Ptr<simb::MCParticle> particle = iter->first;
199  particleMap[particle->TrackId()] = particle;
200  }
201 
202  for( auto const& itr : trackVector )
203  {
204  try
205  {
206  const gar::rec::Track *pTrack = itr.get();
207 
208  const float *trackParams = pTrack->TrackParEnd(); //y, z, omega, phi, lambda
209  const float omega = trackParams[2] / CLHEP::cm;
210  const float d0 = std::sqrt(trackParams[0]*trackParams[0] + trackParams[1]*trackParams[1]) * CLHEP::cm;
211  const float z0 = pTrack->End()[0] * CLHEP::cm;
212 
213  const pandora::Helix helixFit(trackParams[3], d0, z0, omega, std::tan(trackParams[4]), m_bField);
214  const float recoMomentum(helixFit.GetMomentum().GetMagnitude());
215 
216  // Use momentum magnitude to identify best mc particle
217  simb::MCParticle *pBestMCParticle = nullptr;
218  float bestDeltaMomentum(std::numeric_limits<float>::max());
219 
220  //Loop over the MCParticles
221  for (MCParticleMap::const_iterator iterI = particleMap.begin(), iterEndI = particleMap.end(); iterI != iterEndI; ++iterI)
222  {
223  simb::MCParticle *pMCParticle = const_cast<simb::MCParticle*>(iterI->second.get());
224 
225  if (nullptr == pMCParticle)
226  continue;
227 
228  const pandora::CartesianVector momentum(pMCParticle->Px(), pMCParticle->Py(), pMCParticle->Pz());
229  const pandora::CartesianVector newmomentum = m_rotation.MakeRotation(momentum);
230  const float trueMomentum(newmomentum.GetMagnitude());
231 
232  const float deltaMomentum(std::fabs(recoMomentum - trueMomentum));
233 
234  if (deltaMomentum < bestDeltaMomentum)
235  {
236  pBestMCParticle = pMCParticle;
237  bestDeltaMomentum = deltaMomentum;
238  }
239  }
240 
241  if (nullptr == pBestMCParticle)
242  continue;
243 
244  MF_LOG_DEBUG("MCParticleCreator::CreateTrackToMCParticleRelationships")
245  << "Found MCParticle " << pBestMCParticle
246  << " associated to track " << pTrack
247  << " with best delta momentum " << bestDeltaMomentum;
248 
249  PANDORA_THROW_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, PandoraApi::SetTrackToMCParticleRelationship(m_pandora, pTrack, pBestMCParticle));
250  }
251  catch (pandora::StatusCodeException &statusCodeException)
252  {
253  MF_LOG_ERROR("MCParticleCreator::CreateTrackToMCParticleRelationships")
254  << "Failed to extract track to mc particle relationship: " << statusCodeException.ToString();
255  }
256  }
257 
258  return pandora::STATUS_CODE_SUCCESS;
259  }
260 
261  //------------------------------------------------------------------------------------------------------------------------------------------
262 
263  pandora::StatusCode MCParticleCreator::CreateCaloHitToMCParticleRelationships(const CalorimeterHitVector &calorimeterHitVector) const
264  {
265  cheat::BackTrackerCore const* bt = gar::providerFrom<cheat::BackTracker>();
266  std::map< eveLoc, std::vector< art::Ptr<gar::rec::CaloHit> > > eveCaloHitMap;
267 
268  MCParticleMap particleMap;
269  for (MCParticlesToMCTruth::const_iterator iter = artMCParticlesToMCTruth.begin(), iterEnd = artMCParticlesToMCTruth.end(); iter != iterEnd; ++iter)
270  {
271  const art::Ptr<simb::MCParticle> particle = iter->first;
272  particleMap[particle->TrackId()] = particle;
273  }
274 
275  // loop over all hits and fill in the map
276  for( auto const& itr : calorimeterHitVector )
277  {
278  std::vector<gar::cheat::CalIDE> eveides = bt->CaloHitToCalIDEs(itr);
279 
280  // loop over all eveides for this hit
281  for(size_t ieve = 0; ieve < eveides.size(); ieve++) {
282  MF_LOG_DEBUG("MCParticleCreator::CreateCaloHitToMCParticleRelationships")
283  << " Found eveID " << eveides[ieve].trackID
284  << " associated to art hit " << itr;
285 
286  if(eveides[ieve].energyFrac < 0.1) continue;
287 
288  eveLoc el(eveides[ieve].trackID);
289  eveCaloHitMap[el].push_back(itr);
290  } // end loop over eve IDs for this hit
291  }// end loop over hits
292 
293  for(auto const &hitMapItr : eveCaloHitMap)
294  {
295  MF_LOG_DEBUG("MCParticleCreator::CreateCaloHitToMCParticleRelationships")
296  << " Trying to find mcp associated to eveID " << hitMapItr.first.GetEveID();
297 
298  const simb::MCParticle *part = bt->TrackIDToParticle(hitMapItr.first.GetEveID());
299 
300  if( nullptr == part ) {
301  MF_LOG_WARNING("MCParticleCreator::CreateCaloHitToMCParticleRelationships")
302  << "Cannot find MCParticle for eveid: " << hitMapItr.first.GetEveID();
303  continue;
304  }
305 
306  // const int eveID = hitMapItr.first.GetEveID();
307  const int trackID = part->TrackId();
308  // const float partE = part->E();
309 
310  for (MCParticleMap::const_iterator iterI = particleMap.begin(), iterEndI = particleMap.end(); iterI != iterEndI; ++iterI)
311  {
312  simb::MCParticle *pMCParticleCalo = const_cast<simb::MCParticle*>(iterI->second.get());
313 
314  if (nullptr == pMCParticleCalo)
315  continue;
316  if (trackID != pMCParticleCalo->TrackId())
317  continue;
318 
319  //Need to get the original monte carlo particle that created this one (mother <- daughters)
320  const simb::MCParticle *pMCPrimary = MCParticleCreator::GetFinalStateMCParticle(particleMap, pMCParticleCalo);
321  if (nullptr == pMCPrimary)
322  continue;
323 
324  for(auto const& itr : hitMapItr.second)
325  {
326  const gar::rec::CaloHit *hit = itr.get();
327  try
328  {
329  PANDORA_THROW_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, PandoraApi::SetCaloHitToMCParticleRelationship(m_pandora, hit, pMCPrimary, hit->Energy()));
330  }
331  catch (const pandora::StatusCodeException &)
332  {
333  MF_LOG_WARNING("MCParticleCreator") << "CreateCaloHitToMCParticleRelationships - unable to create calo hit to mc particle relationship, invalid information supplied " << std::endl;
334  continue;
335  }
336  }
337  }
338  }
339 
340  return pandora::STATUS_CODE_SUCCESS;
341  }
342 
343  //------------------------------------------------------------------------------------------------------------------------------------------
344 
345  pandora::StatusCode MCParticleCreator::CollectMCParticles(const art::Event &pEvent, const std::string &label, MCParticleVector &particleVector)
346  {
347  auto theParticles = pEvent.getHandle< RawMCParticleVector >(label);
348  if (!theParticles)
349  {
350  MF_LOG_WARNING("MCParticleCreator") << " Failed to find MC particles for label " << label << std::endl;
351  return pandora::STATUS_CODE_NOT_FOUND;
352  }
353 
354  MF_LOG_DEBUG("MCParticleCreator") << " Found: " << theParticles->size() << " MC particles " << std::endl;
355 
356  for (unsigned int i = 0; i < theParticles->size(); ++i)
357  {
358  const art::Ptr<simb::MCParticle> particle(theParticles, i);
359  particleVector.push_back(particle);
360  }
361 
362  return pandora::STATUS_CODE_SUCCESS;
363  }
364 
365  //------------------------------------------------------------------------------------------------------------------------------------------
366 
367  pandora::StatusCode MCParticleCreator::CollectGeneratorMCParticles(const art::Event &pEvent, const std::string &label, RawMCParticleVector &particleVector)
368  {
369  auto mcTruthBlocks = pEvent.getHandle< std::vector<simb::MCTruth> >(label);
370  if (!mcTruthBlocks)
371  {
372  MF_LOG_WARNING("MCParticleCreator") << " Failed to find MC Truth for generator " << label << std::endl;
373  return pandora::STATUS_CODE_NOT_FOUND;
374  }
375 
376  MF_LOG_DEBUG("MCParticleCreator") << " Found: " << mcTruthBlocks->size() << " MC truth blocks " << std::endl;
377 
378  if (mcTruthBlocks->size() != 1)
379  throw cet::exception("MCParticleCreator") << " PandoraCollector::CollectGeneratorMCParticles --- Unexpected number of MC truth blocks ";
380 
381  const art::Ptr<simb::MCTruth> mcTruth(mcTruthBlocks, 0);
382  for (int i = 0; i < mcTruth->NParticles(); ++i)
383  {
384  particleVector.push_back(mcTruth->GetParticle(i));
385  }
386 
387  return pandora::STATUS_CODE_SUCCESS;
388  }
389 
390  //------------------------------------------------------------------------------------------------------------------------------------------
391 
392  pandora::StatusCode MCParticleCreator::CollectMCParticles(const art::Event &pEvent, const std::string &label, MCTruthToMCParticles &truthToParticles, MCParticlesToMCTruth &particlesToTruth)
393  {
394  auto theParticles = pEvent.getHandle< RawMCParticleVector >(label);
395  if (!theParticles)
396  {
397  MF_LOG_WARNING("MCParticleCreator") << " Failed to find MC particles for label " << label << std::endl;
398  return pandora::STATUS_CODE_NOT_FOUND;
399  }
400 
401  MF_LOG_DEBUG("MCParticleCreator") << " Found: " << theParticles->size() << " MC particles " << std::endl;
402 
403  art::FindOneP<simb::MCTruth> theTruthAssns(theParticles, pEvent, label);
404 
405  for (unsigned int i = 0, iEnd = theParticles->size(); i < iEnd; ++i)
406  {
407  const art::Ptr<simb::MCParticle> particle(theParticles, i);
408  const art::Ptr<simb::MCTruth> truth(theTruthAssns.at(i));
409  truthToParticles[truth].push_back(particle);
410  particlesToTruth[particle] = truth;
411  }
412 
413  return pandora::STATUS_CODE_SUCCESS;
414  }
415 
416  //------------------------------------------------------------------------------------------------------------------------------------------
417 
419  {
420  // Navigate upward through MC daughter/parent links - collect this particle and all its parents
421  MCParticleVector mcVector;
422 
423  int trackID(inputParticle->TrackId());
424 
425  while(1)
426  {
427  MCParticleMap::const_iterator pIter = particleMap.find(trackID);
428  if (particleMap.end() == pIter)
429  break; // Can't find MC Particle for this track ID [break]
430 
431  const art::Ptr<simb::MCParticle> particle = pIter->second;
432  mcVector.push_back(particle);
433 
434  trackID = particle->Mother();
435  }
436 
437  // Navigate downward through MC parent/daughter links - return the first long-lived charged particle
438  for (MCParticleVector::const_reverse_iterator iter = mcVector.rbegin(), iterEnd = mcVector.rend(); iter != iterEnd; ++iter)
439  {
440  const art::Ptr<simb::MCParticle> nextParticle = *iter;
441 
442  if (MCParticleCreator::IsVisible(nextParticle))
443  return nextParticle.get();
444  }
445 
446  throw cet::exception("LArPandora"); // need to catch this exception
447  }
448 
449  //------------------------------------------------------------------------------------------------------------------------------------------
450 
452  {
453  // Include long-lived charged particles
454  const int pdg(particle->PdgCode());
455 
456  if ((pandora::E_MINUS == std::abs(pdg)) || (pandora::MU_MINUS == std::abs(pdg)) || (pandora::PROTON == std::abs(pdg)) ||
457  (pandora::PI_PLUS == std::abs(pdg)) || (pandora::K_PLUS == std::abs(pdg)) ||
458  (pandora::SIGMA_MINUS == std::abs(pdg)) || (pandora::SIGMA_PLUS == std::abs(pdg)) || (pandora::HYPERON_MINUS == std::abs(pdg)) ||
459  (pandora::PHOTON == std::abs(pdg)) || (pandora::NEUTRON == std::abs(pdg)))
460  return true;
461 
462  // TODO: What about ions, neutrons, photons? (Have included neutrons and photons for now)
463 
464  return false;
465  }
466 
467  //------------------------------------------------------------------------------------------------------------------------------------------
468 
470  : m_geantModuleLabel( "" ),
471  m_generatorModuleLabel( "" )
472  {
473  }
474  }
475 }
static constexpr double cm
Definition: Units.h:68
double E(const int i=0) const
Definition: MCParticle.h:233
std::vector< CalIDE > CaloHitToCalIDEs(art::Ptr< rec::CaloHit > const &hit) const
std::string m_geantModuleLabel
The geant4 label.
pandora::StatusCode CollectMCParticles(const art::Event &pEvent, const std::string &label, MCParticleVector &particleVector)
std::vector< art::Ptr< gar::rec::CaloHit > > CalorimeterHitVector
int PdgCode() const
Definition: MCParticle.h:212
const simb::MCNeutrino & GetNeutrino() const
Definition: MCTruth.h:77
double Py(const int i=0) const
Definition: MCParticle.h:231
const RotationTransformation & m_rotation
double EndZ() const
Definition: MCParticle.h:228
Handle< PROD > getHandle(SelectorBase const &) const
Definition: DataViewImpl.h:382
std::string string
Definition: nybbler.cc:12
std::string m_generatorModuleLabel
The generator label.
int Mother() const
Definition: MCParticle.h:213
float GetOriginX() const
Definition: GeometryCore.h:548
double Px(const int i=0) const
Definition: MCParticle.h:230
const pandora::Pandora & m_pandora
Reference to the pandora object to create the mc particles.
#define MF_LOG_ERROR(category)
static const simb::MCParticle * GetFinalStateMCParticle(const MCParticleMap &particleMap, const simb::MCParticle *inputParticle)
intermediate_table::const_iterator const_iterator
int NParticles() const
Definition: MCTruth.h:75
std::vector< art::Ptr< simb::MCParticle > > MCParticleVector
double EndY() const
Definition: MCParticle.h:227
const geo::GeometryCore * fGeo
MCTruthToMCParticles artMCTruthToMCParticles
int TrackId() const
Definition: MCParticle.h:210
float GetOriginZ() const
Definition: GeometryCore.h:552
T abs(T value)
MCParticleCreator(const Settings &settings, const pandora::Pandora *const pPandora, const RotationTransformation *const pRotation)
std::vector< simb::MCParticle > RawMCParticleVector
bt
Definition: tracks.py:83
MCParticlesToMCTruth artMCParticlesToMCTruth
pandora::StatusCode CreateCaloHitToMCParticleRelationships(const CalorimeterHitVector &calorimeterHitVector) const
pandora::StatusCode CollectGeneratorMCParticles(const art::Event &pEvent, const std::string &label, RawMCParticleVector &particleVector)
float Energy() const
Definition: CaloHit.h:69
simb::MCParticle * TrackIDToParticle(int const &id) const
const float * TrackParEnd() const
Definition: Track.h:152
float GetOriginY() const
Definition: GeometryCore.h:550
static int max(int a, int b)
const float * End() const
Definition: Track.h:140
std::map< int, art::Ptr< simb::MCParticle > > MCParticleMap
Detector simulation of raw signals on wires.
const simb::MCParticle & GetParticle(int i) const
Definition: MCTruth.h:76
std::map< art::Ptr< simb::MCParticle >, art::Ptr< simb::MCTruth > > MCParticlesToMCTruth
const pandora::CartesianVector MakeRotation(const pandora::CartesianVector &initialVec) const
General GArSoft Utilities.
double Vx(const int i=0) const
Definition: MCParticle.h:221
pandora::StatusCode CreateTrackToMCParticleRelationships(const TrackVector &trackVector) const
#define MF_LOG_DEBUG(id)
double Pz(const int i=0) const
Definition: MCParticle.h:232
std::map< art::Ptr< simb::MCTruth >, MCParticleVector > MCTruthToMCParticles
double Vz(const int i=0) const
Definition: MCParticle.h:223
std::vector< art::Ptr< gar::rec::Track > > TrackVector
Definition: TrackCreator.h:12
RawMCParticleVector generatorArtMCParticleVector
pandora::StatusCode CreateMCParticles() const
bool NeutrinoSet() const
Definition: MCTruth.h:78
const Settings m_settings
The mc particle creator settings.
#define MF_LOG_WARNING(category)
def momentum(x1, x2, x3, scale=1.)
double EndX() const
Definition: MCParticle.h:226
T const * get() const
Definition: Ptr.h:149
Event generator information.
Definition: MCNeutrino.h:18
double Vy(const int i=0) const
Definition: MCParticle.h:222
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
QTextStream & endl(QTextStream &s)
static bool IsVisible(const art::Ptr< simb::MCParticle > particle)
vertex reconstruction