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 EcalEtaPhiRegion &region) const
 
void GetListofFEDs (const EcalEtaPhiRegion &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 31 of file EcalElectronicsMapping.h.

Member Typedef Documentation

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 273 of file EcalElectronicsMapping.h.

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

Definition at line 279 of file EcalElectronicsMapping.h.

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

Definition at line 280 of file EcalElectronicsMapping.h.

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

Definition at line 281 of file EcalElectronicsMapping.h.

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

Definition at line 275 of file EcalElectronicsMapping.h.

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

Definition at line 276 of file EcalElectronicsMapping.h.

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

Definition at line 283 of file EcalElectronicsMapping.h.

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

Definition at line 284 of file EcalElectronicsMapping.h.

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

Definition at line 285 of file EcalElectronicsMapping.h.

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

Definition at line 277 of file EcalElectronicsMapping.h.

Constructor & Destructor Documentation

EcalElectronicsMapping::EcalElectronicsMapping ( )

Definition at line 39 of file EcalElectronicsMapping.cc.

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

Member Function Documentation

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

set the association between a DetId and a tower

Definition at line 793 of file EcalElectronicsMapping.cc.

Referenced by EcalElectronicsMappingBuilder::FillFromDatabase().

793  {
794 
795  m_items.insert(MapItem(cell, elid, tower));
796 }
int EcalElectronicsMapping::DCCBoundary ( int  FED) const

Definition at line 964 of file EcalElectronicsMapping.cc.

964  {
965 
966  if (FED >= MIN_DCCID_EEM && FED <= MAX_DCCID_EEM) return MIN_DCCID_EEM;
967  if (FED >= MIN_DCCID_EBM && FED <= MAX_DCCID_EBM) return MIN_DCCID_EBM;
968  if (FED >= MIN_DCCID_EBP && FED <= MAX_DCCID_EBP) return MIN_DCCID_EBP;
969  if (FED >= MIN_DCCID_EEP && FED <= MAX_DCCID_EEP) return MIN_DCCID_EEP;
970  return -1;
971 
972 }
std::vector< DetId > EcalElectronicsMapping::dccConstituents ( int  dccId) const

Get the constituent detids for this dccId.

Definition at line 580 of file EcalElectronicsMapping.cc.

References EcalBarrel, EcalEndcap, Exception, mps_fire::i, mps_monitormerge::items, and findQualityFiles::size.

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

580  {
581 
583  std::vector<DetId> items;
584 
585  if (sub == EcalBarrel) {
586  for (int tower=1; tower <= kEBTowersPerSM; tower++) {
587  std::vector<DetId> xtals = dccTowerConstituents(dccId,tower);
588  int size = xtals.size();
589  for (int i=0; i < size; i++) {
590  DetId detid = xtals[i];
591  items.emplace_back(detid);
592  }
593  }
594  return items;
595  }
596  else if (sub == EcalEndcap) {
597  EcalElectronicsMap_by_DccId::const_iterator lb,ub;
598  boost::tuples::tie(lb,ub)=get<3>(m_items).equal_range(dccId);
599  while (lb != ub) {
600  DetId cell = lb -> cell;
601  items.emplace_back(cell);
602  ++ lb;
603  }
604  return items;
605  }
606  else throw cms::Exception("InvalidDetId") << "Wrong dccId = " << dccId << " in EcalElectronicsMapping::dccConstituents. ";
607 }
size
Write out results.
Definition: DetId.h:18
EcalSubdetector subdet(int dccid, int mode) const
EcalSubdetector
unsigned dccId(DetId const &)
std::vector< DetId > dccTowerConstituents(int dccId, int tower) const
Get the constituent detids for this dccId.
int EcalElectronicsMapping::DCCid ( const EBDetId id) const

returns the DCC of an EBDetId

Definition at line 74 of file EcalElectronicsMapping.cc.

References HcalDigiParam_cfi::zside.

Referenced by EcalTPGParamBuilder::analyze(), and ecaldqm::dccId().

80 {
81  int dcc = id.ism();
82  if (id.zside() < 0) {
83  dcc += DCCID_PHI0_EBM - 19;
84  }
85  else {
86  dcc += DCCID_PHI0_EBP -1;
87  }
88  return dcc;
89 }
int zside(int dcctcc, int mode) const
int EcalElectronicsMapping::DCCid ( const EcalTrigTowerDetId id) const

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

Definition at line 205 of file EcalElectronicsMapping.cc.

References EcalBarrel, EcalEndcap, Exception, PFRecoTauDiscriminationByIsolation_cfi::offset, and HcalDigiParam_cfi::zside.

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

Get the constituent detids for this dccId.

Definition at line 611 of file EcalElectronicsMapping.cc.

References EcalBarrel, EcalEndcap, EBDetId::ETAPHIMODE, Exception, mps_monitormerge::items, and HcalDigiParam_cfi::zside.

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

611  {
612 
614  std::vector<DetId> items;
615 
616  if (sub == EcalBarrel) {
617  int iz = zside(dccId, DCCMODE);
618  int smid = 0;
619  int iphi = 0;
620  if (iz < 0) {
621  smid = dccId + 19 - DCCID_PHI0_EBM;
622  iphi = (smid - 19) * kCrystalsInPhi;
623  iphi += 5 * ( (tower-1) % kTowersInPhi );
624  }
625  else {
626  smid = dccId +1 - DCCID_PHI0_EBP;
627  iphi = (smid - 1) * kCrystalsInPhi;
628  iphi += 5 * (
629  kTowersInPhi - ( (tower-1) % kTowersInPhi ) -1
630  );
631  }
632  int ieta = 5 * ((tower-1) / kTowersInPhi) + 1;
633  for (int ip=1; ip <=5; ip++) {
634  for (int ie=0; ie <=4; ie++) {
635  int ieta_xtal = ieta + ie;
636  int iphi_xtal = iphi + ip;
637  if (iz < 0) ieta_xtal = -ieta_xtal;
638  EBDetId ebdetid(ieta_xtal,iphi_xtal,EBDetId::ETAPHIMODE);
639  items.emplace_back(ebdetid);
640  }
641  }
642  return items;
643  }
644 
645  else if (sub == EcalEndcap) {
646  EcalElectronicsMap_by_DccId_and_TowerId::const_iterator lb,ub;
647  boost::tuples::tie(lb,ub)=get<4>(m_items).equal_range(boost::make_tuple(int(dccId), int(tower)));
648  while (lb != ub) {
649  DetId cell = lb -> cell;
650  items.emplace_back(cell);
651  ++ lb;
652  }
653  return items;
654  }
655  else throw cms::Exception("InvalidDetId") <<
656  "Wrong dccId = " << dccId << " tower = " << tower << " in EcalElectronicsMapping::dccTowerConstituents.";
657 }
int zside(int dcctcc, int mode) const
static const int ETAPHIMODE
Definition: EBDetId.h:166
Definition: DetId.h:18
EcalSubdetector subdet(int dccid, int mode) const
EcalSubdetector
unsigned dccId(DetId const &)
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 799 of file EcalElectronicsMapping.cc.

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

Referenced by EcalSelectiveReadoutValidation::dccCh(), ecaldqm::dccId(), EcalSelectiveReadoutValidation::dccId(), EcalSelectiveReadout::eeRuInterest(), EcalSelectiveReadout::printDccChMap(), and ecaldqm::towerId().

799  {
800 
801 // pair.first = DCC id
802 // pair.second = DCC_channel
803 // For digi2raw, read the SRflags and write the SR block :
804 // need to find out, for an EcalScDetId, which is the DCC and the DCC_channel
805 
806  std::pair<int,int> ind;
807  EEDetId dum;
808  int ix = id.ix();
809  int iy = id.iy();
810  int zside = id.zside();
811  ix = (ix-1)*5 +1;
812  iy = (iy-1)*5 +1;
813  ix = 5 * (ix/5) +1;
814  iy = 5 * (iy/5) +1;
815  int ix_c = ix;
816  int iy_c = iy;
817  if (! dum.validDetId(ix_c,iy_c,zside) ) {
818  ix_c = ix +4;
819  iy_c = iy ;
820  if ( ! dum.validDetId(ix_c,iy_c,zside) ) {
821  ix_c = ix +4;
822  iy_c = iy +4;
823  if ( ! dum.validDetId(ix_c,iy_c,zside) ) {
824  ix_c = ix;
825  iy_c = iy +4;
826  }
827  }
828  }
829  EEDetId eedetid(ix_c,iy_c,zside,EEDetId::XYMODE);
830  EcalElectronicsId elid = getElectronicsId(eedetid);
831  int Dccid = elid.dccId();
832  int DCC_Channel = elid.towerId();
833  ind.first = Dccid;
834  ind.second = DCC_Channel;
835  return ind;
836 }
int ix() const
Definition: EEDetId.h:76
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:339
int towerId() const
get the tower id
EcalElectronicsId getElectronicsId(const DetId &id) const
Get the electronics id for this det id.
int zside(int dcctcc, int mode) const
int dccId() const
get the DCC (Ecal Local DCC value not global one) id
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.h:248
DetId EcalElectronicsMapping::getDetId ( const EcalElectronicsId id) const

Get the detid given an electronicsId.

Definition at line 423 of file EcalElectronicsMapping.cc.

References MillePedeFileConverter_cfg::e, EcalBarrel, EcalEndcap, end, EBDetId::ETAPHIMODE, Exception, spr::find(), digi_MixPreMix_cfi::strip, and HcalDigiParam_cfi::zside.

Referenced by EcalElectronicsMapper::fillMaps(), DCCDataUnpacker::getChannelValue(), and EcalDetIdToBeRecoveredProducer::produce().

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

Get the detid given a trigger electronicsId.

Definition at line 524 of file EcalElectronicsMapping.cc.

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

524  {
525 
526  EcalSubdetector subdet = id.subdet();
527 
528  if (subdet == EcalBarrel) {
529  const EcalElectronicsId& elid = getElectronicsId(id);
530  DetId cell = getDetId(elid);
531  return cell;
532  }
533  else if (subdet == EcalEndcap) {
534  EcalElectronicsMap_by_TriggerElectronicsId::const_iterator it=get<2>(m_items).find(id);
535  if(it==get<2>(m_items).end())
536  { DetId cell(0);
537  edm::LogError("EcalElectronicsMapping") << "Ecal mapping was asked non valid DetId";
538  return cell; }
539  DetId cell = it -> cell;
540  return cell;
541  }
542  else throw cms::Exception("InvalidDetId") << "Wrong EcalTriggerElectronicsId in EcalElectronicsMapping::getDetId." ;
543 }
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
EcalElectronicsId getElectronicsId(const DetId &id) const
Get the electronics id for this det id.
#define end
Definition: vmac.h:37
Definition: DetId.h:18
EcalSubdetector subdet(int dccid, int mode) const
DetId getDetId(const EcalElectronicsId &id) const
Get the detid given an electronicsId.
EcalSubdetector
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 840 of file EcalElectronicsMapping.cc.

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

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

840  {
841  //Debug output switch:
842  const bool debug = false;
843 
844  // For unpacking of ST flags.
845  //result: SCs readout by the DCC channel DCC_channel of DCC DCCid.
846  //Vector of 1 or 2 elements: most of the time there is only
847  //one SC read-out by the DCC channel, but for some channels
848  //there are 2 partial SCs which were grouped.
849  std::vector<EcalScDetId> scDetIds;
850 
851  //There are 4 SCs in each endcap whose one crystal is read out
852  //by a different DCC channel than the others.
853  //Number of crystals of the SC read out by the DCC channel:
854  std::vector<int> nReadoutXtals;
855 
856  std::vector<DetId> xtals = dccTowerConstituents(DCCid, DCC_Channel);
857 
858  if(debug){
859  std::cout << __FILE__ << ":" << __LINE__ << ": " << xtals.size()
860  << " crystals read out by channel " << DCC_Channel << " of DCC "
861  << DCCid << ": ";
862  for(auto xtal : xtals){
863  std::cout << EEDetId(xtal) << " ";
864  }
865  std::cout << "\n";
866  }
867 
868  if (xtals.empty()) throw cms::Exception("InvalidDetId") <<
869  "EcalElectronicsMapping : can not create EcalScDetId for DCC " << DCCid <<
870  " and DCC_Channel " << DCC_Channel << ".";
871 
872  for(auto xtal : xtals){
873  EEDetId eedetid = xtal;
874  int ix = eedetid.ix();
875  int iy = eedetid.iy();
876  int iz = eedetid.zside();
877  int ix_SC = (ix-1)/5 + 1;
878  int iy_SC = (iy-1)/5 + 1;
879  //Supercrystal (SC) the crystal belongs to:
880  EcalScDetId scdetid(ix_SC,iy_SC,iz);
881  size_t iSc = 0;
882  //look if the SC was already included:
883  while(iSc < scDetIds.size() && scDetIds[iSc] != scdetid) ++iSc;
884  if(iSc==scDetIds.size()){//SC not yet included
885  scDetIds.emplace_back(scdetid);
886  nReadoutXtals.emplace_back(1); //crystal counter of the added SC
887  } else{//SC already included
888  ++nReadoutXtals[iSc];// counting crystals in the SC
889  }
890  }
891 
892  if(ignoreSingleCrystal){
893  //For simplification, SC read out by two different DCC channels
894  //will be associated to the DCC channel reading most of the crystals,
895  //the other DCC channel which read only one crystal is discarded.
896  //Discards SC with only one crystal read out by the considered,
897  //DCC channel:
898  assert(scDetIds.size()==nReadoutXtals.size());
899  for(size_t iSc = 0; iSc < scDetIds.size(); /*NOOP*/){
900  if(nReadoutXtals[iSc]<=1){
901  if(debug) std::cout << "EcalElectronicsMapping::getEcalScDetId: Ignore SC "
902  << scDetIds[iSc] << " whose only one channel is read out by "
903  "the DCC channel (DCC " << DCCid << ", ch " << DCC_Channel<< ").\n";
904  scDetIds.erase(scDetIds.begin()+iSc);
905  nReadoutXtals.erase(nReadoutXtals.begin()+iSc);
906  } else{
907  ++iSc; //next SC;
908  }
909  }
910  }
911 
912  return scDetIds;
913 }
int ix() const
Definition: EEDetId.h:76
int zside() const
Definition: EEDetId.h:70
int iy() const
Definition: EEDetId.h:82
#define debug
Definition: HDRShower.cc:19
int DCCid(const EBDetId &id) const
returns the DCC of an EBDetId
std::vector< DetId > dccTowerConstituents(int dccId, int tower) const
Get the constituent detids for this dccId.
EcalElectronicsId EcalElectronicsMapping::getElectronicsId ( const DetId id) const

Get the electronics id for this det id.

Definition at line 333 of file EcalElectronicsMapping.cc.

References EcalBarrel, EcalEndcap, end, Exception, spr::find(), EBDetId::ietaAbs(), EBDetId::iphi(), digi_MixPreMix_cfi::strip, EBDetId::tower(), and HcalDigiParam_cfi::zside.

Referenced by EcalABAnalyzer::analyze(), EcalPerEvtLaserAnalyzer::analyze(), EcalTestPulseAnalyzer::analyze(), EcalLaserAnalyzer2::analyze(), EcalLaserAnalyzer::analyze(), EcalURecHitHists::analyze(), EcalTPGParamBuilder::analyze(), EcalCosmicsHists::analyze(), popcon::EcalChannelStatusHandler::cosmicsAnalysis(), EcalDccWeightBuilder::dbId(), EcalSelectiveReadoutValidation::dccCh(), ecaldqm::dccId(), EcalSelectiveReadout::eeRuInterest(), EcalElectronicsMapper::fillMaps(), popcon::EcalChannelStatusHandler::laserAnalysis(), EcalDisplaysByEvent::makeHistos(), popcon::EcalChannelStatusHandler::nBadLaserModules(), popcon::EcalChannelStatusHandler::pedAnalysis(), printStatusRecords(), EcalPedOffset::readDACs(), EcalDigiDisplay::readEBDigis(), EcalPedHists::readEBdigis(), EcalDigiDisplay::readEEDigis(), EcalPedHists::readEEdigis(), EcalReadoutTools::readOutUnitOf(), PFEcalEndcapRecHitCreator::readOutUnitOf(), EcalSelectiveReadoutValidation::readOutUnitOf(), EcalMipGraphs::selectDigi(), EcalDisplaysByEvent::selectDigi(), EcalMipGraphs::selectHits(), EcalDisplaysByEvent::selectHits(), and ecaldqm::towerId().

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

Get the electronics id given a trigger electronicsId.

Definition at line 547 of file EcalElectronicsMapping.cc.

References EcalBarrel, EcalEndcap, end, Exception, spr::find(), digi_MixPreMix_cfi::strip, EcalElectronicsId::subdet(), and HcalDigiParam_cfi::zside.

547  {
548 
549  EcalSubdetector subdet = id.subdet();
550 
551  if (subdet == EcalBarrel) {
552  int strip = id.pseudoStripId();
553  int xtal = id.channelId();
554  int tower = id.ttId();
555  int dcc = id.tccId();
556  if (id.zside() < 0) {
558  }
559  else {
561  }
562  EcalElectronicsId elid(dcc,tower,strip,xtal);
563  return elid;
564  }
565  else if (subdet == EcalEndcap) {
566  EcalElectronicsMap_by_TriggerElectronicsId::const_iterator it=get<2>(m_items).find(id);
567  if(it==get<2>(m_items).end())
568  { EcalElectronicsId elid(0);
569  edm::LogError("EcalElectronicsMapping") << "Ecal mapping was asked non valid id";
570  return elid; }
571  EcalElectronicsId elid = it -> elid;
572  return elid;
573  }
574  else throw cms::Exception("InvalidDetId") << "Wrong EcalTriggerElectronicsId in EcalElectronicsMapping::getElectronicsId.";
575 }
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
int zside(int dcctcc, int mode) const
#define end
Definition: vmac.h:37
EcalSubdetector subdet(int dccid, int mode) const
EcalSubdetector
int EcalElectronicsMapping::GetFED ( double  eta,
double  phi 
) const

Definition at line 1105 of file EcalElectronicsMapping.cc.

References createfilelist::int.

Referenced by EcalRegionCabling::elementIndex().

1105  {
1106 
1107  // for regional unpacking.
1108  // eta is signed, phi is in degrees.
1109 
1110  int DCC_Phi0 = 0;
1111  bool IsBarrel = true;
1112  if (fabs(eta) > 1.479) IsBarrel = false;
1113  bool Positive = (eta > 0);
1114 
1115  if (IsBarrel && Positive) DCC_Phi0 = DCCID_PHI0_EBP;
1116  if (IsBarrel && (!Positive)) DCC_Phi0 = DCCID_PHI0_EBM;
1117  if ((!IsBarrel) && Positive) DCC_Phi0 = MIN_DCCID_EEP;
1118  if ((!IsBarrel) && (!Positive)) DCC_Phi0 = MIN_DCCID_EEM;
1119 
1120  // phi between 0 and 360 deg :
1121  if (phi < 0) phi += 360;
1122  if (phi > 360.) phi = 360. ;
1123  if (phi < 0) phi = 0. ;
1124 
1125  if (IsBarrel) phi = phi - 350;
1126  else phi = phi - 330;
1127  if (phi < 0) phi += 360;
1128  int iphi = -1;
1129  if (IsBarrel) iphi = (int)(phi / 20.);
1130  else iphi = (int)(phi / 40.);
1131 
1132  // std::cout << " in GetFED : phi iphi DCC0 " << phi << " " << iphi << " " << DCC_Phi0 << std::endl;
1133 
1134  int DCC = iphi + DCC_Phi0;
1135  // std::cout << " eta phi " << eta << " " << " " << phi << " is in FED " << DCC << std::endl;
1136  return DCC;
1137 }
std::vector< int > EcalElectronicsMapping::GetListofFEDs ( const EcalEtaPhiRegion region) const

Definition at line 975 of file EcalElectronicsMapping.cc.

975  {
976  std::vector<int> FEDs;
977  GetListofFEDs(region, FEDs);
978  return FEDs;
979 }
std::vector< int > GetListofFEDs(const EcalEtaPhiRegion &region) const
void EcalElectronicsMapping::GetListofFEDs ( const EcalEtaPhiRegion region,
std::vector< int > &  FEDs 
) const

Definition at line 980 of file EcalElectronicsMapping.cc.

References gather_cfg::cout, debug, deltaR(), EcalEtaPhiRegion::etaHigh(), EcalEtaPhiRegion::etaLow(), training_settings::idx, M_PI, EcalEtaPhiRegion::phiHigh(), and EcalEtaPhiRegion::phiLow().

980  {
981 
982  // for regional unpacking.
983  // get list of FEDs corresponding to a region in (eta,phi)
984 
985  // std::vector<int> FEDs;
986  double radTodeg = 180. / M_PI;;
987 
988  bool debug = false;
989 
990  double etalow = region.etaLow();
991  double philow = region.phiLow() * radTodeg;
992  if (debug) std::cout << " etalow philow " << etalow << " " << philow << std::endl;
993  int FED_LB = GetFED(etalow,philow); // left, bottom
994 
995  double phihigh = region.phiHigh() * radTodeg;
996  if (debug) std::cout << " etalow phihigh " << etalow << " " << phihigh << std::endl;
997  int FED_LT = GetFED(etalow,phihigh); // left, top
998 
999  int DCC_BoundaryL = DCCBoundary(FED_LB);
1000  int deltaL = 18;
1001  if (FED_LB < MIN_DCCID_EBM || FED_LB > MAX_DCCID_EBP) deltaL=9;
1002 
1003  if (philow < -170 && phihigh > 170) {
1004  FED_LB = DCC_BoundaryL;
1005  FED_LT = DCC_BoundaryL + deltaL -1;
1006  }
1007  if (debug) std::cout << " FED_LB FED_LT " << FED_LB << " " << FED_LT << std::endl;
1008 
1009  bool dummy = true;
1010  int idx = 0;
1011  while ( dummy ) {
1012  int iL = (FED_LB - DCC_BoundaryL + idx ) % deltaL + DCC_BoundaryL;
1013  FEDs.emplace_back(iL);
1014  if (debug) std::cout << " add fed " << iL << std::endl;
1015  if ( iL == FED_LT) break;
1016  idx ++;
1017  }
1018 
1019  double etahigh = region.etaHigh();
1020  int FED_RB = GetFED(etahigh, philow); // right, bottom
1021  if (FED_RB == FED_LB) return;// FEDs;
1022 
1023  int FED_RT = GetFED(etahigh, phihigh); // right, top
1024 
1025  if (debug) std::cout << "etahigh philow phihigh " << etahigh << " " << philow << " " << phihigh << std::endl;
1026  int DCC_BoundaryR = DCCBoundary(FED_RB);
1027  int deltaR = 18;
1028  if (FED_RB < MIN_DCCID_EBM || FED_RB > MAX_DCCID_EBP) deltaR=9;
1029 
1030  if (philow < -170 && phihigh > 170) {
1031  FED_RB = DCC_BoundaryR;
1032  FED_RT = DCC_BoundaryR + deltaR-1;
1033  }
1034  if (debug) std::cout << " FED_RB FED_RT " << FED_RB << " " << FED_RT << std::endl;
1035  idx = 0;
1036  while ( dummy ) {
1037  int iR = (FED_RB - DCC_BoundaryR + idx) % deltaR + DCC_BoundaryR;
1038  FEDs.emplace_back(iR);
1039  if (debug) std::cout << " add fed " << iR << std::endl;
1040  if ( iR == FED_RT) break;
1041  idx ++;
1042  }
1043 
1044 
1045  if (FED_LB >= MIN_DCCID_EBM && FED_LB <= MAX_DCCID_EBM &&
1046  FED_RB >= MIN_DCCID_EEP && FED_RB <= MAX_DCCID_EEP) {
1047  int minR = FED_LB + 18;
1048  int maxR = FED_LT + 18;
1049  int idx = 0;
1050  while ( dummy ) {
1051  int iR = (minR - MIN_DCCID_EBP + idx) % 18 + MIN_DCCID_EBP;
1052  FEDs.emplace_back(iR);
1053  if (debug) std::cout << " add fed " << iR << std::endl;
1054  if ( iR == maxR) break;
1055  idx ++;
1056  }
1057  return;// FEDs;
1058  }
1059 
1060  if (FED_LB >= MIN_DCCID_EEM && FED_LB <= MAX_DCCID_EEM &&
1061  FED_RB >= MIN_DCCID_EBP && FED_RB <= MAX_DCCID_EBP) {
1062  int minL = FED_RB - 18;
1063  int maxL = FED_RT - 18;
1064  int idx = 0;
1065  while ( dummy ) {
1066  int iL = (minL - MIN_DCCID_EBM + idx) % 18 + MIN_DCCID_EBM;
1067  FEDs.emplace_back(iL);
1068  if (debug) std::cout << " add fed " << iL << std::endl;
1069  if (iL == maxL) break;
1070  idx ++;
1071  }
1072  return;// FEDs;
1073  }
1074 
1075  if (FED_LB >= MIN_DCCID_EEM && FED_LB <= MAX_DCCID_EEM &&
1076  FED_RB >= MIN_DCCID_EEP && FED_RB <= MAX_DCCID_EEP) {
1077  int minL = (FED_LB-1)*2 + MIN_DCCID_EBM;
1078  if (minL == MIN_DCCID_EBM) minL=MAX_DCCID_EBM;
1079  else minL = minL -1;
1080  int maxL = (FED_LT-1)*2 + MIN_DCCID_EBM;
1081  int idx = 0;
1082  while (dummy) {
1083  int iL = (minL - MIN_DCCID_EBM + idx) % 18 + MIN_DCCID_EBM;
1084  FEDs.emplace_back(iL);
1085  if (debug) std::cout << " add fed " << iL << std::endl;
1086  if (iL == maxL) break;
1087  idx ++;
1088  }
1089  int minR = minL + 18;
1090  int maxR = maxL + 18;
1091  idx = 0;
1092  while (dummy) {
1093  int iR = (minR - MIN_DCCID_EBP + idx) % 18 + MIN_DCCID_EBP;
1094  FEDs.emplace_back(iR);
1095  if (debug) std::cout << " add fed " << iR << std::endl;
1096  if (iR == maxR) break;
1097  idx ++;
1098  }
1099  }
1100 
1101  return;// FEDs;
1102 
1103 }
int GetFED(double eta, double phi) const
auto phiLow() const
auto etaHigh() const
int DCCBoundary(int FED) const
auto phiHigh() const
#define M_PI
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
#define debug
Definition: HDRShower.cc:19
auto etaLow() const
int EcalElectronicsMapping::getLMNumber ( const DetId id) const

Definition at line 1140 of file EcalElectronicsMapping.cc.

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

Referenced by EcalCosmicsHists::analyze().

1140  {
1141 
1142 // Laser Monitoring readout number.
1143 
1144  EcalSubdetector subdet = EcalSubdetector(id.subdetId());
1145 
1146  if (subdet == EcalBarrel) {
1147  const EBDetId ebdetid = EBDetId(id);
1148  int dccid = DCCid(ebdetid);
1149  std::map<int, int>::const_iterator it = LaserMonitoringMap_EB.find(dccid);
1150  if (it != LaserMonitoringMap_EB.end() ) {
1151  int ilm = it -> second;
1152  int iETA = ebdetid.ietaSM();
1153  int iPHI = ebdetid.iphiSM();
1154  if (iPHI > 10 && iETA>5) {ilm ++; } ;
1155  return ilm;
1156  }
1157  else throw cms::Exception("InvalidDCCId") << "Wrong DCCId (EB) in EcalElectronicsMapping::getLMNumber.";
1158  }
1159 
1160  else if (subdet == EcalEndcap) {
1162  int dccid = elid.dccId();
1163  EEDetId eedetid = EEDetId(id);
1164  std::map<int, int>::const_iterator it = LaserMonitoringMap_EE.find(dccid);
1165  if (it != LaserMonitoringMap_EB.end() ) {
1166  int ilm = it -> second;
1167  if (dccid == 8) {
1168  int ix = eedetid.ix();
1169  if (ix > 50) ilm += 1;
1170  }
1171  if (dccid == 53) {
1172  int ix = eedetid.ix();
1173  if (ix > 50) ilm += 1;
1174  }
1175  return ilm;
1176  }
1177  else throw cms::Exception("InvalidDCCId") << "Wrong DCCId (EE) in EcalElectronicsMapping::getLMNumber.";
1178  }
1179 
1180  return -1;
1181 }
int ix() const
Definition: EEDetId.h:76
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 iphiSM() const
get the crystal iphi (1-20)
Definition: EBDetId.h:75
U second(std::pair< T, U > const &p)
EcalElectronicsId getElectronicsId(const DetId &id) const
Get the electronics id for this det id.
std::map< int, int > LaserMonitoringMap_EE
int dccId() const
get the DCC (Ecal Local DCC value not global one) id
EcalSubdetector subdet(int dccid, int mode) const
int DCCid(const EBDetId &id) const
returns the DCC of an EBDetId
int ietaSM() const
get the crystal ieta in the SM convention (1-85)
Definition: EBDetId.h:73
EcalSubdetector
EcalTriggerElectronicsId EcalElectronicsMapping::getTriggerElectronicsId ( const DetId id) const

Get the trigger electronics id for this det id.

Definition at line 398 of file EcalElectronicsMapping.cc.

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

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

398  {
399  EcalSubdetector subdet = EcalSubdetector(id.subdetId());
400 
401  if (subdet == EcalBarrel) {
402 
403  const EcalElectronicsId& elid = getElectronicsId(id);
405  return trelid;
406  }
407  else if (subdet == EcalEndcap) {
408  EcalElectronicsMap_by_DetId::const_iterator it=get<0>(m_items).find(id);
409  if(it==get<0>(m_items).end())
410  { EcalTriggerElectronicsId trelid(0);
411  edm::LogError("EcalElectronicsMapping") << "Ecal mapping was asked non valid trig id";
412  return trelid; }
413  EcalTriggerElectronicsId trelid = it -> trelid;
414  return trelid;
415  }
416  else {
417  throw cms::Exception("InvalidDetId") <<
418  " Wrong DetId in EcalElectronicsMapping::getTriggerElectronicsId.";
419  }
420 }
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
EcalElectronicsId getElectronicsId(const DetId &id) const
Get the electronics id for this det id.
EcalTriggerElectronicsId getTriggerElectronicsId(const DetId &id) const
Get the trigger electronics id for this det id.
#define end
Definition: vmac.h:37
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...
EcalTriggerElectronicsId EcalElectronicsMapping::getTriggerElectronicsId ( const EcalElectronicsId id) const

Get the trigger electronics id given an electronicsId.

Definition at line 492 of file EcalElectronicsMapping.cc.

References EcalBarrel, EcalEndcap, end, Exception, spr::find(), digi_MixPreMix_cfi::strip, EcalTriggerElectronicsId::subdet(), and HcalDigiParam_cfi::zside.

492  {
493 
494  EcalSubdetector subdet = id.subdet();
495 
496  if (subdet == EcalBarrel) {
497  int strip = id.stripId();
498  int xtal = id.xtalId();
499  int tower = id.towerId();
500  int tcc = id.dccId();
501  if (id.zside() < 0) {
503  }
504  else {
506  }
507  EcalTriggerElectronicsId trelid(tcc,tower,strip,xtal);
508  return trelid;
509 
510  }
511  else if (subdet == EcalEndcap) {
512  EcalElectronicsMap_by_ElectronicsId::const_iterator it=get<1>(m_items).find(id);
513  if(it==get<1>(m_items).end())
514  { EcalTriggerElectronicsId trelid(0);
515  edm::LogError("EcalElectronicsMapping") << "Ecal mapping was asked non valid id";
516  return trelid; }
517  EcalTriggerElectronicsId trelid = it -> trelid;
518  return trelid;
519  }
520  else throw cms::Exception("InvalidDetId") << "Wrong EcalElectronicsId in EcalElectronicsMapping::getTriggerElectronicsId.";
521 }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
int zside(int dcctcc, int mode) const
#define end
Definition: vmac.h:37
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...
EcalTrigTowerDetId EcalElectronicsMapping::getTrigTowerDetId ( int  TCCid,
int  iTT 
) const

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

Definition at line 252 of file EcalElectronicsMapping.cc.

References funct::abs(), EcalBarrel, EcalEndcap, Exception, SurfaceOrientation::inner, SurfaceOrientation::outer, EcalTrigTowerDetId::SUBDETIJMODE, and HcalDigiParam_cfi::zside.

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

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

returns the index of a Trigger Tower within its TCC.

Definition at line 111 of file EcalElectronicsMapping.cc.

References EcalBarrel, EcalEndcap, Exception, SurfaceOrientation::inner, and HcalDigiParam_cfi::zside.

Referenced by EcalTPGParamBuilder::analyze(), and ecaldqm::ttId().

117 {
118  if ( id.subDet() == EcalBarrel )
119  {
120  int ie = id.ietaAbs() -1;
121  int ip;
122  int phi = id.iphi();
123  phi += 2;
124  if (phi > 72) phi = phi-72;
125  if (id.zside() < 0) {
126  ip = (( phi -1 ) % kEBTowersInPhi ) + 1;
127  } else {
128  ip = kEBTowersInPhi - ((phi -1 ) % kEBTowersInPhi );
129  }
130 
131  return (ie * kEBTowersInPhi) + ip;
132  }
133  else if ( id.subDet() == EcalEndcap) {
134  int ie = id.ietaAbs();
135  bool inner = (ie >= iEEEtaMinInner);
136  if (inner) {
137  ie = ie - iEEEtaMinInner;
138  ie = ie % kEETowersInEtaPerInnerTCC;
139  }
140  else {
141  ie = ie - iEEEtaMinOuter;
142  ie = ie % kEETowersInEtaPerOuterTCC;
143  }
144 
145  int ip = id.iphi();
146  ip = (ip + 1) % (kEETowersInPhiPerQuadrant*4);
147  // now iphi between 0 and 71,
148  // with iphi=0,1,2,3 in 1st Phi sector
149  ip = ip % kEETowersInPhiPerTCC;
150  int itt = kEETowersInPhiPerTCC * ie + ip + 1;
151  return itt;
152  }
153  else {
154  throw cms::Exception("InvalidDetId") << " Wrong EcalTrigTowerDetId in EcalElectronicsMapping::iTT. " ;
155  return 0;
156  }
157 
158 }
static const int kEETowersInEtaPerOuterTCC
static const int kEETowersInEtaPerInnerTCC
int zside(int dcctcc, int mode) const
static const int kEETowersInPhiPerQuadrant
static const int kEETowersInPhiPerTCC
std::vector< DetId > EcalElectronicsMapping::pseudoStripConstituents ( int  tccId,
int  tt,
int  pseudostrip 
) const

Get the constituent detids for this dccId.

Definition at line 768 of file EcalElectronicsMapping.cc.

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

768  {
769 
771  std::vector<DetId> items;
772 
773  if (sub == EcalBarrel) {
774  int iz = zside(tccId,TCCMODE);
775  int dccId = tccId;
776  if (iz > 0) dccId = dccId - TCCID_PHI0_EBP + DCCID_PHI0_EBP;
777  else dccId = dccId - TCCID_PHI0_EBM + DCCID_PHI0_EBM;
778  items = stripConstituents(dccId,tt,pseudostrip);
779  return items;
780  }
781  else {
782  EcalElectronicsMap_by_TccId_TtId_and_PseudostripId::const_iterator lb,ub;
783  boost::tuples::tie(lb,ub)=get<8>(m_items).equal_range(boost::make_tuple(int(tccId), int(tt), int(pseudostrip)));
784  while (lb != ub) {
785  DetId cell = lb -> cell;
786  items.emplace_back(cell);
787  ++ lb;
788  }
789  return items;
790  }
791 }
unsigned tccId(DetId const &)
int zside(int dcctcc, int mode) const
Definition: DetId.h:18
EcalSubdetector subdet(int dccid, int mode) const
std::vector< DetId > stripConstituents(int dccId, int tower, int strip) const
Get the constituent detids for this dccId.
EcalSubdetector
unsigned dccId(DetId const &)
bool EcalElectronicsMapping::rightTower ( int  tower) const

Definition at line 953 of file EcalElectronicsMapping.cc.

953  {
954  // for EB, two types of tower (LVRB top/bottom)
955 
956  if ((tower>12 && tower<21) || (tower>28 && tower<37) ||
957  (tower>44 && tower<53) || (tower>60 && tower<69))
958  return true;
959  else
960  return false;
961 }
std::vector< DetId > EcalElectronicsMapping::stripConstituents ( int  dccId,
int  tower,
int  strip 
) const

Get the constituent detids for this dccId.

Definition at line 661 of file EcalElectronicsMapping.cc.

References EcalBarrel, EBDetId::ETAPHIMODE, mps_monitormerge::items, and HcalDigiParam_cfi::zside.

661  {
662 
664  std::vector<DetId> items;
665 
666  if (sub == EcalBarrel) {
667 
668  int iz = zside(dccId, DCCMODE);
669  bool RightTower = rightTower(tower);
670  int smid = 0;
671  int iphi = 0;
672  if (iz < 0) {
673  smid = dccId + 19 - DCCID_PHI0_EBM;
674  iphi = (smid - 19) * kCrystalsInPhi;
675  iphi += 5 * ( (tower-1) % kTowersInPhi );
676  }
677  else {
678  smid = dccId +1 - DCCID_PHI0_EBP;
679  iphi = (smid - 1) * kCrystalsInPhi;
680  iphi += 5 * (
681  kTowersInPhi - ( (tower-1) % kTowersInPhi ) -1
682  );
683  }
684  int ieta = 5 * ((tower-1) / kTowersInPhi) + 1;
685  if (RightTower) {
686  ieta += (strip-1);
687  }
688  else {
689  ieta += 4 - (strip-1);
690  }
691  for (int ip=1; ip <=5; ip++) {
692  int ieta_xtal = ieta ;
693  int iphi_xtal = iphi + ip;
694  if (iz < 0) ieta_xtal = -ieta_xtal;
695  EBDetId ebdetid(ieta_xtal,iphi_xtal,EBDetId::ETAPHIMODE);
696  items.emplace_back(ebdetid);
697  }
698 
699  return items;
700  }
701  else {
702  EcalElectronicsMap_by_DccId_TowerId_and_StripId::const_iterator lb,ub;
703  boost::tuples::tie(lb,ub)=get<5>(m_items).equal_range(boost::make_tuple(int(dccId), int(tower), int(strip)));
704  while (lb != ub) {
705  DetId cell = lb -> cell;
706  items.emplace_back(cell);
707  ++ lb;
708  }
709  return items;
710  }
711 
712 }
int zside(int dcctcc, int mode) const
static const int ETAPHIMODE
Definition: EBDetId.h:166
bool rightTower(int tower) const
Definition: DetId.h:18
EcalSubdetector subdet(int dccid, int mode) const
EcalSubdetector
unsigned dccId(DetId const &)
EcalSubdetector EcalElectronicsMapping::subdet ( int  dccid,
int  mode 
) const

Definition at line 917 of file EcalElectronicsMapping.cc.

References EcalBarrel, EcalEndcap, and Exception.

917  {
918  if (mode == DCCMODE) {
919  if ( (dcctcc >= MIN_DCCID_EBM && dcctcc <= MAX_DCCID_EBM) ||
920  (dcctcc >= MIN_DCCID_EBP && dcctcc <= MAX_DCCID_EBP) ) return EcalBarrel;
921  else return EcalEndcap;
922  }
923  else if (mode == TCCMODE) {
924  if ( (dcctcc >= MIN_TCCID_EBM && dcctcc <= MAX_TCCID_EBM) ||
925  (dcctcc >= MIN_TCCID_EBP && dcctcc <= MAX_TCCID_EBP) ) return EcalBarrel;
926  else return EcalEndcap;
927  }
928  else throw cms::Exception("InvalidDetId") << " Wrong mode in EcalElectronicsMapping::subdet " << mode << ".";
929 }
std::vector< DetId > EcalElectronicsMapping::tccConstituents ( int  tccId) const

Get the constituent detids for this dccId.

Definition at line 715 of file EcalElectronicsMapping.cc.

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

Referenced by EcalElectronicsMapper::fillMaps().

715  {
716 
718  std::vector<DetId> items;
719 
720  if (sub == EcalBarrel) {
721  int iz = zside(tccId,TCCMODE);
722  int dccId = tccId;
723  if (iz > 0) dccId = dccId - TCCID_PHI0_EBP + DCCID_PHI0_EBP;
724  else dccId = dccId - TCCID_PHI0_EBM + DCCID_PHI0_EBM;
725  items = dccConstituents(dccId);
726  return items;
727  }
728  else {
729  EcalElectronicsMap_by_TccId::const_iterator lb,ub;
730  boost::tuples::tie(lb,ub)=get<6>(m_items).equal_range(tccId);
731  while (lb != ub) {
732  DetId cell = lb -> cell;
733  items.emplace_back(cell);
734  ++ lb;
735  }
736  return items;
737  }
738 }
std::vector< DetId > dccConstituents(int dccId) const
Get the constituent detids for this dccId.
unsigned tccId(DetId const &)
int zside(int dcctcc, int mode) const
Definition: DetId.h:18
EcalSubdetector subdet(int dccid, int mode) const
EcalSubdetector
unsigned dccId(DetId const &)
int EcalElectronicsMapping::TCCid ( const EBDetId id) const

returns the TCCid of an EBDetId

Definition at line 92 of file EcalElectronicsMapping.cc.

References HcalDigiParam_cfi::zside.

Referenced by EcalTPGParamBuilder::analyze(), and ecaldqm::tccId().

98 {
99  int tcc = id.ism();
100  if (id.zside() < 0) {
101  tcc += TCCID_PHI0_EBM - 19;
102  }
103  else {
104  tcc += TCCID_PHI0_EBP -1;
105  }
106  return tcc;
107 }
int zside(int dcctcc, int mode) const
int EcalElectronicsMapping::TCCid ( const EcalTrigTowerDetId id) const

returns the TCCid of a Trigger Tower

Definition at line 161 of file EcalElectronicsMapping.cc.

References EcalBarrel, EcalEndcap, Exception, SurfaceOrientation::inner, and HcalDigiParam_cfi::zside.

161  {
162 
163  if ( id.subDet() == EcalBarrel )
164  {
165  int phi = id.iphi() +2;
166  if (phi > 72) phi = phi-72;
167  int tcc = ( phi - 1 ) / kEBTowersInPhi + 1;
168  if ( id.zside() < 0 ) tcc += 18; // now id is the SMid
169  if (id.zside() < 0) {
170  tcc += TCCID_PHI0_EBM - 19;
171  }
172  else {
173  tcc += TCCID_PHI0_EBP -1;
174  }
175  return tcc;
176  }
177 
178  else if ( id.subDet() == EcalEndcap )
179  {
180  int ie = id.ietaAbs();
181  bool inner = (ie >= iEEEtaMinInner);
182  int ip = id.iphi(); // iphi = 1 corresponds to 0 < phi < 5 degrees
183  ip = (ip + 1) % (kEETowersInPhiPerQuadrant*4);
184  // now iphi between 0 and 71,
185  // with iphi=0,1,2,3 in 1st Phi sector
186  int Phiindex = ip / 4;
187  if (inner) {
188  if (id.ieta()> 0) Phiindex += TCCID_PHI0_EEP_IN;
189  else Phiindex += TCCID_PHI0_EEM_IN;
190  }
191  else {
192  if (id.ieta() > 0) Phiindex += TCCID_PHI0_EEP_OUT;
193  else Phiindex += TCCID_PHI0_EEM_OUT;
194  }
195  return Phiindex;
196  }
197  else {
198  throw cms::Exception("InvalidDetId") << " Wrong EcalTrigTowerDetId in EcalElectronicsMapping::TCCid.";
199  return 0;
200  }
201 }
static const int TCCID_PHI0_EEP_IN
static const int TCCID_PHI0_EEM_OUT
static const int TCCID_PHI0_EEM_IN
int zside(int dcctcc, int mode) const
static const int kEETowersInPhiPerQuadrant
static const int TCCID_PHI0_EEP_OUT
std::vector< DetId > EcalElectronicsMapping::ttConstituents ( int  tccId,
int  tt 
) const

Get the constituent detids for this dccId.

Definition at line 742 of file EcalElectronicsMapping.cc.

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

742  {
743 
745  std::vector<DetId> items;
746 
747  if (sub == EcalBarrel) {
748  int iz = zside(tccId,TCCMODE);
749  int dccId = tccId;
750  if (iz > 0) dccId = dccId - TCCID_PHI0_EBP + DCCID_PHI0_EBP;
751  else dccId = dccId - TCCID_PHI0_EBM + DCCID_PHI0_EBM;
752  items = dccTowerConstituents(dccId,tt);
753  return items;
754  }
755  else {
756  EcalElectronicsMap_by_TccId_and_TtId::const_iterator lb,ub;
757  boost::tuples::tie(lb,ub)=get<7>(m_items).equal_range(boost::make_tuple(int(tccId), int(tt)));
758  while (lb != ub) {
759  DetId cell = lb -> cell;
760  items.emplace_back(cell);
761  ++ lb;
762  }
763  return items;
764  }
765 }
unsigned tccId(DetId const &)
int zside(int dcctcc, int mode) const
Definition: DetId.h:18
EcalSubdetector subdet(int dccid, int mode) const
EcalSubdetector
unsigned dccId(DetId const &)
std::vector< DetId > dccTowerConstituents(int dccId, int tower) const
Get the constituent detids for this dccId.
int EcalElectronicsMapping::zside ( int  dcctcc,
int  mode 
) const

Definition at line 932 of file EcalElectronicsMapping.cc.

References Exception.

932  {
933  if (mode == DCCMODE) {
934  if (dcctcc >= MIN_DCCID_EBM && dcctcc <= MAX_DCCID_EBM) return -1;
935  if (dcctcc >= MIN_DCCID_EBP && dcctcc <= MAX_DCCID_EBP) return +1;
936  if (dcctcc >= MIN_DCCID_EEM && dcctcc <= MAX_DCCID_EEM) return -1;
937  if (dcctcc >= MIN_DCCID_EEP && dcctcc <= MAX_DCCID_EEP) return +1;
938  }
939  else if (mode == TCCMODE) {
940  if (dcctcc >= MIN_TCCID_EBM && dcctcc <= MAX_TCCID_EBM) return -1;
941  if (dcctcc >= MIN_TCCID_EBP && dcctcc <= MAX_TCCID_EBP) return +1;
942  if (dcctcc >= MIN_TCCID_EEM && dcctcc <= MAX_TCCID_EEM) return -1;
943  if (dcctcc >= MIN_TCCID_EEP && dcctcc <= MAX_TCCID_EEP) return +1;
944  }
945  else {
946  throw cms::Exception("InvalidDetId") << " Wrong mode in EcalElectronicsMapping::zside " << mode << ".";
947  }
948  return 0;
949 }

Member Data Documentation

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

Definition at line 174 of file EcalElectronicsMapping.h.

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

Definition at line 175 of file EcalElectronicsMapping.h.

const int EcalElectronicsMapping::DCCMODE = 0
staticprivate

Definition at line 209 of file EcalElectronicsMapping.h.

const int EcalElectronicsMapping::iEEEtaMinInner = 22
static

Definition at line 159 of file EcalElectronicsMapping.h.

const int EcalElectronicsMapping::iEEEtaMinOuter = 18
static

Definition at line 158 of file EcalElectronicsMapping.h.

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

Definition at line 144 of file EcalElectronicsMapping.h.

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

Definition at line 151 of file EcalElectronicsMapping.h.

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

Definition at line 149 of file EcalElectronicsMapping.h.

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

Definition at line 150 of file EcalElectronicsMapping.h.

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

Definition at line 152 of file EcalElectronicsMapping.h.

const int EcalElectronicsMapping::kEETowersInEtaPerInnerTCC = 7
static

Definition at line 156 of file EcalElectronicsMapping.h.

const int EcalElectronicsMapping::kEETowersInEtaPerOuterTCC = 4
static

Definition at line 157 of file EcalElectronicsMapping.h.

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

Definition at line 153 of file EcalElectronicsMapping.h.

const int EcalElectronicsMapping::kEETowersInPhiPerTCC = 4
static

Definition at line 155 of file EcalElectronicsMapping.h.

const int EcalElectronicsMapping::kTCCinPhi = 18
static

Definition at line 197 of file EcalElectronicsMapping.h.

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

Definition at line 145 of file EcalElectronicsMapping.h.

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

Definition at line 296 of file EcalElectronicsMapping.h.

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

Definition at line 297 of file EcalElectronicsMapping.h.

EcalElectronicsMap EcalElectronicsMapping::m_items
private

Definition at line 289 of file EcalElectronicsMapping.h.

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

Definition at line 163 of file EcalElectronicsMapping.h.

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

Definition at line 168 of file EcalElectronicsMapping.h.

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

Definition at line 170 of file EcalElectronicsMapping.h.

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

Definition at line 166 of file EcalElectronicsMapping.h.

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

Definition at line 172 of file EcalElectronicsMapping.h.

const int EcalElectronicsMapping::MAX_LM = 92
static

Definition at line 204 of file EcalElectronicsMapping.h.

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

Definition at line 178 of file EcalElectronicsMapping.h.

Referenced by TCCBlockFormatter::DigiToRaw().

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

Definition at line 183 of file EcalElectronicsMapping.h.

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

Definition at line 185 of file EcalElectronicsMapping.h.

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

Definition at line 181 of file EcalElectronicsMapping.h.

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

Definition at line 187 of file EcalElectronicsMapping.h.

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

Definition at line 164 of file EcalElectronicsMapping.h.

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

Definition at line 167 of file EcalElectronicsMapping.h.

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

Definition at line 169 of file EcalElectronicsMapping.h.

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

Definition at line 165 of file EcalElectronicsMapping.h.

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

Definition at line 171 of file EcalElectronicsMapping.h.

const int EcalElectronicsMapping::MIN_LM_EBM = 1
static

Definition at line 201 of file EcalElectronicsMapping.h.

const int EcalElectronicsMapping::MIN_LM_EBP = 37
static

Definition at line 202 of file EcalElectronicsMapping.h.

const int EcalElectronicsMapping::MIN_LM_EEM = 73
static

Definition at line 200 of file EcalElectronicsMapping.h.

const int EcalElectronicsMapping::MIN_LM_EEP = 83
static

Definition at line 203 of file EcalElectronicsMapping.h.

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

Definition at line 179 of file EcalElectronicsMapping.h.

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

Definition at line 182 of file EcalElectronicsMapping.h.

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

Definition at line 184 of file EcalElectronicsMapping.h.

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

Definition at line 180 of file EcalElectronicsMapping.h.

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

Definition at line 186 of file EcalElectronicsMapping.h.

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

Definition at line 189 of file EcalElectronicsMapping.h.

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

Definition at line 190 of file EcalElectronicsMapping.h.

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

Definition at line 192 of file EcalElectronicsMapping.h.

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

Definition at line 193 of file EcalElectronicsMapping.h.

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

Definition at line 194 of file EcalElectronicsMapping.h.

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

Definition at line 195 of file EcalElectronicsMapping.h.

const int EcalElectronicsMapping::TCCMODE = 1
staticprivate

Definition at line 210 of file EcalElectronicsMapping.h.