+void AliGenPythia::GetSubEventTime()
+{
+ // Calculates time of the next subevent
+ fEventTime = 0.;
+ if (fEventsTime) {
+ TArrayF &array = *fEventsTime;
+ fEventTime = array[fCurSubEvent++];
+ }
+ // printf(" Event time: %d %f %p",fCurSubEvent,fEventTime,fEventsTime);
+ return;
+}
+
+Bool_t AliGenPythia::IsInEMCAL(Float_t phi, Float_t eta)
+{
+ // Is particle in EMCAL acceptance?
+ // phi in degrees, etamin=-etamax
+ if(phi > fEMCALMinPhi && phi < fEMCALMaxPhi &&
+ eta < fEMCALEta )
+ return kTRUE;
+ else
+ return kFALSE;
+}
+
+Bool_t AliGenPythia::IsInPHOS(Float_t phi, Float_t eta)
+{
+ // Is particle in PHOS acceptance?
+ // Acceptance slightly larger considered.
+ // phi in degrees, etamin=-etamax
+ if(phi > fPHOSMinPhi && phi < fPHOSMaxPhi &&
+ eta < fPHOSEta )
+ return kTRUE;
+ else
+ return kFALSE;
+}
+
+void AliGenPythia::RotatePhi(Int_t iphcand, Bool_t& okdd)
+{
+ //calculate the new position random between fPHOSMinPhi and fPHOSMaxPhi
+ Double_t phiPHOSmin = TMath::Pi()*fPHOSMinPhi/180;
+ Double_t phiPHOSmax = TMath::Pi()*fPHOSMaxPhi/180;
+ Double_t phiPHOS = gRandom->Uniform(phiPHOSmin,phiPHOSmax);
+
+ //calculate deltaphi
+ TParticle* ph = (TParticle *) fParticles->At(iphcand);
+ Double_t phphi = ph->Phi();
+ Double_t deltaphi = phiPHOS - phphi;
+
+
+
+ //loop for all particles and produce the phi rotation
+ Int_t np = (fHadronisation) ? fParticles->GetEntriesFast() : fNpartons;
+ Double_t oldphi, newphi;
+ Double_t newVx, newVy, R, Vz, time;
+ Double_t newPx, newPy, pt, Pz, e;
+ for(Int_t i=0; i< np; i++) {
+ TParticle* iparticle = (TParticle *) fParticles->At(i);
+ oldphi = iparticle->Phi();
+ newphi = oldphi + deltaphi;
+ if(newphi < 0) newphi = 2*TMath::Pi() + newphi; // correct angle
+ if(newphi > 2*TMath::Pi()) newphi = newphi - 2*TMath::Pi(); // correct angle
+
+ R = iparticle->R();
+ newVx = R*TMath::Cos(newphi);
+ newVy = R*TMath::Sin(newphi);
+ Vz = iparticle->Vz(); // don't transform
+ time = iparticle->T(); // don't transform
+
+ pt = iparticle->Pt();
+ newPx = pt*TMath::Cos(newphi);
+ newPy = pt*TMath::Sin(newphi);
+ Pz = iparticle->Pz(); // don't transform
+ e = iparticle->Energy(); // don't transform
+
+ // apply rotation
+ iparticle->SetProductionVertex(newVx, newVy, Vz, time);
+ iparticle->SetMomentum(newPx, newPy, Pz, e);
+
+ } //end particle loop
+
+ // now let's check that we put correctly the candidate photon in PHOS
+ Float_t phi = ph->Phi()*180./TMath::Pi(); //Convert to degrees
+ Float_t eta =TMath::Abs(ph->Eta());//in calos etamin=-etamax
+ if(IsInPHOS(phi,eta))
+ okdd = kTRUE;
+}
+