CMS 3D CMS Logo

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

#include <OMTFReconstruction.h>

Inheritance diagram for OMTFReconstruction:
OmtfEmulation

Public Member Functions

virtual void addObservers (const MuonGeometryTokens &muonGeometryTokens, const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > &magneticFieldEsToken, const edm::ESGetToken< Propagator, TrackingComponentsRecord > &propagatorEsToken)
 
void beginJob ()
 
void beginJob ()
 
void beginRun (edm::Run const &run, edm::EventSetup const &iSetup, edm::ESGetToken< L1TMuonOverlapParams, L1TMuonOverlapParamsRcd > &omtfParamsEsToken, const MuonGeometryTokens &muonGeometryTokens, const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > &magneticFieldEsToken, const edm::ESGetToken< Propagator, TrackingComponentsRecord > &propagatorEsToken)
 
void beginRun (edm::Run const &, edm::EventSetup const &)
 
void endJob ()
 
void endJob ()
 
 OMTFReconstruction (const edm::ParameterSet &, MuStubsInputTokens &muStubsInputTokens)
 
 OMTFReconstruction (const edm::ParameterSet &, edm::ConsumesCollector &&)
 
std::unique_ptr< l1t::RegionalMuonCandBxCollectionreconstruct (const edm::Event &, const edm::EventSetup &)
 
std::unique_ptr< l1t::RegionalMuonCandBxCollectionreconstruct (const edm::Event &, const edm::EventSetup &)
 
void setInputMaker (unique_ptr< OMTFinputMaker > inputMaker)
 
virtual ~OMTFReconstruction ()
 
 ~OMTFReconstruction ()
 

Protected Attributes

edm::ParameterSet edmParameterSet
 
unique_ptr< OMTFinputMakerinputMaker
 
MuStubsInputTokensmuStubsInputTokens
 
std::vector< std::unique_ptr< IOMTFEmulationObserver > > observers
 
unique_ptr< OMTFConfigurationomtfConfig
 
unique_ptr< L1TMuonOverlapParamsomtfParams
 OMTF objects. More...
 
edm::ESWatcher< L1TMuonOverlapParamsRcdomtfParamsRecordWatcher
 
unique_ptr< IProcessorEmulatoromtfProc
 

Private Member Functions

void getProcessorCandidates (unsigned int iProcessor, l1t::tftype mtfType, int bx, l1t::RegionalMuonCandBxCollection &myCandidates)
 
void loadAndFilterDigis (const edm::Event &)
 
void writeResultToXML (unsigned int iProcessor, l1t::tftype mtfType, const OMTFinput &myInput, const std::vector< OMTFProcessor::resultsMap > &myResults, const std::vector< l1t::RegionalMuonCand > &candMuons)
 

Private Attributes

xercesc::DOMElement * aTopElement
 
int bxMax
 
int bxMin
 
edm::Handle< CSCCorrelatedLCTDigiCollectioncscDigis
 
edm::Handle< L1MuDTChambPhContainerdtPhDigis
 
edm::Handle< L1MuDTChambThContainerdtThDigis
 
bool dumpDetailedResultToXML
 
bool dumpResultToXML
 
edm::ESGetToken< L1TMuonOverlapParams, L1TMuonOverlapParamsRcdl1TMuonOverlapParamsToken_
 
edm::ParameterSet m_Config
 
std::unique_ptr< IGhostBusterm_GhostBuster
 
OMTFinputMaker m_InputMaker
 
OMTFProcessorm_OMTF
 
OMTFConfigurationm_OMTFConfig
 OMTF objects. More...
 
OMTFConfigMakerm_OMTFConfigMaker
 
OMTFSorter m_Sorter
 
XMLConfigWriterm_Writer
 
edm::Handle< RPCDigiCollectionrpcDigis
 

Detailed Description

Definition at line 37 of file OMTFReconstruction.h.

Constructor & Destructor Documentation

◆ OMTFReconstruction() [1/2]

OMTFReconstruction::OMTFReconstruction ( const edm::ParameterSet theConfig,
edm::ConsumesCollector &&  iC 
)

Definition at line 21 of file OMTFReconstruction.cc.

References bxMax, bxMin, dumpDetailedResultToXML, dumpResultToXML, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), and m_Config.

22  : m_Config(theConfig),
25  m_OMTFConfig(nullptr),
26  m_InputMaker(iC, false),
27  m_OMTF(nullptr),
28  aTopElement(nullptr),
29  m_OMTFConfigMaker(nullptr),
30  m_Writer(nullptr) {
31  dumpResultToXML = m_Config.getParameter<bool>("dumpResultToXML");
32  dumpDetailedResultToXML = m_Config.getParameter<bool>("dumpDetailedResultToXML");
33  //m_Config.getParameter<std::string>("XMLDumpFileName");
34  bxMin = m_Config.exists("bxMin") ? m_Config.getParameter<int>("bxMin") : 0;
35  bxMax = m_Config.exists("bxMax") ? m_Config.getParameter<int>("bxMax") : 0;
36 }
edm::ESGetToken< L1TMuonOverlapParams, L1TMuonOverlapParamsRcd > l1TMuonOverlapParamsToken_
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
OMTFConfiguration * m_OMTFConfig
OMTF objects.
bool exists(std::string const &parameterName) const
checks if a parameter exists
xercesc::DOMElement * aTopElement
OMTFProcessor * m_OMTF
XMLConfigWriter * m_Writer
OMTFinputMaker m_InputMaker
OMTFConfigMaker * m_OMTFConfigMaker
edm::ParameterSet m_Config

◆ ~OMTFReconstruction() [1/2]

OMTFReconstruction::~OMTFReconstruction ( )

Definition at line 39 of file OMTFReconstruction.cc.

References m_OMTF, m_OMTFConfig, and m_Writer.

39  {
40  delete m_OMTFConfig;
41  delete m_OMTF;
42 
43  if (m_Writer)
44  delete m_Writer;
45 }
OMTFConfiguration * m_OMTFConfig
OMTF objects.
OMTFProcessor * m_OMTF
XMLConfigWriter * m_Writer

◆ OMTFReconstruction() [2/2]

OMTFReconstruction::OMTFReconstruction ( const edm::ParameterSet parameterSet,
MuStubsInputTokens muStubsInputTokens 
)

Definition at line 29 of file OMTFReconstruction.cc.

References bxMax, bxMin, edmParameterSet, edm::ParameterSet::exists(), and edm::ParameterSet::getParameter().

33  omtfProc(nullptr),
34  m_OMTFConfigMaker(nullptr) {
35  bxMin = edmParameterSet.exists("bxMin") ? edmParameterSet.getParameter<int>("bxMin") : 0;
36  bxMax = edmParameterSet.exists("bxMax") ? edmParameterSet.getParameter<int>("bxMax") : 0;
37 
38  edm::LogVerbatim("OMTFReconstruction") << "running emulation for the bxMin " << bxMin << " - bxMax " << bxMax
39  << std::endl;
40 }
Log< level::Info, true > LogVerbatim
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
bool exists(std::string const &parameterName) const
checks if a parameter exists
ParameterSet const & parameterSet(StableProvenance const &provenance, ProcessHistory const &history)
Definition: Provenance.cc:11
MuStubsInputTokens & muStubsInputTokens
unique_ptr< OMTFConfiguration > omtfConfig
edm::ParameterSet edmParameterSet
unique_ptr< IProcessorEmulator > omtfProc
OMTFConfigMaker * m_OMTFConfigMaker

◆ ~OMTFReconstruction() [2/2]

virtual OMTFReconstruction::~OMTFReconstruction ( )
virtual

Member Function Documentation

◆ addObservers()

void OMTFReconstruction::addObservers ( const MuonGeometryTokens muonGeometryTokens,
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > &  magneticFieldEsToken,
const edm::ESGetToken< Propagator, TrackingComponentsRecord > &  propagatorEsToken 
)
virtual

Reimplemented in OmtfEmulation.

Definition at line 204 of file OMTFReconstruction.cc.

References edmParameterSet, Exception, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), observers, omtfConfig, omtfProc, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by OmtfEmulation::addObservers(), and beginRun().

207  {
208  if (!observers.empty()) //assuring it is done only at the first run
209  return;
210 
211  edm::LogVerbatim("OMTFReconstruction") << "OMTFReconstruction::addObservers " << std::endl;
212 
213  //omtfConfig is created at constructor, and is not re-created at the the start of the run, so this is OK
214  if (edmParameterSet.exists("dumpResultToXML")) {
215  if (edmParameterSet.getParameter<bool>("dumpResultToXML"))
216  observers.emplace_back(std::make_unique<XMLEventWriter>(
217  omtfConfig.get(), edmParameterSet.getParameter<std::string>("XMLDumpFileName")));
218  }
219 
220  CandidateSimMuonMatcher* candidateSimMuonMatcher = nullptr;
221 
222  if (edmParameterSet.exists("candidateSimMuonMatcher")) {
223  if (edmParameterSet.getParameter<bool>("candidateSimMuonMatcher")) {
224  observers.emplace_back(std::make_unique<CandidateSimMuonMatcher>(
225  edmParameterSet, omtfConfig.get(), magneticFieldEsToken, propagatorEsToken));
226  candidateSimMuonMatcher = static_cast<CandidateSimMuonMatcher*>(observers.back().get());
227  }
228  }
229 
230  auto omtfProcGoldenPat = dynamic_cast<OMTFProcessor<GoldenPattern>*>(omtfProc.get());
231  if (omtfProcGoldenPat) {
232  if (edmParameterSet.exists("eventCaptureDebug"))
233  if (edmParameterSet.getParameter<bool>("eventCaptureDebug")) {
234  observers.emplace_back(std::make_unique<EventCapture>(
235  edmParameterSet, omtfConfig.get(), candidateSimMuonMatcher, muonGeometryTokens
236  //&(omtfProcGoldenPat->getPatterns() ),
237  //watch out, will crash if the proc is re-constructed from the DB after L1TMuonOverlapParamsRcd change
238  ));
239  }
240 
241  if (edmParameterSet.exists("dumpHitsToROOT") && edmParameterSet.getParameter<bool>("dumpHitsToROOT")) {
242  //std::string rootFileName = edmParameterSet.getParameter<std::string>("dumpHitsFileName");
243  if (candidateSimMuonMatcher == nullptr) {
244  edm::LogVerbatim("OMTFReconstruction")
245  << "dumpHitsToROOT needs candidateSimMuonMatcher, but it is null " << std::endl;
246  throw cms::Exception("dumpHitsToROOT needs candidateSimMuonMatcher, but it is null");
247  }
248  observers.emplace_back(
249  std::make_unique<DataROOTDumper2>(edmParameterSet, omtfConfig.get(), candidateSimMuonMatcher));
250  }
251  }
252 
253  auto omtfProcGoldenPatWithStat = dynamic_cast<OMTFProcessor<GoldenPatternWithStat>*>(omtfProc.get());
254  if (omtfProcGoldenPatWithStat) {
255  if (edmParameterSet.exists("eventCaptureDebug"))
256  if (edmParameterSet.getParameter<bool>("eventCaptureDebug")) {
257  observers.emplace_back(std::make_unique<EventCapture>(
258  edmParameterSet, omtfConfig.get(), candidateSimMuonMatcher, muonGeometryTokens
259  //&(omtfProcGoldenPat->getPatterns() ),
260  //watch out, will crash if the proc is re-constructed from the DB after L1TMuonOverlapParamsRcd change
261  ));
262  }
263 
264  if (edmParameterSet.exists("generatePatterns") && edmParameterSet.getParameter<bool>("generatePatterns")) {
265  observers.emplace_back(std::make_unique<PatternGenerator>(
266  edmParameterSet, omtfConfig.get(), omtfProcGoldenPatWithStat->getPatterns(), candidateSimMuonMatcher));
267  edm::LogVerbatim("OMTFReconstruction") << "generatePatterns: true " << std::endl;
268  }
269  }
270 }
Log< level::Info, true > LogVerbatim
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
bool exists(std::string const &parameterName) const
checks if a parameter exists
std::vector< std::unique_ptr< IOMTFEmulationObserver > > observers
unique_ptr< OMTFConfiguration > omtfConfig
edm::ParameterSet edmParameterSet
unique_ptr< IProcessorEmulator > omtfProc

◆ beginJob() [1/2]

void OMTFReconstruction::beginJob ( )

◆ beginJob() [2/2]

void OMTFReconstruction::beginJob ( void  )

Definition at line 49 of file OMTFReconstruction.cc.

References m_OMTF, and m_OMTFConfig.

Referenced by L1TMuonOverlapPhase1TrackProducer::beginJob(), and L1TMuonOverlapTrackProducer::beginJob().

49  {
51  m_OMTF = new OMTFProcessor();
52 }
OMTFConfiguration * m_OMTFConfig
OMTF objects.
OMTFProcessor * m_OMTF

◆ beginRun() [1/2]

void OMTFReconstruction::beginRun ( edm::Run const &  run,
edm::EventSetup const &  iSetup,
edm::ESGetToken< L1TMuonOverlapParams, L1TMuonOverlapParamsRcd > &  omtfParamsEsToken,
const MuonGeometryTokens muonGeometryTokens,
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > &  magneticFieldEsToken,
const edm::ESGetToken< Propagator, TrackingComponentsRecord > &  propagatorEsToken 
)

Definition at line 61 of file OMTFReconstruction.cc.

References addObservers(), edm::ESWatcher< T >::check(), edmParameterSet, options_cfi::eventSetup, Exception, edm::ParameterSet::exists(), isotrackTrainRegressor::fName, contentValuesFiles::fullPath, edm::FileInPath::fullPath(), amcDumpToRaw_cfi::fwVersion, edm::ParameterSet::getParameter(), inputMaker, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, observers, omtfConfig, omtfParams, omtfParamsRecordWatcher, omtfProc, fakeOmtfFwVersion_cff::patternsVersion, fakeOmtfParams_cff::patternsXMLFile, fakeOmtfParams_cff::patternsXMLFiles, simOmtfDigis_cfi::processorType, XMLConfigReader::readConfig(), XMLConfigReader::readPatterns(), writedatasetfile::run, XMLConfigReader::setConfigFile(), and AlCaHLTBitMon_QueryRunRegistry::string.

66  {
67  std::string processorType = "OMTFProcessor"; //GoldenPatternWithStat GoldenPattern
68  if (edmParameterSet.exists("processorType")) {
70  }
71 
72  bool buildPatternsFromXml = (edmParameterSet.exists("patternsXMLFile") || edmParameterSet.exists("patternsXMLFiles"));
73 
74  bool readConfigFromXml = edmParameterSet.exists("configXMLFile");
75 
76  if (buildPatternsFromXml != readConfigFromXml)
77  throw cms::Exception(
78  "OMTFReconstruction::beginRun: buildPatternsFromXml != readConfigFromXml - both patternsXMLFiles and "
79  "configXMLFile should be defined (or not) for the simOmtDigis or simOmtfPhase2Digis");
80 
81  edm::LogVerbatim("OMTFReconstruction") << "OMTFReconstruction::beginRun " << run.id()
82  << " buildPatternsFromXml: " << buildPatternsFromXml << std::endl;
83 
84  //if the buildPatternsFromXml == false - we are making the omtfConfig and omtfProc for every run,
85  //as the configuration my change between the runs,
86  if (buildPatternsFromXml == false) {
88  edm::LogVerbatim("OMTFReconstruction") << "retrieving omtfParams from EventSetup" << std::endl;
89 
90  const L1TMuonOverlapParams* omtfParamsFromES = &(eventSetup.getData(omtfParamsEsToken));
91  if (!omtfParamsFromES) {
92  edm::LogError("OMTFReconstruction") << "Could not retrieve omtfParams from Event Setup" << std::endl;
93  throw cms::Exception("OMTFReconstruction::beginRun: Could not retrieve omtfParams from Event Setup");
94  }
95 
96  omtfConfig->configure(omtfParamsFromES);
97 
98  //the parameters can be overwritten from the python config
99  omtfConfig->configureFromEdmParameterSet(edmParameterSet);
100 
101  inputMaker->initialize(edmParameterSet, eventSetup, muonGeometryTokens);
102 
103  //patterns from the edm::EventSetup are reloaded every beginRun
104  //therefore OMTFProcessor is re-created here
105  edm::LogVerbatim("OMTFReconstruction") << "getting patterns from EventSetup" << std::endl;
106  if (processorType == "OMTFProcessor") {
107  omtfProc = std::make_unique<OMTFProcessor<GoldenPattern> >(
108  omtfConfig.get(), edmParameterSet, eventSetup, omtfParamsFromES);
109  omtfProc->printInfo();
110  }
111  }
112  }
113 
114  //if buildPatternsFromXml == true - the entire configuration (patterns and hwToLogicLayer) comes from phyton,
115  //so we read it only once, at the beginning of the first run, not every run
116  if (omtfProc == nullptr && buildPatternsFromXml) {
118 
119  edm::LogVerbatim("OMTFReconstruction")
120  << "OMTFReconstruction::beginRun - reading config from file: " << fName << std::endl;
121 
122  XMLConfigReader xmlConfigReader;
123  xmlConfigReader.setConfigFile(fName);
124 
125  omtfParams.reset(new L1TMuonOverlapParams());
126  xmlConfigReader.readConfig(omtfParams.get());
127 
128  //getPatternsVersion() parses the entire patterns xml - si it is very inefficient
129  //moreover, PatternsVersion is not used anywhere
130  //Therefore we we dont use xmlPatternReader.getPatternsVersion(); but set patternsVersion to 0
131  unsigned int patternsVersion = 0;
132  unsigned int fwVersion = omtfParams->fwVersion();
133  omtfParams->setFwVersion((fwVersion << 16) + patternsVersion);
134 
135  omtfConfig->configure(omtfParams.get());
136 
137  //the parameters can be overwritten from the python config
138  omtfConfig->configureFromEdmParameterSet(edmParameterSet);
139 
140  inputMaker->initialize(edmParameterSet, eventSetup, muonGeometryTokens);
141 
142  //reading patterns from the xml----------------------------------------------------------
143  std::vector<std::string> patternsXMLFiles;
144 
145  if (edmParameterSet.exists("patternsXMLFile")) {
146  patternsXMLFiles.push_back(edmParameterSet.getParameter<edm::FileInPath>("patternsXMLFile").fullPath());
147  } else if (edmParameterSet.exists("patternsXMLFiles")) {
148  for (const auto& it : edmParameterSet.getParameter<std::vector<edm::ParameterSet> >("patternsXMLFiles")) {
149  patternsXMLFiles.push_back(it.getParameter<edm::FileInPath>("patternsXMLFile").fullPath());
150  }
151  }
152 
153  for (auto& patternsXMLFile : patternsXMLFiles)
154  edm::LogVerbatim("OMTFReconstruction") << "reading patterns from " << patternsXMLFile << std::endl;
155 
156  std::string patternType = "GoldenPattern"; //GoldenPatternWithStat GoldenPattern
157  if (edmParameterSet.exists("patternType")) {
158  patternType = edmParameterSet.getParameter<std::string>("patternType");
159  }
160 
161  if (patternType == "GoldenPattern") {
162  if (processorType == "OMTFProcessor") {
163  if (omtfParams) {
164  omtfProc = std::make_unique<OMTFProcessor<GoldenPattern> >(
165  omtfConfig.get(),
167  eventSetup,
168  xmlConfigReader.readPatterns<GoldenPattern>(*omtfParams, patternsXMLFiles, false));
169  } else { //in principle should not happen
170  throw cms::Exception("OMTFReconstruction::beginRun: omtfParams is nullptr");
171  }
172  }
173 
174  edm::LogVerbatim("OMTFReconstruction") << "OMTFProcessor constructed. processorType " << processorType
175  << ". GoldenPattern type: " << patternType << std::endl;
176  } else if (patternType == "GoldenPatternWithStat") {
177  //pattern generation is only possible if the processor is constructed only once per job
178  //PatternGenerator modifies the patterns!!!
179  if (processorType == "OMTFProcessor") {
180  if (omtfParams) {
181  omtfProc = std::make_unique<OMTFProcessor<GoldenPatternWithStat> >(
182  omtfConfig.get(),
184  eventSetup,
186  } else { //in principle should not happen
187  throw cms::Exception("OMTFReconstruction::beginRun: omtfParams is nullptr");
188  }
189  }
190  } else {
191  throw cms::Exception("OMTFReconstruction::beginRun: unknown GoldenPattern type: " + patternType);
192  }
193 
194  omtfProc->printInfo();
195  }
196 
197  addObservers(muonGeometryTokens, magneticFieldEsToken, propagatorEsToken);
198 
199  for (auto& obs : observers) {
200  obs->beginRun(eventSetup);
201  }
202 }
Log< level::Info, true > LogVerbatim
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
bool exists(std::string const &parameterName) const
checks if a parameter exists
virtual void addObservers(const MuonGeometryTokens &muonGeometryTokens, const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > &magneticFieldEsToken, const edm::ESGetToken< Propagator, TrackingComponentsRecord > &propagatorEsToken)
edm::ESWatcher< L1TMuonOverlapParamsRcd > omtfParamsRecordWatcher
Log< level::Error, false > LogError
unique_ptr< OMTFinputMaker > inputMaker
std::vector< std::unique_ptr< IOMTFEmulationObserver > > observers
std::vector< std::shared_ptr< GoldenPattern > > readPatterns(const L1TMuonOverlapParams &aConfig)
void readConfig(const std::string fName)
unique_ptr< OMTFConfiguration > omtfConfig
void setConfigFile(const std::string &fName)
edm::ParameterSet edmParameterSet
unique_ptr< IProcessorEmulator > omtfProc
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:57
unique_ptr< L1TMuonOverlapParams > omtfParams
OMTF objects.
const std::string & fullPath() const
Definition: FileInPath.cc:144

◆ beginRun() [2/2]

void OMTFReconstruction::beginRun ( edm::Run const &  ,
edm::EventSetup const &  iSetup 
)

Definition at line 63 of file OMTFReconstruction.cc.

References OMTFProcessor< GoldenPatternType >::configure(), OMTFConfiguration::configure(), dumpResultToXML, isotrackTrainRegressor::fName, OMTFConfiguration::fwVersion(), edm::EventSetup::getData(), XMLConfigWriter::initialiseXMLDocument(), OMTFSorter< GoldenPatternType >::initialize(), OMTFinputMaker::initialize(), l1TMuonOverlapParamsToken_, m_GhostBuster, m_InputMaker, m_OMTF, m_OMTFConfig, m_Sorter, m_Writer, OMTFConfiguration::nPhiBins(), omtfParams, OMTFSorter< GoldenPatternType >::setNphiBins(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by L1TMuonOverlapPhase2TrackProducer::beginRun(), L1TMuonOverlapPhase1TrackProducer::beginRun(), and L1TMuonOverlapTrackProducer::beginRun().

63  {
65 
66  if (!omtfParams) {
67  edm::LogError("L1TMuonOverlapTrackProducer") << "Could not retrieve parameters from Event Setup" << std::endl;
68  }
69 
72  //m_GhostBuster.setNphiBins(m_OMTFConfig->nPhiBins());
73 
74  if (m_OMTFConfig->fwVersion() >= 5) {
75  // if(m_Config.exists("ghostBusterType") ) {
76  // if(m_Config.getParameter<std::string>("ghostBusterType") == "GhostBusterPreferRefDt")
77  m_GhostBuster = std::make_unique<GhostBusterPreferRefDt>(m_OMTFConfig);
78  } else {
79  m_GhostBuster = std::make_unique<GhostBuster>();
80  }
81 
84 
86 
87  if (dumpResultToXML) {
89  std::string fName = "OMTF";
91  }
92 }
edm::ESGetToken< L1TMuonOverlapParams, L1TMuonOverlapParamsRcd > l1TMuonOverlapParamsToken_
OMTFConfiguration * m_OMTFConfig
OMTF objects.
void initialiseXMLDocument(const std::string &docName)
void initialize(const edm::EventSetup &, const OMTFConfiguration *)
Log< level::Error, false > LogError
std::unique_ptr< IGhostBuster > m_GhostBuster
void setNphiBins(unsigned int phiBins)
Definition: OMTFSorter.h:20
unsigned int fwVersion() const
unsigned int nPhiBins() const
OMTFProcessor * m_OMTF
XMLConfigWriter * m_Writer
void configure(const L1TMuonOverlapParams *omtfParams)
OMTFinputMaker m_InputMaker
bool configure(const OMTFConfiguration *omtfParams, const L1TMuonOverlapParams *omtfPatterns)
Fill GP map with patterns from CondFormats object.
unique_ptr< L1TMuonOverlapParams > omtfParams
OMTF objects.
void initialize(const OMTFConfiguration *cfg)
Definition: OMTFSorter.h:19

◆ endJob() [1/2]

void OMTFReconstruction::endJob ( )

◆ endJob() [2/2]

void OMTFReconstruction::endJob ( void  )

◆ getProcessorCandidates()

void OMTFReconstruction::getProcessorCandidates ( unsigned int  iProcessor,
l1t::tftype  mtfType,
int  bx,
l1t::RegionalMuonCandBxCollection myCandidates 
)
private

Definition at line 137 of file OMTFReconstruction.cc.

References OMTFinputMaker::buildInputForProcessor(), nano_mu_digi_cff::bx, OMTFSorter< GoldenPatternType >::candidates(), cscDigis, dtPhDigis, dtThDigis, RemoveAddSevLevel::flag, OMTFinputMaker::getFlag(), input, m_GhostBuster, m_InputMaker, m_OMTF, m_Sorter, OMTFProcessor< GoldenPatternType >::processInput(), edm::Handle< T >::product(), BXVector< T >::push_back(), mysort::results, rpcDigis, OMTFinputMaker::setFlag(), OMTFSorter< GoldenPatternType >::sortRefHitResults(), and writeResultToXML().

Referenced by reconstruct().

140  {
143  dtPhDigis.product(), dtThDigis.product(), cscDigis.product(), rpcDigis.product(), iProcessor, mtfType, bx);
144  int flag = m_InputMaker.getFlag();
145 
146  const std::vector<OMTFProcessor::resultsMap>& results = m_OMTF->processInput(iProcessor, input);
147 
148  std::vector<AlgoMuon> algoCandidates;
149 
150  m_Sorter.sortRefHitResults(results, algoCandidates);
151 
152  // perform GB
153  std::vector<AlgoMuon> gbCandidates = m_GhostBuster->select(algoCandidates);
154 
155  // fill RegionalMuonCand colleciton
156  std::vector<l1t::RegionalMuonCand> candMuons = m_Sorter.candidates(iProcessor, mtfType, gbCandidates);
157 
158  //fill outgoing collection
159  for (auto& candMuon : candMuons) {
160  candMuon.setHwQual(candMuon.hwQual() | flag); //FIXME temporary debug fix
161  omtfCandidates.push_back(bx, candMuon);
162  }
163 
164  //dump to XML
165  if (bx == 0)
166  writeResultToXML(iProcessor, mtfType, input, results, candMuons);
167 }
OMTFinput buildInputForProcessor(const L1MuDTChambPhContainer *dtPhDigis, const L1MuDTChambThContainer *dtThDigis, const CSCCorrelatedLCTDigiCollection *cscDigis, const RPCDigiCollection *rpcDigis, unsigned int iProcessor, l1t::tftype type=l1t::tftype::omtf_pos, int bx=0)
Method translating trigger digis into input matrix with global phi coordinates.
T const * product() const
Definition: Handle.h:70
std::unique_ptr< IGhostBuster > m_GhostBuster
static std::string const input
Definition: EdmProvDump.cc:50
int getFlag() const
OMTFProcessor * m_OMTF
void writeResultToXML(unsigned int iProcessor, l1t::tftype mtfType, const OMTFinput &myInput, const std::vector< OMTFProcessor::resultsMap > &myResults, const std::vector< l1t::RegionalMuonCand > &candMuons)
const std::vector< OMTFProcessor::resultsMap > & processInput(unsigned int iProcessor, const OMTFinput &aInput)
edm::Handle< RPCDigiCollection > rpcDigis
void setFlag(int aFlag)
std::vector< l1t::RegionalMuonCand > candidates(unsigned int iProcessor, l1t::tftype mtfType, const std::vector< AlgoMuon > &algoCands)
Definition: OMTFSorter.cc:156
edm::Handle< L1MuDTChambThContainer > dtThDigis
OMTFinputMaker m_InputMaker
edm::Handle< L1MuDTChambPhContainer > dtPhDigis
results
Definition: mysort.py:8
void sortRefHitResults(const std::vector< OMTFProcessor::resultsMap > &procResults, std::vector< AlgoMuon > &refHitCleanCands, int charge=0)
Definition: OMTFSorter.cc:130
edm::Handle< CSCCorrelatedLCTDigiCollection > cscDigis

◆ loadAndFilterDigis()

void OMTFReconstruction::loadAndFilterDigis ( const edm::Event iEvent)
private

Definition at line 123 of file OMTFReconstruction.cc.

References cscDigis, dtPhDigis, dtThDigis, edm::ParameterSet::getParameter(), iEvent, m_Config, and rpcDigis.

Referenced by reconstruct().

123  {
124  // Filter digis by dropping digis from selected (by cfg.py) subsystems
125  if (!m_Config.getParameter<bool>("dropDTPrimitives")) {
126  iEvent.getByLabel(m_Config.getParameter<edm::InputTag>("srcDTPh"), dtPhDigis);
127  iEvent.getByLabel(m_Config.getParameter<edm::InputTag>("srcDTTh"), dtThDigis);
128  }
129  if (!m_Config.getParameter<bool>("dropRPCPrimitives"))
130  iEvent.getByLabel(m_Config.getParameter<edm::InputTag>("srcRPC"), rpcDigis);
131  if (!m_Config.getParameter<bool>("dropCSCPrimitives"))
132  iEvent.getByLabel(m_Config.getParameter<edm::InputTag>("srcCSC"), cscDigis);
133 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
int iEvent
Definition: GenABIO.cc:224
edm::Handle< RPCDigiCollection > rpcDigis
edm::Handle< L1MuDTChambThContainer > dtThDigis
edm::Handle< L1MuDTChambPhContainer > dtPhDigis
edm::ParameterSet m_Config
edm::Handle< CSCCorrelatedLCTDigiCollection > cscDigis

◆ reconstruct() [1/2]

std::unique_ptr< l1t::RegionalMuonCandBxCollection > OMTFReconstruction::reconstruct ( const edm::Event iEvent,
const edm::EventSetup evSetup 
)

The order is important: first put omtf_pos candidates, then omtf_neg.

Definition at line 95 of file OMTFReconstruction.cc.

References aTopElement, nano_mu_digi_cff::bx, bxMax, bxMin, HLT_2024v14_cff::candidates, dumpResultToXML, getProcessorCandidates(), iEvent, loadAndFilterDigis(), m_OMTFConfig, m_Writer, OMTFConfiguration::nProcessors(), l1t::omtf_neg, l1t::omtf_pos, and XMLConfigWriter::writeEventHeader().

Referenced by L1TMuonOverlapPhase2TrackProducer::produce(), L1TMuonOverlapPhase1TrackProducer::produce(), and L1TMuonOverlapTrackProducer::produce().

96  {
98 
99  if (dumpResultToXML)
100  aTopElement = m_Writer->writeEventHeader(iEvent.id().event());
101 
102  std::unique_ptr<l1t::RegionalMuonCandBxCollection> candidates(new l1t::RegionalMuonCandBxCollection);
103  candidates->setBXRange(bxMin, bxMax);
104 
106  for (int bx = bxMin; bx <= bxMax; bx++) {
107  for (unsigned int iProcessor = 0; iProcessor < m_OMTFConfig->nProcessors(); ++iProcessor)
109 
110  for (unsigned int iProcessor = 0; iProcessor < m_OMTFConfig->nProcessors(); ++iProcessor)
112 
113  edm::LogInfo("OMTFReconstruction") << "OMTF: Number of candidates in BX=" << bx << ": " << candidates->size(bx)
114  << std::endl;
115  ;
116  }
117 
118  return candidates;
119 }
void getProcessorCandidates(unsigned int iProcessor, l1t::tftype mtfType, int bx, l1t::RegionalMuonCandBxCollection &myCandidates)
OMTFConfiguration * m_OMTFConfig
OMTF objects.
xercesc::DOMElement * aTopElement
void loadAndFilterDigis(const edm::Event &)
int iEvent
Definition: GenABIO.cc:224
XMLConfigWriter * m_Writer
Log< level::Info, false > LogInfo
xercesc::DOMElement * writeEventHeader(unsigned int eventId, unsigned int mixedEventId=0)
unsigned int nProcessors() const

◆ reconstruct() [2/2]

std::unique_ptr<l1t::RegionalMuonCandBxCollection> OMTFReconstruction::reconstruct ( const edm::Event ,
const edm::EventSetup  
)

◆ setInputMaker()

void OMTFReconstruction::setInputMaker ( unique_ptr< OMTFinputMaker inputMaker)
inline

Definition at line 56 of file OMTFReconstruction.h.

References inputMaker, and eostools::move().

56 { this->inputMaker = std::move(inputMaker); }
unique_ptr< OMTFinputMaker > inputMaker
def move(src, dest)
Definition: eostools.py:511

◆ writeResultToXML()

void OMTFReconstruction::writeResultToXML ( unsigned int  iProcessor,
l1t::tftype  mtfType,
const OMTFinput myInput,
const std::vector< OMTFProcessor::resultsMap > &  myResults,
const std::vector< l1t::RegionalMuonCand > &  candMuons 
)
private

Dump only regions, where a candidate was found

Definition at line 170 of file OMTFReconstruction.cc.

References aTopElement, dumpDetailedResultToXML, dumpResultToXML, makeMuonMisalignmentScenario::endcap, AlgoMuon::getPt(), input, m_OMTFConfig, m_Sorter, m_Writer, OMTFConfiguration::nTestRefHits(), l1t::omtf_neg, l1t::omtf_pos, mysort::results, OMTFSorter< GoldenPatternType >::sortRefHitResults(), XMLConfigWriter::writeAlgoMuon(), XMLConfigWriter::writeCandMuon(), XMLConfigWriter::writeEventData(), and XMLConfigWriter::writeResultsData().

Referenced by getProcessorCandidates().

174  {
175  int endcap = (mtfType == l1t::omtf_neg) ? -1 : ((mtfType == l1t::omtf_pos) ? +1 : 0);
176  OmtfName board(iProcessor, endcap);
177 
178  //Write data to XML file
179  if (dumpResultToXML) {
180  xercesc::DOMElement* aProcElement = m_Writer->writeEventData(aTopElement, board, input);
181  for (unsigned int iRefHit = 0; iRefHit < m_OMTFConfig->nTestRefHits(); ++iRefHit) {
183  AlgoMuon algoMuon = m_Sorter.sortRefHitResults(results[iRefHit], 0); //charge=0 means ignore charge
184  if (algoMuon.getPt()) {
185  m_Writer->writeAlgoMuon(aProcElement, iRefHit, algoMuon);
187  for (auto& itKey : results[iRefHit])
188  m_Writer->writeResultsData(aProcElement, iRefHit, itKey.first, itKey.second);
189  }
190  }
191  }
192  for (auto& candMuon : candMuons)
193  m_Writer->writeCandMuon(aProcElement, candMuon);
194  }
195 }
OMTFConfiguration * m_OMTFConfig
OMTF objects.
xercesc::DOMElement * aTopElement
xercesc::DOMElement * writeEventData(xercesc::DOMElement *aTopElement, const OmtfName &board, const OMTFinput &aInput)
static std::string const input
Definition: EdmProvDump.cc:50
void writeResultsData(xercesc::DOMElement *aTopElement, unsigned int iRegion, const Key &aKey, const OMTFResult &aResult)
void writeCandMuon(xercesc::DOMElement *aTopElement, const l1t::RegionalMuonCand &aCand)
XMLConfigWriter * m_Writer
unsigned int nTestRefHits() const
results
Definition: mysort.py:8
void writeAlgoMuon(xercesc::DOMElement *aTopElement, unsigned int iRefHit, const AlgoMuon &aMuon)
int getPt() const
Definition: AlgoMuon.h:50
void sortRefHitResults(const std::vector< OMTFProcessor::resultsMap > &procResults, std::vector< AlgoMuon > &refHitCleanCands, int charge=0)
Definition: OMTFSorter.cc:130

Member Data Documentation

◆ aTopElement

xercesc::DOMElement* OMTFReconstruction::aTopElement
private

Definition at line 84 of file OMTFReconstruction.h.

Referenced by reconstruct(), and writeResultToXML().

◆ bxMax

int OMTFReconstruction::bxMax
private

Definition at line 75 of file OMTFReconstruction.h.

Referenced by OMTFReconstruction(), and reconstruct().

◆ bxMin

int OMTFReconstruction::bxMin
private

Definition at line 75 of file OMTFReconstruction.h.

Referenced by OMTFReconstruction(), and reconstruct().

◆ cscDigis

edm::Handle<CSCCorrelatedLCTDigiCollection> OMTFReconstruction::cscDigis
private

Definition at line 56 of file OMTFReconstruction.h.

Referenced by getProcessorCandidates(), and loadAndFilterDigis().

◆ dtPhDigis

edm::Handle<L1MuDTChambPhContainer> OMTFReconstruction::dtPhDigis
private

Definition at line 54 of file OMTFReconstruction.h.

Referenced by getProcessorCandidates(), and loadAndFilterDigis().

◆ dtThDigis

edm::Handle<L1MuDTChambThContainer> OMTFReconstruction::dtThDigis
private

Definition at line 55 of file OMTFReconstruction.h.

Referenced by getProcessorCandidates(), and loadAndFilterDigis().

◆ dumpDetailedResultToXML

bool OMTFReconstruction::dumpDetailedResultToXML
private

Definition at line 74 of file OMTFReconstruction.h.

Referenced by OMTFReconstruction(), and writeResultToXML().

◆ dumpResultToXML

bool OMTFReconstruction::dumpResultToXML
private

◆ edmParameterSet

edm::ParameterSet OMTFReconstruction::edmParameterSet
protected

◆ inputMaker

unique_ptr<OMTFinputMaker> OMTFReconstruction::inputMaker
protected

Definition at line 74 of file OMTFReconstruction.h.

Referenced by OmtfEmulation::beginJob(), beginRun(), and setInputMaker().

◆ l1TMuonOverlapParamsToken_

edm::ESGetToken<L1TMuonOverlapParams, L1TMuonOverlapParamsRcd> OMTFReconstruction::l1TMuonOverlapParamsToken_
private

Definition at line 59 of file OMTFReconstruction.h.

Referenced by beginRun().

◆ m_Config

edm::ParameterSet OMTFReconstruction::m_Config
private

Definition at line 52 of file OMTFReconstruction.h.

Referenced by endJob(), loadAndFilterDigis(), and OMTFReconstruction().

◆ m_GhostBuster

std::unique_ptr<IGhostBuster> OMTFReconstruction::m_GhostBuster
private

Definition at line 81 of file OMTFReconstruction.h.

Referenced by beginRun(), and getProcessorCandidates().

◆ m_InputMaker

OMTFinputMaker OMTFReconstruction::m_InputMaker
private

Definition at line 79 of file OMTFReconstruction.h.

Referenced by beginRun(), and getProcessorCandidates().

◆ m_OMTF

OMTFProcessor* OMTFReconstruction::m_OMTF
private

◆ m_OMTFConfig

OMTFConfiguration* OMTFReconstruction::m_OMTFConfig
private

OMTF objects.

Definition at line 78 of file OMTFReconstruction.h.

Referenced by beginJob(), beginRun(), reconstruct(), writeResultToXML(), and ~OMTFReconstruction().

◆ m_OMTFConfigMaker

OMTFConfigMaker * OMTFReconstruction::m_OMTFConfigMaker
private

Definition at line 85 of file OMTFReconstruction.h.

◆ m_Sorter

OMTFSorter OMTFReconstruction::m_Sorter
private

Definition at line 80 of file OMTFReconstruction.h.

Referenced by beginRun(), getProcessorCandidates(), and writeResultToXML().

◆ m_Writer

XMLConfigWriter* OMTFReconstruction::m_Writer
private

◆ muStubsInputTokens

MuStubsInputTokens& OMTFReconstruction::muStubsInputTokens
protected

Definition at line 65 of file OMTFReconstruction.h.

Referenced by OmtfEmulation::beginJob().

◆ observers

std::vector<std::unique_ptr<IOMTFEmulationObserver> > OMTFReconstruction::observers
protected

Definition at line 80 of file OMTFReconstruction.h.

Referenced by OmtfEmulation::addObservers(), addObservers(), and beginRun().

◆ omtfConfig

unique_ptr<OMTFConfiguration> OMTFReconstruction::omtfConfig
protected

◆ omtfParams

unique_ptr<L1TMuonOverlapParams> OMTFReconstruction::omtfParams
protected

OMTF objects.

Definition at line 71 of file OMTFReconstruction.h.

Referenced by beginRun().

◆ omtfParamsRecordWatcher

edm::ESWatcher<L1TMuonOverlapParamsRcd> OMTFReconstruction::omtfParamsRecordWatcher
protected

Definition at line 82 of file OMTFReconstruction.h.

Referenced by beginRun().

◆ omtfProc

unique_ptr<IProcessorEmulator> OMTFReconstruction::omtfProc
protected

Definition at line 76 of file OMTFReconstruction.h.

Referenced by OmtfEmulation::addObservers(), addObservers(), and beginRun().

◆ rpcDigis

edm::Handle<RPCDigiCollection> OMTFReconstruction::rpcDigis
private

Definition at line 57 of file OMTFReconstruction.h.

Referenced by getProcessorCandidates(), and loadAndFilterDigis().