-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAPad.h
More file actions
122 lines (100 loc) · 3.21 KB
/
Copy pathAPad.h
File metadata and controls
122 lines (100 loc) · 3.21 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
#ifndef __APAD_H__
#define __APAD_H__
//
// Hello Apad Fans:
//
// The pads are charge collection regions. These are assumed to be
// simple rectangles that can be defined by their corners. Methods
// of the pad class will return both the X center and Y center.
// They also carry some charge.
//
//
// HG & TKH
// 11-16-2011
//
#include <vector>
#include <string>
#include <iostream>
#define NumberOfPads 128 // Actually # READOUTS, it is possible that some readouts don't have pads attached.
class TPolyLine;
class TH1D;
class TF1;
class APad
{
public:
APad(double, double, double, double, double, double);
virtual ~APad() {}
void Clear() {q=0;}
// sets...
void SetQ(double Q) {q = Q;}
void SetT(double T) {t = T;} /* @TODO Do we need this? */
void AddQ(double Q) {q += Q;}
// gets...
double const XCenter() {return (x1+x2)/2.0;}
double const YCenter() {return (y1+y2)/2.0;}
double const ZCenter() {return (z1+z2)/2.0;}
double Q () {return q;}
double T () {return t;} /* @TODO Do we need this? */
int MyID () {return myID;}
void SetMyID(int ID) {myID = ID;}
static int NCreated () {return nextID;}
// Graphics:
virtual void Draw(double);
virtual void Draw3D(double);
int color(int);
double NumSigma() {return q/Gains[myID]/Sigmas[myID];}
bool IsHit()
{
if (UseSigma) return (NumSigma()>SigmaCut);
else return (q>PulseCut);
}
void DetermineQ();
void Report()
{
std::cout << " id: " << myID;
std::cout << " q: " << q;
std::cout << " t: " << t;
std::cout << std::endl;
}
// OK..we're going for it...
// We shall be using the very same sytle of manipulations
// for the pads as we developed for the Hexes. This means
// That we shall make a set of static member variables that
// treat the common data that all Hexes need to access.
//
// This includes calibrations (one copy for all), cuts for
// hit definitions, Raw and Cal "paded" data.
// Flags for calibration operation...
static bool FastQ;
static bool UseSigma;
static double SigmaCut;
static double PulseCut;
static std::string CommonModeMethod;
// Collective Data...
static std::vector<int> Raw[NumberOfPads];
static std::vector<double> Cal[NumberOfPads]; //array OF vectors
// Calibration storage...
static double Pedestals[NumberOfPads];
static double Sigmas[NumberOfPads];
static double Gains[NumberOfPads];
static std::vector<double> CommonMode; // There is one common mode value per TIME SLICE.
// Methods for applying calibrations...
static void WriteCalibration();
static void ReadCalibration();
static void DetermineCommonMode();
static void ApplyCalibration();
static TH1D *Pulse; /* @TODO Do we need this? */
static TF1 *blue; /* @TODO Do we need this? */
protected:
double x1;
double y1;
double x2;
double y2;
double z1;
double z2;
double t; /* @TODO Do we need this? */
double q;
static int nextID;
int myID;
};
#endif /* __APAD_H__ */