CMS 3D CMS Logo

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