]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
changes by Lucia to GammaConvV1: added switch for THnSparses
authordmuhlhei <d.muehlheim@cern.ch>
Thu, 15 Jan 2015 15:04:26 +0000 (16:04 +0100)
committerdmuhlhei <d.muehlheim@cern.ch>
Thu, 15 Jan 2015 15:13:18 +0000 (16:13 +0100)
PWGGA/GammaConv/AliAnalysisTaskGammaConvV1.cxx
PWGGA/GammaConv/AliAnalysisTaskGammaConvV1.h
PWGGA/GammaConv/macros/AddTask_GammaConvV1_PbPb.C

index a34990cb3e13bd56870c5e2b4da67753a2fd3371..0f08f74438dc4ca0a3496c6bee1baa6519659a7e 100644 (file)
@@ -202,7 +202,8 @@ AliAnalysisTaskGammaConvV1::AliAnalysisTaskGammaConvV1(): AliAnalysisTaskSE(),
        fDoMesonQA(0),
        fDoPhotonQA(0),
        fIsFromMBHeader(kTRUE),
-       fIsMC(kFALSE)
+       fIsMC(kFALSE),
+       fDoTHnSparse(kTRUE)
 {
 
 }
@@ -353,7 +354,8 @@ AliAnalysisTaskGammaConvV1::AliAnalysisTaskGammaConvV1(const char *name):
        fDoMesonQA(0),
        fDoPhotonQA(0),
        fIsFromMBHeader(kTRUE),
-       fIsMC(kFALSE)
+       fIsMC(kFALSE),
+       fDoTHnSparse(kTRUE)
 {
    // Define output slots here
        DefineOutput(1, TList::Class());
@@ -382,9 +384,10 @@ void AliAnalysisTaskGammaConvV1::InitBack(){
        Double_t xMin[nDim] = {0,0, 0,0};
        Double_t xMax[nDim] = {0.8,25,7,4};
        
-       sESDMotherInvMassPtZM = new THnSparseF*[fnCuts];
-       sESDMotherBackInvMassPtZM = new THnSparseF*[fnCuts];
-
+       if(fDoTHnSparse){
+               sESDMotherInvMassPtZM = new THnSparseF*[fnCuts];
+               sESDMotherBackInvMassPtZM = new THnSparseF*[fnCuts];
+       }
        fBGHandler = new AliGammaConversionAODBGHandler*[fnCuts];
        fBGHandlerRP = new AliConversionAODBGHandlerRP*[fnCuts];
        for(Int_t iCut = 0; iCut<fnCuts;iCut++){
@@ -411,22 +414,23 @@ void AliAnalysisTaskGammaConvV1::InitBack(){
                                centMax = ((centMax*5)+45);
                        }
                        
-                       fBackList[iCut] = new TList();
-                       fBackList[iCut]->SetName(Form("%s_%s_%s Back histograms",cutstringEvent.Data(), cutstringPhoton.Data(),cutstringMeson.Data()));
-                       fBackList[iCut]->SetOwner(kTRUE);
-                       fCutFolder[iCut]->Add(fBackList[iCut]);
-
-                       sESDMotherBackInvMassPtZM[iCut] = new THnSparseF("Back_Back_InvMass_Pt_z_m","Back_Back_InvMass_Pt_z_m",nDim,nBins,xMin,xMax);
-                       fBackList[iCut]->Add(sESDMotherBackInvMassPtZM[iCut]);
-
-                       fMotherList[iCut] = new TList();
-                       fMotherList[iCut]->SetName(Form("%s_%s_%s Mother histograms",cutstringEvent.Data() ,cutstringPhoton.Data(),cutstringMeson.Data()));
-                       fMotherList[iCut]->SetOwner(kTRUE);
-                       fCutFolder[iCut]->Add(fMotherList[iCut]);
-
-                       sESDMotherInvMassPtZM[iCut] = new THnSparseF("Back_Mother_InvMass_Pt_z_m","Back_Mother_InvMass_Pt_z_m",nDim,nBins,xMin,xMax);
-                       fMotherList[iCut]->Add(sESDMotherInvMassPtZM[iCut]);
-
+                       if(fDoTHnSparse){
+                               fBackList[iCut] = new TList();
+                               fBackList[iCut]->SetName(Form("%s_%s_%s Back histograms",cutstringEvent.Data(), cutstringPhoton.Data(),cutstringMeson.Data()));
+                               fBackList[iCut]->SetOwner(kTRUE);
+                               fCutFolder[iCut]->Add(fBackList[iCut]);
+
+                               sESDMotherBackInvMassPtZM[iCut] = new THnSparseF("Back_Back_InvMass_Pt_z_m","Back_Back_InvMass_Pt_z_m",nDim,nBins,xMin,xMax);
+                               fBackList[iCut]->Add(sESDMotherBackInvMassPtZM[iCut]);
+
+                               fMotherList[iCut] = new TList();
+                               fMotherList[iCut]->SetName(Form("%s_%s_%s Mother histograms",cutstringEvent.Data() ,cutstringPhoton.Data(),cutstringMeson.Data()));
+                               fMotherList[iCut]->SetOwner(kTRUE);
+                               fCutFolder[iCut]->Add(fMotherList[iCut]);
+
+                               sESDMotherInvMassPtZM[iCut] = new THnSparseF("Back_Mother_InvMass_Pt_z_m","Back_Mother_InvMass_Pt_z_m",nDim,nBins,xMin,xMax);
+                               fMotherList[iCut]->Add(sESDMotherInvMassPtZM[iCut]);
+                       }
                        if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->BackgroundHandlerType() == 0){
                                fBGHandler[iCut] = new AliGammaConversionAODBGHandler(
                                                                                                                                        collisionSystem,centMin,centMax,
@@ -462,8 +466,10 @@ void AliAnalysisTaskGammaConvV1::UserCreateOutputObjects(){
 
        fCutFolder = new TList*[fnCuts];
        fESDList = new TList*[fnCuts];
-       fBackList = new TList*[fnCuts];
-       fMotherList = new TList*[fnCuts];
+       if(fDoTHnSparse){
+               fBackList = new TList*[fnCuts];
+               fMotherList = new TList*[fnCuts];
+       }
        hNEvents = new TH1I*[fnCuts];
        hNGoodESDTracks = new TH1I*[fnCuts];
        hNGammaCandidates = new TH1I*[fnCuts];
@@ -1899,7 +1905,7 @@ void AliAnalysisTaskGammaConvV1::CalculatePi0Candidates(){
                                                        hESDMotherEtaPtOpenAngle[fiCut]->Fill(pi0cand->Pt(),pi0cand->GetOpeningAngle());       
                                                }
                                        }   
-                                       if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->DoBGCalculation()){
+                                       if(fDoTHnSparse && ((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->DoBGCalculation()){
                                                Int_t zbin = 0;
                                                Int_t mbin = 0;
 
@@ -2328,14 +2334,14 @@ void AliAnalysisTaskGammaConvV1::ProcessTrueMesonCandidatesAOD(AliAODConversionM
 //________________________________________________________________________
 void AliAnalysisTaskGammaConvV1::CalculateBackground(){
 
-       Int_t zbin= fBGHandler[fiCut]->GetZBinIndex(fInputEvent->GetPrimaryVertex()->GetZ());
+    Int_t zbin = fBGHandler[fiCut]->GetZBinIndex(fInputEvent->GetPrimaryVertex()->GetZ());
        Int_t mbin = 0;
 
-       if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity()){
-               mbin = fBGHandler[fiCut]->GetMultiplicityBinIndex(fV0Reader->GetNumberOfPrimaryTracks());
-       } else {
-               mbin = fBGHandler[fiCut]->GetMultiplicityBinIndex(fGammaCandidates->GetEntries());
-       }
+    if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity()){
+        mbin = fBGHandler[fiCut]->GetMultiplicityBinIndex(fV0Reader->GetNumberOfPrimaryTracks());
+    } else {
+        mbin = fBGHandler[fiCut]->GetMultiplicityBinIndex(fGammaCandidates->GetEntries());
+    }
 
        if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseRotationMethod()){
 
@@ -2364,8 +2370,10 @@ void AliAnalysisTaskGammaConvV1::CalculateBackground(){
                                if((((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))
                                        ->MesonIsSelected(backgroundCandidate,kFALSE,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift()))){
                                        hESDMotherBackInvMassPt[fiCut]->Fill(backgroundCandidate->M(),backgroundCandidate->Pt());
-                                       Double_t sparesFill[4] = {backgroundCandidate->M(),backgroundCandidate->Pt(),(Double_t)zbin,(Double_t)mbin};
-                                       sESDMotherBackInvMassPtZM[fiCut]->Fill(sparesFill,1);
+                                       if(fDoTHnSparse){
+                                               Double_t sparesFill[4] = {backgroundCandidate->M(),backgroundCandidate->Pt(),(Double_t)zbin,(Double_t)mbin};
+                                               sESDMotherBackInvMassPtZM[fiCut]->Fill(sparesFill,1);
+                                       }
                                }
                                delete backgroundCandidate;
                                backgroundCandidate = 0x0;
@@ -2398,8 +2406,10 @@ void AliAnalysisTaskGammaConvV1::CalculateBackground(){
                                        if((((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))
                                                ->MesonIsSelected(backgroundCandidate,kFALSE,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift()))){
                                                hESDMotherBackInvMassPt[fiCut]->Fill(backgroundCandidate->M(),backgroundCandidate->Pt());
-                                               Double_t sparesFill[4] = {backgroundCandidate->M(),backgroundCandidate->Pt(),(Double_t)zbin,(Double_t)mbin};
-                                               sESDMotherBackInvMassPtZM[fiCut]->Fill(sparesFill,1);
+                                               if(fDoTHnSparse){
+                                                       Double_t sparesFill[4] = {backgroundCandidate->M(),backgroundCandidate->Pt(),(Double_t)zbin,(Double_t)mbin};
+                                                       sESDMotherBackInvMassPtZM[fiCut]->Fill(sparesFill,1);
+                                               }
                                        }
                                        delete backgroundCandidate;
                                        backgroundCandidate = 0x0;
@@ -2433,8 +2443,10 @@ void AliAnalysisTaskGammaConvV1::CalculateBackground(){
                                                if((((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))
                                                        ->MesonIsSelected(backgroundCandidate,kFALSE,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift()))){
                                                        hESDMotherBackInvMassPt[fiCut]->Fill(backgroundCandidate->M(),backgroundCandidate->Pt());
-                                                       Double_t sparesFill[4] = {backgroundCandidate->M(),backgroundCandidate->Pt(),(Double_t)zbin,(Double_t)mbin};
-                                                       sESDMotherBackInvMassPtZM[fiCut]->Fill(sparesFill,1);
+                                                       if(fDoTHnSparse){
+                                                               Double_t sparesFill[4] = {backgroundCandidate->M(),backgroundCandidate->Pt(),(Double_t)zbin,(Double_t)mbin};
+                                                               sESDMotherBackInvMassPtZM[fiCut]->Fill(sparesFill,1);
+                                                       }
                                                }
                                                delete backgroundCandidate;
                                                backgroundCandidate = 0x0;
@@ -2448,15 +2460,18 @@ void AliAnalysisTaskGammaConvV1::CalculateBackground(){
 //________________________________________________________________________
 void AliAnalysisTaskGammaConvV1::CalculateBackgroundRP(){
 
-       Int_t zbin= fBGHandlerRP[fiCut]->GetZBinIndex(fInputEvent->GetPrimaryVertex()->GetZ());
+       Int_t zbin = 0;
        Int_t mbin = 0;
-       if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity()){
-               mbin = fBGHandlerRP[fiCut]->GetMultiplicityBinIndex(fV0Reader->GetNumberOfPrimaryTracks());
-       } else {
-               mbin = fBGHandlerRP[fiCut]->GetMultiplicityBinIndex(fGammaCandidates->GetEntries());
+       
+       if(fDoTHnSparse){
+               zbin = fBGHandlerRP[fiCut]->GetZBinIndex(fInputEvent->GetPrimaryVertex()->GetZ());
+               if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity()){
+                       mbin = fBGHandlerRP[fiCut]->GetMultiplicityBinIndex(fV0Reader->GetNumberOfPrimaryTracks());
+               } else {
+                       mbin = fBGHandlerRP[fiCut]->GetMultiplicityBinIndex(fGammaCandidates->GetEntries());
+               }
        }
 
-
        //Rotation Method
        if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseRotationMethod()){
                // Correct for the number of rotations
@@ -2477,8 +2492,10 @@ void AliAnalysisTaskGammaConvV1::CalculateBackgroundRP(){
                                        backgroundCandidate.CalculateDistanceOfClossetApproachToPrimVtx(fInputEvent->GetPrimaryVertex());
                                        if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelected(&backgroundCandidate,kFALSE,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
                                                hESDMotherBackInvMassPt[fiCut]->Fill(backgroundCandidate.M(),backgroundCandidate.Pt());
-                                               Double_t sparesFill[4] = {backgroundCandidate.M(),backgroundCandidate.Pt(),(Double_t)zbin,(Double_t)mbin};
-                                               sESDMotherBackInvMassPtZM[fiCut]->Fill(sparesFill,weight);
+                                               if(fDoTHnSparse){
+                                                       Double_t sparesFill[4] = {backgroundCandidate.M(),backgroundCandidate.Pt(),(Double_t)zbin,(Double_t)mbin};
+                                                       sESDMotherBackInvMassPtZM[fiCut]->Fill(sparesFill,weight);
+                                               }
                                        }
                                }
                        }
@@ -2501,21 +2518,23 @@ void AliAnalysisTaskGammaConvV1::CalculateBackgroundRP(){
 
                                for(Int_t iCurrent=0;iCurrent<fGammaCandidates->GetEntries();iCurrent++){
 
-                               AliAODConversionPhoton *gamma0 = (AliAODConversionPhoton*)(fGammaCandidates->At(iCurrent));
+                    AliAODConversionPhoton *gamma0 = (AliAODConversionPhoton*)(fGammaCandidates->At(iCurrent));
 
-                               for(UInt_t iPrevious=0;iPrevious<previousEventGammas->size();iPrevious++){
+                    for(UInt_t iPrevious=0;iPrevious<previousEventGammas->size();iPrevious++){
 
-                                       AliAODConversionPhoton *gamma1 = (AliAODConversionPhoton*)(previousEventGammas->at(iPrevious));
+                        AliAODConversionPhoton *gamma1 = (AliAODConversionPhoton*)(previousEventGammas->at(iPrevious));
 
-                                       AliAODConversionMother backgroundCandidate(gamma0,gamma1);
-                                       backgroundCandidate.CalculateDistanceOfClossetApproachToPrimVtx(fInputEvent->GetPrimaryVertex());
-                                       if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))
-                                               ->MesonIsSelected(&backgroundCandidate,kFALSE,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
-                                               hESDMotherBackInvMassPt[fiCut]->Fill(backgroundCandidate.M(),backgroundCandidate.Pt());
-                                               Double_t sparesFill[4] = {backgroundCandidate.M(),backgroundCandidate.Pt(),(Double_t)zbin,(Double_t)mbin};
-                                               sESDMotherBackInvMassPtZM[fiCut]->Fill(sparesFill,weight);
-                                       }
-                               }
+                        AliAODConversionMother backgroundCandidate(gamma0,gamma1);
+                        backgroundCandidate.CalculateDistanceOfClossetApproachToPrimVtx(fInputEvent->GetPrimaryVertex());
+                        if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))
+                            ->MesonIsSelected(&backgroundCandidate,kFALSE,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
+                            hESDMotherBackInvMassPt[fiCut]->Fill(backgroundCandidate.M(),backgroundCandidate.Pt());
+                            if(fDoTHnSparse){
+                                Double_t sparesFill[4] = {backgroundCandidate.M(),backgroundCandidate.Pt(),(Double_t)zbin,(Double_t)mbin};
+                                sESDMotherBackInvMassPtZM[fiCut]->Fill(sparesFill,weight);
+                            }
+                        }
+                    }
                                }
                        }
                }
index d9826673efeec1adb6fdb2cbb2439b0c2ee78708..ac2f6ab1d77e0fd7f85eb9e3e2f10c52c221cc4e 100644 (file)
@@ -36,6 +36,7 @@ class AliAnalysisTaskGammaConvV1 : public AliAnalysisTaskSE {
                void SetDoMesonAnalysis(Bool_t flag){fDoMesonAnalysis = flag;}
                void SetDoMesonQA(Int_t flag){fDoMesonQA = flag;}
                void SetDoPhotonQA(Int_t flag){fDoPhotonQA = flag;}
+               void SetDoTHnSparse(Bool_t flag){fDoTHnSparse = flag;}
                void ProcessPhotonCandidates();
                void CalculatePi0Candidates();
                void CalculateBackground();
@@ -229,6 +230,7 @@ class AliAnalysisTaskGammaConvV1 : public AliAnalysisTaskSE {
                Int_t                                                           fDoPhotonQA;                                                                            //
                Bool_t                                                          fIsFromMBHeader;                                                                        //
                Bool_t                                                          fIsMC;                                                                                          //
+               Bool_t                              fDoTHnSparse;                       // flag for using THnSparses for background estimation
 
        private:
 
index 5fbe77d60b6b9e7668cfa5f506b18e5ca28a4541..d3a9d7105db0d0a4670b0999fd41d3289098d9c1 100644 (file)
@@ -6,7 +6,8 @@ void AddTask_GammaConvV1_PbPb(  Int_t trainConfig = 1,  //change different set o
                               Int_t headerSelectionInt = 0,  // 1 pi0 header, 2 eta header, 3 both (only for "named" boxes)
                               TString cutnumberAODBranch = "1000000060084000001500000",
                               TString periodName = "LHC13d2",  //name of the period for added signals and weighting
-                                                         Bool_t doWeighting = kFALSE  //enable Weighting
+                                                         Bool_t doWeighting = kFALSE,  //enable Weighting
+                                                         Bool_t enableUseTHnSparse = kTRUE
                            ) {
 
        // ================= Load Librariers =================================
@@ -1133,7 +1134,8 @@ void AddTask_GammaConvV1_PbPb(  Int_t trainConfig = 1,  //change different set o
        task->SetDoMesonAnalysis(kTRUE);
        task->SetDoMesonQA(enableQAMesonTask); //Attention new switch for Pi0 QA
        task->SetDoPhotonQA(enableQAPhotonTask);  //Attention new switch small for Photon QA
-
+       task->SetDoTHnSparse(enableUseTHnSparse);
+       
        //connect containers
        AliAnalysisDataContainer *coutput =
                mgr->CreateContainer(Form("GammaConvV1_%i",trainConfig), TList::Class(),