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 Member Functions | Private Attributes
AlCaHBHEMuonProducer Class Reference
Inheritance diagram for AlCaHBHEMuonProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 AlCaHBHEMuonProducer (const edm::ParameterSet &)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
 ~AlCaHBHEMuonProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 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
std::vector< ConsumesInfoconsumesInfo () const
 
 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
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

virtual void beginJob ()
 
virtual void beginRun (edm::Run const &, edm::EventSetup const &)
 
virtual void endJob ()
 
virtual void endRun (edm::Run const &, edm::EventSetup const &)
 
bool select (const reco::MuonCollection &)
 

Private Attributes

edm::InputTag labelBS_
 
edm::InputTag labelEB_
 
edm::InputTag labelEE_
 
edm::InputTag labelHBHE_
 
edm::InputTag labelMuon_
 
edm::InputTag labelVtx_
 
int nAll
 
int nGood
 
int nRun
 
double pMuonMin_
 
edm::EDGetTokenT< reco::BeamSpottok_BS_
 
edm::EDGetTokenT
< EcalRecHitCollection
tok_EB_
 
edm::EDGetTokenT
< EcalRecHitCollection
tok_EE_
 
edm::EDGetTokenT
< HBHERecHitCollection
tok_HBHE_
 
edm::EDGetTokenT
< reco::MuonCollection
tok_Muon_
 
edm::EDGetTokenT
< reco::VertexCollection
tok_Vtx_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- 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::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 40 of file AlCaHBHEMuonProducer.cc.

Constructor & Destructor Documentation

AlCaHBHEMuonProducer::AlCaHBHEMuonProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 70 of file AlCaHBHEMuonProducer.cc.

References edm::ParameterSet::getParameter(), edm::InputTag::instance(), edm::InputTag::label(), labelBS_, labelEB_, labelEE_, labelHBHE_, labelMuon_, labelVtx_, pMuonMin_, tok_BS_, tok_EB_, tok_EE_, tok_HBHE_, tok_Muon_, and tok_Vtx_.

70  :
71  nRun(0), nAll(0), nGood(0) {
72  //Get the run parameters
73  labelBS_ = iConfig.getParameter<edm::InputTag>("BeamSpotLabel");
74  labelVtx_ = iConfig.getParameter<edm::InputTag>("VertexLabel");
75  labelEB_ = iConfig.getParameter<edm::InputTag>("EBRecHitLabel");
76  labelEE_ = iConfig.getParameter<edm::InputTag>("EERecHitLabel");
77  labelHBHE_ = iConfig.getParameter<edm::InputTag>("HBHERecHitLabel");
78  labelMuon_ = iConfig.getParameter<edm::InputTag>("MuonLabel");
79  pMuonMin_ = iConfig.getParameter<double>("MinimumMuonP");
80 
81  // define tokens for access
82  tok_Vtx_ = consumes<reco::VertexCollection>(labelVtx_);
83  tok_BS_ = consumes<reco::BeamSpot>(labelBS_);
84  tok_EB_ = consumes<EcalRecHitCollection>(labelEB_);
85  tok_EE_ = consumes<EcalRecHitCollection>(labelEE_);
86  tok_HBHE_ = consumes<HBHERecHitCollection>(labelHBHE_);
87  tok_Muon_ = consumes<reco::MuonCollection>(labelMuon_);
88 
89  edm::LogInfo("HcalIsoTrack") << "Parameters read from config file \n"
90  << "\t minP of muon " << pMuonMin_
91  << "\t input labels " << labelBS_ << " "
92  << labelVtx_ <<" " << labelEB_ << " " << labelEE_
93  <<" " << labelHBHE_ << " " << labelMuon_;
94 
95  //saves the following collections
96  produces<reco::BeamSpot>(labelBS_.label());
97  produces<reco::VertexCollection>(labelVtx_.label());
98  produces<EcalRecHitCollection>(labelEB_.instance());
99  produces<EcalRecHitCollection>(labelEE_.instance());
100  produces<HBHERecHitCollection>(labelHBHE_.label());
101  produces<reco::MuonCollection>(labelMuon_.label());
102 }
T getParameter(std::string const &) const
edm::EDGetTokenT< EcalRecHitCollection > tok_EE_
edm::EDGetTokenT< HBHERecHitCollection > tok_HBHE_
edm::EDGetTokenT< EcalRecHitCollection > tok_EB_
edm::EDGetTokenT< reco::BeamSpot > tok_BS_
std::string const & label() const
Definition: InputTag.h:43
edm::EDGetTokenT< reco::VertexCollection > tok_Vtx_
std::string const & instance() const
Definition: InputTag.h:44
edm::EDGetTokenT< reco::MuonCollection > tok_Muon_
AlCaHBHEMuonProducer::~AlCaHBHEMuonProducer ( )

Definition at line 104 of file AlCaHBHEMuonProducer.cc.

104 { }

Member Function Documentation

void AlCaHBHEMuonProducer::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 208 of file AlCaHBHEMuonProducer.cc.

208 { }
void AlCaHBHEMuonProducer::beginRun ( edm::Run const &  iRun,
edm::EventSetup const &  iSetup 
)
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 215 of file AlCaHBHEMuonProducer.cc.

References nRun, and edm::RunBase::run().

215  {
216  edm::LogInfo("HcalHBHEMuon") << "Run[" << nRun << "] " << iRun.run();
217 }
void AlCaHBHEMuonProducer::endJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 210 of file AlCaHBHEMuonProducer.cc.

References nAll, nGood, and nRun.

210  {
211  edm::LogInfo("HcalHBHEMuon") << "Finds " << nGood << " good tracks in "
212  << nAll << " events from " << nRun << " runs";
213 }
void AlCaHBHEMuonProducer::endRun ( edm::Run const &  iRun,
edm::EventSetup const &   
)
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 219 of file AlCaHBHEMuonProducer.cc.

References nRun, and edm::RunBase::run().

219  {
220  nRun++;
221  edm::LogInfo("HcalHBHEMuon") << "endRun[" << nRun << "] " << iRun.run();
222 }
void AlCaHBHEMuonProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

Implements edm::EDProducer.

Definition at line 106 of file AlCaHBHEMuonProducer.cc.

References accept(), EcalCondDBWriter_cfi::beam, reco::BeamSpot::BeamWidthX(), edm::SortedCollection< T, SORT >::begin(), edm::EventBase::bunchCrossing(), reco::BeamSpot::covariance(), reco::BeamSpot::dxdz(), reco::BeamSpot::dydz(), edm::SortedCollection< T, SORT >::end(), edm::EventID::event(), edm::Event::getByToken(), edm::EventBase::id(), edm::InputTag::instance(), edm::HandleBase::isValid(), edm::InputTag::label(), labelBS_, labelEB_, labelEE_, labelHBHE_, labelMuon_, labelVtx_, edm::EventBase::luminosityBlock(), metsig::muon, patZpeak::muons, nAll, nGood, reco::BeamSpot::position(), edm::Handle< T >::product(), edm::Event::put(), mathSSE::return(), edm::EventID::run(), select(), reco::BeamSpot::sigmaZ(), tok_BS_, tok_EB_, tok_EE_, tok_HBHE_, tok_Muon_, tok_Vtx_, and reco::BeamSpot::type().

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

106  {
107 
108  nAll++;
109 #ifdef DebugLog
110  edm::LogInfo("HcalHBHEMuon") << "AlCaHBHEMuonProducer::Run "
111  << iEvent.id().run() << " Event "
112  << iEvent.id().event() << " Luminosity "
113  << iEvent.luminosityBlock() << " Bunch "
114  << iEvent.bunchCrossing();
115 #endif
116 
117  //Step1: Get all the relevant containers
119  iEvent.getByToken(tok_BS_, bmspot);
120  if (!bmspot.isValid()){
121  edm::LogWarning("HcalHBHEMuon") << "AlCaHBHEMuonProducer: Error! can't get product " << labelBS_;
122  return;
123  }
124  const reco::BeamSpot beam = *(bmspot.product());
125 
126 
128  iEvent.getByToken(tok_Vtx_, vt);
129  if (!vt.isValid()) {
130  edm::LogWarning("HcalHBHEMuon") << "AlCaHBHEMuonProducer: Error! can't get product " << labelVtx_;
131  return ;
132  }
133  const reco::VertexCollection vtx = *(vt.product());
134 
135  edm::Handle<EcalRecHitCollection> barrelRecHitsHandle;
136  iEvent.getByToken(tok_EB_, barrelRecHitsHandle);
137  if (!barrelRecHitsHandle.isValid()) {
138  edm::LogWarning("HcalHBHEMuon") << "AlCaHBHEMuonProducer: Error! can't get product " << labelEB_;
139  return ;
140  }
141  const EcalRecHitCollection ebcoll = *(barrelRecHitsHandle.product());
142 
143  edm::Handle<EcalRecHitCollection> endcapRecHitsHandle;
144  iEvent.getByToken(tok_EE_, endcapRecHitsHandle);
145  if (!endcapRecHitsHandle.isValid()) {
146  edm::LogWarning("HcalHBHEMuon") << "AlCaHBHEMuonProducer: Error! can't get product " << labelEE_;
147  return ;
148  }
149  const EcalRecHitCollection eecoll = *(endcapRecHitsHandle.product());
150 
152  iEvent.getByToken(tok_HBHE_, hbhe);
153  if (!hbhe.isValid()) {
154  edm::LogWarning("HcalHBHEMuon") << "AlCaHBHEMuonProducer: Error! can't get product " << labelHBHE_;
155  return ;
156  }
157  const HBHERecHitCollection hbhecoll = *(hbhe.product());
158 
160  iEvent.getByToken(tok_Muon_, muonhandle);
161  if (!muonhandle.isValid()) {
162  edm::LogWarning("HcalHBHEMuon") << "AlCaHBHEMuonProducer: Error! can't get product " << labelMuon_;
163  return ;
164  }
165  const reco::MuonCollection muons = *(muonhandle.product());
166 
167 #ifdef DebugLog
168  edm::LogInfo("HcalHBHEMuon") << "AlCaHBHEMuonProducer::Has obtained all the collections";
169 #endif
170 
171  //For accepted events
172  bool accept = select(muons);
173  std::auto_ptr<reco::BeamSpot> outputBeamSpot(new reco::BeamSpot(beam.position(),beam.sigmaZ(),
174  beam.dxdz(),beam.dydz(),beam.BeamWidthX(),
175  beam.covariance(),beam.type()));
176  std::auto_ptr<reco::VertexCollection> outputVColl(new reco::VertexCollection);
177  std::auto_ptr<EBRecHitCollection> outputEBColl(new EBRecHitCollection);
178  std::auto_ptr<EERecHitCollection> outputEEColl(new EERecHitCollection);
179  std::auto_ptr<HBHERecHitCollection> outputHBHEColl(new HBHERecHitCollection);
180  std::auto_ptr<reco::MuonCollection> outputMColl(new reco::MuonCollection);
181  if (accept) {
182  nGood++;
183 
184  for (reco::VertexCollection::const_iterator vtr=vtx.begin(); vtr!=vtx.end(); ++vtr)
185  outputVColl->push_back(*vtr);
186 
187  for (edm::SortedCollection<EcalRecHit>::const_iterator ehit=ebcoll.begin(); ehit!=ebcoll.end(); ++ehit)
188  outputEBColl->push_back(*ehit);
189 
190  for (edm::SortedCollection<EcalRecHit>::const_iterator ehit=eecoll.begin(); ehit!=eecoll.end(); ++ehit)
191  outputEEColl->push_back(*ehit);
192 
193  for (std::vector<HBHERecHit>::const_iterator hhit=hbhecoll.begin(); hhit!=hbhecoll.end(); ++hhit)
194  outputHBHEColl->push_back(*hhit);
195 
196  for (reco::MuonCollection::const_iterator muon=muons.begin(); muon!=muons.end(); ++muon)
197  outputMColl->push_back(*muon);
198  }
199 
200  iEvent.put(outputBeamSpot, labelBS_.label());
201  iEvent.put(outputVColl, labelVtx_.label());
202  iEvent.put(outputEBColl, labelEB_.instance());
203  iEvent.put(outputEEColl, labelEE_.instance());
204  iEvent.put(outputHBHEColl, labelHBHE_.label());
205  iEvent.put(outputMColl, labelMuon_.label());
206 }
RunNumber_t run() const
Definition: EventID.h:39
EventNumber_t event() const
Definition: EventID.h:41
bool select(const reco::MuonCollection &)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
edm::EDGetTokenT< EcalRecHitCollection > tok_EE_
std::vector< T >::const_iterator const_iterator
int bunchCrossing() const
Definition: EventBase.h:66
edm::LuminosityBlockNumber_t luminosityBlock() const
Definition: EventBase.h:63
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:25
std::vector< Muon > MuonCollection
collection of Muon objects
Definition: MuonFwd.h:9
return((rh^lh)&mask)
double dydz() const
dydz slope
Definition: BeamSpot.h:84
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:115
edm::EDGetTokenT< HBHERecHitCollection > tok_HBHE_
double BeamWidthX() const
beam width X
Definition: BeamSpot.h:86
bool isValid() const
Definition: HandleBase.h:75
double dxdz() const
dxdz slope
Definition: BeamSpot.h:82
const_iterator end() const
T const * product() const
Definition: Handle.h:81
double sigmaZ() const
sigma z
Definition: BeamSpot.h:80
edm::EDGetTokenT< EcalRecHitCollection > tok_EB_
edm::EDGetTokenT< reco::BeamSpot > tok_BS_
std::string const & label() const
Definition: InputTag.h:43
double covariance(int i, int j) const
(i,j)-th element of error matrix
Definition: BeamSpot.h:112
edm::EventID id() const
Definition: EventBase.h:60
tuple muons
Definition: patZpeak.py:38
edm::EDGetTokenT< reco::VertexCollection > tok_Vtx_
const Point & position() const
position
Definition: BeamSpot.h:62
std::string const & instance() const
Definition: InputTag.h:44
edm::EDGetTokenT< reco::MuonCollection > tok_Muon_
const_iterator begin() const
BeamType type() const
return beam type
Definition: BeamSpot.h:129
bool AlCaHBHEMuonProducer::select ( const reco::MuonCollection muons)
private

Member Data Documentation

edm::InputTag AlCaHBHEMuonProducer::labelBS_
private

Definition at line 57 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

edm::InputTag AlCaHBHEMuonProducer::labelEB_
private

Definition at line 58 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

edm::InputTag AlCaHBHEMuonProducer::labelEE_
private

Definition at line 58 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

edm::InputTag AlCaHBHEMuonProducer::labelHBHE_
private

Definition at line 58 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

edm::InputTag AlCaHBHEMuonProducer::labelMuon_
private

Definition at line 58 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

edm::InputTag AlCaHBHEMuonProducer::labelVtx_
private

Definition at line 57 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

int AlCaHBHEMuonProducer::nAll
private

Definition at line 56 of file AlCaHBHEMuonProducer.cc.

Referenced by endJob(), and produce().

int AlCaHBHEMuonProducer::nGood
private

Definition at line 56 of file AlCaHBHEMuonProducer.cc.

Referenced by endJob(), and produce().

int AlCaHBHEMuonProducer::nRun
private

Definition at line 56 of file AlCaHBHEMuonProducer.cc.

Referenced by beginRun(), endJob(), and endRun().

double AlCaHBHEMuonProducer::pMuonMin_
private

Definition at line 59 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and select().

edm::EDGetTokenT<reco::BeamSpot> AlCaHBHEMuonProducer::tok_BS_
private

Definition at line 61 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

edm::EDGetTokenT<EcalRecHitCollection> AlCaHBHEMuonProducer::tok_EB_
private

Definition at line 63 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

edm::EDGetTokenT<EcalRecHitCollection> AlCaHBHEMuonProducer::tok_EE_
private

Definition at line 64 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

edm::EDGetTokenT<HBHERecHitCollection> AlCaHBHEMuonProducer::tok_HBHE_
private

Definition at line 65 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

edm::EDGetTokenT<reco::MuonCollection> AlCaHBHEMuonProducer::tok_Muon_
private

Definition at line 66 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

edm::EDGetTokenT<reco::VertexCollection> AlCaHBHEMuonProducer::tok_Vtx_
private

Definition at line 62 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().