#include "AliPHOSCpvRecPoint.h"
#include "AliPHOSDigit.h"
#include "AliPHOSDigitizer.h"
-#include "AliPHOSCalibrationDB.h"
#include "AliCDBManager.h"
#include "AliCDBStorage.h"
#include "AliCDBEntry.h"
fNumberOfEmcClusters(0), fNumberOfCpvClusters(0),
fEmcClusteringThreshold(0), fCpvClusteringThreshold(0),
fEmcLocMaxCut(0), fW0(0), fCpvLocMaxCut(0),
- fW0CPV(0), fEmcTimeGate(0), fEcoreRadius(0)
+ fW0CPV(0),
+ fTimeGateLowAmp(0.), fTimeGateLow(0.), fTimeGateHigh(0.),
+ fEcoreRadius(0)
{
// default ctor (to be used mainly by Streamer)
- fDefaultInit = kTRUE ;
+ fDefaultInit = kTRUE ;
+
+ for(Int_t i=0; i<53760; i++){
+ fDigitsUsed[i]=0 ;
+ }
}
//____________________________________________________________________________
fNumberOfEmcClusters(0), fNumberOfCpvClusters(0),
fEmcClusteringThreshold(0), fCpvClusteringThreshold(0),
fEmcLocMaxCut(0), fW0(0), fCpvLocMaxCut(0),
- fW0CPV(0), fEmcTimeGate(0), fEcoreRadius(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
+ for(Int_t i=0; i<53760; i++){
+ fDigitsUsed[i]=0 ;
+ }
+
Init() ;
fDefaultInit = kFALSE ;
}
AliInfo(Form("took %f seconds for Clusterizing\n",
gBenchmark->GetCpuTime("PHOSClusterizer")));
}
- fEMCRecPoints->Delete();
- fCPVRecPoints->Delete();
+ fEMCRecPoints->Clear("C");
+ fCPVRecPoints->Clear("C");
}
//____________________________________________________________________________
// 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) ;
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");
}
const AliPHOSRecoParam* recoParam = AliPHOSReconstructor::GetRecoParam();
if(!recoParam) AliFatal("Reconstruction parameters are not set!");
- fCpvClusteringThreshold = recoParam->GetEMCClusteringThreshold();
- fEmcClusteringThreshold = recoParam->GetCPVClusteringThreshold();
+ recoParam->Print();
+
+ fEmcClusteringThreshold = recoParam->GetEMCClusteringThreshold();
+ fCpvClusteringThreshold = recoParam->GetCPVClusteringThreshold();
fEmcLocMaxCut = recoParam->GetEMCLocalMaxCut();
fCpvLocMaxCut = recoParam->GetCPVLocalMaxCut();
fW0 = recoParam->GetEMCLogWeight();
fW0CPV = recoParam->GetCPVLogWeight();
- fEmcTimeGate = 1.e-6 ;
+ fTimeGateLowAmp = recoParam->GetTimeGateAmpThresh() ;
+ fTimeGateLow = recoParam->GetTimeGateLow() ;
+ fTimeGateHigh = recoParam->GetTimeGateHigh() ;
+
fEcoreRadius = recoParam->GetEMCEcoreRadius();
fToUnfold = recoParam->EMCToUnfold() ;
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))
+ if((relid1[1] != 0) || CheckTimeGate(d1->GetTime(),d1->GetEnergy(),d2->GetTime(),d2->GetEnergy()))
return 1 ;
}
else {
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(amp1<fTimeGateLowAmp || amp2<fTimeGateLowAmp){
+ return (TMath::Abs(t1 - t2 ) < fTimeGateLow) ;
+ }
+ else{ //Time should be measured with good accuracy
+ return (TMath::Abs(t1 - t2 ) < fTimeGateHigh) ;
+ }
+
+}
+//____________________________________________________________________________
Bool_t AliPHOSClusterizerv1::IsInEmc(AliPHOSDigit * digit) const
{
// Tells if (true) or not (false) the digit is in a PHOS-EMC module
fNumberOfEmcClusters = 0 ;
//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<nDigits; i++){
fDigitsUsed[i]=0 ;
}
Int_t iFirst = 0 ; //first index of digit which potentially can be a part of cluster
//e.g. first digit in this module, first CPV digit etc.
AliPHOSDigit * digit ;
- TArrayI clusterdigitslist(1500) ;
+ TArrayI clusterdigitslist(maxNDigits) ;
AliPHOSRecPoint * clu = 0 ;
for(Int_t i=0; i<nDigits; i++){
if(fDigitsUsed[i])
Int_t index ;
//is this digit so energetic that start cluster?
- if (( IsInEmc(digit) && digit->GetEnergy() > fEmcClusteringThreshold ) ||
- ( IsInCpv(digit) && digit->GetEnergy() > fCpvClusteringThreshold ) ) {
+ 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->AddAt(new AliPHOSEmcRecPoint(""), fNumberOfEmcClusters) ;
clu = static_cast<AliPHOSEmcRecPoint *>( 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++ ;
fDigitsUsed[i]=kTRUE ;
fCPVRecPoints->AddAt(new AliPHOSCpvRecPoint(""), fNumberOfCpvClusters) ;
clu = static_cast<AliPHOSCpvRecPoint *>( 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++ ;
fDigitsUsed[i]=kTRUE ;
} // else
-
+
//Now scan remaining digits in list to find neigbours of our seed
AliPHOSDigit * digitN ;
digit = static_cast<AliPHOSDigit*>( fDigitsArr->At(clusterdigitslist[index]) ) ;
index++ ;
for(Int_t j=iFirst; j<nDigits; j++){
+ if (iDigitInCluster >= 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<AliPHOSDigit*>( fDigitsArr->At(j) ) ;
case 0 : // not a neighbour
break ;
case 1 : // are neighbours
- clu->AddDigit(*digitN, digitN->GetEnergy());
+ clu->AddDigit(*digitN, Calibrate(digitN->GetEnergy(),digitN->GetId()),CalibrateT(digitN->GetTime(),digitN->GetId())) ;
clusterdigitslist[iDigitInCluster] = j ;
iDigitInCluster++ ;
fDigitsUsed[j]=kTRUE ;
break ;
case 2 : // too far from each other
- goto endofloop;
+ goto endOfLoop;
} // switch
}
- endofloop: ; //scanned all possible neighbours for this digit
+ endOfLoop: ; //scanned all possible neighbours for this digit
} // loop over cluster
} // energy theshold
- }
+ }
}
// 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()) ) ;
}
}
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(),
//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;
}
}
+//==================================================================================
+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 ;
+ }
+}
+