CMS 3D CMS Logo

Public Member Functions | Private Attributes

SiStripNoisesBuilder Class Reference

#include <SiStripNoisesBuilder.h>

Inheritance diagram for SiStripNoisesBuilder:
edm::EDAnalyzer

List of all members.

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 SiStripNoisesBuilder (const edm::ParameterSet &iConfig)
 ~SiStripNoisesBuilder ()

Private Attributes

edm::FileInPath fp_
uint32_t printdebug_

Detailed Description

Definition at line 16 of file SiStripNoisesBuilder.h.


Constructor & Destructor Documentation

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

Definition at line 6 of file SiStripNoisesBuilder.cc.

                                                                          :
  fp_(iConfig.getUntrackedParameter<edm::FileInPath>("file",edm::FileInPath("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"))),
  printdebug_(iConfig.getUntrackedParameter<uint32_t>("printDebug",1)){}
SiStripNoisesBuilder::~SiStripNoisesBuilder ( ) [inline]

Definition at line 22 of file SiStripNoisesBuilder.h.

{};

Member Function Documentation

void SiStripNoisesBuilder::analyze ( const edm::Event evt,
const edm::EventSetup iSetup 
) [virtual]

Implements edm::EDAnalyzer.

Definition at line 11 of file SiStripNoisesBuilder.cc.

References prof2calltree::count, fp_, edm::FileInPath::fullPath(), edm::EventBase::id(), edm::Service< T >::isAvailable(), getGTfromDQMFile::obj, printdebug_, SiStripNoises::put(), matplotRender::reader, edm::EventID::run(), DTTTrigCorrFirst::run, SiStripNoises::setData(), and strip().

                                                                                  {

  unsigned int run=evt.id().run();

  edm::LogInfo("SiStripNoisesBuilder") << "... creating dummy SiStripNoises Data for Run " << run << "\n " << std::endl;

  SiStripNoises* obj = new SiStripNoises();

  SiStripDetInfoFileReader reader(fp_.fullPath());
  
  const std::map<uint32_t, SiStripDetInfoFileReader::DetInfo > DetInfos  = reader.getAllData();

  int count=-1;
  for(std::map<uint32_t, SiStripDetInfoFileReader::DetInfo >::const_iterator it = DetInfos.begin(); it != DetInfos.end(); it++){    
    count++;
    //Generate Noise for det detid
    SiStripNoises::InputVector theSiStripVector;
    for(int strip=0; strip<128*it->second.nApvs; ++strip){

      float MeanNoise = 5;
      float RmsNoise  = 1;
      float noise =  CLHEP::RandGauss::shoot(MeanNoise,RmsNoise);
      
      //double badStripProb = .5;
      //bool disable = (CLHEP::RandFlat::shoot(1.) < badStripProb ? true:false);
        
      obj->setData(noise,theSiStripVector);
      if (count<static_cast<int>(printdebug_))
        edm::LogInfo("SiStripNoisesBuilder") << "detid " << it->first << " \t"
                                             << " strip " << strip << " \t"
                                             << noise     << " \t" 
                                             << theSiStripVector.back()/10 << " \t" 
                                             << std::endl;          
    }    
      
    if ( ! obj->put(it->first,theSiStripVector) )
      edm::LogError("SiStripNoisesBuilder")<<"[SiStripNoisesBuilder::analyze] detid already exists"<<std::endl;
  }


  //End now write sistripnoises data in DB
  edm::Service<cond::service::PoolDBOutputService> mydbservice;

  if( mydbservice.isAvailable() ){
    if ( mydbservice->isNewTagRequest("SiStripNoisesRcd") ){
      mydbservice->createNewIOV<SiStripNoises>(obj,mydbservice->beginOfTime(),mydbservice->endOfTime(),"SiStripNoisesRcd");
    } else {  
      //mydbservice->createNewIOV<SiStripNoises>(obj,mydbservice->currentTime(),"SiStripNoisesRcd");      
      mydbservice->appendSinceTime<SiStripNoises>(obj,mydbservice->currentTime(),"SiStripNoisesRcd");      
    }
  }else{
    edm::LogError("SiStripNoisesBuilder")<<"Service is unavailable"<<std::endl;
  }
}

Member Data Documentation

Definition at line 27 of file SiStripNoisesBuilder.h.

Referenced by analyze().

Definition at line 28 of file SiStripNoisesBuilder.h.

Referenced by analyze().