CMS 3D CMS Logo

EgammaHLTEffSrc.h

Go to the documentation of this file.
00001 #ifndef DQMOFFLINE_TRIGGER_EGAMMAHLTEFFSRC
00002 #define DQMOFFLINE_TRIGGER_EGAMMAHLTEFFSRC
00003 
00004 
00005 //class: EgammaHLTEffSrc
00006 //
00007 //author: Sam Harper (June 2008)
00008 //
00009 //WARNING: interface is NOT final, please dont use this class for now without clearing it with me
00010 //         as I will change it and possibly break all your code
00011 //
00012 //aim: to create MonitorElements (ie histograms) which can be used to measure trigger efficiencies
00013 //
00014 //
00015 //implimentation:
00016 
00017 #include "DQMOffline/Trigger/interface/MonElemManager.h"
00018 #include "DQMOffline/Trigger/interface/MonElemMgrEBEE.h"
00019 #include "DQMOffline/Trigger/interface/EgHLTDQMCut.h"
00020 #include "DQMOffline/Trigger/interface/EgHLTOffData.h"
00021 
00022 template<class T> class EgammaHLTEffSrcBase {
00023  public:
00024   EgammaHLTEffSrcBase(){}
00025   virtual ~EgammaHLTEffSrcBase(){}
00026 
00027   virtual void fill(const T& obj,const EgHLTOffData& evtData,float weight)=0;
00028 
00029 };
00030 
00031 template<class T,typename varType> class EgammaHLTEffSrc : public EgammaHLTEffSrcBase<T> {
00032 
00033  private:
00034   MonElemMgrEBEE<T,varType> *numMonElem_; //numerator hist, we own this
00035   MonElemMgrEBEE<T,varType> *denMonElem_; //denomenator hist we own this
00036 
00037   EgHLTDQMCut<T> *cut_; //we own this
00038   EgHLTDQMCut<T> *sampleCut_; //we also own this but it may be null
00039   
00040  private:
00041   //no copying allowed
00042   EgammaHLTEffSrc(const EgammaHLTEffSrc& rhs){}
00043   EgammaHLTEffSrc& operator=(const EgammaHLTEffSrc& rhs){return *this;}
00044 
00045  public:
00046   EgammaHLTEffSrc(const std::string& name,const std::string& title,int nrBins,double xMin,double xMax,
00047                   varType (T::*varFunc)()const,
00048                   EgHLTDQMCut<T>* cut,EgHLTDQMCut<T>* sampleCut=NULL);
00049   ~EgammaHLTEffSrc();
00050 
00051   void fill(const T& obj,const EgHLTOffData& evtData,float weight);
00052 
00053 };
00054 
00055 
00056 template<class T,typename varType> EgammaHLTEffSrc<T,varType>::EgammaHLTEffSrc(const std::string& name,const std::string &title,
00057                                                                                int nrBins,double xMin,double xMax,
00058                                                                                varType (T::*varFunc)()const,
00059                                                                                EgHLTDQMCut<T>* cut,EgHLTDQMCut<T>* sampleCut)
00060 {
00061   numMonElem_ = new MonElemMgrEBEE<T,varType>(name+"_pass",title+" Pass",nrBins,xMin,xMax,varFunc);
00062   denMonElem_ = new MonElemMgrEBEE<T,varType>(name+"_all",title+" All",nrBins,xMin,xMax,varFunc); 
00063   cut_=cut;
00064   sampleCut_=sampleCut;
00065 
00066 }
00067 
00068 template<class T,typename varType> EgammaHLTEffSrc<T,varType>::~EgammaHLTEffSrc()
00069 {
00070   delete cut_;
00071   if(sampleCut_) delete sampleCut_;
00072   delete numMonElem_;
00073   delete denMonElem_;
00074 }
00075 
00076 
00077 template<class T,typename varType> void EgammaHLTEffSrc<T,varType>::fill(const T& obj,const EgHLTOffData& evtData,float weight)
00078 {
00079   if(sampleCut_==NULL || sampleCut_->pass(obj,evtData)){
00080     denMonElem_->fill(obj,weight);
00081     if(cut_->pass(obj,evtData)) numMonElem_->fill(obj,weight);
00082   }
00083 }
00084 
00085 
00086 
00087 #endif

Generated on Tue Jun 9 17:34:08 2009 for CMSSW by  doxygen 1.5.4