CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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

Id:
EcalElectronicsMapping.h,v 1.6 2007/12/07 19:08:12 eperez Exp
Author
P.Meridiani (INFN Roma1), E. Perez (CERN)

Definition at line 32 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 274 of file EcalElectronicsMapping.h.

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

Definition at line 280 of file EcalElectronicsMapping.h.

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

Definition at line 281 of file EcalElectronicsMapping.h.

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

Definition at line 282 of file EcalElectronicsMapping.h.

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

Definition at line 276 of file EcalElectronicsMapping.h.

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

Definition at line 277 of file EcalElectronicsMapping.h.

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

Definition at line 284 of file EcalElectronicsMapping.h.

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

Definition at line 285 of file EcalElectronicsMapping.h.

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

Definition at line 286 of file EcalElectronicsMapping.h.

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

Definition at line 278 of file EcalElectronicsMapping.h.

Constructor & Destructor Documentation

EcalElectronicsMapping::EcalElectronicsMapping ( )

Definition at line 38 of file EcalElectronicsMapping.cc.

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

Referenced by EcalElectronicsMappingBuilder::FillFromDatabase().

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

Definition at line 963 of file EcalElectronicsMapping.cc.

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

Get the constituent detids for this dccId.

Definition at line 579 of file EcalElectronicsMapping.cc.

References cond::rpcobgas::detid, EcalBarrel, EcalEndcap, edm::hlt::Exception, i, and findQualityFiles::size.

579  {
580 
581  EcalSubdetector sub = subdet(dccId,DCCMODE);
582  std::vector<DetId> items;
583 
584  if (sub == EcalBarrel) {
585  for (int tower=1; tower <= kEBTowersPerSM; tower++) {
586  std::vector<DetId> xtals = dccTowerConstituents(dccId,tower);
587  int size = xtals.size();
588  for (int i=0; i < size; i++) {
589  DetId detid = xtals[i];
590  items.push_back(detid);
591  }
592  }
593  return items;
594  }
595  else if (sub == EcalEndcap) {
596  EcalElectronicsMap_by_DccId::const_iterator lb,ub;
597  boost::tuples::tie(lb,ub)=get<3>(m_items).equal_range(dccId);
598  while (lb != ub) {
599  DetId cell = lb -> cell;
600  items.push_back(cell);
601  ++ lb;
602  }
603  return items;
604  }
605  else throw cms::Exception("InvalidDetId") << "Wrong dccId = " << dccId << " in EcalElectronicsMapping::dccConstituents. ";
606 }
int i
Definition: DBlmapReader.cc:9
Definition: DetId.h:20
EcalSubdetector subdet(int dccid, int mode) const
EcalSubdetector
tuple size
Write out results.
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 73 of file EcalElectronicsMapping.cc.

Referenced by HLTAlCa::analyze(), EcalTPGParamBuilder::analyze(), and Numbers::iSM().

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

References EcalBarrel, EcalEndcap, edm::hlt::Exception, evf::evtn::offset(), and phi.

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

Get the constituent detids for this dccId.

Definition at line 610 of file EcalElectronicsMapping.cc.

References EcalBarrel, EcalEndcap, EBDetId::ETAPHIMODE, and edm::hlt::Exception.

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

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

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

Referenced by EcalSelectiveReadoutValidation::dccCh(), EcalSelectiveReadoutValidation::dccId(), EcalSelectiveReadout::eeRuInterest(), Numbers::iSC(), Numbers::iSM(), and EcalSelectiveReadout::printDccChMap().

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

Get the detid given an electronicsId.

Definition at line 422 of file EcalElectronicsMapping.cc.

References ExpressReco_HICollisions_FallBack::e, EcalBarrel, EcalEndcap, end, EBDetId::ETAPHIMODE, edm::hlt::Exception, spr::find(), and strip().

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

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

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

523  {
524 
525  EcalSubdetector subdet = id.subdet();
526 
527  if (subdet == EcalBarrel) {
528  const EcalElectronicsId& elid = getElectronicsId(id);
529  DetId cell = getDetId(elid);
530  return cell;
531  }
532  else if (subdet == EcalEndcap) {
533  EcalElectronicsMap_by_TriggerElectronicsId::const_iterator it=get<2>(m_items).find(id);
534  if(it==get<2>(m_items).end())
535  { DetId cell(0);
536  edm::LogError("EcalElectronicsMapping") << "Ecal mapping was asked non valid DetId";
537  return cell; }
538  DetId cell = it -> cell;
539  return cell;
540  }
541  else throw cms::Exception("InvalidDetId") << "Wrong EcalTriggerElectronicsId in EcalElectronicsMapping::getDetId." ;
542 }
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:7
EcalElectronicsId getElectronicsId(const DetId &id) const
Get the electronics id for this det id.
#define end
Definition: vmac.h:38
Definition: DetId.h:20
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 839 of file EcalElectronicsMapping.cc.

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

Referenced by EcalElectronicsMapper::fillMaps(), Numbers::getEcalScDetId(), and EcalSelectiveReadoutValidation::readOutUnitOf().

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

References EcalBarrel, EcalEndcap, end, edm::hlt::Exception, spr::find(), EBDetId::ietaAbs(), EBDetId::iphi(), strip(), and EBDetId::tower().

Referenced by EcalABAnalyzer::analyze(), EcalPerEvtLaserAnalyzer::analyze(), EcalTestPulseAnalyzer::analyze(), EcalLaserAnalyzer2::analyze(), EcalLaserAnalyzer::analyze(), EcalURecHitHists::analyze(), HLTAlCa::analyze(), EcalTPGParamBuilder::analyze(), EcalCosmicsHists::analyze(), EcalDccWeightBuilder::dbId(), EcalSelectiveReadoutValidation::dccCh(), EcalSelectiveReadout::eeRuInterest(), EcalElectronicsMapper::fillMaps(), Numbers::getEcalScDetId(), Numbers::icEE(), Numbers::iSC(), Numbers::iSM(), EEHltTask::iSM(), EBHltTask::iSM(), EcalDisplaysByEvent::makeHistos(), printStatusRecords(), EcalPedOffset::readDACs(), EcalDigiDisplay::readEBDigis(), EcalPedHists::readEBdigis(), EcalDigiDisplay::readEEDigis(), EcalPedHists::readEEdigis(), EcalSelectiveReadoutValidation::readOutUnitOf(), EcalMipGraphs::selectDigi(), EcalDisplaysByEvent::selectDigi(), EcalMipGraphs::selectHits(), and EcalDisplaysByEvent::selectHits().

332  {
333 
334  EcalSubdetector subdet = EcalSubdetector(id.subdetId());
335  if (subdet == EcalBarrel) {
336  const EBDetId ebdetid = EBDetId(id);
337 
338  int dcc = DCCid(ebdetid);
339  bool EBPlus = (zside(dcc,DCCMODE) > 0);
340  bool EBMinus = !EBPlus;
341 
342  EcalTrigTowerDetId trigtower = ebdetid.tower();
343  // int tower = trigtower.iTT();
344  int tower = iTT(trigtower);
345 
346  int ieta = EBDetId(id).ietaAbs();
347  int iphi = EBDetId(id).iphi();
348  int strip(0);
349  int channel(0);
350  bool RightTower = rightTower(tower);
351  if (RightTower) {
352  strip = (ieta-1)%5;
353  if (strip%2 == 0) {
354  if (EBMinus) channel = (iphi-1) %5;
355  if (EBPlus) channel = 4 -( (iphi-1) %5 );
356  }
357  else {
358  if (EBMinus) channel = 4 -( (iphi-1) %5 );
359  if (EBPlus) channel = (iphi-1) %5;
360  }
361  }
362  else {
363  strip = 4 - ( (ieta-1)%5 );
364  if (strip%2 == 0) {
365  if (EBMinus) channel = 4 -( (iphi-1) %5 );
366  if (EBPlus) channel = (iphi-1) %5;
367  }
368  else {
369  if (EBMinus) channel = (iphi-1) %5;
370  if (EBPlus) channel = 4 -( (iphi-1) %5 );
371  }
372  }
373  strip += 1;
374  channel += 1;
375 
376  EcalElectronicsId elid = EcalElectronicsId(dcc,tower,strip,channel);
377 
378  return elid;
379  }
380  else if (subdet == EcalEndcap) {
381  EcalElectronicsMap_by_DetId::const_iterator it=get<0>(m_items).find(id);
382  if(it==get<0>(m_items).end())
383  { EcalElectronicsId elid(0);
384  edm::LogError("EcalElectronicsMapping") << "Ecal mapping was asked non valid id";
385  return elid; }
386  EcalElectronicsId elid = it -> elid;
387  return elid;
388  }
389  else {
390  throw cms::Exception("InvalidDetId") <<
391  " Wrong DetId in EcalElectronicsMapping::getElectronicsId.";
392  }
393 
394 }
void strip(std::string &input, const std::string &blanks=" \n\t")
Definition: stringTools.cc:16
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:7
int iphi() const
get the crystal iphi
Definition: EBDetId.h:46
int zside(int dcctcc, int mode) const
EcalTrigTowerDetId tower() const
get the HCAL/trigger iphi of this crystal
Definition: EBDetId.h:52
#define end
Definition: vmac.h:38
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:42
EcalElectronicsId EcalElectronicsMapping::getElectronicsId ( const EcalTriggerElectronicsId id) const

Get the electronics id given a trigger electronicsId.

Definition at line 546 of file EcalElectronicsMapping.cc.

References EcalBarrel, EcalEndcap, end, edm::hlt::Exception, spr::find(), strip(), and EcalElectronicsId::subdet().

546  {
547 
548  EcalSubdetector subdet = id.subdet();
549 
550  if (subdet == EcalBarrel) {
551  int strip = id.pseudoStripId();
552  int xtal = id.channelId();
553  int tower = id.ttId();
554  int dcc = id.tccId();
555  if (id.zside() < 0) {
557  }
558  else {
560  }
561  EcalElectronicsId elid(dcc,tower,strip,xtal);
562  return elid;
563  }
564  else if (subdet == EcalEndcap) {
565  EcalElectronicsMap_by_TriggerElectronicsId::const_iterator it=get<2>(m_items).find(id);
566  if(it==get<2>(m_items).end())
567  { EcalElectronicsId elid(0);
568  edm::LogError("EcalElectronicsMapping") << "Ecal mapping was asked non valid id";
569  return elid; }
570  EcalElectronicsId elid = it -> elid;
571  return elid;
572  }
573  else throw cms::Exception("InvalidDetId") << "Wrong EcalTriggerElectronicsId in EcalElectronicsMapping::getElectronicsId.";
574 }
void strip(std::string &input, const std::string &blanks=" \n\t")
Definition: stringTools.cc:16
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:7
int zside(int dcctcc, int mode) const
#define end
Definition: vmac.h:38
EcalSubdetector subdet(int dccid, int mode) const
EcalSubdetector
int EcalElectronicsMapping::GetFED ( double  eta,
double  phi 
) const

Definition at line 1112 of file EcalElectronicsMapping.cc.

Referenced by EcalRegionCabling::elementIndex(), HLTAlCa::ListOfFEDS(), and EcalRegionCabling::updateEcalRefGetterWithEtaPhi().

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

Definition at line 974 of file EcalElectronicsMapping.cc.

References reco_application_2006h2rawdata_ecalLocalReco_cfg::FEDs.

Referenced by HLTAlCa::ListOfFEDS(), and ECALRegFEDSelector::produce().

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

Definition at line 979 of file EcalElectronicsMapping.cc.

References gather_cfg::cout, debug, deltaR(), EcalEtaPhiRegion::etaHigh(), EcalEtaPhiRegion::etaLow(), EcalEtaPhiRegion::phiHigh(), EcalEtaPhiRegion::phiLow(), and Geom::pi().

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

Definition at line 1147 of file EcalElectronicsMapping.cc.

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

Referenced by EcalCosmicsHists::analyze().

1147  {
1148 
1149 // Laser Monitoring readout number.
1150 
1151  EcalSubdetector subdet = EcalSubdetector(id.subdetId());
1152 
1153  if (subdet == EcalBarrel) {
1154  const EBDetId ebdetid = EBDetId(id);
1155  int dccid = DCCid(ebdetid);
1156  std::map<int, int>::const_iterator it = LaserMonitoringMap_EB.find(dccid);
1157  if (it != LaserMonitoringMap_EB.end() ) {
1158  int ilm = it -> second;
1159  int iETA = ebdetid.ietaSM();
1160  int iPHI = ebdetid.iphiSM();
1161  if (iPHI > 10 && iETA>5) {ilm ++; } ;
1162  return ilm;
1163  }
1164  else throw cms::Exception("InvalidDCCId") << "Wrong DCCId (EB) in EcalElectronicsMapping::getLMNumber.";
1165  }
1166 
1167  else if (subdet == EcalEndcap) {
1169  int dccid = elid.dccId();
1170  EEDetId eedetid = EEDetId(id);
1171  std::map<int, int>::const_iterator it = LaserMonitoringMap_EE.find(dccid);
1172  if (it != LaserMonitoringMap_EB.end() ) {
1173  int ilm = it -> second;
1174  if (dccid == 8) {
1175  int ix = eedetid.ix();
1176  if (ix > 50) ilm += 1;
1177  }
1178  if (dccid == 53) {
1179  int ix = eedetid.ix();
1180  if (ix > 50) ilm += 1;
1181  }
1182  return ilm;
1183  }
1184  else throw cms::Exception("InvalidDCCId") << "Wrong DCCId (EE) in EcalElectronicsMapping::getLMNumber.";
1185  }
1186 
1187  return -1;
1188 }
int ix() const
Definition: EEDetId.h:71
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:62
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:60
EcalSubdetector
EcalTriggerElectronicsId EcalElectronicsMapping::getTriggerElectronicsId ( const DetId id) const

Get the trigger electronics id for this det id.

Definition at line 397 of file EcalElectronicsMapping.cc.

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

Referenced by EcalTPGParamBuilder::analyze(), EcalElectronicsMapper::fillMaps(), EcalTrigPrimFunctionalAlgo::findStripNr(), and EcalFenixStrip::process().

397  {
398  EcalSubdetector subdet = EcalSubdetector(id.subdetId());
399 
400  if (subdet == EcalBarrel) {
401 
402  const EcalElectronicsId& elid = getElectronicsId(id);
404  return trelid;
405  }
406  else if (subdet == EcalEndcap) {
407  EcalElectronicsMap_by_DetId::const_iterator it=get<0>(m_items).find(id);
408  if(it==get<0>(m_items).end())
409  { EcalTriggerElectronicsId trelid(0);
410  edm::LogError("EcalElectronicsMapping") << "Ecal mapping was asked non valid trig id";
411  return trelid; }
412  EcalTriggerElectronicsId trelid = it -> trelid;
413  return trelid;
414  }
415  else {
416  throw cms::Exception("InvalidDetId") <<
417  " Wrong DetId in EcalElectronicsMapping::getTriggerElectronicsId.";
418  }
419 }
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:7
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:38
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 491 of file EcalElectronicsMapping.cc.

References EcalBarrel, EcalEndcap, end, edm::hlt::Exception, spr::find(), strip(), and EcalTriggerElectronicsId::subdet().

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

References abs, EcalBarrel, EcalEndcap, edm::hlt::Exception, SurfaceOrientation::inner, SurfaceOrientation::outer, and EcalTrigTowerDetId::SUBDETIJMODE.

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

251  {
252 
253  // needed for unpacking code.
254 
256  int zIndex = zside(TCCid, TCCMODE);
257 
258  if (sub == EcalBarrel) {
259 
260  int DCCid =0;
261  int jtower = iTT-1;
262  if (zIndex > 0) DCCid = TCCid - TCCID_PHI0_EBP + DCCID_PHI0_EBP;
263  else DCCid = TCCid - TCCID_PHI0_EBM + DCCID_PHI0_EBM;
264  int SMid = (zIndex > 0) ? DCCid - 27 : DCCid + 9;
265 
266  int etaTT = jtower / kTowersInPhi +1; // between 1 and 17
267  int phiTT;
268 
269  if (zIndex > 0)
270  phiTT=(SMid - 1) * kTowersInPhi + (kTowersInPhi -(jtower % kTowersInPhi)) -1;
271  else
272  phiTT=(SMid - 19)* kTowersInPhi + jtower % kTowersInPhi;
273  phiTT ++;
274  phiTT = phiTT -2;
275  if (phiTT <= 0) phiTT = 72+phiTT;
276  EcalTrigTowerDetId tdetid(zIndex, EcalBarrel, etaTT, phiTT,EcalTrigTowerDetId::SUBDETIJMODE);
277  return tdetid;
278  }
279 
280  else if (sub == EcalEndcap) {
281 
282  bool EEminus = (zIndex <0);
283  bool EEplus = (zIndex >0);
284  if ( (!EEminus) && (!EEplus) )
285  throw cms::Exception("InvalidDetId") <<
286  "EcalElectronicsMapping: Cannot create EcalTrigTowerDetId object. " ;
287  int iz = 0;
288  int tcc = TCCid;
289  if (tcc < TCCID_PHI0_EEM_OUT+kTCCinPhi) iz = -1;
290  else if (tcc >= TCCID_PHI0_EEP_OUT) iz = +1;
291 
292  bool inner = false;
293  if (iz < 0 && tcc >= TCCID_PHI0_EEM_IN && tcc < TCCID_PHI0_EEM_IN+kTCCinPhi) inner=true;
294  if (iz > 0 && tcc >= TCCID_PHI0_EEP_IN && tcc < TCCID_PHI0_EEP_IN+kTCCinPhi) inner=true;
295  bool outer = !inner;
296 
297  int ieta = (iTT-1) / kEETowersInPhiPerTCC;
298  int iphi = (iTT-1) % kEETowersInPhiPerTCC;
299  if (inner) ieta += iEEEtaMinInner;
300  else ieta += iEEEtaMinOuter;
301  if (iz < 0) ieta = -ieta;
302 
303  int TCC_origin = 0;
304  if (inner && iz < 0) TCC_origin=TCCID_PHI0_EEM_IN;
305  if (outer && iz < 0) TCC_origin=TCCID_PHI0_EEM_OUT;
306  if (inner && iz > 0) TCC_origin=TCCID_PHI0_EEP_IN;
307  if (outer && iz > 0) TCC_origin=TCCID_PHI0_EEP_OUT;
308  tcc = tcc - TCC_origin;
309 
310  iphi += kEETowersInPhiPerTCC * tcc;
311  iphi = (iphi -2 + 4*kEETowersInPhiPerQuadrant) % (4*kEETowersInPhiPerQuadrant) + 1;
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  }
320  else {
321  throw cms::Exception("InvalidDetId") <<
322  " Wrong indices in EcalElectronicsMapping::getTrigTowerDetId. TCCid = " << TCCid << " iTT = " << iTT << ".";
323  }
324 
325 
326 }
static const int TCCID_PHI0_EEP_IN
static const int SUBDETIJMODE
#define abs(x)
Definition: mlp_lapack.h:159
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
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 110 of file EcalElectronicsMapping.cc.

References EcalBarrel, EcalEndcap, edm::hlt::Exception, SurfaceOrientation::inner, and phi.

Referenced by EcalTPGParamBuilder::analyze(), and Numbers::crystals().

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

Get the constituent detids for this dccId.

Definition at line 767 of file EcalElectronicsMapping.cc.

References EcalBarrel.

767  {
768 
769  EcalSubdetector sub = subdet(tccId,TCCMODE);
770  std::vector<DetId> items;
771 
772  if (sub == EcalBarrel) {
773  int iz = zside(tccId,TCCMODE);
774  int dccId = tccId;
775  if (iz > 0) dccId = dccId - TCCID_PHI0_EBP + DCCID_PHI0_EBP;
776  else dccId = dccId - TCCID_PHI0_EBM + DCCID_PHI0_EBM;
777  items = stripConstituents(dccId,tt,pseudostrip);
778  return items;
779  }
780  else {
781  EcalElectronicsMap_by_TccId_TtId_and_PseudostripId::const_iterator lb,ub;
782  boost::tuples::tie(lb,ub)=get<8>(m_items).equal_range(boost::make_tuple(int(tccId), int(tt), int(pseudostrip)));
783  while (lb != ub) {
784  DetId cell = lb -> cell;
785  items.push_back(cell);
786  ++ lb;
787  }
788  return items;
789  }
790 }
int zside(int dcctcc, int mode) const
Definition: DetId.h:20
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
bool EcalElectronicsMapping::rightTower ( int  tower) const

Definition at line 952 of file EcalElectronicsMapping.cc.

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

Get the constituent detids for this dccId.

Definition at line 660 of file EcalElectronicsMapping.cc.

References EcalBarrel, and EBDetId::ETAPHIMODE.

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

Definition at line 916 of file EcalElectronicsMapping.cc.

References EcalBarrel, EcalEndcap, and edm::hlt::Exception.

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

Get the constituent detids for this dccId.

Definition at line 714 of file EcalElectronicsMapping.cc.

References EcalBarrel.

Referenced by EcalElectronicsMapper::fillMaps().

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

returns the TCCid of an EBDetId

Definition at line 91 of file EcalElectronicsMapping.cc.

Referenced by L1TdeECAL::analyze(), EcalTPGParamBuilder::analyze(), and Numbers::crystals().

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

returns the TCCid of a Trigger Tower

Definition at line 160 of file EcalElectronicsMapping.cc.

References EcalBarrel, EcalEndcap, edm::hlt::Exception, SurfaceOrientation::inner, and phi.

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

Get the constituent detids for this dccId.

Definition at line 741 of file EcalElectronicsMapping.cc.

References EcalBarrel.

Referenced by Numbers::crystals().

741  {
742 
743  EcalSubdetector sub = subdet(tccId,TCCMODE);
744  std::vector<DetId> items;
745 
746  if (sub == EcalBarrel) {
747  int iz = zside(tccId,TCCMODE);
748  int dccId = tccId;
749  if (iz > 0) dccId = dccId - TCCID_PHI0_EBP + DCCID_PHI0_EBP;
750  else dccId = dccId - TCCID_PHI0_EBM + DCCID_PHI0_EBM;
751  items = dccTowerConstituents(dccId,tt);
752  return items;
753  }
754  else {
755  EcalElectronicsMap_by_TccId_and_TtId::const_iterator lb,ub;
756  boost::tuples::tie(lb,ub)=get<7>(m_items).equal_range(boost::make_tuple(int(tccId), int(tt)));
757  while (lb != ub) {
758  DetId cell = lb -> cell;
759  items.push_back(cell);
760  ++ lb;
761  }
762  return items;
763  }
764 }
int zside(int dcctcc, int mode) const
Definition: DetId.h:20
EcalSubdetector subdet(int dccid, int mode) const
EcalSubdetector
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 931 of file EcalElectronicsMapping.cc.

References edm::hlt::Exception.

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

Member Data Documentation

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

Definition at line 175 of file EcalElectronicsMapping.h.

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

Definition at line 176 of file EcalElectronicsMapping.h.

const int EcalElectronicsMapping::DCCMODE = 0
staticprivate

Definition at line 210 of file EcalElectronicsMapping.h.

const int EcalElectronicsMapping::iEEEtaMinInner = 22
static

Definition at line 160 of file EcalElectronicsMapping.h.

const int EcalElectronicsMapping::iEEEtaMinOuter = 18
static

Definition at line 159 of file EcalElectronicsMapping.h.

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

Definition at line 145 of file EcalElectronicsMapping.h.

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

Definition at line 152 of file EcalElectronicsMapping.h.

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

Definition at line 150 of file EcalElectronicsMapping.h.

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

Definition at line 151 of file EcalElectronicsMapping.h.

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

Definition at line 153 of file EcalElectronicsMapping.h.

const int EcalElectronicsMapping::kEETowersInEtaPerInnerTCC = 7
static

Definition at line 157 of file EcalElectronicsMapping.h.

const int EcalElectronicsMapping::kEETowersInEtaPerOuterTCC = 4
static

Definition at line 158 of file EcalElectronicsMapping.h.

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

Definition at line 154 of file EcalElectronicsMapping.h.

const int EcalElectronicsMapping::kEETowersInPhiPerTCC = 4
static

Definition at line 156 of file EcalElectronicsMapping.h.

const int EcalElectronicsMapping::kTCCinPhi = 18
static

Definition at line 198 of file EcalElectronicsMapping.h.

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

Definition at line 146 of file EcalElectronicsMapping.h.

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

Definition at line 297 of file EcalElectronicsMapping.h.

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

Definition at line 298 of file EcalElectronicsMapping.h.

EcalElectronicsMap EcalElectronicsMapping::m_items
private

Definition at line 290 of file EcalElectronicsMapping.h.

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

Definition at line 164 of file EcalElectronicsMapping.h.

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

Definition at line 169 of file EcalElectronicsMapping.h.

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

Definition at line 171 of file EcalElectronicsMapping.h.

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

Definition at line 167 of file EcalElectronicsMapping.h.

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

Definition at line 173 of file EcalElectronicsMapping.h.

const int EcalElectronicsMapping::MAX_LM = 92
static

Definition at line 205 of file EcalElectronicsMapping.h.

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

Definition at line 179 of file EcalElectronicsMapping.h.

Referenced by TCCBlockFormatter::DigiToRaw().

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

Definition at line 184 of file EcalElectronicsMapping.h.

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

Definition at line 186 of file EcalElectronicsMapping.h.

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

Definition at line 182 of file EcalElectronicsMapping.h.

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

Definition at line 188 of file EcalElectronicsMapping.h.

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

Definition at line 165 of file EcalElectronicsMapping.h.

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

Definition at line 168 of file EcalElectronicsMapping.h.

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

Definition at line 170 of file EcalElectronicsMapping.h.

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

Definition at line 166 of file EcalElectronicsMapping.h.

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

Definition at line 172 of file EcalElectronicsMapping.h.

const int EcalElectronicsMapping::MIN_LM_EBM = 1
static

Definition at line 202 of file EcalElectronicsMapping.h.

const int EcalElectronicsMapping::MIN_LM_EBP = 37
static

Definition at line 203 of file EcalElectronicsMapping.h.

const int EcalElectronicsMapping::MIN_LM_EEM = 73
static

Definition at line 201 of file EcalElectronicsMapping.h.

const int EcalElectronicsMapping::MIN_LM_EEP = 83
static

Definition at line 204 of file EcalElectronicsMapping.h.

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

Definition at line 180 of file EcalElectronicsMapping.h.

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

Definition at line 183 of file EcalElectronicsMapping.h.

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

Definition at line 185 of file EcalElectronicsMapping.h.

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

Definition at line 181 of file EcalElectronicsMapping.h.

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

Definition at line 187 of file EcalElectronicsMapping.h.

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

Definition at line 190 of file EcalElectronicsMapping.h.

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

Definition at line 191 of file EcalElectronicsMapping.h.

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

Definition at line 193 of file EcalElectronicsMapping.h.

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

Definition at line 194 of file EcalElectronicsMapping.h.

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

Definition at line 195 of file EcalElectronicsMapping.h.

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

Definition at line 196 of file EcalElectronicsMapping.h.

const int EcalElectronicsMapping::TCCMODE = 1
staticprivate

Definition at line 211 of file EcalElectronicsMapping.h.