CMS 3D CMS Logo

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 
63 public:
64  static const int FORCED_MASK = 0x4;
65 
66  //type definitions
69  typedef enum {
71  LOWINTEREST = 0x0,
72  SINGLE = 0x1,
73  NEIGHBOUR = 0x2,
74  CENTER = 0x3,
75  FORCED_LOWINTEREST = 0x4, //0x0 | 0x4
76  FORCED_SINGLE = 0x5, //0x1 | 0x4
77  FORCED_NEIGHBOUR = 0x6, //0x2 | 0x4
78  FORCED_CENTER = 0x7 //0x3 | 0x4
80 
81  typedef enum {
85  /* 0x2 not used */
87  TTF_FORCED_LOW_INTEREST = 0x4, //0x0 | 0x4
88  TTF_FORCED_MID_INTEREST = 0x5, //0x1 | 0x4
89  /* 0x6 not used*/
90  TTF_FORCED_HIGH_INTEREST = 0x7 //0x3 | 0x4
91  // TTF_FORCED_RO_LINK_SYNC_ERR = 0x4,
92  // TTF_FORCED_RO_HAMMING_ERR = 0X5,
93  // TTF_FORCED_RO_OTHER1 = 0X6,
94  // TTF_FORCED_RO_OTHER2 = 0X7
95  } ttFlag_t;
96 
97  //deprecated. Use instead FORCED_MASK
98  static const int TTF_FORCED_RO_MASK = FORCED_MASK;
99 
100  //constants
101 public:
104  const static size_t nBarrelEtaBins = 170;
107  const static size_t nBarrelPhiBins = 360;
110  const static size_t nEndcapXBins = 100;
113  const static size_t nEndcapYBins = 100;
116  const static size_t supercrystalEdge = 5;
125  const static size_t nBarrelTowerEtaBins = nBarrelEtaBins / 5;
128  const static size_t nBarrelTowerPhiBins = nBarrelPhiBins / 5;
131  const static size_t nEndcaps = 2;
134  const static size_t nEndcapTriggerTowersInEta = 11;
137  const static size_t nBarrelTriggerTowersInEta = 34;
143  const static size_t nTriggerTowersInPhi = 72;
144 
148  const static int maxDccChs = 68;
149 
152  const static int nDccPerEe = 9;
153 
154  //constructor(s) and destructor(s)
155 public:
164  EcalSelectiveReadout(int dEta = 1, int dPhi = 1);
165 
166  //method(s)
167 
169  void setTriggerMap(const EcalTrigTowerConstituentsMap* map) { theTriggerMap = map; }
170 
173  void setElecMap(const EcalElectronicsMapping* map) { theElecMap = map; }
174 
175 #ifndef ECALSELECTIVEREADOUT_NOGEOM
176  void setGeometry(const CaloGeometry* caloGeometry) { theGeometry = caloGeometry; }
177 #endif //ECALSELECTIVEREADOUT_NOGEOM not defined
178 
207 
212  towerInterest_t getCrystalInterest(const EBDetId& ebDetId) const;
213 
218  towerInterest_t getCrystalInterest(const EEDetId& eeDetId) const;
219 
225 
232 
234  void printHeader(std::ostream& os) const;
235 
237  void print(std::ostream& os) const;
238 
239  void printBarrel(std::ostream& os) const;
240  void printEndcap(int endcap, std::ostream& s) const;
241 
242 private:
249 
256 
264 
267  void resetEeRuInterest();
268 
275  void setLower(int& var, int val) const {
276  if (val < var)
277  var = val;
278  }
279 
286  template <class T>
287  void setHigher(T& var, T val) const {
288  if (val > var)
289  var = val;
290  }
291 
298  template <class T>
299  void combineFlags(T& var, T val) const {
300  var = (T)(std::max(val & ~TTF_FORCED_RO_MASK, //actual flag value:
301  // take highest
302  var & ~TTF_FORCED_RO_MASK) //beware: must work also
303  // for UNKNOW=-1
304  // ->compare the whole
305  // integer but with
306  // the forced bit masked.
307  | ((val | var) & 0x4)); //forced bit: set it if any of the two is
308  // already set
309 
310  if (var < 0 || var > 7) {
311  std::cout << __FILE__ << ":" << __LINE__ << ": ---------->" << var << " " << val << " "
312  << std::max(val & 0x3, var & 0x3) << " " << (val | var) << " " << ((val | var) & 0x4) << " "
313  << (std::max(val & 0x3, var & 0x3) | ((val | var) & 0x4)) << " "
314  << (T)(std::max(val & 0x3, var & 0x3) | ((val | var) & 0x4)) << "\n";
315  }
316  }
317 
318  // /** Propagate TTF flag bit on towerInterest. TT interest forced bit is set
319  // * if TTF forced bit is set, otherwise it is not touched.
320  // * @param ttFlags TT flags
321  // */
322  // void propagateTtForcedBit(const ttFlag_t ttFlags[nTriggerTowersInEta][nTriggerTowersInPhi]);
323 
324  void printDccChMap(std::ostream& os) const;
325 
326  //attribute(s)
327 private:
328  const EcalTrigTowerConstituentsMap* theTriggerMap;
329  const EcalElectronicsMapping* theElecMap;
330 
331 #ifndef ECALSELECTIVEREADOUT_NOGEOM
332  const CaloGeometry* theGeometry;
333 #endif //ECALSELECTIVEREADOUT_NOGEOM not defined
335  //towerInterest_t supercrystalInterest[nEndcaps][nSupercrystalXBins][nSupercrystalYBins];
336  towerInterest_t eeRuInterest_[nEndcaps][nDccPerEe][maxDccChs];
337  int dEta;
338  int dPhi;
339 
340  // for printout
341  const static char srpFlagMarker[];
342 };
343 
344 std::ostream& operator<<(std::ostream& os, const EcalSelectiveReadout& selectiveReadout);
345 
346 #endif
EcalElectronicsMapping
Definition: EcalElectronicsMapping.h:28
EcalSelectiveReadout::TTF_UNKNOWN
Definition: EcalSelectiveReadout.h:82
EcalSelectiveReadout::printEndcap
void printEndcap(int endcap, std::ostream &s) const
Definition: EcalSelectiveReadout.cc:287
EcalSelectiveReadout::FORCED_LOWINTEREST
Definition: EcalSelectiveReadout.h:75
EcalSelectiveReadout::FORCED_SINGLE
Definition: EcalSelectiveReadout.h:76
EcalSelectiveReadout::nEndcapXBins
const static size_t nEndcapXBins
Definition: EcalSelectiveReadout.h:110
EcalSelectiveReadout::printHeader
void printHeader(std::ostream &os) const
print out header for the map: see print(std::ostream&)
Definition: EcalSelectiveReadout.cc:237
EcalSelectiveReadout::TTF_LOW_INTEREST
Definition: EcalSelectiveReadout.h:83
EBDetId
Definition: EBDetId.h:17
EcalSelectiveReadout::TTF_MID_INTEREST
Definition: EcalSelectiveReadout.h:84
gather_cfg.cout
cout
Definition: gather_cfg.py:144
EBDetId.h
EEDetId.h
EcalSelectiveReadout::nBarrelTowerPhiBins
const static size_t nBarrelTowerPhiBins
Definition: EcalSelectiveReadout.h:128
EcalSelectiveReadout::printBarrel
void printBarrel(std::ostream &os) const
Definition: EcalSelectiveReadout.cc:277
EcalSelectiveReadout::towerInterest_t
towerInterest_t
Definition: EcalSelectiveReadout.h:69
EcalTrigTowerDetId
Definition: EcalTrigTowerDetId.h:14
EcalSelectiveReadout::TTF_FORCED_RO_MASK
static const int TTF_FORCED_RO_MASK
Definition: EcalSelectiveReadout.h:98
makeMuonMisalignmentScenario.endcap
endcap
Definition: makeMuonMisalignmentScenario.py:320
EcalSelectiveReadout
Definition: EcalSelectiveReadout.h:62
EcalSelectiveReadout::setTriggerMap
void setTriggerMap(const EcalTrigTowerConstituentsMap *map)
the mapping of which cell goes with which trigger tower
Definition: EcalSelectiveReadout.h:169
HLT_2018_cff.dEta
dEta
Definition: HLT_2018_cff.py:12289
EcalSelectiveReadout::setLower
void setLower(int &var, int val) const
Definition: EcalSelectiveReadout.h:275
EcalSelectiveReadout::nDccPerEe
const static int nDccPerEe
Definition: EcalSelectiveReadout.h:152
EcalSelectiveReadout::supercrystalEdge
const static size_t supercrystalEdge
Definition: EcalSelectiveReadout.h:116
trigObjTnPSource_cfi.var
var
Definition: trigObjTnPSource_cfi.py:21
EcalSelectiveReadout::getCrystalInterest
towerInterest_t getCrystalInterest(const EBDetId &ebDetId) const
Definition: EcalSelectiveReadout.cc:131
alignCSCRings.s
s
Definition: alignCSCRings.py:92
CaloGeometry
Definition: CaloGeometry.h:21
EcalSelectiveReadout::EcalSelectiveReadout
EcalSelectiveReadout(int dEta=1, int dPhi=1)
Definition: EcalSelectiveReadout.cc:20
EcalSelectiveReadout::TTF_FORCED_HIGH_INTEREST
Definition: EcalSelectiveReadout.h:90
srpFlagMarker
const char srpFlagMarker[]
Definition: GenABIO.cc:163
EcalSelectiveReadout::CENTER
Definition: EcalSelectiveReadout.h:74
EcalSelectiveReadout::NEIGHBOUR
Definition: EcalSelectiveReadout.h:73
EcalScDetId
Definition: EcalScDetId.h:24
operator<<
std::ostream & operator<<(std::ostream &os, const EcalSelectiveReadout &selectiveReadout)
Definition: EcalSelectiveReadout.cc:306
HLT_2018_cff.dPhi
dPhi
Definition: HLT_2018_cff.py:12290
EcalSelectiveReadout::nBarrelTriggerTowersInEta
const static size_t nBarrelTriggerTowersInEta
Definition: EcalSelectiveReadout.h:137
EcalSelectiveReadout::nBarrelTowerEtaBins
const static size_t nBarrelTowerEtaBins
Definition: EcalSelectiveReadout.h:125
EcalSelectiveReadout::SINGLE
Definition: EcalSelectiveReadout.h:72
EcalSelectiveReadout::FORCED_MASK
static const int FORCED_MASK
Definition: EcalSelectiveReadout.h:64
EcalSelectiveReadout::nBarrelEtaBins
const static size_t nBarrelEtaBins
Definition: EcalSelectiveReadout.h:104
EEDetId
Definition: EEDetId.h:14
EcalTrigTowerDetId.h
EcalTrigTowerConstituentsMap
Definition: EcalTrigTowerConstituentsMap.h:19
EcalSelectiveReadout::TTF_HIGH_INTEREST
Definition: EcalSelectiveReadout.h:86
EcalSelectiveReadout::classifyTriggerTowers
void classifyTriggerTowers(const ttFlag_t ttFlags[nTriggerTowersInEta][nTriggerTowersInPhi])
Definition: EcalSelectiveReadout.cc:187
EcalSelectiveReadout::nTriggerTowersInEta
const static size_t nTriggerTowersInEta
Definition: EcalSelectiveReadout.h:140
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
ecaldqm::setGeometry
void setGeometry(CaloGeometry const *)
Definition: EcalDQMCommonUtils.cc:484
EcalSelectiveReadout::FORCED_CENTER
Definition: EcalSelectiveReadout.h:78
EcalElectronicsMapping.h
EcalSelectiveReadout::nEndcapTriggerTowersInEta
const static size_t nEndcapTriggerTowersInEta
Definition: EcalSelectiveReadout.h:134
EcalSelectiveReadout::getTowerInterest
towerInterest_t getTowerInterest(const EcalTrigTowerDetId &towerId) const
Definition: EcalSelectiveReadout.cc:177
EcalSelectiveReadout::combineFlags
void combineFlags(T &var, T val) const
Definition: EcalSelectiveReadout.h:299
EcalSelectiveReadout::FORCED_NEIGHBOUR
Definition: EcalSelectiveReadout.h:77
EcalSelectiveReadout::getSuperCrystalInterest
towerInterest_t getSuperCrystalInterest(const EcalScDetId &scDetId) const
Definition: EcalSelectiveReadout.cc:144
EcalSelectiveReadout::nSupercrystalXBins
const static size_t nSupercrystalXBins
Definition: EcalSelectiveReadout.h:119
EcalSelectiveReadout::eeRuInterest
towerInterest_t & eeRuInterest(const EEDetId &id)
Definition: EcalSelectiveReadout.cc:148
EcalSelectiveReadout::LOWINTEREST
Definition: EcalSelectiveReadout.h:71
EcalSelectiveReadout::setElecMap
void setElecMap(const EcalElectronicsMapping *map)
Definition: EcalSelectiveReadout.h:173
EcalSelectiveReadout::nEndcaps
const static size_t nEndcaps
Definition: EcalSelectiveReadout.h:131
ecaldqm::towerId
unsigned towerId(DetId const &)
Definition: EcalDQMCommonUtils.cc:79
EcalSelectiveReadout::print
void print(std::ostream &os) const
print out the map
Definition: EcalSelectiveReadout.cc:266
EcalTrigTowerConstituentsMap.h
heppy_batch.val
val
Definition: heppy_batch.py:351
EcalSelectiveReadout::nEndcapYBins
const static size_t nEndcapYBins
Definition: EcalSelectiveReadout.h:113
EcalSelectiveReadout::TTF_FORCED_MID_INTEREST
Definition: EcalSelectiveReadout.h:88
T
long double T
Definition: Basic3DVectorLD.h:48
EcalScDetId.h
CaloGeometry.h
EcalSelectiveReadout::runSelectiveReadout0
void runSelectiveReadout0(const ttFlag_t towerFlags[nTriggerTowersInEta][nTriggerTowersInPhi])
Definition: EcalSelectiveReadout.cc:34
EcalSelectiveReadout::resetEeRuInterest
void resetEeRuInterest()
Definition: EcalSelectiveReadout.cc:23
EcalSelectiveReadout::maxDccChs
const static int maxDccChs
Definition: EcalSelectiveReadout.h:148
EcalSelectiveReadout::ttFlag_t
ttFlag_t
Definition: EcalSelectiveReadout.h:81
EcalSelectiveReadout::nSupercrystalYBins
const static size_t nSupercrystalYBins
Definition: EcalSelectiveReadout.h:122
genParticles_cff.map
map
Definition: genParticles_cff.py:11
EcalSelectiveReadout::nBarrelPhiBins
const static size_t nBarrelPhiBins
Definition: EcalSelectiveReadout.h:107
EcalSelectiveReadout::setHigher
void setHigher(T &var, T val) const
Definition: EcalSelectiveReadout.h:287
EcalSelectiveReadout::TTF_FORCED_LOW_INTEREST
Definition: EcalSelectiveReadout.h:87
EcalSelectiveReadout::nTriggerTowersInPhi
const static size_t nTriggerTowersInPhi
Definition: EcalSelectiveReadout.h:143
EcalSelectiveReadout::UNKNOWN
Definition: EcalSelectiveReadout.h:70