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: 2009/10/19 17:27:48 $
13  * $Revision: 1.4 $
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 
45 
49  EcalElectronicsMapper(unsigned int numbOfXtalTSamples, unsigned int numbOfTriggerTSamples);
50 
51 
56 
57 
59 
60  void deletePointers();
61  void resetPointers();
62 
66  bool setActiveDCC(unsigned int dccId);
67 
68 
72  bool setDCCMapFilePath(std::string );
73 
74 
78  std::string getDCCMapFilePath() const { return pathToMapFile_; }
79 
80 
85  // bool readDCCMapFile();
86  // bool readDCCMapFile(std::string );
87 
92  bool makeMapFromVectors(std::vector<int>&, std::vector<int>&);
93 
97  const std::map<unsigned int ,unsigned int>& getDCCMap() const { return myDCCMap_; }
98 
99  DetId * getDetIdPointer(unsigned int feChannel, unsigned int strip, unsigned int xtal){ return xtalDetIds_[smId_-1][feChannel-1][strip-1][xtal-1];}
100 
101  EcalTrigTowerDetId * getTTDetIdPointer(unsigned int tccId, unsigned int tower){ return ttDetIds_[tccId-1][tower-1];}
102 
103  EcalElectronicsId * getTTEleIdPointer(unsigned int tccId, unsigned int tower){ return ttEleIds_[tccId-1][tower-1];}
104 
105  EcalTriggerPrimitiveDigi * getTPPointer(unsigned int tccId, unsigned int tower){ return ttTPIds_[tccId-1][tower-1];}
106 
107  EcalScDetId * getSCDetIdPointer(unsigned int smId, unsigned int feChannel){ return scDetIds_[smId-1][feChannel-1];}
108 
109  EcalElectronicsId * getSCElectronicsPointer(unsigned int smId, unsigned int feChannel){ return scEleIds_[smId-1][feChannel-1];}
110 
111  EcalPseudoStripInputDigi * getPSInputDigiPointer(unsigned int tccId, unsigned int towerId, unsigned int psId){ return psInput_[tccId-1][towerId-1][psId-1];}
112 
113  EcalPseudoStripInputDigi * getPSInputDigiPointer(unsigned int tccId, unsigned int psCounter){
114  return getPSInputDigiPointer(tccId, tTandPs_[tccId-1][psCounter-1][0],tTandPs_[tccId-1][psCounter-1][1]);}
115 
116 
117  // this getter method needs be clarified.
118  // Changed by Ph.G. on July 1, 09: return a vector instead of a single
119  // element. One SRF can be associated to two supercrystals, because of
120  // channel grouping.
121  std::vector<EcalSrFlag*> getSrFlagPointer(unsigned int feChannel){ return srFlags_[smId_-1][feChannel-1]; }
122 
123  std::vector<unsigned int> * getTccs(unsigned int smId){ return mapSmIdToTccIds_[smId];}
124 
125  unsigned int getActiveDCC() { return dccId_; }
126 
127  unsigned int getActiveSM() { return smId_; }
128 
129  unsigned int numbXtalTSamples() { return numbXtalTSamples_; }
130 
131  unsigned int numbTriggerTSamples() { return numbTriggerTSamples_; }
132 
134 
135  unsigned int getEBTCCBlockLength() { return ebTccBlockLength_; }
136 
137  unsigned int getEETCCBlockLength() { return eeTccBlockLength_; }
138 
139  unsigned int getSRPBlockLength() { return srpBlockLength_; }
140 
141  unsigned int getDCCId(unsigned int aSMId) const;
142 
143  unsigned int getSMId(unsigned int aDCCId) const;
144 
145  unsigned int getNumChannelsInDcc(unsigned int aDCCId){return numChannelsInDcc_[aDCCId-1];}
146 
148 
149  bool isTCCExternal(unsigned int TCCId);
150 
154  friend std::ostream& operator<< (std::ostream &o, const EcalElectronicsMapper& aEcalElectronicsMapper);
155 
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 
174 private:
175 
176  void fillMaps();
177  unsigned int computeUnfilteredFEBlockLength();
178  unsigned int computeEBTCCBlockLength();
179  unsigned int computeEETCCBlockLength();
180 
181  std::string pathToMapFile_;
182 
183  unsigned int numbXtalTSamples_;
184 
185  unsigned int numbTriggerTSamples_;
186 
187  std::map<unsigned int,unsigned int> myDCCMap_;
188 
189  std::map< unsigned int, std::vector<unsigned int> * > mapSmIdToTccIds_;
190 
191  unsigned int dccId_;
192 
193  unsigned int smId_;
194 
196 
197  unsigned int srpBlockLength_;
198 
200 
201  static const unsigned int numChannelsInDcc_[NUMB_SM];
202 
203 
204  // ARRAYS OF DetId
211  std::vector<EcalSrFlag*> srFlags_[NUMB_SM][NUMB_FE];
213 
215 
217 
218 
219 };
220 
221 #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()
void strip(std::string &input, const std::string &blanks=" \n\t")
Definition: stringTools.cc:16
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]
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()
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 int getUnfilteredTowerBlockLength()
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]