CMS 3D CMS Logo

EgHLTOffEleSel Class Reference

#include <DQMOffline/Trigger/interface/EgHLTOffEleSel.h>

List of all members.

Public Member Functions

void addCuts (const CutValues &cuts)
void clearCuts ()
 EgHLTOffEleSel (const EgHLTOffEleSel &rhs)
 EgHLTOffEleSel ()
int getCutCode (const EgHLTOffEle &ele, int cutMask=~0x0) const
const CutValuesgetCuts (int type) const
CutValuesgetCuts (int type)
const CutValuesgetCutsByIndx (int cutNr) const
CutValuesgetCutsByIndx (int cutNr)
int nrCuts () const
EgHLTOffEleSeloperator= (const EgHLTOffEleSel &rhs)
bool passCuts (const EgHLTOffEle &ele, int cutMask=~0x0) const
void removeCuts (int cutCode, int eleType=~0x0)
void setCutMask (int cutMask, int eleType=~0x0)
void setHighNrgy ()
void setMinEt (float minEt, int eleType=~0x0)
void setPreSel ()
void setPreSelWithEp ()
 ~EgHLTOffEleSel ()

Static Public Member Functions

static int getCutCode (const EgHLTOffEle &ele, const CutValues &cuts, int cutMask=~0x0)

Private Attributes

std::vector< CutValuescutValues_


Detailed Description

Definition at line 10 of file EgHLTOffEleSel.h.


Constructor & Destructor Documentation

EgHLTOffEleSel::EgHLTOffEleSel (  ) 

Definition at line 6 of file EgHLTOffEleSel.cc.

00007 {
00008 
00009 }

EgHLTOffEleSel::EgHLTOffEleSel ( const EgHLTOffEleSel rhs  )  [inline]

Definition at line 18 of file EgHLTOffEleSel.h.

00018 :cutValues_(rhs.cutValues_){}

EgHLTOffEleSel::~EgHLTOffEleSel (  )  [inline]

Definition at line 19 of file EgHLTOffEleSel.h.

00019 {} 


Member Function Documentation

void EgHLTOffEleSel::addCuts ( const CutValues cuts  )  [inline]

Definition at line 28 of file EgHLTOffEleSel.h.

References cutValues_.

Referenced by setHighNrgy(), setPreSel(), and setPreSelWithEp().

00028 {cutValues_.push_back(cuts);}

void EgHLTOffEleSel::clearCuts (  )  [inline]

Definition at line 42 of file EgHLTOffEleSel.h.

References cutValues_.

Referenced by setHighNrgy(), setPreSel(), and setPreSelWithEp().

00042 {cutValues_.clear();}

int EgHLTOffEleSel::getCutCode ( const EgHLTOffEle ele,
const CutValues cuts,
int  cutMask = ~0x0 
) [static]

Definition at line 50 of file EgHLTOffEleSel.cc.

References EgHLTOffEle::bremFrac(), CutCodes::BREMFRAC, EgHLTOffEle::classification(), CutCodes::CRACK, CutValues::cutMask, EgHLTOffEle::dEtaIn(), CutCodes::DETAIN, CutCodes::DETETA, EgHLTOffEle::dPhiIn(), CutCodes::DPHIIN, CutCodes::DPHIOUT, EgHLTOffEle::dPhiOut(), CutCodes::EPIN, EgHLTOffEle::epIn(), CutValues::epInReleaseEtCut, EgHLTOffEle::epOut(), CutCodes::EPOUT, EgHLTOffEle::et(), CutCodes::ET, EgHLTOffEle::etaSC(), EgHLTOffEle::etSC(), CutCodes::HADEM, EgHLTOffEle::hOverE(), CutCodes::INVEINVP, EgHLTOffEle::invEOverInvP(), CutCodes::ISOLEM, EgHLTOffEle::isolEm(), CutValues::isolEmGradCut, CutCodes::ISOLHAD, EgHLTOffEle::isolHad(), CutValues::isolHadGradCut, CutCodes::ISOLNRTRKS, EgHLTOffEle::isolNrTrks(), CutCodes::ISOLPTTRKS, EgHLTOffEle::isolPtTrks(), CutValues::isolPtTrksGradCut, CutValues::maxDEtaInCut, CutValues::maxDPhiInCut, CutValues::maxDPhiOutCut, CutValues::maxEpInCut, CutValues::maxEpOutCut, CutValues::maxEtaCut, CutValues::maxHademCut, CutValues::maxInvEInvPCut, CutValues::maxSigmaEtaEtaCut, CutValues::minBremFracCut, CutValues::minEpInCut, CutValues::minEpOutCut, CutValues::minEtaCut, CutValues::minEtCut, CutValues::minIsolEmConstCut, CutValues::minIsolHadConstCut, CutValues::minIsolNrTrksConstCut, CutValues::minIsolPtTrksConstCut, CutValues::minSigmaEtaEtaCut, CutValues::rejectCracks, CutCodes::SIGMAETAETA, and EgHLTOffEle::sigmaEtaEta().

00051 { 
00052   int cutCode = 0x0;
00053   if(ele.et()< cuts.minEtCut) cutCode |= CutCodes::ET;
00054   if(fabs(ele.etaSC())< cuts.minEtaCut || fabs(ele.etaSC())>cuts.maxEtaCut) cutCode |= CutCodes::DETETA;
00055   if(ele.classification()==40 && cuts.rejectCracks) cutCode |= CutCodes::CRACK;
00056   if((ele.epIn()< cuts.minEpInCut || ele.epIn()> cuts.maxEpInCut) &&  ele.etSC()<cuts.epInReleaseEtCut ) cutCode |=CutCodes::EPIN;
00057   if(fabs(ele.dEtaIn()) > cuts.maxDEtaInCut ) cutCode |=CutCodes::DETAIN;
00058   if(fabs(ele.dPhiIn()) > cuts.maxDPhiInCut ) cutCode |=CutCodes::DPHIIN;
00059   if(ele.hOverE()> cuts.maxHademCut) cutCode |= CutCodes::HADEM;
00060   if(ele.epOut()< cuts.minEpOutCut || ele.epOut()>cuts.maxEpOutCut) cutCode |=CutCodes::EPOUT;
00061   if(fabs(ele.dPhiOut()) > cuts.maxDPhiOutCut) cutCode |=CutCodes::DPHIOUT;
00062   if(ele.invEOverInvP() > cuts.maxInvEInvPCut) cutCode |= CutCodes::INVEINVP;
00063   if(ele.bremFrac() < cuts.minBremFracCut) cutCode |= CutCodes::BREMFRAC;
00064   //if(ele.e9OverE25() < cuts.minE9E25Cut) cutCode |= CutCodes::E9OVERE25;
00065   if(ele.sigmaEtaEta()<cuts.minSigmaEtaEtaCut || ele.sigmaEtaEta()>cuts.maxSigmaEtaEtaCut) cutCode |= CutCodes::SIGMAETAETA;
00066   //if(ele.sigmaPhiPhi()<cuts.minSigmaPhiPhiCut || ele.sigmaPhiPhi()>cuts.maxSigmaPhiPhiCut) cutCode |= CutCodes::SIGMAPHIPHI;
00067   if(ele.isolEm()>( cuts.minIsolEmConstCut + cuts.isolEmGradCut*ele.et())) cutCode |=CutCodes::ISOLEM;
00068   if(ele.isolHad()> (cuts.minIsolHadConstCut + cuts.isolHadGradCut*ele.et())) cutCode |=CutCodes::ISOLHAD;
00069   if(ele.isolPtTrks() > (cuts.minIsolPtTrksConstCut + cuts.isolPtTrksGradCut*ele.et())) cutCode |=CutCodes::ISOLPTTRKS;
00070   if(ele.isolNrTrks() > cuts.minIsolNrTrksConstCut) cutCode |=CutCodes::ISOLNRTRKS;
00071 
00072   return (cutCode & cuts.cutMask & cutMask) ;
00073 }

int EgHLTOffEleSel::getCutCode ( const EgHLTOffEle ele,
int  cutMask = ~0x0 
) const

Definition at line 12 of file EgHLTOffEleSel.cc.

References EgHLTOffEle::classification(), getCuts(), and NULL.

Referenced by EgHLTOffHelper::fillEgHLTOffEleVec(), and passCuts().

00013 {
00014   const CutValues& cuts = getCuts(ele.classification());
00015   if(&cuts!=NULL) return getCutCode(ele,cuts,cutMask);
00016   else return ~0x0;
00017 }

const CutValues & EgHLTOffEleSel::getCuts ( int  type  )  const

Definition at line 20 of file EgHLTOffEleSel.cc.

References GenMuonPlsPt100GeV_cfg::cout, cutValues_, lat::endl(), index, and EleTypeCodes::makeTypeCode().

00021 {
00022   int cutIndex=0;
00023   int nrMatches = 0;
00024   for(unsigned index=0;index<cutValues_.size();index++){
00025     //std::cout <<"valid ele type code "<<std::hex<<cutValues_[index].validEleTypes<<" ele type code "<< EleTypeCodes::makeTypeCode(type) <<" should have code "<<EleTypeCodes::getCode("barrel:golden:narrow:bigBrem:showering")<<std::dec<<" ele type "<<type<<std::endl;
00026     if( (EleTypeCodes::makeTypeCode(type) & cutValues_[index].validEleTypes) == EleTypeCodes::makeTypeCode(type)){
00027       if(nrMatches==0) cutIndex = index;
00028       nrMatches++;
00029     }
00030   }
00031   if(nrMatches>=1){
00032     if(nrMatches>1) std::cout <<"EgHLTOffEleSel::getCuts: Warning have "<<nrMatches<<" for electron type "<<type<<std::endl;
00033     return cutValues_[cutIndex];
00034   }else{
00035     //std::cout <<"EgHLTOffEleSel::getCuts: Warning have "<<nrMatches<<" for electron type "<<type<<std::endl;
00036     CutValues* nullPointer=0; //there has to be a better way, basically I'm in a dire need of a way to return a null object safely when I dont have it and I'm not using exceptions
00037     return *nullPointer;
00038   }
00039 }

CutValues & EgHLTOffEleSel::getCuts ( int  type  ) 

Definition at line 41 of file EgHLTOffEleSel.cc.

References getCuts().

Referenced by getCutCode(), and getCuts().

00042 {
00043   const EgHLTOffEleSel* constThis = this;
00044   const CutValues& constCuts = constThis->getCuts(type);
00045   CutValues& cuts = *(const_cast<CutValues*>(&constCuts)); //is this evil code? Possibly, but I think its safe as all I'm doing is basically code reuse by using the const function and then casting the returned value to non const as in this case the object is really non-const 
00046   return cuts;
00047 
00048 }

const CutValues& EgHLTOffEleSel::getCutsByIndx ( int  cutNr  )  const [inline]

Definition at line 32 of file EgHLTOffEleSel.h.

References cutValues_.

00032 {return cutValues_[cutNr];}

CutValues& EgHLTOffEleSel::getCutsByIndx ( int  cutNr  )  [inline]

Definition at line 31 of file EgHLTOffEleSel.h.

References cutValues_.

00031 {return cutValues_[cutNr];} 

int EgHLTOffEleSel::nrCuts (  )  const [inline]

Definition at line 33 of file EgHLTOffEleSel.h.

References cutValues_.

00033 {return cutValues_.size();}

EgHLTOffEleSel& EgHLTOffEleSel::operator= ( const EgHLTOffEleSel rhs  )  [inline]

Definition at line 21 of file EgHLTOffEleSel.h.

References cutValues_.

00021 {cutValues_=rhs.cutValues_;return *this;}

bool EgHLTOffEleSel::passCuts ( const EgHLTOffEle ele,
int  cutMask = ~0x0 
) const [inline]

Definition at line 23 of file EgHLTOffEleSel.h.

References getCutCode().

00023 {return getCutCode(ele,cutMask)==0x0;}

void EgHLTOffEleSel::removeCuts ( int  cutCode,
int  eleType = ~0x0 
)

Definition at line 129 of file EgHLTOffEleSel.cc.

References cutValues_.

00130 {
00131   for(size_t cutValNr=0;cutValNr<cutValues_.size();cutValNr++){
00132     if((eleType&cutValues_[cutValNr].validEleTypes)!=0){
00133       cutValues_[cutValNr].cutMask &= ~cutCode;
00134     }
00135   }
00136 }

void EgHLTOffEleSel::setCutMask ( int  cutMask,
int  eleType = ~0x0 
)

Definition at line 119 of file EgHLTOffEleSel.cc.

References cutValues_.

00120 {
00121   for(size_t cutValNr=0;cutValNr<cutValues_.size();cutValNr++){
00122     if((eleType&cutValues_[cutValNr].validEleTypes)!=0){
00123       cutValues_[cutValNr].cutMask = cutMask;
00124     }
00125   }
00126    
00127 }

void EgHLTOffEleSel::setHighNrgy (  ) 

Definition at line 76 of file EgHLTOffEleSel.cc.

References addCuts(), clearCuts(), EleTypeCodes::getCode(), CutCodes::getCode(), CutValues::setEBHighNrgy(), CutValues::setEEHighNrgy(), and CutValues::validEleTypes.

Referenced by EgHLTOffHelper::setup().

00077 {
00078   clearCuts();
00079  
00080   CutValues ebCuts;
00081   CutValues eeCuts;
00082   ebCuts.setEBHighNrgy(CutCodes::getCode("et:detEta:crack:dEtaIn:dPhiIn:hadem:sigmaEtaEta:isolEm:isolHad:isolPtTrks"));
00083   ebCuts.validEleTypes = EleTypeCodes::getCode("barrel:golden:narrow:bigBrem:showering:crack");
00084   eeCuts.setEEHighNrgy(CutCodes::getCode("et:detEta:crack:dEtaIn:dPhiIn:hadem:sigmaEtaEta:isolEm:isolHad:isolPtTrks"));
00085   eeCuts.validEleTypes = EleTypeCodes::getCode("endcap:golden:narrow:bigBrem:showering:crack");
00086   addCuts(ebCuts);
00087   addCuts(eeCuts);
00088 }  

void EgHLTOffEleSel::setMinEt ( float  minEt,
int  eleType = ~0x0 
)

Definition at line 138 of file EgHLTOffEleSel.cc.

References cutValues_.

00139 {
00140   for(size_t cutValNr=0;cutValNr<cutValues_.size();cutValNr++){
00141     if((eleType&cutValues_[cutValNr].validEleTypes)!=0){
00142       cutValues_[cutValNr].minEtCut = minEt;
00143     }
00144   }
00145 }

void EgHLTOffEleSel::setPreSel (  ) 

Definition at line 91 of file EgHLTOffEleSel.cc.

References addCuts(), clearCuts(), EleTypeCodes::getCode(), CutCodes::getCode(), CutValues::setEBPreSel(), CutValues::setEEPreSel(), and CutValues::validEleTypes.

Referenced by EgHLTOffHelper::setup().

00092 {
00093   clearCuts();
00094  
00095   CutValues ebCuts;
00096   CutValues eeCuts;
00097   ebCuts.setEBPreSel(CutCodes::getCode("et:detEta:crack:dEtaIn:dPhiIn:hadem"));
00098   ebCuts.validEleTypes = EleTypeCodes::getCode("barrel:golden:narrow:bigBrem:showering:crack");
00099   eeCuts.setEEPreSel(CutCodes::getCode("et:detEta:crack:dEtaIn:dPhiIn:hadem"));
00100   eeCuts.validEleTypes = EleTypeCodes::getCode("endcap:golden:narrow:bigBrem:showering:crack");
00101   addCuts(ebCuts);
00102   addCuts(eeCuts);
00103 }  

void EgHLTOffEleSel::setPreSelWithEp (  ) 

Definition at line 105 of file EgHLTOffEleSel.cc.

References addCuts(), clearCuts(), EleTypeCodes::getCode(), CutCodes::getCode(), CutValues::setEBPreSel(), CutValues::setEEPreSel(), and CutValues::validEleTypes.

00106 {
00107   clearCuts();
00108  
00109   CutValues ebCuts;
00110   CutValues eeCuts;
00111   ebCuts.setEBPreSel(CutCodes::getCode("et:detEta:crack:dEtaIn:dPhiIn:hadem:epIn"));
00112   ebCuts.validEleTypes = EleTypeCodes::getCode("barrel:golden:narrow:bigBrem:showering:crack");
00113   eeCuts.setEEPreSel(CutCodes::getCode("et:detEta:crack:dEtaIn:dPhiIn:hadem:epIn"));
00114   eeCuts.validEleTypes = EleTypeCodes::getCode("endcap:golden:narrow:bigBrem:showering:crack");
00115   addCuts(ebCuts);
00116   addCuts(eeCuts);
00117 }


Member Data Documentation

std::vector<CutValues> EgHLTOffEleSel::cutValues_ [private]

Definition at line 14 of file EgHLTOffEleSel.h.

Referenced by addCuts(), clearCuts(), getCuts(), getCutsByIndx(), nrCuts(), operator=(), removeCuts(), setCutMask(), and setMinEt().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:20:12 2009 for CMSSW by  doxygen 1.5.4