CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/DQM/SiStripMonitorHardware/interface/SiStripFEDEmulator.h

Go to the documentation of this file.
00001 #ifndef DQM_SiStripMonitorHardware_SiStripFEDEmulator_H
00002 #define DQM_SiStripMonitorHardware_SiStripFEDEmulator_H
00003 
00004 // Created 2010-01-20 by A.-M. Magnan
00005 // Class intended to mimic the data path in the FED firmware in software
00006 // steps: pedestal subtraction, CM subtraction, clustering and zero-suppression.
00007 #include <sstream>
00008 #include <fstream>
00009 #include <iostream>
00010 
00011 #include "FWCore/Framework/interface/ESHandle.h"
00012 
00013 #include "DataFormats/Common/interface/DetSetVector.h"
00014 #include "DataFormats/FEDRawData/interface/FEDNumbering.h"
00015 #include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h"
00016 #include "DataFormats/FEDRawData/interface/FEDRawData.h"
00017 #include "DataFormats/SiStripDigi/interface/SiStripRawDigi.h"
00018 #include "DataFormats/SiStripDigi/interface/SiStripProcessedRawDigi.h"
00019 #include "DataFormats/SiStripDigi/interface/SiStripDigi.h"
00020 
00021 #include "DataFormats/Common/interface/Wrapper.h"
00022 
00023 #include "CondFormats/SiStripObjects/interface/SiStripFedCabling.h"
00024 #include "CondFormats/SiStripObjects/interface/SiStripPedestals.h"
00025 #include "CondFormats/SiStripObjects/interface/SiStripNoises.h"
00026 
00027 #include "EventFilter/SiStripRawToDigi/interface/SiStripFEDBuffer.h"
00028 
00029 //for the zero suppression algorithm(s)
00030 #include "RecoLocalTracker/SiStripZeroSuppression/interface/SiStripRawProcessingFactory.h"
00031 #include "RecoLocalTracker/SiStripZeroSuppression/interface/SiStripRawProcessingAlgorithms.h"
00032 
00033 namespace sistrip {
00034 
00035   class FEDEmulator {
00036 
00037   public:
00038     FEDEmulator();
00039     ~FEDEmulator();
00040 
00041     void initialise(const bool byModule);
00042 
00043     void initialiseModule(const uint32_t aDetId,
00044                           const uint32_t aNPairs,
00045                           const uint32_t aPair);
00046 
00047     void retrievePedestals(const edm::ESHandle<SiStripPedestals> & aHandle);
00048     void retrieveNoises(const edm::ESHandle<SiStripNoises> & aHandle);
00049 
00050     void subtractPedestals(const edm::DetSetVector<SiStripRawDigi>::const_iterator & inputChannel,
00051                            std::vector<SiStripRawDigi> & pedsDetSetData,
00052                            std::vector<SiStripProcessedRawDigi> & noiseDetSetData,
00053                            std::vector<SiStripRawDigi> & pedSubtrDetSetData,
00054                            std::vector<uint32_t> & medsDetSetData,
00055                            const bool fillApvsForCM);
00056 
00057     void subtractCM(const std::vector<SiStripRawDigi> & pedSubtrDetSetData,
00058                     std::vector<SiStripRawDigi> & cmSubtrDetSetData);
00059 
00060     void zeroSuppress(const std::vector<SiStripRawDigi> & cmSubtrDetSetData,
00061                       edm::DetSet<SiStripDigi>    & zsDetSetData,
00062                       const std::auto_ptr<SiStripRawProcessingAlgorithms> & algorithms);
00063 
00064     uint32_t fedIndex(const uint16_t aFedChannel);
00065 
00066     void fillPeds(const edm::DetSetVector<SiStripRawDigi>::const_iterator & peds);
00067     void fillNoises(const edm::DetSetVector<SiStripProcessedRawDigi>::const_iterator & noise);
00068 
00069     void fillMedians(const std::map<uint32_t,std::vector<uint32_t> >::const_iterator & meds);
00070 
00071     void print(std::ostream & aOs);
00072     void printPeds(std::ostream & aOs);
00073     void printNoises(std::ostream & aOs);
00074     void printMeds(std::ostream & aOs);
00075 
00076   private:
00077 
00078     static const char* messageLabel_;
00079 
00080     bool byModule_;
00081 
00082     uint32_t detId_;
00083     uint32_t nPairs_;
00084     uint32_t pair_;
00085 
00086     uint32_t minStrip_;
00087     uint32_t maxStrip_;
00088 
00089     std::vector<int> pedestals_;
00090     std::vector<float> noises_;
00091     std::vector<uint32_t> medians_;
00092 
00093 
00094 
00095     
00096   };//class FEDEmulator
00097 
00098 }//namespace sistrip
00099 #endif//DQM_SiStripMonitorHardware_SiStripFEDEmulator_H