Home | News | Documentation | Download

What is the problem in draw cut?

Hi expert.
I just try to see the scatter plot within specific energy range.
So i type this code.

 14  TCanvas *c = new TCanvas("c","c", 800,600);
 15 
 16   TString N37_noise = "(pmt41.nc>1&&pmt42.nc>1 && crystal4.t0>2. && crystal4.x2/crystal4.x1<1.25 && abs((pmt41.qc5-pmt42.qc5)/(pmt41.qc5+pmt42.qc5))<0.5)&&";
 17   TString C0_HE = "BCsI0.Energy>1300 && BCsI0.Energy<1600";
 18   TString C1_HE = "BCsI0.Energy>1300 && BCsI0.Energy<1600";
 19   TString C2_HE = "BCsI0.Energy>1300 && BCsI0.Energy<1600";
 20   TString C3_HE = "BCsI0.Energy>1300 && BCsI0.Energy<1600";
 21   TString C4_HE = "BCsI0.Energy>1300 && BCsI0.Energy<1600";
 22   TString C5_HE = "BCsI0.Energy>1300 && BCsI0.Energy<1600";
 23   TString C6_HE = "BCsI0.Energy>1300 && BCsI0.Energy<1600";
 24   TString C7_HE = "BCsI0.Energy>1300 && BCsI0.Energy<1600";
 25   TString C8_HE = "BCsI0.Energy>1300 && BCsI0.Energy<1600";
 26   TString C9_HE = "BCsI0.Energy>1300 && BCsI0.Energy<1600";
 27   TString C10_HE = "BCsI0.Energy>1300 && BCsI0.Energy<1600 &&";
 28 
 29   ch->Draw("BCsI0.Energy:crystal4.energy>>hdet_y",C0_HE + N37_noise);
 30   ch->Draw("BCsI1.Energy:crystal4.energy>>+hdet_y",C1_HE + N37_noise,"same");
 31   ch->Draw("BCsI2.Energy:crystal4.energy>>+hdet_y",C2_HE + N37_noise,"same");
 32   ch->Draw("BCsI3.Energy:crystal4.energy>>+hdet_y",C3_HE + N37_noise,"same");
 33   ch->Draw("BCsI4.Energy:crystal4.energy>>+hdet_y",C4_HE + N37_noise,"same");
 34   ch->Draw("BCsI5.Energy:crystal4.energy>>+hdet_y",C5_HE + N37_noise,"same");
 35   ch->Draw("BCsI6.Energy:crystal4.energy>>+hdet_y",C6_HE + N37_noise,"same");
 36   ch->Draw("BCsI7.Energy:crystal4.energy>>+hdet_y",C7_HE + N37_noise,"same");
 37   ch->Draw("BCsI8.Energy:crystal4.energy>>+hdet_y",C8_HE + N37_noise,"same");
 38   ch->Draw("BCsI9.Energy:crystal4.energy>>+hdet_y",C9_HE + N37_noise,"same");
 39   ch->Draw("BCsI10.Energy:crystal4.energy>>+hdet_y",C10_HE + N37_noise,"same");
 40 
 41 
 42   TFile o("Nscat.root","RECREATE");
 43   hdet_y->Write();
 44 }

and it shows
Error in <TTreeFormula::Compile>:  Invalid Syntax "&&"
Info in <TSelectorDraw::AbortProcess>: Variable compilation failed: {BCsI0.Energy:crystal4.energy,BCsI0.Energy>1300 && BCsI0.Energy<1600(pmt41.nc>1&&pmt42.nc>1 && crystal4.t0>2. && crystal4.x2/crystal4.x1<1.25 && abs((pmt41.qc5-pmt42.qc5)/(pmt41.qc5+pmt42.qc5))<0.5)&&}
Error in <TTreeFormula::Compile>:  Invalid Syntax "&&"
Info in <TSelectorDraw::AbortProcess>: Variable compilation failed: {BCsI1.Energy:crystal4.energy,BCsI0.Energy>1300 && BCsI0.Energy<1600(pmt41.nc>1&&pmt42.nc>1 && crystal4.t0>2. && crystal4.x2/crystal4.x1<1.25 && abs((pmt41.qc5-pmt42.qc5)/(pmt41.qc5+pmt42.qc5))<0.5)&&}
Error in <TTreeFormula::Compile>:  Invalid Syntax "&&"
Info in <TSelectorDraw::AbortProcess>: Variable compilation failed: {BCsI2.Energy:crystal4.energy,BCsI0.Energy>1300 && BCsI0.Energy<1600(pmt41.nc>1&&pmt42.nc>1 && crystal4.t0>2. && crystal4.x2/crystal4.x1<1.25 && abs((pmt41.qc5-pmt42.qc5)/(pmt41.qc5+pmt42.qc5))<0.5)&&}
Error in <TTreeFormula::Compile>:  Invalid Syntax "&&"
Info in <TSelectorDraw::AbortProcess>: Variable compilation failed: {BCsI3.Energy:crystal4.energy,BCsI0.Energy>1300 && BCsI0.Energy<1600(pmt41.nc>1&&pmt42.nc>1 && crystal4.t0>2. && crystal4.x2/crystal4.x1<1.25 && abs((pmt41.qc5-pmt42.qc5)/(pmt41.qc5+pmt42.qc5))<0.5)&&}
Error in <TTreeFormula::Compile>:  Invalid Syntax "&&"
Info in <TSelectorDraw::AbortProcess>: Variable compilation failed: {BCsI4.Energy:crystal4.energy,BCsI0.Energy>1300 && BCsI0.Energy<1600(pmt41.nc>1&&pmt42.nc>1 && crystal4.t0>2. && crystal4.x2/crystal4.x1<1.25 && abs((pmt41.qc5-pmt42.qc5)/(pmt41.qc5+pmt42.qc5))<0.5)&&}
Error in <TTreeFormula::Compile>:  Invalid Syntax "&&"
Info in <TSelectorDraw::AbortProcess>: Variable compilation failed: {BCsI5.Energy:crystal4.energy,BCsI0.Energy>1300 && BCsI0.Energy<1600(pmt41.nc>1&&pmt42.nc>1 && crystal4.t0>2. && crystal4.x2/crystal4.x1<1.25 && abs((pmt41.qc5-pmt42.qc5)/(pmt41.qc5+pmt42.qc5))<0.5)&&}
Error in <TTreeFormula::Compile>:  Invalid Syntax "&&"
Info in <TSelectorDraw::AbortProcess>: Variable compilation failed: {BCsI6.Energy:crystal4.energy,BCsI0.Energy>1300 && BCsI0.Energy<1600(pmt41.nc>1&&pmt42.nc>1 && crystal4.t0>2. && crystal4.x2/crystal4.x1<1.25 && abs((pmt41.qc5-pmt42.qc5)/(pmt41.qc5+pmt42.qc5))<0.5)&&}
Error in <TTreeFormula::Compile>:  Invalid Syntax "&&"
Info in <TSelectorDraw::AbortProcess>: Variable compilation failed: {BCsI7.Energy:crystal4.energy,BCsI0.Energy>1300 && BCsI0.Energy<1600(pmt41.nc>1&&pmt42.nc>1 && crystal4.t0>2. && crystal4.x2/crystal4.x1<1.25 && abs((pmt41.qc5-pmt42.qc5)/(pmt41.qc5+pmt42.qc5))<0.5)&&}
Error in <TTreeFormula::Compile>:  Invalid Syntax "&&"
Info in <TSelectorDraw::AbortProcess>: Variable compilation failed: {BCsI8.Energy:crystal4.energy,BCsI0.Energy>1300 && BCsI0.Energy<1600(pmt41.nc>1&&pmt42.nc>1 && crystal4.t0>2. && crystal4.x2/crystal4.x1<1.25 && abs((pmt41.qc5-pmt42.qc5)/(pmt41.qc5+pmt42.qc5))<0.5)&&}
Error in <TTreeFormula::Compile>:  Invalid Syntax "&&"
Info in <TSelectorDraw::AbortProcess>: Variable compilation failed: {BCsI9.Energy:crystal4.energy,BCsI0.Energy>1300 && BCsI0.Energy<1600(pmt41.nc>1&&pmt42.nc>1 && crystal4.t0>2. && crystal4.x2/crystal4.x1<1.25 && abs((pmt41.qc5-pmt42.qc5)/(pmt41.qc5+pmt42.qc5))<0.5)&&}
Error in <TTreeFormula::Compile>:  Invalid Syntax "&&"
Info in <TSelectorDraw::AbortProcess>: Variable compilation failed: {BCsI10.Energy:crystal4.energy,BCsI0.Energy>1300 && BCsI0.Energy<1600 &&(pmt41.nc>1&&pmt42.nc>1 && crystal4.t0>2. && crystal4.x2/crystal4.x1<1.25 && abs((pmt41.qc5-pmt42.qc5)/(pmt41.qc5+pmt42.qc5))<0.5)&&}

What is the problem?


Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided


ch->Draw("BCsI0.Energy:crystal4.energy>>hdet_y", N37_noise + C0_HE);

Hi @HyungJoe_Kwon,

Yes, as already suggested by @Wile_E_Coyote, your C0_HE + N37_noise expression is reversed. It should read N37_noise + C0_HE. Same applies for the rest C1_HE, etc.

Cheers,
J.

Thanks!

Thanks for reply! It resolves well!

Oh and i have one question.
When i was use Draw code like this.

ch->Draw("BCsI1.Energy:crystal4.energy>>+hdet_y",N37_noise + C1_HE,"same");

It shows more spot in the scatter plot than i use under code.

ch->Draw("BCsI1.Energy:crystal4.energy>>+hdet_y",N37_noise + C1_HE);

What is the difference?

You can check the differences in the documentation for the corresponding class here: ROOT: ROOT Reference Documentation.

Cheers,
J.

What part? I can’t find them.

When you draw a tree as a scatter plot with option SAME, the plot is produced on top of the previous one. So you see the points of the previous plot and those you just drew with option SAME. Is it what you see ?

Yes That’s it. Thanks for reply.

So when i was not used option same. And just use ‘+’ what is the plot showing?

What do you mean ? What is option + in that context ? Can you show the command you are using ?

ch->Draw(“BCsI0.Energy:crystal4.energy>>hdet_y”,C0_HE + N37_noise);
ch->Draw(“BCsI1.Energy:crystal4.energy>>+hdet_y”,C1_HE + N37_noise);
ch->Draw(“BCsI2.Energy:crystal4.energy>>+hdet_y”,C2_HE + N37_noise);
ch->Draw(“BCsI3.Energy:crystal4.energy>>+hdet_y”,C3_HE + N37_noise);
ch->Draw(“BCsI4.Energy:crystal4.energy>>+hdet_y”,C4_HE + N37_noise);
ch->Draw(“BCsI5.Energy:crystal4.energy>>+hdet_y”,C5_HE + N37_noise);
ch->Draw(“BCsI6.Energy:crystal4.energy>>+hdet_y”,C6_HE + N37_noise);
ch->Draw(“BCsI7.Energy:crystal4.energy>>+hdet_y”,C7_HE + N37_noise);
ch->Draw(“BCsI8.Energy:crystal4.energy>>+hdet_y”,C8_HE + N37_noise);
ch->Draw(“BCsI9.Energy:crystal4.energy>>+hdet_y”,C9_HE + N37_noise);
ch->Draw(“BCsI10.Energy:crystal4.energy>>+hdet_y”,C10_HE + N37_noise);

I mean the front of hdet_y. When i use only ‘+’ it shows less points when i use option “same”.
So i want to know why is it different.

I see …
When you do:

ch->Draw(“BCsI0.Energy:crystal4.energy>>hdet_y”,C0_HE + N37_noise);
ch->Draw(“BCsI1.Energy:crystal4.energy>>hdet_y”,C1_HE + N37_noise, "","SAME");

The two scatter plots are drawn as points at the (x,y) positions. You see the real points.
When you do:

ch->Draw(“BCsI0.Energy:crystal4.energy>>hdet_y”,C0_HE + N37_noise);
ch->Draw(“BCsI1.Energy:crystal4.energy>>+hdet_y”,C1_HE + N37_noise);

The histogram is filled by the first data set, then the 2nd one is added … and at the very end the histogram is drawn. It is not a set of point anymore it is a binned histogram. You see the SCAT option.
You better use and option like BOX or COL

Thanks. It really helps me.