CMS 3D CMS Logo

Public Member Functions | Private Attributes

HLTFiltCand Class Reference

#include <HLTFiltCand.h>

Inheritance diagram for HLTFiltCand:
HLTFilter edm::EDFilter edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

virtual bool filter (edm::Event &, const edm::EventSetup &)
 HLTFiltCand (const edm::ParameterSet &)
 ~HLTFiltCand ()

Private Attributes

edm::InputTag ecalTag_
edm::InputTag elecTag_
edm::InputTag jetsTag_
edm::InputTag metsTag_
edm::InputTag mhtsTag_
double min_Pt_
edm::InputTag muonTag_
edm::InputTag photTag_
bool saveTags_
edm::InputTag tausTag_
edm::InputTag trckTag_

Detailed Description

This class is an HLTFilter (-> EDFilter) implementing a very basic HLT trigger acting on candidates, requiring a g/e/m/j tuple above pt cuts

Date:
2009/04/08 14:24:27
Revision:
1.4
Author:
Martin Grunewald

See header file for documentation

Date:
2009/04/08 14:24:27
Revision:
1.13
Author:
Martin Grunewald

This class is an HLTFilter (-> EDFilter) implementing a minimum-bias HLT trigger acting on candidates, requiring tracks in Pixel det

Date:
2007/03/30 15:56:10
Author:
Mika Huhtinen

This class is an HLTFilter (-> EDFilter) implementing a minimum-bias HLT trigger acting on candidates, requiring tracks in Pixel det

Date:
2007/09/11 09:28:19
Author:
Mika Huhtinen

Definition at line 24 of file HLTFiltCand.h.


Constructor & Destructor Documentation

HLTFiltCand::HLTFiltCand ( const edm::ParameterSet iConfig) [explicit]

Definition at line 45 of file HLTFiltCand.cc.

References ecalTag_, elecTag_, edm::InputTag::encode(), jetsTag_, LogDebug, metsTag_, mhtsTag_, min_Pt_, muonTag_, photTag_, tausTag_, and trckTag_.

                                                       :
  photTag_ (iConfig.getParameter<edm::InputTag>("photTag")),
  elecTag_ (iConfig.getParameter<edm::InputTag>("elecTag")),
  muonTag_ (iConfig.getParameter<edm::InputTag>("muonTag")),
  tausTag_ (iConfig.getParameter<edm::InputTag>("tausTag")),
  jetsTag_ (iConfig.getParameter<edm::InputTag>("jetsTag")),
  metsTag_ (iConfig.getParameter<edm::InputTag>("metsTag")),
  mhtsTag_ (iConfig.getParameter<edm::InputTag>("mhtsTag")),
  trckTag_ (iConfig.getParameter<edm::InputTag>("trckTag")),
  ecalTag_ (iConfig.getParameter<edm::InputTag>("ecalTag")),
  saveTags_(iConfig.getUntrackedParameter<bool>("saveTags",false)),
  min_Pt_  (iConfig.getParameter<double>("MinPt"))
{
  LogDebug("") << "MinPt cut " << min_Pt_
   << " g: " << photTag_.encode()
   << " e: " << elecTag_.encode()
   << " m: " << muonTag_.encode()
   << " t: " << tausTag_.encode()
   << " j: " << jetsTag_.encode()
   << " M: " << metsTag_.encode()
   << " H: " << mhtsTag_.encode()
   <<" TR: " << trckTag_.encode()
   <<" SC: " << ecalTag_.encode()
   ;

   //register your products
   produces<trigger::TriggerFilterObjectWithRefs>();
}
HLTFiltCand::~HLTFiltCand ( )

Definition at line 74 of file HLTFiltCand.cc.

{
}

Member Function Documentation

bool HLTFiltCand::filter ( edm::Event iEvent,
const edm::EventSetup iSetup 
) [virtual]

Implements HLTFilter.

Definition at line 84 of file HLTFiltCand.cc.

References accept(), ecalTag_, elecTag_, edm::Event::getByLabel(), analyzePatCleaning_cfg::jets, jetsTag_, LogDebug, metsTag_, mhtsTag_, min_Pt_, module(), ExpressReco_HICollisions_FallBack::muons, muonTag_, path(), ExpressReco_HICollisions_FallBack::photons, photTag_, edm::Event::put(), dt_offlineAnalysis_common_cff::reco, saveTags_, tausTag_, trckTag_, trigger::TriggerCluster, trigger::TriggerElectron, trigger::TriggerJet, trigger::TriggerMET, trigger::TriggerMHT, trigger::TriggerMuon, trigger::TriggerPhoton, trigger::TriggerTau, and trigger::TriggerTrack.

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

   // All HLT filters must create and fill an HLT filter object,
   // recording any reconstructed physics objects satisfying (or not)
   // this HLT filter, and place it in the Event.

   // The filter object
   auto_ptr<TriggerFilterObjectWithRefs> 
     filterobject (new TriggerFilterObjectWithRefs(path(),module()));
   if (saveTags_) {
     filterobject->addCollectionTag(photTag_);
     filterobject->addCollectionTag(elecTag_);
     filterobject->addCollectionTag(muonTag_);
     filterobject->addCollectionTag(tausTag_);
     filterobject->addCollectionTag(jetsTag_);
     filterobject->addCollectionTag(metsTag_);
     filterobject->addCollectionTag(mhtsTag_);
     filterobject->addCollectionTag(trckTag_);
     filterobject->addCollectionTag(ecalTag_);
   }

   // Specific filter code

   // get hold of products from Event

   Handle<RecoEcalCandidateCollection>   photons;
   Handle<ElectronCollection> electrons;
   Handle<RecoChargedCandidateCollection>     muons;
   Handle<CaloJetCollection>  taus;
   Handle<CaloJetCollection>  jets;
   Handle<CaloMETCollection>  mets;
   Handle<METCollection>      mhts;
   Handle<RecoChargedCandidateCollection> trcks;
   Handle<RecoEcalCandidateCollection>    ecals;

   iEvent.getByLabel(photTag_,photons  );
   iEvent.getByLabel(elecTag_,electrons);
   iEvent.getByLabel(muonTag_,muons    );
   iEvent.getByLabel(tausTag_,taus     );
   iEvent.getByLabel(jetsTag_,jets     );
   iEvent.getByLabel(metsTag_,mets     );
   iEvent.getByLabel(mhtsTag_,mhts     );
   iEvent.getByLabel(trckTag_,trcks    );
   iEvent.getByLabel(ecalTag_,ecals    );


   // look for at least one g,e,m,t,j,M,H,TR,SC above its pt cut

   // photons
   int nphot(0);
   RecoEcalCandidateCollection::const_iterator aphot(photons->begin());
   RecoEcalCandidateCollection::const_iterator ophot(photons->end());
   RecoEcalCandidateCollection::const_iterator iphot;
   for (iphot=aphot; iphot!=ophot; iphot++) {
     if (iphot->pt() >= min_Pt_) {
       nphot++;
       RecoEcalCandidateRef ref(RecoEcalCandidateRef(photons,distance(aphot,iphot)));
       filterobject->addObject(TriggerPhoton,ref);
     }
   }

   // electrons
   int nelec(0);
   ElectronCollection::const_iterator aelec(electrons->begin());
   ElectronCollection::const_iterator oelec(electrons->end());
   ElectronCollection::const_iterator ielec;
   for (ielec=aelec; ielec!=oelec; ielec++) {
     if (ielec->pt() >= min_Pt_) {
       nelec++;
       ElectronRef ref(ElectronRef(electrons,distance(aelec,ielec)));
       filterobject->addObject(-TriggerElectron,ref);
     }
   }

   // muon
   int nmuon(0);
   RecoChargedCandidateCollection::const_iterator amuon(muons->begin());
   RecoChargedCandidateCollection::const_iterator omuon(muons->end());
   RecoChargedCandidateCollection::const_iterator imuon;
   for (imuon=amuon; imuon!=omuon; imuon++) {
     if (imuon->pt() >= min_Pt_) {
       nmuon++;
       RecoChargedCandidateRef ref(RecoChargedCandidateRef(muons,distance(amuon,imuon)));
       filterobject->addObject(TriggerMuon,ref);
     }
   }

   // taus (are stored as jets)
   int ntaus(0);
   CaloJetCollection::const_iterator ataus(taus->begin());
   CaloJetCollection::const_iterator otaus(taus->end());
   CaloJetCollection::const_iterator itaus;
   for (itaus=ataus; itaus!=otaus; itaus++) {
     if (itaus->pt() >= min_Pt_) {
       ntaus++;
       CaloJetRef ref(CaloJetRef(taus,distance(ataus,itaus)));
       filterobject->addObject(-TriggerTau,ref);
     }
   }

   // jets
   int njets(0);
   CaloJetCollection::const_iterator ajets(jets->begin());
   CaloJetCollection::const_iterator ojets(jets->end());
   CaloJetCollection::const_iterator ijets;
   for (ijets=ajets; ijets!=ojets; ijets++) {
     if (ijets->pt() >= min_Pt_) {
       njets++;
       CaloJetRef ref(CaloJetRef(jets,distance(ajets,ijets)));
       filterobject->addObject(TriggerJet,ref);
     }
   }

   // mets
   int nmets(0);
   CaloMETCollection::const_iterator amets(mets->begin());
   CaloMETCollection::const_iterator omets(mets->end());
   CaloMETCollection::const_iterator imets;
   for (imets=amets; imets!=omets; imets++) {
     if (imets->pt() >= min_Pt_) {
       nmets++;
       CaloMETRef ref(CaloMETRef(mets,distance(amets,imets)));
       filterobject->addObject(TriggerMET,ref);
     }
   }

   // mhts
   int nmhts(0);
   METCollection::const_iterator amhts(mhts->begin());
   METCollection::const_iterator omhts(mhts->end());
   METCollection::const_iterator imhts;
   for (imhts=amhts; imhts!=omhts; imhts++) {
     if (imhts->pt() >= min_Pt_) {
       nmhts++;
       METRef ref(METRef(mhts,distance(amhts,imhts)));
       filterobject->addObject(TriggerMHT,ref);
     }
   }

   // trcks
   int ntrck(0);
   RecoChargedCandidateCollection::const_iterator atrcks(trcks->begin());
   RecoChargedCandidateCollection::const_iterator otrcks(trcks->end());
   RecoChargedCandidateCollection::const_iterator itrcks;
   for (itrcks=atrcks; itrcks!=otrcks; itrcks++) {
     if (itrcks->pt() >= min_Pt_) {
       ntrck++;
       RecoChargedCandidateRef ref(RecoChargedCandidateRef(trcks,distance(atrcks,itrcks)));
       filterobject->addObject(TriggerTrack,ref);
     }
   }

   // ecals
   int necal(0);
   RecoEcalCandidateCollection::const_iterator aecals(ecals->begin());
   RecoEcalCandidateCollection::const_iterator oecals(ecals->end());
   RecoEcalCandidateCollection::const_iterator iecals;
   for (iecals=aecals; iecals!=oecals; iecals++) {
     if (iecals->pt() >= min_Pt_) {
       necal++;
       RecoEcalCandidateRef ref(RecoEcalCandidateRef(ecals,distance(aecals,iecals)));
       filterobject->addObject(TriggerCluster,ref);
     }
   }

   // error case
   // filterobject->addObject(0,Ref<vector<int> >());

   // final filter decision:
   const bool accept ( (nphot>0) && (nelec>0) && (nmuon>0) && (ntaus>0) &&
                       (njets>0) && (nmets>0) && (nmhts>=0) && (ntrck>0) && (necal>0) );

   // All filters: put filter object into the Event
   iEvent.put(filterobject);

   LogDebug("") << "Number of g/e/m/t/j/M/H/TR/SC objects accepted:"
                << " " << nphot
                << " " << nelec
                << " " << nmuon
                << " " << ntaus
                << " " << njets
                << " " << nmets
                << " " << nmhts
                << " " << ntrck
                << " " << necal
                ;

   // return with final filter decision
   return accept;
}

Member Data Documentation

Definition at line 40 of file HLTFiltCand.h.

Referenced by filter(), and HLTFiltCand().

Definition at line 33 of file HLTFiltCand.h.

Referenced by filter(), and HLTFiltCand().

Definition at line 36 of file HLTFiltCand.h.

Referenced by filter(), and HLTFiltCand().

Definition at line 37 of file HLTFiltCand.h.

Referenced by filter(), and HLTFiltCand().

Definition at line 38 of file HLTFiltCand.h.

Referenced by filter(), and HLTFiltCand().

double HLTFiltCand::min_Pt_ [private]

Definition at line 44 of file HLTFiltCand.h.

Referenced by filter(), and HLTFiltCand().

Definition at line 34 of file HLTFiltCand.h.

Referenced by filter(), and HLTFiltCand().

Definition at line 32 of file HLTFiltCand.h.

Referenced by filter(), and HLTFiltCand().

bool HLTFiltCand::saveTags_ [private]

Definition at line 42 of file HLTFiltCand.h.

Referenced by filter().

Definition at line 35 of file HLTFiltCand.h.

Referenced by filter(), and HLTFiltCand().

Definition at line 39 of file HLTFiltCand.h.

Referenced by filter(), and HLTFiltCand().