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