17#include "GaudiKernel/ITHistSvc.h"
18#include "Gaudi/Property.h"
31 , ISvcLocator* pSvcLocator)
53 m_mytree =
new TTree(
"mytree",
"mytree");
84 histSvc->regTree(
"/MYSTREAM/myTree",
m_mytree).ignore();
94 if(
m_tileID==0)
throw std::runtime_error(
"ISF_HitAnalysis: Invalid Tile ID helper");
104 return StatusCode::SUCCESS;
112 return StatusCode::SUCCESS;
126 std::vector<const CaloCalibrationHitContainer *> v_cchc;
130 ATH_MSG_WARNING(
"SG does not contain calibration hit container " << containerName);
134 StatusCode
sc =
evtStore()->retrieve(cchc,containerName);
137 ATH_MSG_ERROR(
"Cannot retrieve calibration hit container " << containerName);
142 v_cchc.push_back(cchc);
148 StatusCode
sc =
evtStore()->retrieve(truthEvent,
"TruthEvent");
149 if (
sc.isFailure()||!truthEvent)
152 return StatusCode::FAILURE;
156 m_mc_eta = gen->momentum().pseudoRapidity();
158 m_mc_e = gen->momentum().e();
159 m_mc_pt = sqrt(pow(gen->momentum().px(),2)+pow(gen->momentum().py(),2));
197 Long64_t cell_identifier=0;
198 float cell_energy_reco=0;
199 float cell_energy_active_total_corrected=0;
200 float cell_energy_active_total=0;
201 float cell_energy_inactive_total=0;
207 std::map< Long64_t , cell_info > cell_info_map;
209 for(
int s=0;s<24;s++)
236 double Etot = calibHit->energyTotal();
237 double Eem = calibHit->energyEM();
238 double Enonem = calibHit->energyNonEM();
239 double Einv = calibHit->energyInvisible();
240 double Eesc = calibHit->energyEscaped();
249 if((sampling>=0 && sampling<=11) || (sampling>=21 && sampling<=23)) Efactor=1/fSampl->
FSAMPL(
id);
250 if((sampling>=12 && sampling<=20)) {
252 int channel =
m_tileHWID->channel(channel_id);
253 int drawerIdx =
m_tileHWID->drawerIdx(channel_id);
254 Efactor = tileSamplingFraction->getSamplingFraction(drawerIdx, channel);
262 ATH_MSG_VERBOSE(
"cellID "<<
id<<
" layer "<<sampling<<
" energyTotal "<<Etot<<
" Eem "<<Eem<<
" Enonem "<<Enonem<<
" Einv "<<Einv<<
" Eesc "<<Eesc<<
" Efactor="<<Efactor);
264 if(sampling>=0 && sampling<=23)
267 cell_info_map[
id.get_compact()].cell_identifier=
id.get_compact();
268 cell_info_map[
id.get_compact()].cell_sampling=sampling;
269 cell_info_map[
id.get_compact()].cell_eta=caloDDE->
eta_raw();
270 cell_info_map[
id.get_compact()].cell_phi=caloDDE->
phi_raw();
281 if(
m_docells) cell_info_map[
id.get_compact()].cell_energy_inactive_total+=Etot;
294 cell_info_map[
id.get_compact()].cell_energy_active_total_corrected+=Etot*Efactor;
295 cell_info_map[
id.get_compact()].cell_energy_active_total+=Etot;
308 sc =
evtStore()->retrieve(cellColl,
"AllCalo");
310 if (
sc.isFailure()) {
315 for (
const CaloCell* cell : *cellColl) {
322 if((sampling>=12 && sampling<=20)) {
330 cell_info_map[
id.get_compact()].cell_identifier=
id.get_compact();
331 cell_info_map[
id.get_compact()].cell_sampling=sampling;
333 cell_info_map[
id.get_compact()].cell_eta=caloDDE->
eta_raw();
334 cell_info_map[
id.get_compact()].cell_phi=caloDDE->
phi_raw();
336 cell_info_map[
id.get_compact()].cell_energy_reco+=cell->energy();
343 const std::vector<std::string> lArKeys = {
"LArHitEMB",
"LArHitEMEC",
"LArHitFCAL",
"LArHitHEC"};
344 for (
const std::string& containerName: lArKeys) {
347 if(
evtStore()->retrieve(larContainer,containerName)==StatusCode::SUCCESS) {
349 for (
const LArHit* larHit : *larContainer) {
352 if(!hitElement)
continue;
359 ATH_MSG_DEBUG(
"Read "<<hitnumber<<
" G4Hits from "<<containerName);
367 if (
evtStore()->retrieve(hitVec,
"TileHitVec")==StatusCode::SUCCESS &&
m_tileID ) {
369 for(
const TileHit& hit : *hitVec) {
378 for (
int tilesubhit_i = 0; tilesubhit_i<hit.size(); tilesubhit_i++) {
380 ATH_MSG_DEBUG(
"Tile subhit: "<<tilesubhit_i<<
"/"<<hit.size()<<
" E: "<<hit.energy(tilesubhit_i) );
385 ATH_MSG_DEBUG(
"Read "<<hitnumber<<
" G4Hits from TileHitVec");
388 for(
auto& cell:cell_info_map) {
427 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
AtlasHitsVector< TileHit > TileHitVector
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
ServiceHandle< StoreGateSvc > & evtStore()
const ServiceHandle< StoreGateSvc > & detStore() const
Class to store calorimeter calibration hit.
Container class for CaloCell.
CaloSampling::CaloSample CaloSample
Data object for each calorimeter readout cell.
This class groups all DetDescr information related to a CaloCell.
float eta_raw() const
cell eta_raw
CaloCell_ID::CaloSample getSampling() const
cell sampling
Identifier identify() const override final
cell identifier
float phi_raw() const
cell phi_raw
const CaloDetDescrElement * get_element(const Identifier &cellId) const
get element by its identifier
This class provides the client interface for accessing the detector description information common to...
This class initializes the Calo (LAr and Tile) offline identifiers.
const TileID * getTileID(void) const
const T * at(size_type n) const
Access an element, as an rvalue.
size_type size() const noexcept
Returns the number of elements in the collection.
virtual const float & FSAMPL(const HWIdentifier &id) const =0
Class to store hit energy and time in LAr cell from G4 simulation.
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloMgrKey
std::vector< float > * m_energy_inactive_nonem
std::vector< float > * m_cell_eta
const TileCablingService * m_tileCabling
std::vector< float > * m_energy_active_total
std::vector< float > * m_energy_active_em
std::vector< float > * m_energy_active_inv
ServiceHandle< TileCablingSvc > m_tileCablingSvc
Name of Tile cabling service.
std::vector< float > * m_energy_active_esc
std::vector< int > * m_cell_sampling
SG::ReadCondHandleKey< ILArfSampl > m_fSamplKey
std::vector< float > * m_cell_energy_active_total
std::vector< float > * m_energy_hit
virtual ~LarEMSamplingFraction()
std::vector< float > * m_energy_inactive_em
LarEMSamplingFraction()
Default constructor:
std::vector< std::string > m_CalibrationHitContainerNames
std::vector< float > * m_energy_inactive_inv
std::vector< float > * m_cell_energy_reco
virtual StatusCode finalize() override
SG::ReadCondHandleKey< TileSamplingFraction > m_tileSamplingFractionKey
Name of TileSamplingFraction in condition store.
virtual StatusCode initialize() override
std::vector< float > * m_cell_phi
std::vector< float > * m_energy_active_nonem
std::vector< float > * m_cell_energy_active_total_corrected
virtual StatusCode execute() override
const TileHWID * m_tileHWID
std::vector< Long64_t > * m_cell_identifier
std::vector< float > * m_energy_inactive_total
const CaloCell_ID * m_calo_id
std::vector< float > * m_energy_reco
std::vector< float > * m_cell_energy_inactive_total
std::vector< float > * m_energy_active_total_corrected
std::vector< float > * m_energy_inactive_esc
This defines the McEventCollection, which is really just an ObjectVector of McEvent objectsFile: Gene...
bool contains(const std::string &s, const std::string ®x)
does a string contain the substring
int count(std::string s, const std::string ®x)
count how many occurances of a regx are in a string
GenEvent::particle_iterator begin(HepMC::GenEvent &e)