CMS 3D CMS Logo

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

#include <EcalElectronicsMapping.h>

Classes

struct  MapItem
 Wrap a generic EcalTrigTowerDetId to the equivalent one in z+ Quadrant 1 (from 0 < phi < pi/2) More...
 

Public Member Functions

void assign (const DetId &cell, const EcalElectronicsId &, const EcalTriggerElectronicsId &tower)
 set the association between a DetId and a tower More...
 
int DCCBoundary (int FED) const
 
std::vector< DetIddccConstituents (int dccId) const
 Get the constituent detids for this dccId. More...
 
int DCCid (const EBDetId &id) const
 returns the DCC of an EBDetId More...
 
int DCCid (const EcalTrigTowerDetId &id) const
 returns the DCCid (i.e. the FED) of a Trigger Tower More...
 
std::vector< DetIddccTowerConstituents (int dccId, int tower) const
 Get the constituent detids for this dccId. More...
 
 EcalElectronicsMapping ()
 
std::pair< int, int > getDCCandSC (EcalScDetId id) const
 
DetId getDetId (const EcalElectronicsId &id) const
 Get the detid given an electronicsId. More...
 
DetId getDetId (const EcalTriggerElectronicsId &id) const
 Get the detid given a trigger electronicsId. More...
 
std::vector< EcalScDetIdgetEcalScDetId (int DCCid, int DCC_Channel, bool ignoreSingleCrystal=true) const
 
EcalElectronicsId getElectronicsId (const DetId &id) const
 Get the electronics id for this det id. More...
 
EcalElectronicsId getElectronicsId (const EcalTriggerElectronicsId &id) const
 Get the electronics id given a trigger electronicsId. More...
 
int GetFED (double eta, double phi) const
 
std::vector< int > GetListofFEDs (const RectangularEtaPhiRegion &region) const
 
void GetListofFEDs (const RectangularEtaPhiRegion &region, std::vector< int > &FEDs) const
 
int getLMNumber (const DetId &id) const
 
EcalTriggerElectronicsId getTriggerElectronicsId (const DetId &id) const
 Get the trigger electronics id for this det id. More...
 
EcalTriggerElectronicsId getTriggerElectronicsId (const EcalElectronicsId &id) const
 Get the trigger electronics id given an electronicsId. More...
 
EcalTrigTowerDetId getTrigTowerDetId (int TCCid, int iTT) const
 Builds a EcalTrigTowerDetID from the TCCid & TriggerTower index in TCC. More...
 
int iTT (const EcalTrigTowerDetId &id) const
 returns the index of a Trigger Tower within its TCC. More...
 
std::vector< DetIdpseudoStripConstituents (int tccId, int tt, int pseudostrip) const
 Get the constituent detids for this dccId. More...
 
bool rightTower (int tower) const
 
std::vector< DetIdstripConstituents (int dccId, int tower, int strip) const
 Get the constituent detids for this dccId. More...
 
EcalSubdetector subdet (int dccid, int mode) const
 
std::vector< DetIdtccConstituents (int tccId) const
 Get the constituent detids for this dccId. More...
 
int TCCid (const EBDetId &id) const
 returns the TCCid of an EBDetId More...
 
int TCCid (const EcalTrigTowerDetId &id) const
 returns the TCCid of a Trigger Tower More...
 
std::vector< DetIdttConstituents (int tccId, int tt) const
 Get the constituent detids for this dccId. More...
 
int zside (int dcctcc, int mode) const
 

Static Public Attributes

static const int DCCID_PHI0_EBM = EcalElectronicsId::DCCID_PHI0_EBM
 
static const int DCCID_PHI0_EBP = EcalElectronicsId::DCCID_PHI0_EBP
 
static const int iEEEtaMinInner = 22
 
static const int iEEEtaMinOuter = 18
 
static const int kCrystalsInPhi = EBDetId::kCrystalsInPhi
 
static const int kEBTowersInEta = EcalTrigTowerDetId::kEBTowersInEta
 
static const int kEBTowersInPhi = EcalTrigTowerDetId::kEBTowersInPhi
 
static const int kEBTowersPerSM = EcalTrigTowerDetId::kEBTowersPerSM
 
static const int kEETowersInEta = EcalTrigTowerDetId::kEETowersInEta
 
static const int kEETowersInEtaPerInnerTCC = 7
 
static const int kEETowersInEtaPerOuterTCC = 4
 
static const int kEETowersInPhiPerQuadrant = EcalTrigTowerDetId::kEETowersInPhiPerQuadrant
 
static const int kEETowersInPhiPerTCC = 4
 
static const int kTCCinPhi = 18
 
static const int kTowersInPhi = EBDetId::kTowersInPhi
 
static const int MAX_DCCID = EcalElectronicsId::MAX_DCCID
 
static const int MAX_DCCID_EBM = EcalElectronicsId::MAX_DCCID_EBM
 
static const int MAX_DCCID_EBP = EcalElectronicsId::MAX_DCCID_EBP
 
static const int MAX_DCCID_EEM = EcalElectronicsId::MAX_DCCID_EEM
 
static const int MAX_DCCID_EEP = EcalElectronicsId::MAX_DCCID_EEP
 
static const int MAX_LM = 92
 
static const int MAX_TCCID = EcalTriggerElectronicsId::MAX_TCCID
 
static const int MAX_TCCID_EBM = EcalTriggerElectronicsId::MAX_TCCID_EBM
 
static const int MAX_TCCID_EBP = EcalTriggerElectronicsId::MAX_TCCID_EBP
 
static const int MAX_TCCID_EEM = EcalTriggerElectronicsId::MAX_TCCID_EEM
 
static const int MAX_TCCID_EEP = EcalTriggerElectronicsId::MAX_TCCID_EEP
 
static const int MIN_DCCID = EcalElectronicsId::MIN_DCCID
 
static const int MIN_DCCID_EBM = EcalElectronicsId::MIN_DCCID_EBM
 
static const int MIN_DCCID_EBP = EcalElectronicsId::MIN_DCCID_EBP
 
static const int MIN_DCCID_EEM = EcalElectronicsId::MIN_DCCID_EEM
 
static const int MIN_DCCID_EEP = EcalElectronicsId::MIN_DCCID_EEP
 
static const int MIN_LM_EBM = 1
 
static const int MIN_LM_EBP = 37
 
static const int MIN_LM_EEM = 73
 
static const int MIN_LM_EEP = 83
 
static const int MIN_TCCID = EcalTriggerElectronicsId::MIN_TCCID
 
static const int MIN_TCCID_EBM = EcalTriggerElectronicsId::MIN_TCCID_EBM
 
static const int MIN_TCCID_EBP = EcalTriggerElectronicsId::MIN_TCCID_EBP
 
static const int MIN_TCCID_EEM = EcalTriggerElectronicsId::MIN_TCCID_EEM
 
static const int MIN_TCCID_EEP = EcalTriggerElectronicsId::MIN_TCCID_EEP
 
static const int TCCID_PHI0_EBM = EcalTriggerElectronicsId::TCCID_PHI0_EBM
 
static const int TCCID_PHI0_EBP = EcalTriggerElectronicsId::TCCID_PHI0_EBP
 
static const int TCCID_PHI0_EEM_IN = EcalTriggerElectronicsId::TCCID_PHI0_EEM_IN
 
static const int TCCID_PHI0_EEM_OUT = EcalTriggerElectronicsId::TCCID_PHI0_EEM_OUT
 
static const int TCCID_PHI0_EEP_IN = EcalTriggerElectronicsId::TCCID_PHI0_EEP_IN
 
static const int TCCID_PHI0_EEP_OUT = EcalTriggerElectronicsId::TCCID_PHI0_EEP_OUT
 

Private Types

typedef boost::multi_index::multi_index_container< MapItem, boost::multi_index::indexed_by< boost::multi_index::ordered_unique< boost::multi_index::member< MapItem, DetId, &MapItem::cell > >, boost::multi_index::ordered_unique< boost::multi_index::member< MapItem, EcalElectronicsId, &MapItem::elid > >, boost::multi_index::ordered_unique< boost::multi_index::member< MapItem, EcalTriggerElectronicsId, &MapItem::trelid > >, boost::multi_index::ordered_non_unique< boost::multi_index::const_mem_fun< MapItem, int, &MapItem::dccId > >, boost::multi_index::ordered_non_unique< boost::multi_index::composite_key< MapItem, boost::multi_index::const_mem_fun< MapItem, int, &MapItem::dccId >, boost::multi_index::const_mem_fun< MapItem, int, &MapItem::towerId > > >, boost::multi_index::ordered_non_unique< boost::multi_index::composite_key< MapItem, boost::multi_index::const_mem_fun< MapItem, int, &MapItem::dccId >, boost::multi_index::const_mem_fun< MapItem, int, &MapItem::towerId >, boost::multi_index::const_mem_fun< MapItem, int, &MapItem::stripId > > >, boost::multi_index::ordered_non_unique< boost::multi_index::const_mem_fun< MapItem, int, &MapItem::tccId > >, boost::multi_index::ordered_non_unique< boost::multi_index::composite_key< MapItem, boost::multi_index::const_mem_fun< MapItem, int, &MapItem::tccId >, boost::multi_index::const_mem_fun< MapItem, int, &MapItem::ttId > > >, boost::multi_index::ordered_non_unique< boost::multi_index::composite_key< MapItem, boost::multi_index::const_mem_fun< MapItem, int, &MapItem::tccId >, boost::multi_index::const_mem_fun< MapItem, int, &MapItem::ttId >, boost::multi_index::const_mem_fun< MapItem, int, &MapItem::pseudoStripId > > > > > EcalElectronicsMap
 
typedef EcalElectronicsMap::nth_index< 3 >::type EcalElectronicsMap_by_DccId
 
typedef EcalElectronicsMap::nth_index< 4 >::type EcalElectronicsMap_by_DccId_and_TowerId
 
typedef EcalElectronicsMap::nth_index< 5 >::type EcalElectronicsMap_by_DccId_TowerId_and_StripId
 
typedef EcalElectronicsMap::nth_index< 0 >::type EcalElectronicsMap_by_DetId
 
typedef EcalElectronicsMap::nth_index< 1 >::type EcalElectronicsMap_by_ElectronicsId
 
typedef EcalElectronicsMap::nth_index< 6 >::type EcalElectronicsMap_by_TccId
 
typedef EcalElectronicsMap::nth_index< 7 >::type EcalElectronicsMap_by_TccId_and_TtId
 
typedef EcalElectronicsMap::nth_index< 8 >::type EcalElectronicsMap_by_TccId_TtId_and_PseudostripId
 
typedef EcalElectronicsMap::nth_index< 2 >::type EcalElectronicsMap_by_TriggerElectronicsId
 

Private Attributes

std::map< int, int > LaserMonitoringMap_EB
 
std::map< int, int > LaserMonitoringMap_EE
 
EcalElectronicsMap m_items
 

Static Private Attributes

static const int DCCMODE = 0
 
static const int TCCMODE = 1
 

Detailed Description

Author
P.Meridiani (INFN Roma1), E. Perez (CERN)

Definition at line 28 of file EcalElectronicsMapping.h.

Member Typedef Documentation

◆ EcalElectronicsMap

typedef boost::multi_index::multi_index_container< MapItem, boost::multi_index::indexed_by< boost::multi_index::ordered_unique<boost::multi_index::member<MapItem, DetId, &MapItem::cell> >, boost::multi_index::ordered_unique<boost::multi_index::member<MapItem, EcalElectronicsId, &MapItem::elid> >, boost::multi_index::ordered_unique< boost::multi_index::member<MapItem, EcalTriggerElectronicsId, &MapItem::trelid> >, boost::multi_index::ordered_non_unique<boost::multi_index::const_mem_fun<MapItem, int, &MapItem::dccId> >, boost::multi_index::ordered_non_unique< boost::multi_index::composite_key<MapItem, boost::multi_index::const_mem_fun<MapItem, int, &MapItem::dccId>, boost::multi_index::const_mem_fun<MapItem, int, &MapItem::towerId> > >, boost::multi_index::ordered_non_unique< boost::multi_index::composite_key<MapItem, boost::multi_index::const_mem_fun<MapItem, int, &MapItem::dccId>, boost::multi_index::const_mem_fun<MapItem, int, &MapItem::towerId>, boost::multi_index::const_mem_fun<MapItem, int, &MapItem::stripId> > >, boost::multi_index::ordered_non_unique<boost::multi_index::const_mem_fun<MapItem, int, &MapItem::tccId> >, boost::multi_index::ordered_non_unique< boost::multi_index::composite_key<MapItem, boost::multi_index::const_mem_fun<MapItem, int, &MapItem::tccId>, boost::multi_index::const_mem_fun<MapItem, int, &MapItem::ttId> > >, boost::multi_index::ordered_non_unique<boost::multi_index::composite_key< MapItem, boost::multi_index::const_mem_fun<MapItem, int, &MapItem::tccId>, boost::multi_index::const_mem_fun<MapItem, int, &MapItem::ttId>, boost::multi_index::const_mem_fun<MapItem, int, &MapItem::pseudoStripId> > > > > EcalElectronicsMapping::EcalElectronicsMap
private

Definition at line 254 of file EcalElectronicsMapping.h.

◆ EcalElectronicsMap_by_DccId

typedef EcalElectronicsMap::nth_index<3>::type EcalElectronicsMapping::EcalElectronicsMap_by_DccId
private

Definition at line 260 of file EcalElectronicsMapping.h.

◆ EcalElectronicsMap_by_DccId_and_TowerId

typedef EcalElectronicsMap::nth_index<4>::type EcalElectronicsMapping::EcalElectronicsMap_by_DccId_and_TowerId
private

Definition at line 261 of file EcalElectronicsMapping.h.

◆ EcalElectronicsMap_by_DccId_TowerId_and_StripId

typedef EcalElectronicsMap::nth_index<5>::type EcalElectronicsMapping::EcalElectronicsMap_by_DccId_TowerId_and_StripId
private

Definition at line 262 of file EcalElectronicsMapping.h.

◆ EcalElectronicsMap_by_DetId

typedef EcalElectronicsMap::nth_index<0>::type EcalElectronicsMapping::EcalElectronicsMap_by_DetId
private

Definition at line 256 of file EcalElectronicsMapping.h.

◆ EcalElectronicsMap_by_ElectronicsId

typedef EcalElectronicsMap::nth_index<1>::type EcalElectronicsMapping::EcalElectronicsMap_by_ElectronicsId
private

Definition at line 257 of file EcalElectronicsMapping.h.

◆ EcalElectronicsMap_by_TccId

typedef EcalElectronicsMap::nth_index<6>::type EcalElectronicsMapping::EcalElectronicsMap_by_TccId
private

Definition at line 264 of file EcalElectronicsMapping.h.

◆ EcalElectronicsMap_by_TccId_and_TtId

typedef EcalElectronicsMap::nth_index<7>::type EcalElectronicsMapping::EcalElectronicsMap_by_TccId_and_TtId
private

Definition at line 265 of file EcalElectronicsMapping.h.

◆ EcalElectronicsMap_by_TccId_TtId_and_PseudostripId

typedef EcalElectronicsMap::nth_index<8>::type EcalElectronicsMapping::EcalElectronicsMap_by_TccId_TtId_and_PseudostripId
private

Definition at line 266 of file EcalElectronicsMapping.h.

◆ EcalElectronicsMap_by_TriggerElectronicsId

typedef EcalElectronicsMap::nth_index<2>::type EcalElectronicsMapping::EcalElectronicsMap_by_TriggerElectronicsId
private

Definition at line 258 of file EcalElectronicsMapping.h.

Constructor & Destructor Documentation

◆ EcalElectronicsMapping()

EcalElectronicsMapping::EcalElectronicsMapping ( )

Definition at line 36 of file EcalElectronicsMapping.cc.

36  {
37  // Fill the map (Barrel) for the Laser Monitoring readout numbers :
38  // Each DCC actually corresponds to 2 LMs, ilm and ilm + 1
39 
40  int ilm = MIN_LM_EBM;
41  for (int dcc = MIN_DCCID_EBM; dcc <= MAX_DCCID_EBM; dcc++) {
42  LaserMonitoringMap_EB[dcc] = ilm;
43  ilm += 2;
44  }
45  ilm = MIN_LM_EBP;
46  for (int dcc = MIN_DCCID_EBP; dcc <= MAX_DCCID_EBP; dcc++) {
47  LaserMonitoringMap_EB[dcc] = ilm;
48  ilm += 2;
49  }
50 
51  // Fill the map (EndCap) for the Laser Monitoring readout numbers :
52  // Each DCC corresponds to onr LM, but DCC 8 (LM 80 and 81) and DCC 53 (LM 90 and 91)
53 
54  ilm = MIN_LM_EEM;
55  for (int dcc = MIN_DCCID_EEM; dcc <= MAX_DCCID_EEM; dcc++) {
56  LaserMonitoringMap_EE[dcc] = ilm;
57  ilm += 1;
58  if (dcc == 8)
59  ilm += 1;
60  }
61  ilm = MIN_LM_EEP;
62  for (int dcc = MIN_DCCID_EEP; dcc <= MAX_DCCID_EEP; dcc++) {
63  LaserMonitoringMap_EE[dcc] = ilm;
64  ilm += 1;
65  if (dcc == 53)
66  ilm += 1;
67  }
68 }
std::map< int, int > LaserMonitoringMap_EB
std::map< int, int > LaserMonitoringMap_EE

Member Function Documentation

◆ assign()

void EcalElectronicsMapping::assign ( const DetId cell,
const EcalElectronicsId elid,
const EcalTriggerElectronicsId tower 
)

set the association between a DetId and a tower

Definition at line 755 of file EcalElectronicsMapping.cc.

References l1tHGCalTowerProducer_cfi::tower.

Referenced by EcalElectronicsMappingBuilder::FillFromDatabase().

757  {
758  m_items.insert(MapItem(cell, elid, tower));
759 }

◆ DCCBoundary()

int EcalElectronicsMapping::DCCBoundary ( int  FED) const

Definition at line 928 of file EcalElectronicsMapping.cc.

928  {
929  if (FED >= MIN_DCCID_EEM && FED <= MAX_DCCID_EEM)
930  return MIN_DCCID_EEM;
931  if (FED >= MIN_DCCID_EBM && FED <= MAX_DCCID_EBM)
932  return MIN_DCCID_EBM;
933  if (FED >= MIN_DCCID_EBP && FED <= MAX_DCCID_EBP)
934  return MIN_DCCID_EBP;
935  if (FED >= MIN_DCCID_EEP && FED <= MAX_DCCID_EEP)
936  return MIN_DCCID_EEP;
937  return -1;
938 }

◆ dccConstituents()

std::vector< DetId > EcalElectronicsMapping::dccConstituents ( int  dccId) const

Get the constituent detids for this dccId.

Definition at line 561 of file EcalElectronicsMapping.cc.

References ecaldqm::dccId(), EcalBarrel, EcalEndcap, Exception, mps_fire::i, mps_monitormerge::items, findQualityFiles::size, and l1tHGCalTowerProducer_cfi::tower.

Referenced by ecaldqm::binning::getBinningSM_().

561  {
563  std::vector<DetId> items;
564 
565  if (sub == EcalBarrel) {
566  for (int tower = 1; tower <= kEBTowersPerSM; tower++) {
567  std::vector<DetId> xtals = dccTowerConstituents(dccId, tower);
568  int size = xtals.size();
569  for (int i = 0; i < size; i++) {
570  DetId detid = xtals[i];
571  items.emplace_back(detid);
572  }
573  }
574  return items;
575  } else if (sub == EcalEndcap) {
576  EcalElectronicsMap_by_DccId::const_iterator lb, ub;
577  boost::tuples::tie(lb, ub) = get<3>(m_items).equal_range(dccId);
578  while (lb != ub) {
579  DetId cell = lb->cell;
580  items.emplace_back(cell);
581  ++lb;
582  }
583  return items;
584  } else
585  throw cms::Exception("InvalidDetId") << "Wrong dccId = " << dccId
586  << " in EcalElectronicsMapping::dccConstituents. ";
587 }
size
Write out results.
EcalSubdetector subdet(int dccid, int mode) const
unsigned dccId(DetId const &, EcalElectronicsMapping const *)
std::vector< DetId > dccTowerConstituents(int dccId, int tower) const
Get the constituent detids for this dccId.
Definition: DetId.h:17
EcalSubdetector

◆ DCCid() [1/2]

int EcalElectronicsMapping::DCCid ( const EBDetId id) const

returns the DCC of an EBDetId

Definition at line 70 of file EcalElectronicsMapping.cc.

References ecaldqm::zside().

Referenced by EcalTPGParamBuilder::analyze(), ecaldqm::binning::channelName(), TCCBlockFormatter::DigiToRaw(), TowerBlockFormatter::DigiToRaw(), and EcalDigiToRaw::produce().

76 {
77  int dcc = id.ism();
78  if (id.zside() < 0) {
79  dcc += DCCID_PHI0_EBM - 19;
80  } else {
81  dcc += DCCID_PHI0_EBP - 1;
82  }
83  return dcc;
84 }
int zside(int dcctcc, int mode) const

◆ DCCid() [2/2]

int EcalElectronicsMapping::DCCid ( const EcalTrigTowerDetId id) const

returns the DCCid (i.e. the FED) of a Trigger Tower

Definition at line 189 of file EcalElectronicsMapping.cc.

References EcalBarrel, EcalEndcap, Exception, hltrates_dqm_sourceclient-live_cfg::offset, and ecaldqm::zside().

189  {
190  // This is needed for digitoraw. For a given Trigger Tower,
191  // one needs to know to which FED it gets written.
192 
193  if (id.subDet() == EcalBarrel) {
194  int phi = id.iphi() + 2;
195  if (phi > 72)
196  phi = phi - 72;
197  int dcc = (phi - 1) / kEBTowersInPhi + 1;
198  if (id.zside() < 0)
199  dcc += 18; // now id is the SMid
200  if (id.zside() < 0) {
201  dcc += DCCID_PHI0_EBM - 19;
202  } else {
203  dcc += DCCID_PHI0_EBP - 1;
204  }
205  return dcc;
206  } else if (id.subDet() == EcalEndcap) { //FIXME : yes I need to improve this part of the code...
207  int tccid = TCCid(id);
208  int dcc = 0;
209  int offset = 0;
210  if (tccid >= 73) {
211  tccid = tccid - 72;
212  offset = 45;
213  }
214  if (tccid == 24 || tccid == 25 || tccid == 6 || tccid == 7)
215  dcc = 4;
216  if (tccid == 26 || tccid == 27 || tccid == 8 || tccid == 9)
217  dcc = 5;
218  if (tccid == 28 || tccid == 29 || tccid == 10 || tccid == 11)
219  dcc = 6;
220  if (tccid == 30 || tccid == 31 || tccid == 12 || tccid == 13)
221  dcc = 7;
222  if (tccid == 32 || tccid == 33 || tccid == 14 || tccid == 15)
223  dcc = 8;
224  if (tccid == 34 || tccid == 35 || tccid == 16 || tccid == 17)
225  dcc = 9;
226  if (tccid == 36 || tccid == 19 || tccid == 18 || tccid == 1)
227  dcc = 1;
228  if (tccid == 20 || tccid == 21 || tccid == 2 || tccid == 3)
229  dcc = 2;
230  if (tccid == 22 || tccid == 23 || tccid == 4 || tccid == 5)
231  dcc = 3;
232  dcc += offset;
233  return dcc;
234  } else {
235  throw cms::Exception("InvalidDetId") << " Wrong EcalTrigTowerDetId in EcalElectronicsMapping::DCCid.";
236  return 0;
237  }
238 }
int TCCid(const EBDetId &id) const
returns the TCCid of an EBDetId
int zside(int dcctcc, int mode) const

◆ dccTowerConstituents()

std::vector< DetId > EcalElectronicsMapping::dccTowerConstituents ( int  dccId,
int  tower 
) const

Get the constituent detids for this dccId.

Definition at line 589 of file EcalElectronicsMapping.cc.

References ecaldqm::dccId(), EcalBarrel, EcalEndcap, EBDetId::ETAPHIMODE, Exception, LEDCalibrationChannels::ieta, LEDCalibrationChannels::iphi, mps_monitormerge::items, l1tHGCalTowerProducer_cfi::tower, and ecaldqm::zside().

Referenced by EcalElectronicsMapper::fillMaps(), and DCCDataUnpacker::getCCUValue().

589  {
591  std::vector<DetId> items;
592 
593  if (sub == EcalBarrel) {
594  int iz = zside(dccId, DCCMODE);
595  int smid = 0;
596  int iphi = 0;
597  if (iz < 0) {
598  smid = dccId + 19 - DCCID_PHI0_EBM;
599  iphi = (smid - 19) * kCrystalsInPhi;
600  iphi += 5 * ((tower - 1) % kTowersInPhi);
601  } else {
602  smid = dccId + 1 - DCCID_PHI0_EBP;
603  iphi = (smid - 1) * kCrystalsInPhi;
604  iphi += 5 * (kTowersInPhi - ((tower - 1) % kTowersInPhi) - 1);
605  }
606  int ieta = 5 * ((tower - 1) / kTowersInPhi) + 1;
607  for (int ip = 1; ip <= 5; ip++) {
608  for (int ie = 0; ie <= 4; ie++) {
609  int ieta_xtal = ieta + ie;
610  int iphi_xtal = iphi + ip;
611  if (iz < 0)
612  ieta_xtal = -ieta_xtal;
613  EBDetId ebdetid(ieta_xtal, iphi_xtal, EBDetId::ETAPHIMODE);
614  items.emplace_back(ebdetid);
615  }
616  }
617  return items;
618  }
619 
620  else if (sub == EcalEndcap) {
621  EcalElectronicsMap_by_DccId_and_TowerId::const_iterator lb, ub;
622  boost::tuples::tie(lb, ub) = get<4>(m_items).equal_range(boost::make_tuple(int(dccId), int(tower)));
623  while (lb != ub) {
624  DetId cell = lb->cell;
625  items.emplace_back(cell);
626  ++lb;
627  }
628  return items;
629  } else
630  throw cms::Exception("InvalidDetId") << "Wrong dccId = " << dccId << " tower = " << tower
631  << " in EcalElectronicsMapping::dccTowerConstituents.";
632 }
int zside(int dcctcc, int mode) const
EcalSubdetector subdet(int dccid, int mode) const
unsigned dccId(DetId const &, EcalElectronicsMapping const *)
static const int ETAPHIMODE
Definition: EBDetId.h:158
Definition: DetId.h:17
EcalSubdetector

◆ getDCCandSC()

std::pair< int, int > EcalElectronicsMapping::getDCCandSC ( EcalScDetId  id) const

Retrieves the DCC channel that reads the crystals constituting an ECAL supercystal (SC). For standard 5x5 complete SCs, there is a one-to-one matching between DCC channel and SC. For partial SCs, the relation from SC to DCC channel is N-to-N. The 3-2-1 partial SC type has 1 crystal read by a DCC channel and the others read by another DCC channel. If the former crystal is ignored for the DCC channel matching, then the SC-to-DCC channel association is simplified to 1-to-N relation. This method uses this prescription and therefore returns a single DCC channel.

Parameters
idSC identifier
Returns
DCC channel. .first: DCC ID (from 1 to 54); .second: channel within the DCC (from 1 to 68). See http://hepwww.rl.ac.uk/CMSecal/Dee-layout.html, https://twiki.cern.ch/twiki/bin/view/CMS/EcalIndices, and references thereby.

Definition at line 761 of file EcalElectronicsMapping.cc.

References EcalElectronicsId::dccId(), EEDetId::ix(), EcalElectronicsId::towerId(), EEDetId::validDetId(), EEDetId::XYMODE, and ecaldqm::zside().

Referenced by EcalSelectiveReadoutValidation::dccCh(), EcalSelectiveReadoutValidation::dccId(), EcalSelectiveReadout::eeRuInterest(), EcalSelectiveReadout::printDccChMap(), and EcalDigiToRaw::produce().

761  {
762  // pair.first = DCC id
763  // pair.second = DCC_channel
764  // For digi2raw, read the SRflags and write the SR block :
765  // need to find out, for an EcalScDetId, which is the DCC and the DCC_channel
766 
767  std::pair<int, int> ind;
768  EEDetId dum;
769  int ix = id.ix();
770  int iy = id.iy();
771  int zside = id.zside();
772  ix = (ix - 1) * 5 + 1;
773  iy = (iy - 1) * 5 + 1;
774  ix = 5 * (ix / 5) + 1;
775  iy = 5 * (iy / 5) + 1;
776  int ix_c = ix;
777  int iy_c = iy;
778  if (!dum.validDetId(ix_c, iy_c, zside)) {
779  ix_c = ix + 4;
780  iy_c = iy;
781  if (!dum.validDetId(ix_c, iy_c, zside)) {
782  ix_c = ix + 4;
783  iy_c = iy + 4;
784  if (!dum.validDetId(ix_c, iy_c, zside)) {
785  ix_c = ix;
786  iy_c = iy + 4;
787  }
788  }
789  }
790  EEDetId eedetid(ix_c, iy_c, zside, EEDetId::XYMODE);
791  EcalElectronicsId elid = getElectronicsId(eedetid);
792  int Dccid = elid.dccId();
793  int DCC_Channel = elid.towerId();
794  ind.first = Dccid;
795  ind.second = DCC_Channel;
796  return ind;
797 }
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
static const int XYMODE
Definition: EEDetId.h:335
int dccId() const
get the DCC (Ecal Local DCC value not global one) id
int ix() const
Definition: EEDetId.h:77
int zside(int dcctcc, int mode) const
int towerId() const
get the tower id
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.h:248
EcalElectronicsId getElectronicsId(const DetId &id) const
Get the electronics id for this det id.

◆ getDetId() [1/2]

DetId EcalElectronicsMapping::getDetId ( const EcalElectronicsId id) const

Get the detid given an electronicsId.

Definition at line 410 of file EcalElectronicsMapping.cc.

References MillePedeFileConverter_cfg::e, EcalBarrel, EcalEndcap, EBDetId::ETAPHIMODE, Exception, spr::find(), LEDCalibrationChannels::ieta, LEDCalibrationChannels::iphi, digitizers_cfi::strip, l1tHGCalTowerProducer_cfi::tower, and ecaldqm::zside().

Referenced by ecaldqm::binning::channelName(), EcalElectronicsMapper::fillMaps(), ecaldqm::binning::findBinCrystal_(), ecaldqm::binning::findBinSuperCrystal_(), DCCDataUnpacker::getChannelValue(), and EcalDetIdToBeRecoveredProducer::produce().

410  {
411  EcalSubdetector subdet = id.subdet();
412 
413  if (subdet == EcalBarrel) {
414  int dcc = id.dccId();
415  int tower = id.towerId();
416  int strip = id.stripId();
417  int channel = id.xtalId();
418 
419  int smid = 0;
420  int iphi = 0;
421  bool EBPlus = (id.zside() > 0);
422  bool EBMinus = !EBPlus;
423 
424  if (id.zside() < 0) {
425  smid = dcc + 19 - DCCID_PHI0_EBM;
426  iphi = (smid - 19) * kCrystalsInPhi;
427  iphi += 5 * ((tower - 1) % kTowersInPhi);
428  } else {
429  smid = dcc + 1 - DCCID_PHI0_EBP;
430  iphi = (smid - 1) * kCrystalsInPhi;
431  iphi += 5 * (kTowersInPhi - ((tower - 1) % kTowersInPhi) - 1);
432  }
433  bool RightTower = rightTower(tower);
434  int ieta = 5 * ((tower - 1) / kTowersInPhi) + 1;
435  if (RightTower) {
436  ieta += (strip - 1);
437  if (strip % 2 == 1) {
438  if (EBMinus)
439  iphi += (channel - 1) + 1;
440  if (EBPlus)
441  iphi += (4 - (channel - 1)) + 1;
442  } else {
443  if (EBMinus)
444  iphi += (4 - (channel - 1)) + 1;
445  if (EBPlus)
446  iphi += (channel - 1) + 1;
447  }
448  } else {
449  ieta += 4 - (strip - 1);
450  if (strip % 2 == 1) {
451  if (EBMinus)
452  iphi += (4 - (channel - 1)) + 1;
453  if (EBPlus)
454  iphi += (channel - 1) + 1;
455  } else {
456  if (EBMinus)
457  iphi += (channel - 1) + 1;
458  if (EBPlus)
459  iphi += (4 - (channel - 1)) + 1;
460  }
461  }
462  if (id.zside() < 0)
463  ieta = -ieta;
464 
466  return e;
467  }
468 
469  else if (subdet == EcalEndcap) {
470  EcalElectronicsMap_by_ElectronicsId::const_iterator it = get<1>(m_items).find(id);
471  if (it == (get<1>(m_items).end())) {
472  DetId cell(0);
473  edm::LogError("EcalElectronicsMapping") << "Ecal mapping was asked non DetId";
474  return cell;
475  }
476  DetId cell = it->cell;
477  return cell;
478  } else
479  throw cms::Exception("InvalidDetId") << "Wrong EcalElectronicsId in EcalElectronicsMapping::getDetId.";
480 }
Log< level::Error, false > LogError
int zside(int dcctcc, int mode) const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
EcalSubdetector subdet(int dccid, int mode) const
static const int ETAPHIMODE
Definition: EBDetId.h:158
Definition: DetId.h:17
bool rightTower(int tower) const
EcalSubdetector

◆ getDetId() [2/2]

DetId EcalElectronicsMapping::getDetId ( const EcalTriggerElectronicsId id) const

Get the detid given a trigger electronicsId.

Definition at line 512 of file EcalElectronicsMapping.cc.

References EcalBarrel, EcalEndcap, Exception, and spr::find().

512  {
513  EcalSubdetector subdet = id.subdet();
514 
515  if (subdet == EcalBarrel) {
516  const EcalElectronicsId& elid = getElectronicsId(id);
517  DetId cell = getDetId(elid);
518  return cell;
519  } else if (subdet == EcalEndcap) {
520  EcalElectronicsMap_by_TriggerElectronicsId::const_iterator it = get<2>(m_items).find(id);
521  if (it == get<2>(m_items).end()) {
522  DetId cell(0);
523  edm::LogError("EcalElectronicsMapping") << "Ecal mapping was asked non valid DetId";
524  return cell;
525  }
526  DetId cell = it->cell;
527  return cell;
528  } else
529  throw cms::Exception("InvalidDetId") << "Wrong EcalTriggerElectronicsId in EcalElectronicsMapping::getDetId.";
530 }
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
Log< level::Error, false > LogError
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
EcalSubdetector subdet(int dccid, int mode) const
Definition: DetId.h:17
EcalElectronicsId getElectronicsId(const DetId &id) const
Get the electronics id for this det id.
EcalSubdetector
DetId getDetId(const EcalElectronicsId &id) const
Get the detid given an electronicsId.

◆ getEcalScDetId()

std::vector< EcalScDetId > EcalElectronicsMapping::getEcalScDetId ( int  DCCid,
int  DCC_Channel,
bool  ignoreSingleCrystal = true 
) const

builds EcalScDetId's from (DCC, DCC_channel) Most of the time there is only one SC read-out by the DCC channel, but few DCC channels read VPTs coming from two different partial SCs. There are also 4 SCs per endcap whose one crystal is read out by a different DCC channel than the others. In such case, the SC will be assiociated to the DCC channel reading most of the crystals, the DCC channel reading only one crystal being ignored.

Parameters
ignoreSingleCrystal.There are four partial SCs per endcap whose one crystal is read out by a different DCC channel than for the other crystals. If this parameter is true these single crystals will be ignored: if a SC has only one crystal read out by the DCC channel, then the SC will not be included in the returned list. a differentsimplification, SC read out by two different DCC channels
Returns
vector of SCs associated to the DCC channel.

Definition at line 799 of file EcalElectronicsMapping.cc.

References cms::cuda::assert(), gather_cfg::cout, debug, EEDetId::ix(), EEDetId::iy(), and EEDetId::zside().

Referenced by EcalElectronicsMapper::fillMaps(), ecaldqm::StatusManager::readFromStream(), EcalReadoutTools::readOutUnitOf(), PFEcalEndcapRecHitCreator::readOutUnitOf(), and EcalSelectiveReadoutValidation::readOutUnitOf().

801  {
802  //Debug output switch:
803  const bool debug = false;
804 
805  // For unpacking of ST flags.
806  //result: SCs readout by the DCC channel DCC_channel of DCC DCCid.
807  //Vector of 1 or 2 elements: most of the time there is only
808  //one SC read-out by the DCC channel, but for some channels
809  //there are 2 partial SCs which were grouped.
810  std::vector<EcalScDetId> scDetIds;
811 
812  //There are 4 SCs in each endcap whose one crystal is read out
813  //by a different DCC channel than the others.
814  //Number of crystals of the SC read out by the DCC channel:
815  std::vector<int> nReadoutXtals;
816 
817  std::vector<DetId> xtals = dccTowerConstituents(DCCid, DCC_Channel);
818 
819  if (debug) {
820  std::cout << __FILE__ << ":" << __LINE__ << ": " << xtals.size() << " crystals read out by channel " << DCC_Channel
821  << " of DCC " << DCCid << ": ";
822  for (auto xtal : xtals) {
823  std::cout << EEDetId(xtal) << " ";
824  }
825  std::cout << "\n";
826  }
827 
828  if (xtals.empty())
829  throw cms::Exception("InvalidDetId") << "EcalElectronicsMapping : can not create EcalScDetId for DCC " << DCCid
830  << " and DCC_Channel " << DCC_Channel << ".";
831 
832  for (auto xtal : xtals) {
833  EEDetId eedetid = xtal;
834  int ix = eedetid.ix();
835  int iy = eedetid.iy();
836  int iz = eedetid.zside();
837  int ix_SC = (ix - 1) / 5 + 1;
838  int iy_SC = (iy - 1) / 5 + 1;
839  //Supercrystal (SC) the crystal belongs to:
840  EcalScDetId scdetid(ix_SC, iy_SC, iz);
841  size_t iSc = 0;
842  //look if the SC was already included:
843  while (iSc < scDetIds.size() && scDetIds[iSc] != scdetid)
844  ++iSc;
845  if (iSc == scDetIds.size()) { //SC not yet included
846  scDetIds.emplace_back(scdetid);
847  nReadoutXtals.emplace_back(1); //crystal counter of the added SC
848  } else { //SC already included
849  ++nReadoutXtals[iSc]; // counting crystals in the SC
850  }
851  }
852 
853  if (ignoreSingleCrystal) {
854  //For simplification, SC read out by two different DCC channels
855  //will be associated to the DCC channel reading most of the crystals,
856  //the other DCC channel which read only one crystal is discarded.
857  //Discards SC with only one crystal read out by the considered,
858  //DCC channel:
859  assert(scDetIds.size() == nReadoutXtals.size());
860  for (size_t iSc = 0; iSc < scDetIds.size(); /*NOOP*/) {
861  if (nReadoutXtals[iSc] <= 1) {
862  if (debug)
863  std::cout << "EcalElectronicsMapping::getEcalScDetId: Ignore SC " << scDetIds[iSc]
864  << " whose only one channel is read out by "
865  "the DCC channel (DCC "
866  << DCCid << ", ch " << DCC_Channel << ").\n";
867  scDetIds.erase(scDetIds.begin() + iSc);
868  nReadoutXtals.erase(nReadoutXtals.begin() + iSc);
869  } else {
870  ++iSc; //next SC;
871  }
872  }
873  }
874 
875  return scDetIds;
876 }
int DCCid(const EBDetId &id) const
returns the DCC of an EBDetId
int ix() const
Definition: EEDetId.h:77
assert(be >=bs)
std::vector< DetId > dccTowerConstituents(int dccId, int tower) const
Get the constituent detids for this dccId.
#define debug
Definition: HDRShower.cc:19
int zside() const
Definition: EEDetId.h:71
int iy() const
Definition: EEDetId.h:83

◆ getElectronicsId() [1/2]

EcalElectronicsId EcalElectronicsMapping::getElectronicsId ( const DetId id) const

Get the electronics id for this det id.

Definition at line 324 of file EcalElectronicsMapping.cc.

References EcalBarrel, EcalEndcap, Exception, spr::find(), LEDCalibrationChannels::ieta, EBDetId::ietaAbs(), EBDetId::iphi(), LEDCalibrationChannels::iphi, digitizers_cfi::strip, l1tHGCalTowerProducer_cfi::tower, EBDetId::tower(), and ecaldqm::zside().

Referenced by EcalURecHitHists::analyze(), EcalTPGParamBuilder::analyze(), EcalCosmicsHists::analyze(), ecaldqm::binning::channelName(), EcalDccWeightBuilder::dbId(), EcalSelectiveReadoutValidation::dccCh(), TowerBlockFormatter::DigiToRaw(), EcalSelectiveReadout::eeRuInterest(), EcalElectronicsMapper::fillMaps(), EcalDisplaysByEvent::makeHistos(), EcalDigiToRaw::produce(), EcalPedOffset::readDACs(), EcalDigiDisplay::readEBDigis(), EcalPedHists::readEBdigis(), EcalDigiDisplay::readEEDigis(), EcalPedHists::readEEdigis(), EcalReadoutTools::readOutUnitOf(), PFEcalEndcapRecHitCreator::readOutUnitOf(), EcalSelectiveReadoutValidation::readOutUnitOf(), EcalMipGraphs::selectDigi(), EcalDisplaysByEvent::selectDigi(), EcalMipGraphs::selectHits(), and EcalDisplaysByEvent::selectHits().

324  {
325  EcalSubdetector subdet = EcalSubdetector(id.subdetId());
326  if (subdet == EcalBarrel) {
327  const EBDetId ebdetid = EBDetId(id);
328 
329  int dcc = DCCid(ebdetid);
330  bool EBPlus = (zside(dcc, DCCMODE) > 0);
331  bool EBMinus = !EBPlus;
332 
333  EcalTrigTowerDetId trigtower = ebdetid.tower();
334  // int tower = trigtower.iTT();
335  int tower = iTT(trigtower);
336 
337  int ieta = EBDetId(id).ietaAbs();
338  int iphi = EBDetId(id).iphi();
339  int strip(0);
340  int channel(0);
341  bool RightTower = rightTower(tower);
342  if (RightTower) {
343  strip = (ieta - 1) % 5;
344  if (strip % 2 == 0) {
345  if (EBMinus)
346  channel = (iphi - 1) % 5;
347  if (EBPlus)
348  channel = 4 - ((iphi - 1) % 5);
349  } else {
350  if (EBMinus)
351  channel = 4 - ((iphi - 1) % 5);
352  if (EBPlus)
353  channel = (iphi - 1) % 5;
354  }
355  } else {
356  strip = 4 - ((ieta - 1) % 5);
357  if (strip % 2 == 0) {
358  if (EBMinus)
359  channel = 4 - ((iphi - 1) % 5);
360  if (EBPlus)
361  channel = (iphi - 1) % 5;
362  } else {
363  if (EBMinus)
364  channel = (iphi - 1) % 5;
365  if (EBPlus)
366  channel = 4 - ((iphi - 1) % 5);
367  }
368  }
369  strip += 1;
370  channel += 1;
371 
372  EcalElectronicsId elid = EcalElectronicsId(dcc, tower, strip, channel);
373 
374  return elid;
375  } else if (subdet == EcalEndcap) {
376  EcalElectronicsMap_by_DetId::const_iterator it = get<0>(m_items).find(id);
377  if (it == get<0>(m_items).end()) {
378  EcalElectronicsId elid(0);
379  edm::LogError("EcalElectronicsMapping") << "Ecal mapping was asked non valid id";
380  return elid;
381  }
382  EcalElectronicsId elid = it->elid;
383  return elid;
384  } else {
385  throw cms::Exception("InvalidDetId") << " Wrong DetId in EcalElectronicsMapping::getElectronicsId.";
386  }
387 }
int ietaAbs() const
get the absolute value of the crystal ieta
Definition: EBDetId.h:47
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
int iphi() const
get the crystal iphi
Definition: EBDetId.h:51
int DCCid(const EBDetId &id) const
returns the DCC of an EBDetId
Log< level::Error, false > LogError
int zside(int dcctcc, int mode) const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
EcalSubdetector subdet(int dccid, int mode) const
int iTT(const EcalTrigTowerDetId &id) const
returns the index of a Trigger Tower within its TCC.
bool rightTower(int tower) const
EcalTrigTowerDetId tower() const
get the HCAL/trigger iphi of this crystal
Definition: EBDetId.h:57
EcalSubdetector

◆ getElectronicsId() [2/2]

EcalElectronicsId EcalElectronicsMapping::getElectronicsId ( const EcalTriggerElectronicsId id) const

Get the electronics id given a trigger electronicsId.

Definition at line 532 of file EcalElectronicsMapping.cc.

References EcalBarrel, EcalEndcap, Exception, spr::find(), digitizers_cfi::strip, EcalElectronicsId::subdet(), l1tHGCalTowerProducer_cfi::tower, and ecaldqm::zside().

532  {
533  EcalSubdetector subdet = id.subdet();
534 
535  if (subdet == EcalBarrel) {
536  int strip = id.pseudoStripId();
537  int xtal = id.channelId();
538  int tower = id.ttId();
539  int dcc = id.tccId();
540  if (id.zside() < 0) {
542  } else {
544  }
545  EcalElectronicsId elid(dcc, tower, strip, xtal);
546  return elid;
547  } else if (subdet == EcalEndcap) {
548  EcalElectronicsMap_by_TriggerElectronicsId::const_iterator it = get<2>(m_items).find(id);
549  if (it == get<2>(m_items).end()) {
550  EcalElectronicsId elid(0);
551  edm::LogError("EcalElectronicsMapping") << "Ecal mapping was asked non valid id";
552  return elid;
553  }
554  EcalElectronicsId elid = it->elid;
555  return elid;
556  } else
557  throw cms::Exception("InvalidDetId")
558  << "Wrong EcalTriggerElectronicsId in EcalElectronicsMapping::getElectronicsId.";
559 }
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
Log< level::Error, false > LogError
int zside(int dcctcc, int mode) const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
EcalSubdetector subdet(int dccid, int mode) const
EcalSubdetector

◆ GetFED()

int EcalElectronicsMapping::GetFED ( double  eta,
double  phi 
) const

Definition at line 1087 of file EcalElectronicsMapping.cc.

References OccupancyTask_cfi::DCC, PVValHelper::eta, createfilelist::int, and LEDCalibrationChannels::iphi.

Referenced by EcalRegionCabling::elementIndex().

1087  {
1088  // for regional unpacking.
1089  // eta is signed, phi is in degrees.
1090 
1091  int DCC_Phi0 = 0;
1092  bool IsBarrel = true;
1093  if (fabs(eta) > 1.479)
1094  IsBarrel = false;
1095  bool Positive = (eta > 0);
1096 
1097  if (IsBarrel && Positive)
1098  DCC_Phi0 = DCCID_PHI0_EBP;
1099  if (IsBarrel && (!Positive))
1100  DCC_Phi0 = DCCID_PHI0_EBM;
1101  if ((!IsBarrel) && Positive)
1102  DCC_Phi0 = MIN_DCCID_EEP;
1103  if ((!IsBarrel) && (!Positive))
1104  DCC_Phi0 = MIN_DCCID_EEM;
1105 
1106  // phi between 0 and 360 deg :
1107  if (phi < 0)
1108  phi += 360;
1109  if (phi > 360.)
1110  phi = 360.;
1111  if (phi < 0)
1112  phi = 0.;
1113 
1114  if (IsBarrel)
1115  phi = phi - 350;
1116  else
1117  phi = phi - 330;
1118  if (phi < 0)
1119  phi += 360;
1120  int iphi = -1;
1121  if (IsBarrel)
1122  iphi = (int)(phi / 20.);
1123  else
1124  iphi = (int)(phi / 40.);
1125 
1126  // std::cout << " in GetFED : phi iphi DCC0 " << phi << " " << iphi << " " << DCC_Phi0 << std::endl;
1127 
1128  int DCC = iphi + DCC_Phi0;
1129  // std::cout << " eta phi " << eta << " " << " " << phi << " is in FED " << DCC << std::endl;
1130  return DCC;
1131 }

◆ GetListofFEDs() [1/2]

std::vector< int > EcalElectronicsMapping::GetListofFEDs ( const RectangularEtaPhiRegion region) const

Definition at line 940 of file EcalElectronicsMapping.cc.

References RawToDigi_cff::FEDs, and HLT_2023v11_cff::region.

940  {
941  std::vector<int> FEDs;
943  return FEDs;
944 }
std::vector< int > GetListofFEDs(const RectangularEtaPhiRegion &region) const

◆ GetListofFEDs() [2/2]

void EcalElectronicsMapping::GetListofFEDs ( const RectangularEtaPhiRegion region,
std::vector< int > &  FEDs 
) const

Definition at line 945 of file EcalElectronicsMapping.cc.

References gather_cfg::cout, debug, PbPb_ZMuSkimMuonDPG_cff::deltaR, RawToDigi_cff::FEDs, heavyIonCSV_trainingSettings::idx, M_PI, and HLT_2023v11_cff::region.

945  {
946  // for regional unpacking.
947  // get list of FEDs corresponding to a region in (eta,phi)
948 
949  // std::vector<int> FEDs;
950  double radTodeg = 180. / M_PI;
951  ;
952 
953  bool debug = false;
954 
955  double etalow = region.etaLow();
956  double philow = region.phiLow() * radTodeg;
957  if (debug)
958  std::cout << " etalow philow " << etalow << " " << philow << std::endl;
959  int FED_LB = GetFED(etalow, philow); // left, bottom
960 
961  double phihigh = region.phiHigh() * radTodeg;
962  if (debug)
963  std::cout << " etalow phihigh " << etalow << " " << phihigh << std::endl;
964  int FED_LT = GetFED(etalow, phihigh); // left, top
965 
966  int DCC_BoundaryL = DCCBoundary(FED_LB);
967  int deltaL = 18;
968  if (FED_LB < MIN_DCCID_EBM || FED_LB > MAX_DCCID_EBP)
969  deltaL = 9;
970 
971  if (philow < -170 && phihigh > 170) {
972  FED_LB = DCC_BoundaryL;
973  FED_LT = DCC_BoundaryL + deltaL - 1;
974  }
975  if (debug)
976  std::cout << " FED_LB FED_LT " << FED_LB << " " << FED_LT << std::endl;
977 
978  bool dummy = true;
979  int idx = 0;
980  while (dummy) {
981  int iL = (FED_LB - DCC_BoundaryL + idx) % deltaL + DCC_BoundaryL;
982  FEDs.emplace_back(iL);
983  if (debug)
984  std::cout << " add fed " << iL << std::endl;
985  if (iL == FED_LT)
986  break;
987  idx++;
988  }
989 
990  double etahigh = region.etaHigh();
991  int FED_RB = GetFED(etahigh, philow); // right, bottom
992  if (FED_RB == FED_LB)
993  return; // FEDs;
994 
995  int FED_RT = GetFED(etahigh, phihigh); // right, top
996 
997  if (debug)
998  std::cout << "etahigh philow phihigh " << etahigh << " " << philow << " " << phihigh << std::endl;
999  int DCC_BoundaryR = DCCBoundary(FED_RB);
1000  int deltaR = 18;
1001  if (FED_RB < MIN_DCCID_EBM || FED_RB > MAX_DCCID_EBP)
1002  deltaR = 9;
1003 
1004  if (philow < -170 && phihigh > 170) {
1005  FED_RB = DCC_BoundaryR;
1006  FED_RT = DCC_BoundaryR + deltaR - 1;
1007  }
1008  if (debug)
1009  std::cout << " FED_RB FED_RT " << FED_RB << " " << FED_RT << std::endl;
1010  idx = 0;
1011  while (dummy) {
1012  int iR = (FED_RB - DCC_BoundaryR + idx) % deltaR + DCC_BoundaryR;
1013  FEDs.emplace_back(iR);
1014  if (debug)
1015  std::cout << " add fed " << iR << std::endl;
1016  if (iR == FED_RT)
1017  break;
1018  idx++;
1019  }
1020 
1021  if (FED_LB >= MIN_DCCID_EBM && FED_LB <= MAX_DCCID_EBM && FED_RB >= MIN_DCCID_EEP && FED_RB <= MAX_DCCID_EEP) {
1022  int minR = FED_LB + 18;
1023  int maxR = FED_LT + 18;
1024  int idx = 0;
1025  while (dummy) {
1026  int iR = (minR - MIN_DCCID_EBP + idx) % 18 + MIN_DCCID_EBP;
1027  FEDs.emplace_back(iR);
1028  if (debug)
1029  std::cout << " add fed " << iR << std::endl;
1030  if (iR == maxR)
1031  break;
1032  idx++;
1033  }
1034  return; // FEDs;
1035  }
1036 
1037  if (FED_LB >= MIN_DCCID_EEM && FED_LB <= MAX_DCCID_EEM && FED_RB >= MIN_DCCID_EBP && FED_RB <= MAX_DCCID_EBP) {
1038  int minL = FED_RB - 18;
1039  int maxL = FED_RT - 18;
1040  int idx = 0;
1041  while (dummy) {
1042  int iL = (minL - MIN_DCCID_EBM + idx) % 18 + MIN_DCCID_EBM;
1043  FEDs.emplace_back(iL);
1044  if (debug)
1045  std::cout << " add fed " << iL << std::endl;
1046  if (iL == maxL)
1047  break;
1048  idx++;
1049  }
1050  return; // FEDs;
1051  }
1052 
1053  if (FED_LB >= MIN_DCCID_EEM && FED_LB <= MAX_DCCID_EEM && FED_RB >= MIN_DCCID_EEP && FED_RB <= MAX_DCCID_EEP) {
1054  int minL = (FED_LB - 1) * 2 + MIN_DCCID_EBM;
1055  if (minL == MIN_DCCID_EBM)
1056  minL = MAX_DCCID_EBM;
1057  else
1058  minL = minL - 1;
1059  int maxL = (FED_LT - 1) * 2 + MIN_DCCID_EBM;
1060  int idx = 0;
1061  while (dummy) {
1062  int iL = (minL - MIN_DCCID_EBM + idx) % 18 + MIN_DCCID_EBM;
1063  FEDs.emplace_back(iL);
1064  if (debug)
1065  std::cout << " add fed " << iL << std::endl;
1066  if (iL == maxL)
1067  break;
1068  idx++;
1069  }
1070  int minR = minL + 18;
1071  int maxR = maxL + 18;
1072  idx = 0;
1073  while (dummy) {
1074  int iR = (minR - MIN_DCCID_EBP + idx) % 18 + MIN_DCCID_EBP;
1075  FEDs.emplace_back(iR);
1076  if (debug)
1077  std::cout << " add fed " << iR << std::endl;
1078  if (iR == maxR)
1079  break;
1080  idx++;
1081  }
1082  }
1083 
1084  return; // FEDs;
1085 }
int GetFED(double eta, double phi) const
#define M_PI
#define debug
Definition: HDRShower.cc:19

◆ getLMNumber()

int EcalElectronicsMapping::getLMNumber ( const DetId id) const

Definition at line 1133 of file EcalElectronicsMapping.cc.

References EcalElectronicsId::dccId(), EcalBarrel, EcalEndcap, Exception, EBDetId::ietaSM(), EBDetId::iphiSM(), and EEDetId::ix().

Referenced by EcalCosmicsHists::analyze().

1133  {
1134  // Laser Monitoring readout number.
1135 
1136  EcalSubdetector subdet = EcalSubdetector(id.subdetId());
1137 
1138  if (subdet == EcalBarrel) {
1139  const EBDetId ebdetid = EBDetId(id);
1140  int dccid = DCCid(ebdetid);
1141  std::map<int, int>::const_iterator it = LaserMonitoringMap_EB.find(dccid);
1142  if (it != LaserMonitoringMap_EB.end()) {
1143  int ilm = it->second;
1144  int iETA = ebdetid.ietaSM();
1145  int iPHI = ebdetid.iphiSM();
1146  if (iPHI > 10 && iETA > 5) {
1147  ilm++;
1148  };
1149  return ilm;
1150  } else
1151  throw cms::Exception("InvalidDCCId") << "Wrong DCCId (EB) in EcalElectronicsMapping::getLMNumber.";
1152  }
1153 
1154  else if (subdet == EcalEndcap) {
1156  int dccid = elid.dccId();
1157  EEDetId eedetid = EEDetId(id);
1158  std::map<int, int>::const_iterator it = LaserMonitoringMap_EE.find(dccid);
1159  if (it != LaserMonitoringMap_EB.end()) {
1160  int ilm = it->second;
1161  if (dccid == 8) {
1162  int ix = eedetid.ix();
1163  if (ix > 50)
1164  ilm += 1;
1165  }
1166  if (dccid == 53) {
1167  int ix = eedetid.ix();
1168  if (ix > 50)
1169  ilm += 1;
1170  }
1171  return ilm;
1172  } else
1173  throw cms::Exception("InvalidDCCId") << "Wrong DCCId (EE) in EcalElectronicsMapping::getLMNumber.";
1174  }
1175 
1176  return -1;
1177 }
std::map< int, int > LaserMonitoringMap_EB
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
int DCCid(const EBDetId &id) const
returns the DCC of an EBDetId
int dccId() const
get the DCC (Ecal Local DCC value not global one) id
int ix() const
Definition: EEDetId.h:77
EcalSubdetector subdet(int dccid, int mode) const
std::map< int, int > LaserMonitoringMap_EE
EcalElectronicsId getElectronicsId(const DetId &id) const
Get the electronics id for this det id.
int iphiSM() const
get the crystal iphi (1-20)
Definition: EBDetId.h:73
EcalSubdetector
int ietaSM() const
get the crystal ieta in the SM convention (1-85)
Definition: EBDetId.h:71

◆ getTriggerElectronicsId() [1/2]

EcalTriggerElectronicsId EcalElectronicsMapping::getTriggerElectronicsId ( const DetId id) const

Get the trigger electronics id for this det id.

Definition at line 389 of file EcalElectronicsMapping.cc.

References EcalBarrel, EcalEndcap, Exception, and spr::find().

Referenced by EcalTPGParamBuilder::analyze(), ecaldqm::binning::channelName(), EcalElectronicsMapper::fillMaps(), EcalTrigPrimFunctionalAlgo::findStripNr(), EcalFenixStrip::process(), and EcalEBTrigPrimTestAlgo::run().

389  {
390  EcalSubdetector subdet = EcalSubdetector(id.subdetId());
391 
392  if (subdet == EcalBarrel) {
393  const EcalElectronicsId& elid = getElectronicsId(id);
395  return trelid;
396  } else if (subdet == EcalEndcap) {
397  EcalElectronicsMap_by_DetId::const_iterator it = get<0>(m_items).find(id);
398  if (it == get<0>(m_items).end()) {
399  EcalTriggerElectronicsId trelid(0);
400  edm::LogError("EcalElectronicsMapping") << "Ecal mapping was asked non valid trig id";
401  return trelid;
402  }
403  EcalTriggerElectronicsId trelid = it->trelid;
404  return trelid;
405  } else {
406  throw cms::Exception("InvalidDetId") << " Wrong DetId in EcalElectronicsMapping::getTriggerElectronicsId.";
407  }
408 }
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
EcalTriggerElectronicsId getTriggerElectronicsId(const DetId &id) const
Get the trigger electronics id for this det id.
Log< level::Error, false > LogError
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
EcalSubdetector subdet(int dccid, int mode) const
EcalElectronicsId getElectronicsId(const DetId &id) const
Get the electronics id for this det id.
EcalSubdetector
Ecal trigger electronics identification [32:20] Unused (so far) [19:13] TCC id [12:6] TT id [5:3] pse...

◆ getTriggerElectronicsId() [2/2]

EcalTriggerElectronicsId EcalElectronicsMapping::getTriggerElectronicsId ( const EcalElectronicsId id) const

Get the trigger electronics id given an electronicsId.

Definition at line 482 of file EcalElectronicsMapping.cc.

References EcalBarrel, EcalEndcap, Exception, spr::find(), digitizers_cfi::strip, EcalTriggerElectronicsId::subdet(), l1tHGCalTowerProducer_cfi::tower, and ecaldqm::zside().

482  {
483  EcalSubdetector subdet = id.subdet();
484 
485  if (subdet == EcalBarrel) {
486  int strip = id.stripId();
487  int xtal = id.xtalId();
488  int tower = id.towerId();
489  int tcc = id.dccId();
490  if (id.zside() < 0) {
492  } else {
494  }
495  EcalTriggerElectronicsId trelid(tcc, tower, strip, xtal);
496  return trelid;
497 
498  } else if (subdet == EcalEndcap) {
499  EcalElectronicsMap_by_ElectronicsId::const_iterator it = get<1>(m_items).find(id);
500  if (it == get<1>(m_items).end()) {
501  EcalTriggerElectronicsId trelid(0);
502  edm::LogError("EcalElectronicsMapping") << "Ecal mapping was asked non valid id";
503  return trelid;
504  }
505  EcalTriggerElectronicsId trelid = it->trelid;
506  return trelid;
507  } else
508  throw cms::Exception("InvalidDetId")
509  << "Wrong EcalElectronicsId in EcalElectronicsMapping::getTriggerElectronicsId.";
510 }
Log< level::Error, false > LogError
int zside(int dcctcc, int mode) const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
EcalSubdetector subdet(int dccid, int mode) const
EcalSubdetector
Ecal trigger electronics identification [32:20] Unused (so far) [19:13] TCC id [12:6] TT id [5:3] pse...

◆ getTrigTowerDetId()

EcalTrigTowerDetId EcalElectronicsMapping::getTrigTowerDetId ( int  TCCid,
int  iTT 
) const

Builds a EcalTrigTowerDetID from the TCCid & TriggerTower index in TCC.

Definition at line 240 of file EcalElectronicsMapping.cc.

References funct::abs(), EcalBarrel, EcalEndcap, Exception, LEDCalibrationChannels::ieta, SurfaceOrientation::inner, LEDCalibrationChannels::iphi, SurfaceOrientation::outer, EcalTrigTowerDetId::SUBDETIJMODE, and ecaldqm::zside().

Referenced by ecaldqm::binning::channelName(), EcalElectronicsMapper::fillMaps(), and L1CaloEcalScaleConfigOnlineProd::newObject().

240  {
241  // needed for unpacking code.
242 
244  int zIndex = zside(TCCid, TCCMODE);
245 
246  if (sub == EcalBarrel) {
247  int DCCid = 0;
248  int jtower = iTT - 1;
249  if (zIndex > 0)
251  else
253  int SMid = (zIndex > 0) ? DCCid - 27 : DCCid + 9;
254 
255  int etaTT = jtower / kTowersInPhi + 1; // between 1 and 17
256  int phiTT;
257 
258  if (zIndex > 0)
259  phiTT = (SMid - 1) * kTowersInPhi + (kTowersInPhi - (jtower % kTowersInPhi)) - 1;
260  else
261  phiTT = (SMid - 19) * kTowersInPhi + jtower % kTowersInPhi;
262  phiTT++;
263  phiTT = phiTT - 2;
264  if (phiTT <= 0)
265  phiTT = 72 + phiTT;
266  EcalTrigTowerDetId tdetid(zIndex, EcalBarrel, etaTT, phiTT, EcalTrigTowerDetId::SUBDETIJMODE);
267  return tdetid;
268  }
269 
270  else if (sub == EcalEndcap) {
271  bool EEminus = (zIndex < 0);
272  bool EEplus = (zIndex > 0);
273  if ((!EEminus) && (!EEplus))
274  throw cms::Exception("InvalidDetId") << "EcalElectronicsMapping: Cannot create EcalTrigTowerDetId object. ";
275  int iz = 0;
276  int tcc = TCCid;
277  if (tcc < TCCID_PHI0_EEM_OUT + kTCCinPhi)
278  iz = -1;
279  else if (tcc >= TCCID_PHI0_EEP_OUT)
280  iz = +1;
281 
282  bool inner = false;
283  if (iz < 0 && tcc >= TCCID_PHI0_EEM_IN && tcc < TCCID_PHI0_EEM_IN + kTCCinPhi)
284  inner = true;
285  if (iz > 0 && tcc >= TCCID_PHI0_EEP_IN && tcc < TCCID_PHI0_EEP_IN + kTCCinPhi)
286  inner = true;
287  bool outer = !inner;
288 
289  int ieta = (iTT - 1) / kEETowersInPhiPerTCC;
290  int iphi = (iTT - 1) % kEETowersInPhiPerTCC;
291  if (inner)
292  ieta += iEEEtaMinInner;
293  else
294  ieta += iEEEtaMinOuter;
295  if (iz < 0)
296  ieta = -ieta;
297 
298  int TCC_origin = 0;
299  if (inner && iz < 0)
300  TCC_origin = TCCID_PHI0_EEM_IN;
301  if (outer && iz < 0)
302  TCC_origin = TCCID_PHI0_EEM_OUT;
303  if (inner && iz > 0)
304  TCC_origin = TCCID_PHI0_EEP_IN;
305  if (outer && iz > 0)
306  TCC_origin = TCCID_PHI0_EEP_OUT;
307  tcc = tcc - TCC_origin;
308 
309  iphi += kEETowersInPhiPerTCC * tcc;
311 
312  int tower_i = abs(ieta);
313  int tower_j = iphi;
314 
315  EcalTrigTowerDetId tdetid(zIndex, EcalEndcap, tower_i, tower_j, EcalTrigTowerDetId::SUBDETIJMODE);
316  return tdetid;
317 
318  } else {
319  throw cms::Exception("InvalidDetId") << " Wrong indices in EcalElectronicsMapping::getTrigTowerDetId. TCCid = "
320  << TCCid << " iTT = " << iTT << ".";
321  }
322 }
static const int TCCID_PHI0_EEP_IN
int DCCid(const EBDetId &id) const
returns the DCC of an EBDetId
static const int SUBDETIJMODE
int TCCid(const EBDetId &id) const
returns the TCCid of an EBDetId
static const int TCCID_PHI0_EEM_OUT
int zside(int dcctcc, int mode) const
EcalSubdetector subdet(int dccid, int mode) const
static const int TCCID_PHI0_EEM_IN
static const int kEETowersInPhiPerQuadrant
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static const int kEETowersInPhiPerTCC
static const int TCCID_PHI0_EEP_OUT
int iTT(const EcalTrigTowerDetId &id) const
returns the index of a Trigger Tower within its TCC.
EcalSubdetector

◆ iTT()

int EcalElectronicsMapping::iTT ( const EcalTrigTowerDetId id) const

returns the index of a Trigger Tower within its TCC.

Definition at line 102 of file EcalElectronicsMapping.cc.

References EcalBarrel, EcalEndcap, Exception, SurfaceOrientation::inner, and ecaldqm::zside().

Referenced by EcalTPGParamBuilder::analyze(), TCCBlockFormatter::DigiToRaw(), and EcalDigiToRaw::produce().

108 {
109  if (id.subDet() == EcalBarrel) {
110  int ie = id.ietaAbs() - 1;
111  int ip;
112  int phi = id.iphi();
113  phi += 2;
114  if (phi > 72)
115  phi = phi - 72;
116  if (id.zside() < 0) {
117  ip = ((phi - 1) % kEBTowersInPhi) + 1;
118  } else {
119  ip = kEBTowersInPhi - ((phi - 1) % kEBTowersInPhi);
120  }
121 
122  return (ie * kEBTowersInPhi) + ip;
123  } else if (id.subDet() == EcalEndcap) {
124  int ie = id.ietaAbs();
125  bool inner = (ie >= iEEEtaMinInner);
126  if (inner) {
127  ie = ie - iEEEtaMinInner;
128  ie = ie % kEETowersInEtaPerInnerTCC;
129  } else {
130  ie = ie - iEEEtaMinOuter;
131  ie = ie % kEETowersInEtaPerOuterTCC;
132  }
133 
134  int ip = id.iphi();
135  ip = (ip + 1) % (kEETowersInPhiPerQuadrant * 4);
136  // now iphi between 0 and 71,
137  // with iphi=0,1,2,3 in 1st Phi sector
138  ip = ip % kEETowersInPhiPerTCC;
139  int itt = kEETowersInPhiPerTCC * ie + ip + 1;
140  return itt;
141  } else {
142  throw cms::Exception("InvalidDetId") << " Wrong EcalTrigTowerDetId in EcalElectronicsMapping::iTT. ";
143  return 0;
144  }
145 }
static const int kEETowersInEtaPerOuterTCC
int zside(int dcctcc, int mode) const
static const int kEETowersInEtaPerInnerTCC
static const int kEETowersInPhiPerQuadrant
static const int kEETowersInPhiPerTCC

◆ pseudoStripConstituents()

std::vector< DetId > EcalElectronicsMapping::pseudoStripConstituents ( int  tccId,
int  tt,
int  pseudostrip 
) const

Get the constituent detids for this dccId.

Definition at line 730 of file EcalElectronicsMapping.cc.

References ecaldqm::dccId(), EcalBarrel, mps_monitormerge::items, ecaldqm::tccId(), and ecaldqm::zside().

Referenced by ecaldqm::MESetDet2D::fill().

730  {
732  std::vector<DetId> items;
733 
734  if (sub == EcalBarrel) {
735  int iz = zside(tccId, TCCMODE);
736  int dccId = tccId;
737  if (iz > 0)
739  else
741  items = stripConstituents(dccId, tt, pseudostrip);
742  return items;
743  } else {
744  EcalElectronicsMap_by_TccId_TtId_and_PseudostripId::const_iterator lb, ub;
745  boost::tuples::tie(lb, ub) = get<8>(m_items).equal_range(boost::make_tuple(int(tccId), int(tt), int(pseudostrip)));
746  while (lb != ub) {
747  DetId cell = lb->cell;
748  items.emplace_back(cell);
749  ++lb;
750  }
751  return items;
752  }
753 }
int zside(int dcctcc, int mode) const
EcalSubdetector subdet(int dccid, int mode) const
Definition: TTTypes.h:54
unsigned dccId(DetId const &, EcalElectronicsMapping const *)
Definition: DetId.h:17
unsigned tccId(DetId const &, EcalElectronicsMapping const *)
EcalSubdetector
std::vector< DetId > stripConstituents(int dccId, int tower, int strip) const
Get the constituent detids for this dccId.

◆ rightTower()

bool EcalElectronicsMapping::rightTower ( int  tower) const

Definition at line 918 of file EcalElectronicsMapping.cc.

References l1tHGCalTowerProducer_cfi::tower.

918  {
919  // for EB, two types of tower (LVRB top/bottom)
920 
921  if ((tower > 12 && tower < 21) || (tower > 28 && tower < 37) || (tower > 44 && tower < 53) ||
922  (tower > 60 && tower < 69))
923  return true;
924  else
925  return false;
926 }

◆ stripConstituents()

std::vector< DetId > EcalElectronicsMapping::stripConstituents ( int  dccId,
int  tower,
int  strip 
) const

Get the constituent detids for this dccId.

Definition at line 634 of file EcalElectronicsMapping.cc.

References ecaldqm::dccId(), EcalBarrel, EBDetId::ETAPHIMODE, LEDCalibrationChannels::ieta, LEDCalibrationChannels::iphi, mps_monitormerge::items, digitizers_cfi::strip, l1tHGCalTowerProducer_cfi::tower, and ecaldqm::zside().

634  {
636  std::vector<DetId> items;
637 
638  if (sub == EcalBarrel) {
639  int iz = zside(dccId, DCCMODE);
640  bool RightTower = rightTower(tower);
641  int smid = 0;
642  int iphi = 0;
643  if (iz < 0) {
644  smid = dccId + 19 - DCCID_PHI0_EBM;
645  iphi = (smid - 19) * kCrystalsInPhi;
646  iphi += 5 * ((tower - 1) % kTowersInPhi);
647  } else {
648  smid = dccId + 1 - DCCID_PHI0_EBP;
649  iphi = (smid - 1) * kCrystalsInPhi;
650  iphi += 5 * (kTowersInPhi - ((tower - 1) % kTowersInPhi) - 1);
651  }
652  int ieta = 5 * ((tower - 1) / kTowersInPhi) + 1;
653  if (RightTower) {
654  ieta += (strip - 1);
655  } else {
656  ieta += 4 - (strip - 1);
657  }
658  for (int ip = 1; ip <= 5; ip++) {
659  int ieta_xtal = ieta;
660  int iphi_xtal = iphi + ip;
661  if (iz < 0)
662  ieta_xtal = -ieta_xtal;
663  EBDetId ebdetid(ieta_xtal, iphi_xtal, EBDetId::ETAPHIMODE);
664  items.emplace_back(ebdetid);
665  }
666 
667  return items;
668  } else {
669  EcalElectronicsMap_by_DccId_TowerId_and_StripId::const_iterator lb, ub;
670  boost::tuples::tie(lb, ub) = get<5>(m_items).equal_range(boost::make_tuple(int(dccId), int(tower), int(strip)));
671  while (lb != ub) {
672  DetId cell = lb->cell;
673  items.emplace_back(cell);
674  ++lb;
675  }
676  return items;
677  }
678 }
int zside(int dcctcc, int mode) const
EcalSubdetector subdet(int dccid, int mode) const
unsigned dccId(DetId const &, EcalElectronicsMapping const *)
static const int ETAPHIMODE
Definition: EBDetId.h:158
Definition: DetId.h:17
bool rightTower(int tower) const
EcalSubdetector

◆ subdet()

EcalSubdetector EcalElectronicsMapping::subdet ( int  dccid,
int  mode 
) const

Definition at line 878 of file EcalElectronicsMapping.cc.

References EcalBarrel, EcalEndcap, Exception, and ALCARECOPromptCalibProdSiPixelAli0T_cff::mode.

878  {
879  if (mode == DCCMODE) {
880  if ((dcctcc >= MIN_DCCID_EBM && dcctcc <= MAX_DCCID_EBM) || (dcctcc >= MIN_DCCID_EBP && dcctcc <= MAX_DCCID_EBP))
881  return EcalBarrel;
882  else
883  return EcalEndcap;
884  } else if (mode == TCCMODE) {
885  if ((dcctcc >= MIN_TCCID_EBM && dcctcc <= MAX_TCCID_EBM) || (dcctcc >= MIN_TCCID_EBP && dcctcc <= MAX_TCCID_EBP))
886  return EcalBarrel;
887  else
888  return EcalEndcap;
889  } else
890  throw cms::Exception("InvalidDetId") << " Wrong mode in EcalElectronicsMapping::subdet " << mode << ".";
891 }

◆ tccConstituents()

std::vector< DetId > EcalElectronicsMapping::tccConstituents ( int  tccId) const

Get the constituent detids for this dccId.

Definition at line 680 of file EcalElectronicsMapping.cc.

References ecaldqm::dccId(), EcalBarrel, mps_monitormerge::items, ecaldqm::tccId(), and ecaldqm::zside().

Referenced by EcalElectronicsMapper::fillMaps().

680  {
682  std::vector<DetId> items;
683 
684  if (sub == EcalBarrel) {
685  int iz = zside(tccId, TCCMODE);
686  int dccId = tccId;
687  if (iz > 0)
689  else
692  return items;
693  } else {
694  EcalElectronicsMap_by_TccId::const_iterator lb, ub;
695  boost::tuples::tie(lb, ub) = get<6>(m_items).equal_range(tccId);
696  while (lb != ub) {
697  DetId cell = lb->cell;
698  items.emplace_back(cell);
699  ++lb;
700  }
701  return items;
702  }
703 }
int zside(int dcctcc, int mode) const
EcalSubdetector subdet(int dccid, int mode) const
std::vector< DetId > dccConstituents(int dccId) const
Get the constituent detids for this dccId.
unsigned dccId(DetId const &, EcalElectronicsMapping const *)
Definition: DetId.h:17
unsigned tccId(DetId const &, EcalElectronicsMapping const *)
EcalSubdetector

◆ TCCid() [1/2]

int EcalElectronicsMapping::TCCid ( const EBDetId id) const

returns the TCCid of an EBDetId

Definition at line 86 of file EcalElectronicsMapping.cc.

References ecaldqm::zside().

Referenced by EcalTPGParamBuilder::analyze(), and TCCBlockFormatter::DigiToRaw().

92 {
93  int tcc = id.ism();
94  if (id.zside() < 0) {
95  tcc += TCCID_PHI0_EBM - 19;
96  } else {
97  tcc += TCCID_PHI0_EBP - 1;
98  }
99  return tcc;
100 }
int zside(int dcctcc, int mode) const

◆ TCCid() [2/2]

int EcalElectronicsMapping::TCCid ( const EcalTrigTowerDetId id) const

returns the TCCid of a Trigger Tower

Definition at line 147 of file EcalElectronicsMapping.cc.

References EcalBarrel, EcalEndcap, Exception, LEDCalibrationChannels::ieta, SurfaceOrientation::inner, and ecaldqm::zside().

147  {
148  if (id.subDet() == EcalBarrel) {
149  int phi = id.iphi() + 2;
150  if (phi > 72)
151  phi = phi - 72;
152  int tcc = (phi - 1) / kEBTowersInPhi + 1;
153  if (id.zside() < 0)
154  tcc += 18; // now id is the SMid
155  if (id.zside() < 0) {
156  tcc += TCCID_PHI0_EBM - 19;
157  } else {
158  tcc += TCCID_PHI0_EBP - 1;
159  }
160  return tcc;
161  }
162 
163  else if (id.subDet() == EcalEndcap) {
164  int ie = id.ietaAbs();
165  bool inner = (ie >= iEEEtaMinInner);
166  int ip = id.iphi(); // iphi = 1 corresponds to 0 < phi < 5 degrees
167  ip = (ip + 1) % (kEETowersInPhiPerQuadrant * 4);
168  // now iphi between 0 and 71,
169  // with iphi=0,1,2,3 in 1st Phi sector
170  int Phiindex = ip / 4;
171  if (inner) {
172  if (id.ieta() > 0)
173  Phiindex += TCCID_PHI0_EEP_IN;
174  else
175  Phiindex += TCCID_PHI0_EEM_IN;
176  } else {
177  if (id.ieta() > 0)
178  Phiindex += TCCID_PHI0_EEP_OUT;
179  else
180  Phiindex += TCCID_PHI0_EEM_OUT;
181  }
182  return Phiindex;
183  } else {
184  throw cms::Exception("InvalidDetId") << " Wrong EcalTrigTowerDetId in EcalElectronicsMapping::TCCid.";
185  return 0;
186  }
187 }
static const int TCCID_PHI0_EEP_IN
static const int TCCID_PHI0_EEM_OUT
int zside(int dcctcc, int mode) const
static const int TCCID_PHI0_EEM_IN
static const int kEETowersInPhiPerQuadrant
static const int TCCID_PHI0_EEP_OUT

◆ ttConstituents()

std::vector< DetId > EcalElectronicsMapping::ttConstituents ( int  tccId,
int  tt 
) const

Get the constituent detids for this dccId.

Definition at line 705 of file EcalElectronicsMapping.cc.

References ecaldqm::dccId(), EcalBarrel, mps_monitormerge::items, ecaldqm::tccId(), and ecaldqm::zside().

705  {
707  std::vector<DetId> items;
708 
709  if (sub == EcalBarrel) {
710  int iz = zside(tccId, TCCMODE);
711  int dccId = tccId;
712  if (iz > 0)
714  else
717  return items;
718  } else {
719  EcalElectronicsMap_by_TccId_and_TtId::const_iterator lb, ub;
720  boost::tuples::tie(lb, ub) = get<7>(m_items).equal_range(boost::make_tuple(int(tccId), int(tt)));
721  while (lb != ub) {
722  DetId cell = lb->cell;
723  items.emplace_back(cell);
724  ++lb;
725  }
726  return items;
727  }
728 }
int zside(int dcctcc, int mode) const
EcalSubdetector subdet(int dccid, int mode) const
Definition: TTTypes.h:54
unsigned dccId(DetId const &, EcalElectronicsMapping const *)
std::vector< DetId > dccTowerConstituents(int dccId, int tower) const
Get the constituent detids for this dccId.
Definition: DetId.h:17
unsigned tccId(DetId const &, EcalElectronicsMapping const *)
EcalSubdetector

◆ zside()

int EcalElectronicsMapping::zside ( int  dcctcc,
int  mode 
) const

Definition at line 893 of file EcalElectronicsMapping.cc.

References Exception, and ALCARECOPromptCalibProdSiPixelAli0T_cff::mode.

893  {
894  if (mode == DCCMODE) {
895  if (dcctcc >= MIN_DCCID_EBM && dcctcc <= MAX_DCCID_EBM)
896  return -1;
897  if (dcctcc >= MIN_DCCID_EBP && dcctcc <= MAX_DCCID_EBP)
898  return +1;
899  if (dcctcc >= MIN_DCCID_EEM && dcctcc <= MAX_DCCID_EEM)
900  return -1;
901  if (dcctcc >= MIN_DCCID_EEP && dcctcc <= MAX_DCCID_EEP)
902  return +1;
903  } else if (mode == TCCMODE) {
904  if (dcctcc >= MIN_TCCID_EBM && dcctcc <= MAX_TCCID_EBM)
905  return -1;
906  if (dcctcc >= MIN_TCCID_EBP && dcctcc <= MAX_TCCID_EBP)
907  return +1;
908  if (dcctcc >= MIN_TCCID_EEM && dcctcc <= MAX_TCCID_EEM)
909  return -1;
910  if (dcctcc >= MIN_TCCID_EEP && dcctcc <= MAX_TCCID_EEP)
911  return +1;
912  } else {
913  throw cms::Exception("InvalidDetId") << " Wrong mode in EcalElectronicsMapping::zside " << mode << ".";
914  }
915  return 0;
916 }

Member Data Documentation

◆ DCCID_PHI0_EBM

const int EcalElectronicsMapping::DCCID_PHI0_EBM = EcalElectronicsId::DCCID_PHI0_EBM
static

Definition at line 165 of file EcalElectronicsMapping.h.

◆ DCCID_PHI0_EBP

const int EcalElectronicsMapping::DCCID_PHI0_EBP = EcalElectronicsId::DCCID_PHI0_EBP
static

Definition at line 166 of file EcalElectronicsMapping.h.

◆ DCCMODE

const int EcalElectronicsMapping::DCCMODE = 0
staticprivate

Definition at line 198 of file EcalElectronicsMapping.h.

◆ iEEEtaMinInner

const int EcalElectronicsMapping::iEEEtaMinInner = 22
static

Definition at line 151 of file EcalElectronicsMapping.h.

◆ iEEEtaMinOuter

const int EcalElectronicsMapping::iEEEtaMinOuter = 18
static

Definition at line 150 of file EcalElectronicsMapping.h.

◆ kCrystalsInPhi

const int EcalElectronicsMapping::kCrystalsInPhi = EBDetId::kCrystalsInPhi
static

Definition at line 136 of file EcalElectronicsMapping.h.

◆ kEBTowersInEta

const int EcalElectronicsMapping::kEBTowersInEta = EcalTrigTowerDetId::kEBTowersInEta
static

Definition at line 143 of file EcalElectronicsMapping.h.

◆ kEBTowersInPhi

const int EcalElectronicsMapping::kEBTowersInPhi = EcalTrigTowerDetId::kEBTowersInPhi
static

Definition at line 141 of file EcalElectronicsMapping.h.

◆ kEBTowersPerSM

const int EcalElectronicsMapping::kEBTowersPerSM = EcalTrigTowerDetId::kEBTowersPerSM
static

Definition at line 142 of file EcalElectronicsMapping.h.

◆ kEETowersInEta

const int EcalElectronicsMapping::kEETowersInEta = EcalTrigTowerDetId::kEETowersInEta
static

Definition at line 144 of file EcalElectronicsMapping.h.

◆ kEETowersInEtaPerInnerTCC

const int EcalElectronicsMapping::kEETowersInEtaPerInnerTCC = 7
static

Definition at line 148 of file EcalElectronicsMapping.h.

◆ kEETowersInEtaPerOuterTCC

const int EcalElectronicsMapping::kEETowersInEtaPerOuterTCC = 4
static

Definition at line 149 of file EcalElectronicsMapping.h.

◆ kEETowersInPhiPerQuadrant

const int EcalElectronicsMapping::kEETowersInPhiPerQuadrant = EcalTrigTowerDetId::kEETowersInPhiPerQuadrant
static

Definition at line 145 of file EcalElectronicsMapping.h.

◆ kEETowersInPhiPerTCC

const int EcalElectronicsMapping::kEETowersInPhiPerTCC = 4
static

Definition at line 147 of file EcalElectronicsMapping.h.

◆ kTCCinPhi

const int EcalElectronicsMapping::kTCCinPhi = 18
static

Definition at line 188 of file EcalElectronicsMapping.h.

◆ kTowersInPhi

const int EcalElectronicsMapping::kTowersInPhi = EBDetId::kTowersInPhi
static

Definition at line 137 of file EcalElectronicsMapping.h.

◆ LaserMonitoringMap_EB

std::map<int, int> EcalElectronicsMapping::LaserMonitoringMap_EB
private

Definition at line 275 of file EcalElectronicsMapping.h.

◆ LaserMonitoringMap_EE

std::map<int, int> EcalElectronicsMapping::LaserMonitoringMap_EE
private

Definition at line 276 of file EcalElectronicsMapping.h.

◆ m_items

EcalElectronicsMap EcalElectronicsMapping::m_items
private

Definition at line 269 of file EcalElectronicsMapping.h.

◆ MAX_DCCID

const int EcalElectronicsMapping::MAX_DCCID = EcalElectronicsId::MAX_DCCID
static

Definition at line 154 of file EcalElectronicsMapping.h.

◆ MAX_DCCID_EBM

const int EcalElectronicsMapping::MAX_DCCID_EBM = EcalElectronicsId::MAX_DCCID_EBM
static

Definition at line 159 of file EcalElectronicsMapping.h.

◆ MAX_DCCID_EBP

const int EcalElectronicsMapping::MAX_DCCID_EBP = EcalElectronicsId::MAX_DCCID_EBP
static

Definition at line 161 of file EcalElectronicsMapping.h.

◆ MAX_DCCID_EEM

const int EcalElectronicsMapping::MAX_DCCID_EEM = EcalElectronicsId::MAX_DCCID_EEM
static

Definition at line 157 of file EcalElectronicsMapping.h.

◆ MAX_DCCID_EEP

const int EcalElectronicsMapping::MAX_DCCID_EEP = EcalElectronicsId::MAX_DCCID_EEP
static

Definition at line 163 of file EcalElectronicsMapping.h.

◆ MAX_LM

const int EcalElectronicsMapping::MAX_LM = 92
static

Definition at line 195 of file EcalElectronicsMapping.h.

◆ MAX_TCCID

const int EcalElectronicsMapping::MAX_TCCID = EcalTriggerElectronicsId::MAX_TCCID
static

Definition at line 169 of file EcalElectronicsMapping.h.

Referenced by TCCBlockFormatter::DigiToRaw().

◆ MAX_TCCID_EBM

const int EcalElectronicsMapping::MAX_TCCID_EBM = EcalTriggerElectronicsId::MAX_TCCID_EBM
static

Definition at line 174 of file EcalElectronicsMapping.h.

◆ MAX_TCCID_EBP

const int EcalElectronicsMapping::MAX_TCCID_EBP = EcalTriggerElectronicsId::MAX_TCCID_EBP
static

Definition at line 176 of file EcalElectronicsMapping.h.

◆ MAX_TCCID_EEM

const int EcalElectronicsMapping::MAX_TCCID_EEM = EcalTriggerElectronicsId::MAX_TCCID_EEM
static

Definition at line 172 of file EcalElectronicsMapping.h.

◆ MAX_TCCID_EEP

const int EcalElectronicsMapping::MAX_TCCID_EEP = EcalTriggerElectronicsId::MAX_TCCID_EEP
static

Definition at line 178 of file EcalElectronicsMapping.h.

◆ MIN_DCCID

const int EcalElectronicsMapping::MIN_DCCID = EcalElectronicsId::MIN_DCCID
static

Definition at line 155 of file EcalElectronicsMapping.h.

◆ MIN_DCCID_EBM

const int EcalElectronicsMapping::MIN_DCCID_EBM = EcalElectronicsId::MIN_DCCID_EBM
static

Definition at line 158 of file EcalElectronicsMapping.h.

◆ MIN_DCCID_EBP

const int EcalElectronicsMapping::MIN_DCCID_EBP = EcalElectronicsId::MIN_DCCID_EBP
static

Definition at line 160 of file EcalElectronicsMapping.h.

◆ MIN_DCCID_EEM

const int EcalElectronicsMapping::MIN_DCCID_EEM = EcalElectronicsId::MIN_DCCID_EEM
static

Definition at line 156 of file EcalElectronicsMapping.h.

◆ MIN_DCCID_EEP

const int EcalElectronicsMapping::MIN_DCCID_EEP = EcalElectronicsId::MIN_DCCID_EEP
static

Definition at line 162 of file EcalElectronicsMapping.h.

◆ MIN_LM_EBM

const int EcalElectronicsMapping::MIN_LM_EBM = 1
static

Definition at line 192 of file EcalElectronicsMapping.h.

◆ MIN_LM_EBP

const int EcalElectronicsMapping::MIN_LM_EBP = 37
static

Definition at line 193 of file EcalElectronicsMapping.h.

◆ MIN_LM_EEM

const int EcalElectronicsMapping::MIN_LM_EEM = 73
static

Definition at line 191 of file EcalElectronicsMapping.h.

◆ MIN_LM_EEP

const int EcalElectronicsMapping::MIN_LM_EEP = 83
static

Definition at line 194 of file EcalElectronicsMapping.h.

◆ MIN_TCCID

const int EcalElectronicsMapping::MIN_TCCID = EcalTriggerElectronicsId::MIN_TCCID
static

Definition at line 170 of file EcalElectronicsMapping.h.

◆ MIN_TCCID_EBM

const int EcalElectronicsMapping::MIN_TCCID_EBM = EcalTriggerElectronicsId::MIN_TCCID_EBM
static

Definition at line 173 of file EcalElectronicsMapping.h.

◆ MIN_TCCID_EBP

const int EcalElectronicsMapping::MIN_TCCID_EBP = EcalTriggerElectronicsId::MIN_TCCID_EBP
static

Definition at line 175 of file EcalElectronicsMapping.h.

◆ MIN_TCCID_EEM

const int EcalElectronicsMapping::MIN_TCCID_EEM = EcalTriggerElectronicsId::MIN_TCCID_EEM
static

Definition at line 171 of file EcalElectronicsMapping.h.

◆ MIN_TCCID_EEP

const int EcalElectronicsMapping::MIN_TCCID_EEP = EcalTriggerElectronicsId::MIN_TCCID_EEP
static

Definition at line 177 of file EcalElectronicsMapping.h.

◆ TCCID_PHI0_EBM

const int EcalElectronicsMapping::TCCID_PHI0_EBM = EcalTriggerElectronicsId::TCCID_PHI0_EBM
static

Definition at line 180 of file EcalElectronicsMapping.h.

◆ TCCID_PHI0_EBP

const int EcalElectronicsMapping::TCCID_PHI0_EBP = EcalTriggerElectronicsId::TCCID_PHI0_EBP
static

Definition at line 181 of file EcalElectronicsMapping.h.

◆ TCCID_PHI0_EEM_IN

const int EcalElectronicsMapping::TCCID_PHI0_EEM_IN = EcalTriggerElectronicsId::TCCID_PHI0_EEM_IN
static

Definition at line 183 of file EcalElectronicsMapping.h.

◆ TCCID_PHI0_EEM_OUT

const int EcalElectronicsMapping::TCCID_PHI0_EEM_OUT = EcalTriggerElectronicsId::TCCID_PHI0_EEM_OUT
static

Definition at line 184 of file EcalElectronicsMapping.h.

◆ TCCID_PHI0_EEP_IN

const int EcalElectronicsMapping::TCCID_PHI0_EEP_IN = EcalTriggerElectronicsId::TCCID_PHI0_EEP_IN
static

Definition at line 185 of file EcalElectronicsMapping.h.

◆ TCCID_PHI0_EEP_OUT

const int EcalElectronicsMapping::TCCID_PHI0_EEP_OUT = EcalTriggerElectronicsId::TCCID_PHI0_EEP_OUT
static

Definition at line 186 of file EcalElectronicsMapping.h.

◆ TCCMODE

const int EcalElectronicsMapping::TCCMODE = 1
staticprivate

Definition at line 199 of file EcalElectronicsMapping.h.