Symbol ___ is not defined in current scope

I have a piece of code that adds a new branch to a root file. It has worked before, but now ROOT is giving an absolutely bizarre error message - there must be something else it doesn’t like.

When I run the code shown below I get this output:

> root -l addFisherValue.C root [0] Processing addFisherValue.C... Opened ./QCD20_gaultney.root, adding new branch Error: Symbol newBranch is not defined in current scope addFisherValue.C:77: Error: Failed to evaluate newBranch->Fill() *** Interpreter error recovered *** root [1]

This is the code, and you’ll notice that “newBranch” is defined several lines above where “newBranch->Fill()” is called.

Why does ROOT think “newBranch” is not defined??

[code]#include
#include

void addFisherValue() {
//************************************************************
// Variables //
vector fileName;
fileName.push_back( “PhotonJetPt15_Summer09_1stHalf.root” );

TString treeName = “TreePhotonJet”;

// Variables in the TTree used to determine new value
vector variableNames;
variableNames.push_back( “photon_ecalRecHitSumEtConeDR03” );
variableNames.push_back( “photon_hcalTowerSumEtConeDR03” );
variableNames.push_back( “photon_trkSumPtHollowConeDR03” );
variableNames.push_back( “photon_hadronicOverEm” );
variableNames.push_back( “photon_r2x5” );

vector coeff;
coeff.push_back( -1.0799E0 );
coeff.push_back( -1.1344E-1 );
coeff.push_back( -5.0319E-2 );
coeff.push_back( -1.0400E-1 );
coeff.push_back( -2.6775E0 );
coeff.push_back( 1.5899E0 );
// END of Variables //
//************************************************************

// Loop over all the Files
for (int i=0; i < fileName.size(); i++) {
TFile* currentFile = new TFile(fileName[i],“update”);

cout << "Opened " << fileName[i] << ", adding new branch" << endl;

TTree *tree = (TTree*)currentFile->Get(treeName);

// Loop over all the entries, and add the new branch
vector<float> var;
for (int i=0;i<variableNames.size();i++) {
  var.push_back(0.0);
  tree->SetBranchAddress(variableNames[i], &var[i]);
}
float fishValue;
TBranch *newBranch = tree->Branch("fishValue", &fishValue,"fishValue/F");

Int_t numEntries = (Int_t)tree->GetEntries();
for (Int_t j=0; j<numEntries; j++) {
  // Push values from TTree into "var" vector
  tree->GetEntry(j);
  // Calculate fisher value
  fishValue=coeff[0]+coeff[1]*var[0]+coeff[2]*var[1]+coeff[3]*var[2]+coeff[4]*var[3]+coeff[5]*var[4];
  newBranch->Fill();
}
tree->Write("",TObject::kOverwrite); // save new version only
currentFile->Close();
cout << "...closed file." << endl;

}
}[/code]

After highlighting the above code, copying, and then pasting into a new text file, the bizarre ROOT error disappears - it doesn’t complain anymore!

My only theory is that somehow the macro became corrupted and had a non-printing character in there that was messing up ROOT’s interpretation of the code.

Has anyone else had a weird experience like this?