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 
33 
34 
35  public:
36 
38 
40  EcalElectronicsId getElectronicsId(const DetId& id) const;
41 
44 
46  DetId getDetId(const EcalElectronicsId& id) const;
47 
50 
52  DetId getDetId(const EcalTriggerElectronicsId& id) const;
53 
56 
58  std::vector<DetId> dccConstituents(int dccId) const;
59 
61  std::vector<DetId> dccTowerConstituents(int dccId, int tower) const;
62 
64  std::vector<DetId> stripConstituents(int dccId, int tower, int strip) const;
65 
67  std::vector<DetId> tccConstituents(int tccId) const;
68 
70  std::vector<DetId> ttConstituents(int tccId, int tt) const;
71 
73  std::vector<DetId> pseudoStripConstituents(int tccId, int tt, int pseudostrip) const;
74 
76  void assign(const DetId& cell, const EcalElectronicsId&, const EcalTriggerElectronicsId& tower);
77 
90  std::pair<int, int> getDCCandSC(EcalScDetId id) const;
91 
107  std::vector<EcalScDetId> getEcalScDetId(int DCCid, int DCC_Channel,
108  bool ignoreSingleCrystal = true) const;
109 
111  int DCCid(const EBDetId& id) const;
112 
114  int TCCid(const EBDetId& id) const;
115 
117  int iTT(const EcalTrigTowerDetId& id) const;
118 
120  int TCCid(const EcalTrigTowerDetId& id) const;
121 
123  int DCCid(const EcalTrigTowerDetId& id) const;
124 
126  EcalTrigTowerDetId getTrigTowerDetId(int TCCid, int iTT) const;
127 
128  EcalSubdetector subdet(int dccid, int mode) const;
129  int zside(int dcctcc, int mode) const;
130 
131  bool rightTower(int tower) const;
132 
133  // methods used for regional unpacking :
134  std::vector<int> GetListofFEDs(const EcalEtaPhiRegion region) const ;
135  void GetListofFEDs(const EcalEtaPhiRegion region, std::vector<int> & FEDs) const ;
136  int GetFED(double eta, double phi) const ;
137  int DCCBoundary(int FED) const;
138 
139  // methods for retrieving the Laser Monitoring readout number
140 
141  int getLMNumber(const DetId& id) const;
142 
143 
144  // Geometry of SM in EB :
145  static const int kCrystalsInPhi = EBDetId::kCrystalsInPhi ; // per SM
146  static const int kTowersInPhi = EBDetId::kTowersInPhi ; // per SM
147 
148  // Geometry of the Trigger Towers :
149 
150  static const int kEBTowersInPhi = EcalTrigTowerDetId::kEBTowersInPhi ; // per SM (in the Barrel)
151  static const int kEBTowersPerSM = EcalTrigTowerDetId::kEBTowersPerSM ; // per SM (in the Barrel)
152  static const int kEBTowersInEta = EcalTrigTowerDetId::kEBTowersInEta; // per SM (in the Barrel)
155 
156  static const int kEETowersInPhiPerTCC = 4; // each TCC contains 4 towers in phi
157  static const int kEETowersInEtaPerInnerTCC = 7; // each inner TCC contains 7 towers in eta
158  static const int kEETowersInEtaPerOuterTCC = 4; // each outer TCC contains 4 towers in eta
159  static const int iEEEtaMinOuter = 18; // outer TCC : ieta = 18 -> 21
160  static const int iEEEtaMinInner = 22; // inner TCC : ieta = 22 -> 28
161 
162 
163  // DCC values :
164  static const int MAX_DCCID = EcalElectronicsId::MAX_DCCID ; //To be updated with correct and final number
174 
175  static const int DCCID_PHI0_EBM = EcalElectronicsId::DCCID_PHI0_EBM ; // contains phi = 0 deg.
177 
178  // TCC values :
179  static const int MAX_TCCID = EcalTriggerElectronicsId::MAX_TCCID ; //To be updated with correct and final number
189 
192 
197 
198  static const int kTCCinPhi = 18; // Number of TCC "sectors" in phi
199 
200  // LaserMonitoring readout numbers :
201  static const int MIN_LM_EEM = 73; // corresponds to MIN_DCCID_EEM
202  static const int MIN_LM_EBM = 1; // corresponds to MIN_DCCID_EBM
203  static const int MIN_LM_EBP = 37; // corresponds to MIN_DCCID_EBP
204  static const int MIN_LM_EEP = 83; // corresponds to MIN_DCCID_EEP
205  static const int MAX_LM = 92; // Total number of LaserModules
206 
207 
208  private:
209 
210  static const int DCCMODE = 0;
211  static const int TCCMODE = 1;
212 
215  // DetId wrapEEDetId(const DetId& id) const;
217  //DetId wrapEcalTrigTowerDetId(const DetId& id) const;
218  //DetId changeEEDetIdQuadrantAndZ(const DetId& fromid, const int& toQuadrant,const int& tozside) const;
219  // int changeTowerQuadrant(int phiTower, int fromQuadrant, int toQuadrant) const;
220 
221  struct MapItem {
222  MapItem(const DetId& acell, const EcalElectronicsId& aelid, const EcalTriggerElectronicsId& atrelid) : cell(acell),elid(aelid),trelid(atrelid) { }
226  int dccId() const { return elid.dccId(); }
227  int towerId() const {return elid.towerId(); }
228  int stripId() const {return elid.stripId(); }
229  int tccId() const { return trelid.tccId(); }
230  int ttId() const { return trelid.ttId(); }
231  int pseudoStripId() const { return trelid.pseudoStripId(); }
232  };
233 
234 
235  //hashed indexes to be preferred to ordered (faster for lookup, here we are not interested in ordering...)
236  typedef boost::multi_index::multi_index_container<
237  MapItem,
238  boost::multi_index::indexed_by<
239  // hashed_unique< member < MapItem,DetId,&MapItem::cell > >,
240  // hashed_unique< member < MapItem,EcalElectronicsId,&MapItem::elid > >,
241  // hashed_unique< member < MapItem,EcalTriggerElectronicsId,&MapItem::trelid > >
242  boost::multi_index::ordered_unique< boost::multi_index::member < MapItem,DetId,&MapItem::cell > >,
243  boost::multi_index::ordered_unique< boost::multi_index::member < MapItem,EcalElectronicsId,&MapItem::elid > >,
244  boost::multi_index::ordered_unique< boost::multi_index::member < MapItem,EcalTriggerElectronicsId,&MapItem::trelid > >,
245  boost::multi_index::ordered_non_unique< boost::multi_index::const_mem_fun < MapItem, int, &MapItem::dccId > >,
246  boost::multi_index::ordered_non_unique<
247  boost::multi_index::composite_key<
248  MapItem,
249  boost::multi_index::const_mem_fun < MapItem, int, &MapItem::dccId > ,
250  boost::multi_index::const_mem_fun < MapItem, int, &MapItem::towerId >
251  > >,
252  boost::multi_index::ordered_non_unique<
253  boost::multi_index::composite_key<
254  MapItem,
255  boost::multi_index::const_mem_fun < MapItem, int, &MapItem::dccId > ,
256  boost::multi_index::const_mem_fun < MapItem, int, &MapItem::towerId >,
257  boost::multi_index::const_mem_fun < MapItem, int, &MapItem::stripId >
258  > >,
259  boost::multi_index::ordered_non_unique< boost::multi_index::const_mem_fun < MapItem, int, &MapItem::tccId > >,
260  boost::multi_index::ordered_non_unique<
261  boost::multi_index::composite_key<
262  MapItem,
263  boost::multi_index::const_mem_fun < MapItem, int, &MapItem::tccId > ,
264  boost::multi_index::const_mem_fun < MapItem, int, &MapItem::ttId >
265  > >,
266  boost::multi_index::ordered_non_unique<
267  boost::multi_index::composite_key<
268  MapItem,
269  boost::multi_index::const_mem_fun < MapItem, int, &MapItem::tccId > ,
270  boost::multi_index::const_mem_fun < MapItem, int, &MapItem::ttId >,
271  boost::multi_index::const_mem_fun < MapItem, int, &MapItem::pseudoStripId >
272  > >
273  >
275 
279 
283 
287 
288 
289  //Needed only in the EE (contains only first quadrant object)
291 
292 
293  // Maps between DCC and LaserMonitoring readout numbers (take care that EB DCCs and two EE DCCs
294  // actually correspond to two LMs. The map contain only the first one).
295  // The maps are filled in the constructor of EcalElectronicsMapping.
296 
297  std::map<int, int> LaserMonitoringMap_EB;
298  std::map<int, int> LaserMonitoringMap_EE;
299 
300 };
301 
302 #endif
type
Definition: HCALResponse.h:22
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.
void strip(std::string &input, const std::string &blanks=" \n\t")
Definition: stringTools.cc:16
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.
static const int MIN_DCCID
int towerId() const
get the tower id
unsigned dccId(const DetId &)
static const int TCCID_PHI0_EEM_OUT
static const int kTowersInPhi
Definition: EBDetId.h:125
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:128
EcalElectronicsMap::nth_index< 4 >::type EcalElectronicsMap_by_DccId_and_TowerId
static const int MAX_DCCID_EBP
std::vector< int > GetListofFEDs(const EcalEtaPhiRegion region) const
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:20
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.
unsigned tccId(const DetId &)
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 &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
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