CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

TrackingParticleCategoriesAnalyzer Class Reference

Inheritance diagram for TrackingParticleCategoriesAnalyzer:
edm::EDAnalyzer

List of all members.

Public Member Functions

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

Private Member Functions

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

Private Attributes

TrackClassifier classifier_
Int_t numberTrackingParticleCategories_
std::size_t totalTrakingParticles_
TH1F * trackingParticleCategories_
edm::InputTag trackingTruth_

Detailed Description

Definition at line 24 of file TrackingParticleCategoriesAnalyser.cc.


Constructor & Destructor Documentation

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

Definition at line 49 of file TrackingParticleCategoriesAnalyser.cc.

References createBeamHaloJobs::directory, edm::ParameterSet::getUntrackedParameter(), i, TrackCategories::Names, numberTrackingParticleCategories_, trackingParticleCategories_, trackingTruth_, and TrackCategories::Unknown.

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

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

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

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

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

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

Definition at line 78 of file TrackingParticleCategoriesAnalyser.cc.

{ }

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 81 of file TrackingParticleCategoriesAnalyser.cc.

References classifier_, TrackClassifier::evaluate(), i, getHLTprescales::index, TrackCategories::is(), TrackClassifier::newEvent(), numberTrackingParticleCategories_, ecalTPGAnalyzer_cfg::TPCollection, trackingParticleCategories_, and trackingTruth_.

{
    // Track collection
    edm::Handle<TrackingParticleCollection> TPCollection;
    event.getByLabel(trackingTruth_, TPCollection);

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

    // Loop over the track collection.
    for (std::size_t index = 0; index < TPCollection->size(); index++)
    {
        TrackingParticleRef trackingParticle(TPCollection, index);

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

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

Member Data Documentation

Definition at line 41 of file TrackingParticleCategoriesAnalyser.cc.

Referenced by analyze().

Definition at line 39 of file TrackingParticleCategoriesAnalyser.cc.