PWGPP-3, PWGPP-4, ATO-52 Typo fixed
authormivanov <marian.ivanov@cern.ch>
Thu, 12 Jun 2014 08:41:10 +0000 (10:41 +0200)
committermivanov <marian.ivanov@cern.ch>
Thu, 12 Jun 2014 08:41:10 +0000 (10:41 +0200)
test/testAliAnalysisTaskFiltered/AliAnalysisTaskFilteredTest.C [new file with mode: 0755]
test/testAliAnalysisTaskFiltered/AliAnalysisTaskFilteredTest.sh [new file with mode: 0755]

diff --git a/test/testAliAnalysisTaskFiltered/AliAnalysisTaskFilteredTest.C b/test/testAliAnalysisTaskFiltered/AliAnalysisTaskFilteredTest.C
new file mode 100755 (executable)
index 0000000..efb442a
--- /dev/null
@@ -0,0 +1,119 @@
+/*
+   Macro to test functionality of the AnliAnalysisTaskFiltered.
+   To be used within UnitTest suit
+   $ALICE_ROOT/test/testAliAnalysisTaskFiltered/AliAnalysisTaskFilteredTest.sh
+   To test:
+   1.) CPU/Memory/Data volume
+   2.) Relative fracion of the information in exported trees
+   3.) Compression for points
+
+   Author of test:
+   marian.ivanov@cern.ch
+   
+*/
+void CheckOutput();
+void AliAnalysisTaskFilteredTest( const char* esdList,   
+                      Float_t scalingTracks,
+                      Float_t scalingV0,
+                      Float_t scalingFriend,                  
+                      const char* ocdb ,
+                      Int_t nFiles,  
+                      Int_t firstFile, 
+                      Int_t nEvents, 
+                      Int_t firstEvent,
+                      Bool_t mc=kFALSE)
+{
+    TStopwatch timer;
+    timer.Start();
+
+    printf("\n\n\n");
+    printf("scalingTracks=%d\n",scalingTracks);
+    printf("scalingV0=%d\n",scalingV0);
+    printf("nFiles=%d\n",nFiles);
+
+    gSystem->SetIncludePath("-I$ROOTSYS/include -I$ALICE_ROOT/include -I$ALICE_ROOT/ITS -I$ALICE_ROOT -I$ALICE_ROOT/TRD");
+
+    gSystem->Load("libANALYSIS");
+    gSystem->Load("libANALYSISalice");
+    gSystem->Load("libTENDER");
+    gSystem->Load("libCORRFW");
+    gSystem->Load("libPWGUDbase");
+    gSystem->Load("libTPCcalib");
+    gSystem->Load("libPWGPP");
+    gSystem->Load("libPWGLFspectra");
+
+    //____________________________________________//
+    // Make the analysis manager
+    AliAnalysisManager *mgr = new AliAnalysisManager("TestManager");
+    mgr->SetDebugLevel(0);
+
+    AliESDInputHandler* esdH = new AliESDInputHandler();
+    //esdH->SetReadFriends(1);
+    esdH->SetReadFriends(1);
+    mgr->SetInputEventHandler(esdH);  
+
+    // Enable MC event handler
+    AliMCEventHandler* handlerMC = new AliMCEventHandler;
+    //handler->SetReadTR(kFALSE);
+    if (mc) mgr->SetMCtruthEventHandler(handlerMC);
+
+    gROOT->LoadMacro("$ALICE_ROOT/PWGPP/PilotTrain/AddTaskCDBconnect.C");
+    AddTaskCDBconnect(ocdb);
+
+    if (gSystem->AccessPathName("localOCDBaccessConfig.C", kFileExists)==0) {
+      gROOT->LoadMacro("localOCDBaccessConfig.C");
+      localOCDBaccessConfig();
+    }
+    // Create input chain
+    gROOT->LoadMacro("$ALICE_ROOT/PWGUD/macros/CreateESDChain.C");
+    TChain* chain = CreateESDChain(esdList, nFiles,firstFile);
+
+    if(!chain) {
+        printf("ERROR: chain cannot be created\n");
+        return;
+    }
+    chain->Lookup();
+    //
+    // Wagons to run 
+    //
+    gROOT->LoadMacro("$ALICE_ROOT/PWGPP/macros/AddTaskFilteredTree.C");
+    AliAnalysisTaskFilteredTree* task = (AliAnalysisTaskFilteredTree*)AddTaskFilteredTree("Filtered.root");
+    task->SetLowPtTrackDownscaligF(scalingTracks);
+    task->SetLowPtV0DownscaligF(scalingV0);
+    task->SetFriendDownscaling(scalingFriend);
+    task->SetUseESDfriends(kTRUE);
+    // Init
+    if (!mgr->InitAnalysis()) 
+        mgr->PrintStatus();
+    //
+    // Run on dataset
+    mgr->StartAnalysis("local",chain,nEvents, firstEvent);
+    timer.Stop();
+    timer.Print();
+    delete mgr;
+    CheckOutput();
+}
+
+
+void CheckOutput(){
+  //
+  //
+  //
+  TFile * f  = TFile::Open("Filtered.root");
+  TTree * highPt = (TTree*)f->Get("highPt");
+  TTree * treeV0s = (TTree*)f->Get("V0s");
+  //
+  // Export variable:
+  //
+  Double_t ratioHighPtV0Entries=treeV0s->GetEntries()/Double_t(treeV0s->GetEntries()+highPt->GetEntries()+0.000001);
+  Double_t ratioHighPtV0Size=treeV0s->GetZipBytes()/Double_t(treeV0s->GetZipBytes()+highPt->GetZipBytes()+0.000001);
+  printf("#UnitTest:\tAliAnalysisTaskFiltered\tRatioPtToV0Entries\t%f\n",ratioHighPtV0Entries);
+  printf("#UnitTest:\tAliAnalysisTaskFiltered\tRatioPtToV0Size\t%f\n",ratioHighPtV0Size);
+  //
+  //
+  Double_t ratioPointsV0 = 2*treeV0s->GetBranch("friendTrack0.fCalibContainer")->GetZipBytes()/Double_t(0.00001+treeV0s->GetZipBytes());
+  Double_t ratioPointsHighPt = highPt->GetBranch("friendTrack.fCalibContainer")->GetZipBytes()/Double_t(0.00001+highPt->GetZipBytes());
+  printf("#UnitTest:\tAliAnalysisTaskFiltered\tRatioPointsV0\t%f\n",ratioPointsV0);
+  printf("#UnitTest:\tAliAnalysisTaskFiltered\tRatioPointsHighPt\t%f\n",ratioPointsHighPt);
+
+}
diff --git a/test/testAliAnalysisTaskFiltered/AliAnalysisTaskFilteredTest.sh b/test/testAliAnalysisTaskFiltered/AliAnalysisTaskFilteredTest.sh
new file mode 100755 (executable)
index 0000000..732a694
--- /dev/null
@@ -0,0 +1,71 @@
+#!/bin/bash
+#######################################################################
+#
+# This script runs the test for the AliAnalysisTaskFiltered class 
+#
+#   Macro to test functionality of the AnaliAnalysisTaskFiltered.
+#   To be used within UnitTest suit
+#   $ALICE_ROOT/test/testAliAnalysisTaskFiltered/AliAnalysisTaskFilteredTest.sh
+#   To test:
+#   1.) CPU/Memory/Data volume
+#   2.) Relative fracion of the information in exported trees
+#   3.) Compression for points
+#
+#   Author of test:
+#   marian.ivanov@cern.ch
+###############################################################################
+# Test environment has to be configured before
+# To setup: input data path 
+# Setup example config can be found in directory $ALICE_ROOT/test/configuration
+# E.g for GSI setup
+# export UnitTestConfig=$ALICE_ROOT/test/configuration/configGSI.sh 
+###############################################################################
+# Steps:
+#  1. define vars
+#  2. echo settings
+#  3. runTask 
+###############################################################################
+
+source $UnitTestConfig
+
+#get path to input list
+    inputListfiles=$TestData_pPb
+#get scale number for tracks
+    filterT=${2-100}
+#get scale number for V0s
+    filterV=${3-10}
+#get scale number of riends
+    filterFriend=${4--10}
+#get OCDB path (optional)
+    OCDBpath=${5-"\"$OCDBPath_pPb\""}
+#get max number of files 
+    maxFiles=${6-"1000000"}
+#get offset of first file
+    offsetFile=${7-"0"}
+#get max number of events
+    maxEvents=${8-"30000000"}
+#get offset of first event
+    offsetEvent=${9-"0"}
+
+# echo settings
+    if [[ -f "$inputListfiles" ]] ; then
+        inputListfiles="\"$inputListfiles\""
+        echo "running with setup:"
+        echo "ALICE_ROOT: $ALICE_ROOT"
+        echo "inputListfiles: $inputListfiles"
+        echo "scale tracks: $filterT"
+        echo "scale V0s: $filterV"
+        echo "scale Friends: $filterFriend"
+        echo "OCDB path: $OCDBpath"
+        echo "max Files: $maxFiles"
+        echo "offset File: $offsetFile"
+        echo "max Events: $maxEvents"
+        echo "offset Event: $offsetEvent"
+    else
+        echo "inputListfiles not found: $inputListfiles"
+        exit 1
+    fi
+#run FilterTask
+    echo aliroot -l -b -q $ALICE_ROOT/test/testAliAnalysisTaskFiltered/AliAnalysisTaskFilteredTest.C\($inputListfiles,$filterT,$filterV,$OCDBpath,$maxFiles,$offsetFile,$maxEvents,$offsetEvent\)
+    aliroot -l -b -q $ALICE_ROOT/test/testAliAnalysisTaskFiltered/AliAnalysisTaskFilteredTest.C\($inputListfiles,$filterT,$filterV,$filterFriend,$OCDBpath,$maxFiles,$offsetFile,$maxEvents,$offsetEvent\)
+exit