CMS 3D CMS Logo

EcalElectronicsMapper.h
Go to the documentation of this file.
1 #ifndef _EcalElectronicsMapper_HH_
2 #define _EcalElectronicsMapper_HH_
3 
4 /*
5  *\ Class EcalElectronicsMapper
6  *
7  * Mapper for the ECAL electronics
8 
9  * \file EcalElectronicsMapper.h
10  *
11  * \author N. Almeida
12  * \author G. Franzoni
13  *
14 */
15 
16 #include <iostream>
17 #include <fstream>
18 #include <string>
19 #include <map>
20 
21 #include "DCCRawDataDefinitions.h"
29 #include <iostream>
30 #include <sstream>
31 
33 
35 
37 public:
41  EcalElectronicsMapper(unsigned int numbOfXtalTSamples, unsigned int numbOfTriggerTSamples);
42 
47 
49 
50  void deletePointers();
51  void resetPointers();
52 
56  bool setActiveDCC(unsigned int dccId);
57 
62 
67 
72  // bool readDCCMapFile();
73  // bool readDCCMapFile(std::string );
74 
79  bool makeMapFromVectors(std::vector<int>&, std::vector<int>&);
80 
84  const std::map<unsigned int, unsigned int>& getDCCMap() const { return myDCCMap_; }
85 
86  DetId* getDetIdPointer(unsigned int feChannel, unsigned int strip, unsigned int xtal) {
87  return xtalDetIds_[smId_ - 1][feChannel - 1][strip - 1][xtal - 1];
88  }
89 
90  EcalTrigTowerDetId* getTTDetIdPointer(unsigned int tccId, unsigned int tower) {
91  return ttDetIds_[tccId - 1][tower - 1];
92  }
93 
94  EcalElectronicsId* getTTEleIdPointer(unsigned int tccId, unsigned int tower) {
95  return ttEleIds_[tccId - 1][tower - 1];
96  }
97 
98  EcalTriggerPrimitiveDigi* getTPPointer(unsigned int tccId, unsigned int tower) {
99  return ttTPIds_[tccId - 1][tower - 1];
100  }
101 
102  EcalScDetId* getSCDetIdPointer(unsigned int smId, unsigned int feChannel) {
103  return scDetIds_[smId - 1][feChannel - 1];
104  }
105 
106  EcalElectronicsId* getSCElectronicsPointer(unsigned int smId, unsigned int feChannel) {
107  return scEleIds_[smId - 1][feChannel - 1];
108  }
109 
110  EcalPseudoStripInputDigi* getPSInputDigiPointer(unsigned int tccId, unsigned int towerId, unsigned int psId) {
111  return psInput_[tccId - 1][towerId - 1][psId - 1];
112  }
113 
114  EcalPseudoStripInputDigi* getPSInputDigiPointer(unsigned int tccId, unsigned int psCounter) {
115  return getPSInputDigiPointer(tccId, tTandPs_[tccId - 1][psCounter - 1][0], tTandPs_[tccId - 1][psCounter - 1][1]);
116  }
117 
118  // this getter method needs be clarified.
119  // Changed by Ph.G. on July 1, 09: return a vector instead of a single
120  // element. One SRF can be associated to two supercrystals, because of
121  // channel grouping.
122  std::vector<EcalSrFlag*> getSrFlagPointer(unsigned int feChannel) { return srFlags_[smId_ - 1][feChannel - 1]; }
123 
124  std::vector<unsigned int>* getTccs(unsigned int smId) { return mapSmIdToTccIds_[smId]; }
125 
126  unsigned int getActiveDCC() { return dccId_; }
127 
128  unsigned int getActiveSM() { return smId_; }
129 
130  unsigned int numbXtalTSamples() { return numbXtalTSamples_; }
131 
132  unsigned int numbTriggerTSamples() { return numbTriggerTSamples_; }
133 
135 
136  unsigned int getEBTCCBlockLength() { return ebTccBlockLength_; }
137 
138  unsigned int getEETCCBlockLength() { return eeTccBlockLength_; }
139 
140  unsigned int getSRPBlockLength() { return srpBlockLength_; }
141 
142  unsigned int getDCCId(unsigned int aSMId) const;
143 
144  unsigned int getSMId(unsigned int aDCCId) const;
145 
146  unsigned int getNumChannelsInDcc(unsigned int aDCCId) { return numChannelsInDcc_[aDCCId - 1]; }
147 
149 
150  bool isTCCExternal(unsigned int TCCId);
151 
155  friend std::ostream& operator<<(std::ostream& o, const EcalElectronicsMapper& aEcalElectronicsMapper);
156 
157  // Mantain this here as long as everything is moved to a general mapping
158  enum SMGeom_t {
159  kModules = 4, // Number of modules per supermodule
160  kTriggerTowers = 68, // Number of trigger towers per supermodule
161  kTowersInPhi = 4, // Number of trigger towers in phi
162  kTowersInEta = 17, // Number of trigger towers in eta
163  kCrystals = 1700, // Number of crystals per supermodule
164  kPns = 10, // Number of PN laser monitoring diodes per supermodule
165  kCrystalsInPhi = 20, // Number of crystals in phi
166  kCrystalsInEta = 85, // Number of crystals in eta
167  kCrystalsPerTower = 25, // Number of crystals per trigger tower
168  kCardsPerTower = 5, // Number of VFE cards per trigger tower
169  kChannelsPerCard = 5, // Number of channels per VFE card
170  TTMAPMASK = 100
171  };
172 
173 private:
174  void fillMaps();
175  unsigned int computeUnfilteredFEBlockLength();
176  unsigned int computeEBTCCBlockLength();
177  unsigned int computeEETCCBlockLength();
178 
180 
181  unsigned int numbXtalTSamples_;
182 
183  unsigned int numbTriggerTSamples_;
184 
185  std::map<unsigned int, unsigned int> myDCCMap_;
186 
187  std::map<unsigned int, std::vector<unsigned int>*> mapSmIdToTccIds_;
188 
189  unsigned int dccId_;
190 
191  unsigned int smId_;
192 
194 
195  unsigned int srpBlockLength_;
196 
198 
199  static const unsigned int numChannelsInDcc_[NUMB_SM];
200 
201  // ARRAYS OF DetId
208  std::vector<EcalSrFlag*> srFlags_[NUMB_SM][NUMB_FE];
210 
212 
214 
215  // functions and fields to work with 'ghost' VFEs:
216 public:
217  // check, does the given [FED (dcc), CCU (tower), VFE (strip)] belongs
218  // to the list of VFEs with 'ghost' channels
219  bool isGhost(const int FED, const int CCU, const int VFE);
220 
221 private:
222  void setupGhostMap();
223  std::map<int, std::map<int, std::map<int, bool> > > ghost_;
224 };
225 
226 #endif
std::vector< unsigned int > * getTccs(unsigned int smId)
unsigned int getSMId(unsigned int aDCCId) const
std::vector< EcalSrFlag * > getSrFlagPointer(unsigned int feChannel)
EcalPseudoStripInputDigi * getPSInputDigiPointer(unsigned int tccId, unsigned int psCounter)
const EcalElectronicsMapping * mapping()
std::map< unsigned int, std::vector< unsigned int > * > mapSmIdToTccIds_
const EcalElectronicsMapping * mappingBuilder_
unsigned int getEBTCCBlockLength()
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
EcalTriggerPrimitiveDigi * ttTPIds_[NUMB_TCC][NUMB_FE]
unsigned int getNumChannelsInDcc(unsigned int aDCCId)
unsigned int numbTriggerTSamples()
EcalElectronicsId * getSCElectronicsPointer(unsigned int smId, unsigned int feChannel)
EcalElectronicsId * ttEleIds_[NUMB_TCC][NUMB_FE]
unsigned tccId(DetId const &)
EcalScDetId * getSCDetIdPointer(unsigned int smId, unsigned int feChannel)
DetId * getDetIdPointer(unsigned int feChannel, unsigned int strip, unsigned int xtal)
void setEcalElectronicsMapping(const EcalElectronicsMapping *)
unsigned int getEETCCBlockLength()
std::map< unsigned int, unsigned int > myDCCMap_
EcalPseudoStripInputDigi * psInput_[NUMB_TCC][TCC_EB_NUMBTTS][NUMB_STRIP]
unsigned int getDCCId(unsigned int aSMId) const
static const unsigned int numChannelsInDcc_[NUMB_SM]
bool setActiveDCC(unsigned int dccId)
bool makeMapFromVectors(std::vector< int > &, std::vector< int > &)
const std::map< unsigned int, unsigned int > & getDCCMap() const
unsigned int computeEETCCBlockLength()
bool isGhost(const int FED, const int CCU, const int VFE)
EcalTrigTowerDetId * ttDetIds_[NUMB_TCC][NUMB_FE]
Definition: DetId.h:17
EcalPseudoStripInputDigi * getPSInputDigiPointer(unsigned int tccId, unsigned int towerId, unsigned int psId)
std::vector< EcalSrFlag * > srFlags_[NUMB_SM][NUMB_FE]
EcalElectronicsMapper(unsigned int numbOfXtalTSamples, unsigned int numbOfTriggerTSamples)
EcalTrigTowerDetId * getTTDetIdPointer(unsigned int tccId, unsigned int tower)
std::string getDCCMapFilePath() const
bool setDCCMapFilePath(std::string)
EcalScDetId * scDetIds_[NUMB_SM][NUMB_FE]
short tTandPs_[NUMB_TCC][5 *EcalTrigTowerDetId::kEBTowersPerSM][2]
l1t::HGCalTowerID towerId
Definition: classes.h:36
unsigned int computeUnfilteredFEBlockLength()
unsigned int getUnfilteredTowerBlockLength()
std::map< int, std::map< int, std::map< int, bool > > > ghost_
EcalTriggerPrimitiveDigi * getTPPointer(unsigned int tccId, unsigned int tower)
bool isTCCExternal(unsigned int TCCId)
unsigned int computeEBTCCBlockLength()
static const int kEBTowersPerSM
EcalElectronicsId * getTTEleIdPointer(unsigned int tccId, unsigned int tower)
DetId * xtalDetIds_[NUMB_SM][NUMB_FE][NUMB_STRIP][NUMB_XTAL]
unsigned dccId(DetId const &)
friend std::ostream & operator<<(std::ostream &o, const EcalElectronicsMapper &aEcalElectronicsMapper)
EcalElectronicsId * scEleIds_[NUMB_SM][NUMB_FE]