]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - START/AliSTART.cxx
Adding some QCD diffractive states to the PDG list
[u/mrichter/AliRoot.git] / START / AliSTART.cxx
index bf36571d0bf311522a65f58625e9ee54a3fb02f5..b9fa903839a0dea1b97d42ce88ab5071a256252a 100755 (executable)
 
 /*
 $Log$
+Revision 1.26  2002/10/22 15:40:19  alibrary
+Introducing Riostream.h
+
+Revision 1.25  2002/10/14 14:57:32  hristov
+Merging the VirtualMC branch to the main development branch (HEAD)
+
+Revision 1.23.8.1  2002/07/24 09:50:10  alibrary
+Updating VirtualMC
+
+Revision 1.24  2002/07/23 11:48:05  alla
+new Digits structure
+
+Revision 1.23  2001/09/19 18:41:45  alla
+Asimmetric START geometry
+
+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
 
@@ -78,8 +114,8 @@ Introduction of the Copyright and cvs Log
 //                                                                           //
 ///////////////////////////////////////////////////////////////////////////////
 
-#include <iostream.h>
-#include <fstream.h>
+#include <Riostream.h>
+#include <Riostream.h>
 
 #include "TMath.h"
 #include "TTUBE.h"
@@ -92,8 +128,8 @@ Introduction of the Copyright and cvs Log
 #include "AliRun.h"
 #include "AliSTART.h"
 #include "AliSTARTdigit.h"
-#include "AliMC.h"
 #include "AliSTARThit.h"
+#include "AliSTARThitPhoton.h"
 #include "AliSTARTvertex.h"
 
 ClassImp(AliSTART)
@@ -109,6 +145,7 @@ AliSTART::AliSTART()
   fIshunt   = 1;
   fHits     = 0;
   fDigits   = 0;
+  fPhotons  = 0;
 }
  
 //_____________________________________________________________________________
@@ -124,9 +161,13 @@ AliSTART::AliSTART(const char *name, const char *title)
   // Initialise Hit array
   fHits       = new TClonesArray("AliSTARThit",  405);
   gAlice->AddHitList(fHits);
+
+  fPhotons  = new TClonesArray("AliSTARThitPhoton", 10000);
+  gAlice->AddHitList (fPhotons);
   
   fIshunt     =  1;
   fIdSens   =  0;
+  fNPhotons =  0;
   SetMarkerColor(kRed);
 }
 
@@ -136,6 +177,10 @@ AliSTART::~AliSTART() {
     fHits->Delete();
     delete fHits;
   }
+  if (fPhotons) {
+    fPhotons->Delete();
+    delete fPhotons;
+  }
 }
  
 //_____________________________________________________________________________
@@ -148,6 +193,15 @@ void AliSTART::AddHit(Int_t track, Int_t *vol, Float_t *hits)
   new(lhits[fNhits++]) AliSTARThit(fIshunt,track,vol,hits);
 }
 
+//_____________________________________________________________________________
+void AliSTART::AddHitPhoton(Int_t track, Int_t *vol, Float_t *hits)
+{
+  //  Add a START hit of photons
+  
+  TClonesArray &lhits = *fPhotons;
+  new(lhits[fNPhotons++]) AliSTARThitPhoton(fIshunt,track,vol,hits);
+}
+
 //_____________________________________________________________________________
 
 void AliSTART::AddDigit(Int_t *tracks,Int_t *digits)
@@ -169,17 +223,17 @@ void AliSTART::BuildGeometry()
   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);
 }
@@ -201,52 +255,84 @@ 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, char *file)
+void AliSTART::MakeBranch(Option_t* option, const char *file)
 {
   //
   // Specific START branches
   //
   // Create Tree branches for the START.
-  Int_t buffersize = 400;
-  char branchname[10];
+  Int_t buffersize = 4000;
+  char branchname[20];
   sprintf(branchname,"%s",GetName());
 
   AliDetector::MakeBranch(option,file);
 
-  char *cD = strstr(option,"D");
+  const char *cD = strstr(option,"D");
+  const char *cH = strstr(option,"H");
+  
+  if (cH)
+  {
+     sprintf (branchname, "%shitPhoton", GetName());
+     MakeBranchInTree (gAlice->TreeH(), branchname, &fPhotons, 50000, file);
+  } 
+
   
   if (cD) {
     digits = new AliSTARTdigit();
-    gAlice->MakeBranchInTree(gAlice->TreeD(), 
-                             branchname, "AliSTARTdigit", digits, buffersize, 1, file) ;
+    MakeBranchInTree(gAlice->TreeD(), 
+                     branchname, "AliSTARTdigit", digits, buffersize, 1, file);
   } 
 /*
   char *cR = strstr(option,"R");
   
   if (cR)   {  
-    gAlice->MakeBranchInTree(gAlice->TreeR(), 
-                             branchname, "Int_t", &fZposit, buffersize, 1, file) ;
+    MakeBranchInTree(gAlice->TreeR(), 
+                     branchname, "Int_t", &fZposit, buffersize, 1, file);
   }
   */
 }    
 
+//_____________________________________________________________________________
+void AliSTART::ResetHits()
+{
+  AliDetector::ResetHits();
+  
+  fNPhotons = 0;
+  if (fPhotons)  fPhotons->Clear();
+}
+
+//_____________________________________________________________________________
+void AliSTART::SetTreeAddress()
+{
+  TBranch      *branch;
+  TTree                *treeH;
+
+  AliDetector::SetTreeAddress();
+  treeH = gAlice->TreeH();
+  
+  if (treeH)
+    if (fPhotons)
+    {
+       branch = treeH->GetBranch ("STARThitPhoton");
+       if (branch)  branch->SetAddress (&fPhotons);
+    }
+}
+
+
 //_____________________________________________________________________________
 
 void AliSTART::Hit2digit(Int_t evnum) 
@@ -254,6 +340,7 @@ void AliSTART::Hit2digit(Int_t evnum)
   //
   // From hits to digits
   //
+  /*
   Float_t x,y,e;
   Int_t nbytes = 0;
   Int_t hit;
@@ -268,7 +355,6 @@ void AliSTART::Hit2digit(Int_t evnum)
   AliSTARThit  *startHit;
 
   Int_t buffersize=256;
-  Int_t split=1;
 
   digits= new AliSTARTdigit();
   TBranch *bDig=0;
@@ -278,7 +364,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.;
@@ -359,7 +445,7 @@ void AliSTART::Hit2digit(Int_t evnum)
     td->Fill();
     printf("digits-> %d \n",digits->GetTime());
     td->Write();
-
+  */
 }