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