CMS 3D CMS Logo

DCCDataUnpacker.h
Go to the documentation of this file.
1 #ifndef DCCDATAUNPACKER_HH
2 #define DCCDATAUNPACKER_HH
3 
4 /*
5  *\ Class DCCDataUnpacker
6  *
7  * This class takes care of unpacking ECAL's raw data info.
8  * A gateway for all blocks unpackers and committing collections to the Event
9  * DCCEBEventBlock and DCCEEEventBlock are used here
10  *
11  * \file DCCDataUnpacker.h
12  *
13  * \author N. Almeida
14  * \author G. Franzoni
15  *
16 */
17 //C++
18 #include <fstream>
19 #include <iostream>
20 #include <string>
21 #include <vector>
22 #include <map>
23 #include <cstdio>
24 #include <cstdint>
25 #include <atomic>
26 
27 //DATA DECODER
28 
29 #include "DCCEventBlock.h"
30 
33 
36 
40 
42 
44 class DCCEventBlock;
45 class DCCEBEventBlock;
46 class DCCEEEventBlock;
47 class EcalRawToDigi;
48 
50 public:
52  bool hU,
53  bool srpU,
54  bool tccU,
55  bool feU,
56  bool memU,
57  bool syncCheck,
58  bool feIdCheck,
59  bool forceToKeepFRdata);
64  void unpack(const uint64_t* buffer, size_t bufferSize, unsigned int smId, unsigned int fedId);
65 
70  void setEBDigisCollection(std::unique_ptr<EBDigiCollection>* x) { ebDigis_ = x; }
71 
72  void setEEDigisCollection(std::unique_ptr<EEDigiCollection>* x) { eeDigis_ = x; }
73 
74  void setDccHeadersCollection(std::unique_ptr<EcalRawDataCollection>* x) { dccHeaders_ = x; }
75 
76  void setEBSrFlagsCollection(std::unique_ptr<EBSrFlagCollection>* x) { ebSrFlags_ = x; }
77 
78  void setEESrFlagsCollection(std::unique_ptr<EESrFlagCollection>* x) { eeSrFlags_ = x; }
79 
80  void setEcalTpsCollection(std::unique_ptr<EcalTrigPrimDigiCollection>* x) { ecalTps_ = x; }
81 
82  void setEcalPSsCollection(std::unique_ptr<EcalPSInputDigiCollection>* x) { ecalPSs_ = x; }
83 
84  void setInvalidGainsCollection(std::unique_ptr<EBDetIdCollection>* x) { invalidGains_ = x; }
85 
86  void setInvalidGainsSwitchCollection(std::unique_ptr<EBDetIdCollection>* x) { invalidGainsSwitch_ = x; }
87 
88  void setInvalidChIdsCollection(std::unique_ptr<EBDetIdCollection>* x) { invalidChIds_ = x; }
89 
90  // EE
91  void setInvalidEEGainsCollection(std::unique_ptr<EEDetIdCollection>* x) { invalidEEGains_ = x; }
92 
93  void setInvalidEEGainsSwitchCollection(std::unique_ptr<EEDetIdCollection>* x) { invalidEEGainsSwitch_ = x; }
94 
95  void setInvalidEEChIdsCollection(std::unique_ptr<EEDetIdCollection>* x) { invalidEEChIds_ = x; }
96  // EE
97 
98  void setInvalidTTIdsCollection(std::unique_ptr<EcalElectronicsIdCollection>* x) { invalidTTIds_ = x; }
99 
100  void setInvalidZSXtalIdsCollection(std::unique_ptr<EcalElectronicsIdCollection>* x) { invalidZSXtalIds_ = x; }
101 
102  void setInvalidBlockLengthsCollection(std::unique_ptr<EcalElectronicsIdCollection>* x) { invalidBlockLengths_ = x; }
103 
104  void setPnDiodeDigisCollection(std::unique_ptr<EcalPnDiodeDigiCollection>* x) { pnDiodeDigis_ = x; }
105 
106  void setInvalidMemTtIdsCollection(std::unique_ptr<EcalElectronicsIdCollection>* x) { invalidMemTtIds_ = x; }
107 
108  void setInvalidMemBlockSizesCollection(std::unique_ptr<EcalElectronicsIdCollection>* x) { invalidMemBlockSizes_ = x; }
109 
110  void setInvalidMemChIdsCollection(std::unique_ptr<EcalElectronicsIdCollection>* x) { invalidMemChIds_ = x; }
111 
112  void setInvalidMemGainsCollection(std::unique_ptr<EcalElectronicsIdCollection>* x) { invalidMemGains_ = x; }
113 
118  std::unique_ptr<EBDigiCollection>* ebDigisCollection() { return ebDigis_; }
119 
120  std::unique_ptr<EEDigiCollection>* eeDigisCollection() { return eeDigis_; }
121 
122  std::unique_ptr<EcalTrigPrimDigiCollection>* ecalTpsCollection() { return ecalTps_; }
123 
124  std::unique_ptr<EcalPSInputDigiCollection>* ecalPSsCollection() { return ecalPSs_; }
125 
126  std::unique_ptr<EBSrFlagCollection>* ebSrFlagsCollection() { return ebSrFlags_; }
127 
128  std::unique_ptr<EESrFlagCollection>* eeSrFlagsCollection() { return eeSrFlags_; }
129 
130  std::unique_ptr<EcalRawDataCollection>* dccHeadersCollection() { return dccHeaders_; }
131 
132  std::unique_ptr<EBDetIdCollection>* invalidGainsCollection() { return invalidGains_; }
133 
134  std::unique_ptr<EBDetIdCollection>* invalidGainsSwitchCollection() { return invalidGainsSwitch_; }
135 
136  std::unique_ptr<EBDetIdCollection>* invalidChIdsCollection() { return invalidChIds_; }
137 
138  //EE
139  std::unique_ptr<EEDetIdCollection>* invalidEEGainsCollection() { return invalidEEGains_; }
140 
141  std::unique_ptr<EEDetIdCollection>* invalidEEGainsSwitchCollection() { return invalidEEGainsSwitch_; }
142 
143  std::unique_ptr<EEDetIdCollection>* invalidEEChIdsCollection() { return invalidEEChIds_; }
144  //EE
145 
146  std::unique_ptr<EcalElectronicsIdCollection>* invalidTTIdsCollection() { return invalidTTIds_; }
147 
148  std::unique_ptr<EcalElectronicsIdCollection>* invalidZSXtalIdsCollection() { return invalidZSXtalIds_; }
149 
150  std::unique_ptr<EcalElectronicsIdCollection>* invalidBlockLengthsCollection() { return invalidBlockLengths_; }
151 
152  std::unique_ptr<EcalElectronicsIdCollection>* invalidMemTtIdsCollection() { return invalidMemTtIds_; }
153 
154  std::unique_ptr<EcalElectronicsIdCollection>* invalidMemBlockSizesCollection() { return invalidMemBlockSizes_; }
155 
156  std::unique_ptr<EcalElectronicsIdCollection>* invalidMemChIdsCollection() { return invalidMemChIds_; }
157 
158  std::unique_ptr<EcalElectronicsIdCollection>* invalidMemGainsCollection() { return invalidMemGains_; }
159 
160  std::unique_ptr<EcalPnDiodeDigiCollection>* pnDiodeDigisCollection() { return pnDiodeDigis_; }
161 
166 
170  void setChannelStatusDB(const EcalChannelStatusMap* chdb) { chdb_ = chdb; }
171  // return status of given crystal
172  // https://twiki.cern.ch/twiki/bin/view/CMS/EcalChannelStatus#Assigning_Channel_status
173  uint16_t getChannelStatus(const DetId& id) const;
174  // return low 5 bits of status word
175  uint16_t getChannelValue(const DetId& id) const;
176  uint16_t getChannelValue(const int fed, const int ccu, const int strip, const int xtal) const;
177  // return status of given CCU
178  uint16_t getCCUValue(const int fed, const int ccu) const;
179 
184 
185  static std::atomic<bool> silentMode_;
186 
187 protected:
188  // Data collections pointers
189  std::unique_ptr<EBDigiCollection>* ebDigis_;
190  std::unique_ptr<EEDigiCollection>* eeDigis_;
191  std::unique_ptr<EcalTrigPrimDigiCollection>* ecalTps_;
192  std::unique_ptr<EcalPSInputDigiCollection>* ecalPSs_;
193  std::unique_ptr<EcalRawDataCollection>* dccHeaders_;
194  std::unique_ptr<EBDetIdCollection>* invalidGains_;
195  std::unique_ptr<EBDetIdCollection>* invalidGainsSwitch_;
196  std::unique_ptr<EBDetIdCollection>* invalidChIds_;
197  //EE
198  std::unique_ptr<EEDetIdCollection>* invalidEEGains_;
199  std::unique_ptr<EEDetIdCollection>* invalidEEGainsSwitch_;
200  std::unique_ptr<EEDetIdCollection>* invalidEEChIds_;
201  //EE
202  std::unique_ptr<EBSrFlagCollection>* ebSrFlags_;
203  std::unique_ptr<EESrFlagCollection>* eeSrFlags_;
204  std::unique_ptr<EcalElectronicsIdCollection>* invalidTTIds_;
205  std::unique_ptr<EcalElectronicsIdCollection>* invalidZSXtalIds_;
206  std::unique_ptr<EcalElectronicsIdCollection>* invalidBlockLengths_;
207 
208  std::unique_ptr<EcalElectronicsIdCollection>* invalidMemTtIds_;
209  std::unique_ptr<EcalElectronicsIdCollection>* invalidMemBlockSizes_;
210  std::unique_ptr<EcalElectronicsIdCollection>* invalidMemChIds_;
211  std::unique_ptr<EcalElectronicsIdCollection>* invalidMemGains_;
212  std::unique_ptr<EcalPnDiodeDigiCollection>* pnDiodeDigis_;
213 
219 };
220 
221 #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< 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)
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()
std::unique_ptr< EEDetIdCollection > * invalidEEGainsSwitchCollection()
const EcalElectronicsMapper * electronicsMapper() const
uint16_t getCCUValue(const int fed, const int ccu) const
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)
uint16_t getChannelValue(const DetId &id) const
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_
std::unique_ptr< EBDetIdCollection > * invalidGainsSwitchCollection()
std::unique_ptr< EcalPnDiodeDigiCollection > * pnDiodeDigisCollection()
std::unique_ptr< EBDetIdCollection > * invalidChIds_
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:17
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 > * invalidBlockLengthsCollection()
std::unique_ptr< EcalElectronicsIdCollection > * invalidMemChIdsCollection()
unsigned long long uint64_t
Definition: Time.h:13
std::unique_ptr< EcalElectronicsIdCollection > * invalidMemGains_
std::unique_ptr< EcalTrigPrimDigiCollection > * ecalTps_
uint16_t getChannelStatus(const DetId &id) const
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()