CMS 3D CMS Logo

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

Public Member Functions

 TrackCategoriesAnalyzer (const edm::ParameterSet &)
 
 ~TrackCategoriesAnalyzer () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer< edm::one::SharedResources >
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () 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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (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::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

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

Private Attributes

TrackClassifier classifier_
 
Int_t numberTrackCategories_
 
std::size_t totalTracks_
 
TH1F * trackCategories_
 
edm::EDGetTokenT< edm::View< reco::Track > > trackProducer_
 

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
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 24 of file TrackCategoriesAnalyzer.cc.

Constructor & Destructor Documentation

◆ TrackCategoriesAnalyzer()

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

Definition at line 45 of file TrackCategoriesAnalyzer.cc.

References createBeamHaloJobs::directory, compareTotals::fs, mps_fire::i, TrackCategories::Names, numberTrackCategories_, trackCategories_, trackProducer_, and TrackCategories::Unknown.

47  // Get the track collection
48  trackProducer_ = consumes<edm::View<reco::Track>>(config.getUntrackedParameter<edm::InputTag>("trackProducer"));
49 
50  // Get the file service
51  usesResource("TFileService");
53 
54  // Create a sub directory associated to the analyzer
55  TFileDirectory directory = fs->mkdir("TrackCategoriesAnalyzer");
56 
57  // Number of track categories
59 
60  // Define a new histograms
61  trackCategories_ = 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 < numberTrackCategories_; ++i)
69  trackCategories_->GetXaxis()->SetBinLabel(i + 1, TrackCategories::Names[i]);
70 }
static const char *const Names[]
Name of the different categories.
Definition: config.py:1
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
edm::EDGetTokenT< edm::View< reco::Track > > trackProducer_

◆ ~TrackCategoriesAnalyzer()

TrackCategoriesAnalyzer::~TrackCategoriesAnalyzer ( )
override

Definition at line 72 of file TrackCategoriesAnalyzer.cc.

72 {}

Member Function Documentation

◆ analyze()

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

Implements edm::one::EDAnalyzerBase.

Definition at line 74 of file TrackCategoriesAnalyzer.cc.

References classifier_, TrackClassifier::evaluate(), mps_fire::i, TrackCategories::is(), TrackClassifier::newEvent(), numberTrackCategories_, singleTopDQM_cfi::setup, HLT_2024v13_cff::track, trackCategories_, JetHT_cfg::trackCollection, and trackProducer_.

74  {
75  // Track collection
77  event.getByToken(trackProducer_, trackCollection);
78 
79  // Set the classifier for a new event
81 
82  // Loop over the track collection.
83  for (std::size_t index = 0; index < trackCollection->size(); index++) {
85 
86  // Classify the tracks
88 
89  // Fill the histogram with the categories
90  for (Int_t i = 0; i != numberTrackCategories_; ++i)
92  trackCategories_->Fill(i);
93  }
94 }
bool is(Category category) const
Returns track flag for a given category.
void newEvent(edm::Event const &, edm::EventSetup const &)
Pre-process event information (for accessing reconstraction information)
trackCollection
Definition: JetHT_cfg.py:51
TrackClassifier const & evaluate(reco::TrackBaseRef const &)
Classify the RecoTrack in categories.
edm::EDGetTokenT< edm::View< reco::Track > > trackProducer_
Category
Categories available to vertex.
Definition: event.py:1

Member Data Documentation

◆ classifier_

TrackClassifier TrackCategoriesAnalyzer::classifier_
private

Definition at line 38 of file TrackCategoriesAnalyzer.cc.

Referenced by analyze().

◆ numberTrackCategories_

Int_t TrackCategoriesAnalyzer::numberTrackCategories_
private

Definition at line 42 of file TrackCategoriesAnalyzer.cc.

Referenced by analyze(), and TrackCategoriesAnalyzer().

◆ totalTracks_

std::size_t TrackCategoriesAnalyzer::totalTracks_
private

Definition at line 36 of file TrackCategoriesAnalyzer.cc.

◆ trackCategories_

TH1F* TrackCategoriesAnalyzer::trackCategories_
private

Definition at line 40 of file TrackCategoriesAnalyzer.cc.

Referenced by analyze(), and TrackCategoriesAnalyzer().

◆ trackProducer_

edm::EDGetTokenT<edm::View<reco::Track> > TrackCategoriesAnalyzer::trackProducer_
private

Definition at line 34 of file TrackCategoriesAnalyzer.cc.

Referenced by analyze(), and TrackCategoriesAnalyzer().