Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:14:35

0001 #ifndef ApvAnalysisFactory_h
0002 #define ApvAnalysisFactory_h
0003 //#define DEBUG_INSTANCE_COUNTING
0004 
0005 #include "CalibTracker/SiStripAPVAnalysis/interface/ApvAnalysis.h"
0006 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0007 #include "CalibTracker/SiStripAPVAnalysis/interface/TkStateMachine.h"
0008 #include "CalibTracker/SiStripAPVAnalysis/interface/TkCommonMode.h"
0009 #include "CalibTracker/SiStripAPVAnalysis/interface/TT6ApvMask.h"
0010 #include "CalibTracker/SiStripAPVAnalysis/interface/TT6NoiseCalculator.h"
0011 #include "CalibTracker/SiStripAPVAnalysis/interface/TT6PedestalCalculator.h"
0012 #include "CalibTracker/SiStripAPVAnalysis/interface/TT6CommonModeCalculator.h"
0013 #include "CalibTracker/SiStripAPVAnalysis/interface/MedianCommonModeCalculator.h"
0014 #include "CalibTracker/SiStripAPVAnalysis/interface/SimplePedestalCalculator.h"
0015 #include "CalibTracker/SiStripAPVAnalysis/interface/SimpleNoiseCalculator.h"
0016 #include <vector>
0017 #include <iostream>
0018 #include <map>
0019 #include <algorithm>
0020 #include <string>
0021 
0022 class ApvAnalysisFactory {
0023 public:
0024   typedef std::vector<ApvAnalysis*> ApvAnalysisVector;
0025 
0026   ApvAnalysisFactory(std::string theAlgorithmType,
0027                      int theNumCMstripsInGroup,
0028                      int theMaskCalcFlag,
0029                      float theMaskNoiseCut,
0030                      float theMaskDeadCut,
0031                      float theMaskTruncCut,
0032                      float theCutToAvoidSignal,
0033                      int theEventInitNumber,
0034                      int theEventIterNumber);
0035   ApvAnalysisFactory(const edm::ParameterSet& pset);
0036   ~ApvAnalysisFactory();
0037 
0038   bool instantiateApvs(uint32_t det_id, int numberOfApvs);
0039 
0040   ApvAnalysisVector getApvAnalysis(const uint32_t nDET_ID);
0041 
0042   void getPedestal(uint32_t det_id, int apvNumber, ApvAnalysis::PedestalType& peds);
0043   void getPedestal(uint32_t det_id, ApvAnalysis::PedestalType& peds);
0044   float getStripPedestal(uint32_t det_id, int stripNumber);
0045 
0046   void getMask(uint32_t det_id, TkApvMask::MaskType& tmp);
0047   void getCommonMode(uint32_t det_id, ApvAnalysis::PedestalType& tmp);
0048   std::vector<float> getCommonMode(uint32_t det_id, int apvNumber);
0049 
0050   void getNoise(uint32_t det_id, int apvNumber, ApvAnalysis::PedestalType& noise);
0051   void getNoise(uint32_t det_id, ApvAnalysis::PedestalType& noise);
0052   float getStripNoise(uint32_t det_id, int stripNumber);
0053 
0054   void getRawNoise(uint32_t det_id, int apvNumber, ApvAnalysis::PedestalType& noise);
0055   void getRawNoise(uint32_t det_id, ApvAnalysis::PedestalType& noise);
0056   float getStripRawNoise(uint32_t det_id, int stripNumber);
0057 
0058   void getCommonModeSlope(uint32_t det_id, ApvAnalysis::PedestalType& tmp);
0059   float getCommonModeSlope(uint32_t det_id, int apvNumber);
0060 
0061   void update(uint32_t det_id, const edm::DetSet<SiStripRawDigi>& in);
0062   void updatePair(uint32_t det_id, size_t apvPair, const edm::DetSet<SiStripRawDigi>& in);
0063 
0064   std::string getStatus(uint32_t det_id);
0065 
0066   bool isUpdating(uint32_t detId);
0067 
0068   typedef std::map<uint32_t, ApvAnalysisVector> ApvAnalysisMap;
0069   typedef std::map<ApvAnalysis*, int> MapNumberingPosition;
0070   typedef std::map<ApvAnalysis*, uint32_t> InverseMap;
0071 
0072 private:
0073   //  void  constructAuxiliaryApvClasses (ApvAnalysis* thisApv);
0074   void constructAuxiliaryApvClasses(ApvAnalysis* theApv, uint32_t det_id, int thisApv);
0075   void deleteApv(ApvAnalysis* apv);
0076   ApvAnalysisMap apvMap_;
0077   std::string theAlgorithmType_;
0078   int theNumCMstripsInGroup_;
0079   int theMaskCalcFlag_;
0080   float theMaskNoiseCut_;
0081   float theMaskDeadCut_;
0082   float theMaskTruncCut_;
0083   float theCutToAvoidSignal_;
0084   int theEventInitNumber_;
0085   int theEventIterNumber_;
0086   std::string theCMType_;
0087   bool useDB_;
0088 };
0089 #endif