Updating ITS macros (Ruben)
[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");
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 //
6a5f5ccc 57 if (writeITSTP) {
58 AliAODHandler* aodHandler = new AliAODHandler();
59 aodHandler->SetOutputFileName( "AODtpITS.root" );
60 aodHandler->SetCreateNonStandardAOD();
61 mgr->SetOutputEventHandler(aodHandler);
62 }
63 //
604d6f7e 64 // Event Statistics (Jan Fiete)
65 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C");
66 AliPhysicsSelectionTask* physSelTask = AddTaskPhysicsSelection(kFALSE /*MC*/);
67 //
68 // add standard ITSAlignQA task with only SDD calibration histos activated
2bfe5463 69 gROOT->LoadMacro("$ALICE_ROOT/PWGPP/macros/AddTaskITSAlign.C");
604d6f7e 70 AliAnalysisTaskITSAlignQA *itsAlign = AddTaskITSAlign(0,2011,kTRUE);
71 itsAlign->SetLoadGeometryFromOCDB(kFALSE);
72 itsAlign->SetDoSPDResiduals(kFALSE);
73 itsAlign->SetDoSDDResiduals(kFALSE);
74 itsAlign->SetDoSSDResiduals(kFALSE);
75 itsAlign->SetDoSDDDriftTime(kFALSE);
76 itsAlign->SetMinMaxMult(20.,1070.);
6a5f5ccc 77 itsAlign->SetUseTPCMomentum(useTPCcrv);
604d6f7e 78 //
6a5f5ccc 79 itsAlign->SetDoFillTPTree(writeITSTP);
604d6f7e 80}