CMS 3D CMS Logo

OMTFReconstruction.cc
Go to the documentation of this file.
1 #include <memory>
2 
8 
16 
18 
22  : m_Config(theConfig),
23  l1TMuonOverlapParamsToken_(
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 }
40  delete m_OMTFConfig;
41  delete m_OMTF;
42 
43  if (m_Writer)
44  delete m_Writer;
45 }
46 
51  m_OMTF = new OMTFProcessor();
52 }
56  if (dumpResultToXML) {
57  std::string fName = m_Config.getParameter<std::string>("XMLDumpFileName");
59  }
60 }
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 }
95 std::unique_ptr<l1t::RegionalMuonCandBxCollection> OMTFReconstruction::reconstruct(const edm::Event& iEvent,
96  const edm::EventSetup&) {
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 }
120 
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 }
134 
137 void OMTFReconstruction::getProcessorCandidates(unsigned int iProcessor,
138  l1t::tftype mtfType,
139  int bx,
140  l1t::RegionalMuonCandBxCollection& omtfCandidates) {
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 }
170 void OMTFReconstruction::writeResultToXML(unsigned int iProcessor,
171  l1t::tftype mtfType,
172  const OMTFinput& input,
173  const std::vector<OMTFProcessor::resultsMap>& results,
174  const std::vector<l1t::RegionalMuonCand>& candMuons) {
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 }
OMTFReconstruction::reconstruct
std::unique_ptr< l1t::RegionalMuonCandBxCollection > reconstruct(const edm::Event &, const edm::EventSetup &)
Definition: OMTFReconstruction.cc:95
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:29
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:123
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
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:39
bookConverter.results
results
Definition: bookConverter.py:144
AlgoMuon::getPt
int getPt() const
Definition: AlgoMuon.h:41
OMTFConfiguration
Definition: OMTFConfiguration.h:44
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
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:137
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
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:49
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
OMTFReconstruction.h
edm::ParameterSet::exists
bool exists(std::string const &parameterName) const
checks if a parameter exists
Definition: ParameterSet.cc:681
OMTFinputMaker::getFlag
int getFlag() const
Definition: OMTFinputMaker.h:37
edm::ParameterSet
Definition: ParameterSet.h:47
edm::Transition
Transition
Definition: Transition.h:12
Event.h
OMTFConfiguration::configure
void configure(const L1TMuonOverlapParams *omtfParams)
Definition: OMTFConfiguration.cc:49
OMTFReconstruction::endJob
void endJob()
Definition: OMTFReconstruction.cc:55
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:58
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
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
OMTFinputMaker::setFlag
void setFlag(int aFlag)
Definition: OMTFinputMaker.h:36
OMTFConfiguration::nTestRefHits
unsigned int nTestRefHits() const
Definition: OMTFConfiguration.h:95
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
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:170
OMTFReconstruction::m_InputMaker
OMTFinputMaker m_InputMaker
Definition: OMTFReconstruction.h:79
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:127
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_FULL_cff.candidates
candidates
Definition: HLT_FULL_cff.py:55017
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
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
OMTFReconstruction::aTopElement
xercesc::DOMElement * aTopElement
Definition: OMTFReconstruction.h:84
OMTFReconstruction::OMTFReconstruction
OMTFReconstruction(const edm::ParameterSet &, edm::ConsumesCollector &&)
Definition: OMTFReconstruction.cc:21
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:63
ConsumesCollector.h
OMTFReconstruction::dtThDigis
edm::Handle< L1MuDTChambThContainer > dtThDigis
Definition: OMTFReconstruction.h:55
XMLConfigWriter::writeAlgoMuon
void writeAlgoMuon(xercesc::DOMElement *aTopElement, unsigned int iRefHit, const AlgoMuon &aMuon)
Definition: XMLConfigWriter.cc:219
OMTFinput.h
DeDxTools::esConsumes
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
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:45
OMTFReconstruction::bxMax
int bxMax
Definition: OMTFReconstruction.h:75
RemoveAddSevLevel.flag
flag
Definition: RemoveAddSevLevel.py:117