//////////////////////////////////////////////////////////////////////////////
// --- ROOT system ---
+#include "TClonesArray.h"
+#include "TTree.h"
// --- Standard library ---
// --- AliRoot header files ---
#include "AliEMCALClusterizer.h"
-#include "AliRunLoader.h"
+#include "AliLog.h"
ClassImp(AliEMCALClusterizer)
//____________________________________________________________________________
-AliEMCALClusterizer::AliEMCALClusterizer()
- : TTask("",""),
- fEventFolderName("")
+AliEMCALClusterizer::AliEMCALClusterizer():
+ fDigitsArr(NULL),
+ fTreeR(NULL),
+ fRecPoints(NULL)
{
// ctor
}
//____________________________________________________________________________
-AliEMCALClusterizer::AliEMCALClusterizer(const TString alirunFileName,
- const TString eventFolderName)
- : TTask("EMCAL"+AliConfig::Instance()->GetReconstructionerTaskName(), alirunFileName),
- fEventFolderName(eventFolderName)
+AliEMCALClusterizer::~AliEMCALClusterizer()
{
- // ctor
+ // dtor
+ if (fDigitsArr) {
+ fDigitsArr->Delete();
+ delete fDigitsArr;
+ }
+ if (fRecPoints) {
+ fRecPoints->Delete();
+ delete fRecPoints;
+ }
}
//____________________________________________________________________________
-AliEMCALClusterizer::AliEMCALClusterizer(const AliEMCALClusterizer& clu)
- : TTask(clu.GetName(),clu.GetTitle()),
- fEventFolderName(clu.fEventFolderName)
+void AliEMCALClusterizer::SetInput(TTree *digitsTree)
{
- // copy ctor
+ // Read the digits from the input tree
+ TBranch *branch = digitsTree->GetBranch("EMCAL");
+ if (!branch) {
+ AliError("can't get the branch with the EMCAL digits !");
+ return;
+ }
+ fDigitsArr = new TClonesArray("AliEMCALDigit",100);
+ branch->SetAddress(&fDigitsArr);
+ branch->GetEntry(0);
}
//____________________________________________________________________________
-AliEMCALClusterizer::~AliEMCALClusterizer()
+void AliEMCALClusterizer::SetOutput(TTree *clustersTree)
{
- // dtor
- //Remove this from the parental task before destroying
- AliRunLoader::GetRunLoader()->GetDetectorLoader("EMCAL")->CleanReconstructioner();
+ // Read the digits from the input tree
+ fTreeR = clustersTree;
+
+ AliDebug(9, "Making array for EMCAL clusters");
+ fRecPoints = new TObjArray(100) ;
+ Int_t split = 0;
+ Int_t bufsize = 32000;
+ fTreeR->Branch("EMCALECARP", "TObjArray", &fRecPoints, bufsize, split);
}
-
// of new IO (à la PHOS)
// --- ROOT system ---
-#include "TTask.h"
-#include "AliConfig.h"
+#include "TObject.h"
+class TTree;
// --- Standard library ---
// --- AliRoot header files ---
-class AliEMCALClusterizer : public TTask {
+class AliEMCALClusterizer : public TObject {
public:
AliEMCALClusterizer() ; // default ctor
- AliEMCALClusterizer(const TString alirunFileName, const TString eventFolderName = AliConfig::GetDefaultEventFolderName()) ;
- AliEMCALClusterizer(const AliEMCALClusterizer &); //copy ctor
virtual ~AliEMCALClusterizer() ; // dtorEM
- virtual Float_t GetTowerClusteringThreshold()const {Warning("GetTowerClusteringThreshold", "Not Defined") ; return 0. ; }
- virtual Float_t GetTowerLocalMaxCut()const {Warning("GetTowerLocalMaxCut", "Not Defined") ; return 0. ; }
- virtual Float_t GetTowerLogWeight()const {Warning("GetTowerLogWeight", "Not Defined") ; return 0. ; }
- virtual Float_t GetTimeCut() const {Warning("GetTimeCut", "Not Defined") ; return 0. ; }
- virtual const char * GetRecPointsBranch() const {Warning("GetRecPointsBranch", "Not Defined") ; return 0 ; }
- virtual Int_t GetRecPointsInRun() const {Warning("GetRecPointsInRun", "Not Defined") ; return 0 ; }
- virtual const char * GetDigitsBranch() const {Warning("GetDigitsBranch", "Not Defined") ; return 0 ; }
+ virtual void Digits2Clusters(Option_t *option) = 0;
- virtual void MakeClusters() = 0;
+ virtual Float_t GetTimeCut() const = 0;
virtual void SetECAClusteringThreshold(Float_t) = 0;
virtual void SetECALocalMaxCut(Float_t) = 0;
virtual void SetECALogWeight(Float_t) = 0;
virtual void SetTimeCut(Float_t) = 0;
virtual void SetUnfolding(Bool_t) = 0;
- void SetEventFolderName(TString name) { fEventFolderName = name ; }
-
- AliEMCALClusterizer & operator = (const AliEMCALClusterizer & /*rvalue*/) {return *this ;}
virtual const char * Version() const {Warning("Version", "Not Defined") ; return 0 ; }
+ virtual void SetInput(TTree *digitsTree);
+ virtual void SetOutput(TTree *clustersTree);
+
protected:
- TString fEventFolderName ; // event folder name
- ClassDef(AliEMCALClusterizer,0) // Clusterization algorithm class
+ virtual void MakeClusters(char* opt) = 0;
+
+ TClonesArray *fDigitsArr; // Array with EMCAL digits
+ TTree *fTreeR; // Tree with output clusters
+ TObjArray *fRecPoints; // Array with EMCAL clusters
+
+private:
+ AliEMCALClusterizer(const AliEMCALClusterizer &); //copy ctor
+ AliEMCALClusterizer & operator = (const AliEMCALClusterizer &);
+
+ ClassDef(AliEMCALClusterizer,1) // Clusterization algorithm class
} ;
#endif // AliEMCALCLUSTERIZER_H
#include "AliRunLoader.h"
#include "AliRun.h"
#include "AliESD.h"
-#include "AliEMCALLoader.h"
#include "AliEMCALClusterizerv1.h"
#include "AliEMCALRecPoint.h"
#include "AliEMCALDigit.h"
#include "AliEMCALDigitizer.h"
#include "AliEMCAL.h"
#include "AliEMCALGeometry.h"
-#include "AliEMCALRawUtils.h"
#include "AliEMCALHistoUtilities.h"
+#include "AliEMCALRecParam.h"
+#include "AliEMCALReconstructor.h"
#include "AliCDBManager.h"
class AliCDBStorage;
ClassImp(AliEMCALClusterizerv1)
//____________________________________________________________________________
-AliEMCALClusterizerv1::AliEMCALClusterizerv1()
+AliEMCALClusterizerv1::AliEMCALClusterizerv1()
: AliEMCALClusterizer(),
- fHists(0),fPointE(0),fPointL1(0),fPointL2(0),
- fPointDis(0),fPointMult(0),fDigitAmp(0),fMaxE(0),
- fMaxL1(0),fMaxL2(0),fMaxDis(0),fGeom(0),
- fDefaultInit(kTRUE),
- fToUnfold(kFALSE),
- fNumberOfECAClusters(0),fNTowerInGroup(0),fCalibData(0),
- fADCchannelECA(0.),fADCpedestalECA(0.),fECAClusteringThreshold(0.),fECALocMaxCut(0.),
- fECAW0(0.),fRecPointsInRun(0),fTimeCut(0.),fMinECut(0.)
-{
- // default ctor (to be used mainly by Streamer)
-
- InitParameters() ;
- fGeom = AliEMCALGeometry::GetInstance(AliEMCALGeometry::GetDefaulGeometryName());
- fGeom->GetTransformationForSM(); // Global <-> Local
-}
-
-//____________________________________________________________________________
-AliEMCALClusterizerv1::AliEMCALClusterizerv1(const TString alirunFileName, const TString eventFolderName)
- : AliEMCALClusterizer(alirunFileName, eventFolderName),
fHists(0),fPointE(0),fPointL1(0),fPointL2(0),
fPointDis(0),fPointMult(0),fDigitAmp(0),fMaxE(0),
fMaxL1(0),fMaxL2(0),fMaxDis(0),fGeom(0),
fToUnfold(kFALSE),
fNumberOfECAClusters(0),fNTowerInGroup(0),fCalibData(0),
fADCchannelECA(0.),fADCpedestalECA(0.),fECAClusteringThreshold(0.),fECALocMaxCut(0.),
- fECAW0(0.),fRecPointsInRun(0),fTimeCut(0.),fMinECut(0.)
+ fECAW0(0.),fTimeCut(0.),fMinECut(0.)
{
// ctor with the indication of the file where header Tree and digits Tree are stored
Init() ;
}
-//____________________________________________________________________________
-AliEMCALClusterizerv1::AliEMCALClusterizerv1(const AliEMCALClusterizerv1& clus)
- : AliEMCALClusterizer(clus),
- fHists(clus.fHists),
- fPointE(clus.fPointE),
- fPointL1(clus.fPointL1),
- fPointL2(clus.fPointL2),
- fPointDis(clus.fPointDis),
- fPointMult(clus.fPointMult),
- fDigitAmp(clus.fDigitAmp),
- fMaxE(clus.fMaxE),
- fMaxL1(clus.fMaxL1),
- fMaxL2(clus.fMaxL2),
- fMaxDis(clus.fMaxDis),
- fGeom(clus.fGeom),
- fDefaultInit(clus.fDefaultInit),
- fToUnfold(clus.fToUnfold),
- fNumberOfECAClusters(clus.fNumberOfECAClusters),
- fNTowerInGroup(clus.fNTowerInGroup),
- fCalibData(clus.fCalibData),
- fADCchannelECA(clus.fADCchannelECA),
- fADCpedestalECA(clus.fADCpedestalECA),
- fECAClusteringThreshold(clus.fECAClusteringThreshold),
- fECALocMaxCut(clus.fECALocMaxCut),
- fECAW0(clus.fECAW0),
- fRecPointsInRun(clus.fRecPointsInRun),
- fTimeCut(clus.fTimeCut),
- fMinECut(clus.fMinECut)
-{
- //copy ctor
-}
-
//____________________________________________________________________________
AliEMCALClusterizerv1::~AliEMCALClusterizerv1()
{
// dtor
}
-//____________________________________________________________________________
-const TString AliEMCALClusterizerv1::BranchName() const
-{
- return GetName();
-}
-
//____________________________________________________________________________
Float_t AliEMCALClusterizerv1::Calibrate(Int_t amp, Int_t AbsId)
{
}
//____________________________________________________________________________
-void AliEMCALClusterizerv1::Exec(Option_t * option)
+void AliEMCALClusterizerv1::Digits2Clusters(Option_t * option)
{
// Steering method to perform clusterization for the current event
// in AliEMCALLoader
if(strstr(option,"print"))
Print("") ;
- AliRunLoader *rl = AliRunLoader::GetRunLoader();
- AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*>(rl->GetDetectorLoader("EMCAL"));
-
//Get calibration parameters from file or digitizer default values.
GetCalibrationParameters() ;
if(fToUnfold)
MakeUnfolding() ;
- WriteRecPoints() ;
-
+ fTreeR->Fill();
+
if(strstr(option,"deb") || strstr(option,"all"))
PrintRecPoints(option) ;
- AliDebug(1,Form("EMCAL Clusterizer found %d Rec Points",emcalLoader->RecPoints()->GetEntriesFast()));
-
- //increment the total number of recpoints per run
- fRecPointsInRun += emcalLoader->RecPoints()->GetEntriesFast() ;
+ AliDebug(1,Form("EMCAL Clusterizer found %d Rec Points",fRecPoints->GetEntriesFast()));
if(strstr(option,"tim")){
gBenchmark->Stop("EMCALClusterizer");
// The initial values for fitting procedure are set equal to the positions of local maxima.
// Cluster will be fitted as a superposition of nPar/3 electromagnetic showers
- AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*>(AliRunLoader::GetRunLoader()->GetDetectorLoader("EMCAL"));
- TClonesArray *digits = emcalLoader->Digits();
-
gMinuit->mncler(); // Reset Minuit's list of paramters
gMinuit->SetPrintLevel(-1) ; // No Printout
gMinuit->SetFCN(AliEMCALClusterizerv1::UnfoldingChiSquare) ;
// To set the address of the minimization function
TList * toMinuit = new TList();
toMinuit->AddAt(emcRP,0) ;
- toMinuit->AddAt(digits,1) ;
+ toMinuit->AddAt(fDigitsArr,1) ;
gMinuit->SetObjectFit(toMinuit) ; // To tranfer pointer to UnfoldingChiSquare
//Check if calibration is stored in data base
- AliEMCALLoader *emcalLoader =
- dynamic_cast<AliEMCALLoader*>(AliRunLoader::GetRunLoader()->GetDetectorLoader("EMCAL"));
-
- fCalibData =emcalLoader->CalibData();
-
- if(!fCalibData)
- {
- //If calibration is not available use default parameters
- //Loader
- if ( !emcalLoader->Digitizer() )
- emcalLoader->LoadDigitizer();
- AliEMCALDigitizer * dig = dynamic_cast<AliEMCALDigitizer*>(emcalLoader->Digitizer());
+ if(!fCalibData && (AliCDBManager::Instance()->IsDefaultStorageSet()))
+ {
+ AliCDBEntry *entry = (AliCDBEntry*)
+ AliCDBManager::Instance()->Get("EMCAL/Calib/Data");
+ if (entry) fCalibData = (AliEMCALCalibData*) entry->GetObject();
+ }
+
+ if(!fCalibData)
+ AliFatal("Calibration parameters not found in CDB!");
+
+ // Please fix it!! Or better just remove it...
+// if(!fCalibData)
+// {
+// //If calibration is not available use default parameters
+// //Loader
+// if ( !emcalLoader->Digitizer() )
+// emcalLoader->LoadDigitizer();
+// AliEMCALDigitizer * dig = dynamic_cast<AliEMCALDigitizer*>(emcalLoader->Digitizer());
- fADCchannelECA = dig->GetECAchannel() ;
- fADCpedestalECA = dig->GetECApedestal();
- }
+// fADCchannelECA = dig->GetECAchannel() ;
+// fADCpedestalECA = dig->GetECApedestal();
+// }
}
//____________________________________________________________________________
fNTowerInGroup = 36; //Produces maximum of 80 pseudoclusters per event
- fECAClusteringThreshold = 0.5; // Best value for 2 GeV gamma merged with Ideal HIJING. Retune later?
fECALocMaxCut = 0.03; // ??
- fECAW0 = 4.5;
fTimeCut = 300e-9 ; // 300 ns time cut (to be tuned)
fToUnfold = kFALSE ;
- fRecPointsInRun = 0 ;
- fMinECut = 0.45; // Best value for 2 GeV gamma merged with Ideal HIJING. Retune later?
fCalibData = 0 ;
- // If reconstruction parameters are found in OCDB, take them from it
-
- AliEMCALLoader *emcalLoader =
- dynamic_cast<AliEMCALLoader*>(AliRunLoader::GetRunLoader()->GetDetectorLoader("EMCAL"));
- AliEMCALRecParam *recParamDB = emcalLoader->RecParam();
- if (recParamDB != 0) {
- fECAClusteringThreshold = recParamDB->GetClusteringThreshold();
- fECAW0 = recParamDB->GetW0();
- fMinECut = recParamDB->GetMinECut();
- AliDebug(1,Form("Reconstruction parameters were taken from OCDB: fECAClusteringThreshold=%.3f, fECAW=%.3f, fMinECut=%.3f",
+ const AliEMCALRecParam* recParam = AliEMCALReconstructor::GetRecParam();
+ if(!recParam) {
+ AliFatal("Reconstruction parameters for EMCAL not set!");
+ }
+ else {
+ fECAClusteringThreshold = recParam->GetClusteringThreshold();
+ fECAW0 = recParam->GetW0();
+ fMinECut = recParam->GetMinECut();
+ AliDebug(1,Form("Reconstruction parameters: fECAClusteringThreshold=%.3f, fECAW=%.3f, fMinECut=%.3f",
fECAClusteringThreshold,fECAW0,fMinECut));
}
return rv ;
}
-//____________________________________________________________________________
-void AliEMCALClusterizerv1::WriteRecPoints()
-{
-
- // Creates new branches with given title
- // fills and writes into TreeR.
-
- AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*>(AliRunLoader::GetRunLoader()->GetDetectorLoader("EMCAL"));
-
- TObjArray * aECARecPoints = emcalLoader->RecPoints() ;
-
- TClonesArray * digits = emcalLoader->Digits() ;
- TTree * treeR = emcalLoader->TreeR();
- if ( treeR==0 ) {
- emcalLoader->MakeRecPointsContainer();
- treeR = emcalLoader->TreeR();
- }
- else if (treeR->GetEntries() > 0) {
- Warning("WriteRecPoints","RecPoints already exist in output file. New Recpoitns will not be visible.");
- }
- Int_t index ;
-
- //Evaluate position, dispersion and other RecPoint properties for EC section
- for(index = 0; index < aECARecPoints->GetEntries(); index++) {
- if (dynamic_cast<AliEMCALRecPoint *>(aECARecPoints->At(index))->GetClusterType() != AliESDCaloCluster::kPseudoCluster)
- dynamic_cast<AliEMCALRecPoint *>(aECARecPoints->At(index))->EvalAll(fECAW0,digits) ;
- }
-
- aECARecPoints->Sort() ;
-
- for(index = 0; index < aECARecPoints->GetEntries(); index++) {
- (dynamic_cast<AliEMCALRecPoint *>(aECARecPoints->At(index)))->SetIndexInList(index) ;
- (dynamic_cast<AliEMCALRecPoint *>(aECARecPoints->At(index)))->Print();
- }
-
- Int_t bufferSize = 32000 ;
- Int_t splitlevel = 0 ;
-
- //EC section branch
-
- TBranch * branchECA = 0;
- if ((branchECA = treeR->GetBranch("EMCALECARP")))
- branchECA->SetAddress(&aECARecPoints);
- else
- treeR->Branch("EMCALECARP","TObjArray",&aECARecPoints,bufferSize,splitlevel);
- treeR->Fill() ;
-
- emcalLoader->WriteRecPoints("OVERWRITE");
-}
-
//____________________________________________________________________________
void AliEMCALClusterizerv1::MakeClusters(char* option)
{
if (fGeom==0) AliFatal("Did not get geometry from EMCALLoader");
- AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*>(AliRunLoader::GetRunLoader()->GetDetectorLoader("EMCAL"));
- TObjArray * aECARecPoints = emcalLoader->RecPoints() ;
- aECARecPoints->Clear();
-
- TClonesArray *digits = emcalLoader->Digits();
+ fRecPoints->Clear();
// Set up TObjArray with pointers to digits to work on
TObjArray *digitsC = new TObjArray();
- TIter nextdigit(digits);
+ TIter nextdigit(fDigitsArr);
AliEMCALDigit *digit;
while ( (digit = dynamic_cast<AliEMCALDigit*>(nextdigit())) ) {
digitsC->AddLast(digit);
//
// New algorithm : will be created one pseudo cluster per module
//
- AliDebug(1,Form("Pseudo clustering #digits : %i ",digits->GetEntries()));
+ AliDebug(1,Form("Pseudo clustering #digits : %i ",fDigitsArr->GetEntries()));
AliEMCALRecPoint *recPoints[12]; // max size is 12 : see fGeom->GetNumberOfSuperModules();
for(int i=0; i<12; i++) recPoints[i] = 0;
}
fNumberOfECAClusters = 0;
for(int i=0; i<fGeom->GetNumberOfSuperModules(); i++) { // put non empty rec.points to container
- if(recPoints[i]) aECARecPoints->AddAt(recPoints[i], fNumberOfECAClusters++);
+ if(recPoints[i]) fRecPoints->AddAt(recPoints[i], fNumberOfECAClusters++);
}
AliDebug(1,Form(" Number of PC %d ", fNumberOfECAClusters));
}
ehs += e;
}
AliDebug(1,Form("MakeClusters: Number of digits %d -> (e %f), ehs %d\n",
- digits->GetEntries(),fMinECut,ehs));
+ fDigitsArr->GetEntries(),fMinECut,ehs));
nextdigitC.Reset();
while ( (digit = dynamic_cast<AliEMCALDigit *>(nextdigitC())) ) { // scan over the list of digitsC
- TArrayI clusterECAdigitslist(digits->GetEntries());
+ TArrayI clusterECAdigitslist(fDigitsArr->GetEntries());
if(fGeom->CheckAbsCellId(digit->GetId()) && (Calibrate(digit->GetAmp(), digit->GetId()) > fECAClusteringThreshold ) ){
// start a new Tower RecPoint
- if(fNumberOfECAClusters >= aECARecPoints->GetSize()) aECARecPoints->Expand(2*fNumberOfECAClusters+1) ;
+ if(fNumberOfECAClusters >= fRecPoints->GetSize()) fRecPoints->Expand(2*fNumberOfECAClusters+1) ;
AliEMCALRecPoint *recPoint = new AliEMCALRecPoint("") ;
- aECARecPoints->AddAt(recPoint, fNumberOfECAClusters) ;
- recPoint = dynamic_cast<AliEMCALRecPoint *>(aECARecPoints->At(fNumberOfECAClusters)) ;
+ fRecPoints->AddAt(recPoint, fNumberOfECAClusters) ;
+ recPoint = dynamic_cast<AliEMCALRecPoint *>(fRecPoints->At(fNumberOfECAClusters)) ;
fNumberOfECAClusters++ ;
recPoint->SetClusterType(AliESDCaloCluster::kClusterv1);
delete digitsC ;
- AliDebug(1,Form("total no of clusters %d from %d digits",fNumberOfECAClusters,digits->GetEntriesFast()));
+ AliDebug(1,Form("total no of clusters %d from %d digits",fNumberOfECAClusters,fDigitsArr->GetEntriesFast()));
}
void AliEMCALClusterizerv1::MakeUnfolding() const
// Print parameters
- TString taskName(GetName()) ;
- taskName.ReplaceAll(Version(), "") ;
+ TString taskName(Version()) ;
printf("--------------- ");
printf(taskName.Data()) ;
printf(" ");
- printf(GetTitle()) ;
- printf("-----------\n");
- printf("Clusterizing digits from the file: ");
- printf(taskName.Data());
- printf("\n Branch: ");
- printf(GetName());
+ printf("Clusterizing digits: ");
printf("\n ECA Local Maximum cut = %f", fECALocMaxCut);
printf("\n ECA Logarithmic weight = %f", fECAW0);
if(fToUnfold)
void AliEMCALClusterizerv1::PrintRecPoints(Option_t * option)
{
// Prints list of RecPoints produced at the current pass of AliEMCALClusterizer
- AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*>(AliRunLoader::GetRunLoader()->GetDetectorLoader("EMCAL"));
- TObjArray * aECARecPoints = emcalLoader->RecPoints() ;
-
if(strstr(option,"deb")) {
printf("PrintRecPoints: Clusterization result:") ;
- printf("event # %d\n", emcalLoader->GetRunLoader()->GetEventNumber() ) ;
printf(" Found %d ECA Rec Points\n ",
- aECARecPoints->GetEntriesFast()) ;
+ fRecPoints->GetEntriesFast()) ;
}
- fRecPointsInRun += aECARecPoints->GetEntriesFast() ;
-
if(strstr(option,"all")) {
if(strstr(option,"deb")) {
printf("\n-----------------------------------------------------------------------\n") ;
Float_t maxL2=0;
Float_t maxDis=0;
- AliEMCALHistoUtilities::FillH1(fHists, 12, double(aECARecPoints->GetEntries()));
+ AliEMCALHistoUtilities::FillH1(fHists, 12, double(fRecPoints->GetEntries()));
- for (index = 0 ; index < aECARecPoints->GetEntries() ; index++) {
- AliEMCALRecPoint * rp = dynamic_cast<AliEMCALRecPoint * >(aECARecPoints->At(index)) ;
+ for (index = 0 ; index < fRecPoints->GetEntries() ; index++) {
+ AliEMCALRecPoint * rp = dynamic_cast<AliEMCALRecPoint * >(fRecPoints->At(index)) ;
TVector3 globalpos;
//rp->GetGlobalPosition(globalpos);
TVector3 localpos;
}
}
}
-
-void AliEMCALClusterizerv1::Browse(TBrowser* b)
-{
- if(fHists) b->Add(fHists);
- if(fGeom) b->Add(fGeom);
- TTask::Browse(b);
-}
public:
AliEMCALClusterizerv1() ;
- //cpy ctor required by coding convention
- AliEMCALClusterizerv1(const AliEMCALClusterizerv1& clus);
- AliEMCALClusterizerv1(const TString alirunFileNameFile, const TString eventFolderName = AliConfig::GetDefaultEventFolderName());
virtual ~AliEMCALClusterizerv1() ;
- virtual void Browse(TBrowser* b);
-
- AliEMCALClusterizerv1 & operator = (const AliEMCALClusterizerv1 &) {
- Fatal("operator =", "not implemented") ;
- return *this ;
- }
virtual Int_t AreNeighbours(AliEMCALDigit * d1, AliEMCALDigit * d2)const ;
// Checks if digits are in neighbour cells
virtual Float_t GetMinECut()const { return fMinECut;}
virtual Float_t GetTimeCut() const { return fTimeCut ; }
- virtual const char * GetRecPointsBranch() const{ return GetName() ;}
- virtual Int_t GetRecPointsInRun() const {return fRecPointsInRun ;}
- void Exec(Option_t *option); // Does the job
+ virtual void Digits2Clusters(Option_t *option); // Does the job
virtual void Print(Option_t * option)const ;
void DrawLambdasHists(); //*MENU*
protected:
- void WriteRecPoints() ;
virtual void MakeClusters(char* opt );
- virtual void MakeClusters() { Fatal("MakeClusters","not implemented"); }
/////////////////////
TList *fHists; //!
private:
+ AliEMCALClusterizerv1(const AliEMCALClusterizerv1 &); //copy ctor
+ AliEMCALClusterizerv1 & operator = (const AliEMCALClusterizerv1 &);
- const TString BranchName() const ;
void GetCalibrationParameters(void) ;
Bool_t FindFit(AliEMCALRecPoint * emcRP, AliEMCALDigit ** MaxAt, Float_t * maxAtEnergy,
Float_t fECAClusteringThreshold ; // minimum energy to seed a EC digit in a cluster
Float_t fECALocMaxCut ; // minimum energy difference to distinguish local maxima in a cluster
Float_t fECAW0 ; // logarithmic weight for the cluster center of gravity calculation
- Int_t fRecPointsInRun ; //! Total number of recpoints in one run
Float_t fTimeCut ; // Maximum time difference between the digits in ont EMC cluster
Float_t fMinECut; // Minimum energy for a digit to be a member of a cluster
- ClassDef(AliEMCALClusterizerv1,5) // Clusterizer implementation version 1
+ ClassDef(AliEMCALClusterizerv1,6) // Clusterizer implementation version 1
};
/* $Id$ */
/* History of cvs commits:
*
- * $Log$ */
+ * $Log$
+ * Revision 1.1 2007/03/17 19:56:38 mvl
+ * Moved signal shape routines from AliEMCAL to separate class AliEMCALRawUtils to streamline raw data reconstruction code.
+ * */
//*-- Author: Marco van Leeuwen (LBL)
#include "AliEMCALRawUtils.h"
}
//____________________________________________________________________________
-void AliEMCALRawUtils::Raw2Digits(AliRawReader* reader)
+void AliEMCALRawUtils::Raw2Digits(AliRawReader* reader,TClonesArray *digitsArr)
{
// convert raw data of the current event to digits
AliEMCALGeometry * geom = AliEMCALGeometry::GetInstance();
return;
}
- AliRunLoader *rl = AliRunLoader::GetRunLoader();
- AliEMCALLoader *loader = dynamic_cast<AliEMCALLoader*>(rl->GetDetectorLoader("EMCAL"));
-
- // get the digits
- TClonesArray* digits = loader->Digits() ;
- digits->Clear();
+ digitsArr->Clear();
- if (!digits) {
+ if (!digitsArr) {
Error("Raw2Digits", "no digits found !");
return;
}
if (amp > 0) {
AliDebug(2,Form("id %d amp %g", id, amp));
- new((*digits)[idigit]) AliEMCALDigit( -1, -1, id, (Int_t)amp, time, idigit) ;
+ new((*digitsArr)[idigit]) AliEMCALDigit( -1, -1, id, (Int_t)amp, time, idigit) ;
idigit++ ;
}
Int_t index ;
/* History of cvs commits:
*
* $Log$
+ * Revision 1.1 2007/03/17 19:56:38 mvl
+ * Moved signal shape routines from AliEMCAL to separate class AliEMCALRawUtils to streamline raw data reconstruction code.
+ *
*
*/
//_________________________________________________________________________
virtual ~AliEMCALRawUtils();
void Digits2Raw();
- void Raw2Digits(AliRawReader *reader);
+ void Raw2Digits(AliRawReader *reader,TClonesArray *digitsArr);
// Signal shape parameters
Double_t GetRawFormatHighLowGainFactor() const {return fHighLowGainFactor ;}
//-----------------------------------------------------------------------------
AliEMCALRecParam::AliEMCALRecParam():
- fClusteringThreshold(0),fW0(0),fMinECut(0)
-{}
+ fClusteringThreshold(0.5),fW0(4.5),fMinECut(0.45)
+{
+ // default reco values
+}
//-----------------------------------------------------------------------------
void AliEMCALRecParam::Print(Option_t *) const
AliEMCALRecParam() ;
virtual ~AliEMCALRecParam() {}
- Float_t GetClusteringThreshold() {return fClusteringThreshold;}
- Float_t GetW0 () {return fW0 ;}
- Float_t GetMinECut () {return fMinECut ;}
+ Float_t GetClusteringThreshold() const {return fClusteringThreshold;}
+ Float_t GetW0 () const {return fW0 ;}
+ Float_t GetMinECut () const {return fMinECut ;}
void SetClusteringThreshold(Float_t thrsh) {fClusteringThreshold = thrsh;}
void SetW0 (Float_t w0) {fW0 = w0 ;}
void SetMinECut (Float_t minEcut) {fMinECut = minEcut ;}
// --- AliRoot header files ---
#include "AliEMCALReconstructor.h"
-#include "AliRun.h"
#include "AliESDEvent.h"
#include "AliESDCaloCluster.h"
#include "AliESDtrack.h"
-#include "AliRunLoader.h"
#include "AliEMCALLoader.h"
#include "AliEMCALRawUtils.h"
#include "AliEMCALClusterizerv1.h"
#include "AliEMCALPID.h"
#include "AliEMCALTrigger.h"
#include "AliRawReader.h"
+// to be removed - it is here just because of geom
+#include "AliRun.h"
+#include "AliRunLoader.h"
ClassImp(AliEMCALReconstructor)
+AliEMCALRecParam* AliEMCALReconstructor::fgkRecParam = 0; // EMCAL rec. parameters
+
//____________________________________________________________________________
AliEMCALReconstructor::AliEMCALReconstructor()
: fDebug(kFALSE)
{
// ctor
+ if (!fgkRecParam) {
+ AliWarning("The Reconstruction parameters for EMCAL nonitialized - Used default one");
+ fgkRecParam = new AliEMCALRecParam;
+ }
}
//____________________________________________________________________________
}
//____________________________________________________________________________
-void AliEMCALReconstructor::Reconstruct(AliRunLoader* runLoader) const
+void AliEMCALReconstructor::Reconstruct(TTree* digitsTree, TTree* clustersTree) const
{
// method called by AliReconstruction;
// Only the clusterization is performed,; the rest of the reconstruction is done in FillESD because the track
// segment maker needs access to the AliESD object to retrieve the tracks reconstructed by
// the global tracking.
+ // Works on the current event.
- TString headerFile(runLoader->GetFileName()) ;
- TString branchName(runLoader->GetEventFolder()->GetName() ) ;
-
- AliEMCALClusterizerv1 clu(headerFile, branchName);
- AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*>(runLoader->GetDetectorLoader("EMCAL"));
-
- Int_t nEvents = runLoader->GetNumberOfEvents();
- runLoader->LoadDigits("EMCAL");
- for (Int_t ievent = 0; ievent < nEvents; ievent++) {
- runLoader->GetEvent(ievent);
- if ( Debug() )
- clu.ExecuteTask("deb all") ;
- else
- clu.ExecuteTask("pseudo") ;
- }
- // Unload the Digits and RecPoints
- emcalLoader->UnloadDigits() ;
- emcalLoader->UnloadRecPoints() ;
+ AliEMCALClusterizerv1 clu;
+ clu.SetInput(digitsTree);
+ clu.SetOutput(clustersTree);
+ if ( Debug() )
+ clu.Digits2Clusters("deb all") ;
+ else
+ clu.Digits2Clusters("pseudo") ;
}
//____________________________________________________________________________
-void AliEMCALReconstructor::Reconstruct(AliRunLoader* runLoader, AliRawReader* rawReader) const
+void AliEMCALReconstructor::ConvertDigits(AliRawReader* rawReader, TTree* digitsTree) const
{
- // Reconstruction loop for Raw Data processing
- //
- // Only the clusterization is performed
- // Track-cluster matching is done in FillESD because the track
- // segment maker needs access to the AliESD object to retrieve
- // the tracks reconstructed by the global tracking.
-
- TString headerFile(runLoader->GetFileName()) ;
- TString branchName(runLoader->GetEventFolder()->GetName()) ;
+ // Conversion from raw data to
+ // EMCAL digits.
+ // Works on a single-event basis
- static AliEMCALRawUtils rawUtils;
- AliEMCALClusterizerv1 clu(headerFile, branchName);
- AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*>(runLoader->GetDetectorLoader("EMCAL"));
-
- Int_t iEvent = 0;
rawReader->Reset() ;
- while (rawReader->NextEvent()) {
- runLoader->GetEvent(iEvent++);
- rawUtils.Raw2Digits(rawReader);
+ TClonesArray *digitsArr = new TClonesArray("AliEMCALDigit",100);
+ Int_t bufsize = 32000;
+ digitsTree->Branch("EMCAL", &digitsArr, bufsize);
- if ( Debug() )
- clu.ExecuteTask("deb pseudo all") ;
- else
- clu.ExecuteTask("pseudo") ;
- // Unload the RecPoints
- emcalLoader->UnloadRecPoints() ;
- }
+ static AliEMCALRawUtils rawUtils;
+ rawUtils.Raw2Digits(rawReader,digitsArr);
}
//____________________________________________________________________________
-void AliEMCALReconstructor::FillESD(AliRunLoader* runLoader, AliESDEvent* esd) const
+void AliEMCALReconstructor::FillESD(TTree* digitsTree, TTree* clustersTree,
+ AliESDEvent* esd) const
{
// Called by AliReconstruct after Reconstruct() and global tracking and vertexing
+ // Works on the current event
const double timeScale = 1.e+11; // transition constant from sec to 0.01 ns
- Int_t eventNumber = runLoader->GetEventNumber() ;
-
// Creates AliESDCaloCluster from AliEMCALRecPoints
- AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*>(runLoader->GetDetectorLoader("EMCAL"));
- runLoader->LoadRecPoints("EMCAL");
- runLoader->GetEvent(eventNumber);
- TObjArray *clusters = emcalLoader->RecPoints();
+
+ TObjArray *clusters = new TObjArray(100);
+ TBranch *branch = clustersTree->GetBranch("EMCALECARP");
+ branch->SetAddress(&clusters);
+ clustersTree->GetEvent(0);
+
Int_t nClusters = clusters->GetEntries(), nClustersNew=0;
- AliDebug(1,Form("Event %d: %d clusters",eventNumber,nClusters));
+ AliDebug(1,Form("%d clusters",nClusters));
// Int_t nRP=0, nPC=0; // in input
esd->SetFirstEMCALCluster(esd->GetNumberOfCaloClusters()); // Put after Phos clusters
Float_t ampOutOfPatchnxn = tr.GetnxnAmpOutOfPatch() ;
AliEMCALGeometry * geom = 0;
+ AliRunLoader *runLoader = AliRunLoader::GetRunLoader();
if (runLoader->GetAliRun() && runLoader->GetAliRun()->GetDetector("EMCAL"))
geom = dynamic_cast<AliEMCAL*>(runLoader->GetAliRun()->GetDetector("EMCAL"))->GetGeometry();
if (geom == 0)
for (Int_t iClust = 0 ; iClust < nClusters ; iClust++) {
- const AliEMCALRecPoint * clust = emcalLoader->RecPoint(iClust);
+ const AliEMCALRecPoint * clust = (const AliEMCALRecPoint*)clusters->At(iClust);
//if(clust->GetClusterType()== AliESDCaloCluster::kClusterv1) nRP++; else nPC++;
if (Debug()) clust->Print();
// Get information from EMCAL reconstruction points
class AliEMCALDigitizer ;
class AliEMCALClusterizer ;
class AliEMCALSDigitizer ;
+class AliEMCALRecParam;
class AliESDEvent ;
class AliRawReader ;
Bool_t Debug() const { return fDebug ; }
using AliReconstructor::FillESD;
- virtual void FillESD(AliRunLoader* runLoader, AliESDEvent* esd) const ;
+ virtual void FillESD(TTree* digitsTree, TTree* clustersTree,
+ AliESDEvent* esd) const;
AliTracker* CreateTracker (AliRunLoader* )const{return new AliEMCALTracker;}
using AliReconstructor::Reconstruct;
- virtual void Reconstruct(AliRunLoader* runLoader) const ;
- virtual void Reconstruct(AliRunLoader* runLoader, AliRawReader* rawReader) const ;
+ virtual Bool_t HasLocalReconstruction() const {return kTRUE;};
+ virtual void Reconstruct(TTree* digitsTree, TTree* clustersTree) const;
+
+ virtual Bool_t HasDigitConversion() const {return kTRUE;};
+ virtual void ConvertDigits(AliRawReader* rawReader, TTree* digitsTree) const;
AliEMCALReconstructor & operator = (const AliEMCALReconstructor & /*rvalue*/) {
return *this ;
}
+ void SetRecParam(AliEMCALRecParam * recParam){ fgkRecParam = recParam;}
+
+ static const AliEMCALRecParam* GetRecParam(){ return fgkRecParam;}
private:
Bool_t fDebug; //! verbosity controller
-
- ClassDef(AliEMCALReconstructor,1) // Reconstruction algorithm class (Base Class)
+ static AliEMCALRecParam* fgkRecParam; // reconstruction parameters for EMCAL
+
+ ClassDef(AliEMCALReconstructor,2) // Reconstruction algorithm class (Base Class)
};