Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 /*! \class   TTTrackAssociator
0002  *  \brief   Plugin to create the MC truth for TTTracks.
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_TRACK_ASSOCIATOR_H
0015 #define L1_TRACK_TRIGGER_TRACK_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 "DataFormats/L1TrackTrigger/interface/TTTrack.h"
0026 
0027 #include "L1Trigger/TrackTrigger/interface/classNameFinder.h"
0028 #include "SimDataFormats/EncodedEventId/interface/EncodedEventId.h"
0029 #include "SimTracker/TrackTriggerAssociation/interface/TTStubAssociationMap.h"
0030 #include "SimTracker/TrackTriggerAssociation/interface/TTTrackAssociationMap.h"
0031 #include "SimTracker/TrackTriggerAssociation/plugins/TTStubAssociator.h"
0032 #include "SimTracker/TrackTriggerAssociation/plugins/TTClusterAssociator.h"
0033 #include "DataFormats/L1TrackTrigger/interface/TTTypes.h"
0034 #include "DataFormats/Common/interface/DetSetVectorNew.h"
0035 
0036 #include <memory>
0037 #include <map>
0038 #include <vector>
0039 
0040 template <typename T>
0041 class TTTrackAssociator : public edm::stream::EDProducer<> {
0042   /// NOTE since pattern hit correlation must be performed within a stacked module, one must store
0043   /// Clusters in a proper way, providing easy access to them in a detector/member-wise way
0044 public:
0045   /// Constructors
0046   explicit TTTrackAssociator(const edm::ParameterSet& iConfig);
0047 
0048   /// Destructor
0049   ~TTTrackAssociator() override;
0050 
0051 private:
0052   /// Data members
0053   std::vector<edm::InputTag> ttTracksInputTags_;
0054 
0055   std::vector<edm::EDGetTokenT<std::vector<TTTrack<T> > > > ttTracksTokens_;
0056   edm::EDGetTokenT<TTStubAssociationMap<T> > ttStubTruthToken_;
0057   edm::EDGetTokenT<TTClusterAssociationMap<T> > ttClusterTruthToken_;
0058 
0059   bool TTTrackAllowOneFalse2SStub;
0060 
0061   /// Mandatory methods
0062   void produce(edm::Event& iEvent, const edm::EventSetup& iSetup) override;
0063 
0064 };  /// Close class
0065 
0066 /*! \brief   Implementation of methods
0067  *  \details Here, in the header file, the methods which do not depend
0068  *           on the specific type <T> that can fit the template.
0069  *           Other methods, with type-specific features, are implemented
0070  *           in the source file.
0071  */
0072 
0073 /// Constructors
0074 template <typename T>
0075 TTTrackAssociator<T>::TTTrackAssociator(const edm::ParameterSet& iConfig) {
0076   ttTracksInputTags_ = iConfig.getParameter<std::vector<edm::InputTag> >("TTTracks");
0077   ttClusterTruthToken_ = consumes<TTClusterAssociationMap<T> >(iConfig.getParameter<edm::InputTag>("TTClusterTruth"));
0078   ttStubTruthToken_ = consumes<TTStubAssociationMap<T> >(iConfig.getParameter<edm::InputTag>("TTStubTruth"));
0079   TTTrackAllowOneFalse2SStub = iConfig.getParameter<bool>("TTTrackAllowOneFalse2SStub");
0080   if (TTTrackAllowOneFalse2SStub) {
0081     edm::LogInfo("TTTrackAssociator< ") << "Allow track if no more than one 2S stub doesn't match truth.";
0082   } else {
0083     edm::LogInfo("TTTrackAssociator< ") << "All 2S stubs must match truth.";
0084   }
0085 
0086   for (const auto& iTag : ttTracksInputTags_) {
0087     ttTracksTokens_.push_back(consumes<std::vector<TTTrack<T> > >(iTag));
0088 
0089     produces<TTTrackAssociationMap<T> >(iTag.instance());
0090   }
0091   /// Print some information when loaded
0092   edm::LogInfo("TTStubAssociator< ") << "TTTrackAssociator< " << templateNameFinder<T>() << " > loaded.";
0093 }
0094 
0095 /// Destructor
0096 template <typename T>
0097 TTTrackAssociator<T>::~TTTrackAssociator() {}
0098 
0099 /// Implement the producer
0100 template <>
0101 void TTTrackAssociator<Ref_Phase2TrackerDigi_>::produce(edm::Event& iEvent, const edm::EventSetup& iSetup);
0102 
0103 #endif