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  */
4 
5 #ifndef ECALSELECTIVEREADOUT_H
6 #define ECALSELECTIVEREADOUT_H
7 
8 #include <vector>
9 #include <iosfwd>
16 
17 #define ECALSELECTIVEREADOUT_NOGEOM //version w/o geometry dependency.
18 
19 #ifndef ECALSELECTIVEREADOUT_NOGEOM
21 #endif //ECALSELECTIVEREADOUT_NOGEOM not defined
22 
23 
24 
65 public:
66  static const int FORCED_MASK = 0x4;
67 
68  //type definitions
71  typedef enum {UNKNOWN = -1 & ~FORCED_MASK,
72  LOWINTEREST = 0x0,
73  SINGLE = 0x1,
74  NEIGHBOUR = 0x2,
75  CENTER = 0x3,
76  FORCED_LOWINTEREST = 0x4, //0x0 | 0x4
77  FORCED_SINGLE = 0x5, //0x1 | 0x4
78  FORCED_NEIGHBOUR = 0x6, //0x2 | 0x4
79  FORCED_CENTER = 0x7 //0x3 | 0x4
81 
82  typedef enum {
86  /* 0x2 not used */
88  TTF_FORCED_LOW_INTEREST = 0x4, //0x0 | 0x4
89  TTF_FORCED_MID_INTEREST = 0x5, //0x1 | 0x4
90  /* 0x6 not used*/
91  TTF_FORCED_HIGH_INTEREST = 0x7 //0x3 | 0x4
92 // TTF_FORCED_RO_LINK_SYNC_ERR = 0x4,
93 // TTF_FORCED_RO_HAMMING_ERR = 0X5,
94 // TTF_FORCED_RO_OTHER1 = 0X6,
95 // TTF_FORCED_RO_OTHER2 = 0X7
96  } ttFlag_t;
97 
98  //deprecated. Use instead FORCED_MASK
99  static const int TTF_FORCED_RO_MASK = FORCED_MASK;
100 
101 
102  //constants
103 public:
106  const static size_t nBarrelEtaBins = 170;
109  const static size_t nBarrelPhiBins = 360;
112  const static size_t nEndcapXBins = 100;
115  const static size_t nEndcapYBins = 100;
118  const static size_t supercrystalEdge = 5;
127  const static size_t nBarrelTowerEtaBins = nBarrelEtaBins/5;
130  const static size_t nBarrelTowerPhiBins = nBarrelPhiBins/5;
133  const static size_t nEndcaps = 2;
136  const static size_t nEndcapTriggerTowersInEta = 11;
139  const static size_t nBarrelTriggerTowersInEta = 34;
142  const static size_t nTriggerTowersInEta =
146  const static size_t nTriggerTowersInPhi = 72;
147 
151  const static int maxDccChs = 68;
152 
155  const static int nDccPerEe = 9;
156 
157  //constructor(s) and destructor(s)
158 public:
167  EcalSelectiveReadout(int dEta = 1, int dPhi = 1);
168 
169  //method(s)
170 
173  theTriggerMap = map;
174  }
175 
179  theElecMap = map;
180  }
181 
182 
183 #ifndef ECALSELECTIVEREADOUT_NOGEOM
184  void setGeometry(const CaloGeometry * caloGeometry) {
185  theGeometry = caloGeometry;
186  }
187 #endif //ECALSELECTIVEREADOUT_NOGEOM not defined
188 
216  void runSelectiveReadout0(const ttFlag_t
218 
223  towerInterest_t getCrystalInterest(const EBDetId & ebDetId) const;
224 
229  towerInterest_t getCrystalInterest(const EEDetId & eeDetId) const;
230 
236 
243 
245  void printHeader(std::ostream & os) const;
246 
248  void print(std::ostream & os) const;
249 
250  void printBarrel(std::ostream & os) const;
251  void printEndcap(int endcap, std::ostream & s) const;
252 
253 private:
254 
261 
268 
275  void
277 
280  void resetEeRuInterest();
281 
288  void setLower(int& var, int val) const{
289  if(val<var) var = val;
290  }
291 
298  template<class T>
299  void setHigher(T& var, T val) const{
300  if(val>var) var = val;
301  }
302 
309  template<class T>
310  void combineFlags(T& var, T val) const{
311  var = (T)(std::max(val & ~TTF_FORCED_RO_MASK, //actual flag value:
312  // take highest
313  var & ~TTF_FORCED_RO_MASK) //beware: must work also
314  // for UNKNOW=-1
315  // ->compare the whole
316  // integer but with
317  // the forced bit masked.
318  | ((val | var) & 0x4));//forced bit: set it if any of the two is
319  // already set
320 
321 
322  if(var < 0 || var > 7){
323  std::cout << __FILE__ << ":" << __LINE__ << ": ---------->"
324  << var << " " << val << " "
325  << std::max(val & 0x3, var & 0x3) << " "
326  << (val | var) << " "
327  << ((val | var) & 0x4) << " "
328  << (std::max(val & 0x3, var & 0x3)
329  | ((val | var) & 0x4)) << " "
330  << (T)(std::max(val & 0x3, var & 0x3)
331  | ((val | var) & 0x4)) << "\n";
332  }
333  }
334 
335 
336 // /** Propagate TTF flag bit on towerInterest. TT interest forced bit is set
337 // * if TTF forced bit is set, otherwise it is not touched.
338 // * @param ttFlags TT flags
339 // */
340 // void propagateTtForcedBit(const ttFlag_t ttFlags[nTriggerTowersInEta][nTriggerTowersInPhi]);
341 
342  void printDccChMap(std::ostream& os) const;
343 
344  //attribute(s)
345 private:
346 
349 
350 #ifndef ECALSELECTIVEREADOUT_NOGEOM
351  const CaloGeometry * theGeometry;
352 #endif //ECALSELECTIVEREADOUT_NOGEOM not defined
354  //towerInterest_t supercrystalInterest[nEndcaps][nSupercrystalXBins][nSupercrystalYBins];
356  int dEta;
357  int dPhi;
358 
359  // for printout
360  const static char srpFlagMarker[];
361 
362 };
363 
364 std::ostream & operator<<(std::ostream & os, const EcalSelectiveReadout & selectiveReadout);
365 
366 #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])
towerInterest_t & eeRuInterest(const EEDetId &id)
static const size_t nEndcapYBins
static const size_t nSupercrystalYBins
static const size_t nBarrelTowerPhiBins
EcalSelectiveReadout(int dEta=1, int dPhi=1)
static const size_t supercrystalEdge
static const int maxDccChs
void combineFlags(T &var, T val) const
void setGeometry(CaloGeometry const *)
void printBarrel(std::ostream &os) const
void setLower(int &var, int val) const
static const size_t nEndcapTriggerTowersInEta
unsigned towerId(DetId const &)
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