Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:31:07

0001 /*! \class   TTClusterAssociator
0002  *  \brief   Plugin to create the MC truth for TTClusters.
0003  *  \details After moving from SimDataFormats to DataFormats,
0004  *           the template structure of the class was maintained
0005  *           in order to accomodate any types other than PixelDigis
0006  *           in case there is such a need in the future.
0007  *
0008  *  \author Nicola Pozzobon
0009  *  \date   2013, Jul 19
0010  *  (tidy up: Ian Tomalin, 2020)
0011  *
0012  */
0013 
0014 #ifndef L1_TRACK_TRIGGER_CLUSTER_ASSOCIATOR_H
0015 #define L1_TRACK_TRIGGER_CLUSTER_ASSOCIATOR_H
0016 
0017 #include "FWCore/Framework/interface/Frameworkfwd.h"
0018 #include "FWCore/Framework/interface/stream/EDProducer.h"
0019 #include "FWCore/Framework/interface/Event.h"
0020 #include "FWCore/Framework/interface/EventSetup.h"
0021 #include "FWCore/Framework/interface/ESHandle.h"
0022 #include "FWCore/Framework/interface/MakerMacros.h"
0023 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0024 
0025 #include "L1Trigger/TrackTrigger/interface/classNameFinder.h"
0026 #include "SimTracker/TrackTriggerAssociation/interface/TTClusterAssociationMap.h"
0027 #include "DataFormats/L1TrackTrigger/interface/TTTypes.h"
0028 #include "DataFormats/Common/interface/DetSetVectorNew.h"
0029 
0030 #include "L1Trigger/TrackTrigger/interface/TTStubAlgorithm.h"
0031 #include "L1Trigger/TrackTrigger/interface/TTStubAlgorithmRecord.h"
0032 
0033 #include "Geometry/CommonTopologies/interface/Topology.h"
0034 #include "Geometry/CommonDetUnit/interface/PixelGeomDetUnit.h"
0035 #include "Geometry/CommonTopologies/interface/PixelTopology.h"
0036 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
0037 
0038 #include <memory>
0039 #include <map>
0040 #include <vector>
0041 
0042 template <typename T>
0043 class TTClusterAssociator : public edm::stream::EDProducer<> {
0044   /// NOTE since pattern hit correlation must be performed within a stacked module, one must store
0045   /// Clusters in a proper way, providing easy access to them in a detector/member-wise way
0046 public:
0047   /// Constructors
0048   explicit TTClusterAssociator(const edm::ParameterSet& iConfig);
0049 
0050 private:
0051   /// Data members
0052   edm::Handle<edm::DetSetVector<PixelDigiSimLink> > thePixelDigiSimLinkHandle_;
0053   edm::Handle<std::vector<TrackingParticle> > trackingParticleHandle_;
0054 
0055   std::vector<edm::InputTag> ttClustersInputTags_;
0056 
0057   edm::EDGetTokenT<edm::DetSetVector<PixelDigiSimLink> > digisimLinkToken_;
0058   edm::EDGetTokenT<std::vector<TrackingParticle> > tpToken_;
0059   std::vector<edm::EDGetTokenT<edmNew::DetSetVector<TTCluster<T> > > > ttClustersTokens_;
0060 
0061   edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> theTrackerGeometryToken_;
0062 
0063   /// Mandatory methods
0064   void produce(edm::Event& iEvent, const edm::EventSetup& iSetup) override;
0065 
0066 };  /// Close class
0067 
0068 /*! \brief   Implementation of methods
0069  *  \details Here, in the header file, the methods which do not depend
0070  *           on the specific type <T> that can fit the template.
0071  *           Other methods, with type-specific features, are implemented
0072  *           in the source file.
0073  */
0074 
0075 /// Constructors
0076 template <typename T>
0077 TTClusterAssociator<T>::TTClusterAssociator(const edm::ParameterSet& iConfig) {
0078   digisimLinkToken_ =
0079       consumes<edm::DetSetVector<PixelDigiSimLink> >(iConfig.getParameter<edm::InputTag>("digiSimLinks"));
0080   tpToken_ = consumes<std::vector<TrackingParticle> >(iConfig.getParameter<edm::InputTag>("trackingParts"));
0081 
0082   ttClustersInputTags_ = iConfig.getParameter<std::vector<edm::InputTag> >("TTClusters");
0083 
0084   for (const auto& iTag : ttClustersInputTags_) {
0085     ttClustersTokens_.push_back(consumes<edmNew::DetSetVector<TTCluster<T> > >(iTag));
0086 
0087     produces<TTClusterAssociationMap<T> >(iTag.instance());
0088   }
0089 
0090   theTrackerGeometryToken_ = esConsumes();
0091 
0092   /// Print some information when loaded
0093   edm::LogInfo("TTClusterAssociator< ") << templateNameFinder<T>() << " > loaded.";
0094 }
0095 
0096 /// Implement the producer
0097 template <>
0098 void TTClusterAssociator<Ref_Phase2TrackerDigi_>::produce(edm::Event& iEvent, const edm::EventSetup& iSetup);
0099 
0100 #endif