CMS 3D CMS Logo

examples::TrackAnalysisAlgorithm Struct Reference

#include <PhysicsTools/ParallelAnalysis/interface/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 Private Attributes

static const char * kEta = "eta"
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 GenMuonPlsPt100GeV_cfg::cout, lat::endl(), h_eta, h_pt, kEta, and kPt.

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


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 TestMuL1L2Filter_cff::cerr, and lat::endl().

Referenced by terminate().

00049                                                                                        {
00050   TObject * hist = out.FindObject( k );
00051   if( 0 != hist ) {
00052     hist->Draw();
00053     canvas.SaveAs( ( string( k ) + ".jpg" ).c_str() );
00054   } else {
00055     cerr <<">> no '" << k << "' histogram" << endl;
00056   }
00057 }

void TrackAnalysisAlgorithm::postProcess ( TList &   ) 

post process

Definition at line 38 of file TrackAnalysisAlgorithm.cc.

References GenMuonPlsPt100GeV_cfg::cout, and lat::endl().

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

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

process one event

Definition at line 24 of file TrackAnalysisAlgorithm.cc.

References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), reco::TrackBase::eta(), h_eta, h_pt, i, reco::TrackBase::pt(), track, and tracks.

00024                                                           {
00025   cout << ">> processing event " << endl;
00026   Handle<TrackCollection> tracks;
00027   event.getByLabel( "ctfWithMaterialTracks", tracks );
00028   
00029   cout << ">> tracks found:" << tracks->size() << endl;
00030   for ( size_t i = 0; i < tracks->size(); ++i ) {
00031     const Track & track = ( * tracks )[ i ];
00032     h_pt ->Fill( track.pt() );
00033     h_eta->Fill( track.eta() );
00034     cout << ">> pt, eta:  " << track.pt() << ", " << track.eta() << endl;
00035   }
00036 }

void TrackAnalysisAlgorithm::terminate ( TList &  out  )  [static]

terminate processing

Definition at line 42 of file TrackAnalysisAlgorithm.cc.

References GenMuonPlsPt100GeV_cfg::cout, draw(), lat::endl(), kEta, and kPt.

Referenced by examples::TrackTSelector::terminate().

00042                                                     {
00043   cout << ">> terminating" << endl;
00044   TCanvas canvas;
00045   draw( out, canvas,  kPt );
00046   draw( out, canvas, kEta );
00047 }


Member Data Documentation

TH1F * examples::TrackAnalysisAlgorithm::h_eta [private]

Definition at line 33 of file TrackAnalysisAlgorithm.h.

Referenced by process(), and TrackAnalysisAlgorithm().

TH1F* examples::TrackAnalysisAlgorithm::h_pt [private]

histograms

Definition at line 33 of file TrackAnalysisAlgorithm.h.

Referenced by process(), and TrackAnalysisAlgorithm().

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

Definition at line 35 of file TrackAnalysisAlgorithm.h.

Referenced by terminate(), and TrackAnalysisAlgorithm().

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

histogram names

Definition at line 35 of file TrackAnalysisAlgorithm.h.

Referenced by terminate(), and TrackAnalysisAlgorithm().


The documentation for this struct was generated from the following files:
Generated on Tue Jun 9 18:46:51 2009 for CMSSW by  doxygen 1.5.4