ATLAS Offline Software
Loading...
Searching...
No Matches
CaloCalibrationHitsTestTool.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
5//================================================================//
6// Chiara Debenedetti, 29/08/2011, CaloCalibrationHitsTestTool.cxx //
7//================================================================//
8
12#include "CaloDetDescr/CaloDetDescrElement.h"
13#include <TH1.h>
14#include <TH2D.h>
15#include <TProfile.h>
16
17CaloCalibrationHitsTestTool::CaloCalibrationHitsTestTool(const std::string& type, const std::string& name, const IInterface* parent)
18 : SimTestToolBase(type, name, parent),m_calibHitType("LArActive"),
19 m_eta(nullptr), m_phi(nullptr), m_eEM(nullptr),
20 m_eNonEM(nullptr), m_eInv(nullptr), m_eEsc(nullptr),
21 m_eTot(nullptr), m_rz(nullptr), m_etaphi(nullptr),
22 m_eTot_partID(nullptr), m_eTot_eta(nullptr), m_eTot_phi(nullptr),
23 m_partID_large(nullptr), m_partID_small(nullptr)
24{
25 declareProperty("CalibHitType", m_calibHitType="LArActive");
26}
27
29
30 //--discriminate between different sections--//
31 if (m_calibHitType=="LArActive" || m_calibHitType=="LArInactive" || m_calibHitType=="LArDeadMaterial" ) {
32 m_path+="Calib/LAr/";
33 m_hitcollkey="LArCalibrationHit"+m_calibHitType.substr(3);
34 } else if (m_calibHitType=="TileActiveCell" || m_calibHitType=="TileInactiveCell" || m_calibHitType=="TileDeadMaterial") {
35 m_path+="Calib/Tile/";
36 m_hitcollkey="TileCalibHit"+m_calibHitType.substr(4);
37 } else if (m_calibHitType=="TileDM" || m_calibHitType=="TileCell") { //old naming convention for Tile CaloCalibrationHits
38 m_path+="Calib/Tile/";
39 m_hitcollkey="TileCalibration"+m_calibHitType.substr(4)+"HitCnt";
40 } else{
41 ATH_MSG_ERROR(" unknown key " <<m_calibHitType);
42 return StatusCode::FAILURE;
43 }
44
45 //voglio: eta, phi, tutte le energie, rz, etaphi,
46 // particle ID vs Etot Prof, eta Etot prof, phi etot prof
47 _TH1D(m_eta,(m_calibHitType+"_eta").c_str(),25,-5.,5.);
48 _TH1D(m_phi,(m_calibHitType+"_phi").c_str(),25,-5.,5.);
49 _TH1D(m_eEM,(m_calibHitType+"_eEM").c_str(),100,0.,500.);
50 _TH1D(m_eNonEM,(m_calibHitType+"_eNonEM").c_str(),100,0.,500.);
51 _TH1D(m_eInv,(m_calibHitType+"_eInv").c_str(),100,0.,500.);
52 _TH1D(m_eEsc,(m_calibHitType+"_eEsc").c_str(),100,0.,500.);
53 _TH1D(m_eTot,(m_calibHitType+"_eTot").c_str(),100,0.,500.);
54
55 _TH2D(m_rz,(m_calibHitType+"_rz").c_str(),100,-5200.,5200.,100,0.,3000.);
56 _TH2D(m_etaphi,(m_calibHitType+"_etaphi").c_str(),100,-5.,5.,100,-4.,4.);
57
58 _TH1D(m_partID_large,(m_calibHitType+"_partID1").c_str(),100,0.,1500000.);
59 m_partID_large -> StatOverflows();
60 _TH1D(m_partID_small,(m_calibHitType+"_partID2").c_str(),100,10000.,10100.);
61
62 _TH1D_WEIGHTED(m_eTot_partID,(m_calibHitType+"_eTot_partID").c_str(),600,0.,300000.);
63 _TH1D_WEIGHTED(m_eTot_eta,(m_calibHitType+"_eTot_eta").c_str(),25,-5.,5.);
64 _TH1D_WEIGHTED(m_eTot_phi,(m_calibHitType+"_eTot_phi").c_str(),25,-3.2,3.2);
65
66 ATH_CHECK(m_caloMgrKey.initialize());
67
68 return StatusCode::SUCCESS;
69}
70
72
73 SG::ReadCondHandle<CaloDetDescrManager> caloMgrHandle{m_caloMgrKey,Gaudi::Hive::currentContext()};
74 const CaloDetDescrManager* caloMgr = *caloMgrHandle;
75
77 CHECK(evtStore()->retrieve(iter,m_hitcollkey));
78 for(const CaloCalibrationHit* hit : *iter) {
79
80 GeoCaloCalibHit geoHit(*hit, m_hitcollkey, caloMgr);
81 if (!geoHit) continue;
82 const CaloDetDescrElement* ddElement = geoHit.getDetDescrElement();
83
84 if (!ddElement) {
85 ATH_MSG_WARNING(" could not retrieve DetElement in CaloCalibrationHitsTestTool/" <<m_calibHitType);
86 continue;
87 }
88 double eta = ddElement->eta();
89 double phi = ddElement->phi();
90 double radius = ddElement->r();
91 double z = ddElement->z();
92 double emEnergy = geoHit.energyEM();
93 double nonEmEnergy = geoHit.energyNonEM();
94 double invEnergy = geoHit.energyInvisible();
95 double escEnergy = geoHit.energyEscaped();
96 double totEnergy = geoHit.energyTotal();
97 double particleID = HepMC::barcode(hit);
98
99 m_eta->Fill(eta);
100 m_phi->Fill(phi);
101 m_eEM->Fill(emEnergy);
102 m_eNonEM->Fill(nonEmEnergy);
103 m_eInv->Fill(invEnergy);
104 m_eEsc->Fill(escEnergy);
105 m_eTot->Fill(totEnergy);
106
107 m_rz->Fill(z, radius);
108 m_etaphi->Fill(eta, phi);
109
110 // particle id
111 m_partID_small->Fill(particleID);
112 m_partID_large->Fill(particleID);
113 // weighted histos
114 m_eTot_partID->Fill(particleID, totEnergy);
115 m_eTot_eta->Fill(eta, totEnergy);
116 m_eTot_phi->Fill(phi, totEnergy);
117 }
118
119 return StatusCode::SUCCESS;
120}
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_WARNING(x)
#define CHECK(...)
Evaluate an expression and check for errors.
#define _TH1D_WEIGHTED(var, name, nbin, xmin, xmax)
#define _TH2D(var, name, nbinx, xmin, xmax, nbiny, ymin, ymax)
#define _TH1D(var, name, nbin, xmin, xmax)
#define z
Class to store calorimeter calibration hit.
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloMgrKey
virtual StatusCode processEvent() override
virtual StatusCode initialize() override
CaloCalibrationHitsTestTool(const std::string &type, const std::string &name, const IInterface *parent)
This class groups all DetDescr information related to a CaloCell.
This class provides the client interface for accessing the detector description information common to...
Adaptor for CaloCalibHits.
double energyTotal() const
const CaloDetDescrElement * getDetDescrElement() const
double energyNonEM() const
double energyEM() const
double energyEscaped() const
double energyInvisible() const
std::string m_path
SimTestToolBase(const std::string &type, const std::string &name, const IInterface *parent)
int barcode(const T *p)
Definition Barcode.h:16