CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
OMTFReconstruction.cc
Go to the documentation of this file.
2 
5 
8 
15 
17 
19  m_OMTFConfig(0), m_OMTF(0), aTopElement(0), m_OMTFConfigMaker(0), m_Writer(0){}
23  m_Config(theConfig), m_OMTFConfig(0), m_OMTF(0), aTopElement(0), m_OMTFConfigMaker(0), m_Writer(0) {
24 
25  dumpResultToXML = m_Config.getParameter<bool>("dumpResultToXML");
26  dumpDetailedResultToXML = m_Config.getParameter<bool>("dumpDetailedResultToXML");
27  m_Config.getParameter<std::string>("XMLDumpFileName");
28 }
32 
33  delete m_OMTFConfig;
34  delete m_OMTF;
35 
36  if (m_Writer) delete m_Writer;
37 }
38 
42 
44  m_OMTF = new OMTFProcessor();
45 
46 }
50 
51  if(dumpResultToXML){
52  std::string fName = m_Config.getParameter<std::string>("XMLDumpFileName");
54  }
55 }
59 
60  const L1TMuonOverlapParamsRcd& omtfRcd = iSetup.get<L1TMuonOverlapParamsRcd>();
61 
62  edm::ESHandle<L1TMuonOverlapParams> omtfParamsHandle;
63  omtfRcd.get(omtfParamsHandle);
64 
65  const L1TMuonOverlapParams* omtfParams = omtfParamsHandle.product();
66 
67  if (!omtfParams) {
68  edm::LogError("L1TMuonOverlapTrackProducer") << "Could not retrieve parameters from Event Setup" << std::endl;
69  }
70 
71  m_OMTFConfig->configure(omtfParams);
72  m_OMTF->configure(m_OMTFConfig, omtfParams);
75 
77 
78  if(dumpResultToXML){
80  std::string fName = "OMTF";
82  }
83 }
86 std::auto_ptr<l1t::RegionalMuonCandBxCollection > OMTFReconstruction::reconstruct(const edm::Event& iEvent, const edm::EventSetup& evSetup) {
87 
88  loadAndFilterDigis(iEvent);
89 
91 
92  // NOTE: assuming all is for bx 0
93  int bx = 0;
94  std::auto_ptr<l1t::RegionalMuonCandBxCollection > candidates(new l1t::RegionalMuonCandBxCollection);
95 
97  for(unsigned int iProcessor=0; iProcessor<m_OMTFConfig->nProcessors(); ++iProcessor)
98  getProcessorCandidates(iProcessor, l1t::tftype::omtf_pos, bx, *candidates);
99 
100  for(unsigned int iProcessor=0; iProcessor<m_OMTFConfig->nProcessors(); ++iProcessor)
101  getProcessorCandidates(iProcessor, l1t::tftype::omtf_neg, bx, *candidates);
102 
103  return candidates;
104 }
105 
109 
110  // Filter digis by dropping digis from selected (by cfg.py) subsystems
111  if(!m_Config.getParameter<bool>("dropDTPrimitives")){
114  }
115  if(!m_Config.getParameter<bool>("dropRPCPrimitives")) iEvent.getByLabel(m_Config.getParameter<edm::InputTag>("srcRPC"),rpcDigis);
116  if(!m_Config.getParameter<bool>("dropCSCPrimitives")) iEvent.getByLabel(m_Config.getParameter<edm::InputTag>("srcCSC"),cscDigis);
117 
118 }
119 
122 void OMTFReconstruction::getProcessorCandidates(unsigned int iProcessor, l1t::tftype mtfType, int bx,
123  l1t::RegionalMuonCandBxCollection & OTFCandidates){
124 
126  dtThDigis.product(),
127  cscDigis.product(),
128  rpcDigis.product(),
129  iProcessor, mtfType);
130 
131  const std::vector<OMTFProcessor::resultsMap> & results = m_OMTF->processInput(iProcessor,input);
132 
133  std::vector<AlgoMuon> algoCandidates;
134 
135  m_Sorter.sortRefHitResults(results, algoCandidates);
136  m_GhostBuster.select(algoCandidates);
137  m_Sorter.sortProcessorAndFillCandidates(iProcessor, mtfType, algoCandidates, OTFCandidates, bx);
138 
139  writeResultToXML(iProcessor, input, results);
140 }
143 void OMTFReconstruction::writeResultToXML(unsigned int iProcessor, const OMTFinput &input,
144  const std::vector<OMTFProcessor::resultsMap> & results){
145 
146  //Write data to XML file
147  if(dumpResultToXML){
148  xercesc::DOMElement * aProcElement = m_Writer->writeEventData(aTopElement,iProcessor,input);
149  for(unsigned int iRefHit=0;iRefHit<m_OMTFConfig->nTestRefHits();++iRefHit){
151  AlgoMuon myCand = m_Sorter.sortRefHitResults(results[iRefHit],0);//charge=0 means ignore charge
152  if(myCand.getPt()) {
153  m_Writer->writeCandidateData(aProcElement,iRefHit,myCand);
155  for(auto & itKey: results[iRefHit])
156  m_Writer->writeResultsData(aProcElement, iRefHit, itKey.first,itKey.second);
157  }
158  }
159  }
160  }
161 }
T getParameter(std::string const &) const
EventNumber_t event() const
Definition: EventID.h:41
void getProcessorCandidates(unsigned int iProcessor, l1t::tftype mtfType, int bx, l1t::RegionalMuonCandBxCollection &myCandidates)
bool configure(const OMTFConfiguration *omtfParams, const L1TMuonOverlapParams *omtfPatterns)
Fill GP map with patterns from CondFormats object.
OMTFConfiguration * m_OMTFConfig
OMTF objects.
void sortProcessorAndFillCandidates(unsigned int iProcessor, l1t::tftype mtfType, const std::vector< AlgoMuon > &algoCands, l1t::RegionalMuonCandBxCollection &sortedCands, int bx, int charge=0)
Definition: OMTFSorter.cc:148
void initialiseXMLDocument(const std::string &docName)
void initialize(const edm::EventSetup &es, const OMTFConfiguration *)
xercesc::DOMElement * aTopElement
xercesc::DOMElement * writeEventData(xercesc::DOMElement *aTopElement, unsigned int iProcessor, const OMTFinput &aInput)
unsigned int nPhiBins() const
unsigned int nProcessors() const
void writeResultToXML(unsigned int iProcessor, const OMTFinput &myInput, const std::vector< OMTFProcessor::resultsMap > &myResults)
static std::string const input
Definition: EdmProvDump.cc:44
void loadAndFilterDigis(const edm::Event &)
void setNphiBins(unsigned int phiBins)
Definition: GhostBuster.h:20
void beginRun(edm::Run const &run, edm::EventSetup const &iSetup)
int iEvent
Definition: GenABIO.cc:230
OMTFProcessor * m_OMTF
void writeResultsData(xercesc::DOMElement *aTopElement, unsigned int iRegion, const Key &aKey, const OMTFResult &aResult)
OMTFGhostBuster m_GhostBuster
tuple omtfParams
OMTF ESProducer.
void get(HolderT &iHolder) const
tuple results
Definition: mps_update.py:44
std::auto_ptr< l1t::RegionalMuonCandBxCollection > reconstruct(const edm::Event &, const edm::EventSetup &)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:418
edm::Handle< RPCDigiCollection > rpcDigis
XMLConfigWriter * m_Writer
void configure(const L1TMuonOverlapParams *omtfParams)
T const * product() const
Definition: Handle.h:81
const T & get() const
Definition: EventSetup.h:56
edm::Handle< L1MuDTChambThContainer > dtThDigis
void sortRefHitResults(const std::vector< OMTFProcessor::resultsMap > &procResults, std::vector< AlgoMuon > &refHitCleanCands, int charge=0)
Definition: OMTFSorter.cc:127
OMTFinputMaker m_InputMaker
edm::Handle< L1MuDTChambPhContainer > dtPhDigis
edm::EventID id() const
Definition: EventBase.h:59
const std::vector< OMTFProcessor::resultsMap > & processInput(unsigned int iProcessor, const OMTFinput &aInput)
int getPt() const
Definition: AlgoMuon.h:24
void finaliseXMLDocument(const std::string &fName)
OMTFinput buildInputForProcessor(const L1MuDTChambPhContainer *dtPhDigis, const L1MuDTChambThContainer *dtThDigis, const CSCCorrelatedLCTDigiCollection *cscDigis, const RPCDigiCollection *rpcDigis, unsigned int iProcessor, l1t::tftype type=l1t::tftype::omtf_pos)
Method translating trigger digis into input matrix with global phi coordinates.
xercesc::DOMElement * writeEventHeader(unsigned int eventId, unsigned int mixedEventId=0)
void setNphiBins(unsigned int phiBins)
Definition: OMTFSorter.h:19
edm::ParameterSet m_Config
void select(std::vector< AlgoMuon > &refHitCands, int charge=0)
Definition: GhostBuster.cc:18
unsigned int nTestRefHits() const
void writeCandidateData(xercesc::DOMElement *aTopElement, unsigned int iRefHit, const AlgoMuon &aCand)
edm::Handle< CSCCorrelatedLCTDigiCollection > cscDigis
Definition: Run.h:43