]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWGCF/Correlations/DPhi/TriggerPID/AliTwoParticlePIDCorr.cxx
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGCF / Correlations / DPhi / TriggerPID / AliTwoParticlePIDCorr.cxx
index 25a1855c647a556991a68caed1211e621dc3db9c..61e29bf87920b7a2a3e22b86fa4b3d3bb6b2fd2a 100644 (file)
@@ -156,6 +156,8 @@ AliTwoParticlePIDCorr::AliTwoParticlePIDCorr() // All data members should be ini
  fPriHistShare(0),
   fhistcentrality(0),
  fhistImpactParm(0),
+ fhistImpactParmvsMult(0x0),
+ fNchNpartCorr(0x0),
   fEventCounter(0),
   fEtaSpectrasso(0),
   fphiSpectraasso(0),
@@ -433,6 +435,8 @@ AliTwoParticlePIDCorr::AliTwoParticlePIDCorr(const char *name) // All data membe
    fPriHistShare(0),
   fhistcentrality(0),
    fhistImpactParm(0),
+   fhistImpactParmvsMult(0x0),
+   fNchNpartCorr(0x0),
   fEventCounter(0),
   fEtaSpectrasso(0),
   fphiSpectraasso(0),
@@ -751,7 +755,7 @@ fOutput->Add(fEtaSpectrasso);
 fphiSpectraasso=new TH2F("fphiSpectraasso","fphiSpectraasso",72,0,2*TMath::Pi(),100,0.,20.);
 fOutput->Add(fphiSpectraasso);
 
- if(fSampleType=="pPb" || fSampleType=="PbPb" || fPPVsMultUtils==kTRUE || fCentralityMethod == "MC_b"){ fCentralityCorrelation = new TH2D("fCentralityCorrelation", ";centrality;multiplicity", 101, 0, 101, 20000, 0,40000);
+ if(fSampleType=="pPb" || fSampleType=="PbPb" || fPPVsMultUtils==kTRUE || fCentralityMethod == "MC_b"){ fCentralityCorrelation = new TH2D("fCentralityCorrelation", ";centrality_ImpactParam;multiplicity", 101, 0, 101, 20000, 0,40000);
       fOutput->Add(fCentralityCorrelation);
  }
 
@@ -778,8 +782,15 @@ fhistcentrality=new TH1F("fhistcentrality","centrality",220,-5,105);
 fOutput->Add(fhistcentrality);
  }
  if(fCentralityMethod=="MC_b"){
-fhistImpactParm=new TH1F("fhistImpactParm","Impact_Parameter",300,0,30);
+fhistImpactParm=new TH1F("fhistImpactParm","Impact_Parameter",300,0,300);
 fOutput->Add(fhistImpactParm);
+fhistImpactParmvsMult=new TH2F("fhistImpactParmvsMult","fhistImpactParmvsMult",300,0,300,5001,-0.5,50000.5);
+fOutput->Add(fhistImpactParmvsMult);
+ }
+
+ if(fAnalysisType =="MCAOD" || fAnalysisType =="MC"){
+fNchNpartCorr=new TH2F("fNchNpartCorr","fNchNpartCorr",500,0.0,500.0,5001,-0.5,50000.5);
+fOutput->Add(fNchNpartCorr);
  }
 
  TString gmultName[4] = {"V0A_MANUAL","V0C_MANUAL","V0M_MANUAL","TRACKS_MANUAL"};
@@ -1779,6 +1790,7 @@ if(fAnalysisType == "MC"){
    if(gReactionPlane==999.) return;
  }
 
+
 TObjArray* tracksMCtruth=new TObjArray;//for truth MC particles with PID,here unidentified means any particle other than pion, kaon or proton(Basicaly Spundefined of AliHelperPID)******WARNING::different from data and reco MC
  tracksMCtruth->SetOwner(kTRUE);  //***********************************IMPORTANT!
 
@@ -1917,8 +1929,18 @@ if((partMC->Pt()>=fminPtAsso && partMC->Pt()<=fmaxPtAsso) || (partMC->Pt()>=fmin
   }
  }//track loop ends
 
+ if(nooftrackstruth>0.0){
 if (fSampleType=="pPb" || fSampleType=="PbPb" || fPPVsMultUtils==kTRUE || fCentralityMethod == "MC_b") fCentralityCorrelation->Fill(cent_v0, nooftrackstruth);//only with unidentified tracks(i.e before PID selection);;;;;can be used to remove centrality outliers??????
 
+AliCollisionGeometry* collGeometry = dynamic_cast<AliCollisionGeometry*>(gMCEvent->GenEventHeader());    
+ if(collGeometry){
+Float_t NpartProj= collGeometry-> ProjectileParticipants();
+Float_t NpartTarg = collGeometry->TargetParticipants();
+ Float_t Npart= (NpartProj + NpartTarg);
+fNchNpartCorr->Fill(Npart,nooftrackstruth);
+ }
+ }
+
   if (fRandomizeReactionPlane)//only for TRuth MC??
   {
     Double_t centralityDigits = cent_v0*1000. - (Int_t)(cent_v0*1000.);
@@ -2177,7 +2199,7 @@ if(ffillhistQATruth)
     if (TMath::Abs(pdgtruth)==2212 || TMath::Abs(pdgtruth)==321) fTrackHistEfficiency[4]->Fill(primmctruth,0);//for  primary truth kaons+protons(4)
     if (TMath::Abs(pdgtruth)==211)  fTrackHistEfficiency[0]->Fill(primmctruth,0);//for pions
     if (TMath::Abs(pdgtruth)==321)  fTrackHistEfficiency[1]->Fill(primmctruth,0);//for kaons
-    if(TMath::Abs(pdgtruth)==2212)  fTrackHistEfficiency[2]->Fill(primmctruth,0);//for protons
+    if (TMath::Abs(pdgtruth)==2212)  fTrackHistEfficiency[2]->Fill(primmctruth,0);//for protons
   }
    
  Float_t effmatrixtruth=1.0;//In Truth MC, no case of efficiency correction so it should be always 1.0
@@ -2206,14 +2228,26 @@ if((partMC->Pt()>=fminPtAsso && partMC->Pt()<=fmaxPtAsso) || (partMC->Pt()>=fmin
     ShiftTracks(tracksMCtruth, angle);  
   }
  
+if(nooftrackstruth>0.0){
+if (fSampleType=="pPb" || fSampleType=="PbPb" || fPPVsMultUtils==kTRUE || fCentralityMethod == "MC_b") fCentralityCorrelation->Fill(cent_v0, nooftrackstruth);//only with unidentified tracks(i.e before PID selection);;;;;can be used to remove centrality outliers??????
 
+   AliGenEventHeader* eventHeader = header->GetCocktailHeader(0);  // get first MC header from either ESD/AOD (including cocktail header if available)
+      if (eventHeader)
+      {             
+AliCollisionGeometry* collGeometry = dynamic_cast <AliCollisionGeometry*> (eventHeader);
+ if(collGeometry){
+Float_t NpartProj= collGeometry-> ProjectileParticipants();
+Float_t NpartTarg = collGeometry->TargetParticipants();
+Float_t Npart= (NpartProj + NpartTarg);
+fNchNpartCorr->Fill(Npart,nooftrackstruth);
+         }
+      }    
+ }
  Float_t weghtval=1.0;
 
 if(nooftrackstruth>0.0 && ffilltrigIDassoIDMCTRUTH)
   {
-
-if (fSampleType=="pPb" || fSampleType=="PbPb" || fPPVsMultUtils==kTRUE || fCentralityMethod == "MC_b") fCentralityCorrelation->Fill(cent_v0, nooftrackstruth);//only with unidentified tracks(i.e before PID selection);;;;;can be used to remove centrality outliers??????
-
  //Fill Correlations for MC truth particles(same event)
 if(tracksMCtruth && tracksMCtruth->GetEntriesFast()>0)//hadron triggered correlation
   Fillcorrelation(gReactionPlane,tracksMCtruth,0,cent_v0,zVtxmc,weghtval,kFALSE,bSign,fPtOrderMCTruth,kFALSE,kFALSE,"trigIDassoIDMCTRUTH");//mixcase=kFALSE for same event case
@@ -2428,19 +2462,6 @@ fTrackHistEfficiency[5]->Fill(allrecomatchedpid,2);//for allreco matched
  }
  }
 
- //now start the particle identification process:)
-
-Float_t dEdx = PIDtrack->GetTPCsignal();
- fHistoTPCdEdx->Fill(track->Pt(), dEdx);
-
- if(HasTOFPID(PIDtrack))
-{
-Double_t beta = GetBeta(PIDtrack);
-fHistoTOFbeta->Fill(track->Pt(), beta);
- }
-
-//do track identification(nsigma method)
-  particletypeMC=GetParticle(PIDtrack,fFIllPIDQAHistos);//******************************problem is here
 switch(TMath::Abs(pdgCode)){
   case 2212:
     if(fFIllPIDQAHistos){
@@ -2472,6 +2493,24 @@ switch(TMath::Abs(pdgCode)){
   }
 
 
+ //now start the particle identification process:)
+
+Float_t dEdx = PIDtrack->GetTPCsignal();
+ fHistoTPCdEdx->Fill(track->Pt(), dEdx);
+
+ if(HasTOFPID(PIDtrack))
+{
+Double_t beta = GetBeta(PIDtrack);
+fHistoTOFbeta->Fill(track->Pt(), beta);
+ }
+
+ //remove the tracks which don't have proper TOF response-otherwise the misIDentification rate values will be wrong
+if(fRequestTOFPID && track->Pt()>fPtTOFPIDmin && (!HasTOFPID(PIDtrack)) ) continue;
+
+//do track identification(nsigma method)
+  particletypeMC=GetParticle(PIDtrack,fFIllPIDQAHistos);//******************************problem is here
+
 //2-d TPCTOF map(for each Pt interval)
   if(HasTOFPID(PIDtrack)){
  fTPCTOFPion3d->Fill(track->Pt(),fnsigmas[SpPion][NSigmaTOF],fnsigmas[SpPion][NSigmaTPC]);
@@ -2502,6 +2541,38 @@ if (particletypeMC==SpProton)
   }
     }
 
+ //fill tracking efficiency
+ if(ffillefficiency)
+   {
+ if(particletypeMC==SpPion || particletypeMC==SpKaon)
+   {
+     if(TMath::Abs(pdgCode)==211 ||  TMath::Abs(pdgCode)==321) {
+       fTrackHistEfficiency[3]->Fill(allrecomatchedpid,4);//for mesons
+ if (((AliAODMCParticle*)recomatched)->IsPhysicalPrimary())  fTrackHistEfficiency[3]->Fill(allrecomatchedpid,3);//for mesons
+     }
+   }
+ if(particletypeMC==SpKaon || particletypeMC==SpProton)
+   {
+     if(TMath::Abs(pdgCode)==321 ||  TMath::Abs(pdgCode)==2212) {
+       fTrackHistEfficiency[4]->Fill(allrecomatchedpid,4);//for kaons+protons
+ if (((AliAODMCParticle*)recomatched)->IsPhysicalPrimary())  fTrackHistEfficiency[4]->Fill(allrecomatchedpid,3);
+     }
+   }
+ if(particletypeMC==SpPion && TMath::Abs(pdgCode)==211)  {
+   fTrackHistEfficiency[0]->Fill(allrecomatchedpid,4);//for pions
+ if (((AliAODMCParticle*)recomatched)->IsPhysicalPrimary())  fTrackHistEfficiency[0]->Fill(allrecomatchedpid,3);
+ } 
+ if(particletypeMC==SpKaon && TMath::Abs(pdgCode)==321) {
+   fTrackHistEfficiency[1]->Fill(allrecomatchedpid,4);//for kaons
+if (((AliAODMCParticle*)recomatched)->IsPhysicalPrimary())  fTrackHistEfficiency[1]->Fill(allrecomatchedpid,3);
+ }
+ if(particletypeMC==SpProton && TMath::Abs(pdgCode)==2212){
+   fTrackHistEfficiency[2]->Fill(allrecomatchedpid,4);//for protons
+if (((AliAODMCParticle*)recomatched)->IsPhysicalPrimary())  fTrackHistEfficiency[2]->Fill(allrecomatchedpid,3);
+ }
+   }
+
+
  //for misidentification fraction calculation(do it with tuneonPID)
  if(particletypeMC==SpPion )
    {
@@ -2524,7 +2595,7 @@ if(particletypeMC==SpKaon )
      if(TMath::Abs(pdgCode)==2212) fProtoncont->Fill(5.,track->Pt());
      if(TMath::Abs(pdgCode)!=211 && TMath::Abs(pdgCode)!=321 && TMath::Abs(pdgCode)!=2212) fProtoncont->Fill(7.,track->Pt());
    }
- if(particletypeMC==SpUndefined )
+ if(particletypeMC==SpUndefined )//these undefined are not due to absence of proper TOF response, rather due to the PID method only
    {
      if(TMath::Abs(pdgCode)==211) fUNIDcont->Fill(1.,track->Pt());
      if(TMath::Abs(pdgCode)==321) fUNIDcont->Fill(3.,track->Pt());
@@ -2538,37 +2609,6 @@ if(particletypeMC==SpKaon )
       FillPIDEventPlane(cent_v0,particletypeMC,track->Phi(),gReactionPlane);
     }
 
- //fill tracking efficiency
- if(ffillefficiency)
-   {
- if(particletypeMC==SpPion || particletypeMC==SpKaon)
-   {
-     if(TMath::Abs(pdgCode)==211 ||  TMath::Abs(pdgCode)==321) {
-       fTrackHistEfficiency[3]->Fill(allrecomatchedpid,4);//for mesons
- if (((AliAODMCParticle*)recomatched)->IsPhysicalPrimary())  fTrackHistEfficiency[3]->Fill(allrecomatchedpid,3);//for mesons
-     }
-   }
- if(particletypeMC==SpKaon || particletypeMC==SpProton)
-   {
-     if(TMath::Abs(pdgCode)==321 ||  TMath::Abs(pdgCode)==2212) {
-       fTrackHistEfficiency[4]->Fill(allrecomatchedpid,4);//for kaons+protons
- if (((AliAODMCParticle*)recomatched)->IsPhysicalPrimary())  fTrackHistEfficiency[4]->Fill(allrecomatchedpid,3);
-     }
-   }
- if(particletypeMC==SpPion && TMath::Abs(pdgCode)==211)  {
-   fTrackHistEfficiency[0]->Fill(allrecomatchedpid,4);//for pions
- if (((AliAODMCParticle*)recomatched)->IsPhysicalPrimary())  fTrackHistEfficiency[0]->Fill(allrecomatchedpid,3);
- } 
- if(particletypeMC==SpKaon && TMath::Abs(pdgCode)==321) {
-   fTrackHistEfficiency[1]->Fill(allrecomatchedpid,4);//for kaons
-if (((AliAODMCParticle*)recomatched)->IsPhysicalPrimary())  fTrackHistEfficiency[1]->Fill(allrecomatchedpid,3);
- }
- if(particletypeMC==SpProton && TMath::Abs(pdgCode)==2212){
-   fTrackHistEfficiency[2]->Fill(allrecomatchedpid,4);//for protons
-if (((AliAODMCParticle*)recomatched)->IsPhysicalPrimary())  fTrackHistEfficiency[2]->Fill(allrecomatchedpid,3);
- }
-   }
-
 if((track->Pt()>=fminPtAsso && track->Pt()<=fmaxPtAsso) || (track->Pt()>=fminPtTrig && track->Pt()<=fmaxPtTrig))//to reduce memory consumption in pool
   {
     Short_t chargeval=0;
@@ -2866,7 +2906,9 @@ if (fSampleType=="pp_2_76" || fCentralityMethod.EndsWith("_MANUAL") || (fSampleT
   fHistoTOFbeta->Fill(track->Pt(), beta);
  }
   
-
+ //remove the tracks which don't have proper TOF response-otherwise the misIDentification rate values will be wrong(in MC)
+if(fRequestTOFPID && track->Pt()>fPtTOFPIDmin && (!HasTOFPID(PIDtrack)) ) continue;
 //track identification(using nsigma method)
      particletype=GetParticle(PIDtrack,fFIllPIDQAHistos);//*******************************change may be required(It should return only pion,kaon, proton and Spundefined; NOT unidentifed***************be careful)
 
@@ -4730,7 +4772,7 @@ Double_t AliTwoParticlePIDCorr::GetRefMultiOrCentrality(AliVEvent *mainevent, Bo
 
 if(fCentralityMethod=="V0M" || fCentralityMethod=="V0A" || fCentralityMethod=="V0C" || fCentralityMethod=="CL1" || fCentralityMethod=="ZNA" || fCentralityMethod=="V0AEq" || fCentralityMethod=="V0CEq" || fCentralityMethod=="V0MEq")//for PbPb, pPb, pp7TeV(still to be introduced)//data or RecoMC and also for TRUTH
     {
-      
+                   
 if(fSampleType=="pp_7" && fPPVsMultUtils)
    {//for pp 7 TeV case only using Alianalysisutils class
        if(fAnalysisUtils) cent_v0 = fAnalysisUtils->GetMultiplicityPercentile((AliVEvent*)event,fCentralityMethod);
@@ -4742,7 +4784,7 @@ if(fSampleType=="pp_7" && fPPVsMultUtils)
   fHistCentStats->Fill(4.,fAnalysisUtils->GetMultiplicityPercentile((AliVEvent*)event,"V0CEq"));//only available for LHC10d at present (Quantile info)
   fHistCentStats->Fill(5.,fAnalysisUtils->GetMultiplicityPercentile((AliVEvent*)event,"V0MEq"));//only available for LHC10d at present (Quantile info)
       }
-      
+              
 else if(fSampleType=="pPb" || fSampleType=="PbPb")
   {
   AliCentrality *centralityObj=0;
@@ -4927,6 +4969,7 @@ else if(fAnalysisType == "MC"){
  if (fCentralityMethod == "MC_b"){
        cent_v0=gImpactParameter;
        fhistImpactParm->Fill(gImpactParameter);
+       fhistImpactParmvsMult->Fill(gImpactParameter,gRefMultiplicityTPC_Truth);
  }
 
  else if(fCentralityMethod == "TRACKS_MANUAL")   cent_v0=gRefMultiplicityTPC_Truth;