+// This methode is responsible for merging sdigits to a list of digits
+//Disintegration leeds to the fact that one hit affects several neighbouring pads, which means that the same pad might be affected by few hits.
+ AliDebug(1,Form("Start with %i input(s) for event %i",fManager->GetNinputs(),fManager->GetOutputEventNr()));
+//First we read all sdigits from all inputs
+ AliRunLoader *pInRunLoader=0;//in and out Run loaders
+ AliLoader *pInRichLoader=0;//in and out RICH loaders
+ TClonesArray sdigs("AliRICHDigit");//tmp storage for sdigits sum up from all input files
+ Int_t total=0;
+ for(Int_t inFileN=0;inFileN<fManager->GetNinputs();inFileN++){//files loop
+ pInRunLoader = AliRunLoader::GetRunLoader(fManager->GetInputFolderName(inFileN)); //get run loader from current input
+ pInRichLoader = pInRunLoader->GetLoader("RICHLoader"); if(pInRichLoader==0) continue; //no RICH in this input, check the next input
+ if (!pInRunLoader->GetAliRun()) pInRunLoader->LoadgAlice();
+ AliRICH* pInRich=(AliRICH*)pInRunLoader->GetAliRun()->GetDetector("RICH"); //take RICH from current input
+ pInRichLoader->LoadSDigits(); pInRichLoader->TreeS()->GetEntry(0); //take list of RICH sdigits from current input
+ AliDebug(1,Form("input %i has %i sdigits",inFileN,pInRich->SdiLst()->GetEntries()));
+ for(Int_t i=0;i<pInRich->SdiLst()->GetEntries();i++){ //collect sdigits from current input
+ AliRICHDigit *pSDig=(AliRICHDigit*)pInRich->SdiLst()->At(i);
+ pSDig->AddTidOffset(fManager->GetMask(inFileN)); //apply TID shift since all inputs count tracks independently starting from 0
+ new(sdigs[total++]) AliRICHDigit(*pSDig);
+ }
+ pInRichLoader->UnloadSDigits(); pInRich->SdiReset(); //close current input and reset
+ }//files loop
+
+ //PH if(sdigs.GetEntries()==0) return; //no sdigits collected, nothing to convert