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

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
 SiStripSummaryBuilder (const edm::ParameterSet &iConfig)
 
 ~SiStripSummaryBuilder ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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 & itemsToGetFromEvent () 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
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
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 &)
 
- 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 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 17 of file SiStripSummaryBuilder.h.

Constructor & Destructor Documentation

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

Definition at line 6 of file SiStripSummaryBuilder.cc.

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

Definition at line 23 of file SiStripSummaryBuilder.h.

References analyze().

23 {};

Member Function Documentation

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

Definition at line 11 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(), mps_fire::i, iConfig_, edm::EventBase::id(), edm::Service< T >::isAvailable(), cond::service::PoolDBOutputService::isNewTagRequest(), MuonAssociatorByHits_cfi::obj, SiStripSummary::put(), edm::EventID::run(), findQualityFiles::run, SiStripSummary::setRunNr(), SiStripSummary::setUserDBContent(), AlCaHLTBitMon_QueryRunRegistry::string, and MuonErrorMatrixValues_cff::values.

Referenced by ~SiStripSummaryBuilder().

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

Member Data Documentation

edm::FileInPath SiStripSummaryBuilder::fp_
private

Definition at line 28 of file SiStripSummaryBuilder.h.

edm::ParameterSet SiStripSummaryBuilder::iConfig_
private

Definition at line 31 of file SiStripSummaryBuilder.h.

Referenced by analyze().

bool SiStripSummaryBuilder::printdebug_
private

Definition at line 29 of file SiStripSummaryBuilder.h.