CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/src/DQMOffline/Trigger/src/HLTTauDQMOfflineSource.cc

Go to the documentation of this file.
00001 #include "DQMOffline/Trigger/interface/HLTTauDQMOfflineSource.h"
00002 
00003 using namespace std;
00004 using namespace edm;
00005 using namespace reco;
00006 using namespace l1extra;
00007 using namespace trigger;
00008 
00009 //
00010 // constructors and destructor
00011 //
00012 HLTTauDQMOfflineSource::HLTTauDQMOfflineSource( const edm::ParameterSet& ps ) :counterEvt_(0)
00013 {
00014     //Get General Monitoring Parameters
00015     config_                 = ps.getParameter<std::vector<edm::ParameterSet> >("MonitorSetup");
00016     doRefAnalysis_          = ps.getParameter<bool>("doMatching");
00017     NPtBins_                = ps.getUntrackedParameter<int>("PtHistoBins",20);
00018     NEtaBins_               = ps.getUntrackedParameter<int>("EtaHistoBins",25);
00019     NPhiBins_               = ps.getUntrackedParameter<int>("PhiHistoBins",32);
00020     EtMax_                  = ps.getUntrackedParameter<double>("EtHistoMax",100);
00021     L1MatchDr_              = ps.getUntrackedParameter<double>("L1MatchDeltaR",0.5);
00022     HLTMatchDr_             = ps.getUntrackedParameter<double>("HLTMatchDeltaR",0.3);
00023     
00024     refObjects_             = ps.getUntrackedParameter<std::vector<edm::InputTag> >("refObjects");
00025     
00026     prescaleEvt_            = ps.getUntrackedParameter<int>("prescaleEvt", -1);
00027     
00028     //Read The Configuration
00029     for (unsigned int i=0;i<config_.size();++i) {
00030         if (config_[i].getUntrackedParameter<std::string>("ConfigType") == "L1") {
00031             HLTTauDQML1Plotter tmp(config_[i],NPtBins_,NEtaBins_,NPhiBins_,EtMax_,doRefAnalysis_,L1MatchDr_);
00032             l1Plotters.push_back(tmp);
00033         }
00034         
00035         else if (config_[i].getUntrackedParameter<std::string>("ConfigType") == "Calo") {
00036             HLTTauDQMCaloPlotter tmp(config_[i],NPtBins_,NEtaBins_,NPhiBins_,EtMax_,doRefAnalysis_,HLTMatchDr_);
00037             caloPlotters.push_back(tmp);
00038         }
00039         
00040         else if (config_[i].getUntrackedParameter<std::string>("ConfigType") == "Track") {
00041             HLTTauDQMTrkPlotter tmp(config_[i],NPtBins_,NEtaBins_,NPhiBins_,EtMax_,doRefAnalysis_,HLTMatchDr_);
00042             trackPlotters.push_back(tmp);
00043         }
00044         
00045         else if (config_[i].getUntrackedParameter<std::string>("ConfigType") == "Path") {
00046             HLTTauDQMPathPlotter tmp(config_[i],doRefAnalysis_);
00047             pathPlotters.push_back(tmp);
00048         }
00049         
00050         else if (config_[i].getUntrackedParameter<std::string>("ConfigType") == "LitePath") {
00051             HLTTauDQMLitePathPlotter tmp(config_[i],NPtBins_,NEtaBins_,NPhiBins_,EtMax_,doRefAnalysis_,HLTMatchDr_);
00052             litePathPlotters.push_back(tmp);
00053         }
00054     }
00055 }
00056 
00057 HLTTauDQMOfflineSource::~HLTTauDQMOfflineSource()
00058 {
00059     
00060     // do anything here that needs to be done at desctruction time
00061     // (e.g. close files, deallocate resources etc.)
00062     
00063 }
00064 
00065 
00066 //--------------------------------------------------------
00067 void 
00068 HLTTauDQMOfflineSource::beginJob(){
00069     
00070 }
00071 
00072 //--------------------------------------------------------
00073 void HLTTauDQMOfflineSource::beginRun(const edm::Run& r, const EventSetup& iSetup) {
00074     
00075 }
00076 
00077 //--------------------------------------------------------
00078 void HLTTauDQMOfflineSource::beginLuminosityBlock(const LuminosityBlock& lumiSeg, 
00079                                                   const EventSetup& context) {
00080     
00081 }
00082 
00083 // ----------------------------------------------------------
00084 void 
00085 HLTTauDQMOfflineSource::analyze(const Event& iEvent, const EventSetup& iSetup )
00086 {  
00087     //Apply the prescaler
00088     if(counterEvt_ > prescaleEvt_)
00089     {
00090         //Do Analysis here
00091         
00092         //Create dummy Match Collections
00093         std::vector<LVColl> refC;
00094         
00095         if(doRefAnalysis_)
00096         {
00097             for(unsigned int i=0;i<refObjects_.size();++i)
00098             {
00099                 Handle<LVColl> collHandle;
00100                 if(iEvent.getByLabel(refObjects_[i],collHandle))
00101                 {
00102                     refC.push_back(*collHandle);
00103                 }
00104             }
00105         }
00106         
00107         
00108         
00109         //fill the empty slots with empty collections
00110         LVColl dummy;
00111         for(int k=refC.size();k<3;k++)
00112         {
00113             refC.push_back(dummy);
00114         }
00115         
00116         
00117         
00118         //Path Plotters
00119         for(unsigned int i=0;i<pathPlotters.size();++i)
00120             pathPlotters[i].analyze(iEvent,iSetup,refC);
00121         
00122         //Lite Path Plotters
00123         for(unsigned int i=0;i<litePathPlotters.size();++i)
00124             litePathPlotters[i].analyze(iEvent,iSetup,refC);
00125         
00126         //L1  Plotters
00127         for(unsigned int i=0;i<l1Plotters.size();++i)
00128             l1Plotters[i].analyze(iEvent,iSetup,refC);
00129         
00130         //Calo Plotters
00131         for(unsigned int i=0;i<caloPlotters.size();++i)
00132             caloPlotters[i].analyze(iEvent,iSetup,refC[0]);
00133         
00134         //Track Plotters
00135         for(unsigned int i=0;i<trackPlotters.size();++i)
00136             trackPlotters[i].analyze(iEvent,iSetup,refC[0]);
00137     }
00138     else
00139         counterEvt_++;
00140     
00141 }
00142 
00143 
00144 
00145 
00146 //--------------------------------------------------------
00147 void HLTTauDQMOfflineSource::endLuminosityBlock(const LuminosityBlock& lumiSeg, 
00148                                                 const EventSetup& context) {
00149 }
00150 //--------------------------------------------------------
00151 void HLTTauDQMOfflineSource::endRun(const Run& r, const EventSetup& context){
00152 }
00153 //--------------------------------------------------------
00154 void HLTTauDQMOfflineSource::endJob(){
00155     return;
00156 }
00157 
00158 
00159