CMS 3D CMS Logo

Public Member Functions | Private Attributes

SiStripPedestalsBuilder Class Reference

#include <SiStripPedestalsBuilder.h>

Inheritance diagram for SiStripPedestalsBuilder:
edm::EDAnalyzer

List of all members.

Public Member Functions

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

Private Attributes

edm::FileInPath fp_
uint32_t printdebug_

Detailed Description

Definition at line 17 of file SiStripPedestalsBuilder.h.


Constructor & Destructor Documentation

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

Definition at line 6 of file SiStripPedestalsBuilder.cc.

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

Definition at line 23 of file SiStripPedestalsBuilder.h.

{};

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 11 of file SiStripPedestalsBuilder.cc.

References prof2calltree::count, fp_, edm::FileInPath::fullPath(), SiStripDetInfoFileReader::getAllData(), edm::EventBase::id(), edm::Service< T >::isAvailable(), VarParsing::obj, printdebug_, SiStripPedestals::put(), edm::EventID::run(), DTTTrigCorrFirst::run, SiStripPedestals::setData(), and strip().

                                                                                     {

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

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

  SiStripPedestals* obj = new SiStripPedestals();

  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 Pedestal for det detid
    SiStripPedestals::InputVector theSiStripVector;   
    for(int strip=0; strip<128*it->second.nApvs;++strip){

      float MeanPed   = 100;
      float RmsPed    = 5;

      float ped = CLHEP::RandGauss::shoot(MeanPed,RmsPed);

      if ( count<static_cast<int>(printdebug_))
        edm::LogInfo("SiStripPedestalsBuilder") << "detid "  << it->first << " \t"
                                                << " strip " << strip << " \t"
                                                << ped       << " \t" 
                                                << std::endl;       
      obj->setData(ped,theSiStripVector);
    }

    //SiStripPedestals::Range range(theSiStripVector.begin(),theSiStripVector.end());
    if ( ! obj->put(it->first,theSiStripVector) )
      edm::LogError("SiStripPedestalsBuilder")<<"[SiStripPedestalsBuilder::analyze] detid already exists"<<std::endl;
  }


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

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

Member Data Documentation

Definition at line 28 of file SiStripPedestalsBuilder.h.

Referenced by analyze().

Definition at line 29 of file SiStripPedestalsBuilder.h.

Referenced by analyze().