+Bool_t AliPHOSDigitizer::ReadSDigits(Int_t event)
+{
+ // Reads summable digits from the opened files for the particular set of events given by fIevent
+
+ AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
+
+ // loop over all opened files and read their SDigits to the White Board
+ TCollection * folderslist = ((TFolder*)gROOT->FindObjectAny("YSAlice/WhiteBoard/SDigits/PHOS"))->GetListOfFolders() ;
+ TIter next(folderslist) ;
+ TFolder * folder = 0 ;
+ TClonesArray * sdigits = 0 ;
+ while ( (folder = (TFolder*)next()) ) {
+ TFile * file = (TFile*)gROOT->GetFile(folder->GetName());
+ file->cd() ;
+
+ // Get SDigits Tree header from file
+ TString treeName("TreeS") ;
+ treeName += event ;
+ TTree * treeS = (TTree*)file->Get(treeName.Data());
+
+ if(treeS==0){
+ cerr << "ERROR: AliPHOSDigitizer::ReadSDigits There is no SDigit Tree" << endl;
+ return kFALSE;
+ }
+
+ //set address of the SDigits and SDigitizer
+ TBranch * sdigitsBranch = 0;
+ TBranch * sdigitizerBranch = 0;
+ TBranch * branch = 0 ;
+ TObjArray * lob = (TObjArray*)treeS->GetListOfBranches() ;
+ TIter next(lob) ;
+ Bool_t phosfound = kFALSE, sdigitizerfound = kFALSE ;
+
+ while ( (branch = (TBranch*)next()) && (!phosfound || !sdigitizerfound) ) {
+ if ( (strcmp(branch->GetName(), "PHOS")==0) && (strcmp(branch->GetTitle(), GetName())==0) ) {
+ phosfound = kTRUE ;
+ sdigitsBranch = branch ;
+ }
+
+ else if ( (strcmp(branch->GetName(), "AliPHOSSDigitizer")==0) && (strcmp(branch->GetTitle(), GetName())==0) ) {
+ sdigitizerfound = kTRUE ;
+ sdigitizerBranch = branch ;
+ }
+ }
+ if ( !phosfound || !sdigitizerfound ) {
+ cerr << "WARNING: AliPHOSDigitizer::ReadSDigits -> Digits and/or Digitizer branch with name " << GetName()
+ << " not found" << endl ;
+ return kFALSE ;
+ }
+
+
+ if ( (sdigits = (TClonesArray*)folder->FindObject(GetName()) ) ) {
+ sdigitsBranch->SetAddress(&sdigits) ;
+ sdigits->Clear();
+
+ AliPHOSSDigitizer * sdigitizer = gime->SDigitizer() ;
+ sdigitizerBranch->SetAddress(&sdigitizer) ;
+
+ sdigitsBranch->GetEntry(0) ;
+ sdigitizerBranch->GetEntry(0) ;
+
+ fPedestal = sdigitizer->GetPedestalParameter() ;
+ fSlope = sdigitizer->GetCalibrationParameter() ;
+ }
+ }
+
+ // After SDigits have been read from all files, return to the first one
+
+ next.Reset();
+ folder = (TFolder*)next();
+ TFile * file = (TFile*)gROOT->GetFile(folder->GetName());
+ file->cd() ;
+
+ return kTRUE ;
+
+}
+
+//____________________________________________________________________________
+void AliPHOSDigitizer::Reset()
+{
+ // sets current event number to the first simulated event
+
+ if( strcmp(GetName(), "") == 0 )
+ Init() ;
+
+ // Int_t inputs ;
+// for(inputs = 0; inputs < fNinputs ;inputs++)
+// fIevent->AddAt(-1, inputs ) ;