Back to home page

sPhenix code displayed by LXR

 
 

    


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   //Read the zig zag pad coordinates from XML file
0025   //static void ReadXML();
0026   //virtual int fileopen(const std::string &filenam);
0027   //virtual int fileclose();
0028   
0029   // zig zag strip in x and y from XML file
0030   CheveronPad_t fPads;    
0031   
0032   //Draw
0033   virtual void Draw(double MAX);
0034   int color(int);
0035   
0036   void Clear() {q=0;}
0037   virtual void Report();
0038 
0039   // sets...
0040   void SetQ(double Q) {q = Q;}
0041   void SetT(double T) {t = T;} /* @TODO Do we need this? */
0042   void AddQ(double Q) {q += Q;}
0043 
0044   // gets...
0045   double Q            ()  {return q;}
0046   double T            ()  {return t;} /* @TODO Do we need this? */
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   //  Readout Space Coordinates for utility
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   //  Charge Handling Variables
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);  // This covers the full APV space...
0079 
0080   //  Neighbor Handling Pointers.
0081   bool IsIsolated();
0082   AZigzag* PreLogical;
0083   AZigzag* PostLogical;
0084   AZigzag* PreWaveform;
0085   AZigzag* PostWaveform;
0086     
0087   //  OK..we're going for it...
0088   //  We shall be using the very same sytle of manipulations
0089   //  for the strips as we developed for the Hexes.  This means
0090   //  That we shall make a set of static member variables that
0091   //  treat the common data that all Hexes need to access.
0092   //
0093   //  This includes calibrations (one copy for all), cuts for
0094   //  hit definitions, Raw and Cal "striped" data.
0095   
0096   static TRandom Randy;
0097 
0098   //  Flags for calibration operation...
0099   static bool FastQ;
0100   static bool UseSigma;
0101   static double SigmaCut;
0102   static double PulseCut;
0103   static std::string CommonModeMethod;
0104   
0105   //  Collective Data...
0106   static std::vector<int>    Raw[Nsrs];
0107   static std::vector<double> Cal[Nsrs];  //array OF vectors
0108   
0109   //  Calibration storage...
0110   static double Pedestals[Nsrs];
0111   static double Sigmas[Nsrs];
0112   static double Gains[Nsrs];
0113   static std::vector<double> CommonMode[Nhybrid];
0114   
0115   //  Methods for applying calibrations...
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; /* @TODO Do we need this? */
0123   static TF1*  blue; /* @TODO Do we need this? */
0124     
0125   //Protected
0126   double xinit;
0127   double yinit;
0128   double rinit;
0129   double phinit;
0130   
0131   double t;  /* @TODO Do we need this? */
0132   double q;
0133   double maxq;
0134   double maxt;
0135 
0136   static int nextID;
0137   int myID;
0138 
0139 };
0140 
0141 #endif