adding the option for hybrid tracks global+global constrained as well as global+TPC...
[u/mrichter/AliRoot.git] / PWG4 / macros / runESDQA.C
1 void runESDQA()
2 {
3     gSystem->Load("libTree.so");
4     gSystem->Load("libGeom.so");
5     gSystem->Load("libVMC.so");
6     gSystem->Load("libXMLIO.so");
7
8     gSystem->Load("libSTEERBase.so");
9     gSystem->Load("libESD.so");
10     gSystem->Load("libAOD.so");
11     gSystem->Load("libANALYSIS.so");
12     gSystem->Load("libANALYSISalice.so");
13     gSystem->Load("libJETAN.so");
14     gSystem->Load("libPWG4JetTasks.so");
15 #if 0
16     SetupPar("STEERBase");
17     SetupPar("ESD");
18     SetupPar("AOD");    
19     SetupPar("ANALYSIS");
20     SetupPar("ANALYSISalice");
21 #endif
22
23     TGrid::Connect("alien://");
24     AliTagAnalysis *analysis = new AliTagAnalysis();
25     //TChain *chain = analysis->GetChainFromCollection("pythia_10tev_10files.xml","esdTree");
26     TChain *chain = analysis->GetChainFromCollection("pythia_10tev_ph2_10files.xml","esdTree");
27     
28     // Make the analysis manager
29
30     //
31     // Chain from CAF
32
33     AliESDInputHandler *esdHandler = new AliESDInputHandler();
34     esdHandler->SetInactiveBranches("FMD CaloCluster");
35     
36     AliAnalysisManager *mgr  = new AliAnalysisManager("esd to aod to histos", "testing aod analysis");
37     mgr->SetInputEventHandler(esdHandler);
38
39     mgr->SetDebugLevel(10);
40     AliLog::EnableDebug(kTRUE);
41     AliLog::SetGlobalLogLevel(2);
42
43
44     // Set of cuts
45     // 
46     // standard
47     /*
48     AliESDtrackCuts* esdTrackCutsL = new AliESDtrackCuts("AliESDtrackCuts", "Loose");
49     esdTrackCutsL->SetMinNClustersTPC(50);
50     esdTrackCutsL->SetMaxChi2PerClusterTPC(3.5);
51     esdTrackCutsL->SetMaxCovDiagonalElements(2,2,0.5,0.5,2);
52     esdTrackCutsL->SetRequireTPCRefit(kTRUE);
53     esdTrackCutsL->SetMinNsigmaToVertex(3);
54     esdTrackCutsL->SetRequireSigmaToVertex(kTRUE);
55     esdTrackCutsL->SetAcceptKingDaughters(kFALSE);
56     //
57     // hard
58     AliESDtrackCuts* esdTrackCutsH = new AliESDtrackCuts("AliESDtrackCuts", "Hard");
59     esdTrackCutsH->SetMinNClustersTPC(100);
60     esdTrackCutsH->SetMaxChi2PerClusterTPC(2.0);
61     esdTrackCutsH->SetMaxCovDiagonalElements(2,2,0.5,0.5,2);
62     esdTrackCutsH->SetRequireTPCRefit(kTRUE);
63     esdTrackCutsH->SetMinNsigmaToVertex(2);
64     esdTrackCutsH->SetRequireSigmaToVertex(kTRUE);
65     esdTrackCutsH->SetAcceptKingDaughters(kFALSE);
66     //
67     AliAnalysisFilter* trackFilter = new AliAnalysisFilter("trackFilter");
68     trackFilter->AddCuts(esdTrackCutsL);
69     trackFilter->AddCuts(esdTrackCutsH);
70     //
71     AliAnalysisTaskESDfilter *esdfilter = new AliAnalysisTaskESDfilter("ESD Filter");
72     esdfilter->SetTrackFilter(trackFilter);
73     esdfilter->SetDebugLevel(10);
74     mgr->AddTask(esdfilter);
75 */
76
77     
78     // Take it from the library no need to compile directly
79     // Standalone does not need ANALYISalice/AOD/JETAN/PWG4JetsTasks
80     //    gProof->Load("AliAnaESDSpectraQA.cxx++g");
81
82
83     AliAnaESDSpectraQA *pwg4QA = new AliAnaESDSpectraQA("AliAnaSpectraQA");
84     mgr->AddTask(pwg4QA);
85
86     // Create containers for input/output
87     // Top ESD container
88     AliAnalysisDataContainer *cin_esd = mgr->GetCommonInputContainer();
89
90     // Histos
91     //AliAnalysisDataContainer *cout_hist = mgr->CreateContainer("qa_hists", TObjArray::Class(),
92     AliAnalysisDataContainer *cout_hist = mgr->CreateContainer("qa_hists", TList::Class(),
93                                                               AliAnalysisManager::kOutputContainer, "PWG4QAHists.root");
94
95     mgr->ConnectInput (pwg4QA,  0, cin_esd );
96     mgr->ConnectOutput (pwg4QA,  0, cout_hist );
97    //
98     // Run the analysis
99     //    
100     mgr->InitAnalysis();
101     mgr->PrintStatus();
102     mgr->StartAnalysis("local",chain);
103     delete mgr;
104 }
105
106 void SetupPar(char* pararchivename)
107 {
108     if (pararchivename) {
109         char processline[1024];
110         sprintf(processline,".! tar xvzf %s.par",pararchivename);
111         gROOT->ProcessLine(processline);
112         TString ocwd = gSystem->WorkingDirectory();
113         gSystem->ChangeDirectory(pararchivename);
114         
115         // check for BUILD.sh and execute
116         if (!gSystem->AccessPathName("PROOF-INF/BUILD.sh")) {
117             printf("*******************************\n");
118             printf("*** Building PAR archive    ***\n");
119             printf("*******************************\n");
120             
121             if (gSystem->Exec("PROOF-INF/BUILD.sh")) {
122                 Error("runProcess","Cannot Build the PAR Archive! - Abort!");
123                 return -1;
124             }
125         }
126         // check for SETUP.C and execute
127         if (!gSystem->AccessPathName("PROOF-INF/SETUP.C")) {
128             printf("*******************************\n");
129             printf("*** Setup PAR archive       ***\n");
130             printf("*******************************\n");
131             gROOT->Macro("PROOF-INF/SETUP.C");
132         }
133         
134         gSystem->ChangeDirectory(ocwd.Data());
135         printf("Current dir: %s\n", ocwd.Data());
136     } 
137 }