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

First version of pedestal calibration workflow raw data -> ccdb #5036

Merged
merged 8 commits into from
Dec 14, 2020
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
2 changes: 1 addition & 1 deletion Detectors/TPC/base/include/TPCBase/CDBInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ class CDBStorage

void setJIRA(std::string_view jira)
{
mMetaData["Intervention"] = jira;
mMetaData["JIRA"] = jira;
}

void setComment(std::string_view comment)
Expand Down
5 changes: 0 additions & 5 deletions Detectors/TPC/calibration/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,6 @@ o2_target_root_dictionary(TPCCalibration
include/TPCCalibration/CalibPadGainTracks.h
include/TPCCalibration/FastHisto.h)

o2_add_executable(calib-pedestal
COMPONENT_NAME tpc
SOURCES run/calib-pedestal.cxx
PUBLIC_LINK_LIBRARIES O2::TPCCalibration O2::Framework O2::DPLUtils)

o2_add_test_root_macro(macro/comparePedestalsAndNoise.C
PUBLIC_LINK_LIBRARIES O2::TPCBase
LABELS tpc)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ class CalibRawBase
/// get present event number
size_t getPresentEventNumber() const { return mPresentEventNumber; }

/// return number of events
int getNumberOfEvents() const { return mRawReaderCRUManager.getNumberOfEvents(); }

/// check if present event is complete
bool isPresentEventComplete() const { return mRawReaderCRUManager.isEventComplete(mPresentEventNumber); }

Expand Down
18 changes: 8 additions & 10 deletions Detectors/TPC/calibration/macro/runPedestal.C
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@
#include "TPCCalibration/CalibRawBase.h"
#endif

void runPedestal(std::vector<std::string_view> fileInfos, TString outputFileName = "", Int_t nevents = 100, Int_t adcMin = 0, Int_t adcMax = 1100, Int_t firstTimeBin = 0, Int_t lastTimeBin = 450, Int_t statisticsType = 0, uint32_t verbosity = 0, uint32_t debugLevel = 0, Int_t firstEvent = 0, Bool_t debugOutput = false)
void runPedestal(std::vector<std::string_view> fileInfos, TString outputFileName = "", Int_t nevents = 100, Int_t adcMin = 0, Int_t adcMax = 1100, Int_t firstTimeBin = 0, Int_t lastTimeBin = 450, Int_t statisticsType = 0, uint32_t verbosity = 0, uint32_t debugLevel = 0, Int_t firstEvent = 0, Bool_t debugOutput = false, Bool_t skipIncomplete = false)
{
using namespace o2::tpc;
CalibPedestal ped; //(PadSubset::Region);
ped.setADCRange(adcMin, adcMax);
ped.setStatisticsType(StatisticsType(statisticsType));
ped.setTimeBinRange(firstTimeBin, lastTimeBin);
ped.setSkipIncompleteEvents(skipIncomplete);

//ped.processEvent();
//ped.resetData();
Expand All @@ -35,14 +36,13 @@ void runPedestal(std::vector<std::string_view> fileInfos, TString outputFileName
for (const auto& fileInfo : fileInfos) {
ped.setupContainers(fileInfo.data(), verbosity, debugLevel);

for (Int_t i = firstEvent; i < firstEvent + nevents; ++i) {
const int neventsFile = ped.getNumberOfEvents();
printf("number of events in files: %d\n", neventsFile);
int lastEvent = std::min(neventsFile, firstEvent + nevents);

for (Int_t i = firstEvent; i < lastEvent; ++i) {
status = ped.processEvent(i);
std::cout << "Processing event " << i << " with status " << int(status) << '\n';
if (status == CalibRawBase::ProcessStatus::IncompleteEvent) {
continue;
} else if (status != CalibRawBase::ProcessStatus::Ok) {
break;
}
}
}
ped.analyse();
Expand All @@ -61,7 +61,6 @@ void runPedestal(std::vector<std::string_view> fileInfos, TString outputFileName
debugFile.Append("/");
debugFile.Append("pedestals_debug.root");
TFile f(debugFile, "recreate");
TObjArray arr(72);
for (int i = 0; i < 72; ++i) {
const auto& rocPedestal = calibPedestal.getCalArray(i);

Expand All @@ -70,9 +69,8 @@ void runPedestal(std::vector<std::string_view> fileInfos, TString outputFileName
}

auto ch = ped.createControlHistogram(ROC(i));
arr.Add(static_cast<TObject*>(ch));
ch->Write();
}
arr.Write("histos", TObject::kSingleKey);
f.Write();
}
std::cout << "To display the pedestals run: root.exe $calibMacroDir/drawNoiseAndPedestal.C'(\"" << outputFileName << "\")'\n";
Expand Down
6 changes: 4 additions & 2 deletions Detectors/TPC/calibration/macro/runPedestal.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,13 @@ statisticsType=0
verbosity=0
debugLevel=0
writeDebug=0
skipIncomplete=0

adcMin=0
adcMax=1100

# ===| parse command line options |=============================================
OPTIONS=$(getopt -l "fileInfo:,outputFile:,firstTimeBin:,lastTimeBin:,nevents:,adcMin:,adcMax:,statType:,verbosity:,debugLevel:,writeDebug,help" -o "i:o:t:f:l:n:m:x:s:v:d:wh" -n "runPedestal.sh" -- "$@")
OPTIONS=$(getopt -l "fileInfo:,outputFile:,firstTimeBin:,lastTimeBin:,nevents:,skipIncomplete,adcMin:,adcMax:,statType:,verbosity:,debugLevel:,writeDebug,help" -o "i:o:t:f:l:n:km:x:s:v:d:wh" -n "runPedestal.sh" -- "$@")

if [ $? != 0 ] ; then
usageAndExit
Expand All @@ -65,6 +66,7 @@ while true; do
-f|--firstTimeBin) firstTimeBin=$2; shift 2;;
-l|--lastTimeBin) lastTimeBin=$2; shift 2;;
-n|--nevents) nevents=$2; shift 2;;
-k|--skipIncomplete) skipIncomplete=1; shift;;
-m|--adcMin) adcMin=$2; shift 2;;
-x|--adcMax) adcMax=$2; shift 2;;
-s|--statType) statisticsType=$2; shift 2;;
Expand Down Expand Up @@ -96,6 +98,6 @@ fileInfo=$(echo $fileInfo | sed "s|^|{\"|;s|,|:$lastTimeBin\",\"|g;s|$|\"}|")
cmd=""
#cmd="valgrind --tool=callgrind --dump-instr=yes --dump-instr=yes"
#cmd="perf record -g -o perf.log"
cmd="$cmd root.exe -b -q -l -n -x $O2_SRC/Detectors/TPC/calibration/macro/runPedestal.C'($fileInfo,\"$outputFile\", $nevents, $adcMin, $adcMax, $firstTimeBin, $lastTimeBin, $statisticsType, $verbosity, $debugLevel, 0, $writeDebug)'"
cmd="$cmd root.exe -b -q -l -n -x $O2_SRC/Detectors/TPC/calibration/macro/runPedestal.C'($fileInfo,\"$outputFile\", $nevents, $adcMin, $adcMax, $firstTimeBin, $lastTimeBin, $statisticsType, $verbosity, $debugLevel, 0, $writeDebug, $skipIncomplete)'"
echo "running: $cmd"
eval $cmd
236 changes: 0 additions & 236 deletions Detectors/TPC/calibration/run/calib-pedestal.cxx

This file was deleted.

1 change: 1 addition & 0 deletions Detectors/TPC/calibration/src/CalibRawBase.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ void CalibRawBase::setupContainers(TString fileInfo, uint32_t verbosity, uint32_
printf("Forcing CRU %03d\n", cru);
}
}
mRawReaderCRUManager.init();
} else if (rorcType == "digits") {
TString files = gSystem->GetFromPipe(TString::Format("ls %s", arrDataInfo->At(0)->GetName()));
//const int timeBins = static_cast<TObjString*>(arrDataInfo->At(1))->String().Atoi();
Expand Down