CMS 3D CMS Logo

OMTFReconstruction.cc
Go to the documentation of this file.
6 
14 
16 
20  : m_Config(theConfig),
21  l1TMuonOverlapParamsToken_(
22  iC.esConsumes<L1TMuonOverlapParams, L1TMuonOverlapParamsRcd, edm::Transition::BeginRun>()),
23  m_OMTFConfig(nullptr),
24  m_InputMaker(iC, false),
25  m_OMTF(nullptr),
26  aTopElement(nullptr),
27  m_OMTFConfigMaker(nullptr),
28  m_Writer(nullptr) {
29  dumpResultToXML = m_Config.getParameter<bool>("dumpResultToXML");
30  dumpDetailedResultToXML = m_Config.getParameter<bool>("dumpDetailedResultToXML");
31  //m_Config.getParameter<std::string>("XMLDumpFileName");
32  bxMin = m_Config.exists("bxMin") ? m_Config.getParameter<int>("bxMin") : 0;
33  bxMax = m_Config.exists("bxMax") ? m_Config.getParameter<int>("bxMax") : 0;
34 }
38  delete m_OMTFConfig;
39  delete m_OMTF;
40 
41  if (m_Writer)
42  delete m_Writer;
43 }
44 
49  m_OMTF = new OMTFProcessor();
50 }
54  if (dumpResultToXML) {
55  std::string fName = m_Config.getParameter<std::string>("XMLDumpFileName");
57  }
58 }
63 
64  if (!omtfParams) {
65  edm::LogError("L1TMuonOverlapTrackProducer") << "Could not retrieve parameters from Event Setup" << std::endl;
66  }
67 
70  //m_GhostBuster.setNphiBins(m_OMTFConfig->nPhiBins());
71 
72  if (m_OMTFConfig->fwVersion() >= 5) {
73  // if(m_Config.exists("ghostBusterType") ) {
74  // if(m_Config.getParameter<std::string>("ghostBusterType") == "GhostBusterPreferRefDt")
76  } else {
77  m_GhostBuster.reset(new GhostBuster());
78  }
79 
82 
84 
85  if (dumpResultToXML) {
87  std::string fName = "OMTF";
89  }
90 }
93 std::unique_ptr<l1t::RegionalMuonCandBxCollection> OMTFReconstruction::reconstruct(const edm::Event& iEvent,
94  const edm::EventSetup&) {
96 
97  if (dumpResultToXML)
99 
100  std::unique_ptr<l1t::RegionalMuonCandBxCollection> candidates(new l1t::RegionalMuonCandBxCollection);
101  candidates->setBXRange(bxMin, bxMax);
102 
104  for (int bx = bxMin; bx <= bxMax; bx++) {
105  for (unsigned int iProcessor = 0; iProcessor < m_OMTFConfig->nProcessors(); ++iProcessor)
107 
108  for (unsigned int iProcessor = 0; iProcessor < m_OMTFConfig->nProcessors(); ++iProcessor)
110 
111  edm::LogInfo("OMTFReconstruction") << "OMTF: Number of candidates in BX=" << bx << ": " << candidates->size(bx)
112  << std::endl;
113  ;
114  }
115 
116  return candidates;
117 }
118 
122  // Filter digis by dropping digis from selected (by cfg.py) subsystems
123  if (!m_Config.getParameter<bool>("dropDTPrimitives")) {
124  iEvent.getByLabel(m_Config.getParameter<edm::InputTag>("srcDTPh"), dtPhDigis);
125  iEvent.getByLabel(m_Config.getParameter<edm::InputTag>("srcDTTh"), dtThDigis);
126  }
127  if (!m_Config.getParameter<bool>("dropRPCPrimitives"))
128  iEvent.getByLabel(m_Config.getParameter<edm::InputTag>("srcRPC"), rpcDigis);
129  if (!m_Config.getParameter<bool>("dropCSCPrimitives"))
130  iEvent.getByLabel(m_Config.getParameter<edm::InputTag>("srcCSC"), cscDigis);
131 }
132 
135 void OMTFReconstruction::getProcessorCandidates(unsigned int iProcessor,
136  l1t::tftype mtfType,
137  int bx,
138  l1t::RegionalMuonCandBxCollection& omtfCandidates) {
141  dtPhDigis.product(), dtThDigis.product(), cscDigis.product(), rpcDigis.product(), iProcessor, mtfType, bx);
142  int flag = m_InputMaker.getFlag();
143 
144  const std::vector<OMTFProcessor::resultsMap>& results = m_OMTF->processInput(iProcessor, input);
145 
146  std::vector<AlgoMuon> algoCandidates;
147 
148  m_Sorter.sortRefHitResults(results, algoCandidates);
149 
150  // perform GB
151  std::vector<AlgoMuon> gbCandidates = m_GhostBuster->select(algoCandidates);
152 
153  // fill RegionalMuonCand colleciton
154  std::vector<l1t::RegionalMuonCand> candMuons = m_Sorter.candidates(iProcessor, mtfType, gbCandidates);
155 
156  //fill outgoing collection
157  for (auto& candMuon : candMuons) {
158  candMuon.setHwQual(candMuon.hwQual() | flag); //FIXME temporary debug fix
159  omtfCandidates.push_back(bx, candMuon);
160  }
161 
162  //dump to XML
163  if (bx == 0)
164  writeResultToXML(iProcessor, mtfType, input, results, candMuons);
165 }
168 void OMTFReconstruction::writeResultToXML(unsigned int iProcessor,
169  l1t::tftype mtfType,
170  const OMTFinput& input,
171  const std::vector<OMTFProcessor::resultsMap>& results,
172  const std::vector<l1t::RegionalMuonCand>& candMuons) {
173  int endcap = (mtfType == l1t::omtf_neg) ? -1 : ((mtfType == l1t::omtf_pos) ? +1 : 0);
174  OmtfName board(iProcessor, endcap);
175 
176  //Write data to XML file
177  if (dumpResultToXML) {
178  xercesc::DOMElement* aProcElement = m_Writer->writeEventData(aTopElement, board, input);
179  for (unsigned int iRefHit = 0; iRefHit < m_OMTFConfig->nTestRefHits(); ++iRefHit) {
181  AlgoMuon algoMuon = m_Sorter.sortRefHitResults(results[iRefHit], 0); //charge=0 means ignore charge
182  if (algoMuon.getPt()) {
183  m_Writer->writeAlgoMuon(aProcElement, iRefHit, algoMuon);
185  for (auto& itKey : results[iRefHit])
186  m_Writer->writeResultsData(aProcElement, iRefHit, itKey.first, itKey.second);
187  }
188  }
189  }
190  for (auto& candMuon : candMuons)
191  m_Writer->writeCandMuon(aProcElement, candMuon);
192  }
193 }
OMTFReconstruction::reconstruct
std::unique_ptr< l1t::RegionalMuonCandBxCollection > reconstruct(const edm::Event &, const edm::EventSetup &)
Definition: OMTFReconstruction.cc:93
L1TMuonOverlapParamsRcd
Definition: L1TMuonOverlapParamsRcd.h:23
fakeOmtfParams_cff.omtfParams
omtfParams
OMTF ESProducer.
Definition: fakeOmtfParams_cff.py:11
OMTFReconstruction::m_OMTFConfig
OMTFConfiguration * m_OMTFConfig
OMTF objects.
Definition: OMTFReconstruction.h:78
input
static const std::string input
Definition: EdmProvDump.cc:48
MessageLogger.h
funct::false
false
Definition: Factorize.h:34
XMLConfigWriter::writeEventData
xercesc::DOMElement * writeEventData(xercesc::DOMElement *aTopElement, const OmtfName &board, const OMTFinput &aInput)
Definition: XMLConfigWriter.cc:168
OMTFReconstruction::m_OMTF
OMTFProcessor * m_OMTF
Definition: OMTFReconstruction.h:82
edm::Handle::product
T const * product() const
Definition: Handle.h:70
OMTFProcessor.h
OmtfName
Definition: OmtfName.h:9
l1t::omtf_pos
Definition: RegionalMuonCandFwd.h:8
l1t::tftype
tftype
Definition: RegionalMuonCandFwd.h:8
OMTFReconstruction::loadAndFilterDigis
void loadAndFilterDigis(const edm::Event &)
Definition: OMTFReconstruction.cc:121
edm::Run
Definition: Run.h:45
OMTFReconstruction::m_GhostBuster
std::unique_ptr< IGhostBuster > m_GhostBuster
Definition: OMTFReconstruction.h:81
edm
HLT enums.
Definition: AlignableModifier.h:19
OMTFReconstruction::m_Sorter
OMTFSorter m_Sorter
Definition: OMTFReconstruction.h:80
edm::LogInfo
Definition: MessageLogger.h:254
l1GtPatternGenerator_cfi.bx
bx
Definition: l1GtPatternGenerator_cfi.py:18
OMTFReconstruction::rpcDigis
edm::Handle< RPCDigiCollection > rpcDigis
Definition: OMTFReconstruction.h:57
OMTFReconstruction::~OMTFReconstruction
~OMTFReconstruction()
Definition: OMTFReconstruction.cc:37
bookConverter.results
results
Definition: bookConverter.py:144
AlgoMuon::getPt
int getPt() const
Definition: AlgoMuon.h:41
OMTFConfiguration
Definition: OMTFConfiguration.h:44
OMTFConfiguration::fwVersion
unsigned int fwVersion() const
Definition: OMTFConfiguration.h:81
makeMuonMisalignmentScenario.endcap
endcap
Definition: makeMuonMisalignmentScenario.py:320
OMTFConfiguration::nPhiBins
unsigned int nPhiBins() const
Definition: OMTFConfiguration.h:93
GhostBusterPreferRefDt.h
RPCConst.h
OMTFReconstruction::getProcessorCandidates
void getProcessorCandidates(unsigned int iProcessor, l1t::tftype mtfType, int bx, l1t::RegionalMuonCandBxCollection &myCandidates)
Definition: OMTFReconstruction.cc:135
OMTFSorter::sortRefHitResults
void sortRefHitResults(const std::vector< OMTFProcessor::resultsMap > &procResults, std::vector< AlgoMuon > &refHitCleanCands, int charge=0)
Definition: OMTFSorter.cc:131
OMTFReconstruction::bxMin
int bxMin
Definition: OMTFReconstruction.h:75
MainPageGenerator.fName
fName
Definition: MainPageGenerator.py:301
BXVector< RegionalMuonCand >
OMTFConfiguration.h
XMLConfigWriter::initialiseXMLDocument
void initialiseXMLDocument(const std::string &docName)
Definition: XMLConfigWriter.cc:98
OMTFReconstruction::l1TMuonOverlapParamsToken_
edm::ESGetToken< L1TMuonOverlapParams, L1TMuonOverlapParamsRcd > l1TMuonOverlapParamsToken_
Definition: OMTFReconstruction.h:59
OMTFSorter::candidates
std::vector< l1t::RegionalMuonCand > candidates(unsigned int iProcessor, l1t::tftype mtfType, const std::vector< AlgoMuon > &algoCands)
Definition: OMTFSorter.cc:157
GhostBuster
Definition: GhostBuster.h:15
OMTFSorter::setNphiBins
void setNphiBins(unsigned int phiBins)
Definition: OMTFSorter.h:20
OMTFProcessor
Definition: OMTFProcessor.h:19
OmtfName.h
OMTFReconstruction::m_Writer
XMLConfigWriter * m_Writer
Definition: OMTFReconstruction.h:86
OMTFReconstruction::cscDigis
edm::Handle< CSCCorrelatedLCTDigiCollection > cscDigis
Definition: OMTFReconstruction.h:56
L1TMuonOverlapParams
Definition: L1TMuonOverlapParams.h:14
OMTFReconstruction::dumpResultToXML
bool dumpResultToXML
Definition: OMTFReconstruction.h:74
OMTFReconstruction::beginJob
void beginJob()
Definition: OMTFReconstruction.cc:47
Transition.h
XMLConfigWriter::finaliseXMLDocument
void finaliseXMLDocument(const std::string &fName)
Definition: XMLConfigWriter.cc:114
XMLConfigWriter::writeResultsData
void writeResultsData(xercesc::DOMElement *aTopElement, unsigned int iRegion, const Key &aKey, const OMTFResult &aResult)
Definition: XMLConfigWriter.cc:305
AlgoMuon
Definition: AlgoMuon.h:6
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
OMTFReconstruction.h
edm::ParameterSet::exists
bool exists(std::string const &parameterName) const
checks if a parameter exists
Definition: ParameterSet.cc:674
OMTFinputMaker::getFlag
int getFlag() const
Definition: OMTFinputMaker.h:37
edm::ParameterSet
Definition: ParameterSet.h:36
edm::Transition
Transition
Definition: Transition.h:12
edm::LogError
Definition: MessageLogger.h:183
Event.h
OMTFConfiguration::configure
void configure(const L1TMuonOverlapParams *omtfParams)
Definition: OMTFConfiguration.cc:49
OMTFReconstruction::endJob
void endJob()
Definition: OMTFReconstruction.cc:53
iEvent
int iEvent
Definition: GenABIO.cc:224
OMTFReconstruction::dumpDetailedResultToXML
bool dumpDetailedResultToXML
Definition: OMTFReconstruction.h:74
XMLConfigWriter::writeEventHeader
xercesc::DOMElement * writeEventHeader(unsigned int eventId, unsigned int mixedEventId=0)
Definition: XMLConfigWriter.cc:139
edm::EventSetup
Definition: EventSetup.h:57
OMTFinputMaker::buildInputForProcessor
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.
Definition: OMTFinputMaker.cc:383
OMTFinputMaker::setFlag
void setFlag(int aFlag)
Definition: OMTFinputMaker.h:36
OMTFConfiguration::nTestRefHits
unsigned int nTestRefHits() const
Definition: OMTFConfiguration.h:95
OMTFReconstruction::writeResultToXML
void writeResultToXML(unsigned int iProcessor, l1t::tftype mtfType, const OMTFinput &myInput, const std::vector< OMTFProcessor::resultsMap > &myResults, const std::vector< l1t::RegionalMuonCand > &candMuons)
Definition: OMTFReconstruction.cc:168
OMTFReconstruction::m_InputMaker
OMTFinputMaker m_InputMaker
Definition: OMTFReconstruction.h:79
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:113
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
OMTFConfiguration::nProcessors
unsigned int nProcessors() const
Definition: OMTFConfiguration.h:96
OMTFReconstruction::m_Config
edm::ParameterSet m_Config
Definition: OMTFReconstruction.h:52
XMLConfigWriter::writeCandMuon
void writeCandMuon(xercesc::DOMElement *aTopElement, const l1t::RegionalMuonCand &aCand)
Definition: XMLConfigWriter.cc:260
OMTFProcessor::configure
bool configure(const OMTFConfiguration *omtfParams, const L1TMuonOverlapParams *omtfPatterns)
Fill GP map with patterns from CondFormats object.
Definition: OMTFProcessor.cc:36
HLT_2018_cff.candidates
candidates
Definition: HLT_2018_cff.py:53513
XMLConfigWriter.h
OMTFProcessor::processInput
const std::vector< OMTFProcessor::resultsMap > & processInput(unsigned int iProcessor, const OMTFinput &aInput)
Definition: OMTFProcessor.cc:210
OMTFinputMaker::initialize
void initialize(const edm::EventSetup &, const OMTFConfiguration *)
Definition: OMTFinputMaker.cc:24
EventSetup.h
OMTFReconstruction::aTopElement
xercesc::DOMElement * aTopElement
Definition: OMTFReconstruction.h:84
OMTFReconstruction::OMTFReconstruction
OMTFReconstruction(const edm::ParameterSet &, edm::ConsumesCollector &&)
Definition: OMTFReconstruction.cc:19
OMTFReconstruction::dtPhDigis
edm::Handle< L1MuDTChambPhContainer > dtPhDigis
Definition: OMTFReconstruction.h:54
OMTFSorter::initialize
void initialize(const OMTFConfiguration *cfg)
Definition: OMTFSorter.h:19
OMTFReconstruction::beginRun
void beginRun(edm::Run const &, edm::EventSetup const &)
Definition: OMTFReconstruction.cc:61
ConsumesCollector.h
OMTFReconstruction::dtThDigis
edm::Handle< L1MuDTChambThContainer > dtThDigis
Definition: OMTFReconstruction.h:55
GhostBusterPreferRefDt
Definition: GhostBusterPreferRefDt.h:16
XMLConfigWriter::writeAlgoMuon
void writeAlgoMuon(xercesc::DOMElement *aTopElement, unsigned int iRefHit, const AlgoMuon &aMuon)
Definition: XMLConfigWriter.cc:219
OMTFinput.h
edm::Event
Definition: Event.h:73
OMTFinput
Definition: OMTFinput.h:11
l1t::omtf_neg
Definition: RegionalMuonCandFwd.h:8
BXVector::push_back
void push_back(int bx, T object)
edm::InputTag
Definition: InputTag.h:15
XMLConfigWriter
Definition: XMLConfigWriter.h:28
edm::ConsumesCollector
Definition: ConsumesCollector.h:39
OMTFReconstruction::bxMax
int bxMax
Definition: OMTFReconstruction.h:75
RemoveAddSevLevel.flag
flag
Definition: RemoveAddSevLevel.py:116