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 ( const TList *  ,
TList &  out 
)

constructor

Definition at line 18 of file TrackAnalysisAlgorithm.cc.

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

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 }
static const char * kPt
histogram names

Member Function Documentation

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

draw an histogram

Definition at line 47 of file TrackAnalysisAlgorithm.cc.

References beam_dqm_sourceclient-live_cfg::cerr, and compare::hist.

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 }
def canvas(sub, attr)
Definition: svgfig.py:482
void TrackAnalysisAlgorithm::postProcess ( TList &  )

post process

Definition at line 38 of file TrackAnalysisAlgorithm.cc.

References gather_cfg::cout.

38 { cout << ">> nothing to be done in post-processing" << endl; }
void TrackAnalysisAlgorithm::process ( const edm::Event event)

process one event

Definition at line 24 of file TrackAnalysisAlgorithm.cc.

References gather_cfg::cout, reco::TrackBase::eta(), mps_fire::i, reco::TrackBase::pt(), HLT_2018_cff::track, and PDWG_EXOHSCP_cff::tracks.

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 }
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:617
double pt() const
track transverse momentum
Definition: TrackBase.h:602
void TrackAnalysisAlgorithm::terminate ( TList &  out)
static

terminate processing

Definition at line 40 of file TrackAnalysisAlgorithm.cc.

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

40  {
41  cout << ">> terminating" << endl;
42  TCanvas canvas;
43  draw(out, canvas, kPt);
44  draw(out, canvas, kEta);
45 }
static void draw(const TList &, TCanvas &, const char *)
draw an histogram
static const char * kPt
histogram names
def canvas(sub, attr)
Definition: svgfig.py:482

Member Data Documentation

TH1F * examples::TrackAnalysisAlgorithm::h_eta
private

Definition at line 36 of file TrackAnalysisAlgorithm.h.

TH1F* examples::TrackAnalysisAlgorithm::h_pt
private

histograms

Definition at line 36 of file TrackAnalysisAlgorithm.h.

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

Definition at line 38 of file TrackAnalysisAlgorithm.h.

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

histogram names

Definition at line 38 of file TrackAnalysisAlgorithm.h.