CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
SiStripSummaryBuilder Class Reference

#include <SiStripSummaryBuilder.h>

Inheritance diagram for SiStripSummaryBuilder:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
 SiStripSummaryBuilder (const edm::ParameterSet &iConfig)
 
 ~SiStripSummaryBuilder () override
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

edm::FileInPath fp_
 
edm::ParameterSet iConfig_
 
bool printdebug_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 16 of file SiStripSummaryBuilder.h.

Constructor & Destructor Documentation

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

Definition at line 6 of file SiStripSummaryBuilder.cc.

8  "file", edm::FileInPath("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"))),
9  printdebug_(iConfig.getUntrackedParameter<uint32_t>("printDebug", 1)),
10  iConfig_(iConfig) {}
T getUntrackedParameter(std::string const &, T const &) const
edm::ParameterSet iConfig_
SiStripSummaryBuilder::~SiStripSummaryBuilder ( )
inlineoverride

Definition at line 20 of file SiStripSummaryBuilder.h.

References analyze().

20 {};

Member Function Documentation

void SiStripSummaryBuilder::analyze ( const edm::Event evt,
const edm::EventSetup iSetup 
)
override

Definition at line 12 of file SiStripSummaryBuilder.cc.

References cond::service::PoolDBOutputService::appendSinceTime(), cond::service::PoolDBOutputService::beginOfTime(), cond::service::PoolDBOutputService::createNewIOV(), cond::service::PoolDBOutputService::currentTime(), cond::service::PoolDBOutputService::endOfTime(), edm::ParameterSet::getParameter(), SiStripSummary::getUserDBContent(), SiStripBadComponentsDQMServiceTemplate_cfg::histoList, mps_fire::i, iConfig_, edm::EventBase::id(), edm::Service< T >::isAvailable(), cond::service::PoolDBOutputService::isNewTagRequest(), dqmiolumiharvest::j, getGTfromDQMFile::obj, SiStripSummary::put(), writedatasetfile::run, edm::EventID::run(), SiStripSummary::setRunNr(), SiStripSummary::setUserDBContent(), AlCaHLTBitMon_QueryRunRegistry::string, and contentValuesCheck::values.

Referenced by ~SiStripSummaryBuilder().

12  {
13  unsigned int run = evt.id().run();
14  edm::LogInfo("SiStripSummaryBuilder") << "... creating dummy SiStripSummary Data for Run " << run << "\n "
15  << std::endl;
16 
18  obj->setRunNr(run);
19 
20  //* DISCOVER SET OF HISTOGRAMS & QUANTITIES TO BE UPLOADED*//
21 
22  std::vector<std::string> userDBContent;
23  typedef std::vector<edm::ParameterSet> VParameters;
24  VParameters histoList = iConfig_.getParameter<VParameters>("histoList");
25  VParameters::iterator ithistoList = histoList.begin();
26  VParameters::iterator ithistoListEnd = histoList.end();
27 
28  for (; ithistoList != ithistoListEnd; ++ithistoList) {
29  std::string keyName = ithistoList->getUntrackedParameter<std::string>("keyName");
30  std::vector<std::string> Quantities =
31  ithistoList->getUntrackedParameter<std::vector<std::string> >("quantitiesToExtract");
32  for (size_t i = 0; i < Quantities.size(); ++i) {
33  if (Quantities[i] == "landau") {
34  userDBContent.push_back(keyName + std::string("@") + std::string("landauPeak"));
35  userDBContent.push_back(keyName + std::string("@") + std::string("landauPeakErr"));
36  userDBContent.push_back(keyName + std::string("@") + std::string("landauSFWHM"));
37  userDBContent.push_back(keyName + std::string("@") + std::string("landauChi2NDF"));
38  } else if (Quantities[i] == "gauss") {
39  userDBContent.push_back(keyName + std::string("@") + std::string("gaussMean"));
40  userDBContent.push_back(keyName + std::string("@") + std::string("gaussSigma"));
41  userDBContent.push_back(keyName + std::string("@") + std::string("gaussChi2NDF"));
42  } else if (Quantities[i] == "stat") {
43  userDBContent.push_back(keyName + std::string("@") + std::string("entries"));
44  userDBContent.push_back(keyName + std::string("@") + std::string("mean"));
45  userDBContent.push_back(keyName + std::string("@") + std::string("rms"));
46  } else {
47  edm::LogError("SiStripSummaryBuilder")
48  << "Quantity " << Quantities[i] << " cannot be handled\nAllowed quantities are"
49  << "\n 'stat' that includes: entries, mean, rms"
50  << "\n 'landau' that includes: landauPeak, landauPeakErr, landauSFWHM, landauChi2NDF"
51  << "\n 'gauss' that includes: gaussMean, gaussSigma, gaussChi2NDF" << std::endl;
52  }
53  }
54  }
55  obj->setUserDBContent(userDBContent);
56 
57  std::stringstream ss1;
58  ss1 << "QUANTITIES TO BE INSERTED IN DB :"
59  << " \n";
60  std::vector<std::string> userDBContentA = obj->getUserDBContent();
61  for (size_t i = 0; i < userDBContentA.size(); ++i)
62  ss1 << userDBContentA[i] << std::endl;
63  edm::LogInfo("SiStripSummaryBuilder") << ss1.str();
64 
65  //* Loop over detids and create dummy data for each *//
66 
67  std::stringstream ss2;
68  for (uint32_t detid = 0; detid < 430; detid++) {
70  for (unsigned int i = 0; i < userDBContent.size(); i++)
71  values.push_back((float)CLHEP::RandGauss::shoot(50., 30.));
72 
73  ss2 << "\n\tdetid " << detid;
74  for (size_t j = 0; j < values.size(); ++j)
75  ss2 << "\n\t\t " << userDBContent[j] << " " << values[j];
76 
77  obj->put(detid, values, userDBContent);
78 
79  // See CondFormats/SiStripObjects/SiStripSummary.h for detid definitions
80 
81  if (detid == 4)
82  detid = 10;
83  if (detid == 14)
84  detid = 20;
85  if (detid == 26)
86  detid = 30;
87  if (detid == 32)
88  detid = 40;
89  if (detid == 42)
90  detid = 310;
91  if (detid == 313)
92  detid = 320;
93  if (detid == 323)
94  detid = 410;
95  if (detid == 419)
96  detid = 420;
97  }
98 
99  edm::LogInfo("SiStripSummaryBuilder") << ss2.str();
100 
101  //* Insert summary informations in the DB *//
102 
104 
105  if (mydbservice.isAvailable()) {
106  if (mydbservice->isNewTagRequest("SiStripSummaryRcd")) {
107  mydbservice->createNewIOV<SiStripSummary>(
108  obj, mydbservice->beginOfTime(), mydbservice->endOfTime(), "SiStripSummaryRcd");
109  } else {
110  mydbservice->appendSinceTime<SiStripSummary>(obj, mydbservice->currentTime(), "SiStripSummaryRcd");
111  }
112  } else {
113  edm::LogError("SiStripSummaryBuilder") << "Service is unavailable" << std::endl;
114  }
115 }
RunNumber_t run() const
Definition: EventID.h:38
T getParameter(std::string const &) const
void setRunNr(int inputRunNr)
void appendSinceTime(T *payloadObj, cond::Time_t sinceTime, const std::string &recordName, bool withlogging=false)
bool isNewTagRequest(const std::string &recordName)
bool isAvailable() const
Definition: Service.h:40
std::vector< float > InputVector
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, std::vector< std::string > &userContent)
std::vector< std::string > getUserDBContent() const
edm::ParameterSet iConfig_
edm::EventID id() const
Definition: EventBase.h:59
void setUserDBContent(const std::vector< std::string > &userDBContent)

Member Data Documentation

edm::FileInPath SiStripSummaryBuilder::fp_
private

Definition at line 25 of file SiStripSummaryBuilder.h.

edm::ParameterSet SiStripSummaryBuilder::iConfig_
private

Definition at line 28 of file SiStripSummaryBuilder.h.

Referenced by analyze().

bool SiStripSummaryBuilder::printdebug_
private

Definition at line 26 of file SiStripSummaryBuilder.h.