Change DrawDetector into DrawModule
[u/mrichter/AliRoot.git] / START / AliSTART.cxx
CommitLineData
6ca40650 1///////////////////////////////////////////////////////////////////////////////
2// //
3// START (T-Zero) Detector //
4// This class contains the base procedures for the START //
5// detector //
6// //
7//Begin_Html
8/*
9<img src="gif/AliSTARTClass.gif">
10</pre>
11<br clear=left>
12<font size=+2 color=red>
13<p>The responsible person for this module is
14<a href="mailto:Alla.Maevskaia@cern.ch">Alla Maevskaia</a>.
15</font>
16<pre>
17*/
18//End_Html
19// //
20// //
21///////////////////////////////////////////////////////////////////////////////
99560b47 22#include <stdlib.h>
6ca40650 23
24#include <TTUBE.h>
25#include <TNode.h>
26#include <TGeometry.h>
27#include "AliRun.h"
28#include "AliSTART.h"
29#include <iostream.h>
30#include <fstream.h>
31#include "AliMC.h"
32//#include "TGeant3.h"
33
34ClassImp(AliSTART)
35
36//_____________________________________________________________________________
99560b47 37AliSTART::AliSTART()
6ca40650 38{
39 //
40 // Default constructor for class AliSTART
41 //
42 fIshunt = 0;
43}
44
45//_____________________________________________________________________________
46AliSTART::AliSTART(const char *name, const char *title)
47 : AliDetector(name,title)
48{
49 //
50 // Standard constructor for START Detector
51 //
52
99560b47 53 AliModule *fmd = gAlice->GetModule("FMD");
54 if(fmd) {
55 Int_t fmdversion = fmd->IsVersion();
56 if(fmdversion==0 || fmdversion==1) {
57 Error("ctor","Versions 0 and 1 of FMD incompatible with START\n");
58 exit(1);
59 }
60 }
6ca40650 61 //
62 // Initialise Hit array
63 fHits = new TClonesArray("AliSTARThit", 405);
64
65 fIshunt = 0;
66 fIdSens1 = 0;
67
68 SetMarkerColor(kRed);
69}
70
71//_____________________________________________________________________________
72void AliSTART::AddHit(Int_t track, Int_t *vol, Float_t *hits)
73{
74 //
75 // Add a START hit
76 //
77 TClonesArray &lhits = *fHits;
78 new(lhits[fNhits++]) AliSTARThit(fIshunt,track,vol,hits);
79}
80
81//_____________________________________________________________________________
82void AliSTART::BuildGeometry()
83{
84 //
85 // Build simple ROOT TNode geometry for event display
86 //
87 TNode *Node, *Top;
88 const int kColorSTART = 19;
89 //
90 Top=gAlice->GetGeometry()->GetNode("alice");
91
92 // START define the different volumes
93 new TRotMatrix("rot999","rot999", 90,0,90,90,180,0);
94
95 new TTUBE("S_STR1","START volume 1","void",5.,10.7,5.3);
96 Top->cd();
97 Node = new TNode("STR1","STR1","S_STR1",0,0,75.,"");
98 Node->SetLineColor(kColorSTART);
99 fNodes->Add(Node);
100
101 new TTUBE("S_STR2","START volume 2","void",5.,10.7,5.3);
102 Top->cd();
103 Node = new TNode("STR2","STR2","S_STR2",0,0,-75,"rot999");
104 Node->SetLineColor(kColorSTART);
105 fNodes->Add(Node);
106}
107
108//_____________________________________________________________________________
109Int_t AliSTART::DistanceToPrimitive(Int_t px, Int_t py)
110{
111 //
112 // Calculate the distance from the mouse to the START on the screen
113 // Dummy routine
114 //
115 return 9999;
116}
117
118//_____________________________________________________________________________
119
120//-------------------------------------------------------------------------
121void AliSTART::Init()
122{
123 //
124 // Initialis the START after it has been built
125 Int_t i;
126 AliMC* pMC = AliMC::GetMC();
127 //
128 printf("\n");
129 for(i=0;i<35;i++) printf("*");
130 printf(" START_INIT ");
131 for(i=0;i<35;i++) printf("*");
132 printf("\n");
133 //
134 // Here the START initialisation code (if any!)
135 for(i=0;i<80;i++) printf("*");
136 printf("\n");
137 //
138 //
139 fIdSens1=pMC->VolId("PTOP");
140
141}
142
143//---------------------------------------------------------------------------
144void AliSTART::MakeBranch(Option_t* option)
145{
146
147 // Create Tree branches for the START.
148 Int_t buffersize = 4000;
149 char branchname[10];
150 sprintf(branchname,"%s",GetName());
151
152 AliDetector::MakeBranch(option);
153
154 char *D = strstr(option,"D");
155
156 if (fDigits && gAlice->TreeD() && D) {
157 gAlice->TreeD()->Branch(branchname,&fDigits, buffersize);
158 printf("Making Branch %s for digits\n",branchname);
159 }
160
161}
162
163ClassImp(AliSTARThit)
164
165//_____________________________________________________________________________
166AliSTARThit::AliSTARThit(Int_t shunt, Int_t track, Int_t *vol, Float_t *hits):
167 AliHit(shunt, track)
168{
169 //
170 // Add a START hit
171 //
172
173// Int_t i;
174 fVolume = vol[0];
175 fPmt=vol[1];
176//printf("fvolume %d\n",fVolume);
177//printf("fpmt %d\n",fPmt);
178
179 fX=hits[0];
180 fY=hits[1];
181 fZ=hits[2];
182 fEdep=hits[3];
183 fEtot=hits[4];
184 fParticle=Int_t (hits[5]);
185 fTime=hits[6];
186
187//for (i=0; i<=6; i++) {printf("Hits up %f\n",hits[i]);}
188}
189
190// ClassImp(AliSTARTdigit)