Skip to content
Snippets Groups Projects
Commit 727abf4a authored by Christian Sander's avatar Christian Sander
Browse files

- Bugfix: noisyUpdate = false will now work

- Preparation for 2018 data taking
parent b41ff1ae
No related merge requests found
......@@ -2,9 +2,9 @@
import PyCool # need to import this, so that later imports don't override blob_read
import PyCintex
PyCintex.gbl.cool.IDatabase # force the load of the dictionary (to stay on the safe side)
from PyCintex import gbl, getAllClasses
import cppyy
cppyy.gbl.cool.IDatabase # force the load of the dictionary (to stay on the safe side)
from cppyy import gbl, getAllClasses
def blob_read(self, size = -1):
if size < 0:
......
......@@ -168,7 +168,7 @@ def main( runNum = None, procType = None, forceSkipQueue = 0, Stream = None ):
if 'Project tag:' in line and runPro=='':
runPro = line.split('\'')[1]
if runNum!='' and runPro!='':
if 'data17_cos' in runPro or 'data17_13TeV' in runPro or 'data17_5TeV' in runPro or 'data17_900GeV' in runPro or 'data17_hi' in runPro:
if 'data18_cos' in runPro or 'data18_13TeV' in runPro or 'data18_5TeV' in runPro or 'data18_900GeV' in runPro or 'data18_hi' in runPro:
runList.append(runNum)
runDict[runNum] = runPro
runNum=''
......
......@@ -139,8 +139,8 @@ def main():
def getTransform():
exeSet = set()
exeSet.add(SCTCalibExecutor('/afs/cern.ch/work/c/csander/sct/testarea/AtlasOffline/athena/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/share/skeleton.sct_calib.py'))
# exeSet.add(SCTCalibExecutor('/afs/cern.ch/user/s/sctcalib/testarea/latest/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/share/skeleton.sct_calib.py'))
# exeSet.add(SCTCalibExecutor('/afs/cern.ch/work/c/csander/sct/testarea/AtlasOffline/athena/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/share/skeleton.sct_calib.py'))
exeSet.add(SCTCalibExecutor('/afs/cern.ch/user/s/sctcalib/testarea/latest/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/share/skeleton.sct_calib.py'))
trf = transform(executor=exeSet)
......@@ -284,8 +284,8 @@ class SCTCalibExecutor( athenaExecutor ):
def __init__(self, skeleton):
athenaExecutor.__init__(self,
name = 'sctcalib',
# skeletonFile='/afs/cern.ch/user/s/sctcalib/testarea/latest/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/share/skeleton.sct_calib.py')
skeletonFile='/afs/cern.ch/work/c/csander/sct/testarea/AtlasOffline/athena/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/share/skeleton.sct_calib.py')
skeletonFile='/afs/cern.ch/user/s/sctcalib/testarea/latest/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/share/skeleton.sct_calib.py')
# skeletonFile='/afs/cern.ch/work/c/csander/sct/testarea/AtlasOffline/athena/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/share/skeleton.sct_calib.py')
def preExecute(self, input=set(), output=set()):
......
......@@ -21,7 +21,7 @@ ConditionsTag = '' # empty in default
# Global flags and beam flag
#--------------------------------------------------------------
DataSource = 'data' # 'data' or 'geant4'
beamType = 'cosmics' # 'cosmics', 'singlebeam' or 'collisions'
beamType = 'collisions' # 'cosmics', 'singlebeam' or 'collisions'
#------------------------------------------------------------
# Flags for input
......@@ -71,7 +71,6 @@ LbsPerWindow = 20
#--- Noisy strips
NoisyUpdate = True # True = Write out difference from the existing data, False = Write out all
#NoisyMinStat = 100 # 50000 (enough), 10000 (still possible), 5000 (for commissioning)
NoisyMinStat = 10000 # 50000 (enough), 10000 (still possible), 5000 (for commissioning)
NoisyStripAll = True # True = All noisy strips into DB, False = Only newly found strips
NoisyStripThrDef = True # True = Offline, False = Calib
......
......@@ -499,8 +499,8 @@ SCTCalib.BSErrorModuleFile = 'BSErrorModuleSummary.xml' # Summary
SCTCalib.LorentzAngleFile = 'LorentzAngleFile.xml' # Summary of LorentzAngle ------- Roger
#SCTCalib.NoisyModuleAverageInDB = NoisyModuleAverageInDB #noisyModulesAverageInDB
#SCTCalib.NoisyStripLastRunInDB = NoisyStripLastRunInDB #noisyStripsInDB_lastRun
SCTCalib.NoisyModuleAverageInDB = NoisyModuleAverageInDB #noisyModulesAverageInDB
SCTCalib.NoisyStripLastRunInDB = NoisyStripLastRunInDB #noisyStripsInDB_lastRun
SCTCalib.OutputLevel = INFO # DEBUG
SCTCalib.AuditAlgorithms = True # False
......
......@@ -365,7 +365,7 @@ rec.__dict__.get('projectName').set_Value(projectName)
from IOVDbSvc.CondDB import conddb
conddb.dbdata = 'CONDBR2'
conddb.addFolder("SCT_OFL","<db>COOLOFL_SCT/CONDBR2</db> /SCT/Derived/Monitoring<tag>SctDerivedMonitoring-RUN2-UPD4-005</tag>")
#conddb.addFolder("SCT_OFL","<db>COOLOFL_SCT/CONDBR2</db> /SCT/Derived/Monitoring<tag>SctDerivedMonitoring-RUN2-UPD4-005</tag><forceRunNumber>259237</forceRunNumber>")
#conddb.addFolder("SCT_OFL","<db>COOLOFL_SCT/CONDBR2</db> /SCT/Derived/Monitoring<tag>SctDerivedMonitoring-RUN2-UPD4-005</tag><forceRunNumber>338834</forceRunNumber>")
# GeoModel & MagneticFieldSvc
#--------------------------------------------------------------
......@@ -525,6 +525,7 @@ SCTCalib.DoLorentzAngle = DoLorentzAngle # False in default
#--- Local DB
SCTCalib.WriteToCool = WriteToCool # True in default
#--- Properties for noisy strips
SCTCalib.NoisyUpdate = NoisyUpdate
SCTCalib.NoisyMinStat = NoisyMinStat
SCTCalib.NoisyStripAll = NoisyStripAll
SCTCalib.NoisyStripThrDef = NoisyStripThrDef
......@@ -541,7 +542,7 @@ SCTCalib.NoisyChipFraction = NoisyChipFraction
SCTCalib.NoisyUploadTest = NoisyUploadTest
SCTCalib.NoisyModuleAverageInDB = NoisyModuleAverageInDB
SCTCalib.NoisyStripLastRunInDB = NoisyStripLastRunInDB
#SCTCalib.NoisyStripAverageInDB = NoisyStripAverageInDB
SCTCalib.NoisyStripAverageInDB = NoisyStripAverageInDB
SCTCalib.NoisyModuleList = NoisyModuleList
SCTCalib.NoisyModuleDiff = NoisyModuleDiff
SCTCalib.NoisyStripDiff = NoisyStripDiff
......
......@@ -721,21 +721,21 @@ StatusCode SCTCalib::getNoisyStrip() {
++numNoisyWafers;
if (not m_noisyWaferWrite) break;
if (m_noisyWaferAllStrips) { //write out all strips
//if ( addStripsToList( waferId, stripIdLists[ALL], false, false ).isFailure() or addStripsToList( waferId, stripIdLists[NEW], false, true ).isFailure() ) {
if ( addStripsToList( waferId, stripIdLists[ALL], false, false ).isFailure() ) {
if ( addStripsToList( waferId, stripIdLists[ALL], false, false ).isFailure() or addStripsToList( waferId, stripIdLists[NEW], false, true ).isFailure() ) {
//if ( addStripsToList( waferId, stripIdLists[ALL], false, false ).isFailure() ) {
return msg( MSG::ERROR ) << "Could not add stripIds to the list" << endmsg, StatusCode::FAILURE;
}
break;
} else {
//only noisy strips in noisy wafer
//if ( addStripsToList( waferId, stripIdLists[ALL], true, false ).isFailure() or addStripsToList( waferId, stripIdLists[NEW], true, true ).isFailure() ) {
if ( addStripsToList( waferId, stripIdLists[ALL], true, false ).isFailure() ) {
if ( addStripsToList( waferId, stripIdLists[ALL], true, false ).isFailure() or addStripsToList( waferId, stripIdLists[NEW], true, true ).isFailure() ) {
//if ( addStripsToList( waferId, stripIdLists[ALL], true, false ).isFailure() ) {
return msg( MSG::ERROR ) << "Could not add stripIds to the list" << endmsg, StatusCode::FAILURE;
}
}
} else { // not in noisy wafer
//if ( addStripsToList( waferId, stripIdLists[ALL], true, false ).isFailure() or addStripsToList( waferId, stripIdLists[NEW], true, true ).isFailure() ) {
if ( addStripsToList( waferId, stripIdLists[ALL], true, false ).isFailure() ) {
if ( addStripsToList( waferId, stripIdLists[ALL], true, false ).isFailure() or addStripsToList( waferId, stripIdLists[NEW], true, true ).isFailure() ) {
//if ( addStripsToList( waferId, stripIdLists[ALL], true, false ).isFailure() ) {
return msg( MSG::ERROR ) << "Could not add stripIds to the list" << endmsg, StatusCode::FAILURE;
}
}
......@@ -1866,16 +1866,16 @@ StatusCode SCTCalib::getBSErrors() {
IntStringMap ErrMap_C, ErrMap;
const int numberOfErrorTypes(12);
boost::array<std::string, numberOfErrorTypes> errorNames= {{
"BSParse","TimeOut", "BCID","LVL1ID", "Preamble", "Formatter",
"ABCD","Raw", "MaskedLink", "RODClock",
"TruncROD", (m_histBefore2010?"ROBFragment":"ROBFrag" )
"ByteStreamParseError","TimeOutError","BCIDError","LVL1IDError","PreambleError","FormatterError",
"ABCDError","RawError","MaskedLink","RODClockError",
"TruncatedROD","ROBFragmentError"
}
};
//
boost::array<std::string, numberOfErrorTypes> errorNames_C= {{
"BSParse","TimeOut","BCID","LVL1ID", "Preamble", "Formatter",
"ABCD","Raw", (m_histBefore2010?"TmaskedLinks":"MaskedLink"), "RODClock",
"TruncROD", (m_histBefore2010?"ROBFragment":"ROBFrag" )
"ByteStreamParseError","TimeOutError","BCIDError","LVL1IDError","PreambleError","FormatterError",
"ABCDError","RawError","MaskedLink","RODClockError",
"TruncatedROD","ROBFragmentError"
}
};
boost::array<int, numberOfErrorTypes> errorValues= {{0,1,2,3,4,5,9,10,11,12,13,14}};
......@@ -1893,7 +1893,7 @@ StatusCode SCTCalib::getBSErrors() {
const int N_ENDCAPS(2);
boost::array<std::string, N_ENDCAPS> detectorStems= {{"/run_" + runnum.str() + "/SCT/SCTEC/errors/", "/run_" + runnum.str() + "/SCT/SCTEA/errors/"}}; //barrel stem unused here
boost::array<IntStringMap::iterator, N_ENDCAPS> detectorIterators= {{ErrMap_C.begin(), ErrMap.begin()}};
boost::array<std::string, N_ENDCAPS> detectorParts= {{"ECm", "ECp"}};
boost::array<std::string, N_ENDCAPS> detectorParts= {{"EC", "EA"}};
std::string defecttype("");
std::string n_defect("");
int n_errorLink = 0;
......@@ -1924,11 +1924,13 @@ StatusCode SCTCalib::getBSErrors() {
float errorProb = 0.;
unsigned long long n_errors = 0;
if ( iType == errItr->first ) {
ostringstream streamHist;
ostringstream streamHist;
ostringstream streamHistAlt;
//temporal fix: folder and histogram names should be Preamble
streamHist << errItr->second << "Errs" << "_" << iDisk << "_" << iSide;
streamHistAlt << "T" << errItr->second << "Errs" << detector_part << "_" << iDisk << "_" << iSide;
//streamHist << errItr->second << "Errs" << "_" << iDisk << "_" << iSide;
streamHist << "SCT_T" << errItr->second << detector_part << "_" << iDisk << "_" << iSide;
//streamHistAlt << "T" << errItr->second << "Errs" << detector_part << "_" << iDisk << "_" << iSide;
streamHistAlt << "SCT_" << errItr->second << detector_part << "_" << iDisk << "_" << iSide;
std::string folder = errItr->second+std::string("/");
//histogram might or might not be inside a folder with the same name
std::string profname = detectorStems[stemIndex] + folder +streamHist.str();
......@@ -1950,7 +1952,7 @@ StatusCode SCTCalib::getBSErrors() {
msg( MSG::ERROR ) << "Unable to get profile for BSErrorsDB : " << profname << endmsg;
return StatusCode::FAILURE;
}
n_errors = (unsigned long long)prof_tmp->GetBinContent( iEta+1, iPhi+1 );
// unsigned long long n_errors = (unsigned long long)prof_tmp->GetBinContent( iEta+1, iPhi+1 );
if(n_errors!=0) {
......@@ -2016,8 +2018,9 @@ StatusCode SCTCalib::getBSErrors() {
unsigned long long n_errors = 0;
if ( iType == errItr->first ) {
ostringstream streamHist;
streamHist << "T" << errItr->second << "Errs" << "_" << iLayer << "_" << iSide;
//histogram might or might not be inside a folder with the same name
//streamHist << "SCT_T" << errItr->second << "Errors" << "_" << iLayer << "_" << iSide;
streamHist << "SCT_T" << errItr->second << "B" << "_" << iLayer << "_" << iSide;
//histogram or might not be inside a folder with the same name
std::string folder = errItr->second+std::string("/");
std::string profname = "/run_" + runnum.str() + "/SCT/SCTB/errors/" + folder + streamHist.str();
std::string profnameShort = "/run_" + runnum.str() + "/SCT/SCTB/errors/" + streamHist.str();
......@@ -2775,7 +2778,7 @@ SCTCalib::getNumNoisyStrips( const Identifier& waferId ) const {
bool isNoisyWafer(false);
float noisyStripThr = m_noisyStripThrDef?(m_noisyStripThrOffline):(m_noisyStripThrOnline);
for ( int iStrip = 0; iStrip != nbins; ++iStrip ) {
if ( m_calibHitmapSvc->getBinForHistogramIndex( iStrip + 1, (int) waferHash ) / m_numberOfEvents > noisyStripThr ) ++numNoisyStripsInTheWafer;
if ( (float) m_calibHitmapSvc->getBinForHistogramIndex( iStrip + 1, (int) waferHash ) / m_numberOfEvents > noisyStripThr ) ++numNoisyStripsInTheWafer;
}
//--- Define/counts noisy wafers using wafer occupancy and number of noisy strips
double averageOccupancy = m_calibHitmapSvc->size((int) waferHash)/(double)nbins/(double)m_numberOfEvents;
......@@ -2802,7 +2805,7 @@ SCTCalib::addStripsToList( Identifier& waferId, std::set<Identifier>& stripIdLis
if ( !isNoisy ) { //--- Add all strips
stripIdList.insert( stripId );
} else {
const float stripOccupancy = m_calibHitmapSvc->getBinForHistogramIndex( iStrip + 1, (int) waferHash ) / m_numberOfEvents;
const float stripOccupancy = (float) m_calibHitmapSvc->getBinForHistogramIndex( iStrip + 1, (int) waferHash ) / m_numberOfEvents;
if ( stripOccupancy > noisyStripThr ) {
if ( !isNew ) { //--- All noisy strips
stripIdList.insert( stripId );
......@@ -2848,16 +2851,28 @@ SCTCalib::writeModuleListToCool( const std::map< Identifier, std::set<Identifier
} else msg( MSG::DEBUG ) << "Module "<< moduleId <<" is identical to the reference output" << endmsg;
} else {
if ( m_noisyStripAll ) { //--- ALL noisy strips
if ( !defectStripsAll.empty() ) m_pCalibWriteSvc->createCondObjects( moduleId, m_pSCTHelper, 10000, "NOISY", noisyStripThr, defectStripsAll );
if ( !defectStripsAll.empty() ) {
if (m_pCalibWriteSvc->createCondObjects( moduleId, m_pSCTHelper, 10000, "NOISY", noisyStripThr, defectStripsAll ).isFailure()) {
msg( MSG::ERROR ) << "Could not create defect strip entry in the CalibWriteSvc." << endmsg;
};
} else {
//msg( MSG::INFO ) << "No CondObj since no noisy strips CalibWriteSvc." << endmsg;
}
} else { //--- Only NEW noisy strips
if ( !defectStripsNew.empty() ) m_pCalibWriteSvc->createCondObjects( moduleId, m_pSCTHelper, 10000, "NOISY", noisyStripThr, defectStripsNew );
if ( !defectStripsNew.empty() ) {
if (m_pCalibWriteSvc->createCondObjects( moduleId, m_pSCTHelper, 10000, "NOISY", noisyStripThr, defectStripsNew ).isFailure()) {
msg( MSG::ERROR ) << "Could not create defect strip entry in the CalibWriteSvc." << endmsg;
}
} else {
//msg( MSG::INFO ) << "No CondObj since no noisy strips CalibWriteSvc." << endmsg;
}
}
}
}
}
//msg( MSG::INFO ) << "Number of modules for which conditions were created: " << nDefects <<" !!!!"<< endmsg;
if ( moduleListAll.empty() || nDefects==0 ) {
msg( MSG::INFO ) << "Number of noisy strips was zero or the same list of noisy strips. No local DB was created." << endmsg;
if ( moduleListAll.empty() || ( nDefects==0 && m_noisyUpdate) ) {
msg( MSG::INFO ) << "Number of noisy strips was zero (" << nDefects << ") or the same list of noisy strips. No local DB was created." << endmsg;
} else {
if ( m_pCalibWriteSvc->wrapUpNoisyChannel().isFailure() ) {
msg( MSG::ERROR ) << "Could not get NoisyStrips info" << endmsg;
......@@ -3445,7 +3460,7 @@ SCTCalib::getNoisyLB( const Identifier& moduleId, int& chipId ) const {
for ( int iLB = 0; iLB != m_LBRange; ++iLB ) {
double numEventsInLB = m_calibLbSvc->getNumberOfEventsInBin( iLB + 1 );
if ( numEventsInLB == 0 ) continue;
double chipOccupancy = m_calibLbSvc->getBinForHistogramIndex( iLB + 1, histIndex )/numEventsInLB;
double chipOccupancy = (float) m_calibLbSvc->getBinForHistogramIndex( iLB + 1, histIndex )/numEventsInLB;
if ( chipOccupancy > chipOccupancyThr ) LBList.insert( iLB );
}
//--- Transform LBList to string and calculate a fraction of noisy LBs
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment