Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-04-28 22:23:59

0001 #ifndef __L1Trigger_VertexFinder_InputData_h__
0002 #define __L1Trigger_VertexFinder_InputData_h__
0003 
0004 #include "FWCore/Framework/interface/Event.h"
0005 #include "FWCore/Framework/interface/MakerMacros.h"
0006 #include "FWCore/Framework/interface/EventSetup.h"
0007 #include "FWCore/Utilities/interface/ESGetToken.h"
0008 #include "FWCore/Framework/interface/Frameworkfwd.h"
0009 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0010 #include "L1Trigger/VertexFinder/interface/Stub.h"
0011 #include "L1Trigger/VertexFinder/interface/TP.h"
0012 #include "L1Trigger/VertexFinder/interface/Vertex.h"
0013 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
0014 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
0015 #include "DataFormats/TrackerCommon/interface/TrackerTopology.h"
0016 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
0017 #include "Geometry/Records/interface/TrackerTopologyRcd.h"
0018 
0019 #include <vector>
0020 
0021 namespace l1tVertexFinder {
0022 
0023   typedef edm::Ptr<TrackingParticle> TrackingParticlePtr;
0024   typedef std::map<TrackingParticlePtr, edm::RefToBase<TrackingParticle>> TPPtrToRefMap;
0025 
0026   class AnalysisSettings;
0027   class Stub;
0028 
0029   //=== Unpacks stub & tracking particle (truth) data into user-friendlier format in Stub & TP classes.
0030   //=== Also makes B-field available to Settings class.
0031 
0032   class InputData {
0033   public:
0034     /// Constructor and destructor
0035     InputData();
0036     InputData(const edm::Event& iEvent,
0037               const edm::EventSetup& iSetup,
0038               const AnalysisSettings& settings,
0039               const edm::EDGetTokenT<edm::HepMCProduct> hepMCToken,
0040               const edm::EDGetTokenT<edm::View<reco::GenParticle>> genParticlesToken,
0041               const edm::EDGetTokenT<edm::View<TrackingParticle>> tpToken,
0042               const edm::EDGetTokenT<edm::ValueMap<l1tVertexFinder::TP>> tpValueMapToken,
0043               const edm::EDGetTokenT<DetSetVec> stubToken,
0044               const edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> tTopoToken,
0045               const edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> tGeomToken);
0046     ~InputData();
0047 
0048     // Sort Tracking Particles by vertex z position
0049     struct SortVertexByPt {
0050       inline bool operator()(const Vertex vertex0, const Vertex vertex1) { return (vertex0.pT() > vertex1.pT()); }
0051     };
0052 
0053     // Sort Tracking Particles by vertex z position
0054     struct SortVertexByZ0 {
0055       inline bool operator()(const Vertex vertex0, const Vertex vertex1) { return (vertex0.z0() < vertex1.z0()); }
0056     };
0057 
0058     /// Get the TrackingParticle to TP translation map
0059     const TPPtrToRefMap& getTPPtrToRefMap() const { return tpPtrToRefMap_; }
0060     /// Get primary vertex information (vertex from HepMCProduct)
0061     const Vertex& getHepMCVertex() const { return hepMCVertex_; }
0062     /// Get primary vertex information (vertex from gen particles)
0063     const Vertex& getGenVertex() const { return genVertex_; }
0064     /// Get primary vertex information (vertex from tracking particles)
0065     const Vertex& getPrimaryVertex() const { return vertex_; }
0066     /// Get pile-up vertices information
0067     const std::vector<Vertex>& getPileUpVertices() const { return vertices_; }
0068     /// Get reconstructable pile-up vertices information
0069     const std::vector<Vertex>& getRecoPileUpVertices() const { return recoVertices_; }
0070 
0071     const float genPt() const { return genPt_; }
0072     const float genPt_PU() const { return genPt_PU_; }
0073 
0074   private:
0075     Vertex hepMCVertex_;                // primary vertex from the edm::HepMCProduct
0076     Vertex genVertex_;                  // primary vertex formed from the gen particles collection
0077     Vertex vertex_;                     // primary vertex formed from the tracking particles
0078     std::vector<Vertex> vertices_;      // pile-up vertices
0079     std::vector<Vertex> recoVertices_;  // reconstructable pile-up vertices
0080     std::vector<Stub>
0081         vAllStubs_;  // all stubs, even those that would fail any tightened front-end readout electronic cuts specified in section StubCuts of Analyze_Defaults_cfi.py. (Only used to measure
0082                      // the efficiency of these cuts).
0083     TPPtrToRefMap tpPtrToRefMap_;
0084     float genPt_;
0085     float genPt_PU_;
0086   };
0087 
0088 }  // end namespace l1tVertexFinder
0089 
0090 #endif