]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MONITOR/deroot.cxx
adding production request
[u/mrichter/AliRoot.git] / MONITOR / deroot.cxx
index 2d798a5ef04543cbb59ef6edb4d8dd208fa7e3cf..f0835a0ea545ec88d69062a0d466c2fa12af4ff1 100644 (file)
@@ -7,19 +7,29 @@
 #include <TError.h>
 #include <TSystem.h>
 #include <TSysEvtHandler.h>
+#include <TGrid.h>
 #include "deroot.h"
 
 int deroot(const char *rootFileName, const char *dateFileName, const char *ddlFilesFolder);
 
 int deroot(const char *rootFileName, const char *dateFileName, const char *ddlFilesFolder) {
 
- TFile rootFile(rootFileName);
- TTree *t=(TTree *)rootFile.Get("RAW");
+ TString str = rootFileName;
+ if (str.BeginsWith("alien://"))
+   TGrid::Connect("alien://");
+
+ TFile *rootFile = TFile::Open(rootFileName,"READ");
+ if (!rootFile) {
+   cerr << "Raw data file can not be opened" << endl;
+   return(1);
+ }
+
+ TTree *t=(TTree *)rootFile->Get("RAW");
  if(!t) {
   cerr << "Error getting RAW tree" << endl;
   return(1);
  }
- AliRawEvent *rootEvent=NULL;
+ AliRawVEvent *rootEvent=NULL;
  
  t->SetBranchAddress("rawevent", &rootEvent);
 
@@ -31,8 +41,8 @@ int deroot(const char *rootFileName, const char *dateFileName, const char *ddlFi
  
  UInt_t eventSize = 10000000; // 10MB by default
  unsigned char *dateEvent = new unsigned char[eventSize];
- for(size_t gdcCounter=0; gdcCounter<t->GetEntries(); gdcCounter++) {
-  rootEvent=new AliRawEvent;
+ for(Long_t gdcCounter=0; gdcCounter<t->GetEntries(); gdcCounter++) {
+  rootEvent=NULL;
   t->GetEntry(gdcCounter);
   if (rootEvent->GetHeader()->GetEventSize() > eventSize) {
     delete [] dateEvent;
@@ -65,7 +75,7 @@ int deroot(const char *rootFileName, const char *dateFileName, const char *ddlFi
  cerr << "\r     \r";
  cerr.flush();
  delete t;
- rootFile.Close();
+ rootFile->Close();
  fclose(dateFile);
  delete [] dateEvent;