CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
SiStripApvGainBuilder Class Reference

#include <SiStripApvGainBuilder.h>

Inheritance diagram for SiStripApvGainBuilder:
edm::EDAnalyzer

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
 SiStripApvGainBuilder (const edm::ParameterSet &iConfig)
 
 ~SiStripApvGainBuilder ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Private Attributes

edm::FileInPath fp_
 
bool printdebug_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

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.

6  :
7  fp_(iConfig.getUntrackedParameter<edm::FileInPath>("file",edm::FileInPath("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"))),
8  printdebug_(iConfig.getUntrackedParameter<uint32_t>("printDebug",1)){}
T getUntrackedParameter(std::string const &, T const &) const
SiStripApvGainBuilder::~SiStripApvGainBuilder ( )
inline

Definition at line 23 of file SiStripApvGainBuilder.h.

23 {};

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 cond::service::PoolDBOutputService::appendSinceTime(), cond::service::PoolDBOutputService::beginOfTime(), prof2calltree::count, cond::service::PoolDBOutputService::createNewIOV(), cond::service::PoolDBOutputService::currentTime(), cond::service::PoolDBOutputService::endOfTime(), fp_, edm::FileInPath::fullPath(), SiStripDetInfoFileReader::getAllData(), edm::EventBase::id(), edm::Service< T >::isAvailable(), cond::service::PoolDBOutputService::isNewTagRequest(), j, VarParsing::obj, printdebug_, SiStripApvGain::put(), edm::EventID::run(), and DTTTrigCorrFirst::run.

10  {
11 
12  unsigned int run=evt.id().run();
13 
14  edm::LogInfo("SiStripApvGainBuilder") << "... creating dummy SiStripApvGain Data for Run " << run << "\n " << std::endl;
15 
17 
19 
20  const std::map<uint32_t, SiStripDetInfoFileReader::DetInfo > DetInfos = reader.getAllData();
21 
22  int count=-1;
23  for(std::map<uint32_t, SiStripDetInfoFileReader::DetInfo >::const_iterator it = DetInfos.begin(); it != DetInfos.end(); it++){
24  count++;
25  //Generate Gain for det detid
26  std::vector<float> theSiStripVector;
27  for(unsigned short j=0; j<it->second.nApvs; j++){
28  float gain= (j+1)*1000+ (CLHEP::RandFlat::shoot(1.)*100);
29  if (count<printdebug_)
30  edm::LogInfo("SiStripApvGainBuilder") << "detid " << it->first << " \t"
31  << " apv " << j << " \t"
32  << gain << " \t"
33  << std::endl;
34  theSiStripVector.push_back(gain);
35  }
36 
37 
38  SiStripApvGain::Range range(theSiStripVector.begin(),theSiStripVector.end());
39  if ( ! obj->put(it->first,range) )
40  edm::LogError("SiStripApvGainBuilder")<<"[SiStripApvGainBuilder::analyze] detid already exists"<<std::endl;
41  }
42 
43 
44  //End now write sistripnoises data in DB
46 
47  if( mydbservice.isAvailable() ){
48  if( mydbservice->isNewTagRequest("SiStripApvGainRcd") ){
49  mydbservice->createNewIOV<SiStripApvGain>(obj,mydbservice->beginOfTime(),mydbservice->endOfTime(),"SiStripApvGainRcd");
50  } else {
51  mydbservice->appendSinceTime<SiStripApvGain>(obj,mydbservice->currentTime(),"SiStripApvGainRcd");
52  }
53  }else{
54  edm::LogError("SiStripApvGainBuilder")<<"Service is unavailable"<<std::endl;
55  }
56 }
RunNumber_t run() const
Definition: EventID.h:42
bool put(const uint32_t &detID, Range input)
const std::map< uint32_t, DetInfo > & getAllData() const
void appendSinceTime(T *payloadObj, cond::Time_t sinceTime, const std::string &recordName, bool withlogging=false)
tuple obj
Example code starts here #.
Definition: VarParsing.py:655
bool isNewTagRequest(const std::string &recordName)
bool isAvailable() const
Definition: Service.h:47
std::pair< ContainerIterator, ContainerIterator > Range
int j
Definition: DBlmapReader.cc:9
void createNewIOV(T *firstPayloadObj, cond::Time_t firstSinceTime, cond::Time_t firstTillTime, const std::string &recordName, bool withlogging=false)
edm::EventID id() const
Definition: EventBase.h:56
std::string fullPath() const
Definition: FileInPath.cc:170

Member Data Documentation

edm::FileInPath SiStripApvGainBuilder::fp_
private

Definition at line 28 of file SiStripApvGainBuilder.h.

Referenced by analyze().

bool SiStripApvGainBuilder::printdebug_
private

Definition at line 29 of file SiStripApvGainBuilder.h.

Referenced by analyze().