]> git.uio.no Git - u/mrichter/AliRoot.git/blame - START/AliSTART.cxx
Reinitialization after soft scattering, bug fixes in the calculation of angle and...
[u/mrichter/AliRoot.git] / START / AliSTART.cxx
CommitLineData
4c039060 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15
88cb7938 16/* $Id$ */
4c039060 17
6ca40650 18///////////////////////////////////////////////////////////////////////////////
19// //
20// START (T-Zero) Detector //
21// This class contains the base procedures for the START //
22// detector //
23// //
24//Begin_Html
25/*
26<img src="gif/AliSTARTClass.gif">
27</pre>
28<br clear=left>
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>.
32</font>
33<pre>
34*/
35//End_Html
36// //
37// //
38///////////////////////////////////////////////////////////////////////////////
39
ef0750c2 40#include <Riostream.h>
971579f6 41
88cb7938 42#include <TFile.h>
43#include <TGeometry.h>
44#include <TMath.h>
45#include <TNode.h>
46#include <TParticle.h>
47#include <TRandom.h>
48#include <TTUBE.h>
49#include <TVirtualMC.h>
2ab0c725 50
88cb7938 51#include "AliLoader.h"
971579f6 52#include "AliRun.h"
53#include "AliSTART.h"
54#include "AliSTARTdigit.h"
971579f6 55#include "AliSTARThit.h"
e73d68f2 56#include "AliSTARThitPhoton.h"
c345bb4f 57#include "AliSTARTvertex.h"
f1538e33 58#include "AliMC.h"
85a5290f 59#include "AliSTARTDigitizer.h"
971579f6 60
6ca40650 61ClassImp(AliSTART)
ef51244a 62
f1538e33 63static AliSTARTdigit *digits;
ef51244a 64
6ca40650 65//_____________________________________________________________________________
99560b47 66AliSTART::AliSTART()
6ca40650 67{
68 //
69 // Default constructor for class AliSTART
70 //
f3ed336b 71 fIshunt = 1;
971579f6 72 fHits = 0;
73 fDigits = 0;
e73d68f2 74 fPhotons = 0;
6ca40650 75}
76
77//_____________________________________________________________________________
78AliSTART::AliSTART(const char *name, const char *title)
79 : AliDetector(name,title)
80{
81 //
82 // Standard constructor for START Detector
83 //
971579f6 84
c345bb4f 85
6ca40650 86 //
87 // Initialise Hit array
971579f6 88 fHits = new TClonesArray("AliSTARThit", 405);
f1538e33 89 gAlice->GetMCApp()->AddHitList(fHits);
e73d68f2 90
91 fPhotons = new TClonesArray("AliSTARThitPhoton", 10000);
f1538e33 92 gAlice->GetMCApp()->AddHitList (fPhotons);
6ca40650 93
f3ed336b 94 fIshunt = 1;
c345bb4f 95 fIdSens = 0;
e73d68f2 96 fNPhotons = 0;
6ca40650 97 SetMarkerColor(kRed);
98}
bff160c8 99
100//_____________________________________________________________________________
101AliSTART::~AliSTART() {
102 if (fHits) {
103 fHits->Delete();
104 delete fHits;
105 }
e73d68f2 106 if (fPhotons) {
107 fPhotons->Delete();
108 delete fPhotons;
109 }
bff160c8 110}
6ca40650 111
112//_____________________________________________________________________________
113void AliSTART::AddHit(Int_t track, Int_t *vol, Float_t *hits)
114{
115 //
116 // Add a START hit
117 //
118 TClonesArray &lhits = *fHits;
119 new(lhits[fNhits++]) AliSTARThit(fIshunt,track,vol,hits);
120}
971579f6 121
e73d68f2 122//_____________________________________________________________________________
123void AliSTART::AddHitPhoton(Int_t track, Int_t *vol, Float_t *hits)
124{
125 // Add a START hit of photons
126
127 TClonesArray &lhits = *fPhotons;
128 new(lhits[fNPhotons++]) AliSTARThitPhoton(fIshunt,track,vol,hits);
129}
130
971579f6 131//_____________________________________________________________________________
c345bb4f 132
f1538e33 133void AliSTART::AddDigit(Int_t * /*tracks*/, Int_t * /*digits*/)
971579f6 134{
c345bb4f 135
f3ed336b 136 // Add a START digit to the list. Dummy function.
c345bb4f 137
971579f6 138}
c345bb4f 139
6ca40650 140//_____________________________________________________________________________
141void AliSTART::BuildGeometry()
142{
143 //
144 // Build simple ROOT TNode geometry for event display
145 //
ef51244a 146 TNode *node, *top;
6ca40650 147 const int kColorSTART = 19;
f3ed336b 148
ef51244a 149 top=gAlice->GetGeometry()->GetNode("alice");
6ca40650 150
151 // START define the different volumes
44b06417 152 new TRotMatrix("rotx999","rot999", 90,0,90,90,180,0);
6ca40650 153
2ca99a7f 154 new TTUBE("S_0ST1","START volume 1","void",5.,10.7,5.3);
ef51244a 155 top->cd();
1663993c 156 node = new TNode("0ST1","0ST01","S_0ST1",0,0,-69.7,"");
ef51244a 157 node->SetLineColor(kColorSTART);
158 fNodes->Add(node);
6ca40650 159
2ca99a7f 160 new TTUBE("S_0ST2","START volume 2","void",5.,10.7,5.3);
ef51244a 161 top->cd();
1663993c 162 node = new TNode("0ST2","0ST2","S_0ST2",0,0,350,"rotx999");
ef51244a 163 node->SetLineColor(kColorSTART);
164 fNodes->Add(node);
6ca40650 165}
166
167//_____________________________________________________________________________
7fe81cad 168Int_t AliSTART::DistanceToPrimitive(Int_t /*px*/, Int_t /*py*/)
6ca40650 169{
170 //
171 // Calculate the distance from the mouse to the START on the screen
172 // Dummy routine
173 //
174 return 9999;
175}
176
6ca40650 177//-------------------------------------------------------------------------
178void AliSTART::Init()
179{
180 //
181 // Initialis the START after it has been built
182 Int_t i;
6ca40650 183 //
9e1a0ddb 184 if(fDebug) {
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());
190 //
191 // Here the START initialisation code (if any!)
192 for(i=0;i<80;i++) printf("*");
193 printf("\n");
194 }
6ca40650 195}
196
197//---------------------------------------------------------------------------
88cb7938 198void AliSTART::MakeBranch(Option_t* option)
6ca40650 199{
ef51244a 200 //
201 // Specific START branches
202 //
6ca40650 203 // Create Tree branches for the START.
f1538e33 204 Int_t buffersize = 4000;
e73d68f2 205 char branchname[20];
6ca40650 206 sprintf(branchname,"%s",GetName());
207
6ca40650 208
f1538e33 209 const char *cD = strstr(option,"D");
e73d68f2 210 const char *cH = strstr(option,"H");
211
88cb7938 212 if (cH && fLoader->TreeH())
e73d68f2 213 {
88cb7938 214 if (fPhotons == 0x0) fPhotons = new TClonesArray("AliSTARThitPhoton", 10000);
e73d68f2 215 sprintf (branchname, "%shitPhoton", GetName());
88cb7938 216 MakeBranchInTree (fLoader->TreeH(), branchname, &fPhotons, 50000, 0);
217 if (fHits == 0x0) fHits = new TClonesArray("AliSTARThit", 405);
e73d68f2 218 }
2ab0c725 219
88cb7938 220 AliDetector::MakeBranch(option);
f1538e33 221
2ab0c725 222 if (cD) {
223 digits = new AliSTARTdigit();
88cb7938 224 MakeBranchInTree(fLoader->TreeD(), branchname, "AliSTARTdigit", digits, buffersize, 1, 0);
2ab0c725 225 }
6ca40650 226}
971579f6 227
e73d68f2 228//_____________________________________________________________________________
229void AliSTART::ResetHits()
230{
231 AliDetector::ResetHits();
232
233 fNPhotons = 0;
234 if (fPhotons) fPhotons->Clear();
235}
236
237//_____________________________________________________________________________
238void AliSTART::SetTreeAddress()
239{
88cb7938 240 TBranch *branch;
241 TTree *treeH;
242
243
244 treeH = TreeH();
e73d68f2 245
246 if (treeH)
e73d68f2 247 {
88cb7938 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);
e73d68f2 252 }
88cb7938 253
254 AliDetector::SetTreeAddress();
255
e73d68f2 256}
257
258
f1538e33 259//_____________________________________________________________________________
c345bb4f 260
f1538e33 261void AliSTART::Hit2digit(Int_t /*evnum*/)
262{
f3ed336b 263}
f1538e33 264
85a5290f 265//_____________________________________________________________________________
266AliDigitizer* AliSTART::CreateDigitizer(AliRunDigitizer* manager)
267{
268 return new AliSTARTDigitizer(manager);
269}