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>
54 #include "AliLoader.h"
58 #include "AliSTARTLoader.h"
59 #include "AliSTARTdigit.h"
60 #include "AliSTARThit.h"
61 #include "AliSTARTDigitizer.h"
62 #include "AliSTARTRawData.h"
66 //static AliSTARTdigit *digits;
68 //_____________________________________________________________________________
72 // Default constructor for class AliSTART
79 //_____________________________________________________________________________
80 AliSTART::AliSTART(const char *name, const char *title)
81 : AliDetector(name,title)
84 // Standard constructor for START Detector
89 // Initialise Hit array
90 fHits = new TClonesArray("AliSTARThit", 405);
91 gAlice->GetMCApp()->AddHitList(fHits);
97 //_____________________________________________________________________________
98 AliSTART::~AliSTART() {
105 //_____________________________________________________________________________
106 void AliSTART::AddHit(Int_t track, Int_t *vol, Float_t *hits)
111 TClonesArray &lhits = *fHits;
112 new(lhits[fNhits++]) AliSTARThit(fIshunt,track,vol,hits);
116 //_____________________________________________________________________________
118 void AliSTART::AddDigit(Int_t * /*tracks*/, Int_t * /*digits*/)
121 // Add a START digit to the list. Dummy function.
125 //_____________________________________________________________________________
126 void AliSTART::BuildGeometry()
129 // Build simple ROOT TNode geometry for event display
132 const int kColorSTART = 19;
134 top=gAlice->GetGeometry()->GetNode("alice");
136 // START define the different volumes
137 new TRotMatrix("rotx999","rot999", 90,0,90,90,180,0);
139 new TTUBE("S_0ST1","START volume 1","void",5.,10.7,5.3);
141 node = new TNode("0ST1","0ST01","S_0ST1",0,0,-69.7,"");
142 node->SetLineColor(kColorSTART);
145 new TTUBE("S_0ST2","START volume 2","void",5.,10.7,5.3);
147 node = new TNode("0ST2","0ST2","S_0ST2",0,0,350,"rotx999");
148 node->SetLineColor(kColorSTART);
152 //_____________________________________________________________________________
153 Int_t AliSTART::DistanceToPrimitive(Int_t /*px*/, Int_t /*py*/)
156 // Calculate the distance from the mouse to the START on the screen
162 //-------------------------------------------------------------------------
163 void AliSTART::Init()
166 // Initialis the START after it has been built
170 printf("\n%s: ",ClassName());
171 for(i=0;i<35;i++) printf("*");
172 printf(" START_INIT ");
173 for(i=0;i<35;i++) printf("*");
174 printf("\n%s: ",ClassName());
176 // Here the START initialisation code (if any!)
177 for(i=0;i<80;i++) printf("*");
182 //---------------------------------------------------------------------------
183 void AliSTART::MakeBranch(Option_t* option)
186 // Specific START branches
188 // Create Tree branches for the START.
190 sprintf(branchname,"%s",GetName());
192 const char *cH = strstr(option,"H");
194 if (cH && fLoader->TreeH())
196 if (fHits == 0x0) fHits = new TClonesArray("AliSTARThit", 405);
199 AliDetector::MakeBranch(option);
202 //_____________________________________________________________________________
203 void AliSTART::ResetHits()
205 AliDetector::ResetHits();
209 //_____________________________________________________________________________
210 void AliSTART::SetTreeAddress()
218 if (fHits == 0x0) fHits = new TClonesArray("AliSTARThit", 405);
221 AliDetector::SetTreeAddress();
225 //______________________________________________________________________
226 AliLoader* AliSTART::MakeLoader(const char* topfoldername)
229 AliDebug(2,Form(" Creating AliSTARTLoader "));
230 fLoader = new AliSTARTLoader(GetName(), topfoldername);
234 //_____________________________________________________________________________
235 AliDigitizer* AliSTART::CreateDigitizer(AliRunDigitizer* manager) const
237 return new AliSTARTDigitizer(manager);
239 //____________________________________________________________________________
240 void AliSTART::Digits2Raw()
243 // Starting from the START digits, writes the Raw Data objects
245 AliSTARTLoader* pStartLoader = (AliSTARTLoader*)fLoader;
246 pStartLoader ->LoadDigits();
247 AliSTARTdigit* fDigits=pStartLoader->Digits();
248 AliSTARTRawData rawWriter;
249 rawWriter.SetVerbose(0);
251 AliDebug(2,Form(" Formatting raw data for START "));
253 rawWriter.RawDataSTART (fDigits);
255 pStartLoader->UnloadDigits();