//
// // And finally one can call ExecuteTask() with the following options
// root [5] r->ExecuteTask("debug all timing")
-// // deb - prints the numbers of produced SDigits, Digits etc.
-// // deb all - prints in addition list of made SDigits, digits etc.
-// // timing - prints benchmarking results
+// // deb - prints the numbers of RecPoints, TrackSegments, RecParticles
+// // deb all - prints in addition list of RecPoints, TrackSegments, RecParticles
+// // timing - prints benchmarking results
///////////////////////////////////////////////////////////////////////////////////////////////////
// --- ROOT system ---
// --- Standard library ---
// --- AliRoot header files ---
+#include "AliESD.h"
+#include "AliESDCaloTrack.h"
#include "AliPHOSReconstructioner.h"
#include "AliPHOSClusterizerv1.h"
-#include "AliPHOSDigitizer.h"
-#include "AliPHOSSDigitizer.h"
#include "AliPHOSTrackSegmentMakerv1.h"
#include "AliPHOSPIDv1.h"
+#include "AliPHOSGetter.h"
ClassImp(AliPHOSReconstructioner)
AliPHOSReconstructioner::AliPHOSReconstructioner():TTask("AliPHOSReconstructioner","")
{
// ctor
- fToSplit = kFALSE ;
- fDigitizer = 0 ;
fClusterizer = 0 ;
fTSMaker = 0 ;
fPID = 0 ;
- fSDigitizer = 0 ;
- fHeaderFileName = "galice.root" ;
-
+ fFirstEvent = 0 ;
+ fLastEvent = -1 ;
fIsInitialized = kFALSE ;
}
//____________________________________________________________________________
-AliPHOSReconstructioner::AliPHOSReconstructioner(const char* headerFile,const char * branchName,Bool_t toSplit):
-TTask("AliPHOSReconstructioner","")
+AliPHOSReconstructioner::AliPHOSReconstructioner(const char* evFoldName,const char * branchName):
+TTask("AliPHOSReconstructioner",evFoldName)
{
// ctor
-
- fHeaderFileName = headerFile ;
- fToSplit = toSplit ;
- fSDigitsBranch= branchName;
- fSDigitizer = new AliPHOSSDigitizer(fHeaderFileName.Data(),fSDigitsBranch.Data(),toSplit) ;
- Add(fSDigitizer) ;
-
- fDigitsBranch=branchName ;
- fDigitizer = new AliPHOSDigitizer(fHeaderFileName.Data(),fDigitsBranch.Data(),toSplit) ;
- Add(fDigitizer) ;
+ AliPHOSGetter::Instance(evFoldName) ;
fRecPointBranch=branchName ;
- fClusterizer = new AliPHOSClusterizerv1(fHeaderFileName.Data(),fRecPointBranch.Data(),toSplit) ;
- Add(fClusterizer) ;
+ fClusterizer = new AliPHOSClusterizerv1(evFoldName, GetTitle());
+ Add(fClusterizer);
-
fTSBranch=branchName ;
- fTSMaker = new AliPHOSTrackSegmentMakerv1(fHeaderFileName.Data(),fTSBranch.Data(),toSplit) ;
+ fTSMaker = new AliPHOSTrackSegmentMakerv1(evFoldName, GetTitle());
Add(fTSMaker) ;
-
fRecPartBranch=branchName ;
- fPID = new AliPHOSPIDv1(fHeaderFileName.Data(),fRecPartBranch.Data(),toSplit) ;
- Add(fPID) ;
+ fPID = new AliPHOSPIDv1(evFoldName, GetTitle());
+ Add(fPID);
fIsInitialized = kTRUE ;
-
}
//____________________________________________________________________________
-void AliPHOSReconstructioner::Exec(Option_t *option)
+void AliPHOSReconstructioner::Exec(Option_t *opt)
{
- //chesk, if the names of branches, which should be made conicide with already
+ //check, if the names of branches, which should be made coincide with already
//existing
+ if (!opt)
+ return ;
if(!fIsInitialized)
Init() ;
+}
+//____________________________________________________________________________
+void AliPHOSReconstructioner:: Clusters2Tracks(Int_t ievent, AliESD *event)
+{
+ // Convert PHOS reconstructed particles into ESD object for event# ievent.
+ // ESD object is returned as an argument event
- TString message(" ") ;
-// gAlice->GetEvent(0) ;
-
-// if(fSDigitizer->IsActive()&& gAlice->TreeS()){ //Will produce SDigits
-// TBranch * sdigitsBranch = 0;
-// TBranch * sdigitizerBranch = 0;
-
-// TObjArray * branches = gAlice->TreeS()->GetListOfBranches() ;
-// Int_t ibranch;
-// Bool_t phosNotFound = kTRUE ;
-// Bool_t sdigitizerNotFound = kTRUE ;
-
-// for(ibranch = 0;ibranch <branches->GetEntries();ibranch++){
-// if(phosNotFound){
-// sdigitsBranch=(TBranch *) branches->At(ibranch) ;
-// if(( strcmp("PHOS",sdigitsBranch->GetName())==0 ) &&
-// (fSDigitsBranch.CompareTo(sdigitsBranch->GetTitle())== 0 ))
-// phosNotFound = kFALSE ;
-// }
-// if(sdigitizerNotFound){
-// sdigitizerBranch = (TBranch *) branches->At(ibranch) ;
-// if(( strcmp(sdigitizerBranch->GetName(),"AliPHOSSDigitizer") == 0) &&
-// (fSDigitsBranch.CompareTo(sdigitizerBranch->GetTitle())== 0 ) )
-// sdigitizerNotFound = kFALSE ;
-// }
-// }
-
-// if(!(sdigitizerNotFound && phosNotFound)){
-// message = " Branches PHOS or AliPHOSSDigitizer with title %s\n" ;
-// message += " already exist in TreeS. ROOT does not allow updating/overwriting.\n" ;
-// message += " Specify another title for branches or use StartFrom() method\n" ;
-// Error("Exec", message.Data(), fSDigitsBranch.Data() ) ;
-// //mark all tasks as inactive
-// TIter next(fTasks);
-// TTask *task;
-// while((task=(TTask*)next()))
-// task->SetActive(kFALSE) ;
-
-// return ;
-// }
-// }
-
-// if(fDigitizer->IsActive() && gAlice->TreeD()){ //Will produce Digits
-// TBranch * digitsBranch = 0;
-// TBranch * digitizerBranch = 0;
-
-// TObjArray * branches = gAlice->TreeD()->GetListOfBranches() ;
-// Int_t ibranch;
-// Bool_t phosNotFound = kTRUE ;
-// Bool_t digitizerNotFound = kTRUE ;
-
-// for(ibranch = 0;ibranch <branches->GetEntries();ibranch++){
-// if(phosNotFound){
-// digitsBranch=(TBranch *) branches->At(ibranch) ;
-// if(( strcmp("PHOS",digitsBranch->GetName())==0 ) &&
-// (fDigitsBranch.CompareTo(digitsBranch->GetTitle())== 0 ))
-// phosNotFound = kFALSE ;
-// }
-// if(digitizerNotFound){
-// digitizerBranch = (TBranch *) branches->At(ibranch) ;
-// if(( strcmp(digitizerBranch->GetName(),"AliPHOSDigitizer") == 0) &&
-// (fDigitsBranch.CompareTo(digitizerBranch->GetTitle())== 0 ) )
-// digitizerNotFound = kFALSE ;
-// }
-// }
-
-// if(!(digitizerNotFound && phosNotFound)){
-// message = " Branches PHOS or AliPHOSDigitizer with title %s\n" ;
-// message += " already exist in TreeD. ROOT does not allow updating/overwriting.\n" ;
-// message += " Specify another title for branches or use StartFrom() method" ;
-// Error("Exec", message>Data(), fDigitsBranch.Data() ) ;
-// //mark all tasks as inactive
-// TIter next(fTasks);
-// TTask *task;
-// while((task=(TTask*)next()))
-// task->SetActive(kFALSE) ;
-
-// return ;
-// }
-// }
+ if(!fIsInitialized) Init() ;
-// if(fClusterizer->IsActive() && gAlice->TreeR()){ //Will produce RecPoints
-// TBranch * emcBranch = 0;
-// TBranch * cpvBranch = 0;
-// TBranch * clusterizerBranch = 0;
-
-// TObjArray * branches = gAlice->TreeR()->GetListOfBranches() ;
-// Int_t ibranch;
-// Bool_t emcNotFound = kTRUE ;
-// Bool_t cpvNotFound = kTRUE ;
-// Bool_t clusterizerNotFound = kTRUE ;
-
-// for(ibranch = 0;ibranch <branches->GetEntries();ibranch++){
-
-// if(emcNotFound){
-// emcBranch=(TBranch *) branches->At(ibranch) ;
-// if(fRecPointBranch.CompareTo(emcBranch->GetTitle())==0 )
-// if( strcmp(emcBranch->GetName(),"PHOSEmcRP") == 0)
-// emcNotFound = kFALSE ;
-// }
-// if(cpvNotFound){
-// cpvBranch=(TBranch *) branches->At(ibranch) ;
-// if(fRecPointBranch.CompareTo(cpvBranch->GetTitle())==0 )
-// if( strcmp(cpvBranch->GetName(),"PHOSCpvRP") == 0)
-// cpvNotFound = kFALSE ;
-// }
-// if(clusterizerNotFound){
-// clusterizerBranch = (TBranch *) branches->At(ibranch) ;
-// if( fRecPointBranch.CompareTo(clusterizerBranch->GetTitle()) == 0)
-// if( strcmp(clusterizerBranch->GetName(),"AliPHOSClusterizer") == 0)
-// clusterizerNotFound = kFALSE ;
-// }
-// }
+ fClusterizer->SetEventRange(ievent,ievent);
+ fClusterizer->ExecuteTask();
-// if(!(clusterizerNotFound && emcNotFound && cpvNotFound)){
-// message = " Branches PHOSEmcRP, PHOSCpvRP or AliPHOSClusterizer with title %s\n" ;
-// message += " already exist in TreeR. ROOT does not allow updating/overwriting.\n" ;
-// message += " Specify another title for branches or use StartFrom() method\n" ;
-// Error("Exec", message.Data(),fRecPointBranch.Data() ) ;
-// //mark all tasks as inactive
-// TIter next(fTasks);
-// TTask *task;
-// while((task=(TTask*)next()))
-// task->SetActive(kFALSE) ;
-// return ;
-// }
-// }
+ fTSMaker ->SetEventRange(ievent,ievent);
+ fTSMaker ->ExecuteTask();
+
+ fPID ->SetEventRange(ievent,ievent);
+ fPID ->ExecuteTask();
+
+ AliPHOSGetter *gime = AliPHOSGetter::Instance();
+ TClonesArray *recParticles = gime->RecParticles();
+ Int_t nOfRecParticles = recParticles->GetEntries();
+ for (Int_t recpart=0; recpart<nOfRecParticles; recpart++) {
+ AliESDCaloTrack *ct = new AliESDCaloTrack((AliPHOSRecParticle*)recParticles->At(recpart));
+ event->AddCaloTrack(ct);
+ }
-// if(fTSMaker->IsActive() && gAlice->TreeR()){ //Produce TrackSegments
-// TBranch * tsMakerBranch = 0;
-// TBranch * tsBranch = 0;
-
-// TObjArray * branches = gAlice->TreeR()->GetListOfBranches() ;
-// Int_t ibranch;
-// Bool_t tsMakerNotFound = kTRUE ;
-// Bool_t tsNotFound = kTRUE ;
-
-// for(ibranch = 0;(ibranch <branches->GetEntries())&&(tsMakerNotFound||tsNotFound);ibranch++){
-// if(tsMakerNotFound){
-// tsMakerBranch=(TBranch *) branches->At(ibranch) ;
-// if( fTSBranch.CompareTo(tsMakerBranch->GetTitle())==0 )
-// if( strcmp(tsMakerBranch->GetName(),"AliPHOSTrackSegmentMaker") == 0)
-// tsMakerNotFound = kFALSE ;
-// }
-// if(tsNotFound){
-// tsBranch=(TBranch *) branches->At(ibranch) ;
-// if( fTSBranch.CompareTo(tsBranch->GetTitle())==0 )
-// if( strcmp(tsBranch->GetName(),"PHOSTS") == 0)
-// tsNotFound = kFALSE ;
-// }
-// }
-
-// if(!(tsMakerNotFound &&tsNotFound) ){
-// message = " Branches PHOSTS or AliPHOSTrackSegmentMaker with title %s\n" ;
-// message += " already exist in TreeR. ROOT does not allow updating/overwriting.\n" ;
-// message += " Specify another title for branches or use StartFrom() method\n" ;
-// Error("Exec", message.Data(),fTSBranch.Data() ) ;
-// //mark all tasks as inactive
-// TIter next(fTasks);
-// TTask *task;
-// while((task=(TTask*)next()))
-// task->SetActive(kFALSE) ;
-// return ;
-
-// }
-
-// }
-
-// if(fPID->IsActive() && gAlice->TreeR()){ //Produce RecParticles
-// TBranch * pidBranch = 0;
-// TBranch * rpBranch = 0;
-
-// TObjArray * branches = gAlice->TreeR()->GetListOfBranches() ;
-// Int_t ibranch;
-// Bool_t pidNotFound = kTRUE ;
-// Bool_t rpNotFound = kTRUE ;
-
-// for(ibranch = 0;(ibranch <branches->GetEntries()) && pidNotFound && rpNotFound ;ibranch++){
-// if(pidNotFound){
-// pidBranch=(TBranch *) branches->At(ibranch) ;
-// if( (strcmp(fRecPartBranch,pidBranch->GetTitle())==0 ) &&
-// (strcmp(pidBranch->GetName(),"AliPHOSPID") == 0) )
-// pidNotFound = kFALSE ;
-// }
-// if(rpNotFound){
-// rpBranch=(TBranch *) branches->At(ibranch) ;
-// if( (strcmp(fRecPartBranch,rpBranch->GetTitle())==0 ) &&
-// (strcmp(rpBranch->GetName(),"PHOSRP") == 0) )
-// rpNotFound = kFALSE ;
-// }
-// }
-
-// if(!pidNotFound || !rpNotFound ){
-// message = " Branches PHOSRP or AliPHOSPID with title %s\n" ;
-// message += " already exist in TreeR. ROOT does not allow updating/overwriting.\n" ;
-// message += " Specify another title for branches.\n" ;
-// Error("Exec", message.Data(), fRecPartBranch.Data() ) ;
-// //mark all tasks as inactive
-// TIter next(fTasks);
-// TTask *task;
-// while((task=(TTask*)next()))
-// task->SetActive(kFALSE) ;
-// return ;
-// }
-
-// }
}
//____________________________________________________________________________
void AliPHOSReconstructioner::Init()
// initiliaze Reconstructioner if necessary: we can not do this in default constructor
if(!fIsInitialized){
- // Initialisation
-
- fSDigitsBranch="Default" ;
- fSDigitizer = new AliPHOSSDigitizer(fHeaderFileName.Data(),fSDigitsBranch.Data(),fToSplit) ;
- Add(fSDigitizer) ;
-
- fDigitsBranch="Default" ;
- fDigitizer = new AliPHOSDigitizer(fHeaderFileName.Data(),fDigitsBranch.Data(),fToSplit) ;
- Add(fDigitizer) ;
-
+
fRecPointBranch="Default" ;
- fClusterizer = new AliPHOSClusterizerv1(fHeaderFileName.Data(),fRecPointBranch.Data(),fToSplit) ;
+ fClusterizer = new AliPHOSClusterizerv1(GetTitle(),fRecPointBranch.Data());
Add(fClusterizer) ;
fTSBranch="Default" ;
- fTSMaker = new AliPHOSTrackSegmentMakerv1(fHeaderFileName.Data(),fTSBranch.Data(),fToSplit) ;
+ fTSMaker = new AliPHOSTrackSegmentMakerv1(GetTitle(),fTSBranch.Data());
Add(fTSMaker) ;
- fRecPartBranch="Default" ;
- fPID = new AliPHOSPIDv1(fHeaderFileName.Data(),fRecPartBranch.Data(),fToSplit) ;
+ fRecPartBranch="Default";
+ fPID = new AliPHOSPIDv1(GetTitle(),fRecPartBranch.Data()) ;
Add(fPID) ;
fIsInitialized = kTRUE ;
+
}
}
//____________________________________________________________________________
AliPHOSReconstructioner::~AliPHOSReconstructioner()
{
// Delete data members if any
-
-// if(fSDigitizer)
-// delete fSDigitizer ;
-
-// if(fDigitizer)
-// delete fDigitizer ;
-
-// if(fClusterizer)
-// delete fClusterizer ;
-
-// if(fTSMaker)
-// delete fTSMaker ;
-
-// if(fPID)
-// delete fPID ;
-
-// TFile * file = (TFile*) gROOT->GetFile(fHeaderFileName.Data()) ;
-
-// if(file != 0) {
-// file->Close();
-// delete file;
-// printf("File %s is closed\n",fHeaderFileName.Data());
-// }
-
}
-// //____________________________________________________________________________
-// void AliPHOSReconstructioner::SetBranchTitle(const char* branch, const char * title)
-// {
-// //Diverge correcpoinding branch to the file "title"
-
-// if(strcmp(branch,"SDigits") == 0){
-// fSDigitizer->SetSDigitsBranch(title) ;
-// fDigitizer->SetSDigitsBranch(title) ;
-// fSDigitsBranch = title ;
-// return ;
-// }
-
-// if(strcmp(branch,"Digits") == 0){
-// fDigitizer->SetName(title) ;
-// fClusterizer->SetName(title) ;
-// fDigitsBranch = title ;
-// return ;
-// }
-
-// if(strcmp(branch,"RecPoints") == 0){
-// fClusterizer->SetRecPointsBranch(title) ;
-// fTSMaker->SetRecPointsBranch(title) ;
-// fRecPointBranch = title ;
-// return ;
-// }
-
-// if(strcmp(branch,"TrackSegments") == 0){
-// fTSMaker->SetTrackSegmentsBranch(title) ;
-// fPID->SetTrackSegmentsBranch(title) ;
-// fTSBranch = title ;
-// return ;
-// }
-
-// if(strcmp(branch,"RecParticles") == 0){
-// fPID->SetRecParticlesBranch(title) ;
-// fRecPartBranch = title ;
-// return ;
-// }
-//
-// TString message ;
-// message = "There is no branch %s !\n" ;
-// message += "Available branches `SDigits', `Digits', `RecPoints', `TrackSegments' and `RecParticles'\n" ;
-// Warning("SetBranchTitle", message.Data(), branch ) ;
-// }
-// //____________________________________________________________________________
-// void AliPHOSReconstructioner::StartFrom(char * module,char* title)
-// {
-// // in the next pass of reconstruction (call ExecuteTask()) reconstruction will
-// // start from the module "module", and in the case of non zero title all
-// // pruduced branches will have title "title". The following "modules" are recognized
-// // "SD" - AliPHOSSDigitizer,
-// // "D" - AliPHOSDigitizer
-// // "C" - AliPHOSClusterizer
-// // "TS" - AliPHOSTrackSegmentMaker
-// // "RP" - AliPHOSPID
-
-// if(!fIsInitialized)
-// Init() ;
-
-// char * moduleName = new char[30];
-// if(strstr(module,"SD"))
-// sprintf(moduleName,"AliPHOSSDigitizer") ;
-// else
-// if(strstr(module,"D") )
-// sprintf(moduleName,"AliPHOSDigitizer") ;
-// else
-// if(strstr(module,"C") || strstr(module,"RecPoint") )
-// sprintf(moduleName,"AliPHOSClusterizer") ;
-// else
-// if(strstr(module,"TS") || strstr(module,"Track") )
-// sprintf(moduleName,"AliPHOSTrackSegmentMaker") ;
-// else
-// if(strstr(module,"PID") || strstr(module,"Particle") || strstr(module,"RP") )
-// sprintf(moduleName,"AliPHOSPID") ;
-// else{
-// Warning("StartFrom", "Do not know such a module / Rec Object ") ;
-// return ;
-// }
-
-// TIter next(fTasks);
-// TTask *task;
-// Bool_t active = kFALSE ;
-// while((task=(TTask*)next())){
-// if (strcmp(moduleName,task->GetName())==0)
-// active = kTRUE;
-// task->SetActive(active) ;
-// if(active && title){ // set title to branches
-// switch(strlen(task->GetName()) ) {
-// case 17: // "AliPHOSSDigitizer"
-// fSDigitizer->SetSDigitsBranch(title) ;
-// fDigitizer->SetSDigitsBranch(title) ;
-// fSDigitsBranch = title ;
-// break ;
-// case 16: //"AliPHOSDigitizer"
-// fDigitizer->SetName(title) ;
-// fClusterizer->SetName(title) ;
-// fDigitsBranch = title ;
-// break ;
-// case 18: //"AliPHOSClusterizer"
-// fClusterizer->SetRecPointsBranch(title) ;
-// fTSMaker->SetRecPointsBranch(title) ;
-// fRecPointBranch = title ;
-// break ;
-// case 24: //"AliPHOSTrackSegmentMaker"
-// fTSMaker->SetTrackSegmentsBranch(title) ;
-// fPID->SetTrackSegmentsBranch(title) ;
-// fTSBranch = title ;
-// break ;
-// case 10: // "AliPHOSPID"
-// fPID->SetRecParticlesBranch(title) ;
-// fRecPartBranch = title ;
-// break ;
-// }
-
-// }
-// }
-
-// delete [] moduleName;
-// }
-//____________________________________________________________________________
-
-void AliPHOSReconstructioner::Print(Option_t * option)const {
+void AliPHOSReconstructioner::Print()const {
// Print reconstructioner data
TString message ;
message += " Reconstruction of the header file %s\n" ;
message += " with the following modules:\n" ;
- if(fSDigitizer->IsActive()){
- message += " (+) %s to branch %s\n" ;
- }
- if(fDigitizer->IsActive()){
- message += " (+) %s to branch %s\n" ;
- }
-
if(fClusterizer->IsActive()){
message += " (+) %s to branch %s\n" ;
}
message += " (+) %s to branch %s\n" ;
}
Info("Print", message.Data(),
- fHeaderFileName.Data(),
- fSDigitizer->GetName(), fSDigitsBranch.Data(),
- fDigitizer->GetName(), fDigitsBranch.Data() ,
+ GetTitle(),
fClusterizer->GetName(), fRecPointBranch.Data(),
fTSMaker->GetName(), fTSBranch.Data() ,
fPID->GetName(), fRecPartBranch.Data() ) ;
}
+
+//____________________________________________________________________________
+void AliPHOSReconstructioner::SetEventRange(Int_t first, Int_t last)
+{
+ // Set the event range to process
+ fFirstEvent=first;
+ fLastEvent=last;
+ fClusterizer->SetEventRange(fFirstEvent, fLastEvent) ;
+ fTSMaker->SetEventRange(fFirstEvent, fLastEvent) ;
+ fPID->SetEventRange(fFirstEvent, fLastEvent) ;
+}