CMS 3D CMS Logo

ConverterTester.cc
Go to the documentation of this file.
2 
4  std::string MsgLoggerCat = "ConverterTester_ConverterTester";
5 
6  fName = iPSet.getUntrackedParameter<std::string>("Name");
7  verbosity = iPSet.getUntrackedParameter<int>("Verbosity");
8  frequency = iPSet.getUntrackedParameter<int>("Frequency");
9 
10  if (verbosity >= 0) {
11  edm::LogInfo(MsgLoggerCat) << "\n===============================\n"
12  << "Initialized as EDAnalyzer with parameter values:\n"
13  << " Name = " << fName << "\n"
14  << " Verbosity = " << verbosity << "\n"
15  << " Frequency = " << frequency << "\n"
16  << "===============================\n";
17  }
18 
19  dbe = nullptr;
21 
22  count = 0;
23 }
24 
26 
28  if (dbe) {
29  meTestString = nullptr;
30  meTestInt = nullptr;
31  meTestFloat = nullptr;
32  meTestTH1FN = nullptr;
33  meTestTH1FD = nullptr;
34  meTestTH2F = nullptr;
35  meTestTH3F = nullptr;
36  meTestProfile1 = nullptr;
37  meTestProfile2 = nullptr;
38  Random = new TRandom3();
39 
40  dbe->setCurrentFolder("ConverterTest/String");
41  meTestString = dbe->bookString("TestString", "Test String");
42 
43  dbe->setCurrentFolder("ConverterTest/Int");
44  meTestInt = dbe->bookInt("TestInt");
45 
46  dbe->setCurrentFolder("ConverterTest/Float");
47  meTestFloat = dbe->bookFloat("TestFloat");
48 
49  dbe->setCurrentFolder("ConverterTest/TH1F");
50  meTestTH1FN = dbe->book1D("Random1DN", "Random1D Numerator", 100, -10., 10.);
51  meTestTH1FD = dbe->book1D("Random1DD", "Random1D Denominator", 100, -10., 10.);
52 
53  dbe->setCurrentFolder("ConverterTest/TH2F");
54  meTestTH2F = dbe->book2D("Random2D", "Random2D", 100, -10, 10., 100, -10., 10.);
55 
56  dbe->setCurrentFolder("ConverterTest/TH3F");
57  meTestTH3F = dbe->book3D("Random3D", "Random3D", 100, -10., 10., 100, -10., 10., 100, -10., 10.);
58 
59  dbe->setCurrentFolder("ConverterTest/TProfile");
60  meTestProfile1 = dbe->bookProfile("Profile1", "Profile1", 100, -10., 10., 100, -10., 10.);
61 
62  dbe->setCurrentFolder("ConverterTest/TProfile2D");
63  meTestProfile2 = dbe->bookProfile2D("Profile2", "Profile2", 100, -10., 10., 100, -10, 10., 100, -10., 10.);
64 
67  dbe->tag(meTestTH2F->getFullname(), 3);
68  dbe->tag(meTestTH3F->getFullname(), 4);
72  dbe->tag(meTestInt->getFullname(), 8);
74  }
75 
76  return;
77 }
78 
80  std::string MsgLoggerCat = "ConverterTester_endJob";
81  if (verbosity >= 0)
82  edm::LogInfo(MsgLoggerCat) << "Terminating having processed " << count << " events.";
83  return;
84 }
85 
86 void ConverterTester::beginRun(const edm::Run &iRun, const edm::EventSetup &iSetup) { return; }
87 
88 void ConverterTester::endRun(const edm::Run &iRun, const edm::EventSetup &iSetup) {
89  meTestInt->Fill(100);
90  meTestFloat->Fill(3.141592);
91 
92  return;
93 }
94 
96  ++count;
97 
98  for (int i = 0; i < 1000; ++i) {
99  RandomVal1 = Random->Gaus(0., 1.);
100  RandomVal2 = Random->Gaus(0., 1.);
101  RandomVal3 = Random->Gaus(0., 1.);
102 
103  meTestTH1FN->Fill(0.5 * RandomVal1);
109  }
110 }
MonitorElement * book2D(char_string const &name, char_string const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:1173
MonitorElement * bookProfile2D(char_string const &name, char_string const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, double lowZ, double highZ, char const *option="s")
Definition: DQMStore.cc:1379
void endJob() override
ConverterTester(const edm::ParameterSet &)
T getUntrackedParameter(std::string const &, T const &) const
void analyze(const edm::Event &, const edm::EventSetup &) override
MonitorElement * meTestTH3F
MonitorElement * meTestString
MonitorElement * bookInt(char_string const &name)
Book int.
Definition: DQMStore.cc:1027
MonitorElement * book1D(char_string const &name, char_string const &title, int const nchX, double const lowX, double const highX)
Book 1D histogram.
Definition: DQMStore.cc:1098
MonitorElement * bookFloat(char_string const &name)
Book float.
Definition: DQMStore.cc:1048
void Fill(long long x)
MonitorElement * meTestTH2F
void tag(MonitorElement *me, unsigned int myTag)
Definition: DQMStore.cc:1500
MonitorElement * meTestFloat
int iEvent
Definition: GenABIO.cc:224
MonitorElement * meTestTH1FN
void endRun(const edm::Run &, const edm::EventSetup &) override
~ConverterTester() override
unsigned int count
void beginRun(const edm::Run &, const edm::EventSetup &) override
MonitorElement * bookString(char_string const &name, char_string const &value)
Book string.
Definition: DQMStore.cc:1069
const std::string getFullname() const
get full name of ME including Pathname
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:571
MonitorElement * bookProfile(char_string const &name, char_string const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, char const *option="s")
Definition: DQMStore.cc:1285
MonitorElement * meTestProfile1
MonitorElement * meTestProfile2
MonitorElement * meTestTH1FD
MonitorElement * book3D(char_string const &name, char_string const &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:1253
MonitorElement * meTestInt
void beginJob() override
std::string fName
Definition: Run.h:45