TTree Draw conditional syntax

Hi all. I’m am trying to plot some data using TTree::Draw under some conditions that I can’t figure out how to write in the conditional syntax. Perhaps what I want to do is not possible with the Draw command and I’ll need to write a script.

Here’s what my branch structure looks like

Event{
HeaderData fHeader;
TClonesArray *fDetectors; //an array of Detectors

}

Detector{
Int_t fDetectorNumber;
Double_t fValue[2];

}

What I want to plot is fValue[1]-fValue[0] when fDetectorNumber == 4 AND when any of the other Detectors in the array have fDetectorNumber >= 33 with fValue[0] >-1 and fValue[1]>-1.

So, something like this:
TTree::Draw(“fValue[][1] - fValue[][0]”,“fDetectorNumber==4 && ??? how do I write this condition?”)

Thanks for your help.

Adam

A small clarification:

What I want to plot is fValue[1]-fValue[0] for fDetectorNumber == 4 when any of the other Detectors in the array have fDetectorNumber >= 33 with fValue[0] >-1 and fValue[1]>-1.

Could you post your data model, ie
-either the result of mytree.Print()
-or better a small mytree.root file

Rene

Okay. Here it is (I removed some branches that aren’t relevant to my question).


*Tree :t : KDSTree *
*Entries : 20504240 : Total = 11064261776 bytes File Size = 1723568819 *

  •    :          : Tree compression factor =   6.40                       *
    

*Branch :event *
*Entries : 20504240 : BranchElement (see below) *

*Br 0 :fUniqueID : *
*Entries : 20504240 : Total Size= 82533452 bytes File Size = 362261 *
*Baskets : 44 : Basket Size= 3027968 bytes Compression= 226.41 *

*Br 1 :fBits : *
*Entries : 20504240 : Total Size= 164384588 bytes File Size = 24995268 *
*Baskets : 92 : Basket Size= 3027968 bytes Compression= 6.56 *

*Br 2 :fRunNumber : *
*Entries : 20504240 : Total Size= 82533502 bytes File Size = 402223 *
*Baskets : 44 : Basket Size= 3027968 bytes Compression= 203.92 *

*Br 3 :fRunStartTime : *
*Entries : 20504240 : Total Size= 164554779 bytes File Size = 884816 *
*Baskets : 87 : Basket Size= 3027968 bytes Compression= 185.40 *

*Br 4 :fRunEndTime : *
*Entries : 20504240 : Total Size= 164554593 bytes File Size = 884634 *
*Baskets : 87 : Basket Size= 3027968 bytes Compression= 185.43 *

*Br 5 :fEventTriggerTime : *
*Entries : 20504240 : Total Size= 164555143 bytes File Size = 81040929 *
*Baskets : 87 : Basket Size= 3027968 bytes Compression= 2.02 *

*Br 6 :fStamp : *
*Entries : 20504240 : Total Size= 164554136 bytes File Size = 82877879 *
*Baskets : 87 : Basket Size= 3027968 bytes Compression= 1.98 *

*Br 33 :fNumMuonModule : *
*Entries : 20504240 : Total Size= 82533698 bytes File Size = 8500515 *
*Baskets : 44 : Basket Size= 3027968 bytes Compression= 9.65 *

*Br 77 :fMuonModule : fMuonModule_ *
*Entries : 20504240 : Total Size= 84744834 bytes File Size = 8513643 *
*Baskets : 163 : Basket Size= 512000 bytes Compression= 9.64 *

*Br 78 :fMuonModule.fUniqueID : fUniqueID[fMuonModule_] *
*Entries : 20504240 : Total Size= 176729276 bytes File Size = 24589566 *
*Baskets : 116 : Basket Size= 3027968 bytes Compression= 7.17 *

*Br 79 :fMuonModule.fBits : fBits[fMuonModule_] *
*Entries : 20504240 : Total Size= 176728788 bytes File Size = 24637903 *
*Baskets : 116 : Basket Size= 3027968 bytes Compression= 7.16 *

*Br 80 :fMuonModule.fModuleNumber : fModuleNumber[fMuonModule_] *
*Entries : 20504240 : Total Size= 176729764 bytes File Size = 38496906 *
*Baskets : 116 : Basket Size= 3027968 bytes Compression= 4.58 *

*Br 81 :fMuonModule.fTdc[2] : fTdc[fMuonModule_] *
*Entries : 20504240 : Total Size= 271126826 bytes File Size = 76185481 *
*Baskets : 153 : Basket Size= 3027968 bytes Compression= 3.55 *

*Br 82 :fMuonModule.fAdc[2] : fAdc[fMuonModule_] *
*Entries : 20504240 : Total Size= 271126826 bytes File Size = 104725565 *
*Baskets : 153 : Basket Size= 3027968 bytes Compression= 2.59 *

*Br 83 :fMuonModule.fAdcGroup : fAdcGroup[fMuonModule_] *
*Entries : 20504240 : Total Size= 176729276 bytes File Size = 32123783 *
*Baskets : 116 : Basket Size= 3027968 bytes Compression= 5.49 *

*Br 84 :TRefTable : List of branch numbers with referenced objects *
*Entries : 20504240 : Total Size= 420255214 bytes File Size = 47368263 *
*Baskets : 15684 : Basket Size= 32000 bytes Compression= 8.86 *

So, in terms of these variables, I want to plot fTdc[1]-fTdc[0] for fModuleNumber == 4 when any of the other MuonModule objects in the array have " fModuleNumber >= 33 with fTdc[0] >-1 and fTdc[1]>-1 ".

Also - I’ve attached a small file (but it contains all of these branches that I don’t care about at the moment).

Thanks!

Adam
test.root (424 KB)

poke…

Hi all. Does anybody have some idea? Is it possible what I want to do using TTree::Draw??

thanks,
Adam

[quote] fTdc[1]-fTdc[0] for fModuleNumber == 4 with fTdc[0] >-1 and fTdc[1]>-1[/quote]is

and [quote] fTdc[1]-fTdc[0] for fModuleNumber == 4 when any of the other MuonModule objects in the array have " fModuleNumber >= 33 with fTdc[0] >-1 and fTdc[1]>-1[/quote]is

Cheers,
Philippe.

Fantastic, Philippe.

You saved the day. If I make a visit to CERN I’ll be sure to track you down and buy you a beer.

cheers,
Adam

oh crap… you’re at Fermilab. Okay, I’ll find you there.

Adam

Your welcome.
Philippe.