CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
cms::AlCaDiJetsProducer Class Reference

#include <AlCaDiJetsProducer.h>

Inheritance diagram for cms::AlCaDiJetsProducer:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

 AlCaDiJetsProducer (const edm::ParameterSet &)
 
virtual void beginJob ()
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
 ~AlCaDiJetsProducer ()
 
- 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 ()
 

Private Attributes

bool allowMissingInputs_
 
std::vector< edm::InputTagecalLabels_
 
edm::InputTag hbheInput_
 
edm::InputTag hfInput_
 
edm::InputTag hoInput_
 
edm::InputTag jetsInput_
 

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

Definition at line 38 of file AlCaDiJetsProducer.h.

Constructor & Destructor Documentation

cms::AlCaDiJetsProducer::AlCaDiJetsProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 17 of file AlCaDiJetsProducer.cc.

References edm::ParameterSet::getParameter().

18 {
19  jetsInput_ = iConfig.getParameter<edm::InputTag>("jetsInput");
20  ecalLabels_=iConfig.getParameter<std::vector<edm::InputTag> >("ecalInputs");
21  hbheInput_ = iConfig.getParameter<edm::InputTag>("hbheInput");
22  hoInput_ = iConfig.getParameter<edm::InputTag>("hoInput");
23  hfInput_ = iConfig.getParameter<edm::InputTag>("hfInput");
24  allowMissingInputs_ = true;
25 
26 //register your products
27  produces<CaloJetCollection>("DiJetsBackToBackCollection");
28  produces<EcalRecHitCollection>("DiJetsEcalRecHitCollection");
29  produces<HBHERecHitCollection>("DiJetsHBHERecHitCollection");
30  produces<HORecHitCollection>("DiJetsHORecHitCollection");
31  produces<HFRecHitCollection>("DiJetsHFRecHitCollection");
32 
33 }
T getParameter(std::string const &) const
std::vector< edm::InputTag > ecalLabels_
cms::AlCaDiJetsProducer::~AlCaDiJetsProducer ( )

Definition at line 38 of file AlCaDiJetsProducer.cc.

39 {
40 
41 
42 }

Member Function Documentation

void cms::AlCaDiJetsProducer::beginJob ( void  )
virtual

Reimplemented from edm::EDProducer.

Definition at line 34 of file AlCaDiJetsProducer.cc.

35 {
36 }
void cms::AlCaDiJetsProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

Implements edm::EDProducer.

Definition at line 47 of file AlCaDiJetsProducer.cc.

References PV3DBase< T, PVType, FrameType >::eta(), eta(), edm::EventSetup::get(), edm::Event::getByLabel(), CaloGeometry::getPosition(), i, fwrapper::jets, phi, PV3DBase< T, PVType, FrameType >::phi(), reco::LeafCandidate::phi(), pi, pos, edm::ESHandle< class >::product(), edm::Event::put(), query::result, and mathSSE::sqrt().

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().

48 {
49 
50  double pi = 4.*atan(1.);
51 
52  std::auto_ptr<CaloJetCollection> result (new CaloJetCollection); //Corrected jets
53  std::auto_ptr<EcalRecHitCollection> miniDiJetsEcalRecHitCollection(new EcalRecHitCollection);
54  std::auto_ptr<HBHERecHitCollection> miniDiJetsHBHERecHitCollection(new HBHERecHitCollection);
55  std::auto_ptr<HORecHitCollection> miniDiJetsHORecHitCollection(new HORecHitCollection);
56  std::auto_ptr<HFRecHitCollection> miniDiJetsHFRecHitCollection(new HFRecHitCollection);
57 
59  iSetup.get<CaloGeometryRecord>().get(pG);
60  const CaloGeometry* geo = pG.product();
61 
62  // Jets Collections
63 
64  vector<CaloJet> jetv;
65 
66  CaloJet fJet1, fJet2, fJet3;
68  iEvent.getByLabel(jetsInput_, jets);
69  int iflag_select = 0;
70  if(jets->size()>1){
71  fJet1 = (*jets)[0];
72  fJet2 = (*jets)[1];
73  double dphi = fabs(fJet1.phi() - fJet2.phi());
74  if(dphi > pi){dphi = 2*pi - dphi;}
75  double degreedphi = dphi*180./pi;
76  if(fabs(degreedphi-180)<30.){iflag_select = 1;}
77  }
78  if(iflag_select == 1){
79  result->push_back(fJet1);
80  result->push_back(fJet2);
81  jetv.push_back(fJet1);
82  jetv.push_back(fJet2);
83  if(jets->size()>2){
84  fJet3 = (*jets)[2];
85  result->push_back(fJet3);
86  jetv.push_back(fJet3);
87  }
88  } else {
89  iEvent.put( result, "DiJetsBackToBackCollection");
90  iEvent.put( miniDiJetsEcalRecHitCollection,"DiJetsEcalRecHitCollection");
91  iEvent.put( miniDiJetsHBHERecHitCollection, "DiJetsHBHERecHitCollection");
92  iEvent.put( miniDiJetsHORecHitCollection, "DiJetsHORecHitCollection");
93  iEvent.put( miniDiJetsHFRecHitCollection, "DiJetsHFRecHitCollection");
94  return;
95  }
96 
97  // Ecal Collections
98 
99  std::vector<edm::InputTag>::const_iterator i;
100  for (i=ecalLabels_.begin(); i!=ecalLabels_.end(); i++) {
102  iEvent.getByLabel(*i,ec);
103  for(EcalRecHitCollection::const_iterator ecItr = (*ec).begin();
104  ecItr != (*ec).end(); ++ecItr)
105  {
106 // EcalBarrel = 1, EcalEndcap = 2
107  GlobalPoint pos = geo->getPosition(ecItr->detid());
108  double phihit = pos.phi();
109  double etahit = pos.eta();
110  int iflag_select = 0;
111  for(unsigned int i=0; i<jetv.size(); i++){
112  double deta = fabs(etahit - jetv[i].eta());
113  double dphi = fabs(phihit - jetv[i].phi());
114  if(dphi > pi) dphi = 2*pi - dphi;
115  double dr = sqrt(deta*deta+dphi*dphi);
116  if(dr < 1.4){iflag_select = 1;}
117  }
118  if(iflag_select==1){miniDiJetsEcalRecHitCollection->push_back(*ecItr);}
119  }
120 
121  }
122 
123  // HB & HE Collections
124 
126  iEvent.getByLabel(hbheInput_,hbhe);
127  for(HBHERecHitCollection::const_iterator hbheItr=hbhe->begin();
128  hbheItr!=hbhe->end(); hbheItr++)
129  {
130  GlobalPoint pos = geo->getPosition(hbheItr->detid());
131  double phihit = pos.phi();
132  double etahit = pos.eta();
133  int iflag_select = 0;
134  for(unsigned int i=0; i<jetv.size(); i++){
135  double deta = fabs(etahit - jetv[i].eta());
136  double dphi = fabs(phihit - jetv[i].phi());
137  if(dphi > pi) dphi = 2*pi - dphi;
138  double dr = sqrt(deta*deta+dphi*dphi);
139  if(dr < 1.4){iflag_select = 1;}
140  }
141  if(iflag_select==1){miniDiJetsHBHERecHitCollection->push_back(*hbheItr);}
142  }
143 
144 
145 // HO Collections
146 
147 
149  iEvent.getByLabel(hoInput_,ho);
150  for(HORecHitCollection::const_iterator hoItr=ho->begin();
151  hoItr!=ho->end(); hoItr++)
152  {
153  GlobalPoint pos = geo->getPosition(hoItr->detid());
154  double phihit = pos.phi();
155  double etahit = pos.eta();
156  int iflag_select = 0;
157  for(unsigned int i=0; i<jetv.size(); i++){
158  double deta = fabs(etahit - jetv[i].eta());
159  double dphi = fabs(phihit - jetv[i].phi());
160  if(dphi > pi) dphi = 2*pi - dphi;
161  double dr = sqrt(deta*deta+dphi*dphi);
162  if(dr < 1.4){iflag_select = 1;}
163  }
164  if(iflag_select==1){miniDiJetsHORecHitCollection->push_back(*hoItr);}
165  }
166 
167  // HF Collection
168 
169 
171  iEvent.getByLabel(hfInput_,hf);
172  for(HFRecHitCollection::const_iterator hfItr=hf->begin();
173  hfItr!=hf->end(); hfItr++)
174  {
175  GlobalPoint pos = geo->getPosition(hfItr->detid());
176  double phihit = pos.phi();
177  double etahit = pos.eta();
178  int iflag_select = 0;
179  for(unsigned int i=0; i<jetv.size(); i++){
180  double deta = fabs(etahit - jetv[i].eta());
181  double dphi = fabs(phihit - jetv[i].phi());
182  if(dphi > pi) dphi = 2*pi - dphi;
183  double dr = sqrt(deta*deta+dphi*dphi);
184  if(dr < 1.4){iflag_select = 1;}
185  }
186  if(iflag_select==1){miniDiJetsHFRecHitCollection->push_back(*hfItr);}
187  }
188 
189 
190  //Put selected information in the event
191 
192  iEvent.put( result, "DiJetsBackToBackCollection");
193  iEvent.put( miniDiJetsEcalRecHitCollection,"DiJetsEcalRecHitCollection");
194  iEvent.put( miniDiJetsHBHERecHitCollection, "DiJetsHBHERecHitCollection");
195  iEvent.put( miniDiJetsHORecHitCollection, "DiJetsHORecHitCollection");
196  iEvent.put( miniDiJetsHFRecHitCollection, "DiJetsHFRecHitCollection");
197 }
int i
Definition: DBlmapReader.cc:9
std::vector< edm::InputTag > ecalLabels_
Jets made from CaloTowers.
Definition: CaloJet.h:30
Geom::Phi< T > phi() const
Definition: PV3DBase.h:68
std::vector< EcalRecHit >::const_iterator const_iterator
T eta() const
const Double_t pi
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
T sqrt(T t)
Definition: SSEVec.h:46
vector< PseudoJet > jets
tuple result
Definition: query.py:137
const GlobalPoint & getPosition(const DetId &id) const
Get the position of a given detector id.
Definition: CaloGeometry.cc:68
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
T eta() const
Definition: PV3DBase.h:75
virtual double phi() const
momentum azimuthal angle
std::vector< CaloJet > CaloJetCollection
collection of CaloJet objects
Definition: DDAxes.h:10

Member Data Documentation

bool cms::AlCaDiJetsProducer::allowMissingInputs_
private

Definition at line 54 of file AlCaDiJetsProducer.h.

std::vector<edm::InputTag> cms::AlCaDiJetsProducer::ecalLabels_
private

Definition at line 49 of file AlCaDiJetsProducer.h.

edm::InputTag cms::AlCaDiJetsProducer::hbheInput_
private

Definition at line 50 of file AlCaDiJetsProducer.h.

edm::InputTag cms::AlCaDiJetsProducer::hfInput_
private

Definition at line 52 of file AlCaDiJetsProducer.h.

edm::InputTag cms::AlCaDiJetsProducer::hoInput_
private

Definition at line 51 of file AlCaDiJetsProducer.h.

edm::InputTag cms::AlCaDiJetsProducer::jetsInput_
private

Definition at line 48 of file AlCaDiJetsProducer.h.