]>
Commit | Line | Data |
---|---|---|
ab5dc7f9 | 1 | AliAnalysisTask *AddTask_jbook_JPsi(Bool_t gridconf=kFALSE, |
2 | Bool_t hasMC=kFALSE, | |
34b225f8 | 3 | ULong64_t triggers=AliVEvent::kCentral | AliVEvent::kSemiCentral | AliVEvent::kMB) { |
bffbeda1 | 4 | |
8c06b662 | 5 | //get the current analysis manager |
6 | AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); | |
7 | if (!mgr) { | |
8 | Error("AddTask_jbook_JPsi", "No analysis manager found."); | |
9 | return 0; | |
10 | } | |
bffbeda1 | 11 | |
8c06b662 | 12 | //Do we have an MC handler? |
2d7910f3 | 13 | TString list = gSystem->Getenv("LIST"); |
ab5dc7f9 | 14 | if(!list.IsNull()) { |
15 | if( list.Contains("LHC10h") || list.Contains("LHC11h") ) hasMC=kFALSE; | |
16 | if( list.Contains("LHC11a10") || list.Contains("LHC12a17") ) hasMC=kTRUE; | |
17 | } | |
2d7910f3 | 18 | |
8c06b662 | 19 | //Do we have an AOD handler? |
20 | Bool_t isAOD=(mgr->GetInputEventHandler()->IsA()==AliAODInputHandler::Class() ? kTRUE : kFALSE); | |
94c26f30 | 21 | |
d6aec652 | 22 | // set AOD debug levels |
23 | if(isAOD) { | |
24 | mgr->AddClassDebug("AliAODTrack", AliLog::kFatal); | |
bffbeda1 | 25 | mgr->AddClassDebug("AliAODpidUtil", AliLog::kInfo); |
d6aec652 | 26 | } |
bffbeda1 | 27 | |
8c06b662 | 28 | //set config file name |
94c26f30 | 29 | TString configFile(""); |
30 | printf("%s \n",gSystem->pwd()); | |
31 | TString trainRoot=gSystem->Getenv("TRAIN_ROOT"); | |
32 | if (!trainRoot.IsNull()) | |
33 | configFile="$TRAIN_ROOT/jbook_jpsi/ConfigJpsi_jb_PbPb.C"; // gsi config | |
f6a71c64 | 34 | else if(!gSystem->Exec("alien_cp alien:///alice/cern.ch/user/j/jbook/PWGDQ/dielectron/macrosJPSI/ConfigJpsi_jb_PbPb.C .")) { |
35 | gSystem->Exec(Form("ls -l %s",gSystem->pwd())); | |
94c26f30 | 36 | configFile=Form("%s/ConfigJpsi_jb_PbPb.C",gSystem->pwd()); // alien config |
f6a71c64 | 37 | } |
38 | else { | |
39 | printf("ERROR: couldn't copy file %s from grid \n", | |
40 | "alien:///alice/cern.ch/user/j/jbook/PWGDQ/dielectron/macrosJPSI/ConfigJpsi_jb_PbPb.C"); | |
41 | return; | |
42 | } | |
94c26f30 | 43 | |
f6a71c64 | 44 | // using aliroot config |
94c26f30 | 45 | if(!gridconf) |
46 | configFile="$ALICE_ROOT/PWGDQ/dielectron/macrosJPSI/ConfigJpsi_jb_PbPb.C"; // aliroot config | |
8c06b662 | 47 | |
f6a71c64 | 48 | |
8c06b662 | 49 | //create task and add it to the manager |
51efbccb | 50 | AliAnalysisTaskMultiDielectron *task; |
94c26f30 | 51 | |
51efbccb | 52 | // trigger selection |
bffbeda1 | 53 | ULong64_t triggerSets[]={AliVEvent::kCentral , AliVEvent::kSemiCentral , AliVEvent::kMB, |
54 | AliVEvent::kCentral | AliVEvent::kSemiCentral | AliVEvent::kMB}; | |
51efbccb | 55 | const char* triggerNames[]={"Central","SemiCentral","MB","MB+Cent+SemiCent"}; |
8c06b662 | 56 | |
bffbeda1 | 57 | // find out the configured triggers |
58 | Int_t j=0; | |
59 | for(j=0; j<4; j++) { | |
60 | if(triggers!=triggerSets[j]) continue; | |
61 | else break; | |
62 | } | |
63 | ||
64 | // print task configuration | |
65 | printf("production: %s MC: %d \n", list.Data(),hasMC); | |
66 | printf("triggers: %s \n", triggerNames[j] ); | |
67 | printf("config: %s Grid: %d \n",configFile.Data(),gridconf); | |
68 | ||
eee1b2f2 | 69 | task = new AliAnalysisTaskMultiDielectron((Form("MultiDieJB_%s",triggerNames[j]))); |
2ed1b6ff | 70 | task->SetBeamEnergy(1380.); |
bffbeda1 | 71 | task->SetTriggerMask(triggers); |
c5af1b57 | 72 | //task->SetTriggerMask(AliVEvent::kMB); |
bffbeda1 | 73 | |
74 | if (!hasMC) task->UsePhysicsSelection(); | |
75 | mgr->AddTask(task); | |
76 | ||
77 | //load dielectron configuration file | |
78 | TString checkconfig="ConfigJpsi_jb_PbPb"; | |
79 | if (!gROOT->GetListOfGlobalFunctions()->FindObject(checkconfig.Data())) | |
80 | gROOT->LoadMacro(configFile.Data()); | |
81 | ||
82 | //add dielectron analysis with different cuts to the task | |
ab5dc7f9 | 83 | for (Int_t i=0; i<nDie; ++i) { //nDie defined in config file |
84 | AliDielectron *jpsi=ConfigJpsi_jb_PbPb(i,hasMC,triggers); | |
bffbeda1 | 85 | if (jpsi ) task->AddDielectron(jpsi); |
2f73de50 | 86 | if (jpsi ) printf(" %s added\n",jpsi->GetName()); |
51efbccb | 87 | } |
bffbeda1 | 88 | |
bffbeda1 | 89 | //create output container |
1c96a71e | 90 | TString containerName = "JPSI.root"; |
bffbeda1 | 91 | AliAnalysisDataContainer *cOutputHist1 = |
4c91dae0 | 92 | mgr->CreateContainer(Form("jbook_QA_%s",triggerNames[j]), |
bffbeda1 | 93 | TList::Class(), |
94 | AliAnalysisManager::kOutputContainer, | |
1c96a71e | 95 | containerName.Data()); |
bffbeda1 | 96 | |
97 | AliAnalysisDataContainer *cOutputHist2 = | |
4c91dae0 | 98 | mgr->CreateContainer(Form("jbook_CF_%s",triggerNames[j]), |
bffbeda1 | 99 | TList::Class(), |
100 | AliAnalysisManager::kOutputContainer, | |
1c96a71e | 101 | containerName.Data()); |
bffbeda1 | 102 | |
103 | AliAnalysisDataContainer *cOutputHist3 = | |
4c91dae0 | 104 | mgr->CreateContainer(Form("jbook_EventStat_%s",triggerNames[j]), |
bffbeda1 | 105 | TH1D::Class(), |
106 | AliAnalysisManager::kOutputContainer, | |
1c96a71e | 107 | containerName.Data()); |
bffbeda1 | 108 | |
109 | mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer()); | |
110 | // mgr->ConnectOutput(task, 0, coutput1 ); | |
111 | mgr->ConnectOutput(task, 1, cOutputHist1); | |
112 | mgr->ConnectOutput(task, 2, cOutputHist2); | |
113 | mgr->ConnectOutput(task, 3, cOutputHist3); | |
114 | ||
115 | return task; | |
8c06b662 | 116 | } |