- cout << "AliPHOSTrackSegmentMakerv1 not initialized " << endl ;
-}
-//____________________________________________________________________________
-Bool_t AliPHOSTrackSegmentMakerv1::ReadRecPoints(Int_t event)
-{
- // Reads Emc and CPV recPoints
- // made previously with Clusterizer.
-
-
- //Make some initializations
-
- fNTrackSegments = 0 ;
- fEmcFirst = 0 ;
- fEmcLast = 0 ;
- fCpvFirst = 0 ;
- fCpvLast = 0 ;
- fPpsdFirst= 0 ;
- fPpsdLast = 0 ;
-
- // Get TreeR header from file
- if(gAlice->TreeR()==0){
- cerr << "ERROR: AliPHOSTrackSegmentMakerv1::ReadRecPoints -> There is no Reconstruction Tree" << endl;
- return kFALSE;
- }
-
-
- // Find RecPoints
- TBranch * emcbranch = 0;
- TBranch * cpvbranch = 0;
- TBranch * clusterizerbranch = 0;
- TObjArray * lob = (TObjArray*)gAlice->TreeR()->GetListOfBranches() ;
- TIter next(lob) ;
- TBranch * branch = 0 ;
- Bool_t phosemcfound = kFALSE, phoscpvfound = kFALSE, clusterizerfound = kFALSE ;
-
- TString taskName(GetName()) ;
- taskName.ReplaceAll(Version(), "") ;
-
- while ( (branch = (TBranch*)next()) && (!phosemcfound || !phoscpvfound || !clusterizerfound) ) {
- if ( (strcmp(branch->GetName(), "PHOSEmcRP")==0) && (strcmp(branch->GetTitle(), taskName.Data())==0) ) {
- phosemcfound = kTRUE ;
- emcbranch = branch ;
- }
-
- else if ( (strcmp(branch->GetName(), "PHOSCpvRP")==0) && (strcmp(branch->GetTitle(), taskName.Data())==0) ) {
- phoscpvfound = kTRUE ;
- cpvbranch = branch ;
-
- } else if ( (strcmp(branch->GetName(), "AliPHOSClusterizer")==0) && (strcmp(branch->GetTitle(), taskName.Data())==0) ) {
- clusterizerfound = kTRUE ;
- clusterizerbranch = branch ;
- }
- }
- if ( !phosemcfound || !phoscpvfound || !clusterizerfound ) {
- cerr << "WARNING: AliPHOSTrackSegmentMakerv1::ReadRecPoints -> emc(cpv)RecPoints and/or Clusterizer branch with name " << taskName.Data()
- << " not found" << endl ;
- return kFALSE ;
- }
-
- AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
-
- TObjArray * emcRecPoints = gime->EmcRecPoints() ;
- emcRecPoints->Clear() ;
- emcbranch->SetAddress(&emcRecPoints) ;
-
- TObjArray * cpvRecPoints = gime->CpvRecPoints() ;
- cpvRecPoints->Clear() ;
- cpvbranch->SetAddress(&cpvRecPoints) ;
-
- TClonesArray * trackSegments = gime->TrackSegments() ;
- trackSegments->Clear() ;
-
- AliPHOSClusterizer * clusterizer = 0 ;
- clusterizerbranch->SetAddress(&clusterizer) ;
- clusterizerbranch->GetEntry(0) ;
- TString clusterizerName( fTrackSegmentsBranchTitle ) ;
- clusterizerName.Append(clusterizer->Version()) ;
- clusterizer = gime->Clusterizer(clusterizerName) ;
-
- emcbranch->GetEntry(0) ;
- cpvbranch->GetEntry(0) ;
-
- clusterizerbranch->GetEntry(0) ;
-
- printf("ReadRecPoint: EMC=%d, CPV=%d\n",emcRecPoints->GetEntries(),cpvRecPoints->GetEntries());
-
- return kTRUE ;
-
-}
-
-//____________________________________________________________________________
-void AliPHOSTrackSegmentMakerv1::WriteTrackSegments(Int_t event)
-{
- // Writes found TrackSegments to TreeR. Creates branches
- // "PHOSTS" and "AliPHOSTrackSegmentMaker" with the same title.
- // In the former branch found TrackSegments are stored, while
- // in the latter all parameters, with which TS were made.
- // ROOT does not allow overwriting existing branches, therefore
- // first we check, if branches with the same title already exist.
- // If yes - exits without writing.
-
- AliPHOSGetter *gime = AliPHOSGetter::GetInstance() ;
- TString taskName(GetName()) ;
- taskName.Remove(taskName.Index(Version())-1) ;
-
- TClonesArray * trackSegments = gime->TrackSegments(taskName) ;
- trackSegments->Expand(trackSegments->GetEntriesFast()) ;
-
- //Make branch in TreeR for TrackSegments
- char * filename = 0;
- if(gSystem->Getenv("CONFIG_SPLIT_FILE")!=0){ //generating file name
- filename = new char[strlen(gAlice->GetBaseFile())+20] ;
- sprintf(filename,"%s/PHOS.Reco.root",gAlice->GetBaseFile()) ;
- }
-
- TDirectory *cwd = gDirectory;
-
- //First TS
- Int_t bufferSize = 32000 ;
- TBranch * tsBranch = gAlice->TreeR()->Branch("PHOSTS",&trackSegments,bufferSize);
- tsBranch->SetTitle(fTrackSegmentsBranchTitle);
- if (filename) {
- tsBranch->SetFile(filename);
- TIter next( tsBranch->GetListOfBranches());
- TBranch * sb ;
- while ((sb=(TBranch*)next())) {
- sb->SetFile(filename);
- }
- cwd->cd();
- }
-
- //Second -TSMaker
- Int_t splitlevel = 0 ;
- AliPHOSTrackSegmentMakerv1 * ts = this ;
- TBranch * tsMakerBranch = gAlice->TreeR()->Branch("AliPHOSTrackSegmentMaker","AliPHOSTrackSegmentMakerv1",
- &ts,bufferSize,splitlevel);
- tsMakerBranch->SetTitle(fTrackSegmentsBranchTitle);
- if (filename) {
- tsMakerBranch->SetFile(filename);
- TIter next( tsMakerBranch->GetListOfBranches());
- TBranch * sb;
- while ((sb=(TBranch*)next())) {
- sb->SetFile(filename);
- }
- cwd->cd();
- }
-
- tsBranch->Fill() ;
- tsMakerBranch->Fill() ;
-
- gAlice->TreeR()->Write(0,kOverwrite) ;
-