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)
34 AliFastDetector::AliFastDetector()
36 // Default Constructor
37 fName = "FastDetector";
38 fTitle = "Fast Detector Base Class";
46 AliFastDetector::AliFastDetector(char* Name, char* Title):
50 fSubdetectors = new TList();
51 fResponses = new TList();
54 AliFastDetector::AliFastDetector(const AliFastDetector & det)
61 AliFastDetector::~AliFastDetector()
69 void AliFastDetector::Init()
74 TIter nextRes(fResponses);
77 // Loop over responses and initialize
78 while((res = (AliFastResponse*)nextRes())) {
82 TIter nextDet(fSubdetectors);
85 // Loop over subdetectors and initialize
86 while((det = (AliFastDetector*)nextDet())) {
92 if ((obj = fResponses->FindObject("Efficiency")))
95 fEfficiency = (AliFastResponse*) obj;
96 printf("Detector %s provides Efficiency: %s\n",
97 fName.Data(), fEfficiency->GetTitle());
100 if ((obj = fResponses->FindObject("Resolution")))
102 fResolution = (AliFastResponse*) obj;
103 printf("Detector %s provides Resolution: %s\n",
104 fName.Data(), fResolution->GetTitle());
108 Float_t AliFastDetector::EvaluateEfficiency(AliFastParticle* part)
111 // Evaluate the efficiency for detecting particle part
113 TIter nextDet(fSubdetectors);
114 AliFastDetector *det;
116 // Loop over subdetectors
118 while((det = (AliFastDetector*)nextDet())) {
119 eff *= det->EvaluateEfficiency(part);
124 Bool_t AliFastDetector::EvaluateAcceptance(AliFastParticle* part)
127 // Loop over subdetectors
131 TIter nextDet(fSubdetectors);
132 AliFastDetector *det;
133 while((det = (AliFastDetector*)nextDet()) && !acc) {
134 acc = (acc || det->EvaluateAcceptance(part));
138 acc = fGeometry->Impact((TParticle*) part);
144 void AliFastDetector::EvaluateResponse(AliFastParticle* /*part*/)
149 void AliFastDetector::
150 AddSubdetector(AliFastDetector *Detector, char* /*Name*/)
153 // Add detector to list
154 fSubdetectors->Add(Detector);
159 void AliFastDetector::
160 AddResponse(AliFastResponse *Response)
163 // Add detector to list
164 fResponses->Add(Response);
168 AliFastDetector* AliFastDetector::FirstSubdetector()
170 // Iterator over generators: Initialisation
171 fLnkD = fSubdetectors->FirstLink();
173 return (AliFastDetector*) (fLnkD->GetObject());
179 AliFastDetector* AliFastDetector::NextSubdetector()
181 // Iterator over generators: Increment
182 fLnkD = fLnkD->Next();
184 return (AliFastDetector*) (fLnkD->GetObject());
191 AliFastResponse* AliFastDetector::FirstResponse()
193 // Iterator over generators: Initialisation
194 fLnkR = fResponses->FirstLink();
196 return (AliFastResponse*) (fLnkR->GetObject());
202 AliFastResponse* AliFastDetector::NextResponse()
204 // Iterator over generators: Increment
205 fLnkR = fLnkR->Next();
207 return (AliFastResponse*) (fLnkR->GetObject());
214 AliFastDetector& AliFastDetector::operator=(const AliFastDetector& rhs)
216 // Assignment operator
221 void AliFastDetector::Copy(TObject&) const
226 Fatal("Copy","Not implemented!\n");