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 }
RunNumber_t run() const
Definition: EventID.h:38
reader
Definition: DQM.py:105
void analyze(const edm::Event &, const edm::EventSetup &) override
void appendSinceTime(T *payloadObj, cond::Time_t sinceTime, const std::string &recordName, bool withlogging=false)
std::vector< uint16_t > InputVector
bool isNewTagRequest(const std::string &recordName)
bool isAvailable() const
Definition: Service.h:40
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 &input)
edm::EventID id() const
Definition: EventBase.h:59
void setData(float ped, InputVector &vped)
HLT enums.
std::string fullPath() const
Definition: FileInPath.cc:163
SiStripPedestalsBuilder(const edm::ParameterSet &iConfig)