changed pid correction to a constant, added protection for division over zero to...
authorcnattras <cnattras@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 20 Oct 2010 21:50:12 +0000 (21:50 +0000)
committercnattras <cnattras@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 20 Oct 2010 21:50:12 +0000 (21:50 +0000)
PWG4/totEt/AliAnalysisHadEt.cxx
PWG4/totEt/AliAnalysisHadEtCorrections.cxx
PWG4/totEt/AliAnalysisHadEtCorrections.h
PWG4/totEt/AliAnalysisHadEtMonteCarlo.cxx
PWG4/totEt/AliAnalysisHadEtMonteCarlo.h
PWG4/totEt/AliAnalysisHadEtReconstructed.cxx
PWG4/totEt/AliAnalysisHadEtReconstructed.h
PWG4/totEt/AliAnalysisTaskHadEt.cxx
PWG4/totEt/macros/GetCorrections.C

index 09fa8eb..62f5dcc 100644 (file)
@@ -285,7 +285,7 @@ Float_t AliAnalysisHadEt::Et(TParticle *part, float mass){//function to calculat
        //for antinucleons we specifically want to return the kinetic energy plus twice the rest mass
        return (part->Energy()+part->GetMass())*TMath::Sin(part->Theta());
       }
-      if(part->GetPDG(0)->PdgCode()==2212 || part->GetPDG(0)->PdgCode()==2112){//antiproton or antineutron
+      if(part->GetPDG(0)->PdgCode()==2212 || part->GetPDG(0)->PdgCode()==2112){//proton or neutron
        //for nucleons we specifically want to return the kinetic energy only
        return (part->Energy()-part->GetMass())*TMath::Sin(part->Theta());
       }
index 23a9abf..e4ee2ec 100644 (file)
@@ -19,35 +19,47 @@ ClassImp(AliAnalysisHadEtCorrections);
 
 
 AliAnalysisHadEtCorrections::AliAnalysisHadEtCorrections() : TNamed(),
-  fEtaCut(0)
-  ,fAcceptanceCorrectionFull(0)
-  ,fAcceptanceCorrectionEMCAL(0)
-  ,fAcceptanceCorrectionPHOS(0)
-  ,fNeutralCorrection(0)
-  ,fNotHadronicCorrection(0)
-  ,fpTcutCorrectionTPC(0)
-  ,fpTcutCorrectionITS(0)
-  ,fNeutralCorrectionLow(0)
-  ,fNotHadronicCorrectionLow(0)
-  ,ffpTcutCorrectionTPCLow(0)
-  ,ffpTcutCorrectionITSLow(0)
-  ,fNeutralCorrectionHigh(0)
-  ,fNotHadronicCorrectionHigh(0)
-  ,ffpTcutCorrectionTPCHigh(0)
-  ,ffpTcutCorrectionITSHigh(0)
-  ,fnotIDTPC(0)
-  ,fnotIDITS(0)
-  ,fnotIDNoID(0)
-  ,fEfficiencyPionTPC(0)
-  ,fEfficiencyKaonTPC(0)
-  ,fEfficiencyProtonTPC(0)
-  ,fEfficiencyHadronTPC(0)
-  ,fEfficiencyPionITS(0)
-  ,fEfficiencyKaonITS(0)
-  ,fEfficiencyProtonITS(0)
-  ,fEfficiencyHadronITS(0)
-  ,fBackgroundTPC(0)
-  ,fBackgroundITS(0)
+                                                            fEtaCut(0)
+                                                          ,fAcceptanceCorrectionFull(0)
+                                                          ,fAcceptanceCorrectionEMCAL(0)
+                                                          ,fAcceptanceCorrectionPHOS(0)
+                                                          ,fNeutralCorrection(0)
+                                                          ,fNotHadronicCorrection(0)
+                                                          ,fpTcutCorrectionTPC(0)
+                                                          ,fpTcutCorrectionITS(0)
+                                                          ,fNotIDConstTPC(0)
+                                                          ,fNotIDConstITS(0)
+                                                          ,fNotIDConstTPCNoID(0)
+                                                          ,fNotIDConstITSNoID(0)
+                                                          ,fNeutralCorrectionLow(0)
+                                                          ,fNotHadronicCorrectionLow(0)
+                                                          ,ffpTcutCorrectionTPCLow(0)
+                                                          ,ffpTcutCorrectionITSLow(0)
+                                                          ,fNeutralCorrectionHigh(0)
+                                                          ,fNotHadronicCorrectionHigh(0)
+                                                          ,ffpTcutCorrectionTPCHigh(0)
+                                                          ,ffpTcutCorrectionITSHigh(0)
+                                                          ,fNotIDConstTPCLow(0)
+                                                          ,fNotIDConstITSLow(0)
+                                                          ,fNotIDConstTPCNoIDLow(0)
+                                                          ,fNotIDConstITSNoIDLow(0)
+                                                          ,fNotIDConstTPCHigh(0)
+                                                          ,fNotIDConstITSHigh(0)
+                                                          ,fNotIDConstTPCNoIDHigh(0)
+                                                          ,fNotIDConstITSNoIDHigh(0)
+                                                          ,fnotIDTPC(0)
+                                                          ,fnotIDITS(0)
+                                                          ,fnotIDNoID(0)
+                                                          ,fEfficiencyPionTPC(0)
+                                                          ,fEfficiencyKaonTPC(0)
+                                                          ,fEfficiencyProtonTPC(0)
+                                                          ,fEfficiencyHadronTPC(0)
+                                                          ,fEfficiencyPionITS(0)
+                                                          ,fEfficiencyKaonITS(0)
+                                                          ,fEfficiencyProtonITS(0)
+                                                          ,fEfficiencyHadronITS(0)
+                                                          ,fBackgroundTPC(0)
+                                                          ,fBackgroundITS(0)
 {//default constructor
   //This seems to solve a compiler error
   cout<<"Creating new AliAnalysisHadEtCorrections"<<endl;
@@ -84,35 +96,47 @@ AliAnalysisHadEtCorrections::~AliAnalysisHadEtCorrections()
     delete fBackgroundITS;
 }
 AliAnalysisHadEtCorrections::AliAnalysisHadEtCorrections(const AliAnalysisHadEtCorrections *g): TNamed(),
-  fEtaCut(g->fEtaCut)
-  ,fAcceptanceCorrectionFull(g->fAcceptanceCorrectionFull)
-  ,fAcceptanceCorrectionEMCAL(g->fAcceptanceCorrectionEMCAL)
-  ,fAcceptanceCorrectionPHOS(g->fAcceptanceCorrectionPHOS)
-  ,fNeutralCorrection(g->fNeutralCorrection)
-  ,fNotHadronicCorrection(g->fNotHadronicCorrection)
-  ,fpTcutCorrectionTPC(g->fpTcutCorrectionTPC)
-  ,fpTcutCorrectionITS(g->fpTcutCorrectionITS)
-  ,fNeutralCorrectionLow(g->fNeutralCorrectionLow)
-  ,fNotHadronicCorrectionLow(g->fNotHadronicCorrectionLow)
-  ,ffpTcutCorrectionTPCLow(g->ffpTcutCorrectionTPCLow)
-  ,ffpTcutCorrectionITSLow(g->ffpTcutCorrectionITSLow)
-  ,fNeutralCorrectionHigh(g->fNeutralCorrectionHigh)
-  ,fNotHadronicCorrectionHigh(g->fNotHadronicCorrectionHigh)
-  ,ffpTcutCorrectionTPCHigh(g->ffpTcutCorrectionTPCHigh)
-  ,ffpTcutCorrectionITSHigh(g->ffpTcutCorrectionITSHigh)
-  ,fnotIDTPC(0)
-  ,fnotIDITS(0)
-  ,fnotIDNoID(0)
-  ,fEfficiencyPionTPC(0)
-  ,fEfficiencyKaonTPC(0)
-  ,fEfficiencyProtonTPC(0)
-  ,fEfficiencyHadronTPC(0)
-  ,fEfficiencyPionITS(0)
-  ,fEfficiencyKaonITS(0)
-  ,fEfficiencyProtonITS(0)
-  ,fEfficiencyHadronITS(0)
-  ,fBackgroundTPC(0)
-  ,fBackgroundITS(0)
+                                                                                               fEtaCut(g->fEtaCut)
+                                                                                             ,fAcceptanceCorrectionFull(g->fAcceptanceCorrectionFull)
+                                                                                             ,fAcceptanceCorrectionEMCAL(g->fAcceptanceCorrectionEMCAL)
+                                                                                             ,fAcceptanceCorrectionPHOS(g->fAcceptanceCorrectionPHOS)
+                                                                                             ,fNeutralCorrection(g->fNeutralCorrection)
+                                                                                             ,fNotHadronicCorrection(g->fNotHadronicCorrection)
+                                                                                             ,fpTcutCorrectionTPC(g->fpTcutCorrectionTPC)
+                                                                                             ,fpTcutCorrectionITS(g->fpTcutCorrectionITS)
+                                                                                             ,fNotIDConstTPC(g->fNotIDConstTPC)
+                                                                                             ,fNotIDConstITS(g->fNotIDConstITS)
+                                                                                             ,fNotIDConstTPCNoID(g->fNotIDConstTPCNoID)
+                                                                                             ,fNotIDConstITSNoID(g->fNotIDConstITSNoID)
+                                                                                             ,fNeutralCorrectionLow(g->fNeutralCorrectionLow)
+                                                                                             ,fNotHadronicCorrectionLow(g->fNotHadronicCorrectionLow)
+                                                                                             ,ffpTcutCorrectionTPCLow(g->ffpTcutCorrectionTPCLow)
+                                                                                             ,ffpTcutCorrectionITSLow(g->ffpTcutCorrectionITSLow)
+                                                                                             ,fNeutralCorrectionHigh(g->fNeutralCorrectionHigh)
+                                                                                             ,fNotHadronicCorrectionHigh(g->fNotHadronicCorrectionHigh)
+                                                                                             ,ffpTcutCorrectionTPCHigh(g->ffpTcutCorrectionTPCHigh)
+                                                                                             ,ffpTcutCorrectionITSHigh(g->ffpTcutCorrectionITSHigh)
+                                                                                             ,fNotIDConstTPCLow(g->fNotIDConstTPCLow)
+                                                                                             ,fNotIDConstITSLow(g->fNotIDConstITSLow)
+                                                                                             ,fNotIDConstTPCNoIDLow(g->fNotIDConstTPCNoIDLow)
+                                                                                             ,fNotIDConstITSNoIDLow(g->fNotIDConstITSNoIDLow)
+                                                                                             ,fNotIDConstTPCHigh(g->fNotIDConstTPCHigh)
+                                                                                             ,fNotIDConstITSHigh(g->fNotIDConstITSHigh)
+                                                                                             ,fNotIDConstTPCNoIDHigh(g->fNotIDConstTPCNoIDHigh)
+                                                                                             ,fNotIDConstITSNoIDHigh(g->fNotIDConstITSNoIDHigh)
+                                                                                             ,fnotIDTPC(0)
+                                                                                             ,fnotIDITS(0)
+                                                                                             ,fnotIDNoID(0)
+                                                                                             ,fEfficiencyPionTPC(0)
+                                                                                             ,fEfficiencyKaonTPC(0)
+                                                                                             ,fEfficiencyProtonTPC(0)
+                                                                                             ,fEfficiencyHadronTPC(0)
+                                                                                             ,fEfficiencyPionITS(0)
+                                                                                             ,fEfficiencyKaonITS(0)
+                                                                                             ,fEfficiencyProtonITS(0)
+                                                                                             ,fEfficiencyHadronITS(0)
+                                                                                             ,fBackgroundTPC(0)
+                                                                                             ,fBackgroundITS(0)
 {//copy constructor
   //SetName(g->GetName());
   fnotIDTPC = new TH1D(*(g->fnotIDTPC));
@@ -255,3 +279,18 @@ Float_t AliAnalysisHadEtCorrections::GetITSEfficiencyCorrectionHadron(const floa
   if(eff<=0.0){cerr<<"Efficiency is zero!"<<endl;  return 0.0;}
   return 1.0/eff;
 }
+Float_t AliAnalysisHadEtCorrections::GetNotIDCorrectionTPC(const float pT){//get correction for unidentified particles in the TPC
+  Float_t val = fnotIDTPC->GetBinContent(fnotIDTPC->FindBin(pT));
+  if(val>0.0) return 1.0/(val);
+  else{return 0.0;}
+}
+Float_t AliAnalysisHadEtCorrections::GetNotIDCorrectionITS(const float pT){//Get correction for unidentified particles in the ITS
+  Float_t val = fnotIDITS->GetBinContent(fnotIDITS->FindBin(pT));
+  if(val>0.0) return 1.0/(val);
+  else{return 0.0;}
+}
+Float_t AliAnalysisHadEtCorrections::GetNotIDCorrectionNoPID(const float pT){//Get correction for particles in the case that there is no particle identification
+  Float_t val = fnotIDNoID->GetBinContent(fnotIDNoID->FindBin(pT));
+  if(val>0.0) return 1.0/(val);
+  else{return 0.0;}
+}
index db71a0d..c6f3e77 100644 (file)
@@ -30,6 +30,10 @@ public:
     Float_t GetNotHadronicCorrection() const {return fNotHadronicCorrection;}
     Float_t GetpTCutCorrectionTPC() const {return fpTcutCorrectionTPC;}
     Float_t GetpTCutCorrectionITS() const {return fpTcutCorrectionITS;}
+    Float_t GetNotIDConstCorrectionTPC() const {return fNotIDConstTPC;}
+    Float_t GetNotIDConstCorrectionITS() const {return fNotIDConstITS;}
+    Float_t GetNotIDConstCorrectionTPCNoID() const {return fNotIDConstTPCNoID;}
+    Float_t GetNotIDConstCorrectionITSNoID() const {return fNotIDConstITSNoID;}
     Float_t GetNeutralCorrectionLowBound() const {return fNeutralCorrectionLow;}
     Float_t GetNotHadronicCorrectionLowBound() const {return fNotHadronicCorrectionLow;}
     Float_t GetpTCutCorrectionTPCLowBound() const {return ffpTcutCorrectionTPCLow;}
@@ -38,6 +42,10 @@ public:
     Float_t GetNotHadronicCorrectionHighBound() const {return fNotHadronicCorrectionHigh;}
     Float_t GetpTCutCorrectionTPCHighBound() const {return ffpTcutCorrectionTPCHigh;}
     Float_t GetpTCutCorrectionITSHighBound() const {return ffpTcutCorrectionITSHigh;}
+    Float_t GetNotIDConstCorrectionTPCLowBound() const {return fNotIDConstTPCLow;}
+    Float_t GetNotIDConstCorrectionITSLowBound() const {return fNotIDConstITSLow;}
+    Float_t GetNotIDConstCorrectionTPCNoIDLowBound() const {return fNotIDConstTPCNoIDLow;}
+    Float_t GetNotIDConstCorrectionITSNoIDLowBound() const {return fNotIDConstITSNoIDLow;}
     TH1D *GetNotIDCorrectionTPC() const {return fnotIDTPC;}
     TH1D *GetNotIDCorrectionITS() const {return fnotIDITS;}
     TH1D *GetNotIDCorrectionNoPID() const {return fnotIDNoID;}
@@ -53,9 +61,9 @@ public:
     TH1D *GetBackgroundCorrectionITS() const {return fBackgroundITS;}
 
     //This is stored as the inverse of the correction
-    Float_t GetNotIDCorrectionTPC(const float pT){return 1.0/(fnotIDTPC->GetBinContent(fnotIDTPC->FindBin(pT)));}
-    Float_t GetNotIDCorrectionITS(const float pT){return 1.0/(fnotIDITS->GetBinContent(fnotIDITS->FindBin(pT)));}
-    Float_t GetNotIDCorrectionNoPID(const float pT){return 1.0/(fnotIDNoID->GetBinContent(fnotIDNoID->FindBin(pT)));}
+    Float_t GetNotIDCorrectionTPC(const float pT);//{return 1.0/(fnotIDTPC->GetBinContent(fnotIDTPC->FindBin(pT)));}
+    Float_t GetNotIDCorrectionITS(const float pT);//{return 1.0/(fnotIDITS->GetBinContent(fnotIDITS->FindBin(pT)));}
+    Float_t GetNotIDCorrectionNoPID(const float pT);//{return 1.0/(fnotIDNoID->GetBinContent(fnotIDNoID->FindBin(pT)));}
     //As is this...
     Float_t GetTPCEfficiencyCorrectionPion(const float pT);
     Float_t GetTPCEfficiencyCorrectionKaon(const float pT);
@@ -78,6 +86,10 @@ public:
     void SetNotHadronicCorrection(const Float_t val){fNotHadronicCorrection=val;}
     void SetpTCutCorrectionTPC(const Float_t val){fpTcutCorrectionTPC=val;}
     void SetpTCutCorrectionITS(const Float_t val){fpTcutCorrectionITS=val;}
+    void SetNotIDConstCorrectionTPC(const Float_t val){fNotIDConstTPC=val;}
+    void SetNotIDConstCorrectionITS(const Float_t val){fNotIDConstITS=val;}
+    void SetNotIDConstCorrectionTPCNoID(const Float_t val){fNotIDConstTPCNoID=val;}
+    void SetNotIDConstCorrectionITSNoID(const Float_t val){fNotIDConstITSNoID=val;}
     void SetNeutralCorrectionLowBound(const Float_t val){fNeutralCorrectionLow=val;}
     void SetNotHadronicCorrectionLowBound(const Float_t val){fNotHadronicCorrectionLow=val;}
     void SetpTCutCorrectionTPCLowBound(const Float_t val){ffpTcutCorrectionTPCLow=val;}
@@ -86,6 +98,14 @@ public:
     void SetNotHadronicCorrectionHighBound(const Float_t val){fNotHadronicCorrectionHigh=val;}
     void SetpTCutCorrectionTPCHighBound(const Float_t val){ffpTcutCorrectionTPCHigh=val;}
     void SetpTCutCorrectionITSHighBound(const Float_t val){ffpTcutCorrectionITSHigh=val;}
+    void SetNotIDConstCorrectionTPCLowBound(const Float_t val){fNotIDConstTPCLow=val;}
+    void SetNotIDConstCorrectionITSLowBound(const Float_t val){fNotIDConstITSLow=val;}
+    void SetNotIDConstCorrectionTPCNoIDLowBound(const Float_t val){fNotIDConstTPCNoIDLow=val;}
+    void SetNotIDConstCorrectionITSNoIDLowBound(const Float_t val){fNotIDConstITSNoIDLow=val;}
+    void SetNotIDConstCorrectionTPCHighBound(const Float_t val){fNotIDConstTPCHigh=val;}
+    void SetNotIDConstCorrectionITSHighBound(const Float_t val){fNotIDConstITSHigh=val;}
+    void SetNotIDConstCorrectionTPCNoIDHighBound(const Float_t val){fNotIDConstTPCNoIDHigh=val;}
+    void SetNotIDConstCorrectionITSNoIDHighBound(const Float_t val){fNotIDConstITSNoIDHigh=val;}
     void SetNotIDCorrectionTPC(const TH1D *histo){fnotIDTPC=(TH1D*) histo;}
     void SetNotIDCorrectionITS(const TH1D *histo){fnotIDITS=(TH1D*) histo;}
     void SetNotIDCorrectionNoPID(const TH1D *histo){fnotIDNoID=(TH1D*) histo;}
@@ -118,6 +138,10 @@ protected:
     Float_t fNotHadronicCorrection;//the correction for the fraction of energy which is not measured by the tracking detectors 
     Float_t fpTcutCorrectionTPC;//the correction for the momentum cut for the tpc (150 MeV/c)
     Float_t fpTcutCorrectionITS;//the correction for the momentum cut for the ITS (100 MeV/c)
+    Float_t fNotIDConstTPC;//the correction for the constant correction for unidentified particles with the TPC momentum cut
+    Float_t fNotIDConstITS;//the correction for the constant correction for unidentified particles with the ITS momentum cut
+    Float_t fNotIDConstTPCNoID;//the correction for the constant correction for unidentified particles with the TPC momentum cut if no PID was done
+    Float_t fNotIDConstITSNoID;//the correction for the constant correction for unidentified particles with the ITS momentum cut if no PID was done
     Float_t fNeutralCorrectionLow;//the low bound on the neutral energy fraction correction
     Float_t fNotHadronicCorrectionLow;//the low bound on the hadronic energy fraction correction
     Float_t ffpTcutCorrectionTPCLow;//the low bound on the TPC momentum cut correction
@@ -126,6 +150,14 @@ protected:
     Float_t fNotHadronicCorrectionHigh;//the high bound on the hadronic energy correction
     Float_t ffpTcutCorrectionTPCHigh;//the high bound on the TPC momentum cut correction
     Float_t ffpTcutCorrectionITSHigh;//the high bound on the ITS momentum cut correction
+    Float_t fNotIDConstTPCLow;//the correction for the constant correction for unidentified particles with the TPC momentum cut
+    Float_t fNotIDConstITSLow;//the correction for the constant correction for unidentified particles with the ITS momentum cut
+    Float_t fNotIDConstTPCNoIDLow;//the correction for the constant correction for unidentified particles with the TPC momentum cut if no PID was done
+    Float_t fNotIDConstITSNoIDLow;//the correction for the constant correction for unidentified particles with the ITS momentum cut if no PID was done
+    Float_t fNotIDConstTPCHigh;//the correction for the constant correction for unidentified particles with the TPC momentum cut
+    Float_t fNotIDConstITSHigh;//the correction for the constant correction for unidentified particles with the ITS momentum cut
+    Float_t fNotIDConstTPCNoIDHigh;//the correction for the constant correction for unidentified particles with the TPC momentum cut if no PID was done
+    Float_t fNotIDConstITSNoIDHigh;//the correction for the constant correction for unidentified particles with the ITS momentum cut if no PID was done
 
     //Histograms with the pT dependent fCorrections
     TH1D *fnotIDTPC;//correction for unidentified tracks in the TPC
index 25db7d5..5ba7d51 100644 (file)
@@ -30,13 +30,14 @@ using namespace std;
 ClassImp(AliAnalysisHadEtMonteCarlo);
 
 
-// Int_t AliAnalysisHadEtMonteCarlo::fgNumSmearWidths = 4;
-// Float_t AliAnalysisHadEtMonteCarlo::fgSmearWidths[4] = {0.005,0.006,0.007,0.008};
+Int_t AliAnalysisHadEtMonteCarlo::fgNumSmearWidths = 4;
+Float_t AliAnalysisHadEtMonteCarlo::fgSmearWidths[4] = {0.005,0.006,0.007,0.008};
 
 AliAnalysisHadEtMonteCarlo::AliAnalysisHadEtMonteCarlo():AliAnalysisHadEt()
-                                                     //,fSimPiKPEt(0)
+                                                       ,fSimPiKPEt(0)
                                                        ,fSimHadEt(0)
                                                        ,fSimTotEt(0) 
+                                                       ,fPtSmearer(0)
 {
 //   for(int i=0;i<fgNumSmearWidths;i++){
 //     //fSimPiKPEtSmeared[i] = 0.0;
@@ -44,13 +45,14 @@ AliAnalysisHadEtMonteCarlo::AliAnalysisHadEtMonteCarlo():AliAnalysisHadEt()
 }
 AliAnalysisHadEtMonteCarlo::~AliAnalysisHadEtMonteCarlo(){//destructor
   //if(fSimPiKPEtSmeared) delete [] fSimPiKPEtSmeared;
+  if(fPtSmearer) delete fPtSmearer;
 }
 
 void AliAnalysisHadEtMonteCarlo::ResetEventValues(){//resetting event variables
   AliAnalysisHadEt::ResetEventValues();
     fSimHadEt=0.0;
     fSimTotEt=0.0;
-    //fSimPiKPEt=0.0;
+    fSimPiKPEt=0.0;
 }
 Int_t AliAnalysisHadEtMonteCarlo::AnalyseEvent(AliVEvent* ev,AliVEvent* ev2)
 { // analyse MC and real event info
@@ -156,7 +158,8 @@ Int_t AliAnalysisHadEtMonteCarlo::AnalyseEvent(AliVEvent* ev,AliVEvent* ev2)
          }
          else{//analysis
            if(stack->IsPhysicalPrimary(label)){
-             if (TMath::Abs(simPart->Eta()) < fCuts->GetCommonEtaCut())            {
+             if (TMath::Abs(simPart->Eta()) < fCuts->GetCommonEtaCut()){
+             //if (TMath::Abs(simPart->Eta()) < 0.7)       {
 
                Int_t pdgCode =  simPart->GetPDG(0)->PdgCode();
                Int_t mypid = 0;
@@ -320,65 +323,67 @@ Int_t AliAnalysisHadEtMonteCarlo::AnalyseEvent(AliVEvent* ev,AliVEvent* ev2)
            }
            else{//not a primary - we're after V0 daughters!
              //cout<<"I'm a secondary "<<simPart->GetName()<<"!";//<<endl;
-             TParticle *mom = stack->Particle(simPart->GetFirstMother());
-             if(mom){
-               TParticlePDG *pc = mom->GetPDG(0);
-               if(pc){
-                 Int_t pdgCode =  mom->GetPDG(0)->PdgCode();
-                 if(pdgCode == fgLambdaCode){
-                   float myEt = Et(simPart);
-                   FillHisto2D(Form("EtReconstructed%sLambdaDaughters",cutName->Data()),track->Pt(),track->Eta(),myEt);
-                 }
-                 if(pdgCode == fgAntiLambdaCode){
-                   float myEt = Et(simPart);
-                   FillHisto2D(Form("EtReconstructed%sAntiLambdaDaughters",cutName->Data()),track->Pt(),track->Eta(),myEt);
-                 }
-                 if(pdgCode == fgK0SCode){
-                   float myEt = Et(simPart);
-                   FillHisto2D(Form("EtReconstructed%sK0SDaughters",cutName->Data()),track->Pt(),track->Eta(),myEt);
-                 }
-                 if(pdgCode == fgXiCode){
-                   float myEt = Et(simPart);
-                   FillHisto2D(Form("EtReconstructed%sXiDaughters",cutName->Data()),track->Pt(),track->Eta(),myEt);
-                 }
-                 if(pdgCode == fgAntiXiCode){
-                   float myEt = Et(simPart);
-                   FillHisto2D(Form("EtReconstructed%sAntiXiDaughters",cutName->Data()),track->Pt(),track->Eta(),myEt);
-                 }
-                 if(pdgCode == fgOmegaCode){
-                   float myEt = Et(simPart);
-                   FillHisto2D(Form("EtReconstructed%sOmegaDaughters",cutName->Data()),track->Pt(),track->Eta(),myEt);
-                 }
-                 if(pdgCode == fgXiCode){
-                   float myEt = Et(simPart);
-                   FillHisto2D(Form("EtReconstructed%sAntiOmegaDaughters",cutName->Data()),track->Pt(),track->Eta(),myEt);
-                 }
+             if (TMath::Abs(simPart->Eta()) < fCuts->GetCommonEtaCut()){
+               TParticle *mom = stack->Particle(simPart->GetFirstMother());
+               if(mom){
+                 TParticlePDG *pc = mom->GetPDG(0);
+                 if(pc){
+                   Int_t pdgCode =  mom->GetPDG(0)->PdgCode();
+                   if(pdgCode == fgLambdaCode){
+                     float myEt = Et(simPart);
+                     FillHisto2D(Form("EtReconstructed%sLambdaDaughters",cutName->Data()),track->Pt(),track->Eta(),myEt);
+                   }
+                   if(pdgCode == fgAntiLambdaCode){
+                     float myEt = Et(simPart);
+                     FillHisto2D(Form("EtReconstructed%sAntiLambdaDaughters",cutName->Data()),track->Pt(),track->Eta(),myEt);
+                   }
+                   if(pdgCode == fgK0SCode){
+                     float myEt = Et(simPart);
+                     FillHisto2D(Form("EtReconstructed%sK0SDaughters",cutName->Data()),track->Pt(),track->Eta(),myEt);
+                   }
+                   if(pdgCode == fgXiCode){
+                     float myEt = Et(simPart);
+                     FillHisto2D(Form("EtReconstructed%sXiDaughters",cutName->Data()),track->Pt(),track->Eta(),myEt);
+                   }
+                   if(pdgCode == fgAntiXiCode){
+                     float myEt = Et(simPart);
+                     FillHisto2D(Form("EtReconstructed%sAntiXiDaughters",cutName->Data()),track->Pt(),track->Eta(),myEt);
+                   }
+                   if(pdgCode == fgOmegaCode){
+                     float myEt = Et(simPart);
+                     FillHisto2D(Form("EtReconstructed%sOmegaDaughters",cutName->Data()),track->Pt(),track->Eta(),myEt);
+                   }
+                   if(pdgCode == fgXiCode){
+                     float myEt = Et(simPart);
+                     FillHisto2D(Form("EtReconstructed%sAntiOmegaDaughters",cutName->Data()),track->Pt(),track->Eta(),myEt);
+                   }
 
-                 if(mom->GetFirstMother()>0){
-                   TParticle *grandma = stack->Particle(mom->GetFirstMother());
-                   if(grandma){
-                     Int_t pdgCodeMom =  mom->GetPDG(0)->PdgCode();
-                     if(pdgCodeMom==fgPiPlusCode || pdgCodeMom==fgPiMinusCode || pdgCodeMom==fgProtonCode ||pdgCodeMom==fgAntiProtonCode || pdgCodeMom==fgKPlusCode || pdgCode==fgKMinusCode){
-                       //cout<<" my grandmother is "<<grandma->GetName()<<" "<<endl;
-                       Int_t pdgCodeGrandma =  grandma->GetPDG(0)->PdgCode();
+                   if(mom->GetFirstMother()>0){
+                     TParticle *grandma = stack->Particle(mom->GetFirstMother());
+                     if(grandma){
+                       Int_t pdgCodeMom =  mom->GetPDG(0)->PdgCode();
+                       if(pdgCodeMom==fgPiPlusCode || pdgCodeMom==fgPiMinusCode || pdgCodeMom==fgProtonCode ||pdgCodeMom==fgAntiProtonCode || pdgCodeMom==fgKPlusCode || pdgCode==fgKMinusCode){
+                         //cout<<" my grandmother is "<<grandma->GetName()<<" "<<endl;
+                         Int_t pdgCodeGrandma =  grandma->GetPDG(0)->PdgCode();
                      
-                       if(pdgCodeGrandma == fgXiCode){
-                         float myEt = Et(simPart);
-                         FillHisto2D(Form("EtReconstructed%sXiDaughters",cutName->Data()),track->Pt(),track->Eta(),myEt);
-                       }
-                       if(pdgCodeGrandma == fgAntiXiCode){
-                         float myEt = Et(simPart);
-                         FillHisto2D(Form("EtReconstructed%sAntiXiDaughters",cutName->Data()),track->Pt(),track->Eta(),myEt);
-                       }
-                       if(pdgCodeGrandma == fgOmegaCode){
-                         float myEt = Et(simPart);
-                         FillHisto2D(Form("EtReconstructed%sOmegaDaughters",cutName->Data()),track->Pt(),track->Eta(),myEt);
-                       }
-                       if(pdgCodeGrandma == fgXiCode){
-                         float myEt = Et(simPart);
-                         FillHisto2D(Form("EtReconstructed%sAntiOmegaDaughters",cutName->Data()),track->Pt(),track->Eta(),myEt);
-                       }
+                         if(pdgCodeGrandma == fgXiCode){
+                           float myEt = Et(simPart);
+                           FillHisto2D(Form("EtReconstructed%sXiDaughters",cutName->Data()),track->Pt(),track->Eta(),myEt);
+                         }
+                         if(pdgCodeGrandma == fgAntiXiCode){
+                           float myEt = Et(simPart);
+                           FillHisto2D(Form("EtReconstructed%sAntiXiDaughters",cutName->Data()),track->Pt(),track->Eta(),myEt);
+                         }
+                         if(pdgCodeGrandma == fgOmegaCode){
+                           float myEt = Et(simPart);
+                           FillHisto2D(Form("EtReconstructed%sOmegaDaughters",cutName->Data()),track->Pt(),track->Eta(),myEt);
+                         }
+                         if(pdgCodeGrandma == fgXiCode){
+                           float myEt = Et(simPart);
+                           FillHisto2D(Form("EtReconstructed%sAntiOmegaDaughters",cutName->Data()),track->Pt(),track->Eta(),myEt);
+                         }
 
+                       }
                      }
                    }
                  }
@@ -410,10 +415,12 @@ Int_t AliAnalysisHadEtMonteCarlo::AnalyseEvent(AliVEvent* ev)
 
     Int_t nPrim = stack->GetNtrack();
 
-//     Float_t fSimPiKPEtSmeared[fgNumSmearWidths];
-//     for(int i=0;i<fgNumSmearWidths;i++){
-//       fSimPiKPEtSmeared[i] = 0.0;
-//     }
+    Float_t fSimPiKPEtPtSmeared = 0;
+    Float_t fSimPiKPEtEfficiencySmeared = 0;
+    Float_t fSimPiKPEtPtCutSmearedTPC = 0;
+    Float_t fSimPiKPEtPtCutSmearedITS = 0;
+    Float_t fSimPiKPEtPIDSmeared = 0;
+    Float_t fSimPiKPEtPIDSmearedNoID = 0;
     //=================Tracks which may or may not have been reconstructed=================
 
     for (Int_t iPart = 0; iPart < nPrim; iPart++)
@@ -438,46 +445,76 @@ Int_t AliAnalysisHadEtMonteCarlo::AnalyseEvent(AliVEvent* ev)
            //cout<<pdgCode->PdgCode()<<" ";
            //fPdgDB->GetParticle("pi+")->PdgCode();
            bool filled = false;
+           //Investigating smearing...
+           //Numbers are realistic correction factors from previous studies
+           if(pdgCode==fgPiPlusCode ||pdgCode==fgPiMinusCode ||pdgCode==fgKPlusCode ||pdgCode==fgKMinusCode ||pdgCode==fgProtonCode ||pdgCode==fgAntiProtonCode){
+             //To investigate Smearing...
+             Float_t myet = Et(part);
+             fSimPiKPEt += myet;
+             Float_t theta = part->Theta();
+             Short_t charge = 1;
+             Float_t momentum = part->P();
+             //pt smearing
+             Float_t pSmeared = momentum *  fPtSmearer->Gaus(1,0.005);//Gaussian centered around 1
+             fSimPiKPEtPtSmeared += Et(pSmeared,theta,pdgCode,charge);
+             //Efficiency smearing
+             float efficiency = 2.26545*TMath::Exp(-TMath::Power(9.99977e-01/part->Pt(),7.85488e-02));//simple rough efficiency from fitting curve
+             if(fPtSmearer->Binomial(1,efficiency) ==1){
+               fSimPiKPEtEfficiencySmeared += (1.0/efficiency)*myet;
+             }
+             //pT cut smeared
+             if(part->Pt()>0.10){fSimPiKPEtPtCutSmearedITS +=1.00645645*myet;}
+             if(part->Pt()>0.15){fSimPiKPEtPtCutSmearedTPC +=1.02000723*myet;}
+             //PID smearing
+             fSimPiKPEtPIDSmearedNoID += 1.02679314*Et(momentum,theta,fgPiPlusCode,charge);
+             if(part->P()<1.0){//then the particle would have been ID'd
+               fSimPiKPEtPIDSmeared += 1.0085942*myet;
+             }
+             else{//Then it would have been assumed to be a pion
+               fSimPiKPEtPIDSmeared += 1.0085942*Et(momentum,theta,fgPiPlusCode,charge);
+             }
+           }
+
            //============Charged hadrons===================================
            if(pdgCode == fgPiPlusCode){
              //cout<<"I'm a simulated primary "<<part->GetName()<<"! "<<"my label is "<<part->GetFirstMother()<<" pt "<<part->Pt()<<endl;
              float myEt = Et(part);
+
              fSimHadEt += myEt;
              fSimTotEt += myEt;
-             //To investigate p Smearing...
-//           fSimPiKPEt += myEt;
-//           Float_t theta = part->Theta();
-//           Short_t charge = 1;
-//           for(int i=0;i<fgNumSmearWidths;i++){
-//             Float_t pSmeared = part->P() *  fpSmearer->Gaus(1,fgSmearWidths[i]);//Gaussian centered around 1
-//             fSimPiKPEtSmeared[i] += AliAnalysisHadEt::Et(pSmeared,theta,pdgCode,charge);
-//           }
+
              FillHisto2D("EtSimulatedPiPlus",part->Pt(),part->Eta(),myEt);
              FillHisto2D("EtNSimulatedPiPlus",part->Pt(),part->Eta(),1.0);
              FillHisto2D("EtSimulatedChargedHadron",part->Pt(),part->Eta(),myEt);
              FillHisto2D("EtNSimulatedChargedHadron",part->Pt(),part->Eta(),1.0);
              FillHisto2D("EtSimulatedChargedHadronAssumingPion",part->Pt(),part->Eta(),myEt);
              FillHisto2D("EtSimulatedAllHadron",part->Pt(),part->Eta(),myEt);
+             Short_t charge = 1;
+             Float_t myEtLow = Et(0.0,part->Theta(),pdgCode,charge);
+             Float_t myEtITS = Et(0.10/TMath::Sin(part->Theta()),part->Theta(),pdgCode,charge);
+             Float_t myEtTPC = Et(0.15/TMath::Sin(part->Theta()),part->Theta(),pdgCode,charge);
+             FillHisto2D("EtSimulatedChargedHadronAssumingNoPt",part->Pt(),part->Eta(),myEtLow);
+             FillHisto2D("EtSimulatedChargedHadronAssumingPtTPCCut",part->Pt(),part->Eta(),myEtTPC);
+             FillHisto2D("EtSimulatedChargedHadronAssumingPtITSCut",part->Pt(),part->Eta(),myEtITS);
              filled = true;
            }
            if(pdgCode == fgPiMinusCode){
              float myEt = Et(part);
              fSimHadEt += myEt;
              fSimTotEt += myEt;
-//           //To investigate p Smearing...
-//           fSimPiKPEt += myEt;
-//           Float_t theta = part->Theta();
-//           Short_t charge = -1;
-//           for(int i=0;i<fgNumSmearWidths;i++){
-//             Float_t pSmeared = part->P() *  fpSmearer->Gaus(1,fgSmearWidths[i]);//Gaussian centered around 1
-//             fSimPiKPEtSmeared[i] += AliAnalysisHadEt::Et(pSmeared,theta,pdgCode,charge);
-//           }
              FillHisto2D("EtSimulatedPiMinus",part->Pt(),part->Eta(),myEt);
              FillHisto2D("EtNSimulatedPiMinus",part->Pt(),part->Eta(),1.0);
              FillHisto2D("EtSimulatedChargedHadron",part->Pt(),part->Eta(),myEt);
              FillHisto2D("EtNSimulatedChargedHadron",part->Pt(),part->Eta(),1.0);
              FillHisto2D("EtSimulatedChargedHadronAssumingPion",part->Pt(),part->Eta(),myEt);
              FillHisto2D("EtSimulatedAllHadron",part->Pt(),part->Eta(),myEt);
+             Short_t charge = -1;
+             Float_t myEtLow = Et(0.0,part->Theta(),pdgCode,charge);
+             Float_t myEtITS = Et(0.10/TMath::Sin(part->Theta()),part->Theta(),pdgCode,charge);
+             Float_t myEtTPC = Et(0.15/TMath::Sin(part->Theta()),part->Theta(),pdgCode,charge);
+             FillHisto2D("EtSimulatedChargedHadronAssumingNoPt",part->Pt(),part->Eta(),myEtLow);
+             FillHisto2D("EtSimulatedChargedHadronAssumingPtTPCCut",part->Pt(),part->Eta(),myEtTPC);
+             FillHisto2D("EtSimulatedChargedHadronAssumingPtITSCut",part->Pt(),part->Eta(),myEtITS);
              filled = true;
            }
            if(pdgCode == fgKPlusCode){
@@ -485,14 +522,6 @@ Int_t AliAnalysisHadEtMonteCarlo::AnalyseEvent(AliVEvent* ev)
              float myEtPi = Et(part,fgPionMass);
              fSimHadEt += myEt;
              fSimTotEt += myEt;
-             //To investigate p Smearing...
-//           fSimPiKPEt += myEt;
-//           Float_t theta = part->Theta();
-//           Short_t charge = 1;
-//           for(int i=0;i<fgNumSmearWidths;i++){
-//             Float_t pSmeared = part->P() *  fpSmearer->Gaus(1,fgSmearWidths[i]);//Gaussian centered around 1
-//             fSimPiKPEtSmeared[i] += AliAnalysisHadEt::Et(pSmeared,theta,pdgCode,charge);
-//           }
              FillHisto2D("EtSimulatedKPlus",part->Pt(),part->Eta(),myEt);
              FillHisto2D("EtNSimulatedKPlus",part->Pt(),part->Eta(),1.0);
              FillHisto2D("EtSimulatedChargedHadron",part->Pt(),part->Eta(),myEt);
@@ -500,6 +529,13 @@ Int_t AliAnalysisHadEtMonteCarlo::AnalyseEvent(AliVEvent* ev)
              FillHisto2D("EtSimulatedChargedHadronAssumingPion",part->Pt(),part->Eta(),myEtPi);
              FillHisto2D("EtSimulatedKPlusAssumingPion",part->Pt(),part->Eta(),myEtPi);
              FillHisto2D("EtSimulatedAllHadron",part->Pt(),part->Eta(),myEt);
+             Short_t charge = 1;
+             Float_t myEtLow = Et(0.0,part->Theta(),pdgCode,charge);
+             Float_t myEtITS = Et(0.10/TMath::Sin(part->Theta()),part->Theta(),pdgCode,charge);
+             Float_t myEtTPC = Et(0.15/TMath::Sin(part->Theta()),part->Theta(),pdgCode,charge);
+             FillHisto2D("EtSimulatedChargedHadronAssumingNoPt",part->Pt(),part->Eta(),myEtLow);
+             FillHisto2D("EtSimulatedChargedHadronAssumingPtTPCCut",part->Pt(),part->Eta(),myEtTPC);
+             FillHisto2D("EtSimulatedChargedHadronAssumingPtITSCut",part->Pt(),part->Eta(),myEtITS);
              filled = true;
            }
            if(pdgCode == fgKMinusCode){
@@ -507,14 +543,6 @@ Int_t AliAnalysisHadEtMonteCarlo::AnalyseEvent(AliVEvent* ev)
              float myEtPi = Et(part,fgPionMass);
              fSimHadEt += myEt;
              fSimTotEt += myEt;
-             //To investigate p Smearing...
-//           fSimPiKPEt += myEt;
-//           Float_t theta = part->Theta();
-//           Short_t charge = -1;
-//           for(int i=0;i<fgNumSmearWidths;i++){
-//             Float_t pSmeared = part->P() *  fpSmearer->Gaus(1,fgSmearWidths[i]);//Gaussian centered around 1
-//             fSimPiKPEtSmeared[i] += AliAnalysisHadEt::Et(pSmeared,theta,pdgCode,charge);
-//           }
              FillHisto2D("EtSimulatedKMinus",part->Pt(),part->Eta(),myEt);
              FillHisto2D("EtNSimulatedKMinus",part->Pt(),part->Eta(),1.0);
              FillHisto2D("EtSimulatedChargedHadron",part->Pt(),part->Eta(),myEt);
@@ -522,6 +550,13 @@ Int_t AliAnalysisHadEtMonteCarlo::AnalyseEvent(AliVEvent* ev)
              FillHisto2D("EtSimulatedChargedHadronAssumingPion",part->Pt(),part->Eta(),myEtPi);
              FillHisto2D("EtSimulatedKMinusAssumingPion",part->Pt(),part->Eta(),myEtPi);
              FillHisto2D("EtSimulatedAllHadron",part->Pt(),part->Eta(),myEt);
+             Short_t charge = -1;
+             Float_t myEtLow = Et(0.0,part->Theta(),pdgCode,charge);
+             Float_t myEtITS = Et(0.10/TMath::Sin(part->Theta()),part->Theta(),pdgCode,charge);
+             Float_t myEtTPC = Et(0.15/TMath::Sin(part->Theta()),part->Theta(),pdgCode,charge);
+             FillHisto2D("EtSimulatedChargedHadronAssumingNoPt",part->Pt(),part->Eta(),myEtLow);
+             FillHisto2D("EtSimulatedChargedHadronAssumingPtTPCCut",part->Pt(),part->Eta(),myEtTPC);
+             FillHisto2D("EtSimulatedChargedHadronAssumingPtITSCut",part->Pt(),part->Eta(),myEtITS);
              filled = true;
            }
            if(pdgCode == fgProtonCode){
@@ -529,14 +564,6 @@ Int_t AliAnalysisHadEtMonteCarlo::AnalyseEvent(AliVEvent* ev)
              float myEtPi = Et(part,fgPionMass);
              fSimHadEt += myEt;
              fSimTotEt += myEt;
-             //To investigate p Smearing...
-//           fSimPiKPEt += myEt;
-//           Float_t theta = part->Theta();
-//           Short_t charge = 1;
-//           for(int i=0;i<fgNumSmearWidths;i++){
-//             Float_t pSmeared = part->P() *  fpSmearer->Gaus(1,fgSmearWidths[i]);//Gaussian centered around 1
-//             fSimPiKPEtSmeared[i] += AliAnalysisHadEt::Et(pSmeared,theta,pdgCode,charge);
-//           }
              FillHisto2D("EtSimulatedProton",part->Pt(),part->Eta(),myEt);
              FillHisto2D("EtNSimulatedProton",part->Pt(),part->Eta(),1.0);
              FillHisto2D("EtSimulatedChargedHadron",part->Pt(),part->Eta(),myEt);
@@ -544,6 +571,13 @@ Int_t AliAnalysisHadEtMonteCarlo::AnalyseEvent(AliVEvent* ev)
              FillHisto2D("EtSimulatedChargedHadronAssumingPion",part->Pt(),part->Eta(),myEtPi);
              FillHisto2D("EtSimulatedProtonAssumingPion",part->Pt(),part->Eta(),myEtPi);
              FillHisto2D("EtSimulatedAllHadron",part->Pt(),part->Eta(),myEt);
+             Short_t charge = 1;
+             Float_t myEtLow = Et(0.0,part->Theta(),pdgCode,charge);
+             Float_t myEtITS = Et(0.10/TMath::Sin(part->Theta()),part->Theta(),pdgCode,charge);
+             Float_t myEtTPC = Et(0.15/TMath::Sin(part->Theta()),part->Theta(),pdgCode,charge);
+             FillHisto2D("EtSimulatedChargedHadronAssumingNoPt",part->Pt(),part->Eta(),myEtLow);
+             FillHisto2D("EtSimulatedChargedHadronAssumingPtTPCCut",part->Pt(),part->Eta(),myEtTPC);
+             FillHisto2D("EtSimulatedChargedHadronAssumingPtITSCut",part->Pt(),part->Eta(),myEtITS);
              filled = true;
            }
            if(pdgCode == fgAntiProtonCode){
@@ -551,14 +585,6 @@ Int_t AliAnalysisHadEtMonteCarlo::AnalyseEvent(AliVEvent* ev)
              float myEtPi = Et(part,fgPionMass);
              fSimHadEt += myEt;
              fSimTotEt += myEt;
-             //To investigate p Smearing...
-//           fSimPiKPEt += myEt;
-//           Float_t theta = part->Theta();
-//           Short_t charge = -1;
-//           for(int i=0;i<fgNumSmearWidths;i++){
-//             Float_t pSmeared = part->P() *  fpSmearer->Gaus(1,fgSmearWidths[i]);//Gaussian centered around 1
-//             fSimPiKPEtSmeared[i] += AliAnalysisHadEt::Et(pSmeared,theta,pdgCode,charge);
-//           }
              FillHisto2D("EtSimulatedAntiProton",part->Pt(),part->Eta(),myEt);
              FillHisto2D("EtNSimulatedAntiProton",part->Pt(),part->Eta(),1.0);
              FillHisto2D("EtSimulatedChargedHadron",part->Pt(),part->Eta(),myEt);
@@ -566,6 +592,13 @@ Int_t AliAnalysisHadEtMonteCarlo::AnalyseEvent(AliVEvent* ev)
              FillHisto2D("EtSimulatedChargedHadronAssumingPion",part->Pt(),part->Eta(),myEtPi);
              FillHisto2D("EtSimulatedAntiProtonAssumingPion",part->Pt(),part->Eta(),myEtPi);
              FillHisto2D("EtSimulatedAllHadron",part->Pt(),part->Eta(),myEt);
+             Short_t charge = -1;
+             Float_t myEtLow = Et(0.0,part->Theta(),pdgCode,charge);
+             Float_t myEtITS = Et(0.10/TMath::Sin(part->Theta()),part->Theta(),pdgCode,charge);
+             Float_t myEtTPC = Et(0.15/TMath::Sin(part->Theta()),part->Theta(),pdgCode,charge);
+             FillHisto2D("EtSimulatedChargedHadronAssumingNoPt",part->Pt(),part->Eta(),myEtLow);
+             FillHisto2D("EtSimulatedChargedHadronAssumingPtTPCCut",part->Pt(),part->Eta(),myEtTPC);
+             FillHisto2D("EtSimulatedChargedHadronAssumingPtITSCut",part->Pt(),part->Eta(),myEtITS);
              filled = true;
            }
            //============Other hadrons===================================
@@ -893,16 +926,26 @@ Int_t AliAnalysisHadEtMonteCarlo::AnalyseEvent(AliVEvent* ev)
        }
     }
 
-    FillHisto1D("SimTotEt",fSimTotEt,1.0);
-    FillHisto1D("SimHadEt",fSimHadEt,1.0);
-//     FillHisto1D("SimPiKPEt",fSimPiKPEt,1.0);
-//     char histoname[200];
-//     for(int i=0;i<fgNumSmearWidths;i++){
-//       sprintf(histoname,"SimPiKPEtMinusSimSmeared%2.1f",fgSmearWidths[i]*100.);
-//       if(fSimPiKPEt>0.0) FillHisto2D(histoname,fSimPiKPEt,(fSimPiKPEt-fSimPiKPEtSmeared[i])/fSimPiKPEt,1.0);
-//       sprintf(histoname,"SimPiKPEt%2.1f",fgSmearWidths[i]*100.);
-//       FillHisto1D(histoname,fSimPiKPEtSmeared[i],1.0);
-//     }
+    if(fSimTotEt>0.0)FillHisto1D("SimTotEt",fSimTotEt,1.0);
+    if(fSimHadEt>0.0)FillHisto1D("SimHadEt",fSimHadEt,1.0);
+    if(fSimPiKPEt>0.0)FillHisto1D("SimPiKPEt",fSimPiKPEt,1.0);
+
+    //Smearing histograms
+    if(fSimPiKPEt>0.0) FillHisto2D("SimPiKPEtMinusSimPtSmeared",fSimPiKPEt,(fSimPiKPEt-fSimPiKPEtPtSmeared)/fSimPiKPEt,1.0);
+    FillHisto1D("SimPiKPEtPtSmeared",fSimPiKPEtPtSmeared,1.0);
+    if(fSimPiKPEt>0.0) FillHisto2D("SimPiKPEtMinusSimEfficiencySmeared",fSimPiKPEt,(fSimPiKPEt-fSimPiKPEtEfficiencySmeared)/fSimPiKPEt,1.0);
+    FillHisto1D("SimPiKPEtEfficiencySmeared",fSimPiKPEtEfficiencySmeared,1.0);
+    if(fSimPiKPEt>0.0) FillHisto2D("SimPiKPEtMinusSimPtCutSmearedTPC",fSimPiKPEt,(fSimPiKPEt-fSimPiKPEtPtCutSmearedTPC)/fSimPiKPEt,1.0);
+    FillHisto1D("SimPiKPEtPtCutSmearedTPC",fSimPiKPEtPtCutSmearedTPC,1.0);
+    if(fSimPiKPEt>0.0) FillHisto2D("SimPiKPEtMinusSimPtCutSmearedITS",fSimPiKPEt,(fSimPiKPEt-fSimPiKPEtPtCutSmearedITS)/fSimPiKPEt,1.0);
+    FillHisto1D("SimPiKPEtPtCutSmearedITS",fSimPiKPEtPtCutSmearedTPC,1.0);
+    if(fSimPiKPEt>0.0) FillHisto2D("SimPiKPEtMinusSimPIDSmeared",fSimPiKPEt,(fSimPiKPEt-fSimPiKPEtPIDSmeared)/fSimPiKPEt,1.0);
+    //if(fSimPiKPEt>0.0)cout<<"Filling SimPiKPEtMinusSimPIDSmeared with "<<fSimPiKPEt<<","<<(fSimPiKPEt-fSimPiKPEtPIDSmeared)/fSimPiKPEt<<endl;
+    FillHisto1D("SimPiKPEtPIDSmeared",fSimPiKPEtPIDSmeared,1.0);
+    if(fSimPiKPEt>0.0) FillHisto2D("SimPiKPEtMinusSimPIDSmearedNoID",fSimPiKPEt,(fSimPiKPEt-fSimPiKPEtPIDSmearedNoID)/fSimPiKPEt,1.0);
+    //if(fSimPiKPEt>0.0)cout<<"Filling SimPiKPEtMinusSimPIDSmearedNoID with "<<fSimPiKPEt<<","<<(fSimPiKPEt-fSimPiKPEtPIDSmearedNoID)/fSimPiKPEt<<endl;
+    FillHisto1D("SimPiKPEtPIDSmearedNoID",fSimPiKPEtPIDSmearedNoID,1.0);
+
     return 1;
     
 }
@@ -910,6 +953,7 @@ Int_t AliAnalysisHadEtMonteCarlo::AnalyseEvent(AliVEvent* ev)
 void AliAnalysisHadEtMonteCarlo::Init()
 { // Init
     AliAnalysisHadEt::Init();
+    if(!fPtSmearer) fPtSmearer = new TRandom();
 }
 
 void AliAnalysisHadEtMonteCarlo::CreateHistograms(){
@@ -928,6 +972,9 @@ void AliAnalysisHadEtMonteCarlo::CreateHistograms(){
   CreateEtaPtHisto2D("EtNSimulatedProton","Number of simulated p");
   CreateEtaPtHisto2D("EtNSimulatedAntiProton","Number of simulated #bar{p}");
   CreateEtaPtHisto2D("EtNSimulatedChargedHadron","Number of simulated charged hadrons");
+  CreateEtaPtHisto2D("EtSimulatedChargedHadronAssumingNoPt","Simulated E_{T} from charged hadrons assuming p_{T}=0");
+  CreateEtaPtHisto2D("EtSimulatedChargedHadronAssumingPtTPCCut","Simulated E_{T} from charged hadrons assuming p_{T}=0.15");
+  CreateEtaPtHisto2D("EtSimulatedChargedHadronAssumingPtITSCut","Simulated E_{T} from charged hadrons assuming p_{T}=0.10");
 
   CreateEtaPtHisto2D("EtSimulatedChargedHadronAssumingPion","Simulated E_{T} from charged hadrons assuming they are all pions");
   CreateEtaPtHisto2D("EtSimulatedKPlusAssumingPion","Simulated E_{T} from K^{+} assuming #pi mass");
@@ -1126,27 +1173,102 @@ void AliAnalysisHadEtMonteCarlo::CreateHistograms(){
          sprintf(xtitle,"Simulated %s",etstring->Data());
          CreateHisto2D(histoname,histotitle,xtitle,ytitle,nbinsEt,minEt,maxEt,nbinsEt,-etDiff,etDiff);
 
-         //cout<<"I want to make "<<histoname<<" with the title "<<histotitle<<endl;
+         if(hadet==0){//we only want to do this once...  not the most elegant way of coding but hey...
+           sprintf(histoname,"SimPiKPMinusRecoPiKP%sAcceptance%s%s",acceptance->Data(),detector->Data(),partid->Data());
+           sprintf(histotitle,"(Sim PiKP - reco PiKP)/(Sim PiKP) with %s acceptance for p_{T}>%s GeV/c%s",acceptance->Data(),ptstring->Data(),partidstring->Data());
+           sprintf(ytitle,"(Sim PiKP - reco PiKP)/(Sim PiKP)");
+           sprintf(xtitle,"Simulated E_{T}^{#pi,K,p}");
+           CreateHisto2D(histoname,histotitle,xtitle,ytitle,nbinsEt,minEt,maxEt,nbinsEt,-etDiff,etDiff);
+           //cout<<"Creating "<<histoname<<endl;
+         }
        }
       }
     }
   }
-//   CreateHisto1D("SimPiKPEt","Simulated #pi,K,p E_{T}","Simulated #pi,K,p E_{T}","Number of events",nbinsEt,minEt,maxEt);
-  CreateHisto1D("SimTotEt","Simulated Total E_{T}","Simulated Total E_{T}","Number of events",nbinsEt,minEt,maxEt);
-  CreateHisto1D("SimHadEt","Simulated Hadronic E_{T}","Simulated Hadronic E_{T}","Number of events",nbinsEt,minEt,maxEt);
-//   etDiff = 0.015;
-//   for(int i=0;i<fgNumSmearWidths;i++){
-//     sprintf(histoname,"SimPiKPEtMinusSimSmeared%2.1f",fgSmearWidths[i]*100.);
-//     sprintf(histotitle,"Simulated (true-smeared)/true for %2.1f percent momentum smearing",fgSmearWidths[i]*100.);
-//     sprintf(ytitle,"(true-smeared)/true");
-//     sprintf(xtitle,"true p, K, p E_{T}");
-//     CreateHisto2D(histoname,histotitle,xtitle,ytitle,nbinsEt,minEt,maxEt,nbinsEt,-etDiff,etDiff);
-//     sprintf(histoname,"SimPiKPEt%2.1f",fgSmearWidths[i]*100.);
-//     sprintf(histotitle,"Simulated E_{T} for %2.1f percent momentum smearing",fgSmearWidths[i]*100.);
-//     sprintf(ytitle,"Number of events");
-//     sprintf(xtitle,"p, K, p E_{T}");
-//     CreateHisto1D(histoname,histotitle,xtitle,ytitle,nbinsEt,minEt,maxEt);
-//   }
+   CreateHisto1D("SimPiKPEt","Simulated #pi,K,p E_{T}","Simulated #pi,K,p E_{T}","Number of events",nbinsEt,minEt,maxEt);
+  CreateHisto1D("SimTotEt","Simulated Total E_{T}","Simulated Total E_{T}","Number of events",nbinsEt*4,minEt,maxEt);
+  CreateHisto1D("SimHadEt","Simulated Hadronic E_{T}","Simulated Hadronic E_{T}","Number of events",nbinsEt*4,minEt,maxEt);
+
+  etDiff = 0.15;
+
+  //======================================================================
+
+  sprintf(histoname,"SimPiKPEtMinusSimPtSmeared");
+  sprintf(histotitle,"Simulated (true-smeared)/true for 0.5 percent momentum smearing");
+  sprintf(ytitle,"(true-smeared)/true");
+  sprintf(xtitle,"true p, K, p E_{T}");
+  CreateHisto2D(histoname,histotitle,xtitle,ytitle,nbinsEt,minEt,maxEt,nbinsEt,-etDiff/10.0,etDiff/10.0);
+  sprintf(histoname,"SimPiKPEtPtSmeared");
+  sprintf(histotitle,"Simulated E_{T} for 0.5 percent momentum smearing");
+  sprintf(ytitle,"Number of events");
+  sprintf(xtitle,"p, K, p E_{T}");
+  CreateHisto1D(histoname,histotitle,xtitle,ytitle,nbinsEt,minEt,maxEt);
+
+  //======================================================================
+
+  sprintf(histoname,"SimPiKPEtMinusSimEfficiencySmeared");
+  sprintf(histotitle,"Simulated (true-smeared)/true for efficiency smearing");
+  sprintf(ytitle,"(true-smeared)/true");
+  sprintf(xtitle,"true p, K, p E_{T}");
+  CreateHisto2D(histoname,histotitle,xtitle,ytitle,nbinsEt,minEt,maxEt,nbinsEt,-etDiff*5,etDiff*5);
+  sprintf(histoname,"SimPiKPEtEfficiencySmeared");
+  sprintf(histotitle,"Simulated E_{T} for efficiency smearing");
+  sprintf(ytitle,"Number of events");
+  sprintf(xtitle,"p, K, p E_{T}");
+  CreateHisto1D(histoname,histotitle,xtitle,ytitle,nbinsEt,minEt,maxEt);
+
+  //======================================================================
+
+  sprintf(histoname,"SimPiKPEtMinusSimPtCutSmearedTPC");
+  sprintf(histotitle,"Simulated (true-smeared)/true for p_{T}>0.15 GeV/c smearing");
+  sprintf(ytitle,"(true-smeared)/true");
+  sprintf(xtitle,"true p, K, p E_{T}");
+  CreateHisto2D(histoname,histotitle,xtitle,ytitle,nbinsEt,minEt,maxEt,nbinsEt,-etDiff,etDiff);
+  sprintf(histoname,"SimPiKPEtPtCutSmearedTPC");
+  sprintf(histotitle,"Simulated E_{T} for p_{T}>0.15 GeV/c smearing");
+  sprintf(ytitle,"Number of events");
+  sprintf(xtitle,"p, K, p E_{T}");
+  CreateHisto1D(histoname,histotitle,xtitle,ytitle,nbinsEt,minEt,maxEt);
+
+
+  //======================================================================
+
+  sprintf(histoname,"SimPiKPEtMinusSimPtCutSmearedITS");
+  sprintf(histotitle,"Simulated (true-smeared)/true for p_{T}>0.10 GeV/c smearing");
+  sprintf(ytitle,"(true-smeared)/true");
+  sprintf(xtitle,"true p, K, p E_{T}");
+  CreateHisto2D(histoname,histotitle,xtitle,ytitle,nbinsEt,minEt,maxEt,nbinsEt,-etDiff,etDiff);
+  sprintf(histoname,"SimPiKPEtPtCutSmearedITS");
+  sprintf(histotitle,"Simulated E_{T} for p_{T}>0.10 GeV/c smearing");
+  sprintf(ytitle,"Number of events");
+  sprintf(xtitle,"p, K, p E_{T}");
+  CreateHisto1D(histoname,histotitle,xtitle,ytitle,nbinsEt,minEt,maxEt);
+
+  //======================================================================
+
+  sprintf(histoname,"SimPiKPEtMinusSimPIDSmeared");
+  sprintf(histotitle,"Simulated (true-smeared)/true for PID smearing");
+  sprintf(ytitle,"(true-smeared)/true");
+  sprintf(xtitle,"true p, K, p E_{T}");
+  CreateHisto2D(histoname,histotitle,xtitle,ytitle,nbinsEt,minEt,maxEt,nbinsEt,-etDiff,etDiff);
+  sprintf(histoname,"SimPiKPEtPIDSmeared");
+  sprintf(histotitle,"Simulated E_{T} for PID smearing");
+  sprintf(ytitle,"Number of events");
+  sprintf(xtitle,"p, K, p E_{T}");
+  CreateHisto1D(histoname,histotitle,xtitle,ytitle,nbinsEt,minEt,maxEt);
+
+  //======================================================================
+
+  sprintf(histoname,"SimPiKPEtMinusSimPIDSmearedNoID");
+  sprintf(histotitle,"Simulated (true-smeared)/true for PID smearing No ID");
+  sprintf(ytitle,"(true-smeared)/true");
+  sprintf(xtitle,"true p, K, p E_{T}");
+  CreateHisto2D(histoname,histotitle,xtitle,ytitle,nbinsEt,minEt,maxEt,nbinsEt,-etDiff,etDiff);
+  sprintf(histoname,"SimPiKPEtPIDSmearedNoID");
+  sprintf(histotitle,"Simulated E_{T} for PID smearing No ID");
+  sprintf(ytitle,"Number of events");
+  sprintf(xtitle,"p, K, p E_{T}");
+  CreateHisto1D(histoname,histotitle,xtitle,ytitle,nbinsEt,minEt,maxEt);
 
   delete sTPC;
   delete sITS;
index 028cbba..ed773c2 100644 (file)
@@ -31,30 +31,30 @@ public:
     Float_t GetSimulatedHadronicEt() const {return fSimHadEt;}
     Float_t GetSimulatedTotalEt() const {return fSimTotEt;}
 
-    void FillSimTotEtVsRecoTotEtFullAcceptanceTPC(Float_t et){FillHisto2D("SimTotEtVsRecoTotEtFullAcceptanceTPC",fSimTotEt,et,1.0);}
-    void FillSimTotEtVsRecoTotEtFullAcceptanceITS(Float_t et){FillHisto2D("SimTotEtVsRecoTotEtFullAcceptanceITS",fSimTotEt,et,1.0);}
-    void FillSimTotEtVsRecoTotEtEMCALAcceptanceTPC(Float_t et){FillHisto2D("SimTotEtVsRecoTotEtEMCALAcceptanceTPC",fSimTotEt,et,1.0);}
-    void FillSimTotEtVsRecoTotEtEMCALAcceptanceITS(Float_t et){FillHisto2D("SimTotEtVsRecoTotEtEMCALAcceptanceITS",fSimTotEt,et,1.0);}
-    void FillSimTotEtVsRecoTotEtPHOSAcceptanceTPC(Float_t et){FillHisto2D("SimTotEtVsRecoTotEtPHOSAcceptanceTPC",fSimTotEt,et,1.0);}
-    void FillSimTotEtVsRecoTotEtPHOSAcceptanceITS(Float_t et){FillHisto2D("SimTotEtVsRecoTotEtPHOSAcceptanceITS",fSimTotEt,et,1.0);}
-    void FillSimTotEtVsRecoTotEtFullAcceptanceTPCNoPID(Float_t et){FillHisto2D("SimTotEtVsRecoTotEtFullAcceptanceTPCNoPID",fSimTotEt,et,1.0);}
-    void FillSimTotEtVsRecoTotEtFullAcceptanceITSNoPID(Float_t et){FillHisto2D("SimTotEtVsRecoTotEtFullAcceptanceITSNoPID",fSimTotEt,et,1.0);}
-    void FillSimTotEtVsRecoTotEtEMCALAcceptanceTPCNoPID(Float_t et){FillHisto2D("SimTotEtVsRecoTotEtEMCALAcceptanceTPCNoPID",fSimTotEt,et,1.0);}
-    void FillSimTotEtVsRecoTotEtEMCALAcceptanceITSNoPID(Float_t et){FillHisto2D("SimTotEtVsRecoTotEtEMCALAcceptanceITSNoPID",fSimTotEt,et,1.0);}
-    void FillSimTotEtVsRecoTotEtPHOSAcceptanceTPCNoPID(Float_t et){FillHisto2D("SimTotEtVsRecoTotEtPHOSAcceptanceTPCNoPID",fSimTotEt,et,1.0);}
-    void FillSimTotEtVsRecoTotEtPHOSAcceptanceITSNoPID(Float_t et){FillHisto2D("SimTotEtVsRecoTotEtPHOSAcceptanceITSNoPID",fSimTotEt,et,1.0);}
-    void FillSimHadEtVsRecoHadEtFullAcceptanceTPC(Float_t et){FillHisto2D("SimHadEtVsRecoHadEtFullAcceptanceTPC",fSimHadEt,et,1.0);}
-    void FillSimHadEtVsRecoHadEtFullAcceptanceITS(Float_t et){FillHisto2D("SimHadEtVsRecoHadEtFullAcceptanceITS",fSimHadEt,et,1.0);}
-    void FillSimHadEtVsRecoHadEtEMCALAcceptanceTPC(Float_t et){FillHisto2D("SimHadEtVsRecoHadEtEMCALAcceptanceTPC",fSimHadEt,et,1.0);}
-    void FillSimHadEtVsRecoHadEtEMCALAcceptanceITS(Float_t et){FillHisto2D("SimHadEtVsRecoHadEtEMCALAcceptanceITS",fSimHadEt,et,1.0);}
-    void FillSimHadEtVsRecoHadEtPHOSAcceptanceTPC(Float_t et){FillHisto2D("SimHadEtVsRecoHadEtPHOSAcceptanceTPC",fSimHadEt,et,1.0);}
-    void FillSimHadEtVsRecoHadEtPHOSAcceptanceITS(Float_t et){FillHisto2D("SimHadEtVsRecoHadEtPHOSAcceptanceITS",fSimHadEt,et,1.0);}
-    void FillSimHadEtVsRecoHadEtFullAcceptanceTPCNoPID(Float_t et){FillHisto2D("SimHadEtVsRecoHadEtFullAcceptanceTPCNoPID",fSimHadEt,et,1.0);}
-    void FillSimHadEtVsRecoHadEtFullAcceptanceITSNoPID(Float_t et){FillHisto2D("SimHadEtVsRecoHadEtFullAcceptanceITSNoPID",fSimHadEt,et,1.0);}
-    void FillSimHadEtVsRecoHadEtEMCALAcceptanceTPCNoPID(Float_t et){FillHisto2D("SimHadEtVsRecoHadEtEMCALAcceptanceTPCNoPID",fSimHadEt,et,1.0);}
-    void FillSimHadEtVsRecoHadEtEMCALAcceptanceITSNoPID(Float_t et){FillHisto2D("SimHadEtVsRecoHadEtEMCALAcceptanceITSNoPID",fSimHadEt,et,1.0);}
-    void FillSimHadEtVsRecoHadEtPHOSAcceptanceTPCNoPID(Float_t et){FillHisto2D("SimHadEtVsRecoHadEtPHOSAcceptanceTPCNoPID",fSimHadEt,et,1.0);}
-    void FillSimHadEtVsRecoHadEtPHOSAcceptanceITSNoPID(Float_t et){FillHisto2D("SimHadEtVsRecoHadEtPHOSAcceptanceITSNoPID",fSimHadEt,et,1.0);}
+    void FillSimTotEtVsRecoTotEtFullAcceptanceTPC(Float_t et){if(fSimTotEt>0.0)FillHisto2D("SimTotEtVsRecoTotEtFullAcceptanceTPC",fSimTotEt,et,1.0);}
+    void FillSimTotEtVsRecoTotEtFullAcceptanceITS(Float_t et){if(fSimTotEt>0.0)FillHisto2D("SimTotEtVsRecoTotEtFullAcceptanceITS",fSimTotEt,et,1.0);}
+    void FillSimTotEtVsRecoTotEtEMCALAcceptanceTPC(Float_t et){if(fSimTotEt>0.0)FillHisto2D("SimTotEtVsRecoTotEtEMCALAcceptanceTPC",fSimTotEt,et,1.0);}
+    void FillSimTotEtVsRecoTotEtEMCALAcceptanceITS(Float_t et){if(fSimTotEt>0.0)FillHisto2D("SimTotEtVsRecoTotEtEMCALAcceptanceITS",fSimTotEt,et,1.0);}
+    void FillSimTotEtVsRecoTotEtPHOSAcceptanceTPC(Float_t et){if(fSimTotEt>0.0)FillHisto2D("SimTotEtVsRecoTotEtPHOSAcceptanceTPC",fSimTotEt,et,1.0);}
+    void FillSimTotEtVsRecoTotEtPHOSAcceptanceITS(Float_t et){if(fSimTotEt>0.0)FillHisto2D("SimTotEtVsRecoTotEtPHOSAcceptanceITS",fSimTotEt,et,1.0);}
+    void FillSimTotEtVsRecoTotEtFullAcceptanceTPCNoPID(Float_t et){if(fSimTotEt>0.0)FillHisto2D("SimTotEtVsRecoTotEtFullAcceptanceTPCNoPID",fSimTotEt,et,1.0);}
+    void FillSimTotEtVsRecoTotEtFullAcceptanceITSNoPID(Float_t et){if(fSimTotEt>0.0)FillHisto2D("SimTotEtVsRecoTotEtFullAcceptanceITSNoPID",fSimTotEt,et,1.0);}
+    void FillSimTotEtVsRecoTotEtEMCALAcceptanceTPCNoPID(Float_t et){if(fSimTotEt>0.0)FillHisto2D("SimTotEtVsRecoTotEtEMCALAcceptanceTPCNoPID",fSimTotEt,et,1.0);}
+    void FillSimTotEtVsRecoTotEtEMCALAcceptanceITSNoPID(Float_t et){if(fSimTotEt>0.0)FillHisto2D("SimTotEtVsRecoTotEtEMCALAcceptanceITSNoPID",fSimTotEt,et,1.0);}
+    void FillSimTotEtVsRecoTotEtPHOSAcceptanceTPCNoPID(Float_t et){if(fSimTotEt>0.0)FillHisto2D("SimTotEtVsRecoTotEtPHOSAcceptanceTPCNoPID",fSimTotEt,et,1.0);}
+    void FillSimTotEtVsRecoTotEtPHOSAcceptanceITSNoPID(Float_t et){if(fSimTotEt>0.0)FillHisto2D("SimTotEtVsRecoTotEtPHOSAcceptanceITSNoPID",fSimTotEt,et,1.0);}
+    void FillSimHadEtVsRecoHadEtFullAcceptanceTPC(Float_t et){if(fSimHadEt>0.0)FillHisto2D("SimHadEtVsRecoHadEtFullAcceptanceTPC",fSimHadEt,et,1.0);}
+    void FillSimHadEtVsRecoHadEtFullAcceptanceITS(Float_t et){if(fSimHadEt>0.0)FillHisto2D("SimHadEtVsRecoHadEtFullAcceptanceITS",fSimHadEt,et,1.0);}
+    void FillSimHadEtVsRecoHadEtEMCALAcceptanceTPC(Float_t et){if(fSimHadEt>0.0)FillHisto2D("SimHadEtVsRecoHadEtEMCALAcceptanceTPC",fSimHadEt,et,1.0);}
+    void FillSimHadEtVsRecoHadEtEMCALAcceptanceITS(Float_t et){if(fSimHadEt>0.0)FillHisto2D("SimHadEtVsRecoHadEtEMCALAcceptanceITS",fSimHadEt,et,1.0);}
+    void FillSimHadEtVsRecoHadEtPHOSAcceptanceTPC(Float_t et){if(fSimHadEt>0.0)FillHisto2D("SimHadEtVsRecoHadEtPHOSAcceptanceTPC",fSimHadEt,et,1.0);}
+    void FillSimHadEtVsRecoHadEtPHOSAcceptanceITS(Float_t et){if(fSimHadEt>0.0)FillHisto2D("SimHadEtVsRecoHadEtPHOSAcceptanceITS",fSimHadEt,et,1.0);}
+    void FillSimHadEtVsRecoHadEtFullAcceptanceTPCNoPID(Float_t et){if(fSimHadEt>0.0)FillHisto2D("SimHadEtVsRecoHadEtFullAcceptanceTPCNoPID",fSimHadEt,et,1.0);}
+    void FillSimHadEtVsRecoHadEtFullAcceptanceITSNoPID(Float_t et){if(fSimHadEt>0.0)FillHisto2D("SimHadEtVsRecoHadEtFullAcceptanceITSNoPID",fSimHadEt,et,1.0);}
+    void FillSimHadEtVsRecoHadEtEMCALAcceptanceTPCNoPID(Float_t et){if(fSimHadEt>0.0)FillHisto2D("SimHadEtVsRecoHadEtEMCALAcceptanceTPCNoPID",fSimHadEt,et,1.0);}
+    void FillSimHadEtVsRecoHadEtEMCALAcceptanceITSNoPID(Float_t et){if(fSimHadEt>0.0)FillHisto2D("SimHadEtVsRecoHadEtEMCALAcceptanceITSNoPID",fSimHadEt,et,1.0);}
+    void FillSimHadEtVsRecoHadEtPHOSAcceptanceTPCNoPID(Float_t et){if(fSimHadEt>0.0)FillHisto2D("SimHadEtVsRecoHadEtPHOSAcceptanceTPCNoPID",fSimHadEt,et,1.0);}
+    void FillSimHadEtVsRecoHadEtPHOSAcceptanceITSNoPID(Float_t et){if(fSimHadEt>0.0)FillHisto2D("SimHadEtVsRecoHadEtPHOSAcceptanceITSNoPID",fSimHadEt,et,1.0);}
 
     void FillSimTotEtMinusRecoTotEtFullAcceptanceTPC(Float_t et){if(fSimTotEt>0.0)FillHisto2D("SimTotEtMinusRecoTotEtFullAcceptanceTPC",et,(fSimTotEt-et)/fSimTotEt,1.0);}
     void FillSimTotEtMinusRecoTotEtFullAcceptanceITS(Float_t et){if(fSimTotEt>0.0)FillHisto2D("SimTotEtMinusRecoTotEtFullAcceptanceITS",et,(fSimTotEt-et)/fSimTotEt,1.0);}
@@ -95,13 +95,17 @@ public:
     void FillSimHadEtMinusRawEtPHOSAcceptanceTPC(Float_t et){if(fSimHadEt>0.0)FillHisto2D("SimHadEtMinusRawEtPHOSAcceptanceTPC",et,(fSimHadEt-et)/fSimHadEt,1.0);}
     void FillSimHadEtMinusRawEtPHOSAcceptanceITS(Float_t et){if(fSimHadEt>0.0)FillHisto2D("SimHadEtMinusRawEtPHOSAcceptanceITS",et,(fSimHadEt-et)/fSimHadEt,1.0);}
 
+    void FillSimPiKPMinusRecoPiKPFullAcceptanceTPC(Float_t et){if(fSimPiKPEt>0.0)FillHisto2D("SimPiKPMinusRecoPiKPFullAcceptanceTPC",et,(fSimPiKPEt-et)/fSimPiKPEt,1.0);}
+    void FillSimPiKPMinusRecoPiKPFullAcceptanceITS(Float_t et){if(fSimPiKPEt>0.0)FillHisto2D("SimPiKPMinusRecoPiKPFullAcceptanceITS",et,(fSimPiKPEt-et)/fSimPiKPEt,1.0);}
+    void FillSimPiKPMinusRecoPiKPFullAcceptanceTPCNoPID(Float_t et){if(fSimPiKPEt>0.0)FillHisto2D("SimPiKPMinusRecoPiKPFullAcceptanceTPCNoPID",et,(fSimPiKPEt-et)/fSimPiKPEt,1.0);}
+    void FillSimPiKPMinusRecoPiKPFullAcceptanceITSNoPID(Float_t et){if(fSimPiKPEt>0.0)FillHisto2D("SimPiKPMinusRecoPiKPFullAcceptanceITSNoPID",et,(fSimPiKPEt-et)/fSimPiKPEt,1.0);}
 
  private:
     //Declare it private to avoid compilation warning
     AliAnalysisHadEtMonteCarlo & operator = (const AliAnalysisHadEtMonteCarlo & g) ;//cpy assignment
     AliAnalysisHadEtMonteCarlo(const AliAnalysisHadEtMonteCarlo & g) ; // cpy ctor
 
-    //Float_t fSimPiKPEt;//simulated Et for pi,k,p event by event
+    Float_t fSimPiKPEt;//simulated Et for pi,k,p event by event
     Float_t fSimHadEt;//simulated Et event by event
     Float_t fSimTotEt;//total et event by event
 
@@ -109,8 +113,9 @@ public:
     void ResetEventValues();
 
     //Float_t fSimPiKPEtSmeared[4];//simulated Et for pi,k,p smeared for each event by different momentum resolutions
-/*     static Float_t fgSmearWidths[4]; */
-/*     static Int_t fgNumSmearWidths; */
+    static Float_t fgSmearWidths[4];
+    static Int_t fgNumSmearWidths;
+    TRandom *fPtSmearer;
 
     ClassDef(AliAnalysisHadEtMonteCarlo, 1);
 };
index 68142d6..12dad2b 100644 (file)
@@ -91,8 +91,8 @@ Int_t AliAnalysisHadEtReconstructed::AnalyseEvent(AliVEvent* ev)
     TString *strTPC = new TString("TPC");
     TString *strITS = new TString("ITS");
     TString *strTPCITS = new TString("TPCITS");
-    bool isTPC = false;
     for(Int_t cutset=0;cutset<2;cutset++){
+      bool isTPC = false;
       TString *cutName;
       TObjArray* list;
       switch(cutset){
@@ -126,10 +126,9 @@ Int_t AliAnalysisHadEtReconstructed::AnalyseEvent(AliVEvent* ev)
              continue;
            }
          else{
+           //if(!isTPC) cout<<"I should add an ITS track..."<<endl;
            if(TMath::Abs(track->Eta())>fCorrections->GetEtaCut()) continue;
            Float_t nSigmaPion,nSigmaProton,nSigmaKaon,nSigmaElectron;
-           pID->MakeTPCPID(track);
-           pID->MakeITSPID(track);
            if(cutset!=1){
              nSigmaPion = TMath::Abs(pID->NumberOfSigmasTPC(track,AliPID::kPion));
              nSigmaProton = TMath::Abs(pID->NumberOfSigmasTPC(track,AliPID::kProton));
@@ -148,7 +147,7 @@ Int_t AliAnalysisHadEtReconstructed::AnalyseEvent(AliVEvent* ev)
            bool isProton = (nSigmaPion>3.0 && nSigmaProton<2.0 && nSigmaKaon>2.0);
 
            //bool IsElectron = false;
-           bool unidentified = (!isProton && !isKaon && !isElectron);
+           bool unidentified = (!isProton && !isKaon && !isElectron && !isPion);
            Float_t dEdx = track->GetTPCsignal();
            if(cutset==1) dEdx = track->GetITSsignal();
            FillHisto2D(Form("dEdxDataAll%s",cutName->Data()),track->P(),dEdx,1.0);
@@ -159,18 +158,20 @@ Int_t AliAnalysisHadEtReconstructed::AnalyseEvent(AliVEvent* ev)
 
            Float_t corrBkgd=0.0;
            Float_t corrNotID=0.0;
-           Float_t corrNoID = fCorrections->GetNotIDCorrectionNoPID(track->Pt());
+           Float_t corrNoID=0.0;// = fCorrections->GetNotIDCorrectionNoPID(track->Pt());
            Float_t corrEff = 0.0;
            Float_t corrEffNoID = 0.0;
            if(cutset==0){//TPC
              corrBkgd = fCorrections->GetBackgroundCorrectionTPC(track->Pt());
              corrEffNoID = fCorrections->GetTPCEfficiencyCorrectionHadron(track->Pt());
-             corrNotID = fCorrections->GetNotIDCorrectionTPC(track->Pt());
+             corrNotID = fCorrections->GetNotIDConstCorrectionTPC();
+             corrNoID = fCorrections->GetNotIDConstCorrectionTPCNoID();
            }
            if(cutset==1){//ITS
              corrBkgd = fCorrections->GetBackgroundCorrectionITS(track->Pt());
-             //corrEffNoID = fCorrections->GetITSEfficiencyCorrectionHadron(track->Pt());
-             corrNotID = fCorrections->GetNotIDCorrectionITS(track->Pt());
+             corrEffNoID = fCorrections->GetITSEfficiencyCorrectionHadron(track->Pt());
+             corrNotID = fCorrections->GetNotIDConstCorrectionITS();
+             corrNoID = fCorrections->GetNotIDConstCorrectionITSNoID();
            }
            Float_t et = 0.0;
            Float_t etNoID = Et(track->P(),track->Theta(),fgPiPlusCode,track->Charge());
@@ -183,7 +184,7 @@ Int_t AliAnalysisHadEtReconstructed::AnalyseEvent(AliVEvent* ev)
              et = Et(track->P(),track->Theta(),fgPiPlusCode,track->Charge());
              if(cutset==0){corrEff = fCorrections->GetTPCEfficiencyCorrectionPion(track->Pt());}
              //else{corrEff = fCorrections->GetITSEfficiencyCorrectionPion(track->Pt());}
-             etpartialcorrected = et*corrBkgd*corrEff;
+             etpartialcorrected = et*corrBkgd*corrEff*corrNotID;
              
              if(track->Charge()>0.0){
                FillHisto2D(Form("EtDataRaw%sPiPlus",cutName->Data()),track->Pt(),track->Eta(),et);
@@ -199,7 +200,7 @@ Int_t AliAnalysisHadEtReconstructed::AnalyseEvent(AliVEvent* ev)
              et = Et(track->P(),track->Theta(),fgKPlusCode,track->Charge());
              if(cutset==0){corrEff = fCorrections->GetTPCEfficiencyCorrectionKaon(track->Pt());}
              //else{corrEff = fCorrections->GetITSEfficiencyCorrectionKaon(track->Pt());}
-             etpartialcorrected = et*corrBkgd*corrEff;
+             etpartialcorrected = et*corrBkgd*corrEff*corrNotID;
              
              if(track->Charge()>0.0){
                FillHisto2D(Form("EtDataRaw%sKPlus",cutName->Data()),track->Pt(),track->Eta(),et);
@@ -215,7 +216,7 @@ Int_t AliAnalysisHadEtReconstructed::AnalyseEvent(AliVEvent* ev)
              et = Et(track->P(),track->Theta(),fgProtonCode,track->Charge());
              if(cutset==0){corrEff = fCorrections->GetTPCEfficiencyCorrectionProton(track->Pt());}
              //else{corrEff = fCorrections->GetITSEfficiencyCorrectionProton(track->Pt());}
-             etpartialcorrected = et*corrBkgd*corrEff;
+             etpartialcorrected = et*corrBkgd*corrEff*corrNotID;
              
              if(track->Charge()>0.0){
                FillHisto2D(Form("EtDataRaw%sProton",cutName->Data()),track->Pt(),track->Eta(),et);
@@ -231,13 +232,32 @@ Int_t AliAnalysisHadEtReconstructed::AnalyseEvent(AliVEvent* ev)
              //et = Et(track->P(),track->Theta(),fgPiPlusCode,track->Charge());
            }
            if(unidentified){
+             //if(!isPion) 
              FillHisto2D(Form("dEdxDataUnidentified%s",cutName->Data()),track->P(),dEdx,1.0);
              et = Et(track->P(),track->Theta(),fgPiPlusCode,track->Charge());
              etpartialcorrected = et*corrBkgd*corrEffNoID*corrNotID;
+             //if(!isPion) 
              FillHisto2D(Form("EtDataCorrected%sUnidentified",cutName->Data()),track->Pt(),track->Eta(),etpartialcorrected);
            }
-           if(!isTPC) etpartialcorrected = etpartialcorrectedNoID;//Not using PID for ITS
+           if(!isTPC){
+             etpartialcorrected = etpartialcorrectedNoID;//Not using PID for ITS
+             //cout<<"I should add an ITS track..."<<endl;
+           }
            AddEt(et,etNoID,etpartialcorrected,etpartialcorrectedNoID,track->Pt(),isTPC,inPHOS,inEMCAL);
+           // cout<<"Pt "<<track->Pt()<<" et corrected no id "<<etpartialcorrectedNoID<<"="<<corrNoID<<"*"<<corrBkgd<<"*"<<corrEffNoID<<"*"<<etNoID<<endl;
+//         if(isTPC){
+//           //if(!unidentified){
+//           //cout<<"Pt "<<track->Pt()<<" et corrected   pid "<<etpartialcorrected<<"="<<corrBkgd<<"*"<<corrEff<<"*"<<et;
+//           cout<<"Pt "<<track->Pt()<<" et corrected  pid "<<etpartialcorrected<<"="<<corrNotID<<"*"<<corrBkgd<<"*"<<corrEff<<"*"<<et;
+//           if(isPion)cout<<" pion";
+//           if(isProton)cout<<" proton";
+//           if(isKaon)cout<<" kaon";
+//           if(isElectron)cout<<" electron";
+//           if(unidentified)cout<<" unidentified";
+//           cout<<endl;
+//             //}
+//           //else{cout<<"Pt "<<track->Pt()<<" et corrected  !pid "<<etpartialcorrected<<"="<<corrBkgd<<"*"<<corrEff<<"*"<<corrNotID<<"*"<<et<<" Not identified"<<endl;}
+//         }
            //if(inEMCAL) cout<<"I should add a track"<<endl;
          }
        }
@@ -320,7 +340,8 @@ Int_t AliAnalysisHadEtReconstructed::AnalyseEvent(AliVEvent* ev)
 void AliAnalysisHadEtReconstructed::AddEt(Float_t rawEt, Float_t rawEtNoPID, Float_t corrEt, Float_t corrEtNoPID, Float_t pt, Bool_t IsTPC, Bool_t InPHOS, Bool_t InEMCAL) {//Adding Et to each of the variables that tracks et event by event
   if(pt>=AliAnalysisHadEt::fgPtTPCCutOff && IsTPC){//TPC tracks
     //adding to the raw Et
-    //if(InEMCAL) cout<<"Adding "<<rawEt<<" to the raw Et"<<endl;
+    //if(InEMCAL)
+    //cout<<"Adding "<<rawEt<<" to the raw TPC Et"<<endl;
     fRawEtFullAcceptanceTPC += rawEt;
     if(InPHOS)fRawEtPHOSAcceptanceTPC += rawEt;
     if(InEMCAL)fRawEtEMCALAcceptanceTPC += rawEt;
@@ -335,6 +356,7 @@ void AliAnalysisHadEtReconstructed::AddEt(Float_t rawEt, Float_t rawEtNoPID, Flo
     fCorrectedHadEtFullAcceptanceTPCNoPID += corrEtNoPID;
     if(InPHOS)fCorrectedHadEtPHOSAcceptanceTPCNoPID += corrEtNoPID;
     if(InEMCAL)fCorrectedHadEtEMCALAcceptanceTPCNoPID += corrEtNoPID;
+    //cout<<"Adding "<<corrEt<<" to the corrected Et, TPC pT "<<pt<<endl;
   }
   if(pt<AliAnalysisHadEt::fgPtTPCCutOff &&pt>=AliAnalysisHadEt::fgPtITSCutOff && !IsTPC){//ITS tracks
     //adding to the raw Et
@@ -344,6 +366,7 @@ void AliAnalysisHadEtReconstructed::AddEt(Float_t rawEt, Float_t rawEtNoPID, Flo
     fRawEtFullAcceptanceITSNoPID += rawEtNoPID;
     if(InPHOS)fRawEtPHOSAcceptanceITSNoPID += rawEtNoPID;
     if(InEMCAL)fRawEtEMCALAcceptanceITSNoPID += rawEtNoPID;
+    //cout<<"Adding "<<rawEt<<" to the raw ITS Et"<<endl;
     //adding to the corrected Et
     fCorrectedHadEtFullAcceptanceITS += corrEt;
     if(InPHOS)fCorrectedHadEtPHOSAcceptanceITS += corrEt;
@@ -351,6 +374,7 @@ void AliAnalysisHadEtReconstructed::AddEt(Float_t rawEt, Float_t rawEtNoPID, Flo
     fCorrectedHadEtFullAcceptanceITSNoPID += corrEtNoPID;
     if(InPHOS)fCorrectedHadEtPHOSAcceptanceITSNoPID += corrEtNoPID;
     if(InEMCAL)fCorrectedHadEtEMCALAcceptanceITSNoPID += corrEtNoPID;
+    //cout<<"Adding "<<corrEt<<" to the corrected Et, ITS pT "<<pt<<endl;
   }
 }
 
@@ -575,12 +599,14 @@ void AliAnalysisHadEtReconstructed::CreateHistograms(){//Creating histograms and
          sprintf(histoname,"Reco%s%sAcceptance%s%s",et->Data(),acceptance->Data(),detector->Data(),partid->Data());
          sprintf(histotitle,"Reconstructed %s with %s acceptance for p_{T}>%s GeV/c%s",etstring->Data(),acceptance->Data(),ptstring->Data(),partidstring->Data());
          sprintf(xtitle,"Reconstructed %s",etstring->Data());
-         CreateHisto1D(histoname,histotitle,xtitle,ytitle->Data(),nbinsEt,minEt,maxEt);
+         CreateHisto1D(histoname,histotitle,xtitle,ytitle->Data(),nbinsEt*2,minEt,maxEt);
        }
       }
     }
   }
 
+  //CreateHisto2D("Efficiency","Efficiency","pT","efficiency",
+
   delete sTPC;
   delete sITS;
   delete sTPCpt;
index 59732c9..462330e 100644 (file)
@@ -64,6 +64,10 @@ public:
     Float_t GetRawEtEMCALAcceptanceITSNoPID() const {return fRawEtEMCALAcceptanceITSNoPID+fRawEtEMCALAcceptanceTPCNoPID;}
     Float_t GetRawEtPHOSAcceptanceTPCNoPID() const {return fRawEtPHOSAcceptanceTPCNoPID;}
     Float_t GetRawEtPHOSAcceptanceITSNoPID() const {return fRawEtPHOSAcceptanceITSNoPID+fRawEtPHOSAcceptanceTPCNoPID;}
+    Float_t GetCorrectedPiKPEtFullAcceptanceTPC() const {return fCorrectedHadEtFullAcceptanceTPC;}
+    Float_t GetCorrectedPiKPEtFullAcceptanceITS() const {return fCorrectedHadEtFullAcceptanceITS+fCorrectedHadEtFullAcceptanceTPC;}
+    Float_t GetCorrectedPiKPEtFullAcceptanceTPCNoPID() const {return fCorrectedHadEtFullAcceptanceTPCNoPID;}
+    Float_t GetCorrectedPiKPEtFullAcceptanceITSNoPID() const {return fCorrectedHadEtFullAcceptanceITSNoPID+fCorrectedHadEtFullAcceptanceTPCNoPID;}
 
     void CreateHistograms();
      virtual void Init();
index e5b0532..a9fab88 100644 (file)
@@ -188,6 +188,10 @@ if (mcEvent)
 //     fMCAnalysis->FillSimHadEtMinusRawHadEtPHOSAcceptanceTPC( fRecAnalysis->GetRawEtPHOSAcceptanceTPC() );
 //     fMCAnalysis->FillSimHadEtMinusRawHadEtPHOSAcceptanceITS( fRecAnalysis->GetRawEtPHOSAcceptanceITS() );
 
+    fMCAnalysis->FillSimPiKPMinusRecoPiKPFullAcceptanceTPC(fRecAnalysis->GetCorrectedPiKPEtFullAcceptanceTPC());
+    fMCAnalysis->FillSimPiKPMinusRecoPiKPFullAcceptanceITS(fRecAnalysis->GetCorrectedPiKPEtFullAcceptanceITS());
+    fMCAnalysis->FillSimPiKPMinusRecoPiKPFullAcceptanceTPCNoPID(fRecAnalysis->GetCorrectedPiKPEtFullAcceptanceTPCNoPID());
+    fMCAnalysis->FillSimPiKPMinusRecoPiKPFullAcceptanceITSNoPID(fRecAnalysis->GetCorrectedPiKPEtFullAcceptanceITSNoPID());
 
   }
 
index 7012cff..ddb399f 100644 (file)
 // #include <TSystem.h>
 // #include "TStopwatch.h"
 
-Float_t CorrNeutral(float ptcut, char *prodname, char *shortprodname, bool TPC, char *infilename, bool hadronic = false);
+Float_t CorrNeutral(float ptcut, char *prodname, char *shortprodname, bool TPC, char *infilename, bool hadronic = false, float etacut = 0.7);
 TH1D *GetHistoCorrNeutral(float cut, char *name, int mycase, bool eta, int color, int marker, char *infilename, bool hadronic = false);
 
 Float_t CorrPtCut(float ptcut, char *prodname = "Enter Production Name", char *shortprodname = "EnterProductionName", char *filename="Et.ESD.new.sim.merged.root");
 TH1D *GetHistoCorrPtCut(float ptcut = 0.15, char *name, char *filename);
 
-TH1D *GetHistoCorrNotID(float etacut,char *name, bool TPC, char *infilename);
+TH1D *GetHistoCorrNotID(float etacut,char *name, bool TPC, char *infilename, bool eta);
 TH1D *CorrNotID(float etacut,char *name, char *prodname, char *shortprodname, bool TPC, char *infilename);
+Float_t CorrNotIDConst(float ptcut, float etacut,char *name, char *prodname, char *shortprodname, bool TPC, char *infilename);
 
-TH1D *GetHistoNoID(float etacut, char *name, char *infilename);
+TH1D *GetHistoNoID(float etacut, char *name, char *infilename, bool eta, bool TPC);
 TH1D *CorrNoID(float etacut,char *name, char *prodname, char *shortprodname, char *infilename);
+Float_t CorrNoIDConst(float etacut, float ptcut,char *name, char *prodname, char *shortprodname, char *infilename);
 
 TH1D* bayneseffdiv(TH1D* numerator, TH1D* denominator,Char_t* name);
 TH1D *GetHistoEfficiency(float cut, char *name, int mycase, int color, int marker,bool TPC, char *infilename);
@@ -47,6 +49,7 @@ void GetCorrections(char *prodname = "Enter Production Name", char *shortprodnam
     gSystem->Load("libANALYSISalice");
 
     gSystem->AddIncludePath("-I$ALICE_ROOT/include");
+   gROOT->ProcessLine(".L AliAnalysisEtCuts.cxx+g");
    gROOT->ProcessLine(".L AliAnalysisHadEtCorrections.cxx+g");
 
    char outfilename[200];
@@ -65,14 +68,14 @@ void GetCorrections(char *prodname = "Enter Production Name", char *shortprodnam
    hadCorrectionEMCAL->SetAcceptanceCorrectionEMCAL(360.0/60.0);
 
    float ptcut = 0.1;
-   float neutralCorr = CorrNeutral(ptcut,prodname,shortprodname,TPC,infilename);
+   float neutralCorr = CorrNeutral(ptcut,prodname,shortprodname,TPC,infilename,false,etacut);
    hadCorrectionEMCAL->SetNeutralCorrection(neutralCorr);
    cout<<"Warning:  Setting neutral correction error bars to STAR value of +/-2%.  Use for development purposes only!"<<endl;
    hadCorrectionEMCAL->SetNeutralCorrectionLowBound(neutralCorr*0.98);
    hadCorrectionEMCAL->SetNeutralCorrectionHighBound(neutralCorr*1.02);
 
 
-   float hadronicCorr = CorrNeutral(ptcut,prodname,shortprodname,TPC,infilename,true);
+   float hadronicCorr = CorrNeutral(ptcut,prodname,shortprodname,TPC,infilename,true,etacut);
    hadCorrectionEMCAL->SetNotHadronicCorrection(hadronicCorr);
    cout<<"Warning:  Setting hadronic correction error bars to value of +/-2%.  Use for development purposes only!"<<endl;
    hadCorrectionEMCAL->SetNotHadronicCorrectionLowBound(neutralCorr*0.98);
@@ -82,6 +85,8 @@ void GetCorrections(char *prodname = "Enter Production Name", char *shortprodnam
    hadCorrectionEMCAL->SetpTCutCorrectionITS(ptcutITS);
    float ptcutTPC = CorrPtCut(0.15,prodname,shortprodname,infilename);
    hadCorrectionEMCAL->SetpTCutCorrectionTPC(ptcutTPC);
+   cout<<"Setting ITS pt cut corr to "<<ptcutITS<<endl;
+   cout<<"Setting TPC pt cut corr to "<<ptcutTPC<<endl;
    cout<<"Warning:  Setting pt cut correction error bars to STAR value of +/-3%.  Use for development purposes only!"<<endl;
    hadCorrectionEMCAL->SetpTCutCorrectionITSLowBound(ptcutITS*0.97);
    hadCorrectionEMCAL->SetpTCutCorrectionTPCLowBound(ptcutTPC*0.97);
@@ -93,9 +98,32 @@ void GetCorrections(char *prodname = "Enter Production Name", char *shortprodnam
    hadCorrectionEMCAL->SetNotIDCorrectionTPC(NotIDTPC);
    hadCorrectionEMCAL->SetNotIDCorrectionITS(NotIDITS);
 
+   Float_t NotIDConstTPC = CorrNotIDConst(0.15,etacut,"CorrNotIDEMCALTPC2",prodname,shortprodname,true,infilename);
+   Float_t NotIDConstITS = CorrNotIDConst(0.10,etacut,"CorrNotIDEMCALTPC2",prodname,shortprodname,true,infilename);
+   hadCorrectionEMCAL->SetNotIDConstCorrectionTPC(1.0/NotIDConstTPC);
+   hadCorrectionEMCAL->SetNotIDConstCorrectionITS(1.0/NotIDConstITS);
+   cout<<"Setting constant PID corrections to "<<NotIDConstTPC<<" and "<<NotIDConstITS<<endl;
+   cout<<"Warning:  Setting systematic errors on constant correction from unidentified particles at 1%!  For testing and development purposes only!"<<endl;
+   hadCorrectionEMCAL->SetNotIDConstCorrectionTPCLowBound(1./NotIDConstTPC*.99);
+   hadCorrectionEMCAL->SetNotIDConstCorrectionITSLowBound(1./NotIDConstITS*.99);
+   hadCorrectionEMCAL->SetNotIDConstCorrectionTPCHighBound(1./NotIDConstTPC*1.01);
+   hadCorrectionEMCAL->SetNotIDConstCorrectionITSHighBound(1./NotIDConstITS*1.01);
+
+
    TH1D *NoID = CorrNoID(etacut,"CorrNoIDEMCAL",prodname,shortprodname,infilename);
    hadCorrectionEMCAL->SetNotIDCorrectionNoPID(NoID);
 
+   Float_t NoIDTPC = CorrNoIDConst(etacut,0.15,"CorrNoIDEMCAL2",prodname,shortprodname,infilename);
+   Float_t NoIDITS = CorrNoIDConst(etacut,0.1,"CorrNoIDEMCAL2",prodname,shortprodname,infilename);
+   cout<<"Setting constant PID corrections with no PID to "<<NoIDTPC<<" and "<<NoIDITS<<endl;
+   hadCorrectionEMCAL->SetNotIDConstCorrectionTPCNoID(1./NoIDTPC);
+   hadCorrectionEMCAL->SetNotIDConstCorrectionITSNoID(1./NoIDITS);
+   cout<<"Warning:  Setting systematic errors on constant correction from unidentified particles at 2%!  For testing and development purposes only!"<<endl;
+   hadCorrectionEMCAL->SetNotIDConstCorrectionTPCNoIDLowBound(1./NoIDTPC*.99);
+   hadCorrectionEMCAL->SetNotIDConstCorrectionITSNoIDLowBound(1./NoIDITS*.99);
+   hadCorrectionEMCAL->SetNotIDConstCorrectionTPCNoIDHighBound(1./NoIDTPC*1.01);
+   hadCorrectionEMCAL->SetNotIDConstCorrectionITSNoIDHighBound(1./NoIDITS*1.01);
+
    TH1D *efficiencyPionTPC = GetHistoEfficiency(etacut,"hEfficiencyPionTPC",1,1,20,true,infilename);
    hadCorrectionEMCAL->SetEfficiencyPionTPC(efficiencyPionTPC);
    if(!efficiencyPionTPC){cerr<<"NOOOOOOOOOOOOOOOOOO!!  We have failed you, Christine!"<<endl;}
@@ -150,14 +178,14 @@ void GetCorrections(char *prodname = "Enter Production Name", char *shortprodnam
    hadCorrectionPHOS->SetAcceptanceCorrectionEMCAL(360.0/60.0);
 
    float ptcut = 0.1;
-   float neutralCorr = CorrNeutral(ptcut,prodname,shortprodname,TPC,infilename);
+   float neutralCorr = CorrNeutral(ptcut,prodname,shortprodname,TPC,infilename,false,etacut);
    hadCorrectionPHOS->SetNeutralCorrection(neutralCorr);
    cout<<"Warning:  Setting neutral correction error bars to STAR value of +/-2%.  Use for development purposes only!"<<endl;
    hadCorrectionPHOS->SetNeutralCorrectionLowBound(neutralCorr*0.98);
    hadCorrectionPHOS->SetNeutralCorrectionHighBound(neutralCorr*1.02);
 
 
-   float hadronicCorr = CorrNeutral(ptcut,prodname,shortprodname,TPC,infilename,true);
+   float hadronicCorr = CorrNeutral(ptcut,prodname,shortprodname,TPC,infilename,true,etacut);
    hadCorrectionPHOS->SetNotHadronicCorrection(hadronicCorr);
    cout<<"Warning:  Setting hadronic correction error bars to value of +/-2%.  Use for development purposes only!"<<endl;
    hadCorrectionPHOS->SetNotHadronicCorrectionLowBound(neutralCorr*0.98);
@@ -179,9 +207,32 @@ void GetCorrections(char *prodname = "Enter Production Name", char *shortprodnam
    hadCorrectionPHOS->SetNotIDCorrectionTPC(NotIDTPC);
    hadCorrectionPHOS->SetNotIDCorrectionITS(NotIDITS);
 
+   Float_t NotIDConstTPC = CorrNotIDConst(0.15,etacut,"CorrNotIDPHOSTPC2",prodname,shortprodname,true,infilename);
+   Float_t NotIDConstITS = CorrNotIDConst(0.10,etacut,"CorrNotIDPHOSTPC2",prodname,shortprodname,true,infilename);
+   hadCorrectionPHOS->SetNotIDConstCorrectionTPC(1./NotIDConstTPC);
+   hadCorrectionPHOS->SetNotIDConstCorrectionITS(1./NotIDConstITS);
+   cout<<"Warning:  Setting systematic errors on constant correction from unidentified particles at 1%!  For testing and development purposes only!"<<endl;
+   hadCorrectionPHOS->SetNotIDConstCorrectionTPCLowBound(1./NotIDConstTPC*.99);
+   hadCorrectionPHOS->SetNotIDConstCorrectionITSLowBound(1./NotIDConstITS*.99);
+   hadCorrectionPHOS->SetNotIDConstCorrectionTPCHighBound(1./NotIDConstTPC*1.01);
+   hadCorrectionPHOS->SetNotIDConstCorrectionITSHighBound(1./NotIDConstITS*1.01);
+
+
    TH1D *NoID = CorrNoID(etacut,"CorrNoIDPHOS",prodname,shortprodname,infilename);
    hadCorrectionPHOS->SetNotIDCorrectionNoPID(NoID);
 
+
+   Float_t NoIDTPC = CorrNoIDConst(etacut,0.15,"CorrNoIDPHOS2",prodname,shortprodname,infilename);
+   Float_t NoIDITS = CorrNoIDConst(etacut,0.1,"CorrNoIDPHOS2",prodname,shortprodname,infilename);
+   cout<<"Setting constant PID corrections with no PID to "<<NoIDTPC<<" and "<<NoIDITS<<endl;
+   hadCorrectionPHOS->SetNotIDConstCorrectionTPCNoID(1./NoIDTPC);
+   hadCorrectionPHOS->SetNotIDConstCorrectionITSNoID(1./NoIDITS);
+   cout<<"Warning:  Setting systematic errors on constant correction from unidentified particles at 2%!  For testing and development purposes only!"<<endl;
+   hadCorrectionPHOS->SetNotIDConstCorrectionTPCNoIDLowBound(1./NoIDTPC*.99);
+   hadCorrectionPHOS->SetNotIDConstCorrectionITSNoIDLowBound(1./NoIDITS*.99);
+   hadCorrectionPHOS->SetNotIDConstCorrectionTPCNoIDHighBound(1./NoIDTPC*1.01);
+   hadCorrectionPHOS->SetNotIDConstCorrectionITSNoIDHighBound(1./NoIDITS*1.01);
+
    TH1D *efficiencyPionTPC = GetHistoEfficiency(etacut,"hEfficiencyPionTPC",1,1,20,true,infilename);
    TH1D *efficiencyKaonTPC = GetHistoEfficiency(etacut,"hEfficiencyKaonTPC",2,1,20,true,infilename);
    TH1D *efficiencyProtonTPC = GetHistoEfficiency(etacut,"hEfficiencyProtonTPC",3,1,20,true,infilename);
@@ -219,7 +270,7 @@ void GetCorrections(char *prodname = "Enter Production Name", char *shortprodnam
 }
 
 //==================================CorrNeutral==============================================
-Float_t CorrNeutral(float ptcut, char *prodname, char *shortprodname, bool TPC, char *infilename, bool hadronic){
+Float_t CorrNeutral(float ptcut, char *prodname, char *shortprodname, bool TPC, char *infilename, bool hadronic, float etacut){
   gStyle->SetOptTitle(0);
   gStyle->SetOptStat(0);
   gStyle->SetOptFit(0);
@@ -273,7 +324,7 @@ Float_t CorrNeutral(float ptcut, char *prodname, char *shortprodname, bool TPC,
 
   TF1 *func = new TF1("func","[0]",-.7,.7);
   func->SetParameter(0,0.2);
-  total->Fit(func);
+  total->Fit(func,"","",-etacut,etacut);
 
   //total->SetAxisRange(0.0,4);
   total->GetXaxis()->SetLabelSize(0.05);
@@ -455,8 +506,8 @@ TH1D *GetHistoCorrNeutral(float cut, char *name, int mycase, bool eta, int color
     denominator = allhad->ProjectionY("denominator",lowbin,highbin);
   }
   numerator->Divide(denominator);
-  numerator->Rebin(2);
-  numerator->Scale(0.5);
+  //numerator->Rebin(2);
+  //numerator->Scale(0.5);
   numerator->SetYTitle("E_{T}^{had,sample}/E_{T}^{had,total}");
   numerator->GetYaxis()->SetTitleOffset(1.2);
   numerator->SetMarkerColor(color);
@@ -587,23 +638,65 @@ Float_t CorrPtCut(float ptcut, char *prodname, char *shortprodname, char *filena
 
 
 //==================================CorrNotID=================================================
-TH1D *GetHistoCorrNotID(float etacut,char *name, bool TPC, char *infilename){
+TH1D *GetHistoCorrNotID(float etacut,char *name, bool TPC, char *infilename, bool eta){
   TFile *file = new TFile(infilename);
   TList *list = file->FindObject("out2");
   char *myname = "ITS";
   if(TPC) myname = "TPC";
   TH2F *notid = ((TH2F*) out2->FindObject(Form("EtReconstructed%sUnidentifiedAssumingPion",myname)))->Clone("notid");
   TH2F *nNotid = ((TH2F*) out2->FindObject(Form("EtNReconstructed%sUnidentified",myname)))->Clone("nNotid");
+  if(!eta){
+    cout<<"Correction determined for all charged hadrons"<<endl;
+    notid->Add((TH2F*) out2->FindObject(Form("EtReconstructed%sIdentifiedPiPlus",myname)));
+    notid->Add((TH2F*) out2->FindObject(Form("EtReconstructed%sIdentifiedPiMinus",myname)));
+    notid->Add((TH2F*) out2->FindObject(Form("EtReconstructed%sIdentifiedKPlus",myname)));
+    notid->Add((TH2F*) out2->FindObject(Form("EtReconstructed%sIdentifiedKMinus",myname)));
+    notid->Add((TH2F*) out2->FindObject(Form("EtReconstructed%sIdentifiedProton",myname)));
+    notid->Add((TH2F*) out2->FindObject(Form("EtReconstructed%sIdentifiedAntiProton",myname)));
+    nNotid->Add((TH2F*) out2->FindObject(Form("EtNReconstructed%sPiPlus",myname)));
+    nNotid->Add((TH2F*) out2->FindObject(Form("EtNReconstructed%sPiMinus",myname)));
+    nNotid->Add((TH2F*) out2->FindObject(Form("EtNReconstructed%sKPlus",myname)));
+    nNotid->Add((TH2F*) out2->FindObject(Form("EtNReconstructed%sKMinus",myname)));
+    nNotid->Add((TH2F*) out2->FindObject(Form("EtNReconstructed%sProton",myname)));
+    nNotid->Add((TH2F*) out2->FindObject(Form("EtNReconstructed%sAntiProton",myname)));
+  }
 
-  //Et of all unidentified hadrons (plus hadrons identified as pions) calculated assuming their true mass
   TH2F *id = ((TH2F*) out2->FindObject(Form("EtReconstructed%sUnidentified",myname)))->Clone("id");
-  int lowbin = id->GetYaxis()->FindBin(-etacut+.001);//make sure we don't accidentally get the wrong bin
-  int highbin = id->GetYaxis()->FindBin(etacut-.001);
-  //cout<<"Projecting from "<<id->GetYaxis()->GetBinLowEdge(lowbin)<<" to "<<id->GetYaxis()->GetBinLowEdge(highbin+1)<<endl;
+  if(!eta){
+    id->Add((TH2F*) out2->FindObject(Form("EtReconstructed%sIdentifiedPiPlus",myname)));
+    id->Add((TH2F*) out2->FindObject(Form("EtReconstructed%sIdentifiedPiMinus",myname)));
+    id->Add((TH2F*) out2->FindObject(Form("EtReconstructed%sIdentifiedKPlus",myname)));
+    id->Add((TH2F*) out2->FindObject(Form("EtReconstructed%sIdentifiedKMinus",myname)));
+    id->Add((TH2F*) out2->FindObject(Form("EtReconstructed%sIdentifiedProton",myname)));
+    id->Add((TH2F*) out2->FindObject(Form("EtReconstructed%sIdentifiedAntiProton",myname)));
+  }
 
-  TH1D *denominator = id->ProjectionX(name,lowbin,highbin);
-  TH1D *numerator = notid->ProjectionX("numerator2",lowbin,highbin);
-  TH1D *nNotidProj = nNotid->ProjectionX("nNotidProj2",lowbin,highbin);
+  TH1D *nNotidProj;
+  TH1D *denominator;
+  TH1D *numerator;
+  if(eta){
+    int lowbin = notid->GetYaxis()->FindBin(-etacut+.001);//make sure we don't accv0entally get the wrong bin
+    int highbin = notid->GetYaxis()->FindBin(etacut-.001);
+    cout<<"Projecting from "<<notid->GetYaxis()->GetBinLowEdge(lowbin)<<" to "<<notid->GetYaxis()->GetBinLowEdge(highbin+1)<<endl;
+    denominator = id->ProjectionX("name",lowbin,highbin);
+    numerator = notid->ProjectionX("numerator",lowbin,highbin);
+    nNotidProj = nNotid->ProjectionX("nNotidProj",lowbin,highbin);
+  }
+  else{
+    cout<<"Getting eta dependence"<<endl;
+    int lowbin = id->GetXaxis()->FindBin(etacut);//make sure we don't accidentally get the wrong bin
+    int highbin;
+    if(etacut<0.15){//then we actually have ITS standalone tracks and we only want this to run from 0.1 to 0.15 because this will be used only for ITS standalone tracks
+      highbin = id->GetXaxis()->FindBin(0.15);
+    }
+    else{
+      highbin = id->GetXaxis()->GetNbins();
+    }
+    cout<<"Projecting from "<<id->GetXaxis()->GetBinLowEdge(lowbin)<<" to "<<id->GetXaxis()->GetBinLowEdge(highbin+1)<<endl;
+    numerator = notid->ProjectionY("name",lowbin,highbin);
+    denominator = id->ProjectionY("denominator",lowbin,highbin);
+    nNotidProj = nNotid->ProjectionY("nNotidProj",lowbin,highbin);
+  }
   TH1D *result = numerator;
   if(!denominator){
     cerr<<"Uh-oh!  Can't find denominator!!";
@@ -614,21 +707,20 @@ TH1D *GetHistoCorrNotID(float etacut,char *name, bool TPC, char *infilename){
     cerr<<"Uh-oh!  Can't rescale errors! "<<result->GetNbinsX()<<"!="<<nNotidProj->GetNbinsX()<<endl;
     return result;
   }
-  //fixing the errors
   if(!nNotidProj){
     cerr<<"Uh-oh!  Can't find histogram!!";
     return numerator;
   }
-  else{
-    for(int i=1;i<=result->GetNbinsX();i++){
-      Float_t value = result->GetBinContent(i);
-      Float_t valueerr = result->GetBinError(i);
-      Float_t n = nNotidProj->GetBinContent(i);
-      Float_t err;
-      if(n<=0) err = 0;
-      else{err = value/TMath::Power(n,0.5);}
-      result->SetBinError(i,err);
-    }
+  //fixing the errors
+  for(int i=1;i<=result->GetNbinsX();i++){
+    Float_t value = result->GetBinContent(i);
+    Float_t valueerr = result->GetBinError(i);
+    Float_t n = nNotidProj->GetBinContent(i);
+    Float_t err;
+    if(n<=0) err = 0.0;
+    else{err= value/TMath::Power(n,0.5);}
+    result->SetBinError(i,err);
+    //cout<<"Was "<<valueerr<<", setting to "<<err<<endl;
   }
   result->SetYTitle("Ratio of E_{T}^{assuming pion}/E_{T}^{real}");
   result->GetYaxis()->SetTitleOffset(1.2);
@@ -652,7 +744,7 @@ TH1D *CorrNotID(float etacut,char *name, char *prodname, char *shortprodname, bo
   c->SetFrameFillColor(0);
   c->SetFrameBorderMode(0);
 
-  TH1D *PHOS = GetHistoCorrNotID(etacut,name,TPC,infilename);
+  TH1D *PHOS = GetHistoCorrNotID(etacut,name,TPC,infilename,true);
   PHOS->SetMarkerColor(2);
   PHOS->SetLineColor(2);
   PHOS->SetAxisRange(0.0,4);
@@ -687,21 +779,90 @@ TH1D *CorrNotID(float etacut,char *name, char *prodname, char *shortprodname, bo
   return PHOS;
 }
 
+Float_t CorrNotIDConst(float ptcut, float etacut,char *name, char *prodname, char *shortprodname, bool TPC, char *infilename){
+  gStyle->SetOptTitle(0);
+  gStyle->SetOptStat(0);
+  gStyle->SetOptFit(0);
+  TCanvas *c = new TCanvas("c","c",500,400);
+  c->SetTopMargin(0.04);
+  c->SetRightMargin(0.04);
+  c->SetBorderSize(0);
+  c->SetFillColor(0);
+  c->SetFillColor(0);
+  c->SetBorderMode(0);
+  c->SetFrameFillColor(0);
+  c->SetFrameBorderMode(0);
+
+  TH1D *PHOS = GetHistoCorrNotID(ptcut,name,TPC,infilename,false);
+  PHOS->SetMarkerColor(2);
+  PHOS->SetLineColor(2);
+  PHOS->SetMaximum(1.01);
+  PHOS->SetMinimum(0.98);
+  TF1 *func = new TF1("func","[0]",-etacut,etacut);
+  PHOS->Fit(func,"","",-etacut,etacut);
+  PHOS->SetMarkerStyle(20);
+  PHOS->Draw();
+  TLatex *tex = new TLatex(0.161478,1.0835,prodname);
+  tex->SetTextSize(0.0537634);
+  tex->Draw();
+  char epsname[100];
+  char pngname[100];
+  char *detector = "EMCAL";
+  if(etacut<0.2) detector = "PHOS";
+  if(TPC){
+    sprintf(epsname,"pics/%s/fnotidConstTPC%s.eps",shortprodname,detector);
+    sprintf(pngname,"pics/%s/fnotidConstTPC%s.png",shortprodname,detector);
+  }
+  else{
+    sprintf(epsname,"pics/%s/fnotidConstITS%s.eps",shortprodname,detector);
+    sprintf(pngname,"pics/%s/fnotidConstITS%s.png",shortprodname,detector);
+  }
+
+  c->SaveAs(epsname);
+  c->SaveAs(pngname);
+  delete c;
+  return func->GetParameter(0);
+}
+
 //==================================CorrNoID=================================================
-TH1D *GetHistoNoID(float etacut, char *name, char *infilename){
+TH1D *GetHistoNoID(float etacut, char *name, char *infilename, bool eta, bool TPC){
   TFile *file = new TFile(infilename);
+  char *myname = "ITS";
+  if(TPC) myname = "TPC";
   TList *list = file->FindObject("out2");
-  TH2F *notid = ((TH2F*) out2->FindObject("EtSimulatedChargedHadronAssumingPion"))->Clone("notid");
-  TH2F *nNotid = ((TH2F*) out2->FindObject("EtNSimulatedChargedHadron"))->Clone("nNotid");
+  TH2F *notid = ((TH2F*) out2->FindObject(Form("EtReconstructed%sChargedHadronAssumingPion",myname)))->Clone("notid");
+  TH2F *nNotid = ((TH2F*) out2->FindObject(Form("EtNReconstructed%sChargedHadron",myname)))->Clone("nNotid");
 
-  TH2F *id = ((TH2F*) out2->FindObject("EtSimulatedChargedHadron"))->Clone("id");
+  TH2F *id = ((TH2F*) out2->FindObject(Form("EtReconstructed%sChargedHadron",myname)))->Clone("id");
   int lowbin = id->GetYaxis()->FindBin(-etacut+.001);//make sure we don't accidentally get the wrong bin
   int highbin = id->GetYaxis()->FindBin(etacut-.001);
 
-
-  TH1D *denominator = id->ProjectionX("name",lowbin,highbin);
-  TH1D *nNotidProj = nNotid->ProjectionX("nNotidProj",lowbin,highbin);
-  TH1D *numerator = notid->ProjectionX("numerator",lowbin,highbin);
+  TH1D *nNotidProj;
+  TH1D *denominator;
+  TH1D *numerator;
+  if(eta){
+    int lowbin = notid->GetYaxis()->FindBin(-etacut+.001);//make sure we don't accv0entally get the wrong bin
+    int highbin = notid->GetYaxis()->FindBin(etacut-.001);
+    cout<<"Projecting from "<<notid->GetYaxis()->GetBinLowEdge(lowbin)<<" to "<<notid->GetYaxis()->GetBinLowEdge(highbin+1)<<endl;
+    denominator = id->ProjectionX("name",lowbin,highbin);
+    numerator = notid->ProjectionX("numerator",lowbin,highbin);
+    nNotidProj = nNotid->ProjectionX("nNotidProj",lowbin,highbin);
+  }
+  else{
+    cout<<"Getting eta dependence"<<endl;
+    int lowbin = id->GetXaxis()->FindBin(etacut);//make sure we don't accidentally get the wrong bin
+    int highbin;
+    if(etacut<0.15){//then we actually have ITS standalone tracks and we only want this to run from 0.1 to 0.15 because this will be used only for ITS standalone tracks
+      highbin = id->GetXaxis()->FindBin(0.15);
+    }
+    else{
+      highbin = id->GetXaxis()->GetNbins();
+    }
+    cout<<"Projecting from "<<id->GetXaxis()->GetBinLowEdge(lowbin)<<" to "<<id->GetXaxis()->GetBinLowEdge(highbin+1)<<endl;
+    numerator = notid->ProjectionY("name",lowbin,highbin);
+    denominator = id->ProjectionY("denominator",lowbin,highbin);
+    nNotidProj = nNotid->ProjectionY("nNotidProj",lowbin,highbin);
+  }
   if(denominator) numerator->Divide(denominator);
 
   if(numerator->GetNbinsX() != nNotidProj->GetNbinsX()){
@@ -741,7 +902,7 @@ TH1D *CorrNoID(float etacut,char *name, char *prodname, char *shortprodname, cha
   c->SetFrameFillColor(0);
   c->SetFrameBorderMode(0);
 
-  TH1D *PHOS = GetHistoNoID(etacut,name,infilename);
+  TH1D *PHOS = GetHistoNoID(etacut,name,infilename,true,true);
   PHOS->SetMarkerColor(2);
   PHOS->SetLineColor(2);
   PHOS->SetAxisRange(0.0,4);
@@ -767,6 +928,56 @@ TH1D *CorrNoID(float etacut,char *name, char *prodname, char *shortprodname, cha
   return PHOS;
 
 }
+
+Float_t CorrNoIDConst(float etacut, float ptcut,char *name, char *prodname, char *shortprodname, char *infilename){
+  gStyle->SetOptTitle(0);
+  gStyle->SetOptStat(0);
+  gStyle->SetOptFit(0);
+  TCanvas *c = new TCanvas("c","c",500,400);
+  c->SetTopMargin(0.04);
+  c->SetRightMargin(0.04);
+  c->SetBorderSize(0);
+  c->SetFillColor(0);
+  c->SetFillColor(0);
+  c->SetBorderMode(0);
+  c->SetFrameFillColor(0);
+  c->SetFrameBorderMode(0);
+
+  bool TPC = true;
+  if(ptcut<.15) TPC = false;
+  TH1D *PHOS = GetHistoNoID(ptcut,name,infilename,false,TPC);
+  TF1 *func = new TF1("func","[0]",-etacut,etacut);
+  PHOS->Fit(func,"","",-etacut,etacut);
+  PHOS->SetMarkerColor(2);
+  PHOS->SetLineColor(2);
+  PHOS->SetMaximum(1.1);
+  PHOS->SetMinimum(0.85);
+  PHOS->SetMarkerStyle(20);;
+  PHOS->Draw();
+  TLatex *tex = new TLatex(0.161478,1.0835,prodname);
+  tex->SetTextSize(0.0537634);
+  tex->Draw();
+
+
+  char epsname[100];
+  char pngname[100];
+  char *detector = "EMCAL";
+  if(etacut<0.2) detector = "PHOS";
+  if(TPC){
+    sprintf(epsname,"pics/%s/fnoid%sTPC.eps",shortprodname,detector);
+    sprintf(pngname,"pics/%s/fnoid%sTPC.png",shortprodname,detector);
+  }
+  else{
+    sprintf(epsname,"pics/%s/fnoid%sITS.eps",shortprodname,detector);
+    sprintf(pngname,"pics/%s/fnoid%sITS.png",shortprodname,detector);
+  }
+
+  c->SaveAs(epsname);
+  c->SaveAs(pngname);
+  delete c;
+  return func->GetParameter(0);
+
+}
 //==================================Efficiency=================================================
 TH1D* bayneseffdiv(TH1D* numerator, TH1D* denominator,Char_t* name) 
 {