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"
21 // --- ROOT includes ---
26 ClassImp(AliMUONChamber)
28 AliMUONChamber::AliMUONChamber()
30 // Default constructor
36 // to avoid mistakes if ChargeCorrelInit is not called
40 AliMUONChamber::AliMUONChamber(Int_t id)
42 // Construtor with chamber id
43 fSegmentation = new TObjArray(2);
44 fSegmentation->AddAt(0,0);
45 fSegmentation->AddAt(0,1);
50 // to avoid mistakes if ChargeCorrelInit is not called
54 AliMUONChamber::~AliMUONChamber()
58 fSegmentation->Delete();
63 AliMUONChamber::AliMUONChamber(const AliMUONChamber& rChamber):TObject(rChamber)
65 // Dummy copy constructor
70 void AliMUONChamber::Init()
74 // ... for chamber segmentation
75 //PH if ((*fSegmentation)[0])
76 //PH ((AliSegmentation *) (*fSegmentation)[0])->Init(fId);
77 if (fSegmentation->At(0))
78 ((AliSegmentation *) fSegmentation->At(0))->Init(fId);
81 //PH if ((*fSegmentation)[1])
82 //PH ((AliSegmentation *) (*fSegmentation)[1])->Init(fId);
83 if (fSegmentation->At(1))
84 ((AliSegmentation *) fSegmentation->At(1))->Init(fId);
88 Int_t AliMUONChamber::SigGenCond(Float_t x, Float_t y, Float_t z)
90 // Ask segmentation if signal should be generated
92 //PH return ((AliSegmentation*) (*fSegmentation)[0])
93 return ((AliSegmentation*) fSegmentation->At(0))
94 ->SigGenCond(x, y, z) ;
96 //PH return (((AliSegmentation*) (*fSegmentation)[0])
97 return (((AliSegmentation*) fSegmentation->At(0))
98 ->SigGenCond(x, y, z)) ||
99 //PH (((AliSegmentation*) (*fSegmentation)[1])
100 (((AliSegmentation*) fSegmentation->At(1))
101 ->SigGenCond(x, y, z)) ;
106 void AliMUONChamber::SigGenInit(Float_t x, Float_t y, Float_t z)
109 // Initialisation of segmentation for hit
112 //PH ((AliSegmentation*) (*fSegmentation)[0])->SigGenInit(x, y, z) ;
113 ((AliSegmentation*) fSegmentation->At(0))->SigGenInit(x, y, z) ;
115 //PH ((AliSegmentation*) (*fSegmentation)[0])->SigGenInit(x, y, z) ;
116 //PH ((AliSegmentation*) (*fSegmentation)[1])->SigGenInit(x, y, z) ;
117 ((AliSegmentation*) fSegmentation->At(0))->SigGenInit(x, y, z) ;
118 ((AliSegmentation*) fSegmentation->At(1))->SigGenInit(x, y, z) ;
122 void AliMUONChamber::ChargeCorrelationInit() {
123 // Initialisation of charge correlation for current hit
124 // the value is stored, and then used by Disintegration
128 // exponential is here to avoid eventual problems in 0
129 // factor 2 because chargecorrel is q1/q2 and not q1/qtrue
130 fCurrentCorrel = TMath::Exp(gRandom->Gaus(0,fResponse->ChargeCorrel()/2));
133 void AliMUONChamber::DisIntegration(Float_t eloss, Float_t /*tof*/,
134 Float_t xhit, Float_t yhit, Float_t zhit,
135 Int_t& nnew,Float_t newclust[6][500])
138 // Generates pad hits (simulated cluster)
139 // using the segmentation and the response model
142 // Width of the integration area
144 dx=fResponse->SigmaIntegration()*fResponse->ChargeSpreadX();
145 dy=fResponse->SigmaIntegration()*fResponse->ChargeSpreadY();
147 // Get pulse height from energy loss
148 Float_t qtot = fResponse->IntPH(eloss);
152 Float_t qcheck=0, qp;
155 // Cathode plane loop
156 for (Int_t i=1; i<=fnsec; i++) {
158 Float_t qcath = qtot * (i==1? fCurrentCorrel : 1/fCurrentCorrel);
159 AliSegmentation * segmentation=
160 //PH (AliSegmentation *) (*fSegmentation)[i-1];
161 (AliSegmentation *) fSegmentation->At(i-1);
162 for (segmentation->FirstPad(xhit, yhit, zhit, dx, dy);
163 segmentation->MorePads();
164 segmentation->NextPad())
166 qp=fResponse->IntXY(segmentation);
173 // --- store signal information
174 newclust[0][nnew]=qcath; // total charge
175 newclust[1][nnew]=segmentation->Ix(); // ix-position of pad
176 newclust[2][nnew]=segmentation->Iy(); // iy-position of pad
177 newclust[3][nnew]=qp * qcath; // charge on pad
178 newclust[4][nnew]=segmentation->ISector(); // sector id
179 newclust[5][nnew]=(Float_t) i; // counter
181 // if (i==2) printf("\n i, nnew, q %d %d %f", i, nnew, qp*qcath);
186 } // Cathode plane loop
191 void AliMUONChamber::InitGeo(Float_t /*zpos*/)
195 // 3% radiation length of aluminum (X0=8.9 cm)
200 AliMUONChamber & AliMUONChamber::operator =(const AliMUONChamber& /*rhs*/)
202 // Dummy assignment operator