From: snelling Date: Fri, 5 Mar 2010 18:44:03 +0000 (+0000) Subject: task matching the new classes X-Git-Url: http://git.uio.no/git/?a=commitdiff_plain;h=67a6b1787add28b47ec72839b7ffe778b8b2f2d3;p=u%2Fmrichter%2FAliRoot.git task matching the new classes --- diff --git a/PWG2/FLOW/AliFlowCommon/AliFlowAnalysisWithMixedHarmonics.h b/PWG2/FLOW/AliFlowCommon/AliFlowAnalysisWithMixedHarmonics.h index beb3371dccd..32cc88057d2 100644 --- a/PWG2/FLOW/AliFlowCommon/AliFlowAnalysisWithMixedHarmonics.h +++ b/PWG2/FLOW/AliFlowCommon/AliFlowAnalysisWithMixedHarmonics.h @@ -26,6 +26,7 @@ class TList; class TFile; class TH1; class TH2; +class TH2D; class TProfile; class TProfile2D; diff --git a/PWG2/FLOW/AliFlowTasks/AliAnalysisTaskMixedHarmonics.cxx b/PWG2/FLOW/AliFlowTasks/AliAnalysisTaskMixedHarmonics.cxx new file mode 100644 index 00000000000..1c781ed2256 --- /dev/null +++ b/PWG2/FLOW/AliFlowTasks/AliAnalysisTaskMixedHarmonics.cxx @@ -0,0 +1,197 @@ +/************************************************************************* +* Copyright(c) 1998-2008, 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. * +**************************************************************************/ + +/************************************** + * analysis task for mixed harmomics * + * * + * authors: Naomi van der Kolk * + * (kolk@nikhef.nl) * + * Raimond Snellings * + * (snelling@nikhef.nl) * + * Ante Bilandzic * + * (anteb@nikhef.nl) * + * ***********************************/ + +class TFile; +class TList; +class AliAnalysisTaskSE; + +#include "Riostream.h" +#include "AliFlowEventSimple.h" +#include "AliAnalysisTaskMixedHarmonics.h" +#include "AliFlowAnalysisWithMixedHarmonics.h" + +ClassImp(AliAnalysisTaskMixedHarmonics) + +//================================================================================================================ + +AliAnalysisTaskMixedHarmonics::AliAnalysisTaskMixedHarmonics(const char *name, Bool_t useParticleWeights): +AliAnalysisTaskSE(name), +fEvent(NULL), +fMH(NULL), +fListHistos(NULL), +fCorrelatorInteger(1), +fNoOfMultipicityBins(10), +fMultipicityBinWidth(2.), +fMinMultiplicity(3.), +fCorrectForDetectorEffects(kTRUE), +fUseParticleWeights(useParticleWeights), +fUsePhiWeights(kFALSE), +fUsePtWeights(kFALSE), +fUseEtaWeights(kFALSE), +fWeightsList(NULL) +{ + // constructor + cout<<"AliAnalysisTaskMixedHarmonics::AliAnalysisTaskMixedHarmonics(const char *name, Bool_t useParticleWeights)"<SetCorrelatorInteger(fCorrelatorInteger); + fMH->SetNoOfMultipicityBins(fNoOfMultipicityBins); + fMH->SetMultipicityBinWidth(fMultipicityBinWidth); + fMH->SetMinMultiplicity(fMinMultiplicity); + fMH->SetCorrectForDetectorEffects(fCorrectForDetectorEffects); + if(fUseParticleWeights) + { + // Pass the flags to class: + if(fUsePhiWeights) fMH->SetUsePhiWeights(fUsePhiWeights); + if(fUsePtWeights) fMH->SetUsePtWeights(fUsePtWeights); + if(fUseEtaWeights) fMH->SetUseEtaWeights(fUseEtaWeights); + // Get data from input slot #1 which is used for weights: + if(GetNinputs()==2) + { + fWeightsList = (TList*)GetInputData(1); + } + // Pass the list with weights to class: + if(fWeightsList) fMH->SetWeightsList(fWeightsList); + } + + fMH->Init(); + + if(fMH->GetHistList()) + { + fListHistos = fMH->GetHistList(); + // fListHistos->Print(); + } else + { + Printf("ERROR: Could not retrieve histogram list (MH, Task::UserCreateOutputObjects()) !!!!"); + } + +} // end of void AliAnalysisTaskMixedHarmonics::UserCreateOutputObjects() + +//================================================================================================================ + +void AliAnalysisTaskMixedHarmonics::UserExec(Option_t *) +{ + // main loop (called for each event) + fEvent = dynamic_cast(GetInputData(0)); + + // Mixed Harmonics: + if(fEvent) + { + fMH->Make(fEvent); + } else + { + cout<<"WARNING: No input data (MH, Task::UserExec()) !!!!"<GetOutputHistograms(fListHistos); + fMH->Finish(); + PostData(1,fListHistos); + } else + { + cout<<" WARNING: histogram list pointer is empty (MH, Task::Terminate()) !!!!"<fCorrelatorInteger = ci;}; + Int_t GetCorrelatorInteger() const {return this->fCorrelatorInteger;}; + void SetNoOfMultipicityBins(Int_t const nomb) {this->fNoOfMultipicityBins = nomb;}; + Int_t GetNoOfMultipicityBins() const {return this->fNoOfMultipicityBins;}; + void SetMultipicityBinWidth(Double_t const mbw) {this->fMultipicityBinWidth = mbw;}; + Double_t GetMultipicityBinWidth() const {return this->fMultipicityBinWidth;}; + void SetMinMultiplicity(Double_t const mm) {this->fMinMultiplicity = mm;}; + Double_t GetMinMultiplicity() const {return this->fMinMultiplicity;}; + void SetCorrectForDetectorEffects(Bool_t const cfde) {this->fCorrectForDetectorEffects = cfde;}; + Bool_t GetCorrectForDetectorEffects() const {return this->fCorrectForDetectorEffects;}; + // particle weights: + void SetUsePhiWeights(Bool_t const uPhiW) {this->fUsePhiWeights = uPhiW;}; + Bool_t GetUsePhiWeights() const {return this->fUsePhiWeights;}; + void SetUsePtWeights(Bool_t const uPtW) {this->fUsePtWeights = uPtW;}; + Bool_t GetUsePtWeights() const {return this->fUsePtWeights;}; + void SetUseEtaWeights(Bool_t const uEtaW) {this->fUseEtaWeights = uEtaW;}; + Bool_t GetUseEtaWeights() const {return this->fUseEtaWeights;}; + + private: + AliAnalysisTaskMixedHarmonics(const AliAnalysisTaskMixedHarmonics& aatmh); + AliAnalysisTaskMixedHarmonics& operator=(const AliAnalysisTaskMixedHarmonics& aatmh); + + AliFlowEventSimple *fEvent; // the input event + AliFlowAnalysisWithMixedHarmonics *fMH; // mixed harmonics object + TList *fListHistos; // collection of output + // common: + Int_t fCorrelatorInteger; // integer n in cos[n(2phi1-phi2-phi3)] + Int_t fNoOfMultipicityBins; // number of multiplicity bins + Double_t fMultipicityBinWidth; // width of multiplicity bin + Double_t fMinMultiplicity; // minimal multiplicity + Bool_t fCorrectForDetectorEffects; // correct 3-p correlator for detector effects + // particle weights: + Bool_t fUseParticleWeights; // use any particle weights + Bool_t fUsePhiWeights; // use phi weights + Bool_t fUsePtWeights; // use pt weights + Bool_t fUseEtaWeights; // use eta weights + TList *fWeightsList; // list with weights + + ClassDef(AliAnalysisTaskMixedHarmonics, 0); +}; + +//================================================================================================================ + +#endif + + + + + + + + + + + diff --git a/PWG2/FLOW/AliFlowTasks/AliAnalysisTaskNestedLoops.cxx b/PWG2/FLOW/AliFlowTasks/AliAnalysisTaskNestedLoops.cxx new file mode 100644 index 00000000000..a302b0ca8e4 --- /dev/null +++ b/PWG2/FLOW/AliFlowTasks/AliAnalysisTaskNestedLoops.cxx @@ -0,0 +1,181 @@ +/************************************************************************* +* Copyright(c) 1998-2008, 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. * +**************************************************************************/ + +/********************************** + * analysis task for nested loops * + * * + * authors: Naomi van der Kolk * + * (kolk@nikhef.nl) * + * Raimond Snellings * + * (snelling@nikhef.nl) * + * Ante Bilandzic * + * (anteb@nikhef.nl) * + * *******************************/ + +class TFile; +class TList; +class AliAnalysisTaskSE; + +#include "Riostream.h" +#include "AliFlowEventSimple.h" +#include "AliAnalysisTaskNestedLoops.h" +#include "AliFlowAnalysisWithNestedLoops.h" + +ClassImp(AliAnalysisTaskNestedLoops) + +//================================================================================================================ + +AliAnalysisTaskNestedLoops::AliAnalysisTaskNestedLoops(const char *name, Bool_t useParticleWeights): +AliAnalysisTaskSE(name), +fEvent(NULL), +fNL(NULL), +fListHistos(NULL), +fUseParticleWeights(useParticleWeights), +fUsePhiWeights(kFALSE), +fUsePtWeights(kFALSE), +fUseEtaWeights(kFALSE), +fWeightsList(NULL) +{ + // constructor + cout<<"AliAnalysisTaskNestedLoops::AliAnalysisTaskNestedLoops(const char *name, Bool_t useParticleWeights)"<SetUsePhiWeights(fUsePhiWeights); + if(fUsePtWeights) fNL->SetUsePtWeights(fUsePtWeights); + if(fUseEtaWeights) fNL->SetUseEtaWeights(fUseEtaWeights); + // Get data from input slot #1 which is used for weights: + if(GetNinputs()==2) + { + fWeightsList = (TList*)GetInputData(1); + } + // Pass the list with weights to class: + if(fWeightsList) fNL->SetWeightsList(fWeightsList); + } + + fNL->Init(); + + if(fNL->GetHistList()) + { + fListHistos = fNL->GetHistList(); + // fListHistos->Print(); + } else + { + Printf("ERROR: Could not retrieve histogram list (NL, Task::UserCreateOutputObjects()) !!!!"); + } + +} // end of void AliAnalysisTaskNestedLoops::UserCreateOutputObjects() + +//================================================================================================================ + +void AliAnalysisTaskNestedLoops::UserExec(Option_t *) +{ + // main loop (called for each event) + fEvent = dynamic_cast(GetInputData(0)); + + // Nested Loops: + if(fEvent) + { + fNL->Make(fEvent); + } else + { + cout<<"WARNING: No input data (NL, Task::UserExec()) !!!!"<GetOutputHistograms(fListHistos); + fNL->Finish(); + PostData(1,fListHistos); + } else + { + cout<<" WARNING: histogram list pointer is empty (NL, Task::Terminate()) !!!!"<fUsePhiWeights = uPhiW;}; + Bool_t GetUsePhiWeights() const {return this->fUsePhiWeights;}; + void SetUsePtWeights(Bool_t const uPtW) {this->fUsePtWeights = uPtW;}; + Bool_t GetUsePtWeights() const {return this->fUsePtWeights;}; + void SetUseEtaWeights(Bool_t const uEtaW) {this->fUseEtaWeights = uEtaW;}; + Bool_t GetUseEtaWeights() const {return this->fUseEtaWeights;}; + + private: + AliAnalysisTaskNestedLoops(const AliAnalysisTaskNestedLoops& aatmh); + AliAnalysisTaskNestedLoops& operator=(const AliAnalysisTaskNestedLoops& aatmh); + + AliFlowEventSimple *fEvent; // the input event + AliFlowAnalysisWithNestedLoops *fNL; // nested loops object + TList *fListHistos; // collection of output + // particle weights: + Bool_t fUseParticleWeights; // use any particle weights + Bool_t fUsePhiWeights; // use phi weights + Bool_t fUsePtWeights; // use pt weights + Bool_t fUseEtaWeights; // use eta weights + TList *fWeightsList; // list with weights + + ClassDef(AliAnalysisTaskNestedLoops, 0); +}; + +//================================================================================================================ + +#endif + + + + + + + + + + + diff --git a/PWG2/FLOW/macros/AddTaskFlow.C b/PWG2/FLOW/macros/AddTaskFlow.C index ed884816772..442fb21b1a2 100644 --- a/PWG2/FLOW/macros/AddTaskFlow.C +++ b/PWG2/FLOW/macros/AddTaskFlow.C @@ -167,8 +167,9 @@ AliAnalysisTaskFlowEvent* AddTaskFlow(TString type, Bool_t* METHODS, Bool_t QA, Bool_t GFC = METHODS[6]; Bool_t QC = METHODS[7]; Bool_t FQD = METHODS[8]; - Bool_t MCEP = METHODS[9]; - + Bool_t MCEP = METHODS[9]; + Bool_t MH = METHODS[10]; + Bool_t NL = METHODS[11]; //for using weights Bool_t useWeights = WEIGHTS[0] || WEIGHTS[1] || WEIGHTS[2]; if (useWeights) cout<<"Weights are used"<AddTask(taskMCEP); } - + if (MH){ + AliAnalysisTaskMixedHarmonics *taskMH = new AliAnalysisTaskMixedHarmonics("TaskMixedHarmonics",useWeights); + taskMH->SetCorrelatorInteger(1); + taskMH->SetNoOfMultipicityBins(10); + taskMH->SetMultipicityBinWidth(2); + taskMH->SetMinMultiplicity(3); + taskMH->SetCorrectForDetectorEffects(kTRUE); + //taskMH->SetUsePhiWeights(WEIGHTS[0]); + //taskMH->SetUsePtWeights(WEIGHTS[1]); + //taskMH->SetUseEtaWeights(WEIGHTS[2]); + mgr->AddTask(taskMH); + } + if (NL){ + AliAnalysisTaskNestedLoops *taskNL = new AliAnalysisTaskNestedLoops("TaskNestedLoops",useWeights); + //taskNL->SetUsePhiWeights(WEIGHTS[0]); + //taskNL->SetUsePtWeights(WEIGHTS[1]); + //taskNL->SetUseEtaWeights(WEIGHTS[2]); + mgr->AddTask(taskNL); + } + // Create the output container for the data produced by the task // Connect to the input and output containers //=========================================================================== @@ -850,7 +870,32 @@ AliAnalysisTaskFlowEvent* AddTaskFlow(TString type, Bool_t* METHODS, Bool_t QA, mgr->ConnectInput(taskMCEP,0,coutputFE); mgr->ConnectOutput(taskMCEP,0,coutputMCEP); } - + if(MH) { + TString outputMH = AliAnalysisManager::GetCommonFileName(); + outputMH += ":outputMHanalysis"; + outputMH += type; + + AliAnalysisDataContainer *coutputMH = mgr->CreateContainer("cobjMH", TList::Class(),AliAnalysisManager::kOutputContainer,outputMH); + mgr->ConnectInput(taskMH,0,coutputFE); + mgr->ConnectOutput(taskMH,1,coutputMH); + //if (useWeights) { + // mgr->ConnectInput(taskMH,1,cinputWeights); + // cinputWeights->SetData(weightsList); + //} + } + if(NL) { + TString outputNL = AliAnalysisManager::GetCommonFileName(); + outputNL += ":outputNLanalysis"; + outputNL += type; + + AliAnalysisDataContainer *coutputNL = mgr->CreateContainer("cobjNL", TList::Class(),AliAnalysisManager::kOutputContainer,outputNL); + mgr->ConnectInput(taskNL,0,coutputFE); + mgr->ConnectOutput(taskNL,1,coutputNL); + //if (useWeights) { + // mgr->ConnectInput(taskNL,1,cinputWeights); + // cinputWeights->SetData(weightsList); + //} + } // Return analysis task //=========================================================================== diff --git a/PWG2/FLOW/macros/runFlowTask.C b/PWG2/FLOW/macros/runFlowTask.C index 77b01126404..27f868824a0 100644 --- a/PWG2/FLOW/macros/runFlowTask.C +++ b/PWG2/FLOW/macros/runFlowTask.C @@ -19,8 +19,10 @@ Bool_t LYZ1PROD = kTRUE; // Lee Yang Zeroes using product generating function ( Bool_t LYZ2SUM = kFALSE; // Lee Yang Zeroes using sum generating function (second pass differential v) Bool_t LYZ2PROD = kFALSE; // Lee Yang Zeroes using product generating function (second pass differential v) Bool_t LYZEP = kFALSE; // Lee Yang Zeroes Event plane using sum generating function (gives eventplane + weight) +Bool_t MH = kTRUE; // azimuthal correlators in mixed harmonics +Bool_t NL = kFALSE; // nested loops (for instance distribution of phi1-phi2 for all distinct pairs) -Bool_t METHODS[] = {SP,LYZ1SUM,LYZ1PROD,LYZ2SUM,LYZ2PROD,LYZEP,GFC,QC,FQD,MCEP}; +Bool_t METHODS[] = {SP,LYZ1SUM,LYZ1PROD,LYZ2SUM,LYZ2PROD,LYZEP,GFC,QC,FQD,MCEP,MH,NL}; // Analysis type can be ESD, AOD, MC, ESDMC0, ESDMC1 const TString type = "ESD"; diff --git a/PWG2/PWG2flowTasksLinkDef.h b/PWG2/PWG2flowTasksLinkDef.h index 95c43f45d18..b2397fe85fc 100644 --- a/PWG2/PWG2flowTasksLinkDef.h +++ b/PWG2/PWG2flowTasksLinkDef.h @@ -15,5 +15,7 @@ #pragma link C++ class AliAnalysisTaskFittingQDistribution+; #pragma link C++ class AliAnalysisTaskFlowEvent+; #pragma link C++ class AliAnalysisTaskFlowEventforRP+; +#pragma link C++ class AliAnalysisTaskMixedHarmonics+; +#pragma link C++ class AliAnalysisTaskNestedLoops+; #endif diff --git a/PWG2/libPWG2flowTasks.pkg b/PWG2/libPWG2flowTasks.pkg index 70bd30668a8..9102b1eb1b3 100644 --- a/PWG2/libPWG2flowTasks.pkg +++ b/PWG2/libPWG2flowTasks.pkg @@ -9,7 +9,9 @@ SRCS= FLOW/AliFlowTasks/AliFlowEventSimpleMaker.cxx \ FLOW/AliFlowTasks/AliAnalysisTaskLeeYangZeros.cxx \ FLOW/AliFlowTasks/AliAnalysisTaskFittingQDistribution.cxx \ FLOW/AliFlowTasks/AliAnalysisTaskFlowEvent.cxx \ - FLOW/AliFlowTasks/AliAnalysisTaskFlowEventforRP.cxx + FLOW/AliFlowTasks/AliAnalysisTaskFlowEventforRP.cxx \ + FLOW/AliFlowTasks/AliAnalysisTaskMixedHarmonics.cxx \ + FLOW/AliFlowTasks/AliAnalysisTaskNestedLoops.cxx HDRS= $(SRCS:.cxx=.h)