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 | Private Attributes
SiStripGainRandomCalculator Class Reference

#include <SiStripGainRandomCalculator.h>

Inheritance diagram for SiStripGainRandomCalculator:
ConditionDBWriter< SiStripApvGain > edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 SiStripGainRandomCalculator (const edm::ParameterSet &)
 
 ~SiStripGainRandomCalculator ()
 
- Public Member Functions inherited from ConditionDBWriter< SiStripApvGain >
 ConditionDBWriter (const edm::ParameterSet &iConfig)
 
virtual ~ConditionDBWriter ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

void algoAnalyze (const edm::Event &, const edm::EventSetup &)
 
SiStripApvGaingetNewObject ()
 

Private Attributes

std::vector< std::pair
< uint32_t, unsigned short > > 
detid_apvs_
 
unsigned long long m_cacheID_
 
double meanGain_
 
double minimumPosValue_
 
bool printdebug_
 
double sigmaGain_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from ConditionDBWriter< SiStripApvGain >
void setDoStore (const bool doStore)
 When set to false the payload will not be written to the db. More...
 
void storeOnDbNow ()
 
cond::Time_t timeOfLastIOV ()
 
- 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 26 of file SiStripGainRandomCalculator.h.

Constructor & Destructor Documentation

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

Definition at line 25 of file SiStripGainRandomCalculator.cc.

References detid_apvs_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), meanGain_, minimumPosValue_, printdebug_, and sigmaGain_.

26 
27 
28  edm::LogInfo("SiStripGainRandomCalculator::SiStripGainRandomCalculator");
29 
30 // std::string Mode=iConfig.getParameter<std::string>("Mode");
31 // if (Mode==std::string("Gaussian")) GaussianMode_=true;
32 // else if (IOVMode==std::string("Constant")) ConstantMode_=true;
33 // else edm::LogError("SiStripGainRandomCalculator::SiStripGainRandomCalculator(): ERROR - unknown generation mode...will not store anything on the DB") << std::endl;
34 
35  detid_apvs_.clear();
36 
37  meanGain_=iConfig.getParameter<double>("MeanGain");
38  sigmaGain_=iConfig.getParameter<double>("SigmaGain");
39  minimumPosValue_=iConfig.getParameter<double>("MinPositiveGain");
40  printdebug_ = iConfig.getUntrackedParameter<bool>("printDebug", false);
41 
42 
43 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::vector< std::pair< uint32_t, unsigned short > > detid_apvs_
SiStripGainRandomCalculator::~SiStripGainRandomCalculator ( )

Definition at line 46 of file SiStripGainRandomCalculator.cc.

46  {
47 
48  edm::LogInfo("SiStripGainRandomCalculator::~SiStripGainRandomCalculator");
49 }

Member Function Documentation

void SiStripGainRandomCalculator::algoAnalyze ( const edm::Event event,
const edm::EventSetup iSetup 
)
privatevirtual

Reimplemented from ConditionDBWriter< SiStripApvGain >.

Definition at line 53 of file SiStripGainRandomCalculator.cc.

References cond::rpcobgas::detid, detid_apvs_, cmsRelvalreport::exit, edm::EventSetup::get(), m_cacheID_, StripTopology::nstrips(), AlCaHLTBitMon_ParallelJobs::p, and printdebug_.

53  {
54 
55 
56  unsigned long long cacheID = iSetup.get<TrackerDigiGeometryRecord>().cacheIdentifier();
57 
58  if (m_cacheID_ != cacheID) {
59 
60  m_cacheID_ = cacheID;
61 
63 
64  iSetup.get<TrackerDigiGeometryRecord>().get( pDD );
65  edm::LogInfo("SiStripGainRandomCalculator::algoAnalyze - got new geometry ")<<std::endl;
66 
67  detid_apvs_.clear();
68 
69  edm::LogInfo("SiStripGainCalculator") <<" There are "<<pDD->detUnits().size() <<" detectors"<<std::endl;
70 
71  for(TrackerGeometry::DetUnitContainer::const_iterator it = pDD->detUnits().begin(); it != pDD->detUnits().end(); it++){
72 
73  if( dynamic_cast<const StripGeomDetUnit*>((*it))!=0){
74  uint32_t detid=((*it)->geographicalId()).rawId();
75  const StripTopology & p = dynamic_cast<const StripGeomDetUnit*>((*it))->specificTopology();
76  unsigned short NAPVs = p.nstrips()/128;
77  if(NAPVs<1 || NAPVs>6 ) {
78  edm::LogError("SiStripGainCalculator")<<" Problem with Number of strips in detector.. "<< p.nstrips() <<" Exiting program"<<endl;
79  exit(1);
80  }
81  detid_apvs_.push_back( pair<uint32_t,unsigned short>(detid,NAPVs) );
82  if (printdebug_)
83  edm::LogInfo("SiStripGainCalculator")<< "detid " << detid << " apvs " << NAPVs;
84  }
85  }
86  }
87 
88 
89 }
virtual int nstrips() const =0
const T & get() const
Definition: EventSetup.h:55
std::vector< std::pair< uint32_t, unsigned short > > detid_apvs_
SiStripApvGain * SiStripGainRandomCalculator::getNewObject ( )
privatevirtual

Implements ConditionDBWriter< SiStripApvGain >.

Definition at line 92 of file SiStripGainRandomCalculator.cc.

References gather_cfg::cout, detid_apvs_, j, meanGain_, minimumPosValue_, getGTfromDQMFile::obj, printdebug_, SiStripApvGain::put(), and sigmaGain_.

92  {
93 
94  std::cout<<"SiStripGainRandomCalculator::getNewObject called"<<std::endl;
95 
97 
98  for(std::vector< pair<uint32_t,unsigned short> >::const_iterator it = detid_apvs_.begin(); it != detid_apvs_.end(); it++){
99  //Generate Gain for det detid
100  std::vector<float> theSiStripVector;
101  for(unsigned short j=0; j<it->second; j++){
102  float gain;
103 
104  // if(sigmaGain_/meanGain_ < 0.00001) gain = meanGain_;
105  // else{
106  gain = CLHEP::RandGauss::shoot(meanGain_, sigmaGain_);
107  if(gain<=minimumPosValue_) gain=minimumPosValue_;
108  // }
109 
110  if (printdebug_)
111  edm::LogInfo("SiStripGainCalculator") << "detid " << it->first << " \t"
112  << " apv " << j << " \t"
113  << gain << " \t"
114  << std::endl;
115  theSiStripVector.push_back(gain);
116  }
117 
118 
119  SiStripApvGain::Range range(theSiStripVector.begin(),theSiStripVector.end());
120  if ( ! obj->put(it->first,range) )
121  edm::LogError("SiStripGainCalculator")<<"[SiStripGainCalculator::beginJob] detid already exists"<<std::endl;
122 
123  }
124 
125  return obj;
126 
127 }
bool put(const uint32_t &detID, Range input)
std::pair< ContainerIterator, ContainerIterator > Range
int j
Definition: DBlmapReader.cc:9
std::vector< std::pair< uint32_t, unsigned short > > detid_apvs_
tuple cout
Definition: gather_cfg.py:121

Member Data Documentation

std::vector< std::pair<uint32_t, unsigned short> > SiStripGainRandomCalculator::detid_apvs_
private
unsigned long long SiStripGainRandomCalculator::m_cacheID_
private

Definition at line 46 of file SiStripGainRandomCalculator.h.

Referenced by algoAnalyze().

double SiStripGainRandomCalculator::meanGain_
private

Definition at line 41 of file SiStripGainRandomCalculator.h.

Referenced by getNewObject(), and SiStripGainRandomCalculator().

double SiStripGainRandomCalculator::minimumPosValue_
private

Definition at line 43 of file SiStripGainRandomCalculator.h.

Referenced by getNewObject(), and SiStripGainRandomCalculator().

bool SiStripGainRandomCalculator::printdebug_
private
double SiStripGainRandomCalculator::sigmaGain_
private

Definition at line 42 of file SiStripGainRandomCalculator.h.

Referenced by getNewObject(), and SiStripGainRandomCalculator().