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 Revision 1.1 2002/09/20 13:32:51 morsch
19 Base classes for fast simulation. First commit.
24 #include "AliFastDetector.h"
25 #include "AliFastResponse.h"
26 #include "AliGeometry.h"
29 #include <TIterator.h>
32 ClassImp(AliFastDetector)
33 AliFastDetector::AliFastDetector()
35 // Default Constructor
36 fName = "FastDetector";
37 fTitle = "Fast Detector Base Class";
45 AliFastDetector::AliFastDetector(char* Name, char* Title):
49 fSubdetectors = new TList();
50 fResponses = new TList();
53 AliFastDetector::~AliFastDetector()
61 void AliFastDetector::Init()
66 TIter nextRes(fResponses);
69 // Loop over responses and initialize
70 while((res = (AliFastResponse*)nextRes())) {
74 TIter nextDet(fSubdetectors);
77 // Loop over subdetectors and initialize
78 while((det = (AliFastDetector*)nextDet())) {
84 if ((obj = fResponses->FindObject("Efficiency")))
87 fEfficiency = (AliFastResponse*) obj;
88 printf("Detector %s provides Efficiency: %s\n",
89 fName.Data(), fEfficiency->GetTitle());
92 if ((obj = fResponses->FindObject("Resolution")))
94 fResolution = (AliFastResponse*) obj;
95 printf("Detector %s provides Resolution: %s\n",
96 fName.Data(), fResolution->GetTitle());
100 Float_t AliFastDetector::EvaluateEfficiency(AliFastParticle* part)
102 TIter nextDet(fSubdetectors);
103 AliFastDetector *det;
105 // Loop over subdetectors
107 while((det = (AliFastDetector*)nextDet())) {
108 eff *= det->EvaluateEfficiency(part);
113 Bool_t AliFastDetector::EvaluateAcceptance(AliFastParticle* part)
116 // Loop over subdetectors
120 TIter nextDet(fSubdetectors);
121 AliFastDetector *det;
122 while((det = (AliFastDetector*)nextDet()) && !acc) {
123 acc = (acc || det->EvaluateAcceptance(part));
127 acc = fGeometry->Impact((TParticle*) part);
133 void AliFastDetector::EvaluateResponse(AliFastParticle* part)
138 void AliFastDetector::
139 AddSubdetector(AliFastDetector *Detector, char* Name)
142 // Add detector to list
143 fSubdetectors->Add(Detector);
148 void AliFastDetector::
149 AddResponse(AliFastResponse *Response)
152 // Add detector to list
153 fResponses->Add(Response);
157 AliFastDetector* AliFastDetector::FirstSubdetector()
159 // Iterator over generators: Initialisation
160 fLnkD = fSubdetectors->FirstLink();
162 return (AliFastDetector*) (fLnkD->GetObject());
168 AliFastDetector* AliFastDetector::NextSubdetector()
170 // Iterator over generators: Increment
171 fLnkD = fLnkD->Next();
173 return (AliFastDetector*) (fLnkD->GetObject());
180 AliFastResponse* AliFastDetector::FirstResponse()
182 // Iterator over generators: Initialisation
183 fLnkR = fResponses->FirstLink();
185 return (AliFastResponse*) (fLnkR->GetObject());
191 AliFastResponse* AliFastDetector::NextResponse()
193 // Iterator over generators: Increment
194 fLnkR = fLnkR->Next();
196 return (AliFastResponse*) (fLnkR->GetObject());