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 20 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 49 of file TrackAnalysisAlgorithm.cc.

References MessageLogger_cfi::cerr, and create_public_lumi_plots::hist.

49  {
50  TObject * hist = out.FindObject( k );
51  if( nullptr != hist ) {
52  hist->Draw();
53  canvas.SaveAs( ( string( k ) + ".jpg" ).c_str() );
54  } else {
55  cerr <<">> no '" << k << "' histogram" << endl;
56  }
57 }
int k[5][pyjets_maxn]
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  {
39  cout << ">> nothing to be done in post-processing" << endl;
40 }
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(), HiIsolationCommonParameters_cff::track, and l1t::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:690
double pt() const
track transverse momentum
Definition: TrackBase.h:660
void TrackAnalysisAlgorithm::terminate ( TList &  out)
static

terminate processing

Definition at line 42 of file TrackAnalysisAlgorithm.cc.

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

42  {
43  cout << ">> terminating" << endl;
44  TCanvas canvas;
45  draw( out, canvas, kPt );
46  draw( out, canvas, kEta );
47 }
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 33 of file TrackAnalysisAlgorithm.h.

TH1F* examples::TrackAnalysisAlgorithm::h_pt
private

histograms

Definition at line 33 of file TrackAnalysisAlgorithm.h.

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

Definition at line 35 of file TrackAnalysisAlgorithm.h.

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

histogram names

Definition at line 35 of file TrackAnalysisAlgorithm.h.