CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions
SiStripApvGainGenerator Class Reference

#include <SiStripApvGainGenerator.h>

Inheritance diagram for SiStripApvGainGenerator:
SiStripCondObjBuilderBase< SiStripApvGain >

Public Member Functions

void getObj (SiStripApvGain *&obj)
 
 SiStripApvGainGenerator (const edm::ParameterSet &, const edm::ActivityRegistry &)
 
 ~SiStripApvGainGenerator ()
 
- Public Member Functions inherited from SiStripCondObjBuilderBase< SiStripApvGain >
virtual bool checkForCompatibility (std::string ss)
 
virtual void getMetaDataString (std::stringstream &ss)
 
virtual void initialize ()
 
 SiStripCondObjBuilderBase (const edm::ParameterSet &pset)
 
virtual ~SiStripCondObjBuilderBase ()
 

Private Member Functions

void createObject ()
 

Additional Inherited Members

- Protected Attributes inherited from SiStripCondObjBuilderBase< SiStripApvGain >
edm::ParameterSet _pset
 
SiStripApvGainobj_
 

Detailed Description

Two ways to generate the gain:

Definition at line 16 of file SiStripApvGainGenerator.h.

Constructor & Destructor Documentation

SiStripApvGainGenerator::SiStripApvGainGenerator ( const edm::ParameterSet iConfig,
const edm::ActivityRegistry aReg 
)
explicit

Definition at line 10 of file SiStripApvGainGenerator.cc.

10  :
12 {
13  edm::LogInfo("SiStripApvGainGenerator") << "[SiStripApvGainGenerator::SiStripApvGainGenerator]";
14 }
SiStripCondObjBuilderBase(const edm::ParameterSet &pset)
SiStripApvGainGenerator::~SiStripApvGainGenerator ( )

Definition at line 16 of file SiStripApvGainGenerator.cc.

16  {
17  edm::LogInfo("SiStripApvGainGenerator") << "[SiStripApvGainGenerator::~SiStripApvGainGenerator]";
18 }

Member Function Documentation

void SiStripApvGainGenerator::createObject ( )
private

Definition at line 20 of file SiStripApvGainGenerator.cc.

References SiStripCondObjBuilderBase< SiStripApvGain >::_pset, prof2calltree::count, cmsRelvalreport::exit, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), j, LogDebug, SiStripCondObjBuilderBase< SiStripApvGain >::obj_, SiStripApvGain::put(), and matplotRender::reader.

Referenced by Vispa.Views.LineDecayView.LineDecayContainer::dropEvent(), and getObj().

20  {
21 
22  obj_ = new SiStripApvGain();
23 
24  std::string genMode = _pset.getParameter<std::string>("genMode");
25 
26  double meanGain_=_pset.getParameter<double>("MeanGain");
27  double sigmaGain_=_pset.getParameter<double>("SigmaGain");
28  double minimumPosValue_=_pset.getParameter<double>("MinPositiveGain");
29 
31  uint32_t printdebug_ = _pset.getUntrackedParameter<uint32_t>("printDebug", 5);
32  uint32_t count=0;
33 
34  SiStripDetInfoFileReader reader(fp_.fullPath());
35 
36  const std::map<uint32_t, SiStripDetInfoFileReader::DetInfo > DetInfos = reader.getAllData();
37  float gainValue;
38  for(std::map<uint32_t, SiStripDetInfoFileReader::DetInfo >::const_iterator it = DetInfos.begin(); it != DetInfos.end(); it++){
39 
40  std::vector<float> theSiStripVector;
41  for(unsigned short j=0; j<it->second.nApvs; j++){
42 
43  if(genMode=="default")
44  gainValue=meanGain_;
45  else if (genMode=="gaussian") {
46  gainValue = CLHEP::RandGauss::shoot(meanGain_, sigmaGain_);
47  if(gainValue<=minimumPosValue_) gainValue=minimumPosValue_;
48  }
49  else {
50  LogDebug("SiStripApvGain") << "ERROR: wrong genMode specifier : " << genMode << ", please select one of \"default\" or \"gaussian\"" << std::endl;
51  exit(1);
52  }
53 
54  if (count<printdebug_) {
55  edm::LogInfo("SiStripApvGainGenerator") << "detid: " << it->first << " Apv: " << j << " gain: " << gainValue << std::endl;
56  }
57  theSiStripVector.push_back(gainValue);
58  }
59  count++;
60  SiStripApvGain::Range range(theSiStripVector.begin(),theSiStripVector.end());
61  if ( ! obj_->put(it->first,range) )
62  edm::LogError("SiStripApvGainGenerator")<<" detid already exists"<<std::endl;
63  }
64 }
#define LogDebug(id)
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
bool put(const uint32_t &detID, Range input)
std::pair< ContainerIterator, ContainerIterator > Range
int j
Definition: DBlmapReader.cc:9
void SiStripApvGainGenerator::getObj ( SiStripApvGain *&  obj)
inlinevirtual