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

#include <GlobalHitsTester.h>

Inheritance diagram for GlobalHitsTester:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginJob (void)
 
virtual void beginRun (const edm::Run &, const edm::EventSetup &)
 
virtual void endJob ()
 
virtual void endRun (const edm::Run &, const edm::EventSetup &)
 
 GlobalHitsTester (const edm::ParameterSet &)
 
virtual ~GlobalHitsTester ()
 
- 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
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

unsigned int count
 
DQMStoredbe
 
bool doOutput
 
std::string fName
 
int frequency
 
bool getAllProvenances
 
std::string label
 
MonitorElementmeTestFloat
 
MonitorElementmeTestInt
 
MonitorElementmeTestProfile1
 
MonitorElementmeTestProfile2
 
MonitorElementmeTestString
 
MonitorElementmeTestTH1F
 
MonitorElementmeTestTH2F
 
MonitorElementmeTestTH3F
 
std::string outputfile
 
bool printProvenanceInfo
 
TRandom * Random
 
double RandomVal1
 
double RandomVal2
 
double RandomVal3
 
int verbosity
 
int vtxunit
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- 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 76 of file GlobalHitsTester.h.

Constructor & Destructor Documentation

GlobalHitsTester::GlobalHitsTester ( const edm::ParameterSet iPSet)
explicit

Definition at line 4 of file GlobalHitsTester.cc.

References DQMStore::book1D(), DQMStore::book2D(), DQMStore::book3D(), DQMStore::bookFloat(), DQMStore::bookInt(), DQMStore::bookProfile(), DQMStore::bookProfile2D(), DQMStore::bookString(), dbe, doOutput, fName, frequency, getAllProvenances, MonitorElement::getFullname(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), meTestFloat, meTestInt, meTestProfile1, meTestProfile2, meTestString, meTestTH1F, meTestTH2F, meTestTH3F, cppFunctionSkipper::operator, outputfile, printProvenanceInfo, DQMStore::setCurrentFolder(), AlCaHLTBitMon_QueryRunRegistry::string, DQMStore::tag(), verbosity, and vtxunit.

4  :
5  fName(""), verbosity(0), frequency(0), vtxunit(0), label(""),
7 {
8  std::string MsgLoggerCat = "GlobalHitsTester_GlobalHitsTester";
9 
10  fName = iPSet.getUntrackedParameter<std::string>("Name");
11  verbosity = iPSet.getUntrackedParameter<int>("Verbosity");
12  frequency = iPSet.getUntrackedParameter<int>("Frequency");
13  vtxunit = iPSet.getUntrackedParameter<int>("VtxUnit");
14  outputfile = iPSet.getParameter<std::string>("OutputFile");
15  doOutput = iPSet.getParameter<bool>("DoOutput");
16  edm::ParameterSet m_Prov =
17  iPSet.getParameter<edm::ParameterSet>("ProvenanceLookup");
19  m_Prov.getUntrackedParameter<bool>("GetAllProvenances");
21  m_Prov.getUntrackedParameter<bool>("PrintProvenanceInfo");
22 
23  if (verbosity >= 0) {
24  edm::LogInfo(MsgLoggerCat)
25  << "\n===============================\n"
26  << "Initialized as EDAnalyzer with parameter values:\n"
27  << " Name = " << fName << "\n"
28  << " Verbosity = " << verbosity << "\n"
29  << " Frequency = " << frequency << "\n"
30  << " VtxUnit = " << vtxunit << "\n"
31  << " OutputFile = " << outputfile << "\n"
32  << " DoOutput = " << doOutput << "\n"
33  << " GetProv = " << getAllProvenances << "\n"
34  << " PrintProv = " << printProvenanceInfo << "\n"
35  << "===============================\n";
36  }
37 
38  dbe = 0;
40 
41  if(dbe){
42  meTestString = 0;
43  meTestInt = 0;
44  meTestFloat = 0;
45  meTestTH1F = 0;
46  meTestTH2F = 0;
47  meTestTH3F = 0;
48  meTestProfile1 = 0;
49  meTestProfile2 = 0;
50  Random = new TRandom3();
51 
52  dbe->setCurrentFolder("GlobalTestV/String");
53  meTestString = dbe->bookString("TestString","Hello World" );
54 
55  dbe->setCurrentFolder("GlobalTestV/Int");
56  meTestInt = dbe->bookInt("TestInt");
57 
58  dbe->setCurrentFolder("GlobalTestV/Float");
59  meTestFloat = dbe->bookFloat("TestFloat");
60 
61  dbe->setCurrentFolder("GlobalTestV/TH1F");
62  meTestTH1F = dbe->book1D("Random1D", "Random1D", 100, -10., 10.);
63 
64  dbe->setCurrentFolder("GlobalTestV/TH2F");
65  meTestTH2F = dbe->book2D("Random2D", "Random2D", 100, -10, 10., 100, -10.,
66  10.);
67 
68  dbe->setCurrentFolder("GlobalTestV/TH3F");
69  meTestTH3F = dbe->book3D("Random3D", "Random3D", 100, -10., 10., 100,
70  -10., 10., 100, -10., 10.);
71 
72  dbe->setCurrentFolder("GlobalTestV/TProfile");
73  meTestProfile1 = dbe->bookProfile("Profile1", "Profile1", 100, -10., 10.,
74  100, -10., 10.);
75 
76  dbe->setCurrentFolder("GlobalTestV/TProfile2D");
77  meTestProfile2 = dbe->bookProfile2D("Profile2", "Profile2", 100, -10.,
78  10., 100, -10, 10., 100, -10., 10.);
79 
88  }
89 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * meTestProfile1
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:971
MonitorElement * book3D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, int nchZ, double lowZ, double highZ)
Book 3D histogram.
Definition: DQMStore.cc:1233
std::string outputfile
MonitorElement * meTestInt
MonitorElement * bookFloat(const char *name)
Book float.
Definition: DQMStore.cc:908
MonitorElement * meTestString
MonitorElement * meTestTH3F
void tag(MonitorElement *me, unsigned int myTag)
Definition: DQMStore.cc:1611
MonitorElement * bookString(const char *name, const char *value)
Book string.
Definition: DQMStore.cc:937
MonitorElement * bookProfile(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, const char *option="s")
Definition: DQMStore.cc:1285
const std::string getFullname(void) const
get full name of ME including Pathname
MonitorElement * meTestProfile2
MonitorElement * meTestTH1F
MonitorElement * meTestFloat
MonitorElement * bookInt(const char *name)
Book int.
Definition: DQMStore.cc:878
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:1099
unsigned int count
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:684
MonitorElement * meTestTH2F
MonitorElement * bookProfile2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, int nchZ, double lowZ, double highZ, const char *option="s")
Definition: DQMStore.cc:1429
GlobalHitsTester::~GlobalHitsTester ( )
virtual

Definition at line 91 of file GlobalHitsTester.cc.

References dbe, doOutput, outputfile, and DQMStore::save().

92 {
93  if (doOutput)
94  if (outputfile.size() != 0 && dbe) dbe->save(outputfile);
95 }
std::string outputfile
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", const uint32_t run=0, const uint32_t lumi=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE", const bool resetMEsAfterWriting=false)
Definition: DQMStore.cc:2562

Member Function Documentation

void GlobalHitsTester::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

Implements edm::EDAnalyzer.

Definition at line 126 of file GlobalHitsTester.cc.

References MonitorElement::Fill(), i, meTestProfile1, meTestProfile2, meTestTH1F, meTestTH2F, meTestTH3F, RandomVal1, RandomVal2, and RandomVal3.

128 {
129 
130  for(int i = 0; i < 1000; ++i) {
131  RandomVal1 = Random->Gaus(0.,1.);
132  RandomVal2 = Random->Gaus(0.,1.);
133  RandomVal3 = Random->Gaus(0.,1.);
134 
140  }
141 }
int i
Definition: DBlmapReader.cc:9
MonitorElement * meTestProfile1
MonitorElement * meTestTH3F
void Fill(long long x)
MonitorElement * meTestProfile2
MonitorElement * meTestTH1F
MonitorElement * meTestTH2F
void GlobalHitsTester::beginJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 97 of file GlobalHitsTester.cc.

98 {
99  return;
100 }
void GlobalHitsTester::beginRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
)
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 111 of file GlobalHitsTester.cc.

113 {
114  return;
115 }
void GlobalHitsTester::endJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 102 of file GlobalHitsTester.cc.

References count, AlCaHLTBitMon_QueryRunRegistry::string, and verbosity.

103 {
104  std::string MsgLoggerCat = "GlobalHitsTester_endJob";
105  if (verbosity >= 0)
106  edm::LogInfo(MsgLoggerCat)
107  << "Terminating having processed " << count << " events.";
108  return;
109 }
unsigned int count
void GlobalHitsTester::endRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
)
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 117 of file GlobalHitsTester.cc.

References MonitorElement::Fill(), meTestFloat, and meTestInt.

119 {
120  meTestInt->Fill(100);
121  meTestFloat->Fill(3.141592);
122 
123  return;
124 }
MonitorElement * meTestInt
void Fill(long long x)
MonitorElement * meTestFloat

Member Data Documentation

unsigned int GlobalHitsTester::count
private

Definition at line 117 of file GlobalHitsTester.h.

Referenced by endJob().

DQMStore* GlobalHitsTester::dbe
private

Definition at line 98 of file GlobalHitsTester.h.

Referenced by GlobalHitsTester(), and ~GlobalHitsTester().

bool GlobalHitsTester::doOutput
private

Definition at line 100 of file GlobalHitsTester.h.

Referenced by GlobalHitsTester(), and ~GlobalHitsTester().

std::string GlobalHitsTester::fName
private

Definition at line 91 of file GlobalHitsTester.h.

Referenced by GlobalHitsTester().

int GlobalHitsTester::frequency
private

Definition at line 93 of file GlobalHitsTester.h.

Referenced by GlobalHitsTester().

bool GlobalHitsTester::getAllProvenances
private

Definition at line 96 of file GlobalHitsTester.h.

Referenced by GlobalHitsTester().

std::string GlobalHitsTester::label
private
MonitorElement* GlobalHitsTester::meTestFloat
private

Definition at line 104 of file GlobalHitsTester.h.

Referenced by endRun(), and GlobalHitsTester().

MonitorElement* GlobalHitsTester::meTestInt
private

Definition at line 103 of file GlobalHitsTester.h.

Referenced by endRun(), and GlobalHitsTester().

MonitorElement* GlobalHitsTester::meTestProfile1
private

Definition at line 108 of file GlobalHitsTester.h.

Referenced by analyze(), and GlobalHitsTester().

MonitorElement* GlobalHitsTester::meTestProfile2
private

Definition at line 109 of file GlobalHitsTester.h.

Referenced by analyze(), and GlobalHitsTester().

MonitorElement* GlobalHitsTester::meTestString
private

Definition at line 102 of file GlobalHitsTester.h.

Referenced by GlobalHitsTester().

MonitorElement* GlobalHitsTester::meTestTH1F
private

Definition at line 105 of file GlobalHitsTester.h.

Referenced by analyze(), and GlobalHitsTester().

MonitorElement* GlobalHitsTester::meTestTH2F
private

Definition at line 106 of file GlobalHitsTester.h.

Referenced by analyze(), and GlobalHitsTester().

MonitorElement* GlobalHitsTester::meTestTH3F
private

Definition at line 107 of file GlobalHitsTester.h.

Referenced by analyze(), and GlobalHitsTester().

std::string GlobalHitsTester::outputfile
private

Definition at line 99 of file GlobalHitsTester.h.

Referenced by GlobalHitsTester(), and ~GlobalHitsTester().

bool GlobalHitsTester::printProvenanceInfo
private

Definition at line 97 of file GlobalHitsTester.h.

Referenced by GlobalHitsTester().

TRandom* GlobalHitsTester::Random
private

Definition at line 111 of file GlobalHitsTester.h.

double GlobalHitsTester::RandomVal1
private

Definition at line 112 of file GlobalHitsTester.h.

Referenced by analyze().

double GlobalHitsTester::RandomVal2
private

Definition at line 113 of file GlobalHitsTester.h.

Referenced by analyze().

double GlobalHitsTester::RandomVal3
private

Definition at line 114 of file GlobalHitsTester.h.

Referenced by analyze().

int GlobalHitsTester::verbosity
private

Definition at line 92 of file GlobalHitsTester.h.

Referenced by endJob(), and GlobalHitsTester().

int GlobalHitsTester::vtxunit
private

Definition at line 94 of file GlobalHitsTester.h.

Referenced by GlobalHitsTester().