CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
cms::ProducerAnalyzer Class Reference

#include <ProducerAnalyzer.h>

Inheritance diagram for cms::ProducerAnalyzer:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginJob () override
 
void endJob () override
 
 ProducerAnalyzer (const edm::ParameterSet &)
 
 ~ProducerAnalyzer () override
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

std::string ecalInput_
 
std::string gammaClus_
 
std::string hbheInput_
 
std::string hfInput_
 
std::string hoInput_
 
std::string jetCalo_
 
std::string nameProd_
 
edm::EDGetTokenT< EcalRecHitCollectiontok_ecal_
 
edm::EDGetTokenT< reco::SuperClusterCollectiontok_gamma_
 
edm::EDGetTokenT< HBHERecHitCollectiontok_hbhe_
 
edm::EDGetTokenT< HBHERecHitCollectiontok_hbheProd_
 
edm::EDGetTokenT< HFRecHitCollectiontok_hf_
 
edm::EDGetTokenT< HORecHitCollectiontok_ho_
 
edm::EDGetTokenT< HORecHitCollectiontok_hoProd_
 
edm::EDGetTokenT< HORecHitCollectiontok_horeco_
 
edm::EDGetTokenT< HOCalibVariableCollectiontok_hovar_
 
edm::EDGetTokenT< reco::CaloJetCollectiontok_jets_
 
edm::EDGetTokenT< reco::MuonCollectiontok_muons_
 
edm::EDGetTokenT< reco::TrackCollectiontok_tracks_
 
std::string Tracks_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- 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 43 of file ProducerAnalyzer.h.

Constructor & Destructor Documentation

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

Definition at line 29 of file ProducerAnalyzer.cc.

References edm::ParameterSet::getUntrackedParameter(), and AlCaHLTBitMon_QueryRunRegistry::string.

30 {
31  // get name of output file with histogramms
32 
33  nameProd_ = iConfig.getUntrackedParameter<std::string>("nameProd");
34  jetCalo_ = iConfig.getUntrackedParameter<std::string>("jetCalo","GammaJetJetBackToBackCollection");
35  gammaClus_ = iConfig.getUntrackedParameter<std::string>("gammaClus","GammaJetGammaBackToBackCollection");
36  ecalInput_=iConfig.getUntrackedParameter<std::string>("ecalInput","GammaJetEcalRecHitCollection");
37  hbheInput_ = iConfig.getUntrackedParameter<std::string>("hbheInput");
38  hoInput_ = iConfig.getUntrackedParameter<std::string>("hoInput");
39  hfInput_ = iConfig.getUntrackedParameter<std::string>("hfInput");
40  Tracks_ = iConfig.getUntrackedParameter<std::string>("Tracks","GammaJetTracksCollection");
41 
42  tok_hovar_ = consumes<HOCalibVariableCollection>( edm::InputTag(nameProd_,hoInput_) );
43  tok_horeco_ = consumes<HORecHitCollection>( edm::InputTag("horeco") );
44  tok_ho_ = consumes<HORecHitCollection>( edm::InputTag(hoInput_) );
45  tok_hoProd_ = consumes<HORecHitCollection>( edm::InputTag(nameProd_,hoInput_) );
46 
47  tok_hf_ = consumes<HFRecHitCollection>( edm::InputTag(hfInput_) );
48 
49  tok_jets_ = consumes<reco::CaloJetCollection>( edm::InputTag(nameProd_,jetCalo_) );
50  tok_gamma_ = consumes<reco::SuperClusterCollection>( edm::InputTag(nameProd_,gammaClus_) );
51  tok_muons_ = consumes<reco::MuonCollection>(edm::InputTag(nameProd_,"SelectedMuons"));
52  tok_ecal_ = consumes<EcalRecHitCollection>( edm::InputTag(nameProd_,ecalInput_) );
53  tok_tracks_ = consumes<reco::TrackCollection>( edm::InputTag(nameProd_,Tracks_) );
54 
55  tok_hbheProd_ = consumes<HBHERecHitCollection>( edm::InputTag(nameProd_,hbheInput_) );
56  tok_hbhe_ = consumes<HBHERecHitCollection>( edm::InputTag(hbheInput_) );
57 
58 }
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< reco::TrackCollection > tok_tracks_
edm::EDGetTokenT< reco::MuonCollection > tok_muons_
edm::EDGetTokenT< reco::SuperClusterCollection > tok_gamma_
edm::EDGetTokenT< HORecHitCollection > tok_hoProd_
edm::EDGetTokenT< HORecHitCollection > tok_ho_
edm::EDGetTokenT< HBHERecHitCollection > tok_hbheProd_
edm::EDGetTokenT< HORecHitCollection > tok_horeco_
edm::EDGetTokenT< HOCalibVariableCollection > tok_hovar_
edm::EDGetTokenT< EcalRecHitCollection > tok_ecal_
edm::EDGetTokenT< HBHERecHitCollection > tok_hbhe_
edm::EDGetTokenT< reco::CaloJetCollection > tok_jets_
edm::EDGetTokenT< HFRecHitCollection > tok_hf_
cms::ProducerAnalyzer::~ProducerAnalyzer ( )
override

Definition at line 60 of file ProducerAnalyzer.cc.

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

Member Function Documentation

void cms::ProducerAnalyzer::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 83 of file ProducerAnalyzer.cc.

References begin, gather_cfg::cout, digitizers_cfi::ecal, end, spr::energyECAL(), spr::energyHCAL(), PV3DBase< T, PVType, FrameType >::eta(), edm::EventSetup::get(), edm::Event::getAllStableProvenance(), edm::Event::getByToken(), CaloGeometry::getPosition(), CaloGeometry::getSubdetectorGeometry(), photonIsolationHIProducer_cfi::hbhe, photonIsolationHIProducer_cfi::hf, photonIsolationHIProducer_cfi::ho, metsig::jet, fwrapper::jets, RPCpg::mu, PV3DBase< T, PVType, FrameType >::phi(), edm::Handle< T >::product(), edm::ESHandle< T >::product(), findQualityFiles::size, HiIsolationCommonParameters_cff::track, and l1t::tracks.

84 {
85 
86  using namespace edm;
87 
88  const CaloGeometry* geo;
90  iSetup.get<CaloGeometryRecord>().get(pG);
91  geo = pG.product();
92 
93 
94  std::vector<StableProvenance const*> theProvenance;
95  iEvent.getAllStableProvenance(theProvenance);
96  for(auto const& provenance : theProvenance)
97  {
98  cout<<" Print all module/label names "<<provenance->moduleName()<<" "<<provenance->moduleLabel()<<
99  " "<<provenance->productInstanceName()<<endl;
100  }
101 
102 
103  if(nameProd_ == "hoCalibProducer")
104  {
106  iEvent.getByToken(tok_hovar_, ho);
107  const HOCalibVariableCollection Hitho = *(ho.product());
108  std::cout<<" Size of HO "<<(Hitho).size()<<std::endl;
109  }
110 
111  if(nameProd_ == "ALCARECOMuAlZMuMu" )
112  {
113 
115  iEvent.getByToken(tok_horeco_, ho);
116  const HORecHitCollection Hitho = *(ho.product());
117  std::cout<<" Size of HO "<<(Hitho).size()<<std::endl;
119  iEvent.getByToken(tok_muons_, mucand);
120  std::cout<<" Size of muon collection "<<mucand->size()<<std::endl;
121  for(MuonCollection::const_iterator it = mucand->begin(); it != mucand->end(); it++)
122  {
123  TrackRef mu = (*it).combinedMuon();
124  std::cout<<" Pt muon "<<mu->innerMomentum()<<std::endl;
125  }
126 
127  }
128 
129  if(nameProd_ != "IsoProd" && nameProd_ != "ALCARECOMuAlZMuMu" && nameProd_ != "hoCalibProducer")
130  {
132  iEvent.getByToken(tok_hbhe_, hbhe);
133  const HBHERecHitCollection Hithbhe = *(hbhe.product());
134  std::cout<<" Size of HBHE "<<(Hithbhe).size()<<std::endl;
135 
136 
138  iEvent.getByToken(tok_ho_, ho);
139  const HORecHitCollection Hitho = *(ho.product());
140  std::cout<<" Size of HO "<<(Hitho).size()<<std::endl;
141 
142 
144  iEvent.getByToken(tok_hf_, hf);
145  const HFRecHitCollection Hithf = *(hf.product());
146  std::cout<<" Size of HF "<<(Hithf).size()<<std::endl;
147  }
148  if(nameProd_ == "IsoProd")
149  {
150  cout<<" We are here "<<endl;
152  iEvent.getByToken(tok_tracks_,tracks);
153 
154 
155  std::cout<<" Tracks size "<<(*tracks).size()<<std::endl;
156  reco::TrackCollection::const_iterator track = tracks->begin ();
157 
158  for (; track != tracks->end (); track++)
159  {
160  cout<<" P track "<<(*track).p()<<" eta "<<(*track).eta()<<" phi "<<(*track).phi()<<" Outer "<<(*track).outerMomentum()<<" "<<
161  (*track).outerPosition()<<endl;
162  TrackExtraRef myextra = (*track).extra();
163  cout<<" Track extra "<<myextra->outerMomentum()<<" "<<myextra->outerPosition()<<endl;
164  }
165 
167  iEvent.getByToken(tok_ecal_,ecal);
168  const EcalRecHitCollection Hitecal = *(ecal.product());
169  std::cout<<" Size of Ecal "<<(Hitecal).size()<<std::endl;
171 
172  double energyECAL = 0.;
173  double energyHCAL = 0.;
174 
175  for (; hite != (ecal.product())->end (); hite++) {
176 
177 // cout<<" Energy ECAL "<<(*hite).energy()<<endl;
178 
179 
180 // " eta "<<(*hite).detid()<<" phi "<<(*hite).detid().getPosition().phi()<<endl;
181 
182  const GlobalPoint& posE = geo->getPosition((*hite).detid());
183 
184  cout<<" Energy ECAL "<<(*hite).energy()<<
185  " eta "<<posE.eta()<<" phi "<<posE.phi()<<endl;
186 
187  energyECAL = energyECAL + (*hite).energy();
188 
189  }
190 
192  iEvent.getByToken(tok_hbheProd_,hbhe);
193  const HBHERecHitCollection Hithbhe = *(hbhe.product());
194  std::cout<<" Size of HBHE "<<(Hithbhe).size()<<std::endl;
196 
197  for (; hith != (hbhe.product())->end (); hith++) {
198 
199  GlobalPoint posH = ((HcalGeometry*)(geo->getSubdetectorGeometry((*hith).detid())))->getPosition((*hith).detid());
200 
201  cout<<" Energy HCAL "<<(*hith).energy()<<
202  " eta "<<posH.eta()<<" phi "<<posH.phi()<<endl;
203 
204  energyHCAL = energyHCAL + (*hith).energy();
205 
206  }
207 
208  cout<<" Energy ECAL "<< energyECAL<<" Energy HCAL "<< energyHCAL<<endl;
209 
211  iEvent.getByToken(tok_hoProd_,ho);
212  const HORecHitCollection Hitho = *(ho.product());
213  std::cout<<" Size of HO "<<(Hitho).size()<<std::endl;
215 
216  for (; hito != (ho.product())->end (); hito++)
217  {
218 // cout<<" Energy HO "<<(*hito).energy()<<endl;
219 // " eta "<<(*hite).eta()<<" phi "<<(*hite).phi()<<endl;
220  }
221 
222  }
223 
224 
225  if(nameProd_ == "GammaJetProd" || nameProd_ == "DiJProd")
226  {
227  cout<<" we are in GammaJetProd area "<<endl;
229  iEvent.getByToken(tok_ecal_, ecal);
230  std::cout<<" Size of ECAL "<<(*ecal).size()<<std::endl;
231 
233  iEvent.getByToken(tok_jets_, jets);
234  std::cout<<" Jet size "<<(*jets).size()<<std::endl;
235  reco::CaloJetCollection::const_iterator jet = jets->begin ();
236  for (; jet != jets->end (); jet++)
237  {
238  cout<<" Et jet "<<(*jet).et()<<" eta "<<(*jet).eta()<<" phi "<<(*jet).phi()<<endl;
239  }
240 
242  iEvent.getByToken(tok_tracks_, tracks);
243  std::cout<<" Tracks size "<<(*tracks).size()<<std::endl;
244  }
245  if( nameProd_ == "GammaJetProd")
246  {
248  iEvent.getByToken(tok_gamma_, eclus);
249  std::cout<<" GammaClus size "<<(*eclus).size()<<std::endl;
250  reco::SuperClusterCollection::const_iterator iclus = eclus->begin ();
251  for (; iclus != eclus->end (); iclus++)
252  {
253  cout<<" Et gamma "<<(*iclus).energy()/cosh((*iclus).eta())<<" eta "<<(*iclus).eta()<<" phi "<<(*iclus).phi()<<endl;
254  }
255  }
256 
257 }
size
Write out results.
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:45
double energyECAL(std::vector< DetId > &vdets, edm::Handle< T > &hitsEB, edm::Handle< T > &hitsEE, double ebThr=-100, double eeThr=-100, double tMin=-500, double tMax=500, bool debug=false)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:508
edm::EDGetTokenT< reco::TrackCollection > tok_tracks_
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
std::vector< EcalRecHit >::const_iterator const_iterator
edm::EDGetTokenT< reco::MuonCollection > tok_muons_
edm::EDGetTokenT< reco::SuperClusterCollection > tok_gamma_
edm::EDGetTokenT< HORecHitCollection > tok_hoProd_
edm::EDGetTokenT< HORecHitCollection > tok_ho_
edm::EDGetTokenT< HBHERecHitCollection > tok_hbheProd_
vector< PseudoJet > jets
edm::EDGetTokenT< HORecHitCollection > tok_horeco_
edm::EDGetTokenT< HOCalibVariableCollection > tok_hovar_
edm::EDGetTokenT< EcalRecHitCollection > tok_ecal_
const GlobalPoint & getPosition(const DetId &id) const
Get the position of a given detector id.
Definition: CaloGeometry.cc:70
const int mu
Definition: Constants.h:22
#define end
Definition: vmac.h:37
double energyHCAL(std::vector< DetId > &vdets, edm::Handle< T > &hits, double hbThr=-100, double heThr=-100, double hfThr=-100, double hoThr=-100, double tMin=-500, double tMax=500, bool useRaw=false, bool debug=false)
T const * product() const
Definition: Handle.h:81
const T & get() const
Definition: EventSetup.h:55
std::vector< HOCalibVariables > HOCalibVariableCollection
collection of HOcalibration variabale
T eta() const
Definition: PV3DBase.h:76
edm::EDGetTokenT< HBHERecHitCollection > tok_hbhe_
#define begin
Definition: vmac.h:30
HLT enums.
edm::EDGetTokenT< reco::CaloJetCollection > tok_jets_
edm::EDGetTokenT< HFRecHitCollection > tok_hf_
T const * product() const
Definition: ESHandle.h:86
void getAllStableProvenance(std::vector< StableProvenance const * > &provenances) const
Definition: Event.cc:121
void cms::ProducerAnalyzer::beginJob ( void  )
overridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 68 of file ProducerAnalyzer.cc.

69 {
70 }
void cms::ProducerAnalyzer::endJob ( void  )
overridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 72 of file ProducerAnalyzer.cc.

Referenced by o2olib.O2ORunMgr::executeJob().

73 {
74 }

Member Data Documentation

std::string cms::ProducerAnalyzer::ecalInput_
private

Definition at line 57 of file ProducerAnalyzer.h.

std::string cms::ProducerAnalyzer::gammaClus_
private

Definition at line 56 of file ProducerAnalyzer.h.

std::string cms::ProducerAnalyzer::hbheInput_
private

Definition at line 58 of file ProducerAnalyzer.h.

std::string cms::ProducerAnalyzer::hfInput_
private

Definition at line 60 of file ProducerAnalyzer.h.

std::string cms::ProducerAnalyzer::hoInput_
private

Definition at line 59 of file ProducerAnalyzer.h.

std::string cms::ProducerAnalyzer::jetCalo_
private

Definition at line 55 of file ProducerAnalyzer.h.

std::string cms::ProducerAnalyzer::nameProd_
private

Definition at line 54 of file ProducerAnalyzer.h.

edm::EDGetTokenT<EcalRecHitCollection> cms::ProducerAnalyzer::tok_ecal_
private

Definition at line 73 of file ProducerAnalyzer.h.

edm::EDGetTokenT<reco::SuperClusterCollection> cms::ProducerAnalyzer::tok_gamma_
private

Definition at line 71 of file ProducerAnalyzer.h.

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

Definition at line 76 of file ProducerAnalyzer.h.

edm::EDGetTokenT<HBHERecHitCollection> cms::ProducerAnalyzer::tok_hbheProd_
private

Definition at line 77 of file ProducerAnalyzer.h.

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

Definition at line 68 of file ProducerAnalyzer.h.

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

Definition at line 65 of file ProducerAnalyzer.h.

edm::EDGetTokenT<HORecHitCollection> cms::ProducerAnalyzer::tok_hoProd_
private

Definition at line 66 of file ProducerAnalyzer.h.

edm::EDGetTokenT<HORecHitCollection> cms::ProducerAnalyzer::tok_horeco_
private

Definition at line 64 of file ProducerAnalyzer.h.

edm::EDGetTokenT<HOCalibVariableCollection> cms::ProducerAnalyzer::tok_hovar_
private

Definition at line 63 of file ProducerAnalyzer.h.

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

Definition at line 70 of file ProducerAnalyzer.h.

edm::EDGetTokenT<reco::MuonCollection> cms::ProducerAnalyzer::tok_muons_
private

Definition at line 72 of file ProducerAnalyzer.h.

edm::EDGetTokenT<reco::TrackCollection> cms::ProducerAnalyzer::tok_tracks_
private

Definition at line 74 of file ProducerAnalyzer.h.

std::string cms::ProducerAnalyzer::Tracks_
private

Definition at line 61 of file ProducerAnalyzer.h.