Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-09-27 04:04:15

0001 #ifndef SiStripNoiseNormalizedWithApvGainBuilder_H
0002 #define SiStripNoiseNormalizedWithApvGainBuilder_H
0003 
0004 #include "FWCore/ServiceRegistry/interface/Service.h"
0005 #include "CondCore/DBOutputService/interface/PoolDBOutputService.h"
0006 #include "FWCore/Framework/interface/MakerMacros.h"
0007 #include "FWCore/Framework/interface/Frameworkfwd.h"
0008 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0009 #include "FWCore/Utilities/interface/Exception.h"
0010 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0011 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0012 #include "CommonTools/ConditionDBWriter/interface/ConditionDBWriter.h"
0013 #include "FWCore/ParameterSet/interface/FileInPath.h"
0014 #include "Geometry/Records/interface/TrackerTopologyRcd.h"
0015 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
0016 
0017 #include "CondFormats/SiStripObjects/interface/SiStripApvGain.h"
0018 #include "CondFormats/SiStripObjects/interface/SiStripNoises.h"
0019 #include "CondFormats/DataRecord/interface/SiStripCondDataRecords.h"
0020 
0021 #include "CLHEP/Random/RandFlat.h"
0022 #include "CLHEP/Random/RandGauss.h"
0023 
0024 class TrackerTopology;
0025 class TrackerGeometry;
0026 /**
0027  * Produces a noise tag using the same settings as the service used in the DummyDBWriter, but
0028  * it receives a SiStripApvGain tag from the EventSetup and uses the gain values (per apv) to
0029  * rescale the noise (per strip).
0030  */
0031 
0032 class SiStripNoiseNormalizedWithApvGainBuilder : public edm::one::EDAnalyzer<> {
0033 public:
0034   explicit SiStripNoiseNormalizedWithApvGainBuilder(const edm::ParameterSet& iConfig);
0035 
0036   ~SiStripNoiseNormalizedWithApvGainBuilder() override{};
0037 
0038   void analyze(const edm::Event&, const edm::EventSetup&) override;
0039 
0040 private:
0041   /// Fills the parameters read from cfg and matching the name in the given map
0042   void fillParameters(std::map<int, std::vector<double> >& mapToFill, const std::string& parameterName) const;
0043   /**
0044    * Fills the map with the paramters for the given subdetector. <br>
0045    * Each vector "v" holds the parameters for the layers/rings, if the vector has only one parameter
0046    * all the layers/rings get that parameter. <br>
0047    * The only other possibility is that the number of parameters equals the number of layers, otherwise
0048    * an exception of type "Configuration" will be thrown.
0049    */
0050   void fillSubDetParameter(std::map<int, std::vector<double> >& mapToFill,
0051                            const std::vector<double>& v,
0052                            const int subDet,
0053                            const unsigned short layers) const;
0054 
0055   inline void printLog(const uint32_t detId, const unsigned short strip, const double& noise) const {
0056     edm::LogInfo("SiStripNoisesDummyCalculator")
0057         << "detid: " << detId << " strip: " << strip << " noise: " << noise << " \t" << std::endl;
0058   }
0059 
0060   edm::FileInPath fp_;
0061   bool printdebug_;
0062   edm::ParameterSet pset_;
0063 
0064   double electronsPerADC_;
0065   double minimumPosValue_;
0066   bool stripLengthMode_;
0067   uint32_t printDebug_;
0068 
0069   edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> tTopoToken_;
0070   edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> tGeomToken_;
0071   edm::ESGetToken<SiStripApvGain, SiStripApvGainRcd> inputApvGainToken_;
0072 };
0073 
0074 #endif