test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 <stdio.h>
25 #include <stdint.h>
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::auto_ptr<EBDigiCollection> * x )
67  { ebDigis_ = x; }
68 
69  void setEEDigisCollection( std::auto_ptr<EEDigiCollection> * x )
70  { eeDigis_ = x; }
71 
72  void setDccHeadersCollection( std::auto_ptr<EcalRawDataCollection> * x )
73  { dccHeaders_ = x; }
74 
75  void setEBSrFlagsCollection( std::auto_ptr<EBSrFlagCollection> * x )
76  { ebSrFlags_ = x; }
77 
78  void setEESrFlagsCollection( std::auto_ptr<EESrFlagCollection> * x )
79  { eeSrFlags_ = x; }
80 
81  void setEcalTpsCollection( std::auto_ptr<EcalTrigPrimDigiCollection> * x )
82  { ecalTps_ = x; }
83 
84  void setEcalPSsCollection( std::auto_ptr<EcalPSInputDigiCollection> * x )
85  { ecalPSs_ = x; }
86 
87  void setInvalidGainsCollection( std::auto_ptr<EBDetIdCollection> * x )
88  { invalidGains_ = x; }
89 
90  void setInvalidGainsSwitchCollection( std::auto_ptr<EBDetIdCollection> * x )
91  { invalidGainsSwitch_ = x; }
92 
93  void setInvalidChIdsCollection( std::auto_ptr<EBDetIdCollection> * x )
94  { invalidChIds_ = x; }
95 
96  // EE
97  void setInvalidEEGainsCollection( std::auto_ptr<EEDetIdCollection> * x )
98  { invalidEEGains_ = x; }
99 
100  void setInvalidEEGainsSwitchCollection( std::auto_ptr<EEDetIdCollection> * x )
101  { invalidEEGainsSwitch_ = x; }
102 
103  void setInvalidEEChIdsCollection( std::auto_ptr<EEDetIdCollection> * x )
104  { invalidEEChIds_ = x; }
105  // EE
106 
107  void setInvalidTTIdsCollection( std::auto_ptr<EcalElectronicsIdCollection> * x )
108  { invalidTTIds_ = x; }
109 
110  void setInvalidZSXtalIdsCollection( std::auto_ptr<EcalElectronicsIdCollection> * x )
111  { invalidZSXtalIds_ = x; }
112 
113  void setInvalidBlockLengthsCollection( std::auto_ptr<EcalElectronicsIdCollection> * x )
114  { invalidBlockLengths_ = x; }
115 
116  void setPnDiodeDigisCollection( std::auto_ptr<EcalPnDiodeDigiCollection> * x )
117  { pnDiodeDigis_ = x; }
118 
119  void setInvalidMemTtIdsCollection( std::auto_ptr<EcalElectronicsIdCollection> * x )
120  { invalidMemTtIds_ = x; }
121 
122  void setInvalidMemBlockSizesCollection( std::auto_ptr<EcalElectronicsIdCollection> * x )
123  { invalidMemBlockSizes_ = x; }
124 
125  void setInvalidMemChIdsCollection( std::auto_ptr<EcalElectronicsIdCollection> * x )
126  { invalidMemChIds_ = x; }
127 
128  void setInvalidMemGainsCollection( std::auto_ptr<EcalElectronicsIdCollection> * x )
129  { invalidMemGains_ = x; }
130 
131 
136  std::auto_ptr<EBDigiCollection> * ebDigisCollection()
137  { return ebDigis_; }
138 
139  std::auto_ptr<EEDigiCollection> * eeDigisCollection()
140  { return eeDigis_; }
141 
142  std::auto_ptr<EcalTrigPrimDigiCollection> * ecalTpsCollection()
143  { return ecalTps_; }
144 
145  std::auto_ptr<EcalPSInputDigiCollection> * ecalPSsCollection()
146  { return ecalPSs_; }
147 
148  std::auto_ptr<EBSrFlagCollection> * ebSrFlagsCollection()
149  { return ebSrFlags_; }
150 
151  std::auto_ptr<EESrFlagCollection> * eeSrFlagsCollection()
152  { return eeSrFlags_; }
153 
154  std::auto_ptr<EcalRawDataCollection> * dccHeadersCollection()
155  { return dccHeaders_; }
156 
157  std::auto_ptr<EBDetIdCollection> * invalidGainsCollection()
158  { return invalidGains_; }
159 
160  std::auto_ptr<EBDetIdCollection> * invalidGainsSwitchCollection()
161  { return invalidGainsSwitch_; }
162 
163  std::auto_ptr<EBDetIdCollection> * invalidChIdsCollection()
164  { return invalidChIds_; }
165 
166  //EE
167  std::auto_ptr<EEDetIdCollection> * invalidEEGainsCollection()
168  { return invalidEEGains_; }
169 
170  std::auto_ptr<EEDetIdCollection> * invalidEEGainsSwitchCollection()
171  { return invalidEEGainsSwitch_; }
172 
173  std::auto_ptr<EEDetIdCollection> * invalidEEChIdsCollection()
174  { return invalidEEChIds_; }
175  //EE
176 
177  std::auto_ptr<EcalElectronicsIdCollection> * invalidTTIdsCollection()
178  { return invalidTTIds_; }
179 
180  std::auto_ptr<EcalElectronicsIdCollection> * invalidZSXtalIdsCollection()
181  { return invalidZSXtalIds_; }
182 
183  std::auto_ptr< EcalElectronicsIdCollection> * invalidBlockLengthsCollection()
184  { return invalidBlockLengths_; }
185 
186  std::auto_ptr<EcalElectronicsIdCollection> * invalidMemTtIdsCollection()
187  { return invalidMemTtIds_; }
188 
189  std::auto_ptr<EcalElectronicsIdCollection> * invalidMemBlockSizesCollection()
190  { return invalidMemBlockSizes_; }
191 
192  std::auto_ptr<EcalElectronicsIdCollection> * invalidMemChIdsCollection()
193  { return invalidMemChIds_; }
194 
195  std::auto_ptr<EcalElectronicsIdCollection> * invalidMemGainsCollection()
196  { return invalidMemGains_; }
197 
198  std::auto_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::auto_ptr<EBDigiCollection> * ebDigis_;
233  std::auto_ptr<EEDigiCollection> * eeDigis_;
234  std::auto_ptr<EcalTrigPrimDigiCollection> * ecalTps_;
235  std::auto_ptr<EcalPSInputDigiCollection> * ecalPSs_;
236  std::auto_ptr<EcalRawDataCollection> * dccHeaders_;
237  std::auto_ptr<EBDetIdCollection> * invalidGains_;
238  std::auto_ptr<EBDetIdCollection> * invalidGainsSwitch_;
239  std::auto_ptr<EBDetIdCollection> * invalidChIds_;
240  //EE
241  std::auto_ptr<EEDetIdCollection> * invalidEEGains_;
242  std::auto_ptr<EEDetIdCollection> * invalidEEGainsSwitch_;
243  std::auto_ptr<EEDetIdCollection> * invalidEEChIds_;
244  //EE
245  std::auto_ptr<EBSrFlagCollection> * ebSrFlags_;
246  std::auto_ptr<EESrFlagCollection> * eeSrFlags_;
247  std::auto_ptr<EcalElectronicsIdCollection> * invalidTTIds_;
248  std::auto_ptr<EcalElectronicsIdCollection> * invalidZSXtalIds_;
249  std::auto_ptr<EcalElectronicsIdCollection> * invalidBlockLengths_;
250 
251  std::auto_ptr<EcalElectronicsIdCollection> * invalidMemTtIds_ ;
252  std::auto_ptr<EcalElectronicsIdCollection> * invalidMemBlockSizes_ ;
253  std::auto_ptr<EcalElectronicsIdCollection> * invalidMemChIds_ ;
254  std::auto_ptr<EcalElectronicsIdCollection> * invalidMemGains_ ;
255  std::auto_ptr<EcalPnDiodeDigiCollection> * pnDiodeDigis_;
256 
262 
263 };
264 
265 #endif
void setChannelStatusDB(const EcalChannelStatusMap *chdb)
std::auto_ptr< EEDigiCollection > * eeDigis_
std::auto_ptr< EBDetIdCollection > * invalidGainsSwitchCollection()
void setPnDiodeDigisCollection(std::auto_ptr< EcalPnDiodeDigiCollection > *x)
std::auto_ptr< EBSrFlagCollection > * ebSrFlagsCollection()
DCCEventBlock * currentEvent_
std::auto_ptr< EBDetIdCollection > * invalidGainsSwitch_
std::auto_ptr< EcalElectronicsIdCollection > * invalidTTIdsCollection()
std::auto_ptr< EcalElectronicsIdCollection > * invalidMemBlockSizesCollection()
std::auto_ptr< EcalElectronicsIdCollection > * invalidMemChIdsCollection()
void unpack(const uint64_t *buffer, size_t bufferSize, unsigned int smId, unsigned int fedId)
std::auto_ptr< EBSrFlagCollection > * ebSrFlags_
void setInvalidZSXtalIdsCollection(std::auto_ptr< EcalElectronicsIdCollection > *x)
std::auto_ptr< EcalElectronicsIdCollection > * invalidMemGains_
void setInvalidMemBlockSizesCollection(std::auto_ptr< EcalElectronicsIdCollection > *x)
DCCEBEventBlock * ebEventBlock_
std::auto_ptr< EcalElectronicsIdCollection > * invalidMemChIds_
std::auto_ptr< EEDetIdCollection > * invalidEEChIdsCollection()
std::auto_ptr< EcalElectronicsIdCollection > * invalidTTIds_
void setDccHeadersCollection(std::auto_ptr< EcalRawDataCollection > *x)
void setEcalPSsCollection(std::auto_ptr< EcalPSInputDigiCollection > *x)
uint16_t getChannelStatus(const DetId &id) const
std::auto_ptr< EEDetIdCollection > * invalidEEChIds_
std::auto_ptr< EcalPSInputDigiCollection > * ecalPSsCollection()
std::auto_ptr< EBDetIdCollection > * invalidChIdsCollection()
void setInvalidEEGainsSwitchCollection(std::auto_ptr< EEDetIdCollection > *x)
EcalElectronicsMapper * electronicsMapper_
void setEEDigisCollection(std::auto_ptr< EEDigiCollection > *x)
std::auto_ptr< EESrFlagCollection > * eeSrFlags_
std::auto_ptr< EcalTrigPrimDigiCollection > * ecalTps_
std::auto_ptr< EEDetIdCollection > * invalidEEGainsCollection()
const EcalElectronicsMapper * electronicsMapper() const
void setInvalidMemTtIdsCollection(std::auto_ptr< EcalElectronicsIdCollection > *x)
std::auto_ptr< EBDetIdCollection > * invalidGainsCollection()
std::auto_ptr< EBDetIdCollection > * invalidChIds_
std::auto_ptr< EcalElectronicsIdCollection > * invalidMemBlockSizes_
DCCDataUnpacker(EcalElectronicsMapper *, bool hU, bool srpU, bool tccU, bool feU, bool memU, bool syncCheck, bool feIdCheck, bool forceToKeepFRdata)
std::auto_ptr< EBDigiCollection > * ebDigis_
void setEBSrFlagsCollection(std::auto_ptr< EBSrFlagCollection > *x)
static std::atomic< bool > silentMode_
void setEBDigisCollection(std::auto_ptr< EBDigiCollection > *x)
const EcalChannelStatusMap * chdb_
uint16_t getChannelValue(const DetId &id) const
std::auto_ptr< EcalRawDataCollection > * dccHeadersCollection()
uint16_t getCCUValue(const int fed, const int ccu) const
std::auto_ptr< EcalElectronicsIdCollection > * invalidMemTtIdsCollection()
void setInvalidMemGainsCollection(std::auto_ptr< EcalElectronicsIdCollection > *x)
DCCEEEventBlock * eeEventBlock_
void setInvalidGainsCollection(std::auto_ptr< EBDetIdCollection > *x)
std::auto_ptr< EcalRawDataCollection > * dccHeaders_
void setInvalidEEChIdsCollection(std::auto_ptr< EEDetIdCollection > *x)
std::auto_ptr< EcalElectronicsIdCollection > * invalidZSXtalIdsCollection()
std::auto_ptr< EcalElectronicsIdCollection > * invalidZSXtalIds_
std::auto_ptr< EcalElectronicsIdCollection > * invalidBlockLengths_
std::auto_ptr< EcalElectronicsIdCollection > * invalidMemGainsCollection()
void setInvalidTTIdsCollection(std::auto_ptr< EcalElectronicsIdCollection > *x)
Definition: DetId.h:18
void setInvalidGainsSwitchCollection(std::auto_ptr< EBDetIdCollection > *x)
std::auto_ptr< EBDetIdCollection > * invalidGains_
unsigned long long uint64_t
Definition: Time.h:15
void setEESrFlagsCollection(std::auto_ptr< EESrFlagCollection > *x)
std::auto_ptr< EcalElectronicsIdCollection > * invalidMemTtIds_
DCCEventBlock * currentEvent()
std::auto_ptr< EcalTrigPrimDigiCollection > * ecalTpsCollection()
std::auto_ptr< EEDetIdCollection > * invalidEEGains_
std::auto_ptr< EEDigiCollection > * eeDigisCollection()
void setEcalTpsCollection(std::auto_ptr< EcalTrigPrimDigiCollection > *x)
std::auto_ptr< EcalPSInputDigiCollection > * ecalPSs_
std::auto_ptr< EcalPnDiodeDigiCollection > * pnDiodeDigisCollection()
void setInvalidMemChIdsCollection(std::auto_ptr< EcalElectronicsIdCollection > *x)
void setInvalidBlockLengthsCollection(std::auto_ptr< EcalElectronicsIdCollection > *x)
std::auto_ptr< EcalPnDiodeDigiCollection > * pnDiodeDigis_
std::auto_ptr< EEDetIdCollection > * invalidEEGainsSwitch_
Definition: DDAxes.h:10
void setInvalidEEGainsCollection(std::auto_ptr< EEDetIdCollection > *x)
std::auto_ptr< EBDigiCollection > * ebDigisCollection()
std::auto_ptr< EESrFlagCollection > * eeSrFlagsCollection()
std::auto_ptr< EcalElectronicsIdCollection > * invalidBlockLengthsCollection()
std::auto_ptr< EEDetIdCollection > * invalidEEGainsSwitchCollection()
void setInvalidChIdsCollection(std::auto_ptr< EBDetIdCollection > *x)