Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:33:42

0001 // -*- C++ -*-
0002 //
0003 // Package:    Validation/RecoMET
0004 // Class:      METTesterPostProcessor
0005 //
0006 // Original Author:  "Matthias Weber"
0007 //         Created:  Sun Feb 22 14:35:25 CET 2015
0008 //
0009 
0010 #include "FWCore/Framework/interface/LuminosityBlock.h"
0011 #include "FWCore/Framework/interface/Run.h"
0012 #include "Validation/RecoMET/plugins/METTesterPostProcessor.h"
0013 
0014 // Some switches
0015 //
0016 // constructors and destructor
0017 //
0018 METTesterPostProcessor::METTesterPostProcessor(const edm::ParameterSet &iConfig) {}
0019 
0020 METTesterPostProcessor::~METTesterPostProcessor() {}
0021 
0022 // ------------ method called right after a run ends ------------
0023 void METTesterPostProcessor::dqmEndJob(DQMStore::IBooker &ibook_, DQMStore::IGetter &iget_) {
0024   std::vector<std::string> subDirVec;
0025   std::string RunDir = "JetMET/METValidation/";
0026   iget_.setCurrentFolder(RunDir);
0027   met_dirs = iget_.getSubdirs();
0028   // bin definition for resolution plot -> last bin contains overflow too, but
0029   // for plotting purposes show up to 1 TeV only
0030   int nBins = 11;
0031   float bins[] = {0., 20., 40., 60., 80., 100., 150., 200., 300., 400., 500., 1000};
0032   // loop over met subdirectories
0033   for (int i = 0; i < int(met_dirs.size()); i++) {
0034     ibook_.setCurrentFolder(met_dirs[i]);
0035     mMETDifference_GenMETTrue_METResolution =
0036         ibook_.book1D("METResolution_GenMETTrue_InMETBins", "METResolution_GenMETTrue_InMETBins", nBins, bins);
0037     FillMETRes(met_dirs[i], iget_);
0038   }
0039 }
0040 
0041 void METTesterPostProcessor::FillMETRes(std::string metdir, DQMStore::IGetter &iget) {
0042   mMETDifference_GenMETTrue_MET0to20 = nullptr;
0043   mMETDifference_GenMETTrue_MET20to40 = nullptr;
0044   mMETDifference_GenMETTrue_MET40to60 = nullptr;
0045   mMETDifference_GenMETTrue_MET60to80 = nullptr;
0046   mMETDifference_GenMETTrue_MET80to100 = nullptr;
0047   mMETDifference_GenMETTrue_MET100to150 = nullptr;
0048   mMETDifference_GenMETTrue_MET150to200 = nullptr;
0049   mMETDifference_GenMETTrue_MET200to300 = nullptr;
0050   mMETDifference_GenMETTrue_MET300to400 = nullptr;
0051   mMETDifference_GenMETTrue_MET400to500 = nullptr;
0052   mMETDifference_GenMETTrue_MET500 = nullptr;
0053 
0054   mMETDifference_GenMETTrue_MET0to20 = iget.get(metdir + "/METResolution_GenMETTrue_MET0to20");
0055   mMETDifference_GenMETTrue_MET20to40 = iget.get(metdir + "/METResolution_GenMETTrue_MET20to40");
0056   mMETDifference_GenMETTrue_MET40to60 = iget.get(metdir + "/METResolution_GenMETTrue_MET40to60");
0057   mMETDifference_GenMETTrue_MET60to80 = iget.get(metdir + "/METResolution_GenMETTrue_MET60to80");
0058   mMETDifference_GenMETTrue_MET80to100 = iget.get(metdir + "/METResolution_GenMETTrue_MET80to100");
0059   mMETDifference_GenMETTrue_MET100to150 = iget.get(metdir + "/METResolution_GenMETTrue_MET100to150");
0060   mMETDifference_GenMETTrue_MET150to200 = iget.get(metdir + "/METResolution_GenMETTrue_MET150to200");
0061   mMETDifference_GenMETTrue_MET200to300 = iget.get(metdir + "/METResolution_GenMETTrue_MET200to300");
0062   mMETDifference_GenMETTrue_MET300to400 = iget.get(metdir + "/METResolution_GenMETTrue_MET300to400");
0063   mMETDifference_GenMETTrue_MET400to500 = iget.get(metdir + "/METResolution_GenMETTrue_MET400to500");
0064   mMETDifference_GenMETTrue_MET500 = iget.get(metdir + "/METResolution_GenMETTrue_MET500");
0065   if (mMETDifference_GenMETTrue_MET0to20 &&
0066       mMETDifference_GenMETTrue_MET0to20->getRootObject()) {  // check one object, if existing, then the
0067                                                               // remaining ME's exist too
0068     // for genmet none of these ME's are filled
0069     mMETDifference_GenMETTrue_METResolution->setBinContent(1, mMETDifference_GenMETTrue_MET0to20->getMean());
0070     mMETDifference_GenMETTrue_METResolution->setBinContent(2, mMETDifference_GenMETTrue_MET20to40->getMean());
0071     mMETDifference_GenMETTrue_METResolution->setBinContent(3, mMETDifference_GenMETTrue_MET40to60->getMean());
0072     mMETDifference_GenMETTrue_METResolution->setBinContent(4, mMETDifference_GenMETTrue_MET60to80->getMean());
0073     mMETDifference_GenMETTrue_METResolution->setBinContent(5, mMETDifference_GenMETTrue_MET80to100->getMean());
0074     mMETDifference_GenMETTrue_METResolution->setBinContent(6, mMETDifference_GenMETTrue_MET100to150->getMean());
0075     mMETDifference_GenMETTrue_METResolution->setBinContent(7, mMETDifference_GenMETTrue_MET150to200->getMean());
0076     mMETDifference_GenMETTrue_METResolution->setBinContent(8, mMETDifference_GenMETTrue_MET200to300->getMean());
0077     mMETDifference_GenMETTrue_METResolution->setBinContent(9, mMETDifference_GenMETTrue_MET300to400->getMean());
0078     mMETDifference_GenMETTrue_METResolution->setBinContent(10, mMETDifference_GenMETTrue_MET400to500->getMean());
0079     mMETDifference_GenMETTrue_METResolution->setBinContent(11, mMETDifference_GenMETTrue_MET500->getMean());
0080 
0081     // the error computation should be done in a postProcessor in the harvesting
0082     // step otherwise the histograms will be just summed
0083     mMETDifference_GenMETTrue_METResolution->setBinError(1, mMETDifference_GenMETTrue_MET0to20->getRMS());
0084     mMETDifference_GenMETTrue_METResolution->setBinError(2, mMETDifference_GenMETTrue_MET20to40->getRMS());
0085     mMETDifference_GenMETTrue_METResolution->setBinError(3, mMETDifference_GenMETTrue_MET40to60->getRMS());
0086     mMETDifference_GenMETTrue_METResolution->setBinError(4, mMETDifference_GenMETTrue_MET60to80->getRMS());
0087     mMETDifference_GenMETTrue_METResolution->setBinError(5, mMETDifference_GenMETTrue_MET80to100->getRMS());
0088     mMETDifference_GenMETTrue_METResolution->setBinError(6, mMETDifference_GenMETTrue_MET100to150->getRMS());
0089     mMETDifference_GenMETTrue_METResolution->setBinError(7, mMETDifference_GenMETTrue_MET150to200->getRMS());
0090     mMETDifference_GenMETTrue_METResolution->setBinError(8, mMETDifference_GenMETTrue_MET200to300->getRMS());
0091     mMETDifference_GenMETTrue_METResolution->setBinError(9, mMETDifference_GenMETTrue_MET300to400->getRMS());
0092     mMETDifference_GenMETTrue_METResolution->setBinError(10, mMETDifference_GenMETTrue_MET400to500->getRMS());
0093     mMETDifference_GenMETTrue_METResolution->setBinError(11, mMETDifference_GenMETTrue_MET500->getRMS());
0094   }
0095 }