CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
12 #include <boost/multi_index_container.hpp>
13 #include <boost/multi_index/member.hpp>
14 #include <boost/multi_index/ordered_index.hpp>
15 #include <boost/tuple/tuple.hpp>
16 #include <boost/multi_index/mem_fun.hpp>
17 #include <boost/multi_index/composite_key.hpp>
18 
20 
21 
22 #include <vector>
23 #include <map>
24 
25 
32 
33 
34  public:
35 
37 
39  EcalElectronicsId getElectronicsId(const DetId& id) const;
40 
43 
45  DetId getDetId(const EcalElectronicsId& id) const;
46 
49 
51  DetId getDetId(const EcalTriggerElectronicsId& id) const;
52 
55 
57  std::vector<DetId> dccConstituents(int dccId) const;
58 
60  std::vector<DetId> dccTowerConstituents(int dccId, int tower) const;
61 
63  std::vector<DetId> stripConstituents(int dccId, int tower, int strip) const;
64 
66  std::vector<DetId> tccConstituents(int tccId) const;
67 
69  std::vector<DetId> ttConstituents(int tccId, int tt) const;
70 
72  std::vector<DetId> pseudoStripConstituents(int tccId, int tt, int pseudostrip) const;
73 
75  void assign(const DetId& cell, const EcalElectronicsId&, const EcalTriggerElectronicsId& tower);
76 
89  std::pair<int, int> getDCCandSC(EcalScDetId id) const;
90 
106  std::vector<EcalScDetId> getEcalScDetId(int DCCid, int DCC_Channel,
107  bool ignoreSingleCrystal = true) const;
108 
110  int DCCid(const EBDetId& id) const;
111 
113  int TCCid(const EBDetId& id) const;
114 
116  int iTT(const EcalTrigTowerDetId& id) const;
117 
119  int TCCid(const EcalTrigTowerDetId& id) const;
120 
122  int DCCid(const EcalTrigTowerDetId& id) const;
123 
125  EcalTrigTowerDetId getTrigTowerDetId(int TCCid, int iTT) const;
126 
127  EcalSubdetector subdet(int dccid, int mode) const;
128  int zside(int dcctcc, int mode) const;
129 
130  bool rightTower(int tower) const;
131 
132  // methods used for regional unpacking :
133  std::vector<int> GetListofFEDs(const EcalEtaPhiRegion& region) const ;
134  void GetListofFEDs(const EcalEtaPhiRegion& region, std::vector<int> & FEDs) const ;
135  int GetFED(double eta, double phi) const ;
136  int DCCBoundary(int FED) const;
137 
138  // methods for retrieving the Laser Monitoring readout number
139 
140  int getLMNumber(const DetId& id) const;
141 
142 
143  // Geometry of SM in EB :
144  static const int kCrystalsInPhi = EBDetId::kCrystalsInPhi ; // per SM
145  static const int kTowersInPhi = EBDetId::kTowersInPhi ; // per SM
146 
147  // Geometry of the Trigger Towers :
148 
149  static const int kEBTowersInPhi = EcalTrigTowerDetId::kEBTowersInPhi ; // per SM (in the Barrel)
150  static const int kEBTowersPerSM = EcalTrigTowerDetId::kEBTowersPerSM ; // per SM (in the Barrel)
151  static const int kEBTowersInEta = EcalTrigTowerDetId::kEBTowersInEta; // per SM (in the Barrel)
154 
155  static const int kEETowersInPhiPerTCC = 4; // each TCC contains 4 towers in phi
156  static const int kEETowersInEtaPerInnerTCC = 7; // each inner TCC contains 7 towers in eta
157  static const int kEETowersInEtaPerOuterTCC = 4; // each outer TCC contains 4 towers in eta
158  static const int iEEEtaMinOuter = 18; // outer TCC : ieta = 18 -> 21
159  static const int iEEEtaMinInner = 22; // inner TCC : ieta = 22 -> 28
160 
161 
162  // DCC values :
163  static const int MAX_DCCID = EcalElectronicsId::MAX_DCCID ; //To be updated with correct and final number
173 
174  static const int DCCID_PHI0_EBM = EcalElectronicsId::DCCID_PHI0_EBM ; // contains phi = 0 deg.
176 
177  // TCC values :
178  static const int MAX_TCCID = EcalTriggerElectronicsId::MAX_TCCID ; //To be updated with correct and final number
188 
191 
196 
197  static const int kTCCinPhi = 18; // Number of TCC "sectors" in phi
198 
199  // LaserMonitoring readout numbers :
200  static const int MIN_LM_EEM = 73; // corresponds to MIN_DCCID_EEM
201  static const int MIN_LM_EBM = 1; // corresponds to MIN_DCCID_EBM
202  static const int MIN_LM_EBP = 37; // corresponds to MIN_DCCID_EBP
203  static const int MIN_LM_EEP = 83; // corresponds to MIN_DCCID_EEP
204  static const int MAX_LM = 92; // Total number of LaserModules
205 
206 
207  private:
208 
209  static const int DCCMODE = 0;
210  static const int TCCMODE = 1;
211 
214  // DetId wrapEEDetId(const DetId& id) const;
216  //DetId wrapEcalTrigTowerDetId(const DetId& id) const;
217  //DetId changeEEDetIdQuadrantAndZ(const DetId& fromid, const int& toQuadrant,const int& tozside) const;
218  // int changeTowerQuadrant(int phiTower, int fromQuadrant, int toQuadrant) const;
219 
220  struct MapItem {
221  MapItem(const DetId& acell, const EcalElectronicsId& aelid, const EcalTriggerElectronicsId& atrelid) : cell(acell),elid(aelid),trelid(atrelid) { }
225  int dccId() const { return elid.dccId(); }
226  int towerId() const {return elid.towerId(); }
227  int stripId() const {return elid.stripId(); }
228  int tccId() const { return trelid.tccId(); }
229  int ttId() const { return trelid.ttId(); }
230  int pseudoStripId() const { return trelid.pseudoStripId(); }
231  };
232 
233 
234  //hashed indexes to be preferred to ordered (faster for lookup, here we are not interested in ordering...)
235  typedef boost::multi_index::multi_index_container<
236  MapItem,
237  boost::multi_index::indexed_by<
238  // hashed_unique< member < MapItem,DetId,&MapItem::cell > >,
239  // hashed_unique< member < MapItem,EcalElectronicsId,&MapItem::elid > >,
240  // hashed_unique< member < MapItem,EcalTriggerElectronicsId,&MapItem::trelid > >
241  boost::multi_index::ordered_unique< boost::multi_index::member < MapItem,DetId,&MapItem::cell > >,
242  boost::multi_index::ordered_unique< boost::multi_index::member < MapItem,EcalElectronicsId,&MapItem::elid > >,
243  boost::multi_index::ordered_unique< boost::multi_index::member < MapItem,EcalTriggerElectronicsId,&MapItem::trelid > >,
244  boost::multi_index::ordered_non_unique< boost::multi_index::const_mem_fun < MapItem, int, &MapItem::dccId > >,
245  boost::multi_index::ordered_non_unique<
246  boost::multi_index::composite_key<
247  MapItem,
248  boost::multi_index::const_mem_fun < MapItem, int, &MapItem::dccId > ,
249  boost::multi_index::const_mem_fun < MapItem, int, &MapItem::towerId >
250  > >,
251  boost::multi_index::ordered_non_unique<
252  boost::multi_index::composite_key<
253  MapItem,
254  boost::multi_index::const_mem_fun < MapItem, int, &MapItem::dccId > ,
255  boost::multi_index::const_mem_fun < MapItem, int, &MapItem::towerId >,
256  boost::multi_index::const_mem_fun < MapItem, int, &MapItem::stripId >
257  > >,
258  boost::multi_index::ordered_non_unique< boost::multi_index::const_mem_fun < MapItem, int, &MapItem::tccId > >,
259  boost::multi_index::ordered_non_unique<
260  boost::multi_index::composite_key<
261  MapItem,
262  boost::multi_index::const_mem_fun < MapItem, int, &MapItem::tccId > ,
263  boost::multi_index::const_mem_fun < MapItem, int, &MapItem::ttId >
264  > >,
265  boost::multi_index::ordered_non_unique<
266  boost::multi_index::composite_key<
267  MapItem,
268  boost::multi_index::const_mem_fun < MapItem, int, &MapItem::tccId > ,
269  boost::multi_index::const_mem_fun < MapItem, int, &MapItem::ttId >,
270  boost::multi_index::const_mem_fun < MapItem, int, &MapItem::pseudoStripId >
271  > >
272  >
274 
278 
282 
286 
287 
288  //Needed only in the EE (contains only first quadrant object)
290 
291 
292  // Maps between DCC and LaserMonitoring readout numbers (take care that EB DCCs and two EE DCCs
293  // actually correspond to two LMs. The map contain only the first one).
294  // The maps are filled in the constructor of EcalElectronicsMapping.
295 
296  std::map<int, int> LaserMonitoringMap_EB;
297  std::map<int, int> LaserMonitoringMap_EE;
298 
299 };
300 
301 #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:146
EcalTrigTowerDetId getTrigTowerDetId(int TCCid, int iTT) const
Builds a EcalTrigTowerDetID from the TCCid &amp; 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
T eta() 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:149
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.
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
std::vector< int > GetListofFEDs(const EcalEtaPhiRegion &region) const
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 &lt; phi &lt; 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.
Definition: DDAxes.h:10