#include "TBRIK.h"
#include "TNode.h"
#include "TParticle.h"
+#include "TTree.h"
+#include "TGeometry.h"
+#include "TFile.h"
// --- Standard library ---
#include <stdio.h>
// --- AliRoot header files ---
-
+#include "AliPHOSFastRecParticle.h"
+#include "AliPHOSGeometry.h"
#include "AliPHOSv4.h"
#include "AliRun.h"
#include "AliConst.h"
+#include "AliMC.h"
ClassImp(AliPHOSv4)
-//____________________________________________________________________________
-AliPHOSv4::AliPHOSv4()
-{
- // ctor
-
- fFastRecParticles = 0 ;
- fNRecParticles = 0 ;
-}
-
//____________________________________________________________________________
AliPHOSv4::AliPHOSv4(const char *name, const char *title):
AliPHOS(name,title)
// ctor
// gets an instance of the geometry parameters class
-
- fGeom = AliPHOSGeometry::GetInstance(title, "") ;
-
- if (fGeom->IsInitialized() )
- cout << "AliPHOSv4 : PHOS geometry intialized for " << fGeom->GetName() << endl ;
- else
- cout << "AliPHOSv4 : PHOS geometry initialization failed !" << endl ;
-
- SetBigBox(0, fGeom->GetOuterBoxSize(0) ) ;
- SetBigBox(1, fGeom->GetOuterBoxSize(1) + fGeom->GetPPSDBoxSize(1) ) ;
- SetBigBox(2, fGeom->GetOuterBoxSize(0) );
-
- fNRecParticles = 0 ;
- fFastRecParticles = new AliPHOSFastRecParticle::FastRecParticlesList("AliPHOSFastRecParticle", 100) ;
-
- fResPara1 = 0.030 ; // GeV
- fResPara2 = 0.00003 ;
- fResPara3 = 0.00001 ;
+ if (strcmp(GetTitle(),"") != 0 )
+ fGeom = AliPHOSGeometry::GetInstance(GetTitle(), "") ;
+
+
+ SetBigBox(0, fGeom->GetOuterBoxSize(0) ) ;
+ SetBigBox(1, fGeom->GetOuterBoxSize(1) + fGeom->GetCPVBoxSize(1) ) ;
+ SetBigBox(2, fGeom->GetOuterBoxSize(0) );
+
+ fNRecParticles = 0 ;
+ fFastRecParticles = new AliPHOSFastRecParticle::FastRecParticlesList("AliPHOSFastRecParticle", 100) ;
- fPosParaA0 = 2.87 ; // mm
- fPosParaA1 = -0.0975 ;
- fPosParaB0 = 0.257 ;
- fPosParaB1 = 0.137 ;
- fPosParaB2 = 0.00619 ;
+ fResPara1 = 0.030 ; // GeV
+ fResPara2 = 0.00003 ;
+ fResPara3 = 0.00001 ;
+
+ fPosParaA0 = 2.87 ; // mm
+ fPosParaA1 = -0.0975 ;
+ fPosParaB0 = 0.257 ;
+ fPosParaB1 = 0.137 ;
+ fPosParaB2 = 0.00619 ;
}
//____________________________________________________________________________
}
//___________________________________________________________________________
-void AliPHOSv4::MakeBranch(Option_t* opt)
+void AliPHOSv4::MakeBranch(Option_t* opt, char *file)
{
// Create new branch in the current reconstructed Root Tree
- AliDetector::MakeBranch(opt) ;
+ AliDetector::MakeBranch(opt,file) ;
char branchname[10];
sprintf(branchname,"%s",GetName());
- char *cd = strstr(opt,"R");
+ const char *cd = strstr(opt,"R");
if (fFastRecParticles && gAlice->TreeR() && cd) {
- gAlice->TreeR()->Branch(branchname, &fFastRecParticles, fBufferSize);
+ gAlice->MakeBranchInTree(gAlice->TreeR(),
+ branchname, &fFastRecParticles, fBufferSize, file) ;
}
}
void AliPHOSv4::StepManager(void)
{
// Only verifies if the particle reaches PHOS and stops the tracking
-
+
Int_t primary = gAlice->GetPrimary( gAlice->CurrentTrack() );
+
TLorentzVector lv ;
gMC->TrackPosition(lv) ;
TVector3 pos = lv.Vect() ;
Int_t modid ;
gMC->CurrentVolID(modid);
- // Makes a reconstructed particle from the primary particle
+ Float_t energy = gMC->Etot() ; //Total energy of current track
- TClonesArray * particlelist = gAlice->Particles() ;
- TParticle * part = (TParticle *)particlelist->At(primary) ;
+ //Calculating mass of current particle
+ TDatabasePDG * pdg = TDatabasePDG::Instance() ;
+ TParticlePDG * partPDG = pdg->GetParticle(gMC->TrackPid()) ;
+ Float_t mass = partPDG->Mass() ;
- AliPHOSFastRecParticle rp(*part) ;
- rp.SetPrimary(primary) ;
+ if(energy > mass){
+ pos.SetMag(TMath::Sqrt(energy*energy-mass*mass)) ;
+ TLorentzVector pTrack(pos, energy) ;
- // Adds the response of PHOS to the particle
+ TParticle * part = new TParticle(gMC->TrackPid(), 0,-1,-1,-1,-1, pTrack, lv) ;
+
+ AliPHOSFastRecParticle rp(*part) ;
+ rp.SetPrimary(primary) ;
- MakeRecParticle(modid, pos, rp) ;
-
- // add the primary particle to the FastRecParticles list
+ // Adds the response of PHOS to the particle
+ MakeRecParticle(modid, pos, rp) ;
+
+ // add the `track' particle to the FastRecParticles list
- AddRecParticle(rp) ;
+ AddRecParticle(rp) ;
+ part->Delete() ;
+ }
// stop the track as soon PHOS is reached
gMC->StopTrack() ;