Skip to content

Commit b0e71fe

Browse files
author
Alexandre Bigot
committed
Modifs after addind dataPath as argument of initData()
1 parent c4702fc commit b0e71fe

9 files changed

Lines changed: 31 additions & 24 deletions

File tree

Detectors/ITSMFT/common/data/alpideResponseData/CMakeLists.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,11 @@
1717
o2_add_test_root_macro(alpideResponse.C
1818
LABELS "its;mft")
1919

20-
#add_custom_command(COMMAND root -b -q alpideResponse.C+)
21-
#COMMENT "Storing AlpideResponseData for Vbb=0V and -3V in a .root file")
20+
#add_executable(alpide alpideResponse.C)
21+
#add_custom_command(TARGET alpide
22+
# POST_BUILD
23+
# COMMAND root -b -q alpideResponse.C+
24+
# COMMENT "Storing AlpideResponseData for Vbb=0V and -3V in a .root file")
2225

2326
#set(FILE "hello.txt")
2427

Detectors/ITSMFT/common/data/alpideResponseData/alpideResponse.C

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@
66
#include <fstream>
77
#include <iostream>
88

9-
//ClassImp(o2::itsmft::AlpideSimResponse);
10-
119
void alpideResponse()
1210
{
1311
o2::itsmft::AlpideSimResponse resp0, resp1;
1412

15-
std::string mDataPath = "$O2_ROOT/share/Detectors/ITSMFT/data/alpideResponseData/";
16-
gSystem->Exec("mkdir -p mDataPath");
17-
std::string dataFile = mDataPath + "AlpideResponseData.root";
13+
std::string outputPath = "$O2_ROOT/share/Detectors/ITSMFT/data/alpideResponseData/";
14+
std::string mkdirCommand = "mkdir -p " + outputPath;
15+
gSystem->Exec(mkdirCommand.data());
16+
std::string responseFile = outputPath + "AlpideResponseData.root";
1817

19-
resp0.initData(0);
20-
resp1.initData(1);
18+
std::string dataPath = "/home/abigot/alice/O2/Detectors/ITSMFT/common/data/alpideResponseData/";
19+
resp0.initData(0, dataPath.data());
20+
resp1.initData(1, dataPath.data());
2121

22-
auto file = TFile::Open(dataFile.data(),"recreate");
22+
auto file = TFile::Open(responseFile.data(), "new");
2323
file->WriteObjectAny(&resp0,"o2::itsmft::AlpideSimResponse","response0");
2424
file->WriteObjectAny(&resp1,"o2::itsmft::AlpideSimResponse","response1");
2525
file->Close();

Detectors/ITSMFT/common/simulation/include/ITSMFTSimulation/AlpideSimResponse.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ class AlpideSimResponse
106106
float mStepInvDpt = 0; /// inverse step of the Dpt grid
107107
std::vector<AlpideRespSimMat> mData; /// response data
108108
/// path to look for data file
109-
//std::string mDataPath = "$(O2_ROOT)/share/Detectors/ITSMFT/data/alpideResponseData/";
109+
std::string mDataPath;
110110
std::string mGridColName = "grid_list_x.txt"; /// name of the file with grid in Col
111111
std::string mGridRowName = "grid_list_y.txt"; /// name of the file with grid in Row
112112
std::string mColRowDataFmt = "data_pixels_%.2f_%.2f.txt"; /// format to read the data for given Col,Row
@@ -115,7 +115,7 @@ class AlpideSimResponse
115115
AlpideSimResponse() = default;
116116
~AlpideSimResponse() = default;
117117

118-
void initData(int tableNumber, std::string mDataPath); // FIXME TEMPORARY NAME FOR DATA PATH !!!
118+
void initData(int tableNumber, std::string dataPath);
119119

120120
bool getResponse(float vRow, float vCol, float cDepth, AlpideRespSimMat& dest) const;
121121
const AlpideRespSimMat* getResponse(float vRow, float vCol, float vDepth, bool& flipRow, bool& flipCol) const;

Detectors/ITSMFT/common/simulation/include/ITSMFTSimulation/Digitizer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ class Digitizer : public TObject
127127
o2::itsmft::AlpideSimResponse* mAlpSimRespIB = nullptr;
128128
o2::itsmft::AlpideSimResponse* mAlpSimRespOB = nullptr;
129129
o2::itsmft::AlpideSimResponse mAlpSimResp[2]; // simulated response
130-
std::string mdataFile = "$(O2_ROOT)/share/Detectors/ITSMFT/data/alpideResponseData/AlpideResponseData.root";
130+
std::string mResponseFile = "$(O2_ROOT)/share/Detectors/ITSMFT/data/alpideResponseData/AlpideResponseData.root";
131131
const o2::itsmft::GeometryTGeo* mGeometry = nullptr; ///< ITS OR MFT upgrade geometry
132132

133133
std::vector<o2::itsmft::ChipDigitsContainer> mChips; ///< Array of chips digits containers

Detectors/ITSMFT/common/simulation/src/AlpideSimResponse.cxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,18 @@ ClassImp(o2::itsmft::AlpideRespSimMat);
3030

3131
constexpr float micron2cm = 1e-4;
3232

33-
void AlpideSimResponse::initData(int tableNumber, int mDataPath)
33+
void AlpideSimResponse::initData(int tableNumber, std::string dataPath)
3434
{
3535
/*
3636
* read grid parameters and load data
3737
*/
3838
if (tableNumber == 0) // 0V back bias
3939
{
40-
const std::string newDataPath = mDataPath + "Vbb-0.0V";
40+
const std::string newDataPath = dataPath + "Vbb-0.0V";
4141
setDataPath(newDataPath); // setting the new data path
4242
} else if (tableNumber == 1) // -3V back bias
4343
{
44-
const std::string newDataPath = mDataPath + "Vbb-3.0V";
44+
const std::string newDataPath = dataPath + "Vbb-3.0V";
4545
setDataPath(newDataPath); // setting the new data path
4646
}
4747

Detectors/ITSMFT/common/simulation/src/Digitizer.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ void Digitizer::init()
5555

5656
// importing the charge collection tables
5757
// (initialized while building O2)
58-
auto file = TFile::Open(mdataFile.data());
58+
auto file = TFile::Open(mResponseFile.data());
5959
/*std::string response = "response";
6060
for (int i=0; i<2; i++) {
6161
response.append(std::to_string(i));

Detectors/ITSMFT/common/simulation/test/testAlpideSimResponse.cxx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,18 @@
1515
#include <boost/test/unit_test.hpp>
1616
#include <iostream>
1717
#include "ITSMFTSimulation/AlpideSimResponse.h"
18-
#include <fairlogger/Logger.h>
18+
#include "FairLogger.h"
19+
#include <TFile.h>
1920

2021
using namespace o2::itsmft;
2122

2223
BOOST_AUTO_TEST_CASE(AlpideSimResponse_test)
2324
{
2425
// test for the templated Descriptor struct
25-
AlpideSimResponse resp;
26-
resp.initData(1);
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+
2730
float vCol = 1.e-4, vRow = 1.e-4, vDepth = 10.e-4;
2831
LOG(info) << "Checking response from vRow:" << vCol << " vCol:" << vCol
2932
<< " Depth:" << vDepth;

Detectors/Upgrades/IT3/simulation/include/ITS3Simulation/Digitizer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ class Digitizer : public TObject
120120
uint32_t mEventROFrameMin = 0xffffffff; ///< lowest RO frame for processed events (w/o automatic noise ROFs)
121121
uint32_t mEventROFrameMax = 0; ///< highest RO frame forfor processed events (w/o automatic noise ROFs)
122122

123-
std::unique_ptr<o2::itsmft::AlpideSimResponse> mAlpSimResp; // simulated response
123+
o2::itsmft::AlpideSimResponse* mAlpSimResp = nullptr; // simulated response
124124

125125
const o2::its3::GeometryTGeo* mGeometry = nullptr; ///< ITS OR MFT upgrade geometry
126126

Detectors/Upgrades/IT3/simulation/src/Digitizer.cxx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,10 @@ void Digitizer::init()
4747
mChips[i].setChipIndex(i);
4848
}
4949
if (!mParams.getAlpSimResponse()) {
50-
mAlpSimResp = std::make_unique<o2::itsmft::AlpideSimResponse>();
51-
mAlpSimResp->initData(1);
52-
mParams.setAlpSimResponse(mAlpSimResp.get());
50+
std::string responseFile = "$(O2_ROOT)/share/Detectors/ITSMFT/data/alpideResponseData/AlpideResponseData.root";
51+
auto file = TFile::Open(responseFile.data());
52+
mAlpSimResp = (o2::itsmft::AlpideSimResponse*)file->Get("response1");
53+
mParams.setAlpSimResponse(mAlpSimResp);
5354
}
5455
mParams.print();
5556
mIRFirstSampledTF = o2::raw::HBFUtils::Instance().getFirstSampledTFIR();

0 commit comments

Comments
 (0)