CMS 3D CMS Logo

List of all members | Classes | 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...
 

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 54 of file EcalTrigTowerConstituentsMap.h.

◆ EcalTowerMap_by_DetId

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

Definition at line 56 of file EcalTrigTowerConstituentsMap.h.

◆ EcalTowerMap_by_towerDetId

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

Definition at line 57 of file EcalTrigTowerConstituentsMap.h.

Constructor & Destructor Documentation

◆ EcalTrigTowerConstituentsMap()

EcalTrigTowerConstituentsMap::EcalTrigTowerConstituentsMap ( )

Definition at line 9 of file EcalTrigTowerConstituentsMap.cc.

9 {}

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

152  {
153  if (m_items.find(cell) != m_items.end()) {
154  throw cms::Exception("EcalTrigTowers")
155  << "Cell with id " << std::hex << cell.rawId() << std::dec << " is already mapped to a EcalTrigTower "
156  << m_items.find(cell)->tower << std::endl;
157  }
158 
159  m_items.insert(MapItem(cell, tower));
160 }

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

Referenced by EcalTrigTowerConstituentsMapBuilder::parseTextMap().

◆ changeEEDetIdQuadrantAndZ()

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

Definition at line 94 of file EcalTrigTowerConstituentsMap.cc.

96  {
97  if (!(fromid.det() == DetId::Ecal && fromid.subdetId() == EcalEndcap))
98  return EEDetId(0);
99 
100  EEDetId myId(fromid);
101  int dQuadrant = toQuadrant - myId.iquadrant();
102  switch (dQuadrant % 4) {
103  case 0:
104  return DetId(EEDetId(myId.ix(), myId.iy(), tozside, EEDetId::XYMODE));
105  break;
106  case 1:
107  /* adjacent tower: they are symetric*/
108  return DetId(EEDetId(101 - myId.ix(), myId.iy(), tozside, EEDetId::XYMODE));
109  break;
110  case 2:
111  /* opposite quadrant: they are identical*/
112  return DetId(EEDetId(101 - myId.ix(), 101 - myId.iy(), tozside, EEDetId::XYMODE));
113  break;
114  case 3:
115  /* adjacent tower: they are symetric*/
116  return DetId(EEDetId(myId.ix(), 101 - myId.iy(), tozside, EEDetId::XYMODE));
117  break;
118  default:
119  /*should never be reached*/
120  edm::LogError("EcalTrigTowerConstituentsMapError") << "This should never be reached. Profound error!";
121  }
122  return EEDetId(0);
123 }

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

◆ changeTowerQuadrant()

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

Definition at line 125 of file EcalTrigTowerConstituentsMap.cc.

125  {
126  int newPhiTower = phiTower;
127  int dQuadrant = toQuadrant - fromQuadrant;
128 
129  switch (dQuadrant % 4) {
130  case 0:
131  newPhiTower = phiTower;
132  break;
133  case 1:
134  /* adjacent tower: they are symetric*/
135  newPhiTower = EcalTrigTowerDetId::kEETowersInPhiPerQuadrant * 2 - phiTower + 1;
136  break;
137  case 2:
138  /* opposite quadrant: they are identical*/
139  newPhiTower = phiTower + EcalTrigTowerDetId::kEETowersInPhiPerQuadrant * 2;
140  break;
141  case 3:
142  /* adjacent tower: they are symetric*/
143  newPhiTower = EcalTrigTowerDetId::kEETowersInPhiPerQuadrant * 4 - phiTower + 1;
144  break;
145  default:
146  /*should never be reached*/
147  edm::LogError("EcalTrigTowerConstituentsMapError") << "This should never be reached. Profound error!";
148  }
149  return newPhiTower;
150 }

References EcalTrigTowerDetId::kEETowersInPhiPerQuadrant.

◆ constituentsOf()

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

Get the constituent detids for this tower id.

Definition at line 162 of file EcalTrigTowerConstituentsMap.cc.

162  {
163  std::vector<DetId> items;
164 
165  if (id.det() == DetId::Ecal && id.subdetId() == EcalTriggerTower && id.subDet() == EcalBarrel) {
166  //--------------------
167  // Ecal Barrel
168  //--------------------
169  // trigger towers are 5x5 crystals in the barrel
170  int etaxtalMin = (id.ietaAbs() - 1) * 5 + 1;
171  int phixtalMin = ((id.iphi() - 1) * 5 + 11) % 360;
172  if (phixtalMin <= 0)
173  phixtalMin += 360;
174  int etaxtalMax = id.ietaAbs() * 5;
175  int phixtalMax = ((id.iphi()) * 5 + 10) % 360;
176  if (phixtalMax <= 0)
177  phixtalMax += 360;
178  for (int e = etaxtalMin; e <= etaxtalMax; e++)
179  for (int p = phixtalMin; p <= phixtalMax; p++)
180  items.emplace_back(DetId(EBDetId(id.zside() * e, p, EBDetId::ETAPHIMODE)));
181  } else if (id.det() == DetId::Ecal && id.subdetId() == EcalTriggerTower && id.subDet() == EcalEndcap) {
182  //--------------------
183  // Ecal Endcap
184  //--------------------
185  //DetId myId=wrapEcalTrigTowerDetId(id);
186  EcalTowerMap_by_towerDetId::const_iterator lb, ub;
187  //boost::tuples::tie(lb,ub)=get<1>(m_items).equal_range(myId);
188  boost::tuples::tie(lb, ub) = boost::get<1>(m_items).equal_range(id);
189  while (lb != ub) {
190  //EEDetId mappedId((*lb).cell);
191  //items.emplace_back(changeEEDetIdQuadrantAndZ(mappedId,id.iquadrant(),id.zside()));
192  items.emplace_back((*lb).cell);
193  ++lb;
194  }
195  }
196 
197  return items;
198 }

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_().

◆ towerOf()

EcalTrigTowerDetId EcalTrigTowerConstituentsMap::towerOf ( const DetId id) const

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

Definition at line 11 of file EcalTrigTowerConstituentsMap.cc.

11  {
12  if (id.det() == DetId::Ecal && id.subdetId() == EcalBarrel) {
13  //--------------------
14  // Ecal Barrel
15  //--------------------
16  EBDetId myId(id);
17  return myId.tower();
18  } else if (id.det() == DetId::Ecal && id.subdetId() == EcalEndcap) {
19  //--------------------
20  // Ecal Endcap
21  //--------------------
22  EEDetId originalId(id);
23  // DetId wrappedId=wrapEEDetId(id);
24  DetId wrappedId(originalId);
25  EcalTowerMap::const_iterator i = m_items.find(wrappedId);
26  if (i != m_items.end()) {
27  int etaTower = i->tower.ietaAbs();
28  int phiTower = i->tower.iphi();
29  //trigger tower <-> crystal maping read
30  //..........from file and done only for 1 quadrant
31  //move from quadrant 1 to the actual one:
32  // phiTower = changeTowerQuadrant(phiTower, 1, originalId.iquadrant());
33  // std::cout << originalId.zside() << " " << etaTower << " " << phiTower << std::endl;
34  return EcalTrigTowerDetId(originalId.zside(), EcalEndcap, etaTower, phiTower);
35  }
36  }
37  return EcalTrigTowerDetId(0);
38 }

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

Referenced by EcalRecHitWorkerRecover::estimateEnergy(), EcalTBReadout::findTTlist(), EcalDeadCellDeltaRFilter::getChannelStatusMaps(), EcalTPSkimmer::produce(), EcalDetIdToBeRecoveredProducer::produce(), ecaldqm::OccupancyClient::producePlots(), EcalTBReadout::readOut(), EcalReadoutTools::readOutUnitOf(), PFEcalBarrelRecHitCreator::readOutUnitOf(), EcalSelectiveReadoutValidation::readOutUnitOf(), EcalRecHitWorkerRecover::run(), EcalSelectiveReadoutValidation::setTtEtSums(), and EcalSelectiveReadoutSuppressor::setTtFlags().

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

65  {
66  EcalTrigTowerDetId etid(id);
67 
68  if (!(etid.det() == DetId::Ecal && etid.subdetId() == EcalTriggerTower && etid.subDet() == EcalEndcap))
69  return EcalTrigTowerDetId(0);
70 
71  switch ((etid.iquadrant() - 1) % 4) {
72  case 0:
73  return DetId(EcalTrigTowerDetId(1, EcalEndcap, etid.ietaAbs(), etid.iphi()));
74  break;
75  case 1:
77  1, EcalEndcap, etid.ietaAbs(), EcalTrigTowerDetId::kEETowersInPhiPerQuadrant * 2 - etid.iphi() + 1));
78  break;
79  case 2:
81  1, EcalEndcap, etid.ietaAbs(), etid.iphi() - EcalTrigTowerDetId::kEETowersInPhiPerQuadrant * 2));
82  break;
83  case 3:
85  1, EcalEndcap, etid.ietaAbs(), EcalTrigTowerDetId::kEETowersInPhiPerQuadrant * 4 - etid.iphi() + 1));
86  break;
87  default:
88  /*should never be reached*/
89  edm::LogError("EcalTrigTowerConstituentsMapError") << "This should never be reached. Profound error!";
90  }
91  return EcalTrigTowerDetId(0);
92 }

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

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

40  {
41  if (!(eeid.det() == DetId::Ecal && eeid.subdetId() == EcalEndcap))
42  return EEDetId(0);
43 
44  EEDetId myId(eeid);
45  switch ((myId.iquadrant() - 1) % 4) {
46  case 0:
47  return DetId(EEDetId(myId.ix(), myId.iy(), 1, EEDetId::XYMODE));
48  break;
49  case 1:
50  return DetId(EEDetId(101 - myId.ix(), myId.iy(), 1, EEDetId::XYMODE));
51  break;
52  case 2:
53  return DetId(EEDetId(101 - myId.ix(), 101 - myId.iy(), 1, EEDetId::XYMODE));
54  break;
55  case 3:
56  return DetId(EEDetId(myId.ix(), 101 - myId.iy(), 1, EEDetId::XYMODE));
57  break;
58  default:
59  /*should never be reached*/
60  edm::LogError("EcalTrigTowerConstituentsMapError") << "This should never be reached. Profound error!";
61  }
62  return EEDetId(0);
63 }

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

Member Data Documentation

◆ m_items

EcalTowerMap EcalTrigTowerConstituentsMap::m_items
private

Definition at line 59 of file EcalTrigTowerConstituentsMap.h.

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

mps_fire.i
i
Definition: mps_fire.py:428
ecaldqm::zside
int zside(DetId const &)
Definition: EcalDQMCommonUtils.cc:189
EBDetId
Definition: EBDetId.h:17
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
DetId::det
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
hgcalTowerProducer_cfi.tower
tower
Definition: hgcalTowerProducer_cfi.py:4
EcalTrigTowerDetId
Definition: EcalTrigTowerDetId.h:14
EcalBarrel
Definition: EcalSubdetector.h:10
mps_monitormerge.items
list items
Definition: mps_monitormerge.py:29
DetId
Definition: DetId.h:17
DetId::subdetId
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
Definition: DetId.h:48
EEDetId
Definition: EEDetId.h:14
EcalEndcap
Definition: EcalSubdetector.h:10
EBDetId::ETAPHIMODE
static const int ETAPHIMODE
Definition: EBDetId.h:158
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
DetId::Ecal
Definition: DetId.h:27
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
EcalTriggerTower
Definition: EcalSubdetector.h:10
EEDetId::XYMODE
static const int XYMODE
Definition: EEDetId.h:335
Exception
Definition: hltDiff.cc:245
EcalTrigTowerDetId::kEETowersInPhiPerQuadrant
static const int kEETowersInPhiPerQuadrant
Definition: EcalTrigTowerDetId.h:104
EcalTrigTowerConstituentsMap::m_items
EcalTowerMap m_items
Definition: EcalTrigTowerConstituentsMap.h:59
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37