CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Attributes
EmulationObserverBase Class Reference

#include <EmulationObserverBase.h>

Inheritance diagram for EmulationObserverBase:
IOMTFEmulationObserver DataROOTDumper2 PatternOptimizerBase PatternGenerator

Public Member Functions

 EmulationObserverBase (const edm::ParameterSet &edmCfg, const OMTFConfiguration *omtfConfig)
 
const SimTrackfindSimMuon (const edm::Event &event, const SimTrack *previous=nullptr)
 
void observeEventBegin (const edm::Event &iEvent) override
 
void observeProcesorEmulation (unsigned int iProcessor, l1t::tftype mtfType, const std::shared_ptr< OMTFinput > &input, const AlgoMuons &algoCandidates, const AlgoMuons &gbCandidates, const std::vector< l1t::RegionalMuonCand > &candMuons) override
 
 ~EmulationObserverBase () override
 
- Public Member Functions inherited from IOMTFEmulationObserver
virtual void beginRun (edm::EventSetup const &eventSetup)
 
virtual void endJob ()=0
 
 IOMTFEmulationObserver ()
 
virtual void observeEventEnd (const edm::Event &iEvent, std::unique_ptr< l1t::RegionalMuonCandBxCollection > &finalCandidates)
 
virtual ~IOMTFEmulationObserver ()
 

Protected Attributes

unsigned int candProcIndx = 0
 
edm::ParameterSet edmCfg
 
AlgoMuons::value_type omtfCand
 
const OMTFConfigurationomtfConfig
 
l1t::RegionalMuonCand regionalMuonCand
 
const SimTracksimMuon = nullptr
 

Detailed Description

Definition at line 18 of file EmulationObserverBase.h.

Constructor & Destructor Documentation

◆ EmulationObserverBase()

EmulationObserverBase::EmulationObserverBase ( const edm::ParameterSet edmCfg,
const OMTFConfiguration omtfConfig 
)

Definition at line 12 of file EmulationObserverBase.cc.

13  : edmCfg(edmCfg), omtfConfig(omtfConfig), simMuon(nullptr) {}
const OMTFConfiguration * omtfConfig

◆ ~EmulationObserverBase()

EmulationObserverBase::~EmulationObserverBase ( )
override

Definition at line 15 of file EmulationObserverBase.cc.

15  {
16  // TODO Auto-generated destructor stub
17 }

Member Function Documentation

◆ findSimMuon()

const SimTrack * EmulationObserverBase::findSimMuon ( const edm::Event event,
const SimTrack previous = nullptr 
)

Definition at line 74 of file EmulationObserverBase.cc.

References electronAnalyzer_cfi::DeltaR, edmCfg, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), CoreSimTrack::momentum(), callgraph::previous, mps_fire::result, and CoreSimTrack::type().

Referenced by observeEventBegin().

74  {
75  const SimTrack* result = nullptr;
76  if (edmCfg.exists("simTracksTag") == false)
77  return result;
78 
80  event.getByLabel(edmCfg.getParameter<edm::InputTag>("simTracksTag"), simTks);
81 
82  //LogTrace("l1tOmtfEventPrint")<<__FUNCTION__<<" simTks->size() "<<simTks->size()<<std::endl;
83  for (std::vector<SimTrack>::const_iterator it = simTks->begin(); it < simTks->end(); it++) {
84  const SimTrack& aTrack = *it;
85  if (!(aTrack.type() == 13 || aTrack.type() == -13))
86  continue;
87  if (previous && ROOT::Math::VectorUtil::DeltaR(aTrack.momentum(), previous->momentum()) < 0.07)
88  continue;
89  if (!result || aTrack.momentum().pt() > result->momentum().pt())
90  result = &aTrack;
91  }
92  return result;
93 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
bool exists(std::string const &parameterName) const
checks if a parameter exists
const math::XYZTLorentzVectorD & momentum() const
Definition: CoreSimTrack.h:19
int type() const
particle type (HEP PDT convension)
Definition: CoreSimTrack.h:22

◆ observeEventBegin()

void EmulationObserverBase::observeEventBegin ( const edm::Event iEvent)
overridevirtual

Reimplemented from IOMTFEmulationObserver.

Definition at line 66 of file EmulationObserverBase.cc.

References candProcIndx, findSimMuon(), iEvent, omtfCand, and simMuon.

66  {
67  omtfCand.reset(new AlgoMuon());
68  candProcIndx = 0xffff;
69 
71  //LogTrace("l1tOmtfEventPrint") <<__FUNCTION__<<":"<<__LINE__<<" evevt "<<iEvent.id().event()<<" simMuon pt "<<simMuon->momentum().pt()<<" GeV "<<std::endl;
72 }
AlgoMuons::value_type omtfCand
int iEvent
Definition: GenABIO.cc:224
const SimTrack * findSimMuon(const edm::Event &event, const SimTrack *previous=nullptr)

◆ observeProcesorEmulation()

void EmulationObserverBase::observeProcesorEmulation ( unsigned int  iProcessor,
l1t::tftype  mtfType,
const std::shared_ptr< OMTFinput > &  input,
const AlgoMuons algoCandidates,
const AlgoMuons gbCandidates,
const std::vector< l1t::RegionalMuonCand > &  candMuons 
)
overridevirtual

Implements IOMTFEmulationObserver.

Definition at line 19 of file EmulationObserverBase.cc.

References candProcIndx, OMTFConfiguration::getProcIndx(), mps_fire::i, omtfCand, omtfConfig, and regionalMuonCand.

24  {
25  unsigned int procIndx = omtfConfig->getProcIndx(iProcessor, mtfType);
26 
27  unsigned int i = 0;
28  for (auto& gbCandidate : gbCandidates) {
29  if (gbCandidate->getGoldenPatern() != nullptr &&
30  gbCandidate->getGpResult().getFiredLayerCnt() > omtfCand->getGpResult().getFiredLayerCnt()) {
31  //LogTrace("l1tOmtfEventPrint") <<__FUNCTION__<<":"<<__LINE__<<" gbCandidate "<<gbCandidate<<" "<<std::endl;
32  omtfCand = gbCandidate;
33 
34  candProcIndx = procIndx;
35 
36  //should be good, as the regionalMuonCand is created for every gbCandidate in OMTFProcessor<GoldenPatternType>::getFinalcandidates
37  regionalMuonCand = candMuons.at(i);
38 
39  //this->algoCandidates = algoCandidates; //TODO uncomment if needed
40  }
41  i++;
42  }
43 
45  /*if(omtfCand->isValid()) { //TODO check this condition
46  GoldenPatternWithStat* omtfCandGp = static_cast<GoldenPatternWithStat*>(omtfCand.getGoldenPatern());
47  if( omtfCandGp->key().thePt > 100 && exptCandGp->key().thePt <= 15 ) {
48  //LogTrace("l1tOmtfEventPrint") <<iEvent.id()<<std::endl;
49  LogTrace("l1tOmtfEventPrint") <<" ptSim "<<ptSim<<" chargeSim "<<chargeSim<<std::endl;
50  LogTrace("l1tOmtfEventPrint") <<"iProcessor "<<iProcessor<<" exptCandGp "<<exptCandGp->key()<<std::endl;
51  LogTrace("l1tOmtfEventPrint") <<"iProcessor "<<iProcessor<<" omtfCandGp "<<omtfCandGp->key()<<std::endl;
52  LogTrace("l1tOmtfEventPrint") <<"omtfResult "<<std::endl<<omtfResult<<std::endl;
53  int refHitNum = omtfCand.getRefHitNumber();
54  LogTrace("l1tOmtfEventPrint") <<"other gps results"<<endl;
55  for(auto& gp : goldenPatterns) {
56  if(omtfResult.getFiredLayerCnt() == gp->getResults()[procIndx][iRefHit].getFiredLayerCnt() )
57  {
58  LogTrace("l1tOmtfEventPrint") <<gp->key()<<std::endl<<gp->getResults()[procIndx][iRefHit]<<std::endl;
59  }
60  }
61  LogTrace("l1tOmtfEventPrint")<<std::endl;
62  }
63  }*/
64 }
AlgoMuons::value_type omtfCand
l1t::RegionalMuonCand regionalMuonCand
unsigned int getProcIndx(unsigned int iProcessor, l1t::tftype mtfType) const
input phi should be in the hardware scale (nPhiBins units for 2pi), can be in range -nPhiBins ...
const OMTFConfiguration * omtfConfig

Member Data Documentation

◆ candProcIndx

unsigned int EmulationObserverBase::candProcIndx = 0
protected

◆ edmCfg

edm::ParameterSet EmulationObserverBase::edmCfg
protected

◆ omtfCand

AlgoMuons::value_type EmulationObserverBase::omtfCand
protected

◆ omtfConfig

const OMTFConfiguration* EmulationObserverBase::omtfConfig
protected

◆ regionalMuonCand

l1t::RegionalMuonCand EmulationObserverBase::regionalMuonCand
protected

◆ simMuon

const SimTrack* EmulationObserverBase::simMuon = nullptr
protected