Public Member Functions | |
TrackCategoriesAnalyzer (const edm::ParameterSet &) | |
~TrackCategoriesAnalyzer () | |
Private Member Functions | |
virtual void | analyze (const edm::Event &, const edm::EventSetup &) |
Private Attributes | |
TrackClassifier | classifier_ |
double | maximumChiSquared_ |
int | minimumNumberOfHits_ |
int | minimumNumberOfPixelHits_ |
double | minimumTransverseMomentum_ |
Int_t | numberTrackCategories_ |
std::size_t | totalTracks_ |
TH1F * | trackCategories_ |
edm::InputTag | trackProducer_ |
reco::TrackBase::TrackQuality | trackQuality_ |
bool | useAllQualities_ |
Definition at line 24 of file TrackCategoriesAnalyzer.cc.
TrackCategoriesAnalyzer::TrackCategoriesAnalyzer | ( | const edm::ParameterSet & | config | ) | [explicit] |
Definition at line 57 of file TrackCategoriesAnalyzer.cc.
References edm::ParameterSet::getUntrackedParameter(), i, maximumChiSquared_, minimumNumberOfHits_, minimumNumberOfPixelHits_, minimumTransverseMomentum_, TrackCategories::Names, numberTrackCategories_, reco::TrackBase::qualityByName(), trackCategories_, trackProducer_, trackQuality_, and TrackCategories::Unknown.
00057 : classifier_(config) 00058 { 00059 // Get the track collection 00060 trackProducer_ = config.getUntrackedParameter<edm::InputTag> ( "trackProducer" ); 00061 00062 // Get the basic track selection. 00063 minimumNumberOfHits_ = config.getUntrackedParameter<int> ( "minimumNumberOfHits" ); 00064 minimumNumberOfPixelHits_ = config.getUntrackedParameter<int> ( "minimumNumberOfPixelHits" ); 00065 minimumTransverseMomentum_ = config.getUntrackedParameter<double> ( "minimumTransverseMomentum" ); 00066 maximumChiSquared_ = config.getUntrackedParameter<double> ( "maximumChiSquared" ); 00067 00068 std::string trackQualityType = config.getUntrackedParameter<std::string>("trackQualityClass"); //used 00069 trackQuality_ = reco::TrackBase::qualityByName(trackQualityType); 00070 00071 // Get the file service 00072 edm::Service<TFileService> fs; 00073 00074 // Create a sub directory associated to the analyzer 00075 TFileDirectory directory = fs->mkdir( "TrackCategoriesAnalyzer" ); 00076 00077 // Number of track categories 00078 numberTrackCategories_ = TrackCategories::Unknown+1; 00079 00080 // Define a new histograms 00081 trackCategories_ = fs->make<TH1F>( 00082 "Frequency", 00083 "Frequency for the different track categories", 00084 numberTrackCategories_, 00085 -0.5, 00086 numberTrackCategories_ - 0.5 00087 ); 00088 00089 // Set the proper categories names 00090 for (Int_t i = 0; i < numberTrackCategories_; ++i) 00091 trackCategories_->GetXaxis()->SetBinLabel(i+1, TrackCategories::Names[i]); 00092 }
TrackCategoriesAnalyzer::~TrackCategoriesAnalyzer | ( | ) |
void TrackCategoriesAnalyzer::analyze | ( | const edm::Event & | event, | |
const edm::EventSetup & | setup | |||
) | [private, virtual] |
Implements edm::EDAnalyzer.
Definition at line 98 of file TrackCategoriesAnalyzer.cc.
References classifier_, TrackClassifier::evaluate(), i, index, TrackClassifier::is(), maximumChiSquared_, minimumNumberOfHits_, minimumNumberOfPixelHits_, minimumTransverseMomentum_, TrackClassifier::newEvent(), numberTrackCategories_, track, trackCategories_, trackProducer_, and trackQuality_.
00099 { 00100 // Track collection 00101 edm::Handle<edm::View<reco::Track> > trackCollection; 00102 event.getByLabel(trackProducer_, trackCollection); 00103 00104 // Set the classifier for a new event 00105 classifier_.newEvent(event, setup); 00106 00107 // Loop over the track collection. 00108 for (std::size_t index = 0; index < trackCollection->size(); index++) 00109 { 00110 edm::RefToBase<reco::Track> track(trackCollection, index); 00111 00112 // Get basic track number 00113 double pt = track->pt(); 00114 double chi2 = track->normalizedChi2(); 00115 int hits = track->hitPattern().numberOfValidHits(); 00116 int pixelHits = track->hitPattern().numberOfValidPixelHits(); 00117 00118 // Track selection 00119 if ( 00120 hits < minimumNumberOfHits_ || 00121 pixelHits < minimumNumberOfPixelHits_ || 00122 pt < minimumTransverseMomentum_ || 00123 chi2 > maximumChiSquared_ || 00124 (!track->quality(trackQuality_)) 00125 ) continue; 00126 00127 // Classify the tracks 00128 classifier_.evaluate(track); 00129 00130 // Fill the histogram with the categories 00131 for (Int_t i = 0; i != numberTrackCategories_; ++i) 00132 if ( 00133 classifier_.is( (TrackCategories::Category) i ) 00134 ) 00135 trackCategories_->Fill(i); 00136 } 00137 }
double TrackCategoriesAnalyzer::maximumChiSquared_ [private] |
Definition at line 43 of file TrackCategoriesAnalyzer.cc.
Referenced by analyze(), and TrackCategoriesAnalyzer().
Definition at line 41 of file TrackCategoriesAnalyzer.cc.
Referenced by analyze(), and TrackCategoriesAnalyzer().
Definition at line 41 of file TrackCategoriesAnalyzer.cc.
Referenced by analyze(), and TrackCategoriesAnalyzer().
double TrackCategoriesAnalyzer::minimumTransverseMomentum_ [private] |
Definition at line 43 of file TrackCategoriesAnalyzer.cc.
Referenced by analyze(), and TrackCategoriesAnalyzer().
Int_t TrackCategoriesAnalyzer::numberTrackCategories_ [private] |
Definition at line 53 of file TrackCategoriesAnalyzer.cc.
Referenced by analyze(), and TrackCategoriesAnalyzer().
std::size_t TrackCategoriesAnalyzer::totalTracks_ [private] |
Definition at line 39 of file TrackCategoriesAnalyzer.cc.
TH1F* TrackCategoriesAnalyzer::trackCategories_ [private] |
Definition at line 51 of file TrackCategoriesAnalyzer.cc.
Referenced by analyze(), and TrackCategoriesAnalyzer().
Definition at line 37 of file TrackCategoriesAnalyzer.cc.
Referenced by analyze(), and TrackCategoriesAnalyzer().
Definition at line 47 of file TrackCategoriesAnalyzer.cc.
Referenced by analyze(), and TrackCategoriesAnalyzer().
Definition at line 45 of file TrackCategoriesAnalyzer.cc.