Giter Site home page Giter Site logo

qntools's Introduction

QnTools

Build Status

QnTools provides methods for an iterative data-based correction procedure, which was explored in the paper Effects of nonuniform acceptance in anisotropic flow measurements. It extends the functionality of FlowVectorCorrections. In Addition, it provides functions to correlate the corrected Qn-Vectors. It uses the ROOT RDataFrame to read ROOT TTrees.

How to build

Requirements:

  • ROOT 6.20 (with MathMore)
  • C++17 compatible compiler
  • CMake 3.13

qntools's People

Contributors

eugene274 avatar kreisl avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

qntools's Issues

Proposal: remove static polymorphism of CorrectionManager::AddDetector

Currently CorrectionManager::AddDetector has integer template parameter N which defines size of raw C++ array for the list of needed harmonics in the argument of AddDetector.

Despite we rarely change this parameter, static-ness of AddDetector conceptually blocks any possibility for complete runtime configuration of correction task.

googletest master->main

when cmake prepares build:
Cloning into 'googletest-src'...
fatal: invalid reference: master

change master to main in tests/CMakeLists.txt.in

QnTools - correction logic

Hi Lukas,

I'm trying to run flow analysis for our data in NA61/Shine. I'm seeing now weird difference between 'x' and 'y' component (not seen before), so I decided to look into correction step to understand what is going on.

There is a Q-vector pion_neg_pt which is related to negative pions. Corrections: RECENTERING, TWIST-AND-RESCALE. Normalization: sum of weights. Weight: Ones.

I'm looking at single kinematic bin, only events where number of contributing vectors == 1. So, it is data_[0] and data_[0].n_ == 1

PLAIN: First harmonic x and y
xVsY_PLAIN_n1

Circle is expected, circle is found. Non-uniform acceptance of the NA61 is clearly seen here.

Same plot, but now RECENTERED:

xVsY_RECENTERED_n1

I expected to see one circle (since it is only one kinematical bin) with shifted centre. But here centre is fluctuating (event-by-event).

Can you clarify this?

Weights constraint

Dear all,

In src/dataframe/correlation/CorrelationAction.hpp there is a specific condition in LoopOverBins() function (lines 314 and 325):
if sum of weights is smaller than 1, this entry is not added to correlations.

I wonder if this condition is necessary. And what about case of magnitude normalization, when we can operate with weights smaller than 1?

Problem with selection bins on axis with non-uniform-width binning

Dear @kreisl,

Recently, I faced the problem while attempting to select bins on an axis with non-uniform-width binning. An example of the problem appearance you can find in my repository:
https://github.com/mam-mih-val/qn_tools_test
Please, use the file, attached to the project.

If you try to select the 9 out of 10 initial bins on pT-axis, you see, that bin-edges are biased after the operation. Moreover, the conversion of the container with selected bins into TGraph somehow gives the third version of binning with 5 bins, not similar to the previous two.

I Hope, you can sort it out, or explain if I'm doing something wrong

Cheers,
Mikhail

Construction of observables

Which operations are needed to construct our flow observables? We should document all of them and make sure every path is implemented.

Bug in calculation the fraction

@kreisl, developing the inteface for resolution and flow calculation I faced the problem.

Here's the bug:
Division of multidimensional data container of stats by non-zero one-dimensional data container gives inf/nan in result container.
In the same time, making projection on one axis, gives adequate result. And projection on two axis gives inf/nan too.

Numerator and denuminator are both refference-weighted.

nan values from StatCalculate::StdDevOfMeanFromBootstrapVariance

Hi!

In the condition of the real analysis it may happen so one or few means from bootstrap get nan.

In this case the nan-ish bootstrap mean will be propagated to all derivative objects i.e results of arithmetical operations, merges et cetera.

The most annoying thing is that even a single nan in the vector of bootstrap means ruins statistical error of the bin.

It happens in the StatCalclulate::VarianceOfMeanFromBootstrap:

stats.Fill(sample_means_[i], sample_weights_[i]);

I don't know when and where to filter out nans and who shall take care of it (keep in mind that user has no access to b-p samples). But I think it make sense to introduce guard to the StatCalclulate::VarianceOfMeanFromBootstrap. We can lose few samples per bin, but number of samples is usually a large number (for me it's 50), so I guess we can survive this.

AverageHelper: crash during Finalize

I'm getting out of range error at this line:

results_[0]->CopyInitializedState(*results_.at(first_configured));

Both results_ and is_configured_ have 1 element and is_configure_[0] = false.
In this situation iterator

std::find_if(std::begin(is_configured_), std::end(is_configured_),

points to is_configured_.end(). And it gives out of range index for results_.

I don't know whether this is healthy situation or not.

UPD. This is happening when tree->GetEntries() == 0

Missing includes

HeavyIonAnalysis/QnAnalysis#16

Hi,
My installation throws errors during the compilation:

QnAnalysis/build/_deps/qntools-src/include/base/QnTools/DataContainer.hpp:407:12: error: no member named 'set' in namespace 'std'

Proposed solution:
add #include in DataContainer.hpp and #include <TObjString.h> in CorrelationTaskRunner.cpp

Bootstrapping enhancements

  • Add QA plots
    • distribution of bootstrapping sample means
    • convergence of bootstrapped uncertainties
  • Select number of samples used to evaluate bootstrapped uncertainties

Qn::ToTGraph, counter is not incremented if Sumw <= 0

Hi,

I found something which looks like a bug.

if (bin.SumWeights() <= 0) continue;

If sum of weights equals to zero, loop is continued and ibin is not incremented.
Further it is used to get bin ranges:

auto xhi = data.GetAxes().front().GetUpperBinEdge(ibin);

...and to append TGraph
graph->SetPoint(ibin, x, y);

Deprecation of TROOT::GetImplicitMTPoolSize

With root v6.22 I'm getting warning:

In file included from /home/eugene/CLionProjects/QnAnalysis/cmake-build-debug/_deps/qntools-src/src/dataframe/common/AverageHelper.hpp:28,
                 from /home/eugene/CLionProjects/QnAnalysis/cmake-build-debug/_deps/qntools-src/src/dataframe/QnDataFrame.hpp:20,
                 from /home/eugene/CLionProjects/QnAnalysis/src/QnAnalysisCorrelate/CorrelationTaskRunner.hpp:22,
                 from /home/eugene/CLionProjects/QnAnalysis/src/QnAnalysisCorrelate/CorrelationTaskRunner.cpp:8:
/home/eugene/SOFT/ROOT/root-6.22.02.gcc10.1/include/TROOT.h:89:11: note: declared here
   89 |    UInt_t GetImplicitMTPoolSize() R__DEPRECATED(6, 24, "Please use ROOT::GetThreadPoolSize() instead");

cumulants with particle weights.

How to handle power of weights that enter in the cumulants calculated from the Q-vectors.
Right now we need a Q-vector / Detector for each power. So to calculate v_2{4} 4 different weights are needed.
Is there some smarter way, how to store this information in the Q-vector internally?
See https://doi.org/10.1103/PhysRevC.83.044913 appendix B for more information.

Problem with Bootstrap error in Qn::DataContainerStatCalculate

Dear @kreisl,
I faced a problem with error calculation using bootstrapping in Qn::DataContainerStatCalculate. I read Qn::DataContainerStatCollect (correlations after correlation task) from file, then convert this containers to StatCalculate type and perform resolution calculation. And if I use bootstrap flag for error calculation, I get almost 50% errors on their relative value. At the same time if I switch to propagation error type, I get rather smaller errors. The correlations were filled using 50 samples.
So, can you please tell if I do something wrong, and if not check if there's a bug in error calculation with bootstrapping.

QnToolsSimulationTests: /usr/bin/ld: cannot find -lROOTVecOps

This issue appeared today after pulling from master. It appears while QnToolsSimulationTests is being built.

$ root-config --version
6.20/04
$ root-config --features
cxx17 asimage builtin_clang builtin_llvm builtin_vdt clad dataframe exceptions fftw3 fitsio gdml http mathmore mlp pyroot roofit webgui root7 runtime_cxxmodules shared ssl tmva tmva-pymva spectrum vdt x11

Removing ROOTVecOps from dependencies list fixes the problem. This is weird, because libROOTVecOps.so exists in the system.

I propose:

  • Remove ROOTVecOps from QnToolsSimulationTests (or make it optional)
  • Set building of QnToolsSimulationTests optional

Problem with Qn::DataContainerStats arithmetics

Dear @kreisl,
We found a bunch of bugs connected to Qn::DataContainerStats arithmetics.

  1. If we process any arithmetics on DataContainer and then try rebin this container, we'll get an exceprion thrown:
    std::logic_error
    what(): Cannot merge Stats. Please check prior operations.
    Aborted (core dumped)
  2. If we do any division operation like observed flow divide on resolution, and oserved flow container is multidimensional, we'll get failed any projection axis with
    terminate called after throwing an instance of 'std::out_of_range'
    what(): vector of samples is empty.
    Of course, the numerator is observable-type, the denumerator is reference-type.

Can you please check this?

Machinery for systematics studies in Qn::StatCalculate

(draft based on discussion with Ilya)

To evaluate systematic uncertainties we compare different estimations (Q-vector components, reference subevent, cuts, etc).
Currently Qn::StatCalculate provides machinery to evaluate only statistical uncertainties.
To evaluate systematic uncertainties one has to operate either on exported TGraph or play with DataContainer and develop own structures to keep variations and maintain consistency during various transformations.

Ilya proposed to extend current Qn::StatCalculate with internal field (structure) Systematics which will keep systematic variations and calculate significance of variation.
Variations (V) are added to 'reference' (R) estimation (it is usually all components and all references combined), so I propose method: Qn::StatCalculate::AddVariation (const Qn::StatCalculate& variation)

Internal structure Systematics contains list of systematic variations each of them consists of:

  • Variation itself (Qn::StatCalculate?)
  • Sample-by-sample difference between variation (V) and the (R) reference. It could be Qn::StatCalculare object (R-V).

For QA purposes I propose to keep (or calculate ad-hoc) in Systematics a matrix with correlations:

      ||       R       |      V1       |      V2       | ...
|  R  ||       1       |  cor(R,V1)    | cor(R,V2)     | ...
|  V1 || cor(V1,R)     |         1     | cor(V1,V2)    | ... 

Where correlation coefficient is obtained as follows

cor(R,V) = sum_{b-st. samples} (R_s - <R>) (V_s - <V>)/Var(R)/Var(V)

Using this matrix one can obtain 'independent' (uncorrelated) sources of systematic uncertainty by changing basis.
See:
https://en.wikipedia.org/wiki/Principal_component_analysis and
https://root.cern.ch/doc/master/classTPrincipal.html

New correlation weights management

Hi!

I've recently found that you refactored management of weights for correlation task. So now I have to pass two functions one for correlation itself and another one which evaluates weights.

I have few questions concerning underlying math.
Previously we had OBSERVABLE type and REFERENCE type of Q-vectors. Is there a representation of those types in new version?
You added weights functions into CorrelationFunctions.hpp. Maybe I'm stupid, but I cannot catch new notation (n2, nd2,etc). Can you clarify this? I see also that there is a common ansatz for weights of the form M(M-1). Can you also say few words on that?

Thanks a lot!

QnTools as a subproject (subdirectory)

New CMake (since 3.11.4) provides cool feature FetchContent which allows more convenient dependency management. Unlike ExternalProject it incorporates configuration of external project (targets, etc) into configuration of the dependent project. Under the hood it calls add_subdirectory(_deps/QnTools).

Unfortunately at this moment QnTools cannot be used as subproject. But it requires very minor changes (mainly replacement CMAKE_SOURCE_DIR with CMAKE_CURRENT_SOURCE_DIR)

Backward compatibility

Good day!
@kreisl, as I understand it correctly, new version of QnTools isn't compatible with content of files created with older versions of the framework, is it? Can you please add backward compatibility to the package so we can use it with on DataContainers made with older versions.

QnTools with old ROOT

Hi!

Colleagues reported that QnTools requires minimum 6/20 version of ROOT:

find_package(ROOT 6.20 CONFIG REQUIRED)

I'm fully supporting the idea to not care about compatibility with really old software but ROOT 6/18 is not that old in my opinion. For example at the moment CBM is providing root-6.16.00-gcc-8.1.0-nrkpihv.

Dedicated flag for switching on/of tests

Now QnTools enables tests if CMAKE_BUILD_TYPE == Debug. Lets do a dedicated flag (QnTools_BUILD_TESTS) so we could explicitly switch off tests if QnTools is a part (dependency) of other project.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.