CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EcalSelectiveReadout.h
Go to the documentation of this file.
1 //emacs settings:-*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil -*-"
2 /*
3  * $Id: EcalSelectiveReadout.h,v 1.9 2009/10/26 10:41:26 pgras Exp $
4  */
5 
6 #ifndef ECALSELECTIVEREADOUT_H
7 #define ECALSELECTIVEREADOUT_H
8 
9 #include <vector>
10 #include <iosfwd>
17 
18 #define ECALSELECTIVEREADOUT_NOGEOM //version w/o geometry dependency.
19 
20 #ifndef ECALSELECTIVEREADOUT_NOGEOM
22 #endif //ECALSELECTIVEREADOUT_NOGEOM not defined
23 
24 
25 
66 public:
67  static const int FORCED_MASK = 0x4;
68 
69  //type definitions
72  typedef enum {UNKNOWN = -1 & ~FORCED_MASK,
73  LOWINTEREST = 0x0,
74  SINGLE = 0x1,
75  NEIGHBOUR = 0x2,
76  CENTER = 0x3,
77  FORCED_LOWINTEREST = 0x4, //0x0 | 0x4
78  FORCED_SINGLE = 0x5, //0x1 | 0x4
79  FORCED_NEIGHBOUR = 0x6, //0x2 | 0x4
80  FORCED_CENTER = 0x7 //0x3 | 0x4
82 
83  typedef enum {
87  /* 0x2 not used */
89  TTF_FORCED_LOW_INTEREST = 0x4, //0x0 | 0x4
90  TTF_FORCED_MID_INTEREST = 0x5, //0x1 | 0x4
91  /* 0x6 not used*/
92  TTF_FORCED_HIGH_INTEREST = 0x7 //0x3 | 0x4
93 // TTF_FORCED_RO_LINK_SYNC_ERR = 0x4,
94 // TTF_FORCED_RO_HAMMING_ERR = 0X5,
95 // TTF_FORCED_RO_OTHER1 = 0X6,
96 // TTF_FORCED_RO_OTHER2 = 0X7
97  } ttFlag_t;
98 
99  //deprecated. Use instead FORCED_MASK
100  static const int TTF_FORCED_RO_MASK = FORCED_MASK;
101 
102 
103  //constants
104 public:
107  const static size_t nBarrelEtaBins = 170;
110  const static size_t nBarrelPhiBins = 360;
113  const static size_t nEndcapXBins = 100;
116  const static size_t nEndcapYBins = 100;
119  const static size_t supercrystalEdge = 5;
128  const static size_t nBarrelTowerEtaBins = nBarrelEtaBins/5;
131  const static size_t nBarrelTowerPhiBins = nBarrelPhiBins/5;
134  const static size_t nEndcaps = 2;
137  const static size_t nEndcapTriggerTowersInEta = 11;
140  const static size_t nBarrelTriggerTowersInEta = 34;
143  const static size_t nTriggerTowersInEta =
147  const static size_t nTriggerTowersInPhi = 72;
148 
152  const static int maxDccChs = 68;
153 
156  const static int nDccPerEe = 9;
157 
158  //constructor(s) and destructor(s)
159 public:
168  EcalSelectiveReadout(int dEta = 1, int dPhi = 1);
169 
170  //method(s)
171 
174  theTriggerMap = map;
175  }
176 
180  theElecMap = map;
181  }
182 
183 
184 #ifndef ECALSELECTIVEREADOUT_NOGEOM
185  void setGeometry(const CaloGeometry * caloGeometry) {
186  theGeometry = caloGeometry;
187  }
188 #endif //ECALSELECTIVEREADOUT_NOGEOM not defined
189 
217  void runSelectiveReadout0(const ttFlag_t
219 
224  towerInterest_t getCrystalInterest(const EBDetId & ebDetId) const;
225 
230  towerInterest_t getCrystalInterest(const EEDetId & eeDetId) const;
231 
237 
244 
246  void printHeader(std::ostream & os) const;
247 
249  void print(std::ostream & os) const;
250 
251  void printBarrel(std::ostream & os) const;
252  void printEndcap(int endcap, std::ostream & s) const;
253 
254 private:
255 
262 
269 
276  void
278 
281  void resetEeRuInterest();
282 
289  void setLower(int& var, int val) const{
290  if(val<var) var = val;
291  }
292 
299  template<class T>
300  void setHigher(T& var, T val) const{
301  if(val>var) var = val;
302  }
303 
310  template<class T>
311  void combineFlags(T& var, T val) const{
312  var = (T)(std::max(val & ~TTF_FORCED_RO_MASK, //actual flag value:
313  // take highest
314  var & ~TTF_FORCED_RO_MASK) //beware: must work also
315  // for UNKNOW=-1
316  // ->compare the whole
317  // integer but with
318  // the forced bit masked.
319  | ((val | var) & 0x4));//forced bit: set it if any of the two is
320  // already set
321 
322 
323  if(var < 0 || var > 7){
324  std::cout << __FILE__ << ":" << __LINE__ << ": ---------->"
325  << var << " " << val << " "
326  << std::max(val & 0x3, var & 0x3) << " "
327  << (val | var) << " "
328  << ((val | var) & 0x4) << " "
329  << (std::max(val & 0x3, var & 0x3)
330  | ((val | var) & 0x4)) << " "
331  << (T)(std::max(val & 0x3, var & 0x3)
332  | ((val | var) & 0x4)) << "\n";
333  }
334  }
335 
336 
337 // /** Propagate TTF flag bit on towerInterest. TT interest forced bit is set
338 // * if TTF forced bit is set, otherwise it is not touched.
339 // * @param ttFlags TT flags
340 // */
341 // void propagateTtForcedBit(const ttFlag_t ttFlags[nTriggerTowersInEta][nTriggerTowersInPhi]);
342 
343  void printDccChMap(std::ostream& os) const;
344 
345  //attribute(s)
346 private:
347 
350 
351 #ifndef ECALSELECTIVEREADOUT_NOGEOM
352  const CaloGeometry * theGeometry;
353 #endif //ECALSELECTIVEREADOUT_NOGEOM not defined
355  //towerInterest_t supercrystalInterest[nEndcaps][nSupercrystalXBins][nSupercrystalYBins];
357  int dEta;
358  int dPhi;
359 
360  // for printout
361  const static char srpFlagMarker[];
362 
363 };
364 
365 std::ostream & operator<<(std::ostream & os, const EcalSelectiveReadout & selectiveReadout);
366 
367 #endif
static const int FORCED_MASK
static const size_t nEndcapXBins
towerInterest_t getSuperCrystalInterest(const EcalScDetId &scDetId) const
void setTriggerMap(const EcalTrigTowerConstituentsMap *map)
the mapping of which cell goes with which trigger tower
static const size_t nSupercrystalXBins
void printHeader(std::ostream &os) const
print out header for the map: see print(std::ostream&amp;)
static const int TTF_FORCED_RO_MASK
towerInterest_t getTowerInterest(const EcalTrigTowerDetId &towerId) const
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
static const size_t nEndcaps
void setHigher(T &var, T val) const
static const int nDccPerEe
static const size_t nBarrelPhiBins
void printEndcap(int endcap, std::ostream &s) const
void classifyTriggerTowers(const ttFlag_t ttFlags[nTriggerTowersInEta][nTriggerTowersInPhi])
dictionary map
Definition: Association.py:196
towerInterest_t & eeRuInterest(const EEDetId &id)
static const size_t nEndcapYBins
static const size_t nSupercrystalYBins
unsigned towerId(const DetId &)
static const size_t nBarrelTowerPhiBins
EcalSelectiveReadout(int dEta=1, int dPhi=1)
const T & max(const T &a, const T &b)
static const size_t supercrystalEdge
static const int maxDccChs
void combineFlags(T &var, T val) const
void printBarrel(std::ostream &os) const
void setLower(int &var, int val) const
static const size_t nEndcapTriggerTowersInEta
const EcalElectronicsMapping * theElecMap
towerInterest_t eeRuInterest_[nEndcaps][nDccPerEe][maxDccChs]
const EcalTrigTowerConstituentsMap * theTriggerMap
void print(std::ostream &os) const
print out the map
static const size_t nTriggerTowersInEta
static const size_t nTriggerTowersInPhi
static const char srpFlagMarker[]
void runSelectiveReadout0(const ttFlag_t towerFlags[nTriggerTowersInEta][nTriggerTowersInPhi])
towerInterest_t towerInterest[nTriggerTowersInEta][nTriggerTowersInPhi]
static const size_t nBarrelTriggerTowersInEta
tuple cout
Definition: gather_cfg.py:121
static const size_t nBarrelEtaBins
static const size_t nBarrelTowerEtaBins
long double T
towerInterest_t getCrystalInterest(const EBDetId &ebDetId) const
void setElecMap(const EcalElectronicsMapping *map)
void printDccChMap(std::ostream &os) const