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 // Base class for fast simulation of a detctor
19 // or a system of subdetectors.
20 // The detector response is described by resolution and efficiency.
23 // andreas.morsch@cern.ch
25 #include "AliFastDetector.h"
26 #include "AliFastResponse.h"
27 #include "AliGeometry.h"
30 #include <TIterator.h>
33 ClassImp(AliFastDetector)
36 AliFastDetector::AliFastDetector():
45 // Default Constructor
46 fName = "FastDetector";
47 fTitle = "Fast Detector Base Class";
50 AliFastDetector::AliFastDetector(char* Name, char* Title):
63 AliFastDetector::AliFastDetector(const AliFastDetector & det)
77 AliFastDetector::~AliFastDetector()
85 void AliFastDetector::Init()
90 TIter nextRes(fResponses);
93 // Loop over responses and initialize
94 while((res = (AliFastResponse*)nextRes())) {
98 TIter nextDet(fSubdetectors);
101 // Loop over subdetectors and initialize
102 while((det = (AliFastDetector*)nextDet())) {
108 if ((obj = fResponses->FindObject("Efficiency")))
111 fEfficiency = (AliFastResponse*) obj;
112 printf("Detector %s provides Efficiency: %s\n",
113 fName.Data(), fEfficiency->GetTitle());
116 if ((obj = fResponses->FindObject("Resolution")))
118 fResolution = (AliFastResponse*) obj;
119 printf("Detector %s provides Resolution: %s\n",
120 fName.Data(), fResolution->GetTitle());
124 Float_t AliFastDetector::EvaluateEfficiency(AliFastParticle* part)
127 // Evaluate the efficiency for detecting particle part
129 TIter nextDet(fSubdetectors);
130 AliFastDetector *det;
132 // Loop over subdetectors
134 while((det = (AliFastDetector*)nextDet())) {
135 eff *= det->EvaluateEfficiency(part);
140 Bool_t AliFastDetector::EvaluateAcceptance(AliFastParticle* part)
143 // Loop over subdetectors
147 TIter nextDet(fSubdetectors);
148 AliFastDetector *det;
149 while((det = (AliFastDetector*)nextDet()) && !acc) {
150 acc = (acc || det->EvaluateAcceptance(part));
154 acc = fGeometry->Impact((TParticle*) part);
160 void AliFastDetector::EvaluateResponse(AliFastParticle* /*part*/)
165 void AliFastDetector::
166 AddSubdetector(AliFastDetector *Detector, char* /*Name*/)
169 // Add detector to list
170 fSubdetectors->Add(Detector);
175 void AliFastDetector::
176 AddResponse(AliFastResponse *Response)
179 // Add detector to list
180 fResponses->Add(Response);
184 AliFastDetector* AliFastDetector::FirstSubdetector()
186 // Iterator over generators: Initialisation
187 fLnkD = fSubdetectors->FirstLink();
189 return (AliFastDetector*) (fLnkD->GetObject());
195 AliFastDetector* AliFastDetector::NextSubdetector()
197 // Iterator over generators: Increment
198 fLnkD = fLnkD->Next();
200 return (AliFastDetector*) (fLnkD->GetObject());
207 AliFastResponse* AliFastDetector::FirstResponse()
209 // Iterator over generators: Initialisation
210 fLnkR = fResponses->FirstLink();
212 return (AliFastResponse*) (fLnkR->GetObject());
218 AliFastResponse* AliFastDetector::NextResponse()
220 // Iterator over generators: Increment
221 fLnkR = fLnkR->Next();
223 return (AliFastResponse*) (fLnkR->GetObject());
230 AliFastDetector& AliFastDetector::operator=(const AliFastDetector& rhs)
232 // Assignment operator
237 void AliFastDetector::Copy(TObject&) const
242 Fatal("Copy","Not implemented!\n");