]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWGLF/totEt/AliAnalysisEtMonteCarlo.cxx
fix crash on HIJING with added signals
[u/mrichter/AliRoot.git] / PWGLF / totEt / AliAnalysisEtMonteCarlo.cxx
index 80747c15e81142ad7d13e3692a85347d9a51f14a..7d60369d69655c0dca4f92cd416e5d631b19d6e4 100644 (file)
@@ -37,6 +37,8 @@ ClassImp(AliAnalysisEtMonteCarlo);
 
 // ctor
 AliAnalysisEtMonteCarlo::AliAnalysisEtMonteCarlo():AliAnalysisEt()
+                                                 ,nChargedHadronsMeasured(0)
+                                                 ,nChargedHadronsTotal(0)
                                                  ,fIsMC(kTRUE)
     ,fImpactParameter(0)
     ,fNcoll(0)
@@ -246,15 +248,28 @@ AliAnalysisEtMonteCarlo::AliAnalysisEtMonteCarlo():AliAnalysisEt()
                                                  ,fCalcTrackMatchVsMult(kFALSE)
                                                  ,fHistGammasFound(0)
                                                  ,fHistGammasGenerated(0)
-                                                 ,fHistGammasFoundMult(0)
-                                                 ,fHistGammasGeneratedMult(0)
+                                                 ,fHistGammasFoundCent(0)
+                                                 ,fHistGammasFoundOutOfAccCent(0)
+                                                 ,fHistGammasFoundAltCent(0)
+                                                 ,fHistGammasFoundOutOfAccAltCent(0)
+                                                 ,fHistGammasGeneratedCent(0)
+                                                 ,fHistGammasFoundRecoEnergyCent(0)
+                                                 ,fHistGammasFoundOutOfAccRecoEnergyCent(0)
                                                  ,fHistChargedTracksCut(0)
                                                  ,fHistChargedTracksAccepted(0)
                                                  ,fHistGammasCut(0)
                                                  ,fHistGammasAccepted(0)
+                                                 ,fHistChargedTrackDepositsAcceptedVsPt(0)
+                                                 ,fHistChargedTrackDepositsAllVsPt(0)
+                                                 ,fHistChargedTrackDepositsAcceptedVsPtEffCorr(0)
+                                                 ,fHistChargedTrackDepositsAllVsPtEffCorr(0)
                                                  ,fHistChargedTracksCutMult(0)
                                                  ,fHistChargedTracksAcceptedMult(0)
-                                                 ,fHistChargedTracksAcceptedLowPtMult(0)
+                                                 ,fHistChargedTracksAcceptedLowPtCentEffCorr(0)
+                                                 ,fHistChargedTracksAcceptedLowPtCent(0)
+                                                 ,fHistChargedTracksAcceptedLowPtCent500MeV(0)
+                                                 ,fHistChargedTracksAcceptedLowPtCentNoAntiProtons(0)
+                                                 ,fHistChargedTracksAcceptedLowPtCentAntiProtons(0)
                                                  ,fHistGammasCutMult(0)
                                                  ,fHistGammasAcceptedMult(0)
                                                  ,fHistBadTrackMatches(0)
@@ -262,10 +277,10 @@ AliAnalysisEtMonteCarlo::AliAnalysisEtMonteCarlo():AliAnalysisEt()
                                                  ,fHistMatchedTracksEvspTSignal(0)
                                                  ,fHistMatchedTracksEvspTBkgdPeripheral(0)
                                                  ,fHistMatchedTracksEvspTSignalPeripheral(0)
-                                                 ,fHistMatchedTracksEvspTBkgdvsMult(0)
-                                                 ,fHistMatchedTracksEvspTSignalvsMult(0)
-                                                 ,fHistMatchedTracksEvspTBkgdvsMultEffCorr(0)
-                                                 ,fHistMatchedTracksEvspTSignalvsMultEffCorr(0)
+                                                 ,fHistMatchedTracksEvspTBkgdvsCent(0)
+                                                 ,fHistMatchedTracksEvspTSignalvsCent(0)
+                                                 ,fHistMatchedTracksEvspTBkgdvsCentEffCorr(0)
+                                                 ,fHistMatchedTracksEvspTSignalvsCentEffCorr(0)
 
                                                  ,fHistChargedTracksCutPeripheral(0)
                                                  ,fHistChargedTracksAcceptedPeripheral(0)
@@ -275,10 +290,108 @@ AliAnalysisEtMonteCarlo::AliAnalysisEtMonteCarlo():AliAnalysisEt()
                                                  ,fHistGoodTrackMatchesdPhidEta(0)
                                                  ,fHistHadronDepositsAll(0)
                                                  ,fHistHadronDepositsReco(0)
-                                                 ,fHistHadronDepositsAllMult(0)
-                                                 ,fHistHadronDepositsRecoMult(0)
-                                                 ,fHistHadronsAllMult(0)
+                                                 ,fHistHadronDepositsAllCent(0)
+                                                 ,fHistHadronDepositsAllCent500MeV(0)
+                                                 ,fHistHadronDepositsRecoCent(0)
+                                                 ,fHistHadronDepositsAllvsECent(0)
+                                                 ,fHistHadronDepositsRecovsECent(0)
+                                                 ,fHistHadronsAllCent(0)
                                                  ,fHistMultChVsSignalVsMult(0)
+                                                 ,fHistNeutralRemovedSecondaryEtVsCent(0)
+                                                 ,fHistChargedRemovedSecondaryEtVsCent(0)
+                                                 ,fHistNeutralNotRemovedSecondaryEtVsCent(0)
+                                                 ,fHistChargedNotRemovedSecondaryEtVsCent(0)
+                                                 ,fHistNeutralRemovedSecondaryNumVsNCluster(0)
+                                                 ,fHistChargedRemovedSecondaryNumVsNCluster(0)
+                                                 ,fHistNeutralNotRemovedSecondaryNumVsNCluster(0)
+                                                 ,fHistChargedNotRemovedSecondaryNumVsNCluster(0)
+                                                 ,fHistNeutralRemovedSecondaryNumVsCent(0)
+                                                 ,fHistChargedRemovedSecondaryNumVsCent(0)
+                                                 ,fHistNeutralNotRemovedSecondaryNumVsCent(0)
+                                                 ,fHistChargedNotRemovedSecondaryNumVsCent(0)
+                                                 ,fHistNeutronsEtVsCent(0)
+                                                 ,fHistNeutronsNumVsCent(0)
+                                                 ,fHistNotNeutronsNumVsCent(0)
+                                                 ,fHistPiKPDepositedVsNch(0)
+                                                 ,fHistPiKPNotTrackMatchedDepositedVsNch(0)
+                                                 ,fHistNeutronsDepositedVsNch(0)//start
+                                                 ,fHistAntiNeutronsDepositedVsNch(0)
+                                                 ,fHistProtonsDepositedVsNch(0)
+                                                 ,fHistAntiProtonsDepositedVsNch(0)
+                                                 ,fHistProtonsNotTrackMatchedDepositedVsNch(0)
+                                                 ,fHistAntiProtonsNotTrackMatchedDepositedVsNch(0)
+                                                 ,fHistNeutronsDepositedVsNcl(0)
+                                                 ,fHistAntiNeutronsDepositedVsNcl(0)
+                                                 ,fHistProtonsDepositedVsNcl(0)
+                                                 ,fHistAntiProtonsDepositedVsNcl(0)
+                                                 ,fHistProtonsNotTrackMatchedDepositedVsNcl(0)
+                                                 ,fHistAntiProtonsNotTrackMatchedDepositedVsNcl(0)
+                                                 ,fHistSecondariesVsNch(0)
+                                                 ,fHistSecondariesVsNcl(0)
+                                                 ,fHistSecondariesEffCorrVsNch(0)
+                                                 ,fHistSecondariesEffCorrVsNcl(0)
+                                                 ,fHistSecondariesOutOfAccEffCorrVsNch(0)
+                                                 ,fHistSecondariesDetectorCoverEffCorrVsNch(0)//end
+                                                 ,fHistNeutronsDepositedVsNchNoEffCorr(0)//start
+                                                 ,fHistAntiNeutronsDepositedVsNchNoEffCorr(0)
+                                                 ,fHistProtonsDepositedVsNchNoEffCorr(0)
+                                                 ,fHistAntiProtonsDepositedVsNchNoEffCorr(0)
+                                                 ,fHistProtonsNotTrackMatchedDepositedVsNchNoEffCorr(0)
+                                                 ,fHistAntiProtonsNotTrackMatchedDepositedVsNchNoEffCorr(0)
+                                                 ,fHistNeutronsDepositedVsNclNoEffCorr(0)
+                                                 ,fHistAntiNeutronsDepositedVsNclNoEffCorr(0)
+                                                 ,fHistProtonsDepositedVsNclNoEffCorr(0)
+                                                 ,fHistAntiProtonsDepositedVsNclNoEffCorr(0)
+                                                 ,fHistProtonsNotTrackMatchedDepositedVsNclNoEffCorr(0)
+                                                 ,fHistAntiProtonsNotTrackMatchedDepositedVsNclNoEffCorr(0)//end
+                                                 ,fHistCentVsNchVsNcl(0)
+                                                       ,fHistSecondaryPositionInDetector(0)
+                                                 ,fClusterPositionWeird(0)
+                                               //,fHistSecondaryPositionInDetectorMultiple(0)
+                                                 ,fSecondaryClusterEnergy(0)
+                                                 ,fHistGammaCrossCheck(0)
+                                                 ,fHistGammaCrossCheckAlt(0)
+                                                 ,fHistGammaEnergyCrossCheck(0)
+                                                 ,fHistGammaEnergyCrossCheckAlt(0)
+    ,fHistNeutronCrossCheck(0)
+    ,fHistSecondaryCrossCheck(0)
+    ,fHistHadronCrossCheck(0)
+    ,fHistKaonCrossCheck(0)
+    ,fHistAllEnergy(0)
+    ,fHistSignalEnergy(0)
+    ,fHistNeutronEnergy(0)
+    ,fHistKaonEnergy(0)
+    ,fHistHadronEnergy(0)
+    ,fHistSecondaryEnergy(0)
+    ,fHistSecondaryChargedEnergy(0)
+    ,fHistSecondaryNeutronEnergy(0)
+    ,fHistSecondaryGammaEnergy(0)
+    ,fHistSecondaryElectronEnergy(0)
+    ,fHistSecondaryOtherEnergy(0)
+    ,fHistSimulatedGammaEnergy(0)
+    ,fHistReconstructedGammaEnergy(0)
+                                                 ,fHistSimulatedGammaEnergyAboveThreshold(0)
+                                                 ,fHistReconstructedSignalEnergy(0)
+    ,fHistFracSignalVsNClusters(0)
+    ,fHistFracHadronsVsNClusters(0)
+    ,fHistFracNeutronsVsNClusters(0)
+    ,fHistFracKaonsVsNClusters(0)
+    ,fHistFracSecondariesVsNClusters(0)
+    ,fHistFracSignalVsNMultiplicity(0)
+    ,fHistFracHadronsVsNMultiplicity(0)
+    ,fHistFracNeutronsVsNMultiplicity(0)
+    ,fHistFracKaonsVsNMultiplicity(0)
+    ,fHistFracSecondariesVsNMultiplicity(0)
+    ,fHistFracSignalVsNMatchedTracks(0)
+    ,fHistFracHadronsVsNMatchedTracks(0)
+    ,fHistFracNeutronsVsNMatchedTracks(0)
+    ,fHistFracKaonsVsNMatchedTracks(0)
+    ,fHistFracSecondariesVsNMatchedTracks(0)
+    ,fHistFracSignalVsNTotalTracks(0)
+    ,fHistFracHadronsVsNTotalTracks(0)
+    ,fHistFracNeutronsVsNTotalTracks(0)
+    ,fHistFracKaonsVsNTotalTracks(0)
+    ,fHistFracSecondariesVsNTotalTracks(0)
 {
 }
 
@@ -381,15 +494,28 @@ AliAnalysisEtMonteCarlo::~AliAnalysisEtMonteCarlo()
     delete fHistPiZeroMultAcc; // enter comment here
     delete fHistGammasFound; // enter comment here
     delete fHistGammasGenerated; // enter comment here
-    delete fHistGammasFoundMult; // enter comment here
-    delete fHistGammasGeneratedMult; // enter comment here
+    delete fHistGammasFoundOutOfAccCent; // enter comment here
+    delete fHistGammasFoundCent; // enter comment here
+    delete fHistGammasFoundOutOfAccAltCent; // enter comment here
+    delete fHistGammasFoundAltCent; // enter comment here
+    delete fHistGammasGeneratedCent; // enter comment here
+    delete fHistGammasFoundRecoEnergyCent;
+    delete fHistGammasFoundOutOfAccRecoEnergyCent;
     delete fHistChargedTracksCut;
     delete fHistChargedTracksAccepted;
     delete fHistGammasCut;
     delete fHistGammasAccepted;
     delete fHistChargedTracksCutMult;
+    delete fHistChargedTrackDepositsAcceptedVsPt;
+    delete fHistChargedTrackDepositsAllVsPt;
+    delete fHistChargedTrackDepositsAcceptedVsPtEffCorr;
+    delete fHistChargedTrackDepositsAllVsPtEffCorr;
     delete fHistChargedTracksAcceptedMult;
-    delete fHistChargedTracksAcceptedLowPtMult;
+    delete fHistChargedTracksAcceptedLowPtCentEffCorr;
+    delete fHistChargedTracksAcceptedLowPtCent;
+    delete fHistChargedTracksAcceptedLowPtCent500MeV;
+    delete fHistChargedTracksAcceptedLowPtCentNoAntiProtons;
+    delete fHistChargedTracksAcceptedLowPtCentAntiProtons;
     delete fHistGammasCutMult;
     delete fHistGammasAcceptedMult;
     delete fHistBadTrackMatches;
@@ -397,10 +523,10 @@ AliAnalysisEtMonteCarlo::~AliAnalysisEtMonteCarlo()
     delete fHistMatchedTracksEvspTSignal;
     delete fHistMatchedTracksEvspTBkgdPeripheral;
     delete fHistMatchedTracksEvspTSignalPeripheral;
-    delete fHistMatchedTracksEvspTBkgdvsMult;
-    delete fHistMatchedTracksEvspTSignalvsMult;
-    delete fHistMatchedTracksEvspTBkgdvsMultEffCorr;
-    delete fHistMatchedTracksEvspTSignalvsMultEffCorr;
+    delete fHistMatchedTracksEvspTBkgdvsCent;
+    delete fHistMatchedTracksEvspTSignalvsCent;
+    delete fHistMatchedTracksEvspTBkgdvsCentEffCorr;
+    delete fHistMatchedTracksEvspTSignalvsCentEffCorr;
     delete fHistChargedTracksCutPeripheral;
     delete fHistChargedTracksAcceptedPeripheral;
     delete fHistGammasCutPeripheral;
@@ -409,10 +535,113 @@ AliAnalysisEtMonteCarlo::~AliAnalysisEtMonteCarlo()
     delete fHistGoodTrackMatchesdPhidEta;
     delete fHistHadronDepositsAll;
     delete fHistHadronDepositsReco;
-    delete fHistHadronDepositsAllMult;
-    delete fHistHadronDepositsRecoMult;
-    delete fHistHadronsAllMult;
+    delete fHistHadronDepositsAllCent;
+    delete fHistHadronDepositsAllCent500MeV;
+    delete fHistHadronDepositsRecoCent;
+    delete fHistHadronDepositsAllvsECent;
+    delete fHistHadronDepositsRecovsECent;
+    delete fHistHadronsAllCent;
     delete fHistMultChVsSignalVsMult;
+    delete fHistNeutralRemovedSecondaryEtVsCent;
+    delete fHistChargedRemovedSecondaryEtVsCent;
+    delete fHistNeutralNotRemovedSecondaryEtVsCent;
+    delete fHistChargedNotRemovedSecondaryEtVsCent;
+    delete fHistNeutralRemovedSecondaryNumVsNCluster;
+    delete fHistChargedRemovedSecondaryNumVsNCluster;
+    delete fHistNeutralNotRemovedSecondaryNumVsNCluster;
+    delete fHistChargedNotRemovedSecondaryNumVsNCluster;
+    delete fHistNeutralRemovedSecondaryNumVsCent;
+    delete fHistChargedRemovedSecondaryNumVsCent;
+    delete fHistNeutralNotRemovedSecondaryNumVsCent;
+    delete fHistChargedNotRemovedSecondaryNumVsCent;
+    delete fHistNeutronsEtVsCent;
+    delete fHistNeutronsNumVsCent;
+    delete fHistNotNeutronsNumVsCent;
+    delete fHistPiKPDepositedVsNch;
+    delete fHistPiKPNotTrackMatchedDepositedVsNch;
+
+    delete fHistNeutronsDepositedVsNch;
+    delete fHistAntiNeutronsDepositedVsNch;
+    delete fHistProtonsDepositedVsNch;
+    delete fHistAntiProtonsDepositedVsNch;
+    delete fHistProtonsNotTrackMatchedDepositedVsNch;
+    delete fHistAntiProtonsNotTrackMatchedDepositedVsNch;
+    delete fHistNeutronsDepositedVsNcl;
+    delete fHistAntiNeutronsDepositedVsNcl;
+    delete fHistProtonsDepositedVsNcl;
+    delete fHistAntiProtonsDepositedVsNcl;
+    delete fHistProtonsNotTrackMatchedDepositedVsNcl;
+    delete fHistAntiProtonsNotTrackMatchedDepositedVsNcl;
+    delete fHistSecondariesVsNch;
+    delete fHistSecondariesVsNcl;
+    delete fHistSecondariesEffCorrVsNch;
+    delete fHistSecondariesEffCorrVsNcl;
+    delete fHistSecondariesOutOfAccEffCorrVsNch;
+    delete fHistSecondariesDetectorCoverEffCorrVsNch;
+
+
+    delete fHistNeutronsDepositedVsNchNoEffCorr;
+    delete fHistAntiNeutronsDepositedVsNchNoEffCorr;
+    delete fHistProtonsDepositedVsNchNoEffCorr;
+    delete fHistAntiProtonsDepositedVsNchNoEffCorr;
+    delete fHistProtonsNotTrackMatchedDepositedVsNchNoEffCorr;
+    delete fHistAntiProtonsNotTrackMatchedDepositedVsNchNoEffCorr;
+    delete fHistNeutronsDepositedVsNclNoEffCorr;
+    delete fHistAntiNeutronsDepositedVsNclNoEffCorr;
+    delete fHistProtonsDepositedVsNclNoEffCorr;
+    delete fHistAntiProtonsDepositedVsNclNoEffCorr;
+    delete fHistProtonsNotTrackMatchedDepositedVsNclNoEffCorr;
+    delete fHistAntiProtonsNotTrackMatchedDepositedVsNclNoEffCorr;
+
+    delete fHistCentVsNchVsNcl;
+    delete fHistSecondaryPositionInDetector;
+    delete fClusterPositionWeird;
+    //delete fHistSecondaryPositionInDetectorMultiple;
+    delete fSecondaryClusterEnergy;
+    delete fHistGammaCrossCheck;
+    delete fHistGammaCrossCheckAlt;
+    delete fHistGammaEnergyCrossCheck;
+    delete fHistGammaEnergyCrossCheckAlt;
+    delete fHistNeutronCrossCheck;
+    delete fHistSecondaryCrossCheck;
+    delete fHistHadronCrossCheck;
+    delete fHistKaonCrossCheck;
+
+    delete fHistAllEnergy;
+    delete fHistSignalEnergy;
+    delete fHistNeutronEnergy;
+    delete fHistKaonEnergy;
+    delete fHistHadronEnergy;
+    delete fHistSecondaryEnergy;
+    delete fHistSecondaryChargedEnergy;
+    delete fHistSecondaryNeutronEnergy;
+    delete fHistSecondaryGammaEnergy;
+    delete fHistSecondaryElectronEnergy;
+    delete fHistSecondaryOtherEnergy;
+    delete fHistSimulatedGammaEnergy;
+    delete fHistReconstructedGammaEnergy;
+    delete fHistSimulatedGammaEnergyAboveThreshold;
+    delete fHistReconstructedSignalEnergy;
+    delete fHistFracSignalVsNClusters;
+    delete fHistFracHadronsVsNClusters;
+    delete fHistFracNeutronsVsNClusters;
+    delete fHistFracKaonsVsNClusters;
+    delete fHistFracSecondariesVsNClusters;
+    delete fHistFracSignalVsNMultiplicity;
+    delete fHistFracHadronsVsNMultiplicity;
+    delete fHistFracNeutronsVsNMultiplicity;
+    delete fHistFracKaonsVsNMultiplicity;
+    delete fHistFracSecondariesVsNMultiplicity;
+    delete fHistFracSignalVsNMatchedTracks;
+    delete fHistFracHadronsVsNMatchedTracks;
+    delete fHistFracNeutronsVsNMatchedTracks;
+    delete fHistFracKaonsVsNMatchedTracks;
+    delete fHistFracSecondariesVsNMatchedTracks;
+    delete fHistFracSignalVsNTotalTracks;
+    delete fHistFracHadronsVsNTotalTracks;
+    delete fHistFracNeutronsVsNTotalTracks;
+    delete fHistFracKaonsVsNTotalTracks;
+    delete fHistFracSecondariesVsNTotalTracks;
 }
 
 Int_t AliAnalysisEtMonteCarlo::AnalyseEvent(AliVEvent* ev)
@@ -426,7 +655,7 @@ Int_t AliAnalysisEtMonteCarlo::AnalyseEvent(AliVEvent* ev)
     fPiZeroMult = 0;
     if (fCentrality)
     {
-        fCentClass = fCentrality->GetCentralityClass10(fCentralityMethod);
+        fCentClass = fCentrality->GetCentralityClass5(fCentralityMethod);
 
     }
 
@@ -460,6 +689,7 @@ Int_t AliAnalysisEtMonteCarlo::AnalyseEvent(AliVEvent* ev)
     AliStack *stack = event->Stack();
 
     Int_t nPrim = stack->GetNtrack();
+    //cout<<endl<<endl<<"new event simulated nPrim "<<nPrim<<endl;
 
     Int_t partCount = 0;
     for (Int_t iPart = 0; iPart < nPrim; iPart++)
@@ -497,7 +727,7 @@ Int_t AliAnalysisEtMonteCarlo::AnalyseEvent(AliVEvent* ev)
         {
 
             fMultiplicity++;
-//             PrintFamilyTree(iPart, stack);
+             //PrintFamilyTreeShort(iPart, stack);
 //
             if (TMath::Abs(part->Eta()) < fCuts->GetCommonEtaCut())
             {
@@ -522,57 +752,8 @@ Int_t AliAnalysisEtMonteCarlo::AnalyseEvent(AliVEvent* ev)
                 Double_t et = part->Energy() * TMath::Sin(part->Theta()) + particleMassPart;
 
 
-//                 // Fill up total E_T counters for each particle species
-//                 if (code == fgProtonCode || code == fgAntiProtonCode)
-//                 {
-//                 }
-//                 if (code == fgPiPlusCode || code == fgPiMinusCode)
-//                 {
-//                     if (code == fgPiPlusCode)
-//                     {
-//                     }
-//                     else
-//                     {
-//                     }
-//                 }
-//                 if (code == fgGammaCode)
-//                 {
-//                 }
-//                 if (code == fgKPlusCode)
-//                 {
-//                 }
-//                 if(code == fgKMinusCode)
-//                 {
-//                 }
-//                 if (code == fgMuPlusCode || code == fgMuMinusCode)
-//                 {
-//                 }
-//                 if (code == fgEPlusCode || code == fgEMinusCode)
-//                 {
-//                 }
-//                 // some neutrals also
-//                 if (code == fgNeutronCode)
-//                 {
-//                 }
-//                 if (code == fgAntiNeutronCode)
-//                 {
-//                 }
-//                 if (code == fgGammaCode)
-//                 {
-//                 }
-
-                // Neutral particles
-                //if (TMath::Abs(pdg->Charge() - fCuts->GetMonteCarloNeutralParticle()) <1e-3 )
-
                 if(code == fgGammaCode || code == fgPi0Code || code == fgEtaCode)
                 {
-               //  PrintFamilyTree(iPart,stack);
-                    //Printf("Gamma, phi: %f, eta: %f, phi cut min: %f, phi cut max: %f, eta cut: %f", part->Phi(), part->Eta(), fPhiMinCutAcc, fPhiMaxCutAcc, fEtaCutAcc);
-                    //if (et > fCuts->GetCommonClusterEnergyCut()) fTotNeutralEt += et;
-
-                    // inside EMCal acceptance
-
-                    //if (TMath::Abs(part->Eta()) < fEtaCutAcc && part->Phi() < fPhiMaxCutAcc && part->Phi() > fPhiMinCutAcc)
 
                     if(fSelector->CutGeometricalAcceptance(*part) )
                     {
@@ -633,7 +814,6 @@ Int_t AliAnalysisEtMonteCarlo::AnalyseEvent(AliVEvent* ev)
     //std::cout << "Event done! # of particles: " << partCount << std::endl;
     return 0;
 }
-//Int_t AliAnalysisEtMonteCarlo::AnalyseEvent(AliMCEvent* mcEvent,AliESDEvent* realEvent)
 Int_t AliAnalysisEtMonteCarlo::AnalyseEvent(AliVEvent* ev,AliVEvent* ev2)
 {   // analyse MC and real event info
     //if(!mcEvent || !realEvent){
@@ -658,33 +838,87 @@ Int_t AliAnalysisEtMonteCarlo::AnalyseEvent(AliVEvent* ev,AliVEvent* ev2)
 
     AliStack *stack = mcEvent->Stack();
 
-    // get all detector clusters
-    //  TRefArray* caloClusters = new TRefArray();
+    TObjArray* list = fEsdtrackCutsTPC->GetAcceptedTracks(realEvent);
+    Int_t nGoodTracks = list->GetEntries();
 
-//    if (fDetector == fCuts->GetDetectorEmcal()) realEvent->GetEMCALClusters( caloClusters );
-    //else if (fDetector == fCuts->GetDetectorPhos()) realEvent->GetPHOSClusters( caloClusters );
-    //else {
-    //AliFatal("Detector ID has not been specified");
-    //return -1;
-//    }
-
-//Note that this only returns clusters for the selected detector.  fSelector actually calls the right GetClusters... for the detector
-//It does not apply any cuts on these clusters
+    //Note that this only returns clusters for the selected detector.  fSelector actually calls the right GetClusters... for the detector
+    //It does not apply any cuts on these clusters
     TRefArray *caloClusters = fSelector->GetClusters();
 
     Int_t nCluster = caloClusters->GetEntries();
     fClusterMult = nCluster;
+
+    //cout<<endl<<"new event reconstructed nclusters "<<nCluster<<endl;
     fNClusters = 0;
     Int_t fClusterMultChargedTracks = 0;
     Int_t fClusterMultGammas = 0;
+    Int_t nChargedSecondariesRemoved = 0;
+    Int_t nChargedSecondariesNotRemoved = 0;
+    Int_t nNeutralSecondariesRemoved = 0;
+    Int_t nNeutralSecondariesNotRemoved = 0;
+    Int_t nNeutrons = 0;
+    Int_t nNotNeutrons = 0;
+    //All efficiency corrected except etSecondaries -->
+    Float_t etPiKPDeposited = 0.0;//
+    Float_t etPiKPDepositedNotTrackMatched = 0.0;//
+    Float_t etProtonDepositedNotTrackMatched = 0.0;//
+    Float_t etAntiProtonDepositedNotTrackMatched = 0.0;//
+    Float_t etProtonDepositedNotTrackMatchedNoEffCorr = 0.0;//
+    Float_t etAntiProtonDepositedNotTrackMatchedNoEffCorr = 0.0;//
+    //Float_t etPIDProtonDepositedNotTrackMatched = 0.0;//Still has to be filled!
+    //1Float_t etPIDAntiProtonDepositedNotTrackMatched = 0.0;//Still has to be filled
+    Float_t etProtonDeposited = 0.0;//
+    Float_t etAntiProtonDeposited = 0.0;//
+    Float_t etNeutronDeposited = 0.0;
+    Float_t etAntiNeutronDeposited = 0.0;
+    Float_t etSecondaries = 0.0;
+    Float_t etSecondariesEffCorr = 0.0;
+    Float_t etSecondariesOutOfAccEffCorr = 0.0;
+    Float_t etSecondariesDetectorCoverEffCorr = 0.0;
+    Float_t etProtonDepositedNoEffCorr = 0.0;//
+    Float_t etAntiProtonDepositedNoEffCorr = 0.0;//
+    Float_t etNeutronDepositedNoEffCorr = 0.0;
+    Float_t etAntiNeutronDepositedNoEffCorr = 0.0;
+    Float_t etGammaCrossCheck = 0.0;
+    Float_t etGammaCrossCheckAlt = 0.0;
+//     Float_t etNeutronCrossCheck = 0.0;
+//     Float_t etSecondaryCrossCheck = 0.0;
+//     Float_t etHadronCrossCheck = 0.0;
+//     Float_t etKaonCrossCheck = 0.0;
+    Float_t etGammaCrossCheckTrue = 0.0;//--
+    Float_t etNeutronCrossCheckTrue = 0.0;//--
+    Float_t etSecondaryCrossCheckTrue = 0.0;//--
+    Float_t etHadronCrossCheckTrue = 0.0;//--
+    Float_t etKaonCrossCheckTrue = 0.0;//
+    Float_t multiplicity = fEsdtrackCutsTPC->GetReferenceMultiplicity(realEvent,kTRUE);
+
+    Float_t subtotalAllEnergy = 0.0;//energy of all clusters passing cuts vs centrality
+    Float_t subtotalSignalEnergy = 0.0;//signal of signal clusters passing cuts vs centrality
+    Float_t subtotalNeutronEnergy = 0.0;//signal of neutron clusters passing cuts vs centrality
+    Float_t subtotalKaonEnergy = 0.0;//signal of kaon clusters passing cuts vs centrality
+    Float_t subtotalHadronEnergy = 0.0;//signal of hadron clusters passing cuts vs centrality
+    Float_t subtotalSecondaryEnergy = 0.0;//signal of secondary clusters passing cuts vs centrality
+    Float_t subtotalSecondaryChargedEnergy = 0.0;//signal of secondary clusters passing cuts vs centrality
+    Float_t subtotalSecondaryNeutronEnergy = 0.0;//signal of secondary clusters passing cuts vs centrality
+    Float_t subtotalSecondaryGammaEnergy = 0.0;//signal of secondary clusters passing cuts vs centrality
+    Float_t subtotalSecondaryElectronEnergy = 0.0;//signal of secondary clusters passing cuts vs centrality
+    Float_t subtotalSecondaryOtherEnergy = 0.0;//signal of secondary clusters passing cuts vs centrality
+    Float_t subtotalSimulatedGammaEnergy = 0.0;//signal of signal clusters passing cuts vs centrality
+    Float_t subtotalSimulatedGammaEnergyAboveThreshold = 0.0;//signal of signal clusters passing cuts vs centrality
+    Float_t subtotalReconstructedGammaEnergy = 0.0;//signal of signal clusters passing cuts vs centrality
+    Float_t subtotalReconstructedSignalEnergy = 0.0;//signal of signal clusters passing cuts vs centrality
+
     // loop the clusters
     for (int iCluster = 0; iCluster < nCluster; iCluster++ )
     {
         Int_t cf = 0;
         AliESDCaloCluster* caloCluster = ( AliESDCaloCluster* )caloClusters->At( iCluster );
         //Float_t caloE = caloCluster->E()
+        if (!fSelector->CutGeometricalAcceptance(*caloCluster)) continue;
         fNClusters++;
-        const UInt_t iPart = (UInt_t)TMath::Abs(caloCluster->GetLabel());
+        //const UInt_t iPart = (UInt_t)TMath::Abs(fSelector->GetLabel(caloCluster));//->GetLabel());
+       const UInt_t iPart = fSelector->GetLabel(caloCluster,stack);
+       //const UInt_t iPart = (UInt_t)TMath::Abs(caloCluster->GetLabel());
         TParticle *part  =  stack->Particle(iPart);
 
         if (!part)
@@ -705,8 +939,8 @@ Int_t AliAnalysisEtMonteCarlo::AnalyseEvent(AliVEvent* ev,AliVEvent* ev2)
            //if it is from a K0S
             if(primIdx < 0)
             {
-             std::cout << "What!? No primary?" << std::endl;
-             PrintFamilyTree(iPart, stack);
+             //std::cout << "What!? No primary?" << std::endl;
+             //PrintFamilyTree(iPart, stack);
              //continue;
              //This is a work around to fix a bug.  For the EMCal when you use the tender supply, the parent particle ID gets messed up.
              primIdx = iPart;
@@ -732,41 +966,69 @@ Int_t AliAnalysisEtMonteCarlo::AnalyseEvent(AliVEvent* ev,AliVEvent* ev2)
        Float_t matchedTrackpt = 0.0;
        nottrackmatched = fSelector->PassTrackMatchingCut(*caloCluster);
        //by default ALL matched tracks are accepted, whether or not the match is good.  So we check to see if the track is good.
-       if(!nottrackmatched){
+       if(!nottrackmatched){//if the track is trackmatched
          Int_t trackMatchedIndex = caloCluster->GetTrackMatchedIndex();
          if(trackMatchedIndex < 0) nottrackmatched=kTRUE;
          AliESDtrack *track = realEvent->GetTrack(trackMatchedIndex);
          matchedTrackp = track->P();
          matchedTrackpt = track->Pt();
          //if this is a good track, accept track will return true.  The track matched is good, so not track matched is false
-         nottrackmatched = !(fEsdtrackCutsTPC->AcceptTrack(track));
+         nottrackmatched = !(fEsdtrackCutsTPC->AcceptTrack(track));//if the track is bad, this is track matched
          //if(!nottrackmatched) cout<<"Matched track p: "<<matchedTrackp<<" sim "<<part->P()<<endl;
        }
      
-
+       Bool_t containsGamma = kFALSE;
+       //Int_t gammaCode = -1;
+       Float_t gammaEnergy = 0.0;
        for(UInt_t i = 0; i < caloCluster->GetNLabels(); i++)
        {
          Int_t pIdx = caloCluster->GetLabelAt(i);
+         //Int_t initialLabel = pIdx;
          //TParticle *p = stack->Particle(pIdx);
          
          if(!stack->IsPhysicalPrimary(pIdx))
-         {
-//         PrintFamilyTree(pIdx, stack);
-           pIdx = GetPrimMother(pIdx, stack);
-         }
+           {//This should count gammas as reconstructed if we found even part of them
+             pIdx = GetPrimMother(pIdx, stack);
+             //TParticle *part2  =  stack->Particle(initialLabel);
+//           TParticle *part2  =  stack->Particle(pIdx);
+//           if(part2){
+//             TParticlePDG *pdg2 = part2->GetPDG();
+//             if(pdg2){
+//               Int_t code2 = pdg2->PdgCode();
+//               if(code2 == fgGammaCode){
+//                 cout<<"Relabeling primary index initial label "<<initialLabel<<" final label "<<pIdx<<endl;
+//                 PrintFamilyTree(initialLabel, stack);
+//               }
+//             }
+//           }
+           }
          if(fSelector->PassDistanceToBadChannelCut(*caloCluster))//&&fSelector->CutGeometricalAcceptance(*(stack->Particle(primIdx))))
          {
-
-//         std::cout << "Gamma primary: " << primIdx << std::endl;
-//         foundGammas.push_back(primIdx); 
-           if(nottrackmatched){
-             foundGammas.push_back(pIdx); 
+           //if this contained a gamma...
+           if(pIdx>0){
+             TParticle *part2  =  stack->Particle(pIdx);
+             if(part2){
+               TParticlePDG *pdg2 = part2->GetPDG();
+               if(pdg2){
+                 Int_t code2 = pdg2->PdgCode();
+                 if(code2 == fgGammaCode){//if this is counted as a reconstructed gamma, we want to know what was reconstructed about it
+                   //gammaCode = pIdx;
+                   containsGamma = kTRUE;
+                   gammaEnergy += part2->Energy();//do += because if we have multiple gammas we want to add that to our reconstructed gamma energy, even if we didn't separat them
+                 }
+               }
+             }
+             //            std::cout << "Gamma primary: " << primIdx << std::endl;
+             //            foundGammas.push_back(primIdx); 
+             if(nottrackmatched){
+               foundGammas.push_back(pIdx); 
+             }
            }
          }
        }
        fCutFlow->Fill(cf++);
         if(!fSelector->PassDistanceToBadChannelCut(*caloCluster)) continue;
-        Double_t clEt = CorrectForReconstructionEfficiency(*caloCluster,fClusterMult);
+        Double_t clEt = CorrectForReconstructionEfficiency(*caloCluster,fCentClass);
 //     if(code == fgK0SCode) std::cout << "K0 energy: " << caloCluster->E() << std::endl;
         if(!fSelector->PassMinEnergyCut(*caloCluster)) continue;
 
@@ -779,7 +1041,7 @@ Int_t AliAnalysisEtMonteCarlo::AnalyseEvent(AliVEvent* ev,AliVEvent* ev2)
 
         TParticle *primPart = stack->Particle(primIdx);
         fPrimaryCode = primPart->GetPdgCode();
-        fPrimaryCharge = (Int_t) primPart->GetPDG()->Charge();
+        if(primPart->GetPDG()) fPrimaryCharge = (Int_t) primPart->GetPDG()->Charge();
 
         fPrimaryE = primPart->Energy();
         fPrimaryEt = primPart->Energy()*TMath::Sin(primPart->Theta());
@@ -797,23 +1059,31 @@ Int_t AliAnalysisEtMonteCarlo::AnalyseEvent(AliVEvent* ev,AliVEvent* ev2)
         fDepositedCode = part->GetPdgCode();
        fDepositedE = part->Energy();
         fDepositedEt = part->Energy()*TMath::Sin(part->Theta());
-        fDepositedCharge = (Int_t) part->GetPDG()->Charge();
+        if(part->GetPDG()) fDepositedCharge = (Int_t) part->GetPDG()->Charge();
 
         fDepositedVx = part->Vx();
         fDepositedVy = part->Vy();
         fDepositedVz = part->Vz();
+       fReconstructedE = caloCluster->E();
+       fReconstructedEt = caloCluster->E()*TMath::Sin(cp.Theta());
+
+       if(nottrackmatched) subtotalAllEnergy += fReconstructedEt;
 
        //fSecondary = fSelector->FromSecondaryInteraction(*primPart, *stack);
-       fSecondary =fSelector->FromSecondaryInteraction(*part, *stack);
+       fSecondary =fSelector->FromSecondaryInteraction(iPart, *stack);
+       //if(fSecondary && fReconstructedEt<0.3) fSecondary = kFALSE;//patch to do quick cross check THIS SHOULD NOT GET COMMITTED!!!  IF IT DID YELL AT CHRISTINE ASAP
 //     if(fSecondary) 
 //     {
 //       //std::cout << "Have secondary!" << std::endl;
 //       //PrintFamilyTree(iPart, stack);
 //     }
-       fReconstructedE = caloCluster->E();
-       fReconstructedEt = caloCluster->E()*TMath::Sin(cp.Theta());
        
        pdg = primPart->GetPDG(0);
+        if (!pdg)
+        {
+            Printf("ERROR: Could not get particle PDG %d", iPart);
+            continue;
+        }
        //Int_t code = primPart->GetPdgCode();
 
        Bool_t written = kFALSE;
@@ -830,37 +1100,42 @@ Int_t AliAnalysisEtMonteCarlo::AnalyseEvent(AliVEvent* ev,AliVEvent* ev2)
 //     }
 
        if(fSecondary){//all particles from secondary interactions 
+         //===================================BEGIN SECONDARIES==================================================
          written = kTRUE;
-         if(nottrackmatched){//secondaries not removed
-           if (fDepositedCharge != 0){//charged track not removed
-             fChargedNotRemoved++;
-             fEnergyChargedNotRemoved += clEt;
-             fHistRemovedOrNot->Fill(2.0, fCentClass);
-             fHistDxDzNonRemovedCharged->Fill(caloCluster->GetTrackDx(), caloCluster->GetTrackDz());
-           }
-           else{
-             fSecondaryNotRemoved++;
-           }
-         }
-         else{//secondaries removed
-            if (fDepositedCharge != 0){
+
+         if (fDepositedCharge != 0 && fDepositedCode!=fgEMinusCode && fDepositedCode!=fgEPlusCode){//if the particle hitting the calorimeter is pi/k/p/mu
+         //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%BEGIN CHARGED SECONDARIES%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+           fHistChargedTrackDepositsAllVsPt->Fill(part->Pt(), fCentClass,fReconstructedEt);
+           fHistChargedTrackDepositsAllVsPtEffCorr->Fill(part->Pt(), fCentClass,clEt);
+           if(!nottrackmatched){//if it is track matched
+//           cout<<"Charged Secondary ";
+//           PrintFamilyTreeShort(iPart, stack);
+             fHistChargedTrackDepositsAcceptedVsPt->Fill(part->Pt(), fCentClass,fReconstructedEt);
+             fHistChargedTrackDepositsAcceptedVsPtEffCorr->Fill(part->Pt(), fCentClass,fReconstructedEt);
+             fHistHadronDepositsReco->Fill(part->Pt());
+             fHistHadronDepositsRecoCent->Fill(part->Pt(), fCentClass);
+             fHistHadronDepositsRecovsECent->Fill(fReconstructedE, fCentClass);
              fChargedRemoved++;
              fEnergyChargedRemoved += clEt;
              fHistRemovedOrNot->Fill(0.0, fCentClass);
              fHistDxDzRemovedCharged->Fill(caloCluster->GetTrackDx(), caloCluster->GetTrackDz());
-             fHistChargedTracksCut->Fill(fDepositedEt);
+             fHistChargedRemovedSecondaryEtVsCent->Fill(fReconstructedEt,fCentClass);
+             nChargedSecondariesRemoved++;
+             fHistChargedTracksCut->Fill(fReconstructedEt);
              if(fCalcTrackMatchVsMult){
-               fHistChargedTracksCutMult->Fill(fDepositedEt,fClusterMult);
-               if(fClusterMult<25){fHistChargedTracksCutPeripheral->Fill(fDepositedEt);}
+               fHistChargedTracksCutMult->Fill(fReconstructedEt,fClusterMult);
+               if(fClusterMult<25){fHistChargedTracksCutPeripheral->Fill(fReconstructedEt);}
              }
              fHistMatchedTracksEvspTBkgd->Fill(matchedTrackp,fReconstructedE);
              if(fCalcTrackMatchVsMult){
-               if(fClusterMult<25){fHistMatchedTracksEvspTBkgdPeripheral->Fill(matchedTrackp,fReconstructedEt);}
-               fHistMatchedTracksEvspTBkgdvsMult->Fill(matchedTrackp,fReconstructedEt,fClusterMult);
-               fHistMatchedTracksEvspTBkgdvsMultEffCorr->Fill(matchedTrackp,clEt,fClusterMult);//Fill with the efficiency corrected energy
+                 if(fClusterMult<25){fHistMatchedTracksEvspTBkgdPeripheral->Fill(matchedTrackp,fReconstructedEt);}
+                 fHistMatchedTracksEvspTBkgdvsCent->Fill(matchedTrackp,fReconstructedEt, fCentClass);
+                 fHistMatchedTracksEvspTBkgdvsCentEffCorr->Fill(matchedTrackp,clEt, fCentClass);//Fill with the efficiency corrected energy
              }
-             Int_t trackindex = (caloCluster->GetLabelsArray())->At(1);
-             if(caloCluster->GetLabel()!=trackindex){
+             //Int_t trackindex = (caloCluster->GetLabelsArray())->At(1);
+             UInt_t trackindex = fSelector->GetLabel(caloCluster,stack);//(caloCluster->GetLabelsArray())->At(1);
+             if(((UInt_t)caloCluster->GetLabel())!=trackindex){
+               //if(fSelector->GetLabel(caloCluster,stack) !=trackindex){
                fHistBadTrackMatches->Fill(part->Pt(),fReconstructedE);
                fHistBadTrackMatchesdPhidEta->Fill(caloCluster->GetTrackDx(),caloCluster->GetTrackDz());
                //cout<<"Track matched, label cluster "<<caloCluster->GetLabel()<<" track "<<trackindex<<endl;
@@ -869,42 +1144,170 @@ Int_t AliAnalysisEtMonteCarlo::AnalyseEvent(AliVEvent* ev,AliVEvent* ev2)
                fHistGoodTrackMatchesdPhidEta->Fill(caloCluster->GetTrackDx(),caloCluster->GetTrackDz());
              }
            }
-           else{//neutral energy removed
-             fNeutralRemoved++;
-             fEnergyNeutralRemoved += clEt;
-             fHistRemovedOrNot->Fill(1.0, fCentClass);
-             fHistDxDzRemovedNeutral->Fill(caloCluster->GetTrackDx(), caloCluster->GetTrackDz());
+           else{
+             fChargedNotRemoved++;
+             fEnergyChargedNotRemoved += clEt;
+             fHistRemovedOrNot->Fill(2.0, fCentClass);
+             fHistDxDzNonRemovedCharged->Fill(caloCluster->GetTrackDx(), caloCluster->GetTrackDz());
+             fHistChargedNotRemovedSecondaryEtVsCent->Fill(fReconstructedEt,fCentClass);
+             nChargedSecondariesNotRemoved++;
            }
+           fHistHadronDepositsAll->Fill(part->Pt());
+           fHistHadronDepositsAllCent->Fill(part->Pt(), fCentClass);
+           fHistHadronDepositsAllvsECent->Fill(fReconstructedE, fCentClass);
+         //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%END CHARGED SECONDARIES%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
          }
-       }
-       else{
-
+         else{
+         //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%BEGIN NEUTRAL SECONDARIES%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+           if(nottrackmatched){//secondaries not removed
+//           cout<<"Neutral Secondary ";
+//           PrintFamilyTreeShort(iPart, stack);
+
+             subtotalSecondaryEnergy += fReconstructedEt;
+             Bool_t tmpIsWritten = kFALSE;
+             if(fDepositedCode==fgProtonCode ||  fDepositedCode==fgAntiProtonCode || fDepositedCode==fgPiPlusCode || fDepositedCode==fgPiMinusCode || fDepositedCode==fgKPlusCode || fDepositedCode==fgKMinusCode){
+               subtotalSecondaryChargedEnergy += fReconstructedEt;
+               tmpIsWritten = kTRUE;
+             }
+             if(fDepositedCode==fgNeutronCode ||  fDepositedCode==fgAntiNeutronCode){
+               subtotalSecondaryNeutronEnergy += fReconstructedEt;
+               tmpIsWritten = kTRUE;
+             }
+             if(fDepositedCode==fgGammaCode){
+               subtotalSecondaryNeutronEnergy += fReconstructedEt;
+               tmpIsWritten = kTRUE;
+             }
+             if(fDepositedCode==fgEPlusCode || fDepositedCode==fgEMinusCode){
+               subtotalSecondaryElectronEnergy += fReconstructedEt;
+               tmpIsWritten = kTRUE;
+             }
+             if(!tmpIsWritten){
+               subtotalSecondaryOtherEnergy += fReconstructedEt;
+             }
+             
+             if(!fSelector->CutGeometricalAcceptance(*part)){
+               if(TMath::Sqrt(part->Vx() * part->Vx() + part->Vy() * part->Vy() + part->Vz()* part->Vz())>100){
+                 etSecondariesOutOfAccEffCorr += clEt;
+               }
+             }
+             else{
+               if(TMath::Sqrt(part->Vx() * part->Vx() + part->Vy() * part->Vy() + part->Vz()* part->Vz())>430){
+                 //clusters which are in the cover of the PHOS/EMCal
+                 etSecondariesDetectorCoverEffCorr += clEt;
+               }
+             }
+             fSecondaryClusterEnergy->Fill(fReconstructedEt);
+             fHistSecondaryPositionInDetector->Fill(part->Vx(),part->Vy(),part->Vz());
+             fSecondaryNotRemoved++;
+             etSecondaries += fReconstructedEt;
+             etSecondariesEffCorr += clEt;
+             fHistNeutralNotRemovedSecondaryEtVsCent->Fill(fReconstructedEt,fCentClass);
+             nNeutralSecondariesNotRemoved++;
+           }
+           else{//secondaries removed
+               fNeutralRemoved++;
+               fEnergyNeutralRemoved += clEt;
+               fHistRemovedOrNot->Fill(1.0, fCentClass);
+               fHistDxDzRemovedNeutral->Fill(caloCluster->GetTrackDx(), caloCluster->GetTrackDz());
+               fHistNeutralRemovedSecondaryEtVsCent->Fill(fReconstructedEt,fCentClass);
+               
+               nNeutralSecondariesRemoved++;
+           }
+         }//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%END NEUTRAL SECONDARIES%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+       }//===================================END SECONDARIES==================================================
+       else{//not a secondary
+         //===================================BEGIN CHARGED TRACKS==================================================
          if (fDepositedCharge != 0 && fDepositedCode!=fgEMinusCode && fDepositedCode!=fgEPlusCode){//if the particle hitting the calorimeter is pi/k/p/mu
+//           cout<<"Hadron ";
+//           PrintFamilyTreeShort(iPart, stack);
+           fHistChargedTrackDepositsAllVsPt->Fill(part->Pt(), fCentClass,fReconstructedEt);
+           fHistChargedTrackDepositsAllVsPtEffCorr->Fill(part->Pt(), fCentClass,clEt);
+
            written = kTRUE;
            fClusterMultChargedTracks++;
+           etPiKPDeposited += clEt;
+           if(fDepositedCode==fgProtonCode){
+             etProtonDeposited += clEt;
+             etProtonDepositedNoEffCorr += fReconstructedEt;
+           }
+           if(fDepositedCode==fgAntiProtonCode){
+             etAntiProtonDeposited += clEt;
+             etAntiProtonDepositedNoEffCorr += fReconstructedEt;
+           }
            if(nottrackmatched){//not removed but should be
+             subtotalHadronEnergy += fReconstructedEt;
+             etHadronCrossCheckTrue += clEt;
+             etPiKPDepositedNotTrackMatched += clEt;
+             if(fDepositedCode==fgProtonCode){
+               etProtonDepositedNotTrackMatched += clEt;
+               etProtonDepositedNotTrackMatchedNoEffCorr += fReconstructedEt;
+             }
+             if(fDepositedCode==fgAntiProtonCode){
+               etAntiProtonDepositedNotTrackMatched += clEt;
+               etAntiProtonDepositedNotTrackMatchedNoEffCorr += fReconstructedEt;
+             }
              fHistHadronDepositsAll->Fill(part->Pt());
-             fHistHadronDepositsAllMult->Fill(part->Pt(),fClusterMult);
+             fHistHadronDepositsAllCent->Fill(part->Pt(), fCentClass);//denominator in track matching efficiency
+             //we want this to be all hadrons where we actually reconstructed and would accept the track
+
+             for (Int_t iTrack = 0; iTrack < nGoodTracks; iTrack++){
+               AliESDtrack *track = dynamic_cast<AliESDtrack*> (list->At(iTrack));
+               if (!track){
+                 Printf("ERROR: Could not get track %d", iTrack);
+                 continue;
+               }
+               else{
+                 if((Int_t)fSelector->GetLabel(caloCluster,stack)==track->GetLabel()){//then we found the track from the particle that created this
+                   fHistHadronDepositsAllvsECent->Fill(fReconstructedE, fCentClass);
+                 }
+               }
+             }
+             if(fReconstructedEt>0.5) fHistHadronDepositsAllCent500MeV->Fill(part->Pt(), fCentClass);
              fChargedNotRemoved++;
              fEnergyChargedNotRemoved += clEt;
              fHistRemovedOrNot->Fill(2.0, fCentClass);
              fHistDxDzNonRemovedCharged->Fill(caloCluster->GetTrackDx(), caloCluster->GetTrackDz());
-             fHistChargedTracksAccepted->Fill(fDepositedEt);
+             fHistChargedTracksAccepted->Fill(fReconstructedEt);
              if(fCalcTrackMatchVsMult){
                if(matchedTrackpt<0.5){//if we could never have matched this because of its pt, how much energy did it deposit?
-                 fHistChargedTracksAcceptedLowPtMult->Fill(fDepositedEt,fClusterMult);
+                 fHistChargedTracksAcceptedLowPtCent->Fill(fReconstructedEt, fCentClass);
+                 fHistChargedTracksAcceptedLowPtCentEffCorr->Fill(clEt, fCentClass);
+                 if(fReconstructedEt>=0.5) fHistChargedTracksAcceptedLowPtCent500MeV->Fill(fReconstructedEt, fCentClass);
+                 if(pdg && pdg->PdgCode()!=fgAntiProtonCode){
+                   fHistChargedTracksAcceptedLowPtCentNoAntiProtons->Fill(fReconstructedEt, fCentClass);
+                 }
+                 else{
+                   fHistChargedTracksAcceptedLowPtCentAntiProtons->Fill(fReconstructedEt, fCentClass);
+                 }
                }
-               fHistChargedTracksAcceptedMult->Fill(fDepositedEt,fClusterMult);
-               if(fClusterMult<25){fHistChargedTracksAcceptedPeripheral->Fill(fDepositedEt);}
+               fHistChargedTracksAcceptedMult->Fill(fReconstructedEt,fClusterMult);
+               if(fClusterMult<25){fHistChargedTracksAcceptedPeripheral->Fill(fReconstructedEt);}
              }
            }
            else{//removed and should have been
-             Int_t trackindex = (caloCluster->GetLabelsArray())->At(0);
+             //cout<<" t.m. primary"<<endl;
+             Int_t trackindex =  fSelector->GetLabel(caloCluster,stack);// (caloCluster->GetLabelsArray())->At(0);
+             fHistChargedTrackDepositsAcceptedVsPt->Fill(part->Pt(), fCentClass,fReconstructedEt);
+             fHistChargedTrackDepositsAcceptedVsPtEffCorr->Fill(part->Pt(), fCentClass,clEt);
              fHistHadronDepositsReco->Fill(part->Pt());
-             fHistHadronDepositsRecoMult->Fill(part->Pt(),fClusterMult);
+             fHistHadronDepositsRecoCent->Fill(part->Pt(), fCentClass);
+             fHistHadronDepositsRecovsECent->Fill(fReconstructedE, fCentClass);
              fHistHadronDepositsAll->Fill(part->Pt());
-             fHistHadronDepositsAllMult->Fill(part->Pt(),fClusterMult);
-             if(caloCluster->GetLabel()!=trackindex){
+             fHistHadronDepositsAllCent->Fill(part->Pt(), fCentClass);
+             for (Int_t iTrack = 0; iTrack < nGoodTracks; iTrack++){
+               AliESDtrack *track = dynamic_cast<AliESDtrack*> (list->At(iTrack));
+               if (!track){
+                 Printf("ERROR: Could not get track %d", iTrack);
+                 continue;
+               }
+               else{
+                 if((Int_t) fSelector->GetLabel(caloCluster,stack)==track->GetLabel()){//then we found the track from the particle that created this
+                   fHistHadronDepositsAllvsECent->Fill(fReconstructedE, fCentClass);
+                 }
+               }
+             }
+             if(fReconstructedEt>0.5) fHistHadronDepositsAllCent500MeV->Fill(part->Pt(), fCentClass);
+             if((Int_t)fSelector->GetLabel(caloCluster,stack)!= trackindex){
                fHistBadTrackMatches->Fill(part->Pt(),fReconstructedE);
                fHistBadTrackMatchesdPhidEta->Fill(caloCluster->GetTrackDx(),caloCluster->GetTrackDz());
                //cout<<"Track matched, label cluster "<<caloCluster->GetLabel()<<" track "<<trackindex<<endl;
@@ -916,28 +1319,50 @@ Int_t AliAnalysisEtMonteCarlo::AnalyseEvent(AliVEvent* ev,AliVEvent* ev2)
              fEnergyChargedRemoved += clEt;
              fHistRemovedOrNot->Fill(0.0, fCentClass);
              fHistDxDzRemovedCharged->Fill(caloCluster->GetTrackDx(), caloCluster->GetTrackDz());
-             fHistChargedTracksCut->Fill(fDepositedEt);
+             fHistChargedTracksCut->Fill(fReconstructedEt);
              if(fCalcTrackMatchVsMult){
-               fHistChargedTracksCutMult->Fill(fDepositedEt,fClusterMult);
-               if(fClusterMult<25){fHistChargedTracksCutPeripheral->Fill(fDepositedEt);}
+               fHistChargedTracksCutMult->Fill(fReconstructedEt,fClusterMult);
+               if(fClusterMult<25){fHistChargedTracksCutPeripheral->Fill(fReconstructedEt);}
              }
              fHistMatchedTracksEvspTBkgd->Fill(matchedTrackp,fReconstructedE);
              if(fCalcTrackMatchVsMult){
                if(fClusterMult<25){fHistMatchedTracksEvspTBkgdPeripheral->Fill(matchedTrackp,fReconstructedEt);}
-               fHistMatchedTracksEvspTBkgdvsMult->Fill(matchedTrackp,fReconstructedEt,fClusterMult);
-               fHistMatchedTracksEvspTBkgdvsMultEffCorr->Fill(matchedTrackp,clEt,fClusterMult);//fill with the efficiency corrected energy
+               fHistMatchedTracksEvspTBkgdvsCent->Fill(matchedTrackp,fReconstructedEt, fCentClass);
+               fHistMatchedTracksEvspTBkgdvsCentEffCorr->Fill(matchedTrackp,clEt, fCentClass);//fill with the efficiency corrected energy
              }
            }
          }
+         //===================================END CHARGED TRACKS==================================================
+         //===================================BEGIN KAONS==================================================
          //K0L and any neutral particles from the decay of K+/- or K0S
-         if(!written && (fPrimaryCode==fgKPlusCode || fPrimaryCode==fgKMinusCode || fPrimaryCode==fgK0SCode ||fPrimaryCode==fgK0LCode)){
+         if(!written && (fPrimaryCode==fgKPlusCode || fPrimaryCode==fgKMinusCode || fPrimaryCode==fgK0SCode ||fPrimaryCode==fgK0LCode) && nottrackmatched){
+//         cout<<"Kaon ";
+//         PrintFamilyTreeShort(iPart, stack);
+
+           etKaonCrossCheckTrue += clEt;
+           subtotalKaonEnergy += fReconstructedEt;
+           //etKaonCrossCheckTrue += fReconstructedEt;
            written = kTRUE;//At this point we are not tracking them but we don't count them as neutrals accidentally removed
          }
-         
+         //===================================END KAONS==================================================
+         //===================================BEGIN SIGNAL==================================================
          if(!written && (fDepositedCode==fgGammaCode || fDepositedCode==fgEMinusCode || fDepositedCode ==fgEPlusCode)){//if the particle hitting the calorimeter is gamma, electron and not from a kaon
+//         cout<<"Signal ";
+//         PrintFamilyTreeShort(iPart, stack);
+
            fClusterMultGammas++;
            written = kTRUE;
            if(nottrackmatched){//Not removed and not supposed to be removed - signal
+             subtotalSignalEnergy += fReconstructedEt;
+             subtotalReconstructedSignalEnergy += fReconstructedEt;
+             if(fPrimaryCode==fgGammaCode){//if this comes from a primary electron - this is for reconstruction efficiency
+               subtotalReconstructedGammaEnergy += fReconstructedEt;
+             }
+//           else{
+//             if(fPrimaryCode!=fgEMinusCode && fPrimaryCode !=fgEPlusCode){
+//               PrintFamilyTreeShort(iPart, stack);
+//             }
+//           }
              fEtNonRemovedGammas += clEt;
              fMultNonRemovedGammas++;
              fNeutralNotRemoved--;
@@ -947,14 +1372,35 @@ Int_t AliAnalysisEtMonteCarlo::AnalyseEvent(AliVEvent* ev,AliVEvent* ev2)
                fHistGammasAcceptedMult->Fill(fDepositedEt,fClusterMult);
                if(fClusterMult<25){fHistGammasAcceptedPeripheral->Fill(fDepositedEt);}
              }
+             if(containsGamma){
+               if(!fSelector->CutGeometricalAcceptance(*primPart)){
+                 fHistGammasFoundOutOfAccRecoEnergyCent->Fill(fReconstructedE,fCentClass);
+               }
+               else{
+                 if(gammaEnergy>0) fHistGammaEnergyCrossCheckAlt->Fill(gammaEnergy,(fReconstructedEt-gammaEnergy)/fReconstructedEt);
+                 fHistGammasFoundRecoEnergyCent->Fill(fReconstructedE,fCentClass);
+                 etGammaCrossCheckAlt += clEt;
+               }
+             }
+             if(fDepositedCode==fgGammaCode){
+               if(!fSelector->CutGeometricalAcceptance(*primPart)){
+                 fHistGammasFoundOutOfAccCent->Fill(fReconstructedE,fCentClass);
+               }
+               else{
+                 etGammaCrossCheck += clEt;
+                 // cout<<"Found gamma et "<<fReconstructedEt<<" sim et "<< fPrimaryEt<<endl;
+                 if(fPrimaryEt>0) fHistGammaEnergyCrossCheck->Fill(fPrimaryEt,(fReconstructedEt-fPrimaryEt)/fReconstructedEt);
+                 fHistGammasFoundAltCent->Fill(fReconstructedE,fCentClass);
+               }
+             }
            }
            else{//removed but shouldn't have been
-             Int_t trackindex = (caloCluster->GetLabelsArray())->At(1);
+             Int_t trackindex = fSelector->GetLabel(caloCluster,stack);// (caloCluster->GetLabelsArray())->At(1);
              if(caloCluster->GetLabel()!=trackindex){
                fHistBadTrackMatches->Fill(part->Pt(),fReconstructedE);
                fHistBadTrackMatchesdPhidEta->Fill(caloCluster->GetTrackDx(),caloCluster->GetTrackDz());
 //             cout<<"Track matched, label cluster "<<caloCluster->GetLabel()<<" track "<<trackindex<<endl;
-//             PrintFamilyTree(trackindex, stack);
+//             PrintFamilyTreeShort(trackindex, stack);
 //             cout<<"Cluster"<<endl;
              }
              fGammaRemoved++;
@@ -967,23 +1413,148 @@ Int_t AliAnalysisEtMonteCarlo::AnalyseEvent(AliVEvent* ev,AliVEvent* ev2)
              fHistMatchedTracksEvspTSignal->Fill(matchedTrackp,fReconstructedE);
              if(fCalcTrackMatchVsMult){
                if(fClusterMult<25){fHistMatchedTracksEvspTSignalPeripheral->Fill(matchedTrackp,fReconstructedEt);}
-               fHistMatchedTracksEvspTSignalvsMult->Fill(matchedTrackp,fReconstructedEt,fClusterMult);
-               fHistMatchedTracksEvspTSignalvsMultEffCorr->Fill(matchedTrackp,clEt,fClusterMult);
+               fHistMatchedTracksEvspTSignalvsCent->Fill(matchedTrackp,fReconstructedEt, fCentClass);
+               fHistMatchedTracksEvspTSignalvsCentEffCorr->Fill(matchedTrackp,clEt, fCentClass);
              }
            }
          }
+         //===================================END SIGNAL==================================================
+         //===================================BEGIN NEUTRONS==================================================
          //all other cases - neutron, anti-neutron, not aware of other cases
          if(!written){
+//         cout<<"Neutron ";
+//         PrintFamilyTreeShort(iPart, stack);
            fNeutralNotRemoved++;
-           fEnergyNeutralNotRemoved += clEt;
+           fEnergyNeutralNotRemoved += clEt;//this is the efficiency corrected energy
            fHistRemovedOrNot->Fill(3.0, fCentClass);
-           fHistDxDzNonRemovedNeutral->Fill(caloCluster->GetTrackDx(), caloCluster->GetTrackDz());
+           if ((fDepositedCode == fgNeutronCode || fDepositedCode == fgAntiNeutronCode) && nottrackmatched){
+             etNeutronCrossCheckTrue += clEt;
+             subtotalNeutronEnergy += fReconstructedEt;
+             fHistDxDzNonRemovedNeutral->Fill(caloCluster->GetTrackDx(), caloCluster->GetTrackDz());
+             fHistNeutronsEtVsCent->Fill(clEt,fCentClass);
+             nNeutrons++;
+             if(fDepositedCode == fgNeutronCode){
+               etNeutronDeposited += clEt;
+               etNeutronDeposited += fReconstructedEt;
+             }
+             if(fDepositedCode == fgAntiNeutronCode){
+               etAntiNeutronDeposited += clEt;
+               etAntiNeutronDeposited += fReconstructedEt;
+             }
+             //cout<<"I am a";
+             //if(fDepositedCode == fgAntiNeutronCode) cout<<"n anti-";
+             //else{cout<<" ";}
+             //cout<<"neutron!! pt "<<part->Pt()<<" eta "<<part->Eta()<<" phi "<<part->Phi()<<" Et "<<clEt<<endl;
+             //PrintFamilyTreeShort(iPart, stack);
+           }
+           else{
+             nNotNeutrons++;
+//           cout<<"I am a";
+//           if(fDepositedCode == fgAntiNeutronCode) cout<<"n anti-";
+//           else{cout<<" ";}
+//           cout<<"neutron!! pt "<<part->Pt()<<" eta "<<part->Eta()<<" phi "<<part->Phi()<<" Et "<<clEt<<endl;
+//           PrintFamilyTreeShort(iPart, stack);
+//           cout<<"I am not a neutron!!"<<endl;
+//           PrintFamilyTreeShort(iPart, stack);
+           }
          }
+         //===================================END NEUTRONS==================================================
        }
         fPrimaryTree->Fill();
     } // end of loop over clusters     
 
 
+    fHistAllEnergy->Fill(fCentClass,subtotalAllEnergy);
+    fHistSignalEnergy->Fill(fCentClass,subtotalSignalEnergy);
+    fHistNeutronEnergy->Fill(fCentClass,subtotalNeutronEnergy);
+    fHistKaonEnergy->Fill(fCentClass,subtotalKaonEnergy);
+    fHistHadronEnergy->Fill(fCentClass,subtotalHadronEnergy);
+    fHistSecondaryEnergy->Fill(fCentClass,subtotalSecondaryEnergy);
+    fHistSecondaryChargedEnergy->Fill(fCentClass,subtotalSecondaryChargedEnergy);
+    fHistSecondaryNeutronEnergy->Fill(fCentClass,subtotalSecondaryNeutronEnergy);
+    fHistSecondaryGammaEnergy->Fill(fCentClass,subtotalSecondaryGammaEnergy);
+    fHistSecondaryElectronEnergy->Fill(fCentClass,subtotalSecondaryElectronEnergy);
+    fHistSecondaryOtherEnergy->Fill(fCentClass,subtotalSecondaryOtherEnergy);
+    fHistReconstructedGammaEnergy->Fill(fCentClass,subtotalReconstructedGammaEnergy);
+    fHistReconstructedSignalEnergy->Fill(fCentClass,subtotalReconstructedSignalEnergy);
+    Float_t fracSignal =0;
+    Float_t fracHadron = 0;
+    Float_t fracKaon = 0;
+    Float_t fracNeutron = 0;
+    Float_t fracSecondary = 0;
+    if(subtotalAllEnergy>0){
+      fracSignal = subtotalReconstructedSignalEnergy/subtotalAllEnergy;
+      fracHadron = subtotalHadronEnergy/subtotalAllEnergy;
+      fracKaon = subtotalKaonEnergy/subtotalAllEnergy;
+      fracNeutron = subtotalNeutronEnergy/subtotalAllEnergy;
+      fracSecondary = subtotalSecondaryEnergy/subtotalAllEnergy;
+    }
+     fHistFracSignalVsNClusters->Fill(fClusterMult,fracSignal);
+     fHistFracHadronsVsNClusters->Fill(fClusterMult,fracHadron);
+     fHistFracKaonsVsNClusters->Fill(fClusterMult,fracKaon);
+     fHistFracNeutronsVsNClusters->Fill(fClusterMult,fracNeutron);
+     fHistFracSecondariesVsNClusters->Fill(fClusterMult,fracSecondary);
+     fHistFracSignalVsNMultiplicity->Fill(multiplicity,fracSignal);
+    fHistFracHadronsVsNMultiplicity->Fill(multiplicity,fracHadron);
+    fHistFracKaonsVsNMultiplicity->Fill(multiplicity,fracKaon);
+    fHistFracNeutronsVsNMultiplicity->Fill(multiplicity,fracNeutron);
+    fHistFracSecondariesVsNMultiplicity->Fill(multiplicity,fracSecondary);
+     fHistFracSignalVsNMatchedTracks->Fill(nChargedHadronsMeasured,fracSignal);
+    fHistFracHadronsVsNMatchedTracks->Fill(nChargedHadronsMeasured,fracHadron);
+    fHistFracKaonsVsNMatchedTracks->Fill(nChargedHadronsMeasured,fracKaon);
+    fHistFracNeutronsVsNMatchedTracks->Fill(nChargedHadronsMeasured,fracNeutron);
+    fHistFracSecondariesVsNMatchedTracks->Fill(nChargedHadronsMeasured,fracSecondary);
+     fHistFracSignalVsNTotalTracks->Fill(nChargedHadronsTotal,fracSignal);
+    fHistFracHadronsVsNTotalTracks->Fill(nChargedHadronsTotal,fracHadron);
+    fHistFracKaonsVsNTotalTracks->Fill(nChargedHadronsTotal,fracKaon);
+    fHistFracNeutronsVsNTotalTracks->Fill(nChargedHadronsTotal,fracNeutron);
+    fHistFracSecondariesVsNTotalTracks->Fill(nChargedHadronsTotal,fracSecondary);
+
+
+
+    fHistPiKPNotTrackMatchedDepositedVsNch->Fill(etPiKPDepositedNotTrackMatched,multiplicity);
+    fHistPiKPDepositedVsNch->Fill(etPiKPDeposited,multiplicity);
+
+    fHistNeutronsDepositedVsNch->Fill(etNeutronDeposited,multiplicity);
+    fHistAntiNeutronsDepositedVsNch->Fill(etAntiNeutronDeposited,multiplicity);
+    fHistProtonsDepositedVsNch->Fill(etProtonDeposited,multiplicity);
+    fHistAntiProtonsDepositedVsNch->Fill(etAntiProtonDeposited,multiplicity);
+    fHistProtonsNotTrackMatchedDepositedVsNch->Fill(etProtonDepositedNotTrackMatched,multiplicity);
+    fHistAntiProtonsNotTrackMatchedDepositedVsNch->Fill(etAntiProtonDepositedNotTrackMatched,multiplicity);
+
+    fHistNeutronsDepositedVsNcl->Fill(etNeutronDeposited,fClusterMult);
+    fHistAntiNeutronsDepositedVsNcl->Fill(etAntiNeutronDeposited,fClusterMult);
+    fHistProtonsDepositedVsNcl->Fill(etProtonDeposited,fClusterMult);
+    fHistAntiProtonsDepositedVsNcl->Fill(etAntiProtonDeposited,fClusterMult);
+    fHistProtonsNotTrackMatchedDepositedVsNcl->Fill(etProtonDepositedNotTrackMatched,fClusterMult);
+    fHistAntiProtonsNotTrackMatchedDepositedVsNcl->Fill(etAntiProtonDepositedNotTrackMatched,fClusterMult);
+
+    fHistSecondariesVsNch->Fill(etSecondaries,multiplicity);
+    fHistSecondariesVsNcl->Fill(etSecondaries,fClusterMult);
+    fHistSecondariesEffCorrVsNch->Fill(etSecondariesEffCorr,multiplicity);
+    fHistSecondariesEffCorrVsNcl->Fill(etSecondariesEffCorr,fClusterMult);
+    fHistSecondariesOutOfAccEffCorrVsNch->Fill(etSecondariesOutOfAccEffCorr,multiplicity);
+    fHistSecondariesDetectorCoverEffCorrVsNch->Fill(etSecondariesDetectorCoverEffCorr,multiplicity);
+    fHistCentVsNchVsNcl->Fill(fCentClass,multiplicity, fClusterMult);
+
+    fHistNeutronsDepositedVsNchNoEffCorr->Fill(etNeutronDepositedNoEffCorr,multiplicity);
+    fHistAntiNeutronsDepositedVsNchNoEffCorr->Fill(etAntiNeutronDepositedNoEffCorr,multiplicity);
+    fHistNeutronsDepositedVsNclNoEffCorr->Fill(etNeutronDepositedNoEffCorr,fClusterMult);
+    fHistAntiNeutronsDepositedVsNclNoEffCorr->Fill(etAntiNeutronDepositedNoEffCorr,fClusterMult);
+
+    fHistProtonsDepositedVsNchNoEffCorr->Fill(etProtonDepositedNoEffCorr,multiplicity);
+    fHistAntiProtonsDepositedVsNchNoEffCorr->Fill(etAntiProtonDepositedNoEffCorr,multiplicity);
+    fHistProtonsNotTrackMatchedDepositedVsNchNoEffCorr->Fill(etProtonDepositedNotTrackMatchedNoEffCorr,multiplicity);
+    fHistAntiProtonsNotTrackMatchedDepositedVsNchNoEffCorr->Fill(etAntiProtonDepositedNotTrackMatchedNoEffCorr,multiplicity);
+    fHistProtonsDepositedVsNclNoEffCorr->Fill(etProtonDepositedNoEffCorr,fClusterMult);
+    fHistAntiProtonsDepositedVsNclNoEffCorr->Fill(etAntiProtonDepositedNoEffCorr,fClusterMult);
+    fHistProtonsNotTrackMatchedDepositedVsNclNoEffCorr->Fill(etProtonDepositedNotTrackMatchedNoEffCorr,fClusterMult);
+    fHistAntiProtonsNotTrackMatchedDepositedVsNclNoEffCorr->Fill(etAntiProtonDepositedNotTrackMatchedNoEffCorr,fClusterMult);
+
+
+    fHistNeutronsNumVsCent->Fill(nNeutrons,fCentClass);
+    fHistNotNeutronsNumVsCent->Fill(nNotNeutrons,fCentClass);
+
     std::sort(foundGammas.begin(), foundGammas.end());
     for (Int_t iPart = 0; iPart < stack->GetNtrack(); iPart++)
     {
@@ -1005,18 +1576,35 @@ Int_t AliAnalysisEtMonteCarlo::AnalyseEvent(AliVEvent* ev,AliVEvent* ev2)
             continue;
         }
         
-        if(pdg->PdgCode()==fgGammaCode && fSelector->CutGeometricalAcceptance(*part))// TMath::Abs(part->Eta()) < 0.12)
+        if(pdg->PdgCode()==fgGammaCode)// TMath::Abs(part->Eta()) < 0.12)
        {
-         fHistGammasGenerated->Fill(part->Energy());
-         fHistGammasGeneratedMult->Fill(part->Energy(),fClusterMult);
+         if(fSelector->CutGeometricalAcceptance(*part)){
+           subtotalSimulatedGammaEnergy += part->Energy()*TMath::Sin(part->Theta());
+           if(fSelector->PassMinEnergyCut(*part)){
+             //cout<<"Sim gamma et "<< part->Energy()*TMath::Sin(part->Theta())<<endl;
+             etGammaCrossCheckTrue += part->Energy()*TMath::Sin(part->Theta());
+             subtotalSimulatedGammaEnergyAboveThreshold += part->Energy()*TMath::Sin(part->Theta());
+           }
+           fHistGammasGenerated->Fill(part->Energy());
+           fHistGammasGeneratedCent->Fill(part->Energy(),fCentClass);
+         }
          if(std::binary_search(foundGammas.begin(),foundGammas.end(),iPart))
          {
-           fHistGammasFound->Fill(part->Energy());
-           fHistGammasFoundMult->Fill(part->Energy(),fClusterMult);
+           if(!fSelector->CutGeometricalAcceptance(*part)){
+             //cout<<"Gamma NOT in acceptance"<<endl;
+             fHistGammasFoundOutOfAccCent->Fill(part->Energy(),fCentClass);
+           }
+           else{
+             fHistGammasFound->Fill(part->Energy());
+             fHistGammasFoundCent->Fill(part->Energy(),fCentClass);
+             //cout<<"Gamma IN acceptance"<<endl;
+           }
          }
        }
         if(pdg->PdgCode()==fgPiPlusCode || pdg->PdgCode()==fgPiMinusCode || pdg->PdgCode()==fgProtonCode || pdg->PdgCode()==fgAntiProtonCode){//section here for all hadrons generated
-         fHistHadronsAllMult->Fill(part->Pt(),fClusterMult);
+         //if(fSelector->CutGeometricalAcceptance(*part)){
+           fHistHadronsAllCent->Fill(part->Pt(), fCentClass);
+           //}
        }
        
         
@@ -1063,20 +1651,30 @@ Int_t AliAnalysisEtMonteCarlo::AnalyseEvent(AliVEvent* ev,AliVEvent* ev2)
          Float_t totalClusterEts[11] = {0.0,0.0,0.0,0.0,0.0, 0.0,0.0,0.0,0.0,0.0,  0.0};
          for (int iCluster = 0; iCluster < nCluster; iCluster++ ){//if this cluster is from any of the decay daughters of any kaon...  but there is no easy way to look at this so we loop over clusters...
            AliESDCaloCluster* caloCluster = ( AliESDCaloCluster* )caloClusters->At( iCluster );
-           const UInt_t myPart = (UInt_t)TMath::Abs(caloCluster->GetLabel());
+           if (!fSelector->CutGeometricalAcceptance(*caloCluster)) continue;
+           const Int_t myPart = fSelector->GetLabel(caloCluster,stack);
+           //const Int_t myPart = TMath::Abs(caloCluster->GetLabel());
            //identify the primary particle which created this cluster
            int primIdx = myPart;
            if (!stack->IsPhysicalPrimary(myPart)){
              primIdx = GetPrimMother(iPart, stack);
            } // end of primary particle check
-
-           if(primIdx==iPart && primIdx>0){//This cluster is from our primary particle and our primary particle is a kaon
+           TParticle *hitPart = stack->Particle(myPart);
+           Bool_t hitsAsChargedKaon = kFALSE;
+           if(hitPart->GetPdgCode()== fgKPlusCode || hitPart->GetPdgCode()== fgKPlusCode){
+             if(myPart==primIdx){
+               //The particle hits as a charged kaon and that kaon is a primary kaon - do not count because this is counted in the hadronic correction!
+               hitsAsChargedKaon = kTRUE;
+               //cout<<"Found primary charged kaon cluster!"<<endl;
+             }
+           }
+           if(primIdx==iPart && primIdx>0 && !hitsAsChargedKaon){//This cluster is from our primary particle and our primary particle is a kaon
              //cout<<"I have a particle match! prim code"<<code<<" id "<<primIdx <<endl;
              Float_t pos[3];
              caloCluster->GetPosition(pos);
              TVector3 cp(pos);
              Double_t clEt = caloCluster->E()*TMath::Sin(cp.Theta());
-             Double_t clEtCorr = CorrectForReconstructionEfficiency(*caloCluster,fClusterMult);
+             Double_t clEtCorr = CorrectForReconstructionEfficiency(*caloCluster,fCentClass);
              for(int l=0;l<nEtCuts;l++){//loop over cut values
                if(clEt>=etCuts[l]){
                  //cout<<", "<<clEt<<">="<<etCuts[l];
@@ -1113,7 +1711,26 @@ Int_t AliAnalysisEtMonteCarlo::AnalyseEvent(AliVEvent* ev,AliVEvent* ev2)
        }
       }
     }
+
+    fHistSimulatedGammaEnergy->Fill(fCentClass,subtotalSimulatedGammaEnergy);
+    fHistSimulatedGammaEnergyAboveThreshold->Fill(fCentClass,subtotalSimulatedGammaEnergyAboveThreshold);
+
     fHistMultChVsSignalVsMult->Fill(fClusterMultChargedTracks,fClusterMultGammas,fClusterMult);
+    fHistNeutralRemovedSecondaryNumVsNCluster->Fill(nNeutralSecondariesRemoved,fClusterMult);
+    fHistChargedRemovedSecondaryNumVsNCluster->Fill(nChargedSecondariesRemoved,fClusterMult);
+    fHistNeutralNotRemovedSecondaryNumVsNCluster->Fill(nNeutralSecondariesNotRemoved,fClusterMult);
+    fHistChargedNotRemovedSecondaryNumVsNCluster->Fill(nChargedSecondariesNotRemoved,fClusterMult);
+    fHistNeutralRemovedSecondaryNumVsCent->Fill(nNeutralSecondariesRemoved,fCentClass);
+    fHistChargedRemovedSecondaryNumVsCent->Fill(nChargedSecondariesRemoved,fCentClass);
+    fHistNeutralNotRemovedSecondaryNumVsCent->Fill(nNeutralSecondariesNotRemoved,fCentClass);
+    fHistChargedNotRemovedSecondaryNumVsCent->Fill(nChargedSecondariesNotRemoved,fCentClass);
+    if(etGammaCrossCheckTrue>0)fHistGammaCrossCheck->Fill(fCentClass,(etGammaCrossCheck-etGammaCrossCheckTrue)/etGammaCrossCheckTrue);
+    if(etGammaCrossCheckTrue>0)fHistGammaCrossCheckAlt->Fill(fCentClass,(etGammaCrossCheckAlt-etGammaCrossCheckTrue)/etGammaCrossCheckTrue);
+    if(fTmCorrections->GetNeutronCorrection(fCentClass)>0)fHistNeutronCrossCheck->Fill(fCentClass,(fTmCorrections->GetNeutronCorrection(fCentClass)-etNeutronCrossCheckTrue)/fTmCorrections->GetNeutronCorrection(fCentClass));
+    if(fTmCorrections->GetSecondaryCorrection(fCentClass)>0)fHistSecondaryCrossCheck->Fill(fCentClass,(fTmCorrections->GetSecondaryCorrection(fCentClass)-etSecondaryCrossCheckTrue)/fTmCorrections->GetSecondaryCorrection(fCentClass));
+    if(fTmCorrections->GetHadronCorrection(fCentClass)>0)fHistHadronCrossCheck->Fill(fCentClass,(fTmCorrections->GetHadronCorrection(fCentClass)-etHadronCrossCheckTrue)/fTmCorrections->GetHadronCorrection(fCentClass));
+    if(fTmCorrections->GetKaonCorrection(fCentClass)>0)fHistKaonCrossCheck->Fill(fCentClass,(fTmCorrections->GetKaonCorrection(fCentClass)-etKaonCrossCheckTrue)/fTmCorrections->GetKaonCorrection(fCentClass));
+    //cout<<"Secondaries not removed: "<<fSecondaryNotRemoved<<" neutral secondaries not removed "<<nNeutralSecondariesNotRemoved<<" cluster mult "<<fClusterMult<<endl;
     FillHistograms();
     return 0;
 }
@@ -1431,8 +2048,13 @@ void AliAnalysisEtMonteCarlo::CreateHistograms()
 
     fHistGammasFound = new TH1F("fHistGammasFound", "fHistGammasFound",200, 0, 10);
     fHistGammasGenerated = new TH1F("fHistGammasGenerated", "fHistGammasGenerated",200, 0, 10);
-    fHistGammasFoundMult = new TH2F("fHistGammasFoundMult", "fHistGammasFoundMult",200, 0, 10,10,0,100);
-    fHistGammasGeneratedMult = new TH2F("fHistGammasGeneratedMult", "fHistGammasGeneratedMult",200, 0, 10,10,0,100);
+    fHistGammasFoundOutOfAccCent = new TH2F("fHistGammasFoundOutOfAccCent", "fHistGammasFoundOutOfAccCent",200, 0, 10,20,-0.5,19.5);
+    fHistGammasFoundCent = new TH2F("fHistGammasFoundCent", "fHistGammasFoundCent",200, 0, 10,20,-0.5,19.5);
+    fHistGammasFoundOutOfAccAltCent = new TH2F("fHistGammasFoundOutOfAccAltCent", "fHistGammasFoundOutOfAccCent",200, 0, 10,20,-0.5,19.5);
+    fHistGammasFoundRecoEnergyCent = new TH2F("fHistGammasFoundRecoEnergyCent", "fHistGammasFoundRecoEnergyCent",200, 0, 10,20,-0.5,19.5);
+    fHistGammasFoundOutOfAccRecoEnergyCent = new TH2F("fHistGammasFoundOutOfAccRecoEnergyCent", "fHistGammasFoundOutOfAccRecoEnergyCent",200, 0, 10,20,-0.5,19.5);
+    fHistGammasFoundAltCent = new TH2F("fHistGammasFoundAltCent", "fHistGammasFoundAltCent",200, 0, 10,20,-0.5,19.5);
+    fHistGammasGeneratedCent = new TH2F("fHistGammasGeneratedCent", "fHistGammasGeneratedCent",200, 0, 10,20,-0.5,19.5);
     fHistChargedTracksCut = new TH1F("fHistChargedTracksCut", "fHistChargedTracksCut",100, 0, 5);
     fHistChargedTracksAccepted = new TH1F("fHistChargedTracksAccepted", "fHistChargedTracksAccepted",100, 0, 5);
     fHistGammasCut = new TH1F("fHistGammasTracksCut", "fHistGammasTracksCut",100, 0, 5);
@@ -1441,7 +2063,15 @@ void AliAnalysisEtMonteCarlo::CreateHistograms()
     if(fCalcTrackMatchVsMult){
       fHistChargedTracksCutMult = new TH2F("fHistChargedTracksCutMult", "fHistChargedTracksCutMult",100, 0, 5,10,0,100);
       fHistChargedTracksAcceptedMult = new TH2F("fHistChargedTracksAcceptedMult", "fHistChargedTracksAcceptedMult",100, 0, 5,10,0,100);
-      fHistChargedTracksAcceptedLowPtMult = new TH2F("fHistChargedTracksAcceptedLowPtMult", "fHistChargedTracksAcceptedLowPtMult",100, 0, 5,10,0,100);
+      fHistChargedTrackDepositsAcceptedVsPt = new TH2F("fHistChargedTrackDepositsAcceptedVsPt", "fHistChargedTrackDepositsAcceptedVsPt",100, 0, 5,20,-0.5,19.5);
+      fHistChargedTrackDepositsAllVsPt = new TH2F("fHistChargedTrackDepositsAllVsPt", "fHistChargedTrackDepositsAllVsPt",100, 0, 5,20,-0.5,19.5);
+      fHistChargedTrackDepositsAcceptedVsPtEffCorr = new TH2F("fHistChargedTrackDepositsAcceptedVsPtEffCorr", "fHistChargedTrackDepositsAcceptedVsPtEffCorr",100, 0, 5,20,-0.5,19.5);
+      fHistChargedTrackDepositsAllVsPtEffCorr = new TH2F("fHistChargedTrackDepositsAllVsPtEffCorr", "fHistChargedTrackDepositsAllVsPtEffCorr",100, 0, 5,20,-0.5,19.5);
+      fHistChargedTracksAcceptedLowPtCentEffCorr = new TH2F("fHistChargedTracksAcceptedLowPtCentEffCorr", "fHistChargedTracksAcceptedLowPtCentEffCorr",100, 0, 5,20,-0.5,19.5);
+      fHistChargedTracksAcceptedLowPtCent = new TH2F("fHistChargedTracksAcceptedLowPtCent", "fHistChargedTracksAcceptedLowPtCent",100, 0, 5,20,-0.5,19.5);
+      fHistChargedTracksAcceptedLowPtCent500MeV = new TH2F("fHistChargedTracksAcceptedLowPtCent500MeV", "fHistChargedTracksAcceptedLowPtCent500MeV",100, 0, 5,20,-0.5,19.5);
+      fHistChargedTracksAcceptedLowPtCentNoAntiProtons = new TH2F("fHistChargedTracksAcceptedLowPtCentNoAntiProtons", "fHistChargedTracksAcceptedLowPtCentNoAntiProtons",100, 0, 5,20,-0.5,19.5);
+      fHistChargedTracksAcceptedLowPtCentAntiProtons = new TH2F("fHistChargedTracksAcceptedLowPtCentAntiProtons", "fHistChargedTracksAcceptedLowPtCentAntiProtons",100, 0, 5,20,-0.5,19.5);
       fHistGammasCutMult = new TH2F("fHistGammasTracksCutMult", "fHistGammasTracksCutMult",100, 0, 5,10,0,100);
       fHistGammasAcceptedMult = new TH2F("fHistGammasTracksAcceptedMult", "fHistGammasTracksAcceptedMult",100, 0, 5,10,0,100);
     }
@@ -1453,10 +2083,10 @@ void AliAnalysisEtMonteCarlo::CreateHistograms()
       fHistMatchedTracksEvspTBkgdPeripheral = new TH2F("fHistMatchedTracksEvspTBkgdPeripheral", "fHistMatchedTracksEvspTBkgd",100, 0, 3,100,0,3);
       fHistMatchedTracksEvspTSignalPeripheral = new TH2F("fHistMatchedTracksEvspTSignalPeripheral", "fHistMatchedTracksEvspTSignal",100, 0, 3,100,0,3);
 
-      fHistMatchedTracksEvspTBkgdvsMult = new TH3F("fHistMatchedTracksEvspTBkgdMult", "fHistMatchedTracksEvspTBkgdMult",100, 0, 3,100,0,3,10,0,100);
-      fHistMatchedTracksEvspTSignalvsMult = new TH3F("fHistMatchedTracksEvspTSignalMult", "fHistMatchedTracksEvspTSignalMult",100, 0, 3,100,0,3,10,0,100);
-      fHistMatchedTracksEvspTBkgdvsMultEffCorr = new TH3F("fHistMatchedTracksEvspTBkgdMultEffCorr", "fHistMatchedTracksEvspTBkgdMult",100, 0, 3,100,0,3,10,0,100);
-      fHistMatchedTracksEvspTSignalvsMultEffCorr = new TH3F("fHistMatchedTracksEvspTSignalMultEffCorr", "fHistMatchedTracksEvspTSignalMult",100, 0, 3,100,0,3,10,0,100);
+      fHistMatchedTracksEvspTBkgdvsCent = new TH3F("fHistMatchedTracksEvspTBkgdvsCent", "fHistMatchedTracksEvspTBkgdvsCent",100, 0, 3,100,0,3,20,-0.5,19.5);
+      fHistMatchedTracksEvspTSignalvsCent = new TH3F("fHistMatchedTracksEvspTSignalvsCent", "fHistMatchedTracksEvspTSignalvsCent",100, 0, 3,100,0,3,20,-0.5,19.5);
+      fHistMatchedTracksEvspTBkgdvsCentEffCorr = new TH3F("fHistMatchedTracksEvspTBkgdvsCentEffCorr", "fHistMatchedTracksEvspTBkgdvsCent",100, 0, 3,100,0,3,20,-0.5,19.5);
+      fHistMatchedTracksEvspTSignalvsCentEffCorr = new TH3F("fHistMatchedTracksEvspTSignalvsCentEffCorr", "fHistMatchedTracksEvspTSignalvsCent",100, 0, 3,100,0,3,20,-0.5,19.5);
     
 
       fHistChargedTracksCutPeripheral = new TH1F("fHistChargedTracksCutPeripheral", "fHistChargedTracksCut",100, 0, 5);
@@ -1474,13 +2104,156 @@ void AliAnalysisEtMonteCarlo::CreateHistograms()
       Float_t nMultCuts[21] = { 0, 5,10,15,20, 25,30,35,40,45, 
                               50,55,60,65,70, 75,80,85,90,95,
                                100};
+      Int_t nCent = 20;
+      Float_t nCentCuts[21] = { 0, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20};
+
+      fHistHadronDepositsAllCent = new TH2F("fHistHadronDepositsAllCent","All Hadrons which deposited energy in calorimeter",fgNumOfPtBins,fgPtAxis,nCent,nCentCuts);
+      fHistHadronDepositsAllCent500MeV = new TH2F("fHistHadronDepositsAllCent500MeV","All Hadrons which deposited energy in calorimeter pT>500MeV",fgNumOfPtBins,fgPtAxis,nCent,nCentCuts);
+      fHistHadronDepositsRecoCent = new TH2F("fHistHadronDepositsRecoCent","Reconstructed Hadrons which deposited energy in calorimeter",fgNumOfPtBins,fgPtAxis,nCent,nCentCuts);
 
-      fHistHadronDepositsAllMult = new TH2F("fHistHadronDepositsAllMult","All Hadrons which deposited energy in calorimeter",fgNumOfPtBins,fgPtAxis,nMult,nMultCuts);
-      fHistHadronDepositsRecoMult = new TH2F("fHistHadronDepositsRecoMult","Reconstructed Hadrons which deposited energy in calorimeter",fgNumOfPtBins,fgPtAxis,nMult,nMultCuts);
+      fHistHadronDepositsAllvsECent = new TH2F("fHistHadronDepositsAllvsECent","All Hadrons which deposited energy in calorimeter",fgNumOfPtBins,fgPtAxis,nCent,nCentCuts);
+      fHistHadronDepositsRecovsECent = new TH2F("fHistHadronDepositsRecovsECent","Reconstructed Hadrons which deposited energy in calorimeter",fgNumOfPtBins,fgPtAxis,nCent,nCentCuts);
 
-      fHistHadronsAllMult = new TH2F("fHistHadronsAllMult","All Hadrons vs cluster mult",fgNumOfPtBins,fgPtAxis,nMult,nMultCuts);
+      fHistHadronsAllCent = new TH2F("fHistHadronsAllCent","All Hadrons vs cluster mult",fgNumOfPtBins,fgPtAxis,nCent,nCentCuts);
 
       fHistMultChVsSignalVsMult = new TH3F("fHistMultChVsSignalVsMult","Charged particle Multiplicity vs Signal particle multiplicity vs Cluster Mult",nMult,nMultCuts,nMult,nMultCuts,nMult,nMultCuts);
+      fHistNeutralRemovedSecondaryEtVsCent = new TH2F("fHistNeutralRemovedSecondaryEtVsCent","Neutral Removed Secondaries E_{T} vs centrality",100,0.0,2.0,20,-0.5,19.5);
+      fHistChargedRemovedSecondaryEtVsCent = new TH2F("fHistChargedRemovedSecondaryEtVsCent","Charged Removed Secondaries E_{T} vs centrality",100,0.0,2.0,20,-0.5,19.5);
+      fHistNeutralNotRemovedSecondaryEtVsCent = new TH2F("fHistNeutralNotRemovedSecondaryEtVsCent","Neutral NotRemoved Secondaries E_{T} vs centrality",100,0.0,2.0,20,-0.5,19.5);
+      fHistChargedNotRemovedSecondaryEtVsCent = new TH2F("fHistChargedNotRemovedSecondaryEtVsCent","Charged NotRemoved Secondaries E_{T} vs centrality",100,0.0,2.0,20,-0.5,19.5);
+      fHistNeutralRemovedSecondaryNumVsNCluster = new TH2F("fHistNeutralRemovedSecondaryNumVsNCluster","Neutral Removed Secondaries Number vs N_{cluster}",20,-0.5,19.5,250,0,250);
+      fHistChargedRemovedSecondaryNumVsNCluster = new TH2F("fHistChargedRemovedSecondaryNumVsNCluster","Charged Removed Secondaries Number vs N_{cluster}",20,-0.5,19.5,250,0,250);
+      fHistNeutralNotRemovedSecondaryNumVsNCluster = new TH2F("fHistNeutralNotRemovedSecondaryNumVsNCluster","Neutral NotRemoved Secondaries Number vs N_{cluster}",20,-0.5,19.5,250,0,250);
+      fHistChargedNotRemovedSecondaryNumVsNCluster = new TH2F("fHistChargedNotRemovedSecondaryNumVsNCluster","Charged NotRemoved Secondaries Number vs N_{cluster}",20,-0.5,19.5,250,0,250);
+      fHistNeutralRemovedSecondaryNumVsCent = new TH2F("fHistNeutralRemovedSecondaryNumVsCent","Neutral Removed Secondaries Number vs N_{cluster}",20,-0.5,19.5,20,-0.5,19.5);
+      fHistChargedRemovedSecondaryNumVsCent = new TH2F("fHistChargedRemovedSecondaryNumVsCent","Charged Removed Secondaries Number vs N_{cluster}",20,-0.5,19.5,20,-0.5,19.5);
+      fHistNeutralNotRemovedSecondaryNumVsCent = new TH2F("fHistNeutralNotRemovedSecondaryNumVsCent","Neutral NotRemoved Secondaries Number vs N_{cluster}",20,-0.5,19.5,20,-0.5,19.5);
+      fHistChargedNotRemovedSecondaryNumVsCent = new TH2F("fHistChargedNotRemovedSecondaryNumVsCent","Charged NotRemoved Secondaries Number vs N_{cluster}",20,-0.5,19.5,20,-0.5,19.5);
+      fHistNeutronsEtVsCent = new TH2F("fHistNeutronsEtVsCent","Neutrons and anti-neutrons - deposited ET vs Centrality bin",100,0,4.0,20,-0.5,19.5);
+      fHistNeutronsNumVsCent = new TH2F("fHistNeutronsNumVsCent","Neutrons and anti-neutrons - number vs Centrality bin",20,-0.5,19.5,20,-0.5,19.5);
+      fHistNotNeutronsNumVsCent = new TH2F("fHistNotNeutronsNumVsCent","Neutral particles not otherwise classified - number vs Centrality bin",20,-0.5,19.5,20,-0.5,19.5);
+      Int_t nbinsEt = 125;
+      Float_t maxEtRange = 125;
+      Float_t maxEtRangeShort = 50;
+      Float_t minEtRange = 0;
+      Int_t nbinsMult = 100;
+      Float_t maxMult = 3000;
+      Float_t minMult = 0;
+      Int_t nbinsCl = 250;
+      Float_t maxCl = 500;
+      Float_t minCl = 0;
+      fHistPiKPDepositedVsNch = new TH2F("fHistPiKPDepositedVsNch","#pi,K,p E_{T} deposited in calorimeter vs multiplicity",nbinsEt,minEtRange,maxEtRange,nbinsMult,minMult,maxMult);
+      fHistPiKPNotTrackMatchedDepositedVsNch = new TH2F("fHistPiKPNotTrackMatchedDepositedVsNch","#pi,K,p E_{T} deposited in calorimeter vs multiplicity",nbinsEt,minEtRange,maxEtRange,nbinsMult,minMult,maxMult);
+
+    fHistNeutronsDepositedVsNch = new TH2F("fHistNeutronsDepositedVsNch","n deposited in calorimeter vs multiplicity",nbinsEt,minEtRange,maxEtRangeShort,nbinsMult,minMult,maxMult);
+    fHistAntiNeutronsDepositedVsNch = new TH2F("fHistAntiNeutronsDepositedVsNch","#bar{n} deposited in calorimeter vs multiplicity",nbinsEt,minEtRange,maxEtRangeShort,nbinsMult,minMult,maxMult);
+    fHistProtonsDepositedVsNch = new TH2F("fHistProtonsDepositedVsNch","p deposited in calorimeter vs multiplicity",nbinsEt,minEtRange,maxEtRangeShort,nbinsMult,minMult,maxMult);
+    fHistAntiProtonsDepositedVsNch = new TH2F("fHistAntiProtonsDepositedVsNch","#bar{p} deposited in calorimeter vs multiplicity",nbinsEt,minEtRange,maxEtRangeShort,nbinsMult,minMult,maxMult);
+    fHistProtonsNotTrackMatchedDepositedVsNch = new TH2F("fHistProtonsNotTrackMatchedDepositedVsNch","p not track matched deposited in calorimeter vs multiplicity",nbinsEt,minEtRange,maxEtRangeShort,nbinsMult,minMult,maxMult);
+    fHistAntiProtonsNotTrackMatchedDepositedVsNch = new TH2F("fHistAntiProtonsNotTrackMatchedDepositedVsNch","#bar{p} not track matched deposited in calorimeter vs multiplicity",nbinsEt,minEtRange,maxEtRangeShort,nbinsMult,minMult,maxMult);
+
+
+
+    fHistNeutronsDepositedVsNcl = new TH2F("fHistNeutronsDepositedVsNcl","n deposited in calorimeter vs multiplicity",nbinsEt,minEtRange,maxEtRangeShort,nbinsCl,minCl,maxCl);
+    fHistAntiNeutronsDepositedVsNcl = new TH2F("fHistAntiNeutronsDepositedVsNcl","#bar{n} deposited in calorimeter vs multiplicity",nbinsEt,minEtRange,maxEtRangeShort,nbinsCl,minCl,maxCl);
+    fHistProtonsDepositedVsNcl = new TH2F("fHistProtonsDepositedVsNcl","p deposited in calorimeter vs multiplicity",nbinsEt,minEtRange,maxEtRangeShort,nbinsCl,minCl,maxCl);
+    fHistAntiProtonsDepositedVsNcl = new TH2F("fHistAntiProtonsDepositedVsNcl","#bar{p} deposited in calorimeter vs multiplicity",nbinsEt,minEtRange,maxEtRangeShort,nbinsCl,minCl,maxCl);
+    fHistProtonsNotTrackMatchedDepositedVsNcl = new TH2F("fHistProtonsNotTrackMatchedDepositedVsNcl","p not track matched deposited in calorimeter vs multiplicity",nbinsEt,minEtRange,maxEtRangeShort,nbinsCl,minCl,maxCl);
+    fHistAntiProtonsNotTrackMatchedDepositedVsNcl = new TH2F("fHistAntiProtonsNotTrackMatchedDepositedVsNcl","#bar{p} not track matched deposited in calorimeter vs multiplicity",nbinsEt,minEtRange,maxEtRangeShort,nbinsCl,minCl,maxCl);
+
+    fHistSecondariesVsNch = new TH2F("fHistSecondariesVsNch","secondaries deposited in calorimeter vs multiplicity",nbinsEt,minEtRange,maxEtRangeShort,nbinsMult,minMult,maxMult);
+    fHistSecondariesVsNcl = new TH2F("fHistSecondariesVsNcl","secondaries deposited in calorimeter vs number of clusters",nbinsEt,minEtRange,maxEtRangeShort,nbinsCl,minCl,maxCl);
+    fHistSecondariesEffCorrVsNch = new TH2F("fHistSecondariesEffCorrVsNch","efficiency corrected secondaries deposited in calorimeter vs multiplicity",nbinsEt,minEtRange,maxEtRangeShort,nbinsMult,minMult,maxMult);
+    fHistSecondariesEffCorrVsNcl = new TH2F("fHistSecondariesEffCorrVsNcl","efficiency corrected secondaries deposited in calorimeter vs number of clusters",nbinsEt,minEtRange,maxEtRangeShort,nbinsCl,minCl,maxCl);
+
+    fHistSecondariesOutOfAccEffCorrVsNch = new TH2F("fHistSecondariesOutOfAccEffCorrVsNch","efficiency corrected secondaries deposited in calorimeter vs number of clusters for secondary particles out of detector acceptance",nbinsEt,minEtRange,maxEtRangeShort/10.0,nbinsMult,minMult,maxMult);
+    fHistSecondariesDetectorCoverEffCorrVsNch = new TH2F("fHistSecondariesDetectorCoverEffCorrVsNch","efficiency corrected secondaries deposited in calorimeter vs number of clusters for secondaries from the detector cover",nbinsEt,minEtRange,maxEtRangeShort/10.0,nbinsMult,minMult,maxMult);
+    //start
+    fHistNeutronsDepositedVsNchNoEffCorr = new TH2F("fHistNeutronsDepositedVsNchNoEffCorr","n deposited in calorimeter vs multiplicity",nbinsEt,minEtRange,maxEtRangeShort,nbinsMult,minMult,maxMult);
+    fHistAntiNeutronsDepositedVsNchNoEffCorr = new TH2F("fHistAntiNeutronsDepositedVsNchNoEffCorr","#bar{n} deposited in calorimeter vs multiplicity",nbinsEt,minEtRange,maxEtRangeShort,nbinsMult,minMult,maxMult);
+    fHistProtonsDepositedVsNchNoEffCorr = new TH2F("fHistProtonsDepositedVsNchNoEffCorr","p deposited in calorimeter vs multiplicity",nbinsEt,minEtRange,maxEtRangeShort,nbinsMult,minMult,maxMult);
+    fHistAntiProtonsDepositedVsNchNoEffCorr = new TH2F("fHistAntiProtonsDepositedVsNchNoEffCorr","#bar{p} deposited in calorimeter vs multiplicity",nbinsEt,minEtRange,maxEtRangeShort,nbinsMult,minMult,maxMult);
+    fHistProtonsNotTrackMatchedDepositedVsNchNoEffCorr = new TH2F("fHistProtonsNotTrackMatchedDepositedVsNchNoEffCorr","p not track matched deposited in calorimeter vs multiplicity",nbinsEt,minEtRange,maxEtRangeShort,nbinsMult,minMult,maxMult);
+    fHistAntiProtonsNotTrackMatchedDepositedVsNchNoEffCorr = new TH2F("fHistAntiProtonsNotTrackMatchedDepositedVsNchNoEffCorr","#bar{p} not track matched deposited in calorimeter vs multiplicity",nbinsEt,minEtRange,maxEtRangeShort,nbinsMult,minMult,maxMult);
+
+
+
+    fHistNeutronsDepositedVsNclNoEffCorr = new TH2F("fHistNeutronsDepositedVsNclNoEffCorr","n deposited in calorimeter vs multiplicity",nbinsEt,minEtRange,maxEtRangeShort,nbinsCl,minCl,maxCl);
+    fHistAntiNeutronsDepositedVsNclNoEffCorr = new TH2F("fHistAntiNeutronsDepositedVsNclNoEffCorr","#bar{n} deposited in calorimeter vs multiplicity",nbinsEt,minEtRange,maxEtRangeShort,nbinsCl,minCl,maxCl);
+    fHistProtonsDepositedVsNclNoEffCorr = new TH2F("fHistProtonsDepositedVsNclNoEffCorr","p deposited in calorimeter vs multiplicity",nbinsEt,minEtRange,maxEtRangeShort,nbinsCl,minCl,maxCl);
+    fHistAntiProtonsDepositedVsNclNoEffCorr = new TH2F("fHistAntiProtonsDepositedVsNclNoEffCorr","#bar{p} deposited in calorimeter vs multiplicity",nbinsEt,minEtRange,maxEtRangeShort,nbinsCl,minCl,maxCl);
+    fHistProtonsNotTrackMatchedDepositedVsNclNoEffCorr = new TH2F("fHistProtonsNotTrackMatchedDepositedVsNclNoEffCorr","p not track matched deposited in calorimeter vs multiplicity",nbinsEt,minEtRange,maxEtRangeShort,nbinsCl,minCl,maxCl);
+    fHistAntiProtonsNotTrackMatchedDepositedVsNclNoEffCorr = new TH2F("fHistAntiProtonsNotTrackMatchedDepositedVsNclNoEffCorr","#bar{p} not track matched deposited in calorimeter vs multiplicity",nbinsEt,minEtRange,maxEtRangeShort,nbinsCl,minCl,maxCl);
+
+    //end
+
+    fHistCentVsNchVsNcl = new TH3F("fHistCentVsNchVsNcl","Cent bin vs Nch Vs NCl",20,-0.5,19.5,nbinsMult,minMult,maxMult,nbinsCl,minCl,maxCl);
+    float maxpos = 500;
+     int nbinspos = 50;
+    fHistSecondaryPositionInDetector = new TH3F("fHistSecondaryPositionInDetector","Position of secondaries",nbinspos,-maxpos,maxpos,nbinspos,-maxpos,maxpos,nbinspos,-maxpos,maxpos);
+    fHistSecondaryPositionInDetector->GetXaxis()->SetTitle("X");
+    fHistSecondaryPositionInDetector->GetYaxis()->SetTitle("Y");
+    fHistSecondaryPositionInDetector->GetZaxis()->SetTitle("Z");
+//     fHistSecondaryPositionInDetectorMultiple = new TH3F("fHistSecondaryPositionInDetectorMultiple","Position of secondaries",nbinspos,-maxpos,maxpos,nbinspos,-maxpos,maxpos,nbinspos,-maxpos,maxpos);
+//     fHistSecondaryPositionInDetectorMultiple->GetXaxis()->SetTitle("X");
+//     fHistSecondaryPositionInDetectorMultiple->GetYaxis()->SetTitle("Y");
+//     fHistSecondaryPositionInDetectorMultiple->GetZaxis()->SetTitle("Z");
+    fClusterPositionWeird =  new TH2F("fClusterPositionWeird", "Position of weird secondary clusters",300, -TMath::Pi(),TMath::Pi(), 100, -0.7 , 0.7);
+
+   fSecondaryClusterEnergy = new TH1F("fSecondaryClusterEnergy","fSecondaryClusterEnergy", 100, 0, 5);
+   fHistGammaCrossCheck =  new TH2F("fHistGammaCrossCheck", "(E_{T}^{#gamma,rec}-E_{T}^{#gamma,sim})/E_{T}^{#gamma,rec}",20,-0.5,19.5,100,-1.5,4);
+   fHistGammaCrossCheckAlt =  new TH2F("fHistGammaCrossCheckAlt", "(E_{T}^{#gamma,rec}-E_{T}^{#gamma,sim})/E_{T}^{#gamma,rec}",20,-0.5,19.5,100,-1.5,4);
+   fHistGammaEnergyCrossCheck =  new TH2F("fHistGammaEnergyCrossCheck", "(E_{T}^{#gamma,rec}-E_{T}^{#gamma,sim})/E_{T}^{#gamma,rec}",100,0.0,10.0,100,-2,2);
+   fHistGammaEnergyCrossCheckAlt =  new TH2F("fHistGammaEnergyCrossCheckAlt", "(E_{T}^{#gamma,rec}-E_{T}^{#gamma,sim})/E_{T}^{#gamma,rec}",100,0.0,10.0,100,-2,2);
+   fHistNeutronCrossCheck =  new TH2F("fHistNeutronCrossCheck", "(E_{T}^{n,rec}-E_{T}^{n,sim})/E_{T}^{n,rec}",20,-0.5,19.5,100,-14.8,1.2);
+   fHistSecondaryCrossCheck =  new TH2F("fHistSecondaryCrossCheck", "(E_{T}^{sec,rec}-E_{T}^{sec,sim})/E_{T}^{sec,rec}",20,-0.5,19.5,100,-14.8,1.2);
+   fHistHadronCrossCheck =  new TH2F("fHistHadronCrossCheck", "(E_{T}^{h,rec}-E_{T}^{h,sim})/E_{T}^{h,rec}",20,-0.5,19.5,100,-7.8,1.2);
+   fHistKaonCrossCheck =  new TH2F("fHistKaonCrossCheck", "(E_{T}^{K,rec}-E_{T}^{K,sim})/E_{T}^{K,rec}",20,-0.5,19.5,100,-7.8,1.2);
+
+   fHistAllEnergy = new TH1F("fHistAllEnergy","fHistAllEnergy",20,-0.5,19.5);
+   fHistSignalEnergy = new TH1F("fHistSignalEnergy","fHistSignalEnergy",20,-0.5,19.5);
+   fHistNeutronEnergy = new TH1F("fHistNeutronEnergy","fHistNeutronEnergy",20,-0.5,19.5);
+   fHistKaonEnergy = new TH1F("fHistKaonEnergy","fHistKaonEnergy",20,-0.5,19.5);
+   fHistHadronEnergy = new TH1F("fHistHadronEnergy","fHistHadronEnergy",20,-0.5,19.5);
+   fHistSecondaryEnergy = new TH1F("fHistSecondaryEnergy","fHistSecondaryEnergy",20,-0.5,19.5);
+   fHistSecondaryChargedEnergy = new TH1F("fHistSecondaryChargedEnergy","fHistSecondaryChargedEnergy",20,-0.5,19.5);
+   fHistSecondaryNeutronEnergy = new TH1F("fHistSecondaryNeutronEnergy","fHistSecondaryNeutronEnergy",20,-0.5,19.5);
+   fHistSecondaryGammaEnergy = new TH1F("fHistSecondaryGammaEnergy","fHistSecondaryGammaEnergy",20,-0.5,19.5);
+   fHistSecondaryElectronEnergy = new TH1F("fHistSecondaryElectronEnergy","fHistSecondaryElectronEnergy",20,-0.5,19.5);
+   fHistSecondaryOtherEnergy = new TH1F("fHistSecondaryOtherEnergy","fHistSecondaryOtherEnergy",20,-0.5,19.5);
+   fHistSimulatedGammaEnergy = new TH1F("fHistSimulatedGammaEnergy","fHistSimulatedGammaEnergy",20,-0.5,19.5);
+   fHistReconstructedGammaEnergy = new TH1F("fHistReconstructedGammaEnergy","fHistReconstructedGammaEnergy",20,-0.5,19.5);
+   fHistSimulatedGammaEnergyAboveThreshold = new TH1F("fHistSimulatedGammaEnergyAboveThreshold","fHistSimulatedGammaEnergyAboveThreshold",20,-0.5,19.5);
+   fHistReconstructedSignalEnergy = new TH1F("fHistReconstructedSignalEnergy","fHistReconstructedSignalEnergy",20,-0.5,19.5);
+
+   Float_t fracMin = 0.0;
+   Float_t fracMax = 1.0;
+   Float_t fracMaxLow = 0.2;
+   Float_t nBinsFrac = 50;
+   fHistFracSignalVsNClusters = new TH2F("fHistFracSignalVsNClusters","fHistFracSignalVsNClusters",nbinsCl,minCl,maxCl,nBinsFrac,fracMin,fracMax);
+   fHistFracHadronsVsNClusters = new TH2F("fHistFracHadronsVsNClusters","fHistFracHadronsVsNClusters",nbinsCl,minCl,maxCl,nBinsFrac,fracMin,fracMax);
+   fHistFracNeutronsVsNClusters = new TH2F("fHistFracNeutronsVsNClusters","fHistFracNeutronsVsNClusters",nbinsCl,minCl,maxCl,nBinsFrac,fracMin,fracMaxLow);
+   fHistFracKaonsVsNClusters = new TH2F("fHistFracKaonsVsNClusters","fHistFracKaonsVsNClusters",nbinsCl,minCl,maxCl,nBinsFrac,fracMin,fracMaxLow);
+   fHistFracSecondariesVsNClusters = new TH2F("fHistFracSecondariesVsNClusters","fHistFracSecondariesVsNClusters",nbinsCl,minCl,maxCl,nBinsFrac,fracMin,fracMax);
+   fHistFracSignalVsNMultiplicity = new TH2F("fHistFracSignalVsNMultiplicity","fHistFracSignalVsNMultiplicity",nbinsMult,minMult,maxMult,nBinsFrac,fracMin,fracMax);
+   fHistFracHadronsVsNMultiplicity = new TH2F("fHistFracHadronsVsNMultiplicity","fHistFracHadronsVsNMultiplicity",nbinsMult,minMult,maxMult,nBinsFrac,fracMin,fracMax);
+   fHistFracNeutronsVsNMultiplicity = new TH2F("fHistFracNeutronsVsNMultiplicity","fHistFracNeutronsVsNMultiplicity",nbinsMult,minMult,maxMult,nBinsFrac,fracMin,fracMaxLow);
+   fHistFracKaonsVsNMultiplicity = new TH2F("fHistFracKaonsVsNMultiplicity","fHistFracKaonsVsNMultiplicity",nbinsMult,minMult,maxMult,nBinsFrac,fracMin,fracMaxLow);
+   fHistFracSecondariesVsNMultiplicity = new TH2F("fHistFracSecondariesVsNMultiplicity","fHistFracSecondariesVsNMultiplicity",nbinsMult,minMult,maxMult,nBinsFrac,fracMin,fracMax);
+   Int_t nBinsMatchedTracks = 100;
+   Float_t lowMatchedTracks = 0;
+   Float_t highMatchedTracks = 100;
+   fHistFracSignalVsNMatchedTracks = new TH2F("fHistFracSignalVsNMatchedTracks","fHistFracSignalVsNMatchedTracks",nBinsMatchedTracks,lowMatchedTracks,highMatchedTracks,nBinsFrac,fracMin,fracMax);
+   fHistFracHadronsVsNMatchedTracks = new TH2F("fHistFracHadronsVsNMatchedTracks","fHistFracHadronsVsNMatchedTracks",nBinsMatchedTracks,lowMatchedTracks,highMatchedTracks,nBinsFrac,fracMin,fracMax);
+   fHistFracNeutronsVsNMatchedTracks = new TH2F("fHistFracNeutronsVsNMatchedTracks","fHistFracNeutronsVsNMatchedTracks",nBinsMatchedTracks,lowMatchedTracks,highMatchedTracks,nBinsFrac,fracMin,fracMaxLow);
+   fHistFracKaonsVsNMatchedTracks = new TH2F("fHistFracKaonsVsNMatchedTracks","fHistFracKaonsVsNMatchedTracks",nBinsMatchedTracks,lowMatchedTracks,highMatchedTracks,nBinsFrac,fracMin,fracMaxLow);
+   fHistFracSecondariesVsNMatchedTracks = new TH2F("fHistFracSecondariesVsNMatchedTracks","fHistFracSecondariesVsNMatchedTracks",nBinsMatchedTracks,lowMatchedTracks,highMatchedTracks,nBinsFrac,fracMin,fracMax);
+   fHistFracSignalVsNTotalTracks = new TH2F("fHistFracSignalVsNTotalTracks","fHistFracSignalVsNTotalTracks",nBinsMatchedTracks,lowMatchedTracks,highMatchedTracks,nBinsFrac,fracMin,fracMax);
+   fHistFracHadronsVsNTotalTracks = new TH2F("fHistFracHadronsVsNTotalTracks","fHistFracHadronsVsNTotalTracks",nBinsMatchedTracks,lowMatchedTracks,highMatchedTracks,nBinsFrac,fracMin,fracMax);
+   fHistFracNeutronsVsNTotalTracks = new TH2F("fHistFracNeutronsVsNTotalTracks","fHistFracNeutronsVsNTotalTracks",nBinsMatchedTracks,lowMatchedTracks,highMatchedTracks,nBinsFrac,fracMin,fracMaxLow);
+   fHistFracKaonsVsNTotalTracks = new TH2F("fHistFracKaonsVsNTotalTracks","fHistFracKaonsVsNTotalTracks",nBinsMatchedTracks,lowMatchedTracks,highMatchedTracks,nBinsFrac,fracMin,fracMaxLow);
+   fHistFracSecondariesVsNTotalTracks = new TH2F("fHistFracSecondariesVsNTotalTracks","fHistFracSecondariesVsNTotalTracks",nBinsMatchedTracks,lowMatchedTracks,highMatchedTracks,nBinsFrac,fracMin,fracMax);
+   //NClusters
 }
 
 void AliAnalysisEtMonteCarlo::FillOutputList(TList *list)
@@ -1593,16 +2366,29 @@ void AliAnalysisEtMonteCarlo::FillOutputList(TList *list)
     
     list->Add(fHistGammasFound);
     list->Add(fHistGammasGenerated);
-    list->Add(fHistGammasFoundMult);
-    list->Add(fHistGammasGeneratedMult);
+    list->Add(fHistGammasFoundOutOfAccCent);
+    list->Add(fHistGammasFoundCent);
+    list->Add(fHistGammasFoundOutOfAccAltCent);
+    list->Add(fHistGammasFoundAltCent);
+    list->Add(fHistGammasGeneratedCent);
+    list->Add(fHistGammasFoundRecoEnergyCent);
+    list->Add(fHistGammasFoundOutOfAccRecoEnergyCent);
     list->Add(fHistChargedTracksCut);
     list->Add(fHistChargedTracksAccepted);
     list->Add(fHistGammasCut);
     list->Add(fHistGammasAccepted);
     if(fCalcTrackMatchVsMult){
       list->Add(fHistChargedTracksCutMult);
+      list->Add(fHistChargedTrackDepositsAcceptedVsPt);
+      list->Add(fHistChargedTrackDepositsAllVsPt);
+      list->Add(fHistChargedTrackDepositsAcceptedVsPtEffCorr);
+      list->Add(fHistChargedTrackDepositsAllVsPtEffCorr);
       list->Add(fHistChargedTracksAcceptedMult);
-      list->Add(fHistChargedTracksAcceptedLowPtMult);
+      list->Add(fHistChargedTracksAcceptedLowPtCentEffCorr);
+      list->Add(fHistChargedTracksAcceptedLowPtCent);
+      list->Add(fHistChargedTracksAcceptedLowPtCent500MeV);
+      list->Add(fHistChargedTracksAcceptedLowPtCentNoAntiProtons);
+      list->Add(fHistChargedTracksAcceptedLowPtCentAntiProtons);
       list->Add(fHistGammasCutMult);
       list->Add(fHistGammasAcceptedMult);
     }
@@ -1612,10 +2398,10 @@ void AliAnalysisEtMonteCarlo::FillOutputList(TList *list)
     if(fCalcTrackMatchVsMult){
       list->Add(fHistMatchedTracksEvspTBkgdPeripheral);
       list->Add(fHistMatchedTracksEvspTSignalPeripheral);
-      list->Add(fHistMatchedTracksEvspTBkgdvsMult);
-      list->Add(fHistMatchedTracksEvspTSignalvsMult);
-      list->Add(fHistMatchedTracksEvspTBkgdvsMultEffCorr);
-      list->Add(fHistMatchedTracksEvspTSignalvsMultEffCorr);
+      list->Add(fHistMatchedTracksEvspTBkgdvsCent);
+      list->Add(fHistMatchedTracksEvspTSignalvsCent);
+      list->Add(fHistMatchedTracksEvspTBkgdvsCentEffCorr);
+      list->Add(fHistMatchedTracksEvspTSignalvsCentEffCorr);
       list->Add(fHistChargedTracksCutPeripheral);
       list->Add(fHistChargedTracksAcceptedPeripheral);
       list->Add(fHistGammasCutPeripheral);
@@ -1625,10 +2411,118 @@ void AliAnalysisEtMonteCarlo::FillOutputList(TList *list)
     list->Add(fHistGoodTrackMatchesdPhidEta);
     list->Add(fHistHadronDepositsAll);
     list->Add(fHistHadronDepositsReco);
-    list->Add(fHistHadronDepositsAllMult);
-    list->Add(fHistHadronDepositsRecoMult);
-    list->Add(fHistHadronsAllMult);
+    list->Add(fHistHadronDepositsAllCent);
+    list->Add(fHistHadronDepositsAllCent500MeV);
+    list->Add(fHistHadronDepositsRecoCent);
+    list->Add(fHistHadronDepositsAllvsECent);
+    list->Add(fHistHadronDepositsRecovsECent);
+    list->Add(fHistHadronsAllCent);
     list->Add(fHistMultChVsSignalVsMult);
+    list->Add(fHistNeutralRemovedSecondaryEtVsCent);
+    list->Add(fHistChargedRemovedSecondaryEtVsCent);
+    list->Add(fHistNeutralNotRemovedSecondaryEtVsCent);
+    list->Add(fHistChargedNotRemovedSecondaryEtVsCent);
+    list->Add(fHistNeutralRemovedSecondaryNumVsNCluster);
+    list->Add(fHistChargedRemovedSecondaryNumVsNCluster);
+    list->Add(fHistNeutralNotRemovedSecondaryNumVsNCluster);
+    list->Add(fHistChargedNotRemovedSecondaryNumVsNCluster);
+    list->Add(fHistNeutralRemovedSecondaryNumVsCent);
+    list->Add(fHistChargedRemovedSecondaryNumVsCent);
+    list->Add(fHistNeutralNotRemovedSecondaryNumVsCent);
+    list->Add(fHistChargedNotRemovedSecondaryNumVsCent);
+    list->Add(fHistNeutronsEtVsCent);
+    list->Add(fHistNeutronsNumVsCent);
+    list->Add(fHistNotNeutronsNumVsCent);
+    list->Add(fHistPiKPDepositedVsNch);
+    list->Add(fHistPiKPNotTrackMatchedDepositedVsNch);
+
+    list->Add(fHistNeutronsDepositedVsNch);
+    list->Add(fHistAntiNeutronsDepositedVsNch);
+    list->Add(fHistProtonsDepositedVsNch);
+    list->Add(fHistAntiProtonsDepositedVsNch);
+    list->Add(fHistProtonsNotTrackMatchedDepositedVsNch);
+    list->Add(fHistAntiProtonsNotTrackMatchedDepositedVsNch);
+    list->Add(fHistNeutronsDepositedVsNcl);
+    list->Add(fHistAntiNeutronsDepositedVsNcl);
+    list->Add(fHistProtonsDepositedVsNcl);
+    list->Add(fHistAntiProtonsDepositedVsNcl);
+    list->Add(fHistProtonsNotTrackMatchedDepositedVsNcl);
+    list->Add(fHistAntiProtonsNotTrackMatchedDepositedVsNcl);
+    list->Add(fHistSecondariesVsNch);
+    list->Add(fHistSecondariesVsNcl);
+    list->Add(fHistSecondariesEffCorrVsNch);
+    list->Add(fHistSecondariesEffCorrVsNcl);
+    list->Add(fHistSecondariesOutOfAccEffCorrVsNch);
+    list->Add(fHistSecondariesDetectorCoverEffCorrVsNch);
+    //start
+
+    list->Add(fHistNeutronsDepositedVsNchNoEffCorr);
+    list->Add(fHistAntiNeutronsDepositedVsNchNoEffCorr);
+    list->Add(fHistProtonsDepositedVsNchNoEffCorr);
+    list->Add(fHistAntiProtonsDepositedVsNchNoEffCorr);
+    list->Add(fHistProtonsNotTrackMatchedDepositedVsNchNoEffCorr);
+    list->Add(fHistAntiProtonsNotTrackMatchedDepositedVsNchNoEffCorr);
+    list->Add(fHistNeutronsDepositedVsNclNoEffCorr);
+    list->Add(fHistAntiNeutronsDepositedVsNclNoEffCorr);
+    list->Add(fHistProtonsDepositedVsNclNoEffCorr);
+    list->Add(fHistAntiProtonsDepositedVsNclNoEffCorr);
+    list->Add(fHistProtonsNotTrackMatchedDepositedVsNclNoEffCorr);
+    list->Add(fHistAntiProtonsNotTrackMatchedDepositedVsNclNoEffCorr);
+
+    //end
+
+    list->Add(fHistCentVsNchVsNcl);
+    list->Add(fHistSecondaryPositionInDetector);
+    list->Add(fClusterPositionWeird);
+    //list->Add(fHistSecondaryPositionInDetectorMultiple);
+    list->Add(fSecondaryClusterEnergy);
+    list->Add(fHistGammaCrossCheck);
+    list->Add(fHistGammaCrossCheckAlt);
+    list->Add(fHistGammaEnergyCrossCheck);
+    list->Add(fHistGammaEnergyCrossCheckAlt);
+    list->Add(fHistNeutronCrossCheck);
+    list->Add(fHistSecondaryCrossCheck);
+    list->Add(fHistHadronCrossCheck);
+    list->Add(fHistKaonCrossCheck);
+
+
+    list->Add(fHistAllEnergy);
+    list->Add(fHistSignalEnergy);
+    list->Add(fHistNeutronEnergy);
+    list->Add(fHistKaonEnergy);
+    list->Add(fHistHadronEnergy);
+    list->Add(fHistSecondaryEnergy);
+    list->Add(fHistSecondaryChargedEnergy);
+    list->Add(fHistSecondaryNeutronEnergy);
+    list->Add(fHistSecondaryGammaEnergy);
+    list->Add(fHistSecondaryElectronEnergy);
+    list->Add(fHistSecondaryOtherEnergy);
+    list->Add(fHistSimulatedGammaEnergy);
+    list->Add(fHistReconstructedGammaEnergy);
+    list->Add(fHistSimulatedGammaEnergyAboveThreshold);
+    list->Add(fHistReconstructedSignalEnergy);
+
+
+    list->Add(fHistFracSignalVsNClusters);
+    list->Add(fHistFracHadronsVsNClusters);
+    list->Add(fHistFracNeutronsVsNClusters);
+    list->Add(fHistFracKaonsVsNClusters);
+    list->Add(fHistFracSecondariesVsNClusters);
+    list->Add(fHistFracSignalVsNMultiplicity);
+    list->Add(fHistFracHadronsVsNMultiplicity);
+    list->Add(fHistFracNeutronsVsNMultiplicity);
+    list->Add(fHistFracKaonsVsNMultiplicity);
+    list->Add(fHistFracSecondariesVsNMultiplicity);
+    list->Add(fHistFracSignalVsNMatchedTracks);
+    list->Add(fHistFracHadronsVsNMatchedTracks);
+    list->Add(fHistFracNeutronsVsNMatchedTracks);
+    list->Add(fHistFracKaonsVsNMatchedTracks);
+    list->Add(fHistFracSecondariesVsNMatchedTracks);
+    list->Add(fHistFracSignalVsNTotalTracks);
+    list->Add(fHistFracHadronsVsNTotalTracks);
+    list->Add(fHistFracNeutronsVsNTotalTracks);
+    list->Add(fHistFracKaonsVsNTotalTracks);
+    list->Add(fHistFracSecondariesVsNTotalTracks);
 
 }
 
@@ -1673,7 +2567,7 @@ void AliAnalysisEtMonteCarlo::FillHistograms()
     fHistEtNonRemovedGammas->Fill(fEtNonRemovedGammas, fCentClass);
     fHistEtNonRemovedGammasFromPi0->Fill(fEtNonRemovedGammasFromPi0, fCentClass);
 
-    fHistEtRemovedGammas->Fill(fEtRemovedGammas, fNClusters);
+    fHistEtRemovedGammas->Fill(fEtRemovedGammas, fClusterMult);
     fHistEtRemovedNeutrons->Fill(fEtRemovedNeutrons, fCentClass);
     fHistEtRemovedAntiNeutrons->Fill(fEtRemovedAntiNeutrons, fCentClass);
 
@@ -1689,15 +2583,15 @@ void AliAnalysisEtMonteCarlo::FillHistograms()
 //                             fCentClass);
 //     fHistEtRemovedNeutrals->Fill(fEtNonRemovedNeutrons+fEtNonRemovedAntiNeutrons, fCentClass);
 
-    fHistEtRemovedCharged->Fill(fEnergyChargedRemoved, fNClusters);
-    fHistEtRemovedNeutrals->Fill(fEnergyNeutralRemoved, fNClusters);
-    fHistEtNonRemovedCharged->Fill(fEnergyChargedNotRemoved, fNClusters);
-    fHistEtNonRemovedNeutrals->Fill(fEnergyNeutralNotRemoved, fNClusters);
+    fHistEtRemovedCharged->Fill(fEnergyChargedRemoved, fClusterMult);
+    fHistEtRemovedNeutrals->Fill(fEnergyNeutralRemoved, fClusterMult);
+    fHistEtNonRemovedCharged->Fill(fEnergyChargedNotRemoved, fClusterMult);
+    fHistEtNonRemovedNeutrals->Fill(fEnergyNeutralNotRemoved, fClusterMult);
 
-    fHistMultRemovedCharged->Fill(fChargedRemoved, fNClusters);
-    fHistMultRemovedNeutrals->Fill(fNeutralRemoved, fNClusters);
-    fHistMultNonRemovedCharged->Fill(fChargedNotRemoved, fNClusters);
-    fHistMultNonRemovedNeutrals->Fill(fNeutralNotRemoved, fNClusters);
+    fHistMultRemovedCharged->Fill(fChargedRemoved, fClusterMult);
+    fHistMultRemovedNeutrals->Fill(fNeutralRemoved, fClusterMult);
+    fHistMultNonRemovedCharged->Fill(fChargedNotRemoved, fClusterMult);
+    fHistMultNonRemovedNeutrals->Fill(fNeutralNotRemoved, fClusterMult);
 
 
     fHistMultNonRemovedProtons->Fill(fMultNonRemovedProtons, fCentClass);
@@ -1732,15 +2626,15 @@ void AliAnalysisEtMonteCarlo::FillHistograms()
     fHistTrackMultvsRemovedGamma->Fill(fTrackMultInAcc,
                                        fMultRemovedGammas);
 
-    fHistClusterMultvsNonRemovedCharged->Fill(fNClusters,
+    fHistClusterMultvsNonRemovedCharged->Fill(fClusterMult,
             fMultNonRemovedAntiProtons+fMultNonRemovedElectrons+fMultNonRemovedKaonMinus
             +fMultNonRemovedKaonPlus+fMultNonRemovedMuMinus+fMultNonRemovedMuPlus
             +fMultNonRemovedPiMinus+fMultNonRemovedPiPlus+fMultNonRemovedPositrons+fMultNonRemovedProtons);
 
-    fHistClusterMultvsNonRemovedNeutral->Fill(fNClusters,
+    fHistClusterMultvsNonRemovedNeutral->Fill(fClusterMult,
             fMultNonRemovedNeutrons+fMultNonRemovedAntiNeutrons+fMultNonRemovedK0s+fMultNonRemovedK0L+fMultNonRemovedLambdas+fK0sMult);
 
-    fHistClusterMultvsRemovedGamma->Fill(fNClusters,
+    fHistClusterMultvsRemovedGamma->Fill(fClusterMult,
                                          fMultRemovedGammas);
 
 }
@@ -1753,10 +2647,12 @@ Int_t AliAnalysisEtMonteCarlo::PrintFamilyTree(Int_t partIdx, AliStack* stack)
     TParticle *part = stack->Particle(partIdx);
 //     if(part->GetPdgCode() == fgK0SCode)
     {
-        std::cout << "This is index: " << partIdx << " (" << stack->Particle(partIdx)->GetName() <<") , is it primary: " << stack->IsPhysicalPrimary(partIdx)<< std::endl;
+      std::cout << "This is index: " << partIdx << " (" << stack->Particle(partIdx)->GetName() <<") , is it primary: " << stack->IsPhysicalPrimary(partIdx)<<" is it from secondary interaction "<<fSelector->FromSecondaryInteraction(partIdx, *stack)<< std::endl;
         std::cout << "PID: " << part->GetPdgCode() << "/" << part->GetName() << std::endl;
         std::cout << "Energy: " << part->Energy() << std::endl;
-        std::cout << "Vertex: " << part->Vx() << ", " << part->Vy() << ", " << part->Vz() << std::endl;
+       Float_t vtx = TMath::Sqrt( TMath::Power(part->Vx(),2) + TMath::Power(part->Vy(),2) + TMath::Power(part->Vz(),2) );
+       Float_t vtxy = TMath::Sqrt( TMath::Power(part->Vx(),2) + TMath::Power(part->Vy(),2)  );
+        std::cout << "Vertex: " << part->Vx() << ", " << part->Vy() << ", " << part->Vz() <<" |Vtx| "<<vtx <<" |Vtxy| "<<vtxy << std::endl;
     }
     return PrintMothers(partIdx, stack, 1);
 }
@@ -1781,7 +2677,7 @@ Int_t AliAnalysisEtMonteCarlo::PrintMothers(Int_t partIdx, AliStack* stack, Int_
     {
         //std::cout << tabs << "Mother of index: " << partIdx << " (" << stack->Particle(partIdx)->GetName() <<") is: " << mothIdx << ", is it primary: " << stack->IsPhysicalPrimary(mothIdx)<< std::endl;
         std::cout << tabs << "Index: " << mothIdx << std::endl;
-        std::cout << tabs << "Primary: " << stack->IsPhysicalPrimary(mothIdx) << std::endl;
+        std::cout << tabs << "Primary: " << stack->IsPhysicalPrimary(mothIdx)<<" is it from secondary interaction "<<fSelector->FromSecondaryInteraction(partIdx, *stack) << std::endl;
         std::cout << tabs << "PID: " << mother->GetPdgCode() << "/" << mother->GetName() << std::endl;
         std::cout << tabs << "Energy: " << mother->Energy() << std::endl;
        if(mother->GetFirstMother() >= 0)
@@ -1790,7 +2686,9 @@ Int_t AliAnalysisEtMonteCarlo::PrintMothers(Int_t partIdx, AliStack* stack, Int_
          if(mother->GetSecondMother() >= 0) std::cout << ", " << stack->Particle(mother->GetSecondMother())->GetPdgCode();
          std::cout << std::endl;
        }
-        std::cout << tabs << "Vertex: " << mother->Vx() << ", " << mother->Vy() << ", " << mother->Vz() << std::endl;
+       Float_t vtx = TMath::Sqrt( TMath::Power(mother->Vx(),2) + TMath::Power(mother->Vy(),2) + TMath::Power(mother->Vz(),2) );
+       Float_t vtxy = TMath::Sqrt( TMath::Power(mother->Vx(),2) + TMath::Power(mother->Vy(),2)  );
+        std::cout<<tabs << "Vertex: " << mother->Vx() << ", " << mother->Vy() << ", " << mother->Vz() <<"|Vtx| "<<vtx<<" |Vtxy| "<<vtxy << std::endl;
     }
     if(mother->GetPdgCode() == fgK0SCode)
     {
@@ -1850,4 +2748,35 @@ Int_t AliAnalysisEtMonteCarlo::GetK0InFamily(Int_t partIdx, AliStack* stack)
     }
     return -1;
 }
+Int_t AliAnalysisEtMonteCarlo::PrintFamilyTreeShort(Int_t partIdx, AliStack* stack)
+{ // print family tree
+    TParticle *part = stack->Particle(partIdx);
+    if(part){
+       Float_t vtxy = TMath::Sqrt( TMath::Power(part->Vx(),2) + TMath::Power(part->Vy(),2)  );
+       cout<<part->GetName()<<"( is scondary "<<fSelector->FromSecondaryInteraction(partIdx, *stack)<<", vtx "<<vtxy <<", index "<<partIdx<<")";
+       //cout<<"<-"<<part->GetName()<<"("<<fSelector->FromSecondaryInteraction(partIdx, *stack)<<","<<vtxy <<")";
+    }
+    else{return 0;}
+    Int_t value = PrintMothersShort(partIdx, stack, 1);
+    cout<<endl;
+    return value;
+}
+
+Int_t AliAnalysisEtMonteCarlo::PrintMothersShort(Int_t partIdx, AliStack* stack, Int_t gen)
+{ // print mothers
+    Int_t mothIdx = stack->Particle(partIdx)->GetMother(0);
+    if(mothIdx < 0)
+    {
+      return 0;
+    }
+    TParticle *mother = stack->Particle(mothIdx);
+    if(mother){
+      //Float_t vtx = TMath::Sqrt( TMath::Power(mother->Vx(),2) + TMath::Power(mother->Vy(),2) + TMath::Power(mother->Vz(),2) );
+      Float_t vtxy = TMath::Sqrt( TMath::Power(mother->Vx(),2) + TMath::Power(mother->Vy(),2)  );
+      cout<<"<-"<<mother->GetName()<<"( is scondary "<<fSelector->FromSecondaryInteraction(mothIdx, *stack)<<", vtx "<<vtxy <<", index "<<mothIdx<<")";
+      //std::cout<<tabs << "Vertex: " << mother->Vx() << ", " << mother->Vy() << ", " << mother->Vz() <<"|Vtx| "<<vtx<<" |Vtxy| "<<vtxy << std::endl;
+    }
+    else{return 0;}
+    return PrintMothersShort(mothIdx, stack, gen+1) + 1;
+}