-/**************************************************************************\r
-* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *\r
-* *\r
-* Author: The ALICE Off-line Project. *\r
-* Contributors are mentioned in the code where appropriate. *\r
-* *\r
-* Permission to use, copy, modify and distribute this software and its *\r
-* documentation strictly for non-commercial purposes is hereby granted *\r
-* without fee, provided that the above copyright notice appears in all *\r
-* copies and that both the copyright notice and this permission notice *\r
-* appear in the supporting documentation. The authors make no claims *\r
-* about the suitability of this software for any purpose. It is *\r
-* provided "as is" without express or implied warranty. *\r
-**************************************************************************/\r
-\r
-//------------------------------------------------------------------------------\r
-// Implementation of the AliPerformanceTask class. It checks reconstruction performance \r
-// for the reconstructed vs MC particle tracks under several conditions. For real data \r
-// the control QA histograms are filled.\r
-//\r
-// The comparison output objects deriving from AliPerformanceObject \r
-// (e.g. AliPerformanceRes, AliPerformanceEff, AliPerformanceDEdx, AliPerformanceDCA ...) \r
-// are stored in the output file (details in description of these classes).\r
-// \r
-// Author: J.Otwinowski 01/04/2009 \r
-// Changes by M.Knichel 15/10/2010\r
-//------------------------------------------------------------------------------\r
-\r
-#include "iostream"\r
-\r
-#include "TChain.h"\r
-#include "TTree.h"\r
-#include "TH1F.h"\r
-#include "TCanvas.h"\r
-#include "TList.h"\r
-#include "TFile.h"\r
-#include "TSystem.h"\r
-\r
-#include "AliAnalysisTask.h"\r
-#include "AliAnalysisManager.h"\r
-#include "AliESDEvent.h"\r
-#include "AliESDfriend.h"\r
-#include "AliMCEvent.h"\r
-#include "AliESDInputHandler.h"\r
-#include "AliMCEventHandler.h"\r
-#include "AliESDVertex.h"\r
-#include "AliMagF.h"\r
-#include "AliTracker.h"\r
-#include "AliGeomManager.h"\r
-#include "AliCDBManager.h"\r
-\r
-#include "AliCentrality.h"\r
-#include "AliESDVZERO.h"\r
-#include "AliMultiplicity.h"\r
-\r
-#include "AliMCInfo.h"\r
-#include "AliESDRecInfo.h"\r
-#include "AliMCInfoCuts.h"\r
-#include "AliRecInfoCuts.h"\r
-#include "AliPerformanceObject.h"\r
-#include "AliTPCPerformanceSummary.h"\r
-#include "AliPerformanceTPC.h"\r
-#include "AliPerformanceDEdx.h"\r
-#include "AliPerformanceMatch.h"\r
-#include "AliPerformanceTask.h"\r
-\r
-\r
-using namespace std;\r
-\r
-ClassImp(AliPerformanceTask)\r
-\r
-//_____________________________________________________________________________\r
-AliPerformanceTask::AliPerformanceTask() \r
- : AliAnalysisTaskSE("Performance")\r
- , fESD(0)\r
- , fESDfriend(0)\r
- , fMC(0)\r
- , fOutput(0)\r
- , fOutputSummary(0)\r
- , fPitList(0)\r
- , fCompList(0)\r
- , fUseMCInfo(kFALSE)\r
- , fUseESDfriend(kFALSE)\r
- , fUseHLT(kFALSE)\r
- , fUseTerminate(kTRUE)\r
- , fUseCentrality(0)\r
- , fUseOCDB(kTRUE)\r
- , fUseCentralityBin(0)\r
-{\r
- // Dummy Constructor\r
- // should not be used\r
-}\r
-\r
-//_____________________________________________________________________________\r
-AliPerformanceTask::AliPerformanceTask(const char *name, const char */*title*/) \r
- : AliAnalysisTaskSE(name)\r
- , fESD(0)\r
- , fESDfriend(0)\r
- , fMC(0)\r
- , fOutput(0)\r
- , fOutputSummary(0)\r
- , fPitList(0)\r
- , fCompList(0)\r
- , fUseMCInfo(kFALSE)\r
- , fUseESDfriend(kFALSE)\r
- , fUseHLT(kFALSE)\r
- , fUseTerminate(kTRUE)\r
- , fUseCentrality(0)\r
- , fUseOCDB(kTRUE)\r
- , fUseCentralityBin(0)\r
-{\r
- // Constructor\r
-\r
- // Define input and output slots here\r
- DefineOutput(0, TTree::Class());\r
- DefineOutput(1, TList::Class());\r
-\r
- // create the list for comparison objects\r
- fCompList = new TList;\r
-}\r
-\r
-//_____________________________________________________________________________\r
-AliPerformanceTask::~AliPerformanceTask()\r
-{\r
- if (!AliAnalysisManager::GetAnalysisManager()->IsProofMode()) {\r
- if (fOutput) delete fOutput; fOutput = 0; \r
- if (fOutputSummary) delete fOutputSummary; fOutputSummary = 0;\r
- if (fCompList) delete fCompList; fCompList = 0; \r
- }\r
-}\r
-\r
-//_____________________________________________________________________________\r
-Bool_t AliPerformanceTask::AddPerformanceObject(AliPerformanceObject *pObj) \r
-{\r
- // add comparison object to the list\r
- if(pObj == 0) {\r
- Printf("ERROR: Could not add comparison object");\r
- return kFALSE;\r
- }\r
-\r
- // add object to the list\r
- fCompList->AddLast(pObj);\r
- \r
-return kTRUE;\r
-}\r
-\r
-//_____________________________________________________________________________\r
-void AliPerformanceTask::UserCreateOutputObjects()\r
-{\r
- // Create histograms\r
- // Called once\r
-\r
- // create output list\r
- fOutput = new TList;\r
- fOutput->SetOwner();\r
- fPitList = fOutput->MakeIterator();\r
- \r
- // create output list\r
- //fOutputSummary = new TTree;\r
- \r
- // add comparison objects to the output\r
- AliPerformanceObject *pObj=0;\r
- Int_t count=0;\r
- TIterator *pitCompList = fCompList->MakeIterator();\r
- pitCompList->Reset();\r
- while(( pObj = (AliPerformanceObject *)pitCompList->Next()) != NULL) {\r
- fOutput->Add(pObj);\r
- count++;\r
- }\r
- Printf("UserCreateOutputObjects(): Number of output comparison objects: %d \n", count);\r
- \r
- PostData(1, fOutput); \r
- PostData(0, fOutputSummary); \r
-}\r
-\r
-//_____________________________________________________________________________\r
-void AliPerformanceTask::UserExec(Option_t *) \r
-{\r
- // Main loop\r
- // Called for each event\r
-\r
-\r
- // Decide whether to use HLT or Offline ESD\r
- if(fUseHLT){\r
-\r
- AliESDInputHandler *esdH = dynamic_cast<AliESDInputHandler*> \r
- (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());\r
- \r
- if (!esdH) {\r
- printf("ERROR: Could not get ESDInputHandler");\r
- return;\r
- } \r
- fESD = esdH->GetHLTEvent();\r
- }// end if fUseHLT\r
- else \r
- fESD = (AliESDEvent*) (InputEvent());\r
-\r
- if(fUseESDfriend)\r
- {\r
- fESDfriend = static_cast<AliESDfriend*>(fESD->FindListObject("AliESDfriend"));\r
- if(!fESDfriend) {\r
- Printf("ERROR: ESD friends not available");\r
- }\r
- }\r
- \r
- if(fUseMCInfo) {\r
- fMC = MCEvent();\r
- } \r
-\r
-\r
- if (!fESD) {\r
- Printf("ERROR: ESD event not available");\r
- return;\r
- }\r
- \r
- if (fUseMCInfo && !fMC) {\r
- Printf("ERROR: MC event not available");\r
- return;\r
- }\r
-\r
- if(fUseESDfriend)\r
- {\r
- if(!fESDfriend) {\r
- Printf("ERROR: ESD friends not available");\r
- }\r
- }\r
-\r
- // Process analysis\r
- Bool_t process = kTRUE;\r
-\r
- // Check for centrality\r
- if (fUseCentrality) {\r
- if ( CalculateCentralityBin() != fUseCentralityBin ) {\r
- process = kFALSE;\r
- }\r
- }\r
-\r
- // Process comparison\r
- if (process) {\r
- AliPerformanceObject *pObj=0;\r
- fPitList->Reset();\r
- while(( pObj = (AliPerformanceObject *)fPitList->Next()) != NULL) {\r
- pObj->Exec(fMC,fESD,fESDfriend,fUseMCInfo,fUseESDfriend);\r
- }\r
- }\r
-\r
- // Post output data.\r
- PostData(1, fOutput);\r
-}\r
-\r
-//_____________________________________________________________________________\r
-void AliPerformanceTask::Terminate(Option_t *) \r
-{\r
- // Called once at the end \r
-\r
- if ( !fUseTerminate )\r
- return;\r
- \r
- // check output data\r
- fOutputSummary = dynamic_cast<TTree*> (GetOutputData(0));\r
- fOutput = dynamic_cast<TList*> (GetOutputData(1));\r
- if (!fOutput) {\r
- Printf("ERROR: AliPerformanceTask::Terminate(): fOutput data not available ..." );\r
- return;\r
- }\r
- if (fOutputSummary) { delete fOutputSummary; fOutputSummary=0; } \r
- AliPerformanceObject* pObj=0;\r
- AliPerformanceTPC* pTPC = 0;\r
- AliPerformanceDEdx* pDEdx = 0;\r
- AliPerformanceMatch* pMatch = 0;\r
- AliPerformanceMatch* pPull = 0;\r
- AliPerformanceMatch* pConstrain = 0;\r
- TIterator* itOut = fOutput->MakeIterator();\r
- itOut->Reset();\r
- while(( pObj = dynamic_cast<AliPerformanceObject*>(itOut->Next())) != NULL) { \r
- pObj->AnalyseFinal();\r
- /* if (! pTPC) { pTPC = dynamic_cast<AliPerformanceTPC*>(pObj); }\r
- if (! pDEdx) { pDEdx = dynamic_cast<AliPerformanceDEdx*>(pObj); }\r
- if (! pMatch) { pMatch = dynamic_cast<AliPerformanceMatch*>(pObj); }\r
- if ((! pPull) && pMatch ) { pPull = dynamic_cast<AliPerformanceMatch*>(pObj);*/\r
-\r
- if (!strcmp(pObj->GetName(),"AliPerformanceTPC")) { pTPC = dynamic_cast<AliPerformanceTPC*>(pObj); }\r
- if (!strcmp(pObj->GetName(),"AliPerformanceDEdxTPCInner")) { pDEdx = dynamic_cast<AliPerformanceDEdx*>(pObj); }\r
- if (!strcmp(pObj->GetName(),"AliPerformanceMatchTPCITS")) { pMatch = dynamic_cast<AliPerformanceMatch*>(pObj); }\r
- if (!strcmp(pObj->GetName(),"AliPerformanceMatchITSTPC")) { pPull = dynamic_cast<AliPerformanceMatch*>(pObj);}\r
- if (!strcmp(pObj->GetName(),"AliPerformanceMatchTPCConstrain")) { pConstrain = dynamic_cast<AliPerformanceMatch*>(pObj);}\r
- }\r
- \r
- \r
- if(!fUseOCDB) { \r
- printf("DO NOT USE OCDB \n");\r
- return;\r
- }\r
- \r
- if (! AliCDBManager::Instance()->GetDefaultStorage()) { AliCDBManager::Instance()->SetDefaultStorage("raw://"); }\r
- TUUID uuid;\r
- TString tmpFile = gSystem->TempDirectory() + TString("/TPCQASummary.") + uuid.AsString() + TString(".root");\r
- AliTPCPerformanceSummary::WriteToFile(pTPC, pDEdx, pMatch, pPull, pConstrain, tmpFile.Data());\r
- TChain* chain = new TChain("tpcQA");\r
- if(!chain) return;\r
- chain->Add(tmpFile.Data());\r
- TTree *tree = chain->CopyTree("1");\r
- if (chain) { delete chain; chain=0; }\r
- fOutputSummary = tree;\r
- \r
- // Post output data.\r
- PostData(0, fOutputSummary);\r
-\r
-}\r
-\r
-//_____________________________________________________________________________\r
-void AliPerformanceTask::FinishTaskOutput()\r
-{\r
- // called once at the end of each job (on the workernode)\r
- //\r
- // projects THnSparse to TH1,2,3\r
- \r
- fOutput = dynamic_cast<TList*> (GetOutputData(1));\r
- if (!fOutput) {\r
- Printf("ERROR: AliPerformanceTask::FinishTaskOutput(): fOutput data not available ..." );\r
- return;\r
- }\r
-\r
- AliPerformanceObject* pObj=0;\r
- TIterator* itOut = fOutput->MakeIterator(); \r
- itOut->Reset();\r
- while(( pObj = dynamic_cast<AliPerformanceObject*>(itOut->Next())) != NULL) {\r
- pObj->SetRunNumber(fCurrentRunNumber);\r
- pObj->Analyse();\r
- }\r
- \r
- // Post output data.\r
- PostData(1, fOutput);\r
-}\r
-\r
-//_____________________________________________________________________________\r
-Bool_t AliPerformanceTask::Notify()\r
-{\r
- static Int_t count = 0;\r
- count++;\r
- Printf("Processing %d. file", count);\r
-\r
- return kTRUE;\r
-}\r
-\r
-//________________________________________________________________________\r
-Int_t AliPerformanceTask::CalculateCentralityBin(){\r
- // Get Centrality bin\r
-\r
- Int_t centrality = -1;\r
- Float_t centralityF = -1;\r
-\r
- if (fUseCentrality == 0)\r
- return centrality;\r
-\r
- AliCentrality *esdCentrality = fESD->GetCentrality();\r
- \r
- // New : 2010-11-18 JMT \r
- if ( fUseCentrality == 1 )\r
- centralityF = esdCentrality->GetCentralityPercentile("V0M");\r
- else if ( fUseCentrality == 2 )\r
- centralityF = esdCentrality->GetCentralityPercentile("CL1");\r
- else if ( fUseCentrality == 3 )\r
- centralityF = esdCentrality->GetCentralityPercentile("TRK"); \r
- if (centralityF == 0.)\r
- centralityF = 100.;\r
-\r
- if ( centralityF >= 0. && centralityF < 5.) centrality = 0;\r
- else if ( centralityF >= 5. && centralityF < 10.) centrality = 5;\r
- else if ( centralityF >= 10. && centralityF < 20.) centrality = 10;\r
- else if ( centralityF >= 20. && centralityF < 30.) centrality = 20;\r
- else if ( centralityF >= 30. && centralityF < 40.) centrality = 30;\r
- else if ( centralityF >= 40. && centralityF < 50.) centrality = 40;\r
- else if ( centralityF >= 50. && centralityF < 60.) centrality = 50;\r
- else if ( centralityF >= 60. && centralityF < 70.) centrality = 60;\r
- else if ( centralityF >= 70. && centralityF < 80.) centrality = 70;\r
- else if ( centralityF >= 80. && centralityF < 90.) centrality = 80;\r
- else if ( centralityF >= 90. && centralityF <=100.) centrality = 90;\r
- \r
- return centrality;\r
-}\r
+/**************************************************************************
+* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+* *
+* Author: The ALICE Off-line Project. *
+* Contributors are mentioned in the code where appropriate. *
+* *
+* Permission to use, copy, modify and distribute this software and its *
+* documentation strictly for non-commercial purposes is hereby granted *
+* without fee, provided that the above copyright notice appears in all *
+* copies and that both the copyright notice and this permission notice *
+* appear in the supporting documentation. The authors make no claims *
+* about the suitability of this software for any purpose. It is *
+* provided "as is" without express or implied warranty. *
+**************************************************************************/
+
+//------------------------------------------------------------------------------
+// Implementation of the AliPerformanceTask class. It checks reconstruction performance
+// for the reconstructed vs MC particle tracks under several conditions. For real data
+// the control QA histograms are filled.
+//
+// The comparison output objects deriving from AliPerformanceObject
+// (e.g. AliPerformanceRes, AliPerformanceEff, AliPerformanceDEdx, AliPerformanceDCA ...)
+// are stored in the output file (details in description of these classes).
+//
+// Author: J.Otwinowski 01/04/2009
+// Changes by M.Knichel 15/10/2010
+//------------------------------------------------------------------------------
+
+#include "iostream"
+
+#include "TChain.h"
+#include "TTree.h"
+#include "TH1F.h"
+#include "TCanvas.h"
+#include "TList.h"
+#include "TFile.h"
+#include "TSystem.h"
+
+#include "AliAnalysisTask.h"
+#include "AliAnalysisManager.h"
+#include "AliESDEvent.h"
+#include "AliESDfriend.h"
+#include "AliMCEvent.h"
+#include "AliESDInputHandler.h"
+#include "AliMCEventHandler.h"
+#include "AliESDVertex.h"
+#include "AliMagF.h"
+#include "AliTracker.h"
+#include "AliGeomManager.h"
+#include "AliCDBManager.h"
+
+#include "AliCentrality.h"
+#include "AliESDVZERO.h"
+#include "AliMultiplicity.h"
+
+#include "AliMCInfo.h"
+#include "AliESDRecInfo.h"
+#include "AliMCInfoCuts.h"
+#include "AliRecInfoCuts.h"
+#include "AliPerformanceObject.h"
+#include "AliTPCPerformanceSummary.h"
+#include "AliPerformanceTPC.h"
+#include "AliPerformanceDEdx.h"
+#include "AliPerformanceMatch.h"
+#include "AliPerformanceTask.h"
+
+
+using namespace std;
+
+ClassImp(AliPerformanceTask)
+
+//_____________________________________________________________________________
+AliPerformanceTask::AliPerformanceTask()
+ : AliAnalysisTaskSE("Performance")
+ , fESD(0)
+ , fESDfriend(0)
+ , fMC(0)
+ , fOutput(0)
+ , fOutputSummary(0)
+ , fPitList(0)
+ , fCompList(0)
+ , fUseMCInfo(kFALSE)
+ , fUseESDfriend(kFALSE)
+ , fUseHLT(kFALSE)
+ , fUseTerminate(kTRUE)
+ , fUseCentrality(0)
+ , fUseOCDB(kTRUE)
+ , fUseCentralityBin(0)
+{
+ // Dummy Constructor
+ // should not be used
+}
+
+//_____________________________________________________________________________
+AliPerformanceTask::AliPerformanceTask(const char *name, const char */*title*/)
+ : AliAnalysisTaskSE(name)
+ , fESD(0)
+ , fESDfriend(0)
+ , fMC(0)
+ , fOutput(0)
+ , fOutputSummary(0)
+ , fPitList(0)
+ , fCompList(0)
+ , fUseMCInfo(kFALSE)
+ , fUseESDfriend(kFALSE)
+ , fUseHLT(kFALSE)
+ , fUseTerminate(kTRUE)
+ , fUseCentrality(0)
+ , fUseOCDB(kTRUE)
+ , fUseCentralityBin(0)
+{
+ // Constructor
+
+ // Define input and output slots here
+ DefineOutput(0, TTree::Class());
+ DefineOutput(1, TList::Class());
+
+ // create the list for comparison objects
+ fCompList = new TList;
+}
+
+//_____________________________________________________________________________
+AliPerformanceTask::~AliPerformanceTask()
+{
+ if (!AliAnalysisManager::GetAnalysisManager()->IsProofMode()) {
+ if (fOutput) delete fOutput; fOutput = 0;
+ if (fOutputSummary) delete fOutputSummary; fOutputSummary = 0;
+ if (fCompList) delete fCompList; fCompList = 0;
+ }
+}
+
+//_____________________________________________________________________________
+Bool_t AliPerformanceTask::AddPerformanceObject(AliPerformanceObject *pObj)
+{
+ // add comparison object to the list
+ if(pObj == 0) {
+ Printf("ERROR: Could not add comparison object");
+ return kFALSE;
+ }
+
+ // add object to the list
+ fCompList->AddLast(pObj);
+
+return kTRUE;
+}
+
+//_____________________________________________________________________________
+void AliPerformanceTask::UserCreateOutputObjects()
+{
+ // Create histograms
+ // Called once
+
+ // create output list
+ fOutput = new TList;
+ fOutput->SetOwner();
+ fPitList = fOutput->MakeIterator();
+
+ // create output list
+ //fOutputSummary = new TTree;
+
+ // add comparison objects to the output
+ AliPerformanceObject *pObj=0;
+ Int_t count=0;
+ TIterator *pitCompList = fCompList->MakeIterator();
+ pitCompList->Reset();
+ while(( pObj = (AliPerformanceObject *)pitCompList->Next()) != NULL) {
+ fOutput->Add(pObj);
+ count++;
+ }
+ Printf("UserCreateOutputObjects(): Number of output comparison objects: %d \n", count);
+
+ PostData(1, fOutput);
+ PostData(0, fOutputSummary);
+}
+
+//_____________________________________________________________________________
+void AliPerformanceTask::UserExec(Option_t *)
+{
+ // Main loop
+ // Called for each event
+
+
+ // Decide whether to use HLT or Offline ESD
+ if(fUseHLT){
+
+ AliESDInputHandler *esdH = dynamic_cast<AliESDInputHandler*>
+ (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
+
+ if (!esdH) {
+ printf("ERROR: Could not get ESDInputHandler");
+ return;
+ }
+ fESD = esdH->GetHLTEvent();
+ }// end if fUseHLT
+ else
+ fESD = (AliESDEvent*) (InputEvent());
+
+ if(fUseESDfriend)
+ {
+ if (fUseHLT)
+ {
+ AliESDEvent *fESDoffline;
+ fESDoffline = (AliESDEvent*) (InputEvent());
+ fESDfriend = static_cast<AliESDfriend*>(fESDoffline->FindListObject("AliESDfriend"));
+ }
+ else
+ {
+ fESDfriend = static_cast<AliESDfriend*>(fESD->FindListObject("AliESDfriend"));
+ }
+ if(!fESDfriend) {
+ Printf("ERROR: ESD friends not available");
+ }
+ }
+
+ if(fUseMCInfo) {
+ fMC = MCEvent();
+ }
+
+
+ if (!fESD) {
+ Printf("ERROR: ESD event not available");
+ return;
+ }
+
+ if (fUseMCInfo && !fMC) {
+ Printf("ERROR: MC event not available");
+ return;
+ }
+
+ if(fUseESDfriend)
+ {
+ if(!fESDfriend) {
+ Printf("ERROR: ESD friends not available");
+ }
+ }
+
+ // Process analysis
+ Bool_t process = kTRUE;
+
+ // Check for centrality
+ if (fUseCentrality) {
+ if ( CalculateCentralityBin() != fUseCentralityBin ) {
+ process = kFALSE;
+ }
+ }
+
+ // Process comparison
+ if (process) {
+ AliPerformanceObject *pObj=0;
+ fPitList->Reset();
+ while(( pObj = (AliPerformanceObject *)fPitList->Next()) != NULL) {
+ //AliInfo(pObj->GetName());
+ pObj->Exec(fMC,fESD,fESDfriend,fUseMCInfo,fUseESDfriend);
+ }
+ }
+
+ // Post output data.
+ PostData(1, fOutput);
+}
+
+//_____________________________________________________________________________
+void AliPerformanceTask::Terminate(Option_t *)
+{
+ // Called once at the end
+
+ if ( !fUseTerminate )
+ return;
+
+ // check output data
+ fOutputSummary = dynamic_cast<TTree*> (GetOutputData(0));
+ fOutput = dynamic_cast<TList*> (GetOutputData(1));
+ if (!fOutput) {
+ Printf("ERROR: AliPerformanceTask::Terminate(): fOutput data not available ..." );
+ return;
+ }
+ if (fOutputSummary) { delete fOutputSummary; fOutputSummary=0; }
+ AliPerformanceObject* pObj=0;
+ AliPerformanceTPC* pTPC = 0;
+ AliPerformanceDEdx* pDEdx = 0;
+ AliPerformanceMatch* pMatch = 0;
+ AliPerformanceMatch* pPull = 0;
+ AliPerformanceMatch* pConstrain = 0;
+ TIterator* itOut = fOutput->MakeIterator();
+ itOut->Reset();
+ while(( pObj = dynamic_cast<AliPerformanceObject*>(itOut->Next())) != NULL) {
+ pObj->AnalyseFinal();
+ /* if (! pTPC) { pTPC = dynamic_cast<AliPerformanceTPC*>(pObj); }
+ if (! pDEdx) { pDEdx = dynamic_cast<AliPerformanceDEdx*>(pObj); }
+ if (! pMatch) { pMatch = dynamic_cast<AliPerformanceMatch*>(pObj); }
+ if ((! pPull) && pMatch ) { pPull = dynamic_cast<AliPerformanceMatch*>(pObj);*/
+
+ if (!strcmp(pObj->GetName(),"AliPerformanceTPC")) { pTPC = dynamic_cast<AliPerformanceTPC*>(pObj); }
+ if (!strcmp(pObj->GetName(),"AliPerformanceDEdxTPCInner")) { pDEdx = dynamic_cast<AliPerformanceDEdx*>(pObj); }
+ if (!strcmp(pObj->GetName(),"AliPerformanceMatchTPCITS")) { pMatch = dynamic_cast<AliPerformanceMatch*>(pObj); }
+ if (!strcmp(pObj->GetName(),"AliPerformanceMatchITSTPC")) { pPull = dynamic_cast<AliPerformanceMatch*>(pObj);}
+ if (!strcmp(pObj->GetName(),"AliPerformanceMatchTPCConstrain")) { pConstrain = dynamic_cast<AliPerformanceMatch*>(pObj);}
+ }
+
+
+ if(!fUseOCDB) {
+ printf("DO NOT USE OCDB \n");
+ return;
+ }
+
+ if (! AliCDBManager::Instance()->GetDefaultStorage()) { AliCDBManager::Instance()->SetDefaultStorage("raw://"); }
+ TUUID uuid;
+ TString tmpFile = gSystem->TempDirectory() + TString("/TPCQASummary.") + uuid.AsString() + TString(".root");
+ AliTPCPerformanceSummary::WriteToFile(pTPC, pDEdx, pMatch, pPull, pConstrain, tmpFile.Data());
+ TChain* chain = new TChain("tpcQA");
+ if(!chain) return;
+ chain->Add(tmpFile.Data());
+ TTree *tree = chain->CopyTree("1");
+ if (chain) { delete chain; chain=0; }
+ fOutputSummary = tree;
+
+ // Post output data.
+ PostData(0, fOutputSummary);
+
+}
+
+//_____________________________________________________________________________
+void AliPerformanceTask::FinishTaskOutput()
+{
+ // called once at the end of each job (on the workernode)
+ //
+ // projects THnSparse to TH1,2,3
+
+ fOutput = dynamic_cast<TList*> (GetOutputData(1));
+ if (!fOutput) {
+ Printf("ERROR: AliPerformanceTask::FinishTaskOutput(): fOutput data not available ..." );
+ return;
+ }
+
+ AliPerformanceObject* pObj=0;
+ TIterator* itOut = fOutput->MakeIterator();
+ itOut->Reset();
+ while(( pObj = dynamic_cast<AliPerformanceObject*>(itOut->Next())) != NULL) {
+ pObj->SetRunNumber(fCurrentRunNumber);
+ pObj->Analyse();
+ }
+
+ // Post output data.
+ PostData(1, fOutput);
+}
+
+//_____________________________________________________________________________
+Bool_t AliPerformanceTask::Notify()
+{
+ static Int_t count = 0;
+ count++;
+ Printf("Processing %d. file", count);
+
+ return kTRUE;
+}
+
+//________________________________________________________________________
+Int_t AliPerformanceTask::CalculateCentralityBin(){
+ // Get Centrality bin
+
+ Int_t centrality = -1;
+ Float_t centralityF = -1;
+
+ if (fUseCentrality == 0)
+ return centrality;
+
+ AliCentrality *esdCentrality = fESD->GetCentrality();
+
+ // New : 2010-11-18 JMT
+ if ( fUseCentrality == 1 )
+ centralityF = esdCentrality->GetCentralityPercentile("V0M");
+ else if ( fUseCentrality == 2 )
+ centralityF = esdCentrality->GetCentralityPercentile("CL1");
+ else if ( fUseCentrality == 3 )
+ centralityF = esdCentrality->GetCentralityPercentile("TRK");
+ if (centralityF == 0.)
+ centralityF = 100.;
+
+ if ( centralityF >= 0. && centralityF < 5.) centrality = 0;
+ else if ( centralityF >= 5. && centralityF < 10.) centrality = 5;
+ else if ( centralityF >= 10. && centralityF < 20.) centrality = 10;
+ else if ( centralityF >= 20. && centralityF < 30.) centrality = 20;
+ else if ( centralityF >= 30. && centralityF < 40.) centrality = 30;
+ else if ( centralityF >= 40. && centralityF < 50.) centrality = 40;
+ else if ( centralityF >= 50. && centralityF < 60.) centrality = 50;
+ else if ( centralityF >= 60. && centralityF < 70.) centrality = 60;
+ else if ( centralityF >= 70. && centralityF < 80.) centrality = 70;
+ else if ( centralityF >= 80. && centralityF < 90.) centrality = 80;
+ else if ( centralityF >= 90. && centralityF <=100.) centrality = 90;
+
+ return centrality;
+}