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 162 of file EcalTrigTowerConstituentsMap.cc.

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

Referenced by EcalTrigTowerConstituentsMapBuilder::parseTextMap().

162  {
163  if (m_items.find(cell) != m_items.end()) {
164  throw cms::Exception("EcalTrigTowers")
165  << "Cell with id " << std::hex << cell.rawId() << std::dec << " is already mapped to a EcalTrigTower "
166  << m_items.find(cell)->tower << std::endl;
167  }
168 
169  m_items.insert(MapItem(cell, tower));
170 }
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 104 of file EcalTrigTowerConstituentsMap.cc.

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

106  {
107  if (!(fromid.det() == DetId::Ecal && fromid.subdetId() == EcalEndcap))
108  return EEDetId(0);
109 
110  EEDetId myId(fromid);
111  int dQuadrant = toQuadrant - myId.iquadrant();
112  switch (dQuadrant % 4) {
113  case 0:
114  return DetId(EEDetId(myId.ix(), myId.iy(), tozside, EEDetId::XYMODE));
115  break;
116  case 1:
117  /* adjacent tower: they are symetric*/
118  return DetId(EEDetId(101 - myId.ix(), myId.iy(), tozside, EEDetId::XYMODE));
119  break;
120  case 2:
121  /* opposite quadrant: they are identical*/
122  return DetId(EEDetId(101 - myId.ix(), 101 - myId.iy(), tozside, EEDetId::XYMODE));
123  break;
124  case 3:
125  /* adjacent tower: they are symetric*/
126  return DetId(EEDetId(myId.ix(), 101 - myId.iy(), tozside, EEDetId::XYMODE));
127  break;
128  default:
129  /*should never be reached*/
130  edm::LogError("EcalTrigTowerConstituentsMapError") << "This should never be reached. Profound error!";
131  }
132  return EEDetId(0);
133 }
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 135 of file EcalTrigTowerConstituentsMap.cc.

References EcalTrigTowerDetId::kEETowersInPhiPerQuadrant.

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

172  {
173  std::vector<DetId> items;
174 
175  if (id.det() == DetId::Ecal && id.subdetId() == EcalTriggerTower && id.subDet() == EcalBarrel) {
176  //--------------------
177  // Ecal Barrel
178  //--------------------
179  // trigger towers are 5x5 crystals in the barrel
180  int etaxtalMin = (id.ietaAbs() - 1) * 5 + 1;
181  int phixtalMin = ((id.iphi() - 1) * 5 + 11) % 360;
182  if (phixtalMin <= 0)
183  phixtalMin += 360;
184  int etaxtalMax = id.ietaAbs() * 5;
185  int phixtalMax = ((id.iphi()) * 5 + 10) % 360;
186  if (phixtalMax <= 0)
187  phixtalMax += 360;
188  for (int e = etaxtalMin; e <= etaxtalMax; e++)
189  for (int p = phixtalMin; p <= phixtalMax; p++)
190  items.emplace_back(DetId(EBDetId(id.zside() * e, p, EBDetId::ETAPHIMODE)));
191  } else if (id.det() == DetId::Ecal && id.subdetId() == EcalTriggerTower && id.subDet() == EcalEndcap) {
192  //--------------------
193  // Ecal Endcap
194  //--------------------
195  //DetId myId=wrapEcalTrigTowerDetId(id);
196  EcalTowerMap_by_towerDetId::const_iterator lb, ub;
197  //boost::tuples::tie(lb,ub)=get<1>(m_items).equal_range(myId);
198  boost::tuples::tie(lb, ub) = boost::get<1>(m_items).equal_range(id);
199  while (lb != ub) {
200  //EEDetId mappedId((*lb).cell);
201  //items.emplace_back(changeEEDetIdQuadrantAndZ(mappedId,id.iquadrant(),id.zside()));
202  items.emplace_back((*lb).cell);
203  ++lb;
204  }
205  }
206 
207  return items;
208 }
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  // std::cout << originalId.zside() << " " << etaTower << " " << phiTower << std::endl;
44  return EcalTrigTowerDetId(originalId.zside(), EcalEndcap, etaTower, phiTower);
45  }
46  }
47  return EcalTrigTowerDetId(0);
48 }
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 75 of file EcalTrigTowerConstituentsMap.cc.

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

75  {
76  EcalTrigTowerDetId etid(id);
77 
78  if (!(etid.det() == DetId::Ecal && etid.subdetId() == EcalTriggerTower && etid.subDet() == EcalEndcap))
79  return EcalTrigTowerDetId(0);
80 
81  switch ((etid.iquadrant() - 1) % 4) {
82  case 0:
83  return DetId(EcalTrigTowerDetId(1, EcalEndcap, etid.ietaAbs(), etid.iphi()));
84  break;
85  case 1:
87  1, EcalEndcap, etid.ietaAbs(), EcalTrigTowerDetId::kEETowersInPhiPerQuadrant * 2 - etid.iphi() + 1));
88  break;
89  case 2:
91  1, EcalEndcap, etid.ietaAbs(), etid.iphi() - EcalTrigTowerDetId::kEETowersInPhiPerQuadrant * 2));
92  break;
93  case 3:
95  1, EcalEndcap, etid.ietaAbs(), EcalTrigTowerDetId::kEETowersInPhiPerQuadrant * 4 - etid.iphi() + 1));
96  break;
97  default:
98  /*should never be reached*/
99  edm::LogError("EcalTrigTowerConstituentsMapError") << "This should never be reached. Profound error!";
100  }
101  return EcalTrigTowerDetId(0);
102 }
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 50 of file EcalTrigTowerConstituentsMap.cc.

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

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