Skip to content

Commit

Permalink
Merge pull request #6 from akalinow/add_fileInPath
Browse files Browse the repository at this point in the history
use edm::FileInPath in path OMTFProcessor<GoldenPatternType>::init for extrapolFactorsFileName
  • Loading branch information
kbunkow committed Nov 3, 2023
2 parents 8b414cc + 7316e1f commit cd53c95
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 27 deletions.
8 changes: 4 additions & 4 deletions L1Trigger/L1TMuonOverlapPhase1/python/simOmtfDigis_cfi.py
Expand Up @@ -18,8 +18,8 @@
dropRPCPrimitives = cms.bool(False),
dropDTPrimitives = cms.bool(False),
dropCSCPrimitives = cms.bool(False),
processorType = cms.string("OMTFProcessor"),
processorType = cms.string("OMTFProcessor"),

#ghostBusterType = cms.string("GhostBusterPreferRefDt"),

#patternsXMLFile = cms.FileInPath("L1Trigger/L1TMuon/data/omtf_config/Patterns_0x00020007.xml")
Expand All @@ -28,6 +28,6 @@
#if commented the default values are 0-0
#-3 to 4 is the range of the OMTF DAQ readout, so should be used e.g. in the DQM data to emulator comparison
bxMin = cms.int32(0),
bxMax = cms.int32(0)
)
bxMax = cms.int32(0),

)
Expand Up @@ -36,8 +36,10 @@
useEndcapStubsRInExtr = cms.bool(False),
useFloatingPointExtrapolation = cms.bool(False),
dtRefHitMinQuality = cms.int32(4),
extrapolFactorsFilename = cms.string("ExtrapolationFactors_simple.xml"),
extrapolFactorsFileName= cms.FileInPath("L1Trigger/L1TMuon/data/omtf_config/ExtrapolationFactors_simple.xml"),
sorterType = cms.string("byLLH"),
ghostBusterType = cms.string("byRefLayer") # byLLH byRefLayer GhostBusterPreferRefDt
ghostBusterType = cms.string("byRefLayer"), # byLLH byRefLayer GhostBusterPreferRefDt
goldenPatternResultFinalizeFunction = cms.int32(10)
)


8 changes: 3 additions & 5 deletions L1Trigger/L1TMuonOverlapPhase1/src/Omtf/GoldenPatternBase.cc
Expand Up @@ -99,12 +99,10 @@ StubResult GoldenPatternBase::process1Layer1RefLayer(unsigned int iRefLayer,
}

if (!selectedStub) {
if (this->myOmtfConfig->isNoHitValueInPdf()) {
PdfValueType pdfVal = this->pdfValue(iLayer, iRefLayer, 0);
PdfValueType pdfVal = 0;
if (this->myOmtfConfig->isNoHitValueInPdf()) pdfVal = this->pdfValue(iLayer, iRefLayer, 0);
return StubResult(pdfVal, false, myOmtfConfig->nPhiBins(), iLayer, selectedStub);
} else {
return StubResult(0, false, myOmtfConfig->nPhiBins(), iLayer, selectedStub); //2018 version
}

}

int pdfMiddle = 1 << (myOmtfConfig->nPdfAddrBits() - 1);
Expand Down
Expand Up @@ -365,7 +365,7 @@ void GoldenPatternResult::finalise10() {
//an effect of that is that some fraction of displaced muons get the quality 8 assigned
//the efficiency difference between quality 8 and 12 seems to be at a level of 1-2%
//but in the uGT menu e.g. the L1_DoubleMu0_Upt6_IP_Min1_Upt4 uses quality >= 0, so should be OK

//hard cut - the phiB of the refHit must fit to the pdf
//but this cut has sometimes side effect: there can be a muon which has has pdfSum = 0 for every pattern,
//then in the OMTFSorter<GoldenPatternType>::sortRefHitResults the first pattern that has FiredLayerCnt >= 3 is chosen
Expand Down
36 changes: 21 additions & 15 deletions L1Trigger/L1TMuonOverlapPhase1/src/Omtf/OMTFProcessor.cc
Expand Up @@ -78,22 +78,22 @@ void OMTFProcessor<GoldenPatternType>::init(const edm::ParameterSet& edmCfg, edm
if (edmCfg.exists("useFloatingPointExtrapolation"))
useFloatingPointExtrapolation = edmCfg.getParameter<bool>("useFloatingPointExtrapolation");

std::string extrapolFactorsFilename;
if (edmCfg.exists("extrapolFactorsFilename"))
extrapolFactorsFilename = edmCfg.getParameter<std::string>("extrapolFactorsFilename");
std::string extrapolFactorsFileName;
if (edmCfg.exists("extrapolFactorsFileName"))
extrapolFactorsFileName = edmCfg.getParameter<edm::FileInPath>("extrapolFactorsFileName").fullPath();

if (this->myOmtfConfig->usePhiBExtrapolationMB1() || this->myOmtfConfig->usePhiBExtrapolationMB2()) {
extrapolFactors.resize(2, std::vector<std::map<int, double> >(this->myOmtfConfig->nLayers()));
extrapolFactorsNorm.resize(2, std::vector<std::map<int, int> >(this->myOmtfConfig->nLayers()));

//when useFloatingPointExtrapolation is true the extrapolFactors are not used,
//all calculations are done in the extrapolateDtPhiBFloatPoint
if (!extrapolFactorsFilename.empty() && !useFloatingPointExtrapolation)
loadExtrapolFactors(extrapolFactorsFilename);
if (!extrapolFactorsFileName.empty() && !useFloatingPointExtrapolation)
loadExtrapolFactors(extrapolFactorsFileName);
}

edm::LogVerbatim("OMTFReconstruction") << "useFloatingPointExtrapolation " << useFloatingPointExtrapolation << std::endl;
edm::LogVerbatim("OMTFReconstruction") << "extrapolFactorsFilename " << extrapolFactorsFilename << std::endl;
edm::LogVerbatim("OMTFReconstruction") << "extrapolFactorsFileName " << extrapolFactorsFileName << std::endl;
}

template <class GoldenPatternType>
Expand Down Expand Up @@ -130,8 +130,7 @@ std::vector<l1t::RegionalMuonCand> OMTFProcessor<GoldenPatternType>::getFinalcan
if (myCand->getPtUnconstr() >= 0) { //empty PtUnconstrained is -1, maybe should be corrected on the source
//the upt has different hardware scale than the pt, the upt unit is 1 GeV
candidate.setHwPtUnconstrained(myCand->getPtUnconstr());
} else
candidate.setHwPtUnconstrained(0);
} else candidate.setHwPtUnconstrained(0);

unsigned int quality = 12;
if (this->myOmtfConfig->fwVersion() <= 6)
Expand Down Expand Up @@ -608,8 +607,8 @@ void OMTFProcessor<GoldenPatternType>::processInput(unsigned int iProcessor,

MuonStubPtrs1D restrictedLayerStubs = this->restrictInput(iProcessor, iRegion, iLayer, aInput);

//LogTrace("l1tOmtfEventPrint")<<__FUNCTION__<<" "<<__LINE__<<" iLayer "<<iLayer<<" iRefLayer "<<aRefHitDef.iRefLayer<<" hits.size "<<restrictedLayerHits.size()<<std::endl;
//LogTrace("l1tOmtfEventPrint")<<"iLayer "<<iLayer<<" refHitNum "<<myOmtfConfig->nTestRefHits()-nTestedRefHits-1<<" iRefHit "<<iRefHit;
//LogTrace("l1tOmtfEventPrint")<<__FUNCTION__<<" "<<__LINE__<<" iLayer "<<iLayer<<" iRefLayer "<<aRefHitDef.iRefLayer<<std::endl;
//LogTrace("l1tOmtfEventPrint")<<"iLayer "<<iLayer<<" iRefHit "<<iRefHit;
//LogTrace("l1tOmtfEventPrint")<<" nTestedRefHits "<<nTestedRefHits<<" aRefHitDef "<<aRefHitDef<<std::endl;

std::vector<int> extrapolatedPhi(restrictedLayerStubs.size(), 0);
Expand All @@ -621,12 +620,15 @@ void OMTFProcessor<GoldenPatternType>::processInput(unsigned int iProcessor,
unsigned int iStub = 0;
for (auto& targetStub : restrictedLayerStubs) {
if (targetStub) {
extrapolatedPhi[iStub] = extrapolateDtPhiB(refStub, targetStub, iLayer, this->myOmtfConfig);

LogTrace("l1tOmtfEventPrint") << "\n"
<< __FUNCTION__ << ":" << __LINE__ << " extrapolating from layer "
<< refLayerLogicNum << " - iRefLayer " << aRefHitDef.iRefLayer << " layer "
<< iLayer << " stub " << targetStub << std::endl;
extrapolatedPhi[iStub] = extrapolateDtPhiB(refStub, targetStub, iLayer, this->myOmtfConfig);

<< refLayerLogicNum << " - iRefLayer " << aRefHitDef.iRefLayer << " to layer "
<< iLayer << " stub " << targetStub
<< " value "<<extrapolatedPhi[iStub]
<< std::endl;

if (this->myOmtfConfig->getDumpResultToXML()) {
auto& extrapolatedPhiTree = procDataTree.add_child("extrapolatedPhi", boost::property_tree::ptree());
extrapolatedPhiTree.add("<xmlattr>.refLayer", refLayerLogicNum);
Expand All @@ -650,7 +652,11 @@ void OMTFProcessor<GoldenPatternType>::processInput(unsigned int iProcessor,
StubResult stubResult =
itGP->process1Layer1RefLayer(aRefHitDef.iRefLayer, iLayer, restrictedLayerStubs, extrapolatedPhi, refStub);

//LogTrace("l1tOmtfEventPrint")<<__FUNCTION__<<":"<<__LINE__<<" layerResult: valid"<<layerResult.valid<<" pdfVal "<<layerResult.pdfVal<<std::endl;
LogTrace("l1tOmtfEventPrint")<<__FUNCTION__<<":"<<__LINE__
<<" layerResult: valid"<<stubResult.getValid()
<<" pdfVal "<<stubResult.getPdfVal()
<<std::endl;

itGP->getResults()[procIndx][iRefHit].setStubResult(iLayer, stubResult);
}
}
Expand Down

0 comments on commit cd53c95

Please sign in to comment.