CMS 3D CMS Logo

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

#include <EcalTrigTowerConstituentsMap.h>

Classes

struct  MapItem
 

Public Member Functions

void assign (const DetId &cell, const EcalTrigTowerDetId &tower)
 set the association between a DetId and a tower More...
 
std::vector< DetIdconstituentsOf (const EcalTrigTowerDetId &id) const
 Get the constituent detids for this tower id. More...
 
 EcalTrigTowerConstituentsMap ()
 
EcalTrigTowerDetId towerOf (const DetId &id) const
 Get the tower id for this det id (or null if not known) More...
 

Static Public Member Functions

static EcalTrigTowerDetId barrelTowerOf (const DetId &id)
 

Private Types

typedef boost::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_non_unique< boost::multi_index::member< MapItem, EcalTrigTowerDetId, &MapItem::tower > > > > EcalTowerMap
 
typedef EcalTowerMap::nth_index< 0 >::type EcalTowerMap_by_DetId
 
typedef EcalTowerMap::nth_index< 1 >::type EcalTowerMap_by_towerDetId
 

Private Member Functions

DetId changeEEDetIdQuadrantAndZ (const DetId &fromid, const int &toQuadrant, const int &tozside) const
 
int changeTowerQuadrant (int phiTower, int fromQuadrant, int toQuadrant) const
 
DetId wrapEcalTrigTowerDetId (const DetId &id) const
 Wrap a generic EcalTrigTowerDetId to the equivalent one in z+ Quadrant 1 (from 0 < phi < pi/2) More...
 
DetId wrapEEDetId (const DetId &id) const
 Wrap a generic EEDetId to the equivalent one in z+ Quadrant 1 (from 0 < phi < pi/2) More...
 

Private Attributes

EcalTowerMap m_items
 

Detailed Description

Author
P.Meridiani

Definition at line 19 of file EcalTrigTowerConstituentsMap.h.

Member Typedef Documentation

◆ EcalTowerMap

typedef boost::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_non_unique< boost::multi_index::member<MapItem, EcalTrigTowerDetId, &MapItem::tower> > > > EcalTrigTowerConstituentsMap::EcalTowerMap
private

Definition at line 56 of file EcalTrigTowerConstituentsMap.h.

◆ EcalTowerMap_by_DetId

typedef EcalTowerMap::nth_index<0>::type EcalTrigTowerConstituentsMap::EcalTowerMap_by_DetId
private

Definition at line 58 of file EcalTrigTowerConstituentsMap.h.

◆ EcalTowerMap_by_towerDetId

typedef EcalTowerMap::nth_index<1>::type EcalTrigTowerConstituentsMap::EcalTowerMap_by_towerDetId
private

Definition at line 59 of file EcalTrigTowerConstituentsMap.h.

Constructor & Destructor Documentation

◆ EcalTrigTowerConstituentsMap()

EcalTrigTowerConstituentsMap::EcalTrigTowerConstituentsMap ( )

Definition at line 10 of file EcalTrigTowerConstituentsMap.cc.

10 {}

Member Function Documentation

◆ assign()

void EcalTrigTowerConstituentsMap::assign ( const DetId cell,
const EcalTrigTowerDetId tower 
)

set the association between a DetId and a tower

Definition at line 163 of file EcalTrigTowerConstituentsMap.cc.

References TauDecayModes::dec, Exception, m_items, DetId::rawId(), and l1tHGCalTowerProducer_cfi::tower.

Referenced by EcalTrigTowerConstituentsMapBuilder::parseTextMap().

163  {
164  if (m_items.find(cell) != m_items.end()) {
165  throw cms::Exception("EcalTrigTowers")
166  << "Cell with id " << std::hex << cell.rawId() << std::dec << " is already mapped to a EcalTrigTower "
167  << m_items.find(cell)->tower << std::endl;
168  }
169 
170  m_items.insert(MapItem(cell, tower));
171 }
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57

◆ barrelTowerOf()

EcalTrigTowerDetId EcalTrigTowerConstituentsMap::barrelTowerOf ( const DetId id)
static

Definition at line 12 of file EcalTrigTowerConstituentsMap.cc.

References cms::cuda::assert(), DetId::Ecal, EcalBarrel, and EBDetId::tower().

Referenced by EcalEBTrigPrimTestAlgo::fillMap(), and EcalTrigPrimFunctionalAlgo::fillMap().

12  {
13  assert(id.det() == DetId::Ecal && id.subdetId() == EcalBarrel);
14  //--------------------
15  // Ecal Barrel
16  //--------------------
17  EBDetId myId(id);
18  return myId.tower();
19 }
assert(be >=bs)

◆ changeEEDetIdQuadrantAndZ()

DetId EcalTrigTowerConstituentsMap::changeEEDetIdQuadrantAndZ ( const DetId fromid,
const int &  toQuadrant,
const int &  tozside 
) const
private

Definition at line 105 of file EcalTrigTowerConstituentsMap.cc.

References DetId::det(), DetId::Ecal, EcalEndcap, EEDetId::iquadrant(), EEDetId::ix(), EEDetId::iy(), DetId::subdetId(), and EEDetId::XYMODE.

107  {
108  if (!(fromid.det() == DetId::Ecal && fromid.subdetId() == EcalEndcap))
109  return EEDetId(0);
110 
111  EEDetId myId(fromid);
112  int dQuadrant = toQuadrant - myId.iquadrant();
113  switch (dQuadrant % 4) {
114  case 0:
115  return DetId(EEDetId(myId.ix(), myId.iy(), tozside, EEDetId::XYMODE));
116  break;
117  case 1:
118  /* adjacent tower: they are symetric*/
119  return DetId(EEDetId(101 - myId.ix(), myId.iy(), tozside, EEDetId::XYMODE));
120  break;
121  case 2:
122  /* opposite quadrant: they are identical*/
123  return DetId(EEDetId(101 - myId.ix(), 101 - myId.iy(), tozside, EEDetId::XYMODE));
124  break;
125  case 3:
126  /* adjacent tower: they are symetric*/
127  return DetId(EEDetId(myId.ix(), 101 - myId.iy(), tozside, EEDetId::XYMODE));
128  break;
129  default:
130  /*should never be reached*/
131  edm::LogError("EcalTrigTowerConstituentsMapError") << "This should never be reached. Profound error!";
132  }
133  return EEDetId(0);
134 }
static const int XYMODE
Definition: EEDetId.h:335
Log< level::Error, false > LogError
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
Definition: DetId.h:17

◆ changeTowerQuadrant()

int EcalTrigTowerConstituentsMap::changeTowerQuadrant ( int  phiTower,
int  fromQuadrant,
int  toQuadrant 
) const
private

Definition at line 136 of file EcalTrigTowerConstituentsMap.cc.

References EcalTrigTowerDetId::kEETowersInPhiPerQuadrant.

136  {
137  int newPhiTower = phiTower;
138  int dQuadrant = toQuadrant - fromQuadrant;
139 
140  switch (dQuadrant % 4) {
141  case 0:
142  newPhiTower = phiTower;
143  break;
144  case 1:
145  /* adjacent tower: they are symetric*/
146  newPhiTower = EcalTrigTowerDetId::kEETowersInPhiPerQuadrant * 2 - phiTower + 1;
147  break;
148  case 2:
149  /* opposite quadrant: they are identical*/
150  newPhiTower = phiTower + EcalTrigTowerDetId::kEETowersInPhiPerQuadrant * 2;
151  break;
152  case 3:
153  /* adjacent tower: they are symetric*/
154  newPhiTower = EcalTrigTowerDetId::kEETowersInPhiPerQuadrant * 4 - phiTower + 1;
155  break;
156  default:
157  /*should never be reached*/
158  edm::LogError("EcalTrigTowerConstituentsMapError") << "This should never be reached. Profound error!";
159  }
160  return newPhiTower;
161 }
Log< level::Error, false > LogError
static const int kEETowersInPhiPerQuadrant

◆ constituentsOf()

std::vector< DetId > EcalTrigTowerConstituentsMap::constituentsOf ( const EcalTrigTowerDetId id) const

Get the constituent detids for this tower id.

Definition at line 173 of file EcalTrigTowerConstituentsMap.cc.

References MillePedeFileConverter_cfg::e, DetId::Ecal, EcalBarrel, EcalEndcap, EcalTriggerTower, EBDetId::ETAPHIMODE, mps_monitormerge::items, m_items, AlCaHLTBitMon_ParallelJobs::p, and ecaldqm::zside().

Referenced by EcalRecHitsValidation::analyze(), ecaldqm::MESetProjection::fill(), ecaldqm::MESetDet2D::fill(), ecaldqm::MESetDet2D::findBin(), ecaldqm::MESetProjection::getBinContent(), ecaldqm::MESetDet2D::getBinContent(), ecaldqm::MESetProjection::getBinEntries(), ecaldqm::MESetDet2D::getBinEntries(), ecaldqm::MESetProjection::getBinError(), ecaldqm::MESetDet2D::getBinError(), ecaldqm::MESet::maskMatches(), EcalDetIdToBeRecoveredProducer::produce(), ecaldqm::TimingClient::producePlots(), EcalRecHitWorkerRecover::run(), ecaldqm::TrigPrimTask::runOnEmulTPs(), ecaldqm::TrigPrimTask::runOnRealTPs(), ecaldqm::MESetProjection::setBinContent(), ecaldqm::MESetDet2D::setBinContent(), ecaldqm::MESetProjection::setBinEntries(), ecaldqm::MESetDet2D::setBinEntries(), ecaldqm::MESetProjection::setBinError(), ecaldqm::MESetDet2D::setBinError(), and ecaldqm::DQWorkerClient::towerAverage_().

173  {
174  std::vector<DetId> items;
175 
176  if (id.det() == DetId::Ecal && id.subdetId() == EcalTriggerTower && id.subDet() == EcalBarrel) {
177  //--------------------
178  // Ecal Barrel
179  //--------------------
180  // trigger towers are 5x5 crystals in the barrel
181  int etaxtalMin = (id.ietaAbs() - 1) * 5 + 1;
182  int phixtalMin = ((id.iphi() - 1) * 5 + 11) % 360;
183  if (phixtalMin <= 0)
184  phixtalMin += 360;
185  int etaxtalMax = id.ietaAbs() * 5;
186  int phixtalMax = ((id.iphi()) * 5 + 10) % 360;
187  if (phixtalMax <= 0)
188  phixtalMax += 360;
189  for (int e = etaxtalMin; e <= etaxtalMax; e++)
190  for (int p = phixtalMin; p <= phixtalMax; p++)
191  items.emplace_back(DetId(EBDetId(id.zside() * e, p, EBDetId::ETAPHIMODE)));
192  } else if (id.det() == DetId::Ecal && id.subdetId() == EcalTriggerTower && id.subDet() == EcalEndcap) {
193  //--------------------
194  // Ecal Endcap
195  //--------------------
196  //DetId myId=wrapEcalTrigTowerDetId(id);
197  EcalTowerMap_by_towerDetId::const_iterator lb, ub;
198  //boost::tuples::tie(lb,ub)=get<1>(m_items).equal_range(myId);
199  boost::tuples::tie(lb, ub) = boost::get<1>(m_items).equal_range(id);
200  while (lb != ub) {
201  //EEDetId mappedId((*lb).cell);
202  //items.emplace_back(changeEEDetIdQuadrantAndZ(mappedId,id.iquadrant(),id.zside()));
203  items.emplace_back((*lb).cell);
204  ++lb;
205  }
206  }
207 
208  return items;
209 }
int zside(DetId const &)
static const int ETAPHIMODE
Definition: EBDetId.h:158
Definition: DetId.h:17

◆ towerOf()

EcalTrigTowerDetId EcalTrigTowerConstituentsMap::towerOf ( const DetId id) const

Get the tower id for this det id (or null if not known)

Definition at line 21 of file EcalTrigTowerConstituentsMap.cc.

References DetId::Ecal, EcalBarrel, EcalEndcap, mps_fire::i, m_items, EBDetId::tower(), and EEDetId::zside().

Referenced by EcalTPGAnalyzer::analyze(), EcalRecHitWorkerRecover::estimateEnergy(), EcalEBTrigPrimTestAlgo::fillMap(), EcalTrigPrimFunctionalAlgo::fillMap(), EcalDeadCellDeltaRFilter::getChannelStatusMaps(), EcalSelectiveReadout::getCrystalInterest(), EcalTPSkimmer::produce(), EcalDetIdToBeRecoveredProducer::produce(), ecaldqm::OccupancyClient::producePlots(), EcalReadoutTools::readOutUnitOf(), PFEcalBarrelRecHitCreator::readOutUnitOf(), EcalSelectiveReadoutValidation::readOutUnitOf(), EcalRecHitWorkerRecover::run(), EcalSelectiveReadout::runSelectiveReadout0(), EcalSelectiveReadoutValidation::setTtEtSums(), and EcalSelectiveReadoutSuppressor::setTtFlags().

21  {
22  if (id.det() == DetId::Ecal && id.subdetId() == EcalBarrel) {
23  //--------------------
24  // Ecal Barrel
25  //--------------------
26  EBDetId myId(id);
27  return myId.tower();
28  } else if (id.det() == DetId::Ecal && id.subdetId() == EcalEndcap) {
29  //--------------------
30  // Ecal Endcap
31  //--------------------
32  EEDetId originalId(id);
33  // DetId wrappedId=wrapEEDetId(id);
34  DetId wrappedId(originalId);
35  EcalTowerMap::const_iterator i = m_items.find(wrappedId);
36  if (i != m_items.end()) {
37  int etaTower = i->tower.ietaAbs();
38  int phiTower = i->tower.iphi();
39  //trigger tower <-> crystal maping read
40  //..........from file and done only for 1 quadrant
41  //move from quadrant 1 to the actual one:
42  // phiTower = changeTowerQuadrant(phiTower, 1, originalId.iquadrant());
43  edm::LogVerbatim("EcalTrigTowerConstituentsMap")
44  << "EcalTrigTowerConstituentsMap " << originalId.zside() << " " << etaTower << " " << phiTower;
45  return EcalTrigTowerDetId(originalId.zside(), EcalEndcap, etaTower, phiTower);
46  }
47  }
48  return EcalTrigTowerDetId(0);
49 }
Log< level::Info, true > LogVerbatim
Definition: DetId.h:17

◆ wrapEcalTrigTowerDetId()

DetId EcalTrigTowerConstituentsMap::wrapEcalTrigTowerDetId ( const DetId id) const
private

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

Definition at line 76 of file EcalTrigTowerConstituentsMap.cc.

References DetId::det(), DetId::Ecal, EcalEndcap, EcalTriggerTower, EcalTrigTowerDetId::ietaAbs(), EcalTrigTowerDetId::iphi(), EcalTrigTowerDetId::iquadrant(), EcalTrigTowerDetId::kEETowersInPhiPerQuadrant, EcalTrigTowerDetId::subDet(), and DetId::subdetId().

76  {
77  EcalTrigTowerDetId etid(id);
78 
79  if (!(etid.det() == DetId::Ecal && etid.subdetId() == EcalTriggerTower && etid.subDet() == EcalEndcap))
80  return EcalTrigTowerDetId(0);
81 
82  switch ((etid.iquadrant() - 1) % 4) {
83  case 0:
84  return DetId(EcalTrigTowerDetId(1, EcalEndcap, etid.ietaAbs(), etid.iphi()));
85  break;
86  case 1:
88  1, EcalEndcap, etid.ietaAbs(), EcalTrigTowerDetId::kEETowersInPhiPerQuadrant * 2 - etid.iphi() + 1));
89  break;
90  case 2:
92  1, EcalEndcap, etid.ietaAbs(), etid.iphi() - EcalTrigTowerDetId::kEETowersInPhiPerQuadrant * 2));
93  break;
94  case 3:
96  1, EcalEndcap, etid.ietaAbs(), EcalTrigTowerDetId::kEETowersInPhiPerQuadrant * 4 - etid.iphi() + 1));
97  break;
98  default:
99  /*should never be reached*/
100  edm::LogError("EcalTrigTowerConstituentsMapError") << "This should never be reached. Profound error!";
101  }
102  return EcalTrigTowerDetId(0);
103 }
Log< level::Error, false > LogError
static const int kEETowersInPhiPerQuadrant
Definition: DetId.h:17

◆ wrapEEDetId()

DetId EcalTrigTowerConstituentsMap::wrapEEDetId ( const DetId id) const
private

Wrap a generic EEDetId to the equivalent one in z+ Quadrant 1 (from 0 < phi < pi/2)

Definition at line 51 of file EcalTrigTowerConstituentsMap.cc.

References DetId::det(), DetId::Ecal, EcalEndcap, EEDetId::iquadrant(), EEDetId::ix(), EEDetId::iy(), DetId::subdetId(), and EEDetId::XYMODE.

51  {
52  if (!(eeid.det() == DetId::Ecal && eeid.subdetId() == EcalEndcap))
53  return EEDetId(0);
54 
55  EEDetId myId(eeid);
56  switch ((myId.iquadrant() - 1) % 4) {
57  case 0:
58  return DetId(EEDetId(myId.ix(), myId.iy(), 1, EEDetId::XYMODE));
59  break;
60  case 1:
61  return DetId(EEDetId(101 - myId.ix(), myId.iy(), 1, EEDetId::XYMODE));
62  break;
63  case 2:
64  return DetId(EEDetId(101 - myId.ix(), 101 - myId.iy(), 1, EEDetId::XYMODE));
65  break;
66  case 3:
67  return DetId(EEDetId(myId.ix(), 101 - myId.iy(), 1, EEDetId::XYMODE));
68  break;
69  default:
70  /*should never be reached*/
71  edm::LogError("EcalTrigTowerConstituentsMapError") << "This should never be reached. Profound error!";
72  }
73  return EEDetId(0);
74 }
static const int XYMODE
Definition: EEDetId.h:335
Log< level::Error, false > LogError
Definition: DetId.h:17

Member Data Documentation

◆ m_items

EcalTowerMap EcalTrigTowerConstituentsMap::m_items
private

Definition at line 61 of file EcalTrigTowerConstituentsMap.h.

Referenced by assign(), constituentsOf(), and towerOf().