Project
Loading...
Searching...
No Matches
testResponse.cxx
Go to the documentation of this file.
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.
14
15#define BOOST_TEST_MODULE Test MCHSimulation Response
16#define BOOST_TEST_DYN_LINK
17
18#include <boost/test/unit_test.hpp>
19#include <memory>
20#include <vector>
21
23
24#include "TH1D.h"
25#include "TF1.h"
26
27namespace o2
28{
29namespace mch
30{
31
32BOOST_TEST_DECORATOR(*boost::unit_test::disabled())
34{
35 // check transition between energy and charge
36 // check integration via Mathieson
37 // check FEE response
38 Response r_stat1(Station::Type1);
40
41 // check conversion energy to charge
42 float eloss = 1e-6;
43 TH1D hTest("hTest", "", 10000, 0, 1000);
44 TF1 gaus("gaus", "gaus");
45 for (int i = 0; i < 1000000; i++) {
46 hTest.Fill(r_stat1.etocharge(eloss));
47 }
48
49 hTest.Fit("gaus", "Q");
50
51 float charge_target = 137.15721769834721;
52 float charge_precision = charge_target / 100.f;
53 BOOST_CHECK_CLOSE(gaus.GetParameter(1), charge_target, charge_precision);
54 // TODO, if needed
55 float charge_resolution_target = 21.7099991;
56 float charge_resolution_precision = charge_resolution_target / 100.f;
57 BOOST_CHECK_CLOSE(gaus.GetParameter(2), charge_resolution_target, charge_resolution_precision);
58
59 // test Mathieson integration on Pad
60 // total charge to be distributed
61 float charge_on_plane = 100.f;
62 // borders with some distance to anode
63 // smallest pad dimension for stat.
64 float xmin = -0.658334;
65 float xmax = -0.0283;
66 float ymin = -0.0934209;
67 float ymax = 0.326579;
68
69 float expected_chargeonpad_stat1 = 0.29306942 * charge_on_plane;
70
71 float chargeonpad_precision = expected_chargeonpad_stat1 / 10.f;
72 float result_chargeonpad_stat1 = r_stat1.chargePadfraction(xmin, xmax, ymin, ymax) * charge_on_plane;
73 BOOST_CHECK_CLOSE(result_chargeonpad_stat1, expected_chargeonpad_stat1, chargeonpad_precision);
74
75 // test r_stat2
76 xmin = -0.428572;
77 xmax = 0.285714;
78 ymin = -0.108383;
79 ymax = 9.89162;
80 float expected_chargeonpad_stat2 = 0.633606318 * charge_on_plane;
81 chargeonpad_precision = expected_chargeonpad_stat2 / 10.f;
82 float result_chargeonpad_stat2 = r_stat2.chargePadfraction(xmin, xmax, ymin, ymax) * charge_on_plane;
83 BOOST_CHECK_CLOSE(result_chargeonpad_stat2, expected_chargeonpad_stat2, chargeonpad_precision);
84 // todo some test of chargeCorr? function, not so obvious
85 // getAnod, necessary to do?
86}
87
88} // namespace mch
89} // namespace o2
int32_t i
float chargePadfraction(float xmin, float xmax, float ymin, float ymax) const
Definition Response.h:55
float etocharge(float edepos) const
Definition Response.cxx:51
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
BOOST_AUTO_TEST_CASE(FlatHisto)