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;} }; //=================================================== 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; 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; } 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; tPrev=tp; } int GetTrigger() {return trig;} int GetSpill() {return spill;} int GetTrigSpill() {return trig_spill;} int GetTspl() {return tSpill;} double GetTdig() {return (tDIG[0]+tDIG[1]+tDIG[2])/3.0;} double GetTprev() {return tPrev;} double GetTdiff() {return GetTdig()-tPrev;} double GetTag0() {return tDIG[0];} double GetTag1() {return tDIG[1];} double GetTag2() {return tDIG[2];} }; //===================================================== 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;