Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:32:50

0001 #include "DQMServices/Core/interface/DQMStore.h"
0002 #include "Validation/GlobalHits/interface/GlobalHitsTester.h"
0003 
0004 GlobalHitsTester::GlobalHitsTester(const edm::ParameterSet &iPSet)
0005     : fName(""),
0006       verbosity(0),
0007       frequency(0),
0008       vtxunit(0),
0009       label(""),
0010       getAllProvenances(false),
0011       printProvenanceInfo(false),
0012       count(0) {
0013   std::string MsgLoggerCat = "GlobalHitsTester_GlobalHitsTester";
0014 
0015   fName = iPSet.getUntrackedParameter<std::string>("Name");
0016   verbosity = iPSet.getUntrackedParameter<int>("Verbosity");
0017   frequency = iPSet.getUntrackedParameter<int>("Frequency");
0018   vtxunit = iPSet.getUntrackedParameter<int>("VtxUnit");
0019   outputfile = iPSet.getParameter<std::string>("OutputFile");
0020   doOutput = iPSet.getParameter<bool>("DoOutput");
0021   edm::ParameterSet m_Prov = iPSet.getParameter<edm::ParameterSet>("ProvenanceLookup");
0022   getAllProvenances = m_Prov.getUntrackedParameter<bool>("GetAllProvenances");
0023   printProvenanceInfo = m_Prov.getUntrackedParameter<bool>("PrintProvenanceInfo");
0024 
0025   if (verbosity >= 0) {
0026     edm::LogInfo(MsgLoggerCat) << "\n===============================\n"
0027                                << "Initialized as EDAnalyzer with parameter values:\n"
0028                                << "    Name          = " << fName << "\n"
0029                                << "    Verbosity     = " << verbosity << "\n"
0030                                << "    Frequency     = " << frequency << "\n"
0031                                << "    VtxUnit       = " << vtxunit << "\n"
0032                                << "    OutputFile    = " << outputfile << "\n"
0033                                << "    DoOutput      = " << doOutput << "\n"
0034                                << "    GetProv       = " << getAllProvenances << "\n"
0035                                << "    PrintProv     = " << printProvenanceInfo << "\n"
0036                                << "===============================\n";
0037   }
0038 }
0039 
0040 GlobalHitsTester::~GlobalHitsTester() {}
0041 
0042 void GlobalHitsTester::bookHistograms(DQMStore::IBooker &ibooker, edm::Run const &, edm::EventSetup const &) {
0043   meTestString = nullptr;
0044   meTestInt = nullptr;
0045   meTestFloat = nullptr;
0046   meTestTH1F = nullptr;
0047   meTestTH2F = nullptr;
0048   meTestTH3F = nullptr;
0049   meTestProfile1 = nullptr;
0050   meTestProfile2 = nullptr;
0051   Random = new TRandom3();
0052 
0053   ibooker.setCurrentFolder("GlobalTestV/String");
0054   meTestString = ibooker.bookString("TestString", "Hello World");
0055 
0056   ibooker.setCurrentFolder("GlobalTestV/Int");
0057   meTestInt = ibooker.bookInt("TestInt");
0058 
0059   ibooker.setCurrentFolder("GlobalTestV/Float");
0060   meTestFloat = ibooker.bookFloat("TestFloat");
0061 
0062   ibooker.setCurrentFolder("GlobalTestV/TH1F");
0063   meTestTH1F = ibooker.book1D("Random1D", "Random1D", 100, -10., 10.);
0064 
0065   ibooker.setCurrentFolder("GlobalTestV/TH2F");
0066   meTestTH2F = ibooker.book2D("Random2D", "Random2D", 100, -10, 10., 100, -10., 10.);
0067 
0068   ibooker.setCurrentFolder("GlobalTestV/TH3F");
0069   meTestTH3F = ibooker.book3D("Random3D", "Random3D", 100, -10., 10., 100, -10., 10., 100, -10., 10.);
0070 
0071   ibooker.setCurrentFolder("GlobalTestV/TProfile");
0072   meTestProfile1 = ibooker.bookProfile("Profile1", "Profile1", 100, -10., 10., 100, -10., 10.);
0073 
0074   ibooker.setCurrentFolder("GlobalTestV/TProfile2D");
0075   meTestProfile2 = ibooker.bookProfile2D("Profile2", "Profile2", 100, -10., 10., 100, -10, 10., 100, -10., 10.);
0076 }
0077 
0078 void GlobalHitsTester::analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) {
0079   for (int i = 0; i < 1000; ++i) {
0080     RandomVal1 = Random->Gaus(0., 1.);
0081     RandomVal2 = Random->Gaus(0., 1.);
0082     RandomVal3 = Random->Gaus(0., 1.);
0083 
0084     meTestTH1F->Fill(RandomVal1);
0085     meTestTH2F->Fill(RandomVal1, RandomVal2);
0086     meTestTH3F->Fill(RandomVal1, RandomVal2, RandomVal3);
0087     meTestProfile1->Fill(RandomVal1, RandomVal2);
0088     meTestProfile2->Fill(RandomVal1, RandomVal2, RandomVal3);
0089   }
0090 
0091   meTestInt->Fill(100);
0092   meTestFloat->Fill(3.141592);
0093 }