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 // --- MUON includes ---
19 #include "AliMUONChamber.h"
20 #include "AliMUONChamberGeometry.h"
22 // --- ROOT includes ---
27 ClassImp(AliMUONChamber)
29 AliMUONChamber::AliMUONChamber()
31 // Default constructor
39 // to avoid mistakes if ChargeCorrelInit is not called
43 AliMUONChamber::AliMUONChamber(Int_t id)
45 // Construtor with chamber id
46 fSegmentation = new TObjArray(2);
47 fSegmentation->AddAt(0,0);
48 fSegmentation->AddAt(0,1);
50 fGeometry = new AliMUONChamberGeometry(fId);
54 // to avoid mistakes if ChargeCorrelInit is not called
58 AliMUONChamber::~AliMUONChamber()
62 fSegmentation->Delete();
67 AliMUONChamber::AliMUONChamber(const AliMUONChamber& rChamber):TObject(rChamber)
69 // Dummy copy constructor
74 Bool_t AliMUONChamber::IsSensId(Int_t volId) const
76 // Returns true if the volume specified by volId is in the list
77 // of sesitive volumes for this chamber
79 return fGeometry->IsSensitiveVolume(volId);
82 void AliMUONChamber::Init()
86 // ... for chamber segmentation
87 //PH if ((*fSegmentation)[0])
88 //PH ((AliSegmentation *) (*fSegmentation)[0])->Init(fId);
89 if (fSegmentation->At(0))
90 ((AliSegmentation *) fSegmentation->At(0))->Init(fId);
93 //PH if ((*fSegmentation)[1])
94 //PH ((AliSegmentation *) (*fSegmentation)[1])->Init(fId);
95 if (fSegmentation->At(1))
96 ((AliSegmentation *) fSegmentation->At(1))->Init(fId);
100 Int_t AliMUONChamber::SigGenCond(Float_t x, Float_t y, Float_t z)
102 // Ask segmentation if signal should be generated
104 //PH return ((AliSegmentation*) (*fSegmentation)[0])
105 return ((AliSegmentation*) fSegmentation->At(0))
106 ->SigGenCond(x, y, z) ;
108 //PH return (((AliSegmentation*) (*fSegmentation)[0])
109 return (((AliSegmentation*) fSegmentation->At(0))
110 ->SigGenCond(x, y, z)) ||
111 //PH (((AliSegmentation*) (*fSegmentation)[1])
112 (((AliSegmentation*) fSegmentation->At(1))
113 ->SigGenCond(x, y, z)) ;
118 void AliMUONChamber::SigGenInit(Float_t x, Float_t y, Float_t z)
121 // Initialisation of segmentation for hit
124 //PH ((AliSegmentation*) (*fSegmentation)[0])->SigGenInit(x, y, z) ;
125 ((AliSegmentation*) fSegmentation->At(0))->SigGenInit(x, y, z) ;
127 //PH ((AliSegmentation*) (*fSegmentation)[0])->SigGenInit(x, y, z) ;
128 //PH ((AliSegmentation*) (*fSegmentation)[1])->SigGenInit(x, y, z) ;
129 ((AliSegmentation*) fSegmentation->At(0))->SigGenInit(x, y, z) ;
130 ((AliSegmentation*) fSegmentation->At(1))->SigGenInit(x, y, z) ;
134 void AliMUONChamber::ChargeCorrelationInit() {
135 // Initialisation of charge correlation for current hit
136 // the value is stored, and then used by Disintegration
140 // exponential is here to avoid eventual problems in 0
141 // factor 2 because chargecorrel is q1/q2 and not q1/qtrue
142 fCurrentCorrel = TMath::Exp(gRandom->Gaus(0,fResponse->ChargeCorrel()/2));
145 void AliMUONChamber::DisIntegration(Float_t eloss, Float_t /*tof*/,
146 Float_t xhit, Float_t yhit, Float_t zhit,
147 Int_t& nnew,Float_t newclust[6][500])
150 // Generates pad hits (simulated cluster)
151 // using the segmentation and the response model
154 // Width of the integration area
156 dx=fResponse->SigmaIntegration()*fResponse->ChargeSpreadX();
157 dy=fResponse->SigmaIntegration()*fResponse->ChargeSpreadY();
159 // Get pulse height from energy loss
160 Float_t qtot = fResponse->IntPH(eloss);
164 Float_t qcheck=0, qp;
167 // Cathode plane loop
168 for (Int_t i=1; i<=fnsec; i++) {
170 Float_t qcath = qtot * (i==1? fCurrentCorrel : 1/fCurrentCorrel);
171 AliSegmentation * segmentation=
172 //PH (AliSegmentation *) (*fSegmentation)[i-1];
173 (AliSegmentation *) fSegmentation->At(i-1);
174 for (segmentation->FirstPad(xhit, yhit, zhit, dx, dy);
175 segmentation->MorePads();
176 segmentation->NextPad())
178 qp=fResponse->IntXY(segmentation);
185 // --- store signal information
186 newclust[0][nnew]=qcath; // total charge
187 newclust[1][nnew]=segmentation->Ix(); // ix-position of pad
188 newclust[2][nnew]=segmentation->Iy(); // iy-position of pad
189 newclust[3][nnew]=qp * qcath; // charge on pad
190 newclust[4][nnew]=segmentation->ISector(); // sector id
191 newclust[5][nnew]=(Float_t) i; // counter
193 // if (i==2) printf("\n i, nnew, q %d %d %f", i, nnew, qp*qcath);
198 } // Cathode plane loop
203 void AliMUONChamber::InitGeo(Float_t /*zpos*/)
207 // 3% radiation length of aluminum (X0=8.9 cm)
212 AliMUONChamber & AliMUONChamber::operator =(const AliMUONChamber& /*rhs*/)
214 // Dummy assignment operator