]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PMD/AliPMDClusterFinder.cxx
resolving new library dependency libAOD
[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"
963fe679 48#include "AliPMDNoiseCut.h"
dc6dc1ff 49#include "AliPMDddlinfoData.h"
b9e2f33c 50#include "AliPMDRecoParam.h"
706f7618 51#include "AliRecoParam.h"
b9e2f33c 52#include "AliPMDReconstructor.h"
09a06455 53
2332574a 54#include "AliDAQ.h"
09a06455 55#include "AliCDBManager.h"
56#include "AliCDBEntry.h"
01709453 57
7e9508a7 58
59
01709453 60ClassImp(AliPMDClusterFinder)
b208c6a3 61
7e9508a7 62AliPMDClusterFinder::AliPMDClusterFinder():
63 fRunLoader(0),
64 fPMDLoader(0),
35535af7 65 fCalibGain(GetCalibGain()),
66 fCalibPed(GetCalibPed()),
7adbd8e9 67 fCalibHot(GetCalibHot()),
963fe679 68 fNoiseCut(GetNoiseCut()),
dc6dc1ff 69 fDdlinfo(GetDdlinfoData()),
b9e2f33c 70 fRecoParam(0x0),
7e9508a7 71 fTreeD(0),
72 fTreeR(0),
73 fDigits(new TClonesArray("AliPMDdigit", 1000)),
74 fRecpoints(new TClonesArray("AliPMDrecpoint1", 1000)),
5c5cadd5 75 fRechits(new TClonesArray("AliPMDrechit", 1000)),
7e9508a7 76 fNpoint(0),
5c5cadd5 77 fNhit(0),
963fe679 78 fDetNo(0)
7e9508a7 79{
80//
81// Constructor
82//
83}
84// ------------------------------------------------------------------------- //
dfaeee5f 85AliPMDClusterFinder::AliPMDClusterFinder(AliRunLoader* runLoader):
86 fRunLoader(runLoader),
87 fPMDLoader(runLoader->GetLoader("PMDLoader")),
35535af7 88 fCalibGain(GetCalibGain()),
89 fCalibPed(GetCalibPed()),
7adbd8e9 90 fCalibHot(GetCalibHot()),
963fe679 91 fNoiseCut(GetNoiseCut()),
dc6dc1ff 92 fDdlinfo(GetDdlinfoData()),
b9e2f33c 93 fRecoParam(0x0),
1758e4fe 94 fTreeD(0),
95 fTreeR(0),
ebd83c56 96 fDigits(new TClonesArray("AliPMDdigit", 1000)),
1758e4fe 97 fRecpoints(new TClonesArray("AliPMDrecpoint1", 1000)),
5c5cadd5 98 fRechits(new TClonesArray("AliPMDrechit", 1000)),
1758e4fe 99 fNpoint(0),
5c5cadd5 100 fNhit(0),
963fe679 101 fDetNo(0)
01709453 102{
b208c6a3 103//
dfaeee5f 104// Constructor
b208c6a3 105//
a48edddd 106}
107// ------------------------------------------------------------------------- //
2332574a 108AliPMDClusterFinder::AliPMDClusterFinder(const AliPMDClusterFinder & finder):
109 TObject(finder),
110 fRunLoader(0),
111 fPMDLoader(0),
35535af7 112 fCalibGain(GetCalibGain()),
113 fCalibPed(GetCalibPed()),
7adbd8e9 114 fCalibHot(GetCalibHot()),
963fe679 115 fNoiseCut(GetNoiseCut()),
dc6dc1ff 116 fDdlinfo(GetDdlinfoData()),
b9e2f33c 117 fRecoParam(0x0),
2332574a 118 fTreeD(0),
119 fTreeR(0),
120 fDigits(NULL),
121 fRecpoints(NULL),
122 fRechits(NULL),
123 fNpoint(0),
124 fNhit(0),
963fe679 125 fDetNo(0)
a48edddd 126{
127 // copy constructor
128 AliError("Copy constructor not allowed");
129}
130// ------------------------------------------------------------------------- //
131AliPMDClusterFinder &AliPMDClusterFinder::operator=(const AliPMDClusterFinder & /*finder*/)
132{
133 // assignment op
134 AliError("Assignment Operator not allowed");
135 return *this;
01709453 136}
1758e4fe 137// ------------------------------------------------------------------------- //
01709453 138AliPMDClusterFinder::~AliPMDClusterFinder()
139{
b208c6a3 140 // Destructor
ebd83c56 141 if (fDigits)
142 {
b9e2f33c 143 fDigits->Clear();
ebd83c56 144 }
1758e4fe 145 if (fRecpoints)
146 {
722ccc67 147 fRecpoints->Clear();
1758e4fe 148 }
5c5cadd5 149 if (fRechits)
150 {
722ccc67 151 fRechits->Clear();
5c5cadd5 152 }
5254fcca 153
01709453 154}
1758e4fe 155// ------------------------------------------------------------------------- //
b208c6a3 156
8fbad6d3 157void AliPMDClusterFinder::Digits2RecPoints(TTree *digitsTree,
706f7618 158 TTree *clustersTree, Int_t gRecoMode)
8fbad6d3 159{
160 // Converts digits to recpoints after running clustering
161 // algorithm on CPV plane and PREshower plane
2c1131dd 162 //
f0290c15 163 // This algorithm is called during the reconstruction from digits
8fbad6d3 164
be8b7039 165 Int_t det = 0, smn = 0;
166 Int_t xpos = 0, ypos = 0;
167 Int_t ismn = 0;
168 Int_t idet = 0;
169 Float_t adc = 0.;
170 Float_t clusdata[6] = {0.,0.,0.,0.,0.,0.};
8fbad6d3 171
5254fcca 172 AliPMDcluster *pmdcl = 0x0;
173
8fbad6d3 174 TObjArray *pmdcont = new TObjArray();
27a78deb 175
8fbad6d3 176 AliPMDClustering *pmdclust = new AliPMDClusteringV1();
177
b9e2f33c 178 // Fetch the reco param object
179
180 fRecoParam = AliPMDReconstructor::GetRecoParam();
181 if(fRecoParam == 0x0)
182 {
183 AliFatal("No Reco Param found for PMD!!!");
184 }
185
8fbad6d3 186
8fbad6d3 187 AliPMDdigit *pmddigit;
188 TBranch *branch = digitsTree->GetBranch("PMDDigit");
189 branch->SetAddress(&fDigits);
190
191 ResetRecpoint();
192
8fbad6d3 193 Int_t bufsize = 16000;
194 TBranch * branch1 = clustersTree->Branch("PMDRecpoint", &fRecpoints, bufsize);
195 TBranch * branch2 = clustersTree->Branch("PMDRechit", &fRechits, bufsize);
196
197 Int_t nmodules = (Int_t) digitsTree->GetEntries();
198
199 for (Int_t imodule = 0; imodule < nmodules; imodule++)
200 {
5254fcca 201
202 Int_t totADCMod = 0;
8fbad6d3 203 ResetCellADC();
204 digitsTree->GetEntry(imodule);
205 Int_t nentries = fDigits->GetLast();
206 for (Int_t ient = 0; ient < nentries+1; ient++)
207 {
208 pmddigit = (AliPMDdigit*)fDigits->UncheckedAt(ient);
209
210 det = pmddigit->GetDetector();
211 smn = pmddigit->GetSMNumber();
212 xpos = pmddigit->GetRow();
213 ypos = pmddigit->GetColumn();
214 adc = pmddigit->GetADC();
8a523d22 215
216 if(det < 0 || det > 1)
217 {
218 AliError(Form("*CPV/PRE NUMBER WRONG %d *",det));
219 continue;
220 }
72f10132 221 if(smn == -1 || smn > 23)
8a523d22 222 {
223 AliError(Form("*MODULE NUMBER WRONG %d *",smn));
224 continue;
225 }
226
72f10132 227 if(xpos < 0 || xpos > 47 || ypos < 0 || ypos > 95)
f0290c15 228 {
229 AliError(Form("*Row %d and Column NUMBER %d NOT Valid *",
230 xpos, ypos));
231 continue;
232 }
233
35535af7 234 // Pedestal Subtraction
235 Int_t pedmeanrms = fCalibPed->GetPedMeanRms(det,smn,xpos,ypos);
37edc588 236 Int_t pedrms1 = (Int_t) pedmeanrms%100;
35535af7 237 Float_t pedrms = (Float_t)pedrms1/10.;
238 Float_t pedmean = (Float_t) (pedmeanrms - pedrms1)/1000.0;
239 //printf("%f %f\n",pedmean, pedrms);
240
241 Float_t adc1 = adc - (pedmean + 3.0*pedrms);
242
7adbd8e9 243 // Hot cell - set the cell adc = 0
244 Float_t hotflag = fCalibHot->GetHotChannel(det,smn,xpos,ypos);
8a523d22 245 if (hotflag == 1.) adc1 = 0;
7adbd8e9 246
8fbad6d3 247 // CALIBRATION
35535af7 248 Float_t gain = fCalibGain->GetGainFact(det,smn,xpos,ypos);
8fbad6d3 249 // printf("adc = %d gain = %f\n",adc,gain);
35535af7 250
251 adc = adc1*gain;
8fbad6d3 252
920e13db 253 fCellTrack[xpos][ypos] = pmddigit->GetTrackNumber();
254 fCellPid[xpos][ypos] = pmddigit->GetTrackPid();
8fbad6d3 255 fCellADC[xpos][ypos] = (Double_t) adc;
5254fcca 256
5fbd2db1 257 totADCMod += (Int_t) adc;
5254fcca 258
8fbad6d3 259 }
260
261 idet = det;
262 ismn = smn;
5254fcca 263
264 if (totADCMod <= 0) continue;
265
b9e2f33c 266 // Set the minimum noise cut per module before clustering
267
963fe679 268 // Int_t imod = idet*24 + ismn;
269
270
271 // Int_t cluspar = fRecoParam->GetPbPbParam()->GetClusteringParam();
706f7618 272
4755c3f1 273 Int_t cluspar = fRecoParam->GetPPParam()->GetClusteringParam();
706f7618 274
275
963fe679 276 // Int_t cluspar = fRecoParam->GetCosmicParam()->GetClusteringParam();
f6db02b3 277
278 //_______________________________________________________//
279 //Added to switch Refine and crude Clustering - satya//
280 // temporary solution - will be sorted out later
706f7618 281 /*cluspar = 1;
f6db02b3 282 static AliPMDRecoParam *reconp = NULL;
283 reconp = (AliPMDRecoParam*)AliPMDReconstructor::GetRecoParam();
284 if(!reconp) {
285 cluspar = 1;
286 }
287 else {
706f7618 288
f6db02b3 289 if( reconp->GetClusteringParam() == 1)
290 cluspar = 1;
291 if( reconp->GetClusteringParam() == 2)
292 cluspar = 2;
706f7618 293 }
294
295 */
296 cluspar = gRecoMode;
f6db02b3 297 //_______________________________________________________//
298
4755c3f1 299 pmdclust->SetClusteringParam(cluspar);
b9e2f33c 300
4e642bdd 301 Float_t encut = 4.;
963fe679 302 pmdclust->SetEdepCut(encut);
27a78deb 303 pmdclust->DoClust(idet,ismn,fCellTrack,fCellPid,fCellADC,pmdcont);
8fbad6d3 304
305 Int_t nentries1 = pmdcont->GetEntries();
306
307 AliDebug(1,Form("Total number of clusters/module = %d",nentries1));
308
309 for (Int_t ient1 = 0; ient1 < nentries1; ient1++)
310 {
920e13db 311 pmdcl = (AliPMDcluster*)pmdcont->UncheckedAt(ient1);
8fbad6d3 312 idet = pmdcl->GetDetector();
313 ismn = pmdcl->GetSMN();
314 clusdata[0] = pmdcl->GetClusX();
315 clusdata[1] = pmdcl->GetClusY();
316 clusdata[2] = pmdcl->GetClusADC();
317 clusdata[3] = pmdcl->GetClusCells();
318 clusdata[4] = pmdcl->GetClusSigmaX();
319 clusdata[5] = pmdcl->GetClusSigmaY();
320
321 AddRecPoint(idet,ismn,clusdata);
322
323 Int_t ncell = (Int_t) clusdata[3];
27a78deb 324 if (ncell > 19) ncell = 19;
8fbad6d3 325 for(Int_t ihit = 0; ihit < ncell; ihit++)
326 {
327 Int_t celldataX = pmdcl->GetClusCellX(ihit);
328 Int_t celldataY = pmdcl->GetClusCellY(ihit);
920e13db 329 Int_t celldataTr = pmdcl->GetClusCellTrack(ihit);
330 Int_t celldataPid = pmdcl->GetClusCellPid(ihit);
b0e4d1e1 331 Float_t celldataAdc = pmdcl->GetClusCellAdc(ihit);
332 AddRecHit(celldataX, celldataY, celldataTr, celldataPid, celldataAdc);
8fbad6d3 333 }
334 branch2->Fill();
335 ResetRechit();
336 }
26e08752 337 pmdcont->Delete();
920e13db 338
8fbad6d3 339 branch1->Fill();
340 ResetRecpoint();
341
342 } // modules
343
920e13db 344
8fbad6d3 345 ResetCellADC();
8fbad6d3 346
347 // delete the pointers
348 delete pmdclust;
349 delete pmdcont;
8fbad6d3 350}
351// ------------------------------------------------------------------------- //
352
7e9508a7 353void AliPMDClusterFinder::Digits2RecPoints(AliRawReader *rawReader,
706f7618 354 TTree *clustersTree, Int_t gRecoMode)
7e9508a7 355{
356 // Converts RAW data to recpoints after running clustering
357 // algorithm on CPV and PREshower plane
358 //
2c1131dd 359 // This method is called at the time of reconstruction from RAW data
2332574a 360
7e9508a7 361
920e13db 362 AliPMDddldata *pmdddl = 0x0;
363 AliPMDcluster *pmdcl = 0x0;
5254fcca 364
5c5cadd5 365 Float_t clusdata[6];
df42ab21 366 TObjArray pmdddlcont;
7e9508a7 367
368 TObjArray *pmdcont = new TObjArray();
5254fcca 369
5c5cadd5 370 AliPMDClustering *pmdclust = new AliPMDClusteringV1();
7e9508a7 371
dc6dc1ff 372 // access the ddlinfo database to fetch the no of modules per DDL
08cf9354 373
be8b7039 374 Int_t moduleddl[6] = {0,0,0,0,0,0};
08cf9354 375
376 for(Int_t jddl = 0; jddl < 6; jddl++)
377 {
dc6dc1ff 378 moduleddl[jddl] = fDdlinfo->GetNoOfModulePerDdl(jddl);
08cf9354 379 }
380
b9e2f33c 381 // Set the minimum noise cut per module before clustering
382
383 fRecoParam = AliPMDReconstructor::GetRecoParam();
384
385 if(fRecoParam == 0x0)
386 {
387 AliFatal("No Reco Param found for PMD!!!");
388 }
389
7e9508a7 390 ResetRecpoint();
391
392 Int_t bufsize = 16000;
5c5cadd5 393 TBranch *branch1 = clustersTree->Branch("PMDRecpoint", &fRecpoints, bufsize);
394
395 TBranch * branch2 = clustersTree->Branch("PMDRechit", &fRechits, bufsize);
7e9508a7 396
7e9508a7 397 const Int_t kRow = 48;
398 const Int_t kCol = 96;
399
400 Int_t idet = 0;
401 Int_t iSMN = 0;
2332574a 402
722ccc67 403 Int_t indexDDL = -1;
404 AliPMDRawStream pmdinput(rawReader);
8fbad6d3 405
722ccc67 406 while ((indexDDL = pmdinput.DdlData(&pmdddlcont)) >=0)
08cf9354 407 {
408 iSMN = moduleddl[indexDDL];
409
7e9508a7 410 Int_t ***precpvADC;
411 precpvADC = new int **[iSMN];
412 for (Int_t i=0; i<iSMN; i++) precpvADC[i] = new int *[kRow];
413 for (Int_t i=0; i<iSMN;i++)
414 {
415 for (Int_t j=0; j<kRow; j++) precpvADC[i][j] = new int [kCol];
416 }
417 for (Int_t i = 0; i < iSMN; i++)
418 {
419 for (Int_t j = 0; j < kRow; j++)
420 {
421 for (Int_t k = 0; k < kCol; k++)
422 {
423 precpvADC[i][j][k] = 0;
424 }
425 }
426 }
427 ResetCellADC();
2332574a 428
df42ab21 429 Int_t indexsmn = 0;
430 Int_t ientries = pmdddlcont.GetEntries();
431 for (Int_t ient = 0; ient < ientries; ient++)
7e9508a7 432 {
920e13db 433 pmdddl = (AliPMDddldata*)pmdddlcont.UncheckedAt(ient);
7e9508a7 434
df42ab21 435 Int_t det = pmdddl->GetDetector();
436 Int_t smn = pmdddl->GetSMN();
437 //Int_t mcm = pmdddl->GetMCM();
438 //Int_t chno = pmdddl->GetChannel();
439 Int_t row = pmdddl->GetRow();
440 Int_t col = pmdddl->GetColumn();
441 Int_t sig = pmdddl->GetSignal();
2c1131dd 442
72f10132 443
8a523d22 444 if(det < 0 || det > 1)
445 {
446 AliError(Form("*CPV/PRE NUMBER WRONG %d *",det));
447 continue;
448 }
72f10132 449 if(smn < 0 || smn > 23)
2c1131dd 450 {
451 AliError(Form("*MODULE NUMBER WRONG %d *",smn));
452 continue;
453 }
72f10132 454 if(row < 0 || row > 47 || col < 0 || col > 95)
f0290c15 455 {
456 AliError(Form("*Row %d and Column NUMBER %d NOT Valid *",
457 row, col));
08cf9354 458
f0290c15 459 continue;
460 }
2c1131dd 461
35535af7 462 // Pedestal Subtraction
463 Int_t pedmeanrms = fCalibPed->GetPedMeanRms(det,smn,row,col);
37edc588 464 Int_t pedrms1 = (Int_t) pedmeanrms%100;
35535af7 465 Float_t pedrms = (Float_t)pedrms1/10.;
466 Float_t pedmean = (Float_t) (pedmeanrms - pedrms1)/1000.0;
467
468 //printf("%f %f\n",pedmean, pedrms);
469
470 // Float_t sig1 = (Float_t) sig;
471 Float_t sig1 = (Float_t) sig - (pedmean + 3.0*pedrms);
472
7adbd8e9 473 // Hot cell - set the cell adc = 0
474 Float_t hotflag = fCalibHot->GetHotChannel(det,smn,row,col);
8a523d22 475 if (hotflag == 1.) sig1 = 0;
7adbd8e9 476
09a06455 477 // CALIBRATION
35535af7 478 Float_t gain = fCalibGain->GetGainFact(det,smn,row,col);
df42ab21 479 //printf("sig = %d gain = %f\n",sig,gain);
09a06455 480 sig = (Int_t) (sig1*gain);
7e9508a7 481
08cf9354 482 if (indexDDL == 0)
483 {
484 if (det != 0)
485 AliError(Form("*DDL %d and Detector NUMBER %d NOT MATCHING *",
486 indexDDL, det));
487 if (iSMN == 6)
488 {
489 indexsmn = smn;
490 }
491 else if (iSMN == 12)
492 {
493 if (smn < 6)
494 indexsmn = smn;
495 else if (smn >= 18 && smn < 24)
496 indexsmn = smn-12;
497 }
498 }
499 else if (indexDDL >= 1 && indexDDL < 4)
7e9508a7 500 {
501 if (det != 0)
502 AliError(Form("*DDL %d and Detector NUMBER %d NOT MATCHING *",
503 indexDDL, det));
504 indexsmn = smn - indexDDL * 6;
505 }
506 else if (indexDDL == 4)
507 {
508 if (det != 1)
509 AliError(Form("*DDL %d and Detector NUMBER %d NOT MATCHING *",
510 indexDDL, det));
511 if (smn < 6)
512 {
513 indexsmn = smn;
514 }
df42ab21 515 else if (smn >= 18 && smn < 24)
7e9508a7 516 {
df42ab21 517 indexsmn = smn - 12;
7e9508a7 518 }
519 }
520 else if (indexDDL == 5)
521 {
522 if (det != 1)
523 AliError(Form("*DDL %d and Detector NUMBER %d NOT MATCHING *",
524 indexDDL, det));
08cf9354 525 if (smn >= 6 && smn < 18)
7e9508a7 526 {
df42ab21 527 indexsmn = smn - 6;
7e9508a7 528 }
529 }
08cf9354 530
7e9508a7 531 precpvADC[indexsmn][row][col] = sig;
df42ab21 532 }
533
26e08752 534 pmdddlcont.Delete();
7e9508a7 535
5254fcca 536 Int_t totAdcMod = 0;
537
7e9508a7 538 Int_t ismn = 0;
78fc1b96 539 for (indexsmn = 0; indexsmn < iSMN; indexsmn++)
7e9508a7 540 {
541 ResetCellADC();
5254fcca 542 totAdcMod = 0;
7e9508a7 543 for (Int_t irow = 0; irow < kRow; irow++)
544 {
545 for (Int_t icol = 0; icol < kCol; icol++)
546 {
920e13db 547 fCellTrack[irow][icol] = -1;
548 fCellPid[irow][icol] = -1;
549
7e9508a7 550 fCellADC[irow][icol] =
551 (Double_t) precpvADC[indexsmn][irow][icol];
5254fcca 552 totAdcMod += precpvADC[indexsmn][irow][icol];
7e9508a7 553 } // row
554 } // col
df42ab21 555
08cf9354 556 if (indexDDL == 0)
557 {
558 if (iSMN == 6)
559 {
560 ismn = indexsmn;
561 }
562 else if (iSMN == 12)
563 {
564
565 if (indexsmn < 6)
566 ismn = indexsmn;
567 else if (indexsmn >= 6 && indexsmn < 12)
568 ismn = indexsmn + 12;
569 }
570 idet = 0;
571 }
572 else if (indexDDL >= 1 && indexDDL < 4)
7e9508a7 573 {
574 ismn = indexsmn + indexDDL * 6;
575 idet = 0;
576 }
577 else if (indexDDL == 4)
578 {
579 if (indexsmn < 6)
580 {
581 ismn = indexsmn;
582 }
583 else if (indexsmn >= 6 && indexsmn < 12)
584 {
df42ab21 585 ismn = indexsmn + 12;
7e9508a7 586 }
587 idet = 1;
588 }
589 else if (indexDDL == 5)
590 {
08cf9354 591 ismn = indexsmn + 6;
7e9508a7 592 idet = 1;
593 }
594
5254fcca 595 if (totAdcMod <= 0) continue;
920e13db 596
b9e2f33c 597 Int_t imod = idet*24 + ismn;
598
963fe679 599 // Int_t cluspar = fRecoParam->GetPbPbParam()->GetClusteringParam();
706f7618 600 Int_t cluspar = fRecoParam->GetPPParam()->GetClusteringParam();
963fe679 601 // Int_t cluspar = fRecoParam->GetCosmicParam()->GetClusteringParam();
f6db02b3 602
603 //_______________________________________________________//
604 //Added to switch Refine and crude Clustering - satya//
605 // temporary solution - will be sorted out later
706f7618 606 /* cluspar = 1;
f6db02b3 607 static AliPMDRecoParam *reconp = NULL;
608 reconp = (AliPMDRecoParam*)AliPMDReconstructor::GetRecoParam();
609 if(!reconp) {
610 cluspar = 1;
611 }
612 else {
613 if( reconp->GetClusteringParam() == 1)
614 cluspar = 1;
615 if( reconp->GetClusteringParam() == 2)
616 cluspar = 2;
706f7618 617 }*/
618
619
620 cluspar = gRecoMode; // permanent solution
621
f6db02b3 622 //_______________________________________________________//
623
4755c3f1 624 pmdclust->SetClusteringParam(cluspar);
963fe679 625 Float_t encut = fNoiseCut->GetNoiseCut(imod);
b9e2f33c 626
963fe679 627 pmdclust->SetEdepCut(encut);
27a78deb 628 pmdclust->DoClust(idet,ismn,fCellTrack,fCellPid,fCellADC,pmdcont);
920e13db 629
7e9508a7 630 Int_t nentries1 = pmdcont->GetEntries();
631
632 AliDebug(1,Form("Total number of clusters/module = %d",nentries1));
633
634 for (Int_t ient1 = 0; ient1 < nentries1; ient1++)
635 {
920e13db 636 pmdcl = (AliPMDcluster*)pmdcont->UncheckedAt(ient1);
7e9508a7 637 idet = pmdcl->GetDetector();
638 ismn = pmdcl->GetSMN();
639 clusdata[0] = pmdcl->GetClusX();
640 clusdata[1] = pmdcl->GetClusY();
641 clusdata[2] = pmdcl->GetClusADC();
642 clusdata[3] = pmdcl->GetClusCells();
5c5cadd5 643 clusdata[4] = pmdcl->GetClusSigmaX();
644 clusdata[5] = pmdcl->GetClusSigmaY();
7e9508a7 645
646 AddRecPoint(idet,ismn,clusdata);
09a06455 647
5c5cadd5 648 Int_t ncell = (Int_t) clusdata[3];
27a78deb 649 if (ncell > 19) ncell = 19;
5c5cadd5 650 for(Int_t ihit = 0; ihit < ncell; ihit++)
651 {
652 Int_t celldataX = pmdcl->GetClusCellX(ihit);
653 Int_t celldataY = pmdcl->GetClusCellY(ihit);
920e13db 654 Int_t celldataTr = pmdcl->GetClusCellTrack(ihit);
655 Int_t celldataPid = pmdcl->GetClusCellPid(ihit);
b0e4d1e1 656 Float_t celldataAdc = pmdcl->GetClusCellAdc(ihit);
657 AddRecHit(celldataX, celldataY, celldataTr, celldataPid, celldataAdc);
5c5cadd5 658 }
659 branch2->Fill();
660 ResetRechit();
661
7e9508a7 662 }
26e08752 663 pmdcont->Delete();
920e13db 664
5c5cadd5 665 branch1->Fill();
7e9508a7 666 ResetRecpoint();
667
668
669 } // smn
670
671 for (Int_t i=0; i<iSMN; i++)
672 {
673 for (Int_t j=0; j<kRow; j++) delete [] precpvADC[i][j];
674 }
675 for (Int_t i=0; i<iSMN; i++) delete [] precpvADC[i];
c9e0bd24 676 delete [] precpvADC;
722ccc67 677
7e9508a7 678 } // DDL Loop
920e13db 679
7e9508a7 680
681 ResetCellADC();
682
683 // delete the pointers
684 delete pmdclust;
685 delete pmdcont;
01709453 686}
1758e4fe 687// ------------------------------------------------------------------------- //
1758e4fe 688void AliPMDClusterFinder::AddRecPoint(Int_t idet,Int_t ismn,Float_t *clusdata)
01709453 689{
b208c6a3 690 // Add Reconstructed points
691 //
01709453 692 TClonesArray &lrecpoints = *fRecpoints;
ed228cbc 693 AliPMDrecpoint1 *newrecpoint;
1758e4fe 694 newrecpoint = new AliPMDrecpoint1(idet, ismn, clusdata);
ed228cbc 695 new(lrecpoints[fNpoint++]) AliPMDrecpoint1(newrecpoint);
01709453 696 delete newrecpoint;
697}
1758e4fe 698// ------------------------------------------------------------------------- //
920e13db 699void AliPMDClusterFinder::AddRecHit(Int_t celldataX,Int_t celldataY,
b0e4d1e1 700 Int_t celldataTr, Int_t celldataPid,
701 Float_t celldataAdc)
5c5cadd5 702{
703 // Add associated cell hits to the Reconstructed points
704 //
705 TClonesArray &lrechits = *fRechits;
706 AliPMDrechit *newrechit;
b0e4d1e1 707 newrechit = new AliPMDrechit(celldataX, celldataY, celldataTr, celldataPid, celldataAdc);
5c5cadd5 708 new(lrechits[fNhit++]) AliPMDrechit(newrechit);
709 delete newrechit;
710}
711// ------------------------------------------------------------------------- //
01709453 712void AliPMDClusterFinder::ResetCellADC()
713{
b208c6a3 714 // Reset the individual cell ADC value to zero
715 //
5e6a9312 716 for(Int_t irow = 0; irow < fgkRow; irow++)
01709453 717 {
5e6a9312 718 for(Int_t icol = 0; icol < fgkCol; icol++)
01709453 719 {
920e13db 720 fCellTrack[irow][icol] = -1;
721 fCellPid[irow][icol] = -1;
722 fCellADC[irow][icol] = 0.;
01709453 723 }
724 }
725}
1758e4fe 726// ------------------------------------------------------------------------- //
01709453 727void AliPMDClusterFinder::ResetRecpoint()
728{
b208c6a3 729 // Clear the list of reconstructed points
01709453 730 fNpoint = 0;
731 if (fRecpoints) fRecpoints->Clear();
732}
1758e4fe 733// ------------------------------------------------------------------------- //
5c5cadd5 734void AliPMDClusterFinder::ResetRechit()
735{
736 // Clear the list of reconstructed points
737 fNhit = 0;
738 if (fRechits) fRechits->Clear();
739}
740// ------------------------------------------------------------------------- //
55601d47 741void AliPMDClusterFinder::Load()
742{
ebd83c56 743 // Load all the *.root files
55601d47 744 //
745 fPMDLoader->LoadDigits("READ");
746 fPMDLoader->LoadRecPoints("recreate");
747}
748// ------------------------------------------------------------------------- //
01b56f5c 749void AliPMDClusterFinder::LoadClusters()
750{
751 // Load all the *.root files
752 //
753 fPMDLoader->LoadRecPoints("recreate");
754}
755// ------------------------------------------------------------------------- //
ebd83c56 756void AliPMDClusterFinder::UnLoad()
01709453 757{
b208c6a3 758 // Unload all the *.root files
759 //
ebd83c56 760 fPMDLoader->UnloadDigits();
761 fPMDLoader->UnloadRecPoints();
01709453 762}
1758e4fe 763// ------------------------------------------------------------------------- //
01b56f5c 764void AliPMDClusterFinder::UnLoadClusters()
765{
766 // Unload all the *.root files
767 //
768 fPMDLoader->UnloadRecPoints();
769}
770// ------------------------------------------------------------------------- //
35535af7 771AliPMDCalibData* AliPMDClusterFinder::GetCalibGain() const
09a06455 772{
773 // The run number will be centralized in AliCDBManager,
774 // you don't need to set it here!
775 // Added by ZA
35535af7 776 AliCDBEntry *entry = AliCDBManager::Instance()->Get("PMD/Calib/Gain");
09a06455 777
0dd3d6f9 778 if(!entry) AliFatal("Calibration object retrieval failed! ");
09a06455 779
780 AliPMDCalibData *calibdata=0;
781 if (entry) calibdata = (AliPMDCalibData*) entry->GetObject();
782
0dd3d6f9 783 if (!calibdata) AliFatal("No calibration data from calibration database !");
09a06455 784
785 return calibdata;
786}
35535af7 787// ------------------------------------------------------------------------- //
35535af7 788AliPMDPedestal* AliPMDClusterFinder::GetCalibPed() const
789{
790 // The run number will be centralized in AliCDBManager,
791 // you don't need to set it here!
792 AliCDBEntry *entry = AliCDBManager::Instance()->Get("PMD/Calib/Ped");
793
794 if(!entry) AliFatal("Pedestal object retrieval failed!");
795
796 AliPMDPedestal *pedestal = 0;
797 if (entry) pedestal = (AliPMDPedestal*) entry->GetObject();
798
799 if (!pedestal) AliFatal("No pedestal data from pedestal database !");
800
801 return pedestal;
802}
7adbd8e9 803//--------------------------------------------------------------------//
804AliPMDHotData* AliPMDClusterFinder::GetCalibHot() const
805{
806 // The run number will be centralized in AliCDBManager,
807 // you don't need to set it here!
808 AliCDBEntry *entry = AliCDBManager::Instance()->Get("PMD/Calib/Hot");
809
810 if(!entry) AliFatal("HotData object retrieval failed!");
811
812 AliPMDHotData *hot = 0;
813 if (entry) hot = (AliPMDHotData*) entry->GetObject();
814
815 if (!hot) AliFatal("No hot data from database !");
816
817 return hot;
818}
963fe679 819//--------------------------------------------------------------------//
820AliPMDNoiseCut* AliPMDClusterFinder::GetNoiseCut() const
821{
822 // The run number will be centralized in AliCDBManager,
823 // you don't need to set it here!
824 AliCDBEntry *entry = AliCDBManager::Instance()->Get("PMD/Calib/NoiseCut");
825
826 if(!entry) AliFatal("Noisecut object retrieval failed!");
827
828 AliPMDNoiseCut *ncut = 0;
829 if (entry) ncut = (AliPMDNoiseCut*) entry->GetObject();
830
831 if (!ncut) AliFatal("No noise cut data from database !");
832
833 return ncut;
834}
dc6dc1ff 835//--------------------------------------------------------------------//
836AliPMDddlinfoData* AliPMDClusterFinder::GetDdlinfoData() const
837{
838 // The run number will be centralized in AliCDBManager,
839 // you don't need to set it here!
840 AliCDBEntry *entry = AliCDBManager::Instance()->Get("PMD/Calib/Ddlinfo");
841
842 if(!entry) AliFatal("ddlinfo object retrieval failed!");
843
844 AliPMDddlinfoData *ddlinfo = 0;
845 if (entry) ddlinfo = (AliPMDddlinfoData*) entry->GetObject();
846
847 if (!ddlinfo) AliFatal("No ddl info data from database !");
848
849 return ddlinfo;
850}
7adbd8e9 851