CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes
examples::TrackAnalysisAlgorithm Struct Reference

#include <TrackAnalysisAlgorithm.h>

Public Member Functions

void postProcess (TList &)
 post process More...
 
void process (const edm::Event &)
 process one event More...
 
 TrackAnalysisAlgorithm (const TList *, TList &)
 constructor More...
 

Static Public Member Functions

static void terminate (TList &)
 terminate processing More...
 

Static Private Member Functions

static void draw (const TList &, TCanvas &, const char *)
 draw an histogram More...
 

Private Attributes

TH1F * h_eta
 
TH1F * h_pt
 histograms More...
 

Static Private Attributes

static const char * kEta = "eta"
 
static const char * kPt = "pt"
 histogram names More...
 

Detailed Description

Definition at line 22 of file TrackAnalysisAlgorithm.h.

Constructor & Destructor Documentation

◆ TrackAnalysisAlgorithm()

TrackAnalysisAlgorithm::TrackAnalysisAlgorithm ( const TList *  ,
TList &  out 
)

constructor

Definition at line 18 of file TrackAnalysisAlgorithm.cc.

18  {
19  cout << ">> booking histograms" << endl;
20  out.Add(h_pt = new TH1F(kPt, "pt", 100, 0, 20));
21  out.Add(h_eta = new TH1F(kEta, "#eta", 100, -3, 3));
22 }

References gather_cfg::cout, JetComb::kEta, kPt, and MillePedeFileConverter_cfg::out.

Member Function Documentation

◆ draw()

void TrackAnalysisAlgorithm::draw ( const TList &  out,
TCanvas &  canvas,
const char *  k 
)
staticprivate

draw an histogram

Definition at line 47 of file TrackAnalysisAlgorithm.cc.

47  {
48  TObject* hist = out.FindObject(k);
49  if (nullptr != hist) {
50  hist->Draw();
51  canvas.SaveAs((string(k) + ".jpg").c_str());
52  } else {
53  cerr << ">> no '" << k << "' histogram" << endl;
54  }
55 }

References svgfig::canvas(), EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0::cerr, compare::hist, dqmdumpme::k, and MillePedeFileConverter_cfg::out.

◆ postProcess()

void TrackAnalysisAlgorithm::postProcess ( TList &  )

post process

Definition at line 38 of file TrackAnalysisAlgorithm.cc.

38 { cout << ">> nothing to be done in post-processing" << endl; }

References gather_cfg::cout.

◆ process()

void TrackAnalysisAlgorithm::process ( const edm::Event event)

process one event

Definition at line 24 of file TrackAnalysisAlgorithm.cc.

24  {
25  cout << ">> processing event " << endl;
27  event.getByLabel("ctfWithMaterialTracks", tracks);
28 
29  cout << ">> tracks found:" << tracks->size() << endl;
30  for (size_t i = 0; i < tracks->size(); ++i) {
31  const Track& track = (*tracks)[i];
32  h_pt->Fill(track.pt());
33  h_eta->Fill(track.eta());
34  cout << ">> pt, eta: " << track.pt() << ", " << track.eta() << endl;
35  }
36 }

References gather_cfg::cout, mps_fire::i, HLT_FULL_cff::track, and PDWG_EXOHSCP_cff::tracks.

◆ terminate()

void TrackAnalysisAlgorithm::terminate ( TList &  out)
static

terminate processing

Definition at line 40 of file TrackAnalysisAlgorithm.cc.

40  {
41  cout << ">> terminating" << endl;
42  TCanvas canvas;
43  draw(out, canvas, kPt);
44  draw(out, canvas, kEta);
45 }

References svgfig::canvas(), gather_cfg::cout, ntuplePlotting::draw(), JetComb::kEta, kPt, and MillePedeFileConverter_cfg::out.

Member Data Documentation

◆ h_eta

TH1F * examples::TrackAnalysisAlgorithm::h_eta
private

Definition at line 36 of file TrackAnalysisAlgorithm.h.

◆ h_pt

TH1F* examples::TrackAnalysisAlgorithm::h_pt
private

histograms

Definition at line 36 of file TrackAnalysisAlgorithm.h.

◆ kEta

const char * TrackAnalysisAlgorithm::kEta = "eta"
staticprivate

Definition at line 38 of file TrackAnalysisAlgorithm.h.

◆ kPt

const char * TrackAnalysisAlgorithm::kPt = "pt"
staticprivate

histogram names

Definition at line 38 of file TrackAnalysisAlgorithm.h.

svgfig.canvas
def canvas(*sub, **attr)
Definition: svgfig.py:482
PDWG_EXOHSCP_cff.tracks
tracks
Definition: PDWG_EXOHSCP_cff.py:28
mps_fire.i
i
Definition: mps_fire.py:428
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11713
gather_cfg.cout
cout
Definition: gather_cfg.py:144
edm::Handle
Definition: AssociativeIterator.h:50
compare.hist
hist
Definition: compare.py:376
reco::Track
Definition: Track.h:27
dqmdumpme.k
k
Definition: dqmdumpme.py:60
examples::TrackAnalysisAlgorithm::kEta
static const char * kEta
Definition: TrackAnalysisAlgorithm.h:38
examples::TrackAnalysisAlgorithm::h_eta
TH1F * h_eta
Definition: TrackAnalysisAlgorithm.h:36
examples::TrackAnalysisAlgorithm::h_pt
TH1F * h_pt
histograms
Definition: TrackAnalysisAlgorithm.h:36
examples::TrackAnalysisAlgorithm::draw
static void draw(const TList &, TCanvas &, const char *)
draw an histogram
Definition: TrackAnalysisAlgorithm.cc:47
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.cerr
cerr
Definition: EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.py:8
examples::TrackAnalysisAlgorithm::kPt
static const char * kPt
histogram names
Definition: TrackAnalysisAlgorithm.h:38