TENDER becomes Tender, removing .so
[u/mrichter/AliRoot.git] / PWGGA / GammaConv / macros / AddTask_GammaConvCalo_pPb.C
index 94de291..2c59fd3 100644 (file)
@@ -5,28 +5,33 @@ void AddTask_GammaConvCalo_pPb(  Int_t trainConfig = 1,  //change different set
                               TString fileNameInputForWeighting = "MCSpectraInput.root", // path to file for weigting input
                               Int_t doWeightingPart = 0,  //enable Weighting
                               TString generatorName = "DPMJET",
-                              TString cutnumberAODBranch = "8000000060084000001500000" // cutnumber for AOD branch
+                              TString cutnumberAODBranch = "8000000060084000001500000", // cutnumber for AOD branch
+                              Bool_t enableExtendedMatching = kFALSE //enable or disable extended matching histograms for conversion electrons <-> cluster
                                                        ) {
 
        // ================= Load Librariers =================================
-       gSystem->Load("libCore.so");  
-       gSystem->Load("libTree.so");
-       gSystem->Load("libGeom.so");
-       gSystem->Load("libVMC.so");
-       gSystem->Load("libPhysics.so");
+       gSystem->Load("libCore");  
+       gSystem->Load("libTree");
+       gSystem->Load("libGeom");
+       gSystem->Load("libVMC");
+       gSystem->Load("libPhysics");
        gSystem->Load("libMinuit");
        gSystem->Load("libSTEERBase");
        gSystem->Load("libESD");
        gSystem->Load("libAOD");
        gSystem->Load("libANALYSIS");
        gSystem->Load("libANALYSISalice");  
-       gSystem->Load("libPWGGAGammaConv.so");
-       gSystem->Load("libCDB.so");
-       gSystem->Load("libSTEER.so");
-       gSystem->Load("libSTEERBase.so");
-       gSystem->Load("libTENDER.so");
-       gSystem->Load("libTENDERSupplies.so");
-               
+       gSystem->Load("libCDB");
+       gSystem->Load("libSTEER");
+       gSystem->Load("libSTEERBase");
+       gSystem->Load("libTender");
+       gSystem->Load("libTenderSupplies");
+       gSystem->Load("libPWGflowBase");
+       gSystem->Load("libPWGflowTasks");
+       gSystem->Load("libPWGGAGammaConv");
+
+       Int_t isHeavyIon = 2;
+       
        // ================== GetAnalysisManager ===============================
        AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
        if (!mgr) {
@@ -40,13 +45,15 @@ void AddTask_GammaConvCalo_pPb(  Int_t trainConfig = 1,  //change different set
        //========= Add PID Reponse to ANALYSIS manager ====
        if(!(AliPIDResponse*)mgr->GetTask("PIDResponseTask")){
                gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
-               AddTaskPIDResponse(isMC,1,0,4,0,"",1,1,4);
+               AddTaskPIDResponse(isMC);
        }
        
        Printf("here \n");
        
        //=========  Set Cutnumber for V0Reader ================================
-       TString cutnumber = "8000000060084001001500000000"; 
+       TString cutnumberPhoton = "060000084001001500000000";
+       TString cutnumberEvent = "8000000";
+       Bool_t doEtaShift = kFALSE;
        AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
 
        //========= Add V0 Reader to  ANALYSIS manager if not yet existent =====
@@ -62,12 +69,24 @@ void AddTask_GammaConvCalo_pPb(  Int_t trainConfig = 1,  //change different set
                        return;
                }
 
+               AliConvEventCuts *fEventCuts=NULL;
+               if(cutnumberEvent!=""){
+                       fEventCuts= new AliConvEventCuts(cutnumberEvent.Data(),cutnumberEvent.Data());
+                       fEventCuts->SetPreSelectionCutFlag(kTRUE);
+                       if(fEventCuts->InitializeCutsFromCutString(cutnumberEvent.Data())){
+                               fEventCuts->DoEtaShift(doEtaShift);
+                               fV0ReaderV1->SetEventCuts(fEventCuts);
+                               fEventCuts->SetFillCutHistograms("",kTRUE);
+                       }
+               }
+
                // Set AnalysisCut Number
-               AliConversionCuts *fCuts=NULL;
-               if(cutnumber!=""){
-                       fCuts= new AliConversionCuts(cutnumber.Data(),cutnumber.Data());
+               AliConversionPhotonCuts *fCuts=NULL;
+               if(cutnumberPhoton!=""){
+                       fCuts= new AliConversionPhotonCuts(cutnumberPhoton.Data(),cutnumberPhoton.Data());
                        fCuts->SetPreSelectionCutFlag(kTRUE);
-                       if(fCuts->InitializeCutsFromCutString(cutnumber.Data())){
+                       fCuts->SetIsHeavyIon(isHeavyIon);
+                       if(fCuts->InitializeCutsFromCutString(cutnumberPhoton.Data())){
                                fV0ReaderV1->SetConversionCuts(fCuts);
                                fCuts->SetFillCutHistograms("",kTRUE);
                        }
@@ -91,27 +110,99 @@ void AddTask_GammaConvCalo_pPb(  Int_t trainConfig = 1,  //change different set
        //================================================
        AliAnalysisTaskGammaConvCalo *task=NULL;
        task= new AliAnalysisTaskGammaConvCalo(Form("GammaConvCalo_%i",trainConfig));
-       task->SetIsHeavyIon(2);
+       task->SetIsHeavyIon(isHeavyIon);
        task->SetIsMC(isMC);
        // Cut Numbers to use in Analysis
        Int_t numberOfCuts = 2;
-
-       TString *cutarray = new TString[numberOfCuts];
-       TString *clustercutarray = new TString[numberOfCuts];
+       if (trainConfig==10 ){ numberOfCuts =4;}
+       if (trainConfig==2 || trainConfig==4  ){ numberOfCuts =6;}
+       if (trainConfig==5 || trainConfig==6 || trainConfig==7 || trainConfig==8 || trainConfig==32 || trainConfig==33){ numberOfCuts =5;}
+       
+       TString *eventCutArray = new TString[numberOfCuts];
+       TString *photonCutArray = new TString[numberOfCuts];
+       TString *clusterCutArray = new TString[numberOfCuts];
        TString *mesonCutArray = new TString[numberOfCuts];
 
        // cluster cuts
        // 0 "ClusterType",  1 "EtaMin", 2 "EtaMax", 3 "PhiMin", 4 "PhiMax", 5 "DistanceToBadChannel", 6 "Timing", 7 "TrackMatching", 8 "ExoticCell",
        // 9 "MinEnergy", 10 "MinNCells", 11 "MinM02", 12 "MaxM02", 13 "MinM20", 14 "MaxM20", 15 "MaximumDispersion", 16 "NLM"
        
-       if (trainConfig == 1){ 
-               cutarray[ 0] = "8000001002092970028250400000"; clustercutarray[0] = "10000040022030000"; mesonCutArray[0] = "01525065000000"; //standart cut, kINT7
-               cutarray[ 1] = "8005201002092970028250400000"; clustercutarray[1] = "10000040022030000"; mesonCutArray[1] = "01525065000000"; //standard cut, kEMC7
+       //************************************************ EMCAL clusters **********************************************************
+       if (trainConfig == 1){ // min energy = 0.3 GeV/c
+               eventCutArray[ 0] = "8000001"; photonCutArray[ 0] = "002000093270028250400000"; clusterCutArray[0] = "10000042022030000"; mesonCutArray[0] = "01631031000000"; //standart cut, kINT7 
+               eventCutArray[ 1] = "8005201"; photonCutArray[ 1] = "002000093270028250400000"; clusterCutArray[1] = "10000042022030000"; mesonCutArray[1] = "01631031000000"; //standard cut, kEMC7 
+       } else if (trainConfig == 2){  // min energy = 0.3 GeV/c
+               eventCutArray[ 0] = "8008101"; photonCutArray[ 0] = "002000093270028250400000"; clusterCutArray[0] = "10000042022030000"; mesonCutArray[0] = "01631031000000"; //standart cut, kEMCEGA based on INT7 
+               eventCutArray[ 1] = "8008301"; photonCutArray[ 1] = "002000093270028250400000"; clusterCutArray[1] = "10000042022030000"; mesonCutArray[1] = "01631031000000"; //standard cut, kEMCEG1 based on INT7 
+               eventCutArray[ 2] = "8008501"; photonCutArray[ 2] = "002000093270028250400000"; clusterCutArray[2] = "10000042022030000"; mesonCutArray[2] = "01631031000000"; //standard cut, kEMCEG2 based on INT7 
+               eventCutArray[ 3] = "8009101"; photonCutArray[ 3] = "002000093270028250400000"; clusterCutArray[3] = "10000042022030000"; mesonCutArray[3] = "01631031000000"; //standard cut, kEMCEJE based on INT7 
+               eventCutArray[ 4] = "8009301"; photonCutArray[ 4] = "002000093270028250400000"; clusterCutArray[4] = "10000042022030000"; mesonCutArray[4] = "01631031000000"; //standard cut, kEMCEJ1 based on INT7 
+               eventCutArray[ 5] = "8009501"; photonCutArray[ 5] = "002000093270028250400000"; clusterCutArray[5] = "10000042022030000"; mesonCutArray[5] = "01631031000000"; //standard cut, kEMCEG2 based on INT7 
+       } else if (trainConfig == 3){ // min energy = 0.4 GeV/c
+               eventCutArray[ 0] = "8000001"; photonCutArray[ 0] = "002000093270028250400000"; clusterCutArray[0] = "10000042032030000"; mesonCutArray[0] = "01631031000000"; //standart cut, kINT7 
+               eventCutArray[ 1] = "8005201"; photonCutArray[ 1] = "002000093270028250400000"; clusterCutArray[1] = "10000042032030000"; mesonCutArray[1] = "01631031000000"; //standard cut, kEMC7    
+       } else if (trainConfig == 4){ // min energy = 0.4 GeV/c
+               eventCutArray[ 0] = "8008101"; photonCutArray[ 0] = "002000093270028250400000"; clusterCutArray[0] = "10000042032030000"; mesonCutArray[0] = "01631031000000"; //standart cut, kEMCEGA based on INT7 
+               eventCutArray[ 1] = "8008301"; photonCutArray[ 1] = "002000093270028250400000"; clusterCutArray[1] = "10000042032030000"; mesonCutArray[1] = "01631031000000"; //standard cut, kEMCEG1 based on INT7 
+               eventCutArray[ 2] = "8008501"; photonCutArray[ 2] = "002000093270028250400000"; clusterCutArray[2] = "10000042032030000"; mesonCutArray[2] = "01631031000000"; //standard cut, kEMCEG2 based on INT7 
+               eventCutArray[ 3] = "8009101"; photonCutArray[ 3] = "002000093270028250400000"; clusterCutArray[3] = "10000042032030000"; mesonCutArray[3] = "01631031000000"; //standard cut, kEMCEJE based on INT7 
+               eventCutArray[ 4] = "8009301"; photonCutArray[ 4] = "002000093270028250400000"; clusterCutArray[4] = "10000042032030000"; mesonCutArray[4] = "01631031000000"; //standard cut, kEMCEJ1 based on INT7 
+               eventCutArray[ 5] = "8009501"; photonCutArray[ 5] = "002000093270028250400000"; clusterCutArray[5] = "10000042032030000"; mesonCutArray[5] = "01631031000000"; //standard cut, kEMCEG2 based on INT7
+       } else if (trainConfig == 5){ //EMCAL variation of track matching
+               eventCutArray[ 0] = "8000001"; photonCutArray[ 0] = "002000093270028250400000"; clusterCutArray[0] = "10000041032030000"; mesonCutArray[0] = "01631031000000"; // 
+               eventCutArray[ 1] = "8000001"; photonCutArray[ 1] = "002000093270028250400000"; clusterCutArray[1] = "10000042032030000"; mesonCutArray[1] = "01631031000000"; 
+               eventCutArray[ 2] = "8000001"; photonCutArray[ 2] = "002000093270028250400000"; clusterCutArray[2] = "10000043032030000"; mesonCutArray[2] = "01631031000000"; 
+               eventCutArray[ 3] = "8000001"; photonCutArray[ 3] = "002000093270028250400000"; clusterCutArray[3] = "10000044032030000"; mesonCutArray[3] = "01631031000000"; 
+               eventCutArray[ 4] = "8000001"; photonCutArray[ 4] = "002000093270028250400000"; clusterCutArray[4] = "10000045032030000"; mesonCutArray[4] = "01631031000000"; 
+       } else if (trainConfig == 6){ //EMCAL added signal
+               eventCutArray[ 0] = "8000002"; photonCutArray[ 0] = "002000093270028250400000"; clusterCutArray[0] = "10000041032030000"; mesonCutArray[0] = "01631031000000"; 
+               eventCutArray[ 1] = "8000002"; photonCutArray[ 1] = "002000093270028250400000"; clusterCutArray[1] = "10000042032030000"; mesonCutArray[1] = "01631031000000"; 
+               eventCutArray[ 2] = "8000002"; photonCutArray[ 2] = "002000093270028250400000"; clusterCutArray[2] = "10000043032030000"; mesonCutArray[2] = "01631031000000"; 
+               eventCutArray[ 3] = "8000002"; photonCutArray[ 3] = "002000093270028250400000"; clusterCutArray[3] = "10000044032030000"; mesonCutArray[3] = "01631031000000"; 
+               eventCutArray[ 4] = "8000002"; photonCutArray[ 4] = "002000093270028250400000"; clusterCutArray[4] = "10000045032030000"; mesonCutArray[4] = "01631031000000"; 
+       } else if (trainConfig == 7){ //EMCAL minEnergy variation
+               eventCutArray[ 0] = "8000001"; photonCutArray[ 0] = "002000093270028250400000"; clusterCutArray[0] = "10000042012030000"; mesonCutArray[0] = "01631031000000"; //0.2 GeV/c
+               eventCutArray[ 1] = "8000001"; photonCutArray[ 1] = "002000093270028250400000"; clusterCutArray[1] = "10000042022030000"; mesonCutArray[1] = "01631031000000"; //0.3 GeV/c
+               eventCutArray[ 2] = "8000001"; photonCutArray[ 2] = "002000093270028250400000"; clusterCutArray[2] = "10000042032030000"; mesonCutArray[2] = "01631031000000"; //0.4 GeV/c default
+               eventCutArray[ 3] = "8000001"; photonCutArray[ 3] = "002000093270028250400000"; clusterCutArray[3] = "10000042042030000"; mesonCutArray[3] = "01631031000000"; //0.5 GeV/c
+               eventCutArray[ 4] = "8000001"; photonCutArray[ 4] = "002000093270028250400000"; clusterCutArray[4] = "10000042052030000"; mesonCutArray[4] = "01631031000000"; //0.6 GeV/c
+       } else if (trainConfig == 8){ //EMCAL minNCells variation
+               eventCutArray[ 0] = "8000001"; photonCutArray[ 0] = "002000093270028250400000"; clusterCutArray[0] = "10000042031030000"; mesonCutArray[0] = "01631031000000"; //n cells >= 1
+               eventCutArray[ 1] = "8000001"; photonCutArray[ 1] = "002000093270028250400000"; clusterCutArray[1] = "10000042033030000"; mesonCutArray[1] = "01631031000000"; //n cells >= 3
+               eventCutArray[ 2] = "8000001"; photonCutArray[ 2] = "002000093270028250400000"; clusterCutArray[2] = "10000042032000000"; mesonCutArray[2] = "01631031000000"; //no M02 cut
+               eventCutArray[ 3] = "8000001"; photonCutArray[ 3] = "002000093270028250400000"; clusterCutArray[3] = "10021042032030000"; mesonCutArray[3] = "01631031000000"; //only modules with TRD infront
+               eventCutArray[ 4] = "8000001"; photonCutArray[ 4] = "002000093270028250400000"; clusterCutArray[4] = "10013042032030000"; mesonCutArray[4] = "01631031000000"; //no modules with TRD infront            
+       } else if (trainConfig == 9){ //PCM restriction in acceptance 
+               eventCutArray[ 0] = "8000001"; photonCutArray[ 0] = "002022093270028250400000"; clusterCutArray[0] = "10000042032030000"; mesonCutArray[0] = "01631031000000"; // PCM photons pointing to EMCAL loose
+               eventCutArray[ 1] = "8000001"; photonCutArray[ 1] = "002044093270028250400000"; clusterCutArray[1] = "10000042032030000"; mesonCutArray[1] = "01631031000000"; // PCM photons pointing to EMCAL tight
+       } else if (trainConfig == 10){ 
+               eventCutArray[ 0] = "8005201"; photonCutArray[ 0] = "002000093270028250400000"; clusterCutArray[0] = "10000042062030000"; mesonCutArray[0] = "01631031000000"; 
+               eventCutArray[ 1] = "8005201"; photonCutArray[ 1] = "002000093270028250400000"; clusterCutArray[1] = "10000042072030000"; mesonCutArray[1] = "01631031000000"; 
+               eventCutArray[ 2] = "8005201"; photonCutArray[ 2] = "002000093270028250400000"; clusterCutArray[2] = "10000042082030000"; mesonCutArray[2] = "01631031000000"; 
+               eventCutArray[ 3] = "8005201"; photonCutArray[ 3] = "002000093270028250400000"; clusterCutArray[3] = "10000042092030000"; mesonCutArray[3] = "01631031000000"; 
+               
+       //************************************************ PHOS clusters **********************************************************     
+       } else if (trainConfig == 31) { // min energy = 0.3 GeV/c
+               eventCutArray[ 0] = "8000001"; photonCutArray[ 0] = "002000093270028250400000"; clusterCutArray[0] = "20000042033200000"; mesonCutArray[0] = "01631031000000"; //standart cut, kINT7 
+               eventCutArray[ 1] = "8006201"; photonCutArray[ 1] = "002000093270028250400000"; clusterCutArray[1] = "20000042033200000"; mesonCutArray[1] = "01631031000000"; //standard cut, kPHI7            
+       } else if (trainConfig == 32) { //PHOS
+               eventCutArray[ 0] = "8000001"; photonCutArray[ 0] = "002000093270028250400000"; clusterCutArray[0] = "20000041033200000"; mesonCutArray[0] = "01631031000000"; 
+               eventCutArray[ 1] = "8000001"; photonCutArray[ 1] = "002000093270028250400000"; clusterCutArray[1] = "20000042033200000"; mesonCutArray[1] = "01631031000000"; 
+               eventCutArray[ 2] = "8000001"; photonCutArray[ 2] = "002000093270028250400000"; clusterCutArray[2] = "20000043033200000"; mesonCutArray[2] = "01631031000000"; 
+               eventCutArray[ 3] = "8000001"; photonCutArray[ 3] = "002000093270028250400000"; clusterCutArray[3] = "20000044033200000"; mesonCutArray[3] = "01631031000000"; 
+               eventCutArray[ 4] = "8000001"; photonCutArray[ 4] = "002000093270028250400000"; clusterCutArray[4] = "20000045033200000"; mesonCutArray[4] = "01631031000000"; 
+       } else if (trainConfig == 33) { //PHOS
+               eventCutArray[ 0] = "8000002"; photonCutArray[ 0] = "002000093270028250400000"; clusterCutArray[0] = "20000041033200000"; mesonCutArray[0] = "01631031000000"; 
+               eventCutArray[ 1] = "8000002"; photonCutArray[ 1] = "002000093270028250400000"; clusterCutArray[1] = "20000042033200000"; mesonCutArray[1] = "01631031000000"; 
+               eventCutArray[ 2] = "8000002"; photonCutArray[ 2] = "002000093270028250400000"; clusterCutArray[2] = "20000043033200000"; mesonCutArray[2] = "01631031000000"; 
+               eventCutArray[ 3] = "8000002"; photonCutArray[ 3] = "002000093270028250400000"; clusterCutArray[3] = "20000044033200000"; mesonCutArray[3] = "01631031000000"; 
+               eventCutArray[ 4] = "8000002"; photonCutArray[ 4] = "002000093270028250400000"; clusterCutArray[4] = "20000045033200000"; mesonCutArray[4] = "01631031000000"; 
        } else {
                Error(Form("GammaConvCalo_%i",trainConfig), "wrong trainConfig variable no cuts have been specified for the configuration");
                return;
        }
 
+       TList *EventCutList = new TList();
        TList *ConvCutList = new TList();
        TList *ClusterCutList = new TList();
        TList *MesonCutList = new TList();
@@ -132,33 +223,41 @@ void AddTask_GammaConvCalo_pPb(  Int_t trainConfig = 1,  //change different set
                HeaderList->Add(Header3);
        }
 
+       EventCutList->SetOwner(kTRUE);
+       AliConvEventCuts **analysisEventCuts = new AliConvEventCuts*[numberOfCuts];
        ConvCutList->SetOwner(kTRUE);
-       AliConversionCuts **analysisCuts = new AliConversionCuts*[numberOfCuts];
+       AliConversionPhotonCuts **analysisCuts = new AliConversionPhotonCuts*[numberOfCuts];
        ClusterCutList->SetOwner(kTRUE);
        AliCaloPhotonCuts **analysisClusterCuts = new AliCaloPhotonCuts*[numberOfCuts];
        MesonCutList->SetOwner(kTRUE);
        AliConversionMesonCuts **analysisMesonCuts = new AliConversionMesonCuts*[numberOfCuts];
 
        for(Int_t i = 0; i<numberOfCuts; i++){
-               analysisCuts[i] = new AliConversionCuts();
-               analysisCuts[i]->InitializeCutsFromCutString(cutarray[i].Data());
+               analysisEventCuts[i] = new AliConvEventCuts();   
+               analysisEventCuts[i]->InitializeCutsFromCutString(eventCutArray[i].Data());
+               EventCutList->Add(analysisEventCuts[i]);
+               analysisEventCuts[i]->SetFillCutHistograms("",kFALSE);
+               
+               analysisCuts[i] = new AliConversionPhotonCuts();
+               analysisCuts[i]->InitializeCutsFromCutString(photonCutArray[i].Data());
+               analysisCuts[i]->SetIsHeavyIon(isHeavyIon);
                ConvCutList->Add(analysisCuts[i]);
                analysisCuts[i]->SetFillCutHistograms("",kFALSE);
-               
-               Printf("here %d %s\n", i, clustercutarray[i].Data() );
-               
+       
                analysisClusterCuts[i] = new AliCaloPhotonCuts();
-               analysisClusterCuts[i]->InitializeCutsFromCutString(clustercutarray[i].Data());
+               analysisClusterCuts[i]->InitializeCutsFromCutString(clusterCutArray[i].Data());
                ClusterCutList->Add(analysisClusterCuts[i]);
+        analysisClusterCuts[i]->SetExtendedMatching(enableExtendedMatching);
                analysisClusterCuts[i]->SetFillCutHistograms("");
                
                analysisMesonCuts[i] = new AliConversionMesonCuts();
                analysisMesonCuts[i]->InitializeCutsFromCutString(mesonCutArray[i].Data());
                MesonCutList->Add(analysisMesonCuts[i]);
                analysisMesonCuts[i]->SetFillCutHistograms("");
-               analysisCuts[i]->SetAcceptedHeader(HeaderList);
+               analysisEventCuts[i]->SetAcceptedHeader(HeaderList);
        }
 
+       task->SetEventCutList(numberOfCuts,EventCutList);
        task->SetConversionCutList(numberOfCuts,ConvCutList);
        task->SetCaloCutList(numberOfCuts,ClusterCutList);
        task->SetMesonCutList(numberOfCuts,MesonCutList);
@@ -166,6 +265,7 @@ void AddTask_GammaConvCalo_pPb(  Int_t trainConfig = 1,  //change different set
        task->SetDoMesonAnalysis(kTRUE);
        task->SetDoMesonQA(enableQAMesonTask); //Attention new switch for Pi0 QA
        task->SetDoPhotonQA(enableQAPhotonTask);  //Attention new switch small for Photon QA
+       task->SetDoClusterQA(1);  //Attention new switch small for Cluster QA
 
        //connect containers
        AliAnalysisDataContainer *coutput =