Changed AddTasks
authorFriederike Bock <fbock@cern.ch>
Wed, 8 Jan 2014 19:33:28 +0000 (20:33 +0100)
committerFriederike Bock <fbock@cern.ch>
Wed, 8 Jan 2014 19:33:28 +0000 (20:33 +0100)
PWGGA/GammaConv/AliAnalysisTaskGammaConvV1.cxx
PWGGA/GammaConv/AliAnalysisTaskGammaConvV1.h
PWGGA/GammaConv/AliConversionCuts.cxx
PWGGA/GammaConv/AliConversionCuts.h
PWGGA/GammaConv/AliDalitzElectronCuts.cxx
PWGGA/GammaConv/macros/AddTask_GammaConvV1_PbPb.C
PWGGA/GammaConv/macros/AddTask_GammaConvV1_PbPb2.C
PWGGA/GammaConv/macros/AddTask_GammaConvV1_pPb2.C [new file with mode: 0644]

index 0955548..c95cab1 100644 (file)
@@ -180,7 +180,7 @@ AliAnalysisTaskGammaConvV1::AliAnalysisTaskGammaConvV1(): AliAnalysisTaskSE(),
    fnCuts(0),
    fiCut(0),
    fMoveParticleAccordingToVertex(kTRUE),
-   fIsHeavyIon(kFALSE),
+   fIsHeavyIon(0),
    fDoMesonAnalysis(kTRUE),
    fDoMesonQA(0),
    fDoPhotonQA(0),
@@ -314,7 +314,7 @@ AliAnalysisTaskGammaConvV1::AliAnalysisTaskGammaConvV1(const char *name):
    fnCuts(0),
    fiCut(0),
    fMoveParticleAccordingToVertex(kTRUE),
-   fIsHeavyIon(kFALSE),
+   fIsHeavyIon(0),
    fDoMesonAnalysis(kTRUE),
    fDoMesonQA(0),
    fDoPhotonQA(0),
@@ -498,14 +498,18 @@ void AliAnalysisTaskGammaConvV1::UserCreateOutputObjects()
       hNEvents[iCut]->GetXaxis()->SetBinLabel(8,"no SDD");
       hNEvents[iCut]->GetXaxis()->SetBinLabel(9,"no V0AND");
       fESDList[iCut]->Add(hNEvents[iCut]);
-      if(fIsHeavyIon) hNGoodESDTracks[iCut] = new TH1I("GoodESDTracks","GoodESDTracks",4000,0,4000);
+      
+      if(fIsHeavyIon == 1) hNGoodESDTracks[iCut] = new TH1I("GoodESDTracks","GoodESDTracks",4000,0,4000);
+      else if(fIsHeavyIon == 2) hNGoodESDTracks[iCut] = new TH1I("GoodESDTracks","GoodESDTracks",400,0,400);
       else hNGoodESDTracks[iCut] = new TH1I("GoodESDTracks","GoodESDTracks",200,0,200);
       fESDList[iCut]->Add(hNGoodESDTracks[iCut]);
-      if(fIsHeavyIon) hNGammaCandidates[iCut] = new TH1I("GammaCandidates","GammaCandidates",100,0,100);
+      if(fIsHeavyIon == 1) hNGammaCandidates[iCut] = new TH1I("GammaCandidates","GammaCandidates",100,0,100);
+      else if(fIsHeavyIon == 2) hNGammaCandidates[iCut] = new TH1I("GammaCandidates","GammaCandidates",50,0,50);
       else hNGammaCandidates[iCut] = new TH1I("GammaCandidates","GammaCandidates",50,0,50);
       fESDList[iCut]->Add(hNGammaCandidates[iCut]);
-      if(fIsHeavyIon) hNV0Tracks[iCut] = new TH1I("V0 Multiplicity","V0 Multiplicity",30000,0,30000);
-      else hNV0Tracks[iCut] = new TH1I("V0 Multiplicity","V0 Multiplicity",2000,0,2000);
+      if(fIsHeavyIon == 1) hNV0Tracks[iCut] = new TH1I("V0 Multiplicity","V0 Multiplicity",30000,0,30000);
+      else if(fIsHeavyIon == 2) hNV0Tracks[iCut] = new TH1I("V0 Multiplicity","V0 Multiplicity",2500,0,2500);
+      else hNV0Tracks[iCut] = new TH1I("V0 Multiplicity","V0 Multiplicity",1500,0,1500);
       fESDList[iCut]->Add(hNV0Tracks[iCut]);
       hEtaShift[iCut] = new TProfile("Eta Shift","Eta Shift",1, -0.5,0.5);
       fESDList[iCut]->Add(hEtaShift[iCut]);
@@ -939,7 +943,7 @@ void AliAnalysisTaskGammaConvV1::UserExec(Option_t *)
    // ------------------- BeginEvent ----------------------------
 
    AliEventplane *EventPlane = fInputEvent->GetEventplane();
-   if(fIsHeavyIon)fEventPlaneAngle = EventPlane->GetEventplane("V0",fInputEvent,2);
+   if(fIsHeavyIon ==1)fEventPlaneAngle = EventPlane->GetEventplane("V0",fInputEvent,2);
    else fEventPlaneAngle=0.0;
    
    if(fIsMC && fInputEvent->IsA()==AliAODEvent::Class() && !(fV0Reader->AreAODsRelabeled())){
@@ -1096,7 +1100,7 @@ void AliAnalysisTaskGammaConvV1::ProcessPhotonCandidates()
                ProcessTruePhotonCandidatesAOD(PhotonCandidate);
          }
          if (fIsFromMBHeader && fDoPhotonQA == 2){
-            if (fIsHeavyIon && PhotonCandidate->Pt() > 0.399 && PhotonCandidate->Pt() < 12.){
+            if (fIsHeavyIon == 1 && PhotonCandidate->Pt() > 0.399 && PhotonCandidate->Pt() < 12.){
                fPtGamma = PhotonCandidate->Pt();
                fDCAzPhoton = PhotonCandidate->GetDCAzToPrimVtx();
                fRConvPhoton = PhotonCandidate->GetConversionRadius();
@@ -1152,7 +1156,7 @@ void AliAnalysisTaskGammaConvV1::ProcessPhotonCandidates()
          } else GammaCandidatesStepTwo->Add(PhotonCandidate); // Close v0s cut enabled -> add to list two
          
            if (fIsFromMBHeader && fDoPhotonQA == 2){
-            if (fIsHeavyIon && PhotonCandidate->Pt() > 0.399 && PhotonCandidate->Pt() < 12.){
+            if (fIsHeavyIon ==1 && PhotonCandidate->Pt() > 0.399 && PhotonCandidate->Pt() < 12.){
                fPtGamma = PhotonCandidate->Pt();
                fDCAzPhoton = PhotonCandidate->GetDCAzToPrimVtx();
                fRConvPhoton = PhotonCandidate->GetConversionRadius();
index 8922bc7..9a246a4 100644 (file)
@@ -27,11 +27,8 @@ class AliAnalysisTaskGammaConvV1 : public AliAnalysisTaskSE {
    void InitBack();
 
    void SetIsHeavyIon(Int_t flag){
-      if (flag == 1 || flag ==2 ){
-         fIsHeavyIon = 1;    
-      } else {
-         fIsHeavyIon = 0;    
-      }
+      fIsHeavyIon = flag;    
+      
    }
 
    void SetIsMC(Bool_t isMC){fIsMC=isMC;}
@@ -201,7 +198,7 @@ class AliAnalysisTaskGammaConvV1 : public AliAnalysisTaskSE {
    Int_t fnCuts;
    Int_t fiCut;
    Bool_t fMoveParticleAccordingToVertex;
-   Bool_t fIsHeavyIon;
+   Int_t fIsHeavyIon;
    Bool_t fDoMesonAnalysis;
    Int_t fDoMesonQA;
    Int_t fDoPhotonQA;
@@ -214,7 +211,7 @@ private:
    AliAnalysisTaskGammaConvV1 &operator=(const AliAnalysisTaskGammaConvV1&); // Prevent assignment
 
 
-   ClassDef(AliAnalysisTaskGammaConvV1, 9);
+   ClassDef(AliAnalysisTaskGammaConvV1, 10);
 };
 
 #endif
index 589befe..58bd89b 100644 (file)
@@ -85,7 +85,7 @@ const char* AliConversionCuts::fgkCutNames[AliConversionCuts::kNCuts] = {
    "SharedElectronCuts", //23
    "RejectToCloseV0s", //24
    "DcaRPrimVtx", //25
-   "DcaZPrimVtx" //26
+   "DcaZPrimVtx", //26
    "EvetPlane" //27
 };
 
@@ -3692,7 +3692,7 @@ void AliConversionCuts::GetNotRejectedParticles(Int_t rejection, TList *HeaderLi
             for(Int_t j = 0; j<HeaderList->GetEntries();j++){
                TString GeneratorInList = ((TObjString*)HeaderList->At(j))->GetString();
                if(GeneratorName.CompareTo(GeneratorInList) == 0){
-                  if (GeneratorInList.CompareTo("PARAM") == 0){
+                  if (GeneratorInList.CompareTo("PARAM") == 0 || GeneratorInList.CompareTo("BOX") == 0 ){
                      if(fMCStack){
                         if (fMCStack->Particle(firstindexA)->GetPdgCode() == 111 || fMCStack->Particle(firstindexA)->GetPdgCode() == 221 ) {
                            fnHeaders++;
@@ -3736,7 +3736,7 @@ void AliConversionCuts::GetNotRejectedParticles(Int_t rejection, TList *HeaderLi
          for(Int_t j = 0; j<HeaderList->GetEntries();j++){
             TString GeneratorInList = ((TObjString*)HeaderList->At(j))->GetString();
             if(GeneratorName.CompareTo(GeneratorInList) == 0){
-               if (GeneratorInList.CompareTo("PARAM") == 0){
+               if (GeneratorInList.CompareTo("PARAM") == 0 || GeneratorInList.CompareTo("BOX") == 0 ){
                   if(fMCStack){
                      if (fMCStack->Particle(firstindex)->GetPdgCode() == 111 || fMCStack->Particle(firstindex)->GetPdgCode() == 221 ) {
                         fNotRejectedStart[number] = firstindex;
@@ -3831,16 +3831,16 @@ Int_t AliConversionCuts::IsParticleFromBGEvent(Int_t index, AliStack *MCStack, A
    return accepted;
 }
 //_________________________________________________________________________
-Int_t AliConversionCuts::IsEventAcceptedByConversionCut(AliConversionCuts *ReaderCuts, AliVEvent *InputEvent, AliMCEvent *MCEvent, Bool_t isHeavyIon){
+Int_t AliConversionCuts::IsEventAcceptedByConversionCut(AliConversionCuts *ReaderCuts, AliVEvent *InputEvent, AliMCEvent *MCEvent, Int_t isHeavyIon){
 
    if ( !IsTriggerSelected(InputEvent) )
       return 3;
 
-   if(isHeavyIon && !(IsCentralitySelected(InputEvent,MCEvent)))
+   if(isHeavyIon != 0 && !(IsCentralitySelected(InputEvent,MCEvent)))
       return 1; // Check Centrality --> Not Accepted => eventQuality = 1
       
       
-   if(!isHeavyIon && GetIsFromPileup()){
+   if(isHeavyIon == 0 && GetIsFromPileup()){
       if(InputEvent->IsPileupFromSPD(3,0.8,3.,2.,5.)){
 
          return 6; // Check Pileup --> Not Accepted => eventQuality = 6
index 97850e9..c932eaf 100644 (file)
@@ -132,7 +132,7 @@ class AliConversionCuts : public AliAnalysisCuts {
    
    // Cut Selection
    Bool_t EventIsSelected(AliVEvent *fInputEvent, AliVEvent *fMCEvent);
-   Int_t IsEventAcceptedByConversionCut(AliConversionCuts *ReaderCuts, AliVEvent *InputEvent, AliMCEvent *MCEvent, Bool_t isHeavyIon);
+   Int_t IsEventAcceptedByConversionCut(AliConversionCuts *ReaderCuts, AliVEvent *InputEvent, AliMCEvent *MCEvent, Int_t isHeavyIon);
    Bool_t PhotonIsSelected(AliConversionPhotonBase * photon, AliVEvent  * event);
    Bool_t PhotonIsSelectedMC(TParticle *particle,AliStack *fMCStack,Bool_t checkForConvertedGamma=kTRUE);
    Bool_t PhotonIsSelectedAODMC(AliAODMCParticle *particle,TClonesArray *aodmcArray,Bool_t checkForConvertedGamma=kTRUE);
index 17606a8..ae70d95 100644 (file)
@@ -1559,7 +1559,13 @@ Bool_t AliDalitzElectronCuts::SetPsiPairCut(Int_t psiCut) {
         fDeltaPhiCutMin = 0.0;\r
         fDeltaPhiCutMax = 0.12;\r
         break;\r
-    \r
+  case 4:\r
+        fDoPsiPairCut = kTRUE;\r
+        fPsiPairCut = 0.30;\r
+        fDeltaPhiCutMin = 0.0;\r
+        fDeltaPhiCutMax = 0.12;\r
+        break;\r
+      \r
   default:\r
       cout<<"Warning: PsiPairCut not defined "<<fPsiPairCut<<endl;\r
       return kFALSE;\r
index 70f6e57..9c06e03 100644 (file)
@@ -481,6 +481,9 @@ void AddTask_GammaConvV1_PbPb(  Int_t trainConfig = 1,  //change different set o
    } else if (periodName.CompareTo("LHC12a17x_fix")==0){
       TObjString *Header1 = new TObjString("PARAM");
       HeaderList->Add(Header1);
+   } else if (periodName.CompareTo("LHC14a1x")==0){
+      TObjString *Header1 = new TObjString("BOX");
+      HeaderList->Add(Header1);
    }
    
    ConvCutList->SetOwner(kTRUE);
index 73122bc..f2cd82a 100644 (file)
@@ -158,6 +158,8 @@ void AddTask_GammaConvV1_PbPb2(  Int_t trainConfig = 1,  //change different set
       cutarray[ 0] = "5890001032092970023220000000"; mesonCutArray[ 0] = "01523065009000";    
    } else if (trainConfig == 31) { 
       cutarray[ 0] = "5080001002092970023220000000"; mesonCutArray[ 0] = "01525065009000";    
+   } else if (trainConfig == 32) { 
+      cutarray[ 0] = "5080002002092970023220000000"; mesonCutArray[ 0] = "01525065009000";    
    } else {
       Error(Form("GammaConvV1_%i",trainConfig), "wrong trainConfig variable no cuts have been specified for the configuration");
       return;
@@ -167,7 +169,7 @@ void AddTask_GammaConvV1_PbPb2(  Int_t trainConfig = 1,  //change different set
    TList *MesonCutList = new TList();
 
    TList *HeaderList = new TList();
-   TObjString *Header1 = new TObjString("pi0_1");
+   TObjString *Header1 = new TObjString("BOX");
    HeaderList->Add(Header1);
 //    TObjString *Header3 = new TObjString("eta_2");
 //    HeaderList->Add(Header3);
diff --git a/PWGGA/GammaConv/macros/AddTask_GammaConvV1_pPb2.C b/PWGGA/GammaConv/macros/AddTask_GammaConvV1_pPb2.C
new file mode 100644 (file)
index 0000000..145a493
--- /dev/null
@@ -0,0 +1,176 @@
+void AddTask_GammaConvV1_pPb2(  Int_t trainConfig = 1,  //change different set of cuts
+                              Bool_t isMC   = kFALSE, //run MC
+                              Int_t enableQAMesonTask = 0, //enable QA in AliAnalysisTaskGammaConvV1
+                              Int_t enableQAPhotonTask = 0, // enable additional QA task
+                              TString fileNameInputForWeighting = "MCSpectraInput.root", // path to file for weigting input
+                              Bool_t doWeighting = kFALSE,  //enable Weighting
+                              TString generatorName = "DPMJET",
+                              TString cutnumberAODBranch = "8000000060084000001500000" // cutnumber for AOD branch
+                           ) {
+   // ================= Load Librariers =================================
+   gSystem->Load("libCore.so");  
+   gSystem->Load("libTree.so");
+   gSystem->Load("libGeom.so");
+   gSystem->Load("libVMC.so");
+   gSystem->Load("libPhysics.so");
+   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");
+     
+   // ================== GetAnalysisManager ===============================
+   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+   if (!mgr) {
+      Error(Form("AddTask_GammaConvV1_%i",trainConfig), "No analysis manager found.");
+      return ;
+   }
+   // ================== GetInputEventHandler =============================
+   AliVEventHandler *inputHandler=mgr->GetInputEventHandler();
+   
+   //========= Add PID Reponse to ANALYSIS manager ====
+   if(!(AliPIDResponse*)mgr->GetTask("PIDResponseTask")){
+      gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
+      AddTaskPIDResponse(isMC);
+   }
+   
+   //=========  Set Cutnumber for V0Reader ================================
+   TString cutnumber = "8000000060084001001500000000";
+   Bool_t doEtaShift = kFALSE;
+   AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
+   //========= Add V0 Reader to  ANALYSIS manager if not yet existent =====
+   if( !(AliV0ReaderV1*)mgr->GetTask("V0ReaderV1") ){
+      AliV0ReaderV1 *fV0ReaderV1 = new AliV0ReaderV1("V0ReaderV1");
+     
+      fV0ReaderV1->SetUseOwnXYZCalculation(kTRUE);
+      fV0ReaderV1->SetCreateAODs(kFALSE);// AOD Output
+      fV0ReaderV1->SetUseAODConversionPhoton(kTRUE);
+     
+      if (!mgr) {
+         Error("AddTask_V0ReaderV1", "No analysis manager found.");
+         return;
+      }
+      // Set AnalysisCut Number
+      AliConversionCuts *fCuts=NULL;
+      if(cutnumber!=""){
+         fCuts= new AliConversionCuts(cutnumber.Data(),cutnumber.Data());
+         fCuts->SetPreSelectionCutFlag(kTRUE);
+         if(fCuts->InitializeCutsFromCutString(cutnumber.Data())){
+            fCuts->DoEtaShift(doEtaShift);
+            fV0ReaderV1->SetConversionCuts(fCuts);
+            fCuts->SetFillCutHistograms("",kTRUE);
+         }
+      }
+      if(inputHandler->IsA()==AliAODInputHandler::Class()){
+      // AOD mode
+         cout << "AOD handler: adding " << cutnumberAODBranch.Data() << " as conversion branch" << endl;
+         fV0ReaderV1->SetDeltaAODBranchName(Form("GammaConv_%s_gamma",cutnumberAODBranch.Data()));
+      }
+      fV0ReaderV1->Init();
+      AliLog::SetGlobalLogLevel(AliLog::kInfo);
+      //connect input V0Reader
+      mgr->AddTask(fV0ReaderV1);
+      mgr->ConnectInput(fV0ReaderV1,0,cinput);
+   }
+   //================================================
+   //========= Add task to the ANALYSIS manager =====
+   //================================================
+   //            find input container
+   AliAnalysisTaskGammaConvV1 *task=NULL;
+   task= new AliAnalysisTaskGammaConvV1(Form("GammaConvV1_%i",trainConfig));
+   task->SetIsHeavyIon(2);
+   task->SetIsMC(isMC);
+   // Cut Numbers to use in Analysis
+   Int_t numberOfCuts = 1;
+   TString *cutarray = new TString[numberOfCuts];
+   TString *mesonCutArray = new TString[numberOfCuts];
+   Bool_t doEtaShiftIndCuts = kFALSE;
+   TString stringShift = "";
+   if(trainConfig == 1){
+      // Shifting in pPb direction
+      cutarray[ 0] = "8000011002093172003290000000"; mesonCutArray[ 0] = "01621035009000"; 
+   } else if (trainConfig == 2) {
+      cutarray[ 0] = "8000011002092170008260400000"; mesonCutArray[ 0] = "01621035009000";
+   } else if (trainConfig == 3) {   
+      cutarray[ 0] = "8020011002092170008260400000"; mesonCutArray[ 0] = "01621035009000";      
+   } else if (trainConfig == 4) {   
+      cutarray[ 0] = "8240011002092170008260400000"; mesonCutArray[ 0] = "01621035009000";         
+   } else if (trainConfig == 5) {   
+      cutarray[ 0] = "8460011002092170008260400000"; mesonCutArray[ 0] = "01621035009000";         
+   } else if (trainConfig == 6) {   
+      cutarray[ 0] = "8680011002092170008260400000"; mesonCutArray[ 0] = "01621035009000";      
+   } else if (trainConfig == 7) {   
+      cutarray[ 0] = "8600011002092170008260400000"; mesonCutArray[ 0] = "01621035009000";         
+   } else {
+      Error(Form("GammaConvV1_%i",trainConfig), "wrong trainConfig variable no cuts have been specified for the configuration");
+      return;
+   }
+   TList *ConvCutList = new TList();
+   TList *MesonCutList = new TList();
+   TList *HeaderList = new TList();
+   TObjString *Header1 = new TObjString("pi0_1");
+   HeaderList->Add(Header1);
+   TObjString *Header3 = new TObjString("eta_2");
+   HeaderList->Add(Header3);
+   
+   ConvCutList->SetOwner(kTRUE);
+   AliConversionCuts **analysisCuts = new AliConversionCuts*[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());
+      if (doEtaShiftIndCuts) {
+         analysisCuts[i]->DoEtaShift(doEtaShiftIndCuts);
+         analysisCuts[i]->SetEtaShift(stringShift);
+      }
+     
+      ConvCutList->Add(analysisCuts[i]);
+         
+      analysisCuts[i]->SetFillCutHistograms("",kFALSE);
+      analysisMesonCuts[i] = new AliConversionMesonCuts();
+      analysisMesonCuts[i]->InitializeCutsFromCutString(mesonCutArray[i].Data());
+      MesonCutList->Add(analysisMesonCuts[i]);
+      analysisMesonCuts[i]->SetFillCutHistograms("");
+      analysisCuts[i]->SetAcceptedHeader(HeaderList);
+   }
+   task->SetConversionCutList(numberOfCuts,ConvCutList);
+   task->SetMesonCutList(numberOfCuts,MesonCutList);
+   task->SetMoveParticleAccordingToVertex(kTRUE);
+   task->SetDoMesonAnalysis(kTRUE);
+   task->SetDoMesonQA(enableQAMesonTask); //Attention new switch for Pi0 QA
+   task->SetDoPhotonQA(enableQAMesonTask);  //Attention new switch small for Photon QA
+   //connect containers
+   AliAnalysisDataContainer *coutput =
+      mgr->CreateContainer(Form("GammaConvV1_%i",trainConfig), TList::Class(),
+                           AliAnalysisManager::kOutputContainer,Form("GammaConvV1_%i.root",trainConfig));
+   mgr->AddTask(task);
+   mgr->ConnectInput(task,0,cinput);
+   mgr->ConnectOutput(task,1,coutput);
+   return;
+}