X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=PHOS%2FAliPHOSClusterizerv1.cxx;h=eb636a3c1e079577a3ac5557b3a60b7f34fe3897;hb=fcf739528d3a5c95ac84ed306b92ab7cc9e3e9f7;hp=c3fcae525579f0714f80fa8e74420b541c20f76e;hpb=a28333c5a135d415fb2f965b830e74987a56fe2f;p=u%2Fmrichter%2FAliRoot.git diff --git a/PHOS/AliPHOSClusterizerv1.cxx b/PHOS/AliPHOSClusterizerv1.cxx index c3fcae52557..eb636a3c1e0 100644 --- a/PHOS/AliPHOSClusterizerv1.cxx +++ b/PHOS/AliPHOSClusterizerv1.cxx @@ -180,7 +180,6 @@ #include "AliPHOSCpvRecPoint.h" #include "AliPHOSDigit.h" #include "AliPHOSDigitizer.h" -#include "AliPHOSCalibrationDB.h" #include "AliCDBManager.h" #include "AliCDBStorage.h" #include "AliCDBEntry.h" @@ -194,29 +193,41 @@ ClassImp(AliPHOSClusterizerv1) AliPHOSClusterizerv1::AliPHOSClusterizerv1() : AliPHOSClusterizer(), fDefaultInit(0), fEmcCrystals(0), fToUnfold(0), - fWrite(0), fNumberOfEmcClusters(0), fNumberOfCpvClusters(0), + fWrite(0), + fNumberOfEmcClusters(0), fNumberOfCpvClusters(0), fEmcClusteringThreshold(0), fCpvClusteringThreshold(0), fEmcLocMaxCut(0), fW0(0), fCpvLocMaxCut(0), - fW0CPV(0), fEmcTimeGate(0) + fW0CPV(0), + fTimeGateLowAmp(0.), fTimeGateLow(0.), fTimeGateHigh(0.), + fEcoreRadius(0) { // default ctor (to be used mainly by Streamer) - InitParameters() ; - fDefaultInit = kTRUE ; + fDefaultInit = kTRUE ; + + for(Int_t i=0; i<53760; i++){ + fDigitsUsed[i]=0 ; + } } //____________________________________________________________________________ AliPHOSClusterizerv1::AliPHOSClusterizerv1(AliPHOSGeometry *geom) : AliPHOSClusterizer(geom), fDefaultInit(0), fEmcCrystals(0), fToUnfold(0), - fWrite(0), fNumberOfEmcClusters(0), fNumberOfCpvClusters(0), + fWrite(0), + fNumberOfEmcClusters(0), fNumberOfCpvClusters(0), fEmcClusteringThreshold(0), fCpvClusteringThreshold(0), fEmcLocMaxCut(0), fW0(0), fCpvLocMaxCut(0), - fW0CPV(0), fEmcTimeGate(0) + fW0CPV(0), + fTimeGateLowAmp(0.), fTimeGateLow(0.), fTimeGateHigh(0.), + fEcoreRadius(0) { // ctor with the indication of the file where header Tree and digits Tree are stored - InitParameters() ; + for(Int_t i=0; i<53760; i++){ + fDigitsUsed[i]=0 ; + } + Init() ; fDefaultInit = kFALSE ; } @@ -261,7 +272,9 @@ void AliPHOSClusterizerv1::Digits2Clusters(Option_t *option) gBenchmark->Stop("PHOSClusterizer"); AliInfo(Form("took %f seconds for Clusterizing\n", gBenchmark->GetCpuTime("PHOSClusterizer"))); - } + } + fEMCRecPoints->Clear("C"); + fCPVRecPoints->Clear("C"); } //____________________________________________________________________________ @@ -273,6 +286,8 @@ Bool_t AliPHOSClusterizerv1::FindFit(AliPHOSEmcRecPoint * emcRP, AliPHOSDigit ** // Cluster will be fitted as a superposition of nPar/3 electromagnetic showers + if(!gMinuit) //it was deleted by someone else + gMinuit = new TMinuit(100) ; gMinuit->mncler(); // Reset Minuit's list of paramters gMinuit->SetPrintLevel(-1) ; // No Printout gMinuit->SetFCN(AliPHOSClusterizerv1::UnfoldingChiSquare) ; @@ -369,6 +384,8 @@ void AliPHOSClusterizerv1::Init() fgCalibData = new AliPHOSCalibData(-1); //use AliCDBManager's run number if (fgCalibData->GetCalibDataEmc() == 0) AliFatal("Calibration parameters for PHOS EMC not found. Stop reconstruction.\n"); + if (fgCalibData->GetCalibDataCpv() == 0) + AliFatal("Calibration parameters for PHOS CPV not found. Stop reconstruction.\n"); } @@ -379,24 +396,27 @@ void AliPHOSClusterizerv1::InitParameters() fNumberOfCpvClusters = 0 ; fNumberOfEmcClusters = 0 ; - const AliPHOSRecoParam* parEmc = AliPHOSReconstructor::GetRecoParamEmc(); - if(!parEmc) AliFatal("Reconstruction parameters for EMC not set!"); + const AliPHOSRecoParam* recoParam = AliPHOSReconstructor::GetRecoParam(); + if(!recoParam) AliFatal("Reconstruction parameters are not set!"); - const AliPHOSRecoParam* parCpv = AliPHOSReconstructor::GetRecoParamCpv(); - if(!parCpv) AliFatal("Reconstruction parameters for CPV not set!"); + recoParam->Print(); - fCpvClusteringThreshold = parCpv->GetClusteringThreshold(); - fEmcClusteringThreshold = parEmc->GetClusteringThreshold(); + fEmcClusteringThreshold = recoParam->GetEMCClusteringThreshold(); + fCpvClusteringThreshold = recoParam->GetCPVClusteringThreshold(); - fEmcLocMaxCut = parEmc->GetLocalMaxCut(); - fCpvLocMaxCut = parCpv->GetLocalMaxCut(); + fEmcLocMaxCut = recoParam->GetEMCLocalMaxCut(); + fCpvLocMaxCut = recoParam->GetCPVLocalMaxCut(); - fW0 = parEmc->GetLogWeight(); - fW0CPV = parCpv->GetLogWeight(); + fW0 = recoParam->GetEMCLogWeight(); + fW0CPV = recoParam->GetCPVLogWeight(); - fEmcTimeGate = 1.e-6 ; + fTimeGateLowAmp = recoParam->GetTimeGateAmpThresh() ; + fTimeGateLow = recoParam->GetTimeGateLow() ; + fTimeGateHigh = recoParam->GetTimeGateHigh() ; + + fEcoreRadius = recoParam->GetEMCEcoreRadius(); - fToUnfold = parEmc->ToUnfold() ; + fToUnfold = recoParam->EMCToUnfold() ; fWrite = kTRUE ; } @@ -407,12 +427,11 @@ Int_t AliPHOSClusterizerv1::AreNeighbours(AliPHOSDigit * d1, AliPHOSDigit * d2)c // Gives the neighbourness of two digits = 0 are not neighbour but continue searching // = 1 are neighbour // = 2 are not neighbour but do not continue searching + // =-1 are not neighbour, continue searching, but do not look before d2 next time // neighbours are defined as digits having at least a common vertex // The order of d1 and d2 is important: first (d1) should be a digit already in a cluster // which is compared to a digit (d2) not yet in a cluster - Int_t rv = 0 ; - Int_t relid1[4] ; fGeom->AbsToRelNumbering(d1->GetId(), relid1) ; @@ -425,23 +444,39 @@ Int_t AliPHOSClusterizerv1::AreNeighbours(AliPHOSDigit * d1, AliPHOSDigit * d2)c if (( coldiff <= 1 ) && ( rowdiff <= 1 )){ //At least common vertex // if (( relid1[2]==relid2[2] && coldiff <= 1 ) || ( relid1[3]==relid2[3] && rowdiff <= 1 )){ //common side - if((relid1[1] != 0) || (TMath::Abs(d1->GetTime() - d2->GetTime() ) < fEmcTimeGate)) - rv = 1 ; + if((relid1[1] != 0) || CheckTimeGate(d1->GetTime(),d1->GetEnergy(),d2->GetTime(),d2->GetEnergy())) + return 1 ; } else { if((relid2[2] > relid1[2]) && (relid2[3] > relid1[3]+1)) - rv = 2; // Difference in row numbers is too large to look further + return 2; // Difference in row numbers is too large to look further } + return 0 ; } else { + if(relid1[0] > relid2[0] && relid1[1]==relid2[1] ) //we switched to the next module + return -1 ; + if(relid1[1] < relid2[1]) //we switched from EMC(0) to CPV(-1) + return -1 ; - if( (relid1[0] < relid2[0]) || (relid1[1] != relid2[1]) ) - rv=2 ; + return 2 ; } - return rv ; + return 0 ; +} +//____________________________________________________________________________ +Bool_t AliPHOSClusterizerv1::CheckTimeGate(Float_t t1, Float_t amp1, Float_t t2, Float_t amp2)const{ + //Check if two cells have reasonable time difference + //Note that at low amplitude time is defined up to 1 tick == 100 ns. + if(amp1GetEntriesFast(); - Float_t emcMinE= AliPHOSReconstructor::GetRecoParamEmc()->GetMinE(); //Minimal digit energy + Float_t emcMinE= AliPHOSReconstructor::GetRecoParam()->GetEMCMinE(); //Minimal digit energy + TVector3 fakeVtx(0.,0.,0.) ; for(index = 0; index < nEmc; index++){ AliPHOSEmcRecPoint * rp = - dynamic_cast( fEMCRecPoints->At(index) ); + static_cast( fEMCRecPoints->At(index) ); rp->Purify(emcMinE) ; if(rp->GetMultiplicity()==0){ fEMCRecPoints->RemoveAt(index) ; @@ -493,8 +529,8 @@ void AliPHOSClusterizerv1::WriteRecPoints() } // No vertex is available now, calculate corrections in PID - rp->EvalAll(fW0,fDigitsArr) ; - TVector3 fakeVtx(0.,0.,0.) ; + rp->EvalAll(fDigitsArr) ; + rp->EvalCoreEnergy(fW0,fEcoreRadius,fDigitsArr) ; rp->EvalAll(fW0,fakeVtx,fDigitsArr) ; rp->EvalLocal2TrackingCSTransform(); } @@ -502,7 +538,7 @@ void AliPHOSClusterizerv1::WriteRecPoints() fEMCRecPoints->Sort() ; // fEMCRecPoints->Expand(fEMCRecPoints->GetEntriesFast()) ; for(index = 0; index < fEMCRecPoints->GetEntries(); index++){ - dynamic_cast( fEMCRecPoints->At(index) )->SetIndexInList(index) ; + static_cast( fEMCRecPoints->At(index) )->SetIndexInList(index) ; } //For each rec.point set the distance to the nearest bad crystal (BVP) @@ -510,14 +546,15 @@ void AliPHOSClusterizerv1::WriteRecPoints() //Now the same for CPV for(index = 0; index < fCPVRecPoints->GetEntries(); index++){ - AliPHOSCpvRecPoint * rp = dynamic_cast( fCPVRecPoints->At(index) ); - rp->EvalAll(fW0CPV,fDigitsArr) ; + AliPHOSCpvRecPoint * rp = static_cast( fCPVRecPoints->At(index) ); + rp->EvalAll(fDigitsArr) ; + rp->EvalAll(fW0CPV,fakeVtx,fDigitsArr) ; rp->EvalLocal2TrackingCSTransform(); } fCPVRecPoints->Sort() ; for(index = 0; index < fCPVRecPoints->GetEntries(); index++) - dynamic_cast( fCPVRecPoints->At(index) )->SetIndexInList(index) ; + static_cast( fCPVRecPoints->At(index) )->SetIndexInList(index) ; fCPVRecPoints->Expand(fCPVRecPoints->GetEntriesFast()) ; @@ -532,104 +569,101 @@ void AliPHOSClusterizerv1::MakeClusters() // Steering method to construct the clusters stored in a list of Reconstructed Points // A cluster is defined as a list of neighbour digits - TClonesArray * digitsC = static_cast( fDigitsArr->Clone() ) ; - - // Clusterization starts + fNumberOfCpvClusters = 0 ; + fNumberOfEmcClusters = 0 ; - TIter nextdigit(digitsC) ; + //Mark all digits as unused yet + const Int_t maxNDigits = 3584; // There is no clusters larger than PHOS module ;) + Int_t nDigits=fDigitsArr->GetEntriesFast() ; + + for(Int_t i=0; i( nextdigit()) ) ) { // scan over the list of digitsC - + digit=static_cast(fDigitsArr->At(i)) ; - AliPHOSRecPoint * clu = 0 ; + clu=0 ; - TArrayI clusterdigitslist(1500) ; Int_t index ; - if (( IsInEmc(digit) && digit->GetEnergy() > fEmcClusteringThreshold ) || - ( IsInCpv(digit) && digit->GetEnergy() > fCpvClusteringThreshold ) ) { + //is this digit so energetic that start cluster? + if (( IsInEmc(digit) && Calibrate(digit->GetEnergy(),digit->GetId()) > fEmcClusteringThreshold ) || + ( IsInCpv(digit) && Calibrate(digit->GetEnergy(),digit->GetId()) > fCpvClusteringThreshold ) ) { Int_t iDigitInCluster = 0 ; - if ( IsInEmc(digit) ) { // start a new EMC RecPoint if(fNumberOfEmcClusters >= fEMCRecPoints->GetSize()) fEMCRecPoints->Expand(2*fNumberOfEmcClusters+1) ; fEMCRecPoints->AddAt(new AliPHOSEmcRecPoint(""), fNumberOfEmcClusters) ; - clu = dynamic_cast( fEMCRecPoints->At(fNumberOfEmcClusters) ) ; + clu = static_cast( fEMCRecPoints->At(fNumberOfEmcClusters) ) ; fNumberOfEmcClusters++ ; - clu->AddDigit(*digit, digit->GetEnergy()) ; + clu->AddDigit(*digit, Calibrate(digit->GetEnergy(),digit->GetId()),CalibrateT(digit->GetTime(),digit->GetId())) ; clusterdigitslist[iDigitInCluster] = digit->GetIndexInList() ; iDigitInCluster++ ; - digitsC->Remove(digit) ; - + fDigitsUsed[i]=kTRUE ; } else { - // start a new CPV cluster if(fNumberOfCpvClusters >= fCPVRecPoints->GetSize()) fCPVRecPoints->Expand(2*fNumberOfCpvClusters+1); fCPVRecPoints->AddAt(new AliPHOSCpvRecPoint(""), fNumberOfCpvClusters) ; - - clu = dynamic_cast( fCPVRecPoints->At(fNumberOfCpvClusters) ) ; + clu = static_cast( fCPVRecPoints->At(fNumberOfCpvClusters) ) ; fNumberOfCpvClusters++ ; - clu->AddDigit(*digit, digit->GetEnergy()) ; + clu->AddDigit(*digit, Calibrate(digit->GetEnergy(),digit->GetId()),0.) ; // no timing information in CPV clusterdigitslist[iDigitInCluster] = digit->GetIndexInList() ; iDigitInCluster++ ; - digitsC->Remove(digit) ; - nextdigit.Reset() ; - - // Here we remove remaining EMC digits, which cannot make a cluster - - if( notremoved ) { - while( ( digit = dynamic_cast( nextdigit() ) ) ) { - if( IsInEmc(digit) ) - digitsC->Remove(digit) ; - else - break ; - } - notremoved = kFALSE ; - } - + fDigitsUsed[i]=kTRUE ; } // else - - nextdigit.Reset() ; - + + //Now scan remaining digits in list to find neigbours of our seed + AliPHOSDigit * digitN ; index = 0 ; while (index < iDigitInCluster){ // scan over digits already in cluster - digit = dynamic_cast( fDigitsArr->At(clusterdigitslist[index]) ) ; + digit = static_cast( fDigitsArr->At(clusterdigitslist[index]) ) ; index++ ; - while ( (digitN = dynamic_cast( nextdigit() ) ) ) { // scan over the reduced list of digits + for(Int_t j=iFirst; j= maxNDigits) { + AliError(Form("The number of digits in cluster is more than %d, skip the rest of event", + maxNDigits)); + return; + } + if(fDigitsUsed[j]) + continue ; //look through remaining digits + digitN = static_cast( fDigitsArr->At(j) ) ; Int_t ineb = AreNeighbours(digit, digitN); // call (digit,digitN) in THAT oder !!!!! switch (ineb ) { + case -1: //too early (e.g. previous module), do not look before j at subsequent passes + iFirst=j ; + break ; case 0 : // not a neighbour break ; case 1 : // are neighbours - clu->AddDigit(*digitN, digitN->GetEnergy()); - clusterdigitslist[iDigitInCluster] = digitN->GetIndexInList() ; + clu->AddDigit(*digitN, Calibrate(digitN->GetEnergy(),digitN->GetId()),CalibrateT(digitN->GetTime(),digitN->GetId())) ; + clusterdigitslist[iDigitInCluster] = j ; iDigitInCluster++ ; - digitsC->Remove(digitN) ; + fDigitsUsed[j]=kTRUE ; break ; case 2 : // too far from each other - goto endofloop; + goto endOfLoop; } // switch - } // while digitN + } - endofloop: ; - nextdigit.Reset() ; + endOfLoop: ; //scanned all possible neighbours for this digit } // loop over cluster - } // energy theshold - - - } // while digit - - delete digitsC ; + } } @@ -648,7 +682,7 @@ void AliPHOSClusterizerv1::MakeUnfolding() Int_t index ; for(index = 0 ; index < numberofNotUnfolded ; index++){ - AliPHOSEmcRecPoint * emcRecPoint = dynamic_cast( fEMCRecPoints->At(index) ) ; + AliPHOSEmcRecPoint * emcRecPoint = static_cast( fEMCRecPoints->At(index) ) ; if(emcRecPoint->GetPHOSMod()> nModulesToUnfold) break ; @@ -686,12 +720,12 @@ void AliPHOSClusterizerv1::MakeUnfolding() Int_t index ; for(index = 0 ; index < numberofCpvNotUnfolded ; index++){ - AliPHOSRecPoint * recPoint = dynamic_cast( fCPVRecPoints->At(index) ) ; + AliPHOSRecPoint * recPoint = static_cast( fCPVRecPoints->At(index) ) ; if(recPoint->GetPHOSMod()> nModulesToUnfold) break ; - AliPHOSEmcRecPoint * emcRecPoint = dynamic_cast(recPoint) ; + AliPHOSEmcRecPoint * emcRecPoint = static_cast(recPoint) ; Int_t nMultipl = emcRecPoint->GetMultiplicity() ; AliPHOSDigit ** maxAt = new AliPHOSDigit*[nMultipl] ; @@ -767,7 +801,7 @@ void AliPHOSClusterizerv1::UnfoldCluster(AliPHOSEmcRecPoint * iniEmc, Int_t iparam ; Int_t iDigit ; for(iDigit = 0 ; iDigit < nDigits ; iDigit ++){ - digit = dynamic_cast( fDigitsArr->At(emcDigits[iDigit] ) ) ; + digit = static_cast( fDigitsArr->At(emcDigits[iDigit] ) ) ; fGeom->AbsToRelNumbering(digit->GetId(), relid) ; fGeom->RelPosInModule(relid, xDigit, zDigit) ; efit[iDigit] = 0; @@ -807,7 +841,7 @@ void AliPHOSClusterizerv1::UnfoldCluster(AliPHOSEmcRecPoint * iniEmc, fEMCRecPoints->Expand(2*fNumberOfEmcClusters) ; (*fEMCRecPoints)[fNumberOfEmcClusters] = new AliPHOSEmcRecPoint("") ; - emcRP = dynamic_cast( fEMCRecPoints->At(fNumberOfEmcClusters) ) ; + emcRP = static_cast( fEMCRecPoints->At(fNumberOfEmcClusters) ) ; fNumberOfEmcClusters++ ; emcRP->SetNExMax((Int_t)nPar/3) ; } @@ -816,19 +850,19 @@ void AliPHOSClusterizerv1::UnfoldCluster(AliPHOSEmcRecPoint * iniEmc, fCPVRecPoints->Expand(2*fNumberOfCpvClusters) ; (*fCPVRecPoints)[fNumberOfCpvClusters] = new AliPHOSCpvRecPoint("") ; - emcRP = dynamic_cast( fCPVRecPoints->At(fNumberOfCpvClusters) ) ; + emcRP = static_cast( fCPVRecPoints->At(fNumberOfCpvClusters) ) ; fNumberOfCpvClusters++ ; } Float_t eDigit ; for(iDigit = 0 ; iDigit < nDigits ; iDigit ++){ - digit = dynamic_cast( fDigitsArr->At( emcDigits[iDigit] ) ) ; + digit = static_cast( fDigitsArr->At( emcDigits[iDigit] ) ) ; fGeom->AbsToRelNumbering(digit->GetId(), relid) ; fGeom->RelPosInModule(relid, xDigit, zDigit) ; // ratio = epar * ShowerShape(xDigit - xpar,zDigit - zpar,vIncid) / efit[iDigit] ; ratio = epar * ShowerShape(xDigit - xpar,zDigit - zpar) / efit[iDigit] ; eDigit = emcEnergies[iDigit] * ratio ; - emcRP->AddDigit( *digit, eDigit ) ; + emcRP->AddDigit( *digit, eDigit,CalibrateT(digit->GetTime(),digit->GetId()) ) ; } } @@ -843,17 +877,17 @@ void AliPHOSClusterizerv1::UnfoldingChiSquare(Int_t & nPar, Double_t * Grad, Dou // Calculates the Chi square for the cluster unfolding minimization // Number of parameters, Gradient, Chi squared, parameters, what to do - TList * toMinuit = dynamic_cast( gMinuit->GetObjectFit() ) ; + TList * toMinuit = static_cast( gMinuit->GetObjectFit() ) ; - AliPHOSEmcRecPoint * emcRP = dynamic_cast( toMinuit->At(0) ) ; - TClonesArray * digits = dynamic_cast( toMinuit->At(1) ) ; + AliPHOSEmcRecPoint * emcRP = static_cast( toMinuit->At(0) ) ; + TClonesArray * digits = static_cast( toMinuit->At(1) ) ; // A bit buggy way to get an access to the geometry // To be revised! - AliPHOSGeometry *geom = dynamic_cast(toMinuit->At(2)); + AliPHOSGeometry *geom = static_cast(toMinuit->At(2)); -// TVector3 * vtx = dynamic_cast(toMinuit->At(3)) ; //Vertex position +// TVector3 * vtx = static_cast(toMinuit->At(3)) ; //Vertex position - // AliPHOSEmcRecPoint * emcRP = dynamic_cast( gMinuit->GetObjectFit() ) ; // EmcRecPoint to fit + // AliPHOSEmcRecPoint * emcRP = static_cast( gMinuit->GetObjectFit() ) ; // EmcRecPoint to fit Int_t * emcDigits = emcRP->GetDigitsList() ; @@ -876,7 +910,7 @@ void AliPHOSClusterizerv1::UnfoldingChiSquare(Int_t & nPar, Double_t * Grad, Dou for( iDigit = 0 ; iDigit < nOdigits ; iDigit++) { - digit = dynamic_cast( digits->At( emcDigits[iDigit] ) ); + digit = static_cast( digits->At( emcDigits[iDigit] ) ); Int_t relid[4] ; Float_t xDigit ; @@ -972,7 +1006,7 @@ void AliPHOSClusterizerv1::Print(const Option_t *)const else message = " AliPHOSClusterizerv1 not initialized " ; - AliInfo(Form("%s, %s %s %s %s %s %s %s %s %s %s", message.Data(), + AliInfo(Form("%s, %s %s %s %s %f %f %f %f %f %f", message.Data(), taskName.Data(), GetTitle(), taskName.Data(), @@ -1040,9 +1074,9 @@ void AliPHOSClusterizerv1::SetDistancesToBadChannels() //Author: Boris Polichtchouk if(!fgCalibData->GetNumOfEmcBadChannels()) return; - AliInfo(Form("%d bad channel(s) found.\n",fgCalibData->GetNumOfEmcBadChannels())); Int_t badIds[8000]; + memset(badIds,0,8000*sizeof(Int_t)); fgCalibData->EmcBadChannelIds(badIds); AliPHOSEmcRecPoint* rp; @@ -1053,12 +1087,22 @@ void AliPHOSClusterizerv1::SetDistancesToBadChannels() TVector3 dR; Float_t dist,minDist; - + Int_t relid[4]={0,0,0,0} ; + TVector3 lpos ; for(Int_t iRP=0; iRPGetEntries(); iRP++){ rp = (AliPHOSEmcRecPoint*)fEMCRecPoints->At(iRP); - minDist = 1.e+07; - + //evaluate distance to border + relid[0]=rp->GetPHOSMod() ; + relid[2]=1 ; + relid[3]=1 ; + Float_t xcorner,zcorner; + fGeom->RelPosInModule(relid,xcorner,zcorner) ; //coordinate of the corner cell + rp->GetLocalPosition(lpos) ; + minDist = 2.2+TMath::Min(-xcorner-TMath::Abs(lpos.X()),-zcorner-TMath::Abs(lpos.Z())); //2.2 - crystal size for(Int_t iBad=0; iBadGetNumOfEmcBadChannels(); iBad++) { + fGeom->AbsToRelNumbering(badIds[iBad],relid) ; + if(relid[0]!=rp->GetPHOSMod()) //We can not evaluate global position directly since + continue ; //bad channels can be in the module which does not exist in simulations. rp->GetGlobalPosition(gposRecPoint,gmat); fGeom->RelPosInAlice(badIds[iBad],gposBadChannel); AliDebug(2,Form("BC position:[%.3f,%.3f,%.3f], RP position:[%.3f,%.3f,%.3f]. E=%.3f\n", @@ -1073,3 +1117,45 @@ void AliPHOSClusterizerv1::SetDistancesToBadChannels() } } +//================================================================================== +Float_t AliPHOSClusterizerv1::Calibrate(Float_t amp, Int_t absId) const{ + // Calibrate EMC digit, i.e. multiply its Amp by a factor read from CDB + + const AliPHOSGeometry *geom = AliPHOSGeometry::GetInstance() ; + + //Determine rel.position of the cell absolute ID + Int_t relId[4]; + geom->AbsToRelNumbering(absId,relId); + Int_t module=relId[0]; + Int_t row =relId[2]; + Int_t column=relId[3]; + if(relId[1]){ //CPV + Float_t calibration = fgCalibData->GetADCchannelCpv(module,column,row); + return amp*calibration ; + } + else{ //EMC + Float_t calibration = fgCalibData->GetADCchannelEmc(module,column,row); + return amp*calibration ; + } +} +//================================================================================== +Float_t AliPHOSClusterizerv1::CalibrateT(Float_t time, Int_t absId)const{ + // Calibrate time in EMC digit + + const AliPHOSGeometry *geom = AliPHOSGeometry::GetInstance() ; + + //Determine rel.position of the cell absolute ID + Int_t relId[4]; + geom->AbsToRelNumbering(absId,relId); + Int_t module=relId[0]; + Int_t row =relId[2]; + Int_t column=relId[3]; + if(relId[1]){ //CPV + return 0. ; + } + else{ //EMC + time += fgCalibData->GetTimeShiftEmc(module,column,row); + return time ; + } +} +