Go to the documentation of this file.00001 #ifndef _EcalElectronicsMapper_HH_
00002 #define _EcalElectronicsMapper_HH_
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include <iostream>
00021 #include <fstream>
00022 #include <string>
00023 #include <map>
00024
00025
00026 #include "DCCRawDataDefinitions.h"
00027 #include <DataFormats/EcalDetId/interface/EcalTrigTowerDetId.h>
00028 #include <DataFormats/EcalDetId/interface/EcalElectronicsId.h>
00029 #include <DataFormats/EcalDetId/interface/EcalScDetId.h>
00030 #include <DataFormats/EcalDigi/interface/EcalDataFrame.h>
00031 #include <DataFormats/EcalDigi/interface/EcalTriggerPrimitiveDigi.h>
00032 #include <DataFormats/EcalDigi/interface/EcalPseudoStripInputDigi.h>
00033 #include <DataFormats/EcalDigi/interface/EcalSrFlag.h>
00034 #include <iostream>
00035 #include <sstream>
00036
00037 #include <DataFormats/EcalDetId/interface/EcalTriggerElectronicsId.h>
00038
00039 class EcalElectronicsMapping;
00040
00041 class EcalElectronicsMapper{
00042
00043 public:
00044
00045
00049 EcalElectronicsMapper(unsigned int numbOfXtalTSamples, unsigned int numbOfTriggerTSamples);
00050
00051
00055 ~EcalElectronicsMapper();
00056
00057
00058 void setEcalElectronicsMapping(const EcalElectronicsMapping *);
00059
00060 void deletePointers();
00061 void resetPointers();
00062
00066 bool setActiveDCC(unsigned int dccId);
00067
00068
00072 bool setDCCMapFilePath(std::string );
00073
00074
00078 std::string getDCCMapFilePath() const { return pathToMapFile_; }
00079
00080
00085
00086
00087
00092 bool makeMapFromVectors(std::vector<int>&, std::vector<int>&);
00093
00097 const std::map<unsigned int ,unsigned int>& getDCCMap() const { return myDCCMap_; }
00098
00099 DetId * getDetIdPointer(unsigned int feChannel, unsigned int strip, unsigned int xtal){ return xtalDetIds_[smId_-1][feChannel-1][strip-1][xtal-1];}
00100
00101 EcalTrigTowerDetId * getTTDetIdPointer(unsigned int tccId, unsigned int tower){ return ttDetIds_[tccId-1][tower-1];}
00102
00103 EcalElectronicsId * getTTEleIdPointer(unsigned int tccId, unsigned int tower){ return ttEleIds_[tccId-1][tower-1];}
00104
00105 EcalTriggerPrimitiveDigi * getTPPointer(unsigned int tccId, unsigned int tower){ return ttTPIds_[tccId-1][tower-1];}
00106
00107 EcalScDetId * getSCDetIdPointer(unsigned int smId, unsigned int feChannel){ return scDetIds_[smId-1][feChannel-1];}
00108
00109 EcalElectronicsId * getSCElectronicsPointer(unsigned int smId, unsigned int feChannel){ return scEleIds_[smId-1][feChannel-1];}
00110
00111 EcalPseudoStripInputDigi * getPSInputDigiPointer(unsigned int tccId, unsigned int towerId, unsigned int psId){ return psInput_[tccId-1][towerId-1][psId-1];}
00112
00113 EcalPseudoStripInputDigi * getPSInputDigiPointer(unsigned int tccId, unsigned int psCounter){
00114 return getPSInputDigiPointer(tccId, tTandPs_[tccId-1][psCounter-1][0],tTandPs_[tccId-1][psCounter-1][1]);}
00115
00116
00117
00118
00119
00120
00121 std::vector<EcalSrFlag*> getSrFlagPointer(unsigned int feChannel){ return srFlags_[smId_-1][feChannel-1]; }
00122
00123 std::vector<unsigned int> * getTccs(unsigned int smId){ return mapSmIdToTccIds_[smId];}
00124
00125 unsigned int getActiveDCC() { return dccId_; }
00126
00127 unsigned int getActiveSM() { return smId_; }
00128
00129 unsigned int numbXtalTSamples() { return numbXtalTSamples_; }
00130
00131 unsigned int numbTriggerTSamples() { return numbTriggerTSamples_; }
00132
00133 unsigned int getUnfilteredTowerBlockLength(){ return unfilteredFEBlockLength_; }
00134
00135 unsigned int getEBTCCBlockLength() { return ebTccBlockLength_; }
00136
00137 unsigned int getEETCCBlockLength() { return eeTccBlockLength_; }
00138
00139 unsigned int getSRPBlockLength() { return srpBlockLength_; }
00140
00141 unsigned int getDCCId(unsigned int aSMId) const;
00142
00143 unsigned int getSMId(unsigned int aDCCId) const;
00144
00145 unsigned int getNumChannelsInDcc(unsigned int aDCCId){return numChannelsInDcc_[aDCCId-1];}
00146
00147 const EcalElectronicsMapping * mapping(){return mappingBuilder_;}
00148
00149 bool isTCCExternal(unsigned int TCCId);
00150
00154 friend std::ostream& operator<< (std::ostream &o, const EcalElectronicsMapper& aEcalElectronicsMapper);
00155
00156
00157
00158 enum SMGeom_t {
00159 kModules = 4,
00160 kTriggerTowers = 68,
00161 kTowersInPhi = 4,
00162 kTowersInEta = 17,
00163 kCrystals = 1700,
00164 kPns = 10,
00165 kCrystalsInPhi = 20,
00166 kCrystalsInEta = 85,
00167 kCrystalsPerTower = 25,
00168 kCardsPerTower = 5,
00169 kChannelsPerCard = 5,
00170 TTMAPMASK = 100
00171 };
00172
00173
00174 private:
00175
00176 void fillMaps();
00177 unsigned int computeUnfilteredFEBlockLength();
00178 unsigned int computeEBTCCBlockLength();
00179 unsigned int computeEETCCBlockLength();
00180
00181 std::string pathToMapFile_;
00182
00183 unsigned int numbXtalTSamples_;
00184
00185 unsigned int numbTriggerTSamples_;
00186
00187 std::map<unsigned int,unsigned int> myDCCMap_;
00188
00189 std::map< unsigned int, std::vector<unsigned int> * > mapSmIdToTccIds_;
00190
00191 unsigned int dccId_;
00192
00193 unsigned int smId_;
00194
00195 unsigned int unfilteredFEBlockLength_;
00196
00197 unsigned int srpBlockLength_;
00198
00199 unsigned int ebTccBlockLength_, eeTccBlockLength_;
00200
00201 static const unsigned int numChannelsInDcc_[NUMB_SM];
00202
00203
00204
00205 DetId * xtalDetIds_[NUMB_SM][NUMB_FE][NUMB_STRIP][NUMB_XTAL];
00206 EcalScDetId * scDetIds_[NUMB_SM][NUMB_FE];
00207 EcalElectronicsId * scEleIds_[NUMB_SM][NUMB_FE];
00208 EcalTrigTowerDetId * ttDetIds_[NUMB_TCC][NUMB_FE];
00209 EcalElectronicsId * ttEleIds_[NUMB_TCC][NUMB_FE];
00210 EcalTriggerPrimitiveDigi * ttTPIds_[NUMB_TCC][NUMB_FE];
00211 std::vector<EcalSrFlag*> srFlags_[NUMB_SM][NUMB_FE];
00212 EcalPseudoStripInputDigi * psInput_[NUMB_TCC][TCC_EB_NUMBTTS][NUMB_STRIP];
00213
00214 short tTandPs_[NUMB_TCC][5*EcalTrigTowerDetId::kEBTowersPerSM][2];
00215
00216 const EcalElectronicsMapping * mappingBuilder_;
00217
00218
00219 };
00220
00221 #endif