CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
TrackingParticleCategoriesAnalyzer Class Reference
Inheritance diagram for TrackingParticleCategoriesAnalyzer:
edm::one::EDAnalyzer< edm::one::SharedResources > edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 TrackingParticleCategoriesAnalyzer (const edm::ParameterSet &)
 
 ~TrackingParticleCategoriesAnalyzer () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer< edm::one::SharedResources >
 EDAnalyzer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDAnalyzerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

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

Private Attributes

TrackClassifier classifier_
 
Int_t numberTrackingParticleCategories_
 
std::size_t totalTrakingParticles_
 
TH1F * trackingParticleCategories_
 
edm::EDGetTokenT< TrackingParticleCollectiontrackingTruth_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 24 of file TrackingParticleCategoriesAnalyser.cc.

Constructor & Destructor Documentation

◆ TrackingParticleCategoriesAnalyzer()

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

Definition at line 45 of file TrackingParticleCategoriesAnalyser.cc.

47  // Get the track collection
48  trackingTruth_ = consumes<TrackingParticleCollection>(config.getUntrackedParameter<edm::InputTag>("trackingTruth"));
49 
50  // Get the file service
51  usesResource("TFileService");
53 
54  // Create a sub directory associated to the analyzer
55  TFileDirectory directory = fs->mkdir("TrackingParticleCategoriesAnalyzer");
56 
57  // Number of track categories
59 
60  // Define a new histograms
61  trackingParticleCategories_ = fs->make<TH1F>("Frequency",
62  "Frequency for the different track categories",
64  -0.5,
66 
67  // Set the proper categories names
68  for (Int_t i = 0; i < numberTrackingParticleCategories_; ++i)
69  trackingParticleCategories_->GetXaxis()->SetBinLabel(i + 1, TrackCategories::Names[i]);
70 }

References createBeamHaloJobs::directory, mps_fire::i, TFileService::make(), TFileService::mkdir(), TrackCategories::Names, numberTrackingParticleCategories_, trackingParticleCategories_, trackingTruth_, and TrackCategories::Unknown.

◆ ~TrackingParticleCategoriesAnalyzer()

TrackingParticleCategoriesAnalyzer::~TrackingParticleCategoriesAnalyzer ( )
override

Definition at line 72 of file TrackingParticleCategoriesAnalyser.cc.

72 {}

Member Function Documentation

◆ analyze()

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

Implements edm::one::EDAnalyzerBase.

Definition at line 74 of file TrackingParticleCategoriesAnalyser.cc.

74  {
75  // Track collection
77  event.getByToken(trackingTruth_, TPCollection);
78 
79  // Set the classifier for a new event
81 
82  // Loop over the track collection.
83  for (std::size_t index = 0; index < TPCollection->size(); index++) {
84  TrackingParticleRef trackingParticle(TPCollection, index);
85 
86  // Classify the tracks
87  classifier_.evaluate(trackingParticle);
88 
89  // Fill the histogram with the categories
90  for (Int_t i = 0; i != numberTrackingParticleCategories_; ++i)
93  }
94 }

References classifier_, TrackClassifier::evaluate(), mps_fire::i, TrackCategories::is(), TrackClassifier::newEvent(), numberTrackingParticleCategories_, singleTopDQM_cfi::setup, trackingParticleCategories_, and trackingTruth_.

Member Data Documentation

◆ classifier_

TrackClassifier TrackingParticleCategoriesAnalyzer::classifier_
private

Definition at line 38 of file TrackingParticleCategoriesAnalyser.cc.

Referenced by analyze().

◆ numberTrackingParticleCategories_

Int_t TrackingParticleCategoriesAnalyzer::numberTrackingParticleCategories_
private

◆ totalTrakingParticles_

std::size_t TrackingParticleCategoriesAnalyzer::totalTrakingParticles_
private

Definition at line 36 of file TrackingParticleCategoriesAnalyser.cc.

◆ trackingParticleCategories_

TH1F* TrackingParticleCategoriesAnalyzer::trackingParticleCategories_
private

◆ trackingTruth_

edm::EDGetTokenT<TrackingParticleCollection> TrackingParticleCategoriesAnalyzer::trackingTruth_
private
mps_fire.i
i
Definition: mps_fire.py:355
TrackCategories::Unknown
Definition: TrackCategories.h:63
edm::EDConsumerBase::consumesCollector
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
Definition: EDConsumerBase.cc:71
TFileDirectory
Definition: TFileDirectory.h:24
edm::Handle< TrackingParticleCollection >
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
edm::Ref< TrackingParticleCollection >
config
Definition: config.py:1
TrackClassifier::evaluate
const TrackClassifier & evaluate(reco::TrackBaseRef const &)
Classify the RecoTrack in categories.
Definition: TrackClassifier.cc:75
TrackingParticleCategoriesAnalyzer::trackingParticleCategories_
TH1F * trackingParticleCategories_
Definition: TrackingParticleCategoriesAnalyser.cc:40
TFileService::mkdir
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
Definition: TFileService.h:69
TrackingParticleCategoriesAnalyzer::classifier_
TrackClassifier classifier_
Definition: TrackingParticleCategoriesAnalyser.cc:38
TrackCategories::Names
static const char *const Names[]
Name of the different categories.
Definition: TrackCategories.h:67
TrackClassifier::newEvent
void newEvent(edm::Event const &, edm::EventSetup const &)
Pre-process event information (for accessing reconstraction information)
Definition: TrackClassifier.cc:44
TrackCategories::is
bool is(Category category) const
Returns track flag for a given category.
Definition: TrackCategories.h:76
edm::Service< TFileService >
createBeamHaloJobs.directory
string directory
Definition: createBeamHaloJobs.py:211
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
event
Definition: event.py:1
TrackingParticleCategoriesAnalyzer::trackingTruth_
edm::EDGetTokenT< TrackingParticleCollection > trackingTruth_
Definition: TrackingParticleCategoriesAnalyser.cc:34
TrackingParticleCategoriesAnalyzer::numberTrackingParticleCategories_
Int_t numberTrackingParticleCategories_
Definition: TrackingParticleCategoriesAnalyser.cc:42
edm::InputTag
Definition: InputTag.h:15
TrackCategories::Category
Category
Categories available to vertex.
Definition: TrackCategories.h:11
TFileService::make
T * make(const Args &... args) const
make new ROOT object
Definition: TFileService.h:64