Error in <TFile::WriteTObject>: Directory rdtCuts.root is not writable


Please fill also the fields below. Note that root -b -q will tell you this info, and starting from 6.28/06 upwards, you can call .forum bug from the ROOT prompt to pre-populate a topic.

ROOT Version: 6.26/10
Platform:
Compiler: Not Provided


I got this error when I ran this step

  TFile * fileCut = new  TFile("rdtCuts.root");
   
   TObjArray * cutList = NULL;
   isRDTCutExist = false;
   if( fileCut->IsOpen() ){
      TObjArray * cutList = (TObjArray*) fileCut->FindObjectAny("cutList");
      if( cutList != NULL){
         isRDTCutExist = true;
         const int numCut = cutList->GetEntries();
         cut = new TCutG * [numCut];
         printf("=========== found %d cuts in %s \n", numCut, fileCut->GetName());
         for( int i = 0 ; i < numCut; i++){
            cut[i] = (TCutG* ) cutList->At(i);
            printf("cut name: %s , VarX: %s, VarY: %s\n", cut[i]->GetName(), cut[i]->GetVarX(), cut[i]->GetVarY()); 
         }
      }
    cutList->Write("rdtCutList");
   }

It gives the following error

=========== found 4 cuts in rdtCuts.root 
cut name: cut0 , VarX: rdt[0], VarY: rdt[1]
cut name: cut1 , VarX: rdt[2], VarY: rdt[3]
cut name: cut2 , VarX: rdt[4], VarY: rdt[5]
cut name: cut3 , VarX: rdt[6], VarY: rdt[7]
Error in <TFile::WriteTObject>: Directory rdtCuts.root is not writable
Error in <TFile::WriteTObject>: Directory rdtCuts.root is not writable
Error in <TFile::WriteTObject>: Directory rdtCuts.root is not writable
Error in <TFile::WriteTObject>: Directory rdtCuts.root is not writable

Whatever I change the code to look like this
TFile * fileCut = new TFile("rdtCuts.root","recreate");
or this
TFile * fileCut = new TFile("rdtCuts.root","new");

It doesn’t work. What should I do?

"UPDATE"

Thank you so much. It does work.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.