ATLAS Offline Software
EtaEnergyShowerLib.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 
6 #ifndef SHOWER_LIB_ETA_ENERGY_SHOWER_LIB_H
7 #define SHOWER_LIB_ETA_ENERGY_SHOWER_LIB_H
8 
9 // STL includes
10 #include <map>
11 #include <vector>
12 
13 // local includes
15 
16 // G4 forward declarations
17 class G4Track;
18 
19 // Namespace for the ShowerLib related classes
20 namespace ShowerLib {
21 
35  class EtaEnergyShowerLib : public IShowerLib {
36 
37  public:
38 
40  static IShowerLib* readFromROOTFile(TFile* source);
41 
43  static IShowerLib* createEmptyLib(const std::string& inputFile);
44 
47  {
48  for ( auto& eta : m_libData) { // eta bins
49  for (auto& ene : eta.second ) { // energy map
50  for ( auto& spot : ene.second ) {
51  delete spot;
52  }
53  ene.second.clear();
54  }
55  eta.second.clear();
56  }
57  m_libData.clear();
58  }
59 
61  virtual std::vector<EnergySpot>* getShower(const G4Track* track, ShowerLibStatistics* stats, int randomShift) const;
63  virtual double getContainmentZ(const G4Track* track) const;
65  virtual double getContainmentR(const G4Track* track) const;
67  virtual bool storeShower(HepMC::ConstGenParticlePtr genParticle,const Shower* shower);
69  virtual bool writeToROOT(TFile* dest);
70 
71  virtual ShowerLibStatistics* createStatistics() const;
72 
73  inline virtual const std::string getName() const { return "Eta Energy ShowerLib"; }
74 
75  protected:
76 
77  virtual const std::string printParameters() const {return "";}
78 
79  private:
80 
82 
84  bool read(TTree* source);
86  bool write(TTree* dest) const;
88  bool readStructure(std::vector<float>& structure);
89 
90  bool checkEtaAndStuff(const G4Track* track) const;
91 
93 
94  typedef std::map<float,Shower> etabin;
95  typedef std::map<float,etabin> library;
96 
99 
100  };
101 
102 } // namespace ShowerLib
103 
104 #endif // SHOWER_LIB_ETA_SHOWER_LIB_H
ShowerLib::EtaEnergyShowerLib::getContainmentZ
virtual double getContainmentZ(const G4Track *track) const
get average length of showers for the given energy
Definition: EtaEnergyShowerLib.cxx:231
ShowerLib::Shower
Class for shower library shower.
Definition: Shower.h:36
ShowerLib::EtaEnergyShowerLib::etabin
std::map< float, Shower > etabin
Definition: EtaEnergyShowerLib.h:94
ShowerLib::ShowerLibStatistics
Definition: ShowerLibStatistics.h:20
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
ShowerLib::EtaEnergyShowerLib::checkEtaAndStuff
bool checkEtaAndStuff(const G4Track *track) const
Definition: EtaEnergyShowerLib.cxx:550
ShowerLib::EtaEnergyShowerLib::createEmptyLib
static IShowerLib * createEmptyLib(const std::string &inputFile)
factory method. create empty library with the given structure. returns NULL if file is invalid.
Definition: EtaEnergyShowerLib.cxx:62
ShowerLib::EtaEnergyShowerLib::getName
virtual const std::string getName() const
Definition: EtaEnergyShowerLib.h:73
perfmonmt-printer.dest
dest
Definition: perfmonmt-printer.py:189
ShowerLib::EtaEnergyShowerLib::~EtaEnergyShowerLib
virtual ~EtaEnergyShowerLib()
default destructor
Definition: EtaEnergyShowerLib.h:46
trigbs_dumpHLTContentInBS.stats
stats
Definition: trigbs_dumpHLTContentInBS.py:91
ShowerLib::EtaEnergyShowerLib::m_libData
library m_libData
Definition: EtaEnergyShowerLib.h:97
ShowerLib::EtaEnergyShowerLib::storeShower
virtual bool storeShower(HepMC::ConstGenParticlePtr genParticle, const Shower *shower)
store shower in the library
Definition: EtaEnergyShowerLib.cxx:359
ShowerLib::EtaEnergyShowerLib::m_onlyPositive
bool m_onlyPositive
Definition: EtaEnergyShowerLib.h:98
ShowerLib::EtaEnergyShowerLib::writeToROOT
virtual bool writeToROOT(TFile *dest)
write library to ROOT file
Definition: EtaEnergyShowerLib.cxx:390
ShowerLib::EtaEnergyShowerLib::getShower
virtual std::vector< EnergySpot > * getShower(const G4Track *track, ShowerLibStatistics *stats, int randomShift) const
get shower for given G4 track
Definition: EtaEnergyShowerLib.cxx:151
ShowerLib::EtaEnergyShowerLib::readFromROOTFile
static IShowerLib * readFromROOTFile(TFile *source)
factory method. create a library from root file. returns NULL if file is invalid.
Definition: EtaEnergyShowerLib.cxx:36
ShowerLib::EtaEnergyShowerLib::createStatistics
virtual ShowerLibStatistics * createStatistics() const
Definition: EtaEnergyShowerLib.cxx:527
CaloCondBlobAlgs_fillNoiseFromASCII.inputFile
string inputFile
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:17
ShowerLib::EtaEnergyShowerLib::EtaEnergyShowerLib
EtaEnergyShowerLib()
Definition: EtaEnergyShowerLib.h:81
ShowerLib::IShowerLib
Class for shower library shower lib interface.
Definition: IShowerLib.h:40
ShowerLib::EtaEnergyShowerLib::write
bool write(TTree *dest) const
write library to given TTree
Definition: EtaEnergyShowerLib.cxx:467
ShowerLib::EtaEnergyShowerLib
Class for shower library shower lib.
Definition: EtaEnergyShowerLib.h:35
HepMC::ConstGenParticlePtr
const GenParticle * ConstGenParticlePtr
Definition: GenParticle.h:38
ShowerLib::EtaEnergyShowerLib::m_mineta
float m_mineta
Definition: EtaEnergyShowerLib.h:92
ShowerLib::EtaEnergyShowerLib::read
bool read(TTree *source)
read library from given TTree
Definition: EtaEnergyShowerLib.cxx:410
ShowerLib::EtaEnergyShowerLib::getContainmentR
virtual double getContainmentR(const G4Track *track) const
get average lateral spread of the showers for the given energy
Definition: EtaEnergyShowerLib.cxx:295
ShowerLib::EtaEnergyShowerLib::readStructure
bool readStructure(std::vector< float > &structure)
Definition: EtaEnergyShowerLib.cxx:516
IShowerLib.h
ShowerLib
Namespace for the ShowerLib related classes.
Definition: LArG4GenShowerLib.h:19
ShowerLib::EtaEnergyShowerLib::m_maxeta
float m_maxeta
Definition: EtaEnergyShowerLib.h:92
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
ShowerLib::EtaEnergyShowerLib::library
std::map< float, etabin > library
Definition: EtaEnergyShowerLib.h:95
ShowerLib::EtaEnergyShowerLib::printParameters
virtual const std::string printParameters() const
Definition: EtaEnergyShowerLib.h:77