]>
Commit | Line | Data |
---|---|---|
a3dde4ea | 1 | /* |
2 | Macro to test functionality of the AnliAnalysisTaskFiltered. | |
3 | To be used within UnitTest suit | |
4 | $ALICE_ROOT/test/testAliAnalysisTaskFiltered/AliAnalysisTaskFilteredTest.sh | |
5 | To test: | |
6 | 1.) CPU/Memory/Data volume | |
7 | 2.) Relative fracion of the information in exported trees | |
8 | 3.) Compression for points | |
9 | ||
10 | Author of test: | |
11 | marian.ivanov@cern.ch | |
12 | ||
13 | */ | |
14 | void CheckOutput(); | |
15 | void AliAnalysisTaskFilteredTest( const char* esdList, | |
16 | Float_t scalingTracks, | |
17 | Float_t scalingV0, | |
18 | Float_t scalingFriend, | |
19 | const char* ocdb , | |
20 | Int_t nFiles, | |
21 | Int_t firstFile, | |
22 | Int_t nEvents, | |
23 | Int_t firstEvent, | |
24 | Bool_t mc=kFALSE) | |
25 | { | |
26 | TStopwatch timer; | |
27 | timer.Start(); | |
28 | ||
29 | printf("\n\n\n"); | |
30 | printf("scalingTracks=%d\n",scalingTracks); | |
31 | printf("scalingV0=%d\n",scalingV0); | |
32 | printf("nFiles=%d\n",nFiles); | |
33 | ||
34 | gSystem->SetIncludePath("-I$ROOTSYS/include -I$ALICE_ROOT/include -I$ALICE_ROOT/ITS -I$ALICE_ROOT -I$ALICE_ROOT/TRD"); | |
35 | ||
36 | gSystem->Load("libANALYSIS"); | |
37 | gSystem->Load("libANALYSISalice"); | |
af472fff | 38 | gSystem->Load("libTender"); |
a3dde4ea | 39 | gSystem->Load("libCORRFW"); |
40 | gSystem->Load("libPWGUDbase"); | |
41 | gSystem->Load("libTPCcalib"); | |
42 | gSystem->Load("libPWGPP"); | |
43 | gSystem->Load("libPWGLFspectra"); | |
44 | ||
45 | //____________________________________________// | |
46 | // Make the analysis manager | |
47 | AliAnalysisManager *mgr = new AliAnalysisManager("TestManager"); | |
48 | mgr->SetDebugLevel(0); | |
49 | ||
50 | AliESDInputHandler* esdH = new AliESDInputHandler(); | |
51 | //esdH->SetReadFriends(1); | |
52 | esdH->SetReadFriends(1); | |
53 | mgr->SetInputEventHandler(esdH); | |
54 | ||
55 | // Enable MC event handler | |
56 | AliMCEventHandler* handlerMC = new AliMCEventHandler; | |
57 | //handler->SetReadTR(kFALSE); | |
58 | if (mc) mgr->SetMCtruthEventHandler(handlerMC); | |
59 | ||
60 | gROOT->LoadMacro("$ALICE_ROOT/PWGPP/PilotTrain/AddTaskCDBconnect.C"); | |
61 | AddTaskCDBconnect(ocdb); | |
62 | ||
63 | if (gSystem->AccessPathName("localOCDBaccessConfig.C", kFileExists)==0) { | |
64 | gROOT->LoadMacro("localOCDBaccessConfig.C"); | |
65 | localOCDBaccessConfig(); | |
66 | } | |
67 | // Create input chain | |
68 | gROOT->LoadMacro("$ALICE_ROOT/PWGUD/macros/CreateESDChain.C"); | |
69 | TChain* chain = CreateESDChain(esdList, nFiles,firstFile); | |
70 | ||
71 | if(!chain) { | |
72 | printf("ERROR: chain cannot be created\n"); | |
73 | return; | |
74 | } | |
75 | chain->Lookup(); | |
76 | // | |
77 | // Wagons to run | |
78 | // | |
79 | gROOT->LoadMacro("$ALICE_ROOT/PWGPP/macros/AddTaskFilteredTree.C"); | |
80 | AliAnalysisTaskFilteredTree* task = (AliAnalysisTaskFilteredTree*)AddTaskFilteredTree("Filtered.root"); | |
81 | task->SetLowPtTrackDownscaligF(scalingTracks); | |
82 | task->SetLowPtV0DownscaligF(scalingV0); | |
83 | task->SetFriendDownscaling(scalingFriend); | |
84 | task->SetUseESDfriends(kTRUE); | |
85 | // Init | |
86 | if (!mgr->InitAnalysis()) | |
87 | mgr->PrintStatus(); | |
88 | // | |
89 | // Run on dataset | |
90 | mgr->StartAnalysis("local",chain,nEvents, firstEvent); | |
91 | timer.Stop(); | |
92 | timer.Print(); | |
93 | delete mgr; | |
94 | CheckOutput(); | |
95 | } | |
96 | ||
97 | ||
98 | void CheckOutput(){ | |
99 | // | |
100 | // | |
101 | // | |
102 | TFile * f = TFile::Open("Filtered.root"); | |
103 | TTree * highPt = (TTree*)f->Get("highPt"); | |
104 | TTree * treeV0s = (TTree*)f->Get("V0s"); | |
105 | // | |
106 | // Export variable: | |
107 | // | |
108 | Double_t ratioHighPtV0Entries=treeV0s->GetEntries()/Double_t(treeV0s->GetEntries()+highPt->GetEntries()+0.000001); | |
109 | Double_t ratioHighPtV0Size=treeV0s->GetZipBytes()/Double_t(treeV0s->GetZipBytes()+highPt->GetZipBytes()+0.000001); | |
110 | printf("#UnitTest:\tAliAnalysisTaskFiltered\tRatioPtToV0Entries\t%f\n",ratioHighPtV0Entries); | |
111 | printf("#UnitTest:\tAliAnalysisTaskFiltered\tRatioPtToV0Size\t%f\n",ratioHighPtV0Size); | |
112 | // | |
113 | // | |
114 | Double_t ratioPointsV0 = 2*treeV0s->GetBranch("friendTrack0.fCalibContainer")->GetZipBytes()/Double_t(0.00001+treeV0s->GetZipBytes()); | |
115 | Double_t ratioPointsHighPt = highPt->GetBranch("friendTrack.fCalibContainer")->GetZipBytes()/Double_t(0.00001+highPt->GetZipBytes()); | |
116 | printf("#UnitTest:\tAliAnalysisTaskFiltered\tRatioPointsV0\t%f\n",ratioPointsV0); | |
117 | printf("#UnitTest:\tAliAnalysisTaskFiltered\tRatioPointsHighPt\t%f\n",ratioPointsHighPt); | |
dfd5cb6f | 118 | // |
119 | // a.) Check track correspondence | |
120 | // | |
121 | Int_t entries= highPt->Draw("(friendTrack.fTPCOut.fP[3]-esdTrack.fIp.fP[3])/sqrt(friendTrack.fTPCOut.fC[9]+esdTrack.fIp.fC[9])","friendTrack.fTPCOut.fP[3]!=0",""); | |
122 | // here we should check if the tracks | |
123 | Double_t pulls=TMath::RMS(entries, highPt->GetV1()); | |
124 | printf("#UnitTest:\tAliAnalysisTaskFiltered\tFriendPull\t%2.4f\n",pulls); | |
125 | printf("#UnitTest:\tAliAnalysisTaskFiltered\tFriendOK\t%d\n",pulls<10); | |
a3dde4ea | 126 | |
127 | } |