Re: TChain & Symbol chain is not defined in current scope

From: Edmond Offermann <edmondoffermann_at_yahoo.com>
Date: Tue, 16 Jan 2007 19:32:45 -0800 (PST)


Hi Nevzat,

Change TChain chain('T") to TChain *chain = new TChain("T");

Eddy

>
> Hello,
> I wrote the short program below to chain many root files together.
> In the root session I link the program:
> root [25] .L myChain.C
>
> Then I run the program as:
> root [26] myChain(28074, 28080);
>
> it does not complain about anything. So i assume it chained all the
> root
> files in the list.
> Then I try to draw saomething from the chain by saying:
> root [27] chain.Draw("IPLOTS.ECT_el:IPLOTS.ECin_el >> h2","","colz");
>
> it says:
> Error: Symbol chain is not defined in current scope (tmpfile):1:
> Error: Failed to evaluate chain.Draw("IPLOTS.ECT_el:IPLOTS.ECin_el >>
> h2","","colz")Possible candidates are...
> filename line:size busy function type and name
> *** Interpreter error recovered ***
>
> Program myChain.C is printed below:
>
> P.S. In this program I also tried to pass root file name quoted as
> "28074.root" by creating the file name accordingly. But it also did
> not
> work. I concluded it is not issue with " sign. In the version below I
> dont
> have " sign attached to the ends of root file name..
>
> Thank you very much with your inputs..
>
> Nevzat Guler
>
> #include <stdlib.h>
> #include <vector>
> #include <iostream>
> #include <fstream>
> #include <stdio.h>
> #include <stdarg.h>
> #include <string.h>
> #include "TCanvas.h"
> #include "TVirtualPad.h"
> #include "TPostScript.h"
> #include "TLegend.h"
> #include "TChain.h"
> using namespace std;
> #include "/u/home/nguler/inc/utils.h"
>
> void myChain(int minrun, int maxrun)
> {
>
>
> TChain chain("T");
> for (int run=minrun; run<=maxrun; run++)
> {
>
> string filepathName = "/p/clas-disk1/nevzat/trees/group/";
> string runstring;
> runstring = IntToString( run );
> string file(runstring);
> file.append(".root");
>
> filepathName.append(file);
> int fileExist = 0;
> fileExist = pathExists( filepathName.c_str() );
>
> if ( fileExist == 1 )
> {
> cout << "Adding " << file << endl;
> chain.Add( file.c_str() );
> }
>
> }
>
> }
>
>
>
Received on Wed Jan 17 2007 - 04:32:55 CET

This archive was generated by hypermail 2.2.0 : Wed Jan 17 2007 - 05:50:00 CET