// only the ones in the runList
ifstream inFile(runList);
if (!inFile.is_open()) {
- Error("PlotMUONQApp","unable to open file %s", runList);
+ Error("PlotMuonQApp","unable to open file %s", runList);
return;
}
currRun.ReadLine(inFile, kTRUE);
if (currRun.IsNull()) continue;
if (!currRun.IsDigit()) {
- Error("PlotMUONQApp","invalid run number: %s", currRun.Data());
+ Error("PlotMuonQApp","invalid run number: %s", currRun.Data());
return;
}
runs.AddLast(new TObjString(Form("%09d", currRun.Atoi())));
TString selectAllTriggers = "", selectAllTriggersAC = "", selectAllTriggersE = "";
triggers.SetOwner();
- if (triggerList) {
+ TString sTrigList = triggerList;
+ if ( ! sTrigList.IsNull() ) {
+
// only the ones in the triggerList
ifstream inFile(triggerList);
if (!inFile.is_open()) {
- Error("PlotMUONQApp","unable to open file %s", triggerList);
+ Error("PlotMuonQApp","unable to open file %s", triggerList);
return;
}
- TString currRun;
+ TString currTrig;
while (!inFile.eof()) {
- currRun.ReadLine(inFile, kTRUE);
- if (currRun.IsNull()) continue;
- if (!currRun.IsAlnum()) {
- Error("PlotMUONQApp","invalid trigger name: %s", currRun.Data());
- return;
+ currTrig.ReadLine(inFile, kTRUE);
+ if (currTrig.IsNull()) continue;
+ if (!currTrig.IsAlnum()) {
+ Error("PlotMuonQApp","invalid trigger name: %s", currTrig.Data());
+ return;
}
- triggers.AddLast(new TObjString(Form("%s", currRun.Data())));
+ triggers.AddLast(new TObjString(currTrig));
}
inFile.close();
} else {
TH1* hPosMatchedB[10], *hNegMatchedB[10], *hAllMatchedB[10];
TH1 *hACWithPS[10]={};
TH1 *hACNoPS[10]={};
- TH1 *hEWithPS[10]={};
+ //TH1 *hEWithPS[10]={};
TH1 *hENoPS[10]={};
if(triggers.GetEntriesFast()>=10){
command = Form("find %s/ %s/%s", alienBaseDir.Data(), run.Data(), QAFileName);
res = gGrid->Command(command);
if (!res) {
- Error("PlotMUONQApp","no result for the command: %s",command.Data());
+ Error("PlotMuonQApp","no result for the command: %s",command.Data());
return;
}
}
if(iLoop>iLoopMax) break;
if (!objs || !objs->GetString().Length()) {
- Error("PlotMUONQApp","turl/obj not found for the run %s... SKIPPING", run.Data());
+ Error("PlotMuonQApp","turl/obj not found for the run %s... SKIPPING", run.Data());
continue;
}
// open the outfile for this run
TFile *runFile = TFile::Open(objs->GetString());
if (!runFile || ! runFile->IsOpen()) {
- Error("PlotMUONQApp","failed to open file: %s", objs->GetName());
+ Error("PlotMuonQApp","failed to open file: %s", objs->GetName());
continue;//return;
}
runFile->Cd("MUON_QA");
TObjArray* expert = static_cast<TObjArray*>(runFile->FindObjectAny("expert"));
if (!general1 || !general2 || !expert){
- Error("PlotMUONQApp","All objects not here !!! ===> Skipping...for %s",objs->GetName());
+ Error("PlotMuonQApp","All objects not here !!! ===> Skipping...for %s",objs->GetName());
continue;
}
// skip empty runs... not anymore ! cs !
if (!hNClustersPerCh) {
- Warning("PlotMUONQApp","File: %s has empty histograms !", objs->GetName());
+ Warning("PlotMuonQApp","File: %s has empty histograms !", objs->GetName());
hNClustersPerTrackVsRun_Mean->SetBinContent(ibin, 0.);
hNClustersPerTrackVsRun_Mean->SetBinError(ibin, 1.);
hNClustersPerTrackVsRun_Sigma->SetBinContent(ibin, 0.);
ofstream outFile(outFilename.Data());
- if ( outTaskFilename.Contains("QAresults.root") ) {
- const Int_t kNlibs = 5; // 1
- //TString loadLibs[kNlibs] = {"libPWG3base.so"};
- //TString loadLibs[kNlibs] = {"libANALYSIS.so", "libANALYSISalice.so", "libTENDER.so", "libPWG1.so", "libPWG3base.so"};
- TString loadLibs[kNlibs] = {"libANALYSIS.so", "libOADB.so", "libANALYSISalice.so", "libCORRFW.so", "libPWG3base.so"};
- for ( Int_t ilib=0; ilib<kNlibs; ilib++ ) {
- Int_t exitVal = gSystem->Load(loadLibs[ilib].Data());
- if ( exitVal < 0 ) {
- printf("Please run with aliroot if you're merging QA objects!\n");
- return;
- }
+ // if ( outTaskFilename.Contains("QAresults.root") ) {
+ const Int_t kNlibs = 5; // 1
+ //TString loadLibs[kNlibs] = {"libPWG3base.so"};
+ //TString loadLibs[kNlibs] = {"libANALYSIS.so", "libANALYSISalice.so", "libTENDER.so", "libPWG1.so", "libPWG3base.so"};
+ TString loadLibs[kNlibs] = {"libANALYSIS.so", "libOADB.so", "libANALYSISalice.so", "libCORRFW.so", "libPWG3base.so"};
+ for ( Int_t ilib=0; ilib<kNlibs; ilib++ ) {
+ Int_t exitVal = gSystem->Load(loadLibs[ilib].Data());
+ if ( exitVal < 0 ) {
+ printf("Please run with aliroot if you're merging QA objects!\n");
+ return;
}
}
+ //}
if ( ! gGrid )
TGrid::Connect("alien://");
TString localOut = outTaskFilename;
localOut.ReplaceAll(".root", Form("_%s.root", currRunString.Data()));
- printf("Searching for %s\n", localOut.Data()); // REMEMBER TO CUT
if ( ! gSystem->AccessPathName(localOut.Data()) ) {
if ( overwriteExisting )
printf("Overwriting existing file %s\n", localOut.Data());
else {
printf("Warning: merged file %s already exist: do not overwrite\n", localOut.Data());
+ outFile << gSystem->pwd() << "/" << localOut.Data() << endl;
continue;
}
}
TString mergeFilename = "";
for ( Int_t ipattern=0; ipattern<2; ipattern++ ) {
- TString command = Form("find %s/*%s %s/%s%s", baseDir.Data(), currRunString.Data(), prodDir.Data(), filePattern[ipattern].Data(), outTaskFilename.Data());
+ TString command = ( prodDir.Contains("private") ) ? Form("find %s/ *%s/%s%s", baseDir.Data(), currRunString.Data(), filePattern[ipattern].Data(), outTaskFilename.Data()) : Form("find %s/*%s %s/%s%s", baseDir.Data(), currRunString.Data(), prodDir.Data(), filePattern[ipattern].Data(), outTaskFilename.Data());
printf("%s\n", command.Data());
execTerminate=1
execTrigQA=1
execTrackQA=1
-while getopts "matek" option
+isPrivateProd=0
+optList="mateko:pi:"
+inputTriggerList=""
+while getopts $optList option
do
case $option in
m ) execMerge=0;;
t ) execTerminate=0;;
e ) execTrigQA=0;;
k ) execTrackQA=0;;
+ o ) outTaskName=$OPTARG;;
+ p ) isPrivateProd=1;;
+ i ) inputTriggerList=$OPTARG;;
* ) echo "Unimplemented option chosen."
EXIT=1
;;
# needs 3 arguments
if [[ $# -ne 3 || "$EXIT" -eq 1 ]]; then
- echo "Usage: `basename $0` (-matek) <runList.txt> <QAx> <alien:///alice/data/20XX>/LHCXXy>"
+ echo "Usage: `basename $0` (-$optList) <runList.txt> <QAx> <alien:///alice/data/20XX/LHCXXy>"
echo " -m skip merging (default: run)"
echo " -a skip final merging (default: run)"
echo " -t skip terminate (default: run)"
echo " -e skip run trigger efficiency QA (defult: run)"
echo " -k skip run muon QA (defult: run)"
+ echo " -o task output name (default: QAresults.root)"
+ echo " -p is private production. Use directory structure of the plugin"
+ echo " -i input trigger list (default: no list)"
exit 4
fi
lhcPeriod=`echo ${alienBaseDir%"/"} | awk -F "/" ' { print $NF } '`
aliroot -b <<EOF &> logTrackQA.txt
${loadLibs}
-.x $qaMacroDir/PlotMuonQA.C+("${terminateDir}",0x0,$physSel,"$lhcPeriod","${outTaskName}");
+.x $qaMacroDir/PlotMuonQApp.C+("${terminateDir}",0x0,"${inputTriggerList}",${physSel},"${lhcPeriod}","${outTaskName}");
.q
EOF
cd $baseOutDir
}
+# Use absolute path for file inputTriggerList
+if [ "${inputTriggerList}" != "" ]; then
+ inputTriggerDir=`dirname ${inputTriggerList}`
+ if [ "${inputTriggerDir}"="." ]; then
+ inputTriggerList="`pwd`/${inputTriggerList}"
+ fi
+fi
+
+qaProdName="$2"
+if [ $isPrivateProd -eq 1 ]; then
+ tmpName=${qaProdName//"private"/""}
+ if [ "$tmpName" == "$qaProdName" ]; then
+ qaProdName="${qaProdName}_private"
+ fi
+fi
+
if [ $execMerge -eq 1 ]; then
- mergePerRun $1 $2 $3
+ mergePerRun $1 $qaProdName $3
fi
mergeOut=`grep -A 1 "Output written" ${mergeLog} | grep -v written`
mergeOutAll=${mergeOut//".txt"/"_merged.txt"}
if [ $execTrigQA -eq 1 ]; then
minRun=`echo ${mergeOut} | cut -d "_" -f 2`
maxRun=`echo ${mergeOut} | cut -d "_" -f 3 | cut -d "." -f 1`
- outName="trigEffQA_${minRun}_${maxRun}_$2.root"
+ trigOutSuffix=`echo ${qaProdName} | awk -F "/" '{ print $NF }'`
+ outName="trigEffQA_${minRun}_${maxRun}_${trigOutSuffix}.root"
runTrigQA "${mergeOut}" "${outName}"
fi
#endif
const Int_t kNch = 4;
+const Double_t kZero = 1.e-7; // Avoid problems when comparing to 0.
void SetMyStyle();
Int_t GetRunNumber(TString);
//Double_t GetBinomial(Double_t*, Double_t* eff2 = 0x0, Double_t* effBoth = 0x0);
// }
// if ( eff2 ) {
// for ( Int_t ich=0; ich<4; ich++ ) {
-// auxEff[ich] = ( eff1[ich] > 0. ) ? effBoth[ich]/eff1[ich] : 0.;
+// auxEff[ich] = ( eff1[ich] > kZero ) ? effBoth[ich]/eff1[ich] : 0.;
// }
// auxBinomial = GetBinomial(auxEff);
// eff44 *= auxBinomial;
// auxEff[jch] = ( eff1[jch] < 1. ) ? ( eff2[jch] - effBoth[jch] ) / ( 1. - eff1[jch]) : 0.;
// }
// else {
-// auxEff[jch] = ( eff1[ich] > 0. ) ? effBoth[ich]/eff1[ich] : 0.;
+// auxEff[jch] = ( eff1[ich] > kZero ) ? effBoth[ich]/eff1[ich] : 0.;
// }
// auxBinomial = GetBinomial(auxEff);
// eff34 *= auxBinomial;
for ( Int_t iprod=0; iprod<nFactors; iprod++ ) {
if ( iprod == exclude ) continue;
prod *= effErr[iprod];
- relErr = ( effErr[iprod] > 0. ) ? effErr[iprod+nFactors]/effErr[iprod] : 0.;
+ relErr = ( effErr[iprod] > kZero ) ? effErr[iprod+nFactors]/effErr[iprod] : 0.;
relProdErrSquare += relErr*relErr;
//printf("%f +- %f ", effErr[iprod], effErr[iprod+nFactors]); // REMEMBER TO CUT
}
}
}
else {
- effErr[ich] = ( effErr1[ich] > 0. ) ? effErrBoth[ich]/effErr1[ich] : 0.;
- Double_t relErr1 = ( effErr1[ich] > 0. ) ? effErr1[ich+kNch]/effErr1[ich] : 0.;
- Double_t relErrBoth = ( effErrBoth[ich] > 0. ) ? effErrBoth[ich+kNch]/effErrBoth[ich] : 0.;
+ effErr[ich] = ( effErr1[ich] > kZero ) ? effErrBoth[ich]/effErr1[ich] : 0.;
+ Double_t relErr1 = ( effErr1[ich] > kZero ) ? effErr1[ich+kNch]/effErr1[ich] : 0.;
+ Double_t relErrBoth = ( effErrBoth[ich] > kZero ) ? effErrBoth[ich+kNch]/effErrBoth[ich] : 0.;
effErr[ich+kNch] = effErr[ich] * TMath::Sqrt(relErr1*relErr1 + relErrBoth*relErrBoth);
}
//printf("%f %f %f -> %f\n", effErr1[ich], effErr2[ich], effErrBoth[ich], effErr[ich]); // REMEMBER TO CUT