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

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

Definition at line 59 of file EcalTrigTowerConstituentsMap.h.

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

Definition at line 60 of file EcalTrigTowerConstituentsMap.h.

Constructor & Destructor Documentation

EcalTrigTowerConstituentsMap::EcalTrigTowerConstituentsMap ( )

Definition at line 9 of file EcalTrigTowerConstituentsMap.cc.

10 {
11 }

Member Function Documentation

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

set the association between a DetId and a tower

Definition at line 159 of file EcalTrigTowerConstituentsMap.cc.

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

Referenced by EcalTrigTowerConstituentsMapBuilder::parseTextMap().

159  {
160  if (m_items.find(cell)!=m_items.end()) {
161  throw cms::Exception("EcalTrigTowers") << "Cell with id " << std::hex << cell.rawId() << std::dec << " is already mapped to a EcalTrigTower " << m_items.find(cell)->tower << std::endl;
162  }
163 
164  m_items.insert(MapItem(cell,tower));
165 }
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
DetId EcalTrigTowerConstituentsMap::changeEEDetIdQuadrantAndZ ( const DetId fromid,
const int &  toQuadrant,
const int &  tozside 
) const
private

Definition at line 102 of file EcalTrigTowerConstituentsMap.cc.

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

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

Definition at line 132 of file EcalTrigTowerConstituentsMap.cc.

References EcalTrigTowerDetId::kEETowersInPhiPerQuadrant.

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

Get the constituent detids for this tower id.

Definition at line 167 of file EcalTrigTowerConstituentsMap.cc.

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

Referenced by EcalRecHitsValidation::analyze(), ecaldqm::TimingClient::producePlots(), ecaldqm::TrigPrimTask::runOnEmulTPs(), ecaldqm::TrigPrimTask::runOnRealTPs(), and ecaldqm::DQWorkerClient::towerAverage_().

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

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

Definition at line 13 of file EcalTrigTowerConstituentsMap.cc.

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

Referenced by EcalTBReadout::findTTlist(), EcalSelectiveReadout::getCrystalInterest(), PFRecoTauDiscriminationAgainstElectronDeadECAL::loopXtals(), ecaldqm::OccupancyClient::producePlots(), EcalTBReadout::readOut(), EcalSelectiveReadoutValidation::readOutUnitOf(), EcalSelectiveReadout::runSelectiveReadout0(), EcalSelectiveReadoutValidation::setTtEtSums(), and EcalSelectiveReadoutSuppressor::setTtFlags().

13  {
14  if (id.det() == DetId::Ecal && id.subdetId() == EcalBarrel)
15  {
16  //--------------------
17  // Ecal Barrel
18  //--------------------
19  EBDetId myId(id);
20  return myId.tower();
21  }
22  else if (id.det() == DetId::Ecal && id.subdetId() == EcalEndcap)
23  {
24  //--------------------
25  // Ecal Endcap
26  //--------------------
27  EEDetId originalId(id);
28  // DetId wrappedId=wrapEEDetId(id);
29  DetId wrappedId(originalId);
30  EcalTowerMap::const_iterator i=m_items.find(wrappedId);
31  if (i!=m_items.end())
32  {
33  int etaTower=i->tower.ietaAbs();
34  int phiTower=i->tower.iphi();
35  //trigger tower <-> crystal maping read
36  //..........from file and done only for 1 quadrant
37  //move from quadrant 1 to the actual one:
38  // phiTower = changeTowerQuadrant(phiTower, 1, originalId.iquadrant());
39  // std::cout << originalId.zside() << " " << etaTower << " " << phiTower << std::endl;
40  return EcalTrigTowerDetId(originalId.zside(),EcalEndcap,etaTower,phiTower);
41  }
42  }
43  return EcalTrigTowerDetId(0);
44 }
int i
Definition: DBlmapReader.cc:9
Definition: DetId.h:18
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 74 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  {
83  case 0:
84  return DetId(EcalTrigTowerDetId(1,EcalEndcap,etid.ietaAbs(),etid.iphi()));
85  break;
86  case 1:
87  return DetId(EcalTrigTowerDetId(1,EcalEndcap,etid.ietaAbs(),EcalTrigTowerDetId::kEETowersInPhiPerQuadrant * 2 - etid.iphi() + 1));
88  break;
89  case 2:
90  return DetId(EcalTrigTowerDetId(1,EcalEndcap,etid.ietaAbs(),etid.iphi() - EcalTrigTowerDetId::kEETowersInPhiPerQuadrant * 2 ));
91  break;
92  case 3:
93  return DetId(EcalTrigTowerDetId(1,EcalEndcap,etid.ietaAbs(),EcalTrigTowerDetId::kEETowersInPhiPerQuadrant * 4 - etid.iphi() + 1));
94  break;
95  default:
96  /*should never be reached*/
97  edm::LogError("EcalTrigTowerConstituentsMapError") << "This should never be reached. Profound error!";
98  }
99  return EcalTrigTowerDetId(0);
100 }
static const int kEETowersInPhiPerQuadrant
Definition: DetId.h:18
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 46 of file EcalTrigTowerConstituentsMap.cc.

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

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

Member Data Documentation

EcalTowerMap EcalTrigTowerConstituentsMap::m_items
private

Definition at line 62 of file EcalTrigTowerConstituentsMap.h.

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