Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-10-25 09:35:28

0001 #ifndef SiStripApvGainBuilderFromTag_H
0002 #define SiStripApvGainBuilderFromTag_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/DataRecord/interface/SiStripCondDataRecords.h"
0018 
0019 #include "CLHEP/Random/RandFlat.h"
0020 #include "CLHEP/Random/RandGauss.h"
0021 
0022 class TrackerTopology;
0023 class TrackerGeometry;
0024 /**
0025  * Produces a tag for the apvGain object starting from an already existing tag in the db. <br>
0026  * The input tag is used as starting point and all the values for missing apvs are filled with
0027  * the meanGain specified via cfg. <br>
0028  * It will optionally apply a correction specified via cfg if the applyTuning bool is true. <br>
0029  * The resulting new gain values can optionally be smeared with a gaussian of sigma specified in the cfg. <br>
0030  * Note: we are not using the usual DummyCondDBWriter because we cannot pass an input tag to a service without
0031  * several changes to the base classes used together with it.
0032  */
0033 
0034 class SiStripApvGainBuilderFromTag : public edm::one::EDAnalyzer<> {
0035 public:
0036   explicit SiStripApvGainBuilderFromTag(const edm::ParameterSet& iConfig);
0037 
0038   ~SiStripApvGainBuilderFromTag() override{};
0039 
0040   void analyze(const edm::Event&, const edm::EventSetup&) override;
0041 
0042 private:
0043   /// Fills the parameters read from cfg and matching the name in the given map
0044   void fillParameters(std::map<int, std::vector<double> >& mapToFill, const std::string& parameterName) const;
0045   /**
0046    * Fills the map with the paramters for the given subdetector. <br>
0047    * Each vector "v" holds the parameters for the layers/rings, if the vector has only one parameter
0048    * all the layers/rings get that parameter. <br>
0049    * The only other possibility is that the number of parameters equals the number of layers, otherwise
0050    * an exception of type "Configuration" will be thrown.
0051    */
0052   void fillSubDetParameter(std::map<int, std::vector<double> >& mapToFill,
0053                            const std::vector<double>& v,
0054                            const int subDet,
0055                            const unsigned short layers) const;
0056 
0057   bool printdebug_;
0058   edm::ParameterSet pset_;
0059   edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> tTopoToken_;
0060   edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> tGeomToken_;
0061   edm::ESGetToken<SiStripApvGain, SiStripApvGainRcd> inputApvGainToken_;
0062 };
0063 
0064 #endif