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 <sstream>
18 #include <fstream>
19 #include <string>
20 #include <map>
21 
22 #include "DCCRawDataDefinitions.h"
31 
33 
35 public:
39  EcalElectronicsMapper(unsigned int numbOfXtalTSamples, unsigned int numbOfTriggerTSamples);
40 
45 
47 
48  void deletePointers();
49  void resetPointers();
50 
54  bool setActiveDCC(unsigned int dccId);
55 
60 
65 
70  // bool readDCCMapFile();
71  // bool readDCCMapFile(std::string );
72 
77  bool makeMapFromVectors(std::vector<int>&, std::vector<int>&);
78 
82  const std::map<unsigned int, unsigned int>& getDCCMap() const { return myDCCMap_; }
83 
84  DetId* getDetIdPointer(unsigned int feChannel, unsigned int strip, unsigned int xtal) {
85  return xtalDetIds_[smId_ - 1][feChannel - 1][strip - 1][xtal - 1];
86  }
87 
88  EcalTrigTowerDetId* getTTDetIdPointer(unsigned int tccId, unsigned int tower) {
89  return ttDetIds_[tccId - 1][tower - 1];
90  }
91 
92  EcalElectronicsId* getTTEleIdPointer(unsigned int tccId, unsigned int tower) {
93  return ttEleIds_[tccId - 1][tower - 1];
94  }
95 
96  EcalTriggerPrimitiveDigi* getTPPointer(unsigned int tccId, unsigned int tower) {
97  return ttTPIds_[tccId - 1][tower - 1];
98  }
99 
100  EcalScDetId* getSCDetIdPointer(unsigned int smId, unsigned int feChannel) {
101  return scDetIds_[smId - 1][feChannel - 1];
102  }
103 
104  EcalElectronicsId* getSCElectronicsPointer(unsigned int smId, unsigned int feChannel) {
105  return scEleIds_[smId - 1][feChannel - 1];
106  }
107 
108  EcalPseudoStripInputDigi* getPSInputDigiPointer(unsigned int tccId, unsigned int towerId, unsigned int psId) {
109  return psInput_[tccId - 1][towerId - 1][psId - 1];
110  }
111 
112  EcalPseudoStripInputDigi* getPSInputDigiPointer(unsigned int tccId, unsigned int psCounter) {
113  return getPSInputDigiPointer(tccId, tTandPs_[tccId - 1][psCounter - 1][0], tTandPs_[tccId - 1][psCounter - 1][1]);
114  }
115 
116  // this getter method needs be clarified.
117  // Changed by Ph.G. on July 1, 09: return a vector instead of a single
118  // element. One SRF can be associated to two supercrystals, because of
119  // channel grouping.
120  std::vector<EcalSrFlag*> getSrFlagPointer(unsigned int feChannel) { return srFlags_[smId_ - 1][feChannel - 1]; }
121 
122  std::vector<unsigned int>* getTccs(unsigned int smId) { return mapSmIdToTccIds_[smId]; }
123 
124  unsigned int getActiveDCC() { return dccId_; }
125 
126  unsigned int getActiveSM() { return smId_; }
127 
128  unsigned int numbXtalTSamples() { return numbXtalTSamples_; }
129 
130  unsigned int numbTriggerTSamples() { return numbTriggerTSamples_; }
131 
133 
134  unsigned int getEBTCCBlockLength() { return ebTccBlockLength_; }
135 
136  unsigned int getEETCCBlockLength() { return eeTccBlockLength_; }
137 
138  unsigned int getSRPBlockLength() { return srpBlockLength_; }
139 
140  unsigned int getDCCId(unsigned int aSMId) const;
141 
142  unsigned int getSMId(unsigned int aDCCId) const;
143 
144  unsigned int getNumChannelsInDcc(unsigned int aDCCId) { return numChannelsInDcc_[aDCCId - 1]; }
145 
147 
148  bool isTCCExternal(unsigned int TCCId);
149 
153  friend std::ostream& operator<<(std::ostream& o, const EcalElectronicsMapper& aEcalElectronicsMapper);
154 
155  // Mantain this here as long as everything is moved to a general mapping
156  enum SMGeom_t {
157  kModules = 4, // Number of modules per supermodule
158  kTriggerTowers = 68, // Number of trigger towers per supermodule
159  kTowersInPhi = 4, // Number of trigger towers in phi
160  kTowersInEta = 17, // Number of trigger towers in eta
161  kCrystals = 1700, // Number of crystals per supermodule
162  kPns = 10, // Number of PN laser monitoring diodes per supermodule
163  kCrystalsInPhi = 20, // Number of crystals in phi
164  kCrystalsInEta = 85, // Number of crystals in eta
165  kCrystalsPerTower = 25, // Number of crystals per trigger tower
166  kCardsPerTower = 5, // Number of VFE cards per trigger tower
167  kChannelsPerCard = 5, // Number of channels per VFE card
168  TTMAPMASK = 100
169  };
170 
171 private:
172  void fillMaps();
173  unsigned int computeUnfilteredFEBlockLength();
174  unsigned int computeEBTCCBlockLength();
175  unsigned int computeEETCCBlockLength();
176 
178 
179  unsigned int numbXtalTSamples_;
180 
181  unsigned int numbTriggerTSamples_;
182 
183  std::map<unsigned int, unsigned int> myDCCMap_;
184 
185  std::map<unsigned int, std::vector<unsigned int>*> mapSmIdToTccIds_;
186 
187  unsigned int dccId_;
188 
189  unsigned int smId_;
190 
192 
193  unsigned int srpBlockLength_;
194 
196 
197  static const unsigned int numChannelsInDcc_[NUMB_SM];
198 
199  // ARRAYS OF DetId
206  std::vector<EcalSrFlag*> srFlags_[NUMB_SM][NUMB_FE];
208 
210 
212 
213  // functions and fields to work with 'ghost' VFEs:
214 public:
215  // check, does the given [FED (dcc), CCU (tower), VFE (strip)] belongs
216  // to the list of VFEs with 'ghost' channels
217  bool isGhost(const int FED, const int CCU, const int VFE);
218 
219 private:
220  void setupGhostMap();
221  std::map<int, std::map<int, std::map<int, bool> > > ghost_;
222 };
223 
224 #endif
std::vector< unsigned int > * getTccs(unsigned int smId)
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()
unsigned int getSMId(unsigned int aDCCId) const
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]
EcalScDetId * getSCDetIdPointer(unsigned int smId, unsigned int feChannel)
std::string getDCCMapFilePath() const
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 towerId(DetId const &, EcalElectronicsMapping const *)
static const unsigned int numChannelsInDcc_[NUMB_SM]
bool setActiveDCC(unsigned int dccId)
bool makeMapFromVectors(std::vector< int > &, std::vector< int > &)
unsigned dccId(DetId const &, EcalElectronicsMapping const *)
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)
bool setDCCMapFilePath(std::string)
unsigned tccId(DetId const &, EcalElectronicsMapping const *)
EcalScDetId * scDetIds_[NUMB_SM][NUMB_FE]
short tTandPs_[NUMB_TCC][5 *EcalTrigTowerDetId::kEBTowersPerSM][2]
unsigned int computeUnfilteredFEBlockLength()
unsigned int getUnfilteredTowerBlockLength()
unsigned int getDCCId(unsigned int aSMId) const
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]
friend std::ostream & operator<<(std::ostream &o, const EcalElectronicsMapper &aEcalElectronicsMapper)
EcalElectronicsId * scEleIds_[NUMB_SM][NUMB_FE]