CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TrackingParticleCategoriesAnalyser.cc
Go to the documentation of this file.
1 /*
2  * TrackingParticleCategoriesAnalyzer.C
3  *
4  * Created by Victor Eduardo Bazterra on 06/17/08.
5  *
6  */
7 
8 #include "TH1F.h"
9 
15 
17 
19 
20 //
21 // class decleration
22 //
23 
24 class TrackingParticleCategoriesAnalyzer : public edm::one::EDAnalyzer<edm::one::SharedResources>
25 {
26 public:
27 
30 
31 private:
32 
33  virtual void analyze(const edm::Event&, const edm::EventSetup&) override;
34 
35  // Member data
36 
38 
40 
42 
44 
46 };
47 
48 
50 {
51  // Get the track collection
52  trackingTruth_ = consumes<TrackingParticleCollection>(config.getUntrackedParameter<edm::InputTag> ( "trackingTruth" ));
53 
54  // Get the file service
55  usesResource("TFileService");
57 
58  // Create a sub directory associated to the analyzer
59  TFileDirectory directory = fs->mkdir( "TrackingParticleCategoriesAnalyzer" );
60 
61  // Number of track categories
63 
64  // Define a new histograms
66  "Frequency",
67  "Frequency for the different track categories",
69  -0.5,
70  numberTrackingParticleCategories_ - 0.5
71  );
72 
73  // Set the proper categories names
74  for (Int_t i = 0; i < numberTrackingParticleCategories_; ++i)
75  trackingParticleCategories_->GetXaxis()->SetBinLabel(i+1, TrackCategories::Names[i]);
76 }
77 
78 
80 
81 
83 {
84  // Track collection
86  event.getByToken(trackingTruth_, TPCollection);
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 < TPCollection->size(); index++)
93  {
94  TrackingParticleRef trackingParticle(TPCollection, index);
95 
96  // Classify the tracks
97  classifier_.evaluate(trackingParticle);
98 
99  // Fill the histogram with the categories
100  for (Int_t i = 0; i != numberTrackingParticleCategories_; ++i)
101  if (
103  )
105  }
106 }
107 
108 
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
static const char *const Names[]
Name of the different categories.
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
TrackClassifier const & evaluate(reco::TrackBaseRef const &)
Classify the RecoTrack in categories.
virtual void analyze(const edm::Event &, const edm::EventSetup &) override
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
void newEvent(edm::Event const &, edm::EventSetup const &)
Pre-process event information (for accessing reconstraction information)
edm::EDGetTokenT< TrackingParticleCollection > trackingTruth_
bool is(Category category) const
Returns track flag for a given category.
Get track history and classify it in function of their .
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
Definition: TFileService.h:69
Category
Categories available to vertex.
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")