Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-11-19 00:05:20

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   /// Destructor
0051   ~TTClusterAssociator() override;
0052 
0053 private:
0054   /// Data members
0055   edm::Handle<edm::DetSetVector<PixelDigiSimLink> > thePixelDigiSimLinkHandle_;
0056   edm::Handle<std::vector<TrackingParticle> > trackingParticleHandle_;
0057 
0058   std::vector<edm::InputTag> ttClustersInputTags_;
0059 
0060   edm::EDGetTokenT<edm::DetSetVector<PixelDigiSimLink> > digisimLinkToken_;
0061   edm::EDGetTokenT<std::vector<TrackingParticle> > tpToken_;
0062   std::vector<edm::EDGetTokenT<edmNew::DetSetVector<TTCluster<T> > > > ttClustersTokens_;
0063 
0064   edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> theTrackerGeometryToken_;
0065 
0066   /// Mandatory methods
0067   void beginRun(const edm::Run& run, const edm::EventSetup& iSetup) override;
0068   void endRun(const edm::Run& run, const edm::EventSetup& iSetup) override;
0069   void produce(edm::Event& iEvent, const edm::EventSetup& iSetup) override;
0070 
0071 };  /// Close class
0072 
0073 /*! \brief   Implementation of methods
0074  *  \details Here, in the header file, the methods which do not depend
0075  *           on the specific type <T> that can fit the template.
0076  *           Other methods, with type-specific features, are implemented
0077  *           in the source file.
0078  */
0079 
0080 /// Constructors
0081 template <typename T>
0082 TTClusterAssociator<T>::TTClusterAssociator(const edm::ParameterSet& iConfig) {
0083   digisimLinkToken_ =
0084       consumes<edm::DetSetVector<PixelDigiSimLink> >(iConfig.getParameter<edm::InputTag>("digiSimLinks"));
0085   tpToken_ = consumes<std::vector<TrackingParticle> >(iConfig.getParameter<edm::InputTag>("trackingParts"));
0086 
0087   ttClustersInputTags_ = iConfig.getParameter<std::vector<edm::InputTag> >("TTClusters");
0088 
0089   for (const auto& iTag : ttClustersInputTags_) {
0090     ttClustersTokens_.push_back(consumes<edmNew::DetSetVector<TTCluster<T> > >(iTag));
0091 
0092     produces<TTClusterAssociationMap<T> >(iTag.instance());
0093   }
0094 
0095   theTrackerGeometryToken_ = esConsumes();
0096 }
0097 
0098 /// Destructor
0099 template <typename T>
0100 TTClusterAssociator<T>::~TTClusterAssociator() {}
0101 
0102 /// Begin run
0103 template <typename T>
0104 void TTClusterAssociator<T>::beginRun(const edm::Run& run, const edm::EventSetup& iSetup) {
0105   /// Print some information when loaded
0106   edm::LogInfo("TTClusterAssociator< ") << templateNameFinder<T>() << " > loaded.";
0107 }
0108 
0109 /// End run
0110 template <typename T>
0111 void TTClusterAssociator<T>::endRun(const edm::Run& run, const edm::EventSetup& iSetup) {}
0112 
0113 /// Implement the producer
0114 template <>
0115 void TTClusterAssociator<Ref_Phase2TrackerDigi_>::produce(edm::Event& iEvent, const edm::EventSetup& iSetup);
0116 
0117 #endif