CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

HLTTauDQMPathPlotter Class Reference

#include <HLTTauDQMPathPlotter.h>

List of all members.

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &, const std::vector< LVColl > &)
 HLTTauDQMPathPlotter (const edm::ParameterSet &, bool)
 ~HLTTauDQMPathPlotter ()

Private Member Functions

void endJob ()
LVColl getFilterCollection (size_t, int, const trigger::TriggerEventWithRefs &)
bool match (const LV &, const LVColl &, double)

Private Attributes

MonitorElementaccepted_events
MonitorElementaccepted_events_matched
bool doRefAnalysis_
std::vector< edm::InputTagfilter_
std::vector< int > LeptonType_
std::vector< double > matchDeltaR_
std::vector< unsigned > nTriggeredLeptons_
std::vector< unsigned > nTriggeredTaus_
double refLeptonPt_
double refTauPt_
std::vector< int > TauType_
edm::InputTag triggerEventObject_
 InputTag of TriggerEventWithRefs to analyze.
std::string triggerTag_

Detailed Description

Definition at line 35 of file HLTTauDQMPathPlotter.h.


Constructor & Destructor Documentation

HLTTauDQMPathPlotter::HLTTauDQMPathPlotter ( const edm::ParameterSet ps,
bool  ref 
)

Definition at line 5 of file HLTTauDQMPathPlotter.cc.

References accepted_events, accepted_events_matched, DQMStore::book1D(), doRefAnalysis_, filter_, gen::k, MonitorElement::setBinLabel(), DQMStore::setCurrentFolder(), and triggerTag_.

                                                                             : 
  triggerEventObject_(ps.getUntrackedParameter<edm::InputTag>("triggerEventObject")),
  triggerTag_(ps.getUntrackedParameter<std::string>("DQMFolder","DoubleTau")),
  filter_(ps.getUntrackedParameter<std::vector<edm::InputTag> >("Filter")),
  TauType_(ps.getUntrackedParameter<std::vector<int> >("TauType")),
  LeptonType_(ps.getUntrackedParameter<std::vector<int> >("LeptonType")),
  nTriggeredTaus_(ps.getUntrackedParameter<std::vector<unsigned> >("NTriggeredTaus")),
  nTriggeredLeptons_(ps.getUntrackedParameter<std::vector<unsigned> >("NTriggeredLeptons")),
  doRefAnalysis_(ref),
  matchDeltaR_(ps.getUntrackedParameter<std::vector<double> >("MatchDeltaR")),
  refTauPt_(ps.getUntrackedParameter<double>("refTauPt",20)),
  refLeptonPt_(ps.getUntrackedParameter<double>("refLeptonPt",15))
{
  //initialize 

  //  for(size_t k=0;k<filter_.size();++k)
  //   NEventsPassed.push_back(0);

  //  for(size_t k=0;k<=filter_.size();++k)
  //    NEventsPassedMatched.push_back(0);

  //Declare DQM Store
  DQMStore* store = &*edm::Service<DQMStore>();

  if(store)
    {
      //Create the histograms
      store->setCurrentFolder(triggerTag_);
      accepted_events = store->book1D("TriggerBits","Accepted Events per path",filter_.size(),0,filter_.size());
      for(size_t k=0;k<filter_.size();++k)
        accepted_events->setBinLabel(k+1,filter_[k].label(),1);

      if(doRefAnalysis_)
        {
          accepted_events_matched = store->book1D("MatchedTriggerBits","Accepted +Matched Events per path",filter_.size()+1,0,filter_.size()+1);
          accepted_events_matched->setBinLabel(1,"RefEvents",1);
          for(size_t k=0;k<filter_.size();++k)
            accepted_events_matched->setBinLabel(k+2,filter_[k].label(),1);
        }



    }

}
HLTTauDQMPathPlotter::~HLTTauDQMPathPlotter ( )

Definition at line 51 of file HLTTauDQMPathPlotter.cc.

{
}

Member Function Documentation

void HLTTauDQMPathPlotter::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup,
const std::vector< LVColl > &  refC 
)

Definition at line 60 of file HLTTauDQMPathPlotter.cc.

References accepted_events, accepted_events_matched, doRefAnalysis_, MonitorElement::Fill(), filter_, edm::Event::getByLabel(), getFilterCollection(), i, j, EgammaValidation_Wenu_cff::leptons, LeptonType_, match(), matchDeltaR_, nTriggeredLeptons_, nTriggeredTaus_, dt_offlineAnalysis_common_cff::reco, refLeptonPt_, refTauPt_, findQualityFiles::size, TauType_, and triggerEventObject_.

{
  using namespace std;
  using namespace edm;
  using namespace reco;
  using namespace l1extra;
  using namespace trigger;



  bool tau_ok=true;
  bool lepton_ok=true;

  bool isGoodReferenceEvent=false;

  if(doRefAnalysis_)
    {
      //Tau reference
      if(refC.size()>0)
        {
          if(refC[0].size()<nTriggeredTaus_[0])
            {
              tau_ok = false;
            }
          else
            {
              unsigned int highPtTaus=0;
              for(size_t j = 0;j<refC[0].size();++j)
                {
                  if((refC[0])[j].Et()>refTauPt_)
                    highPtTaus++;
                }
              if(highPtTaus<nTriggeredTaus_[0])
                {
                  tau_ok = false;
                }
         

            }
        }
      //lepton reference
      if(refC.size()>1) {
        if(refC[1].size()<nTriggeredLeptons_[0])
          {
            lepton_ok = false;
          }
        else  {
          unsigned int highPtLeptons=0;
          for(size_t j = 0;j<refC[1].size();++j)
            {
              if((refC[1])[j].Et()>refLeptonPt_)
                highPtLeptons++;
            }
          if(highPtLeptons<nTriggeredLeptons_[0])
            {
              lepton_ok = false;
            }
          
        }
          
        if(lepton_ok&&tau_ok)
          {
            accepted_events_matched->Fill(0.5);
            isGoodReferenceEvent=true;
          }
      }

    }


  Handle<TriggerEventWithRefs> trigEv;
  bool   gotTEV=iEvent.getByLabel(triggerEventObject_,trigEv) &&trigEv.isValid();

  if(gotTEV)
    {

      if (trigEv.isValid()) 
        {


          //Loop through the filters
          for(size_t i=0;i<filter_.size();++i)
            {
        
              size_t ID =trigEv->filterIndex(filter_[i]);
              if(ID!=trigEv->size())
                {
                      LVColl leptons = getFilterCollection(ID,LeptonType_[i],*trigEv);
                      LVColl taus = getFilterCollection(ID,TauType_[i],*trigEv);
                      //Fired
  
                      if(leptons.size()>=nTriggeredLeptons_[i+1] && taus.size()>=nTriggeredTaus_[i+1])
                        {
                          accepted_events->Fill(i+0.5);
                          //Now do the matching only though if we have a good reference event
                          if(doRefAnalysis_)
                          if(isGoodReferenceEvent)
                            {
                              
                              size_t nT=0;
                                for(size_t j=0;j<taus.size();++j)
                                  {
                                    if(match(taus[j],refC[0],matchDeltaR_[i]))
                                      nT++;

                                  }
                              size_t nL=0;
                                for(size_t j=0;j<leptons.size();++j)
                                  {
                                    if(match(leptons[j],refC[1],matchDeltaR_[i]))
                                      nL++;

                                  }
                                if(nT>=nTriggeredTaus_[i+1]&&nL>=nTriggeredLeptons_[i+1])
                                  accepted_events_matched->Fill(i+1.5);
                        }
                    }
                }
            }
        }
    }
}
void HLTTauDQMPathPlotter::endJob ( ) [private]
LVColl HLTTauDQMPathPlotter::getFilterCollection ( size_t  filterID,
int  id,
const trigger::TriggerEventWithRefs trigEv 
) [private]

Definition at line 208 of file HLTTauDQMPathPlotter.cc.

References trigger::TriggerEventWithRefs::getObjects(), i, VarParsing::obj, dbtoconf::out, trigger::TriggerElectron, trigger::TriggerL1CenJet, trigger::TriggerL1IsoEG, trigger::TriggerL1Mu, trigger::TriggerL1NoIsoEG, trigger::TriggerL1TauJet, trigger::TriggerMuon, and trigger::TriggerTau.

Referenced by analyze().

{
  using namespace trigger;

  LVColl out;


          if(id==trigger::TriggerL1IsoEG ||trigger::TriggerL1NoIsoEG) 
            {
              VRl1em obj;
              trigEv.getObjects(filterID,id,obj);
              for(size_t i=0;i<obj.size();++i)
                if(obj.at(i).isAvailable())
                    out.push_back(obj[i]->p4());
            }

          if(id==trigger::TriggerL1Mu) 
            {
              VRl1muon obj;
              trigEv.getObjects(filterID,id,obj);
              for(size_t i=0;i<obj.size();++i)
                if(obj.at(i).isAvailable())

                    out.push_back(obj[i]->p4());
            }


          if(id==trigger::TriggerMuon) 
            {
              VRmuon obj;
              trigEv.getObjects(filterID,id,obj);
              for(size_t i=0;i<obj.size();++i)
                if(obj.at(i).isAvailable())

                    out.push_back(obj[i]->p4());
            }

          if(id==trigger::TriggerElectron) 
            {
              VRelectron obj;
              trigEv.getObjects(filterID,id,obj);
              for(size_t i=0;i<obj.size();++i)
                if(obj.at(i).isAvailable())
                    out.push_back(obj[i]->p4());
            }

          if(id==trigger::TriggerL1TauJet) 
            {
              VRl1jet obj;
              trigEv.getObjects(filterID,id,obj);
              for(size_t i=0;i<obj.size();++i)
                if(obj.at(i).isAvailable())
                    out.push_back(obj[i]->p4());
              trigEv.getObjects(filterID,trigger::TriggerL1CenJet,obj);
              for(size_t i=0;i<obj.size();++i)
                if(obj.at(i).isAvailable())
                    out.push_back(obj[i]->p4());

            }

          if(id==trigger::TriggerTau) 
            {
              VRjet obj;
              trigEv.getObjects(filterID,id,obj);
              for(size_t i=0;i<obj.size();++i)
                if(obj.at(i).isAvailable())
                    out.push_back(obj[i]->p4());
            }

          return out;
}
bool HLTTauDQMPathPlotter::match ( const LV jet,
const LVColl McInfo,
double  dr 
) [private]

Definition at line 188 of file HLTTauDQMPathPlotter.cc.

References delta.

Referenced by analyze().

{
 
  bool matched=false;

  if(McInfo.size()>0)
    for(std::vector<LV>::const_iterator it = McInfo.begin();it!=McInfo.end();++it)
      {
        double delta = ROOT::Math::VectorUtil::DeltaR(jet,*it);
        if(delta<dr)
          {
            matched=true;
          }
      }

  return matched;
}

Member Data Documentation

Definition at line 70 of file HLTTauDQMPathPlotter.h.

Referenced by analyze(), and HLTTauDQMPathPlotter().

Definition at line 71 of file HLTTauDQMPathPlotter.h.

Referenced by analyze(), and HLTTauDQMPathPlotter().

Definition at line 66 of file HLTTauDQMPathPlotter.h.

Referenced by analyze(), and HLTTauDQMPathPlotter().

Definition at line 58 of file HLTTauDQMPathPlotter.h.

Referenced by analyze(), and HLTTauDQMPathPlotter().

std::vector<int> HLTTauDQMPathPlotter::LeptonType_ [private]

Definition at line 60 of file HLTTauDQMPathPlotter.h.

Referenced by analyze().

std::vector<double> HLTTauDQMPathPlotter::matchDeltaR_ [private]

Definition at line 67 of file HLTTauDQMPathPlotter.h.

Referenced by analyze().

std::vector<unsigned> HLTTauDQMPathPlotter::nTriggeredLeptons_ [private]

Definition at line 64 of file HLTTauDQMPathPlotter.h.

Referenced by analyze().

std::vector<unsigned> HLTTauDQMPathPlotter::nTriggeredTaus_ [private]

Definition at line 63 of file HLTTauDQMPathPlotter.h.

Referenced by analyze().

Definition at line 74 of file HLTTauDQMPathPlotter.h.

Referenced by analyze().

Definition at line 73 of file HLTTauDQMPathPlotter.h.

Referenced by analyze().

std::vector<int> HLTTauDQMPathPlotter::TauType_ [private]

Definition at line 59 of file HLTTauDQMPathPlotter.h.

Referenced by analyze().

InputTag of TriggerEventWithRefs to analyze.

Definition at line 52 of file HLTTauDQMPathPlotter.h.

Referenced by analyze().

std::string HLTTauDQMPathPlotter::triggerTag_ [private]

Definition at line 55 of file HLTTauDQMPathPlotter.h.

Referenced by HLTTauDQMPathPlotter().