Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions 1 Detectors/ITSMFT/MFT/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ add_subdirectory(simulation)
add_subdirectory(macros)
add_subdirectory(tracking)
add_subdirectory(workflow)
add_subdirectory(calibration)

o2_data_file(COPY data DESTINATION Detectors/Geometry/MFT/)
27 changes: 27 additions & 0 deletions 27 Detectors/ITSMFT/MFT/calibration/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright CERN and copyright holders of ALICE O2. This software is distributed
# under the terms of the GNU General Public License v3 (GPL Version 3), copied
# verbatim in the file "COPYING".
#
# See http://alice-o2.web.cern.ch/license for full licensing information.
#
# 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.

o2_add_library(MFTCalibration
SOURCES src/NoiseCalibrator.cxx
SOURCES src/NoiseCalibratorSpec.cxx
PUBLIC_LINK_LIBRARIES O2::DataFormatsMFT O2::MFTBase
O2::DetectorsCalibration
O2::CCDB)

o2_target_root_dictionary(MFTCalibration
HEADERS include/MFTCalibration/NoiseCalibrator.h
LINKDEF src/MFTCalibrationLinkDef.h)

o2_add_executable(mft-calib-workflow
COMPONENT_NAME calibration
SOURCES testWorkflow/mft-calib-workflow.cxx
PUBLIC_LINK_LIBRARIES O2::Framework
O2::MFTCalibration)

Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
// Copyright CERN and copyright holders of ALICE O2. This software is
// distributed under the terms of the GNU General Public License v3 (GPL
// Version 3), copied verbatim in the file "COPYING".
//
// See http://alice-o2.web.cern.ch/license for full licensing information.
//
// 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 NoiseCalibrator.h

#ifndef O2_MFT_NOISECALIBRATOR
#define O2_MFT_NOISECALIBRATOR

#include <string>

#include "DataFormatsITSMFT/NoiseMap.h"
#include "DetectorsCalibration/TimeSlotCalibration.h"
#include "DetectorsCalibration/TimeSlot.h"
#include "gsl/span"

namespace o2
{

namespace itsmft
{
class Digit;
class ROFRecord;
} // namespace itsmft

namespace mft
{

class NoiseCalibrator
{
public:
NoiseCalibrator() = default;
NoiseCalibrator(float prob)
{
mProbabilityThreshold = prob;
}
~NoiseCalibrator() = default;

void setThreshold(unsigned int t) { mThreshold = t; }

bool processTimeFrame(calibration::TFType tf,
gsl::span<const o2::itsmft::Digit> const& digits,
gsl::span<const o2::itsmft::ROFRecord> const& rofs);

bool processTimeFrame(calibration::TFType tf,
gsl::span<const o2::itsmft::CompClusterExt> const& clusters,
gsl::span<const unsigned char> const& patterns,
gsl::span<const o2::itsmft::ROFRecord> const& rofs);

void finalize();

const o2::itsmft::NoiseMap& getNoiseMap() const { return mNoiseMap; }

private:
o2::itsmft::NoiseMap mNoiseMap{936};
float mProbabilityThreshold = 1e-6f;
unsigned int mThreshold = 100;
unsigned int mNumberOfStrobes = 0;
};

} // namespace mft
} // namespace o2

#endif /* O2_MFT_NOISECALIBRATOR */
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// Copyright CERN and copyright holders of ALICE O2. This software is
// distributed under the terms of the GNU General Public License v3 (GPL
// Version 3), copied verbatim in the file "COPYING".
//
// See http://alice-o2.web.cern.ch/license for full licensing information.
//
// 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 NoiseCalibratorSpec.h

#ifndef O2_MFT_NOISECALIBRATORSPEC
#define O2_MFT_NOISECALIBRATORSPEC

#include <string>

#include "Framework/DataProcessorSpec.h"
#include "Framework/Task.h"

#include "MFTCalibration/NoiseCalibrator.h"
using CALIBRATOR = o2::mft::NoiseCalibrator;

//#include "MFTCalibration/NoiseSlotCalibrator.h" //For TimeSlot calibration
//using CALIBRATOR = o2::mft::NoiseSlotCalibrator;

#include "DataFormatsITSMFT/NoiseMap.h"

using namespace o2::framework;

namespace o2
{

namespace mft
{

class NoiseCalibratorSpec : public Task
{
public:
NoiseCalibratorSpec(bool digits = false);
~NoiseCalibratorSpec() override = default;

void init(InitContext& ic) final;
void run(ProcessingContext& pc) final;
void endOfStream(EndOfStreamContext& ec) final;

private:
void sendOutput(DataAllocator& output);
o2::itsmft::NoiseMap mNoiseMap{936};
std::unique_ptr<CALIBRATOR> mCalibrator = nullptr;
std::string mPath;
std::string mMeta;
double mThresh;
int64_t mStart;
int64_t mEnd;
bool mDigits = false;
};

/// create a processor spec
/// run MFT noise calibration
DataProcessorSpec getNoiseCalibratorSpec(bool useDigits);

} // namespace mft
} // namespace o2

#endif /* O2_MFT_NOISECALIBRATORSPEC */
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
// Copyright CERN and copyright holders of ALICE O2. This software is
// distributed under the terms of the GNU General Public License v3 (GPL
// Version 3), copied verbatim in the file "COPYING".
//
// See http://alice-o2.web.cern.ch/license for full licensing information.
//
// 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 NoiseSlotCalibrator.h

#ifndef O2_MFT_NOISESLOTCALIBRATOR
#define O2_MFT_NOISESLOTCALIBRATOR

#include <string>

#include "DetectorsCalibration/TimeSlotCalibration.h"
#include "DetectorsCalibration/TimeSlot.h"

#include "DataFormatsITSMFT/CompCluster.h"
#include "DataFormatsITSMFT/Digit.h"
#include "DataFormatsITSMFT/NoiseMap.h"
#include "gsl/span"

namespace o2
{

namespace itsmft
{
class ROFRecord;
} // namespace itsmft

namespace mft
{

class NoiseSlotCalibrator : public o2::calibration::TimeSlotCalibration<o2::itsmft::CompClusterExt, o2::itsmft::NoiseMap>
{
using Slot = calibration::TimeSlot<o2::itsmft::NoiseMap>;

public:
NoiseSlotCalibrator() { setUpdateAtTheEndOfRunOnly(); }
NoiseSlotCalibrator(float prob)
{
mProbabilityThreshold = prob;
setUpdateAtTheEndOfRunOnly();
setSlotLength(std::numeric_limits<TFType>::max);
}
~NoiseSlotCalibrator() final = default;

void setThreshold(unsigned int t) { mThreshold = t; }

bool processTimeFrame(calibration::TFType tf,
gsl::span<const o2::itsmft::Digit> const& digits,
gsl::span<const o2::itsmft::ROFRecord> const& rofs);

bool processTimeFrame(calibration::TFType tf,
gsl::span<const o2::itsmft::CompClusterExt> const& clusters,
gsl::span<const unsigned char> const& patterns,
gsl::span<const o2::itsmft::ROFRecord> const& rofs);

void finalize()
{
LOG(INFO) << "Number of processed strobes is " << mNumberOfStrobes;
auto& slot = getSlots().back();
slot.getContainer()->applyProbThreshold(mProbabilityThreshold, mNumberOfStrobes);
}

const o2::itsmft::NoiseMap& getNoiseMap(long& start, long& end)
{
const auto& slot = getSlots().back();
start = slot.getTFStart();
end = slot.getTFEnd();
return *(slot.getContainer());
}

// Functions overloaded from the calibration framework
bool process(calibration::TFType tf, const gsl::span<const o2::itsmft::CompClusterExt> data) final;

// Functions required by the calibration framework
void initOutput() final {}
Slot& emplaceNewSlot(bool, calibration::TFType, calibration::TFType) final;
void finalizeSlot(Slot& slot) final;
bool hasEnoughData(const Slot& slot) const final;

private:
float mProbabilityThreshold = 1e-6f;
unsigned int mThreshold = 100;
unsigned int mNumberOfStrobes = 0;
};

} // namespace mft
} // namespace o2

#endif /* O2_MFT_NOISESLOTCALIBRATOR */
19 changes: 19 additions & 0 deletions 19 Detectors/ITSMFT/MFT/calibration/src/MFTCalibrationLinkDef.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright CERN and copyright holders of ALICE O2. This software is
// distributed under the terms of the GNU General Public License v3 (GPL
// Version 3), copied verbatim in the file "COPYING".
//
// See http://alice-o2.web.cern.ch/license for full licensing information.
//
// 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.

#ifdef __CLING__

#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;

#pragma link C++ class o2::mft::NoiseCalibrator + ;

#endif
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.