ATLAS Offline Software
FCALDistEnergyShowerLib.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 #ifndef SHOWER_LIB_FCALDIST_ENERGY_SHOWER_LIB_H
6 #define SHOWER_LIB_FCALDIST_ENERGY_SHOWER_LIB_H
7 
8 // STL includes
9 #include <map>
10 #include <vector>
11 
12 // local includes
14 
15 // G4 forward declarations
16 class G4Track;
17 
18 // Namespace for the ShowerLib related classes
19 namespace ShowerLib {
20 
21  // forward declarations in namespace
22 
37 
38  public:
39 
41  static IShowerLib* readFromROOTFile(TFile* source);
42 
44  static IShowerLib* createEmptyLib(const std::string& inputFile);
45 
48  {
49  for ( auto& dist : m_libData) { // dist bins
50  for (auto& ene : dist.second ) { // energy map
51  for ( auto& spot : ene.second ) {
52  delete spot;
53  }
54  ene.second.clear();
55  }
56  dist.second.clear();
57  };
58  m_libData.clear();
59  }
60 
62  virtual std::vector<EnergySpot>* getShower(const G4Track* track, ShowerLibStatistics* stats, int randomShift) const;
64  virtual double getContainmentZ(const G4Track* track) const;
66  virtual double getContainmentR(const G4Track* track) const;
68  virtual bool storeShower(HepMC::ConstGenParticlePtr genParticle,const Shower* shower);
70  virtual bool writeToROOT(TFile* dest);
71 
72  virtual ShowerLibStatistics* createStatistics() const;
73 
74  inline virtual const std::string getName() const { return "FCALDist Energy ShowerLib"; }
75 
76  protected:
77 
78  virtual const std::string printParameters() const;
79 
80  private:
81 
83 
85  bool read(TTree* source);
87  bool write(TTree* dest) const;
89  bool readStructure(std::vector<float>& structure);
90 
91  float distance(double x, double y) const;
92 
93  typedef std::map<float,Shower> distbin;
94  typedef std::map<float,distbin> library;
95 
97 
98  //distance calculator parameters
99  double m_xrodcent;
100  double m_yrodcent;
101  double m_step;
102 
103  };
104 
105 } // namespace ShowerLib
106 
107 #endif // SHOWER_LIB_FCALDIST_SHOWER_LIB_H
ShowerLib::FCALDistEnergyShowerLib::getShower
virtual std::vector< EnergySpot > * getShower(const G4Track *track, ShowerLibStatistics *stats, int randomShift) const
get shower for given G4 track
Definition: FCALDistEnergyShowerLib.cxx:184
ShowerLib::FCALDistEnergyShowerLib::getName
virtual const std::string getName() const
Definition: FCALDistEnergyShowerLib.h:74
ShowerLib::Shower
Class for shower library shower.
Definition: Shower.h:36
ShowerLib::ShowerLibStatistics
Definition: ShowerLibStatistics.h:20
ShowerLib::FCALDistEnergyShowerLib::m_step
double m_step
Definition: FCALDistEnergyShowerLib.h:101
ShowerLib::FCALDistEnergyShowerLib::getContainmentR
virtual double getContainmentR(const G4Track *track) const
get average lateral spread of the showers for the given energy
Definition: FCALDistEnergyShowerLib.cxx:361
ShowerLib::FCALDistEnergyShowerLib::distbin
std::map< float, Shower > distbin
Definition: FCALDistEnergyShowerLib.h:93
perfmonmt-printer.dest
dest
Definition: perfmonmt-printer.py:189
trigbs_dumpHLTContentInBS.stats
stats
Definition: trigbs_dumpHLTContentInBS.py:91
x
#define x
ShowerLib::FCALDistEnergyShowerLib
Class for shower library shower lib.
Definition: FCALDistEnergyShowerLib.h:36
ShowerLib::FCALDistEnergyShowerLib::read
bool read(TTree *source)
read library from given TTree
Definition: FCALDistEnergyShowerLib.cxx:490
CaloCondBlobAlgs_fillNoiseFromASCII.inputFile
string inputFile
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:17
ShowerLib::FCALDistEnergyShowerLib::createEmptyLib
static IShowerLib * createEmptyLib(const std::string &inputFile)
factory method. create empty library with the given structure. returns NULL if file is invalid.
Definition: FCALDistEnergyShowerLib.cxx:79
ShowerLib::FCALDistEnergyShowerLib::m_xrodcent
double m_xrodcent
Definition: FCALDistEnergyShowerLib.h:99
ShowerLib::IShowerLib
Class for shower library shower lib interface.
Definition: IShowerLib.h:40
HepMC::ConstGenParticlePtr
const GenParticle * ConstGenParticlePtr
Definition: GenParticle.h:38
ShowerLib::FCALDistEnergyShowerLib::readStructure
bool readStructure(std::vector< float > &structure)
Definition: FCALDistEnergyShowerLib.cxx:621
ShowerLib::FCALDistEnergyShowerLib::getContainmentZ
virtual double getContainmentZ(const G4Track *track) const
get average length of showers for the given energy
Definition: FCALDistEnergyShowerLib.cxx:280
ShowerLib::FCALDistEnergyShowerLib::writeToROOT
virtual bool writeToROOT(TFile *dest)
write library to ROOT file
Definition: FCALDistEnergyShowerLib.cxx:470
y
#define y
ShowerLib::FCALDistEnergyShowerLib::distance
float distance(double x, double y) const
Definition: FCALDistEnergyShowerLib.cxx:36
ShowerLib::FCALDistEnergyShowerLib::printParameters
virtual const std::string printParameters() const
Definition: FCALDistEnergyShowerLib.cxx:613
ShowerLib::FCALDistEnergyShowerLib::m_yrodcent
double m_yrodcent
Definition: FCALDistEnergyShowerLib.h:100
ShowerLib::FCALDistEnergyShowerLib::createStatistics
virtual ShowerLibStatistics * createStatistics() const
Definition: FCALDistEnergyShowerLib.cxx:632
IShowerLib.h
ShowerLib
Namespace for the ShowerLib related classes.
Definition: LArG4GenShowerLib.h:19
copySelective.source
string source
Definition: copySelective.py:32
ShowerLib::FCALDistEnergyShowerLib::readFromROOTFile
static IShowerLib * readFromROOTFile(TFile *source)
factory method. create a library from root file. returns NULL if file is invalid.
Definition: FCALDistEnergyShowerLib.cxx:53
ShowerLib::FCALDistEnergyShowerLib::storeShower
virtual bool storeShower(HepMC::ConstGenParticlePtr genParticle, const Shower *shower)
store shower in the library
Definition: FCALDistEnergyShowerLib.cxx:442
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
ShowerLib::FCALDistEnergyShowerLib::library
std::map< float, distbin > library
Definition: FCALDistEnergyShowerLib.h:94
ShowerLib::FCALDistEnergyShowerLib::m_libData
library m_libData
Definition: FCALDistEnergyShowerLib.h:96
ShowerLib::FCALDistEnergyShowerLib::~FCALDistEnergyShowerLib
virtual ~FCALDistEnergyShowerLib()
default destructor
Definition: FCALDistEnergyShowerLib.h:47
ShowerLib::FCALDistEnergyShowerLib::write
bool write(TTree *dest) const
write library to given TTree
Definition: FCALDistEnergyShowerLib.cxx:551
ShowerLib::FCALDistEnergyShowerLib::FCALDistEnergyShowerLib
FCALDistEnergyShowerLib()
Definition: FCALDistEnergyShowerLib.h:82