/* History of cvs commits:
*
- * $Log$
+ * $Log: AliPHOSClusterizerv1.cxx,v $
+ * Revision 1.118 2007/12/11 21:23:26 kharlov
+ * Added possibility to swith off unfolding
+ *
* Revision 1.117 2007/10/18 08:42:05 kharlov
* Bad channels cleaned before clusterization
*
#include "AliCDBStorage.h"
#include "AliCDBEntry.h"
#include "AliPHOSRecoParam.h"
-#include "AliPHOSCalibData.h"
#include "AliPHOSReconstructor.h"
+#include "AliPHOSCalibData.h"
ClassImp(AliPHOSClusterizerv1)
AliPHOSClusterizer(),
fDefaultInit(0), fEmcCrystals(0), fToUnfold(0),
fWrite(0), fNumberOfEmcClusters(0), fNumberOfCpvClusters(0),
- fADCchanelEmc(0), fADCpedestalEmc(0),
- fADCchanelCpv(0), fADCpedestalCpv(0), fEmcClusteringThreshold(0),
- fCpvClusteringThreshold(0), fEmcMinE(0), fCpvMinE(0),
+ fEmcClusteringThreshold(0), fCpvClusteringThreshold(0),
fEmcLocMaxCut(0), fW0(0), fCpvLocMaxCut(0),
- fW0CPV(0), fEmcTimeGate(0),
- fIsOldRCUFormat(0)
+ fW0CPV(0), fEmcTimeGate(0)
{
// default ctor (to be used mainly by Streamer)
AliPHOSClusterizer(geom),
fDefaultInit(0), fEmcCrystals(0), fToUnfold(0),
fWrite(0), fNumberOfEmcClusters(0), fNumberOfCpvClusters(0),
- fADCchanelEmc(0), fADCpedestalEmc(0),
- fADCchanelCpv(0), fADCpedestalCpv(0), fEmcClusteringThreshold(0),
- fCpvClusteringThreshold(0), fEmcMinE(0), fCpvMinE(0),
+ fEmcClusteringThreshold(0), fCpvClusteringThreshold(0),
fEmcLocMaxCut(0), fW0(0), fCpvLocMaxCut(0),
- fW0CPV(0), fEmcTimeGate(0),
- fIsOldRCUFormat(0)
+ fW0CPV(0), fEmcTimeGate(0)
{
// ctor with the indication of the file where header Tree and digits Tree are stored
// dtor
}
-
-//____________________________________________________________________________
-Float_t AliPHOSClusterizerv1::CalibrateEMC(Float_t amp, Int_t absId)
-{
- // Convert EMC measured amplitude into real energy.
- // Calibration parameters are taken from calibration data base for raw data,
- // or from digitizer parameters for simulated data.
-
- if(fgCalibData){
- Int_t relId[4];
- fGeom->AbsToRelNumbering(absId,relId) ;
- Int_t module = relId[0];
- Int_t column = relId[3];
- Int_t row = relId[2];
- if(absId <= fEmcCrystals) { // this is EMC
- fADCchanelEmc = fgCalibData->GetADCchannelEmc (module,column,row);
- return amp*fADCchanelEmc ;
- }
- }
- else{ //simulation
- if(absId <= fEmcCrystals) // this is EMC
- return fADCpedestalEmc + amp*fADCchanelEmc ;
- }
- return 0;
-}
-
-//____________________________________________________________________________
-Float_t AliPHOSClusterizerv1::CalibrateCPV(Int_t amp, Int_t absId)
-{
- // Convert digitized CPV amplitude into charge.
- // Calibration parameters are taken from calibration data base for raw data,
- // or from digitizer parameters for simulated data.
-
- if(fgCalibData){
- Int_t relId[4];
- fGeom->AbsToRelNumbering(absId,relId) ;
- Int_t module = relId[0];
- Int_t column = relId[3];
- Int_t row = relId[2];
- if(absId > fEmcCrystals) { // this is CPV
- fADCchanelCpv = fgCalibData->GetADCchannelCpv (module,column,row);
- fADCpedestalCpv = fgCalibData->GetADCpedestalCpv(module,column,row);
- return fADCpedestalCpv + amp*fADCchanelCpv ;
- }
- }
- else{ //simulation
- if(absId > fEmcCrystals) // this is CPV
- return fADCpedestalCpv+ amp*fADCchanelCpv ;
- }
- return 0;
-}
-
//____________________________________________________________________________
void AliPHOSClusterizerv1::Digits2Clusters(Option_t *option)
{
}
-//____________________________________________________________________________
-void AliPHOSClusterizerv1::GetCalibrationParameters()
-{
- // Set calibration parameters:
- // if calibration database exists, they are read from database,
- // otherwise, reconstruction stops in the constructor of AliPHOSCalibData
- //
- // It is a user responsilibity to open CDB before reconstruction, for example:
- // AliCDBStorage* storage = AliCDBManager::Instance()->GetStorage("local://CalibDB");
-
- if (!fgCalibData)
- 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");
-
-}
//____________________________________________________________________________
void AliPHOSClusterizerv1::Init()
if(!gMinuit)
gMinuit = new TMinuit(100);
- GetCalibrationParameters() ;
+ if (!fgCalibData)
+ fgCalibData = new AliPHOSCalibData(-1); //use AliCDBManager's run number
+ if (fgCalibData->GetCalibDataEmc() == 0)
+ AliFatal("Calibration parameters for PHOS EMC not found. Stop reconstruction.\n");
}
fEmcLocMaxCut = parEmc->GetLocalMaxCut();
fCpvLocMaxCut = parCpv->GetLocalMaxCut();
- fEmcMinE = parEmc->GetMinE();
- fCpvMinE = parCpv->GetMinE();
-
fW0 = parEmc->GetLogWeight();
fW0CPV = parCpv->GetLogWeight();
fToUnfold = parEmc->ToUnfold() ;
fWrite = kTRUE ;
-
- fIsOldRCUFormat = kFALSE;
}
//____________________________________________________________________________
return rv ;
}
-//____________________________________________________________________________
-void AliPHOSClusterizerv1::CleanDigits(TClonesArray * digits)
-{
- // Remove digits with amplitudes below threshold.
- // remove digits in bad channels
-
- Bool_t isBadMap = 0 ;
- if(fgCalibData->GetNumOfEmcBadChannels()){
- isBadMap=1 ;
- }
-
- Int_t inBadList=0 ;
- for(Int_t i=0; i<digits->GetEntriesFast(); i++){
- AliPHOSDigit * digit = static_cast<AliPHOSDigit*>(digits->At(i)) ;
- if ( (IsInEmc(digit) && CalibrateEMC(digit->GetEnergy(),digit->GetId()) < fEmcMinE) ||
- (IsInCpv(digit) && CalibrateCPV(digit->GetAmp() ,digit->GetId()) < fCpvMinE) ){
- digits->RemoveAt(i) ;
- continue ;
- }
- if(isBadMap){ //check bad map now
- Int_t relid[4] ;
- fGeom->AbsToRelNumbering(digit->GetId(), relid) ;
- if(fgCalibData->IsBadChannelEmc(relid[0],relid[2],relid[3])){
- digits->RemoveAt(i) ;
- }
- }
- }
-
- digits->Compress() ;
- for (Int_t i = 0 ; i < digits->GetEntriesFast() ; i++) {
- AliPHOSDigit *digit = static_cast<AliPHOSDigit*>( digits->At(i) ) ;
- digit->SetIndexInList(i) ;
- }
-}
-
//____________________________________________________________________________
Bool_t AliPHOSClusterizerv1::IsInEmc(AliPHOSDigit * digit) const
{
Int_t index ;
//Evaluate position, dispersion and other RecPoint properties..
Int_t nEmc = fEMCRecPoints->GetEntriesFast();
+ Float_t emcMinE= AliPHOSReconstructor::GetRecoParamEmc()->GetMinE(); //Minimal digit energy
for(index = 0; index < nEmc; index++){
AliPHOSEmcRecPoint * rp =
dynamic_cast<AliPHOSEmcRecPoint *>( fEMCRecPoints->At(index) );
- rp->Purify(fEmcMinE) ;
+ rp->Purify(emcMinE) ;
if(rp->GetMultiplicity()==0){
fEMCRecPoints->RemoveAt(index) ;
delete rp ;
// Steering method to construct the clusters stored in a list of Reconstructed Points
// A cluster is defined as a list of neighbour digits
- //Remove digits below threshold
- CleanDigits(fDigitsArr) ;
-
TClonesArray * digitsC = static_cast<TClonesArray*>( fDigitsArr->Clone() ) ;
// Clusterization starts
TArrayI clusterdigitslist(1500) ;
Int_t index ;
- if (( IsInEmc (digit) &&
- CalibrateEMC(digit->GetEnergy(),digit->GetId()) > fEmcClusteringThreshold ) ||
- ( IsInCpv (digit) &&
- CalibrateCPV(digit->GetAmp() ,digit->GetId()) > fCpvClusteringThreshold ) ) {
+ if (( IsInEmc(digit) && digit->GetEnergy() > fEmcClusteringThreshold ) ||
+ ( IsInCpv(digit) && digit->GetEnergy() > fCpvClusteringThreshold ) ) {
Int_t iDigitInCluster = 0 ;
if ( IsInEmc(digit) ) {
fEMCRecPoints->AddAt(new AliPHOSEmcRecPoint(""), fNumberOfEmcClusters) ;
clu = dynamic_cast<AliPHOSEmcRecPoint *>( fEMCRecPoints->At(fNumberOfEmcClusters) ) ;
fNumberOfEmcClusters++ ;
- clu->AddDigit(*digit, CalibrateEMC(digit->GetEnergy(),digit->GetId())) ;
+ clu->AddDigit(*digit, digit->GetEnergy()) ;
clusterdigitslist[iDigitInCluster] = digit->GetIndexInList() ;
iDigitInCluster++ ;
digitsC->Remove(digit) ;
clu = dynamic_cast<AliPHOSCpvRecPoint *>( fCPVRecPoints->At(fNumberOfCpvClusters) ) ;
fNumberOfCpvClusters++ ;
- clu->AddDigit(*digit, CalibrateCPV(digit->GetAmp(),digit->GetId()) ) ;
+ clu->AddDigit(*digit, digit->GetEnergy()) ;
clusterdigitslist[iDigitInCluster] = digit->GetIndexInList() ;
iDigitInCluster++ ;
digitsC->Remove(digit) ;
case 0 : // not a neighbour
break ;
case 1 : // are neighbours
- if (IsInEmc (digitN))
- clu->AddDigit(*digitN, CalibrateEMC( digitN->GetEnergy(), digitN->GetId() ) );
- else
- clu->AddDigit(*digitN, CalibrateCPV( digitN->GetAmp() , digitN->GetId() ) );
-
+ clu->AddDigit(*digitN, digitN->GetEnergy());
clusterdigitslist[iDigitInCluster] = digitN->GetIndexInList() ;
iDigitInCluster++ ;
digitsC->Remove(digitN) ;
if( nMax > 1 ) { // if cluster is very flat (no pronounced maximum) then nMax = 0
UnfoldCluster(emcRecPoint, nMax, maxAt, maxAtEnergy) ;
+
fEMCRecPoints->Remove(emcRecPoint);
fEMCRecPoints->Compress() ;
index-- ;
Float_t * fitparameters = new Float_t[nPar] ;
Bool_t rv = FindFit(iniEmc, maxAt, maxAtEnergy, nPar, fitparameters) ;
+
if( !rv ) {
// Fit failed, return and remove cluster
iniEmc->SetNExMax(-1) ;
}
}
-
// Now create new RecPoints and fill energy lists with efit corrected to fluctuations
// so that energy deposited in each cell is distributed betwin new clusters proportionally
// to its contribution to efit
epar = fitparameters[iparam+2] ;
iparam += 3 ;
// fGeom->GetIncidentVector(fVtx,iniEmc->GetPHOSMod(),xpar,zpar,vIncid) ;
-
+
AliPHOSEmcRecPoint * emcRP = 0 ;
if(iniEmc->IsEmc()){ //create new entries in fEMCRecPoints...
/* History of cvs commits:
*
- * $Log$
+ * $Log: AliPHOSClusterizerv1.h,v $
+ * Revision 1.54 2007/10/01 20:24:08 kharlov
+ * Memory leaks fixed
+ *
* Revision 1.53 2007/08/28 12:55:07 policheh
* Loaders removed from the reconstruction code (C.Cheshkov)
*
virtual Int_t AreNeighbours(AliPHOSDigit * d1, AliPHOSDigit * d2)const ;
// Checks if digits are in neighbour cells
- virtual Float_t CalibrateCPV(Int_t amp, Int_t absId) ; // Tranforms CPV Amp to energy
- virtual Float_t CalibrateEMC(Float_t amp, Int_t absId) ; // Tranforms EMC Amp to energy
-
virtual void GetNumberOfClustersFound(int * numb )const{ numb[0] = fNumberOfEmcClusters ;
numb[1] = fNumberOfCpvClusters ; }
void Print(const Option_t * = "")const ;
- void SetEmcMinE(Float_t e){fEmcMinE = e ;}
- void SetCpvMinE(Float_t e){fCpvMinE = e ;}
virtual void SetEmcClusteringThreshold(Float_t cluth) { fEmcClusteringThreshold = cluth ; }
virtual void SetEmcLocalMaxCut(Float_t cut) { fEmcLocMaxCut = cut ; }
virtual void SetEmcLogWeight(Float_t w) { fW0 = w ; }
// void Unload() ;
virtual const char * Version() const { return "clu-v1"; }
- virtual void SetOldRCUFormat(Bool_t rcuFormat = kFALSE)
- { fIsOldRCUFormat = rcuFormat; };
-
protected:
void WriteRecPoints() ;
virtual Bool_t IsInEmc (AliPHOSDigit * digit)const ; // Tells if id digit is in EMC
virtual Bool_t IsInCpv (AliPHOSDigit * digit)const ; // Tells if id digit is in CPV
void CleanDigits(TClonesArray * digits) ;
- void GetCalibrationParameters(void);
void SetDistancesToBadChannels();
private:
Int_t fNumberOfEmcClusters ; // number of EMC clusters found
Int_t fNumberOfCpvClusters ; // number of CPV clusters found
- //Calibration parameters
- Float_t fADCchanelEmc ; // width of one ADC channel in GeV
- Float_t fADCpedestalEmc ; //
- Float_t fADCchanelCpv ; // width of one ADC channel in CPV 'popugais'
- Float_t fADCpedestalCpv ; //
-
Float_t fEmcClusteringThreshold ; // minimum energy to start EMC cluster
Float_t fCpvClusteringThreshold ; // minimum energy to start CPV cluster
- Float_t fEmcMinE ; // minimum energy of digit to be included into cluster
- Float_t fCpvMinE ; // minimum energy of digit to be included into cluster
Float_t fEmcLocMaxCut ; // minimum energy difference to distinguish local maxima in a cluster
Float_t fW0 ; // logarithmic weight for the cluster center of gravity calculation
Float_t fCpvLocMaxCut ; // minimum energy difference to distinguish local maxima in a CPV cluster
// Int_t fRecPointsInRun ; //! Total number of recpoints in one run
Float_t fEmcTimeGate ; // Maximum time difference between the digits in ont EMC cluster
- Bool_t fIsOldRCUFormat; // assume old RCU raw data format
- ClassDef(AliPHOSClusterizerv1,5) // Clusterizer implementation version 1
+ ClassDef(AliPHOSClusterizerv1,6) // Clusterizer implementation version 1
};