-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFillMaxCharge.C
More file actions
170 lines (134 loc) · 4.35 KB
/
Copy pathFillMaxCharge.C
File metadata and controls
170 lines (134 loc) · 4.35 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
////////////////////////////////////
// FillMaxCharge.C //
////////////////////////////////////
// This makes a histogram for each HBD channel showing:
// -Maximum Charge.
// -Time slice with maximum charge.
// -Correlation between these two.
#include "FillMaxCharge.h"
#include "TF1.h"
#include "TH1D.h"
#include "TH2D.h"
#include "APad.h"
#include "PID.h"
#include "cyclops.h"
#include <iostream>
#include <cmath>
TH2D *TPCEventDisplay=0;
TH2D *HBDEventDisplay=0;
TH2D *HBDBeamSpot=0;
TH2D *Psych;
TH1D *NumberInTime=0;
TH1D *OneChargeInTime=0;
TH1D *TotalChargeInTime=0;
TH1D *TotalChargeInTime_Hit=0;
TH1D *TotalChargeInTime_Miss=0;
TH1D *MaxMaxCharge=0;
TH2D *MaxMaxChargeVsTime=0;
TH2D *MaxMaxChargeVsNeighbor=0;
TH1D *MaxCharge[9];
TH1D *MaxChargeTime[9];
TH2D *MaxChargeVsTime[9];
using namespace std;
void FillMaxCharge()
{
if (!IsBeam()) return;
int nTime = APad::Cal[0].size();
double left = -0.5;
double right = (double)nTime - 0.5;
if (!MaxMaxCharge)
{
NumberInTime = new TH1D("NumberInTime","NumberInTime",9,-0.5,8.5);
TotalChargeInTime = new TH1D("TotalChargeInTime","TotalChargeInTime",300,-300.5,3000.5);
TotalChargeInTime_Hit = new TH1D("TotalChargeInTime_Hit","TotalChargeInTime_Hit",300,-300.5,3000.5);
TotalChargeInTime_Miss = new TH1D("TotalChargeInTime_Miss","TotalChargeInTime_Miss",300,-300.5,3000.5);
OneChargeInTime = new TH1D("OneChargeInTime","OneChargeInTime",300,-300.5,3000.5);
MaxMaxCharge = new TH1D("MaxMaxCharge","MaxMaxCharge",300,-300.5,3000.5);
MaxMaxChargeVsTime = new TH2D("MaxMaxChargeVsTime","MaxMaxChargeVsTime",300,-300.5,3000.5,nTime,left,right);
MaxMaxChargeVsNeighbor = new TH2D("MaxMaxChargeVsNeighbor","MaxMaxChargeVsNeighbor",300,-300.5,3000.5,20,0,1);
Psych = new TH2D("Psych","Psych",128,-0.5,127.5,300,-300,3000);
TPCEventDisplay = new TH2D("TPCEventDisplay","TPCEventDisplay",48,-5,5,10,-5,5);
HBDEventDisplay = new TH2D("HBDEventDisplay","HBDEventDisplay",3,-5,5,3,-5,5);
HBDBeamSpot = new TH2D("HBDBeamSpot" ,"HBDBeamSpot", 3,-5,5,3,-5,5);
char name[500];
for (int i=0; i<9; i++)
{
sprintf(name,"MaxCharge%03d",i);
MaxCharge[i] = new TH1D(name,name,300,-300.5,3000.5);
sprintf(name,"MaxChargeTime%03d",i);
MaxChargeTime[i] = new TH1D(name,name,nTime,left,right);
sprintf(name,"MaxChargeVsTime%03d",i);
MaxChargeVsTime[i] = new TH2D(name,name,300,-300.5,3000.5,nTime,left,right);
}
}
cyclops *Scott = cyclops::instance();
double MAX=-999;
double TIME=-9;
int MAXindex=-1;
for (int i=0; i<9; i++)
{
double charge = Scott->thePads[i]->Q();
double time = Scott->thePads[i]->T();
if (charge>MAX)
{
MAX=charge;
TIME=time;
MAXindex=i;
}
MaxCharge[i]->Fill(charge);
MaxChargeTime[i]->Fill(time);
MaxChargeVsTime[i]->Fill(charge,time);
}
MaxMaxCharge->Fill(MAX);
MaxMaxChargeVsTime->Fill(MAX,TIME);
TPCEventDisplay->Reset();
for (int i=0; i<Scott->theZigs.size(); i++)
{
double charge = Scott->theZigs[i]->Q();
TPCEventDisplay->Fill(Scott->theZigs[i]->XCenter(),Scott->theZigs[i]->ZCenter(),Scott->theZigs[i]->Q());
}
double MAX2=-999;
double TIME2=-9;
double MAXindex2=-1;
HBDEventDisplay->Reset();
for (int i=0; i<9; i++)
{
double charge = Scott->thePads[i]->Q();
double time = Scott->thePads[i]->T();
if (i!=MAXindex && charge>MAX2)
{
MAX2=charge;
TIME2=time;
MAXindex2=i;
}
HBDEventDisplay->Fill(Scott->thePads[i]->XCenter(),Scott->thePads[i]->YCenter(),Scott->thePads[i]->Q());
HBDBeamSpot-> Fill(Scott->thePads[i]->XCenter(),Scott->thePads[i]->YCenter(),Scott->thePads[i]->Q());
}
MaxMaxChargeVsNeighbor->Fill(MAX,MAX2/MAX);
double TOTAL=0;
int NUMBER=0;
for (int i=0; i<9; i++)
{
double charge = Scott->thePads[i]->Q();
double time = Scott->thePads[i]->T();
if (time>3 && time<7)
{
TOTAL += charge;
NUMBER++;
}
}
TotalChargeInTime->Fill(TOTAL);
if (ChrHit() ) TotalChargeInTime_Hit ->Fill(TOTAL);
if (ChrMiss()) TotalChargeInTime_Miss->Fill(TOTAL);
NumberInTime->Fill(NUMBER);
if (NUMBER==1) OneChargeInTime->Fill(TOTAL);
for (int i=0; i<128; i++)
{
double Peak=0;
for (int j=4; j<7; j++)
{
Peak += APad::Cal[i][j];
}
Psych->Fill(i,Peak/3.0);
}
}