TENDER becomes Tender
[u/mrichter/AliRoot.git] / PWGPP / macros / RecoQAtrain.C
CommitLineData
604d6f7e 1// RS: This is macro to build an analysis train which will run from the reco loop
2// Uses special AliRecoInputHandler
3// Should be attached in rec.C as
4// AliReconstruction rec; rec.SetAnalysisMacro(thisMacroPath);
5
6void LoadLibraries();
6a5f5ccc 7void AddAnalysisTasks(Bool_t writeITSTP=kFALSE, Bool_t useTPCcrv=kFALSE);
604d6f7e 8
9
6a5f5ccc 10void RecoQAtrain(Bool_t writeITSTP=kFALSE, Bool_t useTPCcrv=kFALSE)
604d6f7e 11{
12 //
13 TGrid::Connect("alien://");
14 if (!gGrid || !gGrid->IsConnected()) {
15 ::Error("QAtrain", "No grid connection");
16 return;
17 }
18 // Set temporary merging directory to current one
19 gSystem->Setenv("TMPDIR", gSystem->pwd());
20 // Set temporary compilation directory to current one
21 gSystem->SetBuildDir(gSystem->pwd(), kTRUE);
22 // Load libraries
23 LoadLibraries();
24 printf("Include path: %s\n", gSystem->GetIncludePath());
25 // Create manager
26 AliAnalysisManager *mgr = new AliAnalysisManager("Analysis", "Reco QA train");
27 // Input handler
28 AliRecoInputHandler *esdHandler = new AliRecoInputHandler();
29 esdHandler->SetReadFriends(kTRUE);
30 esdHandler->SetActiveBranches("ESDfriend");
31 mgr->SetInputEventHandler(esdHandler);
32 //
33 // AnalysisTasks
6a5f5ccc 34 AddAnalysisTasks(writeITSTP,useTPCcrv);
604d6f7e 35 //
36 if (!mgr->InitAnalysis()) printf("Failed to initialize Reco Analysis");
37}
38
39void LoadLibraries()
40{
2bfe5463 41 gSystem->SetIncludePath("-I. -I$ROOTSYS/include -I$ALICE_ROOT/include -I$ALICE_ROOT -I$ALICE_ROOT/ITS -I$ALICE_ROOT/TRD -I$ALICE_ROOT/PWGPP -I$ALICE_ROOT/PWGPP/TRD");
604d6f7e 42 gSystem->Load("libANALYSIS");
43 gSystem->Load("libANALYSISalice");
44 gSystem->Load("libCORRFW");
af472fff 45 gSystem->Load("libTender");
6a5f5ccc 46 // gSystem->Load("libPWG0base.so");
47 // gSystem->Load("libPWG0dep.so");
48 // gSystem->Load("libPWG0selectors.so");
2bfe5463 49 gSystem->Load("libPWGPP.so");
604d6f7e 50}
51
6a5f5ccc 52void AddAnalysisTasks(Bool_t writeITSTP, Bool_t useTPCcrv)
604d6f7e 53{
54 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
55 mgr->SetCommonFileName("RecoQAresults.root");
56 //
57 // Event Statistics (Jan Fiete)
58 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C");
59 AliPhysicsSelectionTask* physSelTask = AddTaskPhysicsSelection(kFALSE /*MC*/);
60 //
61 // add standard ITSAlignQA task with only SDD calibration histos activated
2bfe5463 62 gROOT->LoadMacro("$ALICE_ROOT/PWGPP/macros/AddTaskITSAlign.C");
604d6f7e 63 AliAnalysisTaskITSAlignQA *itsAlign = AddTaskITSAlign(0,2011,kTRUE);
64 itsAlign->SetLoadGeometryFromOCDB(kFALSE);
65 itsAlign->SetDoSPDResiduals(kFALSE);
66 itsAlign->SetDoSDDResiduals(kFALSE);
67 itsAlign->SetDoSSDResiduals(kFALSE);
68 itsAlign->SetDoSDDDriftTime(kFALSE);
69 itsAlign->SetMinMaxMult(20.,1070.);
6a5f5ccc 70 itsAlign->SetUseTPCMomentum(useTPCcrv);
6a5f5ccc 71 itsAlign->SetDoFillTPTree(writeITSTP);
c607d68d 72 //
73 if (writeITSTP) {
74 AliAnalysisDataContainer *coutputTP = mgr->CreateContainer("ITSSumTP",
75 TTree::Class(),
76 AliAnalysisManager::kOutputContainer,
77 "AODtpITS.root" );
78 mgr->ConnectOutput(itsAlign, 2, coutputTP);
79 }
80 //
604d6f7e 81}