// --- AliRoot header files ---
#include "AliMagF.h"
-#include "AliESDCaloTrack.h"
+#include "AliESDtrack.h"
#include "AliESD.h"
#include "AliPHOS.h"
#include "AliPHOSGetter.h"
//____________________________________________________________________________
void AliPHOS::FillESD(AliESD* esd) const
{
- // Fill the ESD with all RecParticles
+ // Called by AliReconstruct after Reconstruct() and global tracking and vertxing
+
+ //Creates the tracksegments and Recparticles
+ AliPHOSReconstructioner * rec = new AliPHOSReconstructioner((fLoader->GetRunLoader()->GetFileName()).Data()) ;
+ TList * taskslist = rec->GetListOfTasks() ;
+ Int_t index ;
+ TTask * task ;
+ TString name ;
+ // set clusterizer task inactive
+ for (index = 0; index < taskslist->GetSize(); index++) {
+ task = dynamic_cast<TTask *>(taskslist->At(index)) ;
+ name = task->GetName() ;
+ if ( name.Contains(AliConfig::fgkReconstructionerTaskName))
+ task->SetActive(kFALSE) ;
+ if ( name.Contains(AliConfig::fgkTrackerTaskName))
+ (dynamic_cast<AliPHOSTrackSegmentMaker *> (task))->SetESD(esd) ;
+ }
+ rec->SetEventRange(0, -1) ; // do all the events
+ rec->ExecuteTask("deb all") ;
+
+ // Creates AliESDtrack from AliPHOSRecParticles
AliPHOSGetter *gime = AliPHOSGetter::Instance( (fLoader->GetRunLoader()->GetFileName()).Data() ) ;
gime->Event(gime->EventNumber(), "P") ;
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));
- esd->AddCaloTrack(ct);
- delete ct;
+ for (Int_t recpart = 0 ; recpart < nOfRecParticles ; recpart++) {
+ AliPHOSRecParticle * rp = dynamic_cast<AliPHOSRecParticle*>(recParticles->At(recpart));
+ AliESDtrack * et = new AliESDtrack() ;
+ // fills the ESDtrack
+ Double_t xyz[3];
+ for (Int_t ixyz=0; ixyz<3; ixyz++) xyz[ixyz] = rp->GetPos()[ixyz];
+ et->SetPHOSposition(xyz) ;
+ et->SetPHOSsignal (rp->Energy()) ;
+ et->SetPHOSpid (rp->GetPID()) ;
+ // add the track to the esd object
+ esd->AddTrack(et);
+ delete et;
}
}
//____________________________________________________________________________
void AliPHOS::Reconstruct() const
{
+ // method called by AliReconstruction; it should not be called otherwise but the AliPHOSReconstructionner
+ // should be called for stand alone reconstruction.
+ // 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.
+
AliPHOSReconstructioner * rec = new AliPHOSReconstructioner((fLoader->GetRunLoader()->GetFileName()).Data()) ;
- rec->SetEventRange(0, -1) ; // do all the events
+ TList * taskslist = rec->GetListOfTasks() ;
+ Int_t index ;
+ TTask * task ;
+ TString name ;
+ // set all tasks inactive except clusterizer
+ for (index = 0; index < taskslist->GetSize(); index++) {
+ task = dynamic_cast<TTask *>(taskslist->At(index)) ;
+ name = task->GetName() ;
+ if ( !name.Contains(AliConfig::fgkReconstructionerTaskName))
+ task->SetActive(kFALSE) ;
+ }
+ rec->SetEventRange(0, -1) ; // do all the events
rec->ExecuteTask() ;
}
}
// return 0 ;
}
+//____________________________________________________________________________
+const Double_t * AliPHOSRecParticle::GetPID()
+{
+ // Get the probability densities that this reconstructed particle
+ // has a type of i:
+ // i particle types
+ // ----------------------
+ // 0 electron
+ // 1 muon
+ // 2 pi+-
+ // 3 K+-
+ // 4 p/pbar
+ // 5 photon
+ // 6 pi0 at high pt
+ // 7 neutron
+ // 8 K0L
+ const Int_t nSPECIES = AliESDtrack::kSPECIES;
+ if (IsElectron() ) fPID[0] = 1.0;
+ if (IsChargedHadron()) {
+ fPID[1] = 0.25;
+ fPID[2] = 0.25;
+ fPID[3] = 0.25;
+ fPID[4] = 0.25;
+ }
+ if (IsFastChargedHadron()) {
+ fPID[1] = 0.33;
+ fPID[2] = 0.33;
+ fPID[3] = 0.33;
+ fPID[4] = 0.00;
+ }
+ if (IsSlowChargedHadron()) {
+ fPID[1] = 0.00;
+ fPID[2] = 0.00;
+ fPID[3] = 0.00;
+ fPID[4] = 1.00;
+ }
+
+ if (IsPhoton() || IsHardPhoton()) fPID[nSPECIES] =1.0;
+ if (IsHardPi0()) fPID[nSPECIES+1]=1.0;
+ if (IsFastNeutralHadron()) fPID[nSPECIES+2]=1.0;
+ if (IsSlowNeutralHadron()) fPID[nSPECIES+3]=1.0;
+
+ return fPID;
+}
// --- AliRoot header files ---
#include "AliPHOSFastRecParticle.h"
+#include "AliESDtrack.h"
+
class TParticle ;
#include "TVector3.h"
virtual const Int_t GetNPrimaries() const ;
TVector3 GetPos() const { return fPos ; }
virtual const TParticle * GetPrimary(Int_t index) const ;
+ const Double_t *GetPID();
void SetDebug() { fDebug = kTRUE ; }
void SetPos(TVector3 pos) { fPos.SetXYZ( pos.X(), pos.Y(), pos.Z() ); }
void UnsetDebug() { fDebug = kFALSE ; }
Int_t fPHOSTrackSegment ; // pointer to the associated track segment in PHOS
Bool_t fDebug ; // to steer debug output
TVector3 fPos ; // position in the global alice coordinate system
+ Double_t fPID[AliESDtrack::kSPECIES+4] ; // PID probability densities
- ClassDef(AliPHOSRecParticle,2) // Reconstructed Particle
+ ClassDef(AliPHOSRecParticle,3) // Reconstructed Particle
};
#endif // AliPHOSRECPARTICLE_H
}
//____________________________________________________________________________
-AliPHOSReconstructioner::AliPHOSReconstructioner(const char* evFoldName,const char * branchName):
+AliPHOSReconstructioner::AliPHOSReconstructioner(const char* evFoldName,const char * branchName,const TString taskName):
TTask("AliPHOSReconstructioner",evFoldName)
{
- // ctor
+ // Create a PHOS reconstructioner for the tasks defined by taskName
+ // "C" - clusterization
+ // "T" - track segment making
+ // "P" - PID
AliPHOSGetter::Instance(evFoldName) ;
- fRecPointBranch=branchName ;
- fClusterizer = new AliPHOSClusterizerv1(evFoldName, GetTitle());
- Add(fClusterizer);
+ if (taskName.Contains("C")) {
+ fRecPointBranch=branchName ;
+ fClusterizer = new AliPHOSClusterizerv1(evFoldName, GetTitle());
+ Add(fClusterizer);
+ }
- fTSBranch=branchName ;
- fTSMaker = new AliPHOSTrackSegmentMakerv1(evFoldName, GetTitle());
- Add(fTSMaker) ;
+ if (taskName.Contains("T")) {
+ fTSBranch=branchName ;
+ fTSMaker = new AliPHOSTrackSegmentMakerv1(evFoldName, GetTitle());
+ Add(fTSMaker) ;
+ }
- fRecPartBranch=branchName ;
- fPID = new AliPHOSPIDv1(evFoldName, GetTitle());
- Add(fPID);
+ if (taskName.Contains("P")) {
+ fRecPartBranch=branchName ;
+ fPID = new AliPHOSPIDv1(evFoldName, GetTitle());
+ Add(fPID);
+ }
fIsInitialized = kTRUE ;
}
public:
AliPHOSReconstructioner() ; //ctor
- AliPHOSReconstructioner(const char * headerFile, const char * branchName = "Default");
+ AliPHOSReconstructioner(const char * headerFile, const char * branchName = "Default",const TString taskName="CTP");
AliPHOSReconstructioner(const AliPHOSReconstructioner & rec) : TTask(rec) {
// cpy ctor:
// requested by the Coding Convention
class AliPHOSClusterizer ;
class AliPHOSGeometry ;
+class AliESD ;
class AliPHOSTrackSegmentMaker : public TTask {
virtual void Print()const {Warning("Print", "Not Defined" ) ; }
void SetEventRange(Int_t first=0, Int_t last=-1) {fFirstEvent=first; fLastEvent=last; }
void SetEventFolderName(TString name) { fEventFolderName = name ; }
+ void SetESD(AliESD *esd) { fESD = esd; }
virtual void WriteTrackSegments() = 0;
TString fEventFolderName ; // event folder name
Int_t fFirstEvent; // first event to process
Int_t fLastEvent; // last event to process
+ AliESD * fESD; //! ESD object
ClassDef( AliPHOSTrackSegmentMaker,4) // Algorithm class to make PHOS track segments (Base Class)
};