CMS 3D CMS Logo

SiStripNoiseDummyCalculator Class Reference

Description: <one line="" class="" summary>="">. More...

#include <CalibTracker/SiStripPedestals/src/SiStripNoiseDummyCalculator.cc>

Inheritance diagram for SiStripNoiseDummyCalculator:

ConditionDBWriter< SiStripNoises > edm::EDAnalyzer

List of all members.

Public Member Functions

 SiStripNoiseDummyCalculator (const edm::ParameterSet &)
 ~SiStripNoiseDummyCalculator ()

Private Member Functions

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

Private Attributes

std::map< uint32_t, std::pair
< unsigned short, double > > 
detData_
double electronsPerADC_
unsigned long long m_cacheID_
double meanNoise_
double minimumPosValue_
double noiseStripLengthLinearQuote_
double noiseStripLengthLinearSlope_
bool printdebug_
double sigmaNoise_
bool stripLengthMode_


Detailed Description

Description: <one line="" class="" summary>="">.

Implementation: <Notes on="" implementation>="">

Definition at line 28 of file SiStripNoiseDummyCalculator.h.


Constructor & Destructor Documentation

SiStripNoiseDummyCalculator::SiStripNoiseDummyCalculator ( const edm::ParameterSet iConfig  )  [explicit]

Definition at line 26 of file SiStripNoiseDummyCalculator.cc.

References detData_, electronsPerADC_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), meanNoise_, minimumPosValue_, noiseStripLengthLinearQuote_, noiseStripLengthLinearSlope_, printdebug_, sigmaNoise_, and stripLengthMode_.

00026                                                                                        : ConditionDBWriter<SiStripNoises>::ConditionDBWriter<SiStripNoises>(iConfig), m_cacheID_(0){
00027 
00028   
00029   edm::LogInfo("SiStripNoiseDummyCalculator::SiStripNoiseDummyCalculator");
00030 
00031   detData_.clear();
00032 
00033   stripLengthMode_ = iConfig.getParameter<bool>("StripLengthMode");
00034   
00035   noiseStripLengthLinearSlope_ = iConfig.getParameter<double>("NoiseStripLengthSlope");  
00036   noiseStripLengthLinearQuote_ = iConfig.getParameter<double>("NoiseStripLengthQuote");  
00037   electronsPerADC_ = iConfig.getParameter<double>("electronPerAdc");
00038 
00039 
00040   meanNoise_=iConfig.getParameter<double>("MeanNoise");
00041   sigmaNoise_=iConfig.getParameter<double>("SigmaNoise");
00042   minimumPosValue_=iConfig.getParameter<double>("MinPositiveNoise");
00043 
00044   printdebug_ = iConfig.getUntrackedParameter<bool>("printDebug", false);
00045 
00046 }

SiStripNoiseDummyCalculator::~SiStripNoiseDummyCalculator (  ) 

Definition at line 49 of file SiStripNoiseDummyCalculator.cc.

00049                                                          {
00050 
00051    edm::LogInfo("SiStripNoiseDummyCalculator::~SiStripNoiseDummyCalculator");
00052 }


Member Function Documentation

void SiStripNoiseDummyCalculator::algoAnalyze ( const edm::Event event,
const edm::EventSetup iSetup 
) [private, virtual]

Reimplemented from ConditionDBWriter< SiStripNoises >.

Definition at line 56 of file SiStripNoiseDummyCalculator.cc.

References detData_, lat::endl(), StripGeomDetUnit::geographicalId(), edm::EventSetup::get(), it, m_cacheID_, StripTopology::nstrips(), printdebug_, StripGeomDetUnit::specificTopology(), and StripTopology::stripLength().

00056                                                                                                 {
00057 
00058   unsigned long long cacheID = iSetup.get<TrackerDigiGeometryRecord>().cacheIdentifier();
00059   
00060   if (m_cacheID_ != cacheID) {
00061 
00062     //remove
00063     //    mys.setESObjects(iSetup);
00064 
00065     
00066     m_cacheID_ = cacheID; 
00067 
00068     edm::ESHandle<TrackerGeometry> pDD;
00069 
00070     iSetup.get<TrackerDigiGeometryRecord>().get( pDD );
00071     edm::LogInfo("SiStripNoiseDummyCalculator::algoAnalyze - got new geometry  ")<<std::endl;
00072 
00073 
00074     detData_.clear();
00075     
00076     edm::LogInfo("SiStripNoiseDummyCalculator") <<" There are "<<pDD->detUnits().size() <<" detectors"<<std::endl;
00077     
00078     for(TrackerGeometry::DetUnitContainer::const_iterator it = pDD->detUnits().begin(); it != pDD->detUnits().end(); it++){
00079   
00080       const StripGeomDetUnit* mit = dynamic_cast<StripGeomDetUnit*>(*it);
00081 
00082       if(mit!=0){
00083 
00084         uint32_t detid=(mit->geographicalId()).rawId();
00085         double stripLength = mit->specificTopology().stripLength();
00086         unsigned short numberOfAPVPairs= mit->specificTopology().nstrips()/256;
00087 
00088         detData_[detid]=pair<unsigned short, double>(numberOfAPVPairs, stripLength);
00089         if (printdebug_)
00090           edm::LogInfo("SiStripNoiseDummyCalculator")<< "detid: " << detid << " strip length: " << stripLength << "  number of APV pairs: " << numberOfAPVPairs;
00091       }
00092     }
00093 
00094     if (printdebug_) edm::LogInfo("SiStripNoiseDummyCalculator - Number of detectors for which got noise value is ")<< detData_.size();
00095 
00096 
00097   }
00098 
00099 }

SiStripNoises * SiStripNoiseDummyCalculator::getNewObject (  )  [private, virtual]

Implements ConditionDBWriter< SiStripNoises >.

Definition at line 102 of file SiStripNoiseDummyCalculator.cc.

References GenMuonPlsPt100GeV_cfg::cout, detData_, electronsPerADC_, lat::endl(), first, it, j, python::multivaluedict::map(), meanNoise_, minimumPosValue_, noiseStripLengthLinearQuote_, noiseStripLengthLinearSlope_, VarParsing::obj, printdebug_, SiStripNoises::put(), SiStripNoises::setData(), sigmaNoise_, strip(), and stripLengthMode_.

00102                                                           {
00103 
00104   std::cout<<"SiStripNoiseDummyCalculator::getNewObject called"<<std::endl;
00105 
00106   SiStripNoises * obj = new SiStripNoises();
00107 
00108   bool firstdet=true;
00109 
00110   for(std::map< uint32_t, pair<unsigned short, double> >::const_iterator it = detData_.begin(); it != detData_.end(); it++){
00111     //Generate Noise for det detid
00112 
00113     SiStripNoises::InputVector theSiStripVector;
00114     for(unsigned short j=0; j<(it->second).first; j++){
00115       for(int strip=0; strip<256; ++strip){
00116 
00117         float noise;
00118 
00119         if(stripLengthMode_){
00120 
00121           noise = ( noiseStripLengthLinearSlope_ * (detData_[it->first].second) + noiseStripLengthLinearQuote_) / electronsPerADC_;
00122 
00123 
00124         }
00125         else{
00126           noise = RandGauss::shoot(meanNoise_,sigmaNoise_);
00127           if(noise<=minimumPosValue_) noise=minimumPosValue_;
00128         }
00129 
00130         if (printdebug_ && firstdet) {
00131 
00132           edm::LogInfo("SiStripNoisesDummyCalculator") << "detid: " << it->first  << " strip: " << j*256+strip <<  " noise: " << noise     << " \t"   << std::endl;         
00133 
00134 
00135         }
00136 
00137 
00138         obj->setData(noise,theSiStripVector);
00139 
00140       }
00141 
00142     }       
00143       
00144     firstdet=false;
00145 
00146     if ( ! obj->put(it->first,theSiStripVector) )
00147       edm::LogError("SiStripNoiseDummyCalculator")<<"[SiStripNoiseDummyCalculator::beginJob] detid already exists"<<std::endl;
00148 
00149   }
00150 
00151 
00152 
00153 //   //remove
00154 //  for(std::map< uint32_t, pair<unsigned short, double> >::const_iterator pit = detData_.begin(); pit != detData_.end(); pit++){
00155 
00156 //    SiStripNoises::Range myra = obj->getRange((*pit).first);
00157 
00158 //    for(unsigned short j=0; j<(pit->second).first; j++){
00159 //      for(int strip=0; strip<256; ++strip){
00160 
00161 //        uint16_t myst=j*256+strip;
00162        
00163 //        float mysnoise = (static_cast<int16_t>  (mys.getNoise((*pit).first,  myst)*10.0 + 0.5) & 0x01FF)/10.0;
00164 
00165 
00166 //        //       if (mys.getNoise((*pit).first,  myst) + 0.00001 < obj->getNoise( myst , myra) || mys.getNoise((*pit).first,  myst) - 0.00001 > obj->getNoise( myst , myra)  ) edm::LogError("ERROR")<< "DETID: "<< (*pit).first << " STRIP: "<< myst <<" NOISE SERVICE NOISE: "<< mys.getNoise((*pit).first,  myst) <<  " MY NOISE: "<<  obj->getNoise( myst , myra) << endl;
00167 
00168 //        if (mysnoise + 0.00001 < obj->getNoise( myst , myra) || mysnoise - 0.00001 > obj->getNoise( myst , myra)  ) edm::LogError("ERROR")<< "DETID: "<< (*pit).first << " STRIP: "<< myst <<" NOISE SERVICE NOISE: "<< mys.getNoise((*pit).first,  myst) <<  " MY NOISE: "<<  obj->getNoise( myst , myra) << " NOISE SERVICE MODIFIED"<< mysnoise<< endl;
00169 
00170        
00171 
00172 //      }
00173 //    }
00174 
00175 //  }
00176 //  //end remove
00177 
00178 
00179   
00180   return obj;
00181 
00182 }


Member Data Documentation

std::map<uint32_t, std::pair<unsigned short, double> > SiStripNoiseDummyCalculator::detData_ [private]

Definition at line 56 of file SiStripNoiseDummyCalculator.h.

Referenced by algoAnalyze(), getNewObject(), and SiStripNoiseDummyCalculator().

double SiStripNoiseDummyCalculator::electronsPerADC_ [private]

Definition at line 53 of file SiStripNoiseDummyCalculator.h.

Referenced by getNewObject(), and SiStripNoiseDummyCalculator().

unsigned long long SiStripNoiseDummyCalculator::m_cacheID_ [private]

Definition at line 57 of file SiStripNoiseDummyCalculator.h.

Referenced by algoAnalyze().

double SiStripNoiseDummyCalculator::meanNoise_ [private]

Definition at line 46 of file SiStripNoiseDummyCalculator.h.

Referenced by getNewObject(), and SiStripNoiseDummyCalculator().

double SiStripNoiseDummyCalculator::minimumPosValue_ [private]

Definition at line 48 of file SiStripNoiseDummyCalculator.h.

Referenced by getNewObject(), and SiStripNoiseDummyCalculator().

double SiStripNoiseDummyCalculator::noiseStripLengthLinearQuote_ [private]

Definition at line 52 of file SiStripNoiseDummyCalculator.h.

Referenced by getNewObject(), and SiStripNoiseDummyCalculator().

double SiStripNoiseDummyCalculator::noiseStripLengthLinearSlope_ [private]

Definition at line 51 of file SiStripNoiseDummyCalculator.h.

Referenced by getNewObject(), and SiStripNoiseDummyCalculator().

bool SiStripNoiseDummyCalculator::printdebug_ [private]

Definition at line 59 of file SiStripNoiseDummyCalculator.h.

Referenced by algoAnalyze(), getNewObject(), and SiStripNoiseDummyCalculator().

double SiStripNoiseDummyCalculator::sigmaNoise_ [private]

Definition at line 47 of file SiStripNoiseDummyCalculator.h.

Referenced by getNewObject(), and SiStripNoiseDummyCalculator().

bool SiStripNoiseDummyCalculator::stripLengthMode_ [private]

Definition at line 43 of file SiStripNoiseDummyCalculator.h.

Referenced by getNewObject(), and SiStripNoiseDummyCalculator().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:32:26 2009 for CMSSW by  doxygen 1.5.4