AliPhysics  ef3b16e (ef3b16e)
AliAnalysisTaskFilteredTest.C
Go to the documentation of this file.
1 
16 void CheckOutput();
17 
18 void AliAnalysisTaskFilteredTest(const char *esdList,
19  Int_t run = 0,
20  Float_t scalingTracks = 1,
21  Float_t scalingV0 = 1,
22  Float_t scalingFriend = 1,
23  const char *ocdb = "cvmfs://",
24  Int_t nFiles = 100000,
25  Int_t firstFile = 0,
26  Int_t nEvents = 1000000000,
27  Int_t firstEvent = 0,
28  Bool_t mc = kFALSE)
29 {
30  TStopwatch timer;
31  timer.Start();
32 
33  printf("\n\n\n");
34  printf("scalingTracks=%d\n",scalingTracks);
35  printf("scalingV0=%d\n",scalingV0);
36  printf("nFiles=%d\n",nFiles);
37 
38  gSystem->SetIncludePath("-I$ROOTSYS/include -I$ALICE_ROOT/include -I$ALICE_ROOT/ITS -I$ALICE_ROOT -I$ALICE_ROOT/TRD");
39 
40  //____________________________________________//
41  // Make the analysis manager
42  AliAnalysisManager *mgr = new AliAnalysisManager("TestManager");
43  mgr->SetDebugLevel(0);
44 
45  AliESDInputHandler* esdH = new AliESDInputHandler();
46  //esdH->SetReadFriends(1);
47  esdH->SetReadFriends(1);
48  mgr->SetInputEventHandler(esdH);
49 
50  // Enable MC event handler
51  AliMCEventHandler* handlerMC = new AliMCEventHandler;
52  //handler->SetReadTR(kFALSE);
53  if (mc) mgr->SetMCtruthEventHandler(handlerMC);
54 
55  gROOT->LoadMacro("$ALICE_PHYSICS/PWGPP/PilotTrain/AddTaskCDBconnect.C");
56  AddTaskCDBconnect(ocdb,run);
57 
58  if (gSystem->AccessPathName("localOCDBaccessConfig.C", kFileExists)==0) {
59  gROOT->LoadMacro("localOCDBaccessConfig.C");
60  localOCDBaccessConfig();
61  }
62  // Create input chain
63  TChain* chain = AliXRDPROOFtoolkit::MakeChain(esdList, "esdTree",0,nFiles,firstFile);
64 
65  if(!chain) {
66  printf("ERROR: chain cannot be created\n");
67  return;
68  }
69  chain->Lookup();
70 
71 
72  gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
73  Bool_t isMC=kFALSE; // kTRUE in case of MC
74  AddTaskPIDResponse(isMC);
75 
76  //
77  // Wagons to run
78  //
79  gROOT->LoadMacro("$ALICE_PHYSICS/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  task->Dump();
86  // Init
87  if (!mgr->InitAnalysis())
88  mgr->PrintStatus();
89  //
90  // Run on dataset
91  mgr->StartAnalysis("local",chain,nEvents, firstEvent);
92  timer.Stop();
93  timer.Print();
94  delete mgr;
95  CheckOutput();
96 }
97 
98 
99 void CheckOutput(){
100  //
101  //
102  //
103  TFile * f = TFile::Open("Filtered.root");
104  TTree * highPt = (TTree*)f->Get("highPt");
105  TTree * treeV0s = (TTree*)f->Get("V0s");
106  //
107  // Export variable:
108  //
109  Double_t ratioHighPtV0Entries=treeV0s->GetEntries()/Double_t(treeV0s->GetEntries()+highPt->GetEntries()+0.000001);
110  Double_t ratioHighPtV0Size=treeV0s->GetZipBytes()/Double_t(treeV0s->GetZipBytes()+highPt->GetZipBytes()+0.000001);
111  printf("#UnitTest:\tAliAnalysisTaskFiltered\tRatioPtToV0Entries\t%f\n",ratioHighPtV0Entries);
112  printf("#UnitTest:\tAliAnalysisTaskFiltered\tRatioPtToV0Size\t%f\n",ratioHighPtV0Size);
113  //
114  //
115  Double_t ratioPointsV0 = 2*treeV0s->GetBranch("friendTrack0.fCalibContainer")->GetZipBytes()/Double_t(0.00001+treeV0s->GetZipBytes());
116  Double_t ratioPointsHighPt = highPt->GetBranch("friendTrack.fCalibContainer")->GetZipBytes()/Double_t(0.00001+highPt->GetZipBytes());
117  printf("#UnitTest:\tAliAnalysisTaskFiltered\tRatioPointsV0\t%f\n",ratioPointsV0);
118  printf("#UnitTest:\tAliAnalysisTaskFiltered\tRatioPointsHighPt\t%f\n",ratioPointsHighPt);
119  //
120  // a.) Check track correspondence
121  //
122  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","");
123  // here we should check if the tracks
124  Double_t pulls=TMath::RMS(entries, highPt->GetV1());
125  printf("#UnitTest:\tAliAnalysisTaskFiltered\tFriendPull\t%2.4f\n",pulls);
126  printf("#UnitTest:\tAliAnalysisTaskFiltered\tFriendOK\t%d\n",pulls<10);
127 
128 }
TChain * MakeChain(const char *what, const char *datadir, bool recursive=false)
Definition: MakeChain.C:151
double Double_t
Definition: External.C:58
TSystem * gSystem
void AliAnalysisTaskFilteredTest(const char *esdList, Int_t run=0, Float_t scalingTracks=1, Float_t scalingV0=1, Float_t scalingFriend=1, const char *ocdb="cvmfs://", Int_t nFiles=100000, Int_t firstFile=0, Int_t nEvents=1000000000, Int_t firstEvent=0, Bool_t mc=kFALSE)
int Int_t
Definition: External.C:63
float Float_t
Definition: External.C:68
Double_t nEvents
plot quality messages
void CheckOutput()
Test of AliAnalysisTaskFiltered class
Bool_t isMC
bool Bool_t
Definition: External.C:53