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 **************************************************************************/
21 #include "AliFastDetector.h"
22 #include "AliFastResponse.h"
23 #include "AliGeometry.h"
26 #include <TIterator.h>
29 ClassImp(AliFastDetector)
30 AliFastDetector::AliFastDetector()
32 // Default Constructor
33 fName = "FastDetector";
34 fTitle = "Fast Detector Base Class";
42 AliFastDetector::AliFastDetector(char* Name, char* Title):
46 fSubdetectors = new TList();
47 fResponses = new TList();
50 AliFastDetector::~AliFastDetector()
58 void AliFastDetector::Init()
63 TIter nextRes(fResponses);
66 // Loop over responses and initialize
67 while((res = (AliFastResponse*)nextRes())) {
71 TIter nextDet(fSubdetectors);
74 // Loop over subdetectors and initialize
75 while((det = (AliFastDetector*)nextDet())) {
81 if ((obj = fResponses->FindObject("Efficiency")))
84 fEfficiency = (AliFastResponse*) obj;
85 printf("Detector %s provides Efficiency: %s\n",
86 fName.Data(), fEfficiency->GetTitle());
89 if ((obj = fResponses->FindObject("Resolution")))
91 fResolution = (AliFastResponse*) obj;
92 printf("Detector %s provides Resolution: %s\n",
93 fName.Data(), fResolution->GetTitle());
97 Float_t AliFastDetector::EvaluateEfficiency(AliFastParticle* part)
99 TIter nextDet(fSubdetectors);
100 AliFastDetector *det;
102 // Loop over subdetectors
104 while((det = (AliFastDetector*)nextDet())) {
105 eff *= det->EvaluateEfficiency(part);
110 Bool_t AliFastDetector::EvaluateAcceptance(AliFastParticle* part)
113 // Loop over subdetectors
117 TIter nextDet(fSubdetectors);
118 AliFastDetector *det;
119 while((det = (AliFastDetector*)nextDet()) && !acc) {
120 acc = (acc || det->EvaluateAcceptance(part));
124 acc = fGeometry->Impact((TParticle*) part);
130 void AliFastDetector::EvaluateResponse(AliFastParticle* part)
135 void AliFastDetector::
136 AddSubdetector(AliFastDetector *Detector, char* Name)
139 // Add detector to list
140 fSubdetectors->Add(Detector);
145 void AliFastDetector::
146 AddResponse(AliFastResponse *Response)
149 // Add detector to list
150 fResponses->Add(Response);
154 AliFastDetector* AliFastDetector::FirstSubdetector()
156 // Iterator over generators: Initialisation
157 fLnkD = fSubdetectors->FirstLink();
159 return (AliFastDetector*) (fLnkD->GetObject());
165 AliFastDetector* AliFastDetector::NextSubdetector()
167 // Iterator over generators: Increment
168 fLnkD = fLnkD->Next();
170 return (AliFastDetector*) (fLnkD->GetObject());
177 AliFastResponse* AliFastDetector::FirstResponse()
179 // Iterator over generators: Initialisation
180 fLnkR = fResponses->FirstLink();
182 return (AliFastResponse*) (fLnkR->GetObject());
188 AliFastResponse* AliFastDetector::NextResponse()
190 // Iterator over generators: Increment
191 fLnkR = fLnkR->Next();
193 return (AliFastResponse*) (fLnkR->GetObject());