New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updates for HCAL online TPG LUT and Trigger keys #28930
Changes from 8 commits
7a55b11
ffa59ca
a6d95c7
d4e4a4a
f39b14c
395bd2c
03d8981
a292992
a52fafd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,7 @@ using namespace std; | |
XERCES_CPP_NAMESPACE_USE | ||
|
||
LutXml::Config::_Config() { | ||
infotype = "LUT"; | ||
ieta = -1000; | ||
iphi = -1000; | ||
depth = -1; | ||
|
@@ -81,6 +82,7 @@ void LutXml::addLut(LutXml::Config &_config, XMLDOMBlock *checksums_xml) { | |
brickElem = document->createElement(XMLProcessor::_toXMLCh("CFGBrick")); | ||
rootElem->appendChild(brickElem); | ||
|
||
addParameter("INFOTYPE", "string", _config.infotype); | ||
addParameter("CREATIONTAG", "string", _config.creationtag); | ||
addParameter("CREATIONSTAMP", "string", _config.creationstamp); | ||
addParameter("FORMATREVISION", "string", _config.formatrevision); | ||
|
@@ -296,37 +298,27 @@ int LutXml::test_access(std::string filename) { | |
return 0; | ||
} | ||
|
||
HcalSubdetector LutXml::subdet_from_crate(int crate_, int eta, int depth) { | ||
HcalSubdetector result; | ||
// HBHE: 0,1,4,5,10,11,14,15,17 | ||
// HF: 2,9,12 | ||
// HO: 3,6,7,13 | ||
HcalSubdetector LutXml::subdet_from_crate(int crate_, int slot, int fiber) { | ||
// HBHE: 0,1,4,5,10,11,14,15,17 (+20) | ||
// HF: 2,9,12 (+20) | ||
// HO: 3,6,7,13,18 (+20) | ||
int crate = crate_ < 20 ? crate_ : crate_ - 20; | ||
|
||
if (crate == 2 || crate == 9 || crate == 12) | ||
result = HcalForward; | ||
else if (crate == 3 || crate == 6 || crate == 7 || crate == 13) | ||
result = HcalOuter; | ||
return HcalForward; | ||
else if (crate == 3 || crate == 6 || crate == 7 || crate == 13 || crate == 18) | ||
return HcalOuter; | ||
else if (crate == 0 || crate == 1 || crate == 4 || crate == 5 || crate == 10 || crate == 11 || crate == 14 || | ||
crate == 15 || crate == 17) { | ||
if (eta < 16) | ||
result = HcalBarrel; | ||
else if (eta > 16) | ||
result = HcalEndcap; | ||
else if (eta == 16 && depth < 3) | ||
result = HcalBarrel; | ||
else if (eta == 16 && depth >= 3) | ||
result = HcalEndcap; | ||
else { | ||
edm::LogError("LutXml") << "Impossible to determine HCAL subdetector!!!"; | ||
exit(-1); | ||
} | ||
} else { | ||
edm::LogError("LutXml") << "Impossible to determine HCAL subdetector!!!"; | ||
exit(-1); | ||
if (slot % 3 == 1) | ||
return HcalBarrel; | ||
else if (slot % 3 == 0) | ||
return HcalEndcap; | ||
else if (fiber < 12) | ||
return HcalBarrel; | ||
else | ||
return HcalEndcap; | ||
} | ||
|
||
return result; | ||
return HcalOther; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is HcalOther being used here? Doesn't HcalOther correspond to calibration channels, for which there is no sensible definition of a trigger tower sum? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. in this case it's just anything Other than normal channel. It should not normally get to this. Changed to HcalEmpty and added a warning. |
||
} | ||
|
||
int LutXml::a_to_i(char *inbuf) { | ||
|
@@ -357,6 +349,8 @@ int LutXml::create_lut_map(void) { | |
int iphi = -99; | ||
int depth = -99; | ||
int crate = -99; | ||
int slot = -99; | ||
int fiber = -99; | ||
int lut_type = -99; | ||
int slb = -99; | ||
HcalSubdetector subdet; | ||
|
@@ -371,12 +365,16 @@ int LutXml::create_lut_map(void) { | |
depth = a_to_i(XMLString::transcode(aPar->getFirstChild()->getNodeValue())); | ||
if (strcmp(aName, "CRATE") == 0) | ||
crate = a_to_i(XMLString::transcode(aPar->getFirstChild()->getNodeValue())); | ||
if (strcmp(aName, "SLOT") == 0) | ||
slot = a_to_i(XMLString::transcode(aPar->getFirstChild()->getNodeValue())); | ||
if (strcmp(aName, "FIBER") == 0) | ||
fiber = a_to_i(XMLString::transcode(aPar->getFirstChild()->getNodeValue())); | ||
if (strcmp(aName, "LUT_TYPE") == 0) | ||
lut_type = a_to_i(XMLString::transcode(aPar->getFirstChild()->getNodeValue())); | ||
if (strcmp(aName, "SLB") == 0) | ||
slb = a_to_i(XMLString::transcode(aPar->getFirstChild()->getNodeValue())); | ||
} | ||
subdet = subdet_from_crate(crate, abs(ieta), depth); | ||
subdet = subdet_from_crate(crate, slot, fiber); | ||
DOMElement *_data = (DOMElement *)(aBrick->getElementsByTagName(XMLString::transcode("Data"))->item(0)); | ||
char *_str = XMLString::transcode(_data->getFirstChild()->getNodeValue()); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,27 @@ | ||
#!/bin/bash | ||
|
||
dumpHelpAndExit(){ | ||
cat << EOF | ||
|
||
examples: | ||
./genLUT.sh dumpAll card=cardPhysics.sh | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add a sample There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. added a skeleton file |
||
./genLUT.sh generate card=cardPhysics.sh | ||
./genLUT.sh diff conditions/newtag/newtag.xml conditions/oldtag/oldtag.xml | ||
./genLUT.sh validate card=cardPhysics.sh | ||
|
||
EOF | ||
exit 0 | ||
} | ||
|
||
FullPath=`pwd -P` | ||
BaseDir=${FullPath#${CMSSW_BASE}/src/} | ||
CondDir=conditions | ||
templatefile=template.py | ||
|
||
inputConditions=(ElectronicsMap LutMetadata LUTCorrs QIETypes QIEData SiPMParameters TPParameters TPChannelParameters ChannelQuality Gains Pedestals RespCorrs L1TriggerObjects) | ||
|
||
|
||
|
||
CheckParameter(){ | ||
if [[ -z ${!1} ]] | ||
then | ||
|
@@ -26,11 +43,6 @@ CheckFile(){ | |
### | ||
|
||
cmd=$1 | ||
if [[ -z $cmd ]] | ||
then | ||
echo "ERROR: no command provided" | ||
exit 1 | ||
fi | ||
|
||
echo ">>>>>>>>>>>>>>>>> genLUT::$cmd <<<<<<<<<<<<<<<<<<<<<" | ||
for var in "$@" | ||
|
@@ -49,11 +61,11 @@ done | |
### Run | ||
### | ||
|
||
if [[ "$cmd" == "dump" ]] | ||
then | ||
|
||
dump(){ | ||
CheckParameter record | ||
CheckParameter run | ||
CheckParameter GT | ||
CheckParameter Run | ||
CheckParameter GlobalTag | ||
|
||
dumpCmd="cmsRun $CMSSW_RELEASE_BASE/src/CondTools/Hcal/test/runDumpHcalCond_cfg.py geometry=DB prefix=""" | ||
|
||
|
@@ -64,62 +76,75 @@ then | |
|
||
if [ ! -z $tag ] | ||
then | ||
if ! $dumpCmd dumplist=$record run=$run globaltag=$GT frontierloc=$frontier frontierlist=Hcal${record}Rcd:$tag | ||
if ! $dumpCmd dumplist=$record run=$Run globaltag=$GlobalTag frontierloc=$frontier frontierlist=Hcal${record}Rcd:$tag | ||
then | ||
exit 1 | ||
fi | ||
else | ||
if ! $dumpCmd dumplist=$record run=$run globaltag=$GT | ||
if ! $dumpCmd dumplist=$record run=$Run globaltag=$GlobalTag | ||
then | ||
exit 1 | ||
fi | ||
fi | ||
|
||
mkdir -p $CondDir/$record | ||
mv ${record}_Run$run.txt $CondDir/$record/. | ||
mv ${record}_Run$Run.txt $CondDir/$record/. | ||
} | ||
|
||
if [[ "$cmd" == "dump" ]] | ||
then | ||
dump | ||
|
||
elif [[ "$cmd" == "dumpAll" ]] | ||
then | ||
CheckParameter card | ||
CheckFile $card | ||
source $card | ||
for i in ${inputConditions[@]}; do | ||
record=$i | ||
tag=${!i} | ||
dump | ||
done | ||
|
||
|
||
elif [[ "$cmd" == "generate" ]] | ||
then | ||
CheckParameter tag | ||
CheckParameter GT | ||
CheckParameter run | ||
CheckParameter HO_master_file | ||
CheckParameter comment | ||
CheckParameter card | ||
CheckFile $card | ||
source $card | ||
|
||
CheckFile $HO_master_file | ||
CheckFile $HOAsciiInput | ||
|
||
rm -rf $CondDir/$tag | ||
rm -rf $CondDir/$Tag | ||
|
||
echo "genLUT.sh::generate: Preparing the configuration file..." | ||
|
||
sed -e "s#__LUTtag__#$tag#g" \ | ||
-e "s#__RUN__#$run#g" \ | ||
sed -e "s#__LUTtag__#$Tag#g" \ | ||
-e "s#__RUN__#$Run#g" \ | ||
-e "s#__CONDDIR__#$BaseDir/$CondDir#g" \ | ||
-e "s#__GlobalTag__#$GT#g" \ | ||
-e "s#__HO_master_file__#$HO_master_file#g" \ | ||
$templatefile > $tag.py | ||
-e "s#__GlobalTag__#$GlobalTag#g" \ | ||
-e "s#__HO_master_file__#$HOAsciiInput#g" \ | ||
$templatefile > $Tag.py | ||
|
||
echo "genLUT.sh::generate: Running..." | ||
|
||
if ! cmsRun $tag.py | ||
if ! cmsRun $Tag.py | ||
then | ||
echo "ERROR: LUT Generation has failed. Exiting..." | ||
exit 1 | ||
fi | ||
|
||
echo "genLUT.sh::generate: Wrapping up..." | ||
|
||
for file in $tag*.xml; do mv $file $file.dat; done | ||
for file in $Tag*.xml; do mv $file $file.dat; done | ||
|
||
echo "-------------------" | ||
echo "-------------------" | ||
echo "Creating LUT Loader..." | ||
echo | ||
timestamp=$(date +%s) | ||
flist=$(ls $tag*_[0-9]*.xml.dat | xargs) | ||
if ! hcalLUT create-lut-loader outputFile="$flist" tag="$tag" storePrepend="$comment" | ||
flist=$(ls $Tag*_[0-9]*.xml.dat | xargs) | ||
if ! hcalLUT create-lut-loader outputFile="$flist" tag="$Tag" storePrepend="$description" | ||
then | ||
echo "ERROR: LUT loader generation has failed. Exiting..." | ||
exit 1 | ||
|
@@ -130,32 +155,62 @@ then | |
echo "-------------------" | ||
echo | ||
|
||
zip -j $tag.zip *$tag*.{xml,dat} | ||
zip -j $Tag.zip *$Tag*.{xml,dat} | ||
|
||
mkdir -p $CondDir/$tag | ||
mkdir -p $CondDir/$tag/Deploy | ||
mv $tag.zip $tag.py Gen_L1TriggerObjects_$tag.txt $CondDir/$tag/Deploy | ||
mkdir -p $CondDir/$Tag | ||
mkdir -p $CondDir/$Tag/Deploy | ||
mv $Tag.zip $Tag.py Gen_L1TriggerObjects_$Tag.txt $CondDir/$Tag/Deploy | ||
|
||
mkdir -p $CondDir/$tag/Debug | ||
hcalLUT merge storePrepend="$flist" outputFile=$CondDir/$tag/${tag}.xml | ||
mv *$tag*.{xml,dat} $CondDir/$tag/Debug | ||
mkdir -p $CondDir/$Tag/Debug | ||
hcalLUT merge storePrepend="$flist" outputFile=$CondDir/$Tag/${Tag}.xml | ||
mv *$Tag*.{xml,dat} $CondDir/$Tag/Debug | ||
|
||
echo "-------------------" | ||
echo "-------------------" | ||
echo "Creating Trigger Key..." | ||
echo | ||
|
||
dd=$(date +"%Y-%m-%d %H:%M:%S") | ||
individualInputTags="" | ||
for i in ${inputConditions[@]}; do | ||
t=$i | ||
v=${!t} | ||
if [[ -n $v ]]; then | ||
individualInputTags="""$individualInputTags | ||
<Parameter type=\"string\" name=\"$t\">$v</Parameter>""" | ||
fi | ||
done | ||
|
||
echo """<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\" ?> | ||
<CFGBrickSet> | ||
<CFGBrick> | ||
<Parameter type=\"string\" name=\"INFOTYPE\">TRIGGERKEY</Parameter> | ||
<Parameter type=\"string\" name=\"CREATIONSTAMP\">$dd</Parameter> | ||
<Parameter type=\"string\" name=\"CREATIONTAG\">$Tag</Parameter> | ||
<Parameter type=\"string\" name=\"HCAL_LUT_TAG\">$Tag</Parameter> | ||
<Parameter type=\"boolean\" name=\"applyO2O\">$applyO2O</Parameter> | ||
<Parameter type=\"string\" name=\"CMSSW\">$CMSSW_VERSION</Parameter> | ||
<Parameter type=\"string\" name=\"InputRun\">$Run</Parameter> | ||
<Parameter type=\"string\" name=\"GlobalTag\">$GlobalTag</Parameter>$individualInputTags | ||
<Data elements=\"1\">1</Data> | ||
</CFGBrick> | ||
</CFGBrickSet>""" > $CondDir/$Tag/tk_$Tag.xml | ||
|
||
elif [[ "$cmd" == "validate" ]] | ||
then | ||
CheckParameter GT | ||
CheckParameter run | ||
CheckParameter tags | ||
CheckParameter pedestals | ||
CheckParameter gains | ||
CheckParameter respcorrs | ||
CheckParameter quality | ||
|
||
ptags=(${tags//,/ }) | ||
mkdir -p $CondDir/${ptags[1]}/Figures | ||
cmsRun PlotLUT.py globaltag=$GT run=$run \ | ||
inputDir=$BaseDir/$CondDir plotsDir=$CondDir/${ptags[1]}/Figures/ \ | ||
tags=$tags gains=$gains respcorrs=$respcorrs pedestals=$pedestals quality=$quality | ||
CheckParameter card | ||
CheckFile $card | ||
source $card | ||
|
||
echo "Comparing input and re-generated L1TriggerObjects files" | ||
diff $CondDir/L1TriggerObjects/L1TriggerObjects_Run$Run.txt $CondDir/$Tag/Deploy/Gen_L1TriggerObjects_$Tag.txt | ||
|
||
#parse LUT xml file and check that changes are consistent with changes in input conditions | ||
runs=$OldRun,$Run | ||
mkdir -p $CondDir/$Tag/Figures | ||
cmsRun PlotLUT.py globaltag=$GlobalTag run=$Run \ | ||
inputDir=$BaseDir/$CondDir plotsDir=$CondDir/$Tag/Figures/ \ | ||
tags=$OldTag,$Tag gains=$runs respcorrs=$runs pedestals=$runs quality=$runs | ||
|
||
elif [ "$cmd" == "upload" ] | ||
then | ||
|
@@ -188,14 +243,8 @@ then | |
|
||
hcalLUT diff inputFiles=$BaseDir/$2,$BaseDir/$3 section=$verbosity | ||
|
||
|
||
|
||
## | ||
## Unknown command | ||
## | ||
else | ||
echo "Unknown command" | ||
exit 1; | ||
dumpHelpAndExit | ||
fi | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import FWCore.ParameterSet.Config as cms | ||
from Configuration.StandardSequences.Eras import eras | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please do not add unnecessary imports. Instead, replace There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
|
||
from Configuration.Eras.Era_Run2_2018_cff import Run2_2018 | ||
process = cms.Process("TEST", Run2_2018) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is crate 18? It's not listed in the electronics map.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's a utca crate 38