CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/DQMOffline/Trigger/interface/EgHLTMonElemFuncs.h

Go to the documentation of this file.
00001 #ifndef DQMOFFLINE_TRIGGER_EGHLTMONELEMFUNCS
00002 #define DQMOFFLINE_TRIGGER_EGHLTMONELEMFUNCS
00003 
00004 
00005 //Author: Sam Harper
00006 
00007 //Description: A collection of functions which assist and automate the creation
00008 //             of useful monitor elements for Eg DQM
00009 //
00010 
00011 #include "DQMOffline/Trigger/interface/EgHLTMonElemManager.h"
00012 #include "DQMOffline/Trigger/interface/EgHLTOffEle.h"
00013 #include "DQMOffline/Trigger/interface/EgHLTOffPho.h"
00014 #include "DQMOffline/Trigger/interface/EgHLTMonElemWithCut.h"
00015 #include "DQMOffline/Trigger/interface/EgHLTMonElemMgrEBEE.h"
00016 #include "DQMOffline/Trigger/interface/EgHLTDQMCut.h"
00017 #include "DQMOffline/Trigger/interface/EgHLTMonElemContainer.h"
00018 #include "DQMOffline/Trigger/interface/EgHLTBinData.h"
00019 #include "DQMOffline/Trigger/interface/EgHLTTrigTools.h"
00020 #include "DQMOffline/Trigger/interface/EgHLTMonElemWithCutEBEE.h"
00021 
00022 #include <boost/algorithm/string.hpp>
00023 
00024 namespace egHLT {
00025 
00026   class CutMasks;
00027 
00028   namespace MonElemFuncs {
00029     
00030     
00031     void initStdEleHists(std::vector<MonElemManagerBase<OffEle>*>& histVec,const std::string& baseName,const BinData& bins); 
00032     void initStdPhoHists(std::vector<MonElemManagerBase<OffPho>*>& histVec,const std::string& baseName,const BinData& bins); 
00033     void initStdEffHists(std::vector<MonElemWithCutBase<OffEle>*>& histVec,const std::string& baseName,int nrBins,double xMin,double xMax,float (OffEle::*vsVarFunc)()const,const CutMasks& masks); 
00034     void initStdEffHists(std::vector<MonElemWithCutBase<OffEle>*>& histVec,const std::string& baseName,const BinData::Data1D& bins,float (OffEle::*vsVarFunc)()const,const CutMasks& masks);
00035     void initStdEffHists(std::vector<MonElemWithCutBase<OffPho>*>& histVec,const std::string& baseName,int nrBins,double xMin,double xMax,float (OffPho::*vsVarFunc)()const,const CutMasks& masks);   
00036     void initStdEffHists(std::vector<MonElemWithCutBase<OffPho>*>& histVec,const std::string& baseName,const BinData::Data1D& bins,float (OffPho::*vsVarFunc)()const,const CutMasks& masks);
00037 
00038     //we own the passed in pointer
00039     void initStdEleCutHists(std::vector<MonElemWithCutBase<OffEle>*>& histVec,const std::string& baseName,const BinData& bins,EgHLTDQMCut<OffEle>* cut=NULL);
00040 
00041 
00042     
00043   
00044     void initTightLooseTrigHists(std::vector<MonElemContainer<OffEle>*>& eleMonElems,const std::vector<std::string>& tightLooseTrigs,const BinData& bins,EgHLTDQMCut<OffEle>* eleCut);
00045     void initTightLooseTrigHists(std::vector<MonElemContainer<OffPho>*>& phoMonElems,const std::vector<std::string>& tightLooseTrigs,const BinData& bins,EgHLTDQMCut<OffPho>* phoCut);
00046     
00047     void initTightLooseTrigHistsTrigCuts(std::vector<MonElemContainer<OffEle>*>& eleMonElems,const std::vector<std::string>& tightLooseTrigs,const BinData& bins);  
00048     void initTightLooseTrigHistsTrigCuts(std::vector<MonElemContainer<OffPho>*>& phoMonElems,const std::vector<std::string>& tightLooseTrigs,const BinData& bins);
00049     
00050     void addTightLooseTrigHist(std::vector<MonElemContainer<OffEle>*>& eleMonElems,
00051                                const std::string& tightTrig,const std::string& looseTrig,
00052                                EgHLTDQMCut<OffEle>* eleCut,const std::string& histId,const BinData& bins);
00053 
00054 
00055     void addTightLooseTrigHist(std::vector<MonElemContainer<OffPho>*>& phoMonElems,
00056                                const std::string& tightTrig,const std::string& looseTrig,
00057                                EgHLTDQMCut<OffPho>* phoCut,const std::string& histId,const BinData& bins);
00058     
00059 
00060     
00061     void initTightLooseDiObjTrigHistsTrigCuts(std::vector<MonElemContainer<OffEle>*>& eleMonElems,const std::vector<std::string>& tightLooseTrigs,const BinData& bins);
00062     void initTightLooseDiObjTrigHistsTrigCuts(std::vector<MonElemContainer<OffPho>*>& phoMonElems,const std::vector<std::string>& tightLooseTrigs,const BinData& bins);
00063 
00064     //ele only
00065     void initTrigTagProbeHists(std::vector<MonElemContainer<OffEle>*>& eleMonElems,const std::vector<std::string> filterNames,int cutMask,const BinData& bins);
00066     void initTrigTagProbeHist(std::vector<MonElemContainer<OffEle>*>& eleMonElems,const std::string filterName,int cutMask,const BinData& bins);
00067   
00068 
00069     template<class T,typename varType> void addStdHist(std::vector<MonElemManagerBase<T>*>& histVec,const std::string& name,const std::string& title,
00070                                                        const BinData::Data1D& binData,varType (T::*varFunc)()const){
00071       histVec.push_back(new MonElemMgrEBEE<T,varType>(name,title,binData.nr,binData.min,binData.max,varFunc));
00072     }
00073 
00074     //this function is special in that it figures out the Et cut from the trigger name
00075     //it then passes the cut as normal into the other addTightLooseTrigHist functions
00076     //it also makes an uncut et distribution
00077     template<class T> void addTightLooseTrigHist(std::vector<MonElemContainer<T>*>& monElems,
00078                                          const std::string& tightTrig,const std::string& looseTrig,
00079                                          const std::string& histId,const BinData& bins)
00080     {
00081   
00082       float etCutValue = trigTools::getEtThresFromName(tightTrig);
00083       
00084       EgHLTDQMCut<T>* etCut = new EgGreaterCut<T,float>(etCutValue,&T::etSC); //note the cut in trigger is on SC Et
00085       addTightLooseTrigHist(monElems,tightTrig,looseTrig,etCut,histId,bins);
00086 
00087       //now make the new mon elems without the et cut (have to be placed in containers even though each container just has one monelem)
00088       MonElemContainer<T>* passEtMonElem;
00089       passEtMonElem = new MonElemContainer<T>(tightTrig+"_"+looseTrig+"_"+histId+"_passTrig","",
00090                                               new EgObjTrigCut<T>(TrigCodes::getCode(tightTrig+":"+looseTrig),EgObjTrigCut<T>::AND));
00091       addStdHist<T,float>(passEtMonElem->monElems(),passEtMonElem->name()+"_etUnCut",passEtMonElem->name()+" E_{T} (Uncut);E_{T} (GeV)",bins.et,&T::et);
00092       
00093       MonElemContainer<T>* failEtMonElem;
00094       failEtMonElem = new MonElemContainer<T>(tightTrig+"_"+looseTrig+"_"+histId+"_failTrig","",
00095                                               new EgObjTrigCut<T>(TrigCodes::getCode(looseTrig),EgObjTrigCut<T>::AND,TrigCodes::getCode(tightTrig)));
00096       addStdHist<T,float>(failEtMonElem->monElems(),failEtMonElem->name()+"_etUnCut",failEtMonElem->name()+" E_{T} (Uncut);E_{T} (GeV)",bins.et,&T::et);
00097 
00098       monElems.push_back(passEtMonElem);
00099       monElems.push_back(failEtMonElem);
00100     }
00101   
00102 
00103     //this function will ultimately produce a set of distributions with the Et cut of the trigger applied + make an additional un cut et monitor element for turn on purposes
00104     template<class T> void initTightLooseTrigHists(std::vector<MonElemContainer<T>*>& monElems,const std::vector<std::string>& tightLooseTrigs,const BinData& bins,const std::string& objName)
00105       {
00106         for(size_t trigNr=0;trigNr<tightLooseTrigs.size();trigNr++){
00107           std::vector<std::string> splitString;
00108           boost::split(splitString,tightLooseTrigs[trigNr],boost::is_any_of(std::string(":")));
00109           if(splitString.size()!=2) continue; //format incorrect
00110           const std::string& tightTrig = splitString[0];
00111           const std::string& looseTrig = splitString[1];
00112           //this step is necessary as we want to transfer ownership of eleCut to the addTrigLooseTrigHist func on the last iteration
00113           //but clone it before that
00114           //perhaps my object ownership rules need to be re-evalulated
00115           if(trigNr!=tightLooseTrigs.size()-2) addTightLooseTrigHist(monElems,tightTrig,looseTrig,objName,bins);
00116           else addTightLooseTrigHist(monElems,tightTrig,looseTrig,objName,bins);
00117         }
00118       }
00119     
00120 
00121   }//end namespace
00122 }
00123 #endif