+ if (rawStream.Next()) {
+ Float_t ADC_max[64], adc[64];
+ Bool_t BBFlag[64], BGFlag[64], integrator[64];
+ Float_t time[64], width[64];
+ for(Int_t i=0; i<64; i++) {
+ // Search for the maximum charge in the train of 21 LHC clocks
+ // regardless of the integrator which has been operated:
+ ADC_max[i] = 0.0;
+ Int_t imax = 0;
+ for(Int_t iClock=0; iClock<21; iClock++){
+ if(rawStream.GetPedestal(i,iClock) > ADC_max[i])
+ {ADC_max[i]= rawStream.GetPedestal(i,iClock);
+ imax = iClock;}
+ }
+ // Convert i (FEE channel numbering) to j (aliroot channel numbering)
+ Int_t j = rawStream.GetOfflineChannel(i);
+ adc[j] = ADC_max[i];
+ time[j] = rawStream.GetTime(i);
+ width[j] = rawStream.GetWidth(i);
+ BBFlag[j] = rawStream.GetBBFlag(i,imax);
+ BGFlag[j] = rawStream.GetBGFlag(i,imax);
+ integrator[j] = rawStream.GetIntegratorFlag(i,imax);
+
+ // Filling the esd friend object
+ fESDVZEROfriend->SetBBScalers(j,rawStream.GetBBScalers(i));
+ fESDVZEROfriend->SetBGScalers(j,rawStream.GetBGScalers(i));
+ for (Int_t iBunch = 0; iBunch < AliESDVZEROfriend::kNBunches; iBunch++) {
+ fESDVZEROfriend->SetChargeMB(j,iBunch,rawStream.GetChargeMB(i,iBunch));
+ fESDVZEROfriend->SetIntMBFlag(j,iBunch,rawStream.GetIntMBFlag(i,iBunch));
+ fESDVZEROfriend->SetBBMBFlag(j,iBunch,rawStream.GetBBMBFlag(i,iBunch));
+ fESDVZEROfriend->SetBGMBFlag(j,iBunch,rawStream.GetBGMBFlag(i,iBunch));
+ }
+ for (Int_t iEv = 0; iEv < AliESDVZEROfriend::kNEvOfInt; iEv++) {
+ fESDVZEROfriend->SetPedestal(j,iEv,rawStream.GetPedestal(i,iEv));
+ fESDVZEROfriend->SetIntegratorFlag(j,iEv,rawStream.GetIntegratorFlag(i,iEv));
+ fESDVZEROfriend->SetBBFlag(j,iEv,rawStream.GetBBFlag(i,iEv));
+ fESDVZEROfriend->SetBGFlag(j,iEv,rawStream.GetBGFlag(i,iEv));
+ }
+ fESDVZEROfriend->SetTime(j,rawStream.GetTime(i));
+ fESDVZEROfriend->SetWidth(j,rawStream.GetWidth(i));
+ }
+
+ // Filling the esd friend object
+ fESDVZEROfriend->SetTriggerInputs(rawStream.GetTriggerInputs());
+ fESDVZEROfriend->SetTriggerInputsMask(rawStream.GetTriggerInputsMask());
+
+ for(Int_t iScaler = 0; iScaler < AliESDVZEROfriend::kNScalers; iScaler++)
+ fESDVZEROfriend->SetTriggerScalers(iScaler,rawStream.GetTriggerScalers(iScaler));
+
+ for(Int_t iBunch = 0; iBunch < AliESDVZEROfriend::kNBunches; iBunch++)
+ fESDVZEROfriend->SetBunchNumbersMB(iBunch,rawStream.GetBunchNumbersMB(iBunch));
+
+
+ // Channels(aliroot numbering) will be ordered in the tree
+ for(Int_t iChannel = 0; iChannel < 64; iChannel++) {
+ new ((*digitsArray)[digitsArray->GetEntriesFast()])
+ AliVZEROdigit(iChannel, adc[iChannel], time[iChannel],
+ width[iChannel], BBFlag[iChannel], BGFlag[iChannel],integrator[iChannel]);
+ }