]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - START/AliSTARTvertex.cxx
Merging the VirtualMC branch to the main development branch (HEAD)
[u/mrichter/AliRoot.git] / START / AliSTARTvertex.cxx
index 24bab6a27829de918f25260ca195abb8ffe6117e..f7284bbe7e44cff5ce30d577ebfc931adec0b4ab 100644 (file)
  **************************************************************************/
 /*
 $Log$
+Revision 1.6.6.2  2002/07/24 09:50:10  alibrary
+Updating VirtualMC
+
+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
 
@@ -27,7 +45,7 @@ Revision 1.1  2000/03/24 17:46:58  alla
 Vertex reconstruction
 
 */ 
-#include <TObject.h>
+#include "TObject.h"
 #include "AliSTARTvertex.h"
 #include "AliSTARTdigit.h"
 #include "AliSTARThit.h"
@@ -37,6 +55,9 @@ Vertex reconstruction
 
 //#include "TTree.h"
 #include "TDirectory.h"
+#include <stdlib.h>
+#include <iostream.h>
+#include <fstream.h>
 
 ClassImp(AliSTARTvertex)
 
@@ -62,42 +83,54 @@ void AliSTARTvertex::Reconstruct(Int_t evNumber=1)
   Float_t timePs;
   char nameTD[8],nameTR[8];
 
-  TBranch *bRec=0;
-  TBranch *bd;
   AliSTARTdigit *digits;
-  AliSTARTvertex *vertex;
+  AliSTARTvertex *fvertex;
  
-  Int_t buffersize=256;
-  // TParticle *particle;
   digits = new AliSTARTdigit();
-  vertex = new AliSTARTvertex();
+  fvertex = new AliSTARTvertex();
 
  // Event ------------------------- LOOP  
    
-  sprintf(nameTD,"TreeD%d",evNumber);
+  // gAlice->GetEvent(evNumber);
+
+  sprintf(nameTD,"START_D_%d",evNumber);
+  TObject *td = (TObject*)gDirectory->Get(nameTD);
   printf("%s\n",nameTD);
-  TTree *td = (TTree*)gDirectory->Get(nameTD);
-  bd = td->GetBranch("START");
-  bd->SetAddress(&digits);
-  bd->GetEvent(0);
-  sprintf(nameTR,"TreeR%d",evNumber);
-  TTree *tr = new TTree(nameTR,"START");
-  bRec = tr->Branch("START","AliSTARTvertex",&vertex,buffersize);
-  if(digits->GetTime()!=999999)
+  
+  if (!td) {
+    cerr<<"something wrong with output...."<<endl;
+    exit(111);
+  }
+  td->Read(nameTD);
+  digits->Read(nameTD);
+  if(digits->GetTimeDiff()<TMath::Abs(1000))
     {
-      timediff=digits->GetTime();     //time in number of channels
-      timePs=(timediff-128)*10.;       // time in Ps channel_width =10ps
-      Float_t c = 299792458/1.e9;  //speed of light cm/ps
-      //Float_t c = 0.3;  //speed of light mm/ps
+      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
-      vertex->Set(Zposit);
-      tr->Fill();
-      tr->Write();
+      cout<<" Zposit "<<Zposit<<endl;
+      fvertex->Set((Int_t) Zposit);
       }
-
+     /*
+        TTree *outTreeR = gAlice->TreeR();
+    if (!outTreeR) {
+      cerr<<"something wrong with output...."<<endl;
+      exit(111);
+    }
+    */
+  sprintf(nameTR,"START_R_%d",evNumber);
+  printf("%s\n",nameTR);
+  //  TDirectory *wd = gDirectory;
+  //  outTreeR->GetDirectory()->cd();
+    fvertex->Write(nameTR);
+    //  wd->cd();
 }
 
 
 
 
+
+