CMS 3D CMS Logo

Public Member Functions | Private Attributes

SiStripApvGainBuilder Class Reference

#include <SiStripApvGainBuilder.h>

Inheritance diagram for SiStripApvGainBuilder:
edm::EDAnalyzer

List of all members.

Public Member Functions

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

Private Attributes

edm::FileInPath fp_
bool printdebug_

Detailed Description

Definition at line 17 of file SiStripApvGainBuilder.h.


Constructor & Destructor Documentation

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

Definition at line 6 of file SiStripApvGainBuilder.cc.

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

Definition at line 23 of file SiStripApvGainBuilder.h.

{};

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 10 of file SiStripApvGainBuilder.cc.

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

                                                                                   {

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

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

  SiStripApvGain* obj = new SiStripApvGain();

  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 Gain for det detid
    std::vector<float> theSiStripVector;
    for(unsigned short j=0; j<it->second.nApvs; j++){
      float gain= (j+1)*1000+ (CLHEP::RandFlat::shoot(1.)*100);
      if (count<printdebug_)
        edm::LogInfo("SiStripApvGainBuilder") << "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("SiStripApvGainBuilder")<<"[SiStripApvGainBuilder::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("SiStripApvGainRcd") ){
      mydbservice->createNewIOV<SiStripApvGain>(obj,mydbservice->beginOfTime(),mydbservice->endOfTime(),"SiStripApvGainRcd");      
    } else {
      mydbservice->appendSinceTime<SiStripApvGain>(obj,mydbservice->currentTime(),"SiStripApvGainRcd");      
    }
  }else{
    edm::LogError("SiStripApvGainBuilder")<<"Service is unavailable"<<std::endl;
  }
}

Member Data Documentation

Definition at line 28 of file SiStripApvGainBuilder.h.

Referenced by analyze().

Definition at line 29 of file SiStripApvGainBuilder.h.

Referenced by analyze().