Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:22:10

0001 /*! \class   TTClusterBuilder
0002  *  \brief   Plugin to load the Clustering algorithm and produce the
0003  *           collection of Clusters that goes in the event content.
0004  *  \details After moving from SimDataFormats to DataFormats,
0005  *           the template structure of the class was maintained
0006  *           in order to accomodate any types other than PixelDigis
0007  *           in case there is such a need in the future.
0008  *
0009  *  \author Nicola Pozzobon
0010  *  \date   2013, Jul 12
0011  *
0012  */
0013 
0014 #ifndef L1_TRACK_TRIGGER_CLUSTER_BUILDER_H
0015 #define L1_TRACK_TRIGGER_CLUSTER_BUILDER_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 #include "FWCore/Utilities/interface/ESGetToken.h"
0025 
0026 #include "L1Trigger/TrackTrigger/interface/TTClusterAlgorithm.h"
0027 #include "L1Trigger/TrackTrigger/interface/TTClusterAlgorithmRecord.h"
0028 #include "Geometry/CommonTopologies/interface/Topology.h"
0029 #include "Geometry/CommonDetUnit/interface/PixelGeomDetUnit.h"
0030 #include "Geometry/CommonTopologies/interface/PixelTopology.h"
0031 
0032 #include "DataFormats/Common/interface/DetSetVectorNew.h"
0033 #include "DataFormats/TrackerCommon/interface/TrackerTopology.h"
0034 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
0035 #include "DataFormats/Phase2TrackerDigi/interface/Phase2TrackerDigi.h"
0036 
0037 #include <memory>
0038 #include <map>
0039 #include <vector>
0040 
0041 template <typename T>
0042 class TTClusterBuilder : 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 TTClusterBuilder(const edm::ParameterSet& iConfig);
0048   /// Destructor
0049   ~TTClusterBuilder() override;
0050 
0051 private:
0052   /// Data members
0053   edm::ESGetToken<TTClusterAlgorithm<T>, TTClusterAlgorithmRecord> theClusterFindingAlgoToken;
0054   edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> tTopoToken;
0055   edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> tGeomToken;
0056   std::vector<edm::EDGetTokenT<edm::DetSetVector<Phase2TrackerDigi> > > rawHitTokens;
0057   unsigned int ADCThreshold;
0058   bool storeLocalCoord;
0059 
0060   /// Mandatory methods
0061   void produce(edm::Event& iEvent, const edm::EventSetup& iSetup) override;
0062 
0063   /// Get hits
0064   void RetrieveRawHits(std::map<DetId, std::vector<T> >& mRawHits, const edm::Event& iEvent);
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 TTClusterBuilder<T>::TTClusterBuilder(const edm::ParameterSet& iConfig) {
0078   ADCThreshold = iConfig.getParameter<unsigned int>("ADCThreshold");
0079   storeLocalCoord = iConfig.getParameter<bool>("storeLocalCoord");
0080   theClusterFindingAlgoToken = esConsumes();
0081   tTopoToken = esConsumes<TrackerTopology, TrackerTopologyRcd>();
0082   tGeomToken = esConsumes<TrackerGeometry, TrackerDigiGeometryRecord>();
0083 
0084   std::vector<edm::InputTag> rawHitInputTags = iConfig.getParameter<std::vector<edm::InputTag> >("rawHits");
0085   for (auto it = rawHitInputTags.begin(); it != rawHitInputTags.end(); ++it) {
0086     rawHitTokens.push_back(consumes<edm::DetSetVector<Phase2TrackerDigi> >(*it));
0087   }
0088 
0089   produces<edmNew::DetSetVector<TTCluster<T> > >("ClusterInclusive");
0090 }
0091 
0092 /// Destructor
0093 template <typename T>
0094 TTClusterBuilder<T>::~TTClusterBuilder() {}
0095 
0096 /// Implement the producer
0097 template <>
0098 void TTClusterBuilder<Ref_Phase2TrackerDigi_>::produce(edm::Event& iEvent, const edm::EventSetup& iSetup);
0099 
0100 /// Retrieve hits from the event
0101 template <>
0102 void TTClusterBuilder<Ref_Phase2TrackerDigi_>::RetrieveRawHits(
0103     std::map<DetId, std::vector<Ref_Phase2TrackerDigi_> >& mRawHits, const edm::Event& iEvent);
0104 
0105 #endif