File indexing completed on 2024-04-06 12:08:48
0001 #ifndef DQM_SiStripMonitorHardware_SiStripFEDEmulator_H
0002 #define DQM_SiStripMonitorHardware_SiStripFEDEmulator_H
0003
0004
0005
0006
0007 #include <sstream>
0008 #include <fstream>
0009 #include <iostream>
0010
0011 #include "FWCore/Framework/interface/ESHandle.h"
0012
0013 #include "DataFormats/Common/interface/DetSetVector.h"
0014 #include "DataFormats/FEDRawData/interface/FEDNumbering.h"
0015 #include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h"
0016 #include "DataFormats/FEDRawData/interface/FEDRawData.h"
0017 #include "DataFormats/SiStripDigi/interface/SiStripRawDigi.h"
0018 #include "DataFormats/SiStripDigi/interface/SiStripProcessedRawDigi.h"
0019 #include "DataFormats/SiStripDigi/interface/SiStripDigi.h"
0020
0021 #include "DataFormats/Common/interface/Wrapper.h"
0022
0023 #include "CondFormats/SiStripObjects/interface/SiStripFedCabling.h"
0024 #include "CondFormats/SiStripObjects/interface/SiStripPedestals.h"
0025 #include "CondFormats/SiStripObjects/interface/SiStripNoises.h"
0026
0027 #include "EventFilter/SiStripRawToDigi/interface/SiStripFEDBuffer.h"
0028
0029
0030 #include "RecoLocalTracker/SiStripZeroSuppression/interface/SiStripRawProcessingFactory.h"
0031 #include "RecoLocalTracker/SiStripZeroSuppression/interface/SiStripRawProcessingAlgorithms.h"
0032
0033 namespace sistrip {
0034
0035 class FEDEmulator {
0036 public:
0037 FEDEmulator();
0038 ~FEDEmulator();
0039
0040 void initialise(const bool byModule);
0041
0042 void initialiseModule(const uint32_t aDetId, const uint32_t aNPairs, const uint32_t aPair);
0043
0044 void retrievePedestals(const edm::ESHandle<SiStripPedestals>& aHandle);
0045 void retrieveNoises(const edm::ESHandle<SiStripNoises>& aHandle);
0046
0047 void subtractPedestals(const edm::DetSetVector<SiStripRawDigi>::const_iterator& inputChannel,
0048 std::vector<SiStripRawDigi>& pedsDetSetData,
0049 std::vector<SiStripProcessedRawDigi>& noiseDetSetData,
0050 std::vector<SiStripRawDigi>& pedSubtrDetSetData,
0051 std::vector<uint32_t>& medsDetSetData,
0052 const bool fillApvsForCM);
0053
0054 void subtractCM(const std::vector<SiStripRawDigi>& pedSubtrDetSetData,
0055 std::vector<SiStripRawDigi>& cmSubtrDetSetData);
0056
0057 void zeroSuppress(const std::vector<SiStripRawDigi>& cmSubtrDetSetData,
0058 edm::DetSet<SiStripDigi>& zsDetSetData,
0059 const std::unique_ptr<SiStripRawProcessingAlgorithms>& algorithms);
0060
0061 uint32_t fedIndex(const uint16_t aFedChannel);
0062
0063 void fillPeds(const edm::DetSetVector<SiStripRawDigi>::const_iterator& peds);
0064 void fillNoises(const edm::DetSetVector<SiStripProcessedRawDigi>::const_iterator& noise);
0065
0066 void fillMedians(const std::map<uint32_t, std::vector<uint32_t> >::const_iterator& meds);
0067
0068 void print(std::ostream& aOs);
0069 void printPeds(std::ostream& aOs);
0070 void printNoises(std::ostream& aOs);
0071 void printMeds(std::ostream& aOs);
0072
0073 private:
0074 static const char* const messageLabel_;
0075
0076 bool byModule_;
0077
0078 uint32_t detId_;
0079 uint32_t nPairs_;
0080 uint32_t pair_;
0081
0082 uint32_t minStrip_;
0083 uint32_t maxStrip_;
0084
0085 std::vector<int> pedestals_;
0086 std::vector<float> noises_;
0087 std::vector<uint32_t> medians_;
0088
0089 };
0090
0091 }
0092 #endif