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 37 of file EcalElectronicsMapping.cc.

References ALPAKA_ACCELERATOR_NAMESPACE::ecal::reconstruction::internal::barrel::dcc().

37  {
38  // Fill the map (Barrel) for the Laser Monitoring readout numbers :
39  // Each DCC actually corresponds to 2 LMs, ilm and ilm + 1
40 
41  int ilm = MIN_LM_EBM;
42  for (int dcc = MIN_DCCID_EBM; dcc <= MAX_DCCID_EBM; dcc++) {
44  ilm += 2;
45  }
46  ilm = MIN_LM_EBP;
47  for (int dcc = MIN_DCCID_EBP; dcc <= MAX_DCCID_EBP; dcc++) {
49  ilm += 2;
50  }
51 
52  // Fill the map (EndCap) for the Laser Monitoring readout numbers :
53  // Each DCC corresponds to onr LM, but DCC 8 (LM 80 and 81) and DCC 53 (LM 90 and 91)
54 
55  ilm = MIN_LM_EEM;
56  for (int dcc = MIN_DCCID_EEM; dcc <= MAX_DCCID_EEM; dcc++) {
58  ilm += 1;
59  if (dcc == 8)
60  ilm += 1;
61  }
62  ilm = MIN_LM_EEP;
63  for (int dcc = MIN_DCCID_EEP; dcc <= MAX_DCCID_EEP; dcc++) {
65  ilm += 1;
66  if (dcc == 53)
67  ilm += 1;
68  }
69 }
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 756 of file EcalElectronicsMapping.cc.

References l1tHGCalTowerProducer_cfi::tower.

Referenced by EcalElectronicsMappingBuilder::FillFromDatabase().

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

◆ DCCBoundary()

int EcalElectronicsMapping::DCCBoundary ( int  FED) const

Definition at line 930 of file EcalElectronicsMapping.cc.

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

◆ dccConstituents()

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

Get the constituent detids for this dccId.

Definition at line 562 of file EcalElectronicsMapping.cc.

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

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

562  {
564  std::vector<DetId> items;
565 
566  if (sub == EcalBarrel) {
567  for (int tower = 1; tower <= kEBTowersPerSM; tower++) {
568  std::vector<DetId> xtals = dccTowerConstituents(dccId, tower);
569  int size = xtals.size();
570  for (int i = 0; i < size; i++) {
571  DetId detid = xtals[i];
572  items.emplace_back(detid);
573  }
574  }
575  return items;
576  } else if (sub == EcalEndcap) {
577  EcalElectronicsMap_by_DccId::const_iterator lb, ub;
578  boost::tuples::tie(lb, ub) = get<3>(m_items).equal_range(dccId);
579  while (lb != ub) {
580  DetId cell = lb->cell;
581  items.emplace_back(cell);
582  ++lb;
583  }
584  return items;
585  } else
586  throw cms::Exception("InvalidDetId") << "Wrong dccId = " << dccId
587  << " in EcalElectronicsMapping::dccConstituents. ";
588 }
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 71 of file EcalElectronicsMapping.cc.

References ALPAKA_ACCELERATOR_NAMESPACE::ecal::reconstruction::internal::barrel::dcc(), and ecaldqm::zside().

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

77 {
78  int dcc = id.ism();
79  if (id.zside() < 0) {
80  dcc += DCCID_PHI0_EBM - 19;
81  } else {
82  dcc += DCCID_PHI0_EBP - 1;
83  }
84  return dcc;
85 }
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 190 of file EcalElectronicsMapping.cc.

References ALPAKA_ACCELERATOR_NAMESPACE::ecal::reconstruction::internal::barrel::dcc(), EcalBarrel, EcalEndcap, Exception, HLT_IsoTrack_cff::offset, and ecaldqm::zside().

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

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

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

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

References EcalElectronicsId::dccId(), hgcal::mappingtools::getElectronicsId(), ALPAKA_ACCELERATOR_NAMESPACE::ecal::reconstruction::internal::endcap::ix(), ALPAKA_ACCELERATOR_NAMESPACE::ecal::reconstruction::internal::endcap::iy(), EcalElectronicsId::towerId(), EEDetId::validDetId(), EEDetId::XYMODE, and ecaldqm::zside().

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

762  {
763  // pair.first = DCC id
764  // pair.second = DCC_channel
765  // For digi2raw, read the SRflags and write the SR block :
766  // need to find out, for an EcalScDetId, which is the DCC and the DCC_channel
767 
768  std::pair<int, int> ind;
769  EEDetId dum;
770  int ix = id.ix();
771  int iy = id.iy();
772  int zside = id.zside();
773  ix = (ix - 1) * 5 + 1;
774  iy = (iy - 1) * 5 + 1;
775  ix = 5 * (ix / 5) + 1;
776  iy = 5 * (iy / 5) + 1;
777  int ix_c = ix;
778  int iy_c = iy;
779  if (!dum.validDetId(ix_c, iy_c, zside)) {
780  ix_c = ix + 4;
781  iy_c = iy;
782  if (!dum.validDetId(ix_c, iy_c, zside)) {
783  ix_c = ix + 4;
784  iy_c = iy + 4;
785  if (!dum.validDetId(ix_c, iy_c, zside)) {
786  ix_c = ix;
787  iy_c = iy + 4;
788  }
789  }
790  }
791  EEDetId eedetid(ix_c, iy_c, zside, EEDetId::XYMODE);
792  EcalElectronicsId elid = getElectronicsId(eedetid);
793  int Dccid = elid.dccId();
794  int DCC_Channel = elid.towerId();
795  ind.first = Dccid;
796  ind.second = DCC_Channel;
797  return ind;
798 }
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:333
int dccId() const
get the DCC (Ecal Local DCC value not global one) id
int zside(int dcctcc, int mode) const
int towerId() const
get the tower id
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t ix(uint32_t 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.
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t iy(uint32_t id)

◆ getDetId() [1/2]

DetId EcalElectronicsMapping::getDetId ( const EcalElectronicsId id) const

Get the detid given an electronicsId.

Definition at line 411 of file EcalElectronicsMapping.cc.

References ALPAKA_ACCELERATOR_NAMESPACE::ecal::reconstruction::internal::barrel::dcc(), MillePedeFileConverter_cfg::e, EcalBarrel, EcalEndcap, EBDetId::ETAPHIMODE, Exception, spr::find(), hcalRecHitTable_cff::ieta, hcalRecHitTable_cff::iphi, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, nano_mu_digi_cff::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().

411  {
412  EcalSubdetector subdet = id.subdet();
413 
414  if (subdet == EcalBarrel) {
415  int dcc = id.dccId();
416  int tower = id.towerId();
417  int strip = id.stripId();
418  int channel = id.xtalId();
419 
420  int smid = 0;
421  int iphi = 0;
422  bool EBPlus = (id.zside() > 0);
423  bool EBMinus = !EBPlus;
424 
425  if (id.zside() < 0) {
426  smid = dcc + 19 - DCCID_PHI0_EBM;
427  iphi = (smid - 19) * kCrystalsInPhi;
428  iphi += 5 * ((tower - 1) % kTowersInPhi);
429  } else {
430  smid = dcc + 1 - DCCID_PHI0_EBP;
431  iphi = (smid - 1) * kCrystalsInPhi;
432  iphi += 5 * (kTowersInPhi - ((tower - 1) % kTowersInPhi) - 1);
433  }
434  bool RightTower = rightTower(tower);
435  int ieta = 5 * ((tower - 1) / kTowersInPhi) + 1;
436  if (RightTower) {
437  ieta += (strip - 1);
438  if (strip % 2 == 1) {
439  if (EBMinus)
440  iphi += (channel - 1) + 1;
441  if (EBPlus)
442  iphi += (4 - (channel - 1)) + 1;
443  } else {
444  if (EBMinus)
445  iphi += (4 - (channel - 1)) + 1;
446  if (EBPlus)
447  iphi += (channel - 1) + 1;
448  }
449  } else {
450  ieta += 4 - (strip - 1);
451  if (strip % 2 == 1) {
452  if (EBMinus)
453  iphi += (4 - (channel - 1)) + 1;
454  if (EBPlus)
455  iphi += (channel - 1) + 1;
456  } else {
457  if (EBMinus)
458  iphi += (channel - 1) + 1;
459  if (EBPlus)
460  iphi += (4 - (channel - 1)) + 1;
461  }
462  }
463  if (id.zside() < 0)
464  ieta = -ieta;
465 
467  return e;
468  }
469 
470  else if (subdet == EcalEndcap) {
471  EcalElectronicsMap_by_ElectronicsId::const_iterator it = get<1>(m_items).find(id);
472  if (it == (get<1>(m_items).end())) {
473  DetId cell(0);
474  edm::LogError("EcalElectronicsMapping") << "Ecal mapping was asked non DetId";
475  return cell;
476  }
477  DetId cell = it->cell;
478  return cell;
479  } else
480  throw cms::Exception("InvalidDetId") << "Wrong EcalElectronicsId in EcalElectronicsMapping::getDetId.";
481 }
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 513 of file EcalElectronicsMapping.cc.

References EcalBarrel, EcalEndcap, Exception, spr::find(), hgcal::mappingtools::getElectronicsId(), and ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it.

513  {
514  EcalSubdetector subdet = id.subdet();
515 
516  if (subdet == EcalBarrel) {
517  const EcalElectronicsId& elid = getElectronicsId(id);
518  DetId cell = getDetId(elid);
519  return cell;
520  } else if (subdet == EcalEndcap) {
521  EcalElectronicsMap_by_TriggerElectronicsId::const_iterator it = get<2>(m_items).find(id);
522  if (it == get<2>(m_items).end()) {
523  DetId cell(0);
524  edm::LogError("EcalElectronicsMapping") << "Ecal mapping was asked non valid DetId";
525  return cell;
526  }
527  DetId cell = it->cell;
528  return cell;
529  } else
530  throw cms::Exception("InvalidDetId") << "Wrong EcalTriggerElectronicsId in EcalElectronicsMapping::getDetId.";
531 }
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 800 of file EcalElectronicsMapping.cc.

References cms::cuda::assert(), debug, EEDetId::ix(), ALPAKA_ACCELERATOR_NAMESPACE::ecal::reconstruction::internal::endcap::ix(), EEDetId::iy(), ALPAKA_ACCELERATOR_NAMESPACE::ecal::reconstruction::internal::endcap::iy(), and EEDetId::zside().

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

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

References ALPAKA_ACCELERATOR_NAMESPACE::ecal::reconstruction::internal::barrel::dcc(), EcalBarrel, EcalEndcap, Exception, spr::find(), hcalRecHitTable_cff::ieta, EBDetId::ietaAbs(), hcalRecHitTable_cff::iphi, EBDetId::iphi(), ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, nano_mu_digi_cff::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().

325  {
326  EcalSubdetector subdet = EcalSubdetector(id.subdetId());
327  if (subdet == EcalBarrel) {
328  const EBDetId ebdetid = EBDetId(id);
329 
330  int dcc = DCCid(ebdetid);
331  bool EBPlus = (zside(dcc, DCCMODE) > 0);
332  bool EBMinus = !EBPlus;
333 
334  EcalTrigTowerDetId trigtower = ebdetid.tower();
335  // int tower = trigtower.iTT();
336  int tower = iTT(trigtower);
337 
338  int ieta = EBDetId(id).ietaAbs();
339  int iphi = EBDetId(id).iphi();
340  int strip(0);
341  int channel(0);
342  bool RightTower = rightTower(tower);
343  if (RightTower) {
344  strip = (ieta - 1) % 5;
345  if (strip % 2 == 0) {
346  if (EBMinus)
347  channel = (iphi - 1) % 5;
348  if (EBPlus)
349  channel = 4 - ((iphi - 1) % 5);
350  } else {
351  if (EBMinus)
352  channel = 4 - ((iphi - 1) % 5);
353  if (EBPlus)
354  channel = (iphi - 1) % 5;
355  }
356  } else {
357  strip = 4 - ((ieta - 1) % 5);
358  if (strip % 2 == 0) {
359  if (EBMinus)
360  channel = 4 - ((iphi - 1) % 5);
361  if (EBPlus)
362  channel = (iphi - 1) % 5;
363  } else {
364  if (EBMinus)
365  channel = (iphi - 1) % 5;
366  if (EBPlus)
367  channel = 4 - ((iphi - 1) % 5);
368  }
369  }
370  strip += 1;
371  channel += 1;
372 
374 
375  return elid;
376  } else if (subdet == EcalEndcap) {
377  EcalElectronicsMap_by_DetId::const_iterator it = get<0>(m_items).find(id);
378  if (it == get<0>(m_items).end()) {
379  EcalElectronicsId elid(0);
380  edm::LogError("EcalElectronicsMapping") << "Ecal mapping was asked non valid id";
381  return elid;
382  }
383  EcalElectronicsId elid = it->elid;
384  return elid;
385  } else {
386  throw cms::Exception("InvalidDetId") << " Wrong DetId in EcalElectronicsMapping::getElectronicsId.";
387  }
388 }
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 533 of file EcalElectronicsMapping.cc.

References ALPAKA_ACCELERATOR_NAMESPACE::ecal::reconstruction::internal::barrel::dcc(), EcalBarrel, EcalEndcap, Exception, spr::find(), ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, nano_mu_digi_cff::strip, EcalElectronicsId::subdet(), l1tHGCalTowerProducer_cfi::tower, and ecaldqm::zside().

533  {
534  EcalSubdetector subdet = id.subdet();
535 
536  if (subdet == EcalBarrel) {
537  int strip = id.pseudoStripId();
538  int xtal = id.channelId();
539  int tower = id.ttId();
540  int dcc = id.tccId();
541  if (id.zside() < 0) {
543  } else {
545  }
546  EcalElectronicsId elid(dcc, tower, strip, xtal);
547  return elid;
548  } else if (subdet == EcalEndcap) {
549  EcalElectronicsMap_by_TriggerElectronicsId::const_iterator it = get<2>(m_items).find(id);
550  if (it == get<2>(m_items).end()) {
551  EcalElectronicsId elid(0);
552  edm::LogError("EcalElectronicsMapping") << "Ecal mapping was asked non valid id";
553  return elid;
554  }
555  EcalElectronicsId elid = it->elid;
556  return elid;
557  } else
558  throw cms::Exception("InvalidDetId")
559  << "Wrong EcalTriggerElectronicsId in EcalElectronicsMapping::getElectronicsId.";
560 }
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 1089 of file EcalElectronicsMapping.cc.

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

Referenced by EcalRegionCabling::elementIndex().

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

◆ GetListofFEDs() [1/2]

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

Definition at line 942 of file EcalElectronicsMapping.cc.

References ALCARECOHcalCalPedestal_cff::FEDs, and nano_mu_digi_cff::region.

942  {
943  std::vector<int> FEDs;
945  return FEDs;
946 }
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 947 of file EcalElectronicsMapping.cc.

References debug, eleIsoSequence_cff::deltaR, ALCARECOHcalCalPedestal_cff::FEDs, heavyIonCSV_trainingSettings::idx, M_PI, and nano_mu_digi_cff::region.

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

References EcalElectronicsId::dccId(), EcalBarrel, EcalEndcap, Exception, hgcal::mappingtools::getElectronicsId(), EBDetId::ietaSM(), EBDetId::iphiSM(), ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, EEDetId::ix(), and ALPAKA_ACCELERATOR_NAMESPACE::ecal::reconstruction::internal::endcap::ix().

Referenced by EcalCosmicsHists::analyze().

1135  {
1136  // Laser Monitoring readout number.
1137 
1138  EcalSubdetector subdet = EcalSubdetector(id.subdetId());
1139 
1140  if (subdet == EcalBarrel) {
1141  const EBDetId ebdetid = EBDetId(id);
1142  int dccid = DCCid(ebdetid);
1143  std::map<int, int>::const_iterator it = LaserMonitoringMap_EB.find(dccid);
1144  if (it != LaserMonitoringMap_EB.end()) {
1145  int ilm = it->second;
1146  int iETA = ebdetid.ietaSM();
1147  int iPHI = ebdetid.iphiSM();
1148  if (iPHI > 10 && iETA > 5) {
1149  ilm++;
1150  };
1151  return ilm;
1152  } else
1153  throw cms::Exception("InvalidDCCId") << "Wrong DCCId (EB) in EcalElectronicsMapping::getLMNumber.";
1154  }
1155 
1156  else if (subdet == EcalEndcap) {
1158  int dccid = elid.dccId();
1159  EEDetId eedetid = EEDetId(id);
1160  std::map<int, int>::const_iterator it = LaserMonitoringMap_EE.find(dccid);
1161  if (it != LaserMonitoringMap_EB.end()) {
1162  int ilm = it->second;
1163  if (dccid == 8) {
1164  int ix = eedetid.ix();
1165  if (ix > 50)
1166  ilm += 1;
1167  }
1168  if (dccid == 53) {
1169  int ix = eedetid.ix();
1170  if (ix > 50)
1171  ilm += 1;
1172  }
1173  return ilm;
1174  } else
1175  throw cms::Exception("InvalidDCCId") << "Wrong DCCId (EE) in EcalElectronicsMapping::getLMNumber.";
1176  }
1177 
1178  return -1;
1179 }
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
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t ix(uint32_t id)
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 390 of file EcalElectronicsMapping.cc.

References EcalBarrel, EcalEndcap, Exception, spr::find(), hgcal::mappingtools::getElectronicsId(), and ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it.

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

390  {
391  EcalSubdetector subdet = EcalSubdetector(id.subdetId());
392 
393  if (subdet == EcalBarrel) {
394  const EcalElectronicsId& elid = getElectronicsId(id);
396  return trelid;
397  } else if (subdet == EcalEndcap) {
398  EcalElectronicsMap_by_DetId::const_iterator it = get<0>(m_items).find(id);
399  if (it == get<0>(m_items).end()) {
400  EcalTriggerElectronicsId trelid(0);
401  edm::LogError("EcalElectronicsMapping") << "Ecal mapping was asked non valid trig id";
402  return trelid;
403  }
404  EcalTriggerElectronicsId trelid = it->trelid;
405  return trelid;
406  } else {
407  throw cms::Exception("InvalidDetId") << " Wrong DetId in EcalElectronicsMapping::getTriggerElectronicsId.";
408  }
409 }
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 483 of file EcalElectronicsMapping.cc.

References EcalBarrel, EcalEndcap, Exception, spr::find(), ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, nano_mu_digi_cff::strip, EcalTriggerElectronicsId::subdet(), l1tHGCalTowerProducer_cfi::tower, and ecaldqm::zside().

483  {
484  EcalSubdetector subdet = id.subdet();
485 
486  if (subdet == EcalBarrel) {
487  int strip = id.stripId();
488  int xtal = id.xtalId();
489  int tower = id.towerId();
490  int tcc = id.dccId();
491  if (id.zside() < 0) {
493  } else {
495  }
496  EcalTriggerElectronicsId trelid(tcc, tower, strip, xtal);
497  return trelid;
498 
499  } else if (subdet == EcalEndcap) {
500  EcalElectronicsMap_by_ElectronicsId::const_iterator it = get<1>(m_items).find(id);
501  if (it == get<1>(m_items).end()) {
502  EcalTriggerElectronicsId trelid(0);
503  edm::LogError("EcalElectronicsMapping") << "Ecal mapping was asked non valid id";
504  return trelid;
505  }
506  EcalTriggerElectronicsId trelid = it->trelid;
507  return trelid;
508  } else
509  throw cms::Exception("InvalidDetId")
510  << "Wrong EcalElectronicsId in EcalElectronicsMapping::getTriggerElectronicsId.";
511 }
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 241 of file EcalElectronicsMapping.cc.

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

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

241  {
242  // needed for unpacking code.
243 
245  int zIndex = zside(TCCid, TCCMODE);
246 
247  if (sub == EcalBarrel) {
248  int DCCid = 0;
249  int jtower = iTT - 1;
250  if (zIndex > 0)
252  else
254  int SMid = (zIndex > 0) ? DCCid - 27 : DCCid + 9;
255 
256  int etaTT = jtower / kTowersInPhi + 1; // between 1 and 17
257  int phiTT;
258 
259  if (zIndex > 0)
260  phiTT = (SMid - 1) * kTowersInPhi + (kTowersInPhi - (jtower % kTowersInPhi)) - 1;
261  else
262  phiTT = (SMid - 19) * kTowersInPhi + jtower % kTowersInPhi;
263  phiTT++;
264  phiTT = phiTT - 2;
265  if (phiTT <= 0)
266  phiTT = 72 + phiTT;
267  EcalTrigTowerDetId tdetid(zIndex, EcalBarrel, etaTT, phiTT, EcalTrigTowerDetId::SUBDETIJMODE);
268  return tdetid;
269  }
270 
271  else if (sub == EcalEndcap) {
272  bool EEminus = (zIndex < 0);
273  bool EEplus = (zIndex > 0);
274  if ((!EEminus) && (!EEplus))
275  throw cms::Exception("InvalidDetId") << "EcalElectronicsMapping: Cannot create EcalTrigTowerDetId object. ";
276  int iz = 0;
277  int tcc = TCCid;
278  if (tcc < TCCID_PHI0_EEM_OUT + kTCCinPhi)
279  iz = -1;
280  else if (tcc >= TCCID_PHI0_EEP_OUT)
281  iz = +1;
282 
283  bool inner = false;
284  if (iz < 0 && tcc >= TCCID_PHI0_EEM_IN && tcc < TCCID_PHI0_EEM_IN + kTCCinPhi)
285  inner = true;
286  if (iz > 0 && tcc >= TCCID_PHI0_EEP_IN && tcc < TCCID_PHI0_EEP_IN + kTCCinPhi)
287  inner = true;
288  bool outer = !inner;
289 
290  int ieta = (iTT - 1) / kEETowersInPhiPerTCC;
291  int iphi = (iTT - 1) % kEETowersInPhiPerTCC;
292  if (inner)
293  ieta += iEEEtaMinInner;
294  else
295  ieta += iEEEtaMinOuter;
296  if (iz < 0)
297  ieta = -ieta;
298 
299  int TCC_origin = 0;
300  if (inner && iz < 0)
301  TCC_origin = TCCID_PHI0_EEM_IN;
302  if (outer && iz < 0)
303  TCC_origin = TCCID_PHI0_EEM_OUT;
304  if (inner && iz > 0)
305  TCC_origin = TCCID_PHI0_EEP_IN;
306  if (outer && iz > 0)
307  TCC_origin = TCCID_PHI0_EEP_OUT;
308  tcc = tcc - TCC_origin;
309 
310  iphi += kEETowersInPhiPerTCC * tcc;
312 
313  int tower_i = abs(ieta);
314  int tower_j = iphi;
315 
316  EcalTrigTowerDetId tdetid(zIndex, EcalEndcap, tower_i, tower_j, EcalTrigTowerDetId::SUBDETIJMODE);
317  return tdetid;
318 
319  } else {
320  throw cms::Exception("InvalidDetId") << " Wrong indices in EcalElectronicsMapping::getTrigTowerDetId. TCCid = "
321  << TCCid << " iTT = " << iTT << ".";
322  }
323 }
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 103 of file EcalElectronicsMapping.cc.

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

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

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

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

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

731  {
733  std::vector<DetId> items;
734 
735  if (sub == EcalBarrel) {
736  int iz = zside(tccId, TCCMODE);
737  int dccId = tccId;
738  if (iz > 0)
740  else
742  items = stripConstituents(dccId, tt, pseudostrip);
743  return items;
744  } else {
745  EcalElectronicsMap_by_TccId_TtId_and_PseudostripId::const_iterator lb, ub;
746  boost::tuples::tie(lb, ub) = get<8>(m_items).equal_range(boost::make_tuple(int(tccId), int(tt), int(pseudostrip)));
747  while (lb != ub) {
748  DetId cell = lb->cell;
749  items.emplace_back(cell);
750  ++lb;
751  }
752  return items;
753  }
754 }
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 920 of file EcalElectronicsMapping.cc.

References l1tHGCalTowerProducer_cfi::tower.

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

◆ stripConstituents()

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

Get the constituent detids for this dccId.

Definition at line 635 of file EcalElectronicsMapping.cc.

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

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

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

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

◆ tccConstituents()

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

Get the constituent detids for this dccId.

Definition at line 681 of file EcalElectronicsMapping.cc.

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

Referenced by EcalElectronicsMapper::fillMaps().

681  {
683  std::vector<DetId> items;
684 
685  if (sub == EcalBarrel) {
686  int iz = zside(tccId, TCCMODE);
687  int dccId = tccId;
688  if (iz > 0)
690  else
693  return items;
694  } else {
695  EcalElectronicsMap_by_TccId::const_iterator lb, ub;
696  boost::tuples::tie(lb, ub) = get<6>(m_items).equal_range(tccId);
697  while (lb != ub) {
698  DetId cell = lb->cell;
699  items.emplace_back(cell);
700  ++lb;
701  }
702  return items;
703  }
704 }
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 87 of file EcalElectronicsMapping.cc.

References ecaldqm::zside().

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

93 {
94  int tcc = id.ism();
95  if (id.zside() < 0) {
96  tcc += TCCID_PHI0_EBM - 19;
97  } else {
98  tcc += TCCID_PHI0_EBP - 1;
99  }
100  return tcc;
101 }
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 148 of file EcalElectronicsMapping.cc.

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

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

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

706  {
708  std::vector<DetId> items;
709 
710  if (sub == EcalBarrel) {
711  int iz = zside(tccId, TCCMODE);
712  int dccId = tccId;
713  if (iz > 0)
715  else
718  return items;
719  } else {
720  EcalElectronicsMap_by_TccId_and_TtId::const_iterator lb, ub;
721  boost::tuples::tie(lb, ub) = get<7>(m_items).equal_range(boost::make_tuple(int(tccId), int(tt)));
722  while (lb != ub) {
723  DetId cell = lb->cell;
724  items.emplace_back(cell);
725  ++lb;
726  }
727  return items;
728  }
729 }
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 895 of file EcalElectronicsMapping.cc.

References Exception, and ALCARECOPromptCalibProdSiPixelAli0T_cff::mode.

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

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.