CMS 3D CMS Logo

LASGlobalData.h
Go to the documentation of this file.
1 
2 #ifndef __LASGLOBALDATA_H
3 #define __LASGLOBALDATA_H
4 
5 #include <vector>
6 #include <iostream>
7 #include "TNamed.h"
8 
29 
30 template <class T>
31 class LASGlobalData : public TNamed {
32 public:
33  // enums not in use so far...
35  enum TecRing { RING4, RING6 };
39  LASGlobalData();
40  LASGlobalData(const T&);
41  T& GetTECEntry(int subdetector, int tecRing, int beam, int tecDisk);
42  T& GetTIBTOBEntry(int subdetector, int beam, int tibTobPosition);
43  T& GetTEC2TECEntry(int subdetector, int beam, int tecDisk);
44  void SetTECEntry(int subdetector, int tecRing, int beam, int tecDisk, T);
45  void SetTIBTOBEntry(int subdetector, int beam, int tibTobPosition, T);
46  void SetTEC2TECEntry(int subdetector, int beam, int tecDisk, T);
47  // LASGlobalData<T>& operator=( LASGlobalData<T>& );
48 
49 private:
50  //void Init( void );
51  void Init(const T& in = T());
52  std::vector<std::vector<std::vector<T> > > tecPlusData; // ring<beam<disk<T>>>
53  std::vector<std::vector<std::vector<T> > > tecMinusData; // ring<beam<disk<T>>>
54  std::vector<std::vector<T> > tecPlusATData; // beam<disk<T>>
55  std::vector<std::vector<T> > tecMinusATData; // beam<disk<T>>
56  std::vector<std::vector<T> > tibData; // beam<pos<T>>
57  std::vector<std::vector<T> > tobData; // beam<pos<T>>
58 
60 };
61 
62 // since this is a template
63 //#include "Alignment/LaserAlignment/src/LASGlobalData.cc"
64 
65 template <class T>
70 
71  Init();
72 }
73 
74 template <class T>
76  Init(in);
77 }
78 
83 template <class T>
84 T& LASGlobalData<T>::GetTECEntry(int theDetector, int theRing, int theBeam, int theDisk) {
85  // do a range check first
86  if (!((theDetector == 0 || theDetector == 1) && // TEC+ or TEC-
87  (theRing == 0 || theRing == 1) && // ring4 or ring6
88  (theBeam >= 0 && theBeam < 8) && // eight beams in a TEC
89  (theDisk >= 0 && theDisk < 9))) { // disk1..disk9
90  std::cerr << " [LASGlobalData::GetTECEntry] ** ERROR: illegal input coordinates:" << std::endl;
91  std::cerr << " detector " << theDetector << ", ring " << theRing << ", beam " << theBeam << ", disk " << theDisk
92  << "." << std::endl;
93  throw " Bailing out."; // @@@ REPLACE THIS BY cms::Exception (<FWCore/Utilities/interface/Exception.h> in 1_3_6)
94  } else {
95  if (theDetector == 0)
96  return (tecPlusData.at(theRing).at(theBeam).at(theDisk));
97  else
98  return (tecMinusData.at(theRing).at(theBeam).at(theDisk));
99  }
100 }
101 
106 template <class T>
107 T& LASGlobalData<T>::GetTIBTOBEntry(int theDetector, int theBeam, int thePosition) {
108  // do a range check first
109  if (!((theDetector == 2 || theDetector == 3) && // TIB or TOB
110  (theBeam >= 0 && theBeam < 8) && // there are eight AT beams
111  (thePosition >= 0 && thePosition < 6))) { // z-pos -3 .. z-pos +3
112  std::cerr << " [LASGlobalData::GetTIBTOBEntry] ** ERROR: illegal coordinates:" << std::endl;
113  std::cerr << " detector " << theDetector << ", beam " << theBeam << ", position " << thePosition << "."
114  << std::endl;
115  throw " Bailing out."; // @@@ REPLACE THIS BY cms::Exception (<FWCore/Utilities/interface/Exception.h> in 1_3_6)
116  } else {
117  if (theDetector == 2)
118  return (tibData.at(theBeam).at(thePosition));
119  else
120  return (tobData.at(theBeam).at(thePosition));
121  }
122 }
123 
128 template <class T>
129 T& LASGlobalData<T>::GetTEC2TECEntry(int theDetector, int theBeam, int theDisk) {
130  // do a range check first
131  if (!((theDetector == 0 || theDetector == 1) && // TEC+ or TEC-
132  (theBeam >= 0 && theBeam < 8) && // eight AT beams in a TEC
133  (theDisk >= 0 && theDisk < 6))) { // disk1...disk5 are hit by AT
134  std::cerr << " [LASGlobalData::GetTEC2TECEntry] ** ERROR: illegal coordinates:" << std::endl;
135  std::cerr << " detector " << theDetector << ", beam " << theBeam << ", disk " << theDisk << "." << std::endl;
136  throw " Bailing out."; // @@@ REPLACE THIS BY cms::Exception (<FWCore/Utilities/interface/Exception.h> in 1_3_6)
137  } else {
138  if (theDetector == 0)
139  return (tecPlusATData.at(theBeam).at(theDisk));
140  else
141  return (tecMinusATData.at(theBeam).at(theDisk));
142  }
143 }
144 
149 template <class T>
150 void LASGlobalData<T>::SetTECEntry(int theDetector, int theRing, int theBeam, int theDisk, T theEntry) {
151  // do a range check first
152  if (!((theDetector == 0 || theDetector == 1) && // TEC+ or TEC-
153  (theRing == 0 || theRing == 1) && // ring4 or ring6
154  (theBeam >= 0 && theBeam < 8) && // eight beams in a TEC
155  (theDisk >= 0 && theDisk < 9))) { // disk1..disk9
156  std::cerr << " [LASGlobalData::SetTECEntry] ** ERROR: illegal coordinates:" << std::endl;
157  std::cerr << " detector " << theDetector << ", ring " << theRing << ", beam " << theBeam << ", disk " << theDisk
158  << "." << std::endl;
159  throw " Bailing out."; // @@@ REPLACE THIS BY cms::Exception (<FWCore/Utilities/interface/Exception.h> in 1_3_6)
160  } else {
161  if (theDetector == 0)
162  tecPlusData.at(theRing).at(theBeam).at(theDisk) = theEntry;
163  else
164  tecMinusData.at(theRing).at(theBeam).at(theDisk) = theEntry;
165  }
166 }
167 
172 template <class T>
173 void LASGlobalData<T>::SetTIBTOBEntry(int theDetector, int theBeam, int thePosition, T theEntry) {
174  // do a range check first
175  if (!((theDetector == 2 || theDetector == 3) && // TIB or TOB
176  (theBeam >= 0 && theBeam < 8) && // there are eight AT beams
177  (thePosition >= 0 && thePosition < 6))) { // pos-3..pos+3
178  std::cerr << " [LASGlobalData::SetTIBTOBEntry] ** ERROR: illegal coordinates:" << std::endl;
179  std::cerr << " detector " << theDetector << ", beam " << theBeam << ", position " << thePosition << "."
180  << std::endl;
181  throw " Bailing out."; // @@@ REPLACE THIS BY cms::Exception (<FWCore/Utilities/interface/Exception.h> in 1_3_6)
182  } else {
183  if (theDetector == 2)
184  tibData.at(theBeam).at(thePosition) = theEntry;
185  else
186  tobData.at(theBeam).at(thePosition) = theEntry;
187  }
188 }
189 
194 template <class T>
195 void LASGlobalData<T>::SetTEC2TECEntry(int theDetector, int theBeam, int theDisk, T theEntry) {
196  // do a range check first
197  if (!((theDetector == 0 || theDetector == 1) && // TEC+ or TEC-
198  (theBeam >= 0 && theBeam < 8) && // eight beams in a TEC
199  (theDisk >= 0 && theDisk < 6))) { // disk1..disk5 for TEC AT
200  std::cerr << " [LASGlobalData::SetTEC2TECEntry] ** ERROR: illegal coordinates:" << std::endl;
201  std::cerr << " detector " << theDetector << ", beam " << theBeam << ", disk " << theDisk << "." << std::endl;
202  throw " Bailing out."; // @@@ REPLACE THIS BY cms::Exception (<FWCore/Utilities/interface/Exception.h> in 1_3_6)
203  } else {
204  if (theDetector == 0)
205  tecPlusATData.at(theBeam).at(theDisk) = theEntry;
206  else
207  tecMinusATData.at(theBeam).at(theDisk) = theEntry;
208  }
209 }
210 
211 // ///
212 // /// element wise assignment operator
213 // ///
214 // template <class T>
215 // LASGlobalData<T>& LASGlobalData<T>::operator=( LASGlobalData<T>& anotherGlobalData ) {
216 
217 // // TEC copy
218 // for( int det = 0; det < 2; ++det ) {
219 // for( int ring = 0; ring < 2; ++ring ) {
220 // for( int beam = 0; beam < 8; ++ beam ) {
221 // for( int disk = 0; disk < 9; ++ disk ) {
222 // this->SetTECEntry( det, ring, beam, disk, anotherGlobalData.GetTECEntry( det, ring, beam, disk ) );
223 // }
224 // }
225 // }
226 // }
227 
228 // // TIBTOB copy
229 // for( int det = 2; det < 4; ++det ) {
230 // for( int beam = 0; beam < 8; ++ beam ) {
231 // for( int pos = 0; pos < 6; ++ pos ) {
232 // this->SetTIBTOBEntry( det, beam, pos, anotherGlobalData.GetTIBTOBEntry( det, beam, pos ) );
233 // }
234 // }
235 // }
236 
237 // // TEC2TEC copy
238 // for( int det = 2; det < 4; ++det ) {
239 // for( int beam = 0; beam < 8; ++ beam ) {
240 // for( int disk = 0; disk < 9; ++ disk ) {
241 // this->SetTEC2TECEntry( det, beam, disk, anotherGlobalData.GetTEC2TECEntry( det, beam, disk ) );
242 // }
243 // }
244 // }
245 
246 // }
247 
248 template <class T>
250  // create TEC+ subdetector "multi"-vector of T
251  tecPlusData.resize(2); // create ring4 and ring6
252  for (unsigned int ring = 0; ring < tecPlusData.size(); ++ring) {
253  tecPlusData.at(ring).resize(8); // create 8 beams for each ring
254  for (unsigned int beam = 0; beam < tecPlusData.at(ring).size(); ++beam) {
255  tecPlusData.at(ring).at(beam).resize(9, in); // create 9 disks for each beam
256  }
257  }
258 
259  // same for TEC-
260  tecMinusData.resize(2); // create ring4 and ring6
261  for (unsigned int ring = 0; ring < tecMinusData.size(); ++ring) {
262  tecMinusData.at(ring).resize(8); // create 8 beams for each ring
263  for (unsigned int beam = 0; beam < tecMinusData.at(ring).size(); ++beam) {
264  tecMinusData.at(ring).at(beam).resize(9, in); // create 9 disks for each beam
265  }
266  }
267 
268  // same for TEC+ AT
269  tecPlusATData.resize(8); // create 8 beams
270  for (unsigned int beam = 0; beam < tecPlusATData.size(); ++beam) {
271  tecPlusATData.at(beam).resize(5, in); // five TEC disks hit by each AT beam
272  }
273 
274  // same for TEC- AT
275  tecMinusATData.resize(8); // create 8 beams
276  for (unsigned int beam = 0; beam < tecMinusATData.size(); ++beam) {
277  tecMinusATData.at(beam).resize(5, in); // five TEC disks hit by each AT beam
278  }
279 
280  // same for TIB..
281  tibData.resize(8); // create 8 beams
282  for (unsigned int beam = 0; beam < tibData.size(); ++beam) {
283  tibData.at(beam).resize(6, in); // six TIB modules hit by each beam
284  }
285 
286  // ..and for TOB
287  tobData.resize(8); // create 8 beams
288  for (unsigned int beam = 0; beam < tobData.size(); ++beam) {
289  tobData.at(beam).resize(6, in); // six TOB modules hit by each beam
290  }
291 }
292 
293 #endif
LASGlobalData::SetTECEntry
void SetTECEntry(int subdetector, int tecRing, int beam, int tecDisk, T)
Definition: LASGlobalData.h:150
LASGlobalData::DISK1
Definition: LASGlobalData.h:37
LASGlobalData::PLUS3
Definition: LASGlobalData.h:38
LASGlobalData::RING6
Definition: LASGlobalData.h:35
LASGlobalData::tecMinusData
std::vector< std::vector< std::vector< T > > > tecMinusData
Definition: LASGlobalData.h:53
LASGlobalData::RING4
Definition: LASGlobalData.h:35
LASGlobalData::DISK5
Definition: LASGlobalData.h:37
LASGlobalData::tecMinusATData
std::vector< std::vector< T > > tecMinusATData
Definition: LASGlobalData.h:55
LASGlobalData::Init
void Init(const T &in=T())
Definition: LASGlobalData.h:249
LASGlobalData::BEAM4
Definition: LASGlobalData.h:36
LASGlobalData< LASModuleProfile >::TecRing
TecRing
Definition: LASGlobalData.h:35
LASGlobalData
Definition: LASGlobalData.h:31
LASGlobalData< LASModuleProfile >::TecDisk
TecDisk
Definition: LASGlobalData.h:37
LASGlobalData::tecPlusData
std::vector< std::vector< std::vector< T > > > tecPlusData
Definition: LASGlobalData.h:52
LASGlobalData::MINUS1
Definition: LASGlobalData.h:38
LASGlobalData::DISK3
Definition: LASGlobalData.h:37
LASGlobalData::TOB
Definition: LASGlobalData.h:34
LASGlobalData::DISK7
Definition: LASGlobalData.h:37
LASGlobalData::MINUS3
Definition: LASGlobalData.h:38
LASGlobalData::MINUS2
Definition: LASGlobalData.h:38
LASGlobalData::GetTECEntry
T & GetTECEntry(int subdetector, int tecRing, int beam, int tecDisk)
Definition: LASGlobalData.h:84
EcalCondDBWriter_cfi.beam
beam
Definition: EcalCondDBWriter_cfi.py:45
LASGlobalData::LASGlobalData
LASGlobalData()
Definition: LASGlobalData.h:66
LASGlobalData::TECMINUS
Definition: LASGlobalData.h:34
LASGlobalData::BEAM2
Definition: LASGlobalData.h:36
LASGlobalData::BEAM1
Definition: LASGlobalData.h:36
LASGlobalData::DISK8
Definition: LASGlobalData.h:37
recoMuon::in
Definition: RecoMuonEnumerators.h:6
LASGlobalData< LASModuleProfile >::Beam
Beam
Definition: LASGlobalData.h:36
LASGlobalData::GetTIBTOBEntry
T & GetTIBTOBEntry(int subdetector, int beam, int tibTobPosition)
Definition: LASGlobalData.h:107
LASGlobalData::PLUS2
Definition: LASGlobalData.h:38
LASGlobalData< LASModuleProfile >::TibTobPosition
TibTobPosition
Definition: LASGlobalData.h:38
LASGlobalData::BEAM7
Definition: LASGlobalData.h:36
LASGlobalData< LASModuleProfile >::Subdetector
Subdetector
Definition: LASGlobalData.h:34
LASGlobalData::PLUS1
Definition: LASGlobalData.h:38
LASGlobalData::DISK6
Definition: LASGlobalData.h:37
LASGlobalData::DISK4
Definition: LASGlobalData.h:37
LASGlobalData::SetTEC2TECEntry
void SetTEC2TECEntry(int subdetector, int beam, int tecDisk, T)
Definition: LASGlobalData.h:195
LASGlobalData::GetTEC2TECEntry
T & GetTEC2TECEntry(int subdetector, int beam, int tecDisk)
Definition: LASGlobalData.h:129
LASGlobalData::DISK2
Definition: LASGlobalData.h:37
T
long double T
Definition: Basic3DVectorLD.h:48
relativeConstraints.ring
ring
Definition: relativeConstraints.py:68
LASGlobalData::SetTIBTOBEntry
void SetTIBTOBEntry(int subdetector, int beam, int tibTobPosition, T)
Definition: LASGlobalData.h:173
LASGlobalData::BEAM3
Definition: LASGlobalData.h:36
LASGlobalData::tobData
std::vector< std::vector< T > > tobData
Definition: LASGlobalData.h:57
EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.cerr
cerr
Definition: EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.py:8
LASGlobalData::BEAM6
Definition: LASGlobalData.h:36
LASGlobalData::TECPLUS
Definition: LASGlobalData.h:34
LASGlobalData::DISK9
Definition: LASGlobalData.h:37
LASGlobalData::ClassDef
ClassDef(LASGlobalData, 2)
LASGlobalData::tibData
std::vector< std::vector< T > > tibData
Definition: LASGlobalData.h:56
LASGlobalData::tecPlusATData
std::vector< std::vector< T > > tecPlusATData
Definition: LASGlobalData.h:54
LASGlobalData::TIB
Definition: LASGlobalData.h:34
LASGlobalData::BEAM5
Definition: LASGlobalData.h:36
LASGlobalData::BEAM0
Definition: LASGlobalData.h:36
subdetector
TString subdetector
Definition: trackSplitPlot.h:54