Questions about the TrendingTask in Framework

Dear all,

We are currently working on the trending of the TPC. We noticed there is already a convenience class TrendingTask implemented in QualityControl/Framework/ to do some basic trending and we have some questions about its current status:

  • At the moment, every histogram which should be trended is passed one by one in the dataSources, in the json file (e.g. postprocessing.json, ExampleTrend, in QualityControl/Framework), and thus, this causes a lot of code duplication. We want to test the trending of two PID histograms, which have the same paths and reductors and this gives in our json file:
        "dataSources": [
          {
            "type": "repository",
            "path": "qc/TPC/PID",
            "name": "hNClusters",
            "reductorName": "o2::quality_control_modules::common::TH1Reductor",
            "moduleName": "QcCommon"
          },
          {
            "type": "repository",
            "path": "qc/TPC/PID",
            "name": "hPhi",
            "reductorName": "o2::quality_control_modules::common::TH1Reductor",
            "moduleName": "QcCommon"
          },
          {
            "type": "repository-quality",
            "path": "qc/TPC/PID",
            "name": "hNClusters",
            "reductorName": "o2::quality_control_modules::common::QualityReductor",
            "moduleName": "QcCommon"
          }
        ],

Other tasks like the checkers are passing vectors of MOs, which reduce the amount of duplicated information in the json file (see QualityControl/Modules/TPC/run/tpcQCClusterChecker.json):

    "checks": {
      "PIDClusterCheck": {
        "active": "true",
        "className": "o2::quality_control_modules::tpc::PIDClusterCheck",
        "moduleName": "QcTPC",
        "policy": "OnAny",
        "dataSource": [{
          "type": "Task",
          "name": "PID",
          "MOs": ["hNClusters"]
        }]
      },
      "TrackClusterCheck": {
        "active": "true",
        "className": "o2::quality_control_modules::tpc::TrackClusterCheck",
        "moduleName": "QcTPC",
        "policy": "OnAny",
        "dataSource": [{
          "type": "Task",
          "name": "Tracks",
          "MOs": ["hNClustersBeforeCuts"]
        }]
      }
    }

We would like to ask if it would be possible to introduce something similar also in the trending, like grouping the histograms with the same path and same reductorName (e.g. TH1-Reductor). Or are there some computational inefficiencies which are preventing it?

  • We also noticed that only the TH1 histograms are implemented in TrendingTask. Are there plans to implement in the Framework also the TH2 histograms and the addition of the checkers, as the corresponding reductors QualityControl/Modules/Common/.../TH2Reductor.* and QualityControl/Modules/Common/.../QualityReductor.* already exist?

Best,
Marcel and Cindy

Hello,
Thanks for the feedback!

That totally makes sense, I’ve added it to my todo list Cern Authentication . That seems like a quick thing to do, so I should find some time to do it this week.

They should work already. You just have to choose TH2Reductor instead of TH1Reductor in the configuration file and point to your 2D histogram. If it doesn’t work, could you show me your configuration and logs?

Cheers,
Piotr

Hi Piotr,

Thanks for your fast answer.

We were ready to try to add these vectors for the TPC, but we thought it could be useful to everyone.

They should work already. You just have to choose TH2Reductor instead of TH1Reductor in the configuration file and point to your 2D histogram. If it doesn’t work, could you show me your configuration and logs?

In QualityControl/Framework/src/TrendingTask.cxx, the method storePlots() does the postprocessing of the plot only for TH1*. On line 123 and following, there is:

    // Postprocessing the plot - adding specified titles, configuring time-based plots, flushing buffers.
    // Notice that axes and title is drawn using a histogram, even in the case of graphs.
    if (auto histo = dynamic_cast<TH1*>(c->GetPrimitive("htemp"))) {
      ...
    } else {
      ILOG(Info) << "Could not get the htemp histogram of the plot '" << plot.name << "'." << ENDM;
    }

Is this only for TH1 histograms or can it take also into account TH2 histograms?

Best,
Marcel and Cindy

This is the code that handles generating plots, not reducing data sources like TH1, TH2, Qualities, etc…

It might be a bit misleading indeed - the problem is that when we use TTree::Draw, the plot that we get is usually drawn on a TH1, regardless whether it is a histogram or a graph. As far as I know, you cannot use Draw() to get 2D histograms out of a TTree (at least it is not indicated in its documentation).

Retrieving objects, reducing them to sets of parameters and storing them in a TTree in takes place in TrendingTask::trendValues(). As you can see there, it is a Reductor responsibility to handle a certain object type. Implementing a proper Reductor is completely enough to trend an object of a given type.

I hope that explains it better :slight_smile:

We indeed misunderstood this part of the script, but it is much clearer now with your explanations.
Thank you a lot.

We will try to trend TH2* and Quality histograms and we will tell you if there is a problem.

Best,
Marcel and Cindy

The PR which allows to specify a vector of object names has been merged ( https://github.com/AliceO2Group/QualityControl/pull/352 ).

Hi Piotr,

I am sorry for not answering earlier. I have updated my QC and the vector of object names work for both repository and repository-quality objects work . =D
Thanks a lot again

Best,
Cindy