struct Run { private: int number; std::vector spill_list; public: void SetNumber(int run) { number=run; spill_list.clear(); } void AddSpill(int spill) {spill_list.push_back(spill);} void OrderSpills() { int moved=1; while (moved>0) { moved=0; for (int i=0; i<(int)spill_list.size()-1; i++) { int j; if (spill_list.at(i) > spill_list.at(i+1)) { j=spill_list.at(i); spill_list.at(i)=spill_list.at(i+1); spill_list.at(i+1)=j; moved++; } } } } int GetNumber() {return number;} int GetNumberOfSpills() {return (int)spill_list.size();} int GetSpillNumber(int i) { if (i<0 || i>=(int)spill_list.size()) { return -1; } else { return spill_list.at(i); } } }; //=================================================== struct BPC_timing { private: int trig; // beam trigger# int spill; // spill# int trig_spill; // trigger# in spill double tBPC; // absolute time double tSpill; // time in-spill double tPrev; // Previous event time; same for the first event in the spill; public: void Set(int tr, int sp, int trsp, double t, double ts) { trig=tr; spill=sp; trig_spill=trsp; tBPC=t; tSpill=ts; } void Set(int tr, int sp, int trsp, double t, double ts, double tp) { trig=tr; spill=sp; trig_spill=trsp; tBPC=t; tSpill=ts; tPrev=tp; } int GetTrigger() {return trig;} int GetSpill() {return spill;} int GetTrigSpill() {return trig_spill;} double GetTbpc() {return tBPC;} double GetTspl() {return tSpill;} double GetTprev() {return tPrev;} double GetTdiff() {return tSpill-tPrev;} void Print() { double ts=tBPC-tSpill; printf("[BPC] spill#%d\t trig#%d(%d)\t tPrev=%fms tBPC=%fms\n", spill, trig, trig_spill, 1000.0*ts+tPrev, 1000.0*tBPC); } }; //=================================================== struct DIG_timing { private: int trig; // beam trigger# int spill; // spill# int trig_spill; // trigger# in spill int tSpill; // spill time (seconds!!!) double tDIG[3]; // 3 digitizers double tPrev; // Previous event time; same for the first event in the spill; double tDig; public: void Set(int tr, int sp, int trsp, int t, int ts0, int ts1, int ts2) { trig=tr; spill=sp; trig_spill=trsp; tSpill=t; tDIG[0]=8.0e-9*ts0; tDIG[1]=8.0e-9*ts1; tDIG[2]=8.0e-9*ts2; tDig=(tDIG[0]+tDIG[1]+tDIG[2])/3.0; } void Set(int tr, int sp, int trsp, int t, int ts0, int ts1, int ts2, double tp) { trig=tr; spill=sp; trig_spill=trsp; tSpill=t; tDIG[0]=8.0e-9*ts0; tDIG[1]=8.0e-9*ts1; tDIG[2]=8.0e-9*ts2; tDig=(tDIG[0]+tDIG[1]+tDIG[2])/3.0; tPrev=tp; } int GetTrigger() {return trig;} int GetSpill() {return spill;} int GetTrigSpill() {return trig_spill;} int GetTspl() {return tSpill;} double GetTdig() {return tDig;} double GetTprev() {return tPrev;} double GetTdiff() {return GetTdig()-tPrev;} double GetTag0() {return tDIG[0];} double GetTag1() {return tDIG[1];} double GetTag2() {return tDIG[2];} void Print() { printf("[DIG] spill#%d\t trig#%d(%d)\t tPrev=%fms tBPC=%fms\n", spill, trig, trig_spill, 1000.0*tPrev, 1000.0*tDig); } }; struct event_match { private: int run; int spill0; int event0; int eventSpill0; int spill1; int event1; int eventSpill1; double mismatch; public: void Set(int r, int s0, int e0, int es0, int s1, int e1, int es1, double m) { run=r; spill0=s0; event0=e0; eventSpill0=es0; spill1=s1; event1=e1; eventSpill1=es1; mismatch=m; } void Print() { printf("run#%3d spill#%3d event#%4d(%3d) -> spill#%3d event#%4d(%3d) match=%.4f\n", run, spill0, event0, eventSpill0, spill1, event1, eventSpill1, 1000.0*mismatch); } int GetRun() {return run;} int GetSpill0() {return spill0;} int GetEvent0() {return event0;} int GetEventSpill0() {return eventSpill0;} int GetSpill1() {return spill1;} int GetEvent1() {return event1;} int GetEventSpill1() {return eventSpill1;} double GetMismatch() {return mismatch;} }; //===================================================== struct hit { int indx0; // contributing hit index int indx1; // contributing hit index int sum; double x; double wGood; double sGood; bool good; //-------------------------- void Set(int I0, int I1, int SUM, double X) { indx0=I0; indx1=I1; sum=SUM; x=X; good=false; wGood=0.; sGood=0.; } void AddGood(double w) { if (w>0.25) { good=true; wGood+=w; sGood+=1.0; } } double GetGood() { if (sGood==0.) return 0.; else return wGood/sGood; } } myHit;