#include "AliMCEventHandler.h"
#include "AliMCEvent.h"
+#include "../../CORRFW/AliCFManager.h"
+
#include "AliAnalysisTaskScalarProduct.h"
#include "AliFlowEventSimpleMaker.h"
#include "AliFlowAnalysisWithScalarProduct.h"
+#include "AliFlowCommonHist.h"
// AliAnalysisTaskScalarProduct:
//
ClassImp(AliAnalysisTaskScalarProduct)
//________________________________________________________________________
-AliAnalysisTaskScalarProduct::AliAnalysisTaskScalarProduct(const char *name) :
+AliAnalysisTaskScalarProduct::AliAnalysisTaskScalarProduct(const char *name, Bool_t on) :
AliAnalysisTask(name, ""),
fESD(NULL),
fAOD(NULL),
fSP(NULL),
fEventMaker(NULL),
fAnalysisType("ESD"),
- fListHistos(NULL)
+ fCFManager1(NULL),
+ fCFManager2(NULL),
+ fListHistos(NULL),
+ fQAInt(NULL),
+ fQADiff(NULL),
+ fQA(on)
{
// Constructor
cout<<"AliAnalysisTaskScalarProduct::AliAnalysisTaskScalarProduct(const char *name)"<<endl;
DefineInput(0, TChain::Class());
// Output slot #0 writes into a TList container
DefineOutput(0, TList::Class());
-
+ if(on) {
+ DefineOutput(1, TList::Class());
+ DefineOutput(2, TList::Class()); }
}
//________________________________________________________________________
fSP(NULL),
fEventMaker(NULL),
fAnalysisType("ESD"),
- fListHistos(NULL)
+ fCFManager1(NULL),
+ fCFManager2(NULL),
+ fListHistos(NULL),
+ fQAInt(NULL),
+ fQADiff(NULL),
+ fQA(kFALSE)
{
// Constructor
cout<<"AliAnalysisTaskScalarProduct::AliAnalysisTaskScalarProduct()"<<endl;
} else {
// Disable all branches and enable only the needed ones
if (fAnalysisType == "MC") {
- cout<<"!!!!!reading MC kinematics only"<<endl;
// we want to process only MC
tree->SetBranchStatus("*", kFALSE);
fESD = esdH->GetEvent();
}
}
- else if (fAnalysisType == "ESD") {
- cout<<"!!!!!reading the ESD only"<<endl;
+ else if (fAnalysisType == "ESD" || fAnalysisType == "ESDMC0" || fAnalysisType == "ESDMC1") {
tree->SetBranchStatus("*", kFALSE);
tree->SetBranchStatus("Tracks.*", kTRUE);
fESD = esdH->GetEvent();
}
else if (fAnalysisType == "AOD") {
- cout<<"!!!!!reading the AOD only"<<endl;
AliAODInputHandler *aodH = dynamic_cast<AliAODInputHandler*> (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
if (!aodH) {
}
}
else {
- Printf("!!!!!Wrong analysis type: Only ESD, AOD and MC types are allowed!");
+ Printf("!!!!!Wrong analysis type: Only ESD, ESDMC0, ESDMC1, AOD and MC types are allowed!");
exit(1);
}
{
// Called at every worker node to initialize
cout<<"AliAnalysisTaskScalarProduct::CreateOutputObjects()"<<endl;
+
+ if (!(fAnalysisType == "AOD" || fAnalysisType == "ESD" || fAnalysisType == "ESDMC0" || fAnalysisType == "ESDMC1" || fAnalysisType == "MC")) {
+ cout<<"WRONG ANALYSIS TYPE! only ESD, ESDMC0, ESDMC1, AOD and MC are allowed."<<endl;
+ exit(1);
+ }
+
//event maker
fEventMaker = new AliFlowEventSimpleMaker();
//Analyser
if (fSP->GetHistList()) {
- // fSP->GetHistList()->Print();
- fListHistos = fSP->GetHistList();
- // fListHistos->Print();
+ //fSP->GetHistList()->Print();
+ fListHistos = fSP->GetHistList();
+ fListHistos->Print();
}
else {Printf("ERROR: Could not retrieve histogram list"); }
}
// Main loop
// Called for each event
-
-
-
+
if (fAnalysisType == "MC") {
// Process MC truth, therefore we receive the AliAnalysisManager and ask it for the AliMCEventHandler
return;
}
+ fCFManager1->SetEventInfo(mcEvent);
+ fCFManager2->SetEventInfo(mcEvent);
+
// analysis
Printf("MC particles: %d", mcEvent->GetNumberOfTracks());
- AliFlowEventSimple* fEvent = fEventMaker->FillTracks(mcEvent);
+ AliFlowEventSimple* fEvent = fEventMaker->FillTracks(mcEvent,fCFManager1,fCFManager2);
fSP->Make(fEvent);
delete fEvent;
Printf("There are %d tracks in this event", fESD->GetNumberOfTracks());
// analysis
- AliFlowEventSimple* fEvent = fEventMaker->FillTracks(fESD);
+ AliFlowEventSimple* fEvent = fEventMaker->FillTracks(fESD,fCFManager1,fCFManager2);
+ fSP->Make(fEvent);
+ delete fEvent;
+ }
+else if (fAnalysisType == "ESDMC0" || 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;
+ }
+
+ AliMCEvent* mcEvent = eventHandler->MCEvent();
+ if (!mcEvent) {
+ Printf("ERROR: Could not retrieve MC event");
+ return;
+ }
+
+ fCFManager1->SetEventInfo(mcEvent);
+ fCFManager2->SetEventInfo(mcEvent);
+
+ //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, 1); //0 = kine from ESD, 1 = kine from MC
+ }
fSP->Make(fEvent);
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());
// analysis
+ //For the moment don't use CF //AliFlowEventSimple* fEvent = fEventMaker->FillTracks(fAOD,fCFManager1,fCFManager2);
AliFlowEventSimple* fEvent = fEventMaker->FillTracks(fAOD);
fSP->Make(fEvent);
delete fEvent;
}
- // fListHistos->Print();
+ //fListHistos->Print();
PostData(0,fListHistos);
+ if (fQA) {
+ PostData(1,fQAInt);
+ PostData(2,fQADiff); }
}
//________________________________________________________________________
void AliAnalysisTaskScalarProduct::Terminate(Option_t *)
{
- // Called once at the end of the query
+ // Called once at the end of the query -- do not call in case of CAF
// fSP->Finish();
// PostData(0,fListHistos);
+
fListHistos = (TList*)GetOutputData(0);
cout << "histgram list in Terminate" << endl;
- if (fListHistos)
- {
- fListHistos->Print();
- }
- else
- {
- cout << "histgram list pointer is empty" << endl;
- }
- // delete fSP;
- // delete fEventMaker;
+ if (fListHistos) {
+ fListHistos->Print();
+ }
+ else { cout << "histgram list pointer is empty" << endl; }
+
}