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