Project
Loading...
Searching...
No Matches
testAlpideSimResponse.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.
11
12#define BOOST_TEST_MODULE Test AlpideSimResponse
13#define BOOST_TEST_MAIN
14#define BOOST_TEST_DYN_LINK
15#include <boost/test/unit_test.hpp>
16#include <iostream>
18#include "FairLogger.h"
19#include <TFile.h>
20
21using namespace o2::itsmft;
22
23BOOST_AUTO_TEST_CASE(AlpideSimResponse_test)
24{
25 // test for the templated Descriptor struct
26 std::string responseFile = "$(O2_ROOT)/share/Detectors/ITSMFT/data/AlpideResponseData/AlpideResponseData.root";
27 auto file = TFile::Open(responseFile.data());
28 AlpideSimResponse resp = *(o2::itsmft::AlpideSimResponse*)file->Get("response1");
29
30 float vCol = 1.e-4, vRow = 1.e-4, vDepth = 10.e-4;
31 LOG(info) << "Checking response from vRow:" << vCol << " vCol:" << vCol
32 << " Depth:" << vDepth;
33 bool flipCol, flipRow;
34 auto respMat = resp.getResponse(vRow, vCol, resp.getDepthMax() - vDepth, flipRow, flipCol);
35 BOOST_CHECK(respMat != nullptr);
36 respMat->print(flipRow, flipCol);
37 // repsonse at central pixel for electron close to the surface should be >>0
38 int pixCen = respMat->getNPix() / 2;
39 LOG(info) << "Response at central pixel " << pixCen << ":" << pixCen
40 << " is " << respMat->getValue(pixCen, pixCen, flipRow, flipCol);
41 BOOST_CHECK(respMat->getValue(pixCen, pixCen, flipRow, flipCol) > 1e-6);
42 //
43 // check normalization
44 float norm = 0.f;
45 for (int ir = respMat->getNPix(); ir--;) {
46 for (int ic = respMat->getNPix(); ic--;) {
47 norm += respMat->getValue(ir, ic, flipRow, flipCol);
48 }
49 }
50 LOG(info) << "Total response to 1 electron: " << norm;
51 BOOST_CHECK(norm > 0.1);
52}
Definition of the ITSMFT Alpide simulated response parametrization.
bool getResponse(float vRow, float vCol, float cDepth, AlpideRespSimMat &dest) const
BOOST_AUTO_TEST_CASE(Cluster_messageable)
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"
BOOST_CHECK(tree)
o2::InteractionRecord ir(0, 0)