CMS 3D CMS Logo

HGCalParameters.cc
Go to the documentation of this file.
4 
5 //#define EDM_ML_DEBUG
6 
7 HGCalParameters::HGCalParameters(const std::string& nam) : name_(nam), nCells_(0), waferMaskMode_(0) {
8 #ifdef EDM_ML_DEBUG
9  edm::LogVerbatim("HGCalGeom") << "Construct HGCalParameters for " << name_;
10 #endif
11 }
12 
14 
16  if (reco) {
17  moduleLayR_.emplace_back(mytr.lay);
18  moduleBlR_.emplace_back(mytr.bl);
19  moduleTlR_.emplace_back(mytr.tl);
20  moduleHR_.emplace_back(mytr.h);
21  moduleDzR_.emplace_back(mytr.dz);
22  moduleAlphaR_.emplace_back(mytr.alpha);
23  moduleCellR_.emplace_back(mytr.cellSize);
24  } else {
25  moduleLayS_.emplace_back(mytr.lay);
26  moduleBlS_.emplace_back(mytr.bl);
27  moduleTlS_.emplace_back(mytr.tl);
28  moduleHS_.emplace_back(mytr.h);
29  moduleDzS_.emplace_back(mytr.dz);
30  moduleAlphaS_.emplace_back(mytr.alpha);
31  moduleCellS_.emplace_back(mytr.cellSize);
32  }
33 }
34 
37  if (reco) {
38  if (k < moduleLayR_.size()) {
39  mytr.lay = moduleLayR_[k];
40  mytr.bl = moduleBlR_[k];
41  mytr.tl = moduleTlR_[k];
42  mytr.h = moduleHR_[k];
43  mytr.dz = moduleDzR_[k];
44  mytr.alpha = moduleAlphaR_[k];
45  mytr.cellSize = moduleCellR_[k];
46  } else {
47  mytr.lay = -1;
48  mytr.bl = mytr.tl = mytr.h = mytr.dz = mytr.alpha = mytr.cellSize = 0;
49  }
50  } else {
51  if (k < moduleLayS_.size()) {
52  mytr.lay = moduleLayS_[k];
53  mytr.bl = moduleBlS_[k];
54  mytr.tl = moduleTlS_[k];
55  mytr.h = moduleHS_[k];
56  mytr.dz = moduleDzS_[k];
57  mytr.alpha = moduleAlphaS_[k];
58  mytr.cellSize = moduleCellS_[k];
59  } else {
60  mytr.lay = -1;
61  mytr.bl = mytr.tl = mytr.h = mytr.dz = mytr.alpha = mytr.cellSize = 0;
62  }
63  }
64  return mytr;
65 }
66 
68  int zp = (mytr.zp == 1) ? 1 : 0;
69  uint32_t indx = ((zp & kMaskZside) << kShiftZside);
70  indx |= ((mytr.lay & kMaskLayer) << kShiftLayer);
71  indx |= ((mytr.sec & kMaskSector) << kShiftSector);
72  indx |= ((mytr.subsec & kMaskSubSec) << kShiftSubSec);
73 #ifdef EDM_ML_DEBUG
74  edm::LogVerbatim("HGCalGeom") << "ZP " << zp << ":" << kMaskZside << ":" << kShiftZside
75  << ((zp & kMaskZside) << kShiftZside) << " Lay " << mytr.lay << ":" << kMaskLayer << ":"
76  << kShiftLayer << ":" << ((mytr.lay & kMaskLayer) << kShiftLayer) << " Sector "
77  << mytr.sec << ":" << kMaskSector << ":" << kShiftSector << ":"
78  << ((mytr.sec & kMaskSector) << kShiftSector) << " SubSec " << mytr.subsec << ":"
79  << kMaskSubSec << ":" << kShiftSubSec << ":"
80  << ((mytr.subsec & kMaskSubSec) << kShiftSubSec) << " Index " << std::hex << indx
81  << std::dec;
82 #endif
83  trformIndex_.emplace_back(indx);
84  trformTranX_.emplace_back(mytr.h3v.x());
85  trformTranY_.emplace_back(mytr.h3v.y());
86  trformTranZ_.emplace_back(mytr.h3v.z());
87  trformRotXX_.emplace_back((std::abs(mytr.hr.xx()) > tol) ? mytr.hr.xx() : 0);
88  trformRotYX_.emplace_back((std::abs(mytr.hr.yx()) > tol) ? mytr.hr.yx() : 0);
89  trformRotZX_.emplace_back((std::abs(mytr.hr.zx()) > tol) ? mytr.hr.zx() : 0);
90  trformRotXY_.emplace_back((std::abs(mytr.hr.xy()) > tol) ? mytr.hr.xy() : 0);
91  trformRotYY_.emplace_back((std::abs(mytr.hr.yy()) > tol) ? mytr.hr.yy() : 0);
92  trformRotZY_.emplace_back((std::abs(mytr.hr.zy()) > tol) ? mytr.hr.zy() : 0);
93  trformRotXZ_.emplace_back((std::abs(mytr.hr.xz()) > tol) ? mytr.hr.xz() : 0);
94  trformRotYZ_.emplace_back((std::abs(mytr.hr.yz()) > tol) ? mytr.hr.yz() : 0);
95  trformRotZZ_.emplace_back((std::abs(mytr.hr.zz()) > tol) ? mytr.hr.zz() : 0);
96 #ifdef EDM_ML_DEBUG
97  unsigned int k = trformIndex_.size() - 1;
98  edm::LogVerbatim("HGCalGeom") << "HGCalParameters[" << k << "] Index " << std::hex << trformIndex_[k] << std::dec
99  << " (" << mytr.zp << ", " << mytr.lay << ", " << mytr.sec << ", " << mytr.subsec
100  << ") Translation (" << trformTranX_[k] << ", " << trformTranY_[k] << ", "
101  << trformTranZ_[k] << ") Rotation (" << trformRotXX_[k] << ", " << trformRotYX_[k]
102  << ", " << trformRotZX_[k] << ", " << trformRotXY_[k] << ", " << trformRotYY_[k] << ", "
103  << trformRotZY_[k] << ", " << trformRotXZ_[k] << ", " << trformRotYZ_[k] << ", "
104  << trformRotZZ_[k];
105 #endif
106 }
107 
110  if (k < trformIndex_.size()) {
111  const auto& id = getID(k);
112  mytr.zp = id[0];
113  mytr.lay = id[1];
114  mytr.sec = id[2];
115  mytr.subsec = id[3];
116  mytr.h3v = CLHEP::Hep3Vector(trformTranX_[k], trformTranY_[k], trformTranZ_[k]);
117  const CLHEP::HepRep3x3 rotation(trformRotXX_[k],
118  trformRotXY_[k],
119  trformRotXZ_[k],
120  trformRotYX_[k],
121  trformRotYY_[k],
122  trformRotYZ_[k],
123  trformRotZX_[k],
124  trformRotZY_[k],
125  trformRotZZ_[k]);
126  mytr.hr = CLHEP::HepRotation(rotation);
127  } else {
128  mytr.zp = mytr.lay = mytr.sec = mytr.subsec = 0;
129  }
130 #ifdef EDM_ML_DEBUG
131  edm::LogVerbatim("HGCalGeom") << "HGCalParameters[" << k << "] Index " << std::hex << trformIndex_[k] << std::dec
132  << " (" << mytr.zp << ", " << mytr.lay << ", " << mytr.sec << ", " << mytr.subsec
133  << ") Translation (" << mytr.h3v.x() << ", " << mytr.h3v.y() << ", " << mytr.h3v.z()
134  << ") Rotation (" << mytr.hr.xx() << ", " << mytr.hr.yx() << ", " << mytr.hr.zx()
135  << ", " << mytr.hr.xy() << ", " << mytr.hr.yy() << ", " << mytr.hr.zy() << ", "
136  << mytr.hr.xz() << ", " << mytr.hr.yz() << ", " << mytr.hr.zz();
137 #endif
138  return mytr;
139 }
140 
141 void HGCalParameters::addTrForm(const CLHEP::Hep3Vector& h3v) {
142  unsigned int k = trformTranX_.size();
143  if (k > 0) {
144  trformTranX_[k - 1] += h3v.x();
145  trformTranY_[k - 1] += h3v.y();
146  trformTranZ_[k - 1] += h3v.z();
147  }
148 }
149 
151  unsigned int k = trformTranX_.size();
152  if (k > 0) {
153  trformTranX_[k - 1] *= scale;
154  trformTranY_[k - 1] *= scale;
155  trformTranZ_[k - 1] *= scale;
156  }
157 }
158 
159 std::array<int, 4> HGCalParameters::getID(unsigned int k) const {
160  int zp = ((trformIndex_[k] >> kShiftZside) & kMaskZside);
161  if (zp != 1)
162  zp = -1;
163  int lay = ((trformIndex_[k] >> kShiftLayer) & kMaskLayer);
164  int sec = ((trformIndex_[k] >> kShiftSector) & kMaskSector);
165  int subsec = ((trformIndex_[k] >> kShiftSubSec) & kMaskSubSec);
166  return std::array<int, 4>{{zp, lay, sec, subsec}};
167 }
168 
170 
HGCalParameters::trformRotXX_
std::vector< double > trformRotXX_
Definition: HGCalParameters.h:88
HGCalParameters::hgtrap::bl
float bl
Definition: HGCalParameters.h:43
HGCalParameters::tol
static constexpr double tol
Definition: HGCalParameters.h:39
HGCalParameters::kMaskZside
const int kMaskZside
Definition: HGCalParameters.h:183
HGCalParameters::scaleTrForm
void scaleTrForm(double)
Definition: HGCalParameters.cc:150
HGCalParameters::kMaskLayer
const int kMaskLayer
Definition: HGCalParameters.h:184
HGCalParameters::trformRotYY_
std::vector< double > trformRotYY_
Definition: HGCalParameters.h:92
HGCalParameters::kShiftSubSec
const int kShiftSubSec
Definition: HGCalParameters.h:190
HGCalParameters::moduleCellS_
std::vector< double > moduleCellS_
Definition: HGCalParameters.h:76
MessageLogger.h
HGCalParameters::kMaskSubSec
const int kMaskSubSec
Definition: HGCalParameters.h:186
L1EGammaCrystalsEmulatorProducer_cfi.scale
scale
Definition: L1EGammaCrystalsEmulatorProducer_cfi.py:10
HGCalParameters::name_
std::string name_
Definition: HGCalParameters.h:65
HGCalParameters::moduleTlR_
std::vector< double > moduleTlR_
Definition: HGCalParameters.h:79
HGCalParameters::moduleBlS_
std::vector< double > moduleBlS_
Definition: HGCalParameters.h:71
HGCalParameters::moduleHS_
std::vector< double > moduleHS_
Definition: HGCalParameters.h:73
HGCalParameters::moduleCellR_
std::vector< double > moduleCellR_
Definition: HGCalParameters.h:83
HGCalParameters::getModule
hgtrap getModule(unsigned int k, bool reco) const
Definition: HGCalParameters.cc:35
HGCalParameters::hgtrform::subsec
int subsec
Definition: HGCalParameters.h:47
HGCalParameters::trformRotYX_
std::vector< double > trformRotYX_
Definition: HGCalParameters.h:89
HGCalParameters::hgtrap::cellSize
float cellSize
Definition: HGCalParameters.h:43
typelookup.h
HGCalParameters::hgtrap::alpha
float alpha
Definition: HGCalParameters.h:43
HGCalParameters::hgtrap::dz
float dz
Definition: HGCalParameters.h:43
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
HGCalParameters::moduleLayR_
std::vector< int > moduleLayR_
Definition: HGCalParameters.h:77
HGCalParameters::hgtrform::zp
int zp
Definition: HGCalParameters.h:47
HGCalParameters::~HGCalParameters
~HGCalParameters(void)
Definition: HGCalParameters.cc:13
HGCalParameters::moduleBlR_
std::vector< double > moduleBlR_
Definition: HGCalParameters.h:78
HGCalParameters::fillModule
void fillModule(const hgtrap &mytr, bool reco)
Definition: HGCalParameters.cc:15
HGCalParameters::moduleTlS_
std::vector< double > moduleTlS_
Definition: HGCalParameters.h:72
HGCalParameters::trformRotZY_
std::vector< double > trformRotZY_
Definition: HGCalParameters.h:93
HGCalParameters::trformTranX_
std::vector< double > trformTranX_
Definition: HGCalParameters.h:85
HGCalParameters::moduleDzR_
std::vector< double > moduleDzR_
Definition: HGCalParameters.h:81
HGCalParameters::kMaskSector
const int kMaskSector
Definition: HGCalParameters.h:185
HGCalParameters::hgtrform::h3v
CLHEP::Hep3Vector h3v
Definition: HGCalParameters.h:48
HGCalParameters::trformIndex_
std::vector< uint32_t > trformIndex_
Definition: HGCalParameters.h:84
HGCalParameters::hgtrap::tl
float tl
Definition: HGCalParameters.h:43
HGCalWaferIndex.h
HGCalParameters::getTrForm
hgtrform getTrForm(unsigned int k) const
Definition: HGCalParameters.cc:108
dqmdumpme.k
k
Definition: dqmdumpme.py:60
HGCalParameters::getID
std::array< int, 4 > getID(unsigned int k) const
Definition: HGCalParameters.cc:159
HGCalParameters::trformRotZX_
std::vector< double > trformRotZX_
Definition: HGCalParameters.h:90
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HGCalParameters::trformRotXZ_
std::vector< double > trformRotXZ_
Definition: HGCalParameters.h:94
HGCalParameters::moduleAlphaS_
std::vector< double > moduleAlphaS_
Definition: HGCalParameters.h:75
idealTransformation.rotation
dictionary rotation
Definition: idealTransformation.py:1
HGCalParameters::hgtrform::sec
int sec
Definition: HGCalParameters.h:47
HGCalParameters::trformTranZ_
std::vector< double > trformTranZ_
Definition: HGCalParameters.h:87
HGCalParameters::fillTrForm
void fillTrForm(const hgtrform &mytr)
Definition: HGCalParameters.cc:67
HGCalParameters::hgtrap::h
float h
Definition: HGCalParameters.h:43
HGCalParameters::trformRotXY_
std::vector< double > trformRotXY_
Definition: HGCalParameters.h:91
TYPELOOKUP_DATA_REG
#define TYPELOOKUP_DATA_REG(_dataclass_)
Definition: typelookup.h:102
HGCalParameters::hgtrform::lay
int lay
Definition: HGCalParameters.h:47
HGCalParameters::kShiftSector
const int kShiftSector
Definition: HGCalParameters.h:189
fileinputsource_cfi.sec
sec
Definition: fileinputsource_cfi.py:87
HGCalParameters::trformTranY_
std::vector< double > trformTranY_
Definition: HGCalParameters.h:86
HGCalParameters
Definition: HGCalParameters.h:13
HGCalParameters::moduleLayS_
std::vector< int > moduleLayS_
Definition: HGCalParameters.h:70
HGCalParameters::addTrForm
void addTrForm(const CLHEP::Hep3Vector &h3v)
Definition: HGCalParameters.cc:141
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
HGCalParameters::moduleDzS_
std::vector< double > moduleDzS_
Definition: HGCalParameters.h:74
HGCalParameters::kShiftLayer
const int kShiftLayer
Definition: HGCalParameters.h:188
HGCalParameters::HGCalParameters
HGCalParameters(const std::string &nam)
Definition: HGCalParameters.cc:7
HGCalParameters::hgtrform
Definition: HGCalParameters.h:46
HGCalParameters::kShiftZside
const int kShiftZside
Definition: HGCalParameters.h:187
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
HGCalParameters::moduleHR_
std::vector< double > moduleHR_
Definition: HGCalParameters.h:80
HGCalParameters::trformRotYZ_
std::vector< double > trformRotYZ_
Definition: HGCalParameters.h:95
HGCalParameters::hgtrap
Definition: HGCalParameters.h:41
HGCalParameters::hgtrform::hr
CLHEP::HepRotation hr
Definition: HGCalParameters.h:49
HGCalParameters::trformRotZZ_
std::vector< double > trformRotZZ_
Definition: HGCalParameters.h:96
HGCalParameters.h
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
HGCalParameters::moduleAlphaR_
std::vector< double > moduleAlphaR_
Definition: HGCalParameters.h:82
HGCalParameters::hgtrap::lay
int lay
Definition: HGCalParameters.h:42