-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpedestal.C
More file actions
71 lines (50 loc) · 1.54 KB
/
pedestal.C
File metadata and controls
71 lines (50 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#include <algorithm> // for min_element, max_element
void donewpart(const char*, int);
void pedestal()
{
donewpart("20151030-1532",50);
}
void donewpart(const char *basename, int nbins)
{
TCanvas *c1 = new TCanvas();
double content;
ifstream fin7(Form("TEMP/%s_Unaveraged_VMin2.txt",basename));
vector<double> voltage7;
while(fin7>>content)
{
voltage7.push_back(content);
}
fin7.close();
cout << voltage7.size() << endl;
int numberD = voltage7.size();
cout << numberD << endl;
// --- get the max, min of the vector
double max = *max_element(voltage7.begin(),voltage7.end());
double min = *min_element(voltage7.begin(),voltage7.end());
cout << max << endl;
cout << min << endl;
// --- calculate the limits for the histograms
double newmax = min*-0.95;
double newmin = max*-1.05 - newmax*0.1;
TH1D *h7 = new TH1D("h7","",nbins,newmin,newmax);
for(int i=0; i<numberD; i++)
{
// --- SiPM1
h7->Fill(-voltage7[i]);
}
h7->SetLineColor(kRed);
h7->SetLineWidth(2);
// --- adjust limits
double peconvert = 0.00502; // volts per photoelectrion
h7->GetXaxis()->SetLimits(newmin/peconvert,newmax/peconvert);
// --- draw
// h7->Scale(1.0/numberD);
h7->Draw();
c1->SetLogy(0);
c1->Print(Form("Pedestals/%s_pedestals_part3.png",basename));
c1->Print(Form("Pedestals/%s_pedestals_part3.pdf",basename));
c1->SetLogy(1);
c1->Print(Form("Pedestals/%s_pedestals_part3_log.png",basename));
c1->Print(Form("Pedestals/%s_pedestals_part3_log.pdf",basename));
delete h7;
}