|
| 1 | +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. |
| 2 | +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. |
| 3 | +// All rights not expressly granted are reserved. |
| 4 | +// |
| 5 | +// This software is distributed under the terms of the GNU General Public |
| 6 | +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". |
| 7 | +// |
| 8 | +// In applying this license CERN does not waive the privileges and immunities |
| 9 | +// granted to it by virtue of its status as an Intergovernmental Organization |
| 10 | +// or submit itself to any jurisdiction. |
| 11 | + |
| 12 | +/// |
| 13 | +/// \file ObjectComparatorInterface.h |
| 14 | +/// \author Andrea Ferrero |
| 15 | +/// \brief An interface for comparing two TObject |
| 16 | +/// |
| 17 | + |
| 18 | +#ifndef QUALITYCONTROL_ObjectComparatorInterface_H |
| 19 | +#define QUALITYCONTROL_ObjectComparatorInterface_H |
| 20 | + |
| 21 | +#include "QualityControl/Quality.h" |
| 22 | +#include "QualityControl/CustomParameters.h" |
| 23 | +#include "QualityControl/Activity.h" |
| 24 | + |
| 25 | +#include <tuple> |
| 26 | + |
| 27 | +class TObject; |
| 28 | +class TH1; |
| 29 | + |
| 30 | +namespace o2::quality_control_modules::common |
| 31 | +{ |
| 32 | + |
| 33 | +/// \brief An interface for comparing two TObject |
| 34 | +class ObjectComparatorInterface |
| 35 | +{ |
| 36 | + public: |
| 37 | + /// \brief Constructor |
| 38 | + ObjectComparatorInterface() = default; |
| 39 | + /// \brief Destructor |
| 40 | + virtual ~ObjectComparatorInterface() = default; |
| 41 | + |
| 42 | + /// \brief comparator configuration via CustomParameters |
| 43 | + // virtual void configure(const o2::quality_control::core::CustomParameters& customParameters, const o2::quality_control::core::Activity activity = {}){}; |
| 44 | + |
| 45 | + /// setter/getter methods for the threshold to define the goodness of the comparison |
| 46 | + void setThreshold(double threshold) { mThreshold = threshold; } |
| 47 | + double getThreshold() { return mThreshold; } |
| 48 | + |
| 49 | + /// perform a number of sanity checks on the input objects |
| 50 | + /// \return a tuple containing pointers to the histogram, the reference histogram, and a boolean indicating the success of the checks |
| 51 | + std::tuple<TH1*, TH1*, bool> checkInputObjects(TObject* object, TObject* referenceObject, std::string& message); |
| 52 | + |
| 53 | + /// \brief objects comparison function |
| 54 | + /// \return the quality resulting from the object comparison |
| 55 | + virtual o2::quality_control::core::Quality compare(TObject* object, TObject* referenceObject, std::string& message) = 0; |
| 56 | + |
| 57 | + private: |
| 58 | + /// the threshold to define the goodness of the comparison |
| 59 | + double mThreshold{ 0 }; |
| 60 | +}; |
| 61 | + |
| 62 | +} // namespace o2::quality_control_modules::common |
| 63 | + |
| 64 | +#endif // QUALITYCONTROL_ObjectComparatorInterface_H |
0 commit comments