-//____________________________________________________________________________
-void AliPHOSPIDv1::Init()
-{
- // Make all memory allocations that are not possible in default constructor
- if(!fIsInitialized){
- if(fHeaderFileName.IsNull())
- fHeaderFileName = "galice.root" ;
-
- TFile * file = (TFile*) gROOT->GetFile(fHeaderFileName.Data() ) ;
-
- if(file == 0){
- file = new TFile(fHeaderFileName.Data(),"update") ;
- gAlice = (AliRun *) file->Get("gAlice") ;
- }
-
- AliPHOS * phos = (AliPHOS *) gAlice->GetDetector("PHOS") ;
- fGeom = AliPHOSGeometry::GetInstance(phos->GetGeometry()->GetName(),phos->GetGeometry()->GetTitle() );
-
- fTrackSegments = new TClonesArray("AliPHOSTrackSegment",1) ;
- fTSMaker = new AliPHOSTrackSegmentMakerv1() ;
- fEmcRecPoints = new TObjArray(1) ;
- fCpvRecPoints = new TObjArray(1) ;
- fClusterizer = new AliPHOSClusterizerv1() ;
- fRecParticles = new TClonesArray("AliPHOSRecParticle",100) ;
-
- fFormula = new TFormula("LambdaCuts","(x>1)*(x<2.5)*(y>0)*(y<x)") ;
-
- // add Task to //root/Tasks folder
- TTask * roottasks = (TTask*)gROOT->GetRootFolder()->FindObject("Tasks") ;
- TTask * phostasks = (TTask*)(roottasks->GetListOfTasks()->FindObject("PHOS"));
- phostasks->Add(this) ;
-
- fDispersion = 2.0;
- fCpvEmcDistance = 3.0 ;
-
- fIsInitialized = kTRUE ;
- }
-}
-//____________________________________________________________________________
-Bool_t AliPHOSPIDv1::ReadTrackSegments()
-{
- // Reads TrackSegments an extracts the title of the RecPoints
- // branch from which TS were made of.
- // Then reads both TrackSegments and RecPoints.
-
- //Fist read Track Segment Branch and extract RecPointsBranch from fTSMaker
- fTrackSegments->Clear() ;
- fEmcRecPoints->Clear() ;
- fCpvRecPoints->Clear() ;
- fRecParticles->Clear() ;
-
- gAlice->GetEvent(fNEvent) ;
-
- TTree * treeR = gAlice->TreeR() ;
-
- if(treeR==0){
- char treeName[20];
- sprintf(treeName,"TreeR%d",fNEvent);
- cout << "Error in AliPHOSClusterizerv1 : no "<<treeName << endl ;
- cout << " Do nothing " << endl ;
- return kFALSE ;
- }
-
- //first read TSMaker branch and extract information about RecPoints Branches
- TBranch * tsMakerBranch = 0;
- TBranch * tsBranch = 0;
-
- TObjArray * branches = 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( fTSTitle.CompareTo(tsMakerBranch->GetTitle())==0 )
- if( strcmp(tsMakerBranch->GetName(),"AliPHOSTrackSegmentMaker") == 0)
- tsMakerNotFound = kFALSE ;
- }
- if(tsNotFound){
- tsBranch=(TBranch *) branches->At(ibranch) ;
- if( fTSTitle.CompareTo(tsBranch->GetTitle())==0 )
- if( strcmp(tsBranch->GetName(),"PHOSTS") == 0)
- tsNotFound = kFALSE ;
- }
- }
-
- if(tsMakerNotFound ||tsNotFound ){
- cout << "Can't find Branch with TrackSegmentMaker and TrackSegments " ;
- cout << "Do nothing" <<endl ;
- return kFALSE ;
- }
-
- tsMakerBranch->SetAddress(&fTSMaker) ;
- tsBranch->SetAddress(&fTrackSegments) ;
-
- tsMakerBranch->GetEntry(0) ;
- tsBranch->GetEntry(0) ;
-
- fRecPointsTitle = fTSMaker->GetRecPointsBranch() ;
-
- //reading now recponts branches
- TBranch * emcBranch = 0;
- TBranch * cpvBranch = 0;
- TBranch * cluBranch = 0;
-
- Bool_t emcNotFound = kTRUE ;
- Bool_t cpvNotFound = kTRUE ;
- Bool_t cluNotFound = kTRUE ;
-
- for(ibranch = 0;(ibranch <branches->GetEntries())&&(emcNotFound||cpvNotFound||cluNotFound);ibranch++){
- if(emcNotFound){
- emcBranch=(TBranch *) branches->At(ibranch) ;
- if( fRecPointsTitle.CompareTo(emcBranch->GetTitle())==0 )
- if( strcmp(emcBranch->GetName(),"PHOSEmcRP") == 0)
- emcNotFound = kFALSE ;
- }
- if(cpvNotFound){
- cpvBranch=(TBranch *) branches->At(ibranch) ;
- if( fRecPointsTitle.CompareTo(cpvBranch->GetTitle())==0 )
- if( strcmp(cpvBranch->GetName(),"PHOSCpvRP") == 0)
- cpvNotFound = kFALSE ;
- }
- if(cluNotFound){
- cluBranch=(TBranch *) branches->At(ibranch) ;
- if( fRecPointsTitle.CompareTo(cluBranch->GetTitle())==0 )
- if( strcmp(cluBranch->GetName(),"AliPHOSClusterizer") == 0)
- cluNotFound = kFALSE ;
- }
- }
-
- if(emcNotFound ||cpvNotFound ||cluNotFound ){
- cout << "Can't find Branch with RecPoints or AliPHOSClusterizer " ;
- cout << "Do nothing" <<endl ;
- return kFALSE ;
- }
-
- emcBranch->SetAddress(&fEmcRecPoints) ;
- cpvBranch->SetAddress(&fCpvRecPoints) ;
- cluBranch->SetAddress(&fClusterizer) ;
-
- emcBranch->GetEntry(0) ;
- cpvBranch->GetEntry(0) ;
- cluBranch->GetEntry(0) ;
-
- return kTRUE ;