Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-03 08:21:02

0001 #ifndef LOCALPOL_LOCALPOLMON_H
0002 #define LOCALPOL_LOCALPOLMON_H
0003 
0004 #include <onlmon/OnlMon.h>
0005 
0006 #include <cmath>
0007 #include <map>
0008 #include <vector>
0009 
0010 class CaloWaveformFitting;
0011 class Event;
0012 class TH1D;
0013 class TH2I;
0014 class TH2D;
0015 class TProfile;
0016 class Packet;
0017 class TRandom;
0018 class eventReceiverClient;
0019 
0020 class LocalPolMon : public OnlMon
0021 {
0022  public:
0023   explicit LocalPolMon(const std::string &name = "LOCALPOLMON");
0024   virtual ~LocalPolMon();
0025 
0026   int process_event(Event *evt);
0027   int Init();
0028   int BeginRun(const int runno);
0029   int Reset();
0030 
0031  private:
0032   double *ComputeAsymmetries(double L_U, double R_D, double L_D, double R_U);
0033   float anaWaveformFast(Packet *p, const int channel, const int low, const int high, const int ihisto);
0034   CaloWaveformFitting *WaveformProcessingFast = nullptr;
0035   void RetrieveSpinPattern(int r);
0036   void RetrieveTriggerDistribution(Event* e);
0037   int RetrieveAbortGapData();
0038   int RetrieveBunchNumber(Event* e, long long int z);
0039   bool GoodSelection(int i);
0040 
0041   const int packetid_gl1 = 14001;  // could be ported to config
0042   const int packetid_smd = 12001;  // could be ported to config
0043 
0044   const int UP = 1;
0045   const int DN = -1;
0046 
0047   const int BLUE = 0;
0048   const int YELLOW = 1;
0049 
0050   const int ZDCN1 = 8;
0051   const int ZDCS1 = 0;
0052   const int ZDCN2 = 10;
0053   const int ZDCS2 = 2;
0054 
0055 
0056   const int ivetoNF=48;
0057   const int ivetoNB=49;
0058   const int ivetoSF=50;
0059   const int ivetoSB=51;
0060 
0061 
0062 
0063 
0064   const float nchannelsY = 8.0;
0065   const float nchannelsX = 7.0;
0066   const float pitchY = 2.0 /*cm plastic scint.*/ * (11.0 / 10.5) /*(pitch correction for gap and wrapping)*/ * sin(M_PI / 4) /*(correct for the tilt)*/;
0067   const float pitchX = 1.5 /*cm plastic scint.*/ * (11.0 / 10.5) /*(pitch correction for gap and wrapping)*/;
0068 
0069   bool goodtrigger[16] = {false};        // selection from config
0070   bool fake = false;                     // config
0071   bool verbosity = false;                // config
0072   bool Initfirstbunch=false;
0073   bool Integrated=false;
0074   int ExpectedsPhenixGapPosition = 111;  // from config
0075   int EventCountThresholdGap = 6000;     // from config
0076   int EventsAsymmetryNewPoint = 10000;   // from config
0077   int nEmptyAbort=0;
0078   int MultiLow=1;
0079   int MultiHigh=7;
0080   float ZDC1Cut=60.;
0081   float ZDC2Cut=10.;
0082   float VetoCut=0.;
0083   float SMDthr=5.;
0084   long long int Prevgl1_clock;
0085   long long int Prevzdc_clock;
0086   int lowSample[52]={0};
0087   int highSample[52]={0};
0088   int evtcnt = 0;
0089   int evtcntA=0;
0090   int EvtShift=0;
0091   int EvtShiftValid=0;
0092   int failuredepth=0;
0093   int StartAbortGapPattern = 111;
0094   int StartAbortGapData = 111;
0095   int CrossingShift = 0;
0096   int iPoint = 0;
0097   int ConversionSign[4] = {1, -1, 1, -1};  // NorthY (bottom to top), NorthX (left to righ from IR->ZDC, while x points outside the ring), SouthY (bottom to top), SouthX (left to right from IR->ZDC and x points outside ring but z is going from south to north, need extra minus one when considering yellow direction)
0098   float smd_north_relatgain[16]={0.};
0099   float smd_south_relatgain[16]={0.}; 
0100   float smd_adc[32];
0101   float signalZDCN1 = 0;
0102   float signalZDCS1 = 0;
0103   float signalZDCN2 = 0;
0104   float signalZDCS2 = 0;
0105   float vetoNF=0;
0106   float vetoNB=0;
0107   float vetoSF=0;
0108   float vetoSB=0;
0109 
0110   float ZeroPosition[4] = {0., 0., 0., 0.};  // from config
0111 
0112   std::map<int, int> SpinPatterns[2];
0113   std::map<int, long long> gl1_counter[16];
0114   std::map<int, int> Chmapping;
0115 
0116   TH1D *h_trigger[16]={nullptr};
0117   TH1D *h_events=nullptr;
0118   TH1D **h_Counts = nullptr;
0119   TH1D **h_CountsScramble = nullptr;
0120 
0121   TH1D *hmultiplicity[4]={nullptr};
0122   TH1D *hposition[8]={nullptr};
0123   TH1D *hadcsum[4]={nullptr};
0124 
0125   TProfile *h_time = nullptr;
0126   TH1D ****h_Asym = nullptr;
0127   TH1D ****h_AsymScramble = nullptr;
0128 
0129   TH2I* hspinpattern=nullptr;
0130   //TH2I* htimesync=nullptr;
0131   TH1D* hsyncfrac=nullptr;
0132   TH2D* Bluespace=nullptr;
0133   TH2D* Yellowspace=nullptr;
0134   TH2D* hwaveform[6]={nullptr};
0135   TH2D* hclocks=nullptr;
0136   TH2D* hevolsync=nullptr;
0137   TH2D* hshiftevol=nullptr;
0138   
0139   TRandom *myRandomBunch = nullptr;
0140   //std::map<int, int> stored_gl1p_files;
0141   eventReceiverClient *erc = nullptr;
0142 };
0143 
0144 #endif /* LOCALPOL_LOCALPOLMON_H */