Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 11:12:51

0001 #ifndef L1T_OmtfP1_OMTFProcessor_H
0002 #define L1T_OmtfP1_OMTFProcessor_H
0003 
0004 #include "L1Trigger/L1TMuonOverlapPhase1/interface/Omtf/AlgoMuon.h"
0005 #include "L1Trigger/L1TMuonOverlapPhase1/interface/Omtf/GoldenPattern.h"
0006 #include "L1Trigger/L1TMuonOverlapPhase1/interface/Omtf/GoldenPatternResult.h"
0007 #include "L1Trigger/L1TMuonOverlapPhase1/interface/Omtf/IGhostBuster.h"
0008 #include "L1Trigger/L1TMuonOverlapPhase1/interface/Omtf/IProcessorEmulator.h"
0009 #include "L1Trigger/L1TMuonOverlapPhase1/interface/Omtf/OMTFConfiguration.h"
0010 #include "L1Trigger/L1TMuonOverlapPhase1/interface/Omtf/OMTFinputMaker.h"
0011 #include "L1Trigger/L1TMuonOverlapPhase1/interface/Omtf/ProcessorBase.h"
0012 #include "L1Trigger/L1TMuonOverlapPhase1/interface/Omtf/SorterBase.h"
0013 
0014 #include "L1Trigger/L1TMuonOverlapPhase1/interface/Omtf/PtAssignmentBase.h"
0015 
0016 #include <memory>
0017 
0018 #include "FWCore/Framework/interface/Event.h"
0019 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0020 
0021 #include "DataFormats/L1TMuon/interface/RegionalMuonCand.h"
0022 #include "DataFormats/L1TMuon/interface/RegionalMuonCandFwd.h"
0023 
0024 #include "DataFormats/L1DTTrackFinder/interface/L1MuDTChambPhContainer.h"
0025 #include "DataFormats/L1DTTrackFinder/interface/L1MuDTChambThContainer.h"
0026 #include "DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigiCollection.h"
0027 #include "DataFormats/RPCDigi/interface/RPCDigiCollection.h"
0028 
0029 #include "L1Trigger/L1TMuonOverlapPhase1/interface/Omtf/GoldenPattern.h"
0030 
0031 class OMTFinput;
0032 
0033 namespace edm {
0034   class ParameterSet;
0035 };
0036 
0037 template <class GoldenPatternType>
0038 class OMTFProcessor : public ProcessorBase<GoldenPatternType>, public IProcessorEmulator {
0039 public:
0040   OMTFProcessor(OMTFConfiguration* omtfConfig,
0041                 const edm::ParameterSet& edmCfg,
0042                 edm::EventSetup const& evSetup,
0043                 const L1TMuonOverlapParams* omtfPatterns);
0044 
0045   OMTFProcessor(OMTFConfiguration* omtfConfig,
0046                 const edm::ParameterSet& edmCfg,
0047                 edm::EventSetup const& evSetup,
0048                 GoldenPatternVec<GoldenPatternType>&& gps);
0049 
0050   ~OMTFProcessor() override;
0051 
0052   ///Fill GP vec with patterns from CondFormats object
0053   /*  virtual bool configure(const OMTFConfiguration* omtfParams, const L1TMuonOverlapParams* omtfPatterns) {
0054     return ProcessorBase<GoldenPatternType>::configure(omtfParams, omtfPatterns);
0055   }*/
0056 
0057   ///Process input data from a single event
0058   ///Input data is represented by hits in logic layers expressed in local coordinates
0059   void processInput(unsigned int iProcessor, l1t::tftype mtfType, const OMTFinput& aInput) override;
0060 
0061   AlgoMuons sortResults(unsigned int iProcessor, l1t::tftype mtfType, int charge = 0) override;
0062 
0063   AlgoMuons ghostBust(AlgoMuons refHitCands, int charge = 0) override {
0064     return ghostBuster->select(refHitCands, charge);
0065   }
0066 
0067   //convert algo muon to outgoing Candidates
0068   std::vector<l1t::RegionalMuonCand> getFinalcandidates(unsigned int iProcessor,
0069                                                         l1t::tftype mtfType,
0070                                                         const AlgoMuons& algoCands) override;
0071 
0072   ///allows to use other sorter implementation than the default one
0073   virtual void setSorter(SorterBase<GoldenPatternType>* sorter) { this->sorter.reset(sorter); }
0074 
0075   ///allows to use other IGhostBuster implementation than the default one
0076   void setGhostBuster(IGhostBuster* ghostBuster) override { this->ghostBuster.reset(ghostBuster); }
0077 
0078   virtual void setPtAssignment(PtAssignmentBase* ptAssignment) { this->ptAssignment = ptAssignment; }
0079 
0080   std::vector<l1t::RegionalMuonCand> run(unsigned int iProcessor,
0081                                          l1t::tftype mtfType,
0082                                          int bx,
0083                                          OMTFinputMaker* inputMaker,
0084                                          std::vector<std::unique_ptr<IOMTFEmulationObserver> >& observers) override;
0085 
0086   void printInfo() const override;
0087 
0088 private:
0089   virtual void init(const edm::ParameterSet& edmCfg, edm::EventSetup const& evSetup);
0090 
0091   ///Check if the hit pattern of given OMTF candite is not on the list
0092   ///of invalid hit patterns. Invalid hit patterns provode very little
0093   ///to efficiency, but gives high contribution to rate.
0094   ///Candidate with invalid hit patterns is assigned quality=0.
0095   ///Currently the list of invalid patterns is hardcoded.
0096   ///This has to be read from configuration.
0097   bool checkHitPatternValidity(unsigned int hits) override;
0098 
0099   std::unique_ptr<SorterBase<GoldenPatternType> > sorter;
0100 
0101   std::unique_ptr<IGhostBuster> ghostBuster;
0102 
0103   //ptAssignment should be destroyed where it is created, i.e. by OmtfEmulation or OMTFReconstruction
0104   PtAssignmentBase* ptAssignment = nullptr;
0105 };
0106 
0107 #endif