Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:31:01

0001 /*! \class   TTStubAlgorithm_cbc3
0002  *  \brief   Class for "cbc3" algorithm to be used
0003  *           in TTStubBuilder
0004  *  \details HW emulation.
0005  *
0006  *  \author Ivan Reid
0007  *  \date   2013, Oct 16
0008  *
0009  */
0010 
0011 #ifndef L1_TRACK_TRIGGER_STUB_ALGO_CBC3_H
0012 #define L1_TRACK_TRIGGER_STUB_ALGO_CBC3_H
0013 
0014 #include "FWCore/Framework/interface/EventSetup.h"
0015 #include "FWCore/Framework/interface/ModuleFactory.h"
0016 #include "FWCore/Framework/interface/ESProducer.h"
0017 
0018 #include "L1Trigger/TrackTrigger/interface/TTStubAlgorithm.h"
0019 #include "L1Trigger/TrackTrigger/interface/TTStubAlgorithmRecord.h"
0020 
0021 #include "DataFormats/GeometryCommonDetAlgo/interface/MeasurementPoint.h"
0022 #include "Geometry/CommonTopologies/interface/Topology.h"
0023 
0024 #include <memory>
0025 #include <string>
0026 #include <map>
0027 #include <typeinfo>
0028 
0029 template <typename T>
0030 class TTStubAlgorithm_cbc3 : public TTStubAlgorithm<T> {
0031 private:
0032   /// Data members
0033   bool mPerformZMatching2S;
0034   std::string className_;
0035 
0036 public:
0037   /// Constructor
0038   TTStubAlgorithm_cbc3(const TrackerGeometry *const theTrackerGeom,
0039                        const TrackerTopology *const theTrackerTopo,
0040                        bool aPerformZMatching2S)
0041       : TTStubAlgorithm<T>(theTrackerGeom, theTrackerTopo, __func__) {
0042     mPerformZMatching2S = aPerformZMatching2S;
0043   }
0044 
0045   /// Destructor
0046   ~TTStubAlgorithm_cbc3() override {}
0047 
0048   /// Matching operations
0049   void PatternHitCorrelation(bool &aConfirmation,
0050                              int &aDisplacement,
0051                              int &anOffset,
0052                              float &anHardBend,
0053                              const TTStub<T> &aTTStub) const override;
0054 
0055 };  /// Close class
0056 
0057 /*! \brief   Implementation of methods
0058  *  \details Here, in the header file, the methods which do not depend
0059  *           on the specific type <T> that can fit the template.
0060  *           Other methods, with type-specific features, are implemented
0061  *           in the source file.
0062  */
0063 
0064 /// Matching operations
0065 template <>
0066 void TTStubAlgorithm_cbc3<Ref_Phase2TrackerDigi_>::PatternHitCorrelation(
0067     bool &aConfirmation,
0068     int &aDisplacement,
0069     int &anOffset,
0070     float &anHardBend,
0071     const TTStub<Ref_Phase2TrackerDigi_> &aTTStub) const;
0072 
0073 /*! \class   ES_TTStubAlgorithm_cbc3
0074  *  \brief   Class to declare the algorithm to the framework
0075  *
0076  *  \author Nicola Pozzobon
0077  *  \date   2013, Jul 18
0078  *
0079  */
0080 
0081 template <typename T>
0082 class ES_TTStubAlgorithm_cbc3 : public edm::ESProducer {
0083 private:
0084   /// Data members
0085   edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> mGeomToken;
0086   edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> mTopoToken;
0087 
0088   /// Z-matching
0089   bool mPerformZMatching2S;
0090 
0091 public:
0092   /// Constructor
0093   ES_TTStubAlgorithm_cbc3(const edm::ParameterSet &p) {
0094     mPerformZMatching2S = p.getParameter<bool>("zMatching2S");
0095     auto cc = setWhatProduced(this);
0096     mGeomToken = cc.consumes();
0097     mTopoToken = cc.consumes();
0098   }
0099 
0100   /// Destructor
0101   ~ES_TTStubAlgorithm_cbc3() override {}
0102 
0103   /// Implement the producer
0104   std::unique_ptr<TTStubAlgorithm<T> > produce(const TTStubAlgorithmRecord &record) {
0105     return std::make_unique<TTStubAlgorithm_cbc3<T> >(
0106         &record.get(mGeomToken), &record.get(mTopoToken), mPerformZMatching2S);
0107   }
0108 };
0109 
0110 #endif