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 // --- ROOT includes ---
22 // --- MUON includes ---
23 #include "AliMUONChamber.h"
24 #include "AliMUONGeometryModule.h"
27 ClassImp(AliMUONChamber)
29 AliMUONChamber::AliMUONChamber()
38 fCurrentCorrel(1), // to avoid mistakes if ChargeCorrelInit is not called
44 // Default constructor
47 AliMUONChamber::AliMUONChamber(Int_t id)
56 fCurrentCorrel(1), // to avoid mistakes if ChargeCorrelInit is not called
62 // Construtor with chamber id
63 fSegmentation = new TObjArray(2);
64 fSegmentation->AddAt(0,0);
65 fSegmentation->AddAt(0,1);
67 fGeometry = new AliMUONGeometryModule(fId);
70 AliMUONChamber::AliMUONChamber(const AliMUONChamber& rChamber)
73 // Protected copy constructor
75 AliFatal("Not implemented.");
76 // Dummy copy constructor
79 AliMUONChamber::~AliMUONChamber()
83 fSegmentation->Delete();
89 AliMUONChamber & AliMUONChamber::operator =(const AliMUONChamber& rhs)
91 // Protected assignement operator
93 if (this == &rhs) return *this;
95 AliFatal("Not implemented.");
100 Bool_t AliMUONChamber::IsSensId(Int_t volId) const
102 // Returns true if the volume specified by volId is in the list
103 // of sesitive volumes for this chamber
105 return fGeometry->IsSensitiveVolume(volId);
108 void AliMUONChamber::Init()
112 // ... for chamber segmentation
113 //PH if ((*fSegmentation)[0])
114 //PH ((AliSegmentation *) (*fSegmentation)[0])->Init(fId);
115 if (fSegmentation->At(0))
116 ((AliSegmentation *) fSegmentation->At(0))->Init(fId);
119 //PH if ((*fSegmentation)[1])
120 //PH ((AliSegmentation *) (*fSegmentation)[1])->Init(fId);
121 if (fSegmentation->At(1))
122 ((AliSegmentation *) fSegmentation->At(1))->Init(fId);
126 Int_t AliMUONChamber::SigGenCond(Float_t x, Float_t y, Float_t z)
128 // Ask segmentation if signal should be generated
130 //PH return ((AliSegmentation*) (*fSegmentation)[0])
131 return ((AliSegmentation*) fSegmentation->At(0))
132 ->SigGenCond(x, y, z) ;
134 //PH return (((AliSegmentation*) (*fSegmentation)[0])
135 return (((AliSegmentation*) fSegmentation->At(0))
136 ->SigGenCond(x, y, z)) ||
137 //PH (((AliSegmentation*) (*fSegmentation)[1])
138 (((AliSegmentation*) fSegmentation->At(1))
139 ->SigGenCond(x, y, z)) ;
144 void AliMUONChamber::SigGenInit(Float_t x, Float_t y, Float_t z)
147 // Initialisation of segmentation for hit
150 //PH ((AliSegmentation*) (*fSegmentation)[0])->SigGenInit(x, y, z) ;
151 ((AliSegmentation*) fSegmentation->At(0))->SigGenInit(x, y, z) ;
153 //PH ((AliSegmentation*) (*fSegmentation)[0])->SigGenInit(x, y, z) ;
154 //PH ((AliSegmentation*) (*fSegmentation)[1])->SigGenInit(x, y, z) ;
155 ((AliSegmentation*) fSegmentation->At(0))->SigGenInit(x, y, z) ;
156 ((AliSegmentation*) fSegmentation->At(1))->SigGenInit(x, y, z) ;
160 void AliMUONChamber::ChargeCorrelationInit() {
161 // Initialisation of charge correlation for current hit
162 // the value is stored, and then used by Disintegration
166 // exponential is here to avoid eventual problems in 0
167 // factor 2 because chargecorrel is q1/q2 and not q1/qtrue
168 fCurrentCorrel = TMath::Exp(gRandom->Gaus(0,fResponse->ChargeCorrel()/2));
171 void AliMUONChamber::DisIntegration(Float_t eloss, Float_t /*tof*/,
172 Float_t xhit, Float_t yhit, Float_t zhit,
173 Int_t& nnew,Float_t newclust[6][500])
176 // Generates pad hits (simulated cluster)
177 // using the segmentation and the response model
180 // Width of the integration area
182 dx=fResponse->SigmaIntegration()*fResponse->ChargeSpreadX();
183 dy=fResponse->SigmaIntegration()*fResponse->ChargeSpreadY();
185 // Get pulse height from energy loss
186 Float_t qtot = fResponse->IntPH(eloss);
193 // Cathode plane loop
194 for (Int_t i=1; i<=fnsec; i++) {
195 Float_t qcath = qtot * (i==1? fCurrentCorrel : 1/fCurrentCorrel);
196 AliSegmentation * segmentation=
197 //PH (AliSegmentation *) (*fSegmentation)[i-1];
198 (AliSegmentation *) fSegmentation->At(i-1);
199 for (segmentation->FirstPad(xhit, yhit, zhit, dx, dy);
200 segmentation->MorePads();
201 segmentation->NextPad())
203 qp=fResponse->IntXY(segmentation);
209 if (nnew >= 500) // Perform a bounds check on nnew since it is assumed
210 // newclust only contains 500 elements.
212 AliError("Limit of 500 pad responses reached.");
216 // --- store signal information
217 newclust[0][nnew]=qcath; // total charge
218 newclust[1][nnew]=segmentation->Ix(); // ix-position of pad
219 newclust[2][nnew]=segmentation->Iy(); // iy-position of pad
220 newclust[3][nnew]=qp * qcath; // charge on pad
221 newclust[4][nnew]=segmentation->ISector(); // sector id
222 newclust[5][nnew]=(Float_t) i; // counter
228 } // Cathode plane loop
233 void AliMUONChamber::InitGeo(Float_t /*zpos*/)
237 // 3% radiation length of aluminum (X0=8.9 cm)