Hi
I am having difficulty figuring out exactly what is wrong with the following code.
I have two cuts. TCut c1 and TCut c2.
when i do
TTree::Draw("something",c1&&c2);
and
TTree::Draw("something",c2&&c1);
I get different total events.
The events I used are the following
************************************************************
* Row * lepPt0 * lepPt1 * lepID0 * lepID1 *
************************************************************
* 0 * 33.423065 * 29.429718 * -11 * 11 *
* 1 * 72.650131 * 23.744958 * -13 * 13 *
* 2 * 48.249301 * 28.992931 * -13 * 13 *
* 3 * 86.468284 * 32.123394 * -11 * 11 *
* 4 * 84.530334 * 53.902832 * -11 * 11 *
* 5 * 29.802261 * 53.590610 * -11 * 11 *
* 6 * 38.740757 * 56.894474 * -13 * 13 *
* 7 * 21.587720 * 58.379043 * -13 * 13 *
* 8 * 25.722772 * 33.72966 * -13 * 13 *
* 9 * 24.190134 * 29.898239 * -13 * 13 *
* 10 * 67.901580 * 47.854301 * -13 * 13 *
* 11 * 120.54889 * 89.160293 * -13 * 13 *
* 12 * 19.230976 * 37.462307 * -13 * 13 *
* 13 * 34.628059 * 28.787733 * -11 * 11 *
* 14 * 30.282795 * 29.04492 * -13 * 13 *
* 15 * 39.282825 * 31.322271 * -11 * 11 *
* 16 * 24.746297 * 63.204483 * -13 * 13 *
* 17 * 45.037014 * 51.062854 * -13 * 13 *
* 18 * 28.274683 * 57.416217 * -11 * 11 *
* 19 * 71.684768 * 46.307247 * -13 * 13 *
* 20 * 52.656810 * 73.149070 * -13 * 13 *
* 21 * 32.525287 * 48.145008 * -11 * 11 *
* 22 * 92.920562 * 151.8992 * -11 * 11 *
* 23 * 100.11554 * 72.081031 * -13 * 13 *
* 24 * 84.972572 * 66.479759 * -11 * 11 *
* 25 * 81.586006 * 70.635055 * -13 * 13 *
* 26 * 30.322980 * 33.639839 * -13 * 13 *
* 27 * 27.474876 * 48.477775 * -13 * 13 *
* 28 * 29.572233 * 28.005685 * -13 * 13 *
* 29 * 18.212085 * 47.551452 * -13 * 13 *
************************************************************
And the Code that i ran to check the result I said is here
void tertiarytest(const char* file){
TFile* _file0 = new TFile(file);
TTree*a=(TTree*)_file0->Get("tree");
const char* cut1= "(lepPt0 > lepPt1 ? lepID0==-11:lepID0==-13)";
//const char* cut1= "(lepPt0 > lepPt1 ? (abs(lepID0) == 11 && abs(lepID1) == 13) : (abs(lepID0) == 13 && abs(lepID1) == 11))";
const char* cut2= "(lepID0*lepID1 < 0)";
TCut c1 = cut1;
TCut c2 = cut2;
cout << cut1 << " && " << cut2 << endl;
a->Draw("lepPt0>>h1",c1&&c2,"goff");
TH1F *h1 = (TH1F*)gDirectory->Get("h1");
cout << h1->Integral() << endl;
cout << cut2 << " && " << cut1 << endl;
a->Draw("lepPt0>>h1",c2&&c1,"goff");
TH1F *h1 = (TH1F*)gDirectory->Get("h1");
cout << h1->Integral() << endl;
}
And, the result I get is
$ ./terttest.sh dummyshort.root
root [0]
Processing tertiarytest.C("dummyshort.root")...
(lepPt0 > lepPt1 ? lepID0==-11:lepID0==-13) && (lepID0*lepID1 < 0)
13
(lepID0*lepID1 < 0) && (lepPt0 > lepPt1 ? lepID0==-11:lepID0==-13)
17
I also attached this example.
ROOT experts! could you tell me what is wrong with this code?
Am I not allowed to use tertiary operators in Cut words…??
terttest.tar.gz (6.82 KB)