CMS 3D CMS Logo

EcalElectronicsMapping.h
Go to the documentation of this file.
1 #ifndef ECALELECTRONICSMAPPING_H
2 #define ECALELECTRONICSMAPPING_H 1
3 
4 #include <memory>
5 #include <iostream>
6 #include <string>
7 
10 
11 #include <boost/multi_index_container.hpp>
12 #include <boost/multi_index/member.hpp>
13 #include <boost/multi_index/ordered_index.hpp>
14 #include <boost/tuple/tuple.hpp>
15 #include <boost/multi_index/mem_fun.hpp>
16 #include <boost/multi_index/composite_key.hpp>
17 
19 
20 #include <vector>
21 #include <map>
22 
29 public:
31 
33  EcalElectronicsId getElectronicsId(const DetId& id) const;
34 
37 
39  DetId getDetId(const EcalElectronicsId& id) const;
40 
43 
45  DetId getDetId(const EcalTriggerElectronicsId& id) const;
46 
49 
51  std::vector<DetId> dccConstituents(int dccId) const;
52 
54  std::vector<DetId> dccTowerConstituents(int dccId, int tower) const;
55 
57  std::vector<DetId> stripConstituents(int dccId, int tower, int strip) const;
58 
60  std::vector<DetId> tccConstituents(int tccId) const;
61 
63  std::vector<DetId> ttConstituents(int tccId, int tt) const;
64 
66  std::vector<DetId> pseudoStripConstituents(int tccId, int tt, int pseudostrip) const;
67 
69  void assign(const DetId& cell, const EcalElectronicsId&, const EcalTriggerElectronicsId& tower);
70 
83  std::pair<int, int> getDCCandSC(EcalScDetId id) const;
84 
100  std::vector<EcalScDetId> getEcalScDetId(int DCCid, int DCC_Channel, bool ignoreSingleCrystal = true) const;
101 
103  int DCCid(const EBDetId& id) const;
104 
106  int TCCid(const EBDetId& id) const;
107 
109  int iTT(const EcalTrigTowerDetId& id) const;
110 
112  int TCCid(const EcalTrigTowerDetId& id) const;
113 
115  int DCCid(const EcalTrigTowerDetId& id) const;
116 
119 
120  EcalSubdetector subdet(int dccid, int mode) const;
121  int zside(int dcctcc, int mode) const;
122 
123  bool rightTower(int tower) const;
124 
125  // methods used for regional unpacking :
126  std::vector<int> GetListofFEDs(const RectangularEtaPhiRegion& region) const;
127  void GetListofFEDs(const RectangularEtaPhiRegion& region, std::vector<int>& FEDs) const;
128  int GetFED(double eta, double phi) const;
129  int DCCBoundary(int FED) const;
130 
131  // methods for retrieving the Laser Monitoring readout number
132 
133  int getLMNumber(const DetId& id) const;
134 
135  // Geometry of SM in EB :
136  static const int kCrystalsInPhi = EBDetId::kCrystalsInPhi; // per SM
137  static const int kTowersInPhi = EBDetId::kTowersInPhi; // per SM
138 
139  // Geometry of the Trigger Towers :
140 
141  static const int kEBTowersInPhi = EcalTrigTowerDetId::kEBTowersInPhi; // per SM (in the Barrel)
142  static const int kEBTowersPerSM = EcalTrigTowerDetId::kEBTowersPerSM; // per SM (in the Barrel)
143  static const int kEBTowersInEta = EcalTrigTowerDetId::kEBTowersInEta; // per SM (in the Barrel)
146 
147  static const int kEETowersInPhiPerTCC = 4; // each TCC contains 4 towers in phi
148  static const int kEETowersInEtaPerInnerTCC = 7; // each inner TCC contains 7 towers in eta
149  static const int kEETowersInEtaPerOuterTCC = 4; // each outer TCC contains 4 towers in eta
150  static const int iEEEtaMinOuter = 18; // outer TCC : ieta = 18 -> 21
151  static const int iEEEtaMinInner = 22; // inner TCC : ieta = 22 -> 28
152 
153  // DCC values :
154  static const int MAX_DCCID = EcalElectronicsId::MAX_DCCID; //To be updated with correct and final number
164 
165  static const int DCCID_PHI0_EBM = EcalElectronicsId::DCCID_PHI0_EBM; // contains phi = 0 deg.
167 
168  // TCC values :
169  static const int MAX_TCCID = EcalTriggerElectronicsId::MAX_TCCID; //To be updated with correct and final number
179 
182 
187 
188  static const int kTCCinPhi = 18; // Number of TCC "sectors" in phi
189 
190  // LaserMonitoring readout numbers :
191  static const int MIN_LM_EEM = 73; // corresponds to MIN_DCCID_EEM
192  static const int MIN_LM_EBM = 1; // corresponds to MIN_DCCID_EBM
193  static const int MIN_LM_EBP = 37; // corresponds to MIN_DCCID_EBP
194  static const int MIN_LM_EEP = 83; // corresponds to MIN_DCCID_EEP
195  static const int MAX_LM = 92; // Total number of LaserModules
196 
197 private:
198  static const int DCCMODE = 0;
199  static const int TCCMODE = 1;
200 
203  // DetId wrapEEDetId(const DetId& id) const;
205  //DetId wrapEcalTrigTowerDetId(const DetId& id) const;
206  //DetId changeEEDetIdQuadrantAndZ(const DetId& fromid, const int& toQuadrant,const int& tozside) const;
207  // int changeTowerQuadrant(int phiTower, int fromQuadrant, int toQuadrant) const;
208 
209  struct MapItem {
210  MapItem(const DetId& acell, const EcalElectronicsId& aelid, const EcalTriggerElectronicsId& atrelid)
211  : cell(acell), elid(aelid), trelid(atrelid) {}
215  int dccId() const { return elid.dccId(); }
216  int towerId() const { return elid.towerId(); }
217  int stripId() const { return elid.stripId(); }
218  int tccId() const { return trelid.tccId(); }
219  int ttId() const { return trelid.ttId(); }
220  int pseudoStripId() const { return trelid.pseudoStripId(); }
221  };
222 
223  //hashed indexes to be preferred to ordered (faster for lookup, here we are not interested in ordering...)
224  typedef boost::multi_index::multi_index_container<
225  MapItem,
226  boost::multi_index::indexed_by<
227  // hashed_unique< member < MapItem,DetId,&MapItem::cell > >,
228  // hashed_unique< member < MapItem,EcalElectronicsId,&MapItem::elid > >,
229  // hashed_unique< member < MapItem,EcalTriggerElectronicsId,&MapItem::trelid > >
230  boost::multi_index::ordered_unique<boost::multi_index::member<MapItem, DetId, &MapItem::cell> >,
231  boost::multi_index::ordered_unique<boost::multi_index::member<MapItem, EcalElectronicsId, &MapItem::elid> >,
232  boost::multi_index::ordered_unique<
233  boost::multi_index::member<MapItem, EcalTriggerElectronicsId, &MapItem::trelid> >,
234  boost::multi_index::ordered_non_unique<boost::multi_index::const_mem_fun<MapItem, int, &MapItem::dccId> >,
235  boost::multi_index::ordered_non_unique<
236  boost::multi_index::composite_key<MapItem,
237  boost::multi_index::const_mem_fun<MapItem, int, &MapItem::dccId>,
238  boost::multi_index::const_mem_fun<MapItem, int, &MapItem::towerId> > >,
239  boost::multi_index::ordered_non_unique<
240  boost::multi_index::composite_key<MapItem,
241  boost::multi_index::const_mem_fun<MapItem, int, &MapItem::dccId>,
242  boost::multi_index::const_mem_fun<MapItem, int, &MapItem::towerId>,
243  boost::multi_index::const_mem_fun<MapItem, int, &MapItem::stripId> > >,
244  boost::multi_index::ordered_non_unique<boost::multi_index::const_mem_fun<MapItem, int, &MapItem::tccId> >,
245  boost::multi_index::ordered_non_unique<
246  boost::multi_index::composite_key<MapItem,
247  boost::multi_index::const_mem_fun<MapItem, int, &MapItem::tccId>,
248  boost::multi_index::const_mem_fun<MapItem, int, &MapItem::ttId> > >,
249  boost::multi_index::ordered_non_unique<boost::multi_index::composite_key<
250  MapItem,
251  boost::multi_index::const_mem_fun<MapItem, int, &MapItem::tccId>,
252  boost::multi_index::const_mem_fun<MapItem, int, &MapItem::ttId>,
253  boost::multi_index::const_mem_fun<MapItem, int, &MapItem::pseudoStripId> > > > >
255 
259 
263 
267 
268  //Needed only in the EE (contains only first quadrant object)
270 
271  // Maps between DCC and LaserMonitoring readout numbers (take care that EB DCCs and two EE DCCs
272  // actually correspond to two LMs. The map contain only the first one).
273  // The maps are filled in the constructor of EcalElectronicsMapping.
274 
275  std::map<int, int> LaserMonitoringMap_EB;
276  std::map<int, int> LaserMonitoringMap_EE;
277 };
278 
279 #endif
static const int MAX_DCCID_EBM
int pseudoStripId() const
get the tower id
std::pair< int, int > getDCCandSC(EcalScDetId id) const
std::vector< DetId > pseudoStripConstituents(int tccId, int tt, int pseudostrip) const
Get the constituent detids for this dccId.
std::map< int, int > LaserMonitoringMap_EB
int GetFED(double eta, double phi) const
std::vector< int > GetListofFEDs(const RectangularEtaPhiRegion &region) const
MapItem(const DetId &acell, const EcalElectronicsId &aelid, const EcalTriggerElectronicsId &atrelid)
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
static const int TCCID_PHI0_EEP_IN
int DCCid(const EBDetId &id) const
returns the DCC of an EBDetId
int dccId() const
get the DCC (Ecal Local DCC value not global one) id
int TCCid(const EBDetId &id) const
returns the TCCid of an EBDetId
static const int MIN_DCCID
static const int TCCID_PHI0_EEM_OUT
static const int kTowersInPhi
Definition: EBDetId.h:139
static const int kEBTowersInPhi
static const int kEETowersInEtaPerOuterTCC
EcalTriggerElectronicsId getTriggerElectronicsId(const DetId &id) const
Get the trigger electronics id for this det id.
int zside(int dcctcc, int mode) const
EcalSubdetector subdet(int dccid, int mode) const
std::vector< DetId > dccConstituents(int dccId) const
Get the constituent detids for this dccId.
std::vector< DetId > tccConstituents(int tccId) const
Get the constituent detids for this dccId.
void assign(const DetId &cell, const EcalElectronicsId &, const EcalTriggerElectronicsId &tower)
set the association between a DetId and a tower
EcalElectronicsMap::nth_index< 3 >::type EcalElectronicsMap_by_DccId
static const int TCCID_PHI0_EEM_IN
static const int kEETowersInPhiPerQuadrant
boost::multi_index::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_unique< boost::multi_index::member< MapItem, EcalElectronicsId, &MapItem::elid > >, boost::multi_index::ordered_unique< boost::multi_index::member< MapItem, EcalTriggerElectronicsId, &MapItem::trelid > >, boost::multi_index::ordered_non_unique< boost::multi_index::const_mem_fun< MapItem, int, &MapItem::dccId > >, boost::multi_index::ordered_non_unique< boost::multi_index::composite_key< MapItem, boost::multi_index::const_mem_fun< MapItem, int, &MapItem::dccId >, boost::multi_index::const_mem_fun< MapItem, int, &MapItem::towerId > > >, boost::multi_index::ordered_non_unique< boost::multi_index::composite_key< MapItem, boost::multi_index::const_mem_fun< MapItem, int, &MapItem::dccId >, boost::multi_index::const_mem_fun< MapItem, int, &MapItem::towerId >, boost::multi_index::const_mem_fun< MapItem, int, &MapItem::stripId > > >, boost::multi_index::ordered_non_unique< boost::multi_index::const_mem_fun< MapItem, int, &MapItem::tccId > >, boost::multi_index::ordered_non_unique< boost::multi_index::composite_key< MapItem, boost::multi_index::const_mem_fun< MapItem, int, &MapItem::tccId >, boost::multi_index::const_mem_fun< MapItem, int, &MapItem::ttId > > >, boost::multi_index::ordered_non_unique< boost::multi_index::composite_key< MapItem, boost::multi_index::const_mem_fun< MapItem, int, &MapItem::tccId >, boost::multi_index::const_mem_fun< MapItem, int, &MapItem::ttId >, boost::multi_index::const_mem_fun< MapItem, int, &MapItem::pseudoStripId > > > > > EcalElectronicsMap
static const int kEETowersInEtaPerInnerTCC
std::map< int, int > LaserMonitoringMap_EE
EcalElectronicsMap::nth_index< 7 >::type EcalElectronicsMap_by_TccId_and_TtId
static const int kCrystalsInPhi
Definition: EBDetId.h:142
EcalElectronicsMap::nth_index< 4 >::type EcalElectronicsMap_by_DccId_and_TowerId
Definition: TTTypes.h:54
static const int MAX_DCCID_EBP
int towerId() const
get the tower id
static const int MAX_DCCID
static const int kEETowersInPhiPerQuadrant
static const int MIN_DCCID_EBM
static const int kEBTowersInEta
unsigned dccId(DetId const &, EcalElectronicsMapping const *)
int tccId() const
get the DCC (Ecal Local DCC value not global one) id
EcalTrigTowerDetId getTrigTowerDetId(int TCCid, int iTT) const
Builds a EcalTrigTowerDetID from the TCCid & TriggerTower index in TCC.
static const int DCCID_PHI0_EBM
static const int MAX_DCCID_EEM
std::vector< DetId > dccTowerConstituents(int dccId, int tower) const
Get the constituent detids for this dccId.
Definition: DetId.h:17
static const int kEETowersInPhiPerTCC
EcalElectronicsMap::nth_index< 0 >::type EcalElectronicsMap_by_DetId
static const int TCCID_PHI0_EEP_OUT
EcalElectronicsMap::nth_index< 5 >::type EcalElectronicsMap_by_DccId_TowerId_and_StripId
int getLMNumber(const DetId &id) const
EcalElectronicsMap::nth_index< 6 >::type EcalElectronicsMap_by_TccId
int stripId() const
get the tower id
unsigned tccId(DetId const &, EcalElectronicsMapping const *)
int iTT(const EcalTrigTowerDetId &id) const
returns the index of a Trigger Tower within its TCC.
static const int MIN_DCCID_EBP
static const int MAX_DCCID_EEP
std::vector< EcalScDetId > getEcalScDetId(int DCCid, int DCC_Channel, bool ignoreSingleCrystal=true) const
EcalElectronicsMap::nth_index< 1 >::type EcalElectronicsMap_by_ElectronicsId
EcalElectronicsId getElectronicsId(const DetId &id) const
Get the electronics id for this det id.
bool rightTower(int tower) const
static const int DCCID_PHI0_EBP
EcalElectronicsMap::nth_index< 8 >::type EcalElectronicsMap_by_TccId_TtId_and_PseudostripId
int ttId() const
get the tower id
EcalElectronicsMap::nth_index< 2 >::type EcalElectronicsMap_by_TriggerElectronicsId
Wrap a generic EcalTrigTowerDetId to the equivalent one in z+ Quadrant 1 (from 0 < phi < pi/2) ...
static const int kEBTowersPerSM
EcalSubdetector
static const int MIN_DCCID_EEM
Ecal trigger electronics identification [32:20] Unused (so far) [19:13] TCC id [12:6] TT id [5:3] pse...
std::vector< DetId > stripConstituents(int dccId, int tower, int strip) const
Get the constituent detids for this dccId.
std::vector< DetId > ttConstituents(int tccId, int tt) const
Get the constituent detids for this dccId.
static const int MIN_DCCID_EEP
DetId getDetId(const EcalElectronicsId &id) const
Get the detid given an electronicsId.