#include <CalibTracker/SiStripChannelGain/plugins/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_.
00026 : ConditionDBWriter<SiStripApvGain>::ConditionDBWriter<SiStripApvGain>(iConfig), m_cacheID_(0){ 00027 00028 00029 edm::LogInfo("SiStripGainRandomCalculator::SiStripGainRandomCalculator"); 00030 00031 // std::string Mode=iConfig.getParameter<std::string>("Mode"); 00032 // if (Mode==std::string("Gaussian")) GaussianMode_=true; 00033 // else if (IOVMode==std::string("Constant")) ConstantMode_=true; 00034 // else edm::LogError("SiStripGainRandomCalculator::SiStripGainRandomCalculator(): ERROR - unknown generation mode...will not store anything on the DB") << std::endl; 00035 00036 detid_apvs_.clear(); 00037 00038 meanGain_=iConfig.getParameter<double>("MeanGain"); 00039 sigmaGain_=iConfig.getParameter<double>("SigmaGain"); 00040 minimumPosValue_=iConfig.getParameter<double>("MinPositiveGain"); 00041 printdebug_ = iConfig.getUntrackedParameter<bool>("printDebug", false); 00042 00043 00044 }
SiStripGainRandomCalculator::~SiStripGainRandomCalculator | ( | ) |
Definition at line 47 of file SiStripGainRandomCalculator.cc.
00047 { 00048 00049 edm::LogInfo("SiStripGainRandomCalculator::~SiStripGainRandomCalculator"); 00050 }
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 detid_apvs_, lat::endl(), cmsRelvalreport::exit, edm::EventSetup::get(), it, m_cacheID_, StripTopology::nstrips(), p, and printdebug_.
00054 { 00055 00056 00057 unsigned long long cacheID = iSetup.get<TrackerDigiGeometryRecord>().cacheIdentifier(); 00058 00059 if (m_cacheID_ != cacheID) { 00060 00061 m_cacheID_ = cacheID; 00062 00063 edm::ESHandle<TrackerGeometry> pDD; 00064 00065 iSetup.get<TrackerDigiGeometryRecord>().get( pDD ); 00066 edm::LogInfo("SiStripGainRandomCalculator::algoAnalyze - got new geometry ")<<std::endl; 00067 00068 detid_apvs_.clear(); 00069 00070 edm::LogInfo("SiStripGainCalculator") <<" There are "<<pDD->detUnits().size() <<" detectors"<<std::endl; 00071 00072 for(TrackerGeometry::DetUnitContainer::const_iterator it = pDD->detUnits().begin(); it != pDD->detUnits().end(); it++){ 00073 00074 if( dynamic_cast<StripGeomDetUnit*>((*it))!=0){ 00075 uint32_t detid=((*it)->geographicalId()).rawId(); 00076 const StripTopology& p = dynamic_cast<StripGeomDetUnit*>((*it))->specificTopology(); 00077 unsigned short NAPVs = p.nstrips()/128; 00078 if(NAPVs<1 || NAPVs>6 ) { 00079 edm::LogError("SiStripGainCalculator")<<" Problem with Number of strips in detector.. "<< p.nstrips() <<" Exiting program"<<endl; 00080 exit(1); 00081 } 00082 detid_apvs_.push_back( pair<uint32_t,unsigned short>(detid,NAPVs) ); 00083 if (printdebug_) 00084 edm::LogInfo("SiStripGainCalculator")<< "detid " << detid << " apvs " << NAPVs; 00085 } 00086 } 00087 } 00088 00089 00090 }
SiStripApvGain * SiStripGainRandomCalculator::getNewObject | ( | ) | [private, virtual] |
Implements ConditionDBWriter< SiStripApvGain >.
Definition at line 93 of file SiStripGainRandomCalculator.cc.
References GenMuonPlsPt100GeV_cfg::cout, detid_apvs_, lat::endl(), it, j, meanGain_, minimumPosValue_, VarParsing::obj, printdebug_, SiStripApvGain::put(), range, and sigmaGain_.
00093 { 00094 00095 std::cout<<"SiStripGainRandomCalculator::getNewObject called"<<std::endl; 00096 00097 SiStripApvGain * obj = new SiStripApvGain(); 00098 00099 for(std::vector< pair<uint32_t,unsigned short> >::const_iterator it = detid_apvs_.begin(); it != detid_apvs_.end(); it++){ 00100 //Generate Gain for det detid 00101 std::vector<float> theSiStripVector; 00102 for(unsigned short j=0; j<it->second; j++){ 00103 float gain; 00104 00105 // if(sigmaGain_/meanGain_ < 0.00001) gain = meanGain_; 00106 // else{ 00107 gain = RandGauss::shoot(meanGain_, sigmaGain_); 00108 if(gain<=minimumPosValue_) gain=minimumPosValue_; 00109 // } 00110 00111 if (printdebug_) 00112 edm::LogInfo("SiStripGainCalculator") << "detid " << it->first << " \t" 00113 << " apv " << j << " \t" 00114 << gain << " \t" 00115 << std::endl; 00116 theSiStripVector.push_back(gain); 00117 } 00118 00119 00120 SiStripApvGain::Range range(theSiStripVector.begin(),theSiStripVector.end()); 00121 if ( ! obj->put(it->first,range) ) 00122 edm::LogError("SiStripGainCalculator")<<"[SiStripGainCalculator::beginJob] detid already exists"<<std::endl; 00123 00124 } 00125 00126 return obj; 00127 00128 }
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] |
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().