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 
23 
30 
31 
32  public:
33 
35 
37  EcalElectronicsId getElectronicsId(const DetId& id) const;
38 
41 
43  DetId getDetId(const EcalElectronicsId& id) const;
44 
47 
49  DetId getDetId(const EcalTriggerElectronicsId& id) const;
50 
53 
55  std::vector<DetId> dccConstituents(int dccId) const;
56 
58  std::vector<DetId> dccTowerConstituents(int dccId, int tower) const;
59 
61  std::vector<DetId> stripConstituents(int dccId, int tower, int strip) const;
62 
64  std::vector<DetId> tccConstituents(int tccId) const;
65 
67  std::vector<DetId> ttConstituents(int tccId, int tt) const;
68 
70  std::vector<DetId> pseudoStripConstituents(int tccId, int tt, int pseudostrip) const;
71 
73  void assign(const DetId& cell, const EcalElectronicsId&, const EcalTriggerElectronicsId& tower);
74 
87  std::pair<int, int> getDCCandSC(EcalScDetId id) const;
88 
104  std::vector<EcalScDetId> getEcalScDetId(int DCCid, int DCC_Channel,
105  bool ignoreSingleCrystal = true) const;
106 
108  int DCCid(const EBDetId& id) const;
109 
111  int TCCid(const EBDetId& id) const;
112 
114  int iTT(const EcalTrigTowerDetId& id) const;
115 
117  int TCCid(const EcalTrigTowerDetId& id) const;
118 
120  int DCCid(const EcalTrigTowerDetId& id) const;
121 
123  EcalTrigTowerDetId getTrigTowerDetId(int TCCid, int iTT) const;
124 
125  EcalSubdetector subdet(int dccid, int mode) const;
126  int zside(int dcctcc, int mode) const;
127 
128  bool rightTower(int tower) const;
129 
130  // methods used for regional unpacking :
131  std::vector<int> GetListofFEDs(const RectangularEtaPhiRegion& region) const ;
132  void GetListofFEDs(const RectangularEtaPhiRegion& region, std::vector<int> & FEDs) const ;
133  int GetFED(double eta, double phi) const ;
134  int DCCBoundary(int FED) const;
135 
136  // methods for retrieving the Laser Monitoring readout number
137 
138  int getLMNumber(const DetId& id) const;
139 
140 
141  // Geometry of SM in EB :
142  static const int kCrystalsInPhi = EBDetId::kCrystalsInPhi ; // per SM
143  static const int kTowersInPhi = EBDetId::kTowersInPhi ; // per SM
144 
145  // Geometry of the Trigger Towers :
146 
147  static const int kEBTowersInPhi = EcalTrigTowerDetId::kEBTowersInPhi ; // per SM (in the Barrel)
148  static const int kEBTowersPerSM = EcalTrigTowerDetId::kEBTowersPerSM ; // per SM (in the Barrel)
149  static const int kEBTowersInEta = EcalTrigTowerDetId::kEBTowersInEta; // per SM (in the Barrel)
152 
153  static const int kEETowersInPhiPerTCC = 4; // each TCC contains 4 towers in phi
154  static const int kEETowersInEtaPerInnerTCC = 7; // each inner TCC contains 7 towers in eta
155  static const int kEETowersInEtaPerOuterTCC = 4; // each outer TCC contains 4 towers in eta
156  static const int iEEEtaMinOuter = 18; // outer TCC : ieta = 18 -> 21
157  static const int iEEEtaMinInner = 22; // inner TCC : ieta = 22 -> 28
158 
159 
160  // DCC values :
161  static const int MAX_DCCID = EcalElectronicsId::MAX_DCCID ; //To be updated with correct and final number
171 
172  static const int DCCID_PHI0_EBM = EcalElectronicsId::DCCID_PHI0_EBM ; // contains phi = 0 deg.
174 
175  // TCC values :
176  static const int MAX_TCCID = EcalTriggerElectronicsId::MAX_TCCID ; //To be updated with correct and final number
186 
189 
194 
195  static const int kTCCinPhi = 18; // Number of TCC "sectors" in phi
196 
197  // LaserMonitoring readout numbers :
198  static const int MIN_LM_EEM = 73; // corresponds to MIN_DCCID_EEM
199  static const int MIN_LM_EBM = 1; // corresponds to MIN_DCCID_EBM
200  static const int MIN_LM_EBP = 37; // corresponds to MIN_DCCID_EBP
201  static const int MIN_LM_EEP = 83; // corresponds to MIN_DCCID_EEP
202  static const int MAX_LM = 92; // Total number of LaserModules
203 
204 
205  private:
206 
207  static const int DCCMODE = 0;
208  static const int TCCMODE = 1;
209 
212  // DetId wrapEEDetId(const DetId& id) const;
214  //DetId wrapEcalTrigTowerDetId(const DetId& id) const;
215  //DetId changeEEDetIdQuadrantAndZ(const DetId& fromid, const int& toQuadrant,const int& tozside) const;
216  // int changeTowerQuadrant(int phiTower, int fromQuadrant, int toQuadrant) const;
217 
218  struct MapItem {
219  MapItem(const DetId& acell, const EcalElectronicsId& aelid, const EcalTriggerElectronicsId& atrelid) : cell(acell),elid(aelid),trelid(atrelid) { }
223  int dccId() const { return elid.dccId(); }
224  int towerId() const {return elid.towerId(); }
225  int stripId() const {return elid.stripId(); }
226  int tccId() const { return trelid.tccId(); }
227  int ttId() const { return trelid.ttId(); }
228  int pseudoStripId() const { return trelid.pseudoStripId(); }
229  };
230 
231 
232  //hashed indexes to be preferred to ordered (faster for lookup, here we are not interested in ordering...)
233  typedef boost::multi_index::multi_index_container<
234  MapItem,
235  boost::multi_index::indexed_by<
236  // hashed_unique< member < MapItem,DetId,&MapItem::cell > >,
237  // hashed_unique< member < MapItem,EcalElectronicsId,&MapItem::elid > >,
238  // hashed_unique< member < MapItem,EcalTriggerElectronicsId,&MapItem::trelid > >
239  boost::multi_index::ordered_unique< boost::multi_index::member < MapItem,DetId,&MapItem::cell > >,
240  boost::multi_index::ordered_unique< boost::multi_index::member < MapItem,EcalElectronicsId,&MapItem::elid > >,
241  boost::multi_index::ordered_unique< boost::multi_index::member < MapItem,EcalTriggerElectronicsId,&MapItem::trelid > >,
242  boost::multi_index::ordered_non_unique< boost::multi_index::const_mem_fun < MapItem, int, &MapItem::dccId > >,
243  boost::multi_index::ordered_non_unique<
244  boost::multi_index::composite_key<
245  MapItem,
246  boost::multi_index::const_mem_fun < MapItem, int, &MapItem::dccId > ,
247  boost::multi_index::const_mem_fun < MapItem, int, &MapItem::towerId >
248  > >,
249  boost::multi_index::ordered_non_unique<
250  boost::multi_index::composite_key<
251  MapItem,
252  boost::multi_index::const_mem_fun < MapItem, int, &MapItem::dccId > ,
253  boost::multi_index::const_mem_fun < MapItem, int, &MapItem::towerId >,
254  boost::multi_index::const_mem_fun < MapItem, int, &MapItem::stripId >
255  > >,
256  boost::multi_index::ordered_non_unique< boost::multi_index::const_mem_fun < MapItem, int, &MapItem::tccId > >,
257  boost::multi_index::ordered_non_unique<
258  boost::multi_index::composite_key<
259  MapItem,
260  boost::multi_index::const_mem_fun < MapItem, int, &MapItem::tccId > ,
261  boost::multi_index::const_mem_fun < MapItem, int, &MapItem::ttId >
262  > >,
263  boost::multi_index::ordered_non_unique<
264  boost::multi_index::composite_key<
265  MapItem,
266  boost::multi_index::const_mem_fun < MapItem, int, &MapItem::tccId > ,
267  boost::multi_index::const_mem_fun < MapItem, int, &MapItem::ttId >,
268  boost::multi_index::const_mem_fun < MapItem, int, &MapItem::pseudoStripId >
269  > >
270  >
272 
276 
280 
284 
285 
286  //Needed only in the EE (contains only first quadrant object)
288 
289 
290  // Maps between DCC and LaserMonitoring readout numbers (take care that EB DCCs and two EE DCCs
291  // actually correspond to two LMs. The map contain only the first one).
292  // The maps are filled in the constructor of EcalElectronicsMapping.
293 
294  std::map<int, int> LaserMonitoringMap_EB;
295  std::map<int, int> LaserMonitoringMap_EE;
296 
297 };
298 
299 #endif
type
Definition: HCALResponse.h:21
static const int MAX_DCCID_EBM
int GetFED(double eta, double phi) const
std::map< int, int > LaserMonitoringMap_EB
int tccId() const
get the DCC (Ecal Local DCC value not global one) id
std::vector< DetId > dccConstituents(int dccId) const
Get the constituent detids for this dccId.
int stripId() const
get the tower id
std::vector< DetId > tccConstituents(int tccId) const
Get the constituent detids for this dccId.
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
std::vector< DetId > pseudoStripConstituents(int tccId, int tt, int pseudostrip) const
Get the constituent detids for this dccId.
unsigned tccId(DetId const &)
static const int MIN_DCCID
int towerId() const
get the tower id
static const int TCCID_PHI0_EEM_OUT
static const int kTowersInPhi
Definition: EBDetId.h:139
EcalTrigTowerDetId getTrigTowerDetId(int TCCid, int iTT) const
Builds a EcalTrigTowerDetID from the TCCid & TriggerTower index in TCC.
static const int kEBTowersInPhi
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 kEETowersInEtaPerOuterTCC
int iTT(const EcalTrigTowerDetId &id) const
returns the index of a Trigger Tower within its TCC.
std::pair< int, int > getDCCandSC(EcalScDetId id) const
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
int DCCBoundary(int FED) const
static const int TCCID_PHI0_EEM_IN
int TCCid(const EBDetId &id) const
returns the TCCid of an EBDetId
static const int kEETowersInPhiPerQuadrant
static const int kEETowersInEtaPerInnerTCC
EcalElectronicsId getElectronicsId(const DetId &id) const
Get the electronics id for this det id.
std::map< int, int > LaserMonitoringMap_EE
EcalElectronicsMap::nth_index< 7 >::type EcalElectronicsMap_by_TccId_and_TtId
int zside(int dcctcc, int mode) const
static const int kCrystalsInPhi
Definition: EBDetId.h:142
EcalElectronicsMap::nth_index< 4 >::type EcalElectronicsMap_by_DccId_and_TowerId
static const int MAX_DCCID_EBP
static const int MAX_DCCID
static const int kEETowersInPhiPerQuadrant
int ttId() const
get the tower id
static const int MIN_DCCID_EBM
static const int kEBTowersInEta
EcalTriggerElectronicsId getTriggerElectronicsId(const DetId &id) const
Get the trigger electronics id for this det id.
std::vector< int > GetListofFEDs(const RectangularEtaPhiRegion &region) const
int pseudoStripId() const
get the tower id
static const int DCCID_PHI0_EBM
int dccId() const
get the DCC (Ecal Local DCC value not global one) id
static const int MAX_DCCID_EEM
std::vector< EcalScDetId > getEcalScDetId(int DCCid, int DCC_Channel, bool ignoreSingleCrystal=true) const
bool rightTower(int tower) const
std::vector< DetId > ttConstituents(int tccId, int tt) const
Get the constituent detids for this dccId.
Definition: DetId.h:18
static const int kEETowersInPhiPerTCC
EcalElectronicsMap::nth_index< 0 >::type EcalElectronicsMap_by_DetId
EcalSubdetector subdet(int dccid, int mode) const
static const int TCCID_PHI0_EEP_OUT
EcalElectronicsMap::nth_index< 5 >::type EcalElectronicsMap_by_DccId_TowerId_and_StripId
EcalElectronicsMap::nth_index< 6 >::type EcalElectronicsMap_by_TccId
int DCCid(const EBDetId &id) const
returns the DCC of an EBDetId
DetId getDetId(const EcalElectronicsId &id) const
Get the detid given an electronicsId.
static const int MIN_DCCID_EBP
static const int MAX_DCCID_EEP
EcalElectronicsMap::nth_index< 1 >::type EcalElectronicsMap_by_ElectronicsId
static const int DCCID_PHI0_EBP
EcalElectronicsMap::nth_index< 8 >::type EcalElectronicsMap_by_TccId_TtId_and_PseudostripId
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
std::vector< DetId > stripConstituents(int dccId, int tower, int strip) const
Get the constituent detids for this dccId.
EcalSubdetector
int getLMNumber(const DetId &id) const
unsigned dccId(DetId const &)
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...
static const int MIN_DCCID_EEP
std::vector< DetId > dccTowerConstituents(int dccId, int tower) const
Get the constituent detids for this dccId.