Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:22:12

0001 #ifndef __L1Trigger_VertexFinder_TP_h__
0002 #define __L1Trigger_VertexFinder_TP_h__
0003 
0004 #include "FWCore/Utilities/interface/Exception.h"
0005 #include "L1Trigger/VertexFinder/interface/AnalysisSettings.h"
0006 #include "L1Trigger/VertexFinder/interface/Stub.h"
0007 #include "SimDataFormats/TrackingAnalysis/interface/TrackingParticle.h"
0008 
0009 namespace l1tVertexFinder {
0010 
0011   class AnalysisSettings;
0012   class Stub;
0013 
0014   typedef edm::Ptr<TrackingParticle> TrackingParticlePtr;
0015 
0016   class TP {
0017   public:
0018     // Fill useful info about tracking particle.
0019     TP();
0020     TP(const TrackingParticlePtr& tpPtr, const AnalysisSettings& settings);
0021     ~TP() {}
0022 
0023     // Need the operator== to compare 2 TP types.
0024     bool operator==(const TP& rhs) const {
0025       return (trackingParticle_ == rhs.trackingParticle_ && settings_ == rhs.settings_ && inTimeBx_ == rhs.inTimeBx_ &&
0026               physicsCollision_ == rhs.physicsCollision_ && use_ == rhs.use_ && useForEff_ == rhs.useForEff_ &&
0027               useForAlgEff_ == rhs.useForAlgEff_ && useForVertexReco_ == rhs.useForVertexReco_ &&
0028               nLayersWithStubs_ == rhs.nLayersWithStubs_ && assocStubs_ == rhs.assocStubs_);
0029     }
0030 
0031     // Fill truth info with association from tracking particle to stubs.
0032     void setMatchingStubs(const std::vector<Stub>& vMatchingStubs);
0033 
0034     // == Functions for returning info about tracking particles ===
0035 
0036     // Count number of tracker layers a given list of stubs are in.
0037     // By default, considers both PS+2S modules, but optionally considers only the PS ones if onlyPS = true.
0038     unsigned int countLayers(bool onlyPS = false);
0039     // Return a C++ pointer to the tracking particle
0040     const TrackingParticlePtr getTrackingParticle() const { return trackingParticle_; }
0041     // Did it come from the main physics collision or from pileup?
0042     bool physicsCollision() const { return physicsCollision_; }
0043     // Functions returning stubs produced by tracking particle.
0044     unsigned int numAssocStubs() const { return assocStubs_.size(); }
0045     // Overload operator-> to return a C++ pointer to the underlying TrackingParticle
0046     const TrackingParticlePtr operator->() const { return trackingParticle_; }
0047     // TP is worth keeping (e.g. for fake rate measurement)
0048     bool use() const { return use_; }
0049     // TP can be used to measure the L1 tracking efficiency
0050     bool useForEff() const { return useForEff_; }
0051     // TP can be used for algorithmic efficiency measurement (also requires stubs in enough layers).
0052     bool useForAlgEff() const { return useForAlgEff_; }
0053     // TP can be used for vertex reconstruction measuremetn
0054     bool useForVertexReco() const { return useForVertexReco_; }
0055 
0056   private:
0057     void fillUse();           // Fill the use_ flag.
0058     void fillUseForEff();     // Fill the useForEff_ flag.
0059     void fillUseForAlgEff();  // Fill the useforAlgEff_ flag.
0060     void fillUseForVertexReco();
0061 
0062   private:
0063     TrackingParticlePtr trackingParticle_;  // Underlying TrackingParticle pointer
0064     const AnalysisSettings* settings_;      // Configuration parameters
0065 
0066     bool inTimeBx_;          // TP came from in-time bunch crossing.
0067     bool physicsCollision_;  // True if TP from physics collision rather than pileup.
0068     bool use_;               // TP is worth keeping (e.g. for fake rate measurement)
0069     bool useForEff_;         // TP can be used for tracking efficiency measurement.
0070     bool useForAlgEff_;      // TP can be used for tracking algorithmic efficiency measurement.
0071     bool useForVertexReco_;
0072 
0073     std::vector<Stub> assocStubs_;
0074     unsigned int nLayersWithStubs_;  // Number of tracker layers with stubs from this TP.
0075   };
0076 
0077 }  // end namespace l1tVertexFinder
0078 
0079 #endif