Back to home page

Project CMSSW displayed by LXR

 
 

    


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

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