]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWGLF/SPECTRA/ChargedHadrons/dNdPt/AlidNdPtAnalysisPbPbAOD.cxx
Modified Crosscheck Histograms for Eventplane
[u/mrichter/AliRoot.git] / PWGLF / SPECTRA / ChargedHadrons / dNdPt / AlidNdPtAnalysisPbPbAOD.cxx
index cda9b08992d63c04aeff76fe468043b526acc9fc..63b8d4fc2ca3e0c5f700f46f0a59bd59a73c2782 100644 (file)
@@ -1,31 +1,31 @@
 /**************************************************************************
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- *                                                                        *
- * Author: The ALICE Off-line Project.                                    *
- * Contributors are mentioned in the code where appropriate.              *
- *                                                                        *
- * Permission to use, copy, modify and distribute this software and its   *
- * documentation strictly for non-commercial purposes is hereby granted   *
- * without fee, provided that the above copyright notice appears in all   *
- * copies and that both the copyright notice and this permission notice   *
- * appear in the supporting documentation. The authors make no claims     *
- * about the suitability of this software for any purpose. It is          *
- * provided "as is" without express or implied warranty.                  *
- **************************************************************************/
+* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+*                                                                        *
+* Author: The ALICE Off-line Project.                                    *
+* Contributors are mentioned in the code where appropriate.              *
+*                                                                        *
+* Permission to use, copy, modify and distribute this software and its   *
+* documentation strictly for non-commercial purposes is hereby granted   *
+* without fee, provided that the above copyright notice appears in all   *
+* copies and that both the copyright notice and this permission notice   *
+* appear in the supporting documentation. The authors make no claims     *
+* about the suitability of this software for any purpose. It is          *
+* provided "as is" without express or implied warranty.                  *
+**************************************************************************/
 //------------------------------------------------------------------------------
 // AlidNdPtAnalysisPbPbAOD class. 
 // 
 // Author: P. Luettig, 15.05.2013
-// last modified: 18.02.2014
+// last modified: 10.06.2014
 //------------------------------------------------------------------------------
 /*
- * This task analysis measured data in PbPb collisions stored in AODs and extract 
- * transverse momentum spectra for unidentified charged hadrons vs. centrality.
- * Based on MC the efficiency and secondary contamination are determined,
- * to correct the measured pT distribution.
- * Histograms for the pT resolution correction are also filled.
- *
- */ 
+* This task analysis measured data in PbPb collisions stored in AODs and extract 
+* transverse momentum spectra for unidentified charged hadrons vs. centrality.
+* Based on MC the efficiency and secondary contamination are determined,
+* to correct the measured pT distribution.
+* Histograms for the pT resolution correction are also filled.
+*
+*/ 
 
 
 #include "AlidNdPtAnalysisPbPbAOD.h"
@@ -72,8 +72,17 @@ fCrossCheckClusterLengthAcc(0),
 fCutSettings(0),
 fEventplaneDist(0),
 fMCEventplaneDist(0),
+fCorrelEventplaneMCDATA(0),
+// cross check for event plane resolution
+fEPDistCent(0),
+fPhiCent(0),
+fPcosEPCent(0),
+fPsinEPCent(0),
+fPcosPhiCent(0),
+fPsinPhiCent(0),
 //global
 fIsMonteCarlo(0),
+fEPselector("Q"),
 // event cut variables
 fCutMaxZVertex(10.),  
 // track kinematic cut variables
@@ -195,7 +204,7 @@ void AlidNdPtAnalysisPbPbAOD::UserCreateOutputObjects()
   if (!fBinsPtCheck)   { SetBinsPtCheck(20,binsPtCheckDefault); }
   if (!fBinsEta)       { SetBinsEta(31,binsEtaDefault); }
   if (!fBinsEtaCheck)  { SetBinsEtaCheck(7,binsEtaCheckDefault); }
-  if (!fBinsZv)                { SetBinsZv(13,binsZvDefault); }  
+  if (!fBinsZv)                { SetBinsZv(7,binsZvDefault); }  
   if (!fBinsCentrality)        { SetBinsCentrality(12,binsCentralityDefault); }
   if (!fBinsPhi)       { SetBinsPhi(37,binsPhiDefault); }
   
@@ -526,6 +535,42 @@ void AlidNdPtAnalysisPbPbAOD::UserCreateOutputObjects()
   fMCEventplaneDist->GetXaxis()->SetTitle("#phi (MC event plane)");
   fMCEventplaneDist->Sumw2();
   
+  fCorrelEventplaneMCDATA = new TH2F("fCorrelEventplaneMCDATA","fCorrelEventplaneMCDATA",40, -2.*TMath::Pi(), 2.*TMath::Pi(), 40, -2.*TMath::Pi(), 2.*TMath::Pi());
+  fCorrelEventplaneMCDATA->GetXaxis()->SetTitle("#phi (event plane)");
+  fCorrelEventplaneMCDATA->GetYaxis()->SetTitle("#phi (MC event plane)");
+  fCorrelEventplaneMCDATA->Sumw2();
+  
+  // cross check for event plane resolution
+  fEPDistCent = new TH2F("fEPDistCent","fEPDistCent",20, -1.*TMath::Pi(), TMath::Pi(), fCentralityNbins-1, fBinsCentrality);
+  fEPDistCent->GetXaxis()->SetTitle("#phi (#Psi_{EP})");
+  fEPDistCent->GetYaxis()->SetTitle("Centrality");
+  fEPDistCent->Sumw2();
+  
+  fPhiCent = new TH2F("fPhiCent","fPhiCent",200, -2.*TMath::Pi(), 2.*TMath::Pi(), fCentralityNbins-1, fBinsCentrality);
+  fPhiCent->GetXaxis()->SetTitle("#phi");
+  fPhiCent->GetYaxis()->SetTitle("Centrality");
+  fPhiCent->Sumw2();
+  
+  fPcosEPCent = new TProfile("fPcosEPCent","fPcosEPCent", 100,0,100);
+  fPcosEPCent->GetXaxis()->SetTitle("Centrality");
+  fPcosEPCent->GetYaxis()->SetTitle("#LT cos 2 #Psi_{EP} #GT");
+  fPcosEPCent->Sumw2();
+  
+  fPsinEPCent = new TProfile("fPsinEPCent","fPsinEPCent", 100,0,100);
+  fPsinEPCent->GetXaxis()->SetTitle("Centrality");
+  fPsinEPCent->GetYaxis()->SetTitle("#LT sin 2 #Psi_{EP} #GT");
+  fPsinEPCent->Sumw2();
+  
+  fPcosPhiCent = new TProfile("fPcosPhiCent","fPcosPhiCent", 100,0,100);
+  fPcosPhiCent->GetXaxis()->SetTitle("Centrality");
+  fPcosPhiCent->GetYaxis()->SetTitle("#LT cos 2 #phi #GT");
+  fPcosPhiCent->Sumw2();
+  
+  fPsinPhiCent = new TProfile("fPsinPhiCent","fPsinPhiCent", 100,0,100);
+  fPsinPhiCent->GetXaxis()->SetTitle("Centrality");
+  fPsinPhiCent->GetYaxis()->SetTitle("#LT sin 2 #phi #GT");
+  fPsinPhiCent->Sumw2();
+  
   // Add Histos, Profiles etc to List
   fOutputList->Add(fZvPtEtaCent);
   fOutputList->Add(fDeltaphiPtEtaCent);
@@ -565,6 +610,14 @@ void AlidNdPtAnalysisPbPbAOD::UserCreateOutputObjects()
   fOutputList->Add(fCutSettings);
   fOutputList->Add(fEventplaneDist);
   fOutputList->Add(fMCEventplaneDist);
+  fOutputList->Add(fCorrelEventplaneMCDATA);
+  
+  fOutputList->Add(fEPDistCent);
+  fOutputList->Add(fPhiCent);
+  fOutputList->Add(fPcosEPCent);
+  fOutputList->Add(fPsinEPCent);
+  fOutputList->Add(fPcosPhiCent);
+  fOutputList->Add(fPsinPhiCent);
   
   StoreCutSettingsToHistogram();
   
@@ -642,6 +695,7 @@ void AlidNdPtAnalysisPbPbAOD::UserExec(Option_t *option)
   // only take tracks of events, which are triggered
   if(nTriggerFired == 0) { return; } 
   
+  
   //   if( !bIsEventSelected || nTriggerFired>1 ) return;
   
   //   fEventStatistics->Fill("events with only coll. cand.", 1);
@@ -669,7 +723,7 @@ void AlidNdPtAnalysisPbPbAOD::UserExec(Option_t *option)
        
        dMCEventZv = mcHdr->GetVtxZ();
        dMCTrackZvPtEtaCent[0] = dMCEventZv;
-       dMCEventplaneAngle = genHijingHeader->ReactionPlaneAngle();
+       dMCEventplaneAngle = MoveEventplane(genHijingHeader->ReactionPlaneAngle());
        fEventStatistics->Fill("MC all events",1);
        fMCEventplaneDist->Fill(dMCEventplaneAngle);
   }
@@ -678,9 +732,28 @@ void AlidNdPtAnalysisPbPbAOD::UserExec(Option_t *option)
   Double_t dCentrality = aCentrality->GetCentralityPercentile("V0M");
   
   if( dCentrality < 0 ) return;
+  
+  // protection for bias on pt spectra if all triggers selected
+  //   if( (bIsEventSelectedCentral) /*&& (!bIsEventSelectedSemi) && (!bIsEventSelectedMB)*/ && (dCentrality > 10) ) return;
+  //   if( /*(!bIsEventSelectedCentral) &&*/ (bIsEventSelectedSemi) /*&& (!bIsEventSelectedMB)*/ && (dCentrality < 20) && (dCentrality > 50)) return;
+  if( (bIsEventSelectedCentral)  && (dCentrality > 10) ) return;
+  if( (bIsEventSelectedSemi) && ((dCentrality < 20) || (dCentrality > 50))) return;
+  
   fEventStatistics->Fill("after centrality selection",1);
   
+  // get event plane Angle from AODHeader, default is Q
+  ep = const_cast<AliAODEvent*>(eventAOD)->GetEventplane();
+  if(ep) {
+       dEventplaneAngle = MoveEventplane(ep->GetEventplane(GetEventplaneSelector().Data(),eventAOD));
+  }
+  
+  //   cout << dEventplaneAngle << endl;
+  fEventplaneDist->Fill(dEventplaneAngle);
   
+  // fill crosscheck histos
+  fEPDistCent->Fill(dEventplaneAngle, dCentrality);
+  fPcosEPCent->Fill(dCentrality, TMath::Cos(2.*dEventplaneAngle));
+  fPsinEPCent->Fill(dCentrality, TMath::Sin(2.*dEventplaneAngle));
   
   // start with MC truth analysis
   if(fIsMonteCarlo)
@@ -719,9 +792,9 @@ void AlidNdPtAnalysisPbPbAOD::UserExec(Option_t *option)
          dMCTrackZvPtEtaCent[3] = dCentrality;
          fMCGenZvPtEtaCent->Fill(dMCTrackZvPtEtaCent);
          
-         dMCTrackPhiPtEtaCent[0] = mcPart->Phi()-dMCEventplaneAngle;
-         if( dMCTrackPhiPtEtaCent[0] < 0) dMCTrackPhiPtEtaCent[0] += 2.*TMath::Pi();
-         else if( dMCTrackPhiPtEtaCent[0] > 2.*TMath::Pi()) dMCTrackPhiPtEtaCent[0] -= 2.*TMath::Pi();
+         dMCTrackPhiPtEtaCent[0] = RotatePhi(mcPart->Phi(), dEventplaneAngle); // use eventplane and not reactionplan, similar to centrality vs impact paramter
+         //      if( dMCTrackPhiPtEtaCent[0] < 0) dMCTrackPhiPtEtaCent[0] += 2.*TMath::Pi();
+         //      else if( dMCTrackPhiPtEtaCent[0] > 2.*TMath::Pi()) dMCTrackPhiPtEtaCent[0] -= 2.*TMath::Pi();
          dMCTrackPhiPtEtaCent[1] = mcPart->Pt();
          dMCTrackPhiPtEtaCent[2] = mcPart->Eta();
          dMCTrackPhiPtEtaCent[3] = dCentrality;
@@ -767,14 +840,7 @@ void AlidNdPtAnalysisPbPbAOD::UserExec(Option_t *option)
   
   dTrackZvPtEtaCent[0] = dEventZv;
   
-  // get event plane Angle from AODHeader, default is Q
-  ep = const_cast<AliAODEvent*>(eventAOD)->GetEventplane();
-  if(ep) {
-       dEventplaneAngle = ep->GetEventplane("V0",eventAOD);
-  }
   
-  cout << dEventplaneAngle << endl;
-  fEventplaneDist->Fill(dEventplaneAngle);
   
   if(AreRelativeCutsEnabled())
   {
@@ -810,9 +876,10 @@ void AlidNdPtAnalysisPbPbAOD::UserExec(Option_t *option)
        dTrackZvPtEtaCent[2] = track->Eta();
        dTrackZvPtEtaCent[3] = dCentrality;
        
-       dTrackPhiPtEtaCent[0] = track->Phi() - dEventplaneAngle;
-       if( dTrackPhiPtEtaCent[0] < 0) dTrackPhiPtEtaCent[0] += 2.*TMath::Pi();
-       else if( dTrackPhiPtEtaCent[0] > 2.*TMath::Pi()) dTrackPhiPtEtaCent[0] -= 2.*TMath::Pi();
+       dTrackPhiPtEtaCent[0] = RotatePhi(track->Phi(), dEventplaneAngle); 
+       
+       //      if( dTrackPhiPtEtaCent[0] < -1.0*TMath::Pi()) dTrackPhiPtEtaCent[0] += 2.*TMath::Pi();
+       //      else if( dTrackPhiPtEtaCent[0] > TMath::Pi()) dTrackPhiPtEtaCent[0] -= 2.*TMath::Pi();
        dTrackPhiPtEtaCent[1] = track->Pt();
        dTrackPhiPtEtaCent[2] = track->Eta();
        dTrackPhiPtEtaCent[3] = dCentrality;
@@ -834,9 +901,10 @@ void AlidNdPtAnalysisPbPbAOD::UserExec(Option_t *option)
          dMCTrackZvPtEtaCent[2] = mcPart->Eta();
          dMCTrackZvPtEtaCent[3] = dCentrality;
          
-         dMCTrackPhiPtEtaCent[0] = mcPart->Phi()-dMCEventplaneAngle;
-         if( dMCTrackPhiPtEtaCent[0] < 0) dMCTrackPhiPtEtaCent[0] += 2.*TMath::Pi();
-         else if( dMCTrackPhiPtEtaCent[0] > 2.*TMath::Pi()) dMCTrackPhiPtEtaCent[0] -= 2.*TMath::Pi();
+         dMCTrackPhiPtEtaCent[0] = RotatePhi(mcPart->Phi(), dEventplaneAngle); // use eventplane and not reactionplan, similar to centrality vs impact paramter
+         
+         //      if( dMCTrackPhiPtEtaCent[0] < -1.0*TMath::Pi()) dMCTrackPhiPtEtaCent[0] += 2.*TMath::Pi();
+         //      else if( dMCTrackPhiPtEtaCent[0] > TMath::Pi()) dMCTrackPhiPtEtaCent[0] -= 2.*TMath::Pi();
          dMCTrackPhiPtEtaCent[1] = mcPart->Pt();
          dMCTrackPhiPtEtaCent[2] = mcPart->Eta();
          dMCTrackPhiPtEtaCent[3] = dCentrality;
@@ -899,6 +967,10 @@ void AlidNdPtAnalysisPbPbAOD::UserExec(Option_t *option)
          bEventHasATrackInRange = kTRUE;
          fPt->Fill(track->Pt());
          fCharge->Fill(track->Charge());
+         
+         fPhiCent->Fill(track->Phi(), dCentrality);
+         fPcosPhiCent->Fill(dCentrality, TMath::Cos(2.*track->Phi()));
+         fPsinPhiCent->Fill(dCentrality, TMath::Sin(2.*track->Phi()));
        }
   } // end track loop
   
@@ -916,15 +988,78 @@ void AlidNdPtAnalysisPbPbAOD::UserExec(Option_t *option)
   if(bIsEventSelectedSemi) fEventStatisticsCentralityTrigger->Fill(dCentrality, 1);
   if(bIsEventSelectedCentral) fEventStatisticsCentralityTrigger->Fill(dCentrality, 2);
   
-  Double_t dEventZvMultCent[3] = {dEventZv, iAcceptedMultiplicity, dCentrality};
+  Double_t dEventZvMultCent[3] = {dEventZv, static_cast<Double_t>(iAcceptedMultiplicity), dCentrality};
   fZvMultCent->Fill(dEventZvMultCent);
   
+  // store correlation between data and MC eventplane
+  if(fIsMonteCarlo) fCorrelEventplaneMCDATA->Fill(dEventplaneAngle, dMCEventplaneAngle);
+  
   PostData(1, fOutputList);
   
   // delete pointers:
   
 }
 
+Double_t AlidNdPtAnalysisPbPbAOD::MoveEventplane(Double_t dMCEP)
+{
+  Double_t retval = 0;
+  retval = dMCEP;
+  
+  if( (dMCEP > 0) && (dMCEP < 1./2.*TMath::Pi()) ) 
+  {
+       return retval;
+  }
+  
+  if( (dMCEP >= 1./2.*TMath::Pi()) && (dMCEP <= 3./2.*TMath::Pi()) )
+  {
+       retval -= TMath::Pi();
+       return retval;
+  }
+  
+  if(dMCEP > 3./2.*TMath::Pi())
+  {
+       retval -= 2.*TMath::Pi();
+       return retval;
+  }
+  
+  return -9999.;
+}
+
+Double_t AlidNdPtAnalysisPbPbAOD::RotatePhi(Double_t phiTrack, Double_t phiEP)
+{
+  Double_t dPhi = 0;
+  dPhi = phiTrack - phiEP;
+  if ((dPhi >= -1./2. * TMath::Pi() ) && 
+       (dPhi <= 1./2. * TMath::Pi() ) )
+  {
+       return dPhi;
+  }
+  
+  if( (dPhi < 0) )
+  {
+       dPhi += 2.*TMath::Pi();
+  }
+  
+  if ((dPhi > 0) && 
+       (dPhi > 1./2. * TMath::Pi() ) && 
+       (dPhi <= 3./2. * TMath::Pi() ) )
+  {
+       dPhi -= TMath::Pi();
+       return dPhi;
+  }    
+  
+  if ((dPhi > 0) && 
+       (dPhi > 3./2. * TMath::Pi() )) 
+  {
+       dPhi -= 2.*TMath::Pi();
+       return dPhi;
+  }
+  
+  //   Printf("[E] dphi = %.4f , phiTrack = %.4f, phiEP = %.4f", dPhi, phiTrack, phiEP);
+  
+  return -9999.;
+}
+
 Bool_t AlidNdPtAnalysisPbPbAOD::SetRelativeCuts(AliAODEvent *event)
 {
   //
@@ -1044,7 +1179,7 @@ Bool_t AlidNdPtAnalysisPbPbAOD::IsTrackAccepted(AliAODTrack *tr, Double_t dCentr
   
   Double_t dLengthInTPC = 0;
   if ( DoCutLengthInTPCPtDependent() ) { dLengthInTPC = dummy.GetLengthInActiveZone(&par,3,236, bMagZ ,0,0); }
-
+  
   Double_t dNClustersTPC = tr->GetTPCNcls();
   Double_t dCrossedRowsTPC = tr->GetTPCClusterInfo(2,1);
   Double_t dFindableClustersTPC = tr->GetTPCNclsF();
@@ -1090,27 +1225,27 @@ Bool_t AlidNdPtAnalysisPbPbAOD::IsTrackAccepted(AliAODTrack *tr, Double_t dCentr
   if(dNClustersTPC < GetCutMinNClustersTPC()) { return kFALSE; }
   
   if (IsITSRefitRequired() && !(tr->GetStatus() & AliVTrack::kITSrefit)) { return kFALSE; } // no ITS refit
-  
-  // do a relativ cut in Nclusters, both time at 80% of mean
-  //   if(fIsMonteCarlo) 
-  //   { 
-  //     if(dNClustersTPC < 88) { return kFALSE; }
-  //   }
-  //   else
-  //   {
-  //     if(dNClustersTPC < 76) { return kFALSE; }
-  //   }
-  
-  // fill histogram for pT resolution correction
-  Double_t dPtResolutionHisto[3] = { dOneOverPt, dSigmaOneOverPt, dCentrality };
-  fPtResptCent->Fill(dPtResolutionHisto);
-  
-  // fill debug histogram for all accepted tracks
-  FillDebugHisto(dCheck, dKine, dCentrality, kTRUE);
-  
-  // delete pointers
-  
-  return kTRUE;
+       
+       // do a relativ cut in Nclusters, both time at 80% of mean
+       //   if(fIsMonteCarlo) 
+       //   { 
+         //     if(dNClustersTPC < 88) { return kFALSE; }
+         //   }
+         //   else
+         //   {
+               //     if(dNClustersTPC < 76) { return kFALSE; }
+               //   }
+               
+               // fill histogram for pT resolution correction
+               Double_t dPtResolutionHisto[3] = { dOneOverPt, dSigmaOneOverPt, dCentrality };
+               fPtResptCent->Fill(dPtResolutionHisto);
+               
+               // fill debug histogram for all accepted tracks
+               FillDebugHisto(dCheck, dKine, dCentrality, kTRUE);
+               
+               // delete pointers
+               
+               return kTRUE;
 }
 
 Bool_t AlidNdPtAnalysisPbPbAOD::FillDebugHisto(Double_t *dCrossCheckVar, Double_t *dKineVar, Double_t dCentrality, Bool_t bIsAccepted)
@@ -1184,6 +1319,7 @@ void AlidNdPtAnalysisPbPbAOD::StoreCutSettingsToHistogram()
   fCutSettings->Fill("fCutMaxChi2TPCConstrainedGlobal", fCutMaxChi2TPCConstrainedGlobal);
   if(fCutLengthInTPCPtDependent) fCutSettings->Fill("fCutLengthInTPCPtDependent", 1);
   fCutSettings->Fill("fPrefactorLengthInTPCPtDependent", fPrefactorLengthInTPCPtDependent);
+  fCutSettings->Fill(Form("EP selector %s", fEPselector.Data()), 1);
 }
 
 Bool_t AlidNdPtAnalysisPbPbAOD::GetDCA(const AliAODTrack *track, AliAODEvent *evt, Double_t d0z0[2])