1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
|
#ifndef _EcalElectronicsMapper_HH_
#define _EcalElectronicsMapper_HH_
/*
*\ Class EcalElectronicsMapper
*
* Mapper for the ECAL electronics
* \file EcalElectronicsMapper.h
*
* \author N. Almeida
* \author G. Franzoni
*
*/
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <map>
#include "DCCRawDataDefinitions.h"
#include <DataFormats/EcalDetId/interface/EcalTrigTowerDetId.h>
#include <DataFormats/EcalDetId/interface/EcalElectronicsId.h>
#include <DataFormats/EcalDetId/interface/EcalScDetId.h>
#include <DataFormats/EcalDigi/interface/EcalDataFrame.h>
#include <DataFormats/EcalDigi/interface/EcalTriggerPrimitiveDigi.h>
#include <DataFormats/EcalDigi/interface/EcalPseudoStripInputDigi.h>
#include <DataFormats/EcalDigi/interface/EcalSrFlag.h>
#include <DataFormats/EcalDetId/interface/EcalTriggerElectronicsId.h>
class EcalElectronicsMapping;
class EcalElectronicsMapper {
public:
/**
* Constructor
*/
EcalElectronicsMapper(unsigned int numbOfXtalTSamples, unsigned int numbOfTriggerTSamples);
/**
* Destructor
*/
~EcalElectronicsMapper();
void setEcalElectronicsMapping(const EcalElectronicsMapping*);
void deletePointers();
void resetPointers();
/**
* Set DCC id that is going to be unpacked for the event
*/
bool setActiveDCC(unsigned int dccId);
/**
* Receives a string with a path and checks if file is accessible
*/
bool setDCCMapFilePath(std::string);
/**
* Retrieves current path do the map file
*/
std::string getDCCMapFilePath() const { return pathToMapFile_; }
/**
* Read map file (returns false if an error ocurred)
* deprecated by HLT environment
*/
// bool readDCCMapFile();
// bool readDCCMapFile(std::string );
/**
* HLT friendly: load default mapping or, for non standatd mapping,
* use 2 vectors from cfg
*/
bool makeMapFromVectors(std::vector<int>&, std::vector<int>&);
/**
* Get methods for DCCId/SMId and map
*/
const std::map<unsigned int, unsigned int>& getDCCMap() const { return myDCCMap_; }
DetId* getDetIdPointer(unsigned int feChannel, unsigned int strip, unsigned int xtal) {
return xtalDetIds_[smId_ - 1][feChannel - 1][strip - 1][xtal - 1];
}
EcalTrigTowerDetId* getTTDetIdPointer(unsigned int tccId, unsigned int tower) {
return ttDetIds_[tccId - 1][tower - 1];
}
EcalElectronicsId* getTTEleIdPointer(unsigned int tccId, unsigned int tower) {
return ttEleIds_[tccId - 1][tower - 1];
}
EcalTriggerPrimitiveDigi* getTPPointer(unsigned int tccId, unsigned int tower) {
return ttTPIds_[tccId - 1][tower - 1];
}
EcalScDetId* getSCDetIdPointer(unsigned int smId, unsigned int feChannel) {
return scDetIds_[smId - 1][feChannel - 1];
}
EcalElectronicsId* getSCElectronicsPointer(unsigned int smId, unsigned int feChannel) {
return scEleIds_[smId - 1][feChannel - 1];
}
EcalPseudoStripInputDigi* getPSInputDigiPointer(unsigned int tccId, unsigned int towerId, unsigned int psId) {
return psInput_[tccId - 1][towerId - 1][psId - 1];
}
EcalPseudoStripInputDigi* getPSInputDigiPointer(unsigned int tccId, unsigned int psCounter) {
return getPSInputDigiPointer(tccId, tTandPs_[tccId - 1][psCounter - 1][0], tTandPs_[tccId - 1][psCounter - 1][1]);
}
// this getter method needs be clarified.
// Changed by Ph.G. on July 1, 09: return a vector instead of a single
// element. One SRF can be associated to two supercrystals, because of
// channel grouping.
std::vector<EcalSrFlag*> getSrFlagPointer(unsigned int feChannel) { return srFlags_[smId_ - 1][feChannel - 1]; }
std::vector<unsigned int>* getTccs(unsigned int smId) { return mapSmIdToTccIds_[smId]; }
unsigned int getActiveDCC() { return dccId_; }
unsigned int getActiveSM() { return smId_; }
unsigned int numbXtalTSamples() { return numbXtalTSamples_; }
unsigned int numbTriggerTSamples() { return numbTriggerTSamples_; }
unsigned int getUnfilteredTowerBlockLength() { return unfilteredFEBlockLength_; }
unsigned int getEBTCCBlockLength() { return ebTccBlockLength_; }
unsigned int getEETCCBlockLength() { return eeTccBlockLength_; }
unsigned int getSRPBlockLength() { return srpBlockLength_; }
unsigned int getDCCId(unsigned int aSMId) const;
unsigned int getSMId(unsigned int aDCCId) const;
unsigned int getNumChannelsInDcc(unsigned int aDCCId) { return numChannelsInDcc_[aDCCId - 1]; }
const EcalElectronicsMapping* mapping() { return mappingBuilder_; }
bool isTCCExternal(unsigned int TCCId);
/**
* Print current map
*/
friend std::ostream& operator<<(std::ostream& o, const EcalElectronicsMapper& aEcalElectronicsMapper);
// Mantain this here as long as everything is moved to a general mapping
enum SMGeom_t {
kModules = 4, // Number of modules per supermodule
kTriggerTowers = 68, // Number of trigger towers per supermodule
kTowersInPhi = 4, // Number of trigger towers in phi
kTowersInEta = 17, // Number of trigger towers in eta
kCrystals = 1700, // Number of crystals per supermodule
kPns = 10, // Number of PN laser monitoring diodes per supermodule
kCrystalsInPhi = 20, // Number of crystals in phi
kCrystalsInEta = 85, // Number of crystals in eta
kCrystalsPerTower = 25, // Number of crystals per trigger tower
kCardsPerTower = 5, // Number of VFE cards per trigger tower
kChannelsPerCard = 5, // Number of channels per VFE card
TTMAPMASK = 100
};
private:
void fillMaps();
unsigned int computeUnfilteredFEBlockLength();
unsigned int computeEBTCCBlockLength();
unsigned int computeEETCCBlockLength();
std::string pathToMapFile_;
unsigned int numbXtalTSamples_;
unsigned int numbTriggerTSamples_;
std::map<unsigned int, unsigned int> myDCCMap_;
std::map<unsigned int, std::vector<unsigned int>*> mapSmIdToTccIds_;
unsigned int dccId_;
unsigned int smId_;
unsigned int unfilteredFEBlockLength_;
unsigned int srpBlockLength_;
unsigned int ebTccBlockLength_, eeTccBlockLength_;
static const unsigned int numChannelsInDcc_[NUMB_SM];
// ARRAYS OF DetId
DetId* xtalDetIds_[NUMB_SM][NUMB_FE][NUMB_STRIP][NUMB_XTAL];
EcalScDetId* scDetIds_[NUMB_SM][NUMB_FE];
EcalElectronicsId* scEleIds_[NUMB_SM][NUMB_FE];
EcalTrigTowerDetId* ttDetIds_[NUMB_TCC][NUMB_FE];
EcalElectronicsId* ttEleIds_[NUMB_TCC][NUMB_FE];
EcalTriggerPrimitiveDigi* ttTPIds_[NUMB_TCC][NUMB_FE];
std::vector<EcalSrFlag*> srFlags_[NUMB_SM][NUMB_FE];
EcalPseudoStripInputDigi* psInput_[NUMB_TCC][TCC_EB_NUMBTTS][NUMB_STRIP];
short tTandPs_[NUMB_TCC][5 * EcalTrigTowerDetId::kEBTowersPerSM][2];
const EcalElectronicsMapping* mappingBuilder_;
// functions and fields to work with 'ghost' VFEs:
public:
// check, does the given [FED (dcc), CCU (tower), VFE (strip)] belongs
// to the list of VFEs with 'ghost' channels
bool isGhost(const int FED, const int CCU, const int VFE);
private:
void setupGhostMap();
std::map<int, std::map<int, std::map<int, bool> > > ghost_;
};
#endif
|