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
EcalElectronicsMapper::setEcalElectronicsMapping
void setEcalElectronicsMapping(const EcalElectronicsMapping *)
Definition: EcalElectronicsMapper.cc:247
EcalElectronicsMapper::computeEBTCCBlockLength
unsigned int computeEBTCCBlockLength()
Definition: EcalElectronicsMapper.cc:374
EcalElectronicsMapping
Definition: EcalElectronicsMapping.h:28
EcalElectronicsMapper::getDCCMapFilePath
std::string getDCCMapFilePath() const
Definition: EcalElectronicsMapper.h:66
NUMB_TCC
Definition: DCCRawDataDefinitions.h:44
EcalElectronicsMapper::numbTriggerTSamples_
unsigned int numbTriggerTSamples_
Definition: EcalElectronicsMapper.h:183
EcalElectronicsMapper::setDCCMapFilePath
bool setDCCMapFilePath(std::string)
Definition: EcalElectronicsMapper.cc:266
EcalElectronicsId.h
EcalElectronicsMapper::resetPointers
void resetPointers()
Definition: EcalElectronicsMapper.cc:17
EcalElectronicsMapper::getDCCId
unsigned int getDCCId(unsigned int aSMId) const
Definition: EcalElectronicsMapper.cc:400
EcalElectronicsMapper::ebTccBlockLength_
unsigned int ebTccBlockLength_
Definition: EcalElectronicsMapper.h:197
EcalElectronicsMapper::numbXtalTSamples_
unsigned int numbXtalTSamples_
Definition: EcalElectronicsMapper.h:181
EcalElectronicsMapper::kTriggerTowers
Definition: EcalElectronicsMapper.h:160
EcalElectronicsMapper::getSCElectronicsPointer
EcalElectronicsId * getSCElectronicsPointer(unsigned int smId, unsigned int feChannel)
Definition: EcalElectronicsMapper.h:106
EcalElectronicsMapper::makeMapFromVectors
bool makeMapFromVectors(std::vector< int > &, std::vector< int > &)
Definition: EcalElectronicsMapper.cc:314
digitizers_cfi.strip
strip
Definition: digitizers_cfi.py:19
EcalElectronicsMapper::computeEETCCBlockLength
unsigned int computeEETCCBlockLength()
Definition: EcalElectronicsMapper.cc:387
EcalElectronicsMapper::kChannelsPerCard
Definition: EcalElectronicsMapper.h:169
EcalElectronicsMapper::dccId_
unsigned int dccId_
Definition: EcalElectronicsMapper.h:189
EcalElectronicsMapper::getActiveSM
unsigned int getActiveSM()
Definition: EcalElectronicsMapper.h:128
hgcalTowerProducer_cfi.tower
tower
Definition: hgcalTowerProducer_cfi.py:4
EcalElectronicsMapper::operator<<
friend std::ostream & operator<<(std::ostream &o, const EcalElectronicsMapper &aEcalElectronicsMapper)
Definition: EcalElectronicsMapper.cc:346
EcalElectronicsMapper::setActiveDCC
bool setActiveDCC(unsigned int dccId)
Definition: EcalElectronicsMapper.cc:252
EcalElectronicsMapper::getSCDetIdPointer
EcalScDetId * getSCDetIdPointer(unsigned int smId, unsigned int feChannel)
Definition: EcalElectronicsMapper.h:102
EcalElectronicsMapper::srFlags_
std::vector< EcalSrFlag * > srFlags_[NUMB_SM][NUMB_FE]
Definition: EcalElectronicsMapper.h:208
EcalElectronicsMapper::scDetIds_
EcalScDetId * scDetIds_[NUMB_SM][NUMB_FE]
Definition: EcalElectronicsMapper.h:203
EcalElectronicsMapper::numbXtalTSamples
unsigned int numbXtalTSamples()
Definition: EcalElectronicsMapper.h:130
EcalTrigTowerDetId
Definition: EcalTrigTowerDetId.h:14
EcalPseudoStripInputDigi
Definition: EcalPseudoStripInputDigi.h:13
NUMB_STRIP
Definition: DCCRawDataDefinitions.h:46
EcalElectronicsMapper::ttTPIds_
EcalTriggerPrimitiveDigi * ttTPIds_[NUMB_TCC][NUMB_FE]
Definition: EcalElectronicsMapper.h:207
EcalDataFrame.h
EcalElectronicsMapper::kTowersInEta
Definition: EcalElectronicsMapper.h:162
EcalTriggerPrimitiveDigi.h
EcalTangentSkim_cfg.o
o
Definition: EcalTangentSkim_cfg.py:42
EcalElectronicsMapper::kCrystalsPerTower
Definition: EcalElectronicsMapper.h:167
ecaldqm::towerId
unsigned towerId(DetId const &, EcalElectronicsMapping const *)
Definition: EcalDQMCommonUtils.cc:77
EcalElectronicsMapper::kCrystals
Definition: EcalElectronicsMapper.h:163
EcalElectronicsMapper::SMGeom_t
SMGeom_t
Definition: EcalElectronicsMapper.h:158
EcalElectronicsMapper::psInput_
EcalPseudoStripInputDigi * psInput_[NUMB_TCC][TCC_EB_NUMBTTS][NUMB_STRIP]
Definition: EcalElectronicsMapper.h:209
NUMB_FE
Definition: DCCRawDataDefinitions.h:43
EcalElectronicsMapper::ghost_
std::map< int, std::map< int, std::map< int, bool > > > ghost_
Definition: EcalElectronicsMapper.h:223
DetId
Definition: DetId.h:17
EcalElectronicsMapper::eeTccBlockLength_
unsigned int eeTccBlockLength_
Definition: EcalElectronicsMapper.h:197
EcalElectronicsMapper::getDetIdPointer
DetId * getDetIdPointer(unsigned int feChannel, unsigned int strip, unsigned int xtal)
Definition: EcalElectronicsMapper.h:86
EcalElectronicsMapper::getEBTCCBlockLength
unsigned int getEBTCCBlockLength()
Definition: EcalElectronicsMapper.h:136
EcalElectronicsMapper::kTowersInPhi
Definition: EcalElectronicsMapper.h:161
EcalScDetId
Definition: EcalScDetId.h:24
EcalElectronicsMapper::getActiveDCC
unsigned int getActiveDCC()
Definition: EcalElectronicsMapper.h:126
EcalElectronicsId
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
Definition: EcalElectronicsId.h:18
EcalElectronicsMapper::getNumChannelsInDcc
unsigned int getNumChannelsInDcc(unsigned int aDCCId)
Definition: EcalElectronicsMapper.h:146
EcalElectronicsMapper::getDCCMap
const std::map< unsigned int, unsigned int > & getDCCMap() const
Definition: EcalElectronicsMapper.h:84
TCC_EB_NUMBTTS
Definition: DCCRawDataDefinitions.h:39
EcalTrigTowerDetId.h
EcalElectronicsMapper::pathToMapFile_
std::string pathToMapFile_
Definition: EcalElectronicsMapper.h:179
EcalElectronicsMapper::getSrFlagPointer
std::vector< EcalSrFlag * > getSrFlagPointer(unsigned int feChannel)
Definition: EcalElectronicsMapper.h:122
EcalElectronicsMapper::getTccs
std::vector< unsigned int > * getTccs(unsigned int smId)
Definition: EcalElectronicsMapper.h:124
EcalElectronicsMapper::kCardsPerTower
Definition: EcalElectronicsMapper.h:168
EcalElectronicsMapper::isGhost
bool isGhost(const int FED, const int CCU, const int VFE)
Definition: EcalElectronicsMapper.cc:688
EcalElectronicsMapper::getPSInputDigiPointer
EcalPseudoStripInputDigi * getPSInputDigiPointer(unsigned int tccId, unsigned int towerId, unsigned int psId)
Definition: EcalElectronicsMapper.h:110
EcalElectronicsMapper::setupGhostMap
void setupGhostMap()
Definition: EcalElectronicsMapper.cc:668
NUMB_SM
Definition: DCCRawDataDefinitions.h:42
EcalElectronicsMapper::mapping
const EcalElectronicsMapping * mapping()
Definition: EcalElectronicsMapper.h:148
NUMB_XTAL
Definition: DCCRawDataDefinitions.h:45
EcalElectronicsMapper::myDCCMap_
std::map< unsigned int, unsigned int > myDCCMap_
Definition: EcalElectronicsMapper.h:185
EcalElectronicsMapper::mappingBuilder_
const EcalElectronicsMapping * mappingBuilder_
Definition: EcalElectronicsMapper.h:213
EcalElectronicsMapper::EcalElectronicsMapper
EcalElectronicsMapper(unsigned int numbOfXtalTSamples, unsigned int numbOfTriggerTSamples)
Definition: EcalElectronicsMapper.cc:8
EcalElectronicsMapper::mapSmIdToTccIds_
std::map< unsigned int, std::vector< unsigned int > * > mapSmIdToTccIds_
Definition: EcalElectronicsMapper.h:187
EcalTriggerElectronicsId.h
EcalElectronicsMapper::getSMId
unsigned int getSMId(unsigned int aDCCId) const
Definition: EcalElectronicsMapper.cc:415
EcalElectronicsMapper::xtalDetIds_
DetId * xtalDetIds_[NUMB_SM][NUMB_FE][NUMB_STRIP][NUMB_XTAL]
Definition: EcalElectronicsMapper.h:202
EcalSrFlag.h
EcalElectronicsMapper::kPns
Definition: EcalElectronicsMapper.h:164
EcalElectronicsMapper::tTandPs_
short tTandPs_[NUMB_TCC][5 *EcalTrigTowerDetId::kEBTowersPerSM][2]
Definition: EcalElectronicsMapper.h:211
EcalPseudoStripInputDigi.h
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
EcalElectronicsMapper::computeUnfilteredFEBlockLength
unsigned int computeUnfilteredFEBlockLength()
Definition: EcalElectronicsMapper.cc:370
ecaldqm::dccId
unsigned dccId(DetId const &, EcalElectronicsMapping const *)
Definition: EcalDQMCommonUtils.cc:16
EcalElectronicsMapper
Definition: EcalElectronicsMapper.h:36
EcalElectronicsMapper::~EcalElectronicsMapper
~EcalElectronicsMapper()
Definition: EcalElectronicsMapper.cc:196
EcalElectronicsMapper::kCrystalsInEta
Definition: EcalElectronicsMapper.h:166
EcalElectronicsMapper::getTPPointer
EcalTriggerPrimitiveDigi * getTPPointer(unsigned int tccId, unsigned int tower)
Definition: EcalElectronicsMapper.h:98
EcalTrigTowerDetId::kEBTowersPerSM
static const int kEBTowersPerSM
Definition: EcalTrigTowerDetId.h:101
EcalElectronicsMapper::isTCCExternal
bool isTCCExternal(unsigned int TCCId)
Definition: EcalElectronicsMapper.cc:392
EcalElectronicsMapper::srpBlockLength_
unsigned int srpBlockLength_
Definition: EcalElectronicsMapper.h:195
EcalElectronicsMapper::unfilteredFEBlockLength_
unsigned int unfilteredFEBlockLength_
Definition: EcalElectronicsMapper.h:193
EcalTriggerPrimitiveDigi
Definition: EcalTriggerPrimitiveDigi.h:16
EcalScDetId.h
EcalElectronicsMapper::getSRPBlockLength
unsigned int getSRPBlockLength()
Definition: EcalElectronicsMapper.h:140
EcalElectronicsMapper::TTMAPMASK
Definition: EcalElectronicsMapper.h:170
EcalElectronicsMapper::fillMaps
void fillMaps()
Definition: EcalElectronicsMapper.cc:431
EcalElectronicsMapper::numbTriggerTSamples
unsigned int numbTriggerTSamples()
Definition: EcalElectronicsMapper.h:132
DCCRawDataDefinitions.h
EcalElectronicsMapper::getTTEleIdPointer
EcalElectronicsId * getTTEleIdPointer(unsigned int tccId, unsigned int tower)
Definition: EcalElectronicsMapper.h:94
EcalElectronicsMapper::getUnfilteredTowerBlockLength
unsigned int getUnfilteredTowerBlockLength()
Definition: EcalElectronicsMapper.h:134
EcalElectronicsMapper::getEETCCBlockLength
unsigned int getEETCCBlockLength()
Definition: EcalElectronicsMapper.h:138
EcalElectronicsMapper::ttDetIds_
EcalTrigTowerDetId * ttDetIds_[NUMB_TCC][NUMB_FE]
Definition: EcalElectronicsMapper.h:205
ecaldqm::tccId
unsigned tccId(DetId const &, EcalElectronicsMapping const *)
Definition: EcalDQMCommonUtils.cc:54
EcalElectronicsMapper::kModules
Definition: EcalElectronicsMapper.h:159
EcalElectronicsMapper::deletePointers
void deletePointers()
Definition: EcalElectronicsMapper.cc:198
EcalElectronicsMapper::smId_
unsigned int smId_
Definition: EcalElectronicsMapper.h:191
EcalElectronicsMapper::scEleIds_
EcalElectronicsId * scEleIds_[NUMB_SM][NUMB_FE]
Definition: EcalElectronicsMapper.h:204
EcalElectronicsMapper::kCrystalsInPhi
Definition: EcalElectronicsMapper.h:165
EcalElectronicsMapper::ttEleIds_
EcalElectronicsId * ttEleIds_[NUMB_TCC][NUMB_FE]
Definition: EcalElectronicsMapper.h:206
EcalElectronicsMapper::getPSInputDigiPointer
EcalPseudoStripInputDigi * getPSInputDigiPointer(unsigned int tccId, unsigned int psCounter)
Definition: EcalElectronicsMapper.h:114
EcalElectronicsMapper::numChannelsInDcc_
static const unsigned int numChannelsInDcc_[NUMB_SM]
Definition: EcalElectronicsMapper.h:199
EcalElectronicsMapper::getTTDetIdPointer
EcalTrigTowerDetId * getTTDetIdPointer(unsigned int tccId, unsigned int tower)
Definition: EcalElectronicsMapper.h:90