Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
05fee66
Optional transfer of interpolated waveform for TDC channels
cortesep May 5, 2022
57f8fb7
Optional transfer of interpolated waveform for TDC channels
cortesep May 5, 2022
0648d45
WIP
cortesep May 5, 2022
ab53549
WIP
cortesep May 6, 2022
b5b2b68
WIP
cortesep May 9, 2022
7e03600
WIP
cortesep May 9, 2022
96003d0
WIP
cortesep May 10, 2022
5ac27a2
WIP
cortesep May 11, 2022
998d37c
WIP
cortesep May 12, 2022
dfb290b
WIP
cortesep May 12, 2022
cd4543a
EPN Waveform workflow
cortesep May 13, 2022
bc94ef2
EPN Waveform workflow
cortesep May 13, 2022
29860be
Correct trailing spaces
cortesep May 13, 2022
1552453
Add waveforms
cortesep May 13, 2022
3ee31eb
WIP
cortesep May 18, 2022
6a6664e
WIP
cortesep May 18, 2022
f75f101
WIP
cortesep May 19, 2022
c383d17
Full workflow
cortesep May 19, 2022
bea6b04
Fix whitespace
cortesep May 19, 2022
0713c4a
Fix whitespace
cortesep May 19, 2022
963e07c
Room to analyze waveform for all channels
cortesep May 19, 2022
02594c4
WIP
cortesep May 20, 2022
0cb1cda
WIP
cortesep May 20, 2022
5e5dc2a
WIP
cortesep May 20, 2022
88c9fad
Indroduced cuts on tower signals
cortesep May 23, 2022
2676d9c
Split WaveformCalibData into two classes
cortesep May 24, 2022
1084516
Improve printout
cortesep May 24, 2022
6938be1
Moving InterCalibData.h and InterCalibData.cxx to ZDCCalib
cortesep May 24, 2022
3382acb
Simplified class to store WaveformCalib output
cortesep May 24, 2022
4648932
Simplified class to store WaveformCalib output
cortesep May 24, 2022
aada04c
Simplified class to store WaveformCalib output
cortesep May 24, 2022
fa06c3b
Simplified class to store WaveformCalib output
cortesep May 24, 2022
9e14bb0
Fix whitespace
cortesep May 24, 2022
8af8bdb
Saving histograms from calibration object
cortesep May 24, 2022
c83d184
clang-format
cortesep May 24, 2022
80c9ccf
Fixed crash
cortesep May 25, 2022
e96371f
Fixing some compilation errors
cortesep May 25, 2022
4d383f3
clang-format
cortesep May 25, 2022
357a6af
Fixing some compilation errors
cortesep May 26, 2022
19db720
Corrected initialization
cortesep May 26, 2022
93e4943
Merge branch 'AliceO2Group:dev' into dev_shape
cortesep May 27, 2022
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
EPN Waveform workflow
  • Loading branch information
cortesep committed May 13, 2022
commit bc94ef26e19b0624d6ab58acd87825c7ca8ec006
35 changes: 35 additions & 0 deletions Detectors/ZDC/calib/include/ZDCCalib/CalibParamZDC.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

#ifndef O2_ZDC_CALIBPARAMZDC_H
#define O2_ZDC_CALIBPARAMZDC_H

#include "CommonUtils/ConfigurableParam.h"
#include "CommonUtils/ConfigurableParamHelper.h"
#include "ZDCBase/Constants.h"

/// \file CalibParamZDC.h
/// \brief ZDC calibration common parameters
/// \author P. Cortese

namespace o2
{
namespace zdc
{
struct CalibParamZDC : public o2::conf::ConfigurableParamHelper<CalibParamZDC> {
int debug_output = -1; // Debug output
void print();
O2ParamDef(CalibParamZDC, "CalibParamZDC");
};
} // namespace zdc
} // namespace o2

#endif
30 changes: 30 additions & 0 deletions Detectors/ZDC/calib/src/CalibParamZDC.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

#include "Framework/Logger.h"
#include "ZDCCalib/CalibParamZDC.h"

O2ParamImpl(o2::zdc::CalibParamZDC);

void o2::zdc::CalibParamZDC::print()
{
bool printed = false;
if (debug_output >= 0) {
if (!printed) {
LOG(info) << "CalibParamZDC::print()";
printed = true;
}
if (debug_output >= 0) {
printf(" debug_output=%d", debug_output);
}
printf("\n");
}
}
141 changes: 141 additions & 0 deletions Detectors/ZDC/calib/src/WaveformCalibEPNSpec.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

/// @file WaveformCalibEPNSpec.cxx
/// @brief ZDC reconstruction
/// @author [email protected]

#include <iostream>
#include <vector>
#include <string>
#include "CCDB/BasicCCDBManager.h"
#include "CCDB/CCDBTimeStampUtils.h"
#include "Framework/Logger.h"
#include "Framework/ControlService.h"
#include "Framework/ConfigParamRegistry.h"
#include "Framework/CCDBParamSpec.h"
#include "Framework/DataRefUtils.h"
#include "DetectorsCommonDataFormats/DetID.h"
#include "DataFormatsZDC/BCData.h"
#include "DataFormatsZDC/ChannelData.h"
#include "DataFormatsZDC/OrbitData.h"
#include "DataFormatsZDC/RecEvent.h"
#include "ZDCBase/ModuleConfig.h"
#include "CommonUtils/NameConf.h"
#include "CCDB/BasicCCDBManager.h"
#include "CCDB/CCDBTimeStampUtils.h"
#include "ZDCCalib/WaveformCalibData.h"
#include "ZDCCalib/WaveformCalibEPNSpec.h"

using namespace o2::framework;

namespace o2
{
namespace zdc
{

WaveformCalibEPNSpec::WaveformCalibEPNSpec()
{
mTimer.Stop();
mTimer.Reset();
}

WaveformCalibEPNSpec::WaveformCalibEPNSpec(const int verbosity) : mVerbosity(verbosity)
{
mTimer.Stop();
mTimer.Reset();
}

void WaveformCalibEPNSpec::init(o2::framework::InitContext& ic)
{
mVerbosity = ic.options().get<int>("verbosity-level");
}

void WaveformCalibEPNSpec::updateTimeDependentParams(ProcessingContext& pc)
{
// we call these methods just to trigger finaliseCCDB callback
pc.inputs().get<o2::zdc::WaveformCalibConfig*>("wavecalibconfig");
}

void WaveformCalibEPNSpec::run(ProcessingContext& pc)
{
updateTimeDependentParams(pc);
if (!mInitialized) {
mInitialized = true;
std::string loadedConfFiles = "Loaded ZDC configuration files:";
// WaveformCalib configuration
auto interConfig = pc.inputs().get<o2::zdc::WaveformCalibConfig*>("wavecalibconfig");
if (!interConfig) {
LOG(fatal) << "Missing WaveformCalibConfig calibration object";
return;
} else {
loadedConfFiles += " WaveformCalibConfig";
if (mVerbosity > DbgZero) {
LOG(info) << "Loaded WaveformCalibConfig configuration object";
interConfig->print();
}
}

mWorker.setConfig(interConfig.get());

LOG(info) << loadedConfFiles;
mTimer.CpuTime();
mTimer.Start(false);
}

const auto ref = pc.inputs().getFirstValid(true);
auto creationTime = DataRefUtils::getHeader<DataProcessingHeader*>(ref)->creation; // approximate time in ms
WaveformCalibData& data = mWorker.getData();
// data.setCreationTime(creationTime);

auto bcrec = pc.inputs().get<gsl::span<o2::zdc::BCRecData>>("bcrec");
auto energy = pc.inputs().get<gsl::span<o2::zdc::ZDCEnergy>>("energy");
auto tdc = pc.inputs().get<gsl::span<o2::zdc::ZDCTDCData>>("tdc");
auto info = pc.inputs().get<gsl::span<uint16_t>>("info");
auto wave = pc.inputs().get<gsl::span<o2::zdc::ZDCWaveform>>("wave");

// Process reconstructed data
mWorker.process(bcrec, energy, tdc, info, wave);

// Send intermediate calibration data and debug histograms
o2::framework::Output output("ZDC", "WAVECALIBDATA", 0, Lifetime::Timeframe);
pc.outputs().snapshot(output, mWorker.mData);
}

void WaveformCalibEPNSpec::endOfStream(EndOfStreamContext& ec)
{
mWorker.endOfRun();
mTimer.Stop();
LOGF(info, "ZDC EPN Waveform calibration total timing: Cpu: %.3e Real: %.3e s in %d slots", mTimer.CpuTime(), mTimer.RealTime(), mTimer.Counter() - 1);
}

framework::DataProcessorSpec getWaveformCalibEPNSpec()
{
std::vector<InputSpec> inputs;
inputs.emplace_back("bcrec", "ZDC", "BCREC", 0, Lifetime::Timeframe);
inputs.emplace_back("energy", "ZDC", "ENERGY", 0, Lifetime::Timeframe);
inputs.emplace_back("tdc", "ZDC", "TDCDATA", 0, Lifetime::Timeframe);
inputs.emplace_back("info", "ZDC", "INFO", 0, Lifetime::Timeframe);
inputs.emplace_back("wave", "ZDC", "WAVE", 0, Lifetime::Timeframe);
inputs.emplace_back("wavecalibconfig", "ZDC", "WAVECALIBCONFIG", 0, Lifetime::Condition, o2::framework::ccdbParamSpec(fmt::format("{}", o2::zdc::CCDBPathWaveformCalibConfig.data())));

std::vector<OutputSpec> outputs;
outputs.emplace_back("ZDC", "WAVECALIBDATA", 0, Lifetime::Timeframe);
return DataProcessorSpec{
"zdc-waveformcalib-epn",
inputs,
outputs,
AlgorithmSpec{adaptFromTask<WaveformCalibEPNSpec>()},
o2::framework::Options{{"verbosity-level", o2::framework::VariantType::Int, 0, {"Verbosity level"}}}};
}

} // namespace zdc
} // namespace o2
42 changes: 42 additions & 0 deletions Detectors/ZDC/calib/src/zdc-waveformcalib-epn-workflow.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

#include "Framework/DataProcessorSpec.h"
#include "DetectorsRaw/HBFUtilsInitializer.h"
#include "ZDCCalib/WaveformCalibEPNSpec.h"

using namespace o2::framework;

// ------------------------------------------------------------------
void customize(std::vector<o2::framework::CallbacksPolicy>& policies)
{
o2::raw::HBFUtilsInitializer::addNewTimeSliceCallback(policies);
}

// we need to add workflow options before including Framework/runDataProcessing
void customize(std::vector<o2::framework::ConfigParamSpec>& workflowOptions)
{
// option allowing to set parameters
o2::raw::HBFUtilsInitializer::addConfigOption(workflowOptions);
}

// ------------------------------------------------------------------

#include "Framework/runDataProcessing.h"

WorkflowSpec defineDataProcessing(ConfigContext const& configcontext)
{
WorkflowSpec specs;
specs.emplace_back(o2::zdc::getWaveformCalibEPNSpec());
// configure dpl timer to inject correct firstTFOrbit: start from the 1st orbit of TF containing 1st sampled orbit
o2::raw::HBFUtilsInitializer hbfIni(configcontext, specs);
return specs;
}