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

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.

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

Definition at line 56 of file EcalTrigTowerConstituentsMap.h.

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

Definition at line 57 of file EcalTrigTowerConstituentsMap.h.

Constructor & Destructor Documentation

EcalTrigTowerConstituentsMap::EcalTrigTowerConstituentsMap ( )

Definition at line 9 of file EcalTrigTowerConstituentsMap.cc.

9 {}

Member Function Documentation

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.

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

Referenced by EcalTrigTowerConstituentsMapBuilder::parseTextMap().

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 }
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
DetId EcalTrigTowerConstituentsMap::changeEEDetIdQuadrantAndZ ( const DetId fromid,
const int &  toQuadrant,
const int &  tozside 
) const
private

Definition at line 94 of file EcalTrigTowerConstituentsMap.cc.

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

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 }
static const int XYMODE
Definition: EEDetId.h:335
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
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
int EcalTrigTowerConstituentsMap::changeTowerQuadrant ( int  phiTower,
int  fromQuadrant,
int  toQuadrant 
) const
private

Definition at line 125 of file EcalTrigTowerConstituentsMap.cc.

References EcalTrigTowerDetId::kEETowersInPhiPerQuadrant.

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 }
static const int kEETowersInPhiPerQuadrant
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.

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(), EcalDetIdToBeRecoveredProducer::produce(), ecaldqm::TimingClient::producePlots(), EcalRecHitWorkerRecover::run(), ecaldqm::TrigPrimTask::runOnEmulTPs(), ecaldqm::TrigPrimTask::runOnRealTPs(), EcalDeadCellTriggerPrimitiveFilter::setEvtRecHitstatus(), and ecaldqm::DQWorkerClient::towerAverage_().

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 }
int zside(DetId const &)
static const int ETAPHIMODE
Definition: EBDetId.h:158
Definition: DetId.h:17
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.

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

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

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 }
Definition: DetId.h:17
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.

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

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 }
static const int kEETowersInPhiPerQuadrant
Definition: DetId.h:17
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.

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

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 }
static const int XYMODE
Definition: EEDetId.h:335
Definition: DetId.h:17

Member Data Documentation

EcalTowerMap EcalTrigTowerConstituentsMap::m_items
private

Definition at line 59 of file EcalTrigTowerConstituentsMap.h.

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