Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Adding check for run number, adding option to set ion drift time
- Adding mInstLumiFactor as optional scaling factor
  • Loading branch information
matthias-kleiner committed Nov 11, 2023
commit 4be2f6cb72d80d2c099c92be775e0add29f0c5d2
2 changes: 1 addition & 1 deletion Detectors/TPC/calibration/src/CorrectionMapsLoader.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ void CorrectionMapsLoader::extractCCDBInputs(ProcessingContext& pc)
setInstLumi(mInstLumiFactor * (mCTPLumiSource == 0 ? lumiObj.getLumi() : lumiObj.getLumiAlt()));
} else if (getLumiScaleType() == 2 && mInstLumiOverride <= 0.) {
float tpcScaler = pc.inputs().get<float>("tpcscaler");
setInstLumi(tpcScaler);
setInstLumi(mInstLumiFactor * tpcScaler);
}
}

Expand Down
15 changes: 14 additions & 1 deletion Detectors/TPC/workflow/src/TPCScalerSpec.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "Framework/Logger.h"
#include "Framework/DataProcessorSpec.h"
#include "Framework/CCDBParamSpec.h"
#include "Framework/ConfigParamRegistry.h"
#include "TPCBase/CDBInterface.h"
#include "DetectorsBase/GRPGeomHelper.h"
#include "TPCCalibration/TPCScaler.h"
Expand All @@ -38,6 +39,7 @@ class TPCScalerSpec : public Task
void init(framework::InitContext& ic) final
{
o2::base::GRPGeomHelper::instance().setRequest(mCCDBRequest);
mIonDriftTimeMS = ic.options().get<float>("ion-drift-time");
}

void run(ProcessingContext& pc) final
Expand All @@ -47,6 +49,10 @@ class TPCScalerSpec : public Task
pc.inputs().get<TTree*>("tpcscaler");
}

if (pc.services().get<o2::framework::TimingInfo>().runNumber != mTPCScaler.getRun()) {
LOGP(error, "Run number {} of processed data and run number {} of loaded TPC scaler doesnt match!", pc.services().get<o2::framework::TimingInfo>().runNumber, mTPCScaler.getRun());
}

const auto orbitResetTimeMS = o2::base::GRPGeomHelper::instance().getOrbitResetTimeMS();
const auto firstTFOrbit = pc.services().get<o2::framework::TimingInfo>().firstTForbit;
const double timestamp = orbitResetTimeMS + firstTFOrbit * o2::constants::lhc::LHCOrbitMUS * 0.001;
Expand All @@ -63,11 +69,16 @@ class TPCScalerSpec : public Task
if (matcher == ConcreteDataMatcher(o2::header::gDataOriginTPC, "TPCSCALERCCDB", 0)) {
LOGP(info, "Updating TPC scaler");
mTPCScaler.setFromTree(*((TTree*)obj));
if (mIonDriftTimeMS > 0) {
LOGP(info, "Setting ion drift time to: {}", mIonDriftTimeMS);
mTPCScaler.setIonDriftTimeMS(mIonDriftTimeMS);
}
}
}

private:
std::shared_ptr<o2::base::GRPGeomRequest> mCCDBRequest; ///< info for CCDB request
float mIonDriftTimeMS{-1}; ///< ion drift time
TPCScaler mTPCScaler; ///< tpc scaler
};

Expand All @@ -91,7 +102,9 @@ o2::framework::DataProcessorSpec getTPCScalerSpec()
"tpc-scaler",
inputs,
outputs,
AlgorithmSpec{adaptFromTask<TPCScalerSpec>(ccdbRequest)}};
AlgorithmSpec{adaptFromTask<TPCScalerSpec>(ccdbRequest)},
Options{
{"ion-drift-time", VariantType::Float, -1.f, {"Overwrite ion drift time if a value >0 is provided"}}}};
}

} // namespace tpc
Expand Down