]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - START/AliSTART.cxx
First attempt to have AliGeant4 compiled with the flat Makefile system. It takes...
[u/mrichter/AliRoot.git] / START / AliSTART.cxx
index 32abf0b4269ef1ae44b526e5d673b0ad2fb22e87..4d4945196999c65af6235c1db2815f549b68036f 100755 (executable)
 
 /*
 $Log$
+Revision 1.22  2001/07/27 13:03:12  hristov
+Default Branch split level set to 99
+
+Revision 1.21  2001/06/27 16:06:59  hristov
+Rotation matrix in BuildGeometry has been changed to rotx999
+
+Revision 1.20.2.1  2001/06/27 10:51:15  alla
+Rotation matrix in BuildGeometry has benn changed to rotx999
+
+Revision 1.20  2001/05/16 14:57:21  alibrary
+New files for folders and Stack
+
+Revision 1.19  2001/04/04 12:10:18  alla
+changes according Coding Convension
+
+Revision 1.18  2001/03/12 17:46:43  hristov
+Changes needed on Sun with CC 5.0
+
+Revision 1.17  2001/01/26 19:59:53  hristov
+Major upgrade of AliRoot code
+
+Revision 1.16  2001/01/17 10:56:08  hristov
+Corrections to destructors
+
+Revision 1.15  2001/01/01 13:10:42  hristov
+Local definition of digits removed
+
+Revision 1.14  2000/12/22 16:17:15  hristov
+Updated  START code from Alla
+
+Revision 1.13  2000/12/18 11:39:41  alibrary
+Quick fix to avoid crash in display waiting for new version
+
 Revision 1.12  2000/12/04 08:48:19  alibrary
 Fixing problems in the HEAD
 
@@ -74,7 +107,9 @@ Introduction of the Copyright and cvs Log
 #include "TNode.h"
 #include "TRandom.h"
 #include "TGeometry.h"
+#include "TFile.h"
 #include "TParticle.h"
+
 #include "AliRun.h"
 #include "AliSTART.h"
 #include "AliSTARTdigit.h"
@@ -92,7 +127,7 @@ AliSTART::AliSTART()
   //
   // Default constructor for class AliSTART
   //
-  fIshunt   = 0;
+  fIshunt   = 1;
   fHits     = 0;
   fDigits   = 0;
 }
@@ -110,12 +145,19 @@ AliSTART::AliSTART(const char *name, const char *title)
   // Initialise Hit array
   fHits       = new TClonesArray("AliSTARThit",  405);
   gAlice->AddHitList(fHits);
-  //  fDigits     = new TClonesArray("AliSTARTdigit",500);
   
-  fIshunt     =  0;
+  fIshunt     =  1;
   fIdSens   =  0;
   SetMarkerColor(kRed);
 }
+
+//_____________________________________________________________________________
+AliSTART::~AliSTART() {
+  if (fHits) {
+    fHits->Delete();
+    delete fHits;
+  }
+}
  
 //_____________________________________________________________________________
 void AliSTART::AddHit(Int_t track, Int_t *vol, Float_t *hits)
@@ -132,11 +174,8 @@ void AliSTART::AddHit(Int_t track, Int_t *vol, Float_t *hits)
 void AliSTART::AddDigit(Int_t *tracks,Int_t *digits)
 {
   
-  //  Add a START digit to the list
+  //  Add a START digit to the list. Dummy function.
   
-//  printf (" AddDigit*******");
-    // TClonesArray &ldigits = *fDigits;
-    // new(ldigits[fNdigits++]) AliSTARTdigit(tracks,digits);
 }
 
 //_____________________________________________________________________________
@@ -147,21 +186,21 @@ void AliSTART::BuildGeometry()
   //
   TNode *node, *top;
   const int kColorSTART  = 19;
-  //
+
   top=gAlice->GetGeometry()->GetNode("alice");
 
   // START define the different volumes
-  new TRotMatrix("rot999","rot999",  90,0,90,90,180,0);
+  new TRotMatrix("rotx999","rot999",  90,0,90,90,180,0);
 
-  new TTUBE("S_STR1","START  volume 1","void",5.,10.7,5.3);
+  new TTUBE("S_0ST1","START  volume 1","void",5.,10.7,5.3);
   top->cd();
-  node = new TNode("STR1","STR1","S_STR1",0,0,75.,"");
+  node = new TNode("0ST1","0ST01","S_0ST1",0,0,69.7,"");
   node->SetLineColor(kColorSTART);
   fNodes->Add(node);
 
-  new TTUBE("S_STR2","START volume 2","void",5.,10.7,5.3);
+  new TTUBE("S_0ST2","START volume 2","void",5.,10.7,5.3);
   top->cd();
-  node = new TNode("STR2","STR2","S_STR2",0,0,-75,"rot999");
+  node = new TNode("0ST2","0ST2","S_0ST2",0,0,-350,"rotx999");
   node->SetLineColor(kColorSTART);
   fNodes->Add(node);
 }
@@ -183,44 +222,46 @@ void AliSTART::Init()
   // Initialis the START after it has been built
   Int_t i;
   //
-  printf("\n");
-  for(i=0;i<35;i++) printf("*");
-  printf(" START_INIT ");
-  for(i=0;i<35;i++) printf("*");
-  printf("\n");
-  //
-  // Here the START initialisation code (if any!)
-  for(i=0;i<80;i++) printf("*");
-  printf("\n");
-  //
-  //
-  //  fIdSensRad=gMC->VolId("PTOP");
-  //  fIdSensPC =gMC->VolId("T0PC");
-
+  if(fDebug) {
+    printf("\n%s: ",ClassName());
+    for(i=0;i<35;i++) printf("*");
+    printf(" START_INIT ");
+    for(i=0;i<35;i++) printf("*");
+    printf("\n%s: ",ClassName());
+    //
+    // Here the START initialisation code (if any!)
+    for(i=0;i<80;i++) printf("*");
+    printf("\n");
+  }
 }
 
 //---------------------------------------------------------------------------
-void AliSTART::MakeBranch(Option_t* option)
+void AliSTART::MakeBranch(Option_t* option, const char *file)
 {
   //
   // Specific START branches
   //
-  AliSTARTdigit *digits; 
   // Create Tree branches for the START.
   Int_t buffersize = 400;
   char branchname[10];
   sprintf(branchname,"%s",GetName());
 
-  AliDetector::MakeBranch(option);
+  AliDetector::MakeBranch(option,file);
 
-  TTree *td = gAlice->TreeD();
-  digits = new AliSTARTdigit();
-  td->Branch(branchname,"AliSTARTdigit",digits, buffersize);
-  printf("Making Branch %s for digits\n",branchname);
-    
+  const char *cD = strstr(option,"D");
+  
+  if (cD) {
+    digits = new AliSTARTdigit();
+    MakeBranchInTree(gAlice->TreeD(), 
+                     branchname, "AliSTARTdigit", digits, buffersize, 1, file);
+  } 
 /*
-  gAlice->TreeR()->Branch(branchname,"Int_t",&fZposit, buffersize);
-  printf("Making Branch %s for vertex position %d\n",branchname);
+  char *cR = strstr(option,"R");
+  
+  if (cR)   {  
+    MakeBranchInTree(gAlice->TreeR(), 
+                     branchname, "Int_t", &fZposit, buffersize, 1, file);
+  }
   */
 }    
 
@@ -245,7 +286,6 @@ void AliSTART::Hit2digit(Int_t evnum)
   AliSTARThit  *startHit;
 
   Int_t buffersize=256;
-  Int_t split=1;
 
   digits= new AliSTARTdigit();
   TBranch *bDig=0;
@@ -255,7 +295,7 @@ void AliSTART::Hit2digit(Int_t evnum)
  
     sprintf(nameTD,"TreeD%d",evnum);
     TTree *td = new TTree(nameTD,"START");
-    bDig = td->Branch("START","AliSTARTdigit",&digits,buffersize,split);
+    bDig = td->Branch("START","AliSTARTdigit",&digits,buffersize);
 
     besttimeright=9999.;
     besttimeleft=9999.;
@@ -266,7 +306,6 @@ void AliSTART::Hit2digit(Int_t evnum)
     if (nparticles <= 0) return;
     printf("\n nparticles %d\n",nparticles);
     
-    TClonesArray *particles = gAlice->Particles();
    
     sprintf(nameTH,"TreeH%d",evnum);
     printf("%s\n",nameTH);
@@ -277,7 +316,7 @@ void AliSTART::Hit2digit(Int_t evnum)
     for (Int_t track=0; track<ntracks;track++) {
       gAlice->ResetHits();
       nbytes += th->GetEvent(track);
-      particle=(TParticle*)particles->UncheckedAt(track);
+      particle=gAlice->Particle(track);
       nhits =fHits->GetEntriesFast();
       
       for (hit=0;hit<nhits;hit++) {
@@ -331,16 +370,14 @@ void AliSTART::Hit2digit(Int_t evnum)
        timeDiff = (Int_t)(timediff); // time ( ps) channel numbres
        digits->Set(timeAv,timeDiff);
      }
-       else
-        {timeAv=999999; timeDiff=99999;}
-       td->Fill();
-       digits->MyDump();
-       printf("digits-> %d \n",digits->GetTime());
-       td->Write();
-       //     } //timediff
-   
+    else
+      {timeAv=999999; timeDiff=99999;}
+      
+    td->Fill();
+    printf("digits-> %d \n",digits->GetTime());
+    td->Write();
 
-} // end macro
+}