ATLAS Offline Software
particleGamma.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef MDT_DIGITIZATION_PARTICLEGAMMA_H
6 #define MDT_DIGITIZATION_PARTICLEGAMMA_H
7 /*-----------------------------------------------
8 
9  Created 07-10-2011 by Oleg.Bulekov@cern.ch
10  Function particleGamma returns the value of gamma factor for Qball particle.
11  -----------------------------------------------*/
12 
13 #include <iostream>
14 #include <sstream>
15 #include <vector>
16 
17 #include "CLHEP/Units/PhysicalConstants.h"
29 #include "StoreGate/StoreGateSvc.h"
31 
32 // SB
33 #include "AtlasHepMC/GenParticle.h"
34 //
35 
36 double particleGamma(const EventContext& ctx, const MDTSimHit& hit, unsigned short eventId = 0) {
37  double QGamma = -9999.;
38  const HepMcParticleLink trkParticle = HepMcParticleLink::getRedirectedLink(hit.particleLink(), eventId, ctx); // This link should now correctly resolve to the TruthEvent McEventCollection in the main StoreGateSvc.
39  HepMC::ConstGenParticlePtr genParticle = trkParticle.cptr();
40  if (genParticle) {
41  const int particleEncoding = genParticle->pdg_id();
42  if ((((int)(std::abs(particleEncoding) / 10000000) == 1) && ((int)(std::abs(particleEncoding) / 100000) == 100)) ||
43  (((int)(std::abs(particleEncoding) / 10000000) == 2) && ((int)(std::abs(particleEncoding) / 100000) == 200))) { // TODO Use functions from TruthUtils/AtlasPID.h instead?
44  const double QPx = genParticle->momentum().px();
45  const double QPy = genParticle->momentum().py();
46  const double QPz = genParticle->momentum().pz();
47  const double QE = genParticle->momentum().e();
48  const double QM2 = pow(QE, 2) - pow(QPx, 2) - pow(QPy, 2) - pow(QPz, 2);
49  if (QM2 >= 0.) {
50  const double QM = std::sqrt(QM2);
51  if (QM > 0.) {
52  QGamma = QE / QM;
53  }
54  }
55  }
56  }
57  return QGamma;
58 }
59 
60 #endif
MdtReadoutElement.h
MdtTubeCalibContainer.h
particleGamma
double particleGamma(const EventContext &ctx, const MDTSimHit &hit, unsigned short eventId=0)
Definition: particleGamma.h:36
MDTSimHit
Definition: MDTSimHit.h:21
conifer::pow
constexpr int pow(int x)
Definition: conifer.h:20
GenParticle.h
GeometryStatics.h
HepMC::ConstGenParticlePtr
const GenParticle * ConstGenParticlePtr
Definition: GenParticle.h:38
MDTSimHitCollection.h
PathResolver.h
MuonDetectorManager.h
MDTSimHit::particleLink
const HepMcParticleLink & particleLink() const
Definition: MDTSimHit.h:100
MdtDigitContainer.h
PileUpMergeSvc.h
the preferred mechanism to access information from the different event stores in a pileup job.
MdtFullCalibData.h
MuonSimDataCollection.h
StoreGateSvc.h
MuonSimData.h