CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
TrackingParticleCategoriesAnalyzer Class Reference
Inheritance diagram for TrackingParticleCategoriesAnalyzer:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 TrackingParticleCategoriesAnalyzer (const edm::ParameterSet &)
 
 ~TrackingParticleCategoriesAnalyzer ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

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

Private Attributes

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

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

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.

49  : classifier_(config)
50 {
51  // Get the track collection
52  trackingTruth_ = config.getUntrackedParameter<edm::InputTag> ( "trackingTruth" );
53 
54  // Get the file service
56 
57  // Create a sub directory associated to the analyzer
58  TFileDirectory directory = fs->mkdir( "TrackingParticleCategoriesAnalyzer" );
59 
60  // Number of track categories
62 
63  // Define a new histograms
64  trackingParticleCategories_ = fs->make<TH1F>(
65  "Frequency",
66  "Frequency for the different track categories",
68  -0.5,
69  numberTrackingParticleCategories_ - 0.5
70  );
71 
72  // Set the proper categories names
73  for (Int_t i = 0; i < numberTrackingParticleCategories_; ++i)
74  trackingParticleCategories_->GetXaxis()->SetBinLabel(i+1, TrackCategories::Names[i]);
75 }
static const char * Names[]
Name of the different categories.
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
TrackingParticleCategoriesAnalyzer::~TrackingParticleCategoriesAnalyzer ( )

Definition at line 78 of file TrackingParticleCategoriesAnalyser.cc.

78 { }

Member Function Documentation

void TrackingParticleCategoriesAnalyzer::analyze ( const edm::Event event,
const edm::EventSetup setup 
)
overrideprivatevirtual

Implements edm::EDAnalyzer.

Definition at line 81 of file TrackingParticleCategoriesAnalyser.cc.

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

82 {
83  // Track collection
85  event.getByLabel(trackingTruth_, TPCollection);
86 
87  // Set the classifier for a new event
88  classifier_.newEvent(event, setup);
89 
90  // Loop over the track collection.
91  for (std::size_t index = 0; index < TPCollection->size(); index++)
92  {
93  TrackingParticleRef trackingParticle(TPCollection, index);
94 
95  // Classify the tracks
96  classifier_.evaluate(trackingParticle);
97 
98  // Fill the histogram with the categories
99  for (Int_t i = 0; i != numberTrackingParticleCategories_; ++i)
100  if (
102  )
104  }
105 }
int i
Definition: DBlmapReader.cc:9
TrackClassifier const & evaluate(reco::TrackBaseRef const &)
Classify the RecoTrack in categories.
void newEvent(edm::Event const &, edm::EventSetup const &)
Pre-process event information (for accessing reconstraction information)
bool is(Category category) const
Returns track flag for a given category.
Category
Categories available to vertex.

Member Data Documentation

TrackClassifier TrackingParticleCategoriesAnalyzer::classifier_
private

Definition at line 41 of file TrackingParticleCategoriesAnalyser.cc.

Referenced by analyze().

Int_t TrackingParticleCategoriesAnalyzer::numberTrackingParticleCategories_
private
std::size_t TrackingParticleCategoriesAnalyzer::totalTrakingParticles_
private

Definition at line 39 of file TrackingParticleCategoriesAnalyser.cc.

TH1F* TrackingParticleCategoriesAnalyzer::trackingParticleCategories_
private
edm::InputTag TrackingParticleCategoriesAnalyzer::trackingTruth_
private