//---------------------------------------------------------------------------
const Bool_t kMC = kTRUE; //With real data kMC = kFALSE
-const TString kInputData = "ESD";
+const TString kInputData = "ESD";//ESD, AOD, MC
+TString kTreeName = "esdTree";
+
void ana(Int_t mode=mLocal, TString configName = "ConfigAnalysisPhoton")
{
// Main
//-------------------------------------------------------------------------------------------------
//Create chain from ESD and from cross sections files, look below for options.
//-------------------------------------------------------------------------------------------------
- TChain *chain = new TChain("esdTree") ;
+ if(kInputData == "ESD") kTreeName = "esdTree" ;
+ else if(kInputData == "AOD") kTreeName = "aodTree" ;
+ else if (kInputData == "MC") kTreeName = "TE" ;
+ else {
+ cout<<"Wrong data type "<<kInputData<<endl;
+ break;
+ }
+
+ TChain *chain = new TChain(kTreeName) ;
TChain * chainxs = new TChain("Xsection") ;
CreateChain(mode, chain, chainxs);
//-------------------------------------
AliAnalysisManager *mgr = new AliAnalysisManager("Manager", "Manager");
// MC handler
- if(kMC){
+ if(kMC || kInputData == "MC"){
AliMCEventHandler* mcHandler = new AliMCEventHandler();
mcHandler->SetReadTR(kFALSE);//Do not search TrackRef file
mgr->SetMCtruthEventHandler(mcHandler);
cout<<"NEVENT : "<<kEvent<<endl;
cout<<"PATTERN: " <<kPattern<<endl;
+ TString datafile="";
+ if(kInputData == "ESD") datafile = "AliESDs.root" ;
+ else if(kInputData == "AOD") datafile = "aod.root" ;
+ else if(kInputData == "MC") datafile = "galice.root" ;
+
//Loop on ESD files, add them to chain
Int_t event =0;
Int_t skipped=0 ;
char filexs[120] ;
for (event = 0 ; event < kEvent ; event++) {
- sprintf(file, "%s/%s%d/AliESDs.root", kInDir,kPattern,event) ;
+ sprintf(file, "%s/%s%d/%s", kInDir,kPattern,event,datafile.Data()) ;
sprintf(filexs, "%s/%s%d/%s", kInDir,kPattern,event,kXSFileName) ;
TFile * fESD = 0 ;
//Check if file exists and add it, if not skip it
if ( fESD = TFile::Open(file)) {
- if ( fESD->Get("esdTree") ) {
+ if ( fESD->Get(kTreeName) ) {
printf("++++ Adding %s\n", file) ;
chain->AddFile(file);
chainxs->Add(filexs) ;