CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | 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

Public Member Functions

 JetCollectionForEleHT (const edm::ParameterSet &)
 
 ~JetCollectionForEleHT ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (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
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

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.

48  :
49  hltElectronTag(iConfig.getParameter< edm::InputTag > ("HltElectronTag")),
50  sourceJetTag(iConfig.getParameter< edm::InputTag > ("SourceJetTag")),
51  minDeltaR_(iConfig.getParameter< double > ("minDeltaR"))
52 {
53  produces<reco::CaloJetCollection>();
54 }
T getParameter(std::string const &) const
JetCollectionForEleHT::~JetCollectionForEleHT ( )

Definition at line 58 of file JetCollectionForEleHT.cc.

59 {
60 
61  // do anything here that needs to be done at desctruction time
62  // (e.g. close files, deallocate resources etc.)
63 
64 }

Member Function Documentation

void JetCollectionForEleHT::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 152 of file JetCollectionForEleHT.cc.

153 {
154 }
void JetCollectionForEleHT::endJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 158 of file JetCollectionForEleHT.cc.

158  {
159 }
void JetCollectionForEleHT::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 67 of file JetCollectionForEleHT.cc.

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

67  {
69  desc.add<edm::InputTag>("HltElectronTag",edm::InputTag("triggerFilterObjectWithRefs"));
70  desc.add<edm::InputTag>("SourceJetTag",edm::InputTag("caloJetCollection"));
71  desc.add<double>("minDeltaR",0.5);
72  descriptions.add("hltJetCollectionForEleHT",desc);
73 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void JetCollectionForEleHT::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

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 detailsBasic3DVector::z.

84 {
85  using namespace edm;
86 
88  iEvent.getByLabel(hltElectronTag,PrevFilterOutput);
89 
90  //its easier on the if statement flow if I try everything at once, shouldnt add to timing
91  std::vector<edm::Ref<reco::RecoEcalCandidateCollection> > clusCands;
92  PrevFilterOutput->getObjects(trigger::TriggerCluster,clusCands);
93  std::vector<edm::Ref<reco::ElectronCollection> > eleCands;
94  PrevFilterOutput->getObjects(trigger::TriggerElectron,eleCands);
95 
96  //prepare the collection of 3-D vector for electron momenta
97  std::vector<TVector3> ElePs;
98 
99  if(!clusCands.empty()){ //try trigger cluster
100  for(size_t candNr=0;candNr<clusCands.size();candNr++){
101  TVector3 positionVector(
102  clusCands[candNr]->superCluster()->position().x(),
103  clusCands[candNr]->superCluster()->position().y(),
104  clusCands[candNr]->superCluster()->position().z());
105  ElePs.push_back(positionVector);
106  }
107  }else if(!eleCands.empty()){ // try trigger electrons
108  for(size_t candNr=0;candNr<eleCands.size();candNr++){
109  TVector3 positionVector(
110  eleCands[candNr]->superCluster()->position().x(),
111  eleCands[candNr]->superCluster()->position().y(),
112  eleCands[candNr]->superCluster()->position().z());
113  ElePs.push_back(positionVector);
114  }
115  }
116 
117  edm::Handle<reco::CaloJetCollection> theCaloJetCollectionHandle;
118  iEvent.getByLabel(sourceJetTag, theCaloJetCollectionHandle);
119  const reco::CaloJetCollection* theCaloJetCollection = theCaloJetCollectionHandle.product();
120 
121  std::auto_ptr< reco::CaloJetCollection > theFilteredCaloJetCollection(new reco::CaloJetCollection);
122 
123  bool isOverlapping;
124 
125  for(unsigned int j=0; j<theCaloJetCollection->size(); j++) {
126 
127  isOverlapping = false;
128  for(unsigned int i=0; i<ElePs.size(); i++) {
129 
130  TVector3 JetP((*theCaloJetCollection)[j].px(), (*theCaloJetCollection)[j].py(), (*theCaloJetCollection)[j].pz());
131  double DR = ElePs[i].DeltaR(JetP);
132 
133  if(DR<minDeltaR_) {
134  isOverlapping = true;
135  break;
136  }
137  }
138 
139  if(!isOverlapping) theFilteredCaloJetCollection->push_back((*theCaloJetCollection)[j]);
140  }
141 
142  //do the filtering
143 
144  iEvent.put(theFilteredCaloJetCollection);
145 
146  return;
147 
148 }
int i
Definition: DBlmapReader.cc:9
double double double z
static int position[TOTALCHAMBERS][3]
Definition: ReadPGInfo.cc:509
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
int j
Definition: DBlmapReader.cc:9
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
Definition: DDAxes.h:10
std::vector< CaloJet > CaloJetCollection
collection of CaloJet objects

Member Data Documentation

edm::InputTag JetCollectionForEleHT::hltElectronTag
private

Definition at line 63 of file JetCollectionForEleHT.h.

Referenced by produce().

float JetCollectionForEleHT::minDeltaR_
private

Definition at line 66 of file JetCollectionForEleHT.h.

Referenced by produce().

edm::InputTag JetCollectionForEleHT::sourceJetTag
private

Definition at line 64 of file JetCollectionForEleHT.h.

Referenced by produce().