CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
GlobalHitsTester.cc
Go to the documentation of this file.
3 
5  fName(""), verbosity(0), frequency(0), vtxunit(0), label(""),
6  getAllProvenances(false), printProvenanceInfo(false), count(0)
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 }
90 
92 {
93  if (doOutput)
94  if (outputfile.size() != 0 && dbe) dbe->save(outputfile);
95 }
96 
98 {
99  return;
100 }
101 
103 {
104  std::string MsgLoggerCat = "GlobalHitsTester_endJob";
105  if (verbosity >= 0)
106  edm::LogInfo(MsgLoggerCat)
107  << "Terminating having processed " << count << " events.";
108  return;
109 }
110 
112  const edm::EventSetup& iSetup)
113 {
114  return;
115 }
116 
118  const edm::EventSetup& iSetup)
119 {
120  meTestInt->Fill(100);
121  meTestFloat->Fill(3.141592);
122 
123  return;
124 }
125 
127  const edm::EventSetup& iSetup)
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 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
MonitorElement * meTestProfile1
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:942
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:1204
std::string outputfile
MonitorElement * meTestInt
MonitorElement * bookFloat(const char *name)
Book float.
Definition: DQMStore.cc:879
MonitorElement * meTestString
virtual void analyze(const edm::Event &, const edm::EventSetup &)
MonitorElement * meTestTH3F
void Fill(long long x)
void tag(MonitorElement *me, unsigned int myTag)
Definition: DQMStore.cc:1582
virtual void endJob()
virtual void beginRun(const edm::Run &, const edm::EventSetup &)
int iEvent
Definition: GenABIO.cc:230
MonitorElement * bookString(const char *name, const char *value)
Book string.
Definition: DQMStore.cc:908
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:1256
virtual void beginJob(void)
const std::string getFullname(void) const
get full name of ME including Pathname
MonitorElement * meTestProfile2
virtual void endRun(const edm::Run &, const edm::EventSetup &)
virtual ~GlobalHitsTester()
MonitorElement * meTestTH1F
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:2490
volatile std::atomic< bool > shutdown_flag false
MonitorElement * meTestFloat
MonitorElement * bookInt(const char *name)
Book int.
Definition: DQMStore.cc:849
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:1070
GlobalHitsTester(const edm::ParameterSet &)
unsigned int count
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:655
MonitorElement * meTestTH2F
Definition: Run.h:41
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:1400