diff --git a/Calorimeter/CaloSimEvent/CaloSimEvent/CaloCalibrationHit.h b/Calorimeter/CaloSimEvent/CaloSimEvent/CaloCalibrationHit.h new file mode 100755 index 0000000000000000000000000000000000000000..5c64e46b7512afc0566f90657ce4a3bff87f8f3b --- /dev/null +++ b/Calorimeter/CaloSimEvent/CaloSimEvent/CaloCalibrationHit.h @@ -0,0 +1,193 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// CaloCalibrationHit +// 26-Jan-2004 William Seligman + +// This class defines a "calibration" hit associated with the Calo +// simulation. + +#ifndef CaloSimEvent_CaloCalibrationHit_h +#define CaloSimEvent_CaloCalibrationHit_h + +#include "Identifier/Identifier.h" + +class CaloCalibrationHit +/** @brief Class to store calorimeter calibration hit. <br> + A calibration hit stores for active, inactive and dead material elements the energy loss according to the + process (EM energy loss, non EM energy loss, Invisible energy and Escaped energy) */ + +{ + public: + + /** @brief Standard constructor using identifer and energy by type + @param[in] id Cell identifier (calorimeter cell or dead material identifier) + @param[in] energyEM energy loss by EM processes + @param[in] energyNonEM visible energy loss by non EM processes (pion dEdx for instance) + @param[in] energyInvisible invisible energy loss (usually nuclear binding energy) + @param[in] energyEscaped energy which escaped from this cell because of production of neutrino (or escaping muon energy) + */ + CaloCalibrationHit(Identifier id, + double energyEM, + double energyNonEM, + double energyInvisible, + double energyEscaped): + m_ID(id), + m_energy0(energyEM), + m_energy1(energyNonEM), + m_energy2(energyInvisible), + m_energy3(energyEscaped), + m_particleID(0) + {} + + /** @brief Standard constructor using identifer, energy by type and primary particle ID + @param[in] id Cell identifier (calorimeter cell or dead material identifier) + @param[in] energyEM energy loss by EM processes + @param[in] energyNonEM visible energy loss by non EM processes (pion dEdx for instance) + @param[in] energyInvisible invisible energy loss (usually nuclear binding energy) + @param[in] energyEscaped energy which escaped from this cell because of production of neutrino (or escaping muon energy) + @param[in] particleID barcode of primary particle which caused given hit + */ + CaloCalibrationHit(Identifier id, + double energyEM, + double energyNonEM, + double energyInvisible, + double energyEscaped, + unsigned int particleID): + m_ID(id), + m_energy0(energyEM), + m_energy1(energyNonEM), + m_energy2(energyInvisible), + m_energy3(energyEscaped), + m_particleID(particleID) + {} + /** Default constructor; should never be used, but provided for some + persistency services. */ + CaloCalibrationHit(): + m_ID(Identifier()), + m_energy0(0.), + m_energy1(0.), + m_energy2(0.), + m_energy3(0.), + m_particleID(0) + {} + + /** Copy constructor **/ + CaloCalibrationHit(const CaloCalibrationHit &cchSource) + { + m_ID = cchSource.m_ID; + m_energy0 = cchSource.m_energy0; + m_energy1 = cchSource.m_energy1; + m_energy2 = cchSource.m_energy2; + m_energy3 = cchSource.m_energy3; + m_particleID = cchSource.m_particleID; + } + + /** Assignment operator **/ + CaloCalibrationHit& operator= (const CaloCalibrationHit &cchSource) + { + if (this == &cchSource) return *this; + m_ID = cchSource.m_ID; + m_energy0 = cchSource.m_energy0; + m_energy1 = cchSource.m_energy1; + m_energy2 = cchSource.m_energy2; + m_energy3 = cchSource.m_energy3; + m_particleID = cchSource.m_particleID; + return *this; + } + + /** Destructor */ + virtual ~CaloCalibrationHit() {} + + /** @return cell identifier of this hit */ + Identifier cellID() const { return m_ID; } + + /** @return EM energy deposits. Units are MeV. */ + double energyEM() const { return m_energy0; } + + /** @return NonEM energy deposits. Units are MeV. */ + double energyNonEM() const { return m_energy1; } + + /** @return invisible energy. Units are MeV. */ + double energyInvisible() const { return m_energy2; } + + /** @return escaped energy. Units are MeV. */ + double energyEscaped() const { return m_energy3; } + + /** @return total energy deposits. Units are MeV. */ + double energyTotal() const + { + return + m_energy0 + + m_energy1 + + m_energy2 + + m_energy3; + } + + /** @return energy deposits by specifying input type. Units are MeV. */ + double energy( unsigned int i ) + { + switch (i) + { + case 0: return m_energy0; + case 1: return m_energy1; + case 2: return m_energy2; + case 3: return m_energy3; + default: return 0.; + } + } + + /** @return primary particle identifier which caused his hit */ + unsigned int particleID() const { return m_particleID; } + + /** @return energy deposits by specifying input type, same as above method */ + double operator() (unsigned int i) { return energy(i); } + + /** Calibration hits are ordered by values of their identifiers */ + bool Less(CaloCalibrationHit* const& h) const + { + if(m_ID != h->m_ID){ + return m_ID < h->m_ID; + }else{ + return m_particleID < h->m_particleID; + } + } + + /** Calibration hits are ordered by values of their identifiers */ + /** Calibration hits are ordered by values of their identifiers */ + bool Equals(CaloCalibrationHit* const& h) const { + return (m_ID == h->m_ID) && (m_particleID == h->m_particleID); + }; + + /** Method used for energy accumulation */ + void Add(CaloCalibrationHit* const& h) + { + m_energy0 += h->m_energy0; + m_energy1 += h->m_energy1; + m_energy2 += h->m_energy2; + m_energy3 += h->m_energy3; + } + +private: + + /** identifier of the cell in which this hit occured. */ + Identifier m_ID; + + /** energies (in MeV) deposited in this hit. In order, they represent: + * EM energy deposited + * non-EM energy deposited + * "invisible" energy deposited + * escaped energy + * Energies are accumulated in double precision and stored as floats */ + double m_energy0; + double m_energy1; + double m_energy2; + double m_energy3; + + /** identifier of Primary Particle which caused this hit */ + unsigned int m_particleID; +}; + +#endif // CaloSimEvent_CaloCalibrationHit_h + diff --git a/Calorimeter/CaloSimEvent/CaloSimEvent/CaloCalibrationHitContainer.h b/Calorimeter/CaloSimEvent/CaloSimEvent/CaloCalibrationHitContainer.h new file mode 100755 index 0000000000000000000000000000000000000000..46e22cbf120fb8f1b039fbe3570ef8bb5a93e58a --- /dev/null +++ b/Calorimeter/CaloSimEvent/CaloSimEvent/CaloCalibrationHitContainer.h @@ -0,0 +1,69 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// CaloCalibrationHitContainer +// 09-Feb-2004 William Seligman + +// This class exists to provides two features that an +// AthenaHitsVector<CaloCalibrationHit> does not provide on its own: + +// - a CLID for StoreGate + +// - a std::string method that can be used to examine the contents of +// the container. + +#ifndef CaloSimEvent_CaloCalibrationHitContainer_h +#define CaloSimEvent_CaloCalibrationHitContainer_h + +#include "HitManagement/AthenaHitsVector.h" +#include "CaloSimEvent/CaloCalibrationHit.h" + +#include "CLIDSvc/CLASS_DEF.h" + +class CaloCalibrationHitContainer:public AthenaHitsVector<CaloCalibrationHit> +{ +public: + + /** Constructor of CaloCalibrationHitContainer */ + CaloCalibrationHitContainer (std::string collectionName="DefaultCollectionName" ); + + /** Destructor */ + virtual ~CaloCalibrationHitContainer() ; + + /** + Returns a string containing the description of this <br> + CaloCalibrationHitContainer with a dump of all the hits + that it contains<br> + Can be used in printouts <br> + */ + virtual operator std::string () const; + +}; + +CLASS_DEF (CaloCalibrationHitContainer, 1312841250 , 1 ) + +class StoredLArCalibHitContainers +/** @brief store pointers to the different hit collections */ +{ + public: + /** Constructor */ + StoredLArCalibHitContainers(): + activeHitCollection(0), + inactiveHitCollection(0), + deadHitCollection(0) + {} + + /** Active calibration Hits */ + CaloCalibrationHitContainer* activeHitCollection; + + /** Inactive calibration Hits */ + CaloCalibrationHitContainer* inactiveHitCollection; + + /** Dead calibration Hits */ + CaloCalibrationHitContainer* deadHitCollection; +}; + +CLASS_DEF (StoredLArCalibHitContainers, 1074460253, 1) + +#endif // CaloSimEvent_CaloCalibrationHitContainer_h diff --git a/Calorimeter/CaloSimEvent/CaloSimEvent/CaloSimEventDict.h b/Calorimeter/CaloSimEvent/CaloSimEvent/CaloSimEventDict.h new file mode 100755 index 0000000000000000000000000000000000000000..baf0032ffa415028dc69bae4359a53a7ca9430cb --- /dev/null +++ b/Calorimeter/CaloSimEvent/CaloSimEvent/CaloSimEventDict.h @@ -0,0 +1,11 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef CaloSimEvent_CaloSimEvent_H +#define CaloSimEvent_CaloSimEvent_H + +#include "CaloSimEvent/CaloCalibrationHit.h" +#include "CaloSimEvent/CaloCalibrationHitContainer.h" + +#endif diff --git a/Calorimeter/CaloSimEvent/CaloSimEvent/selection.xml b/Calorimeter/CaloSimEvent/CaloSimEvent/selection.xml new file mode 100755 index 0000000000000000000000000000000000000000..fb157d4213b49b96dfb2d06592fc83f17a26f87e --- /dev/null +++ b/Calorimeter/CaloSimEvent/CaloSimEvent/selection.xml @@ -0,0 +1,6 @@ +<lcgdict> + <class name="CaloCalibrationHit" /> + <class name="std::vector<CaloCalibrationHit*>" /> + <class name="AthenaHitsVector<CaloCalibrationHit>" /> + <class name="CaloCalibrationHitContainer" id="33CDAED0-F472-47D2-8F28-27C6D6761F35" /> +</lcgdict> diff --git a/Calorimeter/CaloSimEvent/cmt/requirements b/Calorimeter/CaloSimEvent/cmt/requirements new file mode 100755 index 0000000000000000000000000000000000000000..5bde72e699b9c9ff33e4a743658db1cee933a7fb --- /dev/null +++ b/Calorimeter/CaloSimEvent/cmt/requirements @@ -0,0 +1,22 @@ +package CaloSimEvent + +# Common LAr/Tile Calibration Hit classes + +author William Seligman <seligman@nevis.columbia.edu> +author Mikhail Leltchouk <lelchuk@nevis.columbia.edu> + +use AtlasPolicy AtlasPolicy-* +use CLIDSvc CLIDSvc-* Control + +use Identifier Identifier-* DetectorDescription +use HitManagement HitManagement-* Simulation + +library CaloSimEvent *.cxx +apply_pattern installed_library + +# generate dictionary +private +use AtlasReflex AtlasReflex-* External -no_auto_imports +use GaudiInterface GaudiInterface-* External + +apply_pattern lcgdict dict=CaloSimEvent selectionfile=selection.xml headerfiles=" ../CaloSimEvent/CaloSimEventDict.h" diff --git a/Calorimeter/CaloSimEvent/doc/mainpage.h b/Calorimeter/CaloSimEvent/doc/mainpage.h new file mode 100755 index 0000000000000000000000000000000000000000..58ec720c058681939680684df362a0eaacea2364 --- /dev/null +++ b/Calorimeter/CaloSimEvent/doc/mainpage.h @@ -0,0 +1,23 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/** + +@mainpage CaloSimEvent Package + +The package CaloSimEvent contains data model classes for calorimeter +simulation that are not specific to LAr or Tile. They therefore complement +LArSimEvent and TileSimEvent. + +@section CaloCalibrationHit Calibration Hit related classes + +This package includes the CaloCalibrationHit class that describes the +calorimeter calibration hit. This class +includes the energy deposited by type: EM, hadronic, invisible or escaped. +CaloCalibrationHit objects appear as two per cell (active and inactive parts) and in few samplings of +typically eta*phi = 0.1 x 0.1 for +energy deposited in passive material before and after the calorimeter. They are recorded +in StoreGate in a CaloCalibrationHitContainer class. + +*/ diff --git a/Calorimeter/CaloSimEvent/src/CaloCalibrationHitContainer.cxx b/Calorimeter/CaloSimEvent/src/CaloCalibrationHitContainer.cxx new file mode 100755 index 0000000000000000000000000000000000000000..d2fabf3962233fa847c73554db1e90a2e75df793 --- /dev/null +++ b/Calorimeter/CaloSimEvent/src/CaloCalibrationHitContainer.cxx @@ -0,0 +1,68 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// 09-Feb-2004 WGS: The following code was duplicated from +// CaloHitContainer.cxx and modified for CaloCalibrationHits. + +#include "CaloSimEvent/CaloCalibrationHitContainer.h" +#include "GaudiKernel/System.h" +#include <typeinfo> +#include <stdio.h> + +#include <iostream> +#include <sstream> + +CaloCalibrationHitContainer::CaloCalibrationHitContainer(std::string collectionName) +: AthenaHitsVector<CaloCalibrationHit>(collectionName) +{ + +} + +CaloCalibrationHitContainer::~CaloCalibrationHitContainer() +{ + +} + +CaloCalibrationHitContainer::operator std::string () const +{ + std::string newline( "\n" ) ; + std::ostringstream ss; + ss << System::typeinfoName(typeid(*this)); + ss << ": content " ; + ss << newline ; + + CaloCalibrationHitContainer::const_iterator it ; + int counter = 0 ; + CaloCalibrationHit * hit ; + + for(it = this->begin() ; it != this->end() ; it++ ){ // Loop over Hits + + hit = *it ; + + ss << "CaloCalibrationHit[" ; + ss << counter; + ss << "] " ; + + ss << " ID = " << std::hex << hit->cellID().get_identifier32().get_compact() + << std::dec << " ; "; + + ss << " E=(" + << hit->energy(0) << "," + << hit->energy(1) << "," + << hit->energy(2) << "," + << hit->energy(3) << ") MeV"; + + ss << newline ; + + counter ++ ; + + } + + ss << newline ; + ss << "Number of Hits in this container : " ; + ss << counter; + + + return ss.str() ; +}