CMS 3D CMS Logo

HcalTB02HcalNumberingScheme.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: HcalTestBeam
4 // Class : HcalTB02HcalNumberingScheme
5 //
6 // Implementation:
7 // Numbering scheme for hadron calorimeter in 2002 test beam
8 //
9 // Original Author:
10 // Created: Sun 21 10:14:34 CEST 2006
11 //
12 
13 // system include files
14 
15 // user include files
18 
19 #include "G4SystemOfUnits.hh"
20 
21 //
22 // constructors and destructor
23 //
24 
26  : HcalTB02NumberingScheme(), phiScale(1000000), etaScale(10000) {
27  edm::LogVerbatim("HcalTBSim") << "Creating HcalTB02HcalNumberingScheme";
28 }
29 
31  edm::LogVerbatim("HcalTBSim") << "Deleting HcalTB02HcalNumberingScheme";
32 }
33 
34 //
35 // member functions
36 //
37 
38 int HcalTB02HcalNumberingScheme::getUnitID(const G4Step* aStep) const {
39  int scintID = 0;
40 
41  G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
42  const G4ThreeVector& hitPoint = preStepPoint->GetPosition();
43  float hx = hitPoint.x();
44  float hy = hitPoint.y();
45  float hz = hitPoint.z();
46  float hr = std::sqrt(pow(hx, 2) + pow(hy, 2));
47 
48  // Check if hit happened in first HO layer or second.
49 
50  if ((hr > 3. * m) && (hr < 3.830 * m))
51  return scintID = 17;
52  if (hr > 3.830 * m)
53  return scintID = 18;
54 
55  // Compute the scintID in the HB.
56 
57  float hR = hitPoint.mag(); //sqrt( pow(hx,2)+pow(hy,2)+pow(hz,2) );
58  float htheta = (hR == 0. ? 0. : acos(std::max(std::min(hz / hR, float(1.)), float(-1.))));
59  float hsintheta = sin(htheta);
60  float hphi = (hR * hsintheta == 0. ? 0. : acos(std::max(std::min(hx / (hR * hsintheta), float(1.)), float(-1.))));
61  float heta = (fabs(hsintheta) == 1. ? 0. : -log(fabs(tan(htheta / 2.))));
62  int eta = int(heta / 0.087);
63  int phi = int(hphi / (5. * degree));
64 
65  G4VPhysicalVolume* thePV = preStepPoint->GetPhysicalVolume();
66  int ilayer = ((thePV->GetCopyNo()) / 10) % 100;
67  edm::LogVerbatim("HcalTBSim") << "HcalTB02HcalNumberingScheme:: Layer " << thePV->GetName()
68  << " found at phi = " << phi << " eta = " << eta << " lay = " << thePV->GetCopyNo()
69  << " " << ilayer;
70 
71  scintID = phiScale * phi + etaScale * eta + ilayer;
72  if (hy < 0.)
73  scintID = -scintID;
74 
75  return scintID;
76 }
77 
79  sID = abs(sID);
80  int layerID = sID;
81  if ((layerID != 17) && (layerID != 18))
82  layerID = sID - int(float(sID) / float(etaScale)) * etaScale;
83 
84  edm::LogVerbatim("HcalTBSim") << "HcalTB02HcalNumberingScheme:: scintID " << sID << " layer = " << layerID;
85  return layerID;
86 }
87 
89  float IDsign = 1.;
90  if (sID < 0)
91  IDsign = -1;
92  sID = abs(sID);
93  int phiID = int(float(sID) / float(phiScale));
94  edm::LogVerbatim("HcalTBSim") << "HcalTB02HcalNumberingScheme:: scintID " << sID << " phi = " << phiID;
95  if (IDsign > 0) {
96  phiID += 4;
97  } else {
98  phiID = abs(phiID - 3);
99  }
100  return phiID;
101 }
102 
104  sID = abs(sID);
105  int aux = sID - int(float(sID) / float(phiScale)) * phiScale;
106  int etaID = int(float(aux) / float(etaScale));
107 
108  edm::LogVerbatim("HcalTBSim") << "HcalTB02HcalNumberingScheme:: scintID " << sID << " eta = " << etaID;
109  return etaID;
110 }
MessageLogger.h
min
T min(T a, T b)
Definition: MathUtil.h:58
HcalTB02HcalNumberingScheme::phiScale
int phiScale
Definition: HcalTB02HcalNumberingScheme.h:38
HcalTB02HcalNumberingScheme::etaScale
int etaScale
Definition: HcalTB02HcalNumberingScheme.h:39
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
PVValHelper::eta
Definition: PVValidationHelpers.h:69
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:72
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
HcalTB02HcalNumberingScheme.h
HcalTB02HcalNumberingScheme::getphiID
int getphiID(int sID) const
Definition: HcalTB02HcalNumberingScheme.cc:88
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
HcalTB02HcalNumberingScheme::getUnitID
int getUnitID(const G4Step *aStep) const override
Definition: HcalTB02HcalNumberingScheme.cc:38
funct::tan
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
printConversionInfo.aux
aux
Definition: printConversionInfo.py:19
createfilelist.int
int
Definition: createfilelist.py:10
edm::LogVerbatim
Definition: MessageLogger.h:297
HcalTB02HcalNumberingScheme::getetaID
int getetaID(int sID) const
Definition: HcalTB02HcalNumberingScheme.cc:103
DDAxes::phi
HcalTB02NumberingScheme
Definition: HcalTB02NumberingScheme.h:24
dqm-mbProfile.log
log
Definition: dqm-mbProfile.py:17
HcalTB02HcalNumberingScheme::getlayerID
int getlayerID(int sID) const
Definition: HcalTB02HcalNumberingScheme.cc:78
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:30
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
HcalTB02HcalNumberingScheme::~HcalTB02HcalNumberingScheme
~HcalTB02HcalNumberingScheme() override
Definition: HcalTB02HcalNumberingScheme.cc:30
HcalTB02HcalNumberingScheme::HcalTB02HcalNumberingScheme
HcalTB02HcalNumberingScheme()
Definition: HcalTB02HcalNumberingScheme.cc:25