Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2026-10-15 08:17:19

0001 #ifndef __CalcRm_h__
0002 #define __CalcRm_h__
0003 
0004 #include <iostream>
0005 #include <iomanip>
0006 #include <limits>
0007 #include "TROOT.h"
0008 #include "TH1D.h"
0009 #include "TH2D.h"
0010 #include "TH3D.h"
0011 #include "TProfile.h"
0012 #include "TMath.h"
0013 #include "TVector3.h"
0014 #include "TLorentzVector.h"
0015 //#include "TStopwatch.h"
0016 
0017 using namespace std;
0018 
0019 class CalcRm{
0020     //
0021     public:
0022         //
0023         CalcRm();               // ctor
0024         virtual ~CalcRm();      // dtor
0025         //
0026         virtual void    SetDistinguishable(bool b);     
0027         virtual bool    GetDistinguishable();
0028         virtual void    SetDoMinvCut(bool b);
0029         virtual bool    GetDoMinvCut();     
0030         virtual void    SetDoMinvLLCut(bool b);     
0031         virtual bool    GetDoMinvLLCut();       
0032         virtual void    SetFlipDy(bool b);      
0033         virtual bool    GetFlipDy();        
0034         virtual void    SetDoCrossing(bool b);      
0035         virtual bool    GetDoCrossing();        
0036         virtual void    SetField(double f);     // needed before Book() for the dirty-side rule; Increment() also sets it
0037         virtual int     GetDirtySide();         // computed in Book(), see CrossingDirtySide() in CrossingCorrect.h
0038         virtual void    SetDoBaseline(bool b);      
0039         virtual bool    GetDoBaseline();        
0040         virtual void    SetDoQcut(bool b);      
0041         virtual void    SetInttSep(double dphistar){ fISepDphi=dphistar; }  // README_SplitTracks573 sec 29
0042         virtual void    SetTrackSep(double dy, double dphistar, bool useMin=false){ fTSepDy=dy; fTSepDphi=dphistar; fTSepMin=useMin; }  // README_SplitTracks573 sec 11
0043         virtual bool    GetDoQcut();        
0044         virtual void    SetQcut(double v);      
0045         virtual double  GetQcut();      
0046         virtual void    SetCurrentRunEvt(int r, int e){ fCurrentRun=r; fCurrentEvt=e; } // sec 18.20
0047         virtual void    SetCurrentNch(int n){ fCurrentNch=n; }      // README_SplitTracks573 sec 34: accepted charged tracks
0048         virtual void    SetExcludeAdjTF(int m){ fExcludeAdjTF=m; }  // sec 18.23: 0 off, 1 skip |devt|==1, 2 skip |devt|<=1
0049         virtual int     GetExcludeAdjTF(){ return fExcludeAdjTF; }
0050         virtual long    GetNCombUsed(int izv){ return nComb_used[izv]; }
0051         virtual long    GetNCombPossible(int izv){ return nComb_possible[izv]; }
0052         virtual void    SetPid1(int m);
0053         virtual int     GetPid1();
0054         virtual void    SetPid2(int m);
0055         virtual int     GetPid2();
0056 //      virtual void    SetChg1(double m);
0057 //      virtual double  GetChg1();
0058 //      virtual void    SetChg2(double m);
0059 //      virtual double  GetChg2();
0060 //      virtual void    SetMass1(double m);
0061 //      virtual double  GetMass1();
0062 //      virtual void    SetMass2(double m);
0063 //      virtual double  GetMass2();
0064         virtual void    SetMAXMULT(int i);
0065         virtual int     GetMAXMULT();
0066         virtual void    SetNMIX(int i);
0067         virtual int     GetNMIX();
0068         virtual void    SetYNB1(int i);
0069         virtual int     GetYNB1();
0070         virtual void    SetYL1(double y);
0071         virtual double  GetYL1();
0072         virtual void    SetYU1(double y);
0073         virtual double  GetYU1();
0074         virtual void    SetYNB2(int i);
0075         virtual int     GetYNB2();
0076         virtual void    SetYL2(double y);
0077         virtual double  GetYL2();
0078         virtual void    SetYU2(double y);
0079         virtual void    SetDYBW(double w);      // 2026-09-30: dy bin width of the (dy,dphi) maps, per pair type (0 = the y bin width)
0080         virtual double  GetYU2();
0081         virtual void    SetPHINB(int i);
0082         virtual int     GetPHINB();
0083         virtual void    SetPHIL(double phi);
0084         virtual double  GetPHIL();
0085         virtual void    SetPHIU(double phi);
0086         virtual double  GetPHIU();
0087         virtual void    SetPTL1(double pt);     // setptnbX etc not needed !! UMMM NO, neeeded if save rho1 !!
0088         virtual double  GetPTL1();
0089         virtual void    SetPTU1(double pt);
0090         virtual double  GetPTU1();
0091         virtual void    SetPTL2(double pt);
0092         virtual double  GetPTL2();
0093         virtual void    SetPTU2(double pt);
0094         virtual double  GetPTU2();
0095         virtual void    SetZVTXNB(int i);
0096         virtual int     GetZVTXNB();
0097         virtual void    SetZVTXL(double y);
0098         virtual double  GetZVTXL();
0099         virtual void    SetZVTXU(double y);
0100         virtual double  GetZVTXU();
0101         //virtual void  SetQuiet(bool b);
0102         //virtual void  SetZero(bool b);
0103         //virtual void  SetMixing(bool b);
0104         //virtual void  SetUnlikeSign(bool b);      
0105         //virtual bool  GetUnlikeSign();        
0106         virtual void    UpdateBinningPars();
0107         virtual void    Book();
0108 //      virtual void    Increment(double zv=0, double field=0, 
0109 //                                   int n1=0, TLorentzVector* v1=0, 
0110 //                                   int n2=0, TLorentzVector* v2=0);
0111 //      virtual bool    PairInfo(TLorentzVector v1,
0112 //                               TLorentzVector v2,
0113 //                               double& y1,double& y2,double& dy,double& dphi,double& dpt,double& dq,
0114 //                               double& minv, bool& NearSide);
0115         virtual void    Increment(double zv=0, double field=0,
0116                                      int n1=0, double (*e1)=0, double (*v1)[3]=0,
0117                                      int n2=0, double (*e2)=0, double (*v2)[3]=0);
0118         virtual bool    PairInfo(int i, int iev, 
0119                                  int j, int jev,
0120                                  int izv,
0121                                  double& y1,double& y2,double& dy,double& dphi,double& dpt,double& dq,double& Q,
0122                                  double& minv, bool& NearSide, double& kT);
0123         virtual void    Calculate();
0124         virtual double  GetR2Baseline(TH2D* hm=0);
0125         //
0126         virtual int     GetSpecies(int ipid){
0127             int ival    = -1;
0128             if (ipid<  5){ ival = ipid;   } else
0129             if (ipid< 10){ ival = ipid-5; } else
0130             if (ipid==10){ ival = 5;      } else
0131             if (ipid==11){ ival = 6;      } else
0132             if (ipid==12){ ival = 7;      } else
0133             if (ipid==13 || ipid==14){ ival = 0; }  // h+, h-: pion y and pT limits (2026-10-11)
0134             return ival;
0135         }
0136         //
0137 //      virtual double  GetTimeIncrement();     
0138 //      virtual double  GetTimeCalculate();     
0139         //
0140         virtual TH1D*   Gethzvtx();                     // zvtx distribution
0141         //
0142         virtual TH2D*   Gethmult();                     // no parameters  -> returns Zvtx-averaged histogram
0143         virtual TH3D*   Gethrho1_1();                   // no parameters  -> returns Zvtx-averaged histogram
0144         virtual TH3D*   Gethrho1_2();                   // no parameters  -> returns Zvtx-averaged histogram
0145         virtual TH2D*   Gethrho2_S(int ir2);            //  1 parameter   -> returns Zvtx-averaged histogram
0146         virtual TH2D*   Gethrho2_M(int ir2);            //  1 parameter   -> returns Zvtx-averaged histogram
0147         virtual TH2D*   GethC2(int ir2);                //  1 parameter   -> returns Zvtx-averaged histogram
0148         virtual TH2D*   GethR2(int ir2);                //  1 parameter   -> returns Zvtx-averaged histogram
0149         virtual TH1D*   Gethy1_();                      // no parameters  -> returns Zvtx-averaged histogram
0150         virtual TH1D*   Gethy2_();                      // no parameters  -> returns Zvtx-averaged histogram
0151         virtual TH1D*   Gethyc1_();                     // no parameters  -> returns Zvtx-averaged CORR histogram
0152         virtual TH1D*   Gethyc2_();                     // no parameters  -> returns Zvtx-averaged CORR histogram
0153         //
0154         virtual TH2D*   Gethmult(int izv);              //  1 parameter  -> returns histogram in this Zvtx bin
0155         virtual TH3D*   Gethrho1_1(int izv);            //  1 parameter  -> returns histogram in this Zvtx bin
0156         virtual TH3D*   Gethrho1_2(int izv);            //  1 parameter  -> returns histogram in this Zvtx bin
0157         virtual TH2D*   Gethrho2_S(int ir2, int izv);   //  2 parameters -> returns histogram in this Zvtx bin
0158         virtual TH2D*   Gethrho2_M(int ir2, int izv);   //  2 parameters -> returns histogram in this Zvtx bin
0159         virtual TH2D*   GethC2(int ir2, int izv);       //  2 parameters -> returns histogram in this Zvtx bin
0160         virtual TH2D*   GethR2(int ir2, int izv);       //  2 parameters -> returns histogram in this Zvtx bin
0161         virtual TH2D*   Gethrho2C_S();                  // crossing-corrected (dy,dphi) rho2(S), Zvtx-averaged (README_Crossing)
0162         virtual TH2D*   GethC2C();                      // crossing-corrected (dy,dphi) C2,      Zvtx-averaged
0163         virtual TH2D*   GethR2C();                      // crossing-corrected (dy,dphi) R2,      Zvtx-averaged
0164         virtual TH2D*   Gethrho2C_S(int izv);           // same, in this Zvtx bin
0165         virtual TH2D*   GethC2C(int izv);               // same, in this Zvtx bin
0166         virtual TH2D*   GethR2C(int izv);               // same, in this Zvtx bin
0167         virtual TH2D*   GethMempty(){ return hMempty; } // # of used Zvtx slices with an empty (dy,dphi) denominator
0168         virtual double  GetDenomZ(int izv){ return fDenomZ[izv]; }  // README_Finalize: 0 = zvtx bin skipped in Calculate
0169         virtual TH1D*   Gethy1_(int izv);               //  1 parameter  -> returns histogram in this Zvtx bin
0170         virtual TH1D*   Gethy2_(int izv);               //  1 parameter  -> returns histogram in this Zvtx bin
0171         virtual TH1D*   Gethyc1_(int izv);              //  1 parameter  -> returns CORR histogram in this Zvtx bin
0172         virtual TH1D*   Gethyc2_(int izv);              //  1 parameter  -> returns CORR histogram in this Zvtx bin
0173         //
0174         virtual TH2D*   Gethrho2_S_dptP(int ir2);           //  1 parameter  -> returns Zvtx-averaged histogram
0175         virtual TH2D*   Gethrho2_M_dptP(int ir2);           //  1 parameter  -> returns Zvtx-averaged histogram
0176         virtual TH2D*   Gethrho2_S_dptN(int ir2);           //  1 parameter  -> returns Zvtx-averaged histogram
0177         virtual TH2D*   Gethrho2_M_dptN(int ir2);           //  1 parameter  -> returns Zvtx-averaged histogram
0178         virtual TH2D*   Gethrho2_S_dptP(int ir2, int izv);  //  2 parameters -> returns histogram in this Zvtx bin
0179         virtual TH2D*   Gethrho2_M_dptP(int ir2, int izv);  //  2 parameters -> returns histogram in this Zvtx bin
0180         virtual TH2D*   Gethrho2_S_dptN(int ir2, int izv);  //  2 parameters -> returns histogram in this Zvtx bin
0181         virtual TH2D*   Gethrho2_M_dptN(int ir2, int izv);  //  2 parameters -> returns histogram in this Zvtx bin
0182         //
0183         virtual TH1D*   GethR2yydy();                   // no parameters  -> returns Zvtx-averaged histogram
0184         virtual TH1D*   GethR2yydy(int izv);            // one parameter  -> returns histogram in this Zvtx bin
0185         virtual TH1D*   GethR2dy();                     // no parameters  -> returns Zvtx-averaged histogram
0186         virtual TH1D*   GethR2dy(int izv);              // one parameter  -> returns histogram in this Zvtx bin
0187         virtual TH1D*   GethR2dphi();                   // no parameters  -> returns Zvtx-averaged histogram
0188         virtual TH1D*   GethR2dphi(int izv);            // one parameter  -> returns histogram in this Zvtx bin
0189         //
0190 //      virtual TH1D*   GethR2dyNS();                   // no parameters  -> returns Zvtx-averaged histogram
0191 //      virtual TH1D*   GethR2dyNS(int izv);            // one parameter  -> returns histogram in this Zvtx bin
0192 //      virtual TH1D*   GethR2dphiNS();                 // no parameters  -> returns Zvtx-averaged histogram
0193 //      virtual TH1D*   GethR2dphiNS(int izv);          // one parameter  -> returns histogram in this Zvtx bin
0194 //      virtual TH1D*   GethR2dqNS();                   // no parameters  -> returns Zvtx-averaged histogram
0195 //      virtual TH1D*   GethR2dqNS(int izv);            // one parameter  -> returns histogram in this Zvtx bin
0196         //
0197         virtual TH1D*   GethMinv_S();                   // no parameters  -> returns Zvtx-averaged histogram
0198         virtual TH1D*   GethMinv_S(int izv);            // one parameter  -> returns histogram in this Zvtx bin
0199         virtual TH1D*   GethMinv_M();                   // no parameters  -> returns Zvtx-averaged histogram
0200         virtual TH1D*   GethMinv_M(int izv);            // one parameter  -> returns histogram in this Zvtx bin
0201         virtual TH1D*   GethMinv();                     // no parameters  -> returns Zvtx-averaged histogram
0202         virtual TH1D*   GethMinv(int izv);              // one parameter  -> returns histogram in this Zvtx bin
0203 //      virtual TH2D*   GethMinvdq();                   // no parameters  -> returns Zvtx-averaged histogram
0204 //      virtual TH2D*   GethMinvdq(int izv);            // one parameter  -> returns histogram in this Zvtx bin
0205         //
0206         //---- femtoscopic Qinv numerator (sibling), denominator (mixed), and C(Q)=sib/mix ratio
0207         virtual TH2D*   GethZoomS(){ return hzoom_S; }  // README sec 16.8 spike-extent zoom, sibling
0208         virtual TH2D*   GethZoomM(){ return hzoom_M; }  // README sec 16.8 spike-extent zoom, mixed
0209         virtual TH2D*   GethTTR(int sm, int is, int ir){ return hTTR[sm][is][ir]; } // README_SplitTracks573 sec 11
0210         virtual TH2D*   GethTTRside(int sm, int sd){ return hTTRside[sm][sd]; } // README_SplitTracks573 sec 20
0211         virtual void    FillTTR(int sm, int i, int iev, int j, int jev, int izv, double weight);
0212         virtual TH2D*   GethGap(int sm, int w){ return hGap[sm][w]; }   // README_SplitTracks573 sec 28
0213         virtual TH2D*   GethGapDy(int sm){ return hGapDy[sm]; } // README_SplitTracks573 sec 28
0214         virtual TH2D*   GethGapPhi(int sm){ return hGapPhi[sm]; }   // README_SplitTracks573 sec 32 (the +-15 deg notch)
0215         virtual TH2D*   GethGapYbar(int sm){ return hGapYbar[sm]; }
0216         virtual TH2D*   GethGapPt(int sm){ return hGapPt[sm]; }     // sec 34: the notch vs pair mean pt
0217         virtual TH2D*   GethGapNch(int sm){ return hGapNch[sm]; }       // sec 34: the notch vs accepted charged tracks
0218         virtual TH2D*   GethGapRm(int sm){ return hGapRm[sm]; }     // sec 34.1: the notch vs the pair's meeting radius (where the two tracks meet in phi)
0219         virtual void    FillGap(int sm, int i, int iev, int j, int jev, int izv, double weight);
0220         virtual TH1D*   GethMinvFineS(){ return hMinvF_S; } // fine Minv near threshold, sibling (all Zvtx, raw)
0221         virtual TH1D*   GethMinvFineM(){ return hMinvF_M; } // same, mixed
0222         virtual long    GetNMixedPairs_total()      { return nMixedPairs_total; }
0223         virtual long    GetNMixedPairs_sameTF()     { return nMixedPairs_sameTF; }
0224         virtual long    GetNMixedPairs_neighborTF() { return nMixedPairs_neighborTF; }
0225         virtual TH1D*   GethQsib();                     // no parameters  -> returns Zvtx-averaged histogram
0226         virtual TH1D*   GethQsib(int izv);              // one parameter  -> returns histogram in this Zvtx bin
0227         virtual TH1D*   GethQmix();                     // no parameters  -> returns Zvtx-averaged histogram
0228         virtual TH1D*   GethQmix(int izv);              // one parameter  -> returns histogram in this Zvtx bin
0229         virtual TH1D*   GethQsibW(){ return hQsibW[ZVTXNB]; }   // long-Q test copies (0-8 GeV, 10 MeV), Zvtx-summed
0230         virtual TH1D*   GethQmixW(){ return hQmixW[ZVTXNB]; }
0231         virtual TH1D*   GethCQ();                       // no parameters  -> returns Zvtx-averaged histogram
0232         virtual TH1D*   GethCQ(int izv);                // one parameter  -> returns histogram in this Zvtx bin
0233         virtual TH2D*   GethQsibKT(){ return hQsibKT[ZVTXNB]; }         // README_CQ: (Qinv,kT), Zvtx-summed
0234         virtual TH2D*   GethQsibKT(int izv){ return hQsibKT[izv]; }
0235         virtual TH2D*   GethQmixKT(){ return hQmixKT[ZVTXNB]; }
0236         virtual TH2D*   GethQmixKT(int izv){ return hQmixKT[izv]; }
0237         virtual TH2D*   GethCQKT(){ return hCQKT[ZVTXNB]; }             // Zvtx-averaged, like hCQ
0238         virtual TH2D*   GethCQKT(int izv){ return hCQKT[izv]; }
0239         //
0240     //
0241     private:
0242         //
0243 //      TStopwatch* TimerIncrement;
0244 //      TStopwatch* TimerCalculate;
0245 //      double  fTimeIncrement;
0246 //      double  fTimeCalculate;
0247         //
0248         //-------------------------------------
0249         int    NMIX;
0250         static const int NMIXMAX    =   50;
0251         static const int NTRKMAX    =  385;     // set same as other class and MAX_CALCR_N in loop...
0252         static const int NZVTXMAX   =  101;     // allows 1cm-wide bins over +/-50cm.... 
0253 //      static const int NCOMBMAX   = 1000;     // comfortable for NMIX = 8 or less.... obsolete
0254 //      static const int YNBMAX     =   40;     // needed for 4th dimension of R4 via TH3D...
0255         //
0256         static const int NR2TYPES   =   3;      // y1y2, dydphi, (Q,pT_pair)
0257         //-------------------------------------
0258         //
0259         bool   fDistinguishable;
0260         bool   fUseEta1, fUseEta2;  // 2026-10-11: this leg is h+/h- -- its "y" is the pseudorapidity (set in Book from the pid)
0261         bool   fLikeSign;
0262         bool   fDoCrossing;
0263         bool   fDoBaseline;
0264         bool   fDoQcut;
0265         double fTSepDy, fTSepDphi;
0266         double fISepDphi;       // sec 29: near-vertex two-track cut, abs(dphi*(ISEP_R)) < fISepDphi (deg) at abs(dy) < ISEP_DYMAX; OFF if <= 0
0267         int    fPairSM;         // sec 29: 0 while PairInfo sees a sibling pair, 1 a mixed pair (hISep)
0268     public:
0269         //---- sec 29 constants: the radius (from the radius scan, the net loss is deepest at 2-3 cm) and the dy gate
0270         //---- (the loss is gone by abs(dy) ~ 0.8)
0271         static constexpr double ISEP_R      = 0.03;     // m
0272         static constexpr double ISEP_DYMAX  = 1.0;
0273         virtual TH2D*   GethISep(int sm){ return hISep[sm]; }
0274         virtual double  GetISepDphi(){ return fISepDphi; }
0275     private:
0276         bool   fTSepMin;        // true: use min over R = 0.30-0.78 m of abs(dphi*) instead of R = 0.5 m ("tsepmYYPP")  // README_SplitTracks573 sec 11: two-track-resolution pair cut, OFF if fTSepDy<=0.
0277                                     // A charged like-sign pair (sibling AND mixed, in PairInfo) is rejected if
0278                                     // abs(y1-y2)<fTSepDy && abs(dphi*(0.5 m))<fTSepDphi (deg), dphi* with the sign "+" of FillTTR.
0279         double fQcut;
0280         int    fExcludeAdjTF;   // sec 18.23: skip mixed EVENT pairs (iev,jev) from neighboring trigger frames
0281                                 // (same run, |evt1-evt2|==1; mode 2 also same-TF, |devt|==0 -- used when the
0282                                 // same-TF XTFclean cleaner is off). Whole event pairs are skipped, and the
0283                                 // mixed normalization becomes per-zvtx-bin: denomfactor_izv = (used event
0284                                 // pairs in izv)/nevt_izv instead of the fixed NCombinations2/NMIX.
0285         long   nComb_used[NZVTXMAX];        // sec 18.23: mixed event pairs actually filled, per zvtx bin
0286         double fDenomZ[NZVTXMAX];           // README_Finalize: rho2(M) normalization per zvtx bin (denomfactor_izv); 0 = bin not computed
0287         long   nComb_possible[NZVTXMAX];    // sec 18.23: mixed event pairs offered, per zvtx bin
0288         int    fCurrentRun;     // sec 18.20: this event's (run,evt), set once per event via
0289         int    fCurrentNch;     // sec 34: this event's accepted charged tracks (SetCurrentNch, before Increment)
0290         int    fCurrentEvt;     // SetCurrentRunEvt() right before Increment() -- (run,evt) uniquely
0291                                     // identifies the originating trigger frame (SDCC-claude confirmed
0292                                     // `evt` IS the TF's own EvtSequence, constant across every row from
0293                                     // that TF). Used to rebuild rho2(M) excluding same-TF mixed pairs.
0294         int    fPid1;
0295         int    fPid2;
0296         double fChg1;
0297         double fChg2;
0298         double fMass1;
0299         double fMass2;
0300         //
0301         double fField;
0302         int    fDirtySide;  // crossing correction: +1/-1 = dirty side is dphi>0/dphi<0, 0 = no correction (neutral leg)
0303         int    MAXMULT;
0304         int    YNB1;
0305         double YL1;
0306         double YU1;
0307         double YBW;
0308         double YBW1;
0309         int    YNB2;
0310         double YL2;
0311         double YU2;
0312         double YBW2;
0313         int    DYNB;
0314         double DYL;
0315         double DYU;
0316         double DYBW;
0317         double fDYBWset = 0.;
0318         int    PHINB;
0319         double PHIL;
0320         double PHIU;
0321         double PHIBW;
0322         int    DPHINB;
0323         double DPHIL;
0324         double DPHIU;
0325         double DPHIBW;
0326         int    PTNB1;   // set for BW=0.1 based on PTL,PTU so rho1 can be binned and saved (to allow convolution in finalize)
0327         int    PTNB2;   // set for BW=0.1 based on PTL,PTU so rho1 can be binned and saved (to allow convolution in finalize)
0328         double PTL1;        // conv class also has ptnbX, ptnbX etx, which are not needed for mixing!
0329         double PTU1;
0330         double PTL2;
0331         double PTU2;
0332         int    ZVTXNB;
0333         double ZVTXL;
0334         double ZVTXU;       
0335         double ZVTXBW;
0336         //
0337         bool   fFlipDy;
0338         bool   fDoMinvCut;
0339         bool   fDoMinvCutb;
0340         bool   fDoMinvLLCut;
0341         double fMinvCut_m0; 
0342         double fMinvCutb_m0;    
0343         double fMinvCut_dm;
0344         double fMinvCut_mlower; 
0345         double fMinvCut_mupper;
0346         double fMinvCutb_mlower;    
0347         double fMinvCutb_mupper;
0348         double raddeg;
0349         //
0350         int             mix_nevt[NZVTXMAX];
0351         double          mix_field[NMIXMAX][NZVTXMAX];
0352         double          mix_zvtx[NMIXMAX][NZVTXMAX];
0353         int             mix_run[NMIXMAX][NZVTXMAX]; // sec 18.20: per-buffer-slot (run,evt) -- per
0354         int             mix_nch[NMIXMAX][NZVTXMAX]; // sec 34: accepted charged tracks of the buffered event
0355         int             mix_evt[NMIXMAX][NZVTXMAX]; // SDCC-claude, `evt` IS the trigger-frame's own
0356                                                         // EvtSequence, constant across every row from
0357                                                         // that TF -- (run,evt) uniquely IDs the TF, no
0358                                                         // new branch needed. Used to rebuild rho2(M)
0359                                                         // excluding any mixed pair drawn from the same TF.
0360         int             mix_mult1[NMIXMAX][NZVTXMAX];
0361         int             mix_mult2[NMIXMAX][NZVTXMAX];
0362         //TLorentzVector    mix_part1[NTRKMAX][NMIXMAX][NZVTXMAX];
0363         //TLorentzVector    mix_part2[NTRKMAX][NMIXMAX][NZVTXMAX];
0364         double      mix_part1[4][NTRKMAX][NMIXMAX][NZVTXMAX];   // 4: y,phi,pt,eff
0365         double      mix_part2[4][NTRKMAX][NMIXMAX][NZVTXMAX];   // 4: y,phi,pt,eff
0366         //
0367         //
0368         TH1D*   hzvtx;
0369         TAxis*  axiszvtx;
0370         //
0371 //      virtual bool    NextCombination(vector<int>& v, int k, int N);
0372 //      int Combinations2[2][NCOMBMAX];         // indices of 2 tracks in each 2-combination 
0373 //      int NCombinations2_Seen[NZVTXMAX];
0374         int NCombinations2;
0375         //
0376         TH2D*   hmult[NZVTXMAX];
0377         TH2D*   hmultc[NZVTXMAX];
0378         TH3D*   hrho1_1[NZVTXMAX];
0379         TH3D*   hrho1_2[NZVTXMAX];
0380 //      TH3D*   hrho1c_1[NZVTXMAX];     // weighted by 1/eff...
0381 //      TH3D*   hrho1c_2[NZVTXMAX];     // weighted by 1/eff...
0382         TH2D*   hrho2_S[NR2TYPES][NZVTXMAX];
0383         TH2D*   hrho2_M[NR2TYPES][NZVTXMAX];
0384         TH2D*   hC2[NR2TYPES][NZVTXMAX];
0385         TH2D*   hR2[NR2TYPES][NZVTXMAX];
0386         TH2D*   hrho2C_S[NZVTXMAX];     // README_Crossing: crossing-corrected (dy,dphi) only (ir2=1), no rho2(M) version
0387         TH2D*   hC2C[NZVTXMAX];
0388         TH2D*   hR2C[NZVTXMAX];
0389         TH2D*   hMempty;            // README_Crossing sec 8: per (dy,dphi) bin, # of used Zvtx slices with rho2(M)=0
0390         //TH2D* hm2D[NR2TYPES];
0391         //
0392         TH1D*   hy1_[NZVTXMAX];
0393         TH1D*   hy2_[NZVTXMAX];
0394         TH1D*   hyc1_[NZVTXMAX];
0395         TH1D*   hyc2_[NZVTXMAX];
0396         //
0397         TH2D*   hrho2_S_dptP[NR2TYPES][NZVTXMAX];
0398         TH2D*   hrho2_M_dptP[NR2TYPES][NZVTXMAX];
0399         TH2D*   hrho2_S_dptN[NR2TYPES][NZVTXMAX];
0400         TH2D*   hrho2_M_dptN[NR2TYPES][NZVTXMAX];
0401         //
0402         TH1D*   hR2yydy[NZVTXMAX];          // from y1y2...
0403         TH1D*   hR2yydye[NZVTXMAX];         // from y1y2...
0404         TH1D*   hR2yydyN[NZVTXMAX];         // from y1y2...
0405         TH1D*   hR2dy[NZVTXMAX];            // from dydphi...
0406         TH1D*   hR2dye[NZVTXMAX];           // from dydphi...
0407         TH1D*   hR2dyN[NZVTXMAX];           // from dydphi...
0408         TH1D*   hR2dphi[NZVTXMAX];          // from dydphi...
0409         TH1D*   hR2dphie[NZVTXMAX];         // from dydphi...
0410         TH1D*   hR2dphiN[NZVTXMAX];         // from dydphi...
0411         //
0412 //      TH1D*   hR2dyNS[NZVTXMAX];          // from y1y2...
0413 //      TH1D*   hR2dyNSe[NZVTXMAX];         // from y1y2...
0414 //      TH1D*   hR2dyNSN[NZVTXMAX];         // from y1y2...
0415 //      TH1D*   hR2dphiNS[NZVTXMAX];            // from dydphi...
0416 //      TH1D*   hR2dphiNSe[NZVTXMAX];           // from dydphi...
0417 //      TH1D*   hR2dphiNSN[NZVTXMAX];           // from dydphi...
0418 //      TH1D*   hR2dqNS[NZVTXMAX];          // from dydq...
0419 //      TH1D*   hR2dqNSe[NZVTXMAX];         // from dydq...
0420 //      TH1D*   hR2dqNSN[NZVTXMAX];         // from dydq...
0421         //
0422         TH1D*   hMinv_S[NZVTXMAX];
0423         TH1D*   hMinv_M[NZVTXMAX];
0424         TH1D*   hMinv[NZVTXMAX];
0425         //
0426         TH2D*   hzoom_S;            // README sec 16.8: fine (deta,dphi) zoom around (0,0), same-event pairs, raw counts, all Zvtx
0427         TH2D*   hzoom_M;            // same, mixed pairs (smooth reference for the spike-extent measurement)
0428         //---- README_SplitTracks573 sec 11: two-track-resolution study, DIAGNOSTIC ONLY (no pair is cut).
0429         //---- dy vs dphi*(R) for [0 sibling | 1 mixed][sign hypothesis 0: +q*B, 1: -q*B]
0430         //---- [R = 0.30 | 0.50 | 0.70 m | the R in 0.30-0.78 m of smallest abs(dphi*)]. Charged-charged pairs only.
0431         TH2D*   hTTR[2][2][4];
0432         //---- sec 28 (sector-gap diagnostic): [0 sibling | 1 mixed][0: 0.4 <= abs(dy) < 1.0 | 1: abs(dy) < 0.4], x = vertex
0433         //---- dphi = phi1 - phi2 (index order, deg), y = s = q1*asin(aR/pt1) - q2*asin(aR/pt2) at R = 0.55 m (deg; the
0434         //---- sec 11 "+" sign), so dphi - s = dphi*(R), the pair's separation at the TPC. Raw counts, all Zvtx.
0435         TH2D*   hGap[2][2];
0436         TH2D*   hISep[2];
0437         long    nPairCut[2][3];     // Final state: [S|M][0 charged pairs reaching the pair cuts, 1 removed by tsep, 2 by isep]         // sec 29: [sibling|mixed] dphi*(ISEP_R) vs abs(dy), every charged pair before the isep cut
0438         TH2D*   hGapPhi[2];         // sec 32: [sibling|mixed] vertex dphi (1 deg, abs < 60) vs pair mean phi (5 deg), abs(dy) < 1
0439         TH2D*   hGapYbar[2];
0440         TH2D*   hGapPt[2];          // sec 34: [sibling|mixed] vertex dphi (1 deg, abs < 60) vs pair mean pt, abs(dy) < 1
0441         TH2D*   hGapRm[2];          // sec 34.1: [sibling|mixed] vertex dphi vs meeting radius R_m (m; 1.4 = the tracks never meet)
0442         TH2D*   hGapNch[2];         // sec 34: [sibling|mixed] vertex dphi vs accepted charged tracks (event of particle 1)     // sec 32: [sibling|mixed] vertex dphi (1 deg, abs < 60) vs ybar (0.1), abs(dy) < 1
0443         TH2D*   hGapDy[2];          // sec 28: [sibling|mixed] vertex dphi (1 deg, abs < 60) vs abs(dy) (0-2), raw counts, all Zvtx
0444         TH2D*   hTTRside[2][2];     // sec 20: [sibling|mixed][pt-ordered dphi side: 0 clean (dphi>0), 1 dirty (dphi<0)], sign +, min over R
0445         TH1D*   hMinvF_S;       // Minv, 500 x 1 MeV from m1+m2-5MeV, sibling pairs, raw counts summed over Zvtx (C(Q) page)
0446         TH1D*   hMinvF_M;       // same, mixed pairs
0447         long    nMixedPairs_total;
0448         long    nMixedPairs_sameTF;
0449         long    nMixedPairs_neighborTF;
0450         TH1D*   hQsib[NZVTXMAX];            // femtoscopic numerator: Qinv, same-event pairs
0451         TH1D*   hQmix[NZVTXMAX];            // femtoscopic denominator: Qinv, mixed-event pairs (NMIX-only normalization applied in Calculate)
0452         TH1D*   hQsibW[NZVTXMAX];           // long-Q test copies of hQsib / hQmix, 0-8 GeV in 10 MeV bins (README_CQcomparison sec 2.3)
0453         TH1D*   hQmixW[NZVTXMAX];
0454         TH1D*   hCQ[NZVTXMAX];              // femtoscopic C(Q) = hQsib/hQmix
0455         TH2D*   hQsibKT[NZVTXMAX];          // README_CQ: same as hQsib, vs (Qinv, kT) in STAR's 4 kT bins (flow bins = kT outside 0.15-0.60)
0456         TH2D*   hQmixKT[NZVTXMAX];          // same as hQmix, vs (Qinv, kT)
0457         TH2D*   hCQKT[NZVTXMAX];            // hQsibKT/hQmixKT
0458 //      TH2D*   hMinvdq_S[NZVTXMAX];
0459 //      TH2D*   hMinvdq_M[NZVTXMAX];
0460 //      TH2D*   hMinvdq[NZVTXMAX];
0461         //
0462         long npair_all_S    ;
0463         long npair_dylow1_S ;
0464         long npair_dylow2_S ;
0465         long npair_dylow3_S ;
0466         long npair_qlow_S   ;
0467         long npair_mlow_S   ;
0468         long npair_all_M    ;   
0469         long npair_dylow1_M ;
0470         long npair_dylow2_M ;
0471         long npair_dylow3_M ;
0472         long npair_qlow_M   ;
0473         long npair_mlow_M   ;
0474         //
0475     //
0476     //ClassDef(CalcRm, 0)
0477 };
0478 
0479 inline void   CalcRm::SetDistinguishable(bool b){ fDistinguishable=b; return; }
0480 inline bool   CalcRm::GetDistinguishable(){ return fDistinguishable; }
0481 inline void   CalcRm::SetDoMinvCut(bool b){ fDoMinvCut=b; return; }
0482 inline bool   CalcRm::GetDoMinvCut(){ return fDoMinvCut; }
0483 inline void   CalcRm::SetDoMinvLLCut(bool b){ fDoMinvLLCut=b; return; }
0484 inline bool   CalcRm::GetDoMinvLLCut(){ return fDoMinvLLCut; }
0485 inline void   CalcRm::SetFlipDy(bool b){ fFlipDy=b; return; }
0486 inline bool   CalcRm::GetFlipDy(){ return fFlipDy; }
0487 inline void   CalcRm::SetDoCrossing(bool b){ fDoCrossing=b; return; }
0488 inline bool   CalcRm::GetDoCrossing(){ return fDoCrossing; }
0489 inline void   CalcRm::SetField(double f){ fField=f; return; }
0490 inline int    CalcRm::GetDirtySide(){ return fDirtySide; }
0491 inline void   CalcRm::SetDoBaseline(bool b){ fDoBaseline=b; return; }
0492 inline bool   CalcRm::GetDoBaseline(){ return fDoBaseline; }
0493 inline void   CalcRm::SetDoQcut(bool b){ fDoQcut=b; return; }
0494 inline bool   CalcRm::GetDoQcut(){ return fDoQcut; }
0495 inline void   CalcRm::SetQcut(double v){ fQcut=v; return; }
0496 inline double CalcRm::GetQcut(){ return fQcut; }
0497 inline void   CalcRm::SetPid1(int m){ fPid1=m;   return; }
0498 inline int    CalcRm::GetPid1(){ return fPid1; }
0499 inline void   CalcRm::SetPid2(int m){ fPid2=m;   return; }
0500 inline int    CalcRm::GetPid2(){ return fPid2; }
0501 // inline void  CalcRm::SetChg1(double m){ fChg1=m;   return; }
0502 // inline double CalcRm::GetChg1(){ return fChg1; }
0503 // inline void  CalcRm::SetChg2(double m){ fChg2=m;   return; }
0504 // inline double CalcRm::GetChg2(){ return fChg2; }
0505 // inline void  CalcRm::SetMass1(double m){ fMass1=m;   return; }
0506 // inline double CalcRm::GetMass1(){ return fMass1; }
0507 // inline void  CalcRm::SetMass2(double m){ fMass2=m;   return; }
0508 // inline double CalcRm::GetMass2(){ return fMass2; }
0509 inline void   CalcRm::SetMAXMULT(int i){ MAXMULT=i;   return; }
0510 inline int    CalcRm::GetMAXMULT(){ return MAXMULT; }
0511 inline void   CalcRm::SetNMIX(int i){ NMIX=i; return; }
0512 inline int    CalcRm::GetNMIX(){ return NMIX; }
0513 inline void   CalcRm::SetYNB1(int i){ YNB1=i;   return; }
0514 inline void   CalcRm::SetYL1(double y){ YL1=y;  return; }
0515 inline void   CalcRm::SetYU1(double y){ YU1=y;  return; }
0516 inline int    CalcRm::GetYNB1(){ return YNB1; }
0517 inline double CalcRm::GetYL1(){ return YL1; }
0518 inline double CalcRm::GetYU1(){ return YU1; }
0519 inline void   CalcRm::SetYNB2(int i){ YNB2=i;   return; }
0520 inline void   CalcRm::SetYL2(double y){ YL2=y;  return; }
0521 inline void   CalcRm::SetYU2(double y){ YU2=y;  return; }
0522 inline void   CalcRm::SetDYBW(double w){ fDYBWset=w; return; }
0523 inline int    CalcRm::GetYNB2(){ return YNB2; }
0524 inline double CalcRm::GetYL2(){ return YL2; }
0525 inline double CalcRm::GetYU2(){ return YU2; }
0526 inline void   CalcRm::SetPHINB(int i){ PHINB=i;   return; }
0527 inline void   CalcRm::SetPHIL(double phi){ PHIL=phi;  return; }
0528 inline void   CalcRm::SetPHIU(double phi){ PHIU=phi;  return; }
0529 inline int    CalcRm::GetPHINB(){ return PHINB; }
0530 inline double CalcRm::GetPHIL(){ return PHIL; }
0531 inline double CalcRm::GetPHIU(){ return PHIU; }
0532 inline void   CalcRm::SetPTL1(double pt){ PTL1=pt;  return; }
0533 inline void   CalcRm::SetPTU1(double pt){ PTU1=pt;  return; }
0534 inline void   CalcRm::SetPTL2(double pt){ PTL2=pt;  return; }
0535 inline void   CalcRm::SetPTU2(double pt){ PTU2=pt;  return; }
0536 inline double CalcRm::GetPTL1(){ return PTL1; }             
0537 inline double CalcRm::GetPTU1(){ return PTU1; }
0538 inline double CalcRm::GetPTL2(){ return PTL2; }
0539 inline double CalcRm::GetPTU2(){ return PTU2; }
0540 inline void  CalcRm::SetZVTXNB(int i){ if(i+1>=NZVTXMAX){cout<<"no! max zvtx nbin is "<<NZVTXMAX<<endl; exit(0);} ZVTXNB=i; return; }
0541 inline void  CalcRm::SetZVTXL(double y){ ZVTXL=y;  return; }
0542 inline void  CalcRm::SetZVTXU(double y){ ZVTXU=y;  return; }
0543 inline int   CalcRm::GetZVTXNB(){ return ZVTXNB; }
0544 inline double CalcRm::GetZVTXL(){ return ZVTXL; }
0545 inline double CalcRm::GetZVTXU(){ return ZVTXU; }
0546 //inline void CalcRm::SetQuiet(bool b){ fQuiet=b; return; }
0547 //inline void CalcRm::SetZero(bool b){ fZero=b; return; }
0548 //inline void CalcRm::SetMixing(bool b){ fMixing=b; return; }
0549 //inline void CalcRm::SetUnlikeSign(bool b){ fUnlikeSign=b; return; }
0550 //inline bool CalcRm::GetUnlikeSign(){ return fUnlikeSign; }
0551 
0552 //inline double CalcRm::GetTimeIncrement(){ return fTimeIncrement; }
0553 //inline double CalcRm::GetTimeCalculate(){ return fTimeCalculate; }
0554 
0555 inline TH1D* CalcRm::Gethzvtx(){ return hzvtx; }                // Zvtx distribution seen by this class
0556 inline TH2D* CalcRm::Gethmult(){ return hmult[ZVTXNB]; }        // Zvtx-averaged hist returned if no izv given
0557 inline TH2D* CalcRm::Gethmult(int izv){ return hmult[izv]; }    // if izv given then return hist for that zvtx bin
0558 
0559 inline TH3D* CalcRm::Gethrho1_1(){ return hrho1_1[ZVTXNB]; }
0560 inline TH3D* CalcRm::Gethrho1_2(){ return hrho1_2[ZVTXNB]; }
0561 inline TH3D* CalcRm::Gethrho1_1(int izv){ return hrho1_1[izv]; }
0562 inline TH3D* CalcRm::Gethrho1_2(int izv){ return hrho1_2[izv]; }
0563 
0564 inline TH1D* CalcRm::Gethy1_(){ return hy1_[ZVTXNB]; }
0565 inline TH1D* CalcRm::Gethy2_(){ return hy2_[ZVTXNB]; }
0566 inline TH1D* CalcRm::Gethy1_(int izv){ return hy1_[izv]; }
0567 inline TH1D* CalcRm::Gethy2_(int izv){ return hy2_[izv]; }
0568 inline TH1D* CalcRm::Gethyc1_(){ return hyc1_[ZVTXNB]; }
0569 inline TH1D* CalcRm::Gethyc2_(){ return hyc2_[ZVTXNB]; }
0570 inline TH1D* CalcRm::Gethyc1_(int izv){ return hyc1_[izv]; }
0571 inline TH1D* CalcRm::Gethyc2_(int izv){ return hyc2_[izv]; }
0572 
0573 inline TH2D* CalcRm::Gethrho2_S(int ir2){ return hrho2_S[ir2][ZVTXNB]; }
0574 inline TH2D* CalcRm::Gethrho2_S(int ir2, int izv){ return hrho2_S[ir2][izv]; }
0575 inline TH2D* CalcRm::Gethrho2_M(int ir2){ return hrho2_M[ir2][ZVTXNB]; }
0576 inline TH2D* CalcRm::Gethrho2_M(int ir2, int izv){ return hrho2_M[ir2][izv]; }
0577 
0578 inline TH2D* CalcRm::Gethrho2_S_dptP(int ir2){ return hrho2_S_dptP[ir2][ZVTXNB]; }
0579 inline TH2D* CalcRm::Gethrho2_S_dptN(int ir2){ return hrho2_S_dptN[ir2][ZVTXNB]; }
0580 inline TH2D* CalcRm::Gethrho2_M_dptP(int ir2){ return hrho2_M_dptP[ir2][ZVTXNB]; }
0581 inline TH2D* CalcRm::Gethrho2_M_dptN(int ir2){ return hrho2_M_dptN[ir2][ZVTXNB]; }
0582 inline TH2D* CalcRm::Gethrho2_S_dptP(int ir2, int izv){ return hrho2_S_dptP[ir2][izv]; }
0583 inline TH2D* CalcRm::Gethrho2_S_dptN(int ir2, int izv){ return hrho2_S_dptN[ir2][izv]; }
0584 inline TH2D* CalcRm::Gethrho2_M_dptP(int ir2, int izv){ return hrho2_M_dptP[ir2][izv]; }
0585 inline TH2D* CalcRm::Gethrho2_M_dptN(int ir2, int izv){ return hrho2_M_dptN[ir2][izv]; }
0586 
0587 inline TH2D* CalcRm::GethC2(int ir2){ return hC2[ir2][ZVTXNB]; }
0588 inline TH2D* CalcRm::GethC2(int ir2, int izv){ return hC2[ir2][izv]; }
0589 
0590 inline TH2D* CalcRm::GethR2(int ir2){ return hR2[ir2][ZVTXNB]; }
0591 inline TH2D* CalcRm::GethR2(int ir2, int izv){ return hR2[ir2][izv]; }
0592 inline TH2D* CalcRm::Gethrho2C_S(){ return hrho2C_S[ZVTXNB]; }
0593 inline TH2D* CalcRm::GethC2C(){ return hC2C[ZVTXNB]; }
0594 inline TH2D* CalcRm::GethR2C(){ return hR2C[ZVTXNB]; }
0595 inline TH2D* CalcRm::Gethrho2C_S(int izv){ return hrho2C_S[izv]; }
0596 inline TH2D* CalcRm::GethC2C(int izv){ return hC2C[izv]; }
0597 inline TH2D* CalcRm::GethR2C(int izv){ return hR2C[izv]; }
0598 inline TH1D* CalcRm::GethR2yydy(){ return hR2yydy[ZVTXNB]; }
0599 inline TH1D* CalcRm::GethR2yydy(int izv){ return hR2yydy[izv]; }
0600 inline TH1D* CalcRm::GethR2dy(){ return hR2dy[ZVTXNB]; }
0601 inline TH1D* CalcRm::GethR2dy(int izv){ return hR2dy[izv]; }
0602 inline TH1D* CalcRm::GethR2dphi(){ return hR2dphi[ZVTXNB]; }
0603 inline TH1D* CalcRm::GethR2dphi(int izv){ return hR2dphi[izv]; }
0604 
0605 inline TH1D* CalcRm::GethMinv_S(){ return hMinv_S[ZVTXNB]; }
0606 inline TH1D* CalcRm::GethMinv_S(int izv){ return hMinv_S[izv]; }
0607 inline TH1D* CalcRm::GethMinv_M(){ return hMinv_M[ZVTXNB]; }
0608 inline TH1D* CalcRm::GethMinv_M(int izv){ return hMinv_M[izv]; }
0609 inline TH1D* CalcRm::GethMinv(){ return hMinv[ZVTXNB]; }
0610 inline TH1D* CalcRm::GethMinv(int izv){ return hMinv[izv]; }
0611 
0612 inline TH1D* CalcRm::GethQsib(){ return hQsib[ZVTXNB]; }
0613 inline TH1D* CalcRm::GethQsib(int izv){ return hQsib[izv]; }
0614 inline TH1D* CalcRm::GethQmix(){ return hQmix[ZVTXNB]; }
0615 inline TH1D* CalcRm::GethQmix(int izv){ return hQmix[izv]; }
0616 inline TH1D* CalcRm::GethCQ(){ return hCQ[ZVTXNB]; }
0617 inline TH1D* CalcRm::GethCQ(int izv){ return hCQ[izv]; }
0618 
0619 //inline TH2D* CalcRm::GethMinvdq(){ return hMinvdq[ZVTXNB]; }
0620 //inline TH2D* CalcRm::GethMinvdq(int izv){ return hMinvdq[izv]; }
0621 
0622 // inline TH1D* CalcRm::GethR2dyNS(){ return hR2dyNS[ZVTXNB]; }
0623 // inline TH1D* CalcRm::GethR2dyNS(int izv){ return hR2dyNS[izv]; }
0624 // inline TH1D* CalcRm::GethR2dqNS(){ return hR2dqNS[ZVTXNB]; }
0625 // inline TH1D* CalcRm::GethR2dqNS(int izv){ return hR2dqNS[izv]; }
0626 // inline TH1D* CalcRm::GethR2dphiNS(){ return hR2dphiNS[ZVTXNB]; }
0627 // inline TH1D* CalcRm::GethR2dphiNS(int izv){ return hR2dphiNS[izv]; }
0628 
0629 #endif
0630 
0631 
0632 
0633