TTree and TCut

Hello everyone,

I got a problem with my code (see below), could you maybe suggest me I solution ?
My problem is that my histogram behaves strangely… I think the problem is coming from the bitmask

e.g. bitmask = 0b100111000101
I would like perform this bitwise operation direction into the function TTree::Draw()
(i mean no redoing a loop over entries)

My histograms looks proportional to the correct value, but wrong… Since I’m getting more high histogram with TCut than the raw one…
I’m not sure that the bitwise operation & works as I expect
(since I guess it do not seems to have been implemented as well… (cF. in the documentation))

TTree *t = (TTree *)_file0->Get("mytree");
t->Draw("branch1", "bitmask&0x100");

Hi,

How does the actual behavior differ from your expectation. Can you take a look at the result of t->Scan("branch1:bitmask:bitmask&0x100");cheers,
Philippe.

It could be possible that the result is proportional to (x256)
The same for (x4) when I’m applying a cut using 0x4 for example ?

I guess it’s what I get… according to the raw plot

Result :

[quote]************************************************

  • Row * branch1 * bitmask * bitmask& *

  •    0 * 0.3385978 *         4 *         0 *
    
  •    1 * 0.8831923 *       256 *       256 *
    
  •    2 * 1.1687903 *       256 *       256 *
    
  •    3 * 1.0248885 *       256 *       256 *
    
  •    4 * 2.0133838 *         4 *         0 *
    
  •    5 * 1.0554355 *         4 *         0 *
    
  •    6 * 0.6258535 *       256 *       256 *
    
  •    7 * 0.8572015 *       256 *       256 *
    
  •    8 * 0.5914012 *       256 *       256 *
    
  •    9 * 0.3741929 *       260 *       256 *
    
  •   10 * 1.5131082 *         4 *         0 *
    
  •   11 * 0.2922829 *       256 *       256 *
    
  •   12 * 0.2259787 *       256 *       256 *
    
  •   13 * 0.5360142 *       256 *       256 *
    
  •   14 * 1.2419262 *         1 *         0 *
    
  •   15 * 1.0276869 *       256 *       256 *
    
  •   16 * 0.2976450 *         4 *         0 *
    
  •   17 * 0.4651932 *       256 *       256 *
    
  •   18 * 1.3092942 *         4 *         0 *
    
  •   19 * 0.4954045 *       256 *       256 *
    
  •   20 * 0.9920351 *         1 *         0 *
    
  •   21 * 1.2804981 *         4 *         0 *
    
  •   22 * 0.2735099 *       256 *       256 *
    
  •   23 * 0.4602948 *       256 *       256 *
    
  •   24 * 0.9345215 *         4 *         0 *[/quote]

It could be possible that the result is proportional to (x256)

Yes, the result of the selection is used as weight.

Tryt->Draw("branch1", "0 != (bitmask&0x100)");

Cheers,
Philippe.

I see ! I guessed that my TCut as input of TTree:Draw() was only considered like a boolean…
Looks much better now.

At the same time, I tried this command as well, which was the same as your command actually :

Thank you so much,
Marco