Issues accessing array from tree

First an apology for asking about this (probably fairly trivial) issue, I’ve spent the last 2 days chipping away at this, but having reached the point where the macro executes without any errors but gives wildly unexpected values I thought I’d ask for help.
Anyway, my code reads in threshold scan data for many pixels on an ITS chip, and stores it in a tree containing integers (row, column, chipID, Npoints, etc…), floats (threshold, response) and integer arrays (for pulse height (going from 100->000), and hits (the corresponding pixel response to a pulse of size pulseheight). As far as I can tell, this works fine (TTree::Print() displays the correct number of entries and sensible looking data sizes etc…).
My problems occur when trying to read the “PlsH” and “Hits” arrays from this tree, such that these data can be used in a fitting process in order to extract the pixel’s threshold (and then fill that respective branch), I have used a (what seems to be from my research) a fairly standard means: create new TBranch objects and then use tree->GetBranch() with these to read the arrays into ‘intermediate’ arrays. When I print these arrays in a loop, however, I get values which are neither my data or hex memory addresses.
Full macro code:

#include <fstream>
#include <iostream>
#include "TFile.h"
#include "TTree.h"
#if defined(__CINT__) && !defined(__MAKECINT__)
#include "..\test\libEvent.so"
#else
#include "..\test\Event.h"
#endif

//setup data structure
void ReadScanFile(){
	//declare data type variables
	Int_t 	ScanPoints = 100;
	const Int_t	Npoints=101;
	Int_t	ChipID;
	Int_t 	Row;
	Int_t 	Col;
	Int_t	PlsH[Npoints];
	Int_t	Hits[Npoints];
	Float_t	Threshold;
	Float_t	Response;
	
	//instatiate TFile and TTree
	TFile* f = new TFile("thresholdscan.root", "RECREATE","ROOT file for all pixels in pALPIDE-3 threshold scan");
	TTree* tree = new TTree("chip","");
	
	//initialise branches
	tree->Branch("Npoints",&Npoints,"Npoints/I");
	tree->Branch("ChipID",&ChipID,"ChipID/I");
	tree->Branch("Row",&Row,"Row/I");
	tree->Branch("Col",&Col,"Col/I");
	tree->Branch("ChipID",&ChipID,"ChipID/I");
	tree->Branch("PlsH",PlsH,"PlsH[Npoints]/I");
	tree->Branch("Hits",Hits,"Hits[Npoints]/I");
	tree->Branch("Threshold",&Threshold,"Threshold/F");
	tree->Branch("Response",&Response,"Response/F");
		
	//reading reference variables
	int linecount=1; //must be 1 so file splits correctly
	int arrayindex=0;
	
	//open .dat file in filestream
    ifstream file;
    file.open("testshort.txt"); 
    if (file.is_open())
      {
        // Body info.
        while (file.good()) // read the file until its end.
          {
            string line0;		  
            getline (file,line0);
            char * cstr, * p;
            cstr = new char [line0.size()+1];
            strcpy (cstr, line0.c_str());

			//split line by spaces and assign to variables
			p=strtok (cstr," ");
            if(p==NULL)break;
            PlsH[arrayindex] = atoi(p);
            p=strtok (NULL," ");
            Hits[arrayindex] = atoi(p);
            p=strtok (NULL," ");
            ChipID = atoi(p);
            p=strtok (NULL," ");
            Row = atoi(p);
		    p=strtok (NULL," ");
            Col = atoi(p);
			
			arrayindex++;
			//write and split to next pixel if line is multiple of 101
			if (linecount%101==0){
				tree->Fill();	//plsH,hits,chipID,row,col
				cout	<< "pixel " << linecount/101 <<" ends at line: "<<linecount  << endl;				
				arrayindex=0; //reset arrayindex (start filling new entry)
			}
		 linecount++;			
        }
		
	  file.close();
	  tree->Print();
	  Int_t entries = tree->GetEntries();
	  cout<<entries<<" entries in tree"<<endl;
	  
//extract arrays from tree for fitting
	  Int_t *hit[Npoints] ,*pls [Npoints] ;//= new Int_t [101];
	  TBranch *Thit=tree->GetBranch("Hits");
	  TBranch *Tpls=tree->GetBranch("PlsH");
	  
	  Thit->SetAddress(hit); //is & pointer needed here
	  Tpls->SetAddress(pls); //for array access from tree
							 //(seems to crash root w/ &)
	  pls = Tpls->GetEntry(8); //fill intermediate arrays 
	  hit = Thit->GetEntry(8); //with data for pixel 8
	  
	  //read 
	  for(int j=0;j<=100;j++){
		  int x=Tpls[j];
		  int y=Thit[j];
		  
		cout<< x <<" "<< y<<" " <<endl;
	  }
    }
}

data file for 10 pixels:
testshort.txt (13.1 KB)

Again apologies if my mistakes/ignorance are painfully obvious, my computer science knowlegde is fairly limited, and my only experience with c++ is learning root!
Many thanks in advance.

I guess your macro “works” because you run it with ROOT 5 in interpreted mode:

root[0]  .x ReadScanFile.C

It “works” for me that way also … but as soon as I run it in compile mode or with ROOT 6 (which has a real C++ interpreter) I get plenty of C++ mistakes which might well explain the problem you encounter. I would suggest you try in compile mode, by adding “++” after your macro file name when you execute it.

root[0]  .x ReadScanFile.C++

Hi, my macro is a .cpp file. running as

C:\ROOTthings>root .x ReadScanFile.cpp++

yeilds ACLiC errors

root [0]
Processing ReadScanFile.cpp++...
Info in <TWinNTSystem::ACLiC>: creating shared library C:\ROOTthings\ReadScanFil
e_cpp.dll
'cl.exe' is not recognized as an internal or external command,
operable program or batch file.
Error: external preprocessing failed. (0)
!!!Removing C:\ROOTthings\ReadScanFile_cpp_ACLiC_dict.cxx C:\ROOTthings\ReadScan
File_cpp_ACLiC_dict.h !!!
Error: C:\root_v5.34.36\bin\rootcint: error loading headers...
Error in <ACLiC>: Dictionary generation failed!
Info in <ACLiC>: Invoking compiler to check macro's validity
Error: Function ReadScanFile() is not defined in current scope  (0)
*** Interpreter error recovered ***
root [1]

I am running root on windows, so am unable to try the ROOT 6 options.

When I run your macro in compile mode using ROOT 5, I get:

$ root ReadScanFile.C++
  *******************************************
  *                                         *
  *        W E L C O M E  to  R O O T       *
  *                                         *
  *   Version   5.34/37      6 April 2016   *
  *                                         *
  *  You are welcome to visit our Web site  *
  *          http://root.cern.ch            *
  *                                         *
  *******************************************

ROOT 5.34/37 (heads/v5-34-00-patches@v5-34-36-1-g4008982, Mar 17 2017, 11:33:00 on macosx64)

CINT/ROOT C/C++ Interpreter version 5.18.00, July 2, 2010
Type ? for help. Commands must be C++ statements.
Enclose multiple statements between { }.
root [0] 
Processing ReadScanFile.C++...
Info in <TMacOSXSystem::ACLiC>: creating shared library /Users/couet/Downloads/./ReadScanFile_C.so
In file included from /Users/couet/Downloads/ReadScanFile_C_ACLiC_dict.cxx:17:
In file included from /Users/couet/Downloads/ReadScanFile_C_ACLiC_dict.h:34:
/Users/couet/Downloads/./ReadScanFile.C:24:8: error: no matching member function
      for call to 'Branch'
        tree->Branch("Npoints",&Npoints,"Npoints/I");
        ~~~~~~^~~~~~
/Users/couet/git/root534-cocoa-bin/include/TTree.h:305:20: note: candidate
      function not viable: no known conversion from 'const Int_t *'
      (aka 'const int *') to 'Long_t' (aka 'long') for 2nd argument; remove &
   TBranch        *Branch(const char* name, Long_t address, const char* ...
                   ^
/Users/couet/git/root534-cocoa-bin/include/TTree.h:310:20: note: candidate
      function not viable: no known conversion from 'const Int_t *'
      (aka 'const int *') to 'int' for 2nd argument; remove &
   TBranch        *Branch(const char* name, int address, const char* lea...
                   ^
/Users/couet/git/root534-cocoa-bin/include/TTree.h:299:28: note: candidate
      function not viable: no known conversion from 'const Int_t *'
      (aka 'const int *') to 'void *' for 2nd argument
   virtual TBranch        *Branch(const char* name, void* address, cons...
                           ^
/Users/couet/git/root534-cocoa-bin/include/TTree.h:300:28: note: candidate
      function not viable: no known conversion from 'const Int_t *'
      (aka 'const int *') to 'char *' for 2nd argument
           TBranch        *Branch(const char* name, char* address, cons...
                           ^
/Users/couet/git/root534-cocoa-bin/include/TTree.h:318:32: note: candidate
      function [with T = const char] not viable: no known conversion from
      'const Int_t *' (aka 'const int *') to 'const char *' for 2nd argument
   template <class T> TBranch *Branch(const char* name, const char* clas...
                               ^
/Users/couet/git/root534-cocoa-bin/include/TTree.h:333:32: note: candidate
      function [with T = const int] not viable: no known conversion from
      'const char [10]' to 'Int_t' (aka 'int') for 3rd argument
   template <class T> TBranch *Branch(const char* name, T* obj, Int_t bu...
                               ^
/Users/couet/git/root534-cocoa-bin/include/TTree.h:298:28: note: candidate
      function not viable: no known conversion from 'const Int_t *'
      (aka 'const int *') to 'Int_t' (aka 'int') for 2nd argument; remove &
   virtual Int_t           Branch(const char* folder, Int_t bufsize = 32...
                           ^
/Users/couet/git/root534-cocoa-bin/include/TTree.h:316:28: note: candidate
      function not viable: no known conversion from 'const Int_t *'
      (aka 'const int *') to 'const char *' for 2nd argument
   virtual TBranch        *Branch(const char* name, const char* classnam...
                           ^
/Users/couet/git/root534-cocoa-bin/include/TTree.h:296:28: note: candidate
      function not viable: no known conversion from 'const char [8]' to
      'TCollection *' for 1st argument
   virtual Int_t           Branch(TCollection* list, Int_t bufsize = 320...
                           ^
/Users/couet/git/root534-cocoa-bin/include/TTree.h:297:28: note: candidate
      function not viable: no known conversion from 'const char [8]' to
      'TList *' for 1st argument
   virtual Int_t           Branch(TList* list, Int_t bufsize = 32000, In...
                           ^
/Users/couet/git/root534-cocoa-bin/include/TTree.h:323:32: note: candidate
      template ignored: could not match 'type-parameter-0-0 *' against
      'const char'
   template <class T> TBranch *Branch(const char* name, const char* clas...
                               ^
/Users/couet/git/root534-cocoa-bin/include/TTree.h:328:32: note: candidate
      template ignored: could not match 'type-parameter-0-0 *' against
      'const int'
   template <class T> TBranch *Branch(const char* name, T** addobj, Int_...
                               ^
In file included from /Users/couet/Downloads/ReadScanFile_C_ACLiC_dict.cxx:17:
In file included from /Users/couet/Downloads/ReadScanFile_C_ACLiC_dict.h:34:
/Users/couet/Downloads/./ReadScanFile.C:88:8: error: array type 'Int_t *[101]'
      is not assignable
          pls = Tpls->GetEntry(8); //fill intermediate arrays
          ~~~ ^
/Users/couet/Downloads/./ReadScanFile.C:89:8: error: array type 'Int_t *[101]'
      is not assignable
          hit = Thit->GetEntry(8); //with data for pixel 8
          ~~~ ^
/Users/couet/Downloads/./ReadScanFile.C:93:9: error: no viable conversion from
      'TBranch' to 'int'
                  int x=Tpls[j];
                      ^ ~~~~~~~
/Users/couet/Downloads/./ReadScanFile.C:94:9: error: no viable conversion from
      'TBranch' to 'int'
                  int y=Thit[j];
                      ^ ~~~~~~~
5 errors generated.
clang: error: no such file or directory: '/Users/couet/Downloads/ReadScanFile_C_ACLiC_dict.o'
Error in <ACLiC>: Compilation failed!
Error: Function ReadScanFile() is not defined in current scope  :0:
*** Interpreter error recovered ***
root [1] 

First thing to fix is: Npoints cannot be const
Then you will see more errors I started fixing them but I realised you might know better than me what to do.

Hi, having fixed the Npoints const issue (and saving the macro as .c instead of .cpp) I still cannot reproduce the compliler errors you show above. Is it likely this may be due to differening operating systems/subversions of root 5? (In fact I get identical errors to the unchanged code).
Could this also be due to something not being build properly (other than my macro :stuck_out_tongue:), I’m running through binaries but have still had to build the test directory before to get some things to work.

Hi,

You must have Visual Studio (the same version than the one used to build ROOT) installed and its environment properly set.

Cheers, Bertrand.

OK thanks, downloading VS2013 now, got the right version eventually haha! Will I need to do nmake in a root directory or simply ensure VS environment knows where %ROOTSYS% is?

If you’re in a command prompt, you can call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat", or simply start a “Developer Command Prompt for VS 2013” via the main Windows’ “Start” menu…
And obviously, you also need to call "C:\wherever\root\bin\thisroot.bat" in that command prompt…

I have run thisroot.bat from the developer prompt in VS2013 and the cl.exe problem persists. With the echo switch in the bat file turned on this is my output (clueless as to whether or not this is to be expected).

C:\Program Files (x86)\Microsoft Visual Studio 12.0>cd %ROOTSYS%\bin

C:\root_v5.34.36\bin>thisroot

C:\root_v5.34.36\bin>rem Source this script to set up the ROOT build that this s
cript is part of.

C:\root_v5.34.36\bin>rem

C:\root_v5.34.36\bin>rem Author: Axel Naumann, 10/07/2007

C:\root_v5.34.36\bin>set OLDPATH=C:\root_v5.34.36\bin

C:\root_v5.34.36\bin>set THIS=thisroot

C:\root_v5.34.36\bin>set THIS=.

C:\root_v5.34.36\bin>cd /D .\..

C:\root_v5.34.36>set ROOTSYS=C:\root_v5.34.36

C:\root_v5.34.36>cd /D C:\root_v5.34.36\bin

C:\root_v5.34.36\bin>set PATH=C:\root_v5.34.36\bin;C:\Program Files (x86)\Micros
oft Visual Studio 12.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow;C:\Prog
ram Files (x86)\Microsoft SDKs\TypeScript\1.0;C:\Program Files (x86)\MSBuild\12.
0\bin;C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\;C:\Progra
m Files (x86)\Microsoft Visual Studio 12.0\VC\BIN;C:\Program Files (x86)\Microso
ft Visual Studio 12.0\Common7\Tools;C:\WINDOWS\Microsoft.NET\Framework\v4.0.3031
9;C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\VCPackages;C:\Program F
iles (x86)\Microsoft Visual Studio 12.0\Team Tools\Performance Tools;C:\Program
Files (x86)\Windows Kits\8.1\bin\x86;C:\Program Files (x86)\Microsoft SDKs\Windo
ws\v8.1A\bin\NETFX 4.5.1 Tools\;C:\ProgramData\Oracle\Java\javapath;C:\Program F
iles (x86)\AMD APP\bin\x86_64;C:\Program Files (x86)\AMD APP\bin\x86;C:\Program
Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\WINDOWS\sy
stem32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell
\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Progr
am Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\
Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Int
el(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\OpenCL SDK\2
.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;C:\Program Files
(x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\Condusiv Technologie
s\IntelliMemory\;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files (x8
6)\QuickTime\QTSystem\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common
Files\Intel\WirelessCommon\;C:\Program Files\MiKTeX 2.9\miktex\bin\x64\;C:\Progr
am Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Program Files\Mic
rosoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SDKs\TypeScri
pt\1.0\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Users\Eris\AppD
ata.meteor\;C:\root_v5.34.36\bin;C:\root_v5.34.36\lib;C:\root_v5.34.36\test

C:\root_v5.34.36\bin>set OLDPATH=

C:\root_v5.34.36\bin>set THIS=

C:\root_v5.34.36\bin>

thisroot.bat is unchanged from default besides switching to @echo on in the first line

OK, but I don’t understand what you try to do. Please try the following:

  • Open a “Developer Command Prompt for VS 2013”
  • cd C:\ROOTthings
  • C:\root_v5.34.36\bin\thisroot.bat
    And now you can start to use ROOT
    You have to do this every time you want to use ROOT and ACLiC, because the environment variables set with thisroot.bat and vcvarsall.bat are local to the current command prompt.

I think I’m the one with the lack of understanding :wink:. I tried the comands character for character in the VS13 cmd window, and it seems thisroot is doing everything it should, but the problem persists (root was also launched from this prompt in the ROOTthings folder).
I don’t explicitly require the use of ACLiC (high speed is not a crucial factor in this script), was just using it to diagnose why my interpereted macro isn’t working properly as per couet’s recommendation.
EDIT: I can find cl.exe in the visual studio install, is there a way to manually include it? Is the batch file/ACLiC getting confused by multiple versions of VS being installed on my system?
EDIT 2: Looking at the output from the batch file it seems like \Visual Studio 12.0\VC\bin is seen as a path, could it be the presence of spaces in this path that is messing with things (I know root usually gets quite funny with spaces in paths)

The problem is that your original macro is full of C++ errors which are not diagnosed by the C++ interpreter CINT. Only a real compiler will show them. For instance that const issue can be seen immediately using Aclic .

This “const error” is one thing but there is many more . I think it is better for you to have the right tool so you can check properly your code.

In principle if you follow the instructions Bertrand gave you will be able to run with Aclic and see the same kind of errors I sent you earlier.

I am not surprised by my menagerie of c++ errors haha, yeah I understand, compiler errors do seem a lot more useful than standard CINT errors! I am really unsure why Bertrand’s solution to this does not seem to work, especially given the promising output of running the batch file. I’m starting to think I’ve not sacrificed enough goats to bill gates…

I really don’t understand. Could you show exactly what you do and how it fails?

In the VS2013 Developer Command Prompt I use those two commands you show above to run thisroot in my ROOTthings folder. This gives the output:

C:\ROOTthings>cd C:\ROOTthings

C:\ROOTthings>C:\root_v5.34.36\bin\thisroot.bat

C:\ROOTthings>rem Source this script to set up the ROOT build that this script i
s part of.

C:\ROOTthings>rem

C:\ROOTthings>rem Author: Axel Naumann, 10/07/2007

C:\ROOTthings>set OLDPATH=C:\ROOTthings

C:\ROOTthings>set THIS=C:\root_v5.34.36\bin\thisroot.bat

C:\ROOTthings>set THIS=C:\root_v5.34.36\bin\.

C:\ROOTthings>cd /D C:\root_v5.34.36\bin\.\..

C:\root_v5.34.36>set ROOTSYS=C:\root_v5.34.36

C:\root_v5.34.36>cd /D C:\ROOTthings

C:\ROOTthings>set PATH=C:\root_v5.34.36\bin;C:\root_v5.34.36\bin;C:\root_v5.34.3
6\bin;C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\CommonExte
nsions\Microsoft\TestWindow;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0
;C:\Program Files (x86)\MSBuild\12.0\bin;C:\Program Files (x86)\Microsoft Visual
 Studio 12.0\Common7\IDE\;C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC
\BIN;C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools;C:\WINDOW
S\Microsoft.NET\Framework\v4.0.30319;C:\Program Files (x86)\Microsoft Visual Stu
dio 12.0\VC\VCPackages;C:\Program Files (x86)\Microsoft Visual Studio 12.0\Team
Tools\Performance Tools;C:\Program Files (x86)\Windows Kits\8.1\bin\x86;C:\Progr
am Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\;C:\ProgramDat
a\Oracle\Java\javapath;C:\Program Files (x86)\AMD APP\bin\x86_64;C:\Program File
s (x86)\AMD APP\bin\x86;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Fil
es\Intel\iCLS Client\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:
\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Manage
ment Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Com
ponents\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\D
AL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Pro
gram Files (x86)\Intel\OpenCL SDK\2.0\bin\x86;C:\Program Files (x86)\Intel\OpenC
L SDK\2.0\bin\x64;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:
\Program Files\Condusiv Technologies\IntelliMemory\;C:\Program Files (x86)\Windo
ws Live\Shared;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files\Intel
\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files\
MiKTeX 2.9\miktex\bin\x64\;C:\Program Files (x86)\Windows Kits\10\Windows Perfor
mance Toolkit\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program
Files (x86)\Microsoft SDKs\TypeScript\1.0\;C:\Program Files\Microsoft SQL Server
\120\Tools\Binn\;C:\Users\Eris\AppData.meteor\;C:\root_v5.34.36\bin;C:\root_v5.3
4.36\lib;C:\root_v5.34.36\test

C:\ROOTthings>set OLDPATH=

C:\ROOTthings>set THIS=

C:\ROOTthings>root .x ReadScanFile.c++

In the last line I call the macro, root then opens in a new window and gives the same cl.exe error.

Then try the following:

C:\ROOTthings>root -l
root [0] .L ReadScanFile.C+
Info in <TWinNTSystem::ACLiC>: creating shared library C:\ROOTthings\ReadScanFile_C.dll
2751698_cint.cxx
ReadScanFile_C_ACLiC_dict.cxx
C:\ROOTthings\ReadScanFile.C(29) : error C2664: 'TBranch *TTree::Branch<const char>(const char *,const char *,T *,Int_t,Int_t)' : cannot convert parameter 2 from 'const Int_t *' to 'const char *'
        with
        [
            T=const char
        ]
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
C:\ROOTthings\ReadScanFile.C(93) : error C2440: '=' : cannot convert from 'Int_t' to 'Int_t *[101]'
        There are no conversions to array types, although there are conversions to references or pointers to arrays
C:\ROOTthings\ReadScanFile.C(94) : error C2440: '=' : cannot convert from 'Int_t' to 'Int_t *[101]'
        There are no conversions to array types, although there are conversions to references or pointers to arrays
C:\ROOTthings\ReadScanFile.C(98) : error C2440: 'initializing' : cannot convert from 'TBranch' to 'int'
        No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
C:\ROOTthings\ReadScanFile.C(99) : error C2440: 'initializing' : cannot convert from 'TBranch' to 'int'
        No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
Error in <ACLiC>: Compilation failed!
root [1]

And as you can see, there are several errors in your code…
And please use the original thisroot.bat

And this is weird. It should not open a new Window…

Still no luck with the -l switch, this is what my thisroot is, it this original? I don’t remember changing it.
I am going to try and debug on my university’s SL6 systems hopefully they should have ACLiC working fine!

@echo off
rem Source this script to set up the ROOT build that this script is part of.
rem
rem Author: Axel Naumann, 10/07/2007

set OLDPATH=%CD%
set THIS=%0
set THIS=%THIS:~0,-12%.
cd /D %THIS%\..
set ROOTSYS=%CD%
cd /D %OLDPATH%
set PATH=%ROOTSYS%\bin;%PATH%
set OLDPATH=
set THIS=

Ah OK, yeah I noticed how my root has done this regardless of how it’s launched in windows, behaves fine if launched in cygwin, though ACLiC still seems to have issues.

Which version of ROOT are you using exactly?

5.34/36 (surplus characters so I can post this)

Well, I mean did you build it from source? Did you download a binary? And if it is the case, which exact file did you download? And how did you install it?