 |
ATLAS Offline Software
|
Go to the documentation of this file.
32 , m_zCorrection(nullptr)
72 if (
inputMetaStore()->contains<xAOD::FileMetaData>(
"FileMetaData")) {
75 std::string simType(
"");
88 TFile *
file = TFile::Open(filepath.c_str(),
"READ");
90 if (
file ==
nullptr) {
91 ATH_MSG_WARNING(
"Couldn't find file for z-correction: " << filepath.c_str());
93 return StatusCode::FAILURE;
97 file->GetObject(
"dz_trk_pointing_vs_etas2", temp);
99 if (temp ==
nullptr) {
100 ATH_MSG_WARNING(
"Couldn't find 'dz_trk_pointing_vs_etas2' histogram in file: " << filepath.c_str());
102 return StatusCode::FAILURE;
105 bool status = TH1::AddDirectoryStatus();
106 TH1::AddDirectory(
false);
109 TH1::AddDirectory(
status);
111 return StatusCode::SUCCESS;
117 const EventContext& ctx = Gaudi::Hive::currentContext();
128 std::pair<float, float>
result;
129 for (
const auto *
egamma: egammas) {
138 if(isDecorAvailable){
139 ATH_MSG_DEBUG(
"Called updatePointingAuxdata but decoration is already available");
156 if(!isDecorAvailable){
163 return StatusCode::SUCCESS;
169 if (fabs(etas2) < 1.37)
return zPointing;
178 return std::make_pair(0,0);
184 ATH_MSG_WARNING(
"Couldn't retrieve EventInfo from TEvent, egamma won't be decorated.");
185 return std::make_pair(0, 0);
194 if (cluster ==
nullptr) {
195 ATH_MSG_WARNING(
"Couldn't retrieve CaloCluster from Photon, egammas won't be decorated.");
196 return std::make_pair(0, 0);
199 float cl_e = cluster->
e();
200 float etas1 = cluster->
etaBE(1);
201 float etas2 = cluster->
etaBE(2);
202 float phis2 = cluster->
phiBE(2);
203 float cl_theta = 2.0*
atan(
exp(-1.0*cluster->
eta()));
210 double r0_with_beamSpot = d_beamSpot*
cos(phis2 - phi_beamSpot);
212 float s_zvertex = 0, s_errz = 0;
213 s_zvertex = (RZ1.second * (RZ2.first - r0_with_beamSpot) -
214 RZ2.second * (RZ1.first - r0_with_beamSpot)) /
215 (RZ2.first - RZ1.first);
218 s_errz = 0.5 * (RZ2.first + RZ1.first) * (0.060 / sqrt(cl_e * 0.001)) /
219 (
sin(cl_theta) *
sin(cl_theta));
221 return std::make_pair(s_zvertex, s_errz);
229 return std::make_pair(0,0);
235 ATH_MSG_WARNING(
"Couldn't retrieve EventInfo from TEvent, photons won't be decorated.");
236 return std::make_pair(0, 0);
245 if (cluster ==
nullptr) {
246 ATH_MSG_WARNING(
"Couldn't retrieve CaloCluster from Photon, photons won't be decorated.");
247 return std::make_pair(0, 0);
250 float etas1 = cluster->
etaBE(1);
251 float phis2 = cluster->
phiBE(2);
254 if (cluster ==
nullptr) {
255 ATH_MSG_WARNING(
"Couldn't retrieve conversion Vertex from Photon, photons won't be decorated.");
256 return std::make_pair(0, 0);
259 float conv_x =
conv->x();
260 float conv_y =
conv->y();
261 float conv_z =
conv->z();
267 double conv_r = hypot(conv_x, conv_y);
270 double phi_Calo = atan2(
sin(phis2),
cos(phis2));
271 double r0_with_beamSpot = d_beamSpot*
cos(phi_Calo - phi_beamSpot);
273 float s_zvertex = (RZ1.second*(conv_r - r0_with_beamSpot) - conv_z*(RZ1.first - r0_with_beamSpot)) / (conv_r - RZ1.first);
275 float dist_vtx_to_conv = hypot(conv_r - r0_with_beamSpot, conv_z - s_zvertex);
276 float dist_conv_to_s1 = hypot(RZ1.first - conv_r, RZ1.second - conv_z);
278 float error_etaS1 = 0.001;
284 float error_Z_Calo_1st_Sampling_barrel = error_etaS1*RZ1.first*fabs(cosh(etas1));
285 s_errz = error_Z_Calo_1st_Sampling_barrel*dist_vtx_to_conv/dist_conv_to_s1;
288 float error_R_Calo_1st_Sampling_endcap = error_etaS1*cosh(etas1)*RZ1.first*RZ1.first/fabs(RZ1.second);
289 s_errz = error_R_Calo_1st_Sampling_endcap*fabs(sinh(etas1))*dist_vtx_to_conv/dist_conv_to_s1;
292 return std::make_pair(s_zvertex, s_errz);
def retrieve(aClass, aKey=None)
bool isAvailable()
Test to see if this variable exists in the store, for the referenced object.
float phiBE(const unsigned layer) const
Get the phi in one layer of the EM Calo.
Select isolated Photons, Electrons and Muons.
float beamPosX() const
X coordinate of the beam spot position.
float etaBE(const unsigned layer) const
Get the eta in one layer of the EM Calo.
float beamPosY() const
Y coordinate of the beam spot position.
Description of a calorimeter cluster.
bool inEndcap() const
Returns true if at least one clustered cell in the endcap.
std::size_t numberOfSiTracks(const xAOD::Photon *eg)
return the number of Si tracks in the conversion
virtual double eta() const
The pseudorapidity ( ) of the particle.
::StatusCode StatusCode
StatusCode definition for legacy code.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Handle class for adding a decoration to an object.
bool inBarrel() const
Returns true if at least one clustered cell in the barrel.
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
static std::pair< float, float > getRZ(float eta, int sampling)
Shower depth in R,Z for the given sampling.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
Photon_v1 Photon
Definition of the current "egamma version".
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
float eSample(const CaloSample sampling) const
Class describing a Vertex.
#define ATH_MSG_WARNING(x)
def TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)
virtual double e() const
The total energy of the particle.