CMS 3D CMS Logo

DCCDataUnpacker.h
Go to the documentation of this file.
1 #ifndef DCCDATAUNPACKER_HH
2 #define DCCDATAUNPACKER_HH
3 
4 
5 /*
6  *\ Class DCCDataUnpacker
7  *
8  * This class takes care of unpacking ECAL's raw data info.
9  * A gateway for all blocks unpackers and committing collections to the Event
10  * DCCEBEventBlock and DCCEEEventBlock are used here
11  *
12  * \file DCCDataUnpacker.h
13  *
14  * \author N. Almeida
15  * \author G. Franzoni
16  *
17 */
18 //C++
19 #include <fstream>
20 #include <iostream>
21 #include <string>
22 #include <vector>
23 #include <map>
24 #include <cstdio>
25 #include <cstdint>
26 #include <atomic>
27 
28 //DATA DECODER
29 
30 #include "DCCEventBlock.h"
31 
34 
37 
41 
43 
45 class DCCEventBlock;
46 class DCCEBEventBlock;
47 class DCCEEEventBlock;
48 class EcalRawToDigi;
49 
51 
52 public :
53 
54  DCCDataUnpacker(EcalElectronicsMapper *, bool hU,bool srpU, bool tccU, bool feU, bool memU, bool syncCheck, bool feIdCheck, bool forceToKeepFRdata);
59  void unpack(const uint64_t* buffer, size_t bufferSize, unsigned int smId, unsigned int fedId);
60 
61 
66  void setEBDigisCollection( std::unique_ptr<EBDigiCollection> * x )
67  { ebDigis_ = x; }
68 
69  void setEEDigisCollection( std::unique_ptr<EEDigiCollection> * x )
70  { eeDigis_ = x; }
71 
72  void setDccHeadersCollection( std::unique_ptr<EcalRawDataCollection> * x )
73  { dccHeaders_ = x; }
74 
75  void setEBSrFlagsCollection( std::unique_ptr<EBSrFlagCollection> * x )
76  { ebSrFlags_ = x; }
77 
78  void setEESrFlagsCollection( std::unique_ptr<EESrFlagCollection> * x )
79  { eeSrFlags_ = x; }
80 
81  void setEcalTpsCollection( std::unique_ptr<EcalTrigPrimDigiCollection> * x )
82  { ecalTps_ = x; }
83 
84  void setEcalPSsCollection( std::unique_ptr<EcalPSInputDigiCollection> * x )
85  { ecalPSs_ = x; }
86 
87  void setInvalidGainsCollection( std::unique_ptr<EBDetIdCollection> * x )
88  { invalidGains_ = x; }
89 
90  void setInvalidGainsSwitchCollection( std::unique_ptr<EBDetIdCollection> * x )
91  { invalidGainsSwitch_ = x; }
92 
93  void setInvalidChIdsCollection( std::unique_ptr<EBDetIdCollection> * x )
94  { invalidChIds_ = x; }
95 
96  // EE
97  void setInvalidEEGainsCollection( std::unique_ptr<EEDetIdCollection> * x )
98  { invalidEEGains_ = x; }
99 
100  void setInvalidEEGainsSwitchCollection( std::unique_ptr<EEDetIdCollection> * x )
101  { invalidEEGainsSwitch_ = x; }
102 
103  void setInvalidEEChIdsCollection( std::unique_ptr<EEDetIdCollection> * x )
104  { invalidEEChIds_ = x; }
105  // EE
106 
107  void setInvalidTTIdsCollection( std::unique_ptr<EcalElectronicsIdCollection> * x )
108  { invalidTTIds_ = x; }
109 
110  void setInvalidZSXtalIdsCollection( std::unique_ptr<EcalElectronicsIdCollection> * x )
111  { invalidZSXtalIds_ = x; }
112 
113  void setInvalidBlockLengthsCollection( std::unique_ptr<EcalElectronicsIdCollection> * x )
114  { invalidBlockLengths_ = x; }
115 
116  void setPnDiodeDigisCollection( std::unique_ptr<EcalPnDiodeDigiCollection> * x )
117  { pnDiodeDigis_ = x; }
118 
119  void setInvalidMemTtIdsCollection( std::unique_ptr<EcalElectronicsIdCollection> * x )
120  { invalidMemTtIds_ = x; }
121 
122  void setInvalidMemBlockSizesCollection( std::unique_ptr<EcalElectronicsIdCollection> * x )
123  { invalidMemBlockSizes_ = x; }
124 
125  void setInvalidMemChIdsCollection( std::unique_ptr<EcalElectronicsIdCollection> * x )
126  { invalidMemChIds_ = x; }
127 
128  void setInvalidMemGainsCollection( std::unique_ptr<EcalElectronicsIdCollection> * x )
129  { invalidMemGains_ = x; }
130 
131 
136  std::unique_ptr<EBDigiCollection> * ebDigisCollection()
137  { return ebDigis_; }
138 
139  std::unique_ptr<EEDigiCollection> * eeDigisCollection()
140  { return eeDigis_; }
141 
142  std::unique_ptr<EcalTrigPrimDigiCollection> * ecalTpsCollection()
143  { return ecalTps_; }
144 
145  std::unique_ptr<EcalPSInputDigiCollection> * ecalPSsCollection()
146  { return ecalPSs_; }
147 
148  std::unique_ptr<EBSrFlagCollection> * ebSrFlagsCollection()
149  { return ebSrFlags_; }
150 
151  std::unique_ptr<EESrFlagCollection> * eeSrFlagsCollection()
152  { return eeSrFlags_; }
153 
154  std::unique_ptr<EcalRawDataCollection> * dccHeadersCollection()
155  { return dccHeaders_; }
156 
157  std::unique_ptr<EBDetIdCollection> * invalidGainsCollection()
158  { return invalidGains_; }
159 
160  std::unique_ptr<EBDetIdCollection> * invalidGainsSwitchCollection()
161  { return invalidGainsSwitch_; }
162 
163  std::unique_ptr<EBDetIdCollection> * invalidChIdsCollection()
164  { return invalidChIds_; }
165 
166  //EE
167  std::unique_ptr<EEDetIdCollection> * invalidEEGainsCollection()
168  { return invalidEEGains_; }
169 
170  std::unique_ptr<EEDetIdCollection> * invalidEEGainsSwitchCollection()
171  { return invalidEEGainsSwitch_; }
172 
173  std::unique_ptr<EEDetIdCollection> * invalidEEChIdsCollection()
174  { return invalidEEChIds_; }
175  //EE
176 
177  std::unique_ptr<EcalElectronicsIdCollection> * invalidTTIdsCollection()
178  { return invalidTTIds_; }
179 
180  std::unique_ptr<EcalElectronicsIdCollection> * invalidZSXtalIdsCollection()
181  { return invalidZSXtalIds_; }
182 
183  std::unique_ptr< EcalElectronicsIdCollection> * invalidBlockLengthsCollection()
184  { return invalidBlockLengths_; }
185 
186  std::unique_ptr<EcalElectronicsIdCollection> * invalidMemTtIdsCollection()
187  { return invalidMemTtIds_; }
188 
189  std::unique_ptr<EcalElectronicsIdCollection> * invalidMemBlockSizesCollection()
190  { return invalidMemBlockSizes_; }
191 
192  std::unique_ptr<EcalElectronicsIdCollection> * invalidMemChIdsCollection()
193  { return invalidMemChIds_; }
194 
195  std::unique_ptr<EcalElectronicsIdCollection> * invalidMemGainsCollection()
196  { return invalidMemGains_; }
197 
198  std::unique_ptr<EcalPnDiodeDigiCollection> * pnDiodeDigisCollection()
199  { return pnDiodeDigis_; }
200 
201 
206 
207 
211  void setChannelStatusDB(const EcalChannelStatusMap* chdb) { chdb_ = chdb; }
212  // return status of given crystal
213  // https://twiki.cern.ch/twiki/bin/view/CMS/EcalChannelStatus#Assigning_Channel_status
214  uint16_t getChannelStatus(const DetId& id) const;
215  // return low 5 bits of status word
216  uint16_t getChannelValue(const DetId& id) const;
217  uint16_t getChannelValue(const int fed, const int ccu, const int strip, const int xtal) const;
218  // return status of given CCU
219  uint16_t getCCUValue(const int fed, const int ccu) const;
220 
221 
226 
227  static std::atomic<bool> silentMode_;
228 
229 protected :
230 
231  // Data collections pointers
232  std::unique_ptr<EBDigiCollection> * ebDigis_;
233  std::unique_ptr<EEDigiCollection> * eeDigis_;
234  std::unique_ptr<EcalTrigPrimDigiCollection> * ecalTps_;
235  std::unique_ptr<EcalPSInputDigiCollection> * ecalPSs_;
236  std::unique_ptr<EcalRawDataCollection> * dccHeaders_;
237  std::unique_ptr<EBDetIdCollection> * invalidGains_;
238  std::unique_ptr<EBDetIdCollection> * invalidGainsSwitch_;
239  std::unique_ptr<EBDetIdCollection> * invalidChIds_;
240  //EE
241  std::unique_ptr<EEDetIdCollection> * invalidEEGains_;
242  std::unique_ptr<EEDetIdCollection> * invalidEEGainsSwitch_;
243  std::unique_ptr<EEDetIdCollection> * invalidEEChIds_;
244  //EE
245  std::unique_ptr<EBSrFlagCollection> * ebSrFlags_;
246  std::unique_ptr<EESrFlagCollection> * eeSrFlags_;
247  std::unique_ptr<EcalElectronicsIdCollection> * invalidTTIds_;
248  std::unique_ptr<EcalElectronicsIdCollection> * invalidZSXtalIds_;
249  std::unique_ptr<EcalElectronicsIdCollection> * invalidBlockLengths_;
250 
251  std::unique_ptr<EcalElectronicsIdCollection> * invalidMemTtIds_ ;
252  std::unique_ptr<EcalElectronicsIdCollection> * invalidMemBlockSizes_ ;
253  std::unique_ptr<EcalElectronicsIdCollection> * invalidMemChIds_ ;
254  std::unique_ptr<EcalElectronicsIdCollection> * invalidMemGains_ ;
255  std::unique_ptr<EcalPnDiodeDigiCollection> * pnDiodeDigis_;
256 
262 
263 };
264 
265 #endif
void setChannelStatusDB(const EcalChannelStatusMap *chdb)
std::unique_ptr< EBSrFlagCollection > * ebSrFlagsCollection()
void setInvalidEEChIdsCollection(std::unique_ptr< EEDetIdCollection > *x)
DCCEventBlock * currentEvent_
void setInvalidGainsCollection(std::unique_ptr< EBDetIdCollection > *x)
std::unique_ptr< EEDigiCollection > * eeDigis_
std::unique_ptr< EEDigiCollection > * eeDigisCollection()
std::unique_ptr< EEDetIdCollection > * invalidEEChIdsCollection()
std::unique_ptr< EcalElectronicsIdCollection > * invalidBlockLengthsCollection()
std::unique_ptr< EESrFlagCollection > * eeSrFlags_
void unpack(const uint64_t *buffer, size_t bufferSize, unsigned int smId, unsigned int fedId)
std::unique_ptr< EcalElectronicsIdCollection > * invalidMemBlockSizesCollection()
void setPnDiodeDigisCollection(std::unique_ptr< EcalPnDiodeDigiCollection > *x)
std::unique_ptr< EEDetIdCollection > * invalidEEChIds_
DCCEBEventBlock * ebEventBlock_
void setInvalidTTIdsCollection(std::unique_ptr< EcalElectronicsIdCollection > *x)
void setInvalidBlockLengthsCollection(std::unique_ptr< EcalElectronicsIdCollection > *x)
void setInvalidGainsSwitchCollection(std::unique_ptr< EBDetIdCollection > *x)
uint16_t getChannelStatus(const DetId &id) const
std::unique_ptr< EcalElectronicsIdCollection > * invalidMemBlockSizes_
void setInvalidZSXtalIdsCollection(std::unique_ptr< EcalElectronicsIdCollection > *x)
EcalElectronicsMapper * electronicsMapper_
std::unique_ptr< EcalPnDiodeDigiCollection > * pnDiodeDigis_
std::unique_ptr< EcalPSInputDigiCollection > * ecalPSsCollection()
std::unique_ptr< EBDetIdCollection > * invalidGainsCollection()
const EcalElectronicsMapper * electronicsMapper() const
std::unique_ptr< EEDetIdCollection > * invalidEEGainsSwitchCollection()
std::unique_ptr< EcalElectronicsIdCollection > * invalidZSXtalIds_
DCCDataUnpacker(EcalElectronicsMapper *, bool hU, bool srpU, bool tccU, bool feU, bool memU, bool syncCheck, bool feIdCheck, bool forceToKeepFRdata)
std::unique_ptr< EcalRawDataCollection > * dccHeaders_
void setInvalidMemChIdsCollection(std::unique_ptr< EcalElectronicsIdCollection > *x)
std::unique_ptr< EcalElectronicsIdCollection > * invalidTTIdsCollection()
void setEBSrFlagsCollection(std::unique_ptr< EBSrFlagCollection > *x)
void setInvalidMemBlockSizesCollection(std::unique_ptr< EcalElectronicsIdCollection > *x)
std::unique_ptr< EcalElectronicsIdCollection > * invalidMemGainsCollection()
void setEcalTpsCollection(std::unique_ptr< EcalTrigPrimDigiCollection > *x)
static std::atomic< bool > silentMode_
void setInvalidMemTtIdsCollection(std::unique_ptr< EcalElectronicsIdCollection > *x)
void setInvalidEEGainsSwitchCollection(std::unique_ptr< EEDetIdCollection > *x)
std::unique_ptr< EBSrFlagCollection > * ebSrFlags_
void setEEDigisCollection(std::unique_ptr< EEDigiCollection > *x)
const EcalChannelStatusMap * chdb_
uint16_t getChannelValue(const DetId &id) const
std::unique_ptr< EBDetIdCollection > * invalidGainsSwitchCollection()
std::unique_ptr< EcalPnDiodeDigiCollection > * pnDiodeDigisCollection()
std::unique_ptr< EBDetIdCollection > * invalidChIds_
uint16_t getCCUValue(const int fed, const int ccu) const
DCCEEEventBlock * eeEventBlock_
std::unique_ptr< EcalElectronicsIdCollection > * invalidBlockLengths_
std::unique_ptr< EEDetIdCollection > * invalidEEGainsCollection()
void setEcalPSsCollection(std::unique_ptr< EcalPSInputDigiCollection > *x)
std::unique_ptr< EBDetIdCollection > * invalidGainsSwitch_
std::unique_ptr< EBDetIdCollection > * invalidGains_
std::unique_ptr< EcalPSInputDigiCollection > * ecalPSs_
Definition: DetId.h:18
void setEESrFlagsCollection(std::unique_ptr< EESrFlagCollection > *x)
void setInvalidEEGainsCollection(std::unique_ptr< EEDetIdCollection > *x)
std::unique_ptr< EcalElectronicsIdCollection > * invalidMemTtIdsCollection()
std::unique_ptr< EBDetIdCollection > * invalidChIdsCollection()
std::unique_ptr< EcalElectronicsIdCollection > * invalidMemChIdsCollection()
unsigned long long uint64_t
Definition: Time.h:15
std::unique_ptr< EcalElectronicsIdCollection > * invalidMemGains_
std::unique_ptr< EcalTrigPrimDigiCollection > * ecalTps_
std::unique_ptr< EcalRawDataCollection > * dccHeadersCollection()
std::unique_ptr< EcalElectronicsIdCollection > * invalidZSXtalIdsCollection()
std::unique_ptr< EcalElectronicsIdCollection > * invalidTTIds_
DCCEventBlock * currentEvent()
void setDccHeadersCollection(std::unique_ptr< EcalRawDataCollection > *x)
std::unique_ptr< EcalElectronicsIdCollection > * invalidMemTtIds_
std::unique_ptr< EEDetIdCollection > * invalidEEGainsSwitch_
std::unique_ptr< EcalElectronicsIdCollection > * invalidMemChIds_
void setInvalidChIdsCollection(std::unique_ptr< EBDetIdCollection > *x)
std::unique_ptr< EBDigiCollection > * ebDigis_
std::unique_ptr< EEDetIdCollection > * invalidEEGains_
void setInvalidMemGainsCollection(std::unique_ptr< EcalElectronicsIdCollection > *x)
std::unique_ptr< EcalTrigPrimDigiCollection > * ecalTpsCollection()
void setEBDigisCollection(std::unique_ptr< EBDigiCollection > *x)
std::unique_ptr< EESrFlagCollection > * eeSrFlagsCollection()
std::unique_ptr< EBDigiCollection > * ebDigisCollection()