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"
59 #include "AliSTARTDigitizer.h"
63 static AliSTARTdigit *digits;
65 //_____________________________________________________________________________
69 // Default constructor for class AliSTART
77 //_____________________________________________________________________________
78 AliSTART::AliSTART(const char *name, const char *title)
79 : AliDetector(name,title)
82 // Standard constructor for START Detector
87 // Initialise Hit array
88 fHits = new TClonesArray("AliSTARThit", 405);
89 gAlice->GetMCApp()->AddHitList(fHits);
91 fPhotons = new TClonesArray("AliSTARThitPhoton", 10000);
92 gAlice->GetMCApp()->AddHitList (fPhotons);
100 //_____________________________________________________________________________
101 AliSTART::~AliSTART() {
112 //_____________________________________________________________________________
113 void AliSTART::AddHit(Int_t track, Int_t *vol, Float_t *hits)
118 TClonesArray &lhits = *fHits;
119 new(lhits[fNhits++]) AliSTARThit(fIshunt,track,vol,hits);
122 //_____________________________________________________________________________
123 void AliSTART::AddHitPhoton(Int_t track, Int_t *vol, Float_t *hits)
125 // Add a START hit of photons
127 TClonesArray &lhits = *fPhotons;
128 new(lhits[fNPhotons++]) AliSTARThitPhoton(fIshunt,track,vol,hits);
131 //_____________________________________________________________________________
133 void AliSTART::AddDigit(Int_t * /*tracks*/, Int_t * /*digits*/)
136 // Add a START digit to the list. Dummy function.
140 //_____________________________________________________________________________
141 void AliSTART::BuildGeometry()
144 // Build simple ROOT TNode geometry for event display
147 const int kColorSTART = 19;
149 top=gAlice->GetGeometry()->GetNode("alice");
151 // START define the different volumes
152 new TRotMatrix("rotx999","rot999", 90,0,90,90,180,0);
154 new TTUBE("S_0ST1","START volume 1","void",5.,10.7,5.3);
156 node = new TNode("0ST1","0ST01","S_0ST1",0,0,-69.7,"");
157 node->SetLineColor(kColorSTART);
160 new TTUBE("S_0ST2","START volume 2","void",5.,10.7,5.3);
162 node = new TNode("0ST2","0ST2","S_0ST2",0,0,350,"rotx999");
163 node->SetLineColor(kColorSTART);
167 //_____________________________________________________________________________
168 Int_t AliSTART::DistanceToPrimitive(Int_t /*px*/, Int_t /*py*/)
171 // Calculate the distance from the mouse to the START on the screen
177 //-------------------------------------------------------------------------
178 void AliSTART::Init()
181 // Initialis the START after it has been built
185 printf("\n%s: ",ClassName());
186 for(i=0;i<35;i++) printf("*");
187 printf(" START_INIT ");
188 for(i=0;i<35;i++) printf("*");
189 printf("\n%s: ",ClassName());
191 // Here the START initialisation code (if any!)
192 for(i=0;i<80;i++) printf("*");
197 //---------------------------------------------------------------------------
198 void AliSTART::MakeBranch(Option_t* option)
201 // Specific START branches
203 // Create Tree branches for the START.
204 Int_t buffersize = 4000;
206 sprintf(branchname,"%s",GetName());
209 const char *cD = strstr(option,"D");
210 const char *cH = strstr(option,"H");
212 if (cH && fLoader->TreeH())
214 if (fPhotons == 0x0) fPhotons = new TClonesArray("AliSTARThitPhoton", 10000);
215 sprintf (branchname, "%shitPhoton", GetName());
216 MakeBranchInTree (fLoader->TreeH(), branchname, &fPhotons, 50000, 0);
217 if (fHits == 0x0) fHits = new TClonesArray("AliSTARThit", 405);
220 AliDetector::MakeBranch(option);
223 digits = new AliSTARTdigit();
224 MakeBranchInTree(fLoader->TreeD(), branchname, "AliSTARTdigit", digits, buffersize, 1, 0);
228 //_____________________________________________________________________________
229 void AliSTART::ResetHits()
231 AliDetector::ResetHits();
234 if (fPhotons) fPhotons->Clear();
237 //_____________________________________________________________________________
238 void AliSTART::SetTreeAddress()
248 if (fPhotons == 0x0) fPhotons = new TClonesArray("AliSTARThitPhoton", 10000);
249 branch = treeH->GetBranch("STARThitPhoton");
250 if (branch) branch->SetAddress(&fPhotons);
251 if (fHits == 0x0) fHits = new TClonesArray("AliSTARThit", 405);
254 AliDetector::SetTreeAddress();
259 //_____________________________________________________________________________
261 void AliSTART::Hit2digit(Int_t /*evnum*/)
265 //_____________________________________________________________________________
266 AliDigitizer* AliSTART::CreateDigitizer(AliRunDigitizer* manager) const
268 return new AliSTARTDigitizer(manager);