Back to home page

Project CMSSW displayed by LXR

 
 

    


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

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 "SimDataFormats/Associations/interface/TTClusterAssociationMap.h"
0028 #include "SimDataFormats/Associations/interface/TTStubAssociationMap.h"
0029 #include "DataFormats/L1TrackTrigger/interface/TTTypes.h"
0030 #include "DataFormats/Common/interface/DetSetVectorNew.h"
0031 #include "DataFormats/TrackerCommon/interface/TrackerTopology.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 "TTClusterAssociator.h"
0039 
0040 #include <memory>
0041 #include <map>
0042 #include <vector>
0043 
0044 template <typename T>
0045 class TTStubAssociator : public edm::stream::EDProducer<> {
0046   /// NOTE since pattern hit correlation must be performed within a stacked module, one must store
0047   /// Clusters in a proper way, providing easy access to them in a detector/member-wise way
0048 public:
0049   /// Constructors
0050   explicit TTStubAssociator(const edm::ParameterSet& iConfig);
0051 
0052 private:
0053   /// Data members
0054   std::vector<edm::InputTag> ttStubsInputTags_;
0055   std::vector<edm::InputTag> ttClusterTruthInputTags_;
0056 
0057   std::vector<edm::EDGetTokenT<edmNew::DetSetVector<TTStub<T> > > > ttStubsTokens_;
0058   std::vector<edm::EDGetTokenT<TTClusterAssociationMap<T> > > ttClusterTruthTokens_;
0059 
0060   edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> theTrackerGeometryToken_;
0061   edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> theTrackerTopologyToken_;
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 TTStubAssociator<T>::TTStubAssociator(const edm::ParameterSet& iConfig) {
0078   ttStubsInputTags_ = iConfig.getParameter<std::vector<edm::InputTag> >("TTStubs");
0079   ttClusterTruthInputTags_ = iConfig.getParameter<std::vector<edm::InputTag> >("TTClusterTruth");
0080 
0081   for (const auto& iTag : ttClusterTruthInputTags_) {
0082     ttClusterTruthTokens_.push_back(consumes<TTClusterAssociationMap<T> >(iTag));
0083   }
0084 
0085   for (const auto& iTag : ttStubsInputTags_) {
0086     ttStubsTokens_.push_back(consumes<edmNew::DetSetVector<TTStub<T> > >(iTag));
0087 
0088     produces<TTStubAssociationMap<T> >(iTag.instance());
0089   }
0090 
0091   theTrackerGeometryToken_ = esConsumes();
0092   theTrackerTopologyToken_ = esConsumes();
0093 
0094   /// Print some information when loaded
0095   edm::LogInfo("TTStubAssociator< ") << templateNameFinder<T>() << " > loaded.";
0096 }
0097 
0098 /// Implement the producer
0099 template <>
0100 void TTStubAssociator<Ref_Phase2TrackerDigi_>::produce(edm::Event& iEvent, const edm::EventSetup& iSetup);
0101 
0102 #endif