Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:24:00

0001 #include <map>
0002 #include <string>
0003 
0004 #include "TH1.h"
0005 #include "PhysicsTools/UtilAlgos/interface/BasicAnalyzer.h"
0006 #include "DataFormats/PatCandidates/interface/Muon.h"
0007 
0008 /**
0009    \class PatMuonAnalyzer PatMuonAnalyzer.h "PhysicsTools/PatExamples/interface/PatMuonAnalyzer.h"
0010    \brief Example class that can be used to analyze pat::Muons both within FWLite and within the full framework
0011 
0012    This is an example for keeping classes that can be used both within FWLite and within the full
0013    framework. The class is derived from the BasicAnalyzer base class, which is an interface for
0014    the two wrapper classes EDAnalyzerWrapper and FWLiteAnalyzerWrapper. You can fin more information
0015    on this on WorkBookFWLiteExamples#ExampleFive.
0016 */
0017 
0018 class PatMuonAnalyzer : public edm::BasicAnalyzer {
0019 public:
0020   /// default constructor
0021   PatMuonAnalyzer(const edm::ParameterSet& cfg, TFileDirectory& fs);
0022   PatMuonAnalyzer(const edm::ParameterSet& cfg, TFileDirectory& fs, edm::ConsumesCollector&& iC);
0023   /// default destructor
0024   ~PatMuonAnalyzer() override{};
0025   /// everything that needs to be done before the event loop
0026   void beginJob() override{};
0027   /// everything that needs to be done after the event loop
0028   void endJob() override{};
0029   /// everything that needs to be done during the event loop
0030   void analyze(const edm::EventBase& event) override;
0031 
0032 private:
0033   /// input tag for mouns
0034   edm::InputTag muons_;
0035   edm::EDGetTokenT<std::vector<pat::Muon> > muonsToken_;
0036   /// histograms
0037   std::map<std::string, TH1*> hists_;
0038 };