Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:59:51

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