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