#ifndef _COMMONSTATION_H_ #define _COMMONSTATION_H_ #include #include #include #include #include using namespace std; enum { LSID = 0, EVENTINDEX, ACTUALEVENTINDEX, XPOSITION, YPOSITION, SIGNAL, // tank signal in VEM SIGOVERPEAK, // sig over peak value MINDISTANCE, // distance to the closest tank in the event MEANDISTANCE, // average distance to all other tanks in the event AXISDISTANCE, // distance to estimated axis COREDISTANCE, // distance to core ANGLETOAXIS, // angle between (core-tank / -shower axis) TIMERESIDUAL, // 10^9 * (fit - measurement) TIMESHIFT, // LStime - core time LSTIME, // T2 time - min sec T10, // T10 T50, // T50 T70, // T70 T90, // T90 LSFITTEDTIME, // fit PARTICIPATE, CAUSALITYCOUNT, RANDOMCOUNT, NCLASSMEMBERS // MUST BE THE LAST !!!! }; /** @class TClassMember */ class TClassMember { private: bool fIsInt; bool fIsDouble; int fInt; double fDouble; public: TClassMember() {} explicit TClassMember(int i) : fInt(i) { fIsInt=true; fIsDouble=false; } explicit TClassMember(double d) : fDouble(d) { fIsInt=false; fIsDouble=true; } TClassMember& operator=(int); TClassMember& operator=(double); double Value() const { if(fIsInt) return (double)fInt; else return fDouble; } int Int() const { return fInt; } double Double() const { return fDouble; } TClassMember& operator++(int) { if( fIsInt ) fInt++; else fDouble++; return *this; } TClassMember& operator--(int) { if( fIsInt ) fInt--; else fDouble--; return *this; } bool operator==(const TClassMember&) const; bool operator<(const TClassMember&) const; bool operator>(const TClassMember&) const; bool operator<=(const TClassMember&) const; bool operator>=(const TClassMember&) const; void Print(ostream&) const; }; inline ostream& operator<<(ostream& s, const TClassMember& tcm) { tcm.Print(s); return s; } /** @class TCommonStation */ class TCommonStation { private: vector fFilledRanks; public: TCommonStation() { Zero(); } void SetClassMember(int rank, int value); void SetClassMember(int rank, double value); vector< TClassMember > fvcm; TClassMember& operator[](int rank) { return fvcm[rank]; } void Zero(); void Print(ostream&) const; }; inline ostream& operator<<(ostream& s, const TCommonStation& tcs) { tcs.Print(s); return s; } /** @class TLsOrdering */ class TLsOrdering : public binary_function { private: string fOrder; int fRank; public: TLsOrdering(string order,int rank) : fOrder(order), fRank(rank) {} bool operator()(const TCommonStation&, const TCommonStation&) const; }; /** @class TLsEq */ class TLsEq : public unary_function { private: TClassMember ftcm; int fRank; public: explicit TLsEq(int rank, TClassMember value) : ftcm(value), fRank(rank) {} bool operator()(const TCommonStation& tcs) const { return tcs.fvcm[fRank] == ftcm; } }; /***********************************************************/ /** @class TvCommonStation */ class TvCommonStation : public vector { public: TvCommonStation() {} ~TvCommonStation(); vector::iterator fvTCS; int Remove(int rank, TClassMember value); int Remove(int rank, int value); int Remove(int rank, double value); void Sort(string opt, int rank); int fNParticipatingTanks; map fLsMapEventIndex; map fLsMapArrayIndex; map fLsMapActualEventIndex; vector fPairDistances; vector fParticipatingPairDistances; vector fRemovedTanks; void Print(); void Zero(); void BackUp(); void RestoreData(); }; inline ostream& operator<<(ostream& s, const vector& tcs) { if( &tcs == 0x0 ) s << "vector is undefined. Returning." << endl; else if( !tcs.size() ) s << "vector is empty. Returning." << endl; else for( unsigned int i=0;i