Skip to content
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

L1T O2O: degubing of uGMT + new prototype for caloParams payload + scripts' development #16034

Merged
merged 3 commits into from Oct 8, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 2 additions & 4 deletions CondTools/L1TriggerExt/scripts/runL1-O2O-iov.sh
Expand Up @@ -62,10 +62,8 @@ else
fi
fi

cmsRun $CMSSW_BASE/src/CondTools/L1TriggerExt/test/L1ConfigWriteIOVOnlineExt_cfg.py ${CMS_OPTIONS} tscKey=${tsckey} rsKey=${rskey} runNumber=${runnum} ${OUTDB_OPTIONS} logTransactions=0 print
o2ocode=$?

# | grep -Ev "CORAL.*Info|CORAL.*Debug"
cmsRun $CMSSW_BASE/src/CondTools/L1TriggerExt/test/L1ConfigWriteIOVOnlineExt_cfg.py ${CMS_OPTIONS} tscKey=${tsckey} rsKey=${rskey} runNumber=${runnum} ${OUTDB_OPTIONS} logTransactions=0 print | grep -Ev "CORAL.*Info|CORAL.*Debug"
o2ocode=${PIPESTATUS[0]}

if [ ${o2ocode} -eq 0 ]
then
Expand Down
@@ -1,7 +1,7 @@
import FWCore.ParameterSet.Config as cms

#from L1Trigger.L1TCalorimeter.caloStage2Params_cfi import *
from L1Trigger.L1TCalorimeter.caloStage2Params_2016_v2_2_cfi import *
from L1Trigger.L1TCalorimeter.caloStage2Params_2016_v3_2_cfi import *

L1TCaloParamsOnlineProd = cms.ESProducer("L1TCaloParamsOnlineProd",
onlineAuthentication = cms.string('.'),
Expand Down
90 changes: 81 additions & 9 deletions L1TriggerConfig/Utilities/src/L1TMuonGlobalParamsViewer.cc
Expand Up @@ -22,6 +22,8 @@ using namespace std;
class L1TMuonGlobalParamsViewer: public edm::EDAnalyzer {
private:
// bool printLayerMap;
std::string hash(void *buf, size_t len) const ;
void printLUT(l1t::LUT* lut, const char *name) const ;
public:
virtual void analyze(const edm::Event&, const edm::EventSetup&);
// string hash(void *buf, size_t len) const ;
Expand All @@ -32,7 +34,6 @@ class L1TMuonGlobalParamsViewer: public edm::EDAnalyzer {
virtual ~L1TMuonGlobalParamsViewer(void){}
};

/*
#include <openssl/sha.h>
#include <math.h>
#include <iostream>
Expand All @@ -43,14 +44,14 @@ string L1TMuonGlobalParamsViewer::hash(void *buf, size_t len) const {
bzero(tmp,sizeof(tmp));
SHA_CTX ctx;
if( !SHA1_Init( &ctx ) )
throw cms::Exception("L1TCaloParamsReader::hash")<<"SHA1 initialization error";
throw cms::Exception("L1TMuonGlobalParamsViewer::hash")<<"SHA1 initialization error";

if( !SHA1_Update( &ctx, buf, len ) )
throw cms::Exception("L1TCaloParamsReader::hash")<<"SHA1 processing error";
throw cms::Exception("L1TMuonGlobalParamsViewer::hash")<<"SHA1 processing error";

unsigned char hash[SHA_DIGEST_LENGTH];
if( !SHA1_Final(hash, &ctx) )
throw cms::Exception("L1TCaloParamsReader::hash")<<"SHA1 finalization error";
throw cms::Exception("L1TMuonGlobalParamsViewer::hash")<<"SHA1 finalization error";

// re-write bytes in hex
for(unsigned int i=0; i<20; i++)
Expand All @@ -59,18 +60,89 @@ string L1TMuonGlobalParamsViewer::hash(void *buf, size_t len) const {
tmp[20*2] = 0;
return string(tmp);
}
*/

void L1TMuonGlobalParamsViewer::printLUT(l1t::LUT* lut, const char *name) const {

if( !lut->empty() ){
cout<<" "<<std::setw(24)<<name<<"["<<lut->maxSize()<<"] "<<flush;
int pod[lut->maxSize()];
for(unsigned int i=0; i<lut->maxSize(); i++) pod[i] = lut->data(i);
cout << hash( pod, sizeof(int)*lut->maxSize() )<<endl;
} else {
cout<<" "<<std::setw(24)<<name<<"[0]"<<endl;
}

}

void L1TMuonGlobalParamsViewer::analyze(const edm::Event& iEvent, const edm::EventSetup& evSetup){

// Pull the config from the ES
edm::ESHandle<L1TMuonGlobalParams> handle1;
evSetup.get<L1TMuonGlobalParamsRcd>().get( handle1 ) ;
boost::shared_ptr<L1TMuonGlobalParams> ptr1(new L1TMuonGlobalParams(*(handle1.product ())));

cout<<"Some fields in L1TMuonGlobalParams: "<<endl;

((L1TMuonGlobalParamsHelper*)ptr1.get())->print(cout);

// cout<<"Some fields in L1TMuonGlobalParams: "<<endl;

// ((L1TMuonGlobalParamsHelper*)ptr1.get())->print(cout);

printLUT( ptr1.get()->absIsoCheckMemLUT(), "absIsoCheckMemLUT" );
printLUT( ptr1.get()->absIsoCheckMemLUT(), "absIsoCheckMemLUT" );
printLUT( ptr1.get()->relIsoCheckMemLUT(), "relIsoCheckMemLUT" );
printLUT( ptr1.get()->idxSelMemPhiLUT(), "idxSelMemPhiLUT" );
printLUT( ptr1.get()->idxSelMemEtaLUT(), "idxSelMemEtaLUT" );
//l1t::LUT* brlSingleMatchQualLUT();
printLUT( ptr1.get()->fwdPosSingleMatchQualLUT(),"fwdPosSingleMatchQualLUT" );
printLUT( ptr1.get()->fwdNegSingleMatchQualLUT(),"fwdNegSingleMatchQualLUT" );
printLUT( ptr1.get()->ovlPosSingleMatchQualLUT(),"ovlPosSingleMatchQualLUT" );
printLUT( ptr1.get()->ovlNegSingleMatchQualLUT(),"ovlNegSingleMatchQualLUT" );
printLUT( ptr1.get()->bOPosMatchQualLUT(),"bOPosMatchQualLUT" );
printLUT( ptr1.get()->bONegMatchQualLUT(),"bONegMatchQualLUT" );
printLUT( ptr1.get()->fOPosMatchQualLUT(),"fOPosMatchQualLUT" );
printLUT( ptr1.get()->fONegMatchQualLUT(),"fONegMatchQualLUT" );
printLUT( ptr1.get()->bPhiExtrapolationLUT(),"bPhiExtrapolationLUT" );
printLUT( ptr1.get()->oPhiExtrapolationLUT(),"oPhiExtrapolationLUT" );
printLUT( ptr1.get()->fPhiExtrapolationLUT(),"fPhiExtrapolationLUT" );
printLUT( ptr1.get()->bEtaExtrapolationLUT(),"bEtaExtrapolationLUT" );
printLUT( ptr1.get()->oEtaExtrapolationLUT(),"oEtaExtrapolationLUT" );
printLUT( ptr1.get()->fEtaExtrapolationLUT(),"fEtaExtrapolationLUT" );
printLUT( ptr1.get()->sortRankLUT(),"sortRankLUT" );

std::cout<<"absIsoCheckMemLUTPath: "<<ptr1.get()->absIsoCheckMemLUTPath()<<std::endl;
std::cout<<"relIsoCheckMemLUTPath: "<<ptr1.get()->relIsoCheckMemLUTPath()<<std::endl;
std::cout<<"idxSelMemPhiLUTPath: "<<ptr1.get()->idxSelMemPhiLUTPath()<<std::endl;
std::cout<<"idxSelMemEtaLUTPath: "<<ptr1.get()->idxSelMemEtaLUTPath()<<std::endl;
//std::string brlSingleMatchQualLUTPath() const { return pnodes_[brlSingleMatchQual].sparams_.size() > spIdx::fname ? pnodes_[brlSingleMatchQual].sparams_[spIdx::fname] : ""; }
std::cout<<"fwdPosSingleMatchQualLUTPath: "<<ptr1.get()->fwdPosSingleMatchQualLUTPath()<<std::endl;
std::cout<<"fwdNegSingleMatchQualLUTPath: "<<ptr1.get()->fwdNegSingleMatchQualLUTPath()<<std::endl;
std::cout<<"ovlPosSingleMatchQualLUTPath: "<<ptr1.get()->ovlPosSingleMatchQualLUTPath()<<std::endl;
std::cout<<"ovlNegSingleMatchQualLUTPath: "<<ptr1.get()->ovlNegSingleMatchQualLUTPath()<<std::endl;
std::cout<<"bOPosMatchQualLUTPath: "<<ptr1.get()->bOPosMatchQualLUTPath()<<std::endl;
std::cout<<"bONegMatchQualLUTPath: "<<ptr1.get()->bONegMatchQualLUTPath()<<std::endl;
std::cout<<"fOPosMatchQualLUTPath: "<<ptr1.get()->fOPosMatchQualLUTPath()<<std::endl;
std::cout<<"fONegMatchQualLUTPath: "<<ptr1.get()->fONegMatchQualLUTPath()<<std::endl;
std::cout<<"bPhiExtrapolationLUTPath: "<<ptr1.get()->bPhiExtrapolationLUTPath()<<std::endl;
std::cout<<"oPhiExtrapolationLUTPath: "<<ptr1.get()->oPhiExtrapolationLUTPath()<<std::endl;
std::cout<<"fPhiExtrapolationLUTPath: "<<ptr1.get()->fPhiExtrapolationLUTPath()<<std::endl;
std::cout<<"bEtaExtrapolationLUTPath: "<<ptr1.get()->bEtaExtrapolationLUTPath()<<std::endl;
std::cout<<"oEtaExtrapolationLUTPath: "<<ptr1.get()->oEtaExtrapolationLUTPath()<<std::endl;
std::cout<<"fEtaExtrapolationLUTPath: "<<ptr1.get()->fEtaExtrapolationLUTPath()<<std::endl;
std::cout<<"sortRankLUTPath: "<<ptr1.get()->sortRankLUTPath()<<std::endl;


std::cout<<"fwdPosSingleMatchQualLUTMaxDR: "<<ptr1.get()->fwdPosSingleMatchQualLUTMaxDR()<<std::endl;
std::cout<<"fwdNegSingleMatchQualLUTMaxDR: "<<ptr1.get()->fwdNegSingleMatchQualLUTMaxDR()<<std::endl;
std::cout<<"ovlPosSingleMatchQualLUTMaxDR: "<<ptr1.get()->ovlPosSingleMatchQualLUTMaxDR()<<std::endl;
std::cout<<"ovlNegSingleMatchQualLUTMaxDR: "<<ptr1.get()->ovlNegSingleMatchQualLUTMaxDR()<<std::endl;
std::cout<<"bOPosMatchQualLUTMaxDR: "<<ptr1.get()->bOPosMatchQualLUTMaxDR()<<std::endl;
std::cout<<"bONegMatchQualLUTMaxDR: "<<ptr1.get()->bONegMatchQualLUTMaxDR()<<std::endl;
std::cout<<"bOPosMatchQualLUTMaxDREtaFine: "<<ptr1.get()->bOPosMatchQualLUTMaxDREtaFine()<<std::endl;
std::cout<<"bONegMatchQualLUTMaxDREtaFine: "<<ptr1.get()->bONegMatchQualLUTMaxDREtaFine()<<std::endl;
std::cout<<"fOPosMatchQualLUTMaxDR: "<<ptr1.get()->fOPosMatchQualLUTMaxDR()<<std::endl;
std::cout<<"fONegMatchQualLUTMaxDR: "<<ptr1.get()->fONegMatchQualLUTMaxDR()<<std::endl;

// Sort rank LUT factors for pT and quality
std::cout<<"sortRankLUTPtFactor: "<<ptr1.get()->sortRankLUTPtFactor()<<std::endl;
std::cout<<"sortRankLUTQualFactor: "<<ptr1.get()->sortRankLUTQualFactor()<<std::endl;
}

#include "FWCore/PluginManager/interface/ModuleDef.h"
Expand Down
25 changes: 16 additions & 9 deletions L1TriggerConfig/Utilities/test/runOneByOne.sh
@@ -1,30 +1,37 @@
#!/bin/bash
#!/bin/sh

if [ $# -ne 2 ] ; then echo 'Please, provide the 2 arguments: tscKey and rsKey'; exit 2; fi

#source /opt/offline/cmsset_default.sh
#cd /data/O2O/L1T/v9.0/CMSSW_8_0_18
#cmsenv
#cd -

DBAuth=/data/O2O/L1T/

rm -f l1config.db

if [ -e l1configBlank.db ] ; then
echo "Using pre-initialized l1configBlank.db sqlite file";
else
cmsRun ${CMSSW_BASE}/src/CondTools/L1TriggerExt/test/init_cfg.py useO2OTags=1 outputDBConnect=sqlite:./l1configBlank.db outputDBAuth=./
cmsRun ${CMSSW_BASE}/src/CondTools/L1TriggerExt/test/init_cfg.py useO2OTags=1 outputDBConnect=sqlite:./l1configBlank.db outputDBAuth=${DBAuth}
initcode=$?
if [ $initcode -ne 0 ] ; then echo "Failed to initialize sqlite file"; exit 1 ; fi
cmsRun ${CMSSW_BASE}/src/CondTools/L1TriggerExt/test/L1ConfigWriteSinglePayloadExt_cfg.py objectKey="OMTF_ALGO_EMPTY" objectType=L1TMuonOverlapParams recordName=L1TMuonOverlapParamsO2ORcd useO2OTags=1 outputDBConnect=sqlite:l1configBlank.db outputDBAuth=/data/O2O/L1T/pro/o2o/
cmsRun ${CMSSW_BASE}/src/CondTools/L1TriggerExt/test/L1ConfigWriteSinglePayloadExt_cfg.py objectKey="OMTF_ALGO_EMPTY" objectType=L1TMuonOverlapParams recordName=L1TMuonOverlapParamsO2ORcd useO2OTags=1 outputDBConnect=sqlite:l1configBlank.db outputDBAuth=${DBAuth}
initcode=$?
if [ $initcode -ne 0 ] ; then echo "Failed to write OMTF_ALGO_EMPTY in sqlite file" ; exit 1 ; fi
cmsRun ${CMSSW_BASE}/src/CondTools/L1TriggerExt/test/L1ConfigWriteSinglePayloadExt_cfg.py objectKey="EMTF_ALGO_EMPTY" objectType=L1TMuonEndCapParams recordName=L1TMuonEndcapParamsO2ORcd useO2OTags=1 outputDBConnect=sqlite:l1configBlank.db outputDBAuth=/data/O2O/L1T/pro/o2o/
cmsRun ${CMSSW_BASE}/src/CondTools/L1TriggerExt/test/L1ConfigWriteSinglePayloadExt_cfg.py objectKey="EMTF_ALGO_EMPTY" objectType=L1TMuonEndCapParams recordName=L1TMuonEndcapParamsO2ORcd useO2OTags=1 outputDBConnect=sqlite:l1configBlank.db outputDBAuth=${DBAuth}
initcode=$?
if [ $initcode -ne 0 ] ; then echo "Failed to write EMTF_ALGO_EMPTY in sqlite files" ; exit 1 ; fi
fi

# save some time by restoring an always ready template:
cp l1configBlank.db l1config.db

DBAuth=/data/O2O/L1T/

keys=$(cmsRun ${CMSSW_BASE}/src/L1TriggerConfig/Utilities/test/viewTKEonline.py tscKey=$1 rsKey=$2 DBAuth=${DBAuth} 2>/dev/null | grep ' key: ')

keyscode=$?
if [ $keyscode -ne 0 ] ; then echo "Failed to get the list of trigger keys for L1T subsystems. Did you supply the 2 arguments: tscKey and rsKey ? " ; exit 2 ; fi
if [ $keyscode -ne 0 ] ; then echo "Failed to get the list of trigger keys for L1T subsystems. Did you provide the 2 arguments: tscKey and rsKey ? " ; exit 2 ; fi

uGT_key=$(echo $keys | sed -n -e's|.*uGT *key: \([^ ]*\).*|\1|gp')
uGMT_key=$(echo $keys | sed -n -e's|.*uGMT *key: \([^ ]*\).*|\1|gp')
Expand Down Expand Up @@ -67,8 +74,8 @@ if [ $emtfcode -ne 0 ] ; then exitcode=`expr $exitcode + 10000000`; fi

echo "Status codes: uGT: $ugtcode, CALO: $caloparcode, BMTF: $bmtfcode, uGMT: $ugmtcode, uGTrs: $ugtrscode, OMTF: $omtfcode, EMTF:$emtfcode, Total: $exitcode"

if [ -n $exitcode ] ; then
echo "Everythin looks good"
if [ $exitcode -eq 0 ] ; then
echo "Everything looks good"
else
echo "Problems encountered, NOT ok"
fi
Expand Down