CMS 3D CMS Logo

OmtfEmulation.cc
Go to the documentation of this file.
1 /*
2  * OmtfEmulation.cpp
3  *
4  * Created on: May 20, 2020
5  * Author: kbunkow
6  */
7 
8 #include <memory>
9 
13 
15 
16 #include <memory>
17 
19  MuStubsInputTokens& muStubsInputTokens,
20  edm::EDGetTokenT<L1Phase2MuDTPhContainer> inputTokenDTPhPhase2)
21  : OMTFReconstruction(edmParameterSet, muStubsInputTokens), inputTokenDTPhPhase2(inputTokenDTPhPhase2) {}
22 
24  if (edmParameterSet.exists("usePhase2DTPrimitives") && edmParameterSet.getParameter<bool>("usePhase2DTPrimitives")) {
25  inputMaker = std::make_unique<InputMakerPhase2>(edmParameterSet,
28  omtfConfig.get(),
29  std::make_unique<OmtfPhase2AngleConverter>());
30  } else {
31  inputMaker = std::make_unique<OMTFinputMaker>(
32  edmParameterSet, muStubsInputTokens, omtfConfig.get(), std::make_unique<OmtfAngleConverter>());
33  }
34 }
35 
36 void OmtfEmulation::addObservers(const MuonGeometryTokens& muonGeometryTokens,
39  if (observers.empty()) { //assuring it is done only at the first run
40  OMTFReconstruction::addObservers(muonGeometryTokens, magneticFieldEsToken, propagatorEsToken);
41  /* if(edmParameterSet.exists("patternsPtAssignment") && edmParameterSet.getParameter<bool>("patternsPtAssignment")) {
42  //std::string rootFileName = edmParameterSet.getParameter<std::string>("dumpHitsFileName");
43  .emplace_back(std::make_unique<PatternsPtAssignment>(edmParameterSet, omtfConfig.get(), omtfProcGoldenPat->getPatterns(), ""));
44  }*/
45  }
46 
47  if (edmParameterSet.exists("neuralNetworkFile") && !ptAssignment) {
48  edm::LogImportant("OMTFReconstruction") << "constructing PtAssignmentNNRegression" << std::endl;
49  std::string neuralNetworkFile = edmParameterSet.getParameter<edm::FileInPath>("neuralNetworkFile").fullPath();
50  ptAssignment = std::make_unique<PtAssignmentNNRegression>(edmParameterSet, omtfConfig.get(), neuralNetworkFile);
51  }
52 
53  auto omtfProcGoldenPat = dynamic_cast<OMTFProcessor<GoldenPattern>*>(omtfProc.get());
54  if (omtfProcGoldenPat) {
55  omtfProcGoldenPat->setPtAssignment(ptAssignment.get());
56  //omtfProcGoldenPat can be constructed from scratch each run, so ptAssignment is set herer every run
57  }
58 }
virtual void setPtAssignment(PtAssignmentBase *ptAssignment)
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)
unique_ptr< OMTFinputMaker > inputMaker
std::vector< std::unique_ptr< IOMTFEmulationObserver > > observers
MuStubsInputTokens & muStubsInputTokens
Log< level::Error, true > LogImportant
unique_ptr< OMTFConfiguration > omtfConfig
edm::ParameterSet edmParameterSet
unique_ptr< IProcessorEmulator > omtfProc
unique_ptr< PtAssignmentBase > ptAssignment
Definition: OmtfEmulation.h:33
void addObservers(const MuonGeometryTokens &muonGeometryTokens, const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > &magneticFieldEsToken, const edm::ESGetToken< Propagator, TrackingComponentsRecord > &propagatorEsToken) override
OmtfEmulation(const edm::ParameterSet &edmParameterSet, MuStubsInputTokens &muStubsInputTokens, edm::EDGetTokenT< L1Phase2MuDTPhContainer > inputTokenDTPhPhase2)
edm::EDGetTokenT< L1Phase2MuDTPhContainer > inputTokenDTPhPhase2
Definition: OmtfEmulation.h:31