test
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
AlCaHBHEMuonProducer Class Reference
Inheritance diagram for AlCaHBHEMuonProducer:
edm::stream::EDProducer< edm::GlobalCache< AlCaHBHEMuons::Counters > > edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 AlCaHBHEMuonProducer (edm::ParameterSet const &, const AlCaHBHEMuons::Counters *count)
 
virtual void endStream () override
 
virtual void produce (edm::Event &, const edm::EventSetup &) override
 
 ~AlCaHBHEMuonProducer ()
 
- Public Member Functions inherited from edm::stream::EDProducer< edm::GlobalCache< AlCaHBHEMuons::Counters > >
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- 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 ()
 

Static Public Member Functions

static void globalEndJob (const AlCaHBHEMuons::Counters *counters)
 
static std::unique_ptr
< AlCaHBHEMuons::Counters
initializeGlobalCache (edm::ParameterSet const &)
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

virtual void beginRun (edm::Run const &, edm::EventSetup const &) override
 
virtual void endRun (edm::Run const &, edm::EventSetup const &) override
 
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_
 
unsigned int nAll_
 
unsigned int nGood_
 
unsigned 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::stream::EDProducer< edm::GlobalCache< AlCaHBHEMuons::Counters > >
typedef CacheContexts< T...> CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T...> HasAbility
 
typedef
CacheTypes::LuminosityBlockCache 
LuminosityBlockCache
 
typedef
LuminosityBlockContextT
< LuminosityBlockCache,
RunCache, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- 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 48 of file AlCaHBHEMuonProducer.cc.

Constructor & Destructor Documentation

AlCaHBHEMuonProducer::AlCaHBHEMuonProducer ( edm::ParameterSet const &  iConfig,
const AlCaHBHEMuons::Counters count 
)
explicit

Definition at line 82 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_.

82  :
83  nRun_(0), nAll_(0), nGood_(0) {
84  //Get the run parameters
85  labelBS_ = iConfig.getParameter<edm::InputTag>("BeamSpotLabel");
86  labelVtx_ = iConfig.getParameter<edm::InputTag>("VertexLabel");
87  labelEB_ = iConfig.getParameter<edm::InputTag>("EBRecHitLabel");
88  labelEE_ = iConfig.getParameter<edm::InputTag>("EERecHitLabel");
89  labelHBHE_ = iConfig.getParameter<edm::InputTag>("HBHERecHitLabel");
90  labelMuon_ = iConfig.getParameter<edm::InputTag>("MuonLabel");
91  pMuonMin_ = iConfig.getParameter<double>("MinimumMuonP");
92 
93  // define tokens for access
94  tok_Vtx_ = consumes<reco::VertexCollection>(labelVtx_);
95  tok_BS_ = consumes<reco::BeamSpot>(labelBS_);
96  tok_EB_ = consumes<EcalRecHitCollection>(labelEB_);
97  tok_EE_ = consumes<EcalRecHitCollection>(labelEE_);
98  tok_HBHE_ = consumes<HBHERecHitCollection>(labelHBHE_);
99  tok_Muon_ = consumes<reco::MuonCollection>(labelMuon_);
100 
101  edm::LogInfo("HcalHBHEMuon") << "Parameters read from config file \n"
102  << "\t minP of muon " << pMuonMin_
103  << "\t input labels " << labelBS_ << " "
104  << labelVtx_ <<" " << labelEB_ << " " << labelEE_
105  <<" " << labelHBHE_ << " " << labelMuon_;
106 
107  //saves the following collections
108  produces<reco::BeamSpot>(labelBS_.label());
109  produces<reco::VertexCollection>(labelVtx_.label());
110  produces<EcalRecHitCollection>(labelEB_.instance());
111  produces<EcalRecHitCollection>(labelEE_.instance());
112  produces<HBHERecHitCollection>(labelHBHE_.label());
113  produces<reco::MuonCollection>(labelMuon_.label());
114 }
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 116 of file AlCaHBHEMuonProducer.cc.

116 { }

Member Function Documentation

void AlCaHBHEMuonProducer::beginRun ( edm::Run const &  iRun,
edm::EventSetup const &  iSetup 
)
overrideprivatevirtual

Reimplemented from edm::stream::EDProducerBase.

Definition at line 236 of file AlCaHBHEMuonProducer.cc.

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

236  {
237  edm::LogInfo("HcalHBHEMuon") << "Run[" << nRun_ << "] " << iRun.run();
238 }
void AlCaHBHEMuonProducer::endRun ( edm::Run const &  iRun,
edm::EventSetup const &   
)
overrideprivatevirtual

Reimplemented from edm::stream::EDProducerBase.

Definition at line 240 of file AlCaHBHEMuonProducer.cc.

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

240  {
241  ++nRun_;
242  edm::LogInfo("HcalHBHEMuon") << "endRun[" << nRun_ << "] " << iRun.run();
243 }
void AlCaHBHEMuonProducer::endStream ( )
overridevirtual

Reimplemented from edm::stream::EDProducerBase.

Definition at line 226 of file AlCaHBHEMuonProducer.cc.

References nAll_, and nGood_.

226  {
227  globalCache()->nAll_ += nAll_;
228  globalCache()->nGood_ += nGood_;
229 }
void AlCaHBHEMuonProducer::globalEndJob ( const AlCaHBHEMuons::Counters counters)
static

Definition at line 231 of file AlCaHBHEMuonProducer.cc.

References AlCaHBHEMuons::Counters::nAll_, and AlCaHBHEMuons::Counters::nGood_.

231  {
232  edm::LogInfo("HcalHBHEMuon") << "Finds " << count->nGood_ <<" good tracks in "
233  << count->nAll_ << " events";
234 }
static std::unique_ptr<AlCaHBHEMuons::Counters> AlCaHBHEMuonProducer::initializeGlobalCache ( edm::ParameterSet const &  )
inlinestatic

Definition at line 53 of file AlCaHBHEMuonProducer.cc.

53  {
54  return std::unique_ptr<AlCaHBHEMuons::Counters>(new AlCaHBHEMuons::Counters());
55  }
void AlCaHBHEMuonProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Implements edm::stream::EDProducerBase.

Definition at line 118 of file AlCaHBHEMuonProducer.cc.

References accept(), EcalCondDBWriter_cfi::beam, align::BeamSpot, 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(), 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().

118  {
119 
120  ++nAll_;
121  bool valid(true);
122 #ifdef DebugLog
123  edm::LogInfo("HcalHBHEMuon") << "AlCaHBHEMuonProducer::Run "
124  << iEvent.id().run() << " Event "
125  << iEvent.id().event() << " Luminosity "
126  << iEvent.luminosityBlock() << " Bunch "
127  << iEvent.bunchCrossing();
128 #endif
129 
130  //Step1: Get all the relevant containers
132  iEvent.getByToken(tok_BS_, bmspot);
133  if (!bmspot.isValid()){
134  edm::LogWarning("HcalHBHEMuon") << "AlCaHBHEMuonProducer: Error! can't get product " << labelBS_;
135  valid = false;
136  }
137 
139  iEvent.getByToken(tok_Vtx_, vt);
140  if (!vt.isValid()) {
141  edm::LogWarning("HcalHBHEMuon") << "AlCaHBHEMuonProducer: Error! can't get product " << labelVtx_;
142  valid = false;
143  }
144 
145  edm::Handle<EcalRecHitCollection> barrelRecHitsHandle;
146  iEvent.getByToken(tok_EB_, barrelRecHitsHandle);
147  if (!barrelRecHitsHandle.isValid()) {
148  edm::LogWarning("HcalHBHEMuon") << "AlCaHBHEMuonProducer: Error! can't get product " << labelEB_;
149  valid = false;
150  }
151 
152  edm::Handle<EcalRecHitCollection> endcapRecHitsHandle;
153  iEvent.getByToken(tok_EE_, endcapRecHitsHandle);
154  if (!endcapRecHitsHandle.isValid()) {
155  edm::LogWarning("HcalHBHEMuon") << "AlCaHBHEMuonProducer: Error! can't get product " << labelEE_;
156  valid = false;
157  }
158 
160  iEvent.getByToken(tok_HBHE_, hbhe);
161  if (!hbhe.isValid()) {
162  edm::LogWarning("HcalHBHEMuon") << "AlCaHBHEMuonProducer: Error! can't get product " << labelHBHE_;
163  valid = false;
164  }
165 
167  iEvent.getByToken(tok_Muon_, muonhandle);
168  if (!muonhandle.isValid()) {
169  edm::LogWarning("HcalHBHEMuon") << "AlCaHBHEMuonProducer: Error! can't get product " << labelMuon_;
170  valid = false;
171  }
172 
173 #ifdef DebugLog
174  edm::LogInfo("HcalHBHEMuon") << "AlCaHBHEMuonProducer::obtained the collections with validity flag " << valid;
175 #endif
176 
177  //For accepted events
178  std::auto_ptr<reco::BeamSpot> outputBeamSpot(new reco::BeamSpot());
179  std::auto_ptr<reco::VertexCollection> outputVColl(new reco::VertexCollection);
180  std::auto_ptr<EBRecHitCollection> outputEBColl(new EBRecHitCollection);
181  std::auto_ptr<EERecHitCollection> outputEEColl(new EERecHitCollection);
182  std::auto_ptr<HBHERecHitCollection> outputHBHEColl(new HBHERecHitCollection);
183  std::auto_ptr<reco::MuonCollection> outputMColl(new reco::MuonCollection);
184 
185  if (valid) {
186  const reco::BeamSpot beam = *(bmspot.product());
187  outputBeamSpot = std::auto_ptr<reco::BeamSpot>(new reco::BeamSpot(beam.position(),beam.sigmaZ(),
188  beam.dxdz(),beam.dydz(),beam.BeamWidthX(),
189  beam.covariance(),beam.type()));
190  const reco::VertexCollection vtx = *(vt.product());
191  const EcalRecHitCollection ebcoll = *(barrelRecHitsHandle.product());
192  const EcalRecHitCollection eecoll = *(endcapRecHitsHandle.product());
193  const HBHERecHitCollection hbhecoll = *(hbhe.product());
194  const reco::MuonCollection muons = *(muonhandle.product());
195 
196  bool accept = select(muons);
197 
198  if (accept) {
199  ++nGood_;
200 
201  for (reco::VertexCollection::const_iterator vtr=vtx.begin(); vtr!=vtx.end(); ++vtr)
202  outputVColl->push_back(*vtr);
203 
204  for (edm::SortedCollection<EcalRecHit>::const_iterator ehit=ebcoll.begin(); ehit!=ebcoll.end(); ++ehit)
205  outputEBColl->push_back(*ehit);
206 
207  for (edm::SortedCollection<EcalRecHit>::const_iterator ehit=eecoll.begin(); ehit!=eecoll.end(); ++ehit)
208  outputEEColl->push_back(*ehit);
209 
210  for (std::vector<HBHERecHit>::const_iterator hhit=hbhecoll.begin(); hhit!=hbhecoll.end(); ++hhit)
211  outputHBHEColl->push_back(*hhit);
212 
213  for (reco::MuonCollection::const_iterator muon=muons.begin(); muon!=muons.end(); ++muon)
214  outputMColl->push_back(*muon);
215  }
216  }
217 
218  iEvent.put(outputBeamSpot, labelBS_.label());
219  iEvent.put(outputVColl, labelVtx_.label());
220  iEvent.put(outputEBColl, labelEB_.instance());
221  iEvent.put(outputEEColl, labelEE_.instance());
222  iEvent.put(outputHBHEColl, labelHBHE_.label());
223  iEvent.put(outputMColl, labelMuon_.label());
224 }
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:464
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:24
std::vector< Muon > MuonCollection
collection of Muon objects
Definition: MuonFwd.h:9
double dydz() const
dydz slope
Definition: BeamSpot.h:84
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:120
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 69 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

edm::InputTag AlCaHBHEMuonProducer::labelEB_
private

Definition at line 70 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

edm::InputTag AlCaHBHEMuonProducer::labelEE_
private

Definition at line 70 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

edm::InputTag AlCaHBHEMuonProducer::labelHBHE_
private

Definition at line 70 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

edm::InputTag AlCaHBHEMuonProducer::labelMuon_
private

Definition at line 70 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

edm::InputTag AlCaHBHEMuonProducer::labelVtx_
private

Definition at line 69 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

unsigned int AlCaHBHEMuonProducer::nAll_
private

Definition at line 68 of file AlCaHBHEMuonProducer.cc.

Referenced by endStream(), and produce().

unsigned int AlCaHBHEMuonProducer::nGood_
private

Definition at line 68 of file AlCaHBHEMuonProducer.cc.

Referenced by endStream(), and produce().

unsigned int AlCaHBHEMuonProducer::nRun_
private

Definition at line 68 of file AlCaHBHEMuonProducer.cc.

Referenced by beginRun(), and endRun().

double AlCaHBHEMuonProducer::pMuonMin_
private

Definition at line 71 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and select().

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

Definition at line 73 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

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

Definition at line 75 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

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

Definition at line 76 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

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

Definition at line 77 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

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

Definition at line 78 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

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

Definition at line 74 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().