Bitwise complement in TTree::Draw

Hello,
I’m trying to apply a bitwise complement to an unsigned int that I have in a TTree branch. Apparently this is not supported and I get an error. Using bitwise & | works fine, is there any catch with using “~”?

root [18] DM_scalar_p20_c1_Nom->Draw("~DM_low_n1")
Error in TTreeFormula::Compile: Bad numerical expression : "~DM_low_n1"
Info in TSelectorDraw::AbortProcess: Variable compilation failed: {~DM_low_n1,}

Cheers
Javier

Hi Javier,

Unfortunately bitwise complement is not explicitly support by TTreeFormula.

However you can create and load in the interpreter a function that give you access to it and then call it from Draw:

DM_scalar_p20_c1_Nom->Draw("BitwiseComplement(DM_low_n1)");

Cheers,
Philippe.

Hi Philippe,
thanks for the info, that’s what I ended up implementing.

Cheers
Javier

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.