#include "TChain.h"
#include "TTree.h"
#include "TFile.h"
+#include "TList.h"
class AliAnalysisTask;
#include "AliAnalysisManager.h"
#include "AliMCEventHandler.h"
#include "AliMCEvent.h"
+#include "../../CORRFW/AliCFManager.h"
+
#include "AliAnalysisTaskLYZEventPlane.h"
#include "AliFlowEventSimpleMaker.h"
#include "AliFlowLYZEventPlane.h"
fLyzEp(NULL),
fLyz(NULL),
fEventMaker(NULL),
- fFirstRunFile(NULL),
+ fCFManager1(NULL),
+ fCFManager2(NULL),
+ fListHistos(NULL),
fSecondRunFile(NULL)
{
// Constructor
// Input slot #0 works with a TChain
DefineInput(0, TChain::Class());
DefineInput(1, TList::Class());
- DefineInput(2, TList::Class());
// Output slot #0 writes into a TList container
DefineOutput(0, TList::Class());
}
+//________________________________________________________________________
+AliAnalysisTaskLYZEventPlane::AliAnalysisTaskLYZEventPlane() :
+ fESD(NULL),
+ fAOD(NULL),
+ fAnalysisType("ESD"),
+ fLyzEp(NULL),
+ fLyz(NULL),
+ fEventMaker(NULL),
+ fCFManager1(NULL),
+ fCFManager2(NULL),
+ fListHistos(NULL),
+ fSecondRunFile(NULL)
+{
+ // Constructor
+ cout<<"AliAnalysisTaskLYZEventPlane::AliAnalysisTaskLYZEventPlane()"<<endl;
+}
+
+
+//________________________________________________________________________
+AliAnalysisTaskLYZEventPlane::~AliAnalysisTaskLYZEventPlane()
+{
+ //destructor
+
+}
+
//________________________________________________________________________
void AliAnalysisTaskLYZEventPlane::ConnectInputData(Option_t *)
{
fLyzEp = new AliFlowLYZEventPlane() ;
//Analyser
fLyz = new AliFlowAnalysisWithLYZEventPlane() ;
-
- //output file
- TString outputName = "outputFromLYZEventPlaneAnalysis" ;
- outputName += fAnalysisType.Data() ;
- outputName += ".root" ;
- fLyz->SetOutFileName( outputName.Data() );
- // Get data from input slot 1 and 2
- fFirstRunFile = (TFile*)GetInputData(1);
- cerr<<"fFirstRunFile ("<<fFirstRunFile<<")"<<endl;
- if (fFirstRunFile) cerr<<"fFirstRunFile -> IsOpen() = "<<fFirstRunFile -> IsOpen()<<endl;
- fSecondRunFile = (TFile*)GetInputData(2);
+ // Get data from input slot
+ fSecondRunFile = (TFile*)GetInputData(1);
cerr<<"fSecondRunFile ("<<fSecondRunFile<<")"<<endl;
if (fSecondRunFile) cerr<<"fSecondRunFile -> IsOpen() = "<<fSecondRunFile -> IsOpen()<<endl;
-
- fLyzEp -> SetFirstRunFile(fFirstRunFile);
+
fLyzEp -> SetSecondRunFile(fSecondRunFile);
- fLyz -> SetFirstRunFile(fFirstRunFile);
fLyz -> SetSecondRunFile(fSecondRunFile);
fLyzEp-> Init();
fLyz-> Init();
+ if (fLyz->GetHistList()) {
+ fListHistos = fLyz->GetHistList();
+ fListHistos->Print();
+ }
+ else { cout<<"ERROR: Could not retrieve histogram list"<<endl;}
+
}
{
// Main loop
// Called for each event
+
if (fAnalysisType == "MC") {
// Process MC truth, therefore we receive the AliAnalysisManager and ask it for the AliMCEventHandler
// This handler can return the current MC event
return;
}
+ fCFManager1->SetEventInfo(mcEvent);
+ fCFManager2->SetEventInfo(mcEvent);
+
Printf("MC particles: %d", mcEvent->GetNumberOfTracks());
//lee yang zeros analysis
- AliFlowEventSimple* fEvent = fEventMaker->FillTracks(mcEvent);
+ AliFlowEventSimple* fEvent = fEventMaker->FillTracks(mcEvent,fCFManager1,fCFManager2);
fLyz->Make(fEvent,fLyzEp);
delete fEvent;
Printf("There are %d tracks in this event", fESD->GetNumberOfTracks());
//lee yang zeros analysis
- AliFlowEventSimple* fEvent = fEventMaker->FillTracks(fESD);
+ AliFlowEventSimple* fEvent = fEventMaker->FillTracks(fESD,fCFManager1,fCFManager2);
fLyz->Make(fEvent,fLyzEp);
delete fEvent;
}
- else if (fAnalysisType == "ESDMC0") {
+ else if (fAnalysisType == "ESDMC0" || fAnalysisType == "ESDMC1") {
if (!fESD) {
Printf("ERROR: fESD not available");
return;
return;
}
- //lee yang zeros analysis
- AliFlowEventSimple* fEvent = fEventMaker->FillTracks(fESD,mcEvent,0); //0 = kine from ESD, 1 = kine from MC
- fLyz->Make(fEvent,fLyzEp);
- delete fEvent;
- //delete mcEvent;
- }
- else if (fAnalysisType == "ESDMC1") {
- if (!fESD) {
- Printf("ERROR: fESD not available");
- return;
- }
- Printf("There are %d tracks in this event", fESD->GetNumberOfTracks());
-
- AliMCEventHandler* eventHandler = dynamic_cast<AliMCEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
- if (!eventHandler) {
- Printf("ERROR: Could not retrieve MC event handler");
- return;
- }
+ fCFManager1->SetEventInfo(mcEvent);
+ fCFManager2->SetEventInfo(mcEvent);
- AliMCEvent* mcEvent = eventHandler->MCEvent();
- if (!mcEvent) {
- Printf("ERROR: Could not retrieve MC event");
- return;
+ //lee yang zeros analysis
+ AliFlowEventSimple* fEvent = NULL;
+ if (fAnalysisType == "ESDMC0") {
+ fEvent = fEventMaker->FillTracks(fESD, mcEvent,fCFManager1, fCFManager2,0); //0 = kine from ESD, 1 = kine from MC
+ } else if (fAnalysisType == "ESDMC1") {
+ fEvent = fEventMaker->FillTracks(fESD, mcEvent,fCFManager1, fCFManager2,0); //0 = kine from ESD, 1 = kine from MC
}
- //lee yang zeros analysis
- AliFlowEventSimple* fEvent = fEventMaker->FillTracks(fESD,mcEvent,1); //0 = kine from ESD, 1 = kine from MC
fLyz->Make(fEvent,fLyzEp);
delete fEvent;
//delete mcEvent;
}
+
else if (fAnalysisType == "AOD") {
if (!fAOD) {
Printf("ERROR: fAOD not available");
Printf("There are %d tracks in this event", fAOD->GetNumberOfTracks());
//lee yang zeros analysis
+ //for the moment don't use CF
+ //AliFlowEventSimple* fEvent = fEventMaker->FillTracks(fAOD,fCFManager1,fCFManager2);
AliFlowEventSimple* fEvent = fEventMaker->FillTracks(fAOD);
fLyz->Make(fEvent,fLyzEp);
delete fEvent;
}
- PostData(0,fLyz->GetOutFile());
+ PostData(0,fListHistos);
}
//________________________________________________________________________
// Called once at the end of the query
fLyz->Finish();
- delete fLyz;
- delete fLyzEp;
- delete fEventMaker;
+ TList* fOutHistos = (TList*)GetOutputData(0);
+ if (fOutHistos) { fOutHistos->Print(); }
+ else { cout<<"hostogram list pointer in Terminate is empty"<<endl; }
+
+ //delete fLyz;
+ //delete fLyzEp;
+ //delete fEventMaker;
}
class AliESDEvent;
class AliAODEvent;
+class AliCFManager;
class AliFlowLYZEventPlane;
class AliFlowAnalysisWithLYZEventPlane;
class AliFlowEventSimpleMaker;
class TFile;
+class TList;
+#include "TString.h"
#include "AliAnalysisTask.h"
class AliAnalysisTaskLYZEventPlane : public AliAnalysisTask {
public:
- AliAnalysisTaskLYZEventPlane(const char *name = "AliAnalysisTaskLYZEventPlane");
- virtual ~AliAnalysisTaskLYZEventPlane() {}
+ AliAnalysisTaskLYZEventPlane();
+ AliAnalysisTaskLYZEventPlane(const char *name);
+ virtual ~AliAnalysisTaskLYZEventPlane();
virtual void ConnectInputData(Option_t *);
virtual void CreateOutputObjects();
virtual void Terminate(Option_t *);
void SetAnalysisType(TString type) {this->fAnalysisType = type ; }
+ TString GetAnalysisType() const {return this->fAnalysisType; }
+
+ void SetCFManager1(AliCFManager* cfmgr) {this->fCFManager1 = cfmgr; }
+ AliCFManager* GetCFManager1() const {return this->fCFManager1; }
+ void SetCFManager2(AliCFManager* cfmgr) {this->fCFManager2 = cfmgr; }
+ AliCFManager* GetCFManager2() const {return this->fCFManager2; }
private:
AliFlowLYZEventPlane* fLyzEp; //LYZ EP object
AliFlowAnalysisWithLYZEventPlane* fLyz; //LYZ EP analysis object
AliFlowEventSimpleMaker* fEventMaker; //FlowEventSimple maker object
-
- TFile* fFirstRunFile; //! output from the first LYZ loop
- TFile* fSecondRunFile; //! output from the second LYZ loop
+ AliCFManager* fCFManager1; //Correction framework manager
+ AliCFManager* fCFManager2; //Correction framework manager
+ TList* fListHistos; //collection of output hists
+ TFile* fSecondRunFile; //output from the second LYZ loop
ClassDef(AliAnalysisTaskLYZEventPlane, 1); // example of analysis
};
#include "AliMCEventHandler.h"
#include "AliMCEvent.h"
+#include "../../CORRFW/AliCFManager.h"
+
#include "AliGenCocktailEventHeader.h"
#include "AliGenHijingEventHeader.h"
AliAnalysisTask(name, ""),
fESD(0),
fAOD(0),
+ fAnalysisType("MC"),
+ fCFManager1(NULL),
+ fCFManager2(NULL),
fMc(0),
fEventMaker(0),
- fAnalysisType("MC")
+ fListHistos(NULL)
{
// Constructor
cout<<"AliAnalysisTaskMCEventPlane::AliAnalysisTaskMCEventPlane(const char *name)"<<endl;
DefineOutput(0, TList::Class());
}
+//________________________________________________________________________
+AliAnalysisTaskMCEventPlane::AliAnalysisTaskMCEventPlane() :
+ fESD(0),
+ fAOD(0),
+ fAnalysisType("MC"),
+ fCFManager1(NULL),
+ fCFManager2(NULL),
+ fMc(0),
+ fEventMaker(0),
+ fListHistos(NULL)
+{
+ // Constructor
+ cout<<"AliAnalysisTaskMCEventPlane::AliAnalysisTaskMCEventPlane()"<<endl;
+
+}
+
+//________________________________________________________________________
+AliAnalysisTaskMCEventPlane::~AliAnalysisTaskMCEventPlane()
+{
+
+ //destructor
+
+}
+
//________________________________________________________________________
void AliAnalysisTaskMCEventPlane::ConnectInputData(Option_t *)
{
fEventMaker = new AliFlowEventSimpleMaker();
//Analyser
fMc = new AliFlowAnalysisWithMCEventPlane() ;
-
- //output file
- TString outputName = "outputFromMCEventPlaneAnalysis" ;
- outputName += fAnalysisType.Data() ;
- outputName += ".root" ;
- fMc->SetHistFileName( outputName.Data() );
-
+
fMc-> Init();
+ if (fMc->GetHistList()) {
+ fMc->GetHistList()->Print();
+ fListHistos = fMc->GetHistList();
+ fListHistos->Print();
+ }
+ else {Printf("ERROR: Could not retrieve histogram list"); }
}
return;
}
+ fCFManager1->SetEventInfo(mcEvent);
+ fCFManager2->SetEventInfo(mcEvent);
+
Printf("MC particles: %d", mcEvent->GetNumberOfTracks());
AliGenCocktailEventHeader *header = dynamic_cast<AliGenCocktailEventHeader *> (mcEvent-> GenEventHeader());
if (fAnalysisType == "MC") {
// analysis
- AliFlowEventSimple* fEvent = fEventMaker->FillTracks(mcEvent);
+ //AliFlowEventSimple* fEvent = fEventMaker->FillTracks(mcEvent);
+ AliFlowEventSimple* fEvent = fEventMaker->FillTracks(mcEvent,fCFManager1,fCFManager2);
fMc->Make(fEvent,fRP);
-
delete fEvent;
}
Printf("There are %d tracks in this event", fESD->GetNumberOfTracks());
// analysis
- AliFlowEventSimple* fEvent = fEventMaker->FillTracks(fESD);
+ //AliFlowEventSimple* fEvent = fEventMaker->FillTracks(fESD);
+ AliFlowEventSimple* fEvent = fEventMaker->FillTracks(fESD,fCFManager1,fCFManager2);
fMc->Make(fEvent,fRP);
delete fEvent;
}
Printf("There are %d tracks in this event", fESD->GetNumberOfTracks());
// analysis
- AliFlowEventSimple* fEvent = fEventMaker->FillTracks(fESD,mcEvent,0); //0 = kine from ESD, 1 = kine from MC
+ //AliFlowEventSimple* fEvent = fEventMaker->FillTracks(fESD,mcEvent,0); //0 = kine from ESD, 1 = kine from MC
+ AliFlowEventSimple* fEvent = fEventMaker->FillTracks(fESD, mcEvent, fCFManager1, fCFManager2, 0);
fMc->Make(fEvent,fRP);
delete fEvent;
}
Printf("There are %d tracks in this event", fESD->GetNumberOfTracks());
// analysis
- AliFlowEventSimple* fEvent = fEventMaker->FillTracks(fESD,mcEvent,1); //0 = kine from ESD, 1 = kine from MC
+ //AliFlowEventSimple* fEvent = fEventMaker->FillTracks(fESD,mcEvent,1); //0 = kine from ESD, 1 = kine from MC
+ AliFlowEventSimple* fEvent = fEventMaker->FillTracks(fESD, mcEvent, fCFManager1, fCFManager2, 1);
fMc->Make(fEvent,fRP);
delete fEvent;
}
Printf("There are %d tracks in this event", fAOD->GetNumberOfTracks());
// analysis
- AliFlowEventSimple* fEvent = fEventMaker->FillTracks(fAOD);
+ AliFlowEventSimple* fEvent = fEventMaker->FillTracks(fAOD); //no CF yet!
fMc->Make(fEvent,fRP);
delete fEvent;
}
+ //PostData(0,fListHistos); //here for CAF
+
}
//________________________________________________________________________
{
// Called once at the end of the query
fMc->Finish();
- PostData(0,fMc->GetHistFile());
+ PostData(0,fListHistos);
- delete fMc;
- delete fEventMaker;
+ //delete fMc;
+ //delete fEventMaker;
}
class AliESDEvent;
class AliAODEvent;
+class AliCFManager;
class AliFlowAnalysisWithMCEventPlane;
class AliFlowEventSimpleMaker;
+class TList;
#include "TString.h"
#include "AliAnalysisTask.h"
class AliAnalysisTaskMCEventPlane : public AliAnalysisTask {
public:
- AliAnalysisTaskMCEventPlane(const char *name = "AliAnalysisTaskMCEventPlane");
- virtual ~AliAnalysisTaskMCEventPlane() {}
+
+ AliAnalysisTaskMCEventPlane();
+ AliAnalysisTaskMCEventPlane(const char *name);
+ virtual ~AliAnalysisTaskMCEventPlane();
virtual void ConnectInputData(Option_t *);
virtual void CreateOutputObjects();
void SetAnalysisType(TString type) { this->fAnalysisType = type; }
TString GetAnalysisType() const { return this->fAnalysisType; }
+ void SetCFManager1(AliCFManager* cfmgr) {this->fCFManager1 = cfmgr; }
+ AliCFManager* GetCFManager1() {return this->fCFManager1; }
+ void SetCFManager2(AliCFManager* cfmgr) {this->fCFManager2 = cfmgr; }
+ AliCFManager* GetCFManager2() {return this->fCFManager2; }
+
private:
AliAnalysisTaskMCEventPlane(const AliAnalysisTaskMCEventPlane& aAnalysis);
AliESDEvent *fESD; // ESD object
AliAODEvent *fAOD; // AOD object
+ TString fAnalysisType; // can be MC, ESD or AOD
+ AliCFManager* fCFManager1; // correction framework manager
+ AliCFManager* fCFManager2; // correction framework manager
AliFlowAnalysisWithMCEventPlane* fMc; // MC EP analysis object
AliFlowEventSimpleMaker* fEventMaker; // FlowEventSimple maker object
- TString fAnalysisType; // can be MC, ESD or AOD
+
+ TList* fListHistos; // collection of output
ClassDef(AliAnalysisTaskMCEventPlane, 1); // example of analysis
};
#include "Riostream.h" //needed as include
#include "TFile.h"
+#include "TList.h"
#include "TComplex.h" //needed as include
#include "TCanvas.h" //needed as include
#include "TLegend.h" //needed as include
//-----------------------------------------------------------------------
AliFlowAnalysisWithLYZEventPlane::AliFlowAnalysisWithLYZEventPlane():
- fOutFile(0),
- fFirstRunFile(0),
fSecondRunFile(0),
- fFirstRunFileName(0),
fSecondRunFileName(0),
- fOutFileName(0),
- fSecondReDtheta(0),
- fSecondImDtheta(0),
- fFirstr0theta(0),
- fSecondVPt(0),
- fHistProFlow(0),
- fHistProFlow2(0),
- fHistProWr(0),
- fHistProWrCorr(0),
- fHistFlow(0),
- fHistDeltaPhi(0),
- fHistDeltaPhi2(0),
- fHistDeltaPhihere(0),
- fHistPhiEP(0),
- fHistPhiEPhere(0),
- fHistPhiLYZ(0),
- fHistPhiLYZ2(0),
- fHistProR0theta(0),
- fHistProReDtheta(0),
- fHistProImDtheta(0),
- fCommonHists(0),
- fCommonHistsRes(0),
+ fHistList(NULL),
+ fSecondReDtheta(NULL),
+ fSecondImDtheta(NULL),
+ fFirstr0theta(NULL),
+ fSecondVPt(NULL),
+ fHistProFlow(NULL),
+ fHistProFlow2(NULL),
+ fHistProWr(NULL),
+ fHistProWrCorr(NULL),
+ fHistFlow(NULL),
+ fHistDeltaPhi(NULL),
+ fHistDeltaPhi2(NULL),
+ fHistDeltaPhihere(NULL),
+ fHistPhiEP(NULL),
+ fHistPhiEPhere(NULL),
+ fHistPhiLYZ(NULL),
+ fHistPhiLYZ2(NULL),
+ fCommonHists(NULL),
+ fCommonHistsRes(NULL),
fEventNumber(0),
fQsum(NULL),
fQ2sum(0)
// Constructor.
fQsum = new TVector2(); // flow vector sum
+
+ fHistList = new TList();
}
{
//destructor
delete fQsum;
+ delete fHistList;
}
//input histograms
if (fSecondRunFile->IsZombie()){ //check if file exists
- cout << "Error opening file, run first with fFirstrun = kTRUE" << endl;
+ cout << "Error opening file, no input file from LYZ analysis" << endl;
exit(-1);
} else if (fSecondRunFile->IsOpen()){
cout<<"----secondRunFile is open----"<<endl;
- fSecondVPt = (TProfile*)fSecondRunFile->Get("Flow_Differential_Pt_LYZ"); //to compare to
- }
-
- if (fFirstRunFile->IsZombie()){ //check if file exists
- cout << "Error opening file, run first with fFirstrun = kTRUE" << endl;
- exit(-1);
- } else if (fFirstRunFile->IsOpen()){
- cout<<"----firstRunFile is open----"<<endl<<endl;
- fFirstr0theta = (TProfile*)fFirstRunFile->Get("First_FlowPro_r0theta_LYZ");
+ //get List
+ TList* list = (TList*)fSecondRunFile->Get("cobj1");
+ fSecondVPt = (TProfile*)list->FindObject("Flow_Differential_Pt_LYZ"); //to compare to
+ fSecondReDtheta = (TProfile*)list->FindObject("Second_FlowPro_ReDtheta_LYZ");
+ fHistList->Add(fSecondReDtheta);
+ fSecondImDtheta = (TProfile*)list->FindObject("Second_FlowPro_ImDtheta_LYZ");
+ fHistList->Add(fSecondImDtheta);
+ fFirstr0theta = (TProfile*)list->FindObject("First_FlowPro_r0theta_LYZ");
+ fHistList->Add(fFirstr0theta);
}
- //output file
- // ********make output file
- // analysis file (output)
- fOutFile = new TFile(fOutFileName.Data(),"RECREATE") ;
-
fCommonHists = new AliFlowCommonHist("LYZEP");
- fCommonHistsRes = new AliFlowCommonHistResults("LYZEP");
+ fHistList->Add(fCommonHists->GetHistMultOrig());
+ fHistList->Add(fCommonHists->GetHistMultInt());
+ fHistList->Add(fCommonHists->GetHistMultDiff());
+ fHistList->Add(fCommonHists->GetHistPtInt());
+ fHistList->Add(fCommonHists->GetHistPtDiff());
+ fHistList->Add(fCommonHists->GetHistPhiInt());
+ fHistList->Add(fCommonHists->GetHistPhiDiff());
+ fHistList->Add(fCommonHists->GetHistEtaInt());
+ fHistList->Add(fCommonHists->GetHistEtaDiff());
+ fHistList->Add(fCommonHists->GetHistProMeanPtperBin());
+ fHistList->Add(fCommonHists->GetHistQ());
+
+ fCommonHistsRes = new AliFlowCommonHistResults("LYZEP");
+ fHistList->Add(fCommonHistsRes->GetHistDiffFlow());
+ fHistList->Add(fCommonHistsRes->GetHistChi());
+ fHistList->Add(fCommonHistsRes->GetHistIntFlow());
+
- // output histograms
- Int_t iNtheta = AliFlowLYZConstants::kTheta;
Int_t iNbinsPt = AliFlowCommonConstants::GetNbinsPt();
Double_t dPtMin = AliFlowCommonConstants::GetPtMin();
Double_t dPtMax = AliFlowCommonConstants::GetPtMax();
-
fHistProFlow = new TProfile("FlowPro_VPt_LYZEP","FlowPro_VPt_LYZEP",iNbinsPt,dPtMin,dPtMax);
fHistProFlow->SetXTitle("Pt");
fHistProFlow->SetYTitle("v2 (%)");
+ fHistList->Add(fHistProFlow);
fHistProWr = new TProfile("FlowPro_Wr_LYZEP","FlowPro_Wr_LYZEP",100,0.,0.25);
fHistProWr->SetXTitle("Q");
fHistProWr->SetYTitle("Wr");
+ fHistList->Add(fHistProWr);
fHistDeltaPhi = new TH1F("Flow_DeltaPhi_LYZEP","Flow_DeltaPhi_LYZEP",100,0.,3.14);
fHistDeltaPhi->SetXTitle("DeltaPhi");
fHistDeltaPhi->SetYTitle("Counts");
+ fHistList->Add(fHistDeltaPhi);
fHistPhiLYZ = new TH1F("Flow_PhiLYZ_LYZEP","Flow_PhiLYZ_LYZEP",100,0.,3.14);
fHistPhiLYZ->SetXTitle("Phi from LYZ");
fHistPhiLYZ->SetYTitle("Counts");
+ fHistList->Add(fHistPhiLYZ);
fHistPhiEP = new TH1F("Flow_PhiEP_LYZEP","Flow_PhiEP_LYZEP",100,0.,3.14);
fHistPhiEP->SetXTitle("Phi from EP");
fHistPhiEP->SetYTitle("Counts");
-
-
- fHistProR0theta = new TProfile("FlowPro_r0theta_LYZEP","FlowPro_r0theta_LYZEP",iNtheta,-0.5,iNtheta-0.5);
- fHistProR0theta->SetXTitle("#theta");
- fHistProR0theta->SetYTitle("r_{0}^{#theta}");
-
- fHistProReDtheta = new TProfile("FlowPro_ReDtheta_LYZEP","FlowPro_ReDtheta_LYZEP",iNtheta, -0.5, iNtheta-0.5);
- fHistProReDtheta->SetXTitle("#theta");
- fHistProReDtheta->SetYTitle("Re(D^{#theta})");
-
- fHistProImDtheta = new TProfile("FlowPro_ImDtheta_LYZEP","FlowPro_ImDtheta_LYZEP",iNtheta, -0.5, iNtheta-0.5);
- fHistProImDtheta->SetXTitle("#theta");
- fHistProImDtheta->SetYTitle("Im(D^{#theta})");
+ fHistList->Add(fHistPhiEP);
fEventNumber = 0; //set number of events to zero
-
}
dQY = vQ.Y()/vQ.GetMult();
} else {cerr<<"vQ.GetMult() is zero!"<<endl; }
vQ.Set(dQX,dQY);
+
//for chi calculation:
*fQsum += vQ;
fQ2sum += vQ.Mod2();
Double_t dChi= 0;
if (fEventNumber!=0) {
*fQsum /= fEventNumber;
- //cerr<<"fQsum.X() = "<<fQsum.X()<<endl;
- //cerr<<"fQsum.Y() = "<<fQsum.Y()<<endl;
+ cerr<<"fQsum->X() = "<<fQsum->X()<<endl;
+ cerr<<"fQsum->Y() = "<<fQsum->Y()<<endl;
fQ2sum /= fEventNumber;
cerr<<"fEventNumber = "<<fEventNumber<<endl;
cerr<<"fQ2sum = "<<fQ2sum<<endl;
dSigma2 = fQ2sum - TMath::Power(fQsum->X(),2.) - TMath::Power(fQsum->Y(),2.) - TMath::Power(dV,2.); //BP eq. 62
+ cerr<<"dSigma2"<<dSigma2<<endl;
if (dSigma2>0) dChi = dV/TMath::Sqrt(dSigma2);
else dChi = -1.;
fCommonHistsRes->FillChi(dChi);
} //loop over b
- // write to file
- fOutFile->Write();
cout<<"Making some plots to check the results:"<<endl<<endl;
class TProfile;
class TH1F;
class TH1D;
+class TList;
+class Riostream;
// AliFlowAnalysisWithLYZEventPlane:
// Class to do flow analysis with the event plane from the LYZ method
class AliFlowAnalysisWithLYZEventPlane {
+
public:
- AliFlowAnalysisWithLYZEventPlane();
- virtual ~AliFlowAnalysisWithLYZEventPlane();
+
+ AliFlowAnalysisWithLYZEventPlane(); //default constructor
+ virtual ~AliFlowAnalysisWithLYZEventPlane(); //destructor
virtual void Init();
virtual void Make(AliFlowEventSimple* fEvent, AliFlowLYZEventPlane* fLYZEP);
- // virtual void Make(AliFlowEventSimple* anEvent);
virtual void Finish();
// input files
- void SetFirstRunFileName(TString name)
- { this->fFirstRunFileName = name ; } // Sets input file name
- TString GetFirstRunFileName() const
- { return this->fFirstRunFileName ; } // Gets output file name
- void SetFirstRunFile(TFile* file)
- { this->fFirstRunFile = file ; } // Sets first run file
-
- void SetSecondRunFileName(TString name)
- { this->fSecondRunFileName = name ; } // Sets input file name
- TString GetSecondRunFileName() const
- { return this->fSecondRunFileName ; } // Gets output file name
- void SetSecondRunFile(TFile* file)
- { this->fSecondRunFile = file ; } // Sets first run file
-
- // Output
- void SetOutFileName(TString name) { this->fOutFileName = name ; }
- // Sets output file name
- TString GetOutFileName() const { return this->fOutFileName ; }
- // Gets output file name
- TFile* GetOutFile() const { return this->fOutFile ; }
- // Gets output file
+ void SetSecondRunFileName(TString name) { this->fSecondRunFileName = name ; } // Sets input file name
+ TString GetSecondRunFileName() const { return this->fSecondRunFileName ; } // Gets output file name
+ void SetSecondRunFile(TFile* file) { this->fSecondRunFile = file ; } // Sets first run file
+
+ //output
+ TList* GetHistList() const {return this->fHistList; }
private:
AliFlowAnalysisWithLYZEventPlane(const AliFlowAnalysisWithLYZEventPlane& aAnalysis); // copy constructor
AliFlowAnalysisWithLYZEventPlane& operator=(const AliFlowAnalysisWithLYZEventPlane& aAnalysis); // assignment operator
- TFile* fOutFile; //!
- TFile* fFirstRunFile ; //! pointer to file from first run
- TFile* fSecondRunFile ; //! pointer to file from second run
- TString fFirstRunFileName; //!
- TString fSecondRunFileName; //!
- TString fOutFileName; //!
+ TFile* fSecondRunFile ; // pointer to file from second run
+ TString fSecondRunFileName;
//histograms
+ TList* fHistList; //list ro hold all histograms
//input
TProfile* fSecondReDtheta; // input profile
TProfile* fSecondImDtheta; // input profile
TH1F* fHistPhiEPhere; //
TH1F* fHistPhiLYZ; //
TH1F* fHistPhiLYZ2; //
- TProfile* fHistProR0theta; //
- TProfile* fHistProReDtheta; //
- TProfile* fHistProImDtheta; //
AliFlowCommonHist* fCommonHists; //
AliFlowCommonHistResults* fCommonHistsRes; //
Int_t fEventNumber; // event counter
- TVector2 *fQsum; // flow vector sum
- Double_t fQ2sum; // flow vector sum squared
+ TVector2 *fQsum; // flow vector sum
+ Double_t fQ2sum; // flow vector sum squared
ClassDef(AliFlowAnalysisWithLYZEventPlane, 0); // lyz analysis
#include "TFile.h" //needed as include
#include "TProfile.h" //needed as include
#include "TComplex.h" //needed as include
+#include "TList.h"
class TH1F;
fQ2sum(0),
fEventNumber(0),
fDebug(kFALSE),
- fHistFileName(0),
- fHistFile(0),
+ fHistList(NULL),
fCommonHists(NULL),
fCommonHistsRes(NULL),
fHistProFlow(NULL),
{
// Constructor.
+ fHistList = new TList();
+
fQsum = new TVector2; // flow vector sum
}
AliFlowAnalysisWithMCEventPlane::~AliFlowAnalysisWithMCEventPlane()
{
//destructor
+ delete fHistList;
delete fQsum;
}
Double_t dPtMin = AliFlowCommonConstants::GetPtMin();
Double_t dPtMax = AliFlowCommonConstants::GetPtMax();
- // analysis file (output)
- fHistFile = new TFile(fHistFileName.Data(),"RECREATE") ;
-
fCommonHists = new AliFlowCommonHist("MC");
+ fHistList->Add(fCommonHists->GetHistMultOrig());
+ fHistList->Add(fCommonHists->GetHistMultInt());
+ fHistList->Add(fCommonHists->GetHistMultDiff());
+ fHistList->Add(fCommonHists->GetHistPtInt());
+ fHistList->Add(fCommonHists->GetHistPtDiff());
+ fHistList->Add(fCommonHists->GetHistPhiInt());
+ fHistList->Add(fCommonHists->GetHistPhiDiff());
+ fHistList->Add(fCommonHists->GetHistEtaInt());
+ fHistList->Add(fCommonHists->GetHistEtaDiff());
+ fHistList->Add(fCommonHists->GetHistProMeanPtperBin());
+ fHistList->Add(fCommonHists->GetHistQ());
fCommonHistsRes = new AliFlowCommonHistResults("MC");
+ fHistList->Add(fCommonHistsRes->GetHistDiffFlow());
+ fHistList->Add(fCommonHistsRes->GetHistChi());
+ fHistList->Add(fCommonHistsRes->GetHistIntFlow());
fHistProFlow = new TProfile("FlowPro_VPt_MC","FlowPro_VPt_MC",iNbinsPt,dPtMin,dPtMax);
fHistProFlow->SetXTitle("Pt");
fHistProFlow->SetYTitle("v2 (%)");
+ fHistList->Add(fHistProFlow);
fHistRP = new TH1F("Flow_RP_MC","Flow_RP_MC",100,0.,3.14);
fHistRP->SetXTitle("Reaction Plane Angle");
fHistRP->SetYTitle("Counts");
+ fHistList->Add(fHistRP);
fEventNumber = 0; //set number of events to zero
dErrV = TMath::Sqrt(dErrV);
cout<<"dV is "<<dV<<" +- "<<dErrV<<endl;
fCommonHistsRes->FillIntegratedFlow(dV,dErrV);
-
- // write to file
- fHistFile->Write();
-
+
cout<<".....finished"<<endl;
}
class TProfile2D;
class TObjArray;
class TFile;
+class TList;
class TComplex;
class Riostream;
public:
- AliFlowAnalysisWithMCEventPlane(); //default constructor
-
+ AliFlowAnalysisWithMCEventPlane(); //default constructor
virtual ~AliFlowAnalysisWithMCEventPlane(); //destructor
void Init(); //defines variables and histograms
// Output
- void SetHistFileName(TString name) { this->fHistFileName = name ; } // Sets output file name
- TString GetHistFileName() const { return this->fHistFileName ; } // Gets output file name
- TFile* GetHistFile() const { return this->fHistFile ; } // Gets output file
+ TList* GetHistList() const { return this->fHistList ; }
private:
Int_t fEventNumber; // event counter
Bool_t fDebug ; //! flag for lyz analysis: more print statements
- TString fHistFileName; //!
- TFile* fHistFile; //!
+ TList* fHistList; //list to hold all output histograms
AliFlowCommonHist* fCommonHists; //
AliFlowCommonHistResults* fCommonHistsRes; //
//-----------------------------------------------------------------------
AliFlowLYZEventPlane::AliFlowLYZEventPlane():
- fFirstRunFile(0),
fSecondRunFile(0),
- fFirstRunFileName("noname.ESD"),
fSecondRunFileName("noname.ESD"),
fWR(0),
fPsi(0),
exit(-1);
} else if (fSecondRunFile->IsOpen()){
cout<<"----secondRunFile is open----"<<endl;
- fSecondReDtheta = ( TProfile*)fSecondRunFile->Get("Second_FlowPro_ReDtheta_LYZ");
- fSecondImDtheta = ( TProfile*)fSecondRunFile->Get("Second_FlowPro_ImDtheta_LYZ");
- }
- if (fFirstRunFile->IsZombie()){ //check if file exists
- cout << "Error opening file, run first regular LYZ first run" << endl;
- exit(-1);
- } else if (fFirstRunFile->IsOpen()){
- cout<<"----firstRunFile is open----"<<endl<<endl;
- fFirstr0theta = (TProfile*)fFirstRunFile->Get("First_FlowPro_r0theta_LYZ");
+ //get List
+ TList* list = (TList*)fSecondRunFile->Get("cobj1");
+ fSecondReDtheta = ( TProfile*)list->FindObject("Second_FlowPro_ReDtheta_LYZ");
+ fSecondImDtheta = ( TProfile*)list->FindObject("Second_FlowPro_ImDtheta_LYZ");
+ fFirstr0theta = ( TProfile*)list->FindObject("First_FlowPro_r0theta_LYZ");
}
}
Double_t GetWR() const {return this->fWR; }
Double_t GetPsi() const {return this->fPsi; }
- // input files
- void SetFirstRunFileName(TString name)
- { this->fFirstRunFileName = name ; } // Sets input file name
- TString GetFirstRunFileName() const
- { return this->fFirstRunFileName ; } // Gets output file name
- void SetFirstRunFile(TFile* file)
- { this->fFirstRunFile = file ; } // Sets first run file
-
+ // input file
void SetSecondRunFileName(TString name)
{ this->fSecondRunFileName = name ; } // Sets input file name
TString GetSecondRunFileName() const
{ this->fSecondRunFile = file ; } // Sets second run file
-
private:
AliFlowLYZEventPlane(const AliFlowLYZEventPlane& aAnalysis); // copy constructor
AliFlowLYZEventPlane& operator=(const AliFlowLYZEventPlane& aAnalysis); // assignment operator
- TFile* fFirstRunFile ; //! pointer to file from first run
TFile* fSecondRunFile ; //! pointer to file from second run
- TString fFirstRunFileName; //!
TString fSecondRunFileName; //!
Double_t fWR; // event weight
// LYZ2 = Lee Yang Zeroes second run
// LYZEP = Lee Yang Zeroes Event Plane
// CUM = Cumulants
-const TString method = "SP";
+// MCEP = Flow calculated from the real MC event plane (only for simulated data)
+const TString method = "MCEP";
//Type of analysis can be:
// ESD, AOD, MC, ESDMC0, ESDMC1
-const TString type = "ESDMC1";
+const TString type = "ESD";
//SETTING THE CUTS
if (method == "LYZ2"){
- // read the input files from the first run
- TString firstRunFileName = "outputLYZ1analysis" ;
- firstRunFileName += type;
- firstRunFileName += "_firstrun.root";
- cout<<"The input file is "<<firstRunFileName.Data()<<endl;
- TFile* fFirstRunFile = new TFile(firstRunFileName.Data(),"READ");
- if(!fFirstRunFile || fFirstRunFile->IsZombie()) { cerr << " ERROR: NO First Run file... " << endl ; }
- cout<<"input files read..."<<endl;
+ // read the input file from the first run
+ TString inputFileName = "outputLYZ1analysis" ;
+ inputFileName += type;
+ inputFileName += "_firstrun.root";
+ cout<<"The input file is "<<inputFileName.Data()<<endl;
+ TFile* fInputFile = new TFile(inputFileName.Data(),"READ");
+ if(!fInputFile || fInputFile->IsZombie()) { cerr << " ERROR: NO First Run file... " << endl ; }
+ cout<<"input file read..."<<endl;
}
+ if (method == "LYZEP") {
+ // read the input file from the second LYZ run
+ TString inputFileName = "outputLYZ2analysis" ;
+ inputFileName += type;
+ inputFileName += "_secondrun.root";
+ cout<<"The input file is "<<inputFileName.Data()<<endl;
+ TFile* fInputFile = new TFile(inputFileName.Data(),"READ");
+ if(!fInputFile || fInputFile->IsZombie()) { cerr << " ERROR: NO First Run file... " << endl ; }
+ cout<<"input file read..."<<endl;
+ }
+
//____________________________________________//
// Make the analysis manager
if (type == "ESD"){
AliVEventHandler* esdH = new AliESDInputHandler;
- mgr->SetInputEventHandler(esdH); }
+ mgr->SetInputEventHandler(esdH);
+ if (method == "MCEP") {
+ AliMCEventHandler *mc = new AliMCEventHandler();
+ mgr->SetMCtruthEventHandler(mc);} }
if (type == "AOD"){
AliVEventHandler* aodH = new AliAODInputHandler;
- mgr->SetInputEventHandler(aodH); }
+ mgr->SetInputEventHandler(aodH);
+ if (method == "MCEP") {
+ AliMCEventHandler *mc = new AliMCEventHandler();
+ mgr->SetMCtruthEventHandler(mc);} }
if (type == "MC" || type == "ESDMC0" || type == "ESDMC1"){
AliVEventHandler* esdH = new AliESDInputHandler;
else if (method == "LYZEP"){
AliAnalysisTaskLYZEventPlane *task1 = new AliAnalysisTaskLYZEventPlane("TaskLYZEventPlane");
task1->SetAnalysisType(type);
- //task1->SetCFManager1(cfmgr1);
- //task1->SetCFManager2(cfmgr2);
+ task1->SetCFManager1(cfmgr1);
+ task1->SetCFManager2(cfmgr2);
mgr->AddTask(task1);
}
else if (method == "CUM"){
//task1->SetCFManager2(cfmgr2);
mgr->AddTask(task1);
}
+ else if (method == "MCEP"){
+ AliAnalysisTaskMCEventPlane *task1 = new AliAnalysisTaskMCEventPlane("TaskMCEventPlane");
+ task1->SetAnalysisType(type);
+ task1->SetCFManager1(cfmgr1);
+ task1->SetCFManager2(cfmgr2);
+ mgr->AddTask(task1);
+ }
// Create containers for input/output
AliAnalysisDataContainer *cinput1 =
mgr->CreateContainer("cchain1",TChain::Class(),AliAnalysisManager::kInputContainer);
- if (method == "LYZ2"){ AliAnalysisDataContainer *cinput2 =
+ if (method == "LYZ2" || method == "LYZEP"){
+ AliAnalysisDataContainer *cinput2 =
mgr->CreateContainer("cobj2",TList::Class(),AliAnalysisManager::kInputContainer); }
AliAnalysisDataContainer *coutput1 =
mgr->CreateContainer("cobj1", TList::Class(),AliAnalysisManager::kOutputContainer,outputName);
+
//____________________________________________//
mgr->ConnectInput(task1,0,cinput1);
- if (method == "LYZ2") { mgr->ConnectInput(task1,1,cinput2); }
+ if (method == "LYZ2" || method == "LYZEP") {
+ mgr->ConnectInput(task1,1,cinput2); }
mgr->ConnectOutput(task1,0,coutput1);
- if (method == "LYZ2"){ cinput2->SetData(fFirstRunFile);}
+ if (method == "LYZ2" || method == "LYZEP"){
+ cinput2->SetData(fInputFile);}
if (!mgr->InitAnalysis()) return;
mgr->PrintStatus();