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
SiStripThresholdBuilder Class Reference

#include <SiStripThresholdBuilder.h>

Inheritance diagram for SiStripThresholdBuilder:
edm::EDAnalyzer

Public Member Functions

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

Private Attributes

edm::FileInPath fp_
 
uint32_t 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 SiStripThresholdBuilder.h.

Constructor & Destructor Documentation

SiStripThresholdBuilder::SiStripThresholdBuilder ( const edm::ParameterSet iConfig)
explicit

Definition at line 6 of file SiStripThresholdBuilder.cc.

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

Definition at line 23 of file SiStripThresholdBuilder.h.

23 {};

Member Function Documentation

void SiStripThresholdBuilder::analyze ( const edm::Event evt,
const edm::EventSetup iSetup 
)
virtual

Implements edm::EDAnalyzer.

Definition at line 11 of file SiStripThresholdBuilder.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(), VarParsing::obj, printdebug_, SiStripThreshold::put(), edm::EventID::run(), CrabTask::run, edm::second(), SiStripThreshold::setData(), strip(), and tmp.

11  {
12 
13 
14  unsigned int run=evt.id().run();
15 
16  edm::LogInfo("SiStripThresholdBuilder") << "... creating dummy SiStripThreshold Data for Run " << run << "\n " << std::endl;
17 
19 
21 
22  const std::map<uint32_t, SiStripDetInfoFileReader::DetInfo > DetInfos = reader.getAllData();
23 
24  int count=-1;
25  for(std::map<uint32_t, SiStripDetInfoFileReader::DetInfo >::const_iterator it = DetInfos.begin(); it != DetInfos.end(); it++){
26  count++;
27  //Generate Pedestal for det detid
28  SiStripThreshold::Container theSiStripVector;
29  uint16_t strip=0;
30  while(strip<128*it->second.nApvs){
31 
32  float lTh = (CLHEP::RandFlat::shoot(1.) * 64)/5;
33  float hTh = (CLHEP::RandFlat::shoot(1.) * 64)/5;
34  if (hTh < lTh){
35  float tmp = hTh;
36  hTh = lTh;
37  lTh = tmp;
38  }
39  float cTh = (CLHEP::RandFlat::shoot(1.) * 30.);
40 
41  obj->setData(strip,lTh,hTh,cTh,theSiStripVector);
42  if (count<(int)printdebug_){
43  std::stringstream ss;
44  theSiStripVector.back().print(ss);
45  edm::LogInfo("SiStripThresholdBuilder") <<"detid: " << it->first << " \n"
46  << "firstStrip: " << strip << " \t"
47  << "lTh: " << lTh << " \t"
48  << "hTh: " << hTh << " \t"
49  << "cTh: " << cTh << " \t"
50  << "FirstStrip_and_Hth: " << theSiStripVector.back().FirstStrip_and_Hth << " \n"
51  << ss.str()
52  << std::endl;
53  }
54  obj->setData(strip+1,lTh,hTh,theSiStripVector);
55  strip=(uint16_t) (CLHEP::RandFlat::shoot(strip+2,128*it->second.nApvs));
56  }
57  if ( ! obj->put(it->first,theSiStripVector) )
58  edm::LogError("SiStripThresholdBuilder")<<"[SiStripThresholdBuilder::analyze] detid already exists"<<std::endl;
59  }
60 
61 
62  //End now write sistrippedestals data in DB
64 
65  if( mydbservice.isAvailable() ){
66  if ( mydbservice->isNewTagRequest("SiStripThresholdRcd") ){
67  mydbservice->createNewIOV<SiStripThreshold>(obj,mydbservice->beginOfTime(),mydbservice->endOfTime(),"SiStripThresholdRcd");
68  } else {
69  mydbservice->appendSinceTime<SiStripThreshold>(obj,mydbservice->currentTime(),"SiStripThresholdRcd");
70  }
71  }else{
72  edm::LogError("SiStripThresholdBuilder")<<"Service is unavailable"<<std::endl;
73  }
74 }
RunNumber_t run() const
Definition: EventID.h:42
void strip(std::string &input, const std::string &blanks=" \n\t")
Definition: stringTools.cc:16
U second(std::pair< T, U > const &p)
std::vector< Data > Container
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
void createNewIOV(T *firstPayloadObj, cond::Time_t firstSinceTime, cond::Time_t firstTillTime, const std::string &recordName, bool withlogging=false)
bool put(const uint32_t &detID, InputVector vect)
void setData(const uint16_t &strip, const float &lTh, const float &hTh, Container &vthr)
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
edm::EventID id() const
Definition: EventBase.h:56
std::string fullPath() const
Definition: FileInPath.cc:170

Member Data Documentation

edm::FileInPath SiStripThresholdBuilder::fp_
private

Definition at line 28 of file SiStripThresholdBuilder.h.

Referenced by analyze().

uint32_t SiStripThresholdBuilder::printdebug_
private

Definition at line 29 of file SiStripThresholdBuilder.h.

Referenced by analyze().