CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | Static Private Attributes
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
 
static const int maxDccChs = 68
 
static const size_t nBarrelEtaBins = 170
 
static const size_t nBarrelPhiBins = 360
 
static const size_t nBarrelTowerEtaBins = nBarrelEtaBins/5
 
static const size_t nBarrelTowerPhiBins = nBarrelPhiBins/5
 
static const size_t nBarrelTriggerTowersInEta = 34
 
static const int nDccPerEe = 9
 
static const size_t nEndcaps = 2
 
static const size_t nEndcapTriggerTowersInEta = 11
 
static const size_t nEndcapXBins = 100
 
static const size_t nEndcapYBins = 100
 
static const size_t nSupercrystalXBins = nEndcapXBins/supercrystalEdge
 
static const size_t nSupercrystalYBins = nEndcapYBins/supercrystalEdge
 
static const size_t nTriggerTowersInEta
 
static const size_t nTriggerTowersInPhi = 72
 
static const 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 EEDetId &id)
 
towerInterest_teeRuInterest (const EcalScDetId &id)
 
void printDccChMap (std::ostream &os) const
 
void resetEeRuInterest ()
 
template<class T >
void setHigher (T &var, T val) const
 
void setLower (int &var, int val) const
 

Private Attributes

int dEta
 
int dPhi
 
towerInterest_t eeRuInterest_ [nEndcaps][nDccPerEe][maxDccChs]
 
const EcalElectronicsMappingtheElecMap
 
const EcalTrigTowerConstituentsMaptheTriggerMap
 
towerInterest_t towerInterest [nTriggerTowersInEta][nTriggerTowersInPhi]
 

Static Private Attributes

static const char srpFlagMarker []
 

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 64 of file EcalSelectiveReadout.h.

Member Enumeration Documentation

trigger tower classification ("SRP flags")

Enumerator
UNKNOWN 
LOWINTEREST 
SINGLE 
NEIGHBOUR 
CENTER 
FORCED_LOWINTEREST 
FORCED_SINGLE 
FORCED_NEIGHBOUR 
FORCED_CENTER 

Definition at line 71 of file EcalSelectiveReadout.h.

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 82 of file EcalSelectiveReadout.h.

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

Constructor & Destructor Documentation

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 21 of file EcalSelectiveReadout.cc.

21  :
22  theTriggerMap(nullptr), theElecMap(nullptr), dEta(dEta_), dPhi(dPhi_) {
23 }
const EcalElectronicsMapping * theElecMap
const EcalTrigTowerConstituentsMap * theTriggerMap

Member Function Documentation

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 215 of file EcalSelectiveReadout.cc.

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

Referenced by runSelectiveReadout0(), and setElecMap().

216 {
217  //starts with a all low interest map:
218  for(int iEta=0; iEta < (int)nTriggerTowersInEta; ++iEta){
219  for(int iPhi=0; iPhi < (int)nTriggerTowersInPhi; ++iPhi){
220  towerInterest[iEta][iPhi] = LOWINTEREST;
221  }
222  }
223 
224  for(int iEta=0; iEta < (int)nTriggerTowersInEta; ++iEta){
225  for(int iPhi=0; iPhi < (int)nTriggerTowersInPhi; ++iPhi){
226  //copy forced bit from ttFlags to towerInterests:
227  towerInterest[iEta][iPhi] = (towerInterest_t) (towerInterest[iEta][iPhi]
228  | (ttFlags[iEta][iPhi] & FORCED_MASK)) ;
229  if((ttFlags[iEta][iPhi] & ~FORCED_MASK) == TTF_HIGH_INTEREST){
230  //flags this tower as a center tower
231  towerInterest[iEta][iPhi] = CENTER;
232  //flags the neighbours of this tower
233  for(int iEtaNeigh = std::max<int>(0,iEta-dEta);
234  iEtaNeigh <= std::min<int>(nTriggerTowersInEta-1, iEta+dEta);
235  ++iEtaNeigh){
236  for(int iPhiNeigh = iPhi-dPhi;
237  iPhiNeigh <= iPhi+dPhi;
238  ++iPhiNeigh){
239  //beware, iPhiNeigh must be moved to [0,72] interval
240  //=> %nTriggerTowersInPhi required
241  int iPhiNeigh_ = iPhiNeigh%(int)nTriggerTowersInPhi;
242  if(iPhiNeigh_<0) {
243  iPhiNeigh_ += nTriggerTowersInPhi;
244  }
245  combineFlags(towerInterest[iEtaNeigh][iPhiNeigh_],
246  NEIGHBOUR);
247  }
248  }
249  } else if((ttFlags[iEta][iPhi] & ~FORCED_MASK) == TTF_MID_INTEREST){
250  combineFlags(towerInterest[iEta][iPhi], SINGLE);
251  }
252  }
253  }
254 
255  //dealing with pseudo-TT in the two innest eta-ring of the endcaps
256  //=>choose the highest priority SRF of the 2 pseudo-TT constituting
257  //a TT. Note that for S and C, the 2 pseudo-TT must already have the
258  //same mask.
259  const size_t innerEtas[] = {0, 1,
260  nTriggerTowersInEta-2, nTriggerTowersInEta-1};
261  for(size_t i=0; i < 4; ++i){
262  size_t iEta = innerEtas[i];
263  for(size_t iPhi = 0 ; iPhi < nTriggerTowersInPhi; iPhi+=2){
264  const towerInterest_t srf = std::max(towerInterest[iEta][iPhi],
265  towerInterest[iEta][iPhi+1]);
266  towerInterest[iEta][iPhi] = srf;
267  towerInterest[iEta][iPhi+1] = srf;
268  }
269  }
270 }
static const int FORCED_MASK
void combineFlags(T &var, T val) const
static const size_t nTriggerTowersInEta
static const size_t nTriggerTowersInPhi
towerInterest_t towerInterest[nTriggerTowersInEta][nTriggerTowersInPhi]
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 310 of file EcalSelectiveReadout.h.

References gather_cfg::cout, SiStripPI::max, printDccChMap(), and JetChargeProducer_cfi::var.

Referenced by classifyTriggerTowers(), and runSelectiveReadout0().

310  {
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  }
static const int TTF_FORCED_RO_MASK
long double T
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 169 of file EcalSelectiveReadout.cc.

References eeRuInterest_, EcalElectronicsMapping::getElectronicsId(), maxDccChs, nDccPerEe, theElecMap, UNKNOWN, and EcalElectronicsId::zside().

Referenced by getCrystalInterest(), getSuperCrystalInterest(), runSelectiveReadout0(), and setElecMap().

169  {
170  const EcalElectronicsId& id = theElecMap->getElectronicsId(eeDetId);
171  const int iZ0 = id.zside()>0 ? 1 : 0;
172  const int iDcc0 = id.dccId()-1;
173  const int iDccPhi0 = (iDcc0<9)?iDcc0:(iDcc0-45);
174  const int iDccCh0 = id.towerId()-1;
175  assert(0 <= iDccPhi0 && iDccPhi0 < nDccPerEe);
176  assert(0 <= iDccCh0 && iDccCh0 < maxDccChs);
177 
178  assert(eeRuInterest_[iZ0][iDccPhi0][iDccCh0] == UNKNOWN
179  || (0<= eeRuInterest_[iZ0][iDccPhi0][iDccCh0]
180  && eeRuInterest_[iZ0][iDccPhi0][iDccCh0] <=7));
181 
182  return eeRuInterest_[iZ0][iDccPhi0][iDccCh0];
183 }
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
static const int nDccPerEe
EcalElectronicsId getElectronicsId(const DetId &id) const
Get the electronics id for this det id.
static const int maxDccChs
const EcalElectronicsMapping * theElecMap
int zside() const
zside = +1 or -1
towerInterest_t eeRuInterest_[nEndcaps][nDccPerEe][maxDccChs]
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 186 of file EcalSelectiveReadout.cc.

References eeRuInterest_, EcalElectronicsMapping::getDCCandSC(), maxDccChs, nDccPerEe, theElecMap, and EcalScDetId::zside().

186  {
187  std::pair<int, int> dccAndDccCh = theElecMap->getDCCandSC(scDetId);
188  const int iZ0 = (scDetId.zside()>0) ? 1: 0;
189  const int iDcc0 = dccAndDccCh.first-1;
190  const int iDccPhi0 = (iDcc0<9)?iDcc0:(iDcc0-45);
191  const int iDccCh0 = dccAndDccCh.second-1;
192  assert(0 <= iDccPhi0 && iDccPhi0 <= nDccPerEe);
193  assert(0 <= iDccCh0 && iDccCh0 <= maxDccChs);
194 
195  assert(-1<= eeRuInterest_[iZ0][iDccPhi0][iDccCh0] && eeRuInterest_[iZ0][iDccPhi0][iDccCh0] <=7);
196 
197  return eeRuInterest_[iZ0][iDccPhi0][iDccCh0];
198 }
std::pair< int, int > getDCCandSC(EcalScDetId id) const
static const int nDccPerEe
static const int maxDccChs
const EcalElectronicsMapping * theElecMap
towerInterest_t eeRuInterest_[nEndcaps][nDccPerEe][maxDccChs]
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 145 of file EcalSelectiveReadout.cc.

References getTowerInterest(), theTriggerMap, and EcalTrigTowerConstituentsMap::towerOf().

Referenced by setElecMap().

146 {
147  EcalTrigTowerDetId thisTower = theTriggerMap->towerOf(ebDetId);
148  return getTowerInterest(thisTower);
149 }
towerInterest_t getTowerInterest(const EcalTrigTowerDetId &towerId) const
EcalTrigTowerDetId towerOf(const DetId &id) const
Get the tower id for this det id (or null if not known)
const EcalTrigTowerConstituentsMap * theTriggerMap
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 153 of file EcalSelectiveReadout.cc.

References eeRuInterest().

154 {
155  // int iz = (eeDetId.zside() > 0) ? 1 : 0;
156  // int superCrystalX = (eeDetId.ix()-1) / 5;
157  // int superCrystalY = (eeDetId.iy()-1) / 5;
158  // return supercrystalInterest[iz][superCrystalX][superCrystalY];
159  return const_cast<EcalSelectiveReadout*>(this)->eeRuInterest(eeDetId);
160 }
towerInterest_t & eeRuInterest(const EEDetId &id)
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 163 of file EcalSelectiveReadout.cc.

References eeRuInterest().

Referenced by printEndcap(), and setElecMap().

164 {
165  return const_cast<EcalSelectiveReadout*>(this)->eeRuInterest(scDetId);
166 }
towerInterest_t & eeRuInterest(const EEDetId &id)
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 202 of file EcalSelectiveReadout.cc.

References EcalTrigTowerDetId::ieta(), EcalTrigTowerDetId::iphi(), nTriggerTowersInEta, and towerInterest.

Referenced by getCrystalInterest(), runSelectiveReadout0(), and setElecMap().

203 {
204  // remember, array indices start at zero
205  int iEta = tower.ieta()<0? tower.ieta() + nTriggerTowersInEta/2
206  : tower.ieta() + nTriggerTowersInEta/2 -1;
207  int iPhi = tower.iphi() - 1;
208 
209  assert(-1 <= towerInterest[iEta][iPhi] && towerInterest[iEta][iPhi] < 8);
210 
211  return towerInterest[iEta][iPhi];
212 }
static const size_t nTriggerTowersInEta
towerInterest_t towerInterest[nTriggerTowersInEta][nTriggerTowersInPhi]
void EcalSelectiveReadout::print ( std::ostream &  os) const

print out the map

Definition at line 285 of file EcalSelectiveReadout.cc.

References printBarrel(), and printEndcap().

Referenced by operator<<(), and setElecMap().

286 {
287  //EE-
288  printEndcap(0, os);
289 
290  //EB
291  printBarrel(os);
292 
293  //EE+
294  printEndcap(1, os);
295 }
void printEndcap(int endcap, std::ostream &s) const
void printBarrel(std::ostream &os) const
void EcalSelectiveReadout::printBarrel ( std::ostream &  os) const

Definition at line 298 of file EcalSelectiveReadout.cc.

References nBarrelTriggerTowersInEta, nEndcapTriggerTowersInEta, nTriggerTowersInPhi, srpFlagMarker, and towerInterest.

Referenced by print(), and setElecMap().

299 {
300  for(size_t iEta = nEndcapTriggerTowersInEta;
303  ++iEta){
304  for(size_t iPhi = 0; iPhi < nTriggerTowersInPhi; ++iPhi){
305  towerInterest_t srFlag
306  = towerInterest[iEta][iPhi];
307  os << srpFlagMarker[srFlag];
308  }
309  os << "\n"; //one phi per line
310  }
311 }
static const size_t nEndcapTriggerTowersInEta
static const size_t nTriggerTowersInPhi
static const char srpFlagMarker[]
towerInterest_t towerInterest[nTriggerTowersInEta][nTriggerTowersInPhi]
static const size_t nBarrelTriggerTowersInEta
void EcalSelectiveReadout::printDccChMap ( std::ostream &  os) const
private

Propagate TTF flag bit on towerInterest. TT interest forced bit is set if TTF forced bit is set, otherwise it is not touched.

Parameters
ttFlagsTT flags

Definition at line 343 of file EcalSelectiveReadout.cc.

References makeMuonMisalignmentScenario::endcap, EcalElectronicsMapping::getDCCandSC(), mps_fire::i, nSupercrystalXBins, nSupercrystalYBins, theElecMap, and EcalScDetId::validDetId().

Referenced by combineFlags().

343  {
344  for(int i=-1; i<=68; ++i){
345  if((i+1)%10==0) os << "//";
346  os << std::setw(2) << i << ": " << (char)('0'+i);
347  if(i%10==9) os << "\n"; else os << " ";
348  }
349 
350  os << "\n";
351 
352  for(int endcap = 0; endcap < 2; ++endcap){
353  os << "Sc2DCCch0: " << (endcap?"EE+":"EE-") << "\n";
354  for(size_t iY=0; iY<nSupercrystalYBins; ++iY){
355  os << "Sc2DCCch0: ";
356  for(size_t iX=0; iX<nSupercrystalXBins; ++iX){
357  //if(iX) os << ",";
358  if(!EcalScDetId::validDetId(iX+1,iY+1,endcap>=1?1:-1)){
359  //os << std::setw(2) << -1;
360  os << (char)('0'-1);
361  } else{
362  //os << std::setw(2) << theElecMap->getDCCandSC(EcalScDetId(iX+1, iY+1, endcap>0?1:-1)).second-1;
363  os << (char)('0'+(theElecMap->getDCCandSC(EcalScDetId(iX+1, iY+1, endcap>0?1:-1)).second-1));
364  }
365  }
366  os << "\n";
367  }
368  os << "\n";
369  }
370  os << "\n";
371 }
static bool validDetId(int ix, int iy, int iz)
Definition: EcalScDetId.cc:64
static const size_t nSupercrystalXBins
std::pair< int, int > getDCCandSC(EcalScDetId id) const
static const size_t nSupercrystalYBins
const EcalElectronicsMapping * theElecMap
void EcalSelectiveReadout::printEndcap ( int  endcap,
std::ostream &  s 
) const

Definition at line 314 of file EcalSelectiveReadout.cc.

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

Referenced by print(), and setElecMap().

315 {
316  for(size_t iX=0; iX<nSupercrystalXBins; ++iX){
317  for(size_t iY=0; iY<nSupercrystalYBins; ++iY){
318  towerInterest_t srFlag;
319  char c;
320  if(!EcalScDetId::validDetId(iX+1,iY+1,endcap>=1?1:-1)){
321  // srFlag = UNKNOWN;
322  c = ' ';
323  } else{
324  srFlag
325  = getSuperCrystalInterest(EcalScDetId(iX+1, iY+1, endcap>=1?1:-1));//supercrystalInterest[endcap][iX][iY];
326  c = srFlag==UNKNOWN ? '?' : srpFlagMarker[srFlag];
327  }
328  os << c;
329  }
330  os << "\n"; //one Y supercystal column per line
331  } //next supercrystal X-index
332 }
static bool validDetId(int ix, int iy, int iz)
Definition: EcalScDetId.cc:64
towerInterest_t getSuperCrystalInterest(const EcalScDetId &scDetId) const
static const size_t nSupercrystalXBins
static const size_t nSupercrystalYBins
static const char srpFlagMarker[]
void EcalSelectiveReadout::printHeader ( std::ostream &  os) const

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

Definition at line 272 of file EcalSelectiveReadout.cc.

References srpFlagMarker.

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

272  {
273  os << "#SRP flag map\n#\n"
274  "# +-->Phi/Y " << srpFlagMarker[0] << ": low interest\n"
275  "# | " << srpFlagMarker[1] << ": single\n"
276  "# | " << srpFlagMarker[2] << ": neighbour\n"
277  "# V Eta/X " << srpFlagMarker[3] << ": center\n"
278  "# " << srpFlagMarker[4] << ": forced low interest\n"
279  "# " << srpFlagMarker[5] << ": forced single\n"
280  "# " << srpFlagMarker[6] << ": forced neighbout\n"
281  "# " << srpFlagMarker[7] << ": forced center\n"
282  "#\n";
283 }
static const char srpFlagMarker[]
void EcalSelectiveReadout::resetEeRuInterest ( )
private

Sets all endcap RU interest flags to 'unknown'

Definition at line 25 of file EcalSelectiveReadout.cc.

References eeRuInterest_, maxDccChs, nDccPerEe, nEndcaps, and UNKNOWN.

Referenced by runSelectiveReadout0(), and setElecMap().

25  {
26  //init superCrystalInterest (sets all elts to 'UNKNOWN'):
27  for(size_t iCap=0; iCap < nEndcaps; ++iCap){
28  for(int iDccPhi = 0; iDccPhi < nDccPerEe; ++iDccPhi){
29  for(int iDccCh = 0; iDccCh < maxDccChs; ++iDccCh){
30  eeRuInterest_[iCap][iDccPhi][iDccCh] = UNKNOWN;
31  }
32  }
33  }
34 }
static const size_t nEndcaps
static const int nDccPerEe
static const int maxDccChs
towerInterest_t eeRuInterest_[nEndcaps][nDccPerEe][maxDccChs]
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 37 of file EcalSelectiveReadout.cc.

References CENTER, classifyTriggerTowers(), combineFlags(), DetId::Ecal, EcalEndcap, eeRuInterest(), FORCED_MASK, getTowerInterest(), LOWINTEREST, nBarrelTriggerTowersInEta, NEIGHBOUR, nEndcapTriggerTowersInEta, nEndcapXBins, nEndcapYBins, nTriggerTowersInEta, nTriggerTowersInPhi, DetId::rawId(), resetEeRuInterest(), SINGLE, theTriggerMap, towerInterest, EcalTrigTowerConstituentsMap::towerOf(), and EEDetId::validDetId().

Referenced by setElecMap().

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

References heppy_batch::val.

299  {
300  if(val>var) var = val;
301  }
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 288 of file EcalSelectiveReadout.h.

References heppy_batch::val.

288  {
289  if(val<var) var = val;
290  }
void EcalSelectiveReadout::setTriggerMap ( const EcalTrigTowerConstituentsMap map)
inline

the mapping of which cell goes with which trigger tower

Definition at line 172 of file EcalSelectiveReadout.h.

References genParticles_cff::map, and theTriggerMap.

172  {
173  theTriggerMap = map;
174  }
const EcalTrigTowerConstituentsMap * theTriggerMap

Member Data Documentation

int EcalSelectiveReadout::dEta
private

Definition at line 356 of file EcalSelectiveReadout.h.

Referenced by classifyTriggerTowers().

int EcalSelectiveReadout::dPhi
private

Definition at line 357 of file EcalSelectiveReadout.h.

Referenced by classifyTriggerTowers().

towerInterest_t EcalSelectiveReadout::eeRuInterest_[nEndcaps][nDccPerEe][maxDccChs]
private

Definition at line 355 of file EcalSelectiveReadout.h.

Referenced by eeRuInterest(), and resetEeRuInterest().

const int EcalSelectiveReadout::FORCED_MASK = 0x4
static
const 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 151 of file EcalSelectiveReadout.h.

Referenced by eeRuInterest(), and resetEeRuInterest().

const size_t EcalSelectiveReadout::nBarrelEtaBins = 170
static

Number of crystals along eta in barrel

Definition at line 106 of file EcalSelectiveReadout.h.

const size_t EcalSelectiveReadout::nBarrelPhiBins = 360
static

Number of crystals in a eta ring of the barrel

Definition at line 109 of file EcalSelectiveReadout.h.

const size_t EcalSelectiveReadout::nBarrelTowerEtaBins = nBarrelEtaBins/5
static

Number of trigger tower along eta in the barrel

Definition at line 127 of file EcalSelectiveReadout.h.

const size_t EcalSelectiveReadout::nBarrelTowerPhiBins = nBarrelPhiBins/5
static

Number of trigger tower in a eta ring of the barrel

Definition at line 130 of file EcalSelectiveReadout.h.

const size_t EcalSelectiveReadout::nBarrelTriggerTowersInEta = 34
static

Number of barrel trigger towers along eta

Definition at line 139 of file EcalSelectiveReadout.h.

Referenced by printBarrel(), and runSelectiveReadout0().

const int EcalSelectiveReadout::nDccPerEe = 9
static

Number of DCC per endcap

Definition at line 155 of file EcalSelectiveReadout.h.

Referenced by eeRuInterest(), and resetEeRuInterest().

const size_t EcalSelectiveReadout::nEndcaps = 2
static

Number of endcap, obviously tow

Definition at line 133 of file EcalSelectiveReadout.h.

Referenced by resetEeRuInterest().

const size_t EcalSelectiveReadout::nEndcapTriggerTowersInEta = 11
static

Number of trigger towers along eta in one endcap

Definition at line 136 of file EcalSelectiveReadout.h.

Referenced by printBarrel(), and runSelectiveReadout0().

const size_t EcalSelectiveReadout::nEndcapXBins = 100
static

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

Definition at line 112 of file EcalSelectiveReadout.h.

Referenced by runSelectiveReadout0().

const size_t EcalSelectiveReadout::nEndcapYBins = 100
static

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

Definition at line 115 of file EcalSelectiveReadout.h.

Referenced by runSelectiveReadout0().

const size_t EcalSelectiveReadout::nSupercrystalXBins = nEndcapXBins/supercrystalEdge
static

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

Definition at line 121 of file EcalSelectiveReadout.h.

Referenced by printDccChMap(), and printEndcap().

const size_t EcalSelectiveReadout::nSupercrystalYBins = nEndcapYBins/supercrystalEdge
static

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

Definition at line 124 of file EcalSelectiveReadout.h.

Referenced by printDccChMap(), and printEndcap().

const size_t EcalSelectiveReadout::nTriggerTowersInEta
static
const size_t EcalSelectiveReadout::nTriggerTowersInPhi = 72
static
const char EcalSelectiveReadout::srpFlagMarker
staticprivate
Initial value:
= {'.', 'S', 'N', 'C',
'4', '5', '6', '7'}

Definition at line 360 of file EcalSelectiveReadout.h.

Referenced by printBarrel(), printEndcap(), and printHeader().

const size_t EcalSelectiveReadout::supercrystalEdge = 5
static

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

Definition at line 118 of file EcalSelectiveReadout.h.

const EcalElectronicsMapping* EcalSelectiveReadout::theElecMap
private

Definition at line 348 of file EcalSelectiveReadout.h.

Referenced by eeRuInterest(), printDccChMap(), and setElecMap().

const EcalTrigTowerConstituentsMap* EcalSelectiveReadout::theTriggerMap
private

Definition at line 347 of file EcalSelectiveReadout.h.

Referenced by getCrystalInterest(), runSelectiveReadout0(), and setTriggerMap().

towerInterest_t EcalSelectiveReadout::towerInterest[nTriggerTowersInEta][nTriggerTowersInPhi]
private
const int EcalSelectiveReadout::TTF_FORCED_RO_MASK = FORCED_MASK
static

Definition at line 99 of file EcalSelectiveReadout.h.