From 7e9508a7c4e2d2ff987781afa2797d3f422c053c Mon Sep 17 00:00:00 2001 From: bnandi Date: Thu, 27 Jan 2005 06:23:28 +0000 Subject: [PATCH] SetDebug removed and AliLog is implemented --- PMD/AliPMDClusterFinder.cxx | 250 +++++++++++++++++++++++++++++++++--- PMD/AliPMDClusterFinder.h | 8 +- PMD/AliPMDClustering.cxx | 55 +++----- PMD/AliPMDClustering.h | 26 ++-- 4 files changed, 267 insertions(+), 72 deletions(-) diff --git a/PMD/AliPMDClusterFinder.cxx b/PMD/AliPMDClusterFinder.cxx index 16320a00b8a..beac2228f7d 100644 --- a/PMD/AliPMDClusterFinder.cxx +++ b/PMD/AliPMDClusterFinder.cxx @@ -27,6 +27,7 @@ #include #include +#include "AliLog.h" #include "AliRunLoader.h" #include "AliLoader.h" #include "AliRawReader.h" @@ -38,8 +39,25 @@ #include "AliPMDrecpoint1.h" #include "AliPMDRawStream.h" + + ClassImp(AliPMDClusterFinder) +AliPMDClusterFinder::AliPMDClusterFinder(): + fRunLoader(0), + fPMDLoader(0), + fTreeD(0), + fTreeR(0), + fDigits(new TClonesArray("AliPMDdigit", 1000)), + fRecpoints(new TClonesArray("AliPMDrecpoint1", 1000)), + fNpoint(0), + fEcut(0.) +{ +// +// Constructor +// +} +// ------------------------------------------------------------------------- // AliPMDClusterFinder::AliPMDClusterFinder(AliRunLoader* runLoader): fRunLoader(runLoader), fPMDLoader(runLoader->GetLoader("PMDLoader")), @@ -48,7 +66,6 @@ AliPMDClusterFinder::AliPMDClusterFinder(AliRunLoader* runLoader): fDigits(new TClonesArray("AliPMDdigit", 1000)), fRecpoints(new TClonesArray("AliPMDrecpoint1", 1000)), fNpoint(0), - fDebug(0), fEcut(0.) { // @@ -88,16 +105,17 @@ void AliPMDClusterFinder::Digits2RecPoints(Int_t ievt) TObjArray *pmdcont = new TObjArray(); AliPMDClustering *pmdclust = new AliPMDClustering(); - pmdclust->SetDebug(fDebug); + pmdclust->SetEdepCut(fEcut); fRunLoader->GetEvent(ievt); - //cout << " ***** Beginning::Digits2RecPoints *****" << endl; + fTreeD = fPMDLoader->TreeD(); if (fTreeD == 0x0) { - cout << " Can not get TreeD" << endl; + AliFatal("AliPMDClusterFinder: Can not get TreeD"); + } AliPMDdigit *pmddigit; TBranch *branch = fTreeD->GetBranch("PMDDigit"); @@ -140,7 +158,9 @@ void AliPMDClusterFinder::Digits2RecPoints(Int_t ievt) pmdclust->DoClust(idet,ismn,fCellADC,pmdcont); Int_t nentries1 = pmdcont->GetEntries(); -// cout << " nentries1 = " << nentries1 << endl; + + AliDebug(1,Form("Total number of clusters/module = %d",nentries1)); + for (Int_t ient1 = 0; ient1 < nentries1; ient1++) { AliPMDcluster *pmdcl = (AliPMDcluster*)pmdcont->UncheckedAt(ient1); @@ -169,7 +189,201 @@ void AliPMDClusterFinder::Digits2RecPoints(Int_t ievt) delete pmdclust; delete pmdcont; - // cout << " ***** End::Digits2RecPoints *****" << endl; +} +// ------------------------------------------------------------------------- // + +void AliPMDClusterFinder::Digits2RecPoints(AliRawReader *rawReader, + TTree *clustersTree) +{ + // Converts RAW data to recpoints after running clustering + // algorithm on CPV and PREshower plane + // + + Float_t clusdata[5]; + + TObjArray *pmdcont = new TObjArray(); + AliPMDClustering *pmdclust = new AliPMDClustering(); + + pmdclust->SetEdepCut(fEcut); + + ResetRecpoint(); + + Int_t bufsize = 16000; + clustersTree->Branch("PMDRecpoint", &fRecpoints, bufsize); + + const Int_t kDDL = 6; + const Int_t kRow = 48; + const Int_t kCol = 96; + + Int_t idet = 0; + Int_t iSMN = 0; + + for (Int_t indexDDL = 0; indexDDL < kDDL; indexDDL++) + { + if (indexDDL < 4) + { + iSMN = 6; + } + else if (indexDDL >= 4) + { + iSMN = 12; + } + Int_t ***precpvADC; + precpvADC = new int **[iSMN]; + for (Int_t i=0; iReset(); + AliPMDRawStream pmdinput(rawReader); + rawReader->Select(12, indexDDL, indexDDL); + while(pmdinput.Next()) + { + Int_t det = pmdinput.GetDetector(); + Int_t smn = pmdinput.GetSMN(); + //Int_t mcm = pmdinput.GetMCM(); + //Int_t chno = pmdinput.GetChannel(); + Int_t row = pmdinput.GetRow(); + Int_t col = pmdinput.GetColumn(); + Int_t sig = pmdinput.GetSignal(); + + Int_t indexsmn = 0; + + if (indexDDL < 4) + { + if (det != 0) + AliError(Form("*DDL %d and Detector NUMBER %d NOT MATCHING *", + indexDDL, det)); + indexsmn = smn - indexDDL * 6; + } + else if (indexDDL == 4) + { + if (det != 1) + AliError(Form("*DDL %d and Detector NUMBER %d NOT MATCHING *", + indexDDL, det)); + if (smn < 6) + { + indexsmn = smn; + } + else if (smn >= 12 && smn < 18) + { + indexsmn = smn - 6; + } + } + else if (indexDDL == 5) + { + if (det != 1) + AliError(Form("*DDL %d and Detector NUMBER %d NOT MATCHING *", + indexDDL, det)); + if (smn >= 6 && smn < 12) + { + indexsmn = smn - 6; + } + else if (smn >= 18 && smn < 24) + { + indexsmn = smn - 12; + } + } + precpvADC[indexsmn][row][col] = sig; + } // while loop + + Int_t ismn = 0; + for (Int_t indexsmn = 0; indexsmn < iSMN; indexsmn++) + { + ResetCellADC(); + for (Int_t irow = 0; irow < kRow; irow++) + { + for (Int_t icol = 0; icol < kCol; icol++) + { + fCellADC[irow][icol] = + (Double_t) precpvADC[indexsmn][irow][icol]; + } // row + } // col + if (indexDDL < 4) + { + ismn = indexsmn + indexDDL * 6; + idet = 0; + } + else if (indexDDL == 4) + { + if (indexsmn < 6) + { + ismn = indexsmn; + } + else if (indexsmn >= 6 && indexsmn < 12) + { + ismn = indexsmn + 6; + } + idet = 1; + } + else if (indexDDL == 5) + { + if (indexsmn < 6) + { + ismn = indexsmn + 6; + } + else if (indexsmn >= 6 && indexsmn < 12) + { + ismn = indexsmn + 12; + } + idet = 1; + } + + + pmdclust->DoClust(idet,ismn,fCellADC,pmdcont); + Int_t nentries1 = pmdcont->GetEntries(); + + AliDebug(1,Form("Total number of clusters/module = %d",nentries1)); + + for (Int_t ient1 = 0; ient1 < nentries1; ient1++) + { + AliPMDcluster *pmdcl = + (AliPMDcluster*)pmdcont->UncheckedAt(ient1); + idet = pmdcl->GetDetector(); + ismn = pmdcl->GetSMN(); + clusdata[0] = pmdcl->GetClusX(); + clusdata[1] = pmdcl->GetClusY(); + clusdata[2] = pmdcl->GetClusADC(); + clusdata[3] = pmdcl->GetClusCells(); + clusdata[4] = pmdcl->GetClusRadius(); + + AddRecPoint(idet,ismn,clusdata); + } + pmdcont->Clear(); + + //fTreeR->Fill(); + clustersTree->Fill(); + ResetRecpoint(); + + + } // smn + + for (Int_t i=0; iSetDebug(fDebug); + pmdclust->SetEdepCut(fEcut); fRunLoader->GetEvent(ievt); @@ -252,15 +466,15 @@ void AliPMDClusterFinder::Digits2RecPoints(Int_t ievt, AliRawReader *rawReader) if (indexDDL < 4) { if (det != 0) - printf(" *** DDL %d and Detector NUMBER %d NOT MATCHING *** ", - indexDDL, det); + AliError(Form("*DDL %d and Detector NUMBER %d NOT MATCHING *", + indexDDL, det)); indexsmn = smn - indexDDL * 6; } else if (indexDDL == 4) { if (det != 1) - printf(" *** DDL %d and Detector NUMBER %d NOT MATCHING *** ", - indexDDL, det); + AliError(Form("*DDL %d and Detector NUMBER %d NOT MATCHING *", + indexDDL, det)); if (smn < 6) { indexsmn = smn; @@ -273,8 +487,8 @@ void AliPMDClusterFinder::Digits2RecPoints(Int_t ievt, AliRawReader *rawReader) else if (indexDDL == 5) { if (det != 1) - printf(" *** DDL %d and Detector NUMBER %d NOT MATCHING *** ", - indexDDL, det); + AliError(Form("*DDL %d and Detector NUMBER %d NOT MATCHING *", + indexDDL, det)); if (smn >= 6 && smn < 12) { indexsmn = smn - 6; @@ -332,7 +546,9 @@ void AliPMDClusterFinder::Digits2RecPoints(Int_t ievt, AliRawReader *rawReader) pmdclust->DoClust(idet,ismn,fCellADC,pmdcont); Int_t nentries1 = pmdcont->GetEntries(); - // cout << " nentries1 = " << nentries1 << endl; + + AliDebug(1,Form("Total number of clusters/module = %d",nentries1)); + for (Int_t ient1 = 0; ient1 < nentries1; ient1++) { AliPMDcluster *pmdcl = @@ -372,7 +588,6 @@ void AliPMDClusterFinder::Digits2RecPoints(Int_t ievt, AliRawReader *rawReader) delete pmdclust; delete pmdcont; - // cout << " ***** End::Digits2RecPoints :: Raw *****" << endl; } // ------------------------------------------------------------------------- // void AliPMDClusterFinder::SetCellEdepCut(Float_t ecut) @@ -380,11 +595,6 @@ void AliPMDClusterFinder::SetCellEdepCut(Float_t ecut) fEcut = ecut; } // ------------------------------------------------------------------------- // -void AliPMDClusterFinder::SetDebug(Int_t idebug) -{ - fDebug = idebug; -} -// ------------------------------------------------------------------------- // void AliPMDClusterFinder::AddRecPoint(Int_t idet,Int_t ismn,Float_t *clusdata) { // Add Reconstructed points diff --git a/PMD/AliPMDClusterFinder.h b/PMD/AliPMDClusterFinder.h index 7b76131799f..2a6eeb9cf72 100644 --- a/PMD/AliPMDClusterFinder.h +++ b/PMD/AliPMDClusterFinder.h @@ -19,18 +19,19 @@ class AliLoader; class AliRunLoader; class AliRawReader; -class AliPMDClusterFinder +class AliPMDClusterFinder : public TObject { public: + AliPMDClusterFinder(); AliPMDClusterFinder(AliRunLoader* runLoader); virtual ~AliPMDClusterFinder(); void Digits2RecPoints(Int_t ievt); + void Digits2RecPoints(AliRawReader *rawReader, TTree *clustersTree); void Digits2RecPoints(Int_t ievt, AliRawReader *rawReader); void SetCellEdepCut(Float_t ecut); - void SetDebug(Int_t idebug); void AddRecPoint(Int_t idet, Int_t ismn, Float_t * clusdata); void ResetCellADC(); void ResetRecpoint(); @@ -51,14 +52,13 @@ class AliPMDClusterFinder Int_t fNpoint; // Int_t fDetNo; // Detector Number (0:PRE, 1:CPV) - Int_t fDebug; // Debugging switch (0:NO, 1:YES) Float_t fEcut; // Energy/ADC cut per cell static const Int_t fgkRow = 48; // Total number of rows in one unitmodule static const Int_t fgkCol = 96; // Total number of cols in one unitmodule Double_t fCellADC[fgkRow][fgkCol]; // Array containing individual cell ADC - ClassDef(AliPMDClusterFinder,6) // To run PMD clustering + ClassDef(AliPMDClusterFinder,7) // To run PMD clustering }; #endif diff --git a/PMD/AliPMDClustering.cxx b/PMD/AliPMDClustering.cxx index 25e237ae457..f9c766413b2 100644 --- a/PMD/AliPMDClustering.cxx +++ b/PMD/AliPMDClustering.cxx @@ -42,16 +42,17 @@ #include "Riostream.h" #include #include +#include + #include "AliPMDcluster.h" #include "AliPMDClustering.h" -#include +#include "AliLog.h" ClassImp(AliPMDClustering) const Double_t AliPMDClustering::fgkSqroot3by2=0.8660254; // sqrt(3.)/2. AliPMDClustering::AliPMDClustering(): - fDebug(0), fCutoff(0.0) { for(int i = 0; i < kNDIMX; i++) @@ -108,28 +109,22 @@ void AliPMDClustering::DoClust(Int_t idet, Int_t ismn, Double_t celladc[48][96], if (fEdepCell[i1][i2] > cutoff ) nmx1 = nmx1 + 1; } // nmx1 --- number of cells having ener dep >= cutoff - if (fDebug == 1) - { - cout << " nmx1 " << nmx1 << endl; - } + + AliDebug(1,Form("Number of cells having energy >= %f are %d",cutoff,nmx1)); // if (nmx1 == 0 | nmx1 == -1) return; if (nmx1 == 0) nmx1 = 1; ave=ave/nmx1; - if (fDebug == 1) - { - cout <<"kNMX " << kNMX << " nmx1 " << nmx1<< " ave "< 4500) { - Error("RefClust", "Too many superclusters!"); + AliWarning("RefClust: Too many superclusters!"); nsupcl = 4500; break; } ncl[nsupcl]=ncl[nsupcl]+1; } - if (fDebug == 1) - { - cout << " # of cells " <= 5000) { - Error("RefClust", "Too many clusters!"); + AliWarning("RefClust: Too many clusters! more than 5000"); return; } fClno = fClno + 1; @@ -390,7 +381,7 @@ void AliPMDClustering::RefClust(int incr) id = id + 1; icl = icl+1; if (fClno >= 5000) { - Error("RefClust", "Too many clusters!"); + AliWarning("RefClust: Too many clusters! more than 5000"); return; } fClno = fClno+1; @@ -536,7 +527,7 @@ void AliPMDClustering::RefClust(int incr) } for(j=0; j<=ig; j++){ if (fClno >= 5000) { - Error("RefClust", "Too many clusters!"); + AliWarning("RefClust: Too many clusters! more than 5000"); return; } fClno = fClno + 1; @@ -721,7 +712,7 @@ double AliPMDClustering::Ranmar() const cm = 16777213./16777216.; } else{ - cout << " wrong initialization " << endl; + AliWarning("Wrong initialization"); } } else{ @@ -745,7 +736,3 @@ void AliPMDClustering::SetEdepCut(Float_t decut) fCutoff = decut; } // ------------------------------------------------------------------------ // -void AliPMDClustering::SetDebug(Int_t idebug) -{ - fDebug = idebug; -} diff --git a/PMD/AliPMDClustering.h b/PMD/AliPMDClustering.h index d4db3d09ffd..bfc939e9c38 100644 --- a/PMD/AliPMDClustering.h +++ b/PMD/AliPMDClustering.h @@ -37,21 +37,20 @@ class AliPMDClustering: public TObject AliPMDClustering(); virtual ~AliPMDClustering(); - void DoClust(Int_t idet, Int_t ismn, Double_t celladc[][96], - TObjArray *pmdcont); - void Order(); - - Int_t CrClust(Double_t ave, Double_t cutoff, Int_t nmx1); - void RefClust(Int_t incr); - void GaussFit(Int_t ncell, Int_t nclust, Double_t &x, - Double_t &y, Double_t &z, Double_t &xc, - Double_t &yc, Double_t &zc, Double_t &rc); + void DoClust(Int_t idet, Int_t ismn, Double_t celladc[][96], + TObjArray *pmdcont); + void Order(); + + Int_t CrClust(Double_t ave, Double_t cutoff, Int_t nmx1); + void RefClust(Int_t incr); + void GaussFit(Int_t ncell, Int_t nclust, Double_t &x, + Double_t &y, Double_t &z, Double_t &xc, + Double_t &yc, Double_t &zc, Double_t &rc); Double_t Distance(Double_t x1, Double_t y1, Double_t x2, Double_t y2); Double_t Ranmar() const; - void SetEdepCut(Float_t decut); - void SetDebug(Int_t idebug); - + void SetEdepCut(Float_t decut); + protected: static const Double_t fgkSqroot3by2; // fgkSqroot3by2 = sqrt(3.)/2. @@ -114,9 +113,8 @@ class AliPMDClustering: public TObject coord --- x and y coordinates of center of each cell */ - Int_t fDebug; // Switch for debug (1:Print, 0:Noprint) Float_t fCutoff; // Energy(ADC) cutoff per cell before clustering - ClassDef(AliPMDClustering,3) // Does clustering for PMD + ClassDef(AliPMDClustering,5) // Does clustering for PMD }; #endif -- 2.39.3