Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AZigzag.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file AZigzag.h
1 #ifndef __AZIGZAG_H__
2 #define __AZIGZAG_H__
3 
4 #include <cmath>
5 #include <iostream>
6 #include <string>
7 #include <vector>
8 
9 #include "params.h"
10 
11 
12 class TPolyLine;
13 class TH2D;
14 class TH1D;
15 class TF1;
16 class TRandom;
17 
18 class AZigzag
19 {
20 public:
21  AZigzag(CheveronPad_t paddef);
22  virtual ~AZigzag() {}
23 
24  //Read the zig zag pad coordinates from XML file
25  //static void ReadXML();
26  //virtual int fileopen(const std::string &filenam);
27  //virtual int fileclose();
28 
29  // zig zag strip in x and y from XML file
31 
32  //Draw
33  virtual void Draw(double MAX);
34  int color(int);
35 
36  void Clear() {q=0;}
37  virtual void Report();
38 
39  // sets...
40  void SetQ(double Q) {q = Q;}
41  void SetT(double T) {t = T;} /* @TODO Do we need this? */
42  void AddQ(double Q) {q += Q;}
43 
44  // gets...
45  double Q () {return q;}
46  double T () {return t;} /* @TODO Do we need this? */
47  double MAXQ () {return maxq;}
48  double MAXT () {return maxt;}
49  int MyID () {return myID;}
50  void SetMyID(int ID) {myID = ID;}
51  static int NCreated () {return nextID;}
52 
53  // Readout Space Coordinates for utility
54  int MyHybrid;
55  int MyChannel;
57  int iR;
58  int iPhi;
59 
60  double XCenter();
61  double YCenter();
62  double ZCenter();
63  double RCenter();
64  double PCenter();
65 
66  double myR, myPhi;
67 
68 
69  // Charge Handling Variables
70  double NumSigma() {return q/Gains[myID]/Sigmas[myID];}
71  bool IsHit()
72  {
73  if (UseSigma)
74  return (NumSigma()>SigmaCut);
75  else
76  return (q>PulseCut);
77  }
78  void DetermineQ(double Mintime=-2.0, double Maxtime=30.0); // This covers the full APV space...
79 
80  // Neighbor Handling Pointers.
81  bool IsIsolated();
86 
87  // OK..we're going for it...
88  // We shall be using the very same sytle of manipulations
89  // for the strips as we developed for the Hexes. This means
90  // That we shall make a set of static member variables that
91  // treat the common data that all Hexes need to access.
92  //
93  // This includes calibrations (one copy for all), cuts for
94  // hit definitions, Raw and Cal "striped" data.
95 
96  static TRandom Randy;
97 
98  // Flags for calibration operation...
99  static bool FastQ;
100  static bool UseSigma;
101  static double SigmaCut;
102  static double PulseCut;
104 
105  // Collective Data...
106  static std::vector<int> Raw[Nsrs];
107  static std::vector<double> Cal[Nsrs]; //array OF vectors
108 
109  // Calibration storage...
110  static double Pedestals[Nsrs];
111  static double Sigmas[Nsrs];
112  static double Gains[Nsrs];
113  static std::vector<double> CommonMode[Nhybrid];
114 
115  // Methods for applying calibrations...
116  static void WriteCalibration();
117  static void ReadCalibration();
118  static void DetermineCommonMode();
119  static void ApplyCalibration();
120 
121  static TH1D* commy[Nhybrid];
122  static TH1D* Pulse; /* @TODO Do we need this? */
123  static TF1* blue; /* @TODO Do we need this? */
124 
125  //Protected
126  double xinit;
127  double yinit;
128  double rinit;
129  double phinit;
130 
131  double t; /* @TODO Do we need this? */
132  double q;
133  double maxq;
134  double maxt;
135 
136  static int nextID;
137  int myID;
138 
139 };
140 
141 #endif