Updated linkdef and package to include dalitz task, updates by Ana, and added functio...
authorkaamodt <kaamodt@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 22 Sep 2010 15:50:40 +0000 (15:50 +0000)
committerkaamodt <kaamodt@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 22 Sep 2010 15:50:40 +0000 (15:50 +0000)
PWG4/GammaConv/AliAnalysisTaskGammaConversion.cxx
PWG4/GammaConv/AliAnalysisTaskGammaConversion.h
PWG4/GammaConv/AliGammaConversionBGHandler.cxx
PWG4/GammaConv/AliGammaConversionBGHandler.h
PWG4/GammaConv/AliV0Reader.cxx
PWG4/GammaConv/AliV0Reader.h
PWG4/PWG4GammaConvLinkDef.h
PWG4/libPWG4GammaConv.pkg
PWG4/macros/ConfigGammaConversion.C

index 8093bd5..c5c76f1 100644 (file)
@@ -121,6 +121,8 @@ AliAnalysisTaskSE(),
   fKFForceAOD(kFALSE),
   fKFDeltaAODFileName(""),
   fDoNeutralMesonV0MCCheck(kFALSE),
+  fUseTrackMultiplicityForBG(kTRUE),
+  fMoveParticleAccordingToVertex(kFALSE),
   fKFReconstructedGammasV0Index()
 {
   // Default constructor
@@ -202,6 +204,8 @@ AliAnalysisTaskGammaConversion::AliAnalysisTaskGammaConversion(const char* name)
   fKFForceAOD(kFALSE),
   fKFDeltaAODFileName(""),
   fDoNeutralMesonV0MCCheck(kFALSE),
+  fUseTrackMultiplicityForBG(kTRUE),
+  fMoveParticleAccordingToVertex(kFALSE),
   fKFReconstructedGammasV0Index()
 {
   // Common I/O in slot 0
@@ -1249,6 +1253,7 @@ void AliAnalysisTaskGammaConversion::ProcessV0s(){
   }
        
   Int_t nSurvivingV0s=0;
+  fV0Reader->ResetNGoodV0s();
   while(fV0Reader->NextV0()){
     nSurvivingV0s++;
                
@@ -1274,14 +1279,27 @@ void AliAnalysisTaskGammaConversion::ProcessV0s(){
     fHistograms->FillHistogram("ESD_E_Phi", fV0Reader->GetNegativeTrackPhi());
     fHistograms->FillHistogram("ESD_E_nTPCClusters", fV0Reader->GetNegativeTracknTPCClusters());
     fHistograms->FillHistogram("ESD_E_nITSClusters", fV0Reader->GetNegativeTracknITSClusters());
-               
+    if(fV0Reader->GetNegativeTracknTPCFClusters()!=0 && fV0Reader->GetNegativeTracknTPCClusters()!=0 ){
+      Double_t EclsToF= (Double_t)fV0Reader->GetNegativeTracknTPCClusters()/(Double_t)fV0Reader->GetNegativeTracknTPCFClusters();
+      fHistograms->FillHistogram("ESD_E_nTPCClustersToFP", fV0Reader->GetNegativeTrackP(),EclsToF );
+      fHistograms->FillHistogram("ESD_E_TPCchi2", fV0Reader->GetNegativeTrackTPCchi2()/(Double_t)fV0Reader->GetNegativeTracknTPCClusters());
+    }
+
+
+
     fHistograms->FillHistogram("ESD_P_Energy", fV0Reader->GetPositiveTrackEnergy());
     fHistograms->FillHistogram("ESD_P_Pt", fV0Reader->GetPositiveTrackPt());
     fHistograms->FillHistogram("ESD_P_Eta", fV0Reader->GetPositiveTrackEta());
     fHistograms->FillHistogram("ESD_P_Phi", fV0Reader->GetPositiveTrackPhi());
     fHistograms->FillHistogram("ESD_P_nTPCClusters", fV0Reader->GetPositiveTracknTPCClusters());
     fHistograms->FillHistogram("ESD_P_nITSClusters", fV0Reader->GetPositiveTracknITSClusters());
-               
+    if(fV0Reader->GetPositiveTracknTPCFClusters()!=0 && (Double_t)fV0Reader->GetPositiveTracknTPCClusters()!=0 ){
+      Double_t PclsToF= (Double_t)fV0Reader->GetPositiveTracknTPCClusters()/(Double_t)fV0Reader->GetPositiveTracknTPCFClusters();
+      fHistograms->FillHistogram("ESD_P_nTPCClustersToFP",fV0Reader->GetPositiveTrackP(), PclsToF);
+      fHistograms->FillHistogram("ESD_P_TPCchi2", fV0Reader->GetPositiveTrackTPCchi2()/(Double_t)fV0Reader->GetPositiveTracknTPCClusters());
+    }
+
+
     fHistograms->FillHistogram("ESD_ConvGamma_Energy", fV0Reader->GetMotherCandidateEnergy());
     fHistograms->FillHistogram("ESD_ConvGamma_Pt", fV0Reader->GetMotherCandidatePt());
     fHistograms->FillHistogram("ESD_ConvGamma_Eta", fV0Reader->GetMotherCandidateEta());
@@ -1743,11 +1761,34 @@ void AliAnalysisTaskGammaConversion::ProcessGammasForOmegaMesonAnalysis(){
   }
 
   if(fCalculateBackground){
+
+    AliGammaConversionBGHandler * bgHandler = fV0Reader->GetBGHandler();
+    
+    Int_t zbin= bgHandler->GetZBinIndex(fV0Reader->GetVertexZ());
+    Int_t mbin = 0;
+    if(fUseTrackMultiplicityForBG == kTRUE){
+      mbin = bgHandler->GetMultiplicityBinIndex(fV0Reader->CountESDTracks());
+    }
+    else{
+      mbin = bgHandler->GetMultiplicityBinIndex(fV0Reader->GetNGoodV0s());
+    }
+    
+    AliGammaConversionBGHandler::GammaConversionVertex *bgEventVertex = NULL;
+
     // Background calculation for the omega
     for(Int_t nEventsInBG=0;nEventsInBG <fV0Reader->GetNBGEvents();nEventsInBG++){
-      AliGammaConversionKFVector * previousEventV0s = fV0Reader->GetBGGoodV0s(nEventsInBG);
+      AliGammaConversionKFVector * previousEventV0s = bgHandler->GetBGGoodV0s(zbin,mbin,nEventsInBG);
+      
+      if(fMoveParticleAccordingToVertex == kTRUE){
+       bgEventVertex = bgHandler->GetBGEventVertex(zbin,mbin,nEventsInBG);
+      }
       for(UInt_t iPrevious=0;iPrevious<previousEventV0s->size();iPrevious++){
        AliKFParticle previousGoodV0 = (AliKFParticle)(*(previousEventV0s->at(iPrevious)));
+
+       if(fMoveParticleAccordingToVertex == kTRUE){
+         MoveParticleAccordingToVertex(&previousGoodV0,bgEventVertex);
+       }
+
        for(Int_t firstPi0Index=0;firstPi0Index<fKFReconstructedPi0sTClone->GetEntriesFast();firstPi0Index++){
          AliKFParticle * omegaCandidatePi0Daughter = (AliKFParticle *)fKFReconstructedPi0sTClone->At(firstPi0Index);
          AliKFParticle * omegaBckCandidate = new AliKFParticle(*omegaCandidatePi0Daughter,previousGoodV0);
@@ -1791,6 +1832,8 @@ void AliAnalysisTaskGammaConversion::ProcessGammasForNeutralMesonAnalysis(){
   //  for(UInt_t firstGammaIndex=0;firstGammaIndex<fKFReconstructedGammas.size();firstGammaIndex++){
   //    for(UInt_t secondGammaIndex=firstGammaIndex+1;secondGammaIndex<fKFReconstructedGammas.size();secondGammaIndex++){
 
+  fESDEvent = fV0Reader->GetESDEvent();
+
   if(fKFReconstructedGammasTClone->GetEntriesFast()>fV0Reader->GetNumberOfV0s()){
     cout<<"Warning, number of entries in the tclone is bigger than number of v0s"<<endl;
   }
@@ -1864,21 +1907,33 @@ void AliAnalysisTaskGammaConversion::ProcessGammasForNeutralMesonAnalysis(){
          }
          fHistograms->FillHistogram("ESD_Mother_InvMass",massTwoGammaCandidate);
 
-         /* Kenneth, just for testing*/
-         AliGammaConversionBGHandler * bgHandlerTest = fV0Reader->GetBGHandler();
-         
-         Int_t zbin= bgHandlerTest->GetZBinIndex(fV0Reader->GetVertexZ());
-         Int_t mbintest= bgHandlerTest->GetMultiplicityBinIndex(fV0Reader->CountESDTracks());
-
-         fHistograms->FillHistogram(Form("%d%dESD_Mother_InvMass",zbin,mbintest),massTwoGammaCandidate);
-
-         /* end Kenneth, just for testing*/
-
          if(fCalculateBackground){
+           /* Kenneth, just for testing*/
+           AliGammaConversionBGHandler * bgHandlerTest = fV0Reader->GetBGHandler();
+           
+           Int_t zbin= bgHandlerTest->GetZBinIndex(fV0Reader->GetVertexZ());
+           Int_t mbin=0;
+           Int_t multKAA=0;
+           if(fUseTrackMultiplicityForBG == kTRUE){
+             multKAA=fV0Reader->CountESDTracks();
+             mbin = bgHandlerTest->GetMultiplicityBinIndex(fV0Reader->CountESDTracks());
+           }
+           else{// means we use #v0s for multiplicity
+             multKAA=fV0Reader->GetNGoodV0s();
+             mbin = bgHandlerTest->GetMultiplicityBinIndex(fV0Reader->GetNGoodV0s());
+           }
+           //      cout<<"Filling bin number "<<zbin<<" and "<<mbin<<endl;
+           //      cout<<"Corresponding to z = "<<fV0Reader->GetVertexZ()<<" and m = "<<multKAA<<endl;
+           fHistograms->FillHistogram(Form("%d%dESD_Mother_InvMass",zbin,mbin),massTwoGammaCandidate);
+           fHistograms->FillHistogram(Form("%d%dESD_Mother_InvMass_vs_Pt",zbin,mbin),massTwoGammaCandidate ,momentumVectorTwoGammaCandidate.Pt());
+           /* end Kenneth, just for testing*/
+           fHistograms->FillHistogram(Form("%dESD_Mother_InvMass_vs_Pt",mbin),massTwoGammaCandidate ,momentumVectorTwoGammaCandidate.Pt());
+         }
+         /*      if(fCalculateBackground){
            AliGammaConversionBGHandler * bgHandler = fV0Reader->GetBGHandler();
            Int_t mbin= bgHandler->GetMultiplicityBinIndex(fV0Reader->CountESDTracks());
            fHistograms->FillHistogram(Form("%dESD_Mother_InvMass_vs_Pt",mbin),massTwoGammaCandidate ,momentumVectorTwoGammaCandidate.Pt());
-         }
+           }*/
          //      if(fDoNeutralMesonV0MCCheck){
          if(fDoMCTruth){
            //Kenneth: Checking the eta of the gamma to check the difference between 0.9 and 1.2
@@ -2132,108 +2187,263 @@ void AliAnalysisTaskGammaConversion::ProcessConvPHOSGammasForNeutralMesonAnalysi
 */
 }
 
+void AliAnalysisTaskGammaConversion::MoveParticleAccordingToVertex(AliKFParticle *particle,AliGammaConversionBGHandler::GammaConversionVertex *vertex){
+  //see header file for documentation
+
+  Double_t dx = vertex->fX - fESDEvent->GetPrimaryVertex()->GetX();
+  Double_t dy = vertex->fY - fESDEvent->GetPrimaryVertex()->GetY();
+  Double_t dz = vertex->fZ - fESDEvent->GetPrimaryVertex()->GetZ();
+  
+  //  cout<<"dx, dy, dz: ["<<dx<<","<<dy<<","<<dz<<"]"<<endl;
+  particle->X() = particle->GetX() - dx;
+  particle->Y() = particle->GetY() - dy;
+  particle->Z() = particle->GetZ() - dz;
+}
+
 void AliAnalysisTaskGammaConversion::CalculateBackground(){
   // see header file for documentation
 
 
   TClonesArray * currentEventV0s = fV0Reader->GetCurrentEventGoodV0s();
 
-  for(Int_t nEventsInBG=0;nEventsInBG <fV0Reader->GetNBGEvents();nEventsInBG++){
-    AliGammaConversionKFVector * previousEventV0s = fV0Reader->GetBGGoodV0s(nEventsInBG);
-    for(Int_t iCurrent=0;iCurrent<currentEventV0s->GetEntriesFast();iCurrent++){
-      AliKFParticle currentEventGoodV0 = *(AliKFParticle *)(currentEventV0s->At(iCurrent)); 
-      for(UInt_t iPrevious=0;iPrevious<previousEventV0s->size();iPrevious++){
-       AliKFParticle previousGoodV0 = (AliKFParticle)(*(previousEventV0s->at(iPrevious)));
+  AliGammaConversionBGHandler * bgHandler = fV0Reader->GetBGHandler();
+  
+  Int_t zbin= bgHandler->GetZBinIndex(fV0Reader->GetVertexZ());
+  Int_t mbin = 0;
+  if(fUseTrackMultiplicityForBG == kTRUE){
+    mbin = bgHandler->GetMultiplicityBinIndex(fV0Reader->CountESDTracks());
+  }
+  else{
+    mbin = bgHandler->GetMultiplicityBinIndex(fV0Reader->GetNGoodV0s());
+  }
+
+  AliGammaConversionBGHandler::GammaConversionVertex *bgEventVertex = NULL;
+           
+  if(fUseTrackMultiplicityForBG){
+    //    cout<<"Using charged track multiplicity for background calculation"<<endl;
+    for(Int_t nEventsInBG=0;nEventsInBG <fV0Reader->GetNBGEvents();nEventsInBG++){
+
+      AliGammaConversionKFVector * previousEventV0s = bgHandler->GetBGGoodV0s(zbin,mbin,nEventsInBG);//fV0Reader->GetBGGoodV0s(nEventsInBG);
+      
+      if(fMoveParticleAccordingToVertex == kTRUE){
+       bgEventVertex = bgHandler->GetBGEventVertex(zbin,mbin,nEventsInBG);
+      }
+
+      for(Int_t iCurrent=0;iCurrent<currentEventV0s->GetEntriesFast();iCurrent++){
+       AliKFParticle currentEventGoodV0 = *(AliKFParticle *)(currentEventV0s->At(iCurrent)); 
+       for(UInt_t iPrevious=0;iPrevious<previousEventV0s->size();iPrevious++){
+         AliKFParticle previousGoodV0 = (AliKFParticle)(*(previousEventV0s->at(iPrevious)));
+         AliKFParticle previousGoodV0test = (AliKFParticle)(*(previousEventV0s->at(iPrevious)));
 
-       AliKFParticle *backgroundCandidate = new AliKFParticle(currentEventGoodV0,previousGoodV0);
+         //cout<<"Primary Vertex event: ["<<fESDEvent->GetPrimaryVertex()->GetX()<<","<<fESDEvent->GetPrimaryVertex()->GetY()<<","<<fESDEvent->GetPrimaryVertex()->GetZ()<<"]"<<endl;
+         //cout<<"BG prim Vertex event: ["<<bgEventVertex->fX<<","<<bgEventVertex->fY<<","<<bgEventVertex->fZ<<"]"<<endl;
+         
+         //cout<<"XYZ of particle before transport: ["<<previousGoodV0.X()<<","<<previousGoodV0.Y()<<","<<previousGoodV0.Z()<<"]"<<endl;
+         if(fMoveParticleAccordingToVertex == kTRUE){
+           MoveParticleAccordingToVertex(&previousGoodV0,bgEventVertex);
+         }
+         //cout<<"XYZ of particle after transport: ["<<previousGoodV0.X()<<","<<previousGoodV0.Y()<<","<<previousGoodV0.Z()<<"]"<<endl;
+
+         AliKFParticle *backgroundCandidate = new AliKFParticle(currentEventGoodV0,previousGoodV0);
        
-       Double_t massBG =0.;
-       Double_t widthBG = 0.;
-       Double_t chi2BG =10000.;        
-       backgroundCandidate->GetMass(massBG,widthBG);
-       //      if(backgroundCandidate->GetNDF()>0){
-       //        chi2BG = backgroundCandidate->GetChi2()/backgroundCandidate->GetNDF();
+         Double_t massBG =0.;
+         Double_t widthBG = 0.;
+         Double_t chi2BG =10000.;      
+         backgroundCandidate->GetMass(massBG,widthBG);
+         //    if(backgroundCandidate->GetNDF()>0){
+         //      chi2BG = backgroundCandidate->GetChi2()/backgroundCandidate->GetNDF();
          chi2BG = backgroundCandidate->GetChi2();
          //      if(chi2BG>0 && chi2BG<fV0Reader->GetChi2CutMeson()){
                                        
-           TVector3 momentumVectorbackgroundCandidate(backgroundCandidate->GetPx(),backgroundCandidate->GetPy(),backgroundCandidate->GetPz());
-           TVector3 spaceVectorbackgroundCandidate(backgroundCandidate->GetX(),backgroundCandidate->GetY(),backgroundCandidate->GetZ());
+         TVector3 momentumVectorbackgroundCandidate(backgroundCandidate->GetPx(),backgroundCandidate->GetPy(),backgroundCandidate->GetPz());
+         TVector3 spaceVectorbackgroundCandidate(backgroundCandidate->GetX(),backgroundCandidate->GetY(),backgroundCandidate->GetZ());
                                        
-           Double_t openingAngleBG = currentEventGoodV0.GetAngle(previousGoodV0);
+         Double_t openingAngleBG = currentEventGoodV0.GetAngle(previousGoodV0);
                                        
-           Double_t rapidity;
+         Double_t rapidity;
            
-           if(backgroundCandidate->GetE() - backgroundCandidate->GetPz() <= 0 || backgroundCandidate->GetE() + backgroundCandidate->GetPz() <= 0){
-                   cout << "Error: |Pz| > E !!!! " << endl;
-                   rapidity=0;
-           } else {
-             rapidity = 0.5*(TMath::Log((backgroundCandidate->GetE() +backgroundCandidate->GetPz()) / (backgroundCandidate->GetE()-backgroundCandidate->GetPz())));
-           }                           
+         if(backgroundCandidate->GetE() - backgroundCandidate->GetPz() <= 0 || backgroundCandidate->GetE() + backgroundCandidate->GetPz() <= 0){
+           cout << "Error: |Pz| > E !!!! " << endl;
+           rapidity=0;
+         } else {
+           rapidity = 0.5*(TMath::Log((backgroundCandidate->GetE() +backgroundCandidate->GetPz()) / (backgroundCandidate->GetE()-backgroundCandidate->GetPz())));
+         }                             
                                        
-           Double_t alfa=0.0;
-           if( (currentEventGoodV0.GetE()+previousGoodV0.GetE()) != 0){
-             alfa=TMath::Abs((currentEventGoodV0.GetE()-previousGoodV0.GetE())
-                             /(currentEventGoodV0.GetE()+previousGoodV0.GetE()));
-           }
+         Double_t alfa=0.0;
+         if( (currentEventGoodV0.GetE()+previousGoodV0.GetE()) != 0){
+           alfa=TMath::Abs((currentEventGoodV0.GetE()-previousGoodV0.GetE())
+                           /(currentEventGoodV0.GetE()+previousGoodV0.GetE()));
+         }
                        
                                        
-           if(openingAngleBG < fMinOpeningAngleGhostCut ){
-             delete backgroundCandidate;   
-             continue;   // minimum opening angle to avoid using ghosttracks
-           }                   
-
-           // original
-           fHistograms->FillHistogram("ESD_Background_GammaDaughter_OpeningAngle", openingAngleBG);
-           fHistograms->FillHistogram("ESD_Background_Energy", backgroundCandidate->GetE());
-           fHistograms->FillHistogram("ESD_Background_Pt",  momentumVectorbackgroundCandidate.Pt());
-           fHistograms->FillHistogram("ESD_Background_Eta", momentumVectorbackgroundCandidate.Eta());
-           fHistograms->FillHistogram("ESD_Background_Rapidity", rapidity);
-           fHistograms->FillHistogram("ESD_Background_Phi", spaceVectorbackgroundCandidate.Phi());
-           fHistograms->FillHistogram("ESD_Background_Mass", massBG);
-           fHistograms->FillHistogram("ESD_Background_R", spaceVectorbackgroundCandidate.Pt());  // Pt in Space == R!!!!
-           fHistograms->FillHistogram("ESD_Background_ZR", backgroundCandidate->GetZ(), spaceVectorbackgroundCandidate.Pt());
-           fHistograms->FillHistogram("ESD_Background_XY", backgroundCandidate->GetX(), backgroundCandidate->GetY());
-           fHistograms->FillHistogram("ESD_Background_InvMass_vs_Pt",massBG,momentumVectorbackgroundCandidate.Pt());
-           fHistograms->FillHistogram("ESD_Background_InvMass",massBG);
-
-           if(alfa>fV0Reader->GetAlphaMinCutMeson() &&   alfa<fV0Reader->GetAlphaCutMeson()){
-             fHistograms->FillHistogram("ESD_Background_InvMass_vs_Pt_alpha",massBG,momentumVectorbackgroundCandidate.Pt());
-           }
-           if ( TMath::Abs(currentEventGoodV0.GetEta())<0.9 &&  TMath::Abs(previousGoodV0.GetEta())<0.9 ){
-             fHistograms->FillHistogram("ESD_Background_InvMass_vs_Pt_Fiducial",massBG,momentumVectorbackgroundCandidate.Pt());
-             fHistograms->FillHistogram("ESD_Background_InvMass_Fiducial",massBG);
-           }
+         if(openingAngleBG < fMinOpeningAngleGhostCut ){
+           delete backgroundCandidate;   
+           continue;   // minimum opening angle to avoid using ghosttracks
+         }                     
+
+         // original
+         fHistograms->FillHistogram("ESD_Background_GammaDaughter_OpeningAngle", openingAngleBG);
+         fHistograms->FillHistogram("ESD_Background_Energy", backgroundCandidate->GetE());
+         fHistograms->FillHistogram("ESD_Background_Pt",  momentumVectorbackgroundCandidate.Pt());
+         fHistograms->FillHistogram("ESD_Background_Eta", momentumVectorbackgroundCandidate.Eta());
+         fHistograms->FillHistogram("ESD_Background_Rapidity", rapidity);
+         fHistograms->FillHistogram("ESD_Background_Phi", spaceVectorbackgroundCandidate.Phi());
+         fHistograms->FillHistogram("ESD_Background_Mass", massBG);
+         fHistograms->FillHistogram("ESD_Background_R", spaceVectorbackgroundCandidate.Pt());  // Pt in Space == R!!!!
+         fHistograms->FillHistogram("ESD_Background_ZR", backgroundCandidate->GetZ(), spaceVectorbackgroundCandidate.Pt());
+         fHistograms->FillHistogram("ESD_Background_XY", backgroundCandidate->GetX(), backgroundCandidate->GetY());
+         fHistograms->FillHistogram("ESD_Background_InvMass_vs_Pt",massBG,momentumVectorbackgroundCandidate.Pt());
+         fHistograms->FillHistogram("ESD_Background_InvMass",massBG);
+
+         if(alfa>fV0Reader->GetAlphaMinCutMeson() &&   alfa<fV0Reader->GetAlphaCutMeson()){
+           fHistograms->FillHistogram("ESD_Background_InvMass_vs_Pt_alpha",massBG,momentumVectorbackgroundCandidate.Pt());
+         }
+         if ( TMath::Abs(currentEventGoodV0.GetEta())<0.9 &&  TMath::Abs(previousGoodV0.GetEta())<0.9 ){
+           fHistograms->FillHistogram("ESD_Background_InvMass_vs_Pt_Fiducial",massBG,momentumVectorbackgroundCandidate.Pt());
+           fHistograms->FillHistogram("ESD_Background_InvMass_Fiducial",massBG);
+         }
            
            
-           // test
-           AliGammaConversionBGHandler * bgHandler = fV0Reader->GetBGHandler();
+         // test
+         fHistograms->FillHistogram(Form("%d%dESD_Background_GammaDaughter_OpeningAngle",zbin,mbin), openingAngleBG);
+         fHistograms->FillHistogram(Form("%d%dESD_Background_Energy",zbin,mbin), backgroundCandidate->GetE());
+         fHistograms->FillHistogram(Form("%d%dESD_Background_Pt",zbin,mbin),  momentumVectorbackgroundCandidate.Pt());
+         fHistograms->FillHistogram(Form("%d%dESD_Background_Eta",zbin,mbin), momentumVectorbackgroundCandidate.Eta());
+         fHistograms->FillHistogram(Form("%d%dESD_Background_Rapidity",zbin,mbin), rapidity);
+         fHistograms->FillHistogram(Form("%d%dESD_Background_Phi",zbin,mbin), spaceVectorbackgroundCandidate.Phi());
+         fHistograms->FillHistogram(Form("%d%dESD_Background_Mass",zbin,mbin), massBG);
+         fHistograms->FillHistogram(Form("%d%dESD_Background_R",zbin,mbin), spaceVectorbackgroundCandidate.Pt());  // Pt in Space == R!!!!
+         fHistograms->FillHistogram(Form("%d%dESD_Background_ZR",zbin,mbin), backgroundCandidate->GetZ(), spaceVectorbackgroundCandidate.Pt());
+         fHistograms->FillHistogram(Form("%d%dESD_Background_XY",zbin,mbin), backgroundCandidate->GetX(), backgroundCandidate->GetY());
+         fHistograms->FillHistogram(Form("%d%dESD_Background_InvMass_vs_Pt",zbin,mbin),massBG,momentumVectorbackgroundCandidate.Pt());
+         fHistograms->FillHistogram(Form("%d%dESD_Background_InvMass",zbin,mbin),massBG);
+
+         if ( TMath::Abs(currentEventGoodV0.GetEta())<0.9 &&  TMath::Abs(previousGoodV0.GetEta())<0.9 ){
+           fHistograms->FillHistogram(Form("%d%dESD_Background_InvMass_vs_Pt_Fiducial",zbin,mbin),massBG,momentumVectorbackgroundCandidate.Pt());
+           fHistograms->FillHistogram(Form("%d%dESD_Background_InvMass_Fiducial",zbin,mbin),massBG);
+         }
+         //      }
+         //    }
+         delete backgroundCandidate;      
+       }
+      }
+    }
+  }
+  else{ // means using #V0s for multiplicity
 
-           Int_t zbin= bgHandler->GetZBinIndex(fV0Reader->GetVertexZ());
-           Int_t mbin= bgHandler->GetMultiplicityBinIndex(fV0Reader->CountESDTracks());
+    //    cout<<"Using the v0 multiplicity to calculate background"<<endl;
+    
+    fHistograms->FillHistogram("ESD_Background_z_m",zbin,mbin);
+    fHistograms->FillHistogram("ESD_Mother_multpilicityVSv0s",fV0Reader->CountESDTracks(),fV0Reader->GetNumberOfV0s());
+
+    for(Int_t nEventsInBG=0;nEventsInBG <fV0Reader->GetNBGEvents();nEventsInBG++){
+      AliGammaConversionKFVector * previousEventV0s = bgHandler->GetBGGoodV0s(zbin,mbin,nEventsInBG);// fV0Reader->GetBGGoodV0s(nEventsInBG);
+      if(previousEventV0s){
+       
+       if(fMoveParticleAccordingToVertex == kTRUE){
+         bgEventVertex = bgHandler->GetBGEventVertex(zbin,mbin,nEventsInBG);
+       }
+
+       for(Int_t iCurrent=0;iCurrent<currentEventV0s->GetEntriesFast();iCurrent++){
+         AliKFParticle currentEventGoodV0 = *(AliKFParticle *)(currentEventV0s->At(iCurrent)); 
+         for(UInt_t iPrevious=0;iPrevious<previousEventV0s->size();iPrevious++){
+           AliKFParticle previousGoodV0 = (AliKFParticle)(*(previousEventV0s->at(iPrevious)));
+
+           if(fMoveParticleAccordingToVertex == kTRUE){
+             MoveParticleAccordingToVertex(&previousGoodV0,bgEventVertex);
+           }
+
+           AliKFParticle *backgroundCandidate = new AliKFParticle(currentEventGoodV0,previousGoodV0);
+           Double_t massBG =0.;
+           Double_t widthBG = 0.;
+           Double_t chi2BG =10000.;    
+           backgroundCandidate->GetMass(massBG,widthBG);
+           if(backgroundCandidate->GetNDF()>0){
+             chi2BG = backgroundCandidate->GetChi2()/backgroundCandidate->GetNDF();
+             {//remember to remove
+               TVector3 momentumVectorbackgroundCandidate(backgroundCandidate->GetPx(),backgroundCandidate->GetPy(),backgroundCandidate->GetPz());
+               TVector3 spaceVectorbackgroundCandidate(backgroundCandidate->GetX(),backgroundCandidate->GetY(),backgroundCandidate->GetZ());
+             
+               Double_t openingAngleBG = currentEventGoodV0.GetAngle(previousGoodV0);
+               fHistograms->FillHistogram("ESD_Background_GammaDaughter_OpeningAngle_nochi2", openingAngleBG);
+             }
+             if(chi2BG>0 && chi2BG<fV0Reader->GetChi2CutMeson()){
+               TVector3 momentumVectorbackgroundCandidate(backgroundCandidate->GetPx(),backgroundCandidate->GetPy(),backgroundCandidate->GetPz());
+               TVector3 spaceVectorbackgroundCandidate(backgroundCandidate->GetX(),backgroundCandidate->GetY(),backgroundCandidate->GetZ());
+                                       
+               Double_t openingAngleBG = currentEventGoodV0.GetAngle(previousGoodV0);
+                                       
+               Double_t rapidity;
+               if(backgroundCandidate->GetE() - backgroundCandidate->GetPz() == 0 || backgroundCandidate->GetE() + backgroundCandidate->GetPz() == 0) rapidity=0;
+               else rapidity = 0.5*(TMath::Log((backgroundCandidate->GetE() +backgroundCandidate->GetPz()) / (backgroundCandidate->GetE()-backgroundCandidate->GetPz())));
+                                       
+                                       
+               Double_t alfa=0.0;
+               if( (currentEventGoodV0.GetE()+previousGoodV0.GetE()) != 0){
+                 alfa=TMath::Abs((currentEventGoodV0.GetE()-previousGoodV0.GetE())
+                                 /(currentEventGoodV0.GetE()+previousGoodV0.GetE()));
+               }
+                       
+                                       
+               if(openingAngleBG < fMinOpeningAngleGhostCut ){
+                 delete backgroundCandidate;   
+                 continue;   // minimum opening angle to avoid using ghosttracks
+               }                       
+
+               fHistograms->FillHistogram("ESD_Background_GammaDaughter_OpeningAngle", openingAngleBG);
+               fHistograms->FillHistogram("ESD_Background_Energy", backgroundCandidate->GetE());
+               fHistograms->FillHistogram("ESD_Background_Pt",  momentumVectorbackgroundCandidate.Pt());
+               fHistograms->FillHistogram("ESD_Background_Eta", momentumVectorbackgroundCandidate.Eta());
+               fHistograms->FillHistogram("ESD_Background_Rapidity", rapidity);
+               fHistograms->FillHistogram("ESD_Background_Phi", spaceVectorbackgroundCandidate.Phi());
+               fHistograms->FillHistogram("ESD_Background_Mass", massBG);
+               fHistograms->FillHistogram("ESD_Background_R", spaceVectorbackgroundCandidate.Pt());  // Pt in Space == R!!!!
+               fHistograms->FillHistogram("ESD_Background_ZR", backgroundCandidate->GetZ(), spaceVectorbackgroundCandidate.Pt());
+               fHistograms->FillHistogram("ESD_Background_XY", backgroundCandidate->GetX(), backgroundCandidate->GetY());
+               fHistograms->FillHistogram("ESD_Background_InvMass_vs_Pt",massBG,momentumVectorbackgroundCandidate.Pt());
+               fHistograms->FillHistogram("ESD_Background_InvMass",massBG);
+
+               if(alfa>fV0Reader->GetAlphaMinCutMeson() &&   alfa<fV0Reader->GetAlphaCutMeson()){
+                 fHistograms->FillHistogram("ESD_Background_InvMass_vs_Pt_alpha",massBG,momentumVectorbackgroundCandidate.Pt());
+               }
+               if ( TMath::Abs(currentEventGoodV0.GetEta())<0.9 &&  TMath::Abs(previousGoodV0.GetEta())<0.9 ){
+                 fHistograms->FillHistogram("ESD_Background_InvMass_vs_Pt_Fiducial",massBG,momentumVectorbackgroundCandidate.Pt());
+                 fHistograms->FillHistogram("ESD_Background_InvMass_Fiducial",massBG);
+               }
+           
+               if(massBG>0.5 && massBG<0.6){
+                 fHistograms->FillHistogram("ESD_Background_alfa_pt0506",momentumVectorbackgroundCandidate.Pt(),alfa);
+               }
+               if(massBG>0.3 && massBG<0.4){
+                 fHistograms->FillHistogram("ESD_Background_alfa_pt0304",momentumVectorbackgroundCandidate.Pt(),alfa);
+               }
            
-           fHistograms->FillHistogram(Form("%d%dESD_Background_GammaDaughter_OpeningAngle",zbin,mbin), openingAngleBG);
-           fHistograms->FillHistogram(Form("%d%dESD_Background_Energy",zbin,mbin), backgroundCandidate->GetE());
-           fHistograms->FillHistogram(Form("%d%dESD_Background_Pt",zbin,mbin),  momentumVectorbackgroundCandidate.Pt());
-           fHistograms->FillHistogram(Form("%d%dESD_Background_Eta",zbin,mbin), momentumVectorbackgroundCandidate.Eta());
-           fHistograms->FillHistogram(Form("%d%dESD_Background_Rapidity",zbin,mbin), rapidity);
-           fHistograms->FillHistogram(Form("%d%dESD_Background_Phi",zbin,mbin), spaceVectorbackgroundCandidate.Phi());
-           fHistograms->FillHistogram(Form("%d%dESD_Background_Mass",zbin,mbin), massBG);
-           fHistograms->FillHistogram(Form("%d%dESD_Background_R",zbin,mbin), spaceVectorbackgroundCandidate.Pt());  // Pt in Space == R!!!!
-           fHistograms->FillHistogram(Form("%d%dESD_Background_ZR",zbin,mbin), backgroundCandidate->GetZ(), spaceVectorbackgroundCandidate.Pt());
-           fHistograms->FillHistogram(Form("%d%dESD_Background_XY",zbin,mbin), backgroundCandidate->GetX(), backgroundCandidate->GetY());
-           fHistograms->FillHistogram(Form("%d%dESD_Background_InvMass_vs_Pt",zbin,mbin),massBG,momentumVectorbackgroundCandidate.Pt());
-           fHistograms->FillHistogram(Form("%d%dESD_Background_InvMass",zbin,mbin),massBG);
-
-           if ( TMath::Abs(currentEventGoodV0.GetEta())<0.9 &&  TMath::Abs(previousGoodV0.GetEta())<0.9 ){
-             fHistograms->FillHistogram(Form("%d%dESD_Background_InvMass_vs_Pt_Fiducial",zbin,mbin),massBG,momentumVectorbackgroundCandidate.Pt());
-             fHistograms->FillHistogram(Form("%d%dESD_Background_InvMass_Fiducial",zbin,mbin),massBG);
+               // test
+               fHistograms->FillHistogram(Form("%d%dESD_Background_GammaDaughter_OpeningAngle",zbin,mbin), openingAngleBG);
+               fHistograms->FillHistogram(Form("%d%dESD_Background_Energy",zbin,mbin), backgroundCandidate->GetE());
+               fHistograms->FillHistogram(Form("%d%dESD_Background_Pt",zbin,mbin),  momentumVectorbackgroundCandidate.Pt());
+               fHistograms->FillHistogram(Form("%d%dESD_Background_Eta",zbin,mbin), momentumVectorbackgroundCandidate.Eta());
+               fHistograms->FillHistogram(Form("%d%dESD_Background_Rapidity",zbin,mbin), rapidity);
+               fHistograms->FillHistogram(Form("%d%dESD_Background_Phi",zbin,mbin), spaceVectorbackgroundCandidate.Phi());
+               fHistograms->FillHistogram(Form("%d%dESD_Background_Mass",zbin,mbin), massBG);
+               fHistograms->FillHistogram(Form("%d%dESD_Background_R",zbin,mbin), spaceVectorbackgroundCandidate.Pt());  // Pt in Space == R!!!!
+               fHistograms->FillHistogram(Form("%d%dESD_Background_ZR",zbin,mbin), backgroundCandidate->GetZ(), spaceVectorbackgroundCandidate.Pt());
+               fHistograms->FillHistogram(Form("%d%dESD_Background_XY",zbin,mbin), backgroundCandidate->GetX(), backgroundCandidate->GetY());
+               fHistograms->FillHistogram(Form("%d%dESD_Background_InvMass_vs_Pt",zbin,mbin),massBG,momentumVectorbackgroundCandidate.Pt());
+               fHistograms->FillHistogram(Form("%d%dESD_Background_InvMass",zbin,mbin),massBG);
+
+               if ( TMath::Abs(currentEventGoodV0.GetEta())<0.9 &&  TMath::Abs(previousGoodV0.GetEta())<0.9 ){
+                 fHistograms->FillHistogram(Form("%d%dESD_Background_InvMass_vs_Pt_Fiducial",zbin,mbin),massBG,momentumVectorbackgroundCandidate.Pt());
+                 fHistograms->FillHistogram(Form("%d%dESD_Background_InvMass_Fiducial",zbin,mbin),massBG);
+               }
+             }
            }
-           //    }
-           //  }
-       delete backgroundCandidate;      
+           delete backgroundCandidate;      
+         }
+       }
       }
     }
-  }
+  } // end else (means use #v0s as multiplicity)
 }
 
 
index f9f5e0f..f7ee880 100644 (file)
@@ -13,6 +13,7 @@
 #include "AliAnalysisTaskSE.h"
 #include <vector>
 #include "AliV0Reader.h"
+#include "AliGammaConversionBGHandler.h"
 //#include "AliCFManager.h"  // for CF
 //#include "AliCFContainer.h"   // for CF
 
@@ -129,7 +130,13 @@ class AliAnalysisTaskGammaConversion : public AliAnalysisTaskSE
   ///////////////////////////////////////////////////////////////
 
   void SetDoCF(Bool_t flag){fDoCF = flag;}
-               
+
+  void SetUseChargedTracksMultiplicityForBG(Bool_t flag){fUseTrackMultiplicityForBG = flag;}           
+
+  void SetMoveParticleAccordingToVertex(Bool_t flag){fMoveParticleAccordingToVertex = flag;}
+
+  void MoveParticleAccordingToVertex(AliKFParticle *particle,AliGammaConversionBGHandler::GammaConversionVertex *vertex);
+
  private:
   AliAnalysisTaskGammaConversion(const AliAnalysisTaskGammaConversion&); // Not implemented
   AliAnalysisTaskGammaConversion& operator=(const AliAnalysisTaskGammaConversion&); // Not implemented
@@ -256,10 +263,12 @@ class AliAnalysisTaskGammaConversion : public AliAnalysisTaskSE
   Bool_t fKFForceAOD;  //Set the Analysis Manager FillAOD variable to true every event
   TString fKFDeltaAODFileName; //! File name for delta AOD (if any)
   Bool_t fDoNeutralMesonV0MCCheck; //flag
+  Bool_t fUseTrackMultiplicityForBG;
+  Bool_t fMoveParticleAccordingToVertex;
 
   vector<Int_t>fKFReconstructedGammasV0Index; // index of the reconstructed v0s
 
-  ClassDef(AliAnalysisTaskGammaConversion, 9); // Analysis task for gamma conversions
+  ClassDef(AliAnalysisTaskGammaConversion, 10); // Analysis task for gamma conversions
 };
 
 #endif //ALIANALYSISTASKGAMMA_H
index e12c100..7833b95 100644 (file)
@@ -32,6 +32,7 @@ AliGammaConversionBGHandler::AliGammaConversionBGHandler() :
   fNEvents(10),
   fBGEventCounter(NULL),
   fBGEventENegCounter(NULL),
+  fBGEventVertex(NULL),
   fNBinsZ(0),
   fNBinsMultiplicity(0),
   fBinLimitsArrayZ(NULL),
@@ -47,6 +48,7 @@ AliGammaConversionBGHandler::AliGammaConversionBGHandler(UInt_t binsZ,UInt_t bin
   fNEvents(nEvents),
   fBGEventCounter(NULL),
   fBGEventENegCounter(NULL),
+  fBGEventVertex(NULL),
   fNBinsZ(binsZ),
   fNBinsMultiplicity(binsMultiplicity),
   fBinLimitsArrayZ(NULL),
@@ -62,6 +64,7 @@ AliGammaConversionBGHandler::AliGammaConversionBGHandler(const AliGammaConversio
   fNEvents(original.fNEvents),
   fBGEventCounter(original.fBGEventCounter),
   fBGEventENegCounter(original.fBGEventENegCounter),
+  fBGEventVertex(original.fBGEventVertex),
   fNBinsZ(original.fNBinsZ),
   fNBinsMultiplicity(original.fNBinsMultiplicity),
   fBinLimitsArrayZ(original.fBinLimitsArrayZ),
@@ -88,6 +91,17 @@ AliGammaConversionBGHandler::~AliGammaConversionBGHandler(){
     delete[] fBGEventCounter;
     fBGEventCounter = NULL;
   }
+
+  if(fBGEventVertex){
+    for(Int_t z=0;z<fNBinsZ;z++){
+      for(Int_t m=0;m<fNBinsMultiplicity;m++){
+       delete [] fBGEventVertex[z][m];
+      }
+      delete [] fBGEventVertex[z];
+    }
+    delete [] fBGEventVertex;
+  }
+
    if(fBGEventENegCounter){
     for(Int_t z=0;z<fNBinsZ;z++){
       delete[] fBGEventENegCounter[z];
@@ -134,6 +148,17 @@ void AliGammaConversionBGHandler::Initialize(Double_t * const zBinLimitsArray, D
     }
   }
 
+  if(fBGEventVertex == NULL){
+    fBGEventVertex = new GammaConversionVertex**[fNBinsZ];
+  }
+  for(Int_t z=0; z < fNBinsZ; z++){
+    fBGEventVertex[z]= new GammaConversionVertex*[fNBinsMultiplicity];
+  }
+  for(Int_t z=0;z<fNBinsZ;z++){
+    for(Int_t m=0;m<fNBinsMultiplicity; m++){
+      fBGEventVertex[z][m]= new GammaConversionVertex[fNEvents];
+    }
+  }
   if( fBGEventENegCounter == NULL){
     fBGEventENegCounter = new Int_t*[fNBinsZ];
   }
@@ -169,14 +194,14 @@ Int_t AliGammaConversionBGHandler::GetMultiplicityBinIndex(Int_t multiplicity) c
   }
 
   for(Int_t i=0; i<fNBinsMultiplicity-1 ;i++){
-    if(multiplicity > fBinLimitsArrayMultiplicity[i] && multiplicity < fBinLimitsArrayMultiplicity[i+1]){
+    if(multiplicity >= fBinLimitsArrayMultiplicity[i] && multiplicity < fBinLimitsArrayMultiplicity[i+1]){
       return i;
     }
   }
   return fNBinsMultiplicity-1;
 }
 
-void AliGammaConversionBGHandler::AddEvent(TClonesArray * const eventGammas, Double_t zvalue, Int_t multiplicity){
+void AliGammaConversionBGHandler::AddEvent(TClonesArray * const eventGammas,Double_t xvalue, Double_t yvalue, Double_t zvalue, Int_t multiplicity){
   // see header file for documantation  
 
   //  cout<<"Entering the AddEvent function"<<endl;
@@ -189,6 +214,15 @@ void AliGammaConversionBGHandler::AddEvent(TClonesArray * const eventGammas, Dou
   }
   Int_t eventCounter=fBGEventCounter[z][m];
   
+  /*
+  if(fBGEventVertex[z][m][eventCounter]){
+    delete fBGEventVertex[z][m][eventCounter];
+  }
+  */
+  fBGEventVertex[z][m][eventCounter].fX = xvalue;
+  fBGEventVertex[z][m][eventCounter].fY = yvalue;
+  fBGEventVertex[z][m][eventCounter].fZ = zvalue;
+
   //first clear the vector
   // cout<<"Size of vector: "<<fBGEvents[z][m][eventCounter].size()<<endl;
   //  cout<<"Checking the entries: Z="<<z<<", M="<<m<<", eventCounter="<<eventCounter<<endl;
@@ -198,7 +232,7 @@ void AliGammaConversionBGHandler::AddEvent(TClonesArray * const eventGammas, Dou
     delete (AliKFParticle*)(fBGEvents[z][m][eventCounter][d]);
   }
   fBGEvents[z][m][eventCounter].clear();
-
+  
   // add the gammas to the vector
   for(Int_t i=0; i< eventGammas->GetEntriesFast();i++){
     //    AliKFParticle *t = new AliKFParticle(*(AliKFParticle*)(eventGammas->At(i)));
@@ -239,12 +273,9 @@ void AliGammaConversionBGHandler::AddElectronEvent(TClonesArray* const eventENeg
 
 
 }
-AliGammaConversionKFVector* AliGammaConversionBGHandler::GetBGGoodV0s(Int_t event, Double_t zvalue, Int_t multiplicity){
+AliGammaConversionKFVector* AliGammaConversionBGHandler::GetBGGoodV0s(Int_t zbin, Int_t mbin, Int_t event){
   //see headerfile for documentation
-  Int_t z = GetZBinIndex(zvalue);
-  Int_t m = GetMultiplicityBinIndex(multiplicity);
-
-  return &(fBGEvents[z][m][event]);
+  return &(fBGEvents[zbin][mbin][event]);
 }
 AliGammaConversionKFVector* AliGammaConversionBGHandler::GetBGGoodENeg(Int_t event, Double_t zvalue, Int_t multiplicity){
 
index b25c296..c14e5f4 100644 (file)
@@ -17,6 +17,7 @@
 #include <TObject.h> 
 #include "AliKFParticle.h"
 #include "TClonesArray.h"
+#include "AliESDVertex.h"
 
 #if __GNUC__ >= 3
 using namespace std;
@@ -27,7 +28,14 @@ typedef vector<AliKFParticle*> AliGammaConversionKFVector;
 class AliGammaConversionBGHandler : public TObject {
 
  public: 
-  
+  struct GammaConversionVertex
+  {
+    Double_t fX;
+    Double_t fY;
+    Double_t fZ;
+  };
+  typedef struct GammaConversionVertex GammaConversionVertex; //!
+
   typedef vector<AliGammaConversionKFVector> AliGammaConversionBGEventVector;
   typedef vector<AliGammaConversionBGEventVector> AliGammaConversionMultipicityVector;
   typedef vector<AliGammaConversionMultipicityVector> AliGammaConversionBGVector;
@@ -44,26 +52,29 @@ class AliGammaConversionBGHandler : public TObject {
 
   Int_t GetMultiplicityBinIndex(Int_t mult) const;
 
-  void AddEvent(TClonesArray * const eventGammas, Double_t zvalue, Int_t multiplicity);
+  void AddEvent(TClonesArray * const eventGammas, Double_t xvalue,Double_t yvalue,Double_t zvalue, Int_t multiplicity);
   void AddElectronEvent(TClonesArray* const eventENeg, Double_t zvalue, Int_t multiplicity);
 
   Int_t GetNBGEvents()const {return fNEvents;}
 
-  AliGammaConversionKFVector* GetBGGoodV0s(Int_t event, Double_t zvalue, Int_t multiplicity);
+  AliGammaConversionKFVector* GetBGGoodV0s(Int_t zbin, Int_t mbin, Int_t event);
   AliGammaConversionKFVector* GetBGGoodENeg(Int_t event, Double_t zvalue, Int_t multiplicity);
   void PrintBGArray();
 
+  GammaConversionVertex * GetBGEventVertex(Int_t zbin, Int_t mbin, Int_t event){return &fBGEventVertex[zbin][mbin][event];}
+
  private:
 
   Int_t fNEvents; // number of events
   Int_t ** fBGEventCounter; // bg counter
   Int_t ** fBGEventENegCounter;//bg electron counter
+  GammaConversionVertex *** fBGEventVertex;//array of event vertex
   Int_t fNBinsZ; //n z bins
   Int_t fNBinsMultiplicity; //n bins multiplicity
   Double_t *fBinLimitsArrayZ; //bin limits z array
   Double_t *fBinLimitsArrayMultiplicity; //bin limit multiplicity array
   AliGammaConversionBGVector fBGEvents; //gackground events
   AliGammaConversionBGVector fBGEventsENeg; //background electron events
-  ClassDef(AliGammaConversionBGHandler,0)
+  ClassDef(AliGammaConversionBGHandler,1)
 };
 #endif
index 4334e02..5aa50d1 100644 (file)
@@ -121,6 +121,7 @@ AliV0Reader::AliV0Reader() :
   fNSigmaMass(0.),
   fUseImprovedVertex(kFALSE),
   fUseOwnXYZCalculation(kFALSE),
+  fUseConstructGamma(kFALSE),
   fDoCF(kFALSE),
   fUseOnFlyV0Finder(kTRUE),
   fUpdateV0AlreadyCalled(kFALSE),
@@ -133,7 +134,9 @@ AliV0Reader::AliV0Reader() :
   fBGEventInitialized(kFALSE),
   fEsdTrackCuts(NULL),
   fNumberOfESDTracks(0),
-  nEventsForBGCalculation(10)
+  nEventsForBGCalculation(20),
+  fUseChargedTrackMultiplicityForBG(kTRUE),
+  fNumberOfGoodV0s(0)
 {
   //fESDpid = new AliESDpid;   
 }
@@ -211,6 +214,7 @@ AliV0Reader::AliV0Reader(const AliV0Reader & original) :
   fNSigmaMass(original.fNSigmaMass),
   fUseImprovedVertex(original.fUseImprovedVertex),
   fUseOwnXYZCalculation(original.fUseOwnXYZCalculation),
+  fUseConstructGamma(original.fUseConstructGamma),
   fDoCF(original.fDoCF),
   fUseOnFlyV0Finder(original.fUseOnFlyV0Finder),
   fUpdateV0AlreadyCalled(original.fUpdateV0AlreadyCalled),
@@ -223,7 +227,9 @@ AliV0Reader::AliV0Reader(const AliV0Reader & original) :
   fBGEventInitialized(original.fBGEventInitialized),
   fEsdTrackCuts(original.fEsdTrackCuts),
   fNumberOfESDTracks(original.fNumberOfESDTracks),
-  nEventsForBGCalculation(original.nEventsForBGCalculation)
+  nEventsForBGCalculation(original.nEventsForBGCalculation),
+  fUseChargedTrackMultiplicityForBG(original.fUseChargedTrackMultiplicityForBG),
+  fNumberOfGoodV0s(original.fNumberOfGoodV0s)
 {
        
 }
@@ -338,25 +344,37 @@ void AliV0Reader::Initialize(){
       
       Double_t *zBinLimitsArray = new Double_t[9];
       zBinLimitsArray[0] = -50.00;
-      zBinLimitsArray[1] = -4.07;
-      zBinLimitsArray[2] = -2.17;
-      zBinLimitsArray[3] = -0.69;
-      zBinLimitsArray[4] = 0.69;
-      zBinLimitsArray[5] = 2.17;
-      zBinLimitsArray[6] = 4.11;
+      zBinLimitsArray[1] = -3.375;
+      zBinLimitsArray[2] = -1.605;
+      zBinLimitsArray[3] = -0.225;
+      zBinLimitsArray[4] = 1.065;
+      zBinLimitsArray[5] = 2.445;
+      zBinLimitsArray[6] = 4.245;
       zBinLimitsArray[7] = 50.00;
       zBinLimitsArray[8] = 1000.00;
       
-      
       Double_t *multiplicityBinLimitsArray= new Double_t[6];
-      multiplicityBinLimitsArray[0] = 0;
-      multiplicityBinLimitsArray[1] = 8.5;
-      multiplicityBinLimitsArray[2] = 16.5;
-      multiplicityBinLimitsArray[3] = 27.5;
-      multiplicityBinLimitsArray[4] = 41.5;
-      multiplicityBinLimitsArray[5] = 100.;
-          
-      fBGEventHandler = new AliGammaConversionBGHandler(9,6,nEventsForBGCalculation);
+      if(fUseChargedTrackMultiplicityForBG == kTRUE){
+       multiplicityBinLimitsArray[0] = 0;
+       multiplicityBinLimitsArray[1] = 8.5;
+       multiplicityBinLimitsArray[2] = 16.5;
+       multiplicityBinLimitsArray[3] = 27.5;
+       multiplicityBinLimitsArray[4] = 41.5;
+       multiplicityBinLimitsArray[5] = 100.;
+
+       fBGEventHandler = new AliGammaConversionBGHandler(9,6,nEventsForBGCalculation);
+      }
+      else{
+       multiplicityBinLimitsArray[0] = 2;
+       multiplicityBinLimitsArray[1] = 3;
+       multiplicityBinLimitsArray[2] = 4;
+       multiplicityBinLimitsArray[3] = 5;
+       multiplicityBinLimitsArray[4] = 9999;
+
+       fBGEventHandler = new AliGammaConversionBGHandler(9,5,nEventsForBGCalculation);
+      }
+
+
       
       /*
       // ---------------------------------
@@ -886,6 +904,8 @@ Bool_t AliV0Reader::NextV0(){
 
     iResult=kTRUE;//means we have a v0 who survived all the cuts applied
                
+    fNumberOfGoodV0s++;
+
     fCurrentV0IndexNumber++;
                
     break;
@@ -932,13 +952,16 @@ Bool_t AliV0Reader::UpdateV0Information(){
   if(fCurrentMotherKFCandidate != NULL){
     delete fCurrentMotherKFCandidate;
   }
-  fCurrentMotherKFCandidate = new AliKFParticle(*fCurrentNegativeKFParticle,*fCurrentPositiveKFParticle);
-       
-       
-  if(fPositiveTrackPID==-11 && fNegativeTrackPID==11){
-    fCurrentMotherKFCandidate->SetMassConstraint(0,fNSigmaMass);
+
+  if(fUseConstructGamma==kTRUE){
+    fCurrentMotherKFCandidate = new AliKFParticle;//(*fCurrentNegativeKFParticle,*fCurrentPositiveKFParticle);
+    fCurrentMotherKFCandidate->ConstructGamma(*fCurrentNegativeKFParticle,*fCurrentPositiveKFParticle);
+  }else{
+    fCurrentMotherKFCandidate = new AliKFParticle(*fCurrentNegativeKFParticle,*fCurrentPositiveKFParticle);
+    if(fPositiveTrackPID==-11 && fNegativeTrackPID==11){
+      fCurrentMotherKFCandidate->SetMassConstraint(0,fNSigmaMass);
+    }
   }
-       
   if(fUseImprovedVertex == kTRUE){
     AliKFVertex primaryVertexImproved(*GetPrimaryVertex());
     primaryVertexImproved+=*fCurrentMotherKFCandidate;
@@ -1006,7 +1029,13 @@ Bool_t AliV0Reader::UpdateV0Information(){
   
 
   if(fUseOwnXYZCalculation == kFALSE){
-    fCurrentV0->GetXYZ(fCurrentXValue,fCurrentYValue,fCurrentZValue);
+    if(fUseConstructGamma == kFALSE){
+      fCurrentV0->GetXYZ(fCurrentXValue,fCurrentYValue,fCurrentZValue);
+    }else{
+      fCurrentXValue=GetMotherCandidateKFCombination()->GetX();
+      fCurrentYValue=GetMotherCandidateKFCombination()->GetY();
+      fCurrentZValue=GetMotherCandidateKFCombination()->GetZ();
+    }
   }
   else{
     Double_t convpos[2];
@@ -1208,11 +1237,20 @@ void AliV0Reader::UpdateEventByEventData(){
   //see header file for documentation
   if(fCurrentEventGoodV0s->GetEntriesFast() >0 ){
     if(fCalculateBackground){
-      fBGEventHandler->AddEvent(fCurrentEventGoodV0s,fESDEvent->GetPrimaryVertex()->GetZ(),CountESDTracks());
-      //filling z and multiplicity histograms
-      fHistograms->FillHistogram("ESD_Z_distribution",fESDEvent->GetPrimaryVertex()->GetZ());
-      fHistograms->FillHistogram("ESD_multiplicity_distribution",CountESDTracks());
-      fHistograms->FillHistogram("ESD_ZvsMultiplicity",fESDEvent->GetPrimaryVertex()->GetZ(),CountESDTracks());
+      if(fUseChargedTrackMultiplicityForBG == kTRUE){
+       fBGEventHandler->AddEvent(fCurrentEventGoodV0s,fESDEvent->GetPrimaryVertex()->GetX(),fESDEvent->GetPrimaryVertex()->GetY(),fESDEvent->GetPrimaryVertex()->GetZ(),CountESDTracks());
+       //filling z and multiplicity histograms
+       fHistograms->FillHistogram("ESD_Z_distribution",fESDEvent->GetPrimaryVertex()->GetZ());
+       fHistograms->FillHistogram("ESD_multiplicity_distribution",CountESDTracks());
+       fHistograms->FillHistogram("ESD_ZvsMultiplicity",fESDEvent->GetPrimaryVertex()->GetZ(),CountESDTracks());
+      }
+      else{ // means we use #V0s for multiplicity
+       fBGEventHandler->AddEvent(fCurrentEventGoodV0s,fESDEvent->GetPrimaryVertex()->GetX(),fESDEvent->GetPrimaryVertex()->GetY(),fESDEvent->GetPrimaryVertex()->GetZ(),fNumberOfGoodV0s);
+       //filling z and multiplicity histograms
+       fHistograms->FillHistogram("ESD_Z_distribution",fESDEvent->GetPrimaryVertex()->GetZ());
+       fHistograms->FillHistogram("ESD_multiplicity_distribution",fNumberOfGoodV0s);
+       fHistograms->FillHistogram("ESD_ZvsMultiplicity",fESDEvent->GetPrimaryVertex()->GetZ(),fNumberOfGoodV0s);
+      }
     }
   }
   fCurrentEventGoodV0s->Delete();
@@ -1511,9 +1549,16 @@ Double_t AliV0Reader::GetConvPosZ(AliESDtrack* ptrack,AliESDtrack* ntrack, Doubl
    return convposz;
 }
 
-AliGammaConversionKFVector* AliV0Reader::GetBGGoodV0s(Int_t event){
-
-  return fBGEventHandler->GetBGGoodV0s(event,fESDEvent->GetPrimaryVertex()->GetZ(),CountESDTracks());
+AliGammaConversionKFVector* AliV0Reader::GetBGGoodV0s(Int_t /*event*/){
+  /*
+  if(fUseChargedTrackMultiplicityForBG == kTRUE){
+    return fBGEventHandler->GetBGGoodV0s(event,fESDEvent->GetPrimaryVertex()->GetZ(),CountESDTracks());
+  }
+  else{ // means we use #v0s as multiplicity
+    return fBGEventHandler->GetBGGoodV0s(event,fESDEvent->GetPrimaryVertex()->GetZ(),fNumberOfGoodV0s);
+  }
+  */
+  return NULL;
 }
 
 Int_t AliV0Reader::CountESDTracks(){
index 6df4094..a9c3944 100644 (file)
@@ -422,6 +422,17 @@ class AliV0Reader : public TObject {
    */
   Int_t GetPositiveTracknTPCClusters() const{return fCurrentPositiveESDTrack->GetNcls(1);}
        
+
+  /*
+   * Gets the Number of the TPC findable clusters of the negative track.
+   */
+  Int_t GetNegativeTracknTPCFClusters() const{return fCurrentNegativeESDTrack->GetTPCNclsF();}
+
+  /*
+   * Gets the Number of the TPC findable clusters of the positive track.
+   */
+  Int_t GetPositiveTracknTPCFClusters() const{return fCurrentPositiveESDTrack->GetTPCNclsF();}
+
   /*
    * Gets the Number of the ITS clusters of the negative track.
    */
@@ -431,6 +442,16 @@ class AliV0Reader : public TObject {
    * Gets the Number of the ITS clusters of the positive track.
    */
   Int_t GetPositiveTracknITSClusters() const{return fCurrentPositiveESDTrack->GetNcls(0);}
+
+  /*
+   * Gets the chi2 of the TPC  negative track.
+   */
+  Double_t GetNegativeTrackTPCchi2() const{return fCurrentNegativeESDTrack->GetTPCchi2();}
+
+  /*
+   * Gets the chi2 of the TPC  the positive track.
+   */
+  Double_t GetPositiveTrackTPCchi2() const{return fCurrentPositiveESDTrack->GetTPCchi2();}
        
   /*
    * Update data which need to be updated every event.
@@ -703,7 +724,13 @@ class AliV0Reader : public TObject {
    * Resets the V0 index.
    */
   void ResetV0IndexNumber(){fCurrentV0IndexNumber=0;}
-       
+  
+
+  /*
+   * Returns number of good v0s in the event
+   */
+  Int_t GetNGoodV0s() const {return fNumberOfGoodV0s;}
+
   /*
    * Sets the histograms.
    */
@@ -732,6 +759,8 @@ class AliV0Reader : public TObject {
 
   void SetUseOwnXYZCalculation(Bool_t flag){fUseOwnXYZCalculation=flag;}
 
+  void SetUseConstructGamma(Bool_t flag){fUseConstructGamma=flag;}
+
   Bool_t GetHelixCenter(AliESDtrack* track, Double_t b,Int_t charge, Double_t center[2]);
        
   Bool_t GetConvPosXY(AliESDtrack* ptrack,AliESDtrack* ntrack, Double_t b, Double_t convpos[2]);
@@ -771,10 +800,12 @@ class AliV0Reader : public TObject {
   static void SetESDpid(AliESDpid * const pid) {fgESDpid=pid;}
   static AliESDpid* GetESDpid() {return fgESDpid;}
 
+  void SetUseChargedTracksMultiplicityForBG(Bool_t flag){fUseChargedTrackMultiplicityForBG = flag;}
   
   Int_t GetPindex(Int_t i) {return fV0Pindex.at(i);}
   Int_t GetNindex(Int_t i) {return fV0Nindex.at(i);}
+
+  void ResetNGoodV0s(){fNumberOfGoodV0s=0;}
 
 
  private:
@@ -871,6 +902,8 @@ class AliV0Reader : public TObject {
 
   Bool_t fUseOwnXYZCalculation; //flag that determines if we use our own calculation of xyz (markus)
 
+  Bool_t fUseConstructGamma; //flag that determines if we use ConstructGamma method from AliKF
+
   Bool_t fDoCF; //flag
 
   Bool_t fUseOnFlyV0Finder; //flag
@@ -893,8 +926,11 @@ class AliV0Reader : public TObject {
   static AliESDpid* fgESDpid;                 // ESD pid object
 
   Int_t nEventsForBGCalculation;
+  
+  Bool_t fUseChargedTrackMultiplicityForBG;
+  Int_t fNumberOfGoodV0s;
 
-  ClassDef(AliV0Reader,13)
+  ClassDef(AliV0Reader,14)
 };
 
 inline void AliV0Reader::InitESDpid(Int_t type)
index 8229fb8..60fecd7 100644 (file)
@@ -11,5 +11,6 @@
 #pragma link C++ class AliGammaConversionAODObject+;
 #pragma link C++ class AliGammaConversionBGHandler+;
 #pragma link C++ class AliAnalysisTaskGammaJet+;
+#pragma link C++ class AliAnalysisTaskGammaConvDalitz+;
 
 #endif
index 997c610..58a02f0 100644 (file)
@@ -6,7 +6,8 @@ SRCS = GammaConv/AliV0Reader.cxx \
        GammaConv/AliGammaConversionAODObject.cxx \
        GammaConv/AliGammaConversionBGHandler.cxx \
        GammaConv/AliAnalysisTaskCaloConv.cxx \
-       GammaConv/AliAnalysisTaskGammaJet.cxx
+       GammaConv/AliAnalysisTaskGammaJet.cxx \
+       GammaConv/AliAnalysisTaskGammaConvDalitz.cxx
 
 HDRS:= $(SRCS:.cxx=.h) 
 
index fe7f788..b15748a 100644 (file)
@@ -36,6 +36,8 @@ Bool_t kGCdoNeutralMesonV0MCCheck =kFALSE;
 Bool_t kGCrunOmegaMeson = kFALSE;
 Bool_t kGCrunRES = kFALSE;
 Bool_t kGCRecalculateV0ForGamma = kFALSE;
+Bool_t kGCUseTrackMultiplicityForBG = kTRUE;
+Bool_t kGCMoveParticlesAccordingToVertex = kFALSE;
 //Svein 
 Bool_t kGCRunGammaJetTask = kFALSE;
 /** ---------------------------------- define cuts here ------------------------------------*/
@@ -127,6 +129,7 @@ Double_t kGCmaxPhi      = TMath::Pi();
 /** ------------------------------- end Phi/R Mapping ------------------------------------*/
 
 Bool_t kGCdoOwnXYZCalculation = kFALSE;
+Bool_t kGCdoConstructGamma = kFALSE;
 
 /** -------------AOD stuff ---------------------------------------------------------------*/
 TString kGCDeltaAODFilename = "AliAODGammaConversion.root";  //If empty, writes to standard common aod file.
@@ -285,13 +288,17 @@ Bool_t kGCplotESDEEta    = kTRUE;
 Bool_t kGCplotESDEPhi    = kTRUE;
 Bool_t kGCplotESDENTPCClusters = kTRUE;
 Bool_t kGCplotESDENITSClusters = kTRUE;
+Bool_t kGCplotESDENTPCClustersToFP = kTRUE;
+Bool_t kGCplotESDETPCchi2 = kTRUE;
 
 Bool_t kGCplotESDPEnergy = kFALSE;
 Bool_t kGCplotESDPPt     = kTRUE;
 Bool_t kGCplotESDPEta    = kTRUE;
 Bool_t kGCplotESDPPhi    = kTRUE;
-Bool_t kGCplotESDPNTPCClusters = kTRUE;
+Bool_t kGCplotESDPNTPCClusters = kTRUE; 
 Bool_t kGCplotESDPNITSClusters = kTRUE;
+Bool_t kGCplotESDPNTPCClustersToFP = kTRUE;
+Bool_t kGCplotESDPTPCchi2 = kTRUE;
 
 Bool_t kGCplotESDConvGammaEnergy = kFALSE;
 Bool_t kGCplotESDConvGammaPt     = kTRUE;
@@ -620,6 +627,15 @@ Int_t kGCnXBinsNITSClusters = 7;
 Double_t kGCfirstXBinNITSClusters = -0.5;
 Double_t kGClastXBinNITSClusters = 6.5;
 
+//TPCcluster to Findable-plots
+Int_t kGCnYBinsClsToF = 120;
+Double_t kGCfirstYBinClsToF = 0.;
+Double_t kGClastYBinClsToF = 1.2;
+
+//TPCchi2 -plots
+Int_t kGCnXBinsTPCchi2 = 100;
+Double_t kGCfirstXBinTPCchi2 = 0.;
+Double_t kGClastXBinTPCchi2 = 10;
 
 
 //Mapping-plots
@@ -710,7 +726,7 @@ Double_t kGCfirstXBinGammaNDF = 0.;
 Double_t kGClastXBinGammaNDF = 10.;
 
 //Spectra-plots
-Int_t kGCnXBinsSpectra = 1000;
+Int_t kGCnXBinsSpectra = 500;
 Double_t kGCfirstXBinSpectra = 0.;
 Double_t kGClastXBinSpectra = 1.;
 Int_t kGCnYBinsSpectra = 250;
@@ -915,6 +931,12 @@ Bool_t scanArguments(TString arguments){
       else if (argument.CompareTo("-bg-off") == 0){
        kGCcalculateBackground =kFALSE;
       }
+      else if (argument.CompareTo("-use-v0-multiplicity") == 0){
+       kGCUseTrackMultiplicityForBG = kFALSE;
+      }
+      else if (argument.CompareTo("-move-bg-vertex") == 0){
+       kGCMoveParticlesAccordingToVertex = kTRUE;
+      }
       else if (argument.CompareTo("-check-neutralmeson-pi0s") == 0){
        kGCdoNeutralMesonV0MCCheck=kTRUE;
       }
@@ -1005,6 +1027,11 @@ Bool_t scanArguments(TString arguments){
        cout<<"Switching on use own xyz calculation"<<endl;
        kGCdoOwnXYZCalculation = kTRUE;
       }
+      else if (argument.CompareTo("-use-ConstructGamma") == 0){
+       cout<<"Switching on use ConstructGamma and OFF own xyz calculation"<<endl;
+       kGCdoOwnXYZCalculation = kFALSE;
+       kGCdoConstructGamma = kTRUE;
+      }
       else if (argument.CompareTo("-no-aod") == 0){
        cout<<"Turning off AOD"<<endl;
        kGCWriteAOD = kFALSE;
@@ -1353,7 +1380,7 @@ AliAnalysisTaskGammaConversion* ConfigGammaConversion(TString arguments, AliAnal
   v0Reader->SetUseImprovedVertex(kGCuseImprovedVertex);
   v0Reader->SetDoMCTruth(kGCdoMCTruth);
   v0Reader->SetUseOwnXYZCalculation(kGCdoOwnXYZCalculation);
-
+  v0Reader->SetUseChargedTracksMultiplicityForBG(kGCUseTrackMultiplicityForBG);
   // for CF
   v0Reader->SetCFManager(man);
        
@@ -1430,6 +1457,8 @@ AliAnalysisTaskGammaConversion* ConfigGammaConversion(TString arguments, AliAnal
   gammaconversion->SetDoChic(kGCrunChic);
   gammaconversion->SetDoOmegaMeson(kGCrunOmegaMeson);
   gammaconversion->SetRecalculateV0ForGamma(kGCRecalculateV0ForGamma);
+  gammaconversion->SetUseChargedTracksMultiplicityForBG(kGCUseTrackMultiplicityForBG);
+  gammaconversion->SetMoveParticleAccordingToVertex(kGCMoveParticlesAccordingToVertex);
   // for CF
   gammaconversion->SetCFManager(man);
   gammaconversion->SetDoCF(kGCrunCF);
@@ -1705,6 +1734,9 @@ void AddHistograms(AliGammaConversionHistograms *histograms){
     if(kGCplotESDEPhi == kTRUE){ histograms->AddHistogram("ESD_E_Phi" ,"" , kGCnXBinsPhi, kGCfirstXBinPhi, kGClastXBinPhi, "", "");}
     if(kGCplotESDENTPCClusters == kTRUE){ histograms->AddHistogram("ESD_E_nTPCClusters" ,"" , kGCnXBinsNTPCClusters, kGCfirstXBinNTPCClusters, kGClastXBinNTPCClusters, "", "");}
     if(kGCplotESDENITSClusters == kTRUE){ histograms->AddHistogram("ESD_E_nITSClusters" ,"" , kGCnXBinsNITSClusters, kGCfirstXBinNITSClusters, kGClastXBinNITSClusters, "", "");}
+    if(kGCplotESDENTPCClustersToFP== kTRUE){ histograms->AddHistogram("ESD_E_nTPCClustersToFP" ,"" ,kGCnXBinsP, kGCfirstXBinP, kGClastXBinP,kGCnYBinsClsToF, kGCfirstYBinClsToF, kGClastYBinClsToF,"", "",0);}
+    if(kGCplotESDETPCchi2 == kTRUE){ histograms->AddHistogram("ESD_E_TPCchi2" ,"" , kGCnXBinsTPCchi2, kGCfirstXBinTPCchi2, kGClastXBinTPCchi2, "", "");}
+
                
     if(kGCplotESDPEnergy == kTRUE){ histograms->AddHistogram("ESD_P_Energy" ,"" , kGCnXBinsEnergy, kGCfirstXBinEnergy, kGClastXBinEnergy, "", "");}
     if(kGCplotESDPPt == kTRUE){ histograms->AddHistogram("ESD_P_Pt" ,"" , kGCnXBinsPt, kGCfirstXBinPt, kGClastXBinPt, "", "");}
@@ -1712,7 +1744,9 @@ void AddHistograms(AliGammaConversionHistograms *histograms){
     if(kGCplotESDPPhi == kTRUE){ histograms->AddHistogram("ESD_P_Phi" ,"" , kGCnXBinsPhi, kGCfirstXBinPhi, kGClastXBinPhi, "", "");}
     if(kGCplotESDPNTPCClusters == kTRUE){ histograms->AddHistogram("ESD_P_nTPCClusters" ,"" , kGCnXBinsNTPCClusters, kGCfirstXBinNTPCClusters, kGClastXBinNTPCClusters, "", "");}
     if(kGCplotESDPNITSClusters == kTRUE){ histograms->AddHistogram("ESD_P_nITSClusters" ,"" , kGCnXBinsNITSClusters, kGCfirstXBinNITSClusters, kGClastXBinNITSClusters, "", "");}
-               
+    if(kGCplotESDPNTPCClustersToFP== kTRUE){ histograms->AddHistogram("ESD_P_nTPCClustersToFP" ,"" ,kGCnXBinsP, kGCfirstXBinP, kGClastXBinP,kGCnYBinsClsToF, kGCfirstYBinClsToF, kGClastYBinClsToF,"", "",0);} 
+    if(kGCplotESDPTPCchi2 == kTRUE){ histograms->AddHistogram("ESD_P_TPCchi2" ,"" , kGCnXBinsTPCchi2, kGCfirstXBinTPCchi2, kGClastXBinTPCchi2, "", "");}
+
     if(kGCplotESDConvGammaEnergy == kTRUE){ histograms->AddHistogram("ESD_ConvGamma_Energy" ,"" , kGCnXBinsEnergy, kGCfirstXBinEnergy, kGClastXBinEnergy, "", "");}
     if(kGCplotESDConvGammaPt == kTRUE){ histograms->AddHistogram("ESD_ConvGamma_Pt" ,"" , kGCnXBinsPt, kGCfirstXBinPt, kGClastXBinPt, "", "");}
     if(kGCplotESDConvGammaEta == kTRUE){ histograms->AddHistogram("ESD_ConvGamma_Eta" ,"" , kGCnXBinsEta, kGCfirstXBinEta, kGClastXBinEta, "", "");}
@@ -2006,6 +2040,7 @@ void AddHistograms(AliGammaConversionHistograms *histograms){
     if(kGCplotPi0Spectra == kTRUE){
       histograms->AddHistogram("ESD_Mother_alfa","Invariant mass",kGCnXBinsSpectra,kGCfirstXBinAlpha, kGClastXBinAlpha,"#alpha","Counts");
 
+      //      histograms->AddHistogram("ESD_Mother_InvMass_vs_Pt" ,"Invariant Mass vs Pt" , kGCnXBinsSpectra, kGCfirstXBinSpectra, kGClastXBinSpectra,kGCnYBinsSpectra, kGCfirstYBinSpectra, kGClastYBinSpectra,"InvMass [GeV]","Pt [GeV]");
       histograms->AddHistogram("ESD_Mother_InvMass_vs_Pt" ,"Invariant Mass vs Pt" , kGCnXBinsSpectra, kGCfirstXBinSpectra, kGClastXBinSpectra,kGCnYBinsSpectra, kGCfirstYBinSpectra, kGClastYBinSpectra,"InvMass [GeV]","Pt [GeV]");
 histograms->AddHistogram("ESD_Mother_InvMass_vs_Pt_alpha" ,"Invariant Mass vs Pt" , kGCnXBinsSpectra, kGCfirstXBinSpectra, kGClastXBinSpectra,kGCnYBinsSpectra, kGCfirstYBinSpectra, kGClastYBinSpectra,"InvMass [GeV]","Pt [GeV]");
       histograms->AddHistogram("ESD_Mother_InvMass","Invariant mass",kGCnXBinsSpectra,kGCfirstXBinSpectra, kGClastXBinSpectra,"InvMass [GeV]","Counts");
@@ -2060,6 +2095,8 @@ histograms->AddHistogram("ESD_TruePi0_InvMass_vs_Pt_alpha" ,"Invariant Mass vs P
       }
       for(Int_t z=0;z<8;z++){
        for(Int_t m=0;m<6;m++){
+         histograms->AddHistogram(Form("%d%dESD_Mother_InvMass_vs_Pt",z,m) ,"ESD Invariant Mass vs Pt" , kGCnXBinsSpectra, kGCfirstXBinSpectra, kGClastXBinSpectra,kGCnYBinsSpectra, kGCfirstYBinSpectra, kGClastYBinSpectra,"InvMass [GeV]","Pt [GeV]");
+
          histograms->AddHistogram(Form("%d%dESD_Background_InvMass_vs_Pt",z,m) ,"Background Invariant Mass vs Pt" , kGCnXBinsSpectra, kGCfirstXBinSpectra, kGClastXBinSpectra,kGCnYBinsSpectra, kGCfirstYBinSpectra, kGClastYBinSpectra,"InvMass [GeV]","Pt [GeV]");
 
          
@@ -2425,6 +2462,12 @@ Int_t SetAnalysisCutSelection(TString analysisCutSelection){
   case 7:
     kGCchi2CutConversion = 10.;
     break;
+  case 8:
+    kGCchi2CutConversion = 20.;
+    break;
+  case 9:
+    kGCchi2CutConversion = 15.;
+    break;
   default:
     return iResult;
   }
@@ -2442,6 +2485,12 @@ Int_t SetAnalysisCutSelection(TString analysisCutSelection){
   case 3:  // 0.200 GeV
     kGCsingleptCut = 0.200;
     break;
+  case 4:  // 0.075 GeV
+    kGCsingleptCut = 0.075;
+    break;
+  case 5:  // 0.125 GeV
+    kGCsingleptCut = 0.125;
+    break;
   default:
     return iResult;
  }