1 /***************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
16 //-----------------------------------------------------//
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) //
23 //-----------------------------------------------------//
25 #include <Riostream.h>
27 #include <TObjArray.h>
28 #include <TClonesArray.h>
31 #include "AliRunLoader.h"
32 #include "AliLoader.h"
33 #include "AliRawReader.h"
35 #include "AliPMDdigit.h"
36 #include "AliPMDClusterFinder.h"
37 #include "AliPMDClustering.h"
38 #include "AliPMDClusteringV1.h"
39 #include "AliPMDcluster.h"
40 #include "AliPMDrecpoint1.h"
41 #include "AliPMDrechit.h"
42 #include "AliPMDisocell.h"
43 #include "AliPMDRawStream.h"
44 #include "AliPMDCalibData.h"
45 #include "AliPMDPedestal.h"
46 #include "AliPMDddldata.h"
49 #include "AliCDBManager.h"
50 #include "AliCDBEntry.h"
54 ClassImp(AliPMDClusterFinder)
56 AliPMDClusterFinder::AliPMDClusterFinder():
59 fCalibGain(GetCalibGain()),
60 fCalibPed(GetCalibPed()),
63 fDigits(new TClonesArray("AliPMDdigit", 1000)),
64 fRecpoints(new TClonesArray("AliPMDrecpoint1", 1000)),
65 fRechits(new TClonesArray("AliPMDrechit", 1000)),
75 // ------------------------------------------------------------------------- //
76 AliPMDClusterFinder::AliPMDClusterFinder(AliRunLoader* runLoader):
77 fRunLoader(runLoader),
78 fPMDLoader(runLoader->GetLoader("PMDLoader")),
79 fCalibGain(GetCalibGain()),
80 fCalibPed(GetCalibPed()),
83 fDigits(new TClonesArray("AliPMDdigit", 1000)),
84 fRecpoints(new TClonesArray("AliPMDrecpoint1", 1000)),
85 fRechits(new TClonesArray("AliPMDrechit", 1000)),
95 // ------------------------------------------------------------------------- //
96 AliPMDClusterFinder::AliPMDClusterFinder(const AliPMDClusterFinder & finder):
100 fCalibGain(GetCalibGain()),
101 fCalibPed(GetCalibPed()),
113 AliError("Copy constructor not allowed");
115 // ------------------------------------------------------------------------- //
116 AliPMDClusterFinder &AliPMDClusterFinder::operator=(const AliPMDClusterFinder & /*finder*/)
119 AliError("Assignment Operator not allowed");
122 // ------------------------------------------------------------------------- //
123 AliPMDClusterFinder::~AliPMDClusterFinder()
140 // ------------------------------------------------------------------------- //
142 void AliPMDClusterFinder::Digits2RecPoints(Int_t ievt)
144 // Converts digits to recpoints after running clustering
145 // algorithm on CPV plane and PREshower plane
148 Int_t det = 0,smn = 0;
155 AliPMDisocell *pmdiso = 0x0;
157 TObjArray *pmdcont = new TObjArray();
158 TObjArray *pmdisocell = new TObjArray();
160 AliPMDClustering *pmdclust = new AliPMDClusteringV1();
162 pmdclust->SetEdepCut(fEcut);
164 fRunLoader->GetEvent(ievt);
167 fTreeD = fPMDLoader->TreeD();
170 AliFatal("AliPMDClusterFinder: Can not get TreeD");
173 AliPMDdigit *pmddigit;
174 TBranch *branch = fTreeD->GetBranch("PMDDigit");
175 branch->SetAddress(&fDigits);
179 fTreeR = fPMDLoader->TreeR();
182 fPMDLoader->MakeTree("R");
183 fTreeR = fPMDLoader->TreeR();
186 Int_t bufsize = 16000;
187 TBranch * branch1 = fTreeR->Branch("PMDRecpoint", &fRecpoints, bufsize);
188 TBranch * branch2 = fTreeR->Branch("PMDRechit", &fRechits, bufsize);
190 Int_t nmodules = (Int_t) fTreeD->GetEntries();
192 for (Int_t imodule = 0; imodule < nmodules; imodule++)
195 fTreeD->GetEntry(imodule);
196 Int_t nentries = fDigits->GetLast();
197 for (Int_t ient = 0; ient < nentries+1; ient++)
199 pmddigit = (AliPMDdigit*)fDigits->UncheckedAt(ient);
201 det = pmddigit->GetDetector();
202 smn = pmddigit->GetSMNumber();
203 xpos = pmddigit->GetRow();
204 ypos = pmddigit->GetColumn();
205 adc = pmddigit->GetADC();
206 if(xpos < 0 || xpos > 48 || ypos < 0 || ypos > 96)
208 AliError(Form("*Row %d and Column NUMBER %d NOT Valid *",
213 Float_t gain = fCalibGain->GetGainFact(det,smn,xpos,ypos);
214 // printf("adc = %d gain = %f\n",adc,gain);
218 //Int_t trno = pmddigit->GetTrackNumber();
219 fCellTrack[xpos][ypos] = pmddigit->GetTrackNumber();
220 fCellPid[xpos][ypos] = pmddigit->GetTrackPid();
221 fCellADC[xpos][ypos] = (Double_t) adc;
226 //pmdclust->DoClust(idet,ismn,fCellADC,pmdisocell,pmdcont);
227 pmdclust->DoClust(idet,ismn,fCellTrack,fCellPid,fCellADC,
230 Int_t nentries1 = pmdcont->GetEntries();
232 AliDebug(1,Form("Total number of clusters/module = %d",nentries1));
234 for (Int_t ient1 = 0; ient1 < nentries1; ient1++)
236 AliPMDcluster *pmdcl = (AliPMDcluster*)pmdcont->UncheckedAt(ient1);
237 idet = pmdcl->GetDetector();
238 ismn = pmdcl->GetSMN();
239 clusdata[0] = pmdcl->GetClusX();
240 clusdata[1] = pmdcl->GetClusY();
241 clusdata[2] = pmdcl->GetClusADC();
242 clusdata[3] = pmdcl->GetClusCells();
243 clusdata[4] = pmdcl->GetClusSigmaX();
244 clusdata[5] = pmdcl->GetClusSigmaY();
246 AddRecPoint(idet,ismn,clusdata);
248 Int_t ncell = (Int_t) clusdata[3];
249 for(Int_t ihit = 0; ihit < ncell; ihit++)
251 Int_t celldataX = pmdcl->GetClusCellX(ihit);
252 Int_t celldataY = pmdcl->GetClusCellY(ihit);
253 Int_t celldataTr = pmdcl->GetClusCellTrack(ihit);
254 Int_t celldataPid = pmdcl->GetClusCellPid(ihit);
255 AddRecHit(celldataX, celldataY, celldataTr, celldataPid);
256 //AddRecHit(celldataX, celldataY);
263 // Added single isolated cell for offline gain calibration
264 nentries1 = pmdisocell->GetEntries();
265 AliDebug(1,Form("Total number of isolated single cell clusters = %d",nentries1));
267 for (Int_t ient1 = 0; ient1 < nentries1; ient1++)
269 pmdiso = (AliPMDisocell*)pmdisocell->UncheckedAt(ient1);
270 idet = pmdiso->GetDetector();
271 ismn = pmdiso->GetSmn();
272 clusdata[0] = (Float_t) pmdiso->GetRow();
273 clusdata[1] = (Float_t) pmdiso->GetCol();
274 clusdata[2] = pmdiso->GetADC();
279 AddRecPoint(idet,ismn,clusdata);
281 pmdisocell->Delete();
289 fPMDLoader = fRunLoader->GetLoader("PMDLoader");
290 fPMDLoader->WriteRecPoints("OVERWRITE");
292 // delete the pointers
298 // ------------------------------------------------------------------------- //
300 void AliPMDClusterFinder::Digits2RecPoints(TTree *digitsTree,
303 // Converts digits to recpoints after running clustering
304 // algorithm on CPV plane and PREshower plane
306 // This algorithm is called during the reconstruction from digits
308 Int_t det = 0,smn = 0;
315 AliPMDcluster *pmdcl = 0x0;
316 AliPMDisocell *pmdiso = 0x0;
318 TObjArray *pmdcont = new TObjArray();
319 TObjArray *pmdisocell = new TObjArray();
320 AliPMDClustering *pmdclust = new AliPMDClusteringV1();
322 pmdclust->SetEdepCut(fEcut);
324 AliPMDdigit *pmddigit;
325 TBranch *branch = digitsTree->GetBranch("PMDDigit");
326 branch->SetAddress(&fDigits);
330 Int_t bufsize = 16000;
331 TBranch * branch1 = clustersTree->Branch("PMDRecpoint", &fRecpoints, bufsize);
332 TBranch * branch2 = clustersTree->Branch("PMDRechit", &fRechits, bufsize);
334 Int_t nmodules = (Int_t) digitsTree->GetEntries();
336 for (Int_t imodule = 0; imodule < nmodules; imodule++)
341 digitsTree->GetEntry(imodule);
342 Int_t nentries = fDigits->GetLast();
343 for (Int_t ient = 0; ient < nentries+1; ient++)
345 pmddigit = (AliPMDdigit*)fDigits->UncheckedAt(ient);
347 det = pmddigit->GetDetector();
348 smn = pmddigit->GetSMNumber();
349 xpos = pmddigit->GetRow();
350 ypos = pmddigit->GetColumn();
351 adc = pmddigit->GetADC();
352 if(xpos < 0 || xpos > 48 || ypos < 0 || ypos > 96)
354 AliError(Form("*Row %d and Column NUMBER %d NOT Valid *",
359 // Pedestal Subtraction
360 Int_t pedmeanrms = fCalibPed->GetPedMeanRms(det,smn,xpos,ypos);
361 Int_t pedrms1 = (Int_t) pedmeanrms%100;
362 Float_t pedrms = (Float_t)pedrms1/10.;
363 Float_t pedmean = (Float_t) (pedmeanrms - pedrms1)/1000.0;
364 //printf("%f %f\n",pedmean, pedrms);
366 Float_t adc1 = adc - (pedmean + 3.0*pedrms);
369 Float_t gain = fCalibGain->GetGainFact(det,smn,xpos,ypos);
370 // printf("adc = %d gain = %f\n",adc,gain);
374 //Int_t trno = pmddigit->GetTrackNumber();
375 fCellTrack[xpos][ypos] = pmddigit->GetTrackNumber();
376 fCellPid[xpos][ypos] = pmddigit->GetTrackPid();
377 fCellADC[xpos][ypos] = (Double_t) adc;
379 totADCMod += (Int_t) adc;
386 if (totADCMod <= 0) continue;
388 pmdclust->DoClust(idet,ismn,fCellTrack,fCellPid,fCellADC,
391 Int_t nentries1 = pmdcont->GetEntries();
393 AliDebug(1,Form("Total number of clusters/module = %d",nentries1));
395 for (Int_t ient1 = 0; ient1 < nentries1; ient1++)
397 pmdcl = (AliPMDcluster*)pmdcont->UncheckedAt(ient1);
398 idet = pmdcl->GetDetector();
399 ismn = pmdcl->GetSMN();
400 clusdata[0] = pmdcl->GetClusX();
401 clusdata[1] = pmdcl->GetClusY();
402 clusdata[2] = pmdcl->GetClusADC();
403 clusdata[3] = pmdcl->GetClusCells();
404 clusdata[4] = pmdcl->GetClusSigmaX();
405 clusdata[5] = pmdcl->GetClusSigmaY();
407 AddRecPoint(idet,ismn,clusdata);
409 Int_t ncell = (Int_t) clusdata[3];
410 for(Int_t ihit = 0; ihit < ncell; ihit++)
412 Int_t celldataX = pmdcl->GetClusCellX(ihit);
413 Int_t celldataY = pmdcl->GetClusCellY(ihit);
414 Int_t celldataTr = pmdcl->GetClusCellTrack(ihit);
415 Int_t celldataPid = pmdcl->GetClusCellPid(ihit);
416 AddRecHit(celldataX, celldataY, celldataTr, celldataPid);
423 // Added single isolated cell for offline gain calibration
424 nentries1 = pmdisocell->GetEntries();
425 AliDebug(1,Form("Total number of isolated single cell clusters = %d",nentries1));
427 for (Int_t ient1 = 0; ient1 < nentries1; ient1++)
429 pmdiso = (AliPMDisocell*)pmdisocell->UncheckedAt(ient1);
430 idet = pmdiso->GetDetector();
431 ismn = pmdiso->GetSmn();
432 clusdata[0] = (Float_t) pmdiso->GetRow();
433 clusdata[1] = (Float_t) pmdiso->GetCol();
434 clusdata[2] = pmdiso->GetADC();
439 AddRecPoint(idet,ismn,clusdata);
441 pmdisocell->Delete();
451 // delete the pointers
456 // ------------------------------------------------------------------------- //
458 void AliPMDClusterFinder::Digits2RecPoints(AliRawReader *rawReader,
461 // Converts RAW data to recpoints after running clustering
462 // algorithm on CPV and PREshower plane
464 // This method is called at the time of reconstruction from RAW data
467 AliPMDddldata *pmdddl = 0x0;
468 AliPMDcluster *pmdcl = 0x0;
469 AliPMDisocell *pmdiso = 0x0;
473 TObjArray pmdddlcont;
475 TObjArray *pmdcont = new TObjArray();
476 TObjArray *pmdisocell = new TObjArray();
478 AliPMDClustering *pmdclust = new AliPMDClusteringV1();
480 pmdclust->SetEdepCut(fEcut);
484 Int_t bufsize = 16000;
485 TBranch *branch1 = clustersTree->Branch("PMDRecpoint", &fRecpoints, bufsize);
487 TBranch * branch2 = clustersTree->Branch("PMDRechit", &fRechits, bufsize);
489 const Int_t kRow = 48;
490 const Int_t kCol = 96;
496 AliPMDRawStream pmdinput(rawReader);
498 while ((indexDDL = pmdinput.DdlData(&pmdddlcont)) >=0)
504 else if (indexDDL >= 4)
509 precpvADC = new int **[iSMN];
510 for (Int_t i=0; i<iSMN; i++) precpvADC[i] = new int *[kRow];
511 for (Int_t i=0; i<iSMN;i++)
513 for (Int_t j=0; j<kRow; j++) precpvADC[i][j] = new int [kCol];
515 for (Int_t i = 0; i < iSMN; i++)
517 for (Int_t j = 0; j < kRow; j++)
519 for (Int_t k = 0; k < kCol; k++)
521 precpvADC[i][j][k] = 0;
528 Int_t ientries = pmdddlcont.GetEntries();
529 for (Int_t ient = 0; ient < ientries; ient++)
531 pmdddl = (AliPMDddldata*)pmdddlcont.UncheckedAt(ient);
533 Int_t det = pmdddl->GetDetector();
534 Int_t smn = pmdddl->GetSMN();
535 //Int_t mcm = pmdddl->GetMCM();
536 //Int_t chno = pmdddl->GetChannel();
537 Int_t row = pmdddl->GetRow();
538 Int_t col = pmdddl->GetColumn();
539 Int_t sig = pmdddl->GetSignal();
543 AliError(Form("*MODULE NUMBER WRONG %d *",smn));
546 if(row < 0 || row > 48 || col < 0 || col > 96)
548 AliError(Form("*Row %d and Column NUMBER %d NOT Valid *",
553 // Pedestal Subtraction
554 Int_t pedmeanrms = fCalibPed->GetPedMeanRms(det,smn,row,col);
555 Int_t pedrms1 = (Int_t) pedmeanrms%100;
556 Float_t pedrms = (Float_t)pedrms1/10.;
557 Float_t pedmean = (Float_t) (pedmeanrms - pedrms1)/1000.0;
559 //printf("%f %f\n",pedmean, pedrms);
561 // Float_t sig1 = (Float_t) sig;
562 Float_t sig1 = (Float_t) sig - (pedmean + 3.0*pedrms);
565 Float_t gain = fCalibGain->GetGainFact(det,smn,row,col);
566 //printf("sig = %d gain = %f\n",sig,gain);
567 sig = (Int_t) (sig1*gain);
572 AliError(Form("*DDL %d and Detector NUMBER %d NOT MATCHING *",
574 indexsmn = smn - indexDDL * 6;
576 else if (indexDDL == 4)
579 AliError(Form("*DDL %d and Detector NUMBER %d NOT MATCHING *",
585 else if (smn >= 18 && smn < 24)
590 else if (indexDDL == 5)
593 AliError(Form("*DDL %d and Detector NUMBER %d NOT MATCHING *",
595 if (smn >= 6 && smn < 12)
599 else if (smn >= 12 && smn < 18)
604 precpvADC[indexsmn][row][col] = sig;
612 for (indexsmn = 0; indexsmn < iSMN; indexsmn++)
616 for (Int_t irow = 0; irow < kRow; irow++)
618 for (Int_t icol = 0; icol < kCol; icol++)
620 fCellTrack[irow][icol] = -1;
621 fCellPid[irow][icol] = -1;
623 fCellADC[irow][icol] =
624 (Double_t) precpvADC[indexsmn][irow][icol];
625 totAdcMod += precpvADC[indexsmn][irow][icol];
631 ismn = indexsmn + indexDDL * 6;
634 else if (indexDDL == 4)
640 else if (indexsmn >= 6 && indexsmn < 12)
642 ismn = indexsmn + 12;
646 else if (indexDDL == 5)
652 else if (indexsmn >= 6 && indexsmn < 12)
659 if (totAdcMod <= 0) continue;
662 //pmdclust->DoClust(idet,ismn,fCellADC,pmdisocell,pmdcont);
663 pmdclust->DoClust(idet,ismn,fCellTrack,fCellPid,fCellADC,
666 Int_t nentries1 = pmdcont->GetEntries();
668 AliDebug(1,Form("Total number of clusters/module = %d",nentries1));
670 for (Int_t ient1 = 0; ient1 < nentries1; ient1++)
672 pmdcl = (AliPMDcluster*)pmdcont->UncheckedAt(ient1);
673 idet = pmdcl->GetDetector();
674 ismn = pmdcl->GetSMN();
675 clusdata[0] = pmdcl->GetClusX();
676 clusdata[1] = pmdcl->GetClusY();
677 clusdata[2] = pmdcl->GetClusADC();
678 clusdata[3] = pmdcl->GetClusCells();
679 clusdata[4] = pmdcl->GetClusSigmaX();
680 clusdata[5] = pmdcl->GetClusSigmaY();
682 AddRecPoint(idet,ismn,clusdata);
684 Int_t ncell = (Int_t) clusdata[3];
685 for(Int_t ihit = 0; ihit < ncell; ihit++)
687 Int_t celldataX = pmdcl->GetClusCellX(ihit);
688 Int_t celldataY = pmdcl->GetClusCellY(ihit);
689 Int_t celldataTr = pmdcl->GetClusCellTrack(ihit);
690 Int_t celldataPid = pmdcl->GetClusCellPid(ihit);
691 AddRecHit(celldataX, celldataY, celldataTr, celldataPid);
692 //AddRecHit(celldataX, celldataY);
701 // Added single isolated cell for offline gain calibration
702 nentries1 = pmdisocell->GetEntries();
703 AliDebug(1,Form("Total number of isolated single cell clusters = %d",nentries1));
705 for (Int_t ient1 = 0; ient1 < nentries1; ient1++)
707 pmdiso = (AliPMDisocell*)pmdisocell->UncheckedAt(ient1);
708 idet = pmdiso->GetDetector();
709 ismn = pmdiso->GetSmn();
710 clusdata[0] = (Float_t) pmdiso->GetRow();
711 clusdata[1] = (Float_t) pmdiso->GetCol();
712 clusdata[2] = pmdiso->GetADC();
717 AddRecPoint(idet,ismn,clusdata);
719 pmdisocell->Delete();
727 for (Int_t i=0; i<iSMN; i++)
729 for (Int_t j=0; j<kRow; j++) delete [] precpvADC[i][j];
731 for (Int_t i=0; i<iSMN; i++) delete [] precpvADC[i];
739 // delete the pointers
745 // ------------------------------------------------------------------------- //
747 void AliPMDClusterFinder::Digits2RecPoints(Int_t ievt, AliRawReader *rawReader)
749 // Converts RAW data to recpoints after running clustering
750 // algorithm on CPV and PREshower plane
755 TObjArray pmdddlcont;
757 //AliPMDcluster *pmdcl = 0x0;
758 AliPMDisocell *pmdiso = 0x0;
761 TObjArray *pmdcont = new TObjArray();
762 TObjArray *pmdisocell = new TObjArray();
764 AliPMDClustering *pmdclust = new AliPMDClusteringV1();
766 pmdclust->SetEdepCut(fEcut);
768 fRunLoader->GetEvent(ievt);
772 fTreeR = fPMDLoader->TreeR();
775 fPMDLoader->MakeTree("R");
776 fTreeR = fPMDLoader->TreeR();
778 Int_t bufsize = 16000;
779 TBranch *branch1 = fTreeR->Branch("PMDRecpoint", &fRecpoints, bufsize);
780 TBranch *branch2 = fTreeR->Branch("PMDRechit", &fRechits, bufsize);
782 const Int_t kRow = 48;
783 const Int_t kCol = 96;
788 AliPMDRawStream pmdinput(rawReader);
791 while ((indexDDL = pmdinput.DdlData(&pmdddlcont)) >=0) {
797 else if (indexDDL >= 4)
802 precpvADC = new int **[iSMN];
803 for (Int_t i=0; i<iSMN; i++) precpvADC[i] = new int *[kRow];
804 for (Int_t i=0; i<iSMN;i++)
806 for (Int_t j=0; j<kRow; j++) precpvADC[i][j] = new int [kCol];
808 for (Int_t i = 0; i < iSMN; i++)
810 for (Int_t j = 0; j < kRow; j++)
812 for (Int_t k = 0; k < kCol; k++)
814 precpvADC[i][j][k] = 0;
822 Int_t ientries = pmdddlcont.GetEntries();
823 for (Int_t ient = 0; ient < ientries; ient++)
825 AliPMDddldata *pmdddl = (AliPMDddldata*)pmdddlcont.UncheckedAt(ient);
827 Int_t det = pmdddl->GetDetector();
828 Int_t smn = pmdddl->GetSMN();
829 //Int_t mcm = pmdddl->GetMCM();
830 //Int_t chno = pmdddl->GetChannel();
831 Int_t row = pmdddl->GetRow();
832 Int_t col = pmdddl->GetColumn();
833 Int_t sig = pmdddl->GetSignal();
834 if(row < 0 || row > 48 || col < 0 || col > 96)
836 AliError(Form("*Row %d and Column NUMBER %d NOT Valid *",
840 // Pedestal Subtraction
841 Int_t pedmeanrms = fCalibPed->GetPedMeanRms(det,smn,row,col);
842 Int_t pedrms1 = (Int_t) pedmeanrms%100;
843 Float_t pedrms = (Float_t)pedrms1/10.;
844 Float_t pedmean = (Float_t) (pedmeanrms - pedrms1)/1000.0;
846 //printf("%f %f\n",pedmean, pedrms);
848 //Float_t sig1 = (Float_t) sig;
849 Float_t sig1 = (Float_t) sig - (pedmean + 3.0*pedrms);
851 Float_t gain = fCalibGain->GetGainFact(det,smn,row,col);
853 //printf("sig = %d gain = %f\n",sig,gain);
854 sig = (Int_t) (sig1*gain);
860 AliError(Form("*DDL %d and Detector NUMBER %d NOT MATCHING *",
862 indexsmn = smn - indexDDL * 6;
864 else if (indexDDL == 4)
867 AliError(Form("*DDL %d and Detector NUMBER %d NOT MATCHING *",
873 else if (smn >= 18 && smn < 24)
878 else if (indexDDL == 5)
881 AliError(Form("*DDL %d and Detector NUMBER %d NOT MATCHING *",
883 if (smn >= 6 && smn < 12)
887 else if (smn >= 12 && smn < 18)
892 precpvADC[indexsmn][row][col] = sig;
899 for (indexsmn = 0; indexsmn < iSMN; indexsmn++)
902 for (Int_t irow = 0; irow < kRow; irow++)
904 for (Int_t icol = 0; icol < kCol; icol++)
906 fCellTrack[irow][icol] = -1;
907 fCellPid[irow][icol] = -1;
908 fCellADC[irow][icol] =
909 (Double_t) precpvADC[indexsmn][irow][icol];
916 ismn = indexsmn + indexDDL * 6;
919 else if (indexDDL == 4)
925 else if (indexsmn >= 6 && indexsmn < 12)
927 ismn = indexsmn + 12;
931 else if (indexDDL == 5)
937 else if (indexsmn >= 6 && indexsmn < 12)
944 //pmdclust->DoClust(idet,ismn,fCellADC,pmdisocell,pmdcont);
945 pmdclust->DoClust(idet,ismn,fCellTrack,fCellPid,fCellADC,
948 Int_t nentries1 = pmdcont->GetEntries();
950 AliDebug(1,Form("Total number of clusters/module = %d",nentries1));
952 for (Int_t ient1 = 0; ient1 < nentries1; ient1++)
954 AliPMDcluster *pmdcl =
955 (AliPMDcluster*)pmdcont->UncheckedAt(ient1);
956 idet = pmdcl->GetDetector();
957 ismn = pmdcl->GetSMN();
958 clusdata[0] = pmdcl->GetClusX();
959 clusdata[1] = pmdcl->GetClusY();
960 clusdata[2] = pmdcl->GetClusADC();
961 clusdata[3] = pmdcl->GetClusCells();
962 clusdata[4] = pmdcl->GetClusSigmaX();
963 clusdata[5] = pmdcl->GetClusSigmaY();
965 AddRecPoint(idet,ismn,clusdata);
967 Int_t ncell = (Int_t) clusdata[3];
968 for(Int_t ihit = 0; ihit < ncell; ihit++)
970 Int_t celldataX = pmdcl->GetClusCellX(ihit);
971 Int_t celldataY = pmdcl->GetClusCellY(ihit);
972 Int_t celldataTr = pmdcl->GetClusCellTrack(ihit);
973 Int_t celldataPid = pmdcl->GetClusCellPid(ihit);
974 AddRecHit(celldataX, celldataY, celldataTr, celldataPid);
975 //AddRecHit(celldataX, celldataY);
983 // Added single isolated cell for offline gain calibration
984 nentries1 = pmdisocell->GetEntries();
985 AliDebug(1,Form("Total number of isolated single cell clusters = %d",nentries1));
987 for (Int_t ient1 = 0; ient1 < nentries1; ient1++)
989 pmdiso = (AliPMDisocell*)pmdisocell->UncheckedAt(ient1);
990 idet = pmdiso->GetDetector();
991 ismn = pmdiso->GetSmn();
992 clusdata[0] = (Float_t) pmdiso->GetRow();
993 clusdata[1] = (Float_t) pmdiso->GetCol();
994 clusdata[2] = pmdiso->GetADC();
999 AddRecPoint(idet,ismn,clusdata);
1001 pmdisocell->Delete();
1009 for (Int_t i=0; i<iSMN; i++)
1011 for (Int_t j=0; j<kRow; j++) delete [] precpvADC[i][j];
1013 for (Int_t i=0; i<iSMN; i++) delete [] precpvADC[i];
1020 fPMDLoader = fRunLoader->GetLoader("PMDLoader");
1021 fPMDLoader->WriteRecPoints("OVERWRITE");
1023 // delete the pointers
1028 // ------------------------------------------------------------------------- //
1029 void AliPMDClusterFinder::SetCellEdepCut(Float_t ecut)
1033 // ------------------------------------------------------------------------- //
1034 void AliPMDClusterFinder::AddRecPoint(Int_t idet,Int_t ismn,Float_t *clusdata)
1036 // Add Reconstructed points
1038 TClonesArray &lrecpoints = *fRecpoints;
1039 AliPMDrecpoint1 *newrecpoint;
1040 newrecpoint = new AliPMDrecpoint1(idet, ismn, clusdata);
1041 new(lrecpoints[fNpoint++]) AliPMDrecpoint1(newrecpoint);
1044 // ------------------------------------------------------------------------- //
1045 void AliPMDClusterFinder::AddRecHit(Int_t celldataX,Int_t celldataY,
1046 Int_t celldataTr, Int_t celldataPid)
1048 // Add associated cell hits to the Reconstructed points
1050 TClonesArray &lrechits = *fRechits;
1051 AliPMDrechit *newrechit;
1052 newrechit = new AliPMDrechit(celldataX, celldataY, celldataTr, celldataPid);
1053 new(lrechits[fNhit++]) AliPMDrechit(newrechit);
1056 // ------------------------------------------------------------------------- //
1057 void AliPMDClusterFinder::ResetCellADC()
1059 // Reset the individual cell ADC value to zero
1061 for(Int_t irow = 0; irow < fgkRow; irow++)
1063 for(Int_t icol = 0; icol < fgkCol; icol++)
1065 fCellTrack[irow][icol] = -1;
1066 fCellPid[irow][icol] = -1;
1067 fCellADC[irow][icol] = 0.;
1071 // ------------------------------------------------------------------------- //
1072 void AliPMDClusterFinder::ResetRecpoint()
1074 // Clear the list of reconstructed points
1076 if (fRecpoints) fRecpoints->Clear();
1078 // ------------------------------------------------------------------------- //
1079 void AliPMDClusterFinder::ResetRechit()
1081 // Clear the list of reconstructed points
1083 if (fRechits) fRechits->Clear();
1085 // ------------------------------------------------------------------------- //
1086 void AliPMDClusterFinder::Load()
1088 // Load all the *.root files
1090 fPMDLoader->LoadDigits("READ");
1091 fPMDLoader->LoadRecPoints("recreate");
1093 // ------------------------------------------------------------------------- //
1094 void AliPMDClusterFinder::LoadClusters()
1096 // Load all the *.root files
1098 fPMDLoader->LoadRecPoints("recreate");
1100 // ------------------------------------------------------------------------- //
1101 void AliPMDClusterFinder::UnLoad()
1103 // Unload all the *.root files
1105 fPMDLoader->UnloadDigits();
1106 fPMDLoader->UnloadRecPoints();
1108 // ------------------------------------------------------------------------- //
1109 void AliPMDClusterFinder::UnLoadClusters()
1111 // Unload all the *.root files
1113 fPMDLoader->UnloadRecPoints();
1115 // ------------------------------------------------------------------------- //
1116 AliPMDCalibData* AliPMDClusterFinder::GetCalibGain() const
1118 // The run number will be centralized in AliCDBManager,
1119 // you don't need to set it here!
1121 AliCDBEntry *entry = AliCDBManager::Instance()->Get("PMD/Calib/Gain");
1123 if(!entry) AliFatal("Calibration object retrieval failed! ");
1125 AliPMDCalibData *calibdata=0;
1126 if (entry) calibdata = (AliPMDCalibData*) entry->GetObject();
1128 if (!calibdata) AliFatal("No calibration data from calibration database !");
1132 // ------------------------------------------------------------------------- //
1133 AliPMDPedestal* AliPMDClusterFinder::GetCalibPed() const
1135 // The run number will be centralized in AliCDBManager,
1136 // you don't need to set it here!
1137 AliCDBEntry *entry = AliCDBManager::Instance()->Get("PMD/Calib/Ped");
1139 if(!entry) AliFatal("Pedestal object retrieval failed!");
1141 AliPMDPedestal *pedestal = 0;
1142 if (entry) pedestal = (AliPMDPedestal*) entry->GetObject();
1144 if (!pedestal) AliFatal("No pedestal data from pedestal database !");