]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - START/AliSTARTvertex.cxx
batch mode for monitor process
[u/mrichter/AliRoot.git] / START / AliSTARTvertex.cxx
index 3c7d1b807140a48ff759c94495e83464e8c6191f..e726d0074cdb6b36e3141527e4ed46cae871be7d 100644 (file)
  * about the suitability of this software for any purpose. It is          *
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
-/*
-$Log$
-Revision 1.10  2002/10/14 14:57:32  hristov
-Merging the VirtualMC branch to the main development branch (HEAD)
 
-Revision 1.6.6.2  2002/07/24 09:50:10  alibrary
-Updating VirtualMC
+/* $Id$ */
 
-Revision 1.9  2002/07/23 11:48:05  alla
-new Digits structure
-
-Revision 1.8  2002/04/16 10:52:41  hristov
-Wrong usage of exit() corrected (Sun)
-
-Revision 1.7  2002/04/15 08:04:01  alla
-Digits and reconstruction with TObject
-
-Revision 1.6  2001/10/19 05:29:38  alla
-bug in meduim fixed
-
-Revision 1.5  2001/07/27 13:03:12  hristov
-Default Branch split level set to 99
-
-Revision 1.4  2000/12/22 16:17:15  hristov
-Updated  START code from Alla
-
-Revision 1.3  2000/10/02 21:28:13  fca
-Removal of useless dependecies via forward declarations
-Revision 1.2  2000/07/13 16:41:29  fca
-New START corrected for coding conventions
+#include <Riostream.h>
+#include <stdlib.h>
 
-Revision 1.1  2000/03/24 17:46:58  alla
-Vertex reconstruction
+#include <TDirectory.h>
+#include <TVirtualMC.h>
 
-*/ 
-#include "TObject.h"
-#include "AliSTARTvertex.h"
+#include "AliRun.h"
+#include "AliSTART.h"
 #include "AliSTARTdigit.h"
 #include "AliSTARThit.h"
-#include "AliSTART.h"
-#include "AliRun.h"
-#include "AliMC.h"
-
-//#include "TTree.h"
-#include "TDirectory.h"
-#include <stdlib.h>
-#include <Riostream.h>
-#include <Riostream.h>
+#include "AliSTARTvertex.h"
 
 ClassImp(AliSTARTvertex)
 
@@ -76,7 +41,7 @@ AliSTARTvertex::AliSTARTvertex( Int_t * Zposit)
   Zposit = &fZposition ;
 }
 
-void AliSTARTvertex::Reconstruct(Int_t evNumber=1
+void AliSTARTvertex::Reconstruct() 
 {
   /***************************************************
   Resonstruct digits to vertex position
@@ -85,7 +50,26 @@ void AliSTARTvertex::Reconstruct(Int_t evNumber=1)
   Int_t timediff;
   Float_t timePs;
   char nameTD[8],nameTR[8];
+ char filename[100];
+  sprintf(filename,"galice.root");
+  AliRunLoader* rl = AliRunLoader::Open("galice.root",AliConfig::fgkDefaultEventFolderName,"read");
+  if (rl == 0x0)
+   {
+     cerr<<"Can not open session for file galice.root\n";
+     return;
+   }
+
+  rl->LoadgAlice();
+  gAlice = rl->GetAliRun();
+  
+  //  AliSTART* START  = (AliSTART *)gAlice->GetDetector("START");
+  
+  rl->LoadHeader();
+  rl->LoadKinematics("READ");
 
+  AliLoader* lstart = rl->GetLoader("STARTLoader");
+  lstart->LoadDigits("READ");
   AliSTARTdigit *digits;
   AliSTARTvertex *fvertex;
  
@@ -95,41 +79,42 @@ void AliSTARTvertex::Reconstruct(Int_t evNumber=1)
  // Event ------------------------- LOOP  
    
   // gAlice->GetEvent(evNumber);
-
-  sprintf(nameTD,"START_D_%d",evNumber);
-  TObject *td = (TObject*)gDirectory->Get(nameTD);
-  printf("%s\n",nameTD);
+  Int_t iNevents=rl->GetNumberOfEvents();
+  cout<<"  nevents   "<<iNevents<<endl;
   
-  if (!td) {
-    cerr<<"something wrong with output...."<<endl;
-    exit(111);
-  }
-  td->Read(nameTD);
-  digits->Read(nameTD);
-  if(digits->GetTimeDiff()<TMath::Abs(1000))
-    {
-      timediff=digits->GetTimeDiff();     //time in number of channels
-      timePs=(512-timediff)*2.5;       // time in Ps channel_width =10ps
-      cout<<"timediff "<< timediff<<" timePs "<<timePs<<endl;
-      // Float_t c = 299792458/1.e9;  //speed of light cm/ps
-      Float_t c = 0.3;  //speed of light mm/ps
-      Float_t Zposit=timePs*c;// for 0 vertex
-      cout<<" Zposit "<<Zposit<<endl;
-      fvertex->Set((Int_t) Zposit);
-      }
-     /*
-        TTree *outTreeR = gAlice->TreeR();
-    if (!outTreeR) {
-      cerr<<"something wrong with output...."<<endl;
+  for (Int_t evNumber=0; evNumber<iNevents; evNumber++){
+    rl->GetEvent(evNumber);
+    lstart->LoadDigits("READ");
+    gDirectory->ls();
+
+    sprintf(nameTD,"START_D_%d",evNumber);
+    TObject *td = (TObject*)gDirectory->Get(nameTD);
+    printf("%s\n",nameTD);
+    //   td->Dump();
+    if (!td) {
+      cerr<<"something wrong with input...."<<endl;
       exit(111);
     }
-    */
-  sprintf(nameTR,"START_R_%d",evNumber);
-  printf("%s\n",nameTR);
-  //  TDirectory *wd = gDirectory;
-  //  outTreeR->GetDirectory()->cd();
+    td->Read(nameTD);
+    digits->Read(nameTD);
+    if(digits->GetTimeDiff()<TMath::Abs(1000))
+      {
+       timediff=digits->GetTimeDiff();     //time in number of channels
+       timePs=(512-timediff)*2.5;       // time in Ps channel_width =10ps
+       cout<<"timediff "<< timediff<<" timePs "<<timePs<<endl;
+       // Float_t c = 299792458/1.e9;  //speed of light cm/ps
+       Float_t c = 0.3;  //speed of light mm/ps
+       Float_t Zposit=timePs*c;// for 0 vertex
+       cout<<" Zposit "<<Zposit<<endl;
+       fvertex->Set((Int_t) Zposit);
+      }
+    lstart->LoadRecPoints("UPDATE");
+    sprintf(nameTR,"START_R_%d",evNumber);
+    printf("%s\n",nameTR);
     fvertex->Write(nameTR);
-    //  wd->cd();
+
+
+  }
 }