ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
LArG4::DM::CalibrationCalculator Class Reference

#include <DMCalibrationCalculator.h>

Inheritance diagram for LArG4::DM::CalibrationCalculator:
Collaboration diagram for LArG4::DM::CalibrationCalculator:

Public Member Functions

 CalibrationCalculator (const std::string &name, ISvcLocator *pSvcLocator)
 
virtual ~CalibrationCalculator ()
 
virtual G4bool Process (const G4Step *step, LArG4Identifier &identifier, std::vector< G4double > &energies, const eCalculatorProcessing process=kEnergyAndID) const override final
 

Private Attributes

CaloG4::SimulationEnergies m_energyCalculator
 

Detailed Description

Definition at line 34 of file DMCalibrationCalculator.h.

Constructor & Destructor Documentation

◆ CalibrationCalculator()

LArG4::DM::CalibrationCalculator::CalibrationCalculator ( const std::string &  name,
ISvcLocator *  pSvcLocator 
)

Definition at line 36 of file DMCalibrationCalculator.cxx.

37  : LArCalibCalculatorSvcImp(name,pSvcLocator)
38  {
39  }

◆ ~CalibrationCalculator()

LArG4::DM::CalibrationCalculator::~CalibrationCalculator ( )
virtual

Definition at line 42 of file DMCalibrationCalculator.cxx.

43  {
44  }

Member Function Documentation

◆ Process()

G4bool LArG4::DM::CalibrationCalculator::Process ( const G4Step *  step,
LArG4Identifier identifier,
std::vector< G4double > &  energies,
const eCalculatorProcessing  process = kEnergyAndID 
) const
finaloverridevirtual

Definition at line 46 of file DMCalibrationCalculator.cxx.

49  {
50  // Use the calculators to determine the energies and the
51  // identifier associated with this G4Step. Note that the
52  // default is to process both the energy and the ID.
53 
54  if ( process == kEnergyAndID || process == kOnlyEnergy )
55  {
56  m_energyCalculator.Energies( step, energies );
57  }
58  else
59  for (unsigned int i=0; i != 4; i++) energies.push_back( 0. );
60 
61 
62  identifier.clear();
63  if ( process == kEnergyAndID || process == kOnlyID )
64  {
65  // Calculate the identifier.
66 
67  // static ?
68  static const double oneOverDeta = 10.; // 1/Deta = 1./0.1 = 10.
69  static const double oneOverDphi = 32./M_PI; // 1/Dphi
70 
71  // Calculate the mid-point of the step, and the simple geometry variables.
72 
73  G4StepPoint* pre_step_point = step->GetPreStepPoint();
74  G4StepPoint* post_step_point = step->GetPostStepPoint();
75 
76  G4ThreeVector startPoint = pre_step_point->GetPosition();
77  G4ThreeVector endPoint = post_step_point->GetPosition();
78  G4ThreeVector p = (startPoint + endPoint) * 0.5;
79 
80  //G4double rho = p.perp();
81  G4double eta = fabs( p.pseudoRapidity() );
82  G4double phi = p.phi();
83  if ( phi < 0. ) phi += 2.*M_PI; // Normalize for phiBin calculation
84 
85 #ifdef DEBUG_HITS
86  ATH_MSG_DEBUG("Process: rho,eta,phi " << p.perp() << " " << eta << " " << phi);
87 #endif
88 
89  // subdet = +/-4 "+" or " -" according to sign of Z in World coorinate
90  G4int subdet = ( p.z() > 0.) ? 4 : -4;
91  G4int phiBin = (int) ( phi * oneOverDphi );
92  if (phiBin>63) phiBin=63;
93  G4int type = 1;
94 
95  // Initialize identifier variables with (invalid) default
96  // values (INT_MIN is defined in <climits>).
97  G4int sampling = INT_MIN;
98  G4int region = INT_MIN;
99  G4int etaBin = INT_MIN;
100 
101  if (eta < 1.0) {
102  sampling = 2;
103  region = 1;
104  etaBin = (int) ( eta * oneOverDeta );
105  }
106  else if (eta < 1.5) {
107  sampling = 2;
108  region = 2;
109  etaBin = (int) ( (eta-1.) * oneOverDeta );
110  }
111  else if (eta < 1.6) {
112  sampling = 1;
113  region = 4;
114  etaBin = 0;
115  }
116  else if (eta < 1.8) {
117  sampling = 1;
118  region = 5;
119  etaBin = (int) ( (eta-1.5) * oneOverDeta );
120  }
121  else if (eta < 3.2) {
122  sampling = 1;
123  region = 6;
124  etaBin = (int) ( (eta-1.3) * oneOverDeta );
125  }
126  else {
127  ATH_MSG_WARNING("hit above 3.2 in eta !!!");
128  return false;
129  }
130 
131 
132  // Append the cell ID to the (empty) identifier.
133  identifier << 10 // Calorimeter
134  << subdet // LAr +/-4 where "+" or " -" according to
135  // the sign of Z in World coorinate
136  << type
137  << sampling
138  << region
139  << etaBin
140  << phiBin;
141 
142  }
143 
144 #ifdef DEBUG_HITS
145  G4double energy = accumulate(energies.begin(),energies.end(),0.);
146  ATH_MSG_DEBUG("Process:"
147  << " ID=" << std::string(identifier)
148  << " energy=" << energy
149  << " energies=(" << energies[0]
150  << "," << energies[1]
151  << "," << energies[2]
152  << "," << energies[3] << ")");
153 #endif
154 
155  // Check for bad result.
156  if ( identifier == LArG4Identifier() )
157  return false;
158 
159  return true;
160  }

Member Data Documentation

◆ m_energyCalculator

CaloG4::SimulationEnergies LArG4::DM::CalibrationCalculator::m_energyCalculator
private

Definition at line 56 of file DMCalibrationCalculator.h.


The documentation for this class was generated from the following files:
CaloG4::SimulationEnergies::Energies
void Energies(const G4Step *, std::vector< G4double > &) const
The simple method to call from a calibration calculator: Examine the G4Step and return the energies r...
LArG4Identifier
Definition: LArG4Identifier.h:121
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:64
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
accumulate
bool accumulate(AccumulateMap &map, std::vector< module_t > const &modules, FPGATrackSimMatrixAccumulator const &acc)
Accumulates an accumulator (e.g.
Definition: FPGATrackSimMatrixAccumulator.cxx:22
LArG4::kOnlyEnergy
@ kOnlyEnergy
Definition: LArG4EnumDefs.h:10
M_PI
#define M_PI
Definition: ActiveFraction.h:11
xAOD::identifier
identifier
Definition: UncalibratedMeasurement_v1.cxx:15
SUSY_SimplifiedModel_PostInclude.process
string process
Definition: SUSY_SimplifiedModel_PostInclude.py:42
xAOD::etaBin
setSAddress setEtaMS setDirPhiMS setDirZMS setBarrelRadius setEndcapAlpha setEndcapRadius setInterceptInner setEtaMap etaBin
Definition: L2StandAloneMuon_v1.cxx:148
ParticleGun_FastCalo_ChargeFlip_Config.energy
energy
Definition: ParticleGun_FastCalo_ChargeFlip_Config.py:78
lumiFormat.i
int i
Definition: lumiFormat.py:92
LArCalibCalculatorSvcImp::LArCalibCalculatorSvcImp
LArCalibCalculatorSvcImp(const std::string &name, ISvcLocator *pSvcLocator)
Definition: LArCalibCalculatorSvcImp.cxx:7
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
LArG4::kOnlyID
@ kOnlyID
Definition: LArG4EnumDefs.h:10
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
xAOD::phiBin
setSAddress setEtaMS setDirPhiMS setDirZMS setBarrelRadius setEndcapAlpha setEndcapRadius setPhiMap phiBin
Definition: L2StandAloneMuon_v2.cxx:144
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
LArCellBinning.step
step
Definition: LArCellBinning.py:158
LArG4::kEnergyAndID
@ kEnergyAndID
Definition: LArG4EnumDefs.h:10
LArG4::DM::CalibrationCalculator::m_energyCalculator
CaloG4::SimulationEnergies m_energyCalculator
Definition: DMCalibrationCalculator.h:56