CMS 3D CMS Logo

SiStripPedestalsBuilder.cc
Go to the documentation of this file.
3 #include <iostream>
4 #include <fstream>
5 
7  : fp_(iConfig.getUntrackedParameter<edm::FileInPath>(
8  "file", edm::FileInPath("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"))),
9  printdebug_(iConfig.getUntrackedParameter<uint32_t>("printDebug", 1)) {}
10 
12  unsigned int run = evt.id().run();
13 
14  edm::LogInfo("SiStripPedestalsBuilder")
15  << "... creating dummy SiStripPedestals Data for Run " << run << "\n " << std::endl;
16 
18 
20 
21  const std::map<uint32_t, SiStripDetInfoFileReader::DetInfo>& DetInfos = reader.getAllData();
22 
23  int count = -1;
24  for (std::map<uint32_t, SiStripDetInfoFileReader::DetInfo>::const_iterator it = DetInfos.begin();
25  it != DetInfos.end();
26  it++) {
27  count++;
28  //Generate Pedestal for det detid
29  SiStripPedestals::InputVector theSiStripVector;
30  for (int strip = 0; strip < 128 * it->second.nApvs; ++strip) {
31  float MeanPed = 100;
32  float RmsPed = 5;
33 
34  float ped = CLHEP::RandGauss::shoot(MeanPed, RmsPed);
35 
36  if (count < static_cast<int>(printdebug_))
37  edm::LogInfo("SiStripPedestalsBuilder") << "detid " << it->first << " \t"
38  << " strip " << strip << " \t" << ped << " \t" << std::endl;
39  obj->setData(ped, theSiStripVector);
40  }
41 
42  //SiStripPedestals::Range range(theSiStripVector.begin(),theSiStripVector.end());
43  if (!obj->put(it->first, theSiStripVector))
44  edm::LogError("SiStripPedestalsBuilder")
45  << "[SiStripPedestalsBuilder::analyze] detid already exists" << std::endl;
46  }
47 
48  //End now write sistrippedestals data in DB
50 
51  if (mydbservice.isAvailable()) {
52  if (mydbservice->isNewTagRequest("SiStripPedestalsRcd")) {
53  mydbservice->createNewIOV<SiStripPedestals>(
54  obj, mydbservice->beginOfTime(), mydbservice->endOfTime(), "SiStripPedestalsRcd");
55  } else {
56  //mydbservice->createNewIOV<SiStripPedestals>(obj,mydbservice->currentTime(),"SiStripPedestalsRcd");
57  mydbservice->appendSinceTime<SiStripPedestals>(obj, mydbservice->currentTime(), "SiStripPedestalsRcd");
58  }
59  } else {
60  edm::LogError("SiStripPedestalsBuilder") << "Service is unavailable" << std::endl;
61  }
62 }
cond::service::PoolDBOutputService::beginOfTime
cond::Time_t beginOfTime() const
Definition: PoolDBOutputService.cc:177
edm
HLT enums.
Definition: AlignableModifier.h:19
digitizers_cfi.strip
strip
Definition: digitizers_cfi.py:19
edm::LogInfo
Definition: MessageLogger.h:254
cond::service::PoolDBOutputService::appendSinceTime
void appendSinceTime(const T *payloadObj, cond::Time_t sinceTime, const std::string &recordName)
Definition: PoolDBOutputService.h:132
SiStripDetInfoFileReader
Definition: SiStripDetInfoFileReader.h:30
edm::Service::isAvailable
bool isAvailable() const
Definition: Service.h:40
SiStripPedestalsBuilder::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: SiStripPedestalsBuilder.cc:11
cond::service::PoolDBOutputService::createNewIOV
void createNewIOV(const T *firstPayloadObj, cond::Time_t firstSinceTime, cond::Time_t, const std::string &recordName)
Definition: PoolDBOutputService.h:107
DQM.reader
reader
Definition: DQM.py:105
SiStripDetInfoFileReader.h
edm::EventID::run
RunNumber_t run() const
Definition: EventID.h:38
getGTfromDQMFile.obj
obj
Definition: getGTfromDQMFile.py:32
SiStripPedestalsBuilder::fp_
edm::FileInPath fp_
Definition: SiStripPedestalsBuilder.h:25
edm::ParameterSet
Definition: ParameterSet.h:36
edm::LogError
Definition: MessageLogger.h:183
KineDebug3::count
void count()
Definition: KinematicConstrainedVertexUpdatorT.h:21
edm::Service< cond::service::PoolDBOutputService >
edm::EventSetup
Definition: EventSetup.h:57
SiStripPedestalsBuilder.h
cond::service::PoolDBOutputService::endOfTime
cond::Time_t endOfTime() const
Definition: PoolDBOutputService.cc:175
writedatasetfile.run
run
Definition: writedatasetfile.py:27
edm::EventBase::id
edm::EventID id() const
Definition: EventBase.h:59
cond::service::PoolDBOutputService::isNewTagRequest
bool isNewTagRequest(const std::string &recordName)
Definition: PoolDBOutputService.cc:90
SiStripPedestals::InputVector
std::vector< uint16_t > InputVector
Definition: SiStripPedestals.h:54
SiStripPedestals
Definition: SiStripPedestals.h:27
edm::Event
Definition: Event.h:73
cond::service::PoolDBOutputService::currentTime
cond::Time_t currentTime() const
Definition: PoolDBOutputService.cc:179
edm::FileInPath::fullPath
std::string fullPath() const
Definition: FileInPath.cc:163
SiStripPedestalsBuilder::printdebug_
uint32_t printdebug_
Definition: SiStripPedestalsBuilder.h:26
SiStripPedestalsBuilder::SiStripPedestalsBuilder
SiStripPedestalsBuilder(const edm::ParameterSet &iConfig)
Definition: SiStripPedestalsBuilder.cc:6