test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HGCalParameters.cc
Go to the documentation of this file.
2 //#define DebugLog
3 
4 HGCalParameters::HGCalParameters(const std::string& nam): name_(nam) { }
5 
7 
9  bool reco) {
10 
11  if (reco) {
12  moduleLayR_.push_back(mytr.lay);
13  moduleBlR_.push_back(mytr.bl);
14  moduleTlR_.push_back(mytr.tl);
15  moduleHR_.push_back(mytr.h);
16  moduleDzR_.push_back(mytr.dz);
17  moduleAlphaR_.push_back(mytr.alpha);
18  moduleCellR_.push_back(mytr.cellSize);
19  } else {
20  moduleLayS_.push_back(mytr.lay);
21  moduleBlS_.push_back(mytr.bl);
22  moduleTlS_.push_back(mytr.tl);
23  moduleHS_.push_back(mytr.h);
24  moduleDzS_.push_back(mytr.dz);
25  moduleAlphaS_.push_back(mytr.alpha);
26  moduleCellS_.push_back(mytr.cellSize);
27  }
28 }
29 
31  bool reco) const {
33  if (reco) {
34  if (k < moduleLayR_.size()) {
35  mytr.lay = moduleLayR_[k];
36  mytr.bl = moduleBlR_[k];
37  mytr.tl = moduleTlR_[k];
38  mytr.h = moduleHR_[k];
39  mytr.dz = moduleDzR_[k];
40  mytr.alpha = moduleAlphaR_[k];
41  mytr.cellSize = moduleCellR_[k];
42  } else {
43  mytr.lay = -1;
44  mytr.bl = mytr.tl = mytr.h = mytr.dz = mytr.alpha = mytr.cellSize = 0;
45  }
46  } else {
47  if (k < moduleLayS_.size()) {
48  mytr.lay = moduleLayS_[k];
49  mytr.bl = moduleBlS_[k];
50  mytr.tl = moduleTlS_[k];
51  mytr.h = moduleHS_[k];
52  mytr.dz = moduleDzS_[k];
53  mytr.alpha = moduleAlphaS_[k];
54  mytr.cellSize = moduleCellS_[k];
55  } else {
56  mytr.lay = -1;
57  mytr.bl = mytr.tl = mytr.h = mytr.dz = mytr.alpha = mytr.cellSize = 0;
58  }
59  }
60  return mytr;
61 }
62 
64 
65  int zp = (mytr.zp == 1) ? 1 : 0;
66  uint32_t indx = ((zp & kMaskZside) << kShiftZside);
67  indx |= ((mytr.lay & kMaskLayer) << kShiftLayer);
68  indx |= ((mytr.sec & kMaskSector) << kShiftSector);
69  indx |= ((mytr.subsec & kMaskSubSec) << kShiftSubSec);
70 // std::cout << "ZP " << zp << ":" << kMaskZside << ":" << kShiftZside << ((zp & kMaskZside) << kShiftZside) << " Lay " << mytr.lay << ":" << kMaskLayer << ":" << kShiftLayer << ":" << ((mytr.lay & kMaskLayer) << kShiftLayer) << " Sector " << mytr.sec << ":" << kMaskSector << ":" << kShiftSector << ":" << ((mytr.sec & kMaskSector) << kShiftSector) << " SubSec " << mytr.subsec << ":" << kMaskSubSec << ":" << kShiftSubSec << ":" << ((mytr.subsec & kMaskSubSec) << kShiftSubSec) << " Index " << std::hex << indx << std::dec << std::endl;
71 
72  trformIndex_.push_back(indx);
73  trformTranX_.push_back(mytr.h3v.x());
74  trformTranY_.push_back(mytr.h3v.y());
75  trformTranZ_.push_back(mytr.h3v.z());
76  trformRotXX_.push_back(mytr.hr.xx());
77  trformRotYX_.push_back(mytr.hr.yx());
78  trformRotZX_.push_back(mytr.hr.zx());
79  trformRotXY_.push_back(mytr.hr.xy());
80  trformRotYY_.push_back(mytr.hr.yy());
81  trformRotZY_.push_back(mytr.hr.zy());
82  trformRotXZ_.push_back(mytr.hr.xz());
83  trformRotYZ_.push_back(mytr.hr.yz());
84  trformRotZZ_.push_back(mytr.hr.zz());
85 #ifdef DebugLog
86  unsigned int k = trformIndex_.size() - 1;
87  std::cout << "HGCalParameters[" << k << "] Index " << std::hex
88  << trformIndex_[k] << std::dec << " (" << mytr.zp << ", "<< mytr.lay
89  << ", " << mytr.sec << ", " << mytr.subsec << ") Translation ("
90  << trformTranX_[k] << ", " << trformTranY_[k] << ", "
91  << trformTranZ_[k] << ") Rotation (" << trformRotXX_[k] << ", "
92  << trformRotYX_[k] << ", " << trformRotZX_[k] << ", "
93  << trformRotXY_[k] << ", " << trformRotYY_[k] << ", "
94  << trformRotZY_[k] << ", " << trformRotXZ_[k] << ", "
95  << trformRotYZ_[k] << ", " << trformRotZZ_[k] << std::endl;
96 #endif
97 }
98 
100 
102  if (k < trformIndex_.size()) {
103  int zp = ((trformIndex_[k] >> kShiftZside) & kMaskZside);
104  mytr.zp = (zp == 1) ? 1 : -1;
105  mytr.lay = ((trformIndex_[k] >> kShiftLayer) & kMaskLayer);
106  mytr.sec = ((trformIndex_[k] >> kShiftSector) & kMaskSector);
107  mytr.subsec= ((trformIndex_[k] >> kShiftSubSec) & kMaskSubSec);
108  mytr.h3v = CLHEP::Hep3Vector(trformTranX_[k],trformTranY_[k],trformTranZ_[k]);
109  const CLHEP::HepRep3x3 rotation(trformRotXX_[k],trformRotXY_[k],trformRotXZ_[k],
112  mytr.hr = CLHEP::HepRotation(rotation);
113  } else {
114  mytr.zp = mytr.lay = mytr.sec = mytr.subsec = 0;
115  }
116 #ifdef DebugLog
117  std::cout << "HGCalParameters[" << k << "] Index " << std::hex
118  << trformIndex_[k] << std::dec << " (" << mytr.zp << ", "<< mytr.lay
119  << ", " << mytr.sec << ", " << mytr.subsec << ") Translation ("
120  << mytr.h3v.x() << ", " << mytr.h3v.y() << ", " << mytr.h3v.z()
121  << ") Rotation (" << mytr.hr.xx() << ", " << mytr.hr.yx() << ", "
122  << mytr.hr.zx() << ", " << mytr.hr.xy() << ", " << mytr.hr.yy()
123  << ", " << mytr.hr.zy() << ", " << mytr.hr.xz() << ", "
124  << mytr.hr.yz() << ", " << mytr.hr.zz() << std::endl;
125 #endif
126  return mytr;
127 }
128 
129 void HGCalParameters::addTrForm(const CLHEP::Hep3Vector& h3v) {
130 
131  unsigned int k = trformTranX_.size();
132  if (k > 0) {
133  trformTranX_[k-1] += h3v.x();
134  trformTranY_[k-1] += h3v.y();
135  trformTranZ_[k-1] += h3v.z();
136  }
137 }
138 
140  unsigned int k = trformTranX_.size();
141  if (k > 0) {
142  trformTranX_[k-1] *= scale;
143  trformTranY_[k-1] *= scale;
144  trformTranZ_[k-1] *= scale;
145  }
146 }
147 
149 
std::vector< double > moduleDzR_
std::vector< double > moduleCellR_
std::vector< double > moduleHR_
std::vector< int > moduleLayR_
static const int kMaskSubSec
std::vector< double > moduleHS_
std::vector< double > trformTranY_
static const int kMaskLayer
std::vector< double > trformRotZY_
std::vector< uint32_t > trformIndex_
std::vector< double > trformRotXX_
void fillTrForm(const hgtrform &mytr)
HGCalParameters(const std::string &nam)
std::vector< double > trformRotZX_
std::vector< double > trformRotYZ_
static const int kMaskSector
std::vector< double > moduleDzS_
std::vector< double > moduleAlphaR_
hgtrform getTrForm(unsigned int k) const
std::vector< double > trformRotXY_
std::vector< double > trformRotYX_
hgtrap getModule(unsigned int k, bool reco) const
std::vector< double > moduleBlR_
void fillModule(const hgtrap &mytr, bool reco)
std::vector< double > moduleTlS_
#define TYPELOOKUP_DATA_REG(_dataclass_)
Definition: typelookup.h:96
std::vector< double > trformTranX_
std::vector< double > trformRotXZ_
void scaleTrForm(double)
std::vector< double > moduleCellS_
std::vector< double > trformRotYY_
static const int kShiftSector
std::vector< double > trformRotZZ_
std::vector< double > moduleAlphaS_
static const int kShiftZside
std::vector< double > moduleBlS_
tuple cout
Definition: gather_cfg.py:145
std::vector< int > moduleLayS_
std::vector< double > trformTranZ_
static const int kMaskZside
CLHEP::HepRotation hr
void addTrForm(const CLHEP::Hep3Vector &h3v)
std::vector< double > moduleTlR_
static const int kShiftSubSec
static const int kShiftLayer