Hi Brett and thanks for your suggestion!
I'm really not familiar with C unfortunately and tried implementing your
suggestion without success... =(. I do need something similar to this, i.e.
be able to call different filenames. To be more specific:
I have a bash-script with a loop ( in this case 40 loops, as many as the
number of root files I have).
Each loop I run:
cd folder$j
root -q -b myScript1.C myScript2.C
cd ..
done
while(afile = gSystem->GetDirEntry(dirp)) {
if (strstr(afile,".root")) {
TChain chain("finalDelayedCoinci");
sprintf(Root_File,"%s",afile); chain.Add(Root_File); printf("\n Processing file %s...\n",afile); nfiles++; }
cd folder$j
root -q -b myScript1.C("rootFile_$j") myScript2.C
cd ..
done
Cheers,
Ida
Den 6 april 2010 19.56 skrev Brett Viren <bv_at_bnl.gov>:
> Ida Häggström <ida.haggstrom_at_radfys.umu.se> writes:
>
> > I want to
> > create a bash-script to run from my Linux teminal that calls for ROOT and
> > executes the C-scripts and so on...
>
> One more feature to consider is that you can pass arguments from the
> shell into your C-scripts. You just have to be a little careful to make
> sure that any special characters are escaped so the shell won't
> interpret them.
>
> For example,
>
> shell> cat myscript.C
> void myscript(const char* filename) {
> TFile* f = new TFile(filename);
> //...
> }
>
> You can pass in the file name like:
>
> shell> root -q myscript.C\(\"file1.root\"\)
>
> or wrap the whole thing in single-quotes like:
>
> shell> root -q 'myscript.C("file1.root")'
>
>
> -Brett.
>
>
>
Received on Wed Apr 07 2010 - 08:47:39 CEST
This archive was generated by hypermail 2.2.0 : Wed Apr 07 2010 - 17:50:02 CEST