#include <SiStripGainRandomCalculator.h>
Public Member Functions | |
SiStripGainRandomCalculator (const edm::ParameterSet &) | |
~SiStripGainRandomCalculator () | |
Private Member Functions | |
void | algoAnalyze (const edm::Event &, const edm::EventSetup &) |
SiStripApvGain * | getNewObject () |
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_ |
Definition at line 27 of file SiStripGainRandomCalculator.h.
SiStripGainRandomCalculator::SiStripGainRandomCalculator | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 26 of file SiStripGainRandomCalculator.cc.
References detid_apvs_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), meanGain_, minimumPosValue_, printdebug_, and sigmaGain_.
: ConditionDBWriter<SiStripApvGain>(iConfig), m_cacheID_(0){ edm::LogInfo("SiStripGainRandomCalculator::SiStripGainRandomCalculator"); // std::string Mode=iConfig.getParameter<std::string>("Mode"); // if (Mode==std::string("Gaussian")) GaussianMode_=true; // else if (IOVMode==std::string("Constant")) ConstantMode_=true; // else edm::LogError("SiStripGainRandomCalculator::SiStripGainRandomCalculator(): ERROR - unknown generation mode...will not store anything on the DB") << std::endl; detid_apvs_.clear(); meanGain_=iConfig.getParameter<double>("MeanGain"); sigmaGain_=iConfig.getParameter<double>("SigmaGain"); minimumPosValue_=iConfig.getParameter<double>("MinPositiveGain"); printdebug_ = iConfig.getUntrackedParameter<bool>("printDebug", false); }
SiStripGainRandomCalculator::~SiStripGainRandomCalculator | ( | ) |
Definition at line 47 of file SiStripGainRandomCalculator.cc.
{ edm::LogInfo("SiStripGainRandomCalculator::~SiStripGainRandomCalculator"); }
void SiStripGainRandomCalculator::algoAnalyze | ( | const edm::Event & | event, |
const edm::EventSetup & | iSetup | ||
) | [private, virtual] |
Reimplemented from ConditionDBWriter< SiStripApvGain >.
Definition at line 54 of file SiStripGainRandomCalculator.cc.
References cond::rpcobgas::detid, detid_apvs_, cmsRelvalreport::exit, edm::EventSetup::get(), m_cacheID_, StripTopology::nstrips(), AlCaHLTBitMon_ParallelJobs::p, and printdebug_.
{ unsigned long long cacheID = iSetup.get<TrackerDigiGeometryRecord>().cacheIdentifier(); if (m_cacheID_ != cacheID) { m_cacheID_ = cacheID; edm::ESHandle<TrackerGeometry> pDD; iSetup.get<TrackerDigiGeometryRecord>().get( pDD ); edm::LogInfo("SiStripGainRandomCalculator::algoAnalyze - got new geometry ")<<std::endl; detid_apvs_.clear(); edm::LogInfo("SiStripGainCalculator") <<" There are "<<pDD->detUnits().size() <<" detectors"<<std::endl; for(TrackerGeometry::DetUnitContainer::const_iterator it = pDD->detUnits().begin(); it != pDD->detUnits().end(); it++){ if( dynamic_cast<StripGeomDetUnit*>((*it))!=0){ uint32_t detid=((*it)->geographicalId()).rawId(); const StripTopology& p = dynamic_cast<StripGeomDetUnit*>((*it))->specificTopology(); unsigned short NAPVs = p.nstrips()/128; if(NAPVs<1 || NAPVs>6 ) { edm::LogError("SiStripGainCalculator")<<" Problem with Number of strips in detector.. "<< p.nstrips() <<" Exiting program"<<endl; exit(1); } detid_apvs_.push_back( pair<uint32_t,unsigned short>(detid,NAPVs) ); if (printdebug_) edm::LogInfo("SiStripGainCalculator")<< "detid " << detid << " apvs " << NAPVs; } } } }
SiStripApvGain * SiStripGainRandomCalculator::getNewObject | ( | ) | [private, virtual] |
Implements ConditionDBWriter< SiStripApvGain >.
Definition at line 93 of file SiStripGainRandomCalculator.cc.
References gather_cfg::cout, detid_apvs_, j, meanGain_, minimumPosValue_, VarParsing::obj, printdebug_, SiStripApvGain::put(), and sigmaGain_.
{ std::cout<<"SiStripGainRandomCalculator::getNewObject called"<<std::endl; SiStripApvGain * obj = new SiStripApvGain(); for(std::vector< pair<uint32_t,unsigned short> >::const_iterator it = detid_apvs_.begin(); it != detid_apvs_.end(); it++){ //Generate Gain for det detid std::vector<float> theSiStripVector; for(unsigned short j=0; j<it->second; j++){ float gain; // if(sigmaGain_/meanGain_ < 0.00001) gain = meanGain_; // else{ gain = CLHEP::RandGauss::shoot(meanGain_, sigmaGain_); if(gain<=minimumPosValue_) gain=minimumPosValue_; // } if (printdebug_) edm::LogInfo("SiStripGainCalculator") << "detid " << it->first << " \t" << " apv " << j << " \t" << gain << " \t" << std::endl; theSiStripVector.push_back(gain); } SiStripApvGain::Range range(theSiStripVector.begin(),theSiStripVector.end()); if ( ! obj->put(it->first,range) ) edm::LogError("SiStripGainCalculator")<<"[SiStripGainCalculator::beginJob] detid already exists"<<std::endl; } return obj; }
std::vector< std::pair<uint32_t, unsigned short> > SiStripGainRandomCalculator::detid_apvs_ [private] |
Definition at line 46 of file SiStripGainRandomCalculator.h.
Referenced by algoAnalyze(), getNewObject(), and SiStripGainRandomCalculator().
unsigned long long SiStripGainRandomCalculator::m_cacheID_ [private] |
Definition at line 47 of file SiStripGainRandomCalculator.h.
Referenced by algoAnalyze().
double SiStripGainRandomCalculator::meanGain_ [private] |
Definition at line 42 of file SiStripGainRandomCalculator.h.
Referenced by getNewObject(), and SiStripGainRandomCalculator().
double SiStripGainRandomCalculator::minimumPosValue_ [private] |
Definition at line 44 of file SiStripGainRandomCalculator.h.
Referenced by getNewObject(), and SiStripGainRandomCalculator().
bool SiStripGainRandomCalculator::printdebug_ [private] |
Definition at line 48 of file SiStripGainRandomCalculator.h.
Referenced by algoAnalyze(), getNewObject(), and SiStripGainRandomCalculator().
double SiStripGainRandomCalculator::sigmaGain_ [private] |
Definition at line 43 of file SiStripGainRandomCalculator.h.
Referenced by getNewObject(), and SiStripGainRandomCalculator().