00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 #include "TCut.h"
00038
00039 ClassImp(TCut)
00040
00041
00042 TCut::TCut() : TNamed()
00043 {
00044
00045 }
00046
00047
00048 TCut::TCut(const char *title) : TNamed("CUT",title)
00049 {
00050
00051 }
00052
00053
00054 TCut::TCut(const char *name, const char *title) : TNamed(name,title)
00055 {
00056
00057 }
00058
00059
00060 TCut::TCut(const TCut &cut) : TNamed(cut)
00061 {
00062
00063 }
00064
00065
00066 TCut::~TCut()
00067 {
00068
00069 }
00070
00071
00072 Bool_t TCut::operator==(const char *rhs) const
00073 {
00074
00075
00076 return fTitle == rhs;
00077 }
00078
00079
00080 Bool_t TCut::operator==(const TCut &rhs) const
00081 {
00082
00083
00084 return fTitle == rhs.fTitle;
00085 }
00086
00087
00088 Bool_t TCut::operator!=(const char *rhs) const
00089 {
00090
00091
00092 return fTitle != rhs;
00093 }
00094
00095
00096 Bool_t TCut::operator!=(const TCut &rhs) const
00097 {
00098
00099
00100 return fTitle != rhs.fTitle;
00101 }
00102
00103
00104 TCut& TCut::operator=(const char *rhs)
00105 {
00106
00107
00108 fTitle = rhs;
00109 return *this;
00110 }
00111
00112
00113 TCut& TCut::operator=(const TCut& rhs)
00114 {
00115
00116
00117 if (this != &rhs) TNamed::operator=(rhs);
00118 return *this;
00119 }
00120
00121
00122 TCut& TCut::operator+=(const char *rhs)
00123 {
00124
00125
00126 if (!rhs || strlen(rhs) == 0) return *this;
00127 if (fTitle.Length() == 0)
00128 fTitle = rhs;
00129 else
00130 fTitle = "(" + fTitle + ")&&(" + TString(rhs) + ")";
00131 return *this;
00132 }
00133
00134
00135 TCut& TCut::operator+=(const TCut& rhs)
00136 {
00137
00138
00139 if (rhs.fTitle.Length() == 0) return *this;
00140 if (fTitle.Length() == 0)
00141 fTitle = rhs;
00142 else
00143 fTitle = "(" + fTitle + ")&&(" + rhs.fTitle + ")";
00144 return *this;
00145 }
00146
00147
00148 TCut& TCut::operator*=(const char *rhs)
00149 {
00150
00151
00152 if (!rhs || strlen(rhs) == 0) return *this;
00153 if (fTitle.Length() == 0)
00154 fTitle = rhs;
00155 else
00156 fTitle = "(" + fTitle + ")*(" + TString(rhs) + ")";
00157 return *this;
00158 }
00159
00160
00161 TCut& TCut::operator*=(const TCut& rhs)
00162 {
00163
00164
00165 if (rhs.fTitle.Length() == 0) return *this;
00166 if (fTitle.Length() == 0)
00167 fTitle = rhs;
00168 else
00169 fTitle = "(" + fTitle + ")*(" + rhs.fTitle + ")";
00170 return *this;
00171 }
00172
00173
00174 TCut operator+(const TCut& lhs, const char *rhs)
00175 {
00176
00177
00178 return TCut(lhs) += rhs;
00179 }
00180
00181
00182 TCut operator+(const char *lhs, const TCut& rhs)
00183 {
00184
00185
00186 return TCut(lhs) += rhs;
00187 }
00188
00189
00190 TCut operator+(const TCut& lhs, const TCut& rhs)
00191 {
00192
00193
00194 return TCut(lhs) += rhs;
00195 }
00196
00197
00198 TCut operator*(const TCut& lhs, const char *rhs)
00199 {
00200
00201
00202 return TCut(lhs) *= rhs;
00203 }
00204
00205
00206 TCut operator*(const char *lhs, const TCut& rhs)
00207 {
00208
00209
00210 return TCut(lhs) *= rhs;
00211 }
00212
00213
00214 TCut operator*(const TCut& lhs, const TCut& rhs)
00215 {
00216
00217
00218 return TCut(lhs) *= rhs;
00219 }
00220
00221
00222 TCut operator&&(const TCut& lhs, const char *rhs)
00223 {
00224
00225
00226 return TCut(lhs) += rhs;
00227 }
00228
00229
00230 TCut operator&&(const char *lhs, const TCut& rhs)
00231 {
00232
00233
00234 return TCut(lhs) += rhs;
00235 }
00236
00237
00238 TCut operator&&(const TCut& lhs, const TCut& rhs)
00239 {
00240
00241
00242 return TCut(lhs) += rhs;
00243 }
00244
00245
00246 TCut operator||(const TCut& lhs, const char *rhs)
00247 {
00248
00249
00250 if (lhs.fTitle.Length() == 0 && (!rhs || strlen(rhs) == 0)) return TCut();
00251 if (lhs.fTitle.Length() == 0) return TCut(rhs);
00252 if (!rhs || strlen(rhs) == 0) return TCut(lhs);
00253 TString s = "(" + lhs.fTitle + ")||(" + TString(rhs) + ")";
00254 return TCut(s.Data());
00255 }
00256
00257
00258 TCut operator||(const char *lhs, const TCut& rhs)
00259 {
00260
00261
00262 if ((!lhs || strlen(lhs) == 0) && rhs.fTitle.Length() == 0) return TCut();
00263 if (!lhs || strlen(lhs) == 0) return TCut(rhs);
00264 if (rhs.fTitle.Length() == 0) return TCut(lhs);
00265 TString s = "(" + TString(lhs) + ")||(" + rhs.fTitle + ")";
00266 return TCut(s.Data());
00267 }
00268
00269
00270 TCut operator||(const TCut& lhs, const TCut& rhs)
00271 {
00272
00273
00274 if (lhs.fTitle.Length() == 0 && rhs.fTitle.Length() == 0) return TCut();
00275 if (lhs.fTitle.Length() == 0) return TCut(rhs);
00276 if (rhs.fTitle.Length() == 0) return TCut(lhs);
00277 TString s = "(" + lhs.fTitle + ")||(" + rhs.fTitle + ")";
00278 return TCut(s.Data());
00279 }
00280
00281
00282 TCut operator!(const TCut &rhs)
00283 {
00284
00285
00286 if (rhs.fTitle.Length() == 0) return TCut();
00287 TString s = "!(" + rhs.fTitle + ")";
00288 return TCut(s.Data());
00289 }
00290