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
 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 labelTriggerResults_
 
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
< edm::TriggerResults
tok_trigRes_
 
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
 
- 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 41 of file AlCaHBHEMuonProducer.cc.

Constructor & Destructor Documentation

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

Definition at line 72 of file AlCaHBHEMuonProducer.cc.

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

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

Definition at line 111 of file AlCaHBHEMuonProducer.cc.

111 { }

Member Function Documentation

void AlCaHBHEMuonProducer::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 223 of file AlCaHBHEMuonProducer.cc.

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

Reimplemented from edm::EDProducer.

Definition at line 230 of file AlCaHBHEMuonProducer.cc.

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

230  {
231  edm::LogInfo("HcalHBHEMuon") << "Run[" << nRun << "] " << iRun.run();
232 }
void AlCaHBHEMuonProducer::endJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 225 of file AlCaHBHEMuonProducer.cc.

References nAll, nGood, and nRun.

225  {
226  edm::LogInfo("HcalHBHEMuon") << "Finds " << nGood << " good tracks in "
227  << nAll << " events from " << nRun << " runs";
228 }
void AlCaHBHEMuonProducer::endRun ( edm::Run const &  iRun,
edm::EventSetup const &   
)
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 234 of file AlCaHBHEMuonProducer.cc.

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

234  {
235  nRun++;
236  edm::LogInfo("HcalHBHEMuon") << "endRun[" << nRun << "] " << iRun.run();
237 }
void AlCaHBHEMuonProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

Implements edm::EDProducer.

Definition at line 113 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::InputTag::encode(), edm::SortedCollection< T, SORT >::end(), edm::EventID::event(), edm::Event::getByToken(), edm::EventBase::id(), edm::HandleBase::isValid(), labelBS_, labelEB_, labelEE_, labelHBHE_, labelMuon_, labelTriggerResults_, labelVtx_, LogDebug, 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_trigRes_, tok_Vtx_, triggerResults, and reco::BeamSpot::type().

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

113  {
114 
115  nAll++;
116  LogDebug("HcalHBHEMuon") << "Run " << iEvent.id().run() << " Event "
117  << iEvent.id().event() << " Luminosity "
118  << iEvent.luminosityBlock() << " Bunch "
119  << iEvent.bunchCrossing();
120 
121  //Step1: Get all the relevant containers
123  iEvent.getByToken(tok_trigRes_, triggerResults);
124  if (!triggerResults.isValid()) {
125  edm::LogWarning("HcalHBHEMuon") << "AlCaHBHEMuonProducer: Error! can't get product " << labelTriggerResults_;
126  return;
127  }
128  const edm::TriggerResults trigres = *(triggerResults.product());
129 
131  iEvent.getByToken(tok_BS_, bmspot);
132  if (!bmspot.isValid()){
133  edm::LogWarning("HcalHBHEMuon") << "AlCaHBHEMuonProducer: Error! can't get product " << labelBS_;
134  return;
135  }
136  const reco::BeamSpot beam = *(bmspot.product());
137 
139  iEvent.getByToken(tok_Vtx_, vt);
140  if (!vt.isValid()) {
141  edm::LogWarning("HcalHBHEMuon") << "AlCaHBHEMuonProducer: Error! can't get product " << labelVtx_;
142  return ;
143  }
144  const reco::VertexCollection vtx = *(vt.product());
145 
146  edm::Handle<EcalRecHitCollection> barrelRecHitsHandle;
147  iEvent.getByToken(tok_EB_, barrelRecHitsHandle);
148  if (!barrelRecHitsHandle.isValid()) {
149  edm::LogWarning("HcalHBHEMuon") << "AlCaHBHEMuonProducer: Error! can't get product " << labelEB_;
150  return ;
151  }
152  const EcalRecHitCollection ebcoll = *(barrelRecHitsHandle.product());
153 
154  edm::Handle<EcalRecHitCollection> endcapRecHitsHandle;
155  iEvent.getByToken(tok_EE_, endcapRecHitsHandle);
156  if (!endcapRecHitsHandle.isValid()) {
157  edm::LogWarning("HcalHBHEMuon") << "AlCaHBHEMuonProducer: Error! can't get product " << labelEE_;
158  return ;
159  }
160  const EcalRecHitCollection eecoll = *(endcapRecHitsHandle.product());
161 
163  iEvent.getByToken(tok_HBHE_, hbhe);
164  if (!hbhe.isValid()) {
165  edm::LogWarning("HcalHBHEMuon") << "AlCaHBHEMuonProducer: Error! can't get product " << labelHBHE_;
166  return ;
167  }
168  const HBHERecHitCollection hbhecoll = *(hbhe.product());
169 
171  iEvent.getByToken(tok_Muon_, muonhandle);
172  if (!muonhandle.isValid()) {
173  edm::LogWarning("HcalHBHEMuon") << "AlCaHBHEMuonProducer: Error! can't get product " << labelMuon_;
174  return ;
175  }
176  const reco::MuonCollection muons = *(muonhandle.product());
177 
178  LogDebug("HcalHBHEMuon") << "Has obtained all the collections";
179 
180  //For accepted events
181  bool accept = select(muons);
182  if (accept) {
183  nGood++;
184 
185  std::auto_ptr<edm::TriggerResults> outputTriggerResults(new edm::TriggerResults);
186  *outputTriggerResults = trigres;
187 
188  std::auto_ptr<reco::BeamSpot> outputBeamSpot(new reco::BeamSpot(beam.position(),beam.sigmaZ(),
189  beam.dxdz(),beam.dydz(),beam.BeamWidthX(),
190  beam.covariance(),beam.type()));
191 
192  std::auto_ptr<reco::VertexCollection> outputVColl(new reco::VertexCollection);
193  for (reco::VertexCollection::const_iterator vtr=vtx.begin(); vtr!=vtx.end(); ++vtr)
194  outputVColl->push_back(*vtr);
195 
196  std::auto_ptr<EBRecHitCollection> outputEBColl(new EBRecHitCollection);
197  for (edm::SortedCollection<EcalRecHit>::const_iterator ehit=ebcoll.begin(); ehit!=ebcoll.end(); ++ehit)
198  outputEBColl->push_back(*ehit);
199 
200  std::auto_ptr<EERecHitCollection> outputEEColl(new EERecHitCollection);
201  for (edm::SortedCollection<EcalRecHit>::const_iterator ehit=eecoll.begin(); ehit!=eecoll.end(); ++ehit)
202  outputEEColl->push_back(*ehit);
203 
204  std::auto_ptr<HBHERecHitCollection> outputHBHEColl(new HBHERecHitCollection);
205  for (std::vector<HBHERecHit>::const_iterator hhit=hbhecoll.begin(); hhit!=hbhecoll.end(); ++hhit)
206  outputHBHEColl->push_back(*hhit);
207 
208 
209  std::auto_ptr<reco::MuonCollection> outputMColl(new reco::MuonCollection);
210  for (reco::MuonCollection::const_iterator muon=muons.begin(); muon!=muons.end(); ++muon)
211  outputMColl->push_back(*muon);
212 
213  iEvent.put(outputTriggerResults, labelTriggerResults_.encode());
214  iEvent.put(outputBeamSpot, labelBS_.encode());
215  iEvent.put(outputVColl, labelVtx_.encode());
216  iEvent.put(outputEBColl, labelEB_.encode());
217  iEvent.put(outputEEColl, labelEE_.encode());
218  iEvent.put(outputHBHEColl, labelHBHE_.encode());
219  iEvent.put(outputMColl, labelMuon_.encode());
220  }
221 }
#define LogDebug(id)
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:449
edm::EDGetTokenT< EcalRecHitCollection > tok_EE_
std::vector< T >::const_iterator const_iterator
int bunchCrossing() const
Definition: EventBase.h:66
edm::InputTag labelTriggerResults_
edm::LuminosityBlockNumber_t luminosityBlock() const
Definition: EventBase.h:63
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
edm::EDGetTokenT< edm::TriggerResults > tok_trigRes_
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:25
std::string encode() const
Definition: InputTag.cc:164
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:113
edm::EDGetTokenT< HBHERecHitCollection > tok_HBHE_
double BeamWidthX() const
beam width X
Definition: BeamSpot.h:86
static std::string const triggerResults
Definition: EdmProvDump.cc:40
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_
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
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 58 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

edm::InputTag AlCaHBHEMuonProducer::labelEB_
private

Definition at line 59 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

edm::InputTag AlCaHBHEMuonProducer::labelEE_
private

Definition at line 59 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

edm::InputTag AlCaHBHEMuonProducer::labelHBHE_
private

Definition at line 59 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

edm::InputTag AlCaHBHEMuonProducer::labelMuon_
private

Definition at line 59 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

edm::InputTag AlCaHBHEMuonProducer::labelTriggerResults_
private

Definition at line 58 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

edm::InputTag AlCaHBHEMuonProducer::labelVtx_
private

Definition at line 58 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

int AlCaHBHEMuonProducer::nAll
private

Definition at line 57 of file AlCaHBHEMuonProducer.cc.

Referenced by endJob(), and produce().

int AlCaHBHEMuonProducer::nGood
private

Definition at line 57 of file AlCaHBHEMuonProducer.cc.

Referenced by endJob(), and produce().

int AlCaHBHEMuonProducer::nRun
private

Definition at line 57 of file AlCaHBHEMuonProducer.cc.

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

double AlCaHBHEMuonProducer::pMuonMin_
private

Definition at line 60 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and select().

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

Definition at line 63 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

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

Definition at line 65 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

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

Definition at line 66 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

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

Definition at line 67 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

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

Definition at line 68 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

edm::EDGetTokenT<edm::TriggerResults> AlCaHBHEMuonProducer::tok_trigRes_
private

Definition at line 62 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().

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

Definition at line 64 of file AlCaHBHEMuonProducer.cc.

Referenced by AlCaHBHEMuonProducer(), and produce().