Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-10-25 10:05:13

0001 /*! \class   TTStubAssociator
0002  *  \brief   Plugin to create the MC truth for TTStubs.
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_STUB_ASSOCIATOR_H
0015 #define L1_TRACK_TRIGGER_STUB_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/MakerMacros.h"
0022 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0023 
0024 #include "DataFormats/L1TrackTrigger/interface/TTStub.h"
0025 
0026 #include "L1Trigger/TrackTrigger/interface/classNameFinder.h"
0027 #include "SimTracker/TrackTriggerAssociation/interface/TTClusterAssociationMap.h"
0028 #include "SimTracker/TrackTriggerAssociation/interface/TTStubAssociationMap.h"
0029 #include "SimTracker/TrackTriggerAssociation/plugins/TTClusterAssociator.h"
0030 #include "DataFormats/L1TrackTrigger/interface/TTTypes.h"
0031 #include "DataFormats/Common/interface/DetSetVectorNew.h"
0032 #include "DataFormats/TrackerCommon/interface/TrackerTopology.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 TTStubAssociator : 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 TTStubAssociator(const edm::ParameterSet& iConfig);
0050 
0051   /// Destructor
0052   ~TTStubAssociator() override;
0053 
0054 private:
0055   /// Data members
0056   std::vector<edm::InputTag> ttStubsInputTags_;
0057   std::vector<edm::InputTag> ttClusterTruthInputTags_;
0058 
0059   std::vector<edm::EDGetTokenT<edmNew::DetSetVector<TTStub<T> > > > ttStubsTokens_;
0060   std::vector<edm::EDGetTokenT<TTClusterAssociationMap<T> > > ttClusterTruthTokens_;
0061 
0062   edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> theTrackerGeometryToken_;
0063   edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> theTrackerTopologyToken_;
0064 
0065   /// Mandatory methods
0066   void beginRun(const edm::Run& run, const edm::EventSetup& iSetup) override;
0067   void endRun(const edm::Run& run, const edm::EventSetup& iSetup) override;
0068   void produce(edm::Event& iEvent, const edm::EventSetup& iSetup) override;
0069 
0070 };  /// Close class
0071 
0072 /*! \brief   Implementation of methods
0073  *  \details Here, in the header file, the methods which do not depend
0074  *           on the specific type <T> that can fit the template.
0075  *           Other methods, with type-specific features, are implemented
0076  *           in the source file.
0077  */
0078 
0079 /// Constructors
0080 template <typename T>
0081 TTStubAssociator<T>::TTStubAssociator(const edm::ParameterSet& iConfig) {
0082   ttStubsInputTags_ = iConfig.getParameter<std::vector<edm::InputTag> >("TTStubs");
0083   ttClusterTruthInputTags_ = iConfig.getParameter<std::vector<edm::InputTag> >("TTClusterTruth");
0084 
0085   for (const auto& iTag : ttClusterTruthInputTags_) {
0086     ttClusterTruthTokens_.push_back(consumes<TTClusterAssociationMap<T> >(iTag));
0087   }
0088 
0089   for (const auto& iTag : ttStubsInputTags_) {
0090     ttStubsTokens_.push_back(consumes<edmNew::DetSetVector<TTStub<T> > >(iTag));
0091 
0092     produces<TTStubAssociationMap<T> >(iTag.instance());
0093   }
0094 
0095   theTrackerGeometryToken_ = esConsumes();
0096   theTrackerTopologyToken_ = esConsumes();
0097 }
0098 
0099 /// Destructor
0100 template <typename T>
0101 TTStubAssociator<T>::~TTStubAssociator() {}
0102 
0103 /// Begin run
0104 template <typename T>
0105 void TTStubAssociator<T>::beginRun(const edm::Run& run, const edm::EventSetup& iSetup) {
0106   /// Print some information when loaded
0107   edm::LogInfo("TTStubAssociator< ") << templateNameFinder<T>() << " > loaded.";
0108 }
0109 
0110 /// End run
0111 template <typename T>
0112 void TTStubAssociator<T>::endRun(const edm::Run& run, const edm::EventSetup& iSetup) {}
0113 
0114 /// Implement the producer
0115 template <>
0116 void TTStubAssociator<Ref_Phase2TrackerDigi_>::produce(edm::Event& iEvent, const edm::EventSetup& iSetup);
0117 
0118 #endif