Skip to content

Commit ccd75ae

Browse files
committed
print out the resp centre in the CheckChipResponseFile
1 parent 6c8c904 commit ccd75ae

File tree

1 file changed

+31
-20
lines changed

1 file changed

+31
-20
lines changed

Detectors/Upgrades/ITS3/macros/test/CheckChipResponseFile.C

Lines changed: 31 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
#define ENABLE_UPGRADES
2626
#include "ITSMFTSimulation/AlpideSimResponse.h"
27+
#include "ITS3Simulation/ChipSimResponse.h"
2728

2829
#include "ITS3Base/SegmentationMosaix.h"
2930
#include "fairlogger/Logger.h"
@@ -34,40 +35,50 @@ using SegmentationMosaix = o2::its3::SegmentationMosaix;
3435
double um2cm(double um) { return um * 1e-4; }
3536
double cm2um(double cm) { return cm * 1e+4; }
3637

37-
o2::itsmft::AlpideSimResponse *mAlpSimResp0 = nullptr,
38-
*mAlpSimResp1 = nullptr,
39-
*mAptSimResp1 = nullptr;
38+
std::unique_ptr<o2::its3::ChipSimResponse> mAlpSimResp0, mAlpSimResp1, mAptSimResp1;
4039

41-
o2::itsmft::AlpideSimResponse* loadResponse(const std::string& fileName, const std::string& respName)
40+
std::unique_ptr<o2::its3::ChipSimResponse> loadResponse(const std::string& fileName, const std::string& respName)
4241
{
4342
TFile* f = TFile::Open(fileName.data());
4443
if (!f) {
4544
std::cerr << fileName << " not found" << std::endl;
4645
return nullptr;
4746
}
48-
auto resp = (o2::itsmft::AlpideSimResponse*)f->Get(respName.data());
49-
if (!resp)
47+
auto base = f->Get<o2::itsmft::AlpideSimResponse>(respName.c_str());
48+
if (!base) {
5049
std::cerr << respName << " not found in " << fileName << std::endl;
51-
return resp;
50+
return nullptr;
51+
}
52+
return std::make_unique<o2::its3::ChipSimResponse>(base);
5253
}
5354

5455
void LoadRespFunc()
5556
{
5657
std::string AptsFile = "$(O2_ROOT)/share/Detectors/Upgrades/ITS3/data/ITS3ChipResponseData/APTSResponseData.root";
5758
std::string AlpideFile = "$(O2_ROOT)/share/Detectors/ITSMFT/data/AlpideResponseData/AlpideResponseData.root";
5859

60+
std::cout<<"=====================\n";
61+
LOGP(info, "ALPIDE Vbb=0V response");
5962
mAlpSimResp0 = loadResponse(AlpideFile, "response0"); // Vbb=0V
60-
LOG(info) << "ALPIDE Vbb=0V response" << std::endl;
63+
mAlpSimResp0->computeCentreFromData();
6164
mAlpSimResp0->print();
65+
LOGP(info, "Response Centre {}", mAlpSimResp0->getRespCentreDep());
66+
std::cout<<"=====================\n";
67+
LOGP(info, "ALPIDE Vbb=-3V response");
6268
mAlpSimResp1 = loadResponse(AlpideFile, "response1"); // Vbb=-3V
63-
LOG(info) << "ALPIDE Vbb=-3V response" << std::endl;
69+
mAlpSimResp1->computeCentreFromData();
6470
mAlpSimResp1->print();
71+
LOGP(info, "Response Centre {}", mAlpSimResp1->getRespCentreDep());
72+
std::cout<<"=====================\n";
73+
LOGP(info, "APTS response");
6574
mAptSimResp1 = loadResponse(AptsFile, "response1"); // APTS
66-
LOG(info) << "APTS response" << std::endl;
75+
mAptSimResp1->computeCentreFromData();
6776
mAptSimResp1->print();
77+
LOGP(info, "Response Centre {}", mAptSimResp1->getRespCentreDep());
78+
std::cout<<"=====================\n";
6879
}
6980

70-
std::vector<float> getCollectionSeediciencies(o2::itsmft::AlpideSimResponse* resp,
81+
std::vector<float> getCollectionSeediciencies(o2::its3::ChipSimResponse* resp,
7182
const std::vector<float>& depths)
7283
{
7384
std::vector<float> seed;
@@ -81,7 +92,7 @@ std::vector<float> getCollectionSeediciencies(o2::itsmft::AlpideSimResponse* res
8192
return seed;
8293
}
8394

84-
std::vector<float> getShareValues(o2::itsmft::AlpideSimResponse* resp,
95+
std::vector<float> getShareValues(o2::its3::ChipSimResponse* resp,
8596
const std::vector<float>& depths)
8697
{
8798
std::vector<float> share;
@@ -103,7 +114,7 @@ std::vector<float> getShareValues(o2::itsmft::AlpideSimResponse* resp,
103114
return share;
104115
}
105116

106-
std::vector<float> getEffValues(o2::itsmft::AlpideSimResponse* resp,
117+
std::vector<float> getEffValues(o2::its3::ChipSimResponse* resp,
107118
const std::vector<float>& depths)
108119
{
109120
std::vector<float> all;
@@ -135,7 +146,7 @@ void CheckChipResponseFile()
135146

136147
int colors[] = {kOrange + 7, kRed + 1, kAzure + 4};
137148
struct RespInfo {
138-
o2::itsmft::AlpideSimResponse* resp;
149+
std::unique_ptr<o2::its3::ChipSimResponse>& resp;
139150
std::string title;
140151
int color;
141152
};
@@ -154,11 +165,11 @@ void CheckChipResponseFile()
154165
for (auto& r : responses) {
155166
if (!r.resp)
156167
continue;
157-
auto seed = getCollectionSeediciencies(r.resp, vecDepth);
158-
auto shr = getShareValues(r.resp, vecDepth);
159-
auto all = getEffValues(r.resp, vecDepth);
168+
auto seed = getCollectionSeediciencies(r.resp.get(), vecDepth);
169+
auto shr = getShareValues(r.resp.get(), vecDepth);
170+
auto all = getEffValues(r.resp.get(), vecDepth);
160171

161-
TGraph* grSeed = new TGraph(vecDepth.size(), vecDepth.data(), seed.data());
172+
auto grSeed = new TGraph(vecDepth.size(), vecDepth.data(), seed.data());
162173
grSeed->SetTitle(Form("%s seed", r.title.c_str()));
163174
grSeed->SetLineColor(r.color);
164175
grSeed->SetLineWidth(2);
@@ -168,7 +179,7 @@ void CheckChipResponseFile()
168179
grSeed->Draw("SAME LP");
169180
leg->AddEntry(grSeed, Form("%s seed", r.title.c_str()), "lp");
170181

171-
TGraph* grShare = new TGraph(vecDepth.size(), vecDepth.data(), shr.data());
182+
auto grShare = new TGraph(vecDepth.size(), vecDepth.data(), shr.data());
172183
grShare->SetLineColor(r.color);
173184
grShare->SetLineWidth(2);
174185
grShare->SetMarkerColor(r.color);
@@ -177,7 +188,7 @@ void CheckChipResponseFile()
177188
grShare->Draw("SAME LP");
178189
leg->AddEntry(grShare, Form("%s share", r.title.c_str()), "p");
179190

180-
TGraph* grEff = new TGraph(vecDepth.size(), vecDepth.data(), all.data());
191+
auto grEff = new TGraph(vecDepth.size(), vecDepth.data(), all.data());
181192
grEff->SetLineColor(r.color);
182193
grEff->SetLineWidth(2);
183194
grEff->SetMarkerColor(r.color);

0 commit comments

Comments
 (0)