CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

TrackCategoriesAnalyzer Class Reference

Inheritance diagram for TrackCategoriesAnalyzer:
edm::EDAnalyzer

List of all members.

Public Member Functions

 TrackCategoriesAnalyzer (const edm::ParameterSet &)
 ~TrackCategoriesAnalyzer ()

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)

Private Attributes

TrackClassifier classifier_
Int_t numberTrackCategories_
std::size_t totalTracks_
TH1F * trackCategories_
edm::InputTag trackProducer_

Detailed Description

Definition at line 24 of file TrackCategoriesAnalyzer.cc.


Constructor & Destructor Documentation

TrackCategoriesAnalyzer::TrackCategoriesAnalyzer ( const edm::ParameterSet config) [explicit]

Definition at line 49 of file TrackCategoriesAnalyzer.cc.

References createBeamHaloJobs::directory, edm::ParameterSet::getUntrackedParameter(), i, TrackCategories::Names, numberTrackCategories_, trackCategories_, trackProducer_, and TrackCategories::Unknown.

                                                                              : classifier_(config)
{
    // Get the track collection
    trackProducer_ = config.getUntrackedParameter<edm::InputTag> ( "trackProducer" );

    // Get the file service
    edm::Service<TFileService> fs;

    // Create a sub directory associated to the analyzer
    TFileDirectory directory = fs->mkdir( "TrackCategoriesAnalyzer" );

    // Number of track categories
    numberTrackCategories_ = TrackCategories::Unknown+1;

    // Define a new histograms
    trackCategories_ = fs->make<TH1F>(
                           "Frequency",
                           "Frequency for the different track categories",
                           numberTrackCategories_,
                           -0.5,
                           numberTrackCategories_ - 0.5
                       );

    // Set the proper categories names
    for (Int_t i = 0; i < numberTrackCategories_; ++i)
        trackCategories_->GetXaxis()->SetBinLabel(i+1, TrackCategories::Names[i]);
}
TrackCategoriesAnalyzer::~TrackCategoriesAnalyzer ( )

Definition at line 78 of file TrackCategoriesAnalyzer.cc.

{ }

Member Function Documentation

void TrackCategoriesAnalyzer::analyze ( const edm::Event event,
const edm::EventSetup setup 
) [private, virtual]

Implements edm::EDAnalyzer.

Definition at line 81 of file TrackCategoriesAnalyzer.cc.

References classifier_, TrackClassifier::evaluate(), i, getHLTprescales::index, TrackCategories::is(), TrackClassifier::newEvent(), numberTrackCategories_, trackCategories_, and trackProducer_.

{
    // Track collection
    edm::Handle<edm::View<reco::Track> > trackCollection;
    event.getByLabel(trackProducer_, trackCollection);

    // Set the classifier for a new event
    classifier_.newEvent(event, setup);

    // Loop over the track collection.
    for (std::size_t index = 0; index < trackCollection->size(); index++)
    {
        edm::RefToBase<reco::Track> track(trackCollection, index);

        // Classify the tracks
        classifier_.evaluate(track);

        // Fill the histogram with the categories
        for (Int_t i = 0; i != numberTrackCategories_; ++i)
            if (
                classifier_.is( (TrackCategories::Category) i )
            )
                trackCategories_->Fill(i);
    }
}

Member Data Documentation

Definition at line 41 of file TrackCategoriesAnalyzer.cc.

Referenced by analyze().

Definition at line 45 of file TrackCategoriesAnalyzer.cc.

Referenced by analyze(), and TrackCategoriesAnalyzer().

Definition at line 39 of file TrackCategoriesAnalyzer.cc.

Definition at line 43 of file TrackCategoriesAnalyzer.cc.

Referenced by analyze(), and TrackCategoriesAnalyzer().

Definition at line 37 of file TrackCategoriesAnalyzer.cc.

Referenced by analyze(), and TrackCategoriesAnalyzer().