Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #include <map>
0002 #include <string>
0003 
0004 #include "TH1.h"
0005 #include "PhysicsTools/UtilAlgos/interface/BasicAnalyzer.h"
0006 #include "DataFormats/MuonReco/interface/Muon.h"
0007 
0008 /**
0009    \class BasicMuonAnalyzer BasicMuonAnalyzer.h "PhysicsTools/UtilAlgos/interface/BasicMuonAnalyzer.h"
0010    \brief Example class that can be used 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. The latter provides basic
0015    configuration file reading and event looping equivalent to the FWLiteHistograms executable of
0016    this package. You can see the FWLiteAnalyzerWrapper class at work in the FWLiteWithBasicAnalyzer
0017    executable of this package.
0018 */
0019 
0020 class BasicMuonAnalyzer : public edm::BasicAnalyzer {
0021 public:
0022   /// default constructor
0023   BasicMuonAnalyzer(const edm::ParameterSet& cfg, TFileDirectory& fs);
0024   BasicMuonAnalyzer(const edm::ParameterSet& cfg, TFileDirectory& fs, edm::ConsumesCollector&& iC);
0025   /// default destructor
0026   ~BasicMuonAnalyzer() override{};
0027   /// everything that needs to be done before the event loop
0028   void beginJob() override{};
0029   /// everything that needs to be done after the event loop
0030   void endJob() override{};
0031   /// everything that needs to be done during the event loop
0032   void analyze(const edm::EventBase& event) override;
0033 
0034 private:
0035   /// input tag for mouns
0036   edm::InputTag muons_;
0037   edm::EDGetTokenT<std::vector<reco::Muon> > muonsToken_;
0038   /// histograms
0039   std::map<std::string, TH1*> hists_;
0040 };