File indexing completed on 2024-04-06 12:07:19
0001 #ifndef SelectiveReadoutTask_H
0002 #define SelectiveReadoutTask_H
0003
0004 #include "DQWorkerTask.h"
0005
0006 #include "CondFormats/EcalObjects/interface/EcalChannelStatus.h"
0007
0008 #include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h"
0009 #include "DataFormats/EcalRawData/interface/EcalRawDataCollections.h"
0010 #include "DataFormats/EcalDigi/interface/EcalDigiCollections.h"
0011 #include "DataFormats/EcalDetId/interface/EcalTrigTowerDetId.h"
0012 #include "DataFormats/EcalDetId/interface/EcalScDetId.h"
0013 #include "CondFormats/EcalObjects/interface/EcalSRSettings.h"
0014 #include "CondFormats/DataRecord/interface/EcalSRSettingsRcd.h"
0015
0016 class EcalTrigTowerConstituentsMap;
0017
0018 namespace ecaldqm {
0019
0020 class SelectiveReadoutTask : public DQWorkerTask {
0021 public:
0022 SelectiveReadoutTask();
0023 ~SelectiveReadoutTask() override {}
0024
0025 void addDependencies(DependencySet&) override;
0026
0027 void beginRun(edm::Run const&, edm::EventSetup const&) override;
0028 void beginEvent(edm::Event const&, edm::EventSetup const&, bool const&, bool&) override;
0029
0030 bool analyze(void const*, Collections) override;
0031
0032 void runOnSource(FEDRawDataCollection const&);
0033 void runOnRawData(EcalRawDataCollection const&);
0034 template <typename SRFlagCollection>
0035 void runOnSrFlags(SRFlagCollection const&, Collections);
0036 template <typename DigiCollection>
0037 void runOnDigis(DigiCollection const&, Collections);
0038 void setTokens(edm::ConsumesCollector&) override;
0039
0040 enum Constants {
0041 nFIRTaps = 6,
0042 bytesPerCrystal = 24,
0043 nRU = EcalTrigTowerDetId::kEBTotalTowers + EcalScDetId::kSizeForDenseIndexing
0044 };
0045
0046 private:
0047 void setParams(edm::ParameterSet const&) override;
0048
0049 void setFIRWeights_(std::vector<double> const&);
0050
0051 bool useCondDb_;
0052 int iFirstSample_;
0053 std::vector<int> ZSFIRWeights_;
0054
0055 std::set<std::pair<int, int> > suppressed_;
0056 std::vector<short> flags_;
0057 edm::ESGetToken<EcalSRSettings, EcalSRSettingsRcd> hSr;
0058 };
0059
0060 inline bool SelectiveReadoutTask::analyze(void const* _p, Collections _collection) {
0061 switch (_collection) {
0062 case kSource:
0063 if (_p)
0064 runOnSource(*static_cast<FEDRawDataCollection const*>(_p));
0065 return true;
0066 break;
0067 case kEcalRawData:
0068 if (_p)
0069 runOnRawData(*static_cast<EcalRawDataCollection const*>(_p));
0070 return true;
0071 break;
0072 case kEBSrFlag:
0073 if (_p)
0074 runOnSrFlags(*static_cast<EBSrFlagCollection const*>(_p), _collection);
0075 return true;
0076 break;
0077 case kEESrFlag:
0078 if (_p)
0079 runOnSrFlags(*static_cast<EESrFlagCollection const*>(_p), _collection);
0080 return true;
0081 break;
0082 case kEBDigi:
0083 if (_p)
0084 runOnDigis(*static_cast<EBDigiCollection const*>(_p), _collection);
0085 return true;
0086 break;
0087 case kEEDigi:
0088 if (_p)
0089 runOnDigis(*static_cast<EEDigiCollection const*>(_p), _collection);
0090 return true;
0091 break;
0092 default:
0093 break;
0094 }
0095 return false;
0096 }
0097
0098 }
0099
0100 #endif