CMS 3D CMS Logo

FFTJetImageRecorder.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: FFTJetImageRecorder
4 // Class: FFTJetImageRecorder
5 //
13 //
14 // Original Author: Igor Volobouev
15 // Created: Thu Apr 21 15:52:11 CDT 2011
16 //
17 //
18 
19 #include <cassert>
20 #include <sstream>
21 #include <numeric>
22 
23 #include "TNtuple.h"
24 
25 // user include files
28 
32 
34 
36 #include <TH3F.h>
37 
39 
41 
42 #define init_param(type, varname) varname (ps.getParameter< type >( #varname ))
43 
44 //
45 // class declaration
46 //
48 {
49 public:
50  explicit FFTJetImageRecorder(const edm::ParameterSet&);
51  ~FFTJetImageRecorder() override;
52 
53 private:
54  FFTJetImageRecorder() = delete;
57 
58  void beginJob() override ;
59  void analyze(const edm::Event&, const edm::EventSetup&) override;
60  void endJob() override ;
61 
63  unsigned long counter;
64 
66 };
67 
68 //
69 // constructors and destructor
70 //
72  : init_param(edm::InputTag, histoLabel),
73  counter(0)
74 {
75  histoToken = consumes<TH3F>(histoLabel);
76 }
77 
78 
80 {
81 }
82 
83 
84 //
85 // member functions
86 //
87 
88 // ------------ method called once each job just before starting event loop
90 {
92  fs->make<TNtuple>("dummy", "dummy", "var");
93 }
94 
95 
96 // ------------ method called to for each event ------------
98  const edm::EventSetup& iSetup)
99 {
100  edm::RunNumber_t const runnumber = iEvent.id().run();
101  edm::EventNumber_t const eventnumber = iEvent.id().event();
102 
104  iEvent.getByToken(histoToken, input);
105 
107  TH3F* copy = new TH3F(*input);
108 
109  std::ostringstream os;
110  os << copy->GetName() << '_' << counter << '_'
111  << runnumber << '_' << eventnumber;
112  const std::string& newname(os.str());
113  copy->SetNameTitle(newname.c_str(), newname.c_str());
114 
115  copy->SetDirectory(fs->getBareDirectory());
116 
117  ++counter;
118 }
119 
120 
121 // ------------ method called once each job just after ending the event loop
123 {
124 }
125 
126 
127 //define this as a plug-in
RunNumber_t run() const
Definition: EventID.h:39
EventNumber_t event() const
Definition: EventID.h:41
FFTJetImageRecorder()=delete
FFTJetImageRecorder & operator=(const FFTJetImageRecorder &)=delete
def copy(args, dbName)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
#define init_param(type, varname)
unsigned long long EventNumber_t
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
static std::string const input
Definition: EdmProvDump.cc:48
edm::EDGetTokenT< TH3F > histoToken
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
TDirectory * getBareDirectory(const std::string &subdir="") const
Definition: TFileService.h:52
void analyze(const edm::Event &, const edm::EventSetup &) override
void beginJob() override
edm::EventID id() const
Definition: EventBase.h:59
HLT enums.
unsigned int RunNumber_t