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::EDConsumerBase 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 ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

bool allowMissingInputs_
 
std::vector< edm::InputTagecalLabels_
 
edm::EDGetTokenT
< HBHERecHitCollection
tok_hbhe_
 
edm::EDGetTokenT
< HFRecHitCollection
tok_hf_
 
edm::EDGetTokenT
< HORecHitCollection
tok_ho_
 
edm::EDGetTokenT
< reco::CaloJetCollection
tok_jets_
 
std::vector< edm::EDGetTokenT
< EcalRecHitCollection > > 
toks_ecal_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- 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::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 42 of file AlCaDiJetsProducer.h.

Constructor & Destructor Documentation

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

Definition at line 14 of file AlCaDiJetsProducer.cc.

References edm::ParameterSet::getParameter(), and i.

15 {
16  tok_jets_ = consumes<CaloJetCollection>(iConfig.getParameter<edm::InputTag>("jetsInput"));
17  ecalLabels_=iConfig.getParameter<std::vector<edm::InputTag> >("ecalInputs");
18  tok_hbhe_ = consumes<HBHERecHitCollection>(iConfig.getParameter<edm::InputTag>("hbheInput"));
19  tok_ho_ = consumes<HORecHitCollection>(iConfig.getParameter<edm::InputTag>("hoInput"));
20  tok_hf_ = consumes<HFRecHitCollection>(iConfig.getParameter<edm::InputTag>("hfInput"));
21  allowMissingInputs_ = true;
22 
23  // fill ecal tokens from input labels
24  const unsigned nLabels = ecalLabels_.size();
25  for ( unsigned i=0; i != nLabels; i++ )
26  toks_ecal_.push_back(consumes<EcalRecHitCollection>(ecalLabels_[i]));
27 
28 //register your products
29  produces<CaloJetCollection>("DiJetsBackToBackCollection");
30  produces<EcalRecHitCollection>("DiJetsEcalRecHitCollection");
31  produces<HBHERecHitCollection>("DiJetsHBHERecHitCollection");
32  produces<HORecHitCollection>("DiJetsHORecHitCollection");
33  produces<HFRecHitCollection>("DiJetsHFRecHitCollection");
34 
35 }
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
std::vector< edm::InputTag > ecalLabels_
edm::EDGetTokenT< HFRecHitCollection > tok_hf_
std::vector< edm::EDGetTokenT< EcalRecHitCollection > > toks_ecal_
edm::EDGetTokenT< HORecHitCollection > tok_ho_
edm::EDGetTokenT< HBHERecHitCollection > tok_hbhe_
edm::EDGetTokenT< reco::CaloJetCollection > tok_jets_
cms::AlCaDiJetsProducer::~AlCaDiJetsProducer ( )

Definition at line 40 of file AlCaDiJetsProducer.cc.

41 {
42 
43 
44 }

Member Function Documentation

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

Reimplemented from edm::EDProducer.

Definition at line 36 of file AlCaDiJetsProducer.cc.

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

Implements edm::EDProducer.

Definition at line 49 of file AlCaDiJetsProducer.cc.

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

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

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

Member Data Documentation

bool cms::AlCaDiJetsProducer::allowMissingInputs_
private

Definition at line 61 of file AlCaDiJetsProducer.h.

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

Definition at line 52 of file AlCaDiJetsProducer.h.

edm::EDGetTokenT<HBHERecHitCollection> cms::AlCaDiJetsProducer::tok_hbhe_
private

Definition at line 55 of file AlCaDiJetsProducer.h.

edm::EDGetTokenT<HFRecHitCollection> cms::AlCaDiJetsProducer::tok_hf_
private

Definition at line 57 of file AlCaDiJetsProducer.h.

edm::EDGetTokenT<HORecHitCollection> cms::AlCaDiJetsProducer::tok_ho_
private

Definition at line 56 of file AlCaDiJetsProducer.h.

edm::EDGetTokenT<reco::CaloJetCollection> cms::AlCaDiJetsProducer::tok_jets_
private

Definition at line 54 of file AlCaDiJetsProducer.h.

std::vector<edm::EDGetTokenT<EcalRecHitCollection> > cms::AlCaDiJetsProducer::toks_ecal_
private

Definition at line 59 of file AlCaDiJetsProducer.h.