DD4hep - The AIDA detector description toolkit for high energy physics experiments
DD4hep  Rev:Unversioneddirectory
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Geant4DataDump.cpp
Go to the documentation of this file.
1 // $Id: $
2 //==========================================================================
3 // AIDA Detector description implementation for LCD
4 //--------------------------------------------------------------------------
5 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
6 // All rights reserved.
7 //
8 // For the licensing terms see $DD4hepINSTALL/LICENSE.
9 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
10 //
11 // Author : M.Frank
12 //
13 //==========================================================================
14 
15 // Framework include files
16 #include "DD4hep/Primitives.h"
17 #include "DDG4/Geant4DataDump.h"
18 
19 using namespace std;
20 using namespace DD4hep;
21 using namespace DD4hep::Simulation;
22 
24 
26 Geant4DataDump::Geant4DataDump(const std::string& tag) : m_tag(tag) {
27 }
28 
31 }
32 
35  PropertyMask mask(p->reason);
36  int parent = p->parents.empty() ? -1 : *p->parents.begin();
37  printout(level, m_tag, " +++ TrackID: %6d %12d %6d %-7s %3s %5d %6s %8.3g %-4s %-7s %-7s %-3s",
38  p->id,
39  p->pdgID,
40  parent,
43  int(p->daughters.size()),
45  p.energy(),
49  mask.isSet(G4PARTICLE_KEEP_PARENT) ? "YES" : ""
50  );
51 }
52 
54 void Geant4DataDump::print(PrintLevel level, const std::string& container, const Particles* parts) {
55  if ( parts ) {
56  printout(level,m_tag,"+++ Track container: %-21s --------------- Track KEEP reasoning ---------------",container.c_str());
57  printout(level,m_tag,"+++ # of Tracks:%6d PDG Parent Primary Secondary Energy %-8s Calo Tracker Process/Par",
58  int(parts->size()),"in [MeV]");
59  for(Particles::const_iterator i=parts->begin(); i!= parts->end(); ++i)
60  print(PrintLevel(level-1), *i);
61  return;
62  }
63 }
64 
67  const SimpleHit::Contribution& t = h->truth;
68  printout(level,m_tag," +++ Hit: Cell: %016llX Pos:(%9.3g,%9.3g,%9.3g) Len:%9.3g [mm] E:%9.3g MeV TrackID:%6d PDG:%12d dep:%9.3g time:%9.3g [ns]",
69  h->cellID,h->position.x(),h->position.y(),h->position.z(),h->length,h->energyDeposit,t.trackID,t.pdgID,t.deposit,t.time);
70 }
71 
73 void Geant4DataDump::print(PrintLevel level, const std::string& container, const TrackerHits* hits) {
74  if ( hits ) {
75  printout(level,m_tag,"+++ %s: # Tracker hits %d",container.c_str(),int(hits->size()));
76  for(TrackerHits::const_iterator i=hits->begin(); i!= hits->end(); ++i)
77  print(PrintLevel(level-1), *i);
78  return;
79  }
80 }
81 
84  printout(level,m_tag," +++ Hit: Cell: %016llX Pos:(%9.3g,%9.3g,%9.3g) [mm] E:%9.3g MeV #Contributions:%3d",
85  h->cellID,h->position.x(),h->position.y(),h->position.z(),h->energyDeposit,h->truth.size());
86  const SimpleHit::Contributions& t = h->truth;
87  int cnt=0;
88  for(SimpleHit::Contributions::const_iterator i=t.begin(); i!=t.end(); ++i,++cnt) {
89  const SimpleHit::Contribution& c = *i;
90  printout(PrintLevel(level-1),m_tag," Contribution #%3d TrackID:%6d PDG:%12d %9.3g MeV %9.3g ns",
91  cnt,c.trackID,c.pdgID,c.deposit,c.time);
92  }
93 }
94 
96 void Geant4DataDump::print(PrintLevel level, const std::string& container, const CalorimeterHits* hits) {
97  if ( hits ) {
98  printout(level,m_tag,"+++ %s: # Calorimeter hits %d",container.c_str(),int(hits->size()));
99  for(CalorimeterHits::const_iterator i=hits->begin(); i!= hits->end(); ++i)
100  print(PrintLevel(level-1), *i);
101  return;
102  }
103 }
DDG4 tracker hit class used by the generic DDG4 tracker sensitive detector.
Definition: Geant4Data.h:228
std::vector< SimpleCalorimeter::Hit * > CalorimeterHits
std::vector< Particle * > Particles
std::vector< MonteCarloContrib > Contributions
Definition: Geant4Data.h:199
double length
Length of the track segment contributing to this hit.
Definition: Geant4Data.h:235
DDG4 calorimeter hit class used by the generic DDG4 calorimeter sensitive detector.
Definition: Geant4Data.h:273
const char * yes_no(bool value)
Helper function to print booleans in format YES/NO.
Definition: Printout.h:295
double energyDeposit
Energy deposit in the tracker hit.
Definition: Geant4Data.h:239
Data structure to manipulate a bitmask held by reference and represented by an integer.
Definition: Primitives.h:526
PrintLevel
Definition: Printout.h:47
Contribution truth
Monte Carlo / Geant4 information.
Definition: Geant4Data.h:237
long long int cellID
cellID
Definition: Geant4Data.h:122
Contributions truth
Hit contributions by individual particles.
Definition: Geant4Data.h:278
double deposit
Total energy deposit in this hit.
Definition: Geant4Data.h:147
not persisten. ROOT cannot handle
Definition: Geant4Data.h:140
Particles parents
The list of daughters of this MC particle.
ReferenceBitMask< const int > PropertyMask
virtual ~Geant4DataDump()
Standard destructor.
Position position
Hit position.
Definition: Geant4Data.h:231
std::vector< SimpleTracker::Hit * > TrackerHits
std::string m_tag
Tag variable.
Data structure to access derived MC particle information.
double energy() const
Scalar particle energy.
int pdgID
Particle ID from the PDG table.
Definition: Geant4Data.h:145
int printout(PrintLevel severity, const char *src, const char *fmt,...)
Calls the display action with a given severity level.
Definition: Printout.cpp:111
void print(PrintLevel level, Geant4ParticleHandle p) const
Print a single particle to the output logging using the specified print level.
double energyDeposit
Total energy deposit.
Definition: Geant4Data.h:280
double time
Timestamp when this energy was deposited.
Definition: Geant4Data.h:149
bool isSet(const T &m) const
Definition: Primitives.h:544