CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC2/src/DQM/L1TMonitor/src/L1ExtraDQM.cc

Go to the documentation of this file.
00001 
00017 // this class header
00018 #include "DQM/L1TMonitor/interface/L1ExtraDQM.h"
00019 
00020 // system include files
00021 #include <iostream>
00022 #include <iomanip>
00023 #include <memory>
00024 #include <string>
00025 
00026 // user include files
00027 #include "FWCore/Framework/interface/MakerMacros.h"
00028 
00029 
00030 // constructor
00031 L1ExtraDQM::L1ExtraDQM(const edm::ParameterSet& paramSet) :
00032     //
00033     m_retrieveL1Extra(paramSet.getParameter<edm::ParameterSet>("L1ExtraInputTags")),
00034     m_dirName(paramSet.getUntrackedParameter("DirName", std::string(
00035                     "L1T/L1ExtraDQM"))),
00036     //
00037     m_nrBxInEventGmt(paramSet.getParameter<int>("NrBxInEventGmt")),
00038     m_nrBxInEventGct(paramSet.getParameter<int>("NrBxInEventGct")),
00039     //
00040     m_dbe(0), m_resetModule(true), m_currentRun(-99),
00041     //
00042     m_nrEvJob(0),
00043     m_nrEvRun(0)
00044 
00045     {
00046 
00047 
00048     //
00049     if ((m_nrBxInEventGmt > 0) && ((m_nrBxInEventGmt % 2) == 0)) {
00050         m_nrBxInEventGmt = m_nrBxInEventGmt - 1;
00051 
00052         edm::LogInfo("L1ExtraDQM")
00053                 << "\nWARNING: Number of bunch crossing to be monitored for GMT rounded to: "
00054                 << m_nrBxInEventGmt
00055                 << "\n         The number must be an odd number!\n"
00056                 << std::endl;
00057     }
00058 
00059     if ((m_nrBxInEventGct > 0) && ((m_nrBxInEventGct % 2) == 0)) {
00060         m_nrBxInEventGct = m_nrBxInEventGct - 1;
00061 
00062         edm::LogInfo("L1ExtraDQM")
00063                 << "\nWARNING: Number of bunch crossing to be monitored for GCT rounded to: "
00064                 << m_nrBxInEventGct
00065                 << "\n         The number must be an odd number!\n"
00066                 << std::endl;
00067     }
00068 
00069     //
00070     m_meAnalysisL1ExtraMuon.reserve(m_nrBxInEventGmt);
00071     m_meAnalysisL1ExtraIsoEG.reserve(m_nrBxInEventGct);
00072     m_meAnalysisL1ExtraNoIsoEG.reserve(m_nrBxInEventGct);
00073     m_meAnalysisL1ExtraCenJet.reserve(m_nrBxInEventGct);
00074     m_meAnalysisL1ExtraForJet.reserve(m_nrBxInEventGct);
00075     m_meAnalysisL1ExtraTauJet.reserve(m_nrBxInEventGct);
00076     m_meAnalysisL1ExtraETT.reserve(m_nrBxInEventGct);
00077     m_meAnalysisL1ExtraETM.reserve(m_nrBxInEventGct);
00078     m_meAnalysisL1ExtraHTT.reserve(m_nrBxInEventGct);
00079     m_meAnalysisL1ExtraHTM.reserve(m_nrBxInEventGct);
00080     m_meAnalysisL1ExtraHfBitCounts.reserve(m_nrBxInEventGct);
00081     m_meAnalysisL1ExtraHfRingEtSums.reserve(m_nrBxInEventGct);
00082 
00083     m_dbe = edm::Service<DQMStore>().operator->();
00084     if (m_dbe == 0) {
00085         edm::LogInfo("L1ExtraDQM") << "\n Unable to get DQMStore service.";
00086     } else {
00087 
00088         if (paramSet.getUntrackedParameter<bool> ("DQMStore", false)) {
00089             m_dbe->setVerbose(0);
00090         }
00091 
00092         m_dbe->setCurrentFolder(m_dirName);
00093 
00094     }
00095 
00096 }
00097 
00098 // destructor
00099 L1ExtraDQM::~L1ExtraDQM() {
00100 
00101     // empty
00102 
00103 }
00104 
00105 void L1ExtraDQM::analyzeL1ExtraMuon(const edm::Event& iEvent,
00106         const edm::EventSetup& evSetup) {
00107 
00108     bool bookEta = true;
00109     bool bookPhi = true;
00110 
00111     bool isL1Coll = true;
00112 
00113     for (int iBxInEvent = 0; iBxInEvent < m_nrBxInEventGmt; ++iBxInEvent) {
00114 
00115         // convert to actual convention used in the hardware
00116         // (from [o, m_nrBxInEventGmt] -> [-X, 0, +X]
00117         int bxInEvent = iBxInEvent + (m_nrBxInEventGmt + 1) / 2
00118                 - m_nrBxInEventGmt;
00119 
00120         (m_meAnalysisL1ExtraMuon.at(iBxInEvent))->fillNrObjects(
00121                 m_retrieveL1Extra.l1ExtraMuon(),
00122                 m_retrieveL1Extra.validL1ExtraMuon(), isL1Coll, bxInEvent);
00123         (m_meAnalysisL1ExtraMuon.at(iBxInEvent))->fillPtPhiEta(
00124                 m_retrieveL1Extra.l1ExtraMuon(),
00125                 m_retrieveL1Extra.validL1ExtraMuon(), bookPhi, bookEta,
00126                 isL1Coll, bxInEvent);
00127 
00128     }
00129 
00130 }
00131 
00132 void L1ExtraDQM::analyzeL1ExtraIsoEG(const edm::Event& iEvent,
00133         const edm::EventSetup& evSetup) {
00134 
00135     bool bookEta = true;
00136     bool bookPhi = true;
00137 
00138     bool isL1Coll = true;
00139 
00140     for (int iBxInEvent = 0; iBxInEvent < m_nrBxInEventGct; ++iBxInEvent) {
00141 
00142         // convert to actual convention used in the hardware
00143         // (from [o, m_nrBxInEventGct] -> [-X, 0, +X]
00144         int bxInEvent = iBxInEvent + (m_nrBxInEventGct + 1) / 2
00145                 - m_nrBxInEventGct;
00146 
00147         (m_meAnalysisL1ExtraIsoEG.at(iBxInEvent))->fillNrObjects(
00148                 m_retrieveL1Extra.l1ExtraIsoEG(),
00149                 m_retrieveL1Extra.validL1ExtraIsoEG(), isL1Coll, bxInEvent);
00150         (m_meAnalysisL1ExtraIsoEG.at(iBxInEvent))->fillPtPhiEta(
00151                 m_retrieveL1Extra.l1ExtraIsoEG(),
00152                 m_retrieveL1Extra.validL1ExtraIsoEG(), bookPhi, bookEta,
00153                 isL1Coll, bxInEvent);
00154     }
00155 
00156 }
00157 
00158 void L1ExtraDQM::analyzeL1ExtraNoIsoEG(const edm::Event& iEvent,
00159         const edm::EventSetup& evSetup) {
00160 
00161     bool bookEta = true;
00162     bool bookPhi = true;
00163 
00164     bool isL1Coll = true;
00165 
00166     for (int iBxInEvent = 0; iBxInEvent < m_nrBxInEventGct; ++iBxInEvent) {
00167 
00168         // convert to actual convention used in the hardware
00169         // (from [o, m_nrBxInEventGct] -> [-X, 0, +X]
00170         int bxInEvent = iBxInEvent + (m_nrBxInEventGct + 1) / 2
00171                 - m_nrBxInEventGct;
00172 
00173         (m_meAnalysisL1ExtraNoIsoEG.at(iBxInEvent))->fillNrObjects(
00174                 m_retrieveL1Extra.l1ExtraNoIsoEG(),
00175                 m_retrieveL1Extra.validL1ExtraNoIsoEG(), isL1Coll, bxInEvent);
00176         (m_meAnalysisL1ExtraNoIsoEG.at(iBxInEvent))->fillPtPhiEta(
00177                 m_retrieveL1Extra.l1ExtraNoIsoEG(),
00178                 m_retrieveL1Extra.validL1ExtraNoIsoEG(), bookPhi, bookEta,
00179                 isL1Coll, bxInEvent);
00180     }
00181 
00182 }
00183 
00184 void L1ExtraDQM::analyzeL1ExtraCenJet(const edm::Event& iEvent,
00185         const edm::EventSetup& evSetup) {
00186 
00187     bool bookEta = true;
00188     bool bookPhi = true;
00189 
00190     bool isL1Coll = true;
00191 
00192     for (int iBxInEvent = 0; iBxInEvent < m_nrBxInEventGct; ++iBxInEvent) {
00193 
00194         // convert to actual convention used in the hardware
00195         // (from [o, m_nrBxInEventGct] -> [-X, 0, +X]
00196         int bxInEvent = iBxInEvent + (m_nrBxInEventGct + 1) / 2
00197                 - m_nrBxInEventGct;
00198 
00199         (m_meAnalysisL1ExtraCenJet.at(iBxInEvent))->fillNrObjects(
00200                 m_retrieveL1Extra.l1ExtraCenJet(),
00201                 m_retrieveL1Extra.validL1ExtraCenJet(), isL1Coll, bxInEvent);
00202         (m_meAnalysisL1ExtraCenJet.at(iBxInEvent))->fillEtPhiEta(
00203                 m_retrieveL1Extra.l1ExtraCenJet(),
00204                 m_retrieveL1Extra.validL1ExtraCenJet(), bookPhi, bookEta,
00205                 isL1Coll, bxInEvent);
00206     }
00207 
00208 }
00209 
00210 
00211 void L1ExtraDQM::analyzeL1ExtraForJet(const edm::Event& iEvent,
00212         const edm::EventSetup& evSetup) {
00213 
00214     bool bookPhi = true;
00215     bool bookEta = true;
00216 
00217     bool isL1Coll = true;
00218 
00219     for (int iBxInEvent = 0; iBxInEvent < m_nrBxInEventGct; ++iBxInEvent) {
00220 
00221         // convert to actual convention used in the hardware
00222         // (from [o, m_nrBxInEventGct] -> [-X, 0, +X]
00223         int bxInEvent = iBxInEvent + (m_nrBxInEventGct + 1) / 2
00224                 - m_nrBxInEventGct;
00225 
00226         (m_meAnalysisL1ExtraForJet.at(iBxInEvent))->fillNrObjects(
00227                 m_retrieveL1Extra.l1ExtraForJet(),
00228                 m_retrieveL1Extra.validL1ExtraForJet(), isL1Coll, bxInEvent);
00229         (m_meAnalysisL1ExtraForJet.at(iBxInEvent))->fillEtPhiEta(
00230                 m_retrieveL1Extra.l1ExtraForJet(),
00231                 m_retrieveL1Extra.validL1ExtraForJet(), bookPhi, bookEta,
00232                 isL1Coll, bxInEvent);
00233     }
00234 
00235 }
00236 
00237 void L1ExtraDQM::analyzeL1ExtraTauJet(const edm::Event& iEvent,
00238         const edm::EventSetup& evSetup) {
00239 
00240     bool bookPhi = true;
00241     bool bookEta = true;
00242 
00243     bool isL1Coll = true;
00244 
00245     for (int iBxInEvent = 0; iBxInEvent < m_nrBxInEventGct; ++iBxInEvent) {
00246 
00247         // convert to actual convention used in the hardware
00248         // (from [o, m_nrBxInEventGct] -> [-X, 0, +X]
00249         int bxInEvent = iBxInEvent + (m_nrBxInEventGct + 1) / 2
00250                 - m_nrBxInEventGct;
00251 
00252         (m_meAnalysisL1ExtraTauJet.at(iBxInEvent))->fillNrObjects(
00253                 m_retrieveL1Extra.l1ExtraTauJet(),
00254                 m_retrieveL1Extra.validL1ExtraTauJet(), isL1Coll, bxInEvent);
00255         (m_meAnalysisL1ExtraTauJet.at(iBxInEvent))->fillEtPhiEta(
00256                 m_retrieveL1Extra.l1ExtraTauJet(),
00257                 m_retrieveL1Extra.validL1ExtraTauJet(), bookPhi, bookEta,
00258                 isL1Coll, bxInEvent);
00259     }
00260 
00261 }
00262 
00263 void L1ExtraDQM::analyzeL1ExtraETT(const edm::Event& iEvent,
00264         const edm::EventSetup& evSetup) {
00265 
00266     bool isL1Coll = true;
00267 
00268     for (int iBxInEvent = 0; iBxInEvent < m_nrBxInEventGct; ++iBxInEvent) {
00269 
00270         // convert to actual convention used in the hardware
00271         // (from [o, m_nrBxInEventGct] -> [-X, 0, +X]
00272         int bxInEvent = iBxInEvent + (m_nrBxInEventGct + 1) / 2
00273                 - m_nrBxInEventGct;
00274 
00275         (m_meAnalysisL1ExtraETT.at(iBxInEvent))->fillEtTotal(m_retrieveL1Extra.l1ExtraETT(),
00276                 m_retrieveL1Extra.validL1ExtraETT(), isL1Coll, bxInEvent);
00277 
00278     }
00279 
00280 }
00281 
00282 void L1ExtraDQM::analyzeL1ExtraETM(const edm::Event& iEvent,
00283         const edm::EventSetup& evSetup) {
00284 
00285     bool bookPhi = true;
00286     bool bookEta = false;
00287 
00288     bool isL1Coll = true;
00289 
00290     for (int iBxInEvent = 0; iBxInEvent < m_nrBxInEventGct; ++iBxInEvent) {
00291 
00292         // convert to actual convention used in the hardware
00293         // (from [o, m_nrBxInEventGct] -> [-X, 0, +X]
00294         int bxInEvent = iBxInEvent + (m_nrBxInEventGct + 1) / 2
00295                 - m_nrBxInEventGct;
00296 
00297         (m_meAnalysisL1ExtraETM.at(iBxInEvent))->fillEtPhiEta(m_retrieveL1Extra.l1ExtraETM(),
00298                 m_retrieveL1Extra.validL1ExtraETM(), bookPhi, bookEta,
00299                 isL1Coll, bxInEvent);
00300 
00301     }
00302 
00303 }
00304 
00305 void L1ExtraDQM::analyzeL1ExtraHTT(const edm::Event& iEvent,
00306         const edm::EventSetup& evSetup) {
00307 
00308     bool isL1Coll = true;
00309 
00310     for (int iBxInEvent = 0; iBxInEvent < m_nrBxInEventGct; ++iBxInEvent) {
00311 
00312         // convert to actual convention used in the hardware
00313         // (from [o, m_nrBxInEventGct] -> [-X, 0, +X]
00314         int bxInEvent = iBxInEvent + (m_nrBxInEventGct + 1) / 2
00315                 - m_nrBxInEventGct;
00316 
00317         (m_meAnalysisL1ExtraHTT.at(iBxInEvent))->fillEtTotal(m_retrieveL1Extra.l1ExtraHTT(),
00318                 m_retrieveL1Extra.validL1ExtraHTT(), isL1Coll, bxInEvent);
00319 
00320     }
00321 }
00322 
00323 void L1ExtraDQM::analyzeL1ExtraHTM(const edm::Event& iEvent,
00324         const edm::EventSetup& evSetup) {
00325 
00326     bool bookPhi = true;
00327     bool bookEta = false;
00328 
00329     bool isL1Coll = true;
00330 
00331     for (int iBxInEvent = 0; iBxInEvent < m_nrBxInEventGct; ++iBxInEvent) {
00332 
00333         // convert to actual convention used in the hardware
00334         // (from [o, m_nrBxInEventGct] -> [-X, 0, +X]
00335         int bxInEvent = iBxInEvent + (m_nrBxInEventGct + 1) / 2
00336                 - m_nrBxInEventGct;
00337 
00338         (m_meAnalysisL1ExtraHTM.at(iBxInEvent))->fillEtPhiEta(m_retrieveL1Extra.l1ExtraHTM(),
00339                 m_retrieveL1Extra.validL1ExtraHTM(), bookPhi, bookEta,
00340                 isL1Coll, bxInEvent);
00341     }
00342 
00343 }
00344 
00345 void L1ExtraDQM::analyzeL1ExtraHfBitCounts(const edm::Event& iEvent,
00346         const edm::EventSetup& evSetup) {
00347 
00348     bool isL1Coll = true;
00349 
00350     for (int iBxInEvent = 0; iBxInEvent < m_nrBxInEventGct; ++iBxInEvent) {
00351 
00352         // convert to actual convention used in the hardware
00353         // (from [o, m_nrBxInEventGct] -> [-X, 0, +X]
00354         int bxInEvent = iBxInEvent + (m_nrBxInEventGct + 1) / 2
00355                 - m_nrBxInEventGct;
00356 
00357         for (int iCount = 0; iCount < l1extra::L1HFRings::kNumRings; ++iCount) {
00358             (m_meAnalysisL1ExtraHfBitCounts.at(iBxInEvent))->fillHfBitCounts(
00359                     m_retrieveL1Extra.l1ExtraHfBitCounts(),
00360                     m_retrieveL1Extra.validL1ExtraHfBitCounts(), iCount,
00361                     isL1Coll, bxInEvent);
00362         }
00363     }
00364 
00365 }
00366 
00367 void L1ExtraDQM::analyzeL1ExtraHfRingEtSums(const edm::Event& iEvent,
00368         const edm::EventSetup& evSetup) {
00369 
00370     bool isL1Coll = true;
00371 
00372     for (int iBxInEvent = 0; iBxInEvent < m_nrBxInEventGct; ++iBxInEvent) {
00373 
00374         // convert to actual convention used in the hardware
00375         // (from [o, m_nrBxInEventGct] -> [-X, 0, +X]
00376         int bxInEvent = iBxInEvent + (m_nrBxInEventGct + 1) / 2
00377                 - m_nrBxInEventGct;
00378 
00379         for (int iCount = 0; iCount < l1extra::L1HFRings::kNumRings; ++iCount) {
00380             (m_meAnalysisL1ExtraHfRingEtSums.at(iBxInEvent))->fillHfRingEtSums(
00381                     m_retrieveL1Extra.l1ExtraHfRingEtSums(),
00382                     m_retrieveL1Extra.validL1ExtraHfRingEtSums(), iCount,
00383                     isL1Coll, bxInEvent);
00384         }
00385     }
00386 
00387 }
00388 
00389 //
00390 void L1ExtraDQM::beginJob() {
00391 
00392 
00393 }
00394 
00395 
00396 void L1ExtraDQM::beginRun(const edm::Run& iRun, const edm::EventSetup& evSetup) {
00397 
00398     m_nrEvRun = 0;
00399 
00400     DQMStore* dbe = 0;
00401     dbe = edm::Service<DQMStore>().operator->();
00402 
00403     // clean up directory
00404     if (dbe) {
00405         dbe->setCurrentFolder(m_dirName);
00406         if (dbe->dirExists(m_dirName)) {
00407             dbe->rmdir(m_dirName);
00408         }
00409         dbe->setCurrentFolder(m_dirName);
00410     }
00411 
00412     std::vector<L1GtObject> l1Obj;
00413 
00414     // define standard sets of histograms
00415 
00416     //
00417     l1Obj.clear();
00418     l1Obj.push_back(Mu);
00419     int nrMonElements = 5;
00420 
00421     for (int iBxInEvent = 0; iBxInEvent < m_nrBxInEventGmt; ++iBxInEvent) {
00422 
00423         m_meAnalysisL1ExtraMuon.push_back(new L1ExtraDQM::L1ExtraMonElement<
00424                 l1extra::L1MuonParticleCollection>(evSetup, nrMonElements));
00425 
00426         // convert to actual convention used in the hardware
00427         // (from [o, m_nrBxInEventGct] -> [-X, 0, +X]
00428         // write it in hex [..., E, F, 0, 1, 2, ...]
00429         int bxInEvent = iBxInEvent + (m_nrBxInEventGct + 1) / 2
00430                 - m_nrBxInEventGct;
00431         int bxInEventHex = (bxInEvent+ 16) % 16;
00432 
00433         std::stringstream ss;
00434         std::string bxInEventHexString;
00435         ss << std::uppercase << std::hex << bxInEventHex;
00436         ss >> bxInEventHexString;
00437 
00438         if (m_dbe) {
00439             dbe->setCurrentFolder(m_dirName + "/BxInEvent_"
00440                     + bxInEventHexString);
00441         }
00442 
00443         (m_meAnalysisL1ExtraMuon.at(iBxInEvent))->bookHistograms(evSetup, m_dbe,
00444                 "L1_Mu", l1Obj);
00445 
00446     }
00447 
00448     //
00449     l1Obj.clear();
00450     l1Obj.push_back(IsoEG);
00451     nrMonElements = 4;
00452 
00453     for (int iBxInEvent = 0; iBxInEvent < m_nrBxInEventGct; ++iBxInEvent) {
00454 
00455         m_meAnalysisL1ExtraIsoEG.push_back(new L1ExtraDQM::L1ExtraMonElement<
00456                 l1extra::L1EmParticleCollection>(evSetup, nrMonElements));
00457 
00458         // convert to actual convention used in the hardware
00459         // (from [o, m_nrBxInEventGct] -> [-X, 0, +X]
00460         // write it in hex [..., E, F, 0, 1, 2, ...]
00461         int bxInEvent = iBxInEvent + (m_nrBxInEventGct + 1) / 2
00462                 - m_nrBxInEventGct;
00463         int bxInEventHex = (bxInEvent+ 16) % 16;
00464 
00465         std::stringstream ss;
00466         std::string bxInEventHexString;
00467         ss << std::uppercase << std::hex << bxInEventHex;
00468         ss >> bxInEventHexString;
00469 
00470         if (m_dbe) {
00471             dbe->setCurrentFolder(m_dirName + "/BxInEvent_"
00472                     + bxInEventHexString);
00473         }
00474 
00475         (m_meAnalysisL1ExtraIsoEG.at(iBxInEvent))->bookHistograms(evSetup, m_dbe,
00476                 "L1_IsoEG", l1Obj);
00477     }
00478 
00479     //
00480     l1Obj.clear();
00481     l1Obj.push_back(NoIsoEG);
00482     nrMonElements = 4;
00483 
00484     for (int iBxInEvent = 0; iBxInEvent < m_nrBxInEventGct; ++iBxInEvent) {
00485 
00486         m_meAnalysisL1ExtraNoIsoEG.push_back(new L1ExtraDQM::L1ExtraMonElement<
00487                 l1extra::L1EmParticleCollection>(evSetup, nrMonElements));
00488 
00489         // convert to actual convention used in the hardware
00490         // (from [o, m_nrBxInEventGct] -> [-X, 0, +X]
00491         // write it in hex [..., E, F, 0, 1, 2, ...]
00492         int bxInEvent = iBxInEvent + (m_nrBxInEventGct + 1) / 2
00493                 - m_nrBxInEventGct;
00494         int bxInEventHex = (bxInEvent+ 16) % 16;
00495 
00496         std::stringstream ss;
00497         std::string bxInEventHexString;
00498         ss << std::uppercase << std::hex << bxInEventHex;
00499         ss >> bxInEventHexString;
00500 
00501         if (m_dbe) {
00502             dbe->setCurrentFolder(m_dirName + "/BxInEvent_"
00503                     + bxInEventHexString);
00504         }
00505 
00506         (m_meAnalysisL1ExtraNoIsoEG.at(iBxInEvent))->bookHistograms(evSetup, m_dbe,
00507                 "L1_NoIsoEG", l1Obj);
00508     }
00509 
00510     //
00511     l1Obj.clear();
00512     l1Obj.push_back(CenJet);
00513     nrMonElements = 4;
00514 
00515     for (int iBxInEvent = 0; iBxInEvent < m_nrBxInEventGct; ++iBxInEvent) {
00516 
00517         m_meAnalysisL1ExtraCenJet.push_back(new L1ExtraDQM::L1ExtraMonElement<
00518                 l1extra::L1JetParticleCollection>(evSetup, nrMonElements));
00519 
00520         // convert to actual convention used in the hardware
00521         // (from [o, m_nrBxInEventGct] -> [-X, 0, +X]
00522         // write it in hex [..., E, F, 0, 1, 2, ...]
00523         int bxInEvent = iBxInEvent + (m_nrBxInEventGct + 1) / 2
00524                 - m_nrBxInEventGct;
00525         int bxInEventHex = (bxInEvent+ 16) % 16;
00526 
00527         std::stringstream ss;
00528         std::string bxInEventHexString;
00529         ss << std::uppercase << std::hex << bxInEventHex;
00530         ss >> bxInEventHexString;
00531 
00532         if (m_dbe) {
00533             dbe->setCurrentFolder(m_dirName + "/BxInEvent_"
00534                     + bxInEventHexString);
00535         }
00536 
00537         (m_meAnalysisL1ExtraCenJet.at(iBxInEvent))->bookHistograms(evSetup, m_dbe,
00538                 "L1_CenJet", l1Obj);
00539     }
00540 
00541     //
00542     l1Obj.clear();
00543     l1Obj.push_back(ForJet);
00544 
00545     for (int iBxInEvent = 0; iBxInEvent < m_nrBxInEventGct; ++iBxInEvent) {
00546 
00547         m_meAnalysisL1ExtraForJet.push_back(new L1ExtraDQM::L1ExtraMonElement<
00548                 l1extra::L1JetParticleCollection>(evSetup, nrMonElements));
00549 
00550         // convert to actual convention used in the hardware
00551         // (from [o, m_nrBxInEventGct] -> [-X, 0, +X]
00552         // write it in hex [..., E, F, 0, 1, 2, ...]
00553         int bxInEvent = iBxInEvent + (m_nrBxInEventGct + 1) / 2
00554                 - m_nrBxInEventGct;
00555         int bxInEventHex = (bxInEvent+ 16) % 16;
00556 
00557         std::stringstream ss;
00558         std::string bxInEventHexString;
00559         ss << std::uppercase << std::hex << bxInEventHex;
00560         ss >> bxInEventHexString;
00561 
00562         if (m_dbe) {
00563             dbe->setCurrentFolder(m_dirName + "/BxInEvent_"
00564                     + bxInEventHexString);
00565         }
00566 
00567         (m_meAnalysisL1ExtraForJet.at(iBxInEvent))->bookHistograms(evSetup, m_dbe,
00568                 "L1_ForJet", l1Obj);
00569     }
00570 
00571     //
00572     l1Obj.clear();
00573     l1Obj.push_back(TauJet);
00574 
00575     for (int iBxInEvent = 0; iBxInEvent < m_nrBxInEventGct; ++iBxInEvent) {
00576 
00577         m_meAnalysisL1ExtraTauJet.push_back(new L1ExtraDQM::L1ExtraMonElement<
00578                 l1extra::L1JetParticleCollection>(evSetup, nrMonElements));
00579 
00580         // convert to actual convention used in the hardware
00581         // (from [o, m_nrBxInEventGct] -> [-X, 0, +X]
00582         // write it in hex [..., E, F, 0, 1, 2, ...]
00583         int bxInEvent = iBxInEvent + (m_nrBxInEventGct + 1) / 2
00584                 - m_nrBxInEventGct;
00585         int bxInEventHex = (bxInEvent+ 16) % 16;
00586 
00587         std::stringstream ss;
00588         std::string bxInEventHexString;
00589         ss << std::uppercase << std::hex << bxInEventHex;
00590         ss >> bxInEventHexString;
00591 
00592         if (m_dbe) {
00593             dbe->setCurrentFolder(m_dirName + "/BxInEvent_"
00594                     + bxInEventHexString);
00595         }
00596 
00597         (m_meAnalysisL1ExtraTauJet.at(iBxInEvent))->bookHistograms(evSetup, m_dbe,
00598                 "L1_TauJet", l1Obj);
00599     }
00600 
00601     //
00602     l1Obj.clear();
00603     l1Obj.push_back(ETT);
00604     nrMonElements = 1;
00605 
00606     bool bookPhi = false;
00607     bool bookEta = false;
00608 
00609     for (int iBxInEvent = 0; iBxInEvent < m_nrBxInEventGct; ++iBxInEvent) {
00610 
00611         m_meAnalysisL1ExtraETT.push_back(new L1ExtraDQM::L1ExtraMonElement<
00612                 l1extra::L1EtMissParticleCollection>(evSetup, nrMonElements));
00613 
00614         // convert to actual convention used in the hardware
00615         // (from [o, m_nrBxInEventGct] -> [-X, 0, +X]
00616         // write it in hex [..., E, F, 0, 1, 2, ...]
00617         int bxInEvent = iBxInEvent + (m_nrBxInEventGct + 1) / 2
00618                 - m_nrBxInEventGct;
00619         int bxInEventHex = (bxInEvent+ 16) % 16;
00620 
00621         std::stringstream ss;
00622         std::string bxInEventHexString;
00623         ss << std::uppercase << std::hex << bxInEventHex;
00624         ss >> bxInEventHexString;
00625 
00626         if (m_dbe) {
00627             dbe->setCurrentFolder(m_dirName + "/BxInEvent_"
00628                     + bxInEventHexString);
00629         }
00630 
00631         (m_meAnalysisL1ExtraETT.at(iBxInEvent))->bookHistograms(evSetup, m_dbe,
00632                 "L1_ETT", l1Obj, bookPhi, bookEta);
00633     }
00634 
00635     //
00636     l1Obj.clear();
00637     l1Obj.push_back(ETM);
00638     nrMonElements = 2;
00639 
00640     bookPhi = true;
00641     bookEta = false;
00642 
00643     for (int iBxInEvent = 0; iBxInEvent < m_nrBxInEventGct; ++iBxInEvent) {
00644 
00645         m_meAnalysisL1ExtraETM.push_back(new L1ExtraDQM::L1ExtraMonElement<
00646                 l1extra::L1EtMissParticleCollection>(evSetup, nrMonElements));
00647 
00648         // convert to actual convention used in the hardware
00649         // (from [o, m_nrBxInEventGct] -> [-X, 0, +X]
00650         // write it in hex [..., E, F, 0, 1, 2, ...]
00651         int bxInEvent = iBxInEvent + (m_nrBxInEventGct + 1) / 2
00652                 - m_nrBxInEventGct;
00653         int bxInEventHex = (bxInEvent+ 16) % 16;
00654 
00655         std::stringstream ss;
00656         std::string bxInEventHexString;
00657         ss << std::uppercase << std::hex << bxInEventHex;
00658         ss >> bxInEventHexString;
00659 
00660         if (m_dbe) {
00661             dbe->setCurrentFolder(m_dirName + "/BxInEvent_"
00662                     + bxInEventHexString);
00663         }
00664 
00665         (m_meAnalysisL1ExtraETM.at(iBxInEvent))->bookHistograms(evSetup, m_dbe,
00666                 "L1_ETM", l1Obj, bookPhi, bookEta);
00667     }
00668 
00669     //
00670     l1Obj.clear();
00671     l1Obj.push_back(HTT);
00672     nrMonElements = 1;
00673 
00674     bookPhi = false;
00675     bookEta = false;
00676 
00677     for (int iBxInEvent = 0; iBxInEvent < m_nrBxInEventGct; ++iBxInEvent) {
00678 
00679         m_meAnalysisL1ExtraHTT.push_back(new L1ExtraDQM::L1ExtraMonElement<
00680                 l1extra::L1EtMissParticleCollection>(evSetup, nrMonElements));
00681 
00682         // convert to actual convention used in the hardware
00683         // (from [o, m_nrBxInEventGct] -> [-X, 0, +X]
00684         // write it in hex [..., E, F, 0, 1, 2, ...]
00685         int bxInEvent = iBxInEvent + (m_nrBxInEventGct + 1) / 2
00686                 - m_nrBxInEventGct;
00687         int bxInEventHex = (bxInEvent+ 16) % 16;
00688 
00689         std::stringstream ss;
00690         std::string bxInEventHexString;
00691         ss << std::uppercase << std::hex << bxInEventHex;
00692         ss >> bxInEventHexString;
00693 
00694         if (m_dbe) {
00695             dbe->setCurrentFolder(m_dirName + "/BxInEvent_"
00696                     + bxInEventHexString);
00697         }
00698 
00699         (m_meAnalysisL1ExtraHTT.at(iBxInEvent))->bookHistograms(evSetup, m_dbe,
00700                 "L1_HTT", l1Obj, bookPhi, bookEta);
00701     }
00702 
00703     //
00704     l1Obj.clear();
00705     l1Obj.push_back(HTM);
00706     nrMonElements = 2;
00707 
00708     bookPhi = true;
00709     bookEta = false;
00710 
00711     for (int iBxInEvent = 0; iBxInEvent < m_nrBxInEventGct; ++iBxInEvent) {
00712 
00713         m_meAnalysisL1ExtraHTM.push_back(new L1ExtraDQM::L1ExtraMonElement<
00714                 l1extra::L1EtMissParticleCollection>(evSetup, nrMonElements));
00715 
00716         // convert to actual convention used in the hardware
00717         // (from [o, m_nrBxInEventGct] -> [-X, 0, +X]
00718         // write it in hex [..., E, F, 0, 1, 2, ...]
00719         int bxInEvent = iBxInEvent + (m_nrBxInEventGct + 1) / 2
00720                 - m_nrBxInEventGct;
00721         int bxInEventHex = (bxInEvent+ 16) % 16;
00722 
00723         std::stringstream ss;
00724         std::string bxInEventHexString;
00725         ss << std::uppercase << std::hex << bxInEventHex;
00726         ss >> bxInEventHexString;
00727 
00728         if (m_dbe) {
00729             dbe->setCurrentFolder(m_dirName + "/BxInEvent_"
00730                     + bxInEventHexString);
00731         }
00732 
00733         (m_meAnalysisL1ExtraHTM.at(iBxInEvent))->bookHistograms(evSetup, m_dbe,
00734                 "L1_HTM", l1Obj, bookPhi, bookEta);
00735     }
00736 
00737     //
00738     l1Obj.clear();
00739     l1Obj.push_back(HfBitCounts);
00740     nrMonElements = 1;
00741 
00742     bookPhi = false;
00743     bookEta = false;
00744 
00745     for (int iBxInEvent = 0; iBxInEvent < m_nrBxInEventGct; ++iBxInEvent) {
00746 
00747         m_meAnalysisL1ExtraHfBitCounts.push_back(
00748                 new L1ExtraDQM::L1ExtraMonElement<l1extra::L1HFRingsCollection>(
00749                         evSetup, nrMonElements));
00750 
00751         // convert to actual convention used in the hardware
00752         // (from [o, m_nrBxInEventGct] -> [-X, 0, +X]
00753         // write it in hex [..., E, F, 0, 1, 2, ...]
00754         int bxInEvent = iBxInEvent + (m_nrBxInEventGct + 1) / 2
00755                 - m_nrBxInEventGct;
00756         int bxInEventHex = (bxInEvent+ 16) % 16;
00757 
00758         std::stringstream ss;
00759         std::string bxInEventHexString;
00760         ss << std::uppercase << std::hex << bxInEventHex;
00761         ss >> bxInEventHexString;
00762 
00763         if (m_dbe) {
00764             dbe->setCurrentFolder(m_dirName + "/BxInEvent_"
00765                     + bxInEventHexString);
00766         }
00767 
00768         (m_meAnalysisL1ExtraHfBitCounts.at(iBxInEvent))->bookHistograms(evSetup,
00769                 m_dbe, "L1_HfBitCounts", l1Obj, bookPhi, bookEta);
00770     }
00771 
00772     //
00773     l1Obj.clear();
00774     l1Obj.push_back(HfRingEtSums);
00775     nrMonElements = 1;
00776 
00777     bookPhi = false;
00778     bookEta = false;
00779 
00780     for (int iBxInEvent = 0; iBxInEvent < m_nrBxInEventGct; ++iBxInEvent) {
00781 
00782         m_meAnalysisL1ExtraHfRingEtSums.push_back(
00783                 new L1ExtraDQM::L1ExtraMonElement<l1extra::L1HFRingsCollection>(
00784                         evSetup, nrMonElements));
00785 
00786         // convert to actual convention used in the hardware
00787         // (from [o, m_nrBxInEventGct] -> [-X, 0, +X]
00788         // write it in hex [..., E, F, 0, 1, 2, ...]
00789         int bxInEvent = iBxInEvent + (m_nrBxInEventGct + 1) / 2
00790                 - m_nrBxInEventGct;
00791         int bxInEventHex = (bxInEvent+ 16) % 16;
00792 
00793         std::stringstream ss;
00794         std::string bxInEventHexString;
00795         ss << std::uppercase << std::hex << bxInEventHex;
00796         ss >> bxInEventHexString;
00797 
00798         if (m_dbe) {
00799             dbe->setCurrentFolder(m_dirName + "/BxInEvent_"
00800                     + bxInEventHexString);
00801         }
00802 
00803         (m_meAnalysisL1ExtraHfRingEtSums.at(iBxInEvent))->bookHistograms(evSetup,
00804                 m_dbe, "L1_HfRingEtSums", l1Obj, bookPhi, bookEta);
00805     }
00806 
00807 }
00808 
00809 
00810 //
00811 void L1ExtraDQM::analyze(const edm::Event& iEvent,
00812         const edm::EventSetup& evSetup) {
00813 
00814     ++m_nrEvJob;
00815     ++m_nrEvRun;
00816 
00817     //
00818     m_retrieveL1Extra.retrieveL1ExtraObjects(iEvent, evSetup);
00819     //
00820     analyzeL1ExtraMuon(iEvent, evSetup);
00821     analyzeL1ExtraIsoEG(iEvent, evSetup);
00822     analyzeL1ExtraNoIsoEG(iEvent, evSetup);
00823     analyzeL1ExtraCenJet(iEvent, evSetup);
00824     analyzeL1ExtraForJet(iEvent, evSetup);
00825     analyzeL1ExtraTauJet(iEvent, evSetup);
00826     analyzeL1ExtraETT(iEvent, evSetup);
00827     analyzeL1ExtraETM(iEvent, evSetup);
00828     analyzeL1ExtraHTT(iEvent, evSetup);
00829     analyzeL1ExtraHTM(iEvent, evSetup);
00830     analyzeL1ExtraHfBitCounts(iEvent, evSetup);
00831     analyzeL1ExtraHfRingEtSums(iEvent, evSetup);
00832 }
00833 
00834 
00835 void L1ExtraDQM::endRun(const edm::Run& run, const edm::EventSetup& evSetup) {
00836 
00837     // delete if event setup has changed only FIXME
00838 
00839     for (std::vector<L1ExtraMonElement<l1extra::L1MuonParticleCollection>*>::iterator
00840             iterME = m_meAnalysisL1ExtraMuon.begin(); iterME
00841             != m_meAnalysisL1ExtraMuon.end(); ++iterME) {
00842 
00843         delete *iterME;
00844 
00845     }
00846     m_meAnalysisL1ExtraMuon.clear();
00847 
00848 
00849     for (std::vector<L1ExtraMonElement<l1extra::L1EmParticleCollection>*>::iterator
00850             iterME = m_meAnalysisL1ExtraIsoEG.begin(); iterME
00851             != m_meAnalysisL1ExtraIsoEG.end(); ++iterME) {
00852 
00853         delete *iterME;
00854 
00855     }
00856     m_meAnalysisL1ExtraIsoEG.clear();
00857 
00858 
00859     for (std::vector<L1ExtraMonElement<l1extra::L1EmParticleCollection>*>::iterator
00860             iterME = m_meAnalysisL1ExtraNoIsoEG.begin(); iterME
00861             != m_meAnalysisL1ExtraNoIsoEG.end(); ++iterME) {
00862 
00863         delete *iterME;
00864 
00865     }
00866     m_meAnalysisL1ExtraNoIsoEG.clear();
00867 
00868 
00869     for (std::vector<L1ExtraMonElement<l1extra::L1JetParticleCollection>*>::iterator
00870             iterME = m_meAnalysisL1ExtraCenJet.begin(); iterME
00871             != m_meAnalysisL1ExtraCenJet.end(); ++iterME) {
00872 
00873         delete *iterME;
00874 
00875     }
00876     m_meAnalysisL1ExtraCenJet.clear();
00877 
00878     for (std::vector<L1ExtraMonElement<l1extra::L1JetParticleCollection>*>::iterator
00879             iterME = m_meAnalysisL1ExtraForJet.begin(); iterME
00880             != m_meAnalysisL1ExtraForJet.end(); ++iterME) {
00881 
00882         delete *iterME;
00883 
00884     }
00885     m_meAnalysisL1ExtraForJet.clear();
00886 
00887     for (std::vector<L1ExtraMonElement<l1extra::L1JetParticleCollection>*>::iterator
00888             iterME = m_meAnalysisL1ExtraTauJet.begin(); iterME
00889             != m_meAnalysisL1ExtraTauJet.end(); ++iterME) {
00890 
00891         delete *iterME;
00892 
00893     }
00894     m_meAnalysisL1ExtraTauJet.clear();
00895 
00896 
00897     for (std::vector<L1ExtraMonElement<l1extra::L1EtMissParticleCollection>*>::iterator
00898             iterME = m_meAnalysisL1ExtraETT.begin(); iterME
00899             != m_meAnalysisL1ExtraETT.end(); ++iterME) {
00900 
00901         delete *iterME;
00902 
00903     }
00904     m_meAnalysisL1ExtraETT.clear();
00905 
00906     for (std::vector<L1ExtraMonElement<l1extra::L1EtMissParticleCollection>*>::iterator
00907             iterME = m_meAnalysisL1ExtraETM.begin(); iterME
00908             != m_meAnalysisL1ExtraETM.end(); ++iterME) {
00909 
00910         delete *iterME;
00911 
00912     }
00913     m_meAnalysisL1ExtraETM.clear();
00914 
00915     for (std::vector<L1ExtraMonElement<l1extra::L1EtMissParticleCollection>*>::iterator
00916             iterME = m_meAnalysisL1ExtraHTT.begin(); iterME
00917             != m_meAnalysisL1ExtraHTT.end(); ++iterME) {
00918 
00919         delete *iterME;
00920 
00921     }
00922     m_meAnalysisL1ExtraHTT.clear();
00923 
00924     for (std::vector<L1ExtraMonElement<l1extra::L1EtMissParticleCollection>*>::iterator
00925             iterME = m_meAnalysisL1ExtraHTM.begin(); iterME
00926             != m_meAnalysisL1ExtraHTM.end(); ++iterME) {
00927 
00928         delete *iterME;
00929 
00930     }
00931     m_meAnalysisL1ExtraHTM.clear();
00932 
00933 
00934     for (std::vector<L1ExtraMonElement<l1extra::L1HFRingsCollection>*>::iterator
00935             iterME = m_meAnalysisL1ExtraHfBitCounts.begin(); iterME
00936             != m_meAnalysisL1ExtraHfBitCounts.end(); ++iterME) {
00937 
00938         delete *iterME;
00939 
00940     }
00941     m_meAnalysisL1ExtraHfBitCounts.clear();
00942 
00943     for (std::vector<L1ExtraMonElement<l1extra::L1HFRingsCollection>*>::iterator
00944             iterME = m_meAnalysisL1ExtraHfRingEtSums.begin(); iterME
00945             != m_meAnalysisL1ExtraHfRingEtSums.end(); ++iterME) {
00946 
00947         delete *iterME;
00948 
00949     }
00950     m_meAnalysisL1ExtraHfRingEtSums.clear();
00951 
00952     LogDebug("L1ExtraDQM") << "\n\n endRun: " << run.id()
00953             << "\n  Number of events analyzed in this run:       " << m_nrEvRun
00954             << "\n  Total number of events analyzed in this job: " << m_nrEvJob
00955             << "\n" << std::endl;
00956 
00957 }
00958 
00959 void L1ExtraDQM::endJob() {
00960 
00961     edm::LogInfo("L1ExtraDQM")
00962             << "\n\nTotal number of events analyzed in this job: " << m_nrEvJob
00963             << "\n" << std::endl;
00964 
00965     return;
00966 }
00967 
00968 //define this as a plug-in
00969 DEFINE_FWK_MODULE(L1ExtraDQM);