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>
52 #include "AliLoader.h"
55 #include "AliSTARTdigit.h"
56 #include "AliSTARThit.h"
57 #include "AliSTARThitPhoton.h"
58 #include "AliSTARTvertex.h"
60 #include "AliSTARTDigitizer.h"
64 static AliSTARTdigit *digits;
66 //_____________________________________________________________________________
70 // Default constructor for class AliSTART
78 //_____________________________________________________________________________
79 AliSTART::AliSTART(const char *name, const char *title)
80 : AliDetector(name,title)
83 // Standard constructor for START Detector
88 // Initialise Hit array
89 fHits = new TClonesArray("AliSTARThit", 405);
90 gAlice->GetMCApp()->AddHitList(fHits);
92 fPhotons = new TClonesArray("AliSTARThitPhoton", 10000);
93 gAlice->GetMCApp()->AddHitList (fPhotons);
94 if (GetDebug()>2) cout<<" Debug "<<endl;
101 //_____________________________________________________________________________
102 AliSTART::~AliSTART() {
113 //_____________________________________________________________________________
114 void AliSTART::AddHit(Int_t track, Int_t *vol, Float_t *hits)
119 TClonesArray &lhits = *fHits;
120 new(lhits[fNhits++]) AliSTARThit(fIshunt,track,vol,hits);
123 //_____________________________________________________________________________
124 void AliSTART::AddHitPhoton(Int_t track, Int_t *vol, Float_t *hits)
126 // Add a START hit of photons
128 TClonesArray &lhits = *fPhotons;
129 new(lhits[fNPhotons++]) AliSTARThitPhoton(fIshunt,track,vol,hits);
132 //_____________________________________________________________________________
134 void AliSTART::AddDigit(Int_t * /*tracks*/, Int_t * /*digits*/)
137 // Add a START digit to the list. Dummy function.
141 //_____________________________________________________________________________
142 void AliSTART::BuildGeometry()
145 // Build simple ROOT TNode geometry for event display
148 const int kColorSTART = 19;
150 top=gAlice->GetGeometry()->GetNode("alice");
152 // START define the different volumes
153 new TRotMatrix("rotx999","rot999", 90,0,90,90,180,0);
155 new TTUBE("S_0ST1","START volume 1","void",5.,10.7,5.3);
157 node = new TNode("0ST1","0ST01","S_0ST1",0,0,-69.7,"");
158 node->SetLineColor(kColorSTART);
161 new TTUBE("S_0ST2","START volume 2","void",5.,10.7,5.3);
163 node = new TNode("0ST2","0ST2","S_0ST2",0,0,350,"rotx999");
164 node->SetLineColor(kColorSTART);
168 //_____________________________________________________________________________
169 Int_t AliSTART::DistanceToPrimitive(Int_t /*px*/, Int_t /*py*/)
172 // Calculate the distance from the mouse to the START on the screen
178 //-------------------------------------------------------------------------
179 void AliSTART::Init()
182 // Initialis the START after it has been built
186 printf("\n%s: ",ClassName());
187 for(i=0;i<35;i++) printf("*");
188 printf(" START_INIT ");
189 for(i=0;i<35;i++) printf("*");
190 printf("\n%s: ",ClassName());
192 // Here the START initialisation code (if any!)
193 for(i=0;i<80;i++) printf("*");
198 //---------------------------------------------------------------------------
199 void AliSTART::MakeBranch(Option_t* option)
202 // Specific START branches
204 // Create Tree branches for the START.
205 Int_t buffersize = 4000;
207 sprintf(branchname,"%s",GetName());
210 const char *cD = strstr(option,"D");
211 const char *cH = strstr(option,"H");
213 if (cH && fLoader->TreeH())
215 if (fPhotons == 0x0) fPhotons = new TClonesArray("AliSTARThitPhoton", 10000);
216 sprintf (branchname, "%shitPhoton", GetName());
217 MakeBranchInTree (fLoader->TreeH(), branchname, &fPhotons, 50000, 0);
218 if (fHits == 0x0) fHits = new TClonesArray("AliSTARThit", 405);
221 AliDetector::MakeBranch(option);
224 digits = new AliSTARTdigit();
225 MakeBranchInTree(fLoader->TreeD(), branchname, "AliSTARTdigit", digits, buffersize, 1, 0);
229 //_____________________________________________________________________________
230 void AliSTART::ResetHits()
232 AliDetector::ResetHits();
235 if (fPhotons) fPhotons->Clear();
238 //_____________________________________________________________________________
239 void AliSTART::SetTreeAddress()
249 if (fPhotons == 0x0) fPhotons = new TClonesArray("AliSTARThitPhoton", 10000);
250 branch = treeH->GetBranch("STARThitPhoton");
251 if (branch) branch->SetAddress(&fPhotons);
252 if (fHits == 0x0) fHits = new TClonesArray("AliSTARThit", 405);
255 AliDetector::SetTreeAddress();
259 //_____________________________________________________________________________
260 AliDigitizer* AliSTART::CreateDigitizer(AliRunDigitizer* manager) const
262 return new AliSTARTDigitizer(manager);