File indexing completed on 2025-08-05 08:15:10
0001 #ifndef __AZIGZAG_H__
0002 #define __AZIGZAG_H__
0003
0004 #include <cmath>
0005 #include <iostream>
0006 #include <string>
0007 #include <vector>
0008
0009 #include "params.h"
0010
0011
0012 class TPolyLine;
0013 class TH2D;
0014 class TH1D;
0015 class TF1;
0016 class TRandom;
0017
0018 class AZigzag
0019 {
0020 public:
0021 AZigzag(CheveronPad_t paddef);
0022 virtual ~AZigzag() {}
0023
0024
0025
0026
0027
0028
0029
0030 CheveronPad_t fPads;
0031
0032
0033 virtual void Draw(double MAX);
0034 int color(int);
0035
0036 void Clear() {q=0;}
0037 virtual void Report();
0038
0039
0040 void SetQ(double Q) {q = Q;}
0041 void SetT(double T) {t = T;}
0042 void AddQ(double Q) {q += Q;}
0043
0044
0045 double Q () {return q;}
0046 double T () {return t;}
0047 double MAXQ () {return maxq;}
0048 double MAXT () {return maxt;}
0049 int MyID () {return myID;}
0050 void SetMyID(int ID) {myID = ID;}
0051 static int NCreated () {return nextID;}
0052
0053
0054 int MyHybrid;
0055 int MyChannel;
0056 int MyWaveIndex;
0057 int iR;
0058 int iPhi;
0059
0060 double XCenter();
0061 double YCenter();
0062 double ZCenter();
0063 double RCenter();
0064 double PCenter();
0065
0066 double myR, myPhi;
0067
0068
0069
0070 double NumSigma() {return q/Gains[myID]/Sigmas[myID];}
0071 bool IsHit()
0072 {
0073 if (UseSigma)
0074 return (NumSigma()>SigmaCut);
0075 else
0076 return (q>PulseCut);
0077 }
0078 void DetermineQ(double Mintime=-2.0, double Maxtime=30.0);
0079
0080
0081 bool IsIsolated();
0082 AZigzag* PreLogical;
0083 AZigzag* PostLogical;
0084 AZigzag* PreWaveform;
0085 AZigzag* PostWaveform;
0086
0087
0088
0089
0090
0091
0092
0093
0094
0095
0096 static TRandom Randy;
0097
0098
0099 static bool FastQ;
0100 static bool UseSigma;
0101 static double SigmaCut;
0102 static double PulseCut;
0103 static std::string CommonModeMethod;
0104
0105
0106 static std::vector<int> Raw[Nsrs];
0107 static std::vector<double> Cal[Nsrs];
0108
0109
0110 static double Pedestals[Nsrs];
0111 static double Sigmas[Nsrs];
0112 static double Gains[Nsrs];
0113 static std::vector<double> CommonMode[Nhybrid];
0114
0115
0116 static void WriteCalibration();
0117 static void ReadCalibration();
0118 static void DetermineCommonMode();
0119 static void ApplyCalibration();
0120
0121 static TH1D* commy[Nhybrid];
0122 static TH1D* Pulse;
0123 static TF1* blue;
0124
0125
0126 double xinit;
0127 double yinit;
0128 double rinit;
0129 double phinit;
0130
0131 double t;
0132 double q;
0133 double maxq;
0134 double maxt;
0135
0136 static int nextID;
0137 int myID;
0138
0139 };
0140
0141 #endif