29#include "GaudiKernel/ISvcLocator.h"
30#include "GaudiKernel/StatusCode.h"
38#include <CLHEP/Units/SystemOfUnits.h>
59 ISvcLocator* pSvcLocator)
129 ATH_MSG_FATAL(
" Error while initializing default dead material coefficients " );
130 return StatusCode::FAILURE;
134 for(
int i_dm=0; i_dm<
m_HadDMCoeff->getSizeAreaSet(); i_dm++){
137 if (
m_HadDMCoeff->getArea(i_dm)->getTitle() == vname.first ) {
145 return StatusCode::FAILURE;
167 return StatusCode::SUCCESS;
182 return StatusCode::SUCCESS;
206 double mc_eta = gen->momentum().pseudoRapidity();
207 double mc_phi = gen->momentum().phi();
211 m_data->m_mc_pdg = gen->pdg_id();
212 m_data->m_mc_ener = gen->momentum().e();
213 m_data->m_mc_eta = mc_eta;
214 m_data->m_mc_phi = mc_phi;
216 int nClus = pClusColl->size();
218 m_data->m_cls_ener->resize(nClus, 0.0);
219 m_data->m_cls_ener_unw->resize(nClus, 0.0);
220 m_data->m_cls_lambda->resize(nClus, 0.0);
221 m_data->m_cls_eta->resize(nClus, 0.0);
222 m_data->m_cls_phi->resize(nClus, 0.0);
224 m_data->m_cls_smpener->resize(nClus);
225 m_data->m_cls_smpener_unw->resize(nClus);
227 m_data->m_cls_eprep->resize(nClus);
228 m_data->m_cls_dmener->resize(nClus);
230 for(
int i_cls=0; i_cls<nClus; i_cls++){
232 (*
m_data->m_cls_smpener)[i_cls].resize(CaloSampling::Unknown, 0.0);
233 (*
m_data->m_cls_smpener_unw)[i_cls].resize(CaloSampling::Unknown, 0.0);
234 (*
m_data->m_cls_eprep)[i_cls].resize(
m_data->m_narea, 0.0);
235 (*
m_data->m_cls_dmener)[i_cls].resize(
m_data->m_narea, 0.0);
237 m_data->m_cls_engcalib->resize(nClus, 0.0);
238 m_data->m_cls_recostat->resize(nClus, 0);
239 m_data->m_cls_pi0prob->resize(nClus, 0.0);
240 m_data->m_cls_isol->resize(nClus, 0.0);
241 m_data->m_cls_oocener->resize(nClus, 0.0);
242 m_data->m_cls_calib_emfrac->resize(nClus, 0.0);
243 m_data->m_cls_engcalibpres->resize(nClus, 0.0);
247 unsigned int iClus = 0;
248 for( ;clusIter!=clusIterEnd;++clusIter,++iClus) {
251 (*
m_data->m_cls_ener)[iClus] = theCluster->
e();
253 for(
int i_smp=0; i_smp<(int)CaloSampling::Unknown; i_smp++){
258 double mx_calib_tot=0;
261 return StatusCode::FAILURE;
263 m_data->m_engClusSumCalib += mx_calib_tot;
264 (*
m_data->m_cls_engcalib)[iClus] = mx_calib_tot;
266 double mx_calib_emb0=0, mx_calib_eme0=0, mx_calib_tileg3=0;
270 ATH_MSG_ERROR(
"One of the moment ENG_CALIB_EMB0, ENG_CALIB_EME0, ENG_CALIB_TILEG3 is absent" );
271 return StatusCode::FAILURE;
273 (*
m_data->m_cls_engcalibpres)[iClus] = (mx_calib_emb0+mx_calib_eme0+mx_calib_tileg3);
278 if(pClusColl->size() != pClusCollCalib->size()) {
279 ATH_MSG_WARNING(
"Different size of calibrated and uncalibrated cluster collection "
280 << pClusColl->size() <<
" " << pClusCollCalib->size() );
281 return StatusCode::SUCCESS;
297 if ( pi0Prob < 0 ) pi0Prob = 0;
298 if ( pi0Prob > 1 ) pi0Prob = 1;
300 (*
m_data->m_cls_pi0prob)[iClus] = pi0Prob;
307 return StatusCode::FAILURE;
309 (*
m_data->m_cls_isol)[iClus] = mx_isol;
312 double mx_calib_oocL;
315 return StatusCode::FAILURE;
317 (*
m_data->m_cls_oocener)[iClus] = mx_calib_oocL;
320 double mx_calib_emfrac;
323 return StatusCode::FAILURE;
325 (*
m_data->m_cls_calib_emfrac)[iClus] = mx_calib_emfrac;
333 for(; cellIter != cellIterEnd; cellIter++ ){
334 const CaloCell* pCell = (*cellIter);
337 (*
m_data->m_cls_ener_unw)[iClus] += pCell->
e();
338 (*
m_data->m_cls_smpener_unw)[iClus][(
int)nsmp] += pCell->
e();
341 double clusEner = (*
m_data->m_cls_ener_unw)[iClus];
345 return StatusCode::FAILURE;
347 (*
m_data->m_cls_lambda)[iClus] = clusLambda;
348 (*
m_data->m_cls_eta)[iClus] = theCluster->
eta();
349 (*
m_data->m_cls_phi)[iClus] = theCluster->
phi();
357 for(
int i_dma=0; i_dma<
m_data->m_narea; i_dma++){
362 return StatusCode::FAILURE;
364 (*
m_data->m_cls_dmener)[iClus][i_dma] = dmVal;
372 x = (*
m_data->m_cls_smpener_unw)[iClus][CaloSampling::PreSamplerB];
378 x = (*
m_data->m_cls_smpener_unw)[iClus][CaloSampling::EMB3];
379 y = (*
m_data->m_cls_smpener_unw)[iClus][CaloSampling::TileBar0];
385 x = (*
m_data->m_cls_smpener_unw)[iClus][CaloSampling::TileGap3];
391 x = (*
m_data->m_cls_smpener_unw)[iClus][CaloSampling::PreSamplerE];
397 x = (*
m_data->m_cls_smpener_unw)[iClus][CaloSampling::EME3];
398 y = (*
m_data->m_cls_smpener_unw)[iClus][CaloSampling::HEC0];
404 eprep = (*
m_data->m_cls_ener_unw)[iClus];
407 eprep = (*
m_data->m_cls_ener_unw)[iClus];
410 eprep = (*
m_data->m_cls_ener_unw)[iClus];
414 return StatusCode::FAILURE;
417 (*
m_data->m_cls_eprep)[iClus][i_dma] = eprep;
427 for(
int i_cls=0; i_cls<
m_data->m_ncls; i_cls++){
428 double edm_uncorrected = 0.0;
429 for(
int i_dma=0; i_dma<
m_data->m_narea; i_dma++){
431 if( (*
m_data->m_cls_eprep)[i_cls][i_dma] <= 0.0 &&
438 edm_uncorrected += (*
m_data->m_cls_dmener)[i_cls][i_dma];
439 (*
m_data->m_cls_dmener)[i_cls][i_dma] = 0.0;
443 for(
int i_dma=0; i_dma<
m_data->m_narea; i_dma++){
445 (*
m_data->m_cls_dmener)[i_cls][i_dma] += edm_uncorrected;
452 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
bool isValid() const
Test to see if the link can be dereferenced.
#define ATH_MSG_ERROR(x,...)
#define ATH_MSG_WARNING(x,...)
#define ATH_MSG_INFO(x,...)
#define ATH_MSG_FATAL(x,...)
Helpers for checking error return status codes and reporting errors.
Handle class for reading from StoreGate.
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
ServiceHandle< StoreGateSvc > & evtStore()
const ServiceHandle< StoreGateSvc > & detStore() const
Data object for each calorimeter readout cell.
virtual double e() const override final
get energy (data member) (synonym to method energy()
Identifier ID() const
get ID (from cached data member) non-virtual and inline for fast access
Data to read from special DeadMaterialTree.
CaloLocalHadCoeff * InitDataFromFile(const char *fname)
reconstruction status indicator
virtual const store_type & getStatusWord() const
retrieve the entire status word
DataModel_detail::const_iterator< DataVector > const_iterator
const T * at(size_type n) const
Access an element, as an rvalue.
CaloLocalHadCoeff * m_HadDMCoeff
Collection of dead material correction coeffitients.
std::string m_outputFileName
Name of the output file to save tree in.
SG::ReadHandleKey< xAOD::CaloClusterContainer > m_clusterCollNameCalib
Name of the calibrated CaloClusterContainer to use.
virtual StatusCode execute(const EventContext &ctx)
Execute method.
virtual StatusCode initialize()
std::pair< std::string, xAOD::CaloCluster::MomentType > moment_name_pair
std::vector< moment_name_pair > moment_name_vector
const CaloCell_ID * m_calo_id
bool m_doSaveCalibClusInfo
save additional cluster info from calibrated collections
TTree * m_outputTree
Output tree.
virtual ~GetLCDeadMaterialTree()
std::string m_HadDMCoeffInitFile
Name of text file with initial parameters for coefficients calculation.
GetLCDeadMaterialTree(const std::string &name, ISvcLocator *pSvcLocator)
CaloHadDMCoeffData * m_data
data to save into the tree
SG::ReadHandleKey< xAOD::CaloClusterContainer > m_clusterCollName
Name of the uncalibrated CaloClusterContainer to use.
std::vector< xAOD::CaloCluster::MomentType > m_momentForDMArea
virtual StatusCode finalize()
TFile * m_outputFile
Output file to save tree in.
This defines the McEventCollection, which is really just an ObjectVector of McEvent objectsFile: Gene...
static std::string find_file(const std::string &logical_file_name, const std::string &search_path)
bool retrieveMoment(MomentType type, double &value) const
Retrieve individual moment.
virtual double eta() const
The pseudorapidity ( ) of the particle.
virtual double e() const
The total energy of the particle.
CaloClusterCellLink::const_iterator const_cell_iterator
Iterator of the underlying CaloClusterCellLink (explicitly const version).
const_cell_iterator cell_end() const
float eSample(const CaloSample sampling) const
virtual double phi() const
The azimuthal angle ( ) of the particle.
MomentType
Enums to identify different moments.
@ ENG_CALIB_OUT_L
Attached Calibration Hit energy outside clusters but inside the calorimeter with loose matching (Angl...
@ EM_PROBABILITY
Classification probability to be em-like.
@ ENG_CALIB_DEAD_UNCLASS
Attached Calibration Hit energy in dead material in unclassified areas of the detector.
@ ENG_CALIB_DEAD_HEC0
Attached Calibration Hit energy in dead material between EME3 and HEC0.
@ ENG_CALIB_DEAD_TILEG3
Attached Calibration Hit energy in dead material before scintillator.
@ CENTER_LAMBDA
Shower depth at Cluster Centroid.
@ ENG_CALIB_DEAD_EME0
Attached Calibration Hit energy in dead material before EME0, between EME0 and EME1.
@ ENG_CALIB_DEAD_TILE0
Attached Calibration Hit energy in dead material between EMB3 and TILE0.
@ ENG_CALIB_FRAC_EM
Calibration Hit energy inside the cluster caused by e/gamma/pi0.
@ ENG_CALIB_DEAD_FCAL
Attached Calibration Hit energy in dead material before FCAL, between FCAL and HEC.
@ ENG_CALIB_TOT
Calibration Hit energy inside the cluster.
@ ENG_CALIB_DEAD_LEAKAGE
Attached Calibration Hit energy in dead material behind calorimeters.
@ ENG_CALIB_EMB0
Calibration Hit energy inside the cluster barrel presampler.
@ ENG_CALIB_EME0
Calibration Hit energy inside the cluster endcap presampler.
@ ENG_CALIB_DEAD_EMB0
Attached Calibration Hit energy in dead material before EMB0, between EMB0 and EMB1.
@ ISOLATION
Energy weighted fraction of non-clustered perimeter cells.
@ ENG_CALIB_TILEG3
Calibration Hit energy inside the cluster scintillator.
const_cell_iterator cell_begin() const
Iterator of the underlying CaloClusterCellLink (const version).
CaloRecoStatus & recoStatus()
Accesssor to CaloRecoStatus (non-const).
HepMC3::ConstGenParticlePtr ConstGenParticlePtr
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.