CMS 3D CMS Logo

Public Member Functions | Static 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 ()

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)

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 51 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 152 of file JetCollectionForEleHT.cc.

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

Reimplemented from edm::EDProducer.

Definition at line 158 of file JetCollectionForEleHT.cc.

                              {
}
void JetCollectionForEleHT::fillDescriptions ( edm::ConfigurationDescriptions descriptions) [static]

Reimplemented from edm::EDProducer.

Definition at line 67 of file JetCollectionForEleHT.cc.

References edm::ParameterSetDescription::add(), and edm::ConfigurationDescriptions::add().

                                                                                  {
  edm::ParameterSetDescription desc;
  desc.add<edm::InputTag>("HltElectronTag",edm::InputTag("triggerFilterObjectWithRefs"));
  desc.add<edm::InputTag>("SourceJetTag",edm::InputTag("caloJetCollection"));
  desc.add<double>("minDeltaR",0.5);
  descriptions.add("hltJetCollectionForEleHT",desc);
}
void JetCollectionForEleHT::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
) [private, virtual]

Implements edm::EDProducer.

Definition at line 83 of file JetCollectionForEleHT.cc.

References edm::Event::getByLabel(), hltElectronTag, i, j, minDeltaR_, position, edm::Event::put(), sourceJetTag, trigger::TriggerCluster, trigger::TriggerElectron, x, detailsBasic3DVector::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 63 of file JetCollectionForEleHT.h.

Referenced by produce().

Definition at line 66 of file JetCollectionForEleHT.h.

Referenced by produce().

Definition at line 64 of file JetCollectionForEleHT.h.

Referenced by produce().