00001
00002
00003
00004
00005 #ifndef RUNTHINGS_HEADER
00006 #define RUNTHINGS_HEADER
00007
00008 #include <vector>
00009 #include "hkl_datatypes.hh"
00010 #include "range.hh"
00011
00012 namespace scala {
00013
00014
00015 class Run
00016
00017 {
00018 public:
00019 enum FullsAndPartials {FULLSANDPARTIALS, ONLYFULLS, ONLYPARTIALS, FEWFULLS, FEWPARTIALS};
00020
00021 Run();
00022 Run(const int& DatasetIndex);
00023 void clear();
00024 void clearCounts();
00025
00026 void AddBatch(const int& Batch, const bool& accept=true);
00027
00028 void SortList();
00029
00030
00031 bool IsInList(const int& Batch) const;
00032
00033
00034 std::vector<int> BatchList(const bool& Accepted=false) const;
00035 int DatasetIndex() const {return dataset_index;}
00036
00037 std::pair<int,int> BatchRange() const;
00038
00039 int Batch0() const;
00040
00041 void SetBatchSerial0(const int& BatchSerial)
00042 {batchserial0 = BatchSerial;}
00043 int BatchSerial0() const {return batchserial0;}
00044
00045
00046 int Nbatches() const {return batch_number_list.size();}
00047
00048
00049 void OffsetBatchNumbers(const int& offset);
00050 int& BatchNumberOffset() {return batch_number_offset;}
00051 int BatchNumberOffset() const {return batch_number_offset;}
00052
00053 int& RunNumber() {return runnumber;}
00054 int RunNumber() const {return runnumber;}
00055
00056 int& FileNumber() {return file_number;}
00057 int FileNumber() const {return file_number;}
00058
00059 Range& PhiRange() {return phirange;}
00060 Range PhiRange() const {return phirange;}
00061
00062 Range& TimeRange() {return timerange;}
00063 Range TimeRange() const {return timerange;}
00064
00065 bool& ValidTime() {return validtime;}
00066 bool ValidTime() const {return validtime;}
00067 void SetValidOrientation(const bool& validOrientation)
00068 {validorientation = validOrientation;}
00069 bool ValidOrientation() const {return validorientation;}
00070 void StoreSpindleToPrincipleAxis(const std::string& Spindletoprincipleaxis)
00071 {spindletoprincipleaxis = Spindletoprincipleaxis;}
00072 std::string SpindleToPrincipleAxis() const
00073 {return spindletoprincipleaxis;}
00074
00075 static int MaximumBatchNumber() {return MaxBatchNumber;}
00076
00077 std::string formatPrint(const std::vector<Xdataset>& datasets) const;
00078 std::string formatPrintBrief(const std::vector<Xdataset>& datasets) const;
00079
00080 int& Nfulls() {return nfulls;}
00081 int& Npartials() {return npartials;}
00082
00083 int Nfulls() const {return nfulls;}
00084 int Npartials() const {return npartials;}
00085
00087 void SetFullsAndPartials();
00089 FullsAndPartials fullsAndPartials()const {return fullsandpartials;}
00090
00091
00092 std::string FormatSave() const;
00093
00095 void StoreResoRange(const ResoRange& Resrange);
00097 ResoRange GetResoRange() const {return resrange;}
00099 bool IsResoRange() const {return resrangeset;}
00101
00102 bool InResoRange(const Rtype& invresolsq, const int& batch);
00103
00104 private:
00105 int runnumber;
00106 static const int MaxBatchNumber;
00107 int dataset_index;
00108 mutable std::vector<int> batch_number_list;
00109 std::vector<bool> batch_accepted;
00110 int batch_number_offset;
00111 int batchserial0;
00112 int file_number;
00113 Range phirange;
00114 Range timerange;
00115 bool validtime;
00116 bool validorientation;
00117 std::string spindletoprincipleaxis;
00118 int nfulls;
00119 int npartials;
00120 FullsAndPartials fullsandpartials;
00121 ResoRange resrange;
00122 bool resrangeset;
00123 };
00124
00125 class RunRange
00126 {
00127 public:
00128 RunRange() : Offset(0) {}
00129 RunRange(const int& Low, const int& High)
00130 : Offset(0),
00131 LowBatchNumber(Low), HighBatchNumber(High) {}
00132 RunRange(const std::pair<int,int>& LowHigh)
00133 : Offset(0),
00134 LowBatchNumber(LowHigh.first), HighBatchNumber(LowHigh.second) {}
00135
00136 bool Encloses(const RunRange& test) const;
00137 bool Encloses(const int& testN) const;
00138
00139 void IncrementOffset(const int& offset);
00140
00141
00142 int LowBatchNumber;
00143 int HighBatchNumber;
00144 int Offset;
00145 };
00146
00147
00148
00149
00150
00151
00152 std::vector<int> CompareRunRanges(const std::vector<Run>& refruns,
00153 const std::vector<Run>& testruns);
00154
00155
00156
00157 int FindRunIndex(const int& runNumber, const std::vector<Run>& runList);
00158 }
00159 #endif