]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGDQ/dielectron/macrosJPSI/AddTaskJPSIFilter_pp.C
including switch to set on/off iso-track core removal, cleaning and bug fix
[u/mrichter/AliRoot.git] / PWGDQ / dielectron / macrosJPSI / AddTaskJPSIFilter_pp.C
CommitLineData
2abd10b7 1AliAnalysisTask *AddTaskJPSIFilter_pp(TString cfg="ConfigJpsi_nano_pp.C",
2 Bool_t gridconf=kFALSE,
3 ULong64_t triggers=AliVEvent::kCentral | AliVEvent::kSemiCentral | AliVEvent::kMB,
4 TString period="",
5 Bool_t storeLS = kFALSE,
6 Bool_t hasMC_aod = kFALSE){
7 //get the current analysis manager
8 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
9 if (!mgr) {
10 Error("AddTaskJPSIFilter", "No analysis manager found.");
11 return 0;
12 }
13
14 //check for output aod handler
15 if (!mgr->GetOutputEventHandler()||mgr->GetOutputEventHandler()->IsA()!=AliAODHandler::Class()) {
16 Warning("AddTaskJPSIFilter","No AOD output handler available. Not adding the task!");
17 return 0;
18 }
19
20 //Do we have an MC handler?
21 Bool_t hasMC=(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()!=0x0)||hasMC_aod;
22
23 //Do we run on AOD?
24 Bool_t isAOD=mgr->GetInputEventHandler()->IsA()==AliAODInputHandler::Class();
25
26 //Allow merging of the filtered aods on grid trains
27 if(mgr->GetGridHandler()) {
28 printf(" SET MERGE FILTERED AODs \n");
29 //mgr->GetGridHandler()->SetMergeAOD(kTRUE);
30 }
31
32 //set config file name
33 TString configFile("");
34 printf("%s \n",gSystem->pwd());
35 TString trainRoot=gSystem->Getenv("TRAIN_ROOT");
36 if(cfg.IsNull()) cfg="ConfigJpsi_jb_PbPb.C";
37
38 // the different paths
39 TString alienPath("alien:///alice/cern.ch/user/j/jbook/PWGDQ/dielectron/macrosJPSI");
40 TString alirootPath("$ALICE_ROOT/PWGDQ/dielectron/macrosJPSI/");
41
42 ////////// >>>>>>>>>> alien config
43 if(gridconf && !gSystem->Exec(Form("alien_cp %s/%s .",alienPath.Data(),cfg.Data()))) {
44 gSystem->Exec(Form("ls -l %s",gSystem->pwd()));
45 configFile=gSystem->pwd();
46 }
47 else {
48 printf("ERROR: couldn't copy file %s/%s from grid \n", alienPath.Data(),cfg.Data() );
49 return;
50 }
51 ///////// >>>>>>>>> aliroot config
52 if(!gridconf) configFile=alirootPath.Data();
53 ///////// add config to path
54 configFile+="/";
55 configFile+=cfg.Data();
56
57
58 //gROOT->LoadMacro("$ALICE_ROOT/PWGDQ/dielectron/macros/ConfigBJpsi_ff_PbPbFilter.C");
59 // gROOT->LoadMacro("$ALICE_ROOT/PWGDQ/dielectron/macrosJPSI/ConfigBJpsi_ff_PbPbFilter.C");
60 // gROOT->LoadMacro("$ALICE_ROOT/PWGDQ/dielectron/macrosJPSI/ConfigJpsi_nano_PbPb.C");
61
62 //load dielectron configuration file (only once)
63 // TString checkconfig="ConfigJpsi_jb_PbPb";
64 if (!gROOT->GetListOfGlobalFunctions()->FindObject(cfg.Data()))
65 gROOT->LoadMacro(configFile.Data());
66
67 AliDielectron *jpsi=ConfigJpsi_nano_pp(0,hasMC,period);
68
69 if(isAOD) {
70 //add options to AliAODHandler to duplicate input event
71 AliAODHandler *aodHandler = (AliAODHandler*)mgr->GetOutputEventHandler();
72 aodHandler->SetCreateNonStandardAOD();
73 aodHandler->SetNeedsHeaderReplication();
74 if(!period.Contains("LHC10h")) aodHandler->SetNeedsTOFHeaderReplication();
75 aodHandler->SetNeedsVZEROReplication();
76 /*aodHandler->SetNeedsTracksBranchReplication();
77 aodHandler->SetNeedsCaloClustersBranchReplication();
78 aodHandler->SetNeedsVerticesBranchReplication();
79 aodHandler->SetNeedsCascadesBranchReplication();
80 aodHandler->SetNeedsTrackletsBranchReplication();
81 aodHandler->SetNeedsPMDClustersBranchReplication();
82 aodHandler->SetNeedsJetsBranchReplication();
83 aodHandler->SetNeedsFMDClustersBranchReplication();
84 //aodHandler->SetNeedsMCParticlesBranchReplication();
85 aodHandler->SetNeedsDimuonsBranchReplication();*/
86 // if(hasMC) aodHandler->SetNeedsV0sBranchReplication();
87 if(hasMC) aodHandler->SetNeedsMCParticlesBranchReplication();
88 jpsi->SetHasMC(hasMC);
89 }
90
91 //Create task and add it to the analysis manager
92 AliAnalysisTaskDielectronFilter *task=new AliAnalysisTaskDielectronFilter("jpsi_DielectronFilter");
93 task->SetTriggerMask(triggers);
94 // task->SetTriggerMask(AliVEvent::kMB+AliVEvent::kCentral+AliVEvent::kSemiCentral+AliVEvent::kEMCEGA+AliVEvent::kEMCEJE);
95 // task->SetTriggerMask(AliVEvent::kMB+AliVEvent::kCentral+AliVEvent::kSemiCentral);
96 if (!hasMC) task->UsePhysicsSelection();
97
98 // //Add event filter
99 // AliDielectronEventCuts *eventCuts=new AliDielectronEventCuts("eventCuts","Vertex Track && |vtxZ|<10 && ncontrib>0");
100 // if(!hasMC) eventCuts->SetRequireVertex();
101 // if (isAOD) eventCuts->SetVertexType(AliDielectronEventCuts::kVtxAny);
102 // eventCuts->SetMinVtxContributors(1);
103 // eventCuts->SetVertexZ(-10.,10.);
104 // eventCuts->SetCentralityRange(0.0,90.0);
105 // task->SetEventFilter(eventCuts);
106
107 task->SetDielectron(jpsi);
108 if(storeLS) task->SetStoreLikeSignCandidates(storeLS);
109 task->SetCreateNanoAODs(kTRUE);
110 task->SetStoreEventsWithSingleTracks(kTRUE);
111 //task->SetStoreHeader(kTRUE);
112 mgr->AddTask(task);
113
114 //----------------------
115 //create data containers
116 //----------------------
117
118
119 TString containerName = mgr->GetCommonFileName();
120 containerName += ":PWGDQ_dielectronFilter";
121
122 //create output container
123
124 AliAnalysisDataContainer *cOutputHist1 =
125 mgr->CreateContainer("jpsi_FilterQA",
126 THashList::Class(),
127 AliAnalysisManager::kOutputContainer,
128 containerName.Data());
129
130 AliAnalysisDataContainer *cOutputHist2 =
131 mgr->CreateContainer("jpsi_FilterEventStat",
132 TH1D::Class(),
133 AliAnalysisManager::kOutputContainer,
134 containerName.Data());
135
136
137 mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
138 mgr->ConnectOutput(task, 0, mgr->GetCommonOutputContainer());
139 mgr->ConnectOutput(task, 1, cOutputHist1);
140 mgr->ConnectOutput(task, 2, cOutputHist2);
141
142 return task;
143}