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
 
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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
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)
 
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 TrackCategoriesAnalyzer.cc.

Constructor & Destructor Documentation

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

Definition at line 49 of file TrackCategoriesAnalyzer.cc.

References createBeamHaloJobs::directory, edm::ParameterSet::getUntrackedParameter(), mps_fire::i, TFileService::make(), TFileService::mkdir(), TrackCategories::Names, numberTrackCategories_, trackCategories_, trackProducer_, and TrackCategories::Unknown.

49  : classifier_(config,consumesCollector())
50 {
51  // Get the track collection
52  trackProducer_ = consumes<edm::View<reco::Track>>(config.getUntrackedParameter<edm::InputTag> ( "trackProducer" ));
53 
54  // Get the file service
55  usesResource("TFileService");
57 
58  // Create a sub directory associated to the analyzer
59  TFileDirectory directory = fs->mkdir( "TrackCategoriesAnalyzer" );
60 
61  // Number of track categories
63 
64  // Define a new histograms
65  trackCategories_ = fs->make<TH1F>(
66  "Frequency",
67  "Frequency for the different track categories",
69  -0.5,
70  numberTrackCategories_ - 0.5
71  );
72 
73  // Set the proper categories names
74  for (Int_t i = 0; i < numberTrackCategories_; ++i)
75  trackCategories_->GetXaxis()->SetBinLabel(i+1, TrackCategories::Names[i]);
76 }
T getUntrackedParameter(std::string const &, T const &) const
static const char *const Names[]
Name of the different categories.
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
Definition: TFileService.h:69
edm::EDGetTokenT< edm::View< reco::Track > > trackProducer_
TrackCategoriesAnalyzer::~TrackCategoriesAnalyzer ( )
override

Definition at line 79 of file TrackCategoriesAnalyzer.cc.

79 { }

Member Function Documentation

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

Definition at line 82 of file TrackCategoriesAnalyzer.cc.

References classifier_, DEFINE_FWK_MODULE, TrackClassifier::evaluate(), mps_fire::i, TrackCategories::is(), TrackClassifier::newEvent(), numberTrackCategories_, HiIsolationCommonParameters_cff::track, trackCategories_, findElectronsInSiStrips_cfi::trackCollection, and trackProducer_.

83 {
84  // Track collection
86  event.getByToken(trackProducer_, trackCollection);
87 
88  // Set the classifier for a new event
89  classifier_.newEvent(event, setup);
90 
91  // Loop over the track collection.
92  for (std::size_t index = 0; index < trackCollection->size(); index++)
93  {
94  edm::RefToBase<reco::Track> track(trackCollection, index);
95 
96  // Classify the tracks
98 
99  // Fill the histogram with the categories
100  for (Int_t i = 0; i != numberTrackCategories_; ++i)
101  if (
103  )
104  trackCategories_->Fill(i);
105  }
106 }
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.
edm::EDGetTokenT< edm::View< reco::Track > > trackProducer_
Category
Categories available to vertex.

Member Data Documentation

TrackClassifier TrackCategoriesAnalyzer::classifier_
private

Definition at line 41 of file TrackCategoriesAnalyzer.cc.

Referenced by analyze().

Int_t TrackCategoriesAnalyzer::numberTrackCategories_
private

Definition at line 45 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 43 of file TrackCategoriesAnalyzer.cc.

Referenced by analyze(), and TrackCategoriesAnalyzer().

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

Definition at line 37 of file TrackCategoriesAnalyzer.cc.

Referenced by analyze(), and TrackCategoriesAnalyzer().