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>
52 #include "AliLoader.h"
55 #include "AliSTARTLoader.h"
56 #include "AliSTARTdigit.h"
57 #include "AliSTARThit.h"
58 #include "AliSTARThitPhoton.h"
59 #include "AliSTARTvertex.h"
61 #include "AliSTARTDigitizer.h"
65 static AliSTARTdigit *digits;
67 //_____________________________________________________________________________
71 // 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);
93 fPhotons = new TClonesArray("AliSTARThitPhoton", 10000);
94 gAlice->GetMCApp()->AddHitList (fPhotons);
95 if (GetDebug()>2) cout<<" Debug "<<endl;
102 //_____________________________________________________________________________
103 AliSTART::~AliSTART() {
114 //_____________________________________________________________________________
115 void AliSTART::AddHit(Int_t track, Int_t *vol, Float_t *hits)
120 TClonesArray &lhits = *fHits;
121 new(lhits[fNhits++]) AliSTARThit(fIshunt,track,vol,hits);
124 //_____________________________________________________________________________
125 void AliSTART::AddHitPhoton(Int_t track, Int_t *vol, Float_t *hits)
127 // Add a START hit of photons
129 TClonesArray &lhits = *fPhotons;
130 new(lhits[fNPhotons++]) AliSTARThitPhoton(fIshunt,track,vol,hits);
133 //_____________________________________________________________________________
135 void AliSTART::AddDigit(Int_t * /*tracks*/, Int_t * /*digits*/)
138 // Add a START digit to the list. Dummy function.
142 //_____________________________________________________________________________
143 void AliSTART::BuildGeometry()
146 // Build simple ROOT TNode geometry for event display
149 const int kColorSTART = 19;
151 top=gAlice->GetGeometry()->GetNode("alice");
153 // START define the different volumes
154 new TRotMatrix("rotx999","rot999", 90,0,90,90,180,0);
156 new TTUBE("S_0ST1","START volume 1","void",5.,10.7,5.3);
158 node = new TNode("0ST1","0ST01","S_0ST1",0,0,-69.7,"");
159 node->SetLineColor(kColorSTART);
162 new TTUBE("S_0ST2","START volume 2","void",5.,10.7,5.3);
164 node = new TNode("0ST2","0ST2","S_0ST2",0,0,350,"rotx999");
165 node->SetLineColor(kColorSTART);
169 //_____________________________________________________________________________
170 Int_t AliSTART::DistanceToPrimitive(Int_t /*px*/, Int_t /*py*/)
173 // Calculate the distance from the mouse to the START on the screen
179 //-------------------------------------------------------------------------
180 void AliSTART::Init()
183 // Initialis the START after it has been built
187 printf("\n%s: ",ClassName());
188 for(i=0;i<35;i++) printf("*");
189 printf(" START_INIT ");
190 for(i=0;i<35;i++) printf("*");
191 printf("\n%s: ",ClassName());
193 // Here the START initialisation code (if any!)
194 for(i=0;i<80;i++) printf("*");
199 //---------------------------------------------------------------------------
200 void AliSTART::MakeBranch(Option_t* option)
203 // Specific START branches
205 // Create Tree branches for the START.
206 Int_t buffersize = 4000;
208 sprintf(branchname,"%s",GetName());
211 const char *cD = strstr(option,"D");
212 const char *cH = strstr(option,"H");
214 if (cH && fLoader->TreeH())
216 if (fPhotons == 0x0) fPhotons = new TClonesArray("AliSTARThitPhoton", 10000);
217 sprintf (branchname, "%shitPhoton", GetName());
218 MakeBranchInTree (fLoader->TreeH(), branchname, &fPhotons, 50000, 0);
219 if (fHits == 0x0) fHits = new TClonesArray("AliSTARThit", 405);
222 AliDetector::MakeBranch(option);
225 digits = new AliSTARTdigit();
226 MakeBranchInTree(fLoader->TreeD(), branchname, "AliSTARTdigit", digits, buffersize, 1, 0);
230 //_____________________________________________________________________________
231 void AliSTART::ResetHits()
233 AliDetector::ResetHits();
236 if (fPhotons) fPhotons->Clear();
239 //_____________________________________________________________________________
240 void AliSTART::SetTreeAddress()
250 if (fPhotons == 0x0) fPhotons = new TClonesArray("AliSTARThitPhoton", 10000);
251 branch = treeH->GetBranch("STARThitPhoton");
252 if (branch) branch->SetAddress(&fPhotons);
253 if (fHits == 0x0) fHits = new TClonesArray("AliSTARThit", 405);
256 AliDetector::SetTreeAddress();
260 //______________________________________________________________________
261 AliLoader* AliSTART::MakeLoader(const char* topfoldername)
263 Info("MakeLoader", "Creating AliSTARTLoader. Top folder is %s.", topfoldername);
264 fLoader = new AliSTARTLoader(GetName(), topfoldername);
268 //_____________________________________________________________________________
269 AliDigitizer* AliSTART::CreateDigitizer(AliRunDigitizer* manager) const
271 return new AliSTARTDigitizer(manager);
274 //_____________________________________________________________________________
275 void AliSTART::FillESD(AliESD* pESD) const
278 reco.Reconstruct(fLoader->GetRunLoader(), pESD);