-// AliPHOSRecParticle * recParticle ;
-// Int_t iRecParticle ;
-// for(iRecParticle = 0; iRecParticle < recParticleList->GetEntries() ;iRecParticle++ )
-// {
-// recParticle = (AliPHOSRecParticle *) recParticleList->At(iRecParticle) ;
-// fhAllRP->Fill(CorrectEnergy(recParticle->Energy())) ;
-
-// Int_t moduleNumberRec ;
-// Double_t recX, recZ ;
-// fGeom->ImpactOnEmc(recParticle->Theta(), recParticle->Phi(), moduleNumberRec, recX, recZ) ;
-
-// Double_t minDistance = 100. ;
-// Int_t closestPrimary = -1 ;
-
-// Int_t numberofprimaries ;
-// Int_t * listofprimaries = recParticle->GetPrimaries(numberofprimaries) ;
-// Int_t index ;
-// TParticle * primary ;
-// Double_t distance = minDistance ;
-// Double_t dX, dZ;
-// Double_t dXmin = 0.;
-// Double_t dZmin = 0. ;
-// for ( index = 0 ; index < numberofprimaries ; index++){
-// primary = gAlice->Particle(listofprimaries[index]) ;
-// Int_t moduleNumber ;
-// Double_t primX, primZ ;
-// fGeom->ImpactOnEmc(primary->Theta(), primary->Phi(), moduleNumber, primX, primZ) ;
-// if(moduleNumberRec == moduleNumber) {
-// dX = recX - primX;
-// dZ = recZ - primZ;
-// distance = TMath::Sqrt(dX*dX + dZ*dZ) ;
-// if(minDistance > distance) {
-// minDistance = distance ;
-// dXmin = dX;
-// dZmin = dZ;
-// closestPrimary = listofprimaries[index] ;
-// }
-// }
-// }
-// totalRecPart++ ;
-
-// if(closestPrimary >=0 ){
-// totalRPwithPrim++;
-
-// Int_t primaryType = gAlice->Particle(closestPrimary)->GetPdgCode() ;
-// // TParticlePDG* pDGparticle = gAlice->ParticleAt(closestPrimary)->GetPDG();
-// // Double_t charge = PDGparticle->Charge() ;
-// // if(charge)
-// // cout <<"Primary " <<primaryType << " E " << ((TParticle *)primaryList->At(closestPrimary))->Energy() << endl ;
-// Int_t primaryCode ;
-// switch(primaryType)
-// {
-// case 22:
-// primaryCode = 0; //Photon
-// fhAllEnergy ->Fill(gAlice->Particle(closestPrimary)->Energy(), recParticle->Energy()) ;
-// fhAllPosition ->Fill(gAlice->Particle(closestPrimary)->Energy(), minDistance) ;
-// fhAllPositionX->Fill(dXmin);
-// fhAllPositionZ->Fill(dZmin);
-// break;
-// case 11 :
-// primaryCode = 1; //Electron
-// break;
-// case -11 :
-// primaryCode = 1; //positron
-// break;
-// case 321 :
-// primaryCode = 4; //K+
-// break;
-// case -321 :
-// primaryCode = 4; //K-
-// break;
-// case 310 :
-// primaryCode = 4; //K0s
-// break;
-// case 130 :
-// primaryCode = 4; //K0l
-// break;
-// case 211 :
-// primaryCode = 2; //K0l
-// break;
-// case -211 :
-// primaryCode = 2; //K0l
-// break;
-// case 2212 :
-// primaryCode = 2; //K0l
-// break;
-// case -2212 :
-// primaryCode = 2; //K0l
-// break;
-// default:
-// primaryCode = 3; //ELSE
-// break;
-// }
-
-// switch(recParticle->GetType())
-// {
-// case AliPHOSFastRecParticle::kGAMMA:
-// if(primaryType == 22){
-// fhPhotEnergy->Fill(gAlice->Particle(closestPrimary)->Energy(), recParticle->Energy() ) ;
-// fhEMEnergy->Fill(gAlice->Particle(closestPrimary)->Energy(), recParticle->Energy() ) ;
-// fhPPSDEnergy->Fill(gAlice->Particle(closestPrimary)->Energy(), recParticle->Energy() ) ;
-
-// fhPhotPosition->Fill(gAlice->Particle(closestPrimary)->Energy(),minDistance) ;
-// fhEMPosition->Fill(gAlice->Particle(closestPrimary)->Energy(),minDistance) ;
-// fhPPSDPosition->Fill(gAlice->Particle(closestPrimary)->Energy(),minDistance) ;
-
-// fhPhotReg->Fill(CorrectEnergy(recParticle->Energy()) ) ;
-// fhPhotEM->Fill(CorrectEnergy(recParticle->Energy()) ) ;
-// fhPhotPPSD->Fill(CorrectEnergy(recParticle->Energy()) ) ;
-
-// fhPhotPhot->Fill(CorrectEnergy(recParticle->Energy()) ) ;
-// }
-// if(primaryType == 2112){ //neutron
-// fhNReg->Fill(CorrectEnergy(recParticle->Energy()) ) ;
-// fhNEM->Fill(CorrectEnergy(recParticle->Energy()) ) ;
-// fhNPPSD->Fill(CorrectEnergy(recParticle->Energy()) ) ;
-// }
-
-// if(primaryType == -2112){ //neutron ~
-// fhNBarReg->Fill(CorrectEnergy(recParticle->Energy()) ) ;
-// fhNBarEM->Fill(CorrectEnergy(recParticle->Energy()) ) ;
-// fhNBarPPSD->Fill(CorrectEnergy(recParticle->Energy()) ) ;
-
-// }
-// if(primaryCode == 2){
-// fhChargedReg->Fill(CorrectEnergy(recParticle->Energy()) ) ;
-// fhChargedEM->Fill(CorrectEnergy(recParticle->Energy()) ) ;
-// fhChargedPPSD->Fill(CorrectEnergy(recParticle->Energy()) ) ;
-// }
-
-// fhAllReg->Fill(CorrectEnergy(recParticle->Energy()) ) ;
-// fhAllEM->Fill(CorrectEnergy(recParticle->Energy()) ) ;
-// fhAllPPSD->Fill(CorrectEnergy(recParticle->Energy()) ) ;
-// fhShape->Fill(CorrectEnergy(recParticle->Energy()) ) ;
-// fhVeto->Fill(CorrectEnergy(recParticle->Energy()) ) ;
-// fhPPSD->Fill(CorrectEnergy(recParticle->Energy()) ) ;
-// counter[0][primaryCode]++;
-// break;
-// case AliPHOSFastRecParticle::kELECTRON:
-// if(primaryType == 22){
-// fhPhotElec->Fill(CorrectEnergy(recParticle->Energy()) ) ;
-// fhEMEnergy->Fill(gAlice->Particle(closestPrimary)->Energy(), recParticle->Energy() ) ;
-// fhEMPosition->Fill(gAlice->Particle(closestPrimary)->Energy(),minDistance) ;
-// fhPhotEM->Fill(CorrectEnergy(recParticle->Energy()) ) ;
-// fhPhotPPSD->Fill(CorrectEnergy(recParticle->Energy()) ) ;
-// }
-// if(primaryType == 2112){ //neutron
-// fhNEM->Fill(CorrectEnergy(recParticle->Energy()) ) ;
-// fhNPPSD->Fill(CorrectEnergy(recParticle->Energy()) ) ;
-// }
-
-// if(primaryType == -2112){ //neutron ~
-// fhNBarEM->Fill(CorrectEnergy(recParticle->Energy()) ) ;
-// fhNBarPPSD->Fill(CorrectEnergy(recParticle->Energy()) ) ;
-
-// }
-// if(primaryCode == 2){
-// fhChargedEM->Fill(CorrectEnergy(recParticle->Energy()) ) ;
-// fhChargedPPSD->Fill(CorrectEnergy(recParticle->Energy()) ) ;
-// }
-
-// fhAllEM->Fill(CorrectEnergy(recParticle->Energy()) ) ;
-// fhAllPPSD->Fill(CorrectEnergy(recParticle->Energy()) ) ;
-// fhShape->Fill(CorrectEnergy(recParticle->Energy()) ) ;
-// fhPPSD->Fill(CorrectEnergy(recParticle->Energy()) ) ;
-// counter[1][primaryCode]++;
-// break;
-// case AliPHOSFastRecParticle::kNEUTRALHA:
-// if(primaryType == 22)
-// fhPhotNeuH->Fill(CorrectEnergy(recParticle->Energy()) ) ;
-
-// fhVeto->Fill(CorrectEnergy(recParticle->Energy()) ) ;
-// counter[2][primaryCode]++;
-// break ;
-// case AliPHOSFastRecParticle::kNEUTRALEM:
-// if(primaryType == 22){
-// fhEMEnergy->Fill(gAlice->Particle(closestPrimary)->Energy(),recParticle->Energy() ) ;
-// fhEMPosition->Fill(gAlice->Particle(closestPrimary)->Energy(),minDistance ) ;
-
-// fhPhotNuEM->Fill(CorrectEnergy(recParticle->Energy()) ) ;
-// fhPhotEM->Fill(CorrectEnergy(recParticle->Energy()) ) ;
-// }
-// if(primaryType == 2112) //neutron
-// fhNEM->Fill(CorrectEnergy(recParticle->Energy()) ) ;
-
-// if(primaryType == -2112) //neutron ~
-// fhNBarEM->Fill(CorrectEnergy(recParticle->Energy()) ) ;
-
-// if(primaryCode == 2)
-// fhChargedEM->Fill(CorrectEnergy(recParticle->Energy()) ) ;
-
-// fhAllEM->Fill(CorrectEnergy(recParticle->Energy()) ) ;
-// fhShape->Fill(CorrectEnergy(recParticle->Energy()) ) ;
-// fhVeto->Fill(CorrectEnergy(recParticle->Energy()) ) ;
-
-// counter[3][primaryCode]++;
-// break ;
-// case AliPHOSFastRecParticle::kCHARGEDHA:
-// if(primaryType == 22) //photon
-// fhPhotChHa->Fill(CorrectEnergy(recParticle->Energy()) ) ;
-
-// counter[4][primaryCode]++ ;
-// break ;
-// case AliPHOSFastRecParticle::kGAMMAHA:
-// if(primaryType == 22){ //photon
-// fhPhotGaHa->Fill(CorrectEnergy(recParticle->Energy()) ) ;
-// fhPPSDEnergy->Fill(gAlice->Particle(closestPrimary)->Energy(), recParticle->Energy() ) ;
-// fhPPSDPosition->Fill(gAlice->Particle(closestPrimary)->Energy(),minDistance) ;
-// fhPhotPPSD->Fill(CorrectEnergy(recParticle->Energy()) ) ;
-// }
-// if(primaryType == 2112){ //neutron
-// fhNPPSD->Fill(CorrectEnergy(recParticle->Energy()) ) ;
-// }
-
-// if(primaryType == -2112){ //neutron ~
-// fhNBarPPSD->Fill(CorrectEnergy(recParticle->Energy()) ) ;
-// }
-// if(primaryCode == 2){
-// fhChargedPPSD->Fill(CorrectEnergy(recParticle->Energy()) ) ;
-// }
-
-// fhAllPPSD->Fill(CorrectEnergy(recParticle->Energy()) ) ;
-// fhVeto->Fill(CorrectEnergy(recParticle->Energy()) ) ;
-// fhPPSD->Fill(CorrectEnergy(recParticle->Energy()) ) ;
-// counter[5][primaryCode]++ ;
-// break ;
-// case AliPHOSFastRecParticle::kABSURDEM:
-// counter[6][primaryCode]++ ;
-// fhShape->Fill(CorrectEnergy(recParticle->Energy()) ) ;
-// break;
-// case AliPHOSFastRecParticle::kABSURDHA:
-// counter[7][primaryCode]++ ;
-// break;
-// default:
-// counter[8][primaryCode]++ ;
-// break;
-// }
-// }
-// }
-// } // endfor
-// SaveHistograms();
-// cout << "Resolutions: Analyzed " << Nevents << " event(s)" << endl ;
-// cout << "Resolutions: Total primary " << totalPrimary << endl ;
-// cout << "Resoluitons: Total reconstracted " << totalRecPart << endl ;
-// cout << "TotalReconstructed with Primarie " << totalRPwithPrim << endl ;
-// cout << " Primary: Photon Electron Ch. Hadr. Neutr. Hadr Kaons" << endl ;
-// cout << " Detected as photon " << counter[0][0] << " " << counter[0][1] << " " << counter[0][2] << " " <<counter[0][3] << " " << counter[0][4] << endl ;
-// cout << " Detected as electron " << counter[1][0] << " " << counter[1][1] << " " << counter[1][2] << " " <<counter[1][3] << " " << counter[1][4] << endl ;
-// cout << " Detected as neutral hadron " << counter[2][0] << " " << counter[2][1] << " " << counter[2][2] << " " <<counter[2][3] << " " << counter[2][4] << endl ;
-// cout << " Detected as neutral EM " << counter[3][0] << " " << counter[3][1] << " " << counter[3][2] << " " <<counter[3][3] << " " << counter[3][4] << endl ;
-// cout << " Detected as charged hadron " << counter[4][0] << " " << counter[4][1] << " " << counter[4][2] << " " <<counter[4][3] << " " << counter[4][4] << endl ;
-// cout << " Detected as gamma-hadron " << counter[5][0] << " " << counter[5][1] << " " << counter[5][2] << " " <<counter[5][3] << " " << counter[5][4] << endl ;
-// cout << " Detected as Absurd EM " << counter[6][0] << " " << counter[6][1] << " " << counter[6][2] << " " <<counter[6][3] << " " << counter[6][4] << endl ;
-// cout << " Detected as absurd hadron " << counter[7][0] << " " << counter[7][1] << " " << counter[7][2] << " " <<counter[7][3] << " " << counter[7][4] << endl ;
-// cout << " Detected as undefined " << counter[8][0] << " " << counter[8][1] << " " << counter[8][2] << " " <<counter[8][3] << " " << counter[8][4] << endl ;