CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static Public Attributes | Private Member Functions
EcalSelectiveReadout Class Reference

#include <EcalSelectiveReadout.h>

Public Types

enum  towerInterest_t {
  UNKNOWN = -1 & ~FORCED_MASK, LOWINTEREST = 0x0, SINGLE = 0x1, NEIGHBOUR = 0x2,
  CENTER = 0x3, FORCED_LOWINTEREST = 0x4, FORCED_SINGLE = 0x5, FORCED_NEIGHBOUR = 0x6,
  FORCED_CENTER = 0x7
}
 
enum  ttFlag_t {
  TTF_UNKNOWN = -1, TTF_LOW_INTEREST = 0x0, TTF_MID_INTEREST = 0x1, TTF_HIGH_INTEREST = 0X3,
  TTF_FORCED_LOW_INTEREST = 0x4, TTF_FORCED_MID_INTEREST = 0x5, TTF_FORCED_HIGH_INTEREST = 0x7
}
 

Public Member Functions

 EcalSelectiveReadout (int dEta=1, int dPhi=1)
 
towerInterest_t getCrystalInterest (const EBDetId &ebDetId) const
 
towerInterest_t getCrystalInterest (const EEDetId &eeDetId) const
 
towerInterest_t getSuperCrystalInterest (const EcalScDetId &scDetId) const
 
towerInterest_t getTowerInterest (const EcalTrigTowerDetId &towerId) const
 
void print (std::ostream &os) const
 print out the map More...
 
void printBarrel (std::ostream &os) const
 
void printEndcap (int endcap, std::ostream &s) const
 
void printHeader (std::ostream &os) const
 print out header for the map: see print(std::ostream&) More...
 
void runSelectiveReadout0 (const ttFlag_t towerFlags[nTriggerTowersInEta][nTriggerTowersInPhi])
 
void setElecMap (const EcalElectronicsMapping *map)
 
void setTriggerMap (const EcalTrigTowerConstituentsMap *map)
 the mapping of which cell goes with which trigger tower More...
 

Static Public Attributes

static const int FORCED_MASK = 0x4
 
const static int maxDccChs = 68
 
const static size_t nBarrelEtaBins = 170
 
const static size_t nBarrelPhiBins = 360
 
const static size_t nBarrelTowerEtaBins = nBarrelEtaBins / 5
 
const static size_t nBarrelTowerPhiBins = nBarrelPhiBins / 5
 
const static size_t nBarrelTriggerTowersInEta = 34
 
const static int nDccPerEe = 9
 
const static size_t nEndcaps = 2
 
const static size_t nEndcapTriggerTowersInEta = 11
 
const static size_t nEndcapXBins = 100
 
const static size_t nEndcapYBins = 100
 
const static size_t nSupercrystalXBins = nEndcapXBins / supercrystalEdge
 
const static size_t nSupercrystalYBins = nEndcapYBins / supercrystalEdge
 
const static size_t nTriggerTowersInEta = 2 * nEndcapTriggerTowersInEta + nBarrelTriggerTowersInEta
 
const static size_t nTriggerTowersInPhi = 72
 
const static size_t supercrystalEdge = 5
 
static const int TTF_FORCED_RO_MASK = FORCED_MASK
 

Private Member Functions

void classifyTriggerTowers (const ttFlag_t ttFlags[nTriggerTowersInEta][nTriggerTowersInPhi])
 
template<class T >
void combineFlags (T &var, T val) const
 
towerInterest_teeRuInterest (const EcalScDetId &id)
 
towerInterest_teeRuInterest (const EEDetId &id)
 
void resetEeRuInterest ()
 
template<class T >
void setHigher (T &var, T val) const
 
void setLower (int &var, int val) const
 

Detailed Description

This class is used to run the selective readout processing on the electromagnetic calorimeter. Normal user do not need to access directly this class: the selective readout is made at digitization by the CaloDataFrameFormatter class which uses the EcalSelectiveReadout class for this purpose: see CaloDataFrameFormatter class documentation. The ECAL event size must be reduced by a factor ~1/20th online at the LV1 rate. This reduction is achieved by suppressing channels whose energy, evaluated on line by a FIR, is below a threshold ("zero suppression"). This threshold is dynamic and determined for the channel of each readout unit. A readout unit is a group of 5x5 crystals: a trigger tower for the barrel and a supercrystal for the endcap) basis. The selective readout classifies the readout units in three classes:

. Single, neighbour and center classes consitute the "high interest" readout units and their channels the "high interest" channels. Two zero suppresion thresholds, eventually -/+ infinity, are defined: one for the "Low interest" channels and one for the "high interest" channels. The low interest threshold must be higher than the high interest one.

Note: Forced bit processing:

The trigger tower flag (TTF) issued by the TCC and indicating the level of transverse deposited energy (classified is three levels called low interest, mid interest, high interest), the selective readout flags (SRF) are made of 2 bits. An additionnal bit, called force bit, is used to indicate if some information was missing to compute the flag and if therefore some default value was used. TCC can substitute a default value to a TTF. In such case the forced bit is set. Similarly SRP can substitute a default value to a SRF and set the forced bit accordingly. If the TTF forced bit of a trigger tower is set the SRP propagates it to the SRF by setting the forced bit of every readout unit overlapping with the trigger tower. Note that for the barrel readout units match with trigger towers.

Definition at line 62 of file EcalSelectiveReadout.h.

Member Enumeration Documentation

◆ towerInterest_t

trigger tower classification ("SRP flags")

Enumerator
UNKNOWN 
LOWINTEREST 
SINGLE 
NEIGHBOUR 
CENTER 
FORCED_LOWINTEREST 
FORCED_SINGLE 
FORCED_NEIGHBOUR 
FORCED_CENTER 

Definition at line 69 of file EcalSelectiveReadout.h.

69  {
70  UNKNOWN = -1 & ~FORCED_MASK,
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

◆ ttFlag_t

Enumerator
TTF_UNKNOWN 
TTF_LOW_INTEREST 
TTF_MID_INTEREST 
TTF_HIGH_INTEREST 
TTF_FORCED_LOW_INTEREST 
TTF_FORCED_MID_INTEREST 
TTF_FORCED_HIGH_INTEREST 

Definition at line 81 of file EcalSelectiveReadout.h.

81  {
82  TTF_UNKNOWN = -1,
83  TTF_LOW_INTEREST = 0x0,
84  TTF_MID_INTEREST = 0x1,
85  /* 0x2 not used */
86  TTF_HIGH_INTEREST = 0X3,
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;

Constructor & Destructor Documentation

◆ EcalSelectiveReadout()

EcalSelectiveReadout::EcalSelectiveReadout ( int  dEta = 1,
int  dPhi = 1 
)

Constructs a ecalselectivereadout. Neighbours are taken in a trigger tower matrix of size 2(dEta+1))x2(dPhi+1) around a 'center' tower.

Parameters
dEtaneighborhood extend in number of trigger towers along eta
dPhineighborgooh extend in number if trigger towers along phi in 'low interest', 'single' or 'center. First element is the lower threshold, second element is the higher one.

Definition at line 20 of file EcalSelectiveReadout.cc.

21  : theTriggerMap(nullptr), theElecMap(nullptr), dEta(dEta_), dPhi(dPhi_) {}

Member Function Documentation

◆ classifyTriggerTowers()

void EcalSelectiveReadout::classifyTriggerTowers ( const ttFlag_t  ttFlags[nTriggerTowersInEta][nTriggerTowersInPhi])
private

Classifies trigger tower in three classes:

  • low interest: value 'lowInterest'
  • middle interest: value 'single'
  • high interest: value 'center'

Definition at line 187 of file EcalSelectiveReadout.cc.

187  {
188  //starts with a all low interest map:
189  for (int iEta = 0; iEta < (int)nTriggerTowersInEta; ++iEta) {
190  for (int iPhi = 0; iPhi < (int)nTriggerTowersInPhi; ++iPhi) {
191  towerInterest[iEta][iPhi] = LOWINTEREST;
192  }
193  }
194 
195  for (int iEta = 0; iEta < (int)nTriggerTowersInEta; ++iEta) {
196  for (int iPhi = 0; iPhi < (int)nTriggerTowersInPhi; ++iPhi) {
197  //copy forced bit from ttFlags to towerInterests:
198  towerInterest[iEta][iPhi] = (towerInterest_t)(towerInterest[iEta][iPhi] | (ttFlags[iEta][iPhi] & FORCED_MASK));
199  if ((ttFlags[iEta][iPhi] & ~FORCED_MASK) == TTF_HIGH_INTEREST) {
200  //flags this tower as a center tower
201  towerInterest[iEta][iPhi] = CENTER;
202  //flags the neighbours of this tower
203  for (int iEtaNeigh = std::max<int>(0, iEta - dEta);
204  iEtaNeigh <= std::min<int>(nTriggerTowersInEta - 1, iEta + dEta);
205  ++iEtaNeigh) {
206  for (int iPhiNeigh = iPhi - dPhi; iPhiNeigh <= iPhi + dPhi; ++iPhiNeigh) {
207  //beware, iPhiNeigh must be moved to [0,72] interval
208  //=> %nTriggerTowersInPhi required
209  int iPhiNeigh_ = iPhiNeigh % (int)nTriggerTowersInPhi;
210  if (iPhiNeigh_ < 0) {
211  iPhiNeigh_ += nTriggerTowersInPhi;
212  }
213  combineFlags(towerInterest[iEtaNeigh][iPhiNeigh_], NEIGHBOUR);
214  }
215  }
216  } else if ((ttFlags[iEta][iPhi] & ~FORCED_MASK) == TTF_MID_INTEREST) {
217  combineFlags(towerInterest[iEta][iPhi], SINGLE);
218  }
219  }
220  }
221 
222  //dealing with pseudo-TT in the two innest eta-ring of the endcaps
223  //=>choose the highest priority SRF of the 2 pseudo-TT constituting
224  //a TT. Note that for S and C, the 2 pseudo-TT must already have the
225  //same mask.
226  const size_t innerEtas[] = {0, 1, nTriggerTowersInEta - 2, nTriggerTowersInEta - 1};
227  for (size_t i = 0; i < 4; ++i) {
228  size_t iEta = innerEtas[i];
229  for (size_t iPhi = 0; iPhi < nTriggerTowersInPhi; iPhi += 2) {
230  const towerInterest_t srf = std::max(towerInterest[iEta][iPhi], towerInterest[iEta][iPhi + 1]);
231  towerInterest[iEta][iPhi] = srf;
232  towerInterest[iEta][iPhi + 1] = srf;
233  }
234  }
235 }

References CENTER, combineFlags(), HLT_FULL_cff::dEta, HLT_FULL_cff::dPhi, FORCED_MASK, mps_fire::i, L1TowerCalibrationProducer_cfi::iEta, createfilelist::int, LOWINTEREST, SiStripPI::max, NEIGHBOUR, nTriggerTowersInEta, nTriggerTowersInPhi, SINGLE, TTF_HIGH_INTEREST, and TTF_MID_INTEREST.

Referenced by runSelectiveReadout0().

◆ combineFlags()

template<class T >
void EcalSelectiveReadout::combineFlags ( T var,
T  val 
) const
inlineprivate

Combine two flags. Forced bit and actual flag fields are treated separately. For both fields, the highst value is selected.

Parameters
var[in,out] flag to change in place
valflag to combine with the first.
Template Parameters
TtowerInterest_t or

Definition at line 299 of file EcalSelectiveReadout.h.

299  {
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  }

References gather_cfg::cout, SiStripPI::max, TTF_FORCED_RO_MASK, heppy_batch::val, and trigObjTnPSource_cfi::var.

Referenced by classifyTriggerTowers(), and runSelectiveReadout0().

◆ eeRuInterest() [1/2]

EcalSelectiveReadout::towerInterest_t & EcalSelectiveReadout::eeRuInterest ( const EcalScDetId id)
private

Get access to eeRuInterest element corresponding to an SC det Id

Parameters
idthe SC det id
Returns
reference to the eeRuInterest array element

Definition at line 163 of file EcalSelectiveReadout.cc.

163  {
164  std::pair<int, int> dccAndDccCh = theElecMap->getDCCandSC(scDetId);
165  const int iZ0 = (scDetId.zside() > 0) ? 1 : 0;
166  const int iDcc0 = dccAndDccCh.first - 1;
167  const int iDccPhi0 = (iDcc0 < 9) ? iDcc0 : (iDcc0 - 45);
168  const int iDccCh0 = dccAndDccCh.second - 1;
169  assert(0 <= iDccPhi0 && iDccPhi0 <= nDccPerEe);
170  assert(0 <= iDccCh0 && iDccCh0 <= maxDccChs);
171 
172  assert(-1 <= eeRuInterest_[iZ0][iDccPhi0][iDccCh0] && eeRuInterest_[iZ0][iDccPhi0][iDccCh0] <= 7);
173 
174  return eeRuInterest_[iZ0][iDccPhi0][iDccCh0];
175 }

References cms::cuda::assert(), maxDccChs, nDccPerEe, and EcalScDetId::zside().

◆ eeRuInterest() [2/2]

EcalSelectiveReadout::towerInterest_t & EcalSelectiveReadout::eeRuInterest ( const EEDetId id)
private

Get access to eeRuInterest element corresponding to an EE det Id

Parameters
idthe EE det id
Returns
reference to the eeRuInterest array element

Definition at line 148 of file EcalSelectiveReadout.cc.

148  {
149  const EcalElectronicsId& id = theElecMap->getElectronicsId(eeDetId);
150  const int iZ0 = id.zside() > 0 ? 1 : 0;
151  const int iDcc0 = id.dccId() - 1;
152  const int iDccPhi0 = (iDcc0 < 9) ? iDcc0 : (iDcc0 - 45);
153  const int iDccCh0 = id.towerId() - 1;
154  assert(0 <= iDccPhi0 && iDccPhi0 < nDccPerEe);
155  assert(0 <= iDccCh0 && iDccCh0 < maxDccChs);
156 
157  assert(eeRuInterest_[iZ0][iDccPhi0][iDccCh0] == UNKNOWN ||
158  (0 <= eeRuInterest_[iZ0][iDccPhi0][iDccCh0] && eeRuInterest_[iZ0][iDccPhi0][iDccCh0] <= 7));
159 
160  return eeRuInterest_[iZ0][iDccPhi0][iDccCh0];
161 }

References cms::cuda::assert(), maxDccChs, nDccPerEe, UNKNOWN, and EcalElectronicsId::zside().

Referenced by runSelectiveReadout0().

◆ getCrystalInterest() [1/2]

EcalSelectiveReadout::towerInterest_t EcalSelectiveReadout::getCrystalInterest ( const EBDetId ebDetId) const

Gets the SR interest classification of an EB channel

Parameters
ebDetIdid of the crystal
interest

Definition at line 131 of file EcalSelectiveReadout.cc.

131  {
132  EcalTrigTowerDetId thisTower = theTriggerMap->towerOf(ebDetId);
133  return getTowerInterest(thisTower);
134 }

References getTowerInterest().

◆ getCrystalInterest() [2/2]

EcalSelectiveReadout::towerInterest_t EcalSelectiveReadout::getCrystalInterest ( const EEDetId eeDetId) const

Gets the SR interest classification of an EE channel

Parameters
eeDetIdid of the crystal
Returns
interest

Definition at line 136 of file EcalSelectiveReadout.cc.

136  {
137  // int iz = (eeDetId.zside() > 0) ? 1 : 0;
138  // int superCrystalX = (eeDetId.ix()-1) / 5;
139  // int superCrystalY = (eeDetId.iy()-1) / 5;
140  // return supercrystalInterest[iz][superCrystalX][superCrystalY];
141  return const_cast<EcalSelectiveReadout*>(this)->eeRuInterest(eeDetId);
142 }

◆ getSuperCrystalInterest()

EcalSelectiveReadout::towerInterest_t EcalSelectiveReadout::getSuperCrystalInterest ( const EcalScDetId scDetId) const

Gets the SR interest classification of an EE supercrystal

Parameters
scDetIdid of the crystal
Returns
interest

Definition at line 144 of file EcalSelectiveReadout.cc.

144  {
145  return const_cast<EcalSelectiveReadout*>(this)->eeRuInterest(scDetId);
146 }

Referenced by printEndcap().

◆ getTowerInterest()

EcalSelectiveReadout::towerInterest_t EcalSelectiveReadout::getTowerInterest ( const EcalTrigTowerDetId towerId) const

Gets the SR interest classification of a trigger tower (TT).

Parameters
iEtaindex of the TT along eta
iPhiindex of the TT along phi
Returns
interest

Definition at line 177 of file EcalSelectiveReadout.cc.

177  {
178  // remember, array indices start at zero
179  int iEta = tower.ieta() < 0 ? tower.ieta() + nTriggerTowersInEta / 2 : tower.ieta() + nTriggerTowersInEta / 2 - 1;
180  int iPhi = tower.iphi() - 1;
181 
182  assert(-1 <= towerInterest[iEta][iPhi] && int(towerInterest[iEta][iPhi]) < 8);
183 
184  return towerInterest[iEta][iPhi];
185 }

References cms::cuda::assert(), L1TowerCalibrationProducer_cfi::iEta, nTriggerTowersInEta, and hgcalTowerProducer_cfi::tower.

Referenced by getCrystalInterest(), and runSelectiveReadout0().

◆ print()

void EcalSelectiveReadout::print ( std::ostream &  os) const

print out the map

Definition at line 266 of file EcalSelectiveReadout.cc.

266  {
267  //EE-
268  printEndcap(0, os);
269 
270  //EB
271  printBarrel(os);
272 
273  //EE+
274  printEndcap(1, os);
275 }

References printBarrel(), and printEndcap().

Referenced by operator<<().

◆ printBarrel()

void EcalSelectiveReadout::printBarrel ( std::ostream &  os) const

Definition at line 277 of file EcalSelectiveReadout.cc.

277  {
279  for (size_t iPhi = 0; iPhi < nTriggerTowersInPhi; ++iPhi) {
280  towerInterest_t srFlag = towerInterest[iEta][iPhi];
281  os << srpFlagMarker[srFlag];
282  }
283  os << "\n"; //one phi per line
284  }
285 }

References L1TowerCalibrationProducer_cfi::iEta, nBarrelTriggerTowersInEta, nEndcapTriggerTowersInEta, nTriggerTowersInPhi, and srpFlagMarker.

Referenced by print().

◆ printEndcap()

void EcalSelectiveReadout::printEndcap ( int  endcap,
std::ostream &  s 
) const

Definition at line 287 of file EcalSelectiveReadout.cc.

287  {
288  for (size_t iX = 0; iX < nSupercrystalXBins; ++iX) {
289  for (size_t iY = 0; iY < nSupercrystalYBins; ++iY) {
290  towerInterest_t srFlag;
291  char c;
292  if (!EcalScDetId::validDetId(iX + 1, iY + 1, endcap >= 1 ? 1 : -1)) {
293  // srFlag = UNKNOWN;
294  c = ' ';
295  } else {
296  srFlag = getSuperCrystalInterest(
297  EcalScDetId(iX + 1, iY + 1, endcap >= 1 ? 1 : -1)); //supercrystalInterest[endcap][iX][iY];
298  c = srFlag == UNKNOWN ? '?' : srpFlagMarker[srFlag];
299  }
300  os << c;
301  }
302  os << "\n"; //one Y supercystal column per line
303  } //next supercrystal X-index
304 }

References c, makeMuonMisalignmentScenario::endcap, getSuperCrystalInterest(), nSupercrystalXBins, nSupercrystalYBins, srpFlagMarker, UNKNOWN, and EcalScDetId::validDetId().

Referenced by print().

◆ printHeader()

void EcalSelectiveReadout::printHeader ( std::ostream &  os) const

print out header for the map: see print(std::ostream&)

Definition at line 237 of file EcalSelectiveReadout.cc.

237  {
238  os << "#SRP flag map\n#\n"
239  "# +-->Phi/Y "
240  << srpFlagMarker[0]
241  << ": low interest\n"
242  "# | "
243  << srpFlagMarker[1]
244  << ": single\n"
245  "# | "
246  << srpFlagMarker[2]
247  << ": neighbour\n"
248  "# V Eta/X "
249  << srpFlagMarker[3]
250  << ": center\n"
251  "# "
252  << srpFlagMarker[4]
253  << ": forced low interest\n"
254  "# "
255  << srpFlagMarker[5]
256  << ": forced single\n"
257  "# "
258  << srpFlagMarker[6]
259  << ": forced neighbout\n"
260  "# "
261  << srpFlagMarker[7]
262  << ": forced center\n"
263  "#\n";
264 }

References srpFlagMarker.

Referenced by ntuplePrintersDiff.SeedPrinter::diff(), ntuplePrintersDiff.TrackPrinter::diff(), ntuplePrintersDiff.SeedPrinter::printSeed(), and ntuplePrintersDiff.TrackPrinter::printTrack().

◆ resetEeRuInterest()

void EcalSelectiveReadout::resetEeRuInterest ( )
private

Sets all endcap RU interest flags to 'unknown'

Definition at line 23 of file EcalSelectiveReadout.cc.

23  {
24  //init superCrystalInterest (sets all elts to 'UNKNOWN'):
25  for (size_t iCap = 0; iCap < nEndcaps; ++iCap) {
26  for (int iDccPhi = 0; iDccPhi < nDccPerEe; ++iDccPhi) {
27  for (int iDccCh = 0; iDccCh < maxDccChs; ++iDccCh) {
28  eeRuInterest_[iCap][iDccPhi][iDccCh] = UNKNOWN;
29  }
30  }
31  }
32 }

References maxDccChs, nDccPerEe, nEndcaps, and UNKNOWN.

Referenced by runSelectiveReadout0().

◆ runSelectiveReadout0()

void EcalSelectiveReadout::runSelectiveReadout0 ( const ttFlag_t  towerFlags[nTriggerTowersInEta][nTriggerTowersInPhi])

Selective readout algorithm type 0. The algorithm is the following:

  1. A trigger tower (TT) with Et higher than the high threshold is classified as 'center'
  2. A trigger tower which is a neighbour of a 'center' TT and which is not itself a 'center' is classified as 'neighbour'
  3. A TT with Et between the two threshold and which is not a 'center' or a 'neighbour' is classified as 'single'
  4. Any other TT are classified as 'low interest'

For the barrel a crystal inherit the single/center/neighbour/low_interst classification of its TT. For the endcap,

  • if the supercrystal overlaps with a 'center' TT, it's flagged as 'center'
  • otherwise if it overlaps with a 'neighbour' TT, it's flagged as 'neighbour'
  • else if it overlaps with a 'single' TT, it's flagged as 'single'
  • the remaining SC are flagged as 'low interest'

An endcap crystal inherits the SRP flag of its SC.

Parameters
triggerTowerEtarray of the transverse enrgy deposited in the trigger tower. First index is for eta,2nd index for phi.

Definition at line 34 of file EcalSelectiveReadout.cc.

34  {
35  //printDccChMap(std::cout);
36 
37  //classifies the trigger towers (single,center,neighbor,low interest)
38  classifyTriggerTowers(ttFlags);
39 
40  //count number of TT in each interest class for debugging display
41  int nTriggerTowerE[] = {0, 0, 0, 0, 0, 0, 0, 0};
42  int nTriggerTowerB[] = {0, 0, 0, 0, 0, 0, 0, 0};
43  static std::atomic<int> ncall{0};
44  if (ncall < 10) {
45  ++ncall;
46  for (size_t iPhi = 0; iPhi < nTriggerTowersInPhi; ++iPhi) {
47  for (size_t iEta = 0; iEta < nTriggerTowersInEta; ++iEta) {
48  if (iEta < nEndcapTriggerTowersInEta || iEta >= nBarrelTriggerTowersInEta + nEndcapTriggerTowersInEta) {
49  //in endcaps
50  ++nTriggerTowerE[towerInterest[iEta][iPhi]];
51  } else { //in barrel
52  ++nTriggerTowerB[towerInterest[iEta][iPhi]];
53  }
54 
55  assert(towerInterest[iEta][iPhi] >= 0 && towerInterest[iEta][iPhi] <= 0x7);
56  }
57  }
58  edm::LogInfo("EcalSelectiveReadout") << "without forced bit + with forced bit set:\n"
59  << nTriggerTowerB[LOWINTEREST] << " + "
60  << nTriggerTowerB[LOWINTEREST | FORCED_MASK]
61  << " low interest TT(s) in barrel\n"
62  << nTriggerTowerB[SINGLE] << " + " << nTriggerTowerB[SINGLE | FORCED_MASK]
63  << " single TT(s) in barrel\n"
64  << nTriggerTowerB[NEIGHBOUR] << " + "
65  << nTriggerTowerB[NEIGHBOUR | FORCED_MASK]
66  << " neighbor interest TT(s) in barrel\n"
67  << nTriggerTowerB[CENTER] << " + " << nTriggerTowerB[CENTER | FORCED_MASK]
68  << " centre interest TT(s) in barrel\n"
69  << nTriggerTowerE[LOWINTEREST] << " + "
70  << nTriggerTowerE[LOWINTEREST | FORCED_MASK]
71  << " low interest TT(s) in endcap\n"
72  << nTriggerTowerE[SINGLE] << " + " << nTriggerTowerE[SINGLE | FORCED_MASK]
73  << " single TT(s) in endcap\n"
74  << nTriggerTowerE[NEIGHBOUR] << " + "
75  << nTriggerTowerE[NEIGHBOUR | FORCED_MASK] << " neighbor TT(s) in endcap\n"
76  << nTriggerTowerE[CENTER] << " + " << nTriggerTowerE[CENTER | FORCED_MASK]
77  << " center TT(s) in endcap\n";
78  }
79  //end TT interest class composition debugging display
80 
81  //For the endcap the TT classification must be mapped to the SC:
83 
84 #ifndef ECALSELECTIVEREADOUT_NOGEOM
85  const std::vector<DetId>& endcapDetIds = theGeometry->getValidDetIds(DetId::Ecal, EcalEndcap);
86  for (std::vector<DetId>::const_iterator eeDetIdItr = endcapDetIds.begin(); eeDetIdItr != endcapDetIds.end();
87  ++eeDetIdItr) {
88  // for each superCrystal, the interest is the highest interest
89  // of any trigger tower associated with at least one crystal from this SC.
90  // The forced bit must be set if the flag of one of these trigger towers has
91  // the forced bit set.
92  EcalTrigTowerDetId trigTower = theTriggerMap->towerOf(*eeDetIdItr);
93  assert(trigTower.rawId() != 0);
94  EEDetId eeDetId(*eeDetIdItr);
95  int iz = (eeDetId.zside() > 0) ? 1 : 0;
96  //Following statement will set properly the actual 2-bit flag value
97  //and the forced bit: TTF forced bit is propagated to every RU that
98  //overlaps with the corresponding TT.
99  combineFlags(eeRuInterest(eeDetId), getTowerInterest(trigTower));
100  }
101 #else //ECALSELECTIVEREADOUT_NOGEOM defined
102  EEDetId xtal;
103  for (int iZ0 = 0; iZ0 < 2; ++iZ0) { //0->EE-, 1->EE+
104  for (unsigned iX0 = 0; iX0 < nEndcapXBins; ++iX0) {
105  for (unsigned iY0 = 0; iY0 < nEndcapYBins; ++iY0) {
106  if (!(xtal.validDetId(iX0 + 1, iY0 + 1, (iZ0 > 0 ? 1 : -1)))) {
107  continue;
108  }
109  xtal = EEDetId(iX0 + 1, iY0 + 1, (iZ0 > 0 ? 1 : -1));
110  //works around a EEDetId bug. To remove once the bug fixed.
111  if (39 <= iX0 && iX0 <= 60 && 45 <= iY0 && iY0 <= 54) {
112  continue;
113  }
114  // for each superCrystal, the interest is the highest interest
115  // of any trigger tower associated with any crystal in this SC
116  EcalTrigTowerDetId trigTower = theTriggerMap->towerOf(xtal);
117  assert(trigTower.rawId() != 0);
118  //Following statement will set properly the actual 2-bit flag value
119  //and the forced bit: TTF forced bit is propagated to every RU that
120  //overlaps with the corresponding TT.
121  combineFlags(eeRuInterest(xtal), getTowerInterest(trigTower));
122 
123  assert(0 <= eeRuInterest(xtal) && eeRuInterest(xtal) <= 0x7);
124 
125  } //next iY0
126  } //next iX0
127  } //next iZ0
128 #endif //ECALSELECTIVEREADOUT_NOGEOM not defined
129 }

References cms::cuda::assert(), CENTER, classifyTriggerTowers(), combineFlags(), DetId::Ecal, EcalEndcap, eeRuInterest(), FORCED_MASK, getTowerInterest(), L1TowerCalibrationProducer_cfi::iEta, LOWINTEREST, nBarrelTriggerTowersInEta, NEIGHBOUR, nEndcapTriggerTowersInEta, nEndcapXBins, nEndcapYBins, nTriggerTowersInEta, nTriggerTowersInPhi, DetId::rawId(), resetEeRuInterest(), SINGLE, and EEDetId::validDetId().

◆ setElecMap()

void EcalSelectiveReadout::setElecMap ( const EcalElectronicsMapping map)
inline

the electronics map, used to get information about the DCC and DCC channel used to read a crystal channel

Definition at line 173 of file EcalSelectiveReadout.h.

173 { theElecMap = map; }

References genParticles_cff::map.

◆ setHigher()

template<class T >
void EcalSelectiveReadout::setHigher ( T var,
T  val 
) const
inlineprivate

Changes the value of a variable iff that has the effect to increase the variable value var = max(var,val)

Parameters
varthe variable
valthe new candidate value

Definition at line 287 of file EcalSelectiveReadout.h.

287  {
288  if (val > var)
289  var = val;
290  }

References heppy_batch::val, and trigObjTnPSource_cfi::var.

◆ setLower()

void EcalSelectiveReadout::setLower ( int &  var,
int  val 
) const
inlineprivate

Changes the value of a variable iff that has the effect to decrease the variable value var = min(var,val)

Parameters
varthe variable
valthe new candidate value

Definition at line 275 of file EcalSelectiveReadout.h.

275  {
276  if (val < var)
277  var = val;
278  }

References heppy_batch::val, and trigObjTnPSource_cfi::var.

◆ setTriggerMap()

void EcalSelectiveReadout::setTriggerMap ( const EcalTrigTowerConstituentsMap map)
inline

the mapping of which cell goes with which trigger tower

Definition at line 169 of file EcalSelectiveReadout.h.

169 { theTriggerMap = map; }

References genParticles_cff::map.

Member Data Documentation

◆ FORCED_MASK

const int EcalSelectiveReadout::FORCED_MASK = 0x4
static

◆ maxDccChs

const static int EcalSelectiveReadout::maxDccChs = 68
static

Maximum number of DCC channels used from crystal channels (channel #69 and #70 used for MEM are not counted here)

Definition at line 148 of file EcalSelectiveReadout.h.

Referenced by eeRuInterest(), and resetEeRuInterest().

◆ nBarrelEtaBins

const static size_t EcalSelectiveReadout::nBarrelEtaBins = 170
static

Number of crystals along eta in barrel

Definition at line 104 of file EcalSelectiveReadout.h.

◆ nBarrelPhiBins

const static size_t EcalSelectiveReadout::nBarrelPhiBins = 360
static

Number of crystals in a eta ring of the barrel

Definition at line 107 of file EcalSelectiveReadout.h.

◆ nBarrelTowerEtaBins

const static size_t EcalSelectiveReadout::nBarrelTowerEtaBins = nBarrelEtaBins / 5
static

Number of trigger tower along eta in the barrel

Definition at line 125 of file EcalSelectiveReadout.h.

◆ nBarrelTowerPhiBins

const static size_t EcalSelectiveReadout::nBarrelTowerPhiBins = nBarrelPhiBins / 5
static

Number of trigger tower in a eta ring of the barrel

Definition at line 128 of file EcalSelectiveReadout.h.

◆ nBarrelTriggerTowersInEta

const static size_t EcalSelectiveReadout::nBarrelTriggerTowersInEta = 34
static

Number of barrel trigger towers along eta

Definition at line 137 of file EcalSelectiveReadout.h.

Referenced by printBarrel(), and runSelectiveReadout0().

◆ nDccPerEe

const static int EcalSelectiveReadout::nDccPerEe = 9
static

Number of DCC per endcap

Definition at line 152 of file EcalSelectiveReadout.h.

Referenced by eeRuInterest(), and resetEeRuInterest().

◆ nEndcaps

const static size_t EcalSelectiveReadout::nEndcaps = 2
static

Number of endcap, obviously tow

Definition at line 131 of file EcalSelectiveReadout.h.

Referenced by resetEeRuInterest().

◆ nEndcapTriggerTowersInEta

const static size_t EcalSelectiveReadout::nEndcapTriggerTowersInEta = 11
static

Number of trigger towers along eta in one endcap

Definition at line 134 of file EcalSelectiveReadout.h.

Referenced by printBarrel(), and runSelectiveReadout0().

◆ nEndcapXBins

const static size_t EcalSelectiveReadout::nEndcapXBins = 100
static

Range of the x-index of endcap crystals (xman-xmin+1).

Definition at line 110 of file EcalSelectiveReadout.h.

Referenced by runSelectiveReadout0().

◆ nEndcapYBins

const static size_t EcalSelectiveReadout::nEndcapYBins = 100
static

Range of the y-index of endcap crystals (yman-ymin+1).

Definition at line 113 of file EcalSelectiveReadout.h.

Referenced by runSelectiveReadout0().

◆ nSupercrystalXBins

const static size_t EcalSelectiveReadout::nSupercrystalXBins = nEndcapXBins / supercrystalEdge
static

Range of endcap supercrystal x-index (xmax-xmin+1)

Definition at line 119 of file EcalSelectiveReadout.h.

Referenced by printEndcap().

◆ nSupercrystalYBins

const static size_t EcalSelectiveReadout::nSupercrystalYBins = nEndcapYBins / supercrystalEdge
static

Range of endcap supercrystal y-index (ymay-ymin+1)

Definition at line 122 of file EcalSelectiveReadout.h.

Referenced by printEndcap().

◆ nTriggerTowersInEta

const static size_t EcalSelectiveReadout::nTriggerTowersInEta = 2 * nEndcapTriggerTowersInEta + nBarrelTriggerTowersInEta
static

◆ nTriggerTowersInPhi

const static size_t EcalSelectiveReadout::nTriggerTowersInPhi = 72
static

◆ supercrystalEdge

const static size_t EcalSelectiveReadout::supercrystalEdge = 5
static

Edge size of a supercrystal. A supercrystal is a tower of 5x5 crystals.

Definition at line 116 of file EcalSelectiveReadout.h.

◆ TTF_FORCED_RO_MASK

const int EcalSelectiveReadout::TTF_FORCED_RO_MASK = FORCED_MASK
static

Definition at line 98 of file EcalSelectiveReadout.h.

Referenced by combineFlags().

EcalSelectiveReadout::TTF_UNKNOWN
Definition: EcalSelectiveReadout.h:82
EcalSelectiveReadout::printEndcap
void printEndcap(int endcap, std::ostream &s) const
Definition: EcalSelectiveReadout.cc:287
mps_fire.i
i
Definition: mps_fire.py:428
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::TTF_LOW_INTEREST
Definition: EcalSelectiveReadout.h:83
EcalElectronicsId::zside
int zside() const
zside = +1 or -1
Definition: EcalElectronicsId.cc:27
EcalSelectiveReadout::TTF_MID_INTEREST
Definition: EcalSelectiveReadout.h:84
gather_cfg.cout
cout
Definition: gather_cfg.py:144
EcalScDetId::validDetId
static bool validDetId(int ix, int iy, int iz)
Definition: EcalScDetId.cc:59
hgcalTowerProducer_cfi.tower
tower
Definition: hgcalTowerProducer_cfi.py:4
cms::cuda::assert
assert(be >=bs)
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
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
EcalSelectiveReadout::TTF_FORCED_RO_MASK
static const int TTF_FORCED_RO_MASK
Definition: EcalSelectiveReadout.h:98
makeMuonMisalignmentScenario.endcap
endcap
Definition: makeMuonMisalignmentScenario.py:320
HLT_FULL_cff.dPhi
dPhi
Definition: HLT_FULL_cff.py:13695
EcalSelectiveReadout::nDccPerEe
const static int nDccPerEe
Definition: EcalSelectiveReadout.h:152
trigObjTnPSource_cfi.var
var
Definition: trigObjTnPSource_cfi.py:21
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
EcalSelectiveReadout::nBarrelTriggerTowersInEta
const static size_t nBarrelTriggerTowersInEta
Definition: EcalSelectiveReadout.h:137
EcalSelectiveReadout::SINGLE
Definition: EcalSelectiveReadout.h:72
EcalSelectiveReadout::FORCED_MASK
static const int FORCED_MASK
Definition: EcalSelectiveReadout.h:64
EcalElectronicsId
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
Definition: EcalElectronicsId.h:18
EEDetId
Definition: EEDetId.h:14
EcalEndcap
Definition: EcalSubdetector.h:10
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
EcalSelectiveReadout::FORCED_CENTER
Definition: EcalSelectiveReadout.h:78
EcalSelectiveReadout::nEndcapTriggerTowersInEta
const static size_t nEndcapTriggerTowersInEta
Definition: EcalSelectiveReadout.h:134
createfilelist.int
int
Definition: createfilelist.py:10
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
DetId::Ecal
Definition: DetId.h:27
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::nEndcaps
const static size_t nEndcaps
Definition: EcalSelectiveReadout.h:131
heppy_batch.val
val
Definition: heppy_batch.py:351
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
EcalSelectiveReadout::nEndcapYBins
const static size_t nEndcapYBins
Definition: EcalSelectiveReadout.h:113
EcalSelectiveReadout::TTF_FORCED_MID_INTEREST
Definition: EcalSelectiveReadout.h:88
HLT_FULL_cff.dEta
dEta
Definition: HLT_FULL_cff.py:13694
T
long double T
Definition: Basic3DVectorLD.h:48
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
EEDetId::validDetId
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.h:248
L1TowerCalibrationProducer_cfi.iEta
iEta
Definition: L1TowerCalibrationProducer_cfi.py:60
EcalSelectiveReadout::nSupercrystalYBins
const static size_t nSupercrystalYBins
Definition: EcalSelectiveReadout.h:122
genParticles_cff.map
map
Definition: genParticles_cff.py:11
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:56
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