CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
corrGains Class Reference
Inheritance diagram for corrGains:
edm::one::EDAnalyzer< edm::one::WatchRuns > edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 corrGains (const edm::ParameterSet &)
 
 ~corrGains () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer< edm::one::WatchRuns >
 EDAnalyzer ()=default
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDAnalyzerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void analyze (edm::Event const &, edm::EventSetup const &) override
 
void beginRun (edm::Run const &iEvent, edm::EventSetup const &) override
 
void endRun (edm::Run const &iEvent, edm::EventSetup const &) override
 

Private Attributes

std::string fileCorr
 
std::string fileIn
 
std::string fileOut
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 19 of file corrGains.cc.

Constructor & Destructor Documentation

corrGains::corrGains ( const edm::ParameterSet iConfig)
explicit

Definition at line 32 of file corrGains.cc.

References fileCorr, fileIn, fileOut, edm::ParameterSet::getUntrackedParameter(), and AlCaHLTBitMon_QueryRunRegistry::string.

32  {
33  fileIn = iConfig.getUntrackedParameter<std::string>("FileIn");
34  fileOut = iConfig.getUntrackedParameter<std::string>("FileOut");
35  fileCorr = iConfig.getUntrackedParameter<std::string>("FileCorr");
36 }
std::string fileIn
Definition: corrGains.cc:29
T getUntrackedParameter(std::string const &, T const &) const
std::string fileCorr
Definition: corrGains.cc:29
std::string fileOut
Definition: corrGains.cc:29
corrGains::~corrGains ( )
override

Definition at line 38 of file corrGains.cc.

38 { }

Member Function Documentation

void corrGains::analyze ( edm::Event const &  ,
edm::EventSetup const &  iSetup 
)
overrideprivatevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 40 of file corrGains.cc.

References HcalCondObjectContainer< Item >::addValues(), DEFINE_FWK_MODULE, HcalDbASCIIIO::dumpObject(), HcalCondObjectContainer< Item >::exists(), fileCorr, fileIn, fileOut, edm::EventSetup::get(), HcalCondObjectContainer< Item >::getAllChannels(), HcalDbASCIIIO::getObject(), HcalRespCorr::getValue(), HcalGain::getValue(), HcalCondObjectContainer< Item >::getValues(), mps_fire::i, and Scenarios_cff::scale.

Referenced by beginRun().

40  {
41 
43  iSetup.get<HcalRecNumberingRecord>().get(htopo);
44  HcalTopology topo = (*htopo);
45 
46  HcalGains gainsIn(&topo);;
47  std::ifstream inStream (fileIn.c_str());
48  HcalDbASCIIIO::getObject (inStream, &gainsIn);
49  inStream.close();
50 
51  HcalRespCorrs corrsIn(&topo);;
52  std::ifstream inCorr (fileCorr.c_str());
53  HcalDbASCIIIO::getObject (inCorr, &corrsIn);
54  inCorr.close();
55 
56  HcalGains gainsOut(&topo);;
57  std::vector<DetId> channels = gainsIn.getAllChannels ();
58  for (unsigned int i = 0; i < channels.size(); i++) {
59  DetId id = channels[i];
60  float scale = 1.;
61  if (corrsIn.exists(id)) scale = corrsIn.getValues(id)->getValue();
62  HcalGain item(id, gainsIn.getValues(id)->getValue(0) * scale, gainsIn.getValues(id)->getValue(1) * scale,
63  gainsIn.getValues(id)->getValue(2) * scale, gainsIn.getValues(id)->getValue(3) * scale);
64  gainsOut.addValues(item);
65  }
66  std::ofstream outStream (fileOut.c_str());
67  HcalDbASCIIIO::dumpObject (outStream, gainsOut);
68  outStream.close();
69 }
std::string fileIn
Definition: corrGains.cc:29
std::string fileCorr
Definition: corrGains.cc:29
std::string fileOut
Definition: corrGains.cc:29
Definition: DetId.h:18
bool getObject(std::istream &fInput, HcalPedestals *fObject)
bool dumpObject(std::ostream &fOutput, const HcalPedestals &fObject)
void corrGains::beginRun ( edm::Run const &  iEvent,
edm::EventSetup const &   
)
inlineoverrideprivate

Definition at line 26 of file corrGains.cc.

References analyze().

26 {}
void corrGains::endRun ( edm::Run const &  iEvent,
edm::EventSetup const &   
)
inlineoverrideprivate

Definition at line 28 of file corrGains.cc.

28 {}

Member Data Documentation

std::string corrGains::fileCorr
private

Definition at line 29 of file corrGains.cc.

Referenced by analyze(), and corrGains().

std::string corrGains::fileIn
private

Definition at line 29 of file corrGains.cc.

Referenced by analyze(), and corrGains().

std::string corrGains::fileOut
private

Definition at line 29 of file corrGains.cc.

Referenced by analyze(), and corrGains().