1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
18 ///////////////////////////////////////////////////////////////////////////////
20 // START (T-Zero) Detector //
21 // This class contains the base procedures for the START //
26 <img src="gif/AliSTARTClass.gif">
29 <font size=+2 color=red>
30 <p>The responsible person for this module is
31 <a href="mailto:Alla.Maevskaia@cern.ch">Alla Maevskaia</a>.
38 ///////////////////////////////////////////////////////////////////////////////
40 #include <Riostream.h>
43 #include <TGeometry.h>
46 #include <TParticle.h>
49 #include <TVirtualMC.h>
51 #include "AliLoader.h"
54 #include "AliSTARTdigit.h"
55 #include "AliSTARThit.h"
56 #include "AliSTARThitPhoton.h"
57 #include "AliSTARTvertex.h"
62 static AliSTARTdigit *digits;
64 //_____________________________________________________________________________
68 // Default constructor for class AliSTART
76 //_____________________________________________________________________________
77 AliSTART::AliSTART(const char *name, const char *title)
78 : AliDetector(name,title)
81 // Standard constructor for START Detector
86 // Initialise Hit array
87 fHits = new TClonesArray("AliSTARThit", 405);
88 gAlice->GetMCApp()->AddHitList(fHits);
90 fPhotons = new TClonesArray("AliSTARThitPhoton", 10000);
91 gAlice->GetMCApp()->AddHitList (fPhotons);
99 //_____________________________________________________________________________
100 AliSTART::~AliSTART() {
111 //_____________________________________________________________________________
112 void AliSTART::AddHit(Int_t track, Int_t *vol, Float_t *hits)
117 TClonesArray &lhits = *fHits;
118 new(lhits[fNhits++]) AliSTARThit(fIshunt,track,vol,hits);
121 //_____________________________________________________________________________
122 void AliSTART::AddHitPhoton(Int_t track, Int_t *vol, Float_t *hits)
124 // Add a START hit of photons
126 TClonesArray &lhits = *fPhotons;
127 new(lhits[fNPhotons++]) AliSTARThitPhoton(fIshunt,track,vol,hits);
130 //_____________________________________________________________________________
132 void AliSTART::AddDigit(Int_t * /*tracks*/, Int_t * /*digits*/)
135 // Add a START digit to the list. Dummy function.
139 //_____________________________________________________________________________
140 void AliSTART::BuildGeometry()
143 // Build simple ROOT TNode geometry for event display
146 const int kColorSTART = 19;
148 top=gAlice->GetGeometry()->GetNode("alice");
150 // START define the different volumes
151 new TRotMatrix("rotx999","rot999", 90,0,90,90,180,0);
153 new TTUBE("S_0ST1","START volume 1","void",5.,10.7,5.3);
155 node = new TNode("0ST1","0ST01","S_0ST1",0,0,-69.7,"");
156 node->SetLineColor(kColorSTART);
159 new TTUBE("S_0ST2","START volume 2","void",5.,10.7,5.3);
161 node = new TNode("0ST2","0ST2","S_0ST2",0,0,350,"rotx999");
162 node->SetLineColor(kColorSTART);
166 //_____________________________________________________________________________
167 Int_t AliSTART::DistanceToPrimitive(Int_t /*px*/, Int_t /*py*/)
170 // Calculate the distance from the mouse to the START on the screen
176 //-------------------------------------------------------------------------
177 void AliSTART::Init()
180 // Initialis the START after it has been built
184 printf("\n%s: ",ClassName());
185 for(i=0;i<35;i++) printf("*");
186 printf(" START_INIT ");
187 for(i=0;i<35;i++) printf("*");
188 printf("\n%s: ",ClassName());
190 // Here the START initialisation code (if any!)
191 for(i=0;i<80;i++) printf("*");
196 //---------------------------------------------------------------------------
197 void AliSTART::MakeBranch(Option_t* option)
200 // Specific START branches
202 // Create Tree branches for the START.
203 Int_t buffersize = 4000;
205 sprintf(branchname,"%s",GetName());
208 const char *cD = strstr(option,"D");
209 const char *cH = strstr(option,"H");
211 if (cH && fLoader->TreeH())
213 if (fPhotons == 0x0) fPhotons = new TClonesArray("AliSTARThitPhoton", 10000);
214 sprintf (branchname, "%shitPhoton", GetName());
215 MakeBranchInTree (fLoader->TreeH(), branchname, &fPhotons, 50000, 0);
216 if (fHits == 0x0) fHits = new TClonesArray("AliSTARThit", 405);
219 AliDetector::MakeBranch(option);
222 digits = new AliSTARTdigit();
223 MakeBranchInTree(fLoader->TreeD(), branchname, "AliSTARTdigit", digits, buffersize, 1, 0);
227 //_____________________________________________________________________________
228 void AliSTART::ResetHits()
230 AliDetector::ResetHits();
233 if (fPhotons) fPhotons->Clear();
236 //_____________________________________________________________________________
237 void AliSTART::SetTreeAddress()
247 if (fPhotons == 0x0) fPhotons = new TClonesArray("AliSTARThitPhoton", 10000);
248 branch = treeH->GetBranch("STARThitPhoton");
249 if (branch) branch->SetAddress(&fPhotons);
250 if (fHits == 0x0) fHits = new TClonesArray("AliSTARThit", 405);
253 AliDetector::SetTreeAddress();
258 //_____________________________________________________________________________
260 void AliSTART::Hit2digit(Int_t /*evnum*/)