CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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  * $Date: 2010/09/30 16:45:32 $
13  * $Revision: 1.6 $
14  * \author N. Almeida
15  * \author G. Franzoni
16  *
17 */
18 
19 
20 #include <iostream>
21 #include <fstream>
22 #include <string>
23 #include <map>
24 
25 
26 #include "DCCRawDataDefinitions.h"
34 #include <iostream>
35 #include <sstream>
36 
38 
40 
42 
43 public:
44 
48  EcalElectronicsMapper(unsigned int numbOfXtalTSamples, unsigned int numbOfTriggerTSamples);
49 
50 
55 
56 
58 
59  void deletePointers();
60  void resetPointers();
61 
65  bool setActiveDCC(unsigned int dccId);
66 
67 
72 
73 
78 
79 
84  // bool readDCCMapFile();
85  // bool readDCCMapFile(std::string );
86 
91  bool makeMapFromVectors(std::vector<int>&, std::vector<int>&);
92 
96  const std::map<unsigned int ,unsigned int>& getDCCMap() const { return myDCCMap_; }
97 
98  DetId * getDetIdPointer(unsigned int feChannel, unsigned int strip, unsigned int xtal){ return xtalDetIds_[smId_-1][feChannel-1][strip-1][xtal-1];}
99 
100  EcalTrigTowerDetId * getTTDetIdPointer(unsigned int tccId, unsigned int tower){ return ttDetIds_[tccId-1][tower-1];}
101 
102  EcalElectronicsId * getTTEleIdPointer(unsigned int tccId, unsigned int tower){ return ttEleIds_[tccId-1][tower-1];}
103 
104  EcalTriggerPrimitiveDigi * getTPPointer(unsigned int tccId, unsigned int tower){ return ttTPIds_[tccId-1][tower-1];}
105 
106  EcalScDetId * getSCDetIdPointer(unsigned int smId, unsigned int feChannel){ return scDetIds_[smId-1][feChannel-1];}
107 
108  EcalElectronicsId * getSCElectronicsPointer(unsigned int smId, unsigned int feChannel){ return scEleIds_[smId-1][feChannel-1];}
109 
110  EcalPseudoStripInputDigi * getPSInputDigiPointer(unsigned int tccId, unsigned int towerId, unsigned int psId){ return psInput_[tccId-1][towerId-1][psId-1];}
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 
156  // Mantain this here as long as everything is moved to a general mapping
157  enum SMGeom_t {
158  kModules = 4, // Number of modules per supermodule
159  kTriggerTowers = 68, // Number of trigger towers per supermodule
160  kTowersInPhi = 4, // Number of trigger towers in phi
161  kTowersInEta = 17, // Number of trigger towers in eta
162  kCrystals = 1700, // Number of crystals per supermodule
163  kPns = 10, // Number of PN laser monitoring diodes per supermodule
164  kCrystalsInPhi = 20, // Number of crystals in phi
165  kCrystalsInEta = 85, // Number of crystals in eta
166  kCrystalsPerTower = 25, // Number of crystals per trigger tower
167  kCardsPerTower = 5, // Number of VFE cards per trigger tower
168  kChannelsPerCard = 5, // Number of channels per VFE card
169  TTMAPMASK = 100
170  };
171 
172 
173 private:
174 
175  void fillMaps();
176  unsigned int computeUnfilteredFEBlockLength();
177  unsigned int computeEBTCCBlockLength();
178  unsigned int computeEETCCBlockLength();
179 
181 
182  unsigned int numbXtalTSamples_;
183 
184  unsigned int numbTriggerTSamples_;
185 
186  std::map<unsigned int,unsigned int> myDCCMap_;
187 
188  std::map< unsigned int, std::vector<unsigned int> * > mapSmIdToTccIds_;
189 
190  unsigned int dccId_;
191 
192  unsigned int smId_;
193 
195 
196  unsigned int srpBlockLength_;
197 
199 
200  static const unsigned int numChannelsInDcc_[NUMB_SM];
201 
202 
203  // ARRAYS OF DetId
210  std::vector<EcalSrFlag*> srFlags_[NUMB_SM][NUMB_FE];
212 
214 
216 
217 
218 // functions and fields to work with 'ghost' VFEs:
219 public:
220  // check, does the given [FED (dcc), CCU (tower), VFE (strip)] belongs
221  // to the list of VFEs with 'ghost' channels
222  bool isGhost(const int FED, const int CCU, const int VFE);
223 
224 private:
225  void setupGhostMap();
226  std::map<int, std::map<int, std::map<int, bool> > > ghost_;
227 };
228 
229 #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 dccId(const DetId &)
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()
unsigned towerId(const DetId &)
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:20
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]
unsigned int computeUnfilteredFEBlockLength()
unsigned tccId(const DetId &)
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]
friend std::ostream & operator<<(std::ostream &o, const EcalElectronicsMapper &aEcalElectronicsMapper)
EcalElectronicsId * scEleIds_[NUMB_SM][NUMB_FE]