RE: TClonesArray of Tracks with a TClonesArray of Hits as a data member

From: Philippe Canal <pcanal_at_fnal.gov>
Date: Wed, 18 May 2005 09:09:58 -0500


Hi Vincent,

Please send me your ROOT file.

Philippe.

-----Original Message-----
From: Vincent Roberfroid [mailto:roberfroid_at_fynu.ucl.ac.be] Sent: Wednesday, May 18, 2005 8:57 AM
To: Philippe Canal
Cc: 'Axel Naumann'; roottalk_at_pcroot.cern.ch Subject: Re: [ROOT] TClonesArray of Tracks with a TClonesArray of Hits as a data member

Unfortunately, the command

     mytree->Draw("theTracks.Hits.r")
does not work.
I get the following stack trace :

0xb683bbcf in TTreeFormula::ParseWithLeaf(TLeaf*, char const*, bool, unsigned int, TObjArray&, bool, char const*) + 0x2a21 from /usr/local/cern/root/lib/libTreePlayer.so  0xb683f564 in TTreeFormula::DefinedVariable(TString&, int&) + 0x1144 from /usr/local/cern/root/lib/libTreePlayer.so  0xb75a9660 in TFormula::Analyze(char const*, int&, int) + 0x3372 from /usr/local/cern/root/lib/libHist.so
 0xb75aec3f in TFormula::Compile(char const*) + 0xd4f from /usr/local/cern/root/lib/libHist.so
 0xb6836ef4 in TTreeFormula::Init(char const*, char const*) + 0x1dc from /usr/local/cern/root/lib/libTreePlayer.so  0xb6836701 in TTreeFormula::TTreeFormula(char const*, char const*, TTree*) + 0xdf from /usr/local/cern/root/lib/libTreePlayer.so  0xb68318fd in TSelectorDraw::CompileVariables(char const*, char const*) + 0x2b9 from /usr/local/cern/root/lib/libTreePlayer.so  0xb682ed67 in TSelectorDraw::Begin(TTree*) + 0xd9b from /usr/local/cern/root/lib/libTreePlayer.so  0xb684ff8b in TTreePlayer::Process(TSelector*, char const*, long long, long long) + 0x8d from /usr/local/cern/root/lib/libTreePlayer.so  0xb684a199 in TTreePlayer::DrawSelect(char const*, char const*, char const*, long long, long long) + 0x4bd from /usr/local/cern/root/lib/libTreePlayer.so  0xb70fc4c1 in TTree::Draw(char const*, char const*, char const*, long long, long long) + 0x69 from /usr/local/cern/root/lib/libTree.so  0xb70f3d23 in TTree::Draw(char const*) + 0x35 from /usr/local/cern/root/lib/libTree.so
 0xb7118201 in <unknown> from /usr/local/cern/root/lib/libTree.so  0xb77bf49f in G__call_cppfunc + 0x2a5 from /usr/local/cern/root/lib/libCint.so
 0xb77aea8f in G__interpret_func + 0x745 from /usr/local/cern/root/lib/libCint.so
 0xb7793298 in G__getfunction + 0x1390 from /usr/local/cern/root/lib/libCint.so
 0xb782500f in G__getstructmem + 0x80d from /usr/local/cern/root/lib/libCint.so
 0xb781cb38 in G__getvariable + 0x4b7 from /usr/local/cern/root/lib/libCint.so

 0xb778a449 in G__getitem + 0x4e8 from /usr/local/cern/root/lib/libCint.so
 0xb778914f in G__getexpr + 0x7264 from /usr/local/cern/root/lib/libCint.so
 0xb77d72cb in G__exec_function + 0x1d5 from 
/usr/local/cern/root/lib/libCint.so
 0xb77ddfeb in G__exec_statement + 0x23c3 from /usr/local/cern/root/lib/libCint.so
 0xb77b01b0 in G__interpret_func + 0x1e66 from /usr/local/cern/root/lib/libCint.so
 0xb779397f in G__getfunction + 0x1a77 from /usr/local/cern/root/lib/libCint.so
 0xb778a479 in G__getitem + 0x518 from /usr/local/cern/root/lib/libCint.so
 0xb778914f in G__getexpr + 0x7264 from /usr/local/cern/root/lib/libCint.so
 0xb7781b99 in G__calc_internal + 0x29f from 
/usr/local/cern/root/lib/libCint.so
 0xb77e3dfb in G__process_cmd + 0x213b from /usr/local/cern/root/lib/libCint.so
 0xb7aed6ff in TCint::ProcessLine(char const*, TInterpreter::EErrorCode*) + 0xaf from /usr/local/cern/root/lib/libCore.so  0xb7aed80c in TCint::ProcessLineSynch(char const*, TInterpreter::EErrorCode*) + 0x46 from /usr/local/cern/root/lib/libCore.so  0xb7a421bf in TApplication::ProcessFile(char const*, int*) + 0x959 from /usr/local/cern/root/lib/libCore.so
 0xb7a417ea in TApplication::ProcessLine(char const*, bool, int*) + 0x5f8 from /usr/local/cern/root/lib/libCore.so  0xb6ebd3eb in TRint::Run(bool) + 0x21f from /usr/local/cern/root/lib/libRint.so
 0x08048d5d in main + 0x71 from /usr/local/cern/root/bin/root.exe  0x00851e23 in __libc_start_main + 0xd3 from /lib/tls/libc.so.6  0x08048c5d in TApplicationImp::ShowMembers(TMemberInspector&, char*) + 0x31 from /usr/local/cern/root/bin/root.exe

Do you have an idea ?
Thanks a lot again.
Vincent

Philippe Canal wrote:

>Hi Vincent,
>
>The ability to drill through un-split object in the TBrowser is new and *as
>you noticed) not complete yet.
>We will check into this case.
>
>In the meantime, you can still access your data simply by typing the
>corresponding draw command:
>
> mytree->Draw("theTracks.Hits.r");
>
>Note that the @size (when it works :) ) is used to draw an histogram of the
>number of elements in the collection.
>
>Cheers,
>Philippe
>
>
>________________________________
>
>From: Vincent Roberfroid [mailto:roberfroid_at_fynu.ucl.ac.be]
>Sent: Wednesday, May 18, 2005 8:19 AM
>To: Philippe Canal
>Cc: roottalk_at_pcroot.cern.ch
>Subject: Re: [ROOT] TClonesArray of Tracks with a TClonesArray of Hits as a
>data member
>
>
>Hi Philippe,
>
>Thank you for your answer.
>I used root 4.02/00.
>But it does not work with root 4.04/02.
>When I click on "theTracks.Hits" I get also the same message :
>Warning in <TSelectorDraw::ProcessFillObject>: Not implemented for
>TClonesArray
>
>I have also an new variable in the Track branch : "@size".
>But when I click on it I get the following message :
>Error in <TTreeFormula::DefinedVariable>: Unknown method:GetEntries() in
>Track
>
>*ERROR 30 :
> Bad numerical expression : "Track.GetEntries()"
>
>It is maybe related ?
>
>Vincent
>
>Philippe Canal wrote:
>
> So, how can I do to see the variables r, phi and z of a hit
>belonging to
> a Track ? The split level is good ? Is it possible to have a
>TClonesArray
>
>
> in a
>
>
> TClonesArray include in a TTree ?
>
>
>
> It is possible to have a TClonesArray within a TClonesArray.
>However they
> can not be split. To see the data member in the Browser you should
>use
> ROOT 4.04/02 (note that you forgot to mention which version of ROOT
>you
> were using).
>
> Cheers,
> Philippe.
>
> -----Original Message-----
> From: owner-roottalk_at_pcroot.cern.ch
>[mailto:owner-roottalk_at_pcroot.cern.ch]
> On Behalf Of Vincent Roberfroid
> Sent: Wednesday, May 18, 2005 4:10 AM
> To: roottalk_at_pcroot.cern.ch
> Subject: [ROOT] TClonesArray of Tracks with a TClonesArray of Hits
>as a data
> member
>
> Dear root users,
>
> I have a TTree containg a TClonesArray of Tracks (a class derivating
>
> from TObject).
> And a data member of Track is also a TClonesArray containing Hits
>(an
> other class derivating from TObject).
> So here is the structure :
>
> class Track : public TObject
> {
> public :
>
> double R; /** track parameters **/
> double phi0;
> int Nhits;
> ...
> TClonesArray *Hits; /* all the hits in a TClonesArray */
> }
> Track::Track(axial_track *atrack) /* the constructor - axial_track
>is
> just a struct*/
> {
> R=atrack->R;
> phi0=atrack->phi0;
> for(int i=0; i<Nhits;i++)
> new(Hits->operator[](i)) Hit(atrack->mvdhit[i]); /* Fill the
> TClonesArray */
> }
> //-----------------------------------
> class Hit : public TObject
> {
> public :
>
> float r; /** r-phi cluster position **/
> float phi;
> float z;
> ...
> }
>
> And in the main :
> TTree *outTTree = new TTree("outTTree","Output TTree");
> TCLonesArray *theTracks = new TClonesArray("Track",100);
> outTTree->Branch("theTracks",&theTracks,4000,2);
>
> The code runs well, the variables R, phi0 and Hits are visible in
>the
> Track branch, but when I click on Hits I get the following message :
> Warning in <TSelectorDraw::ProcessFillObject>: Not implemented for
> TClonesArray
>
> So, how can I do to see the variables r, phi and z of a hit
>belonging to
> a Track ?
> The split level is good ? Is it possible to have a TClonesArray in a
>
> TClonesArray include in a TTree ?
> And is it possible to use the TreeViewer with it ?
>
> Thanks a lot.
> Vincent
>
>
>
>
>
>
>
>
>
Received on Wed May 18 2005 - 16:10:07 MEST

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:08 MET