]>
Commit | Line | Data |
---|---|---|
b9746a9e | 1 | /*************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
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 | **************************************************************************/ | |
b2b13ee2 | 15 | //-----------------------------------------------------// |
16 | // // | |
8599803d | 17 | // Source File : PMDDigitizer.cxx, Version 00 // |
b2b13ee2 | 18 | // // |
19 | // Date : September 20 2002 // | |
20 | // // | |
21 | //-----------------------------------------------------// | |
22 | ||
36031625 | 23 | #include <Riostream.h> |
b2b13ee2 | 24 | #include <TBRIK.h> |
25 | #include <TNode.h> | |
26 | #include <TTree.h> | |
27 | #include <TGeometry.h> | |
28 | #include <TObjArray.h> | |
29 | #include <TClonesArray.h> | |
30 | #include <TFile.h> | |
31 | #include <TNtuple.h> | |
32 | #include <TParticle.h> | |
e939a978 | 33 | #include <TRandom.h> |
b2b13ee2 | 34 | |
ecee2a1a | 35 | #include "AliLog.h" |
b2b13ee2 | 36 | #include "AliRun.h" |
b2b13ee2 | 37 | #include "AliHit.h" |
38 | #include "AliDetector.h" | |
39 | #include "AliRunLoader.h" | |
40 | #include "AliLoader.h" | |
41 | #include "AliConfig.h" | |
42 | #include "AliMagF.h" | |
43 | #include "AliRunDigitizer.h" | |
7088dbe9 | 44 | #include "AliDigitizer.h" |
b2b13ee2 | 45 | #include "AliHeader.h" |
09a06455 | 46 | #include "AliCDBManager.h" |
47 | #include "AliCDBStorage.h" | |
48 | #include "AliCDBEntry.h" | |
49 | #include "AliMC.h" | |
b2b13ee2 | 50 | |
09a06455 | 51 | #include "AliPMD.h" |
52 | #include "AliPMDhit.h" | |
b2b13ee2 | 53 | #include "AliPMDcell.h" |
54 | #include "AliPMDsdigit.h" | |
55 | #include "AliPMDdigit.h" | |
09a06455 | 56 | #include "AliPMDCalibData.h" |
35535af7 | 57 | #include "AliPMDPedestal.h" |
b2b13ee2 | 58 | #include "AliPMDDigitizer.h" |
09a06455 | 59 | |
b2b13ee2 | 60 | |
61 | ClassImp(AliPMDDigitizer) | |
a7d110b8 | 62 | |
01960205 | 63 | AliPMDDigitizer::AliPMDDigitizer() : |
64 | fRunLoader(0), | |
65 | fPMDHit(0), | |
66 | fPMD(0), | |
67 | fPMDLoader(0), | |
35535af7 | 68 | fCalibGain(GetCalibGain()), |
69 | fCalibPed(GetCalibPed()), | |
ebd83c56 | 70 | fSDigits(0), |
71 | fDigits(0), | |
4d59e381 | 72 | fCPVCell(0), |
ebd83c56 | 73 | fCell(0), |
01960205 | 74 | fNsdigit(0), |
75 | fNdigit(0), | |
76 | fDetNo(0), | |
2332574a | 77 | fZPos(361.5) // in units of cm, default position of PMD |
b2b13ee2 | 78 | { |
36031625 | 79 | // Default Constructor |
80 | // | |
36031625 | 81 | for (Int_t i = 0; i < fgkTotUM; i++) |
b2b13ee2 | 82 | { |
36031625 | 83 | for (Int_t j = 0; j < fgkRow; j++) |
b2b13ee2 | 84 | { |
36031625 | 85 | for (Int_t k = 0; k < fgkCol; k++) |
b2b13ee2 | 86 | { |
5e2cc5bc | 87 | fCPV[i][j][k] = 0.; |
88 | fPRE[i][j][k] = 0.; | |
4d59e381 | 89 | fCPVCounter[i][j][k] = 0; |
5e2cc5bc | 90 | fPRECounter[i][j][k] = 0; |
5e2cc5bc | 91 | fCPVTrackNo[i][j][k] = -1; |
4d59e381 | 92 | fPRETrackNo[i][j][k] = -1; |
b2b13ee2 | 93 | } |
94 | } | |
95 | } | |
2332574a | 96 | |
b2b13ee2 | 97 | } |
7088dbe9 | 98 | //____________________________________________________________________________ |
2332574a | 99 | AliPMDDigitizer::AliPMDDigitizer(const AliPMDDigitizer& digitizer): |
100 | AliDigitizer(digitizer), | |
101 | fRunLoader(0), | |
102 | fPMDHit(0), | |
103 | fPMD(0), | |
104 | fPMDLoader(0), | |
35535af7 | 105 | fCalibGain(GetCalibGain()), |
106 | fCalibPed(GetCalibPed()), | |
2332574a | 107 | fSDigits(0), |
108 | fDigits(0), | |
4d59e381 | 109 | fCPVCell(0), |
2332574a | 110 | fCell(0), |
111 | fNsdigit(0), | |
112 | fNdigit(0), | |
113 | fDetNo(0), | |
114 | fZPos(361.5) // in units of cm, default position of PMD | |
a48edddd | 115 | { |
116 | // copy constructor | |
117 | AliError("Copy constructor not allowed "); | |
118 | ||
119 | } | |
120 | //____________________________________________________________________________ | |
a48edddd | 121 | AliPMDDigitizer & AliPMDDigitizer::operator=(const AliPMDDigitizer& /*digitizer*/) |
122 | { | |
123 | // Assignment operator | |
124 | AliError("Assignement operator not allowed "); | |
125 | ||
126 | return *this; | |
127 | } | |
128 | //____________________________________________________________________________ | |
2332574a | 129 | AliPMDDigitizer::AliPMDDigitizer(AliRunDigitizer* manager): |
130 | AliDigitizer(manager), | |
ebd83c56 | 131 | fRunLoader(0), |
132 | fPMDHit(0), | |
133 | fPMD(0), | |
134 | fPMDLoader(0), | |
35535af7 | 135 | fCalibGain(GetCalibGain()), |
136 | fCalibPed(GetCalibPed()), | |
ebd83c56 | 137 | fSDigits(new TClonesArray("AliPMDsdigit", 1000)), |
138 | fDigits(new TClonesArray("AliPMDdigit", 1000)), | |
4d59e381 | 139 | fCPVCell(0), |
ebd83c56 | 140 | fCell(0), |
ebd83c56 | 141 | fNsdigit(0), |
142 | fNdigit(0), | |
143 | fDetNo(0), | |
144 | fZPos(361.5)// in units of cm, This is the default position of PMD | |
7088dbe9 | 145 | { |
146 | // ctor which should be used | |
147 | ||
09a06455 | 148 | |
ebd83c56 | 149 | for (Int_t i = 0; i < fgkTotUM; i++) |
150 | { | |
151 | for (Int_t j = 0; j < fgkRow; j++) | |
152 | { | |
153 | for (Int_t k = 0; k < fgkCol; k++) | |
154 | { | |
5e2cc5bc | 155 | fCPV[i][j][k] = 0.; |
156 | fPRE[i][j][k] = 0.; | |
4d59e381 | 157 | fCPVCounter[i][j][k] = 0; |
5e2cc5bc | 158 | fPRECounter[i][j][k] = 0; |
5e2cc5bc | 159 | fCPVTrackNo[i][j][k] = -1; |
4d59e381 | 160 | fPRETrackNo[i][j][k] = -1; |
ebd83c56 | 161 | } |
162 | } | |
163 | } | |
7088dbe9 | 164 | } |
2332574a | 165 | |
7088dbe9 | 166 | //____________________________________________________________________________ |
b2b13ee2 | 167 | AliPMDDigitizer::~AliPMDDigitizer() |
168 | { | |
36031625 | 169 | // Default Destructor |
170 | // | |
01960205 | 171 | if (fSDigits) { |
172 | fSDigits->Delete(); | |
173 | delete fSDigits; | |
174 | fSDigits=0; | |
175 | } | |
176 | if (fDigits) { | |
177 | fDigits->Delete(); | |
178 | delete fDigits; | |
179 | fDigits=0; | |
180 | } | |
4d59e381 | 181 | fCPVCell.Delete(); |
ebd83c56 | 182 | fCell.Delete(); |
b2b13ee2 | 183 | } |
184 | // | |
185 | // Member functions | |
186 | // | |
7088dbe9 | 187 | //____________________________________________________________________________ |
85a5290f | 188 | void AliPMDDigitizer::OpengAliceFile(const char *file, Option_t *option) |
b2b13ee2 | 189 | { |
36031625 | 190 | // Loads galice.root file and corresponding header, kinematics |
191 | // hits and sdigits or digits depending on the option | |
192 | // | |
f540341d | 193 | |
e191bb57 | 194 | TString evfoldname = AliConfig::GetDefaultEventFolderName(); |
f540341d | 195 | fRunLoader = AliRunLoader::GetRunLoader(evfoldname); |
196 | if (!fRunLoader) | |
5e2cc5bc | 197 | fRunLoader = AliRunLoader::Open(file,AliConfig::GetDefaultEventFolderName(), "UPDATE"); |
b2b13ee2 | 198 | |
199 | if (!fRunLoader) | |
200 | { | |
ecee2a1a | 201 | AliError(Form("Can not open session for file %s.",file)); |
b2b13ee2 | 202 | } |
b2b13ee2 | 203 | |
be9188a5 | 204 | const char *cHS = strstr(option,"HS"); |
205 | const char *cHD = strstr(option,"HD"); | |
206 | const char *cSD = strstr(option,"SD"); | |
b2b13ee2 | 207 | |
be9188a5 | 208 | if(cHS || cHD) |
ecee2a1a | 209 | { |
be9188a5 | 210 | if (!fRunLoader->GetAliRun()) fRunLoader->LoadgAlice(); |
211 | if (!fRunLoader->TreeE()) fRunLoader->LoadHeader(); | |
212 | if (!fRunLoader->TreeK()) fRunLoader->LoadKinematics(); | |
213 | ||
214 | gAlice = fRunLoader->GetAliRun(); | |
215 | ||
216 | if (gAlice) | |
217 | { | |
218 | AliDebug(1,"Alirun object found"); | |
219 | } | |
220 | else | |
221 | { | |
222 | AliError("Could not found Alirun object"); | |
223 | } | |
f540341d | 224 | |
be9188a5 | 225 | fPMD = (AliPMD*)gAlice->GetDetector("PMD"); |
226 | } | |
227 | ||
36031625 | 228 | fPMDLoader = fRunLoader->GetLoader("PMDLoader"); |
229 | if (fPMDLoader == 0x0) | |
b2b13ee2 | 230 | { |
ecee2a1a | 231 | AliError("Can not find PMDLoader"); |
b2b13ee2 | 232 | } |
233 | ||
b2b13ee2 | 234 | |
235 | if (cHS) | |
236 | { | |
36031625 | 237 | fPMDLoader->LoadHits("READ"); |
238 | fPMDLoader->LoadSDigits("recreate"); | |
b2b13ee2 | 239 | } |
240 | else if (cHD) | |
241 | { | |
36031625 | 242 | fPMDLoader->LoadHits("READ"); |
243 | fPMDLoader->LoadDigits("recreate"); | |
b2b13ee2 | 244 | } |
245 | else if (cSD) | |
246 | { | |
36031625 | 247 | fPMDLoader->LoadSDigits("READ"); |
248 | fPMDLoader->LoadDigits("recreate"); | |
b2b13ee2 | 249 | } |
b2b13ee2 | 250 | } |
7088dbe9 | 251 | //____________________________________________________________________________ |
b2b13ee2 | 252 | void AliPMDDigitizer::Hits2SDigits(Int_t ievt) |
253 | { | |
36031625 | 254 | // This reads the PMD Hits tree and assigns the right track number |
255 | // to a cell and stores in the summable digits tree | |
256 | // | |
b2b13ee2 | 257 | |
36031625 | 258 | const Int_t kPi0 = 111; |
259 | const Int_t kGamma = 22; | |
b2b13ee2 | 260 | Int_t npmd; |
261 | Int_t trackno; | |
b2b13ee2 | 262 | Int_t smnumber; |
263 | Int_t trackpid; | |
264 | Int_t mtrackno; | |
265 | Int_t mtrackpid; | |
266 | ||
267 | Float_t xPos, yPos, zPos; | |
8599803d | 268 | Int_t xpad = -1, ypad = -1; |
b2b13ee2 | 269 | Float_t edep; |
270 | Float_t vx = -999.0, vy = -999.0, vz = -999.0; | |
271 | ||
a7d110b8 | 272 | |
ebd83c56 | 273 | if (!fSDigits) fSDigits = new TClonesArray("AliPMDsdigit", 1000); |
b2b13ee2 | 274 | ResetSDigit(); |
275 | ||
ecee2a1a | 276 | AliDebug(1,Form("Event Number = %d",ievt)); |
b2b13ee2 | 277 | Int_t nparticles = fRunLoader->GetHeader()->GetNtrack(); |
ecee2a1a | 278 | AliDebug(1,Form("Number of Particles = %d",nparticles)); |
b2b13ee2 | 279 | fRunLoader->GetEvent(ievt); |
b2b13ee2 | 280 | // ------------------------------------------------------- // |
281 | // Pointer to specific detector hits. | |
282 | // Get pointers to Alice detectors and Hits containers | |
283 | ||
ebd83c56 | 284 | TTree* treeH = fPMDLoader->TreeH(); |
b2b13ee2 | 285 | |
ebd83c56 | 286 | Int_t ntracks = (Int_t) treeH->GetEntries(); |
ecee2a1a | 287 | AliDebug(1,Form("Number of Tracks in the TreeH = %d", ntracks)); |
ebd83c56 | 288 | TTree* treeS = fPMDLoader->TreeS(); |
289 | if (treeS == 0x0) | |
b2b13ee2 | 290 | { |
36031625 | 291 | fPMDLoader->MakeTree("S"); |
ebd83c56 | 292 | treeS = fPMDLoader->TreeS(); |
b2b13ee2 | 293 | } |
294 | Int_t bufsize = 16000; | |
5e2cc5bc | 295 | treeS->Branch("PMDSDigit", &fSDigits, bufsize); |
b2b13ee2 | 296 | |
ebd83c56 | 297 | TClonesArray* hits = 0; |
298 | if (fPMD) hits = fPMD->Hits(); | |
b2b13ee2 | 299 | |
300 | // Start loop on tracks in the hits containers | |
a7d110b8 | 301 | |
5e2cc5bc | 302 | for (Int_t track=0; track<ntracks;track++) |
b2b13ee2 | 303 | { |
b208c6a3 | 304 | gAlice->ResetHits(); |
ebd83c56 | 305 | treeH->GetEvent(track); |
5e2cc5bc | 306 | if (fPMD) |
b2b13ee2 | 307 | { |
ebd83c56 | 308 | npmd = hits->GetEntriesFast(); |
4d59e381 | 309 | for (Int_t ipmd = 0; ipmd < npmd; ipmd++) |
b2b13ee2 | 310 | { |
ebd83c56 | 311 | fPMDHit = (AliPMDhit*) hits->UncheckedAt(ipmd); |
36031625 | 312 | trackno = fPMDHit->GetTrack(); |
b2b13ee2 | 313 | // get kinematics of the particles |
36031625 | 314 | |
ebd83c56 | 315 | TParticle* mparticle = gAlice->GetMCApp()->Particle(trackno); |
316 | trackpid = mparticle->GetPdgCode(); | |
4d59e381 | 317 | Int_t ks = mparticle->GetStatusCode(); |
b2b13ee2 | 318 | Int_t imo; |
36031625 | 319 | Int_t tracknoOld=0, trackpidOld=0, statusOld = 0; |
4d59e381 | 320 | |
8599803d | 321 | if (mparticle->GetFirstMother() == -1) |
322 | { | |
36031625 | 323 | tracknoOld = trackno; |
324 | trackpidOld = trackpid; | |
325 | statusOld = -1; | |
8599803d | 326 | } |
8599803d | 327 | Int_t igstatus = 0; |
4d59e381 | 328 | //------------------modified by Mriganka ---------------------- |
329 | if(ks==1||(imo = mparticle->GetFirstMother())<0 ){ | |
330 | vx = mparticle->Vx(); | |
331 | vy = mparticle->Vy(); | |
332 | vz = mparticle->Vz(); | |
333 | ||
334 | if(trackpid==kGamma||trackpid==11||trackpid==-11|| | |
335 | trackpid==kPi0)igstatus=1; | |
336 | } | |
337 | ||
338 | ||
339 | while(((imo = mparticle->GetFirstMother()) >= 0)&& | |
340 | (ks = mparticle->GetStatusCode() <1) ) | |
b2b13ee2 | 341 | { |
b208c6a3 | 342 | mparticle = gAlice->GetMCApp()->Particle(imo); |
4d59e381 | 343 | trackpid = mparticle->GetPdgCode(); |
344 | ks = mparticle->GetStatusCode(); | |
b2b13ee2 | 345 | vx = mparticle->Vx(); |
346 | vy = mparticle->Vy(); | |
347 | vz = mparticle->Vz(); | |
4d59e381 | 348 | |
349 | trackno=imo; | |
350 | ||
b2b13ee2 | 351 | } |
4d59e381 | 352 | |
353 | if(trackpid==kGamma||trackpid==11||trackpid==-11|| | |
354 | trackpid==kPi0)igstatus=1; | |
355 | mtrackpid=trackpid; | |
356 | mtrackno=trackno; | |
357 | trackpid=trackpidOld; | |
358 | trackno=tracknoOld; | |
359 | ||
360 | //-----------------end of modification---------------- | |
36031625 | 361 | xPos = fPMDHit->X(); |
362 | yPos = fPMDHit->Y(); | |
363 | zPos = fPMDHit->Z(); | |
7088dbe9 | 364 | |
c35544fe | 365 | edep = fPMDHit->GetEnergy(); |
366 | Int_t vol1 = fPMDHit->GetVolume(1); // Column | |
367 | Int_t vol2 = fPMDHit->GetVolume(2); // Row | |
f117e3aa | 368 | Int_t vol7 = fPMDHit->GetVolume(7); // UnitModule |
369 | Int_t vol8 = fPMDHit->GetVolume(8); // SuperModule | |
370 | ||
c35544fe | 371 | |
8599803d | 372 | // -----------------------------------------// |
f117e3aa | 373 | // In new geometry after adding electronics // |
8599803d | 374 | // For Super Module 1 & 2 // |
8599803d | 375 | // nrow = 48, ncol = 96 // |
f117e3aa | 376 | // For Super Module 3 & 4 // |
377 | // nrow = 96, ncol = 48 // | |
8599803d | 378 | // -----------------------------------------// |
f117e3aa | 379 | |
380 | ||
b2b13ee2 | 381 | |
f117e3aa | 382 | smnumber = (vol8-1)*6 + vol7; |
8599803d | 383 | |
f117e3aa | 384 | if (vol8 == 1 || vol8 == 2) |
b2b13ee2 | 385 | { |
36031625 | 386 | xpad = vol2; |
387 | ypad = vol1; | |
b2b13ee2 | 388 | } |
f117e3aa | 389 | else if (vol8 == 3 || vol8 == 4) |
390 | { | |
391 | xpad = vol1; | |
392 | ypad = vol2; | |
393 | } | |
b2b13ee2 | 394 | |
ecee2a1a | 395 | AliDebug(2,Form("Zposition = %f Edeposition = %f",zPos,edep)); |
f117e3aa | 396 | //Float_t zposition = TMath::Abs(zPos); |
397 | if (zPos < fZPos) | |
b2b13ee2 | 398 | { |
399 | // CPV | |
400 | fDetNo = 1; | |
401 | } | |
f117e3aa | 402 | else if (zPos > fZPos) |
b2b13ee2 | 403 | { |
404 | // PMD | |
405 | fDetNo = 0; | |
406 | } | |
8599803d | 407 | Int_t smn = smnumber - 1; |
408 | Int_t ixx = xpad - 1; | |
409 | Int_t iyy = ypad - 1; | |
b2b13ee2 | 410 | if (fDetNo == 0) |
411 | { | |
36031625 | 412 | fPRE[smn][ixx][iyy] += edep; |
413 | fPRECounter[smn][ixx][iyy]++; | |
b2b13ee2 | 414 | |
ebd83c56 | 415 | AliPMDcell* cell = new AliPMDcell(mtrackno,smn,ixx,iyy,edep); |
ebd83c56 | 416 | fCell.Add(cell); |
b2b13ee2 | 417 | } |
418 | else if(fDetNo == 1) | |
419 | { | |
8599803d | 420 | fCPV[smn][ixx][iyy] += edep; |
4d59e381 | 421 | fCPVCounter[smn][ixx][iyy]++; |
422 | AliPMDcell* cpvcell = new AliPMDcell(mtrackno,smn,ixx,iyy,edep); | |
423 | fCPVCell.Add(cpvcell); | |
b2b13ee2 | 424 | } |
425 | } | |
426 | } | |
427 | } // Track Loop ended | |
4d59e381 | 428 | TrackAssignment2CPVCell(); |
b2b13ee2 | 429 | TrackAssignment2Cell(); |
b2b13ee2 | 430 | ResetCell(); |
431 | ||
432 | Float_t deltaE = 0.; | |
433 | Int_t detno = 0; | |
b2b13ee2 | 434 | Int_t trno = -1; |
b2b13ee2 | 435 | |
436 | for (Int_t idet = 0; idet < 2; idet++) | |
437 | { | |
36031625 | 438 | for (Int_t ism = 0; ism < fgkTotUM; ism++) |
b2b13ee2 | 439 | { |
36031625 | 440 | for (Int_t jrow = 0; jrow < fgkRow; jrow++) |
b2b13ee2 | 441 | { |
36031625 | 442 | for (Int_t kcol = 0; kcol < fgkCol; kcol++) |
b2b13ee2 | 443 | { |
b2b13ee2 | 444 | if (idet == 0) |
445 | { | |
36031625 | 446 | deltaE = fPRE[ism][jrow][kcol]; |
447 | trno = fPRETrackNo[ism][jrow][kcol]; | |
b2b13ee2 | 448 | detno = 0; |
449 | } | |
450 | else if (idet == 1) | |
451 | { | |
452 | deltaE = fCPV[ism][jrow][kcol]; | |
453 | trno = fCPVTrackNo[ism][jrow][kcol]; | |
454 | detno = 1; | |
455 | } | |
456 | if (deltaE > 0.) | |
457 | { | |
7088dbe9 | 458 | AddSDigit(trno,detno,ism,jrow,kcol,deltaE); |
b2b13ee2 | 459 | } |
460 | } | |
461 | } | |
ebd83c56 | 462 | treeS->Fill(); |
b2b13ee2 | 463 | ResetSDigit(); |
464 | } | |
465 | } | |
36031625 | 466 | fPMDLoader->WriteSDigits("OVERWRITE"); |
b2b13ee2 | 467 | ResetCellADC(); |
b2b13ee2 | 468 | } |
7088dbe9 | 469 | //____________________________________________________________________________ |
b2b13ee2 | 470 | |
471 | void AliPMDDigitizer::Hits2Digits(Int_t ievt) | |
472 | { | |
36031625 | 473 | // This reads the PMD Hits tree and assigns the right track number |
474 | // to a cell and stores in the digits tree | |
475 | // | |
476 | const Int_t kPi0 = 111; | |
477 | const Int_t kGamma = 22; | |
b2b13ee2 | 478 | Int_t npmd; |
479 | Int_t trackno; | |
b2b13ee2 | 480 | Int_t smnumber; |
481 | Int_t trackpid; | |
482 | Int_t mtrackno; | |
483 | Int_t mtrackpid; | |
484 | ||
485 | Float_t xPos, yPos, zPos; | |
8599803d | 486 | Int_t xpad = -1, ypad = -1; |
b2b13ee2 | 487 | Float_t edep; |
488 | Float_t vx = -999.0, vy = -999.0, vz = -999.0; | |
489 | ||
ebd83c56 | 490 | if (!fDigits) fDigits = new TClonesArray("AliPMDdigit", 1000); |
b2b13ee2 | 491 | ResetDigit(); |
492 | ||
5e2cc5bc | 493 | AliDebug(1,Form("Event Number = %d",ievt)); |
b2b13ee2 | 494 | Int_t nparticles = fRunLoader->GetHeader()->GetNtrack(); |
ecee2a1a | 495 | AliDebug(1,Form("Number of Particles = %d", nparticles)); |
b2b13ee2 | 496 | fRunLoader->GetEvent(ievt); |
b2b13ee2 | 497 | // ------------------------------------------------------- // |
498 | // Pointer to specific detector hits. | |
499 | // Get pointers to Alice detectors and Hits containers | |
500 | ||
b208c6a3 | 501 | fPMD = (AliPMD*)gAlice->GetDetector("PMD"); |
36031625 | 502 | fPMDLoader = fRunLoader->GetLoader("PMDLoader"); |
b2b13ee2 | 503 | |
36031625 | 504 | if (fPMDLoader == 0x0) |
b2b13ee2 | 505 | { |
ecee2a1a | 506 | AliError("Can not find PMD or PMDLoader"); |
b2b13ee2 | 507 | } |
ebd83c56 | 508 | TTree* treeH = fPMDLoader->TreeH(); |
509 | Int_t ntracks = (Int_t) treeH->GetEntries(); | |
ecee2a1a | 510 | AliDebug(1,Form("Number of Tracks in the TreeH = %d", ntracks)); |
36031625 | 511 | fPMDLoader->LoadDigits("recreate"); |
ebd83c56 | 512 | TTree* treeD = fPMDLoader->TreeD(); |
513 | if (treeD == 0x0) | |
b2b13ee2 | 514 | { |
36031625 | 515 | fPMDLoader->MakeTree("D"); |
ebd83c56 | 516 | treeD = fPMDLoader->TreeD(); |
b2b13ee2 | 517 | } |
518 | Int_t bufsize = 16000; | |
5e2cc5bc | 519 | treeD->Branch("PMDDigit", &fDigits, bufsize); |
b2b13ee2 | 520 | |
ebd83c56 | 521 | TClonesArray* hits = 0; |
522 | if (fPMD) hits = fPMD->Hits(); | |
b2b13ee2 | 523 | |
524 | // Start loop on tracks in the hits containers | |
525 | ||
5e2cc5bc | 526 | for (Int_t track=0; track<ntracks;track++) |
b2b13ee2 | 527 | { |
b208c6a3 | 528 | gAlice->ResetHits(); |
ebd83c56 | 529 | treeH->GetEvent(track); |
b2b13ee2 | 530 | |
5e2cc5bc | 531 | if (fPMD) |
b2b13ee2 | 532 | { |
ebd83c56 | 533 | npmd = hits->GetEntriesFast(); |
4d59e381 | 534 | for (Int_t ipmd = 0; ipmd < npmd; ipmd++) |
b2b13ee2 | 535 | { |
ebd83c56 | 536 | fPMDHit = (AliPMDhit*) hits->UncheckedAt(ipmd); |
36031625 | 537 | trackno = fPMDHit->GetTrack(); |
b2b13ee2 | 538 | |
539 | // get kinematics of the particles | |
540 | ||
ebd83c56 | 541 | TParticle* mparticle = gAlice->GetMCApp()->Particle(trackno); |
542 | trackpid = mparticle->GetPdgCode(); | |
4d59e381 | 543 | Int_t ks = mparticle->GetStatusCode(); |
b2b13ee2 | 544 | Int_t imo; |
36031625 | 545 | Int_t tracknoOld=0, trackpidOld=0, statusOld = 0; |
8599803d | 546 | if (mparticle->GetFirstMother() == -1) |
547 | { | |
36031625 | 548 | tracknoOld = trackno; |
549 | trackpidOld = trackpid; | |
550 | statusOld = -1; | |
8599803d | 551 | } |
552 | ||
553 | Int_t igstatus = 0; | |
4d59e381 | 554 | //-----------------------modified by Mriganka ------------------ |
555 | if(ks==1||(imo = mparticle->GetFirstMother())<0 ){ | |
556 | vx = mparticle->Vx(); | |
557 | vy = mparticle->Vy(); | |
558 | vz = mparticle->Vz(); | |
559 | ||
560 | if(trackpid==kGamma||trackpid==11||trackpid==-11||trackpid==kPi0) | |
561 | igstatus=1; | |
562 | } | |
563 | ||
564 | ||
565 | while(((imo = mparticle->GetFirstMother()) >= 0)&& | |
566 | (ks = mparticle->GetStatusCode() <1) ) | |
b2b13ee2 | 567 | { |
b208c6a3 | 568 | mparticle = gAlice->GetMCApp()->Particle(imo); |
4d59e381 | 569 | trackpid = mparticle->GetPdgCode(); |
570 | ks = mparticle->GetStatusCode(); | |
b2b13ee2 | 571 | vx = mparticle->Vx(); |
572 | vy = mparticle->Vy(); | |
573 | vz = mparticle->Vz(); | |
4d59e381 | 574 | |
575 | trackno=imo; | |
576 | ||
b2b13ee2 | 577 | } |
4d59e381 | 578 | |
579 | if(trackpid==kGamma||trackpid==11||trackpid==-11||trackpid==kPi0) | |
580 | igstatus=1; | |
581 | mtrackpid=trackpid; | |
582 | mtrackno=trackno; | |
583 | trackpid=trackpidOld; | |
584 | trackno=tracknoOld; | |
b2b13ee2 | 585 | |
4d59e381 | 586 | //-----------------end of modification---------------- |
36031625 | 587 | xPos = fPMDHit->X(); |
588 | yPos = fPMDHit->Y(); | |
589 | zPos = fPMDHit->Z(); | |
f117e3aa | 590 | edep = fPMDHit->GetEnergy(); |
c35544fe | 591 | Int_t vol1 = fPMDHit->GetVolume(1); // Column |
592 | Int_t vol2 = fPMDHit->GetVolume(2); // Row | |
f117e3aa | 593 | Int_t vol7 = fPMDHit->GetVolume(7); // UnitModule |
594 | Int_t vol8 = fPMDHit->GetVolume(8); // SuperModule | |
595 | ||
8599803d | 596 | |
597 | // -----------------------------------------// | |
f117e3aa | 598 | // In new geometry after adding electronics // |
8599803d | 599 | // For Super Module 1 & 2 // |
8599803d | 600 | // nrow = 48, ncol = 96 // |
f117e3aa | 601 | // For Super Module 3 & 4 // |
602 | // nrow = 96, ncol = 48 // | |
8599803d | 603 | // -----------------------------------------// |
b2b13ee2 | 604 | |
f117e3aa | 605 | smnumber = (vol8-1)*6 + vol7; |
8599803d | 606 | |
f117e3aa | 607 | if (vol8 == 1 || vol8 == 2) |
8599803d | 608 | { |
36031625 | 609 | xpad = vol2; |
610 | ypad = vol1; | |
b2b13ee2 | 611 | } |
f117e3aa | 612 | else if (vol8 == 3 || vol8 == 4) |
613 | { | |
614 | xpad = vol1; | |
615 | ypad = vol2; | |
616 | } | |
b2b13ee2 | 617 | |
ecee2a1a | 618 | AliDebug(2,Form("ZPosition = %f Edeposition = %d",zPos,edep)); |
f117e3aa | 619 | //Float_t zposition = TMath::Abs(zPos); |
8599803d | 620 | |
f117e3aa | 621 | if (zPos < fZPos) |
b2b13ee2 | 622 | { |
623 | // CPV | |
624 | fDetNo = 1; | |
625 | } | |
f117e3aa | 626 | else if (zPos > fZPos) |
b2b13ee2 | 627 | { |
628 | // PMD | |
629 | fDetNo = 0; | |
630 | } | |
8599803d | 631 | |
632 | Int_t smn = smnumber - 1; | |
633 | Int_t ixx = xpad - 1; | |
634 | Int_t iyy = ypad - 1; | |
635 | if (fDetNo == 0) | |
b2b13ee2 | 636 | { |
36031625 | 637 | fPRE[smn][ixx][iyy] += edep; |
638 | fPRECounter[smn][ixx][iyy]++; | |
8599803d | 639 | |
ebd83c56 | 640 | AliPMDcell* cell = new AliPMDcell(mtrackno,smn,ixx,iyy,edep); |
8599803d | 641 | |
ebd83c56 | 642 | fCell.Add(cell); |
b2b13ee2 | 643 | } |
8599803d | 644 | else if(fDetNo == 1) |
b2b13ee2 | 645 | { |
8599803d | 646 | fCPV[smn][ixx][iyy] += edep; |
4d59e381 | 647 | fCPVCounter[smn][ixx][iyy]++; |
648 | AliPMDcell* cpvcell = new AliPMDcell(mtrackno,smn,ixx,iyy,edep); | |
649 | fCPVCell.Add(cpvcell); | |
b2b13ee2 | 650 | } |
651 | } | |
652 | } | |
653 | } // Track Loop ended | |
4d59e381 | 654 | TrackAssignment2CPVCell(); |
b2b13ee2 | 655 | TrackAssignment2Cell(); |
656 | ResetCell(); | |
657 | ||
50555ba1 | 658 | Float_t gain1; |
7088dbe9 | 659 | Float_t adc; |
b2b13ee2 | 660 | Float_t deltaE = 0.; |
661 | Int_t detno = 0; | |
b2b13ee2 | 662 | Int_t trno = 1; |
b2b13ee2 | 663 | for (Int_t idet = 0; idet < 2; idet++) |
5e2cc5bc | 664 | { |
36031625 | 665 | for (Int_t ism = 0; ism < fgkTotUM; ism++) |
5e2cc5bc | 666 | { |
36031625 | 667 | for (Int_t jrow = 0; jrow < fgkRow; jrow++) |
5e2cc5bc | 668 | { |
36031625 | 669 | for (Int_t kcol = 0; kcol < fgkCol; kcol++) |
5e2cc5bc | 670 | { |
b2b13ee2 | 671 | if (idet == 0) |
5e2cc5bc | 672 | { |
673 | deltaE = fPRE[ism][jrow][kcol]; | |
36031625 | 674 | trno = fPRETrackNo[ism][jrow][kcol]; |
b2b13ee2 | 675 | detno = 0; |
5e2cc5bc | 676 | } |
b2b13ee2 | 677 | else if (idet == 1) |
5e2cc5bc | 678 | { |
679 | deltaE = fCPV[ism][jrow][kcol]; | |
8599803d | 680 | trno = fCPVTrackNo[ism][jrow][kcol]; |
b2b13ee2 | 681 | detno = 1; |
5e2cc5bc | 682 | } |
b2b13ee2 | 683 | if (deltaE > 0.) |
5e2cc5bc | 684 | { |
7088dbe9 | 685 | MeV2ADC(deltaE,adc); |
5e2cc5bc | 686 | |
687 | // To decalibrate the adc values | |
688 | // | |
689 | gain1 = Gain(idet,ism,jrow,kcol); | |
690 | if (gain1 != 0.) | |
691 | { | |
692 | Int_t adcDecalib = (Int_t)(adc/gain1); | |
693 | adc = (Float_t) adcDecalib; | |
694 | } | |
695 | else if(gain1 == 0.) | |
696 | { | |
697 | adc = 0.; | |
698 | } | |
35535af7 | 699 | |
700 | // Pedestal Decalibration | |
701 | Int_t pedmeanrms = | |
702 | fCalibPed->GetPedMeanRms(idet,ism,jrow,kcol); | |
703 | Int_t pedrms1 = (Int_t) pedmeanrms%1000; | |
704 | Float_t pedrms = (Float_t)pedrms1/10.; | |
705 | Float_t pedmean = | |
706 | (Float_t) (pedmeanrms - pedrms1)/1000.0; | |
707 | //printf("%f %f\n",pedmean, pedrms); | |
708 | if (adc > 0.) | |
709 | { | |
710 | adc += (pedmean + 3.0*pedrms); | |
711 | AddDigit(trno,detno,ism,jrow,kcol,adc); | |
712 | } | |
5e2cc5bc | 713 | } |
714 | } // column loop | |
715 | } // row loop | |
03965b13 | 716 | treeD->Fill(); |
717 | ResetDigit(); | |
5e2cc5bc | 718 | } // supermodule loop |
719 | } // detector loop | |
03965b13 | 720 | |
36031625 | 721 | fPMDLoader->WriteDigits("OVERWRITE"); |
b2b13ee2 | 722 | ResetCellADC(); |
50555ba1 | 723 | |
b2b13ee2 | 724 | } |
7088dbe9 | 725 | //____________________________________________________________________________ |
b2b13ee2 | 726 | |
727 | ||
728 | void AliPMDDigitizer::SDigits2Digits(Int_t ievt) | |
729 | { | |
36031625 | 730 | // This reads the PMD sdigits tree and converts energy deposition |
731 | // in a cell to ADC and stores in the digits tree | |
732 | // | |
ecee2a1a | 733 | |
b2b13ee2 | 734 | fRunLoader->GetEvent(ievt); |
735 | ||
ebd83c56 | 736 | TTree* treeS = fPMDLoader->TreeS(); |
b2b13ee2 | 737 | AliPMDsdigit *pmdsdigit; |
ebd83c56 | 738 | TBranch *branch = treeS->GetBranch("PMDSDigit"); |
ecee2a1a | 739 | if(!branch) |
740 | { | |
741 | AliError("PMD Sdigit branch does not exist"); | |
742 | return; | |
743 | } | |
ebd83c56 | 744 | if (!fSDigits) fSDigits = new TClonesArray("AliPMDsdigit", 1000); |
b2b13ee2 | 745 | branch->SetAddress(&fSDigits); |
746 | ||
ebd83c56 | 747 | TTree* treeD = fPMDLoader->TreeD(); |
748 | if (treeD == 0x0) | |
b2b13ee2 | 749 | { |
36031625 | 750 | fPMDLoader->MakeTree("D"); |
ebd83c56 | 751 | treeD = fPMDLoader->TreeD(); |
b2b13ee2 | 752 | } |
753 | Int_t bufsize = 16000; | |
ebd83c56 | 754 | if (!fDigits) fDigits = new TClonesArray("AliPMDdigit", 1000); |
5e2cc5bc | 755 | treeD->Branch("PMDDigit", &fDigits, bufsize); |
b2b13ee2 | 756 | |
757 | Int_t trno, det, smn; | |
7088dbe9 | 758 | Int_t irow, icol; |
b2b13ee2 | 759 | Float_t edep, adc; |
760 | ||
ebd83c56 | 761 | Int_t nmodules = (Int_t) treeS->GetEntries(); |
ecee2a1a | 762 | AliDebug(1,Form("Number of modules = %d",nmodules)); |
b2b13ee2 | 763 | |
764 | for (Int_t imodule = 0; imodule < nmodules; imodule++) | |
765 | { | |
5e2cc5bc | 766 | treeS->GetEntry(imodule); |
b2b13ee2 | 767 | Int_t nentries = fSDigits->GetLast(); |
ecee2a1a | 768 | AliDebug(2,Form("Number of entries per module = %d",nentries+1)); |
b2b13ee2 | 769 | for (Int_t ient = 0; ient < nentries+1; ient++) |
770 | { | |
771 | pmdsdigit = (AliPMDsdigit*)fSDigits->UncheckedAt(ient); | |
772 | trno = pmdsdigit->GetTrackNumber(); | |
773 | det = pmdsdigit->GetDetector(); | |
774 | smn = pmdsdigit->GetSMNumber(); | |
7088dbe9 | 775 | irow = pmdsdigit->GetRow(); |
776 | icol = pmdsdigit->GetColumn(); | |
b2b13ee2 | 777 | edep = pmdsdigit->GetCellEdep(); |
778 | ||
779 | MeV2ADC(edep,adc); | |
5e2cc5bc | 780 | |
35535af7 | 781 | |
5e2cc5bc | 782 | // To decalibrte the adc values |
783 | // | |
784 | Float_t gain1 = Gain(det,smn,irow,icol); | |
785 | if (gain1 != 0.) | |
786 | { | |
787 | Int_t adcDecalib = (Int_t)(adc/gain1); | |
788 | adc = (Float_t) adcDecalib; | |
789 | } | |
790 | else if(gain1 == 0.) | |
791 | { | |
792 | adc = 0.; | |
793 | } | |
35535af7 | 794 | // Pedestal Decalibration |
795 | Int_t pedmeanrms = fCalibPed->GetPedMeanRms(det,smn,irow,icol); | |
796 | Int_t pedrms1 = (Int_t) pedmeanrms%1000; | |
797 | Float_t pedrms = (Float_t)pedrms1/10.; | |
798 | Float_t pedmean = (Float_t) (pedmeanrms - pedrms1)/1000.0; | |
799 | //printf("%f %f\n",pedmean, pedrms); | |
800 | if(adc > 0.) | |
801 | { | |
802 | adc += (pedmean + 3.0*pedrms); | |
803 | AddDigit(trno,det,smn,irow,icol,adc); | |
804 | } | |
5e2cc5bc | 805 | |
b2b13ee2 | 806 | } |
ebd83c56 | 807 | treeD->Fill(); |
b2b13ee2 | 808 | ResetDigit(); |
809 | } | |
36031625 | 810 | fPMDLoader->WriteDigits("OVERWRITE"); |
ecee2a1a | 811 | |
b2b13ee2 | 812 | } |
7088dbe9 | 813 | //____________________________________________________________________________ |
814 | void AliPMDDigitizer::Exec(Option_t *option) | |
815 | { | |
816 | // Does the event merging and digitization | |
7088dbe9 | 817 | const char *cdeb = strstr(option,"deb"); |
818 | if(cdeb) | |
819 | { | |
ecee2a1a | 820 | AliDebug(100," *** PMD Exec is called ***"); |
7088dbe9 | 821 | } |
ecee2a1a | 822 | |
7088dbe9 | 823 | Int_t ninputs = fManager->GetNinputs(); |
ecee2a1a | 824 | AliDebug(1,Form("Number of files to be processed = %d",ninputs)); |
7088dbe9 | 825 | ResetCellADC(); |
826 | ||
827 | for (Int_t i = 0; i < ninputs; i++) | |
828 | { | |
829 | Int_t troffset = fManager->GetMask(i); | |
830 | MergeSDigits(i, troffset); | |
831 | } | |
b2b13ee2 | 832 | |
7088dbe9 | 833 | fRunLoader = AliRunLoader::GetRunLoader(fManager->GetOutputFolderName()); |
834 | fPMD = (AliPMD*)gAlice->GetDetector("PMD"); | |
835 | fPMDLoader = fRunLoader->GetLoader("PMDLoader"); | |
836 | if (fPMDLoader == 0x0) | |
837 | { | |
ecee2a1a | 838 | AliError("Can not find PMD or PMDLoader"); |
7088dbe9 | 839 | } |
06f2c79d | 840 | fPMDLoader->LoadDigits("update"); |
ebd83c56 | 841 | TTree* treeD = fPMDLoader->TreeD(); |
842 | if (treeD == 0x0) | |
7088dbe9 | 843 | { |
844 | fPMDLoader->MakeTree("D"); | |
ebd83c56 | 845 | treeD = fPMDLoader->TreeD(); |
7088dbe9 | 846 | } |
847 | Int_t bufsize = 16000; | |
ebd83c56 | 848 | if (!fDigits) fDigits = new TClonesArray("AliPMDdigit", 1000); |
5e2cc5bc | 849 | treeD->Branch("PMDDigit", &fDigits, bufsize); |
7088dbe9 | 850 | |
851 | Float_t adc; | |
852 | Float_t deltaE = 0.; | |
853 | Int_t detno = 0; | |
854 | Int_t trno = 1; | |
855 | ||
856 | for (Int_t idet = 0; idet < 2; idet++) | |
857 | { | |
858 | for (Int_t ism = 0; ism < fgkTotUM; ism++) | |
859 | { | |
860 | for (Int_t jrow = 0; jrow < fgkRow; jrow++) | |
861 | { | |
862 | for (Int_t kcol = 0; kcol < fgkCol; kcol++) | |
863 | { | |
864 | if (idet == 0) | |
865 | { | |
866 | deltaE = fPRE[ism][jrow][kcol]; | |
867 | trno = fPRETrackNo[ism][jrow][kcol]; | |
868 | detno = 0; | |
869 | } | |
870 | else if (idet == 1) | |
871 | { | |
872 | deltaE = fCPV[ism][jrow][kcol]; | |
873 | trno = fCPVTrackNo[ism][jrow][kcol]; | |
874 | detno = 1; | |
875 | } | |
876 | if (deltaE > 0.) | |
877 | { | |
878 | MeV2ADC(deltaE,adc); | |
35535af7 | 879 | |
5f566ada | 880 | // |
35535af7 | 881 | // Gain decalibration |
5f566ada | 882 | // |
883 | Float_t gain1 = Gain(idet,ism,jrow,kcol); | |
35535af7 | 884 | |
5f566ada | 885 | if (gain1 != 0.) |
886 | { | |
887 | Int_t adcDecalib = (Int_t)(adc/gain1); | |
888 | adc = (Float_t) adcDecalib; | |
889 | } | |
890 | else if(gain1 == 0.) | |
891 | { | |
892 | adc = 0.; | |
893 | } | |
35535af7 | 894 | // Pedestal Decalibration |
895 | Int_t pedmeanrms = | |
896 | fCalibPed->GetPedMeanRms(idet,ism,jrow,kcol); | |
897 | Int_t pedrms1 = (Int_t) pedmeanrms%1000; | |
898 | Float_t pedrms = (Float_t)pedrms1/10.; | |
899 | Float_t pedmean = | |
900 | (Float_t) (pedmeanrms - pedrms1)/1000.0; | |
901 | //printf("%f %f\n",pedmean, pedrms); | |
902 | if (adc > 0.) | |
903 | { | |
904 | adc += (pedmean + 3.0*pedrms); | |
905 | AddDigit(trno,detno,ism,jrow,kcol,adc); | |
906 | } | |
5f566ada | 907 | |
7088dbe9 | 908 | } |
909 | } // column loop | |
910 | } // row loop | |
ebd83c56 | 911 | treeD->Fill(); |
7088dbe9 | 912 | ResetDigit(); |
913 | } // supermodule loop | |
914 | } // detector loop | |
5e2cc5bc | 915 | fPMDLoader->WriteDigits("OVERWRITE"); |
06f2c79d | 916 | fPMDLoader->UnloadDigits(); |
917 | ResetCellADC(); | |
7088dbe9 | 918 | } |
919 | //____________________________________________________________________________ | |
4d59e381 | 920 | void AliPMDDigitizer::TrackAssignment2CPVCell() |
921 | { | |
922 | // This block assigns the cell id when there are | |
923 | // multiple tracks in a cell according to the | |
924 | // energy deposition | |
925 | // This method added by Ajay | |
926 | Bool_t jsort = false; | |
927 | ||
928 | Int_t i, j, k; | |
929 | ||
930 | Int_t *status1; | |
931 | Int_t *status2; | |
932 | Int_t *trnarray; | |
933 | Float_t *fracEdp; | |
934 | Float_t *trEdp; | |
935 | ||
936 | Int_t ****cpvTrack; | |
937 | Float_t ****cpvEdep; | |
938 | ||
939 | cpvTrack = new Int_t ***[fgkTotUM]; | |
940 | cpvEdep = new Float_t ***[fgkTotUM]; | |
941 | for (i=0; i<fgkTotUM; i++) | |
942 | { | |
943 | cpvTrack[i] = new Int_t **[fgkRow]; | |
944 | cpvEdep[i] = new Float_t **[fgkRow]; | |
945 | } | |
946 | ||
947 | for (i = 0; i < fgkTotUM; i++) | |
948 | { | |
949 | for (j = 0; j < fgkRow; j++) | |
950 | { | |
951 | cpvTrack[i][j] = new Int_t *[fgkCol]; | |
952 | cpvEdep[i][j] = new Float_t *[fgkCol]; | |
953 | } | |
954 | } | |
955 | for (i = 0; i < fgkTotUM; i++) | |
956 | { | |
957 | for (j = 0; j < fgkRow; j++) | |
958 | { | |
959 | for (k = 0; k < fgkCol; k++) | |
960 | { | |
961 | Int_t nn = fCPVCounter[i][j][k]; | |
962 | if(nn > 0) | |
963 | { | |
964 | cpvTrack[i][j][k] = new Int_t[nn]; | |
965 | cpvEdep[i][j][k] = new Float_t[nn]; | |
966 | } | |
967 | else | |
968 | { | |
969 | nn = 1; | |
970 | cpvTrack[i][j][k] = new Int_t[nn]; | |
971 | cpvEdep[i][j][k] = new Float_t[nn]; | |
972 | } | |
973 | fCPVCounter[i][j][k] = 0; | |
974 | } | |
975 | } | |
976 | } | |
977 | ||
978 | ||
979 | Int_t nentries = fCPVCell.GetEntries(); | |
980 | ||
981 | Int_t mtrackno, ism, ixp, iyp; | |
982 | Float_t edep; | |
983 | for (i = 0; i < nentries; i++) | |
984 | { | |
985 | AliPMDcell* cpvcell = (AliPMDcell*)fCPVCell.UncheckedAt(i); | |
986 | ||
987 | mtrackno = cpvcell->GetTrackNumber(); | |
988 | ism = cpvcell->GetSMNumber(); | |
989 | ixp = cpvcell->GetX(); | |
990 | iyp = cpvcell->GetY(); | |
991 | edep = cpvcell->GetEdep(); | |
992 | Int_t nn = fCPVCounter[ism][ixp][iyp]; | |
993 | cpvTrack[ism][ixp][iyp][nn] = (Int_t) mtrackno; | |
994 | cpvEdep[ism][ixp][iyp][nn] = edep; | |
995 | fCPVCounter[ism][ixp][iyp]++; | |
996 | } | |
997 | ||
998 | Int_t iz, il; | |
999 | Int_t im, ix, iy; | |
1000 | Int_t nn; | |
1001 | for (im=0; im<fgkTotUM; im++) | |
1002 | { | |
1003 | for (ix=0; ix<fgkRow; ix++) | |
1004 | { | |
1005 | for (iy=0; iy<fgkCol; iy++) | |
1006 | { | |
1007 | nn = fCPVCounter[im][ix][iy]; | |
1008 | if (nn > 1) | |
1009 | { | |
1010 | // This block handles if a cell is fired | |
1011 | // many times by many tracks | |
1012 | status1 = new Int_t[nn]; | |
1013 | status2 = new Int_t[nn]; | |
1014 | trnarray = new Int_t[nn]; | |
1015 | for (iz = 0; iz < nn; iz++) | |
1016 | { | |
1017 | status1[iz] = cpvTrack[im][ix][iy][iz]; | |
1018 | } | |
1019 | TMath::Sort(nn,status1,status2,jsort); | |
1020 | Int_t trackOld = -99999; | |
1021 | Int_t track, trCount = 0; | |
1022 | for (iz = 0; iz < nn; iz++) | |
1023 | { | |
1024 | track = status1[status2[iz]]; | |
1025 | if (trackOld != track) | |
1026 | { | |
1027 | trnarray[trCount] = track; | |
1028 | trCount++; | |
1029 | } | |
1030 | trackOld = track; | |
1031 | } | |
1032 | delete [] status1; | |
1033 | delete [] status2; | |
1034 | Float_t totEdp = 0.; | |
1035 | trEdp = new Float_t[trCount]; | |
1036 | fracEdp = new Float_t[trCount]; | |
1037 | for (il = 0; il < trCount; il++) | |
1038 | { | |
1039 | trEdp[il] = 0.; | |
1040 | track = trnarray[il]; | |
1041 | for (iz = 0; iz < nn; iz++) | |
1042 | { | |
1043 | if (track == cpvTrack[im][ix][iy][iz]) | |
1044 | { | |
1045 | trEdp[il] += cpvEdep[im][ix][iy][iz]; | |
1046 | } | |
1047 | } | |
1048 | totEdp += trEdp[il]; | |
1049 | } | |
1050 | Int_t ilOld = 0; | |
1051 | Float_t fracOld = 0.; | |
1052 | ||
1053 | for (il = 0; il < trCount; il++) | |
1054 | { | |
1055 | fracEdp[il] = trEdp[il]/totEdp; | |
1056 | if (fracOld < fracEdp[il]) | |
1057 | { | |
1058 | fracOld = fracEdp[il]; | |
1059 | ilOld = il; | |
1060 | } | |
1061 | } | |
1062 | fCPVTrackNo[im][ix][iy] = trnarray[ilOld]; | |
1063 | delete [] fracEdp; | |
1064 | delete [] trEdp; | |
1065 | delete [] trnarray; | |
1066 | } | |
1067 | else if (nn == 1) | |
1068 | { | |
1069 | // This only handles if a cell is fired | |
1070 | // by only one track | |
1071 | ||
1072 | fCPVTrackNo[im][ix][iy] = cpvTrack[im][ix][iy][0]; | |
1073 | ||
1074 | } | |
1075 | else if (nn ==0) | |
1076 | { | |
1077 | // This is if no cell is fired | |
1078 | fCPVTrackNo[im][ix][iy] = -999; | |
1079 | } | |
1080 | } // end of iy | |
1081 | } // end of ix | |
1082 | } // end of im | |
1083 | ||
1084 | // Delete all the pointers | |
1085 | ||
1086 | for (i = 0; i < fgkTotUM; i++) | |
1087 | { | |
1088 | for (j = 0; j < fgkRow; j++) | |
1089 | { | |
1090 | for (k = 0; k < fgkCol; k++) | |
1091 | { | |
1092 | delete []cpvTrack[i][j][k]; | |
1093 | delete []cpvEdep[i][j][k]; | |
1094 | } | |
1095 | } | |
1096 | } | |
1097 | ||
1098 | for (i = 0; i < fgkTotUM; i++) | |
1099 | { | |
1100 | for (j = 0; j < fgkRow; j++) | |
1101 | { | |
1102 | delete [] cpvTrack[i][j]; | |
1103 | delete [] cpvEdep[i][j]; | |
1104 | } | |
1105 | } | |
1106 | ||
1107 | for (i = 0; i < fgkTotUM; i++) | |
1108 | { | |
1109 | delete [] cpvTrack[i]; | |
1110 | delete [] cpvEdep[i]; | |
1111 | } | |
1112 | delete [] cpvTrack; | |
1113 | delete [] cpvEdep; | |
1114 | ||
1115 | // | |
1116 | // End of the cell id assignment | |
1117 | // | |
1118 | } | |
1119 | //____________________________________________________________________________ | |
7088dbe9 | 1120 | |
1121 | void AliPMDDigitizer::MergeSDigits(Int_t filenumber, Int_t troffset) | |
1122 | { | |
1123 | // merging sdigits | |
1124 | fRunLoader = AliRunLoader::GetRunLoader(fManager->GetInputFolderName(filenumber)); | |
1125 | fPMDLoader = fRunLoader->GetLoader("PMDLoader"); | |
1126 | fPMDLoader->LoadSDigits("read"); | |
ebd83c56 | 1127 | TTree* treeS = fPMDLoader->TreeS(); |
7088dbe9 | 1128 | AliPMDsdigit *pmdsdigit; |
ebd83c56 | 1129 | TBranch *branch = treeS->GetBranch("PMDSDigit"); |
1130 | if (!fSDigits) fSDigits = new TClonesArray("AliPMDsdigit", 1000); | |
7088dbe9 | 1131 | branch->SetAddress(&fSDigits); |
1132 | ||
1133 | Int_t itrackno, idet, ism; | |
1134 | Int_t ixp, iyp; | |
1135 | Float_t edep; | |
ebd83c56 | 1136 | Int_t nmodules = (Int_t) treeS->GetEntries(); |
ecee2a1a | 1137 | AliDebug(1,Form("Number of Modules in the treeS = %d",nmodules)); |
1138 | AliDebug(1,Form("Track Offset = %d",troffset)); | |
7088dbe9 | 1139 | for (Int_t imodule = 0; imodule < nmodules; imodule++) |
1140 | { | |
5e2cc5bc | 1141 | treeS->GetEntry(imodule); |
7088dbe9 | 1142 | Int_t nentries = fSDigits->GetLast(); |
ecee2a1a | 1143 | AliDebug(2,Form("Number of Entries per Module = %d",nentries)); |
7088dbe9 | 1144 | for (Int_t ient = 0; ient < nentries+1; ient++) |
1145 | { | |
1146 | pmdsdigit = (AliPMDsdigit*)fSDigits->UncheckedAt(ient); | |
1147 | itrackno = pmdsdigit->GetTrackNumber(); | |
1148 | idet = pmdsdigit->GetDetector(); | |
1149 | ism = pmdsdigit->GetSMNumber(); | |
1150 | ixp = pmdsdigit->GetRow(); | |
1151 | iyp = pmdsdigit->GetColumn(); | |
1152 | edep = pmdsdigit->GetCellEdep(); | |
7088dbe9 | 1153 | if (idet == 0) |
1154 | { | |
1155 | if (fPRE[ism][ixp][iyp] < edep) | |
1156 | { | |
1157 | fPRETrackNo[ism][ixp][iyp] = troffset + itrackno; | |
1158 | } | |
1159 | fPRE[ism][ixp][iyp] += edep; | |
1160 | } | |
1161 | else if (idet == 1) | |
1162 | { | |
1163 | if (fCPV[ism][ixp][iyp] < edep) | |
1164 | { | |
1165 | fCPVTrackNo[ism][ixp][iyp] = troffset + itrackno; | |
1166 | } | |
1167 | fCPV[ism][ixp][iyp] += edep; | |
1168 | } | |
1169 | } | |
1170 | } | |
1171 | ||
1172 | } | |
1173 | // ---------------------------------------------------------------------- | |
b2b13ee2 | 1174 | void AliPMDDigitizer::TrackAssignment2Cell() |
1175 | { | |
b2b13ee2 | 1176 | // |
75bb524e | 1177 | // This block assigns the cell id when there are |
b2b13ee2 | 1178 | // multiple tracks in a cell according to the |
1179 | // energy deposition | |
1180 | // | |
75bb524e | 1181 | Bool_t jsort = false; |
8599803d | 1182 | |
b2b13ee2 | 1183 | Int_t i, j, k; |
1184 | ||
4d59e381 | 1185 | Int_t *status1; |
1186 | Int_t *status2; | |
1187 | Int_t *trnarray; | |
36031625 | 1188 | Float_t *fracEdp; |
1189 | Float_t *trEdp; | |
4d59e381 | 1190 | |
36031625 | 1191 | Int_t ****pmdTrack; |
1192 | Float_t ****pmdEdep; | |
b2b13ee2 | 1193 | |
36031625 | 1194 | pmdTrack = new Int_t ***[fgkTotUM]; |
1195 | pmdEdep = new Float_t ***[fgkTotUM]; | |
1196 | for (i=0; i<fgkTotUM; i++) | |
b2b13ee2 | 1197 | { |
36031625 | 1198 | pmdTrack[i] = new Int_t **[fgkRow]; |
1199 | pmdEdep[i] = new Float_t **[fgkRow]; | |
b2b13ee2 | 1200 | } |
1201 | ||
36031625 | 1202 | for (i = 0; i < fgkTotUM; i++) |
b2b13ee2 | 1203 | { |
36031625 | 1204 | for (j = 0; j < fgkRow; j++) |
b2b13ee2 | 1205 | { |
36031625 | 1206 | pmdTrack[i][j] = new Int_t *[fgkCol]; |
1207 | pmdEdep[i][j] = new Float_t *[fgkCol]; | |
b2b13ee2 | 1208 | } |
1209 | } | |
1210 | ||
36031625 | 1211 | for (i = 0; i < fgkTotUM; i++) |
b2b13ee2 | 1212 | { |
36031625 | 1213 | for (j = 0; j < fgkRow; j++) |
b2b13ee2 | 1214 | { |
36031625 | 1215 | for (k = 0; k < fgkCol; k++) |
b2b13ee2 | 1216 | { |
36031625 | 1217 | Int_t nn = fPRECounter[i][j][k]; |
b2b13ee2 | 1218 | if(nn > 0) |
1219 | { | |
36031625 | 1220 | pmdTrack[i][j][k] = new Int_t[nn]; |
1221 | pmdEdep[i][j][k] = new Float_t[nn]; | |
b2b13ee2 | 1222 | } |
1223 | else | |
1224 | { | |
1225 | nn = 1; | |
36031625 | 1226 | pmdTrack[i][j][k] = new Int_t[nn]; |
1227 | pmdEdep[i][j][k] = new Float_t[nn]; | |
5e2cc5bc | 1228 | } |
36031625 | 1229 | fPRECounter[i][j][k] = 0; |
b2b13ee2 | 1230 | } |
1231 | } | |
1232 | } | |
1233 | ||
1234 | ||
ebd83c56 | 1235 | Int_t nentries = fCell.GetEntries(); |
b2b13ee2 | 1236 | |
1237 | Int_t mtrackno, ism, ixp, iyp; | |
1238 | Float_t edep; | |
1239 | ||
1240 | for (i = 0; i < nentries; i++) | |
1241 | { | |
ebd83c56 | 1242 | AliPMDcell* cell = (AliPMDcell*)fCell.UncheckedAt(i); |
b2b13ee2 | 1243 | |
ebd83c56 | 1244 | mtrackno = cell->GetTrackNumber(); |
1245 | ism = cell->GetSMNumber(); | |
1246 | ixp = cell->GetX(); | |
1247 | iyp = cell->GetY(); | |
1248 | edep = cell->GetEdep(); | |
36031625 | 1249 | Int_t nn = fPRECounter[ism][ixp][iyp]; |
36031625 | 1250 | pmdTrack[ism][ixp][iyp][nn] = (Int_t) mtrackno; |
1251 | pmdEdep[ism][ixp][iyp][nn] = edep; | |
1252 | fPRECounter[ism][ixp][iyp]++; | |
b2b13ee2 | 1253 | } |
1254 | ||
1255 | Int_t iz, il; | |
1256 | Int_t im, ix, iy; | |
1257 | Int_t nn; | |
1258 | ||
36031625 | 1259 | for (im=0; im<fgkTotUM; im++) |
b2b13ee2 | 1260 | { |
36031625 | 1261 | for (ix=0; ix<fgkRow; ix++) |
b2b13ee2 | 1262 | { |
36031625 | 1263 | for (iy=0; iy<fgkCol; iy++) |
b2b13ee2 | 1264 | { |
36031625 | 1265 | nn = fPRECounter[im][ix][iy]; |
b2b13ee2 | 1266 | if (nn > 1) |
1267 | { | |
1268 | // This block handles if a cell is fired | |
1269 | // many times by many tracks | |
75bb524e | 1270 | status1 = new Int_t[nn]; |
1271 | status2 = new Int_t[nn]; | |
1272 | trnarray = new Int_t[nn]; | |
b2b13ee2 | 1273 | for (iz = 0; iz < nn; iz++) |
1274 | { | |
36031625 | 1275 | status1[iz] = pmdTrack[im][ix][iy][iz]; |
b2b13ee2 | 1276 | } |
75bb524e | 1277 | TMath::Sort(nn,status1,status2,jsort); |
36031625 | 1278 | Int_t trackOld = -99999; |
1279 | Int_t track, trCount = 0; | |
b2b13ee2 | 1280 | for (iz = 0; iz < nn; iz++) |
1281 | { | |
75bb524e | 1282 | track = status1[status2[iz]]; |
36031625 | 1283 | if (trackOld != track) |
b2b13ee2 | 1284 | { |
36031625 | 1285 | trnarray[trCount] = track; |
1286 | trCount++; | |
5e2cc5bc | 1287 | } |
36031625 | 1288 | trackOld = track; |
b2b13ee2 | 1289 | } |
6eb80a7c | 1290 | delete [] status1; |
1291 | delete [] status2; | |
36031625 | 1292 | Float_t totEdp = 0.; |
1293 | trEdp = new Float_t[trCount]; | |
1294 | fracEdp = new Float_t[trCount]; | |
1295 | for (il = 0; il < trCount; il++) | |
b2b13ee2 | 1296 | { |
36031625 | 1297 | trEdp[il] = 0.; |
75bb524e | 1298 | track = trnarray[il]; |
b2b13ee2 | 1299 | for (iz = 0; iz < nn; iz++) |
1300 | { | |
36031625 | 1301 | if (track == pmdTrack[im][ix][iy][iz]) |
b2b13ee2 | 1302 | { |
36031625 | 1303 | trEdp[il] += pmdEdep[im][ix][iy][iz]; |
b2b13ee2 | 1304 | } |
1305 | } | |
36031625 | 1306 | totEdp += trEdp[il]; |
b2b13ee2 | 1307 | } |
36031625 | 1308 | Int_t ilOld = 0; |
1309 | Float_t fracOld = 0.; | |
b2b13ee2 | 1310 | |
36031625 | 1311 | for (il = 0; il < trCount; il++) |
b2b13ee2 | 1312 | { |
36031625 | 1313 | fracEdp[il] = trEdp[il]/totEdp; |
1314 | if (fracOld < fracEdp[il]) | |
b2b13ee2 | 1315 | { |
36031625 | 1316 | fracOld = fracEdp[il]; |
1317 | ilOld = il; | |
b2b13ee2 | 1318 | } |
1319 | } | |
36031625 | 1320 | fPRETrackNo[im][ix][iy] = trnarray[ilOld]; |
6eb80a7c | 1321 | delete [] fracEdp; |
1322 | delete [] trEdp; | |
1323 | delete [] trnarray; | |
b2b13ee2 | 1324 | } |
1325 | else if (nn == 1) | |
1326 | { | |
1327 | // This only handles if a cell is fired | |
1328 | // by only one track | |
1329 | ||
36031625 | 1330 | fPRETrackNo[im][ix][iy] = pmdTrack[im][ix][iy][0]; |
b2b13ee2 | 1331 | |
1332 | } | |
1333 | else if (nn ==0) | |
1334 | { | |
1335 | // This is if no cell is fired | |
36031625 | 1336 | fPRETrackNo[im][ix][iy] = -999; |
b2b13ee2 | 1337 | } |
1338 | } // end of iy | |
1339 | } // end of ix | |
1340 | } // end of im | |
1341 | ||
1342 | // Delete all the pointers | |
1343 | ||
36031625 | 1344 | for (i = 0; i < fgkTotUM; i++) |
b2b13ee2 | 1345 | { |
36031625 | 1346 | for (j = 0; j < fgkRow; j++) |
b2b13ee2 | 1347 | { |
36031625 | 1348 | for (k = 0; k < fgkCol; k++) |
b2b13ee2 | 1349 | { |
36031625 | 1350 | delete [] pmdTrack[i][j][k]; |
1351 | delete [] pmdEdep[i][j][k]; | |
b2b13ee2 | 1352 | } |
1353 | } | |
1354 | } | |
1355 | ||
36031625 | 1356 | for (i = 0; i < fgkTotUM; i++) |
b2b13ee2 | 1357 | { |
36031625 | 1358 | for (j = 0; j < fgkRow; j++) |
b2b13ee2 | 1359 | { |
36031625 | 1360 | delete [] pmdTrack[i][j]; |
1361 | delete [] pmdEdep[i][j]; | |
b2b13ee2 | 1362 | } |
1363 | } | |
1364 | ||
36031625 | 1365 | for (i = 0; i < fgkTotUM; i++) |
b2b13ee2 | 1366 | { |
36031625 | 1367 | delete [] pmdTrack[i]; |
1368 | delete [] pmdEdep[i]; | |
b2b13ee2 | 1369 | } |
6eb80a7c | 1370 | delete [] pmdTrack; |
1371 | delete [] pmdEdep; | |
b2b13ee2 | 1372 | // |
1373 | // End of the cell id assignment | |
1374 | // | |
1375 | } | |
7088dbe9 | 1376 | //____________________________________________________________________________ |
a7d110b8 | 1377 | void AliPMDDigitizer::MeV2ADC(Float_t mev, Float_t & adc) const |
b2b13ee2 | 1378 | { |
36031625 | 1379 | // This converts the simulated edep to ADC according to the |
1380 | // Test Beam Data | |
4d59e381 | 1381 | //PS Test in September 2003 and 2006 |
1382 | // KeV - ADC conversion for 12bit ADC | |
1383 | // Modified by Ajay | |
1384 | const Float_t kConstant = 9.0809; | |
1385 | const Float_t kErConstant = 1.6763; | |
1386 | const Float_t kSlope = 128.348; | |
1387 | const Float_t kErSlope = 0.4703; | |
1388 | ||
b8e69f1f | 1389 | Float_t cons = gRandom->Gaus(kConstant,kErConstant); |
1390 | Float_t slop = gRandom->Gaus(kSlope,kErSlope); | |
4d59e381 | 1391 | |
1392 | Float_t adc12bit = slop*mev*0.001 + cons; | |
1393 | ||
1394 | if(adc12bit < 1600.0) | |
b8e69f1f | 1395 | { |
1396 | adc = (Float_t) adc12bit; | |
1397 | } | |
4d59e381 | 1398 | else if (adc12bit >= 1600.0) |
b8e69f1f | 1399 | { |
4d59e381 | 1400 | adc = 1600.0; |
b8e69f1f | 1401 | } |
b2b13ee2 | 1402 | } |
7088dbe9 | 1403 | //____________________________________________________________________________ |
5e2cc5bc | 1404 | void AliPMDDigitizer::AddSDigit(Int_t trnumber, Int_t det, Int_t smnumber, |
1405 | Int_t irow, Int_t icol, Float_t adc) | |
b2b13ee2 | 1406 | { |
36031625 | 1407 | // Add SDigit |
1408 | // | |
ebd83c56 | 1409 | if (!fSDigits) fSDigits = new TClonesArray("AliPMDsdigit", 1000); |
b2b13ee2 | 1410 | TClonesArray &lsdigits = *fSDigits; |
7088dbe9 | 1411 | new(lsdigits[fNsdigit++]) AliPMDsdigit(trnumber,det,smnumber,irow,icol,adc); |
b2b13ee2 | 1412 | } |
7088dbe9 | 1413 | //____________________________________________________________________________ |
b2b13ee2 | 1414 | |
5e2cc5bc | 1415 | void AliPMDDigitizer::AddDigit(Int_t trnumber, Int_t det, Int_t smnumber, |
1416 | Int_t irow, Int_t icol, Float_t adc) | |
b2b13ee2 | 1417 | { |
36031625 | 1418 | // Add Digit |
1419 | // | |
ebd83c56 | 1420 | if (!fDigits) fDigits = new TClonesArray("AliPMDdigit", 1000); |
b2b13ee2 | 1421 | TClonesArray &ldigits = *fDigits; |
7088dbe9 | 1422 | new(ldigits[fNdigit++]) AliPMDdigit(trnumber,det,smnumber,irow,icol,adc); |
b2b13ee2 | 1423 | } |
7088dbe9 | 1424 | //____________________________________________________________________________ |
b2b13ee2 | 1425 | |
b2b13ee2 | 1426 | void AliPMDDigitizer::SetZPosition(Float_t zpos) |
1427 | { | |
1428 | fZPos = zpos; | |
1429 | } | |
7088dbe9 | 1430 | //____________________________________________________________________________ |
b2b13ee2 | 1431 | Float_t AliPMDDigitizer::GetZPosition() const |
1432 | { | |
1433 | return fZPos; | |
1434 | } | |
7088dbe9 | 1435 | //____________________________________________________________________________ |
b2b13ee2 | 1436 | |
1437 | void AliPMDDigitizer::ResetCell() | |
1438 | { | |
36031625 | 1439 | // clears the cell array and also the counter |
1440 | // for each cell | |
1441 | // | |
4d59e381 | 1442 | fCPVCell.Delete(); |
ebd83c56 | 1443 | fCell.Delete(); |
36031625 | 1444 | for (Int_t i = 0; i < fgkTotUM; i++) |
b2b13ee2 | 1445 | { |
36031625 | 1446 | for (Int_t j = 0; j < fgkRow; j++) |
b2b13ee2 | 1447 | { |
36031625 | 1448 | for (Int_t k = 0; k < fgkCol; k++) |
b2b13ee2 | 1449 | { |
4d59e381 | 1450 | fCPVCounter[i][j][k] = 0; |
5e2cc5bc | 1451 | fPRECounter[i][j][k] = 0; |
b2b13ee2 | 1452 | } |
1453 | } | |
1454 | } | |
1455 | } | |
7088dbe9 | 1456 | //____________________________________________________________________________ |
b2b13ee2 | 1457 | void AliPMDDigitizer::ResetSDigit() |
1458 | { | |
36031625 | 1459 | // Clears SDigits |
b2b13ee2 | 1460 | fNsdigit = 0; |
ebd83c56 | 1461 | if (fSDigits) fSDigits->Delete(); |
b2b13ee2 | 1462 | } |
7088dbe9 | 1463 | //____________________________________________________________________________ |
b2b13ee2 | 1464 | void AliPMDDigitizer::ResetDigit() |
1465 | { | |
36031625 | 1466 | // Clears Digits |
b2b13ee2 | 1467 | fNdigit = 0; |
ebd83c56 | 1468 | if (fDigits) fDigits->Delete(); |
b2b13ee2 | 1469 | } |
7088dbe9 | 1470 | //____________________________________________________________________________ |
b2b13ee2 | 1471 | |
1472 | void AliPMDDigitizer::ResetCellADC() | |
1473 | { | |
7088dbe9 | 1474 | // Clears individual cells edep and track number |
36031625 | 1475 | for (Int_t i = 0; i < fgkTotUM; i++) |
b2b13ee2 | 1476 | { |
36031625 | 1477 | for (Int_t j = 0; j < fgkRow; j++) |
b2b13ee2 | 1478 | { |
36031625 | 1479 | for (Int_t k = 0; k < fgkCol; k++) |
b2b13ee2 | 1480 | { |
5e2cc5bc | 1481 | fCPV[i][j][k] = 0.; |
1482 | fPRE[i][j][k] = 0.; | |
7088dbe9 | 1483 | fCPVTrackNo[i][j][k] = 0; |
4d59e381 | 1484 | fPRETrackNo[i][j][k] = 0; |
b2b13ee2 | 1485 | } |
1486 | } | |
1487 | } | |
1488 | } | |
7088dbe9 | 1489 | //____________________________________________________________________________ |
b2b13ee2 | 1490 | |
1491 | void AliPMDDigitizer::UnLoad(Option_t *option) | |
1492 | { | |
36031625 | 1493 | // Unloads all the root files |
1494 | // | |
b2b13ee2 | 1495 | const char *cS = strstr(option,"S"); |
1496 | const char *cD = strstr(option,"D"); | |
1497 | ||
1498 | fRunLoader->UnloadgAlice(); | |
1499 | fRunLoader->UnloadHeader(); | |
1500 | fRunLoader->UnloadKinematics(); | |
1501 | ||
1502 | if (cS) | |
1503 | { | |
36031625 | 1504 | fPMDLoader->UnloadHits(); |
b2b13ee2 | 1505 | } |
1506 | if (cD) | |
1507 | { | |
36031625 | 1508 | fPMDLoader->UnloadHits(); |
1509 | fPMDLoader->UnloadSDigits(); | |
b2b13ee2 | 1510 | } |
1511 | } | |
09a06455 | 1512 | |
1513 | //---------------------------------------------------------------------- | |
1514 | Float_t AliPMDDigitizer::Gain(Int_t det, Int_t smn, Int_t row, Int_t col) const | |
1515 | { | |
1516 | // returns of the gain of the cell | |
1517 | // Added this method by ZA | |
1518 | ||
1519 | //cout<<" I am here in gain "<<fCalibData<< "smn,row, col "<<smn | |
1520 | //<<" "<<row<<" "<<col<<endl; | |
1521 | ||
35535af7 | 1522 | if(!fCalibGain) { |
09a06455 | 1523 | AliError("No calibration data loaded from CDB!!!"); |
50555ba1 | 1524 | return 1; |
09a06455 | 1525 | } |
1526 | ||
1527 | Float_t GainFact; | |
35535af7 | 1528 | GainFact = fCalibGain->GetGainFact(det,smn,row,col); |
09a06455 | 1529 | return GainFact; |
1530 | } | |
1531 | //---------------------------------------------------------------------- | |
35535af7 | 1532 | AliPMDCalibData* AliPMDDigitizer::GetCalibGain() const |
09a06455 | 1533 | { |
1534 | // The run number will be centralized in AliCDBManager, | |
1535 | // you don't need to set it here! | |
1536 | // Added this method by ZA | |
0dd3d6f9 | 1537 | // Cleaned up by Alberto |
35535af7 | 1538 | AliCDBEntry *entry = AliCDBManager::Instance()->Get("PMD/Calib/Gain"); |
09a06455 | 1539 | |
0dd3d6f9 | 1540 | if(!entry) AliFatal("Calibration object retrieval failed!"); |
09a06455 | 1541 | |
1542 | AliPMDCalibData *calibdata=0; | |
1543 | if (entry) calibdata = (AliPMDCalibData*) entry->GetObject(); | |
1544 | ||
0dd3d6f9 | 1545 | if (!calibdata) AliFatal("No calibration data from calibration database !"); |
09a06455 | 1546 | |
1547 | return calibdata; | |
1548 | } | |
35535af7 | 1549 | //---------------------------------------------------------------------- |
1550 | AliPMDPedestal* AliPMDDigitizer::GetCalibPed() const | |
1551 | { | |
1552 | // The run number will be centralized in AliCDBManager, | |
1553 | // you don't need to set it here! | |
1554 | ||
1555 | AliCDBEntry *entry = AliCDBManager::Instance()->Get("PMD/Calib/Ped"); | |
1556 | ||
1557 | if(!entry) AliFatal("Pedestal object retrieval failed!"); | |
1558 | ||
1559 | AliPMDPedestal *pedestal=0; | |
1560 | if (entry) pedestal = (AliPMDPedestal*) entry->GetObject(); | |
1561 | ||
1562 | if (!pedestal) AliFatal("No pedestal data from calibration database !"); | |
1563 | ||
1564 | return pedestal; | |
1565 | } |