sipm-characterisation 0.1.0
SiPM characterisation for ePIC — IV/DCR/gain, laser, readout, irradiation
Loading...
Searching...
No Matches
ureadout_dcr_get.C
Go to the documentation of this file.
1#pragma once
2
4ureadout_dcr_get(const std::string filename, const std::string whatx, const std::string whaty = "dead_rate")
5{
6 auto fin = TFile::Open(filename.c_str());
7 if (!fin || !fin->IsOpen()) return nullptr;
8 auto tin = (TTree *)fin->Get("ureadout_dcr_scan");
9 if (!tin) return nullptr;
10
13 tin->SetBranchAddress("bias_dac", &bias_dac);
14 tin->SetBranchAddress("bias_voltage", &bias_voltage);
15 tin->SetBranchAddress("base_threshold", &base_threshold);
16 tin->SetBranchAddress("threshold", &threshold);
17 tin->SetBranchAddress("raw_rate", &raw_rate);
18 tin->SetBranchAddress("raw_ratee", &raw_ratee);
19 tin->SetBranchAddress("dead_rate", &dead_rate);
20 tin->SetBranchAddress("dead_ratee", &dead_ratee);
21 tin->SetBranchAddress("fit_rate", &fit_rate);
22 tin->SetBranchAddress("fit_ratee", &fit_ratee);
23
24 auto g = new TGraphErrors;
25
26 std::map<std::string, float> x, y, ey;
27
28 for (int iev = 0; iev < tin->GetEntries(); ++iev) {
29 tin->GetEntry(iev);
30
31 x["bias_voltage"] = bias_voltage;
32 x["threshold"] = threshold;
33
34 y["raw_rate"] = raw_rate;
35 y["dead_rate"] = dead_rate;
36 y["fit_rate"] = fit_rate;
37
38 ey["raw_rate"] = raw_ratee;
39 ey["dead_rate"] = dead_ratee;
40 ey["fit_rate"] = fit_ratee;
41
42 if (!x.count(whatx)) {
43 std::cout << "unknown whatx: " << whatx << std::endl;
44 continue;
45 }
46
47 if (!y.count(whaty) || !ey.count(whaty)) {
48 std::cout << "unknown whaty: " << whaty << std::endl;
49 continue;
50 }
51 g->SetPoint(iev, x[whatx], y[whaty]);
52 g->SetPointError(iev, 0., ey[whaty]);
53 }
54
55 g->Sort();
56 return g;
57}
TH2_Type * build_fine_tune_raw_histogram(std::vector< TString > kInputFileNames, TString kRunTag, TString kOutputFileName, bool kRecalculate)
Functions -------------------------------------------------------------------------------------------...
Definition fine_analysis.h:80
float threshold
Definition my_test_macro_for_WF_fitting.C:6
TGraphErrors * ureadout_dcr_get(const std::string filename, const std::string whatx, const std::string whaty="dead_rate")
Definition ureadout_dcr_get.C:4