CMS 3D CMS Logo

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

#include <OMTFReconstruction.h>

Public Member Functions

void beginJob ()
 
void beginRun (edm::Run const &run, edm::EventSetup const &iSetup)
 
void endJob ()
 
 OMTFReconstruction ()
 
 OMTFReconstruction (const edm::ParameterSet &)
 
std::unique_ptr< l1t::RegionalMuonCandBxCollectionreconstruct (const edm::Event &, const edm::EventSetup &)
 
 ~OMTFReconstruction ()
 

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::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 36 of file OMTFReconstruction.h.

Constructor & Destructor Documentation

OMTFReconstruction::OMTFReconstruction ( )

Definition at line 19 of file OMTFReconstruction.cc.

20  : m_OMTFConfig(nullptr), m_OMTF(nullptr), aTopElement(nullptr), m_OMTFConfigMaker(nullptr), m_Writer(nullptr) {}
OMTFConfiguration * m_OMTFConfig
OMTF objects.
OMTFConfigMaker * m_OMTFConfigMaker
xercesc::DOMElement * aTopElement
OMTFProcessor * m_OMTF
XMLConfigWriter * m_Writer
OMTFReconstruction::OMTFReconstruction ( const edm::ParameterSet theConfig)

Definition at line 23 of file OMTFReconstruction.cc.

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

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

Definition at line 38 of file OMTFReconstruction.cc.

References m_OMTF, m_OMTFConfig, and m_Writer.

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

Member Function Documentation

void OMTFReconstruction::beginJob ( void  )

Definition at line 48 of file OMTFReconstruction.cc.

References m_OMTF, and m_OMTFConfig.

Referenced by L1TMuonOverlapTrackProducer::beginJob().

48  {
50  m_OMTF = new OMTFProcessor();
51 }
OMTFConfiguration * m_OMTFConfig
OMTF objects.
OMTFProcessor * m_OMTF
void OMTFReconstruction::beginRun ( edm::Run const &  run,
edm::EventSetup const &  iSetup 
)

Definition at line 62 of file OMTFReconstruction.cc.

References OMTFProcessor::configure(), OMTFConfiguration::configure(), dumpResultToXML, MainPageGenerator::fName, OMTFConfiguration::fwVersion(), edm::EventSetup::get(), edm::eventsetup::EventSetupRecordImplementation< T >::get(), XMLConfigWriter::initialiseXMLDocument(), OMTFSorter::initialize(), OMTFinputMaker::initialize(), m_GhostBuster, m_InputMaker, m_OMTF, m_OMTFConfig, m_Sorter, m_Writer, OMTFConfiguration::nPhiBins(), fakeOmtfParams_cff::omtfParams, OMTFSorter::setNphiBins(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by L1TMuonOverlapTrackProducer::beginRun().

62  {
63  const L1TMuonOverlapParamsRcd& omtfRcd = iSetup.get<L1TMuonOverlapParamsRcd>();
64 
65  edm::ESHandle<L1TMuonOverlapParams> omtfParamsHandle;
66  omtfRcd.get(omtfParamsHandle);
67 
68  const L1TMuonOverlapParams* omtfParams = omtfParamsHandle.product();
69 
70  if (!omtfParams) {
71  edm::LogError("L1TMuonOverlapTrackProducer") << "Could not retrieve parameters from Event Setup" << std::endl;
72  }
73 
74  m_OMTFConfig->configure(omtfParams);
75  m_OMTF->configure(m_OMTFConfig, omtfParams);
76  //m_GhostBuster.setNphiBins(m_OMTFConfig->nPhiBins());
77 
78  if (m_OMTFConfig->fwVersion() >= 5) {
79  // if(m_Config.exists("ghostBusterType") ) {
80  // if(m_Config.getParameter<std::string>("ghostBusterType") == "GhostBusterPreferRefDt")
82  } else {
83  m_GhostBuster.reset(new GhostBuster());
84  }
85 
88 
90 
91  if (dumpResultToXML) {
93  std::string fName = "OMTF";
95  }
96 }
bool configure(const OMTFConfiguration *omtfParams, const L1TMuonOverlapParams *omtfPatterns)
Fill GP map with patterns from CondFormats object.
OMTFConfiguration * m_OMTFConfig
OMTF objects.
unsigned int fwVersion() const
void initialiseXMLDocument(const std::string &docName)
void initialize(const edm::EventSetup &es, const OMTFConfiguration *)
unsigned int nPhiBins() const
std::unique_ptr< IGhostBuster > m_GhostBuster
void initialize(const OMTFConfiguration *cfg)
Definition: OMTFSorter.h:19
PRODUCT const & get(ESGetToken< PRODUCT, T > const &iToken) const
omtfParams
OMTF ESProducer.
OMTFProcessor * m_OMTF
XMLConfigWriter * m_Writer
void configure(const L1TMuonOverlapParams *omtfParams)
OMTFinputMaker m_InputMaker
void setNphiBins(unsigned int phiBins)
Definition: OMTFSorter.h:20
void OMTFReconstruction::endJob ( void  )
void OMTFReconstruction::getProcessorCandidates ( unsigned int  iProcessor,
l1t::tftype  mtfType,
int  bx,
l1t::RegionalMuonCandBxCollection myCandidates 
)
private

Definition at line 141 of file OMTFReconstruction.cc.

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

Referenced by reconstruct().

144  {
147  dtPhDigis.product(), dtThDigis.product(), cscDigis.product(), rpcDigis.product(), iProcessor, mtfType, bx);
148  int flag = m_InputMaker.getFlag();
149 
150  const std::vector<OMTFProcessor::resultsMap>& results = m_OMTF->processInput(iProcessor, input);
151 
152  std::vector<AlgoMuon> algoCandidates;
153 
154  m_Sorter.sortRefHitResults(results, algoCandidates);
155 
156  // perform GB
157  std::vector<AlgoMuon> gbCandidates = m_GhostBuster->select(algoCandidates);
158 
159  // fill RegionalMuonCand colleciton
160  std::vector<l1t::RegionalMuonCand> candMuons = m_Sorter.candidates(iProcessor, mtfType, gbCandidates);
161 
162  //fill outgoing collection
163  for (auto& candMuon : candMuons) {
164  candMuon.setHwQual(candMuon.hwQual() | flag); //FIXME temporary debug fix
165  omtfCandidates.push_back(bx, candMuon);
166  }
167 
168  //dump to XML
169  if (bx == 0)
170  writeResultToXML(iProcessor, mtfType, input, results, candMuons);
171 }
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.
std::unique_ptr< IGhostBuster > m_GhostBuster
static std::string const input
Definition: EdmProvDump.cc:48
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)
int getFlag() const
edm::Handle< RPCDigiCollection > rpcDigis
void setFlag(int aFlag)
T const * product() const
Definition: Handle.h:69
edm::Handle< L1MuDTChambThContainer > dtThDigis
void sortRefHitResults(const std::vector< OMTFProcessor::resultsMap > &procResults, std::vector< AlgoMuon > &refHitCleanCands, int charge=0)
Definition: OMTFSorter.cc:131
OMTFinputMaker m_InputMaker
edm::Handle< L1MuDTChambPhContainer > dtPhDigis
const std::vector< OMTFProcessor::resultsMap > & processInput(unsigned int iProcessor, const OMTFinput &aInput)
std::vector< l1t::RegionalMuonCand > candidates(unsigned int iProcessor, l1t::tftype mtfType, const std::vector< AlgoMuon > &algoCands)
Definition: OMTFSorter.cc:157
edm::Handle< CSCCorrelatedLCTDigiCollection > cscDigis
void OMTFReconstruction::loadAndFilterDigis ( const edm::Event iEvent)
private

Definition at line 127 of file OMTFReconstruction.cc.

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

Referenced by reconstruct().

127  {
128  // Filter digis by dropping digis from selected (by cfg.py) subsystems
129  if (!m_Config.getParameter<bool>("dropDTPrimitives")) {
132  }
133  if (!m_Config.getParameter<bool>("dropRPCPrimitives"))
135  if (!m_Config.getParameter<bool>("dropCSCPrimitives"))
137 }
T getParameter(std::string const &) const
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:488
edm::Handle< RPCDigiCollection > rpcDigis
edm::Handle< L1MuDTChambThContainer > dtThDigis
edm::Handle< L1MuDTChambPhContainer > dtPhDigis
edm::ParameterSet m_Config
edm::Handle< CSCCorrelatedLCTDigiCollection > cscDigis
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 99 of file OMTFReconstruction.cc.

References aTopElement, l1GtPatternGenerator_cfi::bx, bxMax, bxMin, HLT_2018_cff::candidates, dumpResultToXML, edm::EventID::event(), getProcessorCandidates(), edm::EventBase::id(), loadAndFilterDigis(), m_OMTFConfig, m_Writer, OMTFConfiguration::nProcessors(), l1t::omtf_neg, l1t::omtf_pos, and XMLConfigWriter::writeEventHeader().

Referenced by L1TMuonOverlapTrackProducer::produce().

100  {
101  loadAndFilterDigis(iEvent);
102 
103  if (dumpResultToXML)
105 
106  std::unique_ptr<l1t::RegionalMuonCandBxCollection> candidates(new l1t::RegionalMuonCandBxCollection);
107  candidates->setBXRange(bxMin, bxMax);
108 
110  for (int bx = bxMin; bx <= bxMax; bx++) {
111  for (unsigned int iProcessor = 0; iProcessor < m_OMTFConfig->nProcessors(); ++iProcessor)
113 
114  for (unsigned int iProcessor = 0; iProcessor < m_OMTFConfig->nProcessors(); ++iProcessor)
116 
117  edm::LogInfo("OMTFReconstruction") << "OMTF: Number of candidates in BX=" << bx << ": " << candidates->size(bx)
118  << std::endl;
119  ;
120  }
121 
122  return candidates;
123 }
EventNumber_t event() const
Definition: EventID.h:40
void getProcessorCandidates(unsigned int iProcessor, l1t::tftype mtfType, int bx, l1t::RegionalMuonCandBxCollection &myCandidates)
OMTFConfiguration * m_OMTFConfig
OMTF objects.
xercesc::DOMElement * aTopElement
unsigned int nProcessors() const
void loadAndFilterDigis(const edm::Event &)
XMLConfigWriter * m_Writer
edm::EventID id() const
Definition: EventBase.h:59
xercesc::DOMElement * writeEventHeader(unsigned int eventId, unsigned int mixedEventId=0)
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 174 of file OMTFReconstruction.cc.

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

Referenced by getProcessorCandidates().

178  {
179  int endcap = (mtfType == l1t::omtf_neg) ? -1 : ((mtfType == l1t::omtf_pos) ? +1 : 0);
180  OmtfName board(iProcessor, endcap);
181 
182  //Write data to XML file
183  if (dumpResultToXML) {
184  xercesc::DOMElement* aProcElement = m_Writer->writeEventData(aTopElement, board, input);
185  for (unsigned int iRefHit = 0; iRefHit < m_OMTFConfig->nTestRefHits(); ++iRefHit) {
187  AlgoMuon algoMuon = m_Sorter.sortRefHitResults(results[iRefHit], 0); //charge=0 means ignore charge
188  if (algoMuon.getPt()) {
189  m_Writer->writeAlgoMuon(aProcElement, iRefHit, algoMuon);
191  for (auto& itKey : results[iRefHit])
192  m_Writer->writeResultsData(aProcElement, iRefHit, itKey.first, itKey.second);
193  }
194  }
195  }
196  for (auto& candMuon : candMuons)
197  m_Writer->writeCandMuon(aProcElement, candMuon);
198  }
199 }
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:48
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
void sortRefHitResults(const std::vector< OMTFProcessor::resultsMap > &procResults, std::vector< AlgoMuon > &refHitCleanCands, int charge=0)
Definition: OMTFSorter.cc:131
int getPt() const
Definition: AlgoMuon.h:41
void writeAlgoMuon(xercesc::DOMElement *aTopElement, unsigned int iRefHit, const AlgoMuon &aMuon)
unsigned int nTestRefHits() const

Member Data Documentation

xercesc::DOMElement* OMTFReconstruction::aTopElement
private

Definition at line 83 of file OMTFReconstruction.h.

Referenced by reconstruct(), and writeResultToXML().

int OMTFReconstruction::bxMax
private

Definition at line 74 of file OMTFReconstruction.h.

Referenced by OMTFReconstruction(), and reconstruct().

int OMTFReconstruction::bxMin
private

Definition at line 74 of file OMTFReconstruction.h.

Referenced by OMTFReconstruction(), and reconstruct().

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

Definition at line 57 of file OMTFReconstruction.h.

Referenced by getProcessorCandidates(), and loadAndFilterDigis().

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

Definition at line 55 of file OMTFReconstruction.h.

Referenced by getProcessorCandidates(), and loadAndFilterDigis().

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

Definition at line 56 of file OMTFReconstruction.h.

Referenced by getProcessorCandidates(), and loadAndFilterDigis().

bool OMTFReconstruction::dumpDetailedResultToXML
private

Definition at line 73 of file OMTFReconstruction.h.

Referenced by OMTFReconstruction(), and writeResultToXML().

bool OMTFReconstruction::dumpResultToXML
private
edm::ParameterSet OMTFReconstruction::m_Config
private

Definition at line 53 of file OMTFReconstruction.h.

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

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

Definition at line 80 of file OMTFReconstruction.h.

Referenced by beginRun(), and getProcessorCandidates().

OMTFinputMaker OMTFReconstruction::m_InputMaker
private

Definition at line 78 of file OMTFReconstruction.h.

Referenced by beginRun(), and getProcessorCandidates().

OMTFProcessor* OMTFReconstruction::m_OMTF
private
OMTFConfiguration* OMTFReconstruction::m_OMTFConfig
private

OMTF objects.

Definition at line 77 of file OMTFReconstruction.h.

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

OMTFConfigMaker* OMTFReconstruction::m_OMTFConfigMaker
private

Definition at line 84 of file OMTFReconstruction.h.

OMTFSorter OMTFReconstruction::m_Sorter
private

Definition at line 79 of file OMTFReconstruction.h.

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

XMLConfigWriter* OMTFReconstruction::m_Writer
private
edm::Handle<RPCDigiCollection> OMTFReconstruction::rpcDigis
private

Definition at line 58 of file OMTFReconstruction.h.

Referenced by getProcessorCandidates(), and loadAndFilterDigis().