CMS 3D CMS Logo

SimTauAnalyzer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 //
4 // Original Author: Andreas Gruber
5 // Created: Mon, 16 Oct 2023 14:24:35 GMT
6 //
7 //
8 
9 // system include files
10 #include <memory>
11 
12 // user include files
17 
20 #include "TH1.h"
21 
25 
28 
29 class SimTauAnalyzer : public edm::one::EDAnalyzer<edm::one::SharedResources> {
30 public:
31  explicit SimTauAnalyzer(const edm::ParameterSet&);
32  ~SimTauAnalyzer() override = default;
33 
34 private:
35  void analyze(const edm::Event&, const edm::EventSetup&) override;
36 
38  TH1D* DM_histo;
39 };
40 
42  : simTau_token_(consumes<std::vector<SimTauCPLink>>(iConfig.getParameter<edm::InputTag>("simTau"))) {
43  usesResource(TFileService::kSharedResource);
45  DM_histo = fs->make<TH1D>("DM_histo", "DM_histo", 20, -1, 19);
46 }
47 
48 // ------------ method called for each event ------------
51  iEvent.getByToken(simTau_token_, simTau_h);
52 
53  const auto& simTaus = *simTau_h;
54 
55  for (auto const& simTau : simTaus) {
56 #ifdef EDM_ML_DEBUG
57  simTau.dumpFullDecay();
58  simTau.dump();
59 #endif
60  DM_histo->Fill(simTau.decayMode);
61  }
62 }
63 
64 //define this as a plug-in
static const std::string kSharedResource
Definition: TFileService.h:76
void analyze(const edm::Event &, const edm::EventSetup &) override
int iEvent
Definition: GenABIO.cc:224
const edm::EDGetTokenT< std::vector< SimTauCPLink > > simTau_token_
SimTauAnalyzer(const edm::ParameterSet &)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
HLT enums.
~SimTauAnalyzer() override=default