CMS 3D CMS Logo

Public Member Functions | Static Public Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes

examples::TrackAnalysisAlgorithm Struct Reference

#include <TrackAnalysisAlgorithm.h>

List of all members.

Public Member Functions

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

Static Public Member Functions

static void terminate (TList &)
 terminate processing

Static Private Member Functions

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

Private Attributes

TH1F * h_eta
TH1F * h_pt
 histograms
static const char * kEta = "eta"

Static Private Attributes

static const char * kPt = "pt"
 histogram names

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.

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

Member Function Documentation

void TrackAnalysisAlgorithm::draw ( const TList &  out,
TCanvas &  canvas,
const char *  k 
) [static, private]

draw an histogram

Definition at line 49 of file TrackAnalysisAlgorithm.cc.

References benchmark_cfg::cerr, and estimatePileup::hist.

                                                                                       {
  TObject * hist = out.FindObject( k );
  if( 0 != hist ) {
    hist->Draw();
    canvas.SaveAs( ( string( k ) + ".jpg" ).c_str() );
  } else {
    cerr <<">> no '" << k << "' histogram" << endl;
  }
}
void TrackAnalysisAlgorithm::postProcess ( TList &  )

post process

Definition at line 38 of file TrackAnalysisAlgorithm.cc.

References gather_cfg::cout.

                                                  {
  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(), i, reco::TrackBase::pt(), and testEve_cfg::tracks.

                                                          {
  cout << ">> processing event " << endl;
  Handle<TrackCollection> tracks;
  event.getByLabel( "ctfWithMaterialTracks", tracks );
  
  cout << ">> tracks found:" << tracks->size() << endl;
  for ( size_t i = 0; i < tracks->size(); ++i ) {
    const Track & track = ( * tracks )[ i ];
    h_pt ->Fill( track.pt() );
    h_eta->Fill( track.eta() );
    cout << ">> pt, eta:  " << track.pt() << ", " << track.eta() << endl;
  }
}
void TrackAnalysisAlgorithm::terminate ( TList &  out) [static]

terminate processing

Definition at line 42 of file TrackAnalysisAlgorithm.cc.

References MultipleCompare::canvas, gather_cfg::cout, cond::draw(), JetComb::kEta, and kPt.

                                                    {
  cout << ">> terminating" << endl;
  TCanvas canvas;
  draw( out, canvas,  kPt );
  draw( out, canvas, kEta );
}

Member Data Documentation

Definition at line 33 of file TrackAnalysisAlgorithm.h.

histograms

Definition at line 33 of file TrackAnalysisAlgorithm.h.

const char * TrackAnalysisAlgorithm::kEta = "eta" [private]

Definition at line 35 of file TrackAnalysisAlgorithm.h.

const char * TrackAnalysisAlgorithm::kPt = "pt" [static, private]

histogram names

Definition at line 35 of file TrackAnalysisAlgorithm.h.