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"
61 static AliSTARTdigit *digits;
63 //_____________________________________________________________________________
67 // Default constructor for class AliSTART
75 //_____________________________________________________________________________
76 AliSTART::AliSTART(const char *name, const char *title)
77 : AliDetector(name,title)
80 // Standard constructor for START Detector
85 // Initialise Hit array
86 fHits = new TClonesArray("AliSTARThit", 405);
87 gAlice->AddHitList(fHits);
89 fPhotons = new TClonesArray("AliSTARThitPhoton", 10000);
90 gAlice->AddHitList (fPhotons);
98 //_____________________________________________________________________________
99 AliSTART::~AliSTART() {
110 //_____________________________________________________________________________
111 void AliSTART::AddHit(Int_t track, Int_t *vol, Float_t *hits)
116 TClonesArray &lhits = *fHits;
117 new(lhits[fNhits++]) AliSTARThit(fIshunt,track,vol,hits);
120 //_____________________________________________________________________________
121 void AliSTART::AddHitPhoton(Int_t track, Int_t *vol, Float_t *hits)
123 // Add a START hit of photons
125 TClonesArray &lhits = *fPhotons;
126 new(lhits[fNPhotons++]) AliSTARThitPhoton(fIshunt,track,vol,hits);
129 //_____________________________________________________________________________
131 void AliSTART::AddDigit(Int_t *tracks,Int_t *digits)
134 // Add a START digit to the list. Dummy function.
138 //_____________________________________________________________________________
139 void AliSTART::BuildGeometry()
142 // Build simple ROOT TNode geometry for event display
145 const int kColorSTART = 19;
147 top=gAlice->GetGeometry()->GetNode("alice");
149 // START define the different volumes
150 new TRotMatrix("rotx999","rot999", 90,0,90,90,180,0);
152 new TTUBE("S_0ST1","START volume 1","void",5.,10.7,5.3);
154 node = new TNode("0ST1","0ST01","S_0ST1",0,0,69.7,"");
155 node->SetLineColor(kColorSTART);
158 new TTUBE("S_0ST2","START volume 2","void",5.,10.7,5.3);
160 node = new TNode("0ST2","0ST2","S_0ST2",0,0,-350,"rotx999");
161 node->SetLineColor(kColorSTART);
165 //_____________________________________________________________________________
166 Int_t AliSTART::DistanceToPrimitive(Int_t px, Int_t py)
169 // Calculate the distance from the mouse to the START on the screen
175 //-------------------------------------------------------------------------
176 void AliSTART::Init()
179 // Initialis the START after it has been built
183 printf("\n%s: ",ClassName());
184 for(i=0;i<35;i++) printf("*");
185 printf(" START_INIT ");
186 for(i=0;i<35;i++) printf("*");
187 printf("\n%s: ",ClassName());
189 // Here the START initialisation code (if any!)
190 for(i=0;i<80;i++) printf("*");
195 //---------------------------------------------------------------------------
196 void AliSTART::MakeBranch(Option_t* option)
199 // Specific START branches
201 // Create Tree branches for the START.
202 Int_t buffersize = 4000;
204 sprintf(branchname,"%s",GetName());
207 const char *cD = strstr(option,"D");
208 const char *cH = strstr(option,"H");
210 if (cH && fLoader->TreeH())
212 if (fPhotons == 0x0) fPhotons = new TClonesArray("AliSTARThitPhoton", 10000);
213 sprintf (branchname, "%shitPhoton", GetName());
214 MakeBranchInTree (fLoader->TreeH(), branchname, &fPhotons, 50000, 0);
215 if (fHits == 0x0) fHits = new TClonesArray("AliSTARThit", 405);
218 AliDetector::MakeBranch(option);
221 digits = new AliSTARTdigit();
222 MakeBranchInTree(fLoader->TreeD(), branchname, "AliSTARTdigit", digits, buffersize, 1, 0);
226 //_____________________________________________________________________________
227 void AliSTART::ResetHits()
229 AliDetector::ResetHits();
232 if (fPhotons) fPhotons->Clear();
235 //_____________________________________________________________________________
236 void AliSTART::SetTreeAddress()
246 if (fPhotons == 0x0) fPhotons = new TClonesArray("AliSTARThitPhoton", 10000);
247 branch = treeH->GetBranch("STARThitPhoton");
248 if (branch) branch->SetAddress(&fPhotons);
249 if (fHits == 0x0) fHits = new TClonesArray("AliSTARThit", 405);
252 AliDetector::SetTreeAddress();
257 //_____________________________________________________________________________
259 void AliSTART::Hit2digit(Int_t evnum)