CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

JetCollectionForEleHT Class Reference

#include <HLTrigger/JetCollectionForEleHT/src/JetCollectionForEleHT.cc>

Inheritance diagram for JetCollectionForEleHT:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

 JetCollectionForEleHT (const edm::ParameterSet &)
 ~JetCollectionForEleHT ()

Private Member Functions

virtual void beginJob ()
virtual void endJob ()
virtual void produce (edm::Event &, const edm::EventSetup &)

Private Attributes

edm::InputTag hltElectronTag
float minDeltaR_
edm::InputTag sourceJetTag

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 47 of file JetCollectionForEleHT.h.


Constructor & Destructor Documentation

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

Definition at line 48 of file JetCollectionForEleHT.cc.

                                                                          :
  hltElectronTag(iConfig.getParameter< edm::InputTag > ("HltElectronTag")),
  sourceJetTag(iConfig.getParameter< edm::InputTag > ("SourceJetTag")),
  minDeltaR_(iConfig.getParameter< double > ("minDeltaR"))
{
  produces<reco::CaloJetCollection>();
}
JetCollectionForEleHT::~JetCollectionForEleHT ( )

Definition at line 58 of file JetCollectionForEleHT.cc.

{
 
   // do anything here that needs to be done at desctruction time
   // (e.g. close files, deallocate resources etc.)

}

Member Function Documentation

void JetCollectionForEleHT::beginJob ( void  ) [private, virtual]

Reimplemented from edm::EDProducer.

Definition at line 144 of file JetCollectionForEleHT.cc.

{
}
void JetCollectionForEleHT::endJob ( void  ) [private, virtual]

Reimplemented from edm::EDProducer.

Definition at line 150 of file JetCollectionForEleHT.cc.

                              {
}
void JetCollectionForEleHT::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
) [private, virtual]

Implements edm::EDProducer.

Definition at line 75 of file JetCollectionForEleHT.cc.

References edm::Event::getByLabel(), hltElectronTag, i, j, minDeltaR_, position, edm::Event::put(), sourceJetTag, trigger::TriggerCluster, trigger::TriggerElectron, ExpressReco_HICollisions_FallBack::x, ExpressReco_HICollisions_FallBack::y, and z.

{
  using namespace edm;
  
  edm::Handle<trigger::TriggerFilterObjectWithRefs> PrevFilterOutput;
  iEvent.getByLabel(hltElectronTag,PrevFilterOutput);
 
  //its easier on the if statement flow if I try everything at once, shouldnt add to timing
  std::vector<edm::Ref<reco::RecoEcalCandidateCollection> > clusCands;
  PrevFilterOutput->getObjects(trigger::TriggerCluster,clusCands);
  std::vector<edm::Ref<reco::ElectronCollection> > eleCands;
  PrevFilterOutput->getObjects(trigger::TriggerElectron,eleCands);
  
  //prepare the collection of 3-D vector for electron momenta
  std::vector<TVector3> ElePs;

  if(!clusCands.empty()){ //try trigger cluster
    for(size_t candNr=0;candNr<clusCands.size();candNr++){
      TVector3 positionVector(
          clusCands[candNr]->superCluster()->position().x(),
          clusCands[candNr]->superCluster()->position().y(),
          clusCands[candNr]->superCluster()->position().z());
      ElePs.push_back(positionVector);
    }
  }else if(!eleCands.empty()){ // try trigger electrons
    for(size_t candNr=0;candNr<eleCands.size();candNr++){
      TVector3 positionVector(
          eleCands[candNr]->superCluster()->position().x(),
          eleCands[candNr]->superCluster()->position().y(),
          eleCands[candNr]->superCluster()->position().z());
      ElePs.push_back(positionVector);
    }
  }
  
  edm::Handle<reco::CaloJetCollection> theCaloJetCollectionHandle;
  iEvent.getByLabel(sourceJetTag, theCaloJetCollectionHandle);
  const reco::CaloJetCollection* theCaloJetCollection = theCaloJetCollectionHandle.product();

  std::auto_ptr< reco::CaloJetCollection >  theFilteredCaloJetCollection(new reco::CaloJetCollection);
  
  bool isOverlapping;
 
  for(unsigned int j=0; j<theCaloJetCollection->size(); j++) {

    isOverlapping = false;
    for(unsigned int i=0; i<ElePs.size(); i++) {
      
      TVector3 JetP((*theCaloJetCollection)[j].px(), (*theCaloJetCollection)[j].py(), (*theCaloJetCollection)[j].pz());
      double DR = ElePs[i].DeltaR(JetP);
      
      if(DR<minDeltaR_) {
              isOverlapping = true;
              break;
      }
    }
   
    if(!isOverlapping) theFilteredCaloJetCollection->push_back((*theCaloJetCollection)[j]);
  }
  
  //do the filtering

  iEvent.put(theFilteredCaloJetCollection);

  return;

}

Member Data Documentation

Definition at line 58 of file JetCollectionForEleHT.h.

Referenced by produce().

Definition at line 61 of file JetCollectionForEleHT.h.

Referenced by produce().

Definition at line 59 of file JetCollectionForEleHT.h.

Referenced by produce().