Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-08-09 23:47:44

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 "SimDataFormats/Associations/interface/TTClusterAssociationMap.h"
0027 #include "SimDataFormats/TrackerDigiSimLink/interface/PixelDigiSimLink.h"
0028 #include "DataFormats/L1TrackTrigger/interface/TTTypes.h"
0029 #include "DataFormats/Common/interface/DetSetVectorNew.h"
0030 
0031 #include "L1Trigger/TrackTrigger/interface/TTStubAlgorithm.h"
0032 #include "L1Trigger/TrackTrigger/interface/TTStubAlgorithmRecord.h"
0033 
0034 #include "Geometry/CommonTopologies/interface/Topology.h"
0035 #include "Geometry/CommonDetUnit/interface/PixelGeomDetUnit.h"
0036 #include "Geometry/CommonTopologies/interface/PixelTopology.h"
0037 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
0038 
0039 #include <memory>
0040 #include <map>
0041 #include <vector>
0042 
0043 template <typename T>
0044 class TTClusterAssociator : public edm::stream::EDProducer<> {
0045   /// NOTE since pattern hit correlation must be performed within a stacked module, one must store
0046   /// Clusters in a proper way, providing easy access to them in a detector/member-wise way
0047 public:
0048   /// Constructors
0049   explicit TTClusterAssociator(const edm::ParameterSet& iConfig);
0050 
0051 private:
0052   /// Data members
0053   edm::Handle<edm::DetSetVector<PixelDigiSimLink> > thePixelDigiSimLinkHandle_;
0054   edm::Handle<std::vector<TrackingParticle> > trackingParticleHandle_;
0055 
0056   std::vector<edm::InputTag> ttClustersInputTags_;
0057 
0058   edm::EDGetTokenT<edm::DetSetVector<PixelDigiSimLink> > digisimLinkToken_;
0059   edm::EDGetTokenT<std::vector<TrackingParticle> > tpToken_;
0060   std::vector<edm::EDGetTokenT<edmNew::DetSetVector<TTCluster<T> > > > ttClustersTokens_;
0061 
0062   edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> theTrackerGeometryToken_;
0063 
0064   /// Mandatory methods
0065   void produce(edm::Event& iEvent, const edm::EventSetup& iSetup) override;
0066 
0067 };  /// Close class
0068 
0069 /*! \brief   Implementation of methods
0070  *  \details Here, in the header file, the methods which do not depend
0071  *           on the specific type <T> that can fit the template.
0072  *           Other methods, with type-specific features, are implemented
0073  *           in the source file.
0074  */
0075 
0076 /// Constructors
0077 template <typename T>
0078 TTClusterAssociator<T>::TTClusterAssociator(const edm::ParameterSet& iConfig) {
0079   digisimLinkToken_ =
0080       consumes<edm::DetSetVector<PixelDigiSimLink> >(iConfig.getParameter<edm::InputTag>("digiSimLinks"));
0081   tpToken_ = consumes<std::vector<TrackingParticle> >(iConfig.getParameter<edm::InputTag>("trackingParts"));
0082 
0083   ttClustersInputTags_ = iConfig.getParameter<std::vector<edm::InputTag> >("TTClusters");
0084 
0085   for (const auto& iTag : ttClustersInputTags_) {
0086     ttClustersTokens_.push_back(consumes<edmNew::DetSetVector<TTCluster<T> > >(iTag));
0087 
0088     produces<TTClusterAssociationMap<T> >(iTag.instance());
0089   }
0090 
0091   theTrackerGeometryToken_ = esConsumes();
0092 
0093   /// Print some information when loaded
0094   edm::LogInfo("TTClusterAssociator< ") << templateNameFinder<T>() << " > loaded.";
0095 }
0096 
0097 /// Implement the producer
0098 template <>
0099 void TTClusterAssociator<Ref_Phase2TrackerDigi_>::produce(edm::Event& iEvent, const edm::EventSetup& iSetup);
0100 
0101 #endif