]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PMD/AliPMDClusterFinder.cxx
data member is initialised
[u/mrichter/AliRoot.git] / PMD / AliPMDClusterFinder.cxx
CommitLineData
ed228cbc 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 **************************************************************************/
15
01709453 16//-----------------------------------------------------//
17// //
18// Date : August 05 2003 //
19// This reads the file PMD.digits.root(TreeD), //
20// calls the Clustering algorithm and stores the //
21// clustering output in PMD.RecPoints.root(TreeR) //
22// //
23//-----------------------------------------------------//
24
25#include <Riostream.h>
01709453 26#include <TTree.h>
01709453 27#include <TObjArray.h>
28#include <TClonesArray.h>
08cf9354 29#include <TSystem.h>
01709453 30
7e9508a7 31#include "AliLog.h"
01709453 32#include "AliRunLoader.h"
33#include "AliLoader.h"
5f55af10 34#include "AliRawReader.h"
01709453 35
36#include "AliPMDdigit.h"
37#include "AliPMDClusterFinder.h"
38#include "AliPMDClustering.h"
5c5cadd5 39#include "AliPMDClusteringV1.h"
01709453 40#include "AliPMDcluster.h"
96377d57 41#include "AliPMDrecpoint1.h"
5c5cadd5 42#include "AliPMDrechit.h"
5f55af10 43#include "AliPMDRawStream.h"
09a06455 44#include "AliPMDCalibData.h"
35535af7 45#include "AliPMDPedestal.h"
df42ab21 46#include "AliPMDddldata.h"
7adbd8e9 47#include "AliPMDHotData.h"
b9e2f33c 48#include "AliPMDRecoParam.h"
49#include "AliPMDReconstructor.h"
09a06455 50
2332574a 51#include "AliDAQ.h"
09a06455 52#include "AliCDBManager.h"
53#include "AliCDBEntry.h"
01709453 54
7e9508a7 55
56
01709453 57ClassImp(AliPMDClusterFinder)
b208c6a3 58
7e9508a7 59AliPMDClusterFinder::AliPMDClusterFinder():
60 fRunLoader(0),
61 fPMDLoader(0),
35535af7 62 fCalibGain(GetCalibGain()),
63 fCalibPed(GetCalibPed()),
7adbd8e9 64 fCalibHot(GetCalibHot()),
b9e2f33c 65 fRecoParam(0x0),
7e9508a7 66 fTreeD(0),
67 fTreeR(0),
68 fDigits(new TClonesArray("AliPMDdigit", 1000)),
69 fRecpoints(new TClonesArray("AliPMDrecpoint1", 1000)),
5c5cadd5 70 fRechits(new TClonesArray("AliPMDrechit", 1000)),
7e9508a7 71 fNpoint(0),
5c5cadd5 72 fNhit(0),
a48edddd 73 fDetNo(0),
7e9508a7 74 fEcut(0.)
75{
76//
77// Constructor
78//
79}
80// ------------------------------------------------------------------------- //
dfaeee5f 81AliPMDClusterFinder::AliPMDClusterFinder(AliRunLoader* runLoader):
82 fRunLoader(runLoader),
83 fPMDLoader(runLoader->GetLoader("PMDLoader")),
35535af7 84 fCalibGain(GetCalibGain()),
85 fCalibPed(GetCalibPed()),
7adbd8e9 86 fCalibHot(GetCalibHot()),
b9e2f33c 87 fRecoParam(0x0),
1758e4fe 88 fTreeD(0),
89 fTreeR(0),
ebd83c56 90 fDigits(new TClonesArray("AliPMDdigit", 1000)),
1758e4fe 91 fRecpoints(new TClonesArray("AliPMDrecpoint1", 1000)),
5c5cadd5 92 fRechits(new TClonesArray("AliPMDrechit", 1000)),
1758e4fe 93 fNpoint(0),
5c5cadd5 94 fNhit(0),
a48edddd 95 fDetNo(0),
1758e4fe 96 fEcut(0.)
01709453 97{
b208c6a3 98//
dfaeee5f 99// Constructor
b208c6a3 100//
a48edddd 101}
102// ------------------------------------------------------------------------- //
2332574a 103AliPMDClusterFinder::AliPMDClusterFinder(const AliPMDClusterFinder & finder):
104 TObject(finder),
105 fRunLoader(0),
106 fPMDLoader(0),
35535af7 107 fCalibGain(GetCalibGain()),
108 fCalibPed(GetCalibPed()),
7adbd8e9 109 fCalibHot(GetCalibHot()),
b9e2f33c 110 fRecoParam(0x0),
2332574a 111 fTreeD(0),
112 fTreeR(0),
113 fDigits(NULL),
114 fRecpoints(NULL),
115 fRechits(NULL),
116 fNpoint(0),
117 fNhit(0),
118 fDetNo(0),
119 fEcut(0.)
a48edddd 120{
121 // copy constructor
122 AliError("Copy constructor not allowed");
123}
124// ------------------------------------------------------------------------- //
125AliPMDClusterFinder &AliPMDClusterFinder::operator=(const AliPMDClusterFinder & /*finder*/)
126{
127 // assignment op
128 AliError("Assignment Operator not allowed");
129 return *this;
01709453 130}
1758e4fe 131// ------------------------------------------------------------------------- //
01709453 132AliPMDClusterFinder::~AliPMDClusterFinder()
133{
b208c6a3 134 // Destructor
ebd83c56 135 if (fDigits)
136 {
b9e2f33c 137 fDigits->Clear();
ebd83c56 138 }
1758e4fe 139 if (fRecpoints)
140 {
722ccc67 141 fRecpoints->Clear();
1758e4fe 142 }
5c5cadd5 143 if (fRechits)
144 {
722ccc67 145 fRechits->Clear();
5c5cadd5 146 }
5254fcca 147
01709453 148}
1758e4fe 149// ------------------------------------------------------------------------- //
b208c6a3 150
01709453 151void AliPMDClusterFinder::Digits2RecPoints(Int_t ievt)
152{
b208c6a3 153 // Converts digits to recpoints after running clustering
154 // algorithm on CPV plane and PREshower plane
155 //
2332574a 156
ed228cbc 157 Int_t det = 0,smn = 0;
01709453 158 Int_t xpos,ypos;
159 Float_t adc;
1758e4fe 160 Int_t ismn;
01709453 161 Int_t idet;
5c5cadd5 162 Float_t clusdata[6];
ed228cbc 163
164 TObjArray *pmdcont = new TObjArray();
920e13db 165
5c5cadd5 166 AliPMDClustering *pmdclust = new AliPMDClusteringV1();
7e9508a7 167
b9e2f33c 168 // fetch the recoparam object from database
169 fRecoParam = AliPMDReconstructor::GetRecoParam();
170
171 if(fRecoParam == 0x0)
172 {
173 AliFatal("No Reco Param found for PMD!!!");
174 }
175
01709453 176
177 fRunLoader->GetEvent(ievt);
7e9508a7 178
01b56f5c 179
b208c6a3 180 fTreeD = fPMDLoader->TreeD();
181 if (fTreeD == 0x0)
01709453 182 {
7e9508a7 183 AliFatal("AliPMDClusterFinder: Can not get TreeD");
184
01709453 185 }
186 AliPMDdigit *pmddigit;
b208c6a3 187 TBranch *branch = fTreeD->GetBranch("PMDDigit");
01709453 188 branch->SetAddress(&fDigits);
189
190 ResetRecpoint();
01b56f5c 191
b208c6a3 192 fTreeR = fPMDLoader->TreeR();
193 if (fTreeR == 0x0)
01709453 194 {
b208c6a3 195 fPMDLoader->MakeTree("R");
196 fTreeR = fPMDLoader->TreeR();
01709453 197 }
198
199 Int_t bufsize = 16000;
5c5cadd5 200 TBranch * branch1 = fTreeR->Branch("PMDRecpoint", &fRecpoints, bufsize);
201 TBranch * branch2 = fTreeR->Branch("PMDRechit", &fRechits, bufsize);
01709453 202
b208c6a3 203 Int_t nmodules = (Int_t) fTreeD->GetEntries();
01b56f5c 204
01709453 205 for (Int_t imodule = 0; imodule < nmodules; imodule++)
206 {
ed228cbc 207 ResetCellADC();
b208c6a3 208 fTreeD->GetEntry(imodule);
01709453 209 Int_t nentries = fDigits->GetLast();
210 for (Int_t ient = 0; ient < nentries+1; ient++)
211 {
212 pmddigit = (AliPMDdigit*)fDigits->UncheckedAt(ient);
213
214 det = pmddigit->GetDetector();
215 smn = pmddigit->GetSMNumber();
5e6a9312 216 xpos = pmddigit->GetRow();
217 ypos = pmddigit->GetColumn();
01709453 218 adc = pmddigit->GetADC();
f0290c15 219 if(xpos < 0 || xpos > 48 || ypos < 0 || ypos > 96)
220 {
221 AliError(Form("*Row %d and Column NUMBER %d NOT Valid *",
222 xpos, ypos));
223 continue;
224 }
7adbd8e9 225
226 // Hot cell - set the cell adc = 0
227 Float_t hotflag = fCalibHot->GetHotChannel(det,smn,xpos,ypos);
228 if (hotflag == 1) adc = 0;
09a06455 229 // CALIBRATION
35535af7 230 Float_t gain = fCalibGain->GetGainFact(det,smn,xpos,ypos);
2332574a 231 // printf("adc = %d gain = %f\n",adc,gain);
09a06455 232
233 adc = adc*gain;
234
ed228cbc 235 //Int_t trno = pmddigit->GetTrackNumber();
920e13db 236 fCellTrack[xpos][ypos] = pmddigit->GetTrackNumber();
237 fCellPid[xpos][ypos] = pmddigit->GetTrackPid();
238 fCellADC[xpos][ypos] = (Double_t) adc;
01709453 239 }
01709453 240
ed228cbc 241 idet = det;
1758e4fe 242 ismn = smn;
b9e2f33c 243
244 // Set the minimum noise cut per module before clustering
245
246 Int_t imod = idet*24 + ismn;
247 fEcut = fRecoParam->GetNoiseCut(imod); // default
248 // fEcut = fRecoParam->GetPbPbParam()->GetNoiseCut(imod);
249 // fEcut = fRecoParam->GetPPParam()->GetNoiseCut(imod);
250 // fEcut = fRecoParam->GetCosmicParam()->GetNoiseCut(imod);
251
252 pmdclust->SetEdepCut(fEcut);
27a78deb 253 pmdclust->DoClust(idet,ismn,fCellTrack,fCellPid,fCellADC,pmdcont);
920e13db 254
ed228cbc 255 Int_t nentries1 = pmdcont->GetEntries();
7e9508a7 256
257 AliDebug(1,Form("Total number of clusters/module = %d",nentries1));
258
ed228cbc 259 for (Int_t ient1 = 0; ient1 < nentries1; ient1++)
01709453 260 {
ebd83c56 261 AliPMDcluster *pmdcl = (AliPMDcluster*)pmdcont->UncheckedAt(ient1);
1758e4fe 262 idet = pmdcl->GetDetector();
263 ismn = pmdcl->GetSMN();
264 clusdata[0] = pmdcl->GetClusX();
265 clusdata[1] = pmdcl->GetClusY();
266 clusdata[2] = pmdcl->GetClusADC();
267 clusdata[3] = pmdcl->GetClusCells();
5c5cadd5 268 clusdata[4] = pmdcl->GetClusSigmaX();
269 clusdata[5] = pmdcl->GetClusSigmaY();
01b56f5c 270
1758e4fe 271 AddRecPoint(idet,ismn,clusdata);
5c5cadd5 272
5c5cadd5 273 Int_t ncell = (Int_t) clusdata[3];
274 for(Int_t ihit = 0; ihit < ncell; ihit++)
275 {
276 Int_t celldataX = pmdcl->GetClusCellX(ihit);
277 Int_t celldataY = pmdcl->GetClusCellY(ihit);
920e13db 278 Int_t celldataTr = pmdcl->GetClusCellTrack(ihit);
279 Int_t celldataPid = pmdcl->GetClusCellPid(ihit);
b0e4d1e1 280 Float_t celldataAdc = pmdcl->GetClusCellAdc(ihit);
281 AddRecHit(celldataX, celldataY, celldataTr, celldataPid, celldataAdc);
5c5cadd5 282 }
283 branch2->Fill();
284 ResetRechit();
ed228cbc 285 }
26e08752 286 pmdcont->Delete();
920e13db 287
5c5cadd5 288 branch1->Fill();
ed228cbc 289 ResetRecpoint();
290
291 } // modules
292
01709453 293 ResetCellADC();
e1287360 294 fPMDLoader = fRunLoader->GetLoader("PMDLoader");
b208c6a3 295 fPMDLoader->WriteRecPoints("OVERWRITE");
01709453 296
297 // delete the pointers
298 delete pmdclust;
299 delete pmdcont;
7e9508a7 300}
301// ------------------------------------------------------------------------- //
302
8fbad6d3 303void AliPMDClusterFinder::Digits2RecPoints(TTree *digitsTree,
304 TTree *clustersTree)
305{
306 // Converts digits to recpoints after running clustering
307 // algorithm on CPV plane and PREshower plane
2c1131dd 308 //
f0290c15 309 // This algorithm is called during the reconstruction from digits
8fbad6d3 310
311 Int_t det = 0,smn = 0;
312 Int_t xpos,ypos;
313 Float_t adc;
314 Int_t ismn;
315 Int_t idet;
316 Float_t clusdata[6];
317
5254fcca 318 AliPMDcluster *pmdcl = 0x0;
319
8fbad6d3 320 TObjArray *pmdcont = new TObjArray();
27a78deb 321
8fbad6d3 322 AliPMDClustering *pmdclust = new AliPMDClusteringV1();
323
b9e2f33c 324 // Fetch the reco param object
325
326 fRecoParam = AliPMDReconstructor::GetRecoParam();
327 if(fRecoParam == 0x0)
328 {
329 AliFatal("No Reco Param found for PMD!!!");
330 }
331
8fbad6d3 332
8fbad6d3 333 AliPMDdigit *pmddigit;
334 TBranch *branch = digitsTree->GetBranch("PMDDigit");
335 branch->SetAddress(&fDigits);
336
337 ResetRecpoint();
338
8fbad6d3 339 Int_t bufsize = 16000;
340 TBranch * branch1 = clustersTree->Branch("PMDRecpoint", &fRecpoints, bufsize);
341 TBranch * branch2 = clustersTree->Branch("PMDRechit", &fRechits, bufsize);
342
343 Int_t nmodules = (Int_t) digitsTree->GetEntries();
344
345 for (Int_t imodule = 0; imodule < nmodules; imodule++)
346 {
5254fcca 347
348 Int_t totADCMod = 0;
8fbad6d3 349 ResetCellADC();
350 digitsTree->GetEntry(imodule);
351 Int_t nentries = fDigits->GetLast();
352 for (Int_t ient = 0; ient < nentries+1; ient++)
353 {
354 pmddigit = (AliPMDdigit*)fDigits->UncheckedAt(ient);
355
356 det = pmddigit->GetDetector();
357 smn = pmddigit->GetSMNumber();
358 xpos = pmddigit->GetRow();
359 ypos = pmddigit->GetColumn();
360 adc = pmddigit->GetADC();
8a523d22 361
362 if(det < 0 || det > 1)
363 {
364 AliError(Form("*CPV/PRE NUMBER WRONG %d *",det));
365 continue;
366 }
72f10132 367 if(smn == -1 || smn > 23)
8a523d22 368 {
369 AliError(Form("*MODULE NUMBER WRONG %d *",smn));
370 continue;
371 }
372
72f10132 373 if(xpos < 0 || xpos > 47 || ypos < 0 || ypos > 95)
f0290c15 374 {
375 AliError(Form("*Row %d and Column NUMBER %d NOT Valid *",
376 xpos, ypos));
377 continue;
378 }
379
35535af7 380 // Pedestal Subtraction
381 Int_t pedmeanrms = fCalibPed->GetPedMeanRms(det,smn,xpos,ypos);
37edc588 382 Int_t pedrms1 = (Int_t) pedmeanrms%100;
35535af7 383 Float_t pedrms = (Float_t)pedrms1/10.;
384 Float_t pedmean = (Float_t) (pedmeanrms - pedrms1)/1000.0;
385 //printf("%f %f\n",pedmean, pedrms);
386
387 Float_t adc1 = adc - (pedmean + 3.0*pedrms);
388
7adbd8e9 389 // Hot cell - set the cell adc = 0
390 Float_t hotflag = fCalibHot->GetHotChannel(det,smn,xpos,ypos);
8a523d22 391 if (hotflag == 1.) adc1 = 0;
7adbd8e9 392
8fbad6d3 393 // CALIBRATION
35535af7 394 Float_t gain = fCalibGain->GetGainFact(det,smn,xpos,ypos);
8fbad6d3 395 // printf("adc = %d gain = %f\n",adc,gain);
35535af7 396
397 adc = adc1*gain;
8fbad6d3 398
920e13db 399 fCellTrack[xpos][ypos] = pmddigit->GetTrackNumber();
400 fCellPid[xpos][ypos] = pmddigit->GetTrackPid();
8fbad6d3 401 fCellADC[xpos][ypos] = (Double_t) adc;
5254fcca 402
5fbd2db1 403 totADCMod += (Int_t) adc;
5254fcca 404
8fbad6d3 405 }
406
407 idet = det;
408 ismn = smn;
5254fcca 409
410 if (totADCMod <= 0) continue;
411
b9e2f33c 412 // Set the minimum noise cut per module before clustering
413
414 Int_t imod = idet*24 + ismn;
415 fEcut = fRecoParam->GetNoiseCut(imod); // default
416 // fEcut = fRecoParam->GetPbPbParam()->GetNoiseCut(imod);
417 // fEcut = fRecoParam->GetPPParam()->GetNoiseCut(imod);
418 // fEcut = fRecoParam->GetCosmicParam()->GetNoiseCut(imod);
419
420
421 pmdclust->SetEdepCut(fEcut);
27a78deb 422 pmdclust->DoClust(idet,ismn,fCellTrack,fCellPid,fCellADC,pmdcont);
8fbad6d3 423
424 Int_t nentries1 = pmdcont->GetEntries();
425
426 AliDebug(1,Form("Total number of clusters/module = %d",nentries1));
427
428 for (Int_t ient1 = 0; ient1 < nentries1; ient1++)
429 {
920e13db 430 pmdcl = (AliPMDcluster*)pmdcont->UncheckedAt(ient1);
8fbad6d3 431 idet = pmdcl->GetDetector();
432 ismn = pmdcl->GetSMN();
433 clusdata[0] = pmdcl->GetClusX();
434 clusdata[1] = pmdcl->GetClusY();
435 clusdata[2] = pmdcl->GetClusADC();
436 clusdata[3] = pmdcl->GetClusCells();
437 clusdata[4] = pmdcl->GetClusSigmaX();
438 clusdata[5] = pmdcl->GetClusSigmaY();
439
440 AddRecPoint(idet,ismn,clusdata);
441
442 Int_t ncell = (Int_t) clusdata[3];
27a78deb 443 if (ncell > 19) ncell = 19;
8fbad6d3 444 for(Int_t ihit = 0; ihit < ncell; ihit++)
445 {
446 Int_t celldataX = pmdcl->GetClusCellX(ihit);
447 Int_t celldataY = pmdcl->GetClusCellY(ihit);
920e13db 448 Int_t celldataTr = pmdcl->GetClusCellTrack(ihit);
449 Int_t celldataPid = pmdcl->GetClusCellPid(ihit);
b0e4d1e1 450 Float_t celldataAdc = pmdcl->GetClusCellAdc(ihit);
451 AddRecHit(celldataX, celldataY, celldataTr, celldataPid, celldataAdc);
8fbad6d3 452 }
453 branch2->Fill();
454 ResetRechit();
455 }
26e08752 456 pmdcont->Delete();
920e13db 457
8fbad6d3 458 branch1->Fill();
459 ResetRecpoint();
460
461 } // modules
462
920e13db 463
8fbad6d3 464 ResetCellADC();
8fbad6d3 465
466 // delete the pointers
467 delete pmdclust;
468 delete pmdcont;
8fbad6d3 469}
470// ------------------------------------------------------------------------- //
471
7e9508a7 472void AliPMDClusterFinder::Digits2RecPoints(AliRawReader *rawReader,
473 TTree *clustersTree)
474{
475 // Converts RAW data to recpoints after running clustering
476 // algorithm on CPV and PREshower plane
477 //
2c1131dd 478 // This method is called at the time of reconstruction from RAW data
2332574a 479
7e9508a7 480
920e13db 481 AliPMDddldata *pmdddl = 0x0;
482 AliPMDcluster *pmdcl = 0x0;
5254fcca 483
5c5cadd5 484 Float_t clusdata[6];
df42ab21 485 TObjArray pmdddlcont;
7e9508a7 486
487 TObjArray *pmdcont = new TObjArray();
5254fcca 488
5c5cadd5 489 AliPMDClustering *pmdclust = new AliPMDClusteringV1();
7e9508a7 490
08cf9354 491 // open the ddl file info to know the module
492 TString ddlinfofileName(gSystem->Getenv("ALICE_ROOT"));
493 ddlinfofileName += "/PMD/PMD_ddl_info.dat";
494
495 ifstream infileddl;
496 infileddl.open(ddlinfofileName.Data(), ios::in); // ascii file
497 if(!infileddl) AliError("Could not read the ddl info file");
498
499 Int_t ddlno;
500 Int_t modno;
501 Int_t modulePerDDL;
502 Int_t moduleddl[6];
503
504 for(Int_t jddl = 0; jddl < 6; jddl++)
505 {
506 if (infileddl.eof()) break;
507 infileddl >> ddlno >> modulePerDDL;
508 moduleddl[jddl] = modulePerDDL;
509
510 if (modulePerDDL == 0) continue;
511 for (Int_t im = 0; im < modulePerDDL; im++)
512 {
513 infileddl >> modno;
514 }
515 }
516
517 infileddl.close();
518
b9e2f33c 519 // Set the minimum noise cut per module before clustering
520
521 fRecoParam = AliPMDReconstructor::GetRecoParam();
522
523 if(fRecoParam == 0x0)
524 {
525 AliFatal("No Reco Param found for PMD!!!");
526 }
527
7e9508a7 528 ResetRecpoint();
529
530 Int_t bufsize = 16000;
5c5cadd5 531 TBranch *branch1 = clustersTree->Branch("PMDRecpoint", &fRecpoints, bufsize);
532
533 TBranch * branch2 = clustersTree->Branch("PMDRechit", &fRechits, bufsize);
7e9508a7 534
7e9508a7 535 const Int_t kRow = 48;
536 const Int_t kCol = 96;
537
538 Int_t idet = 0;
539 Int_t iSMN = 0;
2332574a 540
722ccc67 541 Int_t indexDDL = -1;
542 AliPMDRawStream pmdinput(rawReader);
8fbad6d3 543
722ccc67 544 while ((indexDDL = pmdinput.DdlData(&pmdddlcont)) >=0)
08cf9354 545 {
546 iSMN = moduleddl[indexDDL];
547
7e9508a7 548 Int_t ***precpvADC;
549 precpvADC = new int **[iSMN];
550 for (Int_t i=0; i<iSMN; i++) precpvADC[i] = new int *[kRow];
551 for (Int_t i=0; i<iSMN;i++)
552 {
553 for (Int_t j=0; j<kRow; j++) precpvADC[i][j] = new int [kCol];
554 }
555 for (Int_t i = 0; i < iSMN; i++)
556 {
557 for (Int_t j = 0; j < kRow; j++)
558 {
559 for (Int_t k = 0; k < kCol; k++)
560 {
561 precpvADC[i][j][k] = 0;
562 }
563 }
564 }
565 ResetCellADC();
2332574a 566
df42ab21 567 Int_t indexsmn = 0;
568 Int_t ientries = pmdddlcont.GetEntries();
569 for (Int_t ient = 0; ient < ientries; ient++)
7e9508a7 570 {
920e13db 571 pmdddl = (AliPMDddldata*)pmdddlcont.UncheckedAt(ient);
7e9508a7 572
df42ab21 573 Int_t det = pmdddl->GetDetector();
574 Int_t smn = pmdddl->GetSMN();
575 //Int_t mcm = pmdddl->GetMCM();
576 //Int_t chno = pmdddl->GetChannel();
577 Int_t row = pmdddl->GetRow();
578 Int_t col = pmdddl->GetColumn();
579 Int_t sig = pmdddl->GetSignal();
2c1131dd 580
72f10132 581
8a523d22 582 if(det < 0 || det > 1)
583 {
584 AliError(Form("*CPV/PRE NUMBER WRONG %d *",det));
585 continue;
586 }
72f10132 587 if(smn < 0 || smn > 23)
2c1131dd 588 {
589 AliError(Form("*MODULE NUMBER WRONG %d *",smn));
590 continue;
591 }
72f10132 592 if(row < 0 || row > 47 || col < 0 || col > 95)
f0290c15 593 {
594 AliError(Form("*Row %d and Column NUMBER %d NOT Valid *",
595 row, col));
08cf9354 596
f0290c15 597 continue;
598 }
2c1131dd 599
72f10132 600
35535af7 601 // Pedestal Subtraction
602 Int_t pedmeanrms = fCalibPed->GetPedMeanRms(det,smn,row,col);
37edc588 603 Int_t pedrms1 = (Int_t) pedmeanrms%100;
35535af7 604 Float_t pedrms = (Float_t)pedrms1/10.;
605 Float_t pedmean = (Float_t) (pedmeanrms - pedrms1)/1000.0;
606
607 //printf("%f %f\n",pedmean, pedrms);
608
609 // Float_t sig1 = (Float_t) sig;
610 Float_t sig1 = (Float_t) sig - (pedmean + 3.0*pedrms);
611
8a523d22 612
7adbd8e9 613 // Hot cell - set the cell adc = 0
614 Float_t hotflag = fCalibHot->GetHotChannel(det,smn,row,col);
8a523d22 615 if (hotflag == 1.) sig1 = 0;
7adbd8e9 616
09a06455 617 // CALIBRATION
35535af7 618 Float_t gain = fCalibGain->GetGainFact(det,smn,row,col);
df42ab21 619 //printf("sig = %d gain = %f\n",sig,gain);
09a06455 620 sig = (Int_t) (sig1*gain);
7e9508a7 621
08cf9354 622 if (indexDDL == 0)
623 {
624 if (det != 0)
625 AliError(Form("*DDL %d and Detector NUMBER %d NOT MATCHING *",
626 indexDDL, det));
627 if (iSMN == 6)
628 {
629 indexsmn = smn;
630 }
631 else if (iSMN == 12)
632 {
633 if (smn < 6)
634 indexsmn = smn;
635 else if (smn >= 18 && smn < 24)
636 indexsmn = smn-12;
637 }
638 }
639 else if (indexDDL >= 1 && indexDDL < 4)
7e9508a7 640 {
641 if (det != 0)
642 AliError(Form("*DDL %d and Detector NUMBER %d NOT MATCHING *",
643 indexDDL, det));
644 indexsmn = smn - indexDDL * 6;
645 }
646 else if (indexDDL == 4)
647 {
648 if (det != 1)
649 AliError(Form("*DDL %d and Detector NUMBER %d NOT MATCHING *",
650 indexDDL, det));
651 if (smn < 6)
652 {
653 indexsmn = smn;
654 }
df42ab21 655 else if (smn >= 18 && smn < 24)
7e9508a7 656 {
df42ab21 657 indexsmn = smn - 12;
7e9508a7 658 }
659 }
660 else if (indexDDL == 5)
661 {
662 if (det != 1)
663 AliError(Form("*DDL %d and Detector NUMBER %d NOT MATCHING *",
664 indexDDL, det));
08cf9354 665 if (smn >= 6 && smn < 18)
7e9508a7 666 {
df42ab21 667 indexsmn = smn - 6;
7e9508a7 668 }
669 }
08cf9354 670
7e9508a7 671 precpvADC[indexsmn][row][col] = sig;
df42ab21 672 }
673
26e08752 674 pmdddlcont.Delete();
7e9508a7 675
5254fcca 676 Int_t totAdcMod = 0;
677
7e9508a7 678 Int_t ismn = 0;
78fc1b96 679 for (indexsmn = 0; indexsmn < iSMN; indexsmn++)
7e9508a7 680 {
681 ResetCellADC();
5254fcca 682 totAdcMod = 0;
7e9508a7 683 for (Int_t irow = 0; irow < kRow; irow++)
684 {
685 for (Int_t icol = 0; icol < kCol; icol++)
686 {
920e13db 687 fCellTrack[irow][icol] = -1;
688 fCellPid[irow][icol] = -1;
689
7e9508a7 690 fCellADC[irow][icol] =
691 (Double_t) precpvADC[indexsmn][irow][icol];
5254fcca 692 totAdcMod += precpvADC[indexsmn][irow][icol];
7e9508a7 693 } // row
694 } // col
df42ab21 695
08cf9354 696 if (indexDDL == 0)
697 {
698 if (iSMN == 6)
699 {
700 ismn = indexsmn;
701 }
702 else if (iSMN == 12)
703 {
704
705 if (indexsmn < 6)
706 ismn = indexsmn;
707 else if (indexsmn >= 6 && indexsmn < 12)
708 ismn = indexsmn + 12;
709 }
710 idet = 0;
711 }
712 else if (indexDDL >= 1 && indexDDL < 4)
7e9508a7 713 {
714 ismn = indexsmn + indexDDL * 6;
715 idet = 0;
716 }
717 else if (indexDDL == 4)
718 {
719 if (indexsmn < 6)
720 {
721 ismn = indexsmn;
722 }
723 else if (indexsmn >= 6 && indexsmn < 12)
724 {
df42ab21 725 ismn = indexsmn + 12;
7e9508a7 726 }
727 idet = 1;
728 }
729 else if (indexDDL == 5)
730 {
08cf9354 731 ismn = indexsmn + 6;
7e9508a7 732 idet = 1;
733 }
734
5254fcca 735 if (totAdcMod <= 0) continue;
920e13db 736
b9e2f33c 737 Int_t imod = idet*24 + ismn;
738
739 fEcut = fRecoParam->GetNoiseCut(imod); // default
740 // fEcut = fRecoParam->GetPbPbParam()->GetNoiseCut(imod);
741 // fEcut = fRecoParam->GetPPParam()->GetNoiseCut(imod);
742 // fEcut = fRecoParam->GetCosmicParam()->GetNoiseCut(imod);
743
744
745 pmdclust->SetEdepCut(fEcut);
27a78deb 746 pmdclust->DoClust(idet,ismn,fCellTrack,fCellPid,fCellADC,pmdcont);
920e13db 747
7e9508a7 748 Int_t nentries1 = pmdcont->GetEntries();
749
750 AliDebug(1,Form("Total number of clusters/module = %d",nentries1));
751
752 for (Int_t ient1 = 0; ient1 < nentries1; ient1++)
753 {
920e13db 754 pmdcl = (AliPMDcluster*)pmdcont->UncheckedAt(ient1);
7e9508a7 755 idet = pmdcl->GetDetector();
756 ismn = pmdcl->GetSMN();
757 clusdata[0] = pmdcl->GetClusX();
758 clusdata[1] = pmdcl->GetClusY();
759 clusdata[2] = pmdcl->GetClusADC();
760 clusdata[3] = pmdcl->GetClusCells();
5c5cadd5 761 clusdata[4] = pmdcl->GetClusSigmaX();
762 clusdata[5] = pmdcl->GetClusSigmaY();
7e9508a7 763
764 AddRecPoint(idet,ismn,clusdata);
09a06455 765
5c5cadd5 766 Int_t ncell = (Int_t) clusdata[3];
27a78deb 767 if (ncell > 19) ncell = 19;
5c5cadd5 768 for(Int_t ihit = 0; ihit < ncell; ihit++)
769 {
770 Int_t celldataX = pmdcl->GetClusCellX(ihit);
771 Int_t celldataY = pmdcl->GetClusCellY(ihit);
920e13db 772 Int_t celldataTr = pmdcl->GetClusCellTrack(ihit);
773 Int_t celldataPid = pmdcl->GetClusCellPid(ihit);
b0e4d1e1 774 Float_t celldataAdc = pmdcl->GetClusCellAdc(ihit);
775 AddRecHit(celldataX, celldataY, celldataTr, celldataPid, celldataAdc);
5c5cadd5 776 }
777 branch2->Fill();
778 ResetRechit();
779
7e9508a7 780 }
26e08752 781 pmdcont->Delete();
920e13db 782
5c5cadd5 783 branch1->Fill();
7e9508a7 784 ResetRecpoint();
785
786
787 } // smn
788
789 for (Int_t i=0; i<iSMN; i++)
790 {
791 for (Int_t j=0; j<kRow; j++) delete [] precpvADC[i][j];
792 }
793 for (Int_t i=0; i<iSMN; i++) delete [] precpvADC[i];
c9e0bd24 794 delete [] precpvADC;
722ccc67 795
7e9508a7 796 } // DDL Loop
920e13db 797
7e9508a7 798
799 ResetCellADC();
800
801 // delete the pointers
802 delete pmdclust;
803 delete pmdcont;
01709453 804}
1758e4fe 805// ------------------------------------------------------------------------- //
5f55af10 806
807void AliPMDClusterFinder::Digits2RecPoints(Int_t ievt, AliRawReader *rawReader)
808{
01b56f5c 809 // Converts RAW data to recpoints after running clustering
810 // algorithm on CPV and PREshower plane
5f55af10 811 //
812
5c5cadd5 813 Float_t clusdata[6];
920e13db 814
df42ab21 815 TObjArray pmdddlcont;
920e13db 816
b0e4d1e1 817 AliPMDcluster *pmdcl = 0x0;
920e13db 818
5f55af10 819 TObjArray *pmdcont = new TObjArray();
5c5cadd5 820
821 AliPMDClustering *pmdclust = new AliPMDClusteringV1();
7e9508a7 822
08cf9354 823 // open the ddl file info to know the module
824 TString ddlinfofileName(gSystem->Getenv("ALICE_ROOT"));
825 ddlinfofileName += "/PMD/PMD_ddl_info.dat";
826
827 ifstream infileddl;
828 infileddl.open(ddlinfofileName.Data(), ios::in); // ascii file
829 if(!infileddl) AliError("Could not read the ddl info file");
830
831 Int_t ddlno;
832 Int_t modno;
833 Int_t modulePerDDL;
834 Int_t moduleddl[6];
835
836 for(Int_t jddl = 0; jddl < 6; jddl++)
837 {
838 if (infileddl.eof()) break;
839 infileddl >> ddlno >> modulePerDDL;
840 moduleddl[jddl] = modulePerDDL;
841
842 if (modulePerDDL == 0) continue;
843 for (Int_t im = 0; im < modulePerDDL; im++)
844 {
845 infileddl >> modno;
846 }
847 }
848
849 infileddl.close();
850
b9e2f33c 851 // Set the minimum noise cut per module before clustering
852
853 fRecoParam = AliPMDReconstructor::GetRecoParam();
854
855 if(fRecoParam == 0x0)
856 {
857 AliFatal("No Reco Param found for PMD!!!");
858 }
859
5f55af10 860
861 fRunLoader->GetEvent(ievt);
862
863 ResetRecpoint();
01b56f5c 864
5f55af10 865 fTreeR = fPMDLoader->TreeR();
866 if (fTreeR == 0x0)
867 {
868 fPMDLoader->MakeTree("R");
869 fTreeR = fPMDLoader->TreeR();
870 }
5f55af10 871 Int_t bufsize = 16000;
5c5cadd5 872 TBranch *branch1 = fTreeR->Branch("PMDRecpoint", &fRecpoints, bufsize);
873 TBranch *branch2 = fTreeR->Branch("PMDRechit", &fRechits, bufsize);
01b56f5c 874
5f55af10 875 const Int_t kRow = 48;
876 const Int_t kCol = 96;
5f55af10 877
01b56f5c 878 Int_t idet = 0;
879 Int_t iSMN = 0;
722ccc67 880
881 AliPMDRawStream pmdinput(rawReader);
882 Int_t indexDDL = -1;
883
08cf9354 884 while ((indexDDL = pmdinput.DdlData(&pmdddlcont)) >=0)
885 {
886
887 iSMN = moduleddl[indexDDL];
722ccc67 888
01b56f5c 889 Int_t ***precpvADC;
890 precpvADC = new int **[iSMN];
891 for (Int_t i=0; i<iSMN; i++) precpvADC[i] = new int *[kRow];
892 for (Int_t i=0; i<iSMN;i++)
5f55af10 893 {
01b56f5c 894 for (Int_t j=0; j<kRow; j++) precpvADC[i][j] = new int [kCol];
5f55af10 895 }
01b56f5c 896 for (Int_t i = 0; i < iSMN; i++)
897 {
898 for (Int_t j = 0; j < kRow; j++)
899 {
900 for (Int_t k = 0; k < kCol; k++)
901 {
902 precpvADC[i][j][k] = 0;
903 }
904 }
905 }
906 ResetCellADC();
df42ab21 907
908 Int_t indexsmn = 0;
909 Int_t ientries = pmdddlcont.GetEntries();
910 for (Int_t ient = 0; ient < ientries; ient++)
01b56f5c 911 {
df42ab21 912 AliPMDddldata *pmdddl = (AliPMDddldata*)pmdddlcont.UncheckedAt(ient);
913
914 Int_t det = pmdddl->GetDetector();
915 Int_t smn = pmdddl->GetSMN();
916 //Int_t mcm = pmdddl->GetMCM();
917 //Int_t chno = pmdddl->GetChannel();
918 Int_t row = pmdddl->GetRow();
919 Int_t col = pmdddl->GetColumn();
920 Int_t sig = pmdddl->GetSignal();
f0290c15 921 if(row < 0 || row > 48 || col < 0 || col > 96)
922 {
923 AliError(Form("*Row %d and Column NUMBER %d NOT Valid *",
924 row, col));
925 continue;
926 }
35535af7 927 // Pedestal Subtraction
928 Int_t pedmeanrms = fCalibPed->GetPedMeanRms(det,smn,row,col);
37edc588 929 Int_t pedrms1 = (Int_t) pedmeanrms%100;
35535af7 930 Float_t pedrms = (Float_t)pedrms1/10.;
931 Float_t pedmean = (Float_t) (pedmeanrms - pedrms1)/1000.0;
35535af7 932 //printf("%f %f\n",pedmean, pedrms);
35535af7 933 Float_t sig1 = (Float_t) sig - (pedmean + 3.0*pedrms);
7adbd8e9 934
935 // Hot cell - set the cell adc = 0
936 Float_t hotflag = fCalibHot->GetHotChannel(det,smn,row,col);
937 if (hotflag == 1) sig1 = 0;
938
09a06455 939 // CALIBRATION
35535af7 940 Float_t gain = fCalibGain->GetGainFact(det,smn,row,col);
2332574a 941
df42ab21 942 //printf("sig = %d gain = %f\n",sig,gain);
09a06455 943 sig = (Int_t) (sig1*gain);
df42ab21 944
08cf9354 945 if (indexDDL == 0)
946 {
947 if (det != 0)
948 AliError(Form("*DDL %d and Detector NUMBER %d NOT MATCHING *",
949 indexDDL, det));
950 if (iSMN == 6)
951 {
952 indexsmn = smn;
953 }
954 else if (iSMN == 12)
955 {
956 if (smn < 6)
957 indexsmn = smn;
958 else if (smn >= 18 && smn < 24)
959 indexsmn = smn-12;
960 }
961 }
962 else if (indexDDL >= 1 && indexDDL < 4)
01b56f5c 963 {
964 if (det != 0)
7e9508a7 965 AliError(Form("*DDL %d and Detector NUMBER %d NOT MATCHING *",
966 indexDDL, det));
01b56f5c 967 indexsmn = smn - indexDDL * 6;
968 }
969 else if (indexDDL == 4)
970 {
971 if (det != 1)
7e9508a7 972 AliError(Form("*DDL %d and Detector NUMBER %d NOT MATCHING *",
973 indexDDL, det));
01b56f5c 974 if (smn < 6)
975 {
976 indexsmn = smn;
977 }
df42ab21 978 else if (smn >= 18 && smn < 24)
01b56f5c 979 {
df42ab21 980 indexsmn = smn - 12;
01b56f5c 981 }
982 }
983 else if (indexDDL == 5)
984 {
985 if (det != 1)
7e9508a7 986 AliError(Form("*DDL %d and Detector NUMBER %d NOT MATCHING *",
987 indexDDL, det));
08cf9354 988 if (smn >= 6 && smn < 18)
01b56f5c 989 {
df42ab21 990 indexsmn = smn - 6;
01b56f5c 991 }
992 }
08cf9354 993
01b56f5c 994 precpvADC[indexsmn][row][col] = sig;
df42ab21 995
996 }
997
26e08752 998 pmdddlcont.Delete();
01b56f5c 999
1000 Int_t ismn = 0;
78fc1b96 1001 for (indexsmn = 0; indexsmn < iSMN; indexsmn++)
5f55af10 1002 {
01b56f5c 1003 ResetCellADC();
5f55af10 1004 for (Int_t irow = 0; irow < kRow; irow++)
1005 {
1006 for (Int_t icol = 0; icol < kCol; icol++)
1007 {
920e13db 1008 fCellTrack[irow][icol] = -1;
1009 fCellPid[irow][icol] = -1;
01b56f5c 1010 fCellADC[irow][icol] =
1011 (Double_t) precpvADC[indexsmn][irow][icol];
5f55af10 1012 } // row
1013 } // col
df42ab21 1014
08cf9354 1015
1016 if (indexDDL == 0)
1017 {
1018 if (iSMN == 6)
1019 {
1020 ismn = indexsmn;
1021 }
1022 else if (iSMN == 12)
1023 {
1024
1025 if (indexsmn < 6)
1026 ismn = indexsmn;
1027 else if (indexsmn >= 6 && indexsmn < 12)
1028 ismn = indexsmn + 12;
1029 }
1030 idet = 0;
1031 }
1032 else if (indexDDL >= 1 && indexDDL < 4)
01b56f5c 1033 {
1034 ismn = indexsmn + indexDDL * 6;
1035 idet = 0;
1036 }
1037 else if (indexDDL == 4)
1038 {
1039 if (indexsmn < 6)
1040 {
1041 ismn = indexsmn;
1042 }
1043 else if (indexsmn >= 6 && indexsmn < 12)
1044 {
df42ab21 1045 ismn = indexsmn + 12;
01b56f5c 1046 }
1047 idet = 1;
1048 }
1049 else if (indexDDL == 5)
1050 {
08cf9354 1051 ismn = indexsmn + 6;
01b56f5c 1052 idet = 1;
1053 }
1054
b9e2f33c 1055 Int_t imod = idet*24 + ismn;
1056 fEcut = fRecoParam->GetNoiseCut(imod); // default
1057 // fEcut = fRecoParam->GetPbPbParam()->GetNoiseCut(imod);
1058 // fEcut = fRecoParam->GetPPParam()->GetNoiseCut(imod);
1059 // fEcut = fRecoParam->GetCosmicParam()->GetNoiseCut(imod);
1060
1061 pmdclust->SetEdepCut(fEcut);
1062
27a78deb 1063 pmdclust->DoClust(idet,ismn,fCellTrack,fCellPid,fCellADC,pmdcont);
920e13db 1064
5f55af10 1065 Int_t nentries1 = pmdcont->GetEntries();
7e9508a7 1066
1067 AliDebug(1,Form("Total number of clusters/module = %d",nentries1));
1068
5f55af10 1069 for (Int_t ient1 = 0; ient1 < nentries1; ient1++)
1070 {
b0e4d1e1 1071 pmdcl = (AliPMDcluster*)pmdcont->UncheckedAt(ient1);
5f55af10 1072 idet = pmdcl->GetDetector();
1073 ismn = pmdcl->GetSMN();
1074 clusdata[0] = pmdcl->GetClusX();
1075 clusdata[1] = pmdcl->GetClusY();
1076 clusdata[2] = pmdcl->GetClusADC();
1077 clusdata[3] = pmdcl->GetClusCells();
5c5cadd5 1078 clusdata[4] = pmdcl->GetClusSigmaX();
1079 clusdata[5] = pmdcl->GetClusSigmaY();
01b56f5c 1080
5f55af10 1081 AddRecPoint(idet,ismn,clusdata);
5c5cadd5 1082
5c5cadd5 1083 Int_t ncell = (Int_t) clusdata[3];
1084 for(Int_t ihit = 0; ihit < ncell; ihit++)
1085 {
1086 Int_t celldataX = pmdcl->GetClusCellX(ihit);
1087 Int_t celldataY = pmdcl->GetClusCellY(ihit);
920e13db 1088 Int_t celldataTr = pmdcl->GetClusCellTrack(ihit);
1089 Int_t celldataPid = pmdcl->GetClusCellPid(ihit);
b0e4d1e1 1090 Float_t celldataAdc = pmdcl->GetClusCellAdc(ihit);
1091 AddRecHit(celldataX, celldataY, celldataTr, celldataPid, celldataAdc);
5c5cadd5 1092 }
1093 branch2->Fill();
1094 ResetRechit();
1095
5f55af10 1096 }
26e08752 1097 pmdcont->Delete();
920e13db 1098
5c5cadd5 1099 branch1->Fill();
5f55af10 1100 ResetRecpoint();
01b56f5c 1101
1102
5f55af10 1103 } // smn
5f55af10 1104
01b56f5c 1105 for (Int_t i=0; i<iSMN; i++)
1106 {
1107 for (Int_t j=0; j<kRow; j++) delete [] precpvADC[i][j];
1108 }
1109 for (Int_t i=0; i<iSMN; i++) delete [] precpvADC[i];
1110 delete precpvADC;
1111 } // DDL Loop
920e13db 1112
1113
5f55af10 1114 ResetCellADC();
01b56f5c 1115
5f55af10 1116 fPMDLoader = fRunLoader->GetLoader("PMDLoader");
1117 fPMDLoader->WriteRecPoints("OVERWRITE");
1118
1119 // delete the pointers
1120 delete pmdclust;
1121 delete pmdcont;
5f55af10 1122}
1123// ------------------------------------------------------------------------- //
ed228cbc 1124void AliPMDClusterFinder::SetCellEdepCut(Float_t ecut)
1125{
1126 fEcut = ecut;
1127}
1758e4fe 1128// ------------------------------------------------------------------------- //
1758e4fe 1129void AliPMDClusterFinder::AddRecPoint(Int_t idet,Int_t ismn,Float_t *clusdata)
01709453 1130{
b208c6a3 1131 // Add Reconstructed points
1132 //
01709453 1133 TClonesArray &lrecpoints = *fRecpoints;
ed228cbc 1134 AliPMDrecpoint1 *newrecpoint;
1758e4fe 1135 newrecpoint = new AliPMDrecpoint1(idet, ismn, clusdata);
ed228cbc 1136 new(lrecpoints[fNpoint++]) AliPMDrecpoint1(newrecpoint);
01709453 1137 delete newrecpoint;
1138}
1758e4fe 1139// ------------------------------------------------------------------------- //
920e13db 1140void AliPMDClusterFinder::AddRecHit(Int_t celldataX,Int_t celldataY,
b0e4d1e1 1141 Int_t celldataTr, Int_t celldataPid,
1142 Float_t celldataAdc)
5c5cadd5 1143{
1144 // Add associated cell hits to the Reconstructed points
1145 //
1146 TClonesArray &lrechits = *fRechits;
1147 AliPMDrechit *newrechit;
b0e4d1e1 1148 newrechit = new AliPMDrechit(celldataX, celldataY, celldataTr, celldataPid, celldataAdc);
5c5cadd5 1149 new(lrechits[fNhit++]) AliPMDrechit(newrechit);
1150 delete newrechit;
1151}
1152// ------------------------------------------------------------------------- //
01709453 1153void AliPMDClusterFinder::ResetCellADC()
1154{
b208c6a3 1155 // Reset the individual cell ADC value to zero
1156 //
5e6a9312 1157 for(Int_t irow = 0; irow < fgkRow; irow++)
01709453 1158 {
5e6a9312 1159 for(Int_t icol = 0; icol < fgkCol; icol++)
01709453 1160 {
920e13db 1161 fCellTrack[irow][icol] = -1;
1162 fCellPid[irow][icol] = -1;
1163 fCellADC[irow][icol] = 0.;
01709453 1164 }
1165 }
1166}
1758e4fe 1167// ------------------------------------------------------------------------- //
01709453 1168void AliPMDClusterFinder::ResetRecpoint()
1169{
b208c6a3 1170 // Clear the list of reconstructed points
01709453 1171 fNpoint = 0;
1172 if (fRecpoints) fRecpoints->Clear();
1173}
1758e4fe 1174// ------------------------------------------------------------------------- //
5c5cadd5 1175void AliPMDClusterFinder::ResetRechit()
1176{
1177 // Clear the list of reconstructed points
1178 fNhit = 0;
1179 if (fRechits) fRechits->Clear();
1180}
1181// ------------------------------------------------------------------------- //
55601d47 1182void AliPMDClusterFinder::Load()
1183{
ebd83c56 1184 // Load all the *.root files
55601d47 1185 //
1186 fPMDLoader->LoadDigits("READ");
1187 fPMDLoader->LoadRecPoints("recreate");
1188}
1189// ------------------------------------------------------------------------- //
01b56f5c 1190void AliPMDClusterFinder::LoadClusters()
1191{
1192 // Load all the *.root files
1193 //
1194 fPMDLoader->LoadRecPoints("recreate");
1195}
1196// ------------------------------------------------------------------------- //
ebd83c56 1197void AliPMDClusterFinder::UnLoad()
01709453 1198{
b208c6a3 1199 // Unload all the *.root files
1200 //
ebd83c56 1201 fPMDLoader->UnloadDigits();
1202 fPMDLoader->UnloadRecPoints();
01709453 1203}
1758e4fe 1204// ------------------------------------------------------------------------- //
01b56f5c 1205void AliPMDClusterFinder::UnLoadClusters()
1206{
1207 // Unload all the *.root files
1208 //
1209 fPMDLoader->UnloadRecPoints();
1210}
1211// ------------------------------------------------------------------------- //
35535af7 1212AliPMDCalibData* AliPMDClusterFinder::GetCalibGain() const
09a06455 1213{
1214 // The run number will be centralized in AliCDBManager,
1215 // you don't need to set it here!
1216 // Added by ZA
35535af7 1217 AliCDBEntry *entry = AliCDBManager::Instance()->Get("PMD/Calib/Gain");
09a06455 1218
0dd3d6f9 1219 if(!entry) AliFatal("Calibration object retrieval failed! ");
09a06455 1220
1221 AliPMDCalibData *calibdata=0;
1222 if (entry) calibdata = (AliPMDCalibData*) entry->GetObject();
1223
0dd3d6f9 1224 if (!calibdata) AliFatal("No calibration data from calibration database !");
09a06455 1225
1226 return calibdata;
1227}
35535af7 1228// ------------------------------------------------------------------------- //
35535af7 1229AliPMDPedestal* AliPMDClusterFinder::GetCalibPed() const
1230{
1231 // The run number will be centralized in AliCDBManager,
1232 // you don't need to set it here!
1233 AliCDBEntry *entry = AliCDBManager::Instance()->Get("PMD/Calib/Ped");
1234
1235 if(!entry) AliFatal("Pedestal object retrieval failed!");
1236
1237 AliPMDPedestal *pedestal = 0;
1238 if (entry) pedestal = (AliPMDPedestal*) entry->GetObject();
1239
1240 if (!pedestal) AliFatal("No pedestal data from pedestal database !");
1241
1242 return pedestal;
1243}
7adbd8e9 1244//--------------------------------------------------------------------//
1245AliPMDHotData* AliPMDClusterFinder::GetCalibHot() const
1246{
1247 // The run number will be centralized in AliCDBManager,
1248 // you don't need to set it here!
1249 AliCDBEntry *entry = AliCDBManager::Instance()->Get("PMD/Calib/Hot");
1250
1251 if(!entry) AliFatal("HotData object retrieval failed!");
1252
1253 AliPMDHotData *hot = 0;
1254 if (entry) hot = (AliPMDHotData*) entry->GetObject();
1255
1256 if (!hot) AliFatal("No hot data from database !");
1257
1258 return hot;
1259}
1260