i) Add a new constructor with the type of analysis as an argument
ii) In case the default constructor is used there is a type setter
iii) Within the function we distinguish between esd and aod analysis by setting the tree name accordingly
TObject(),
ftagresult(0x0),
fTagDirName(),
TObject(),
ftagresult(0x0),
fTagDirName(),
+ fChain(0x0),
+ fAnalysisType()
{
//Default constructor for a AliTagAnalysis
}
{
//Default constructor for a AliTagAnalysis
}
+//___________________________________________________________________________
+AliTagAnalysis::AliTagAnalysis(const char* type):
+ TObject(),
+ ftagresult(0x0),
+ fTagDirName(),
+ fChain(0x0),
+ fAnalysisType(type)
+{
+ //constructor for a AliTagAnalysis
+}
+
//___________________________________________________________________________
AliTagAnalysis::~AliTagAnalysis() {
//Default destructor for a AliTagAnalysis
//___________________________________________________________________________
AliTagAnalysis::~AliTagAnalysis() {
//Default destructor for a AliTagAnalysis
TString fTagFilename;
if (! fChain) fChain = new TChain("T");
TString fTagFilename;
if (! fChain) fChain = new TChain("T");
-
- const char * tagPattern = "tag.root";
+ const char * tagPattern = 0x0;
+ if(fAnalysisType == "ESD") tagPattern = "ESD.tag.root";
+ else if(fAnalysisType == "AOD") tagPattern = "AOD.tag.root";
+ else AliFatal("Only ESD and AOD type is implemented!!!");
+
// Open the working directory
void * dirp = gSystem->OpenDirectory(fTagDirName);
const char * name = 0x0;
// Open the working directory
void * dirp = gSystem->OpenDirectory(fTagDirName);
const char * name = 0x0;
//and returns a TChain along with the associated TEventList
AliInfo(Form("Querying the tags........"));
//and returns a TChain along with the associated TEventList
AliInfo(Form("Querying the tags........"));
- TString fAliceFile = "esdTree";
+ TString fAliceFile;
+ if(fAnalysisType == "ESD") fAliceFile = "esdTree";
+ else if(fAnalysisType == "AOD") fAliceFile = "aodTree";
+ else AliFatal("Only ESD and AOD type is implemented!!!");
//ESD file chain
TChain *fESDchain = new TChain(fAliceFile.Data());
//ESD file chain
TChain *fESDchain = new TChain(fAliceFile.Data());
//and returns a TChain along with the associated TEventList
AliInfo(Form("Querying the tags........"));
//and returns a TChain along with the associated TEventList
AliInfo(Form("Querying the tags........"));
- TString fAliceFile = "esdTree";
+ TString fAliceFile;
+ if(fAnalysisType == "ESD") fAliceFile = "esdTree";
+ else if(fAnalysisType == "AOD") fAliceFile = "aodTree";
+ else AliFatal("Only ESD and AOD type is implemented!!!");
//ESD file chain
TChain *fESDchain = new TChain(fAliceFile.Data());
//ESD file chain
TChain *fESDchain = new TChain(fAliceFile.Data());
// improvements are committed
TString fsystem = system;
Int_t iAccepted = 0;
// improvements are committed
TString fsystem = system;
Int_t iAccepted = 0;
- //ESD file chain
- TChain *fESDchain = new TChain("esdTree");
+
+ TChain *fAnalysisChain = new TChain();
+ if(fAnalysisType == "ESD") fAnalysisChain->SetName("esdTree");
+ else if(fAnalysisType == "AOD") fAnalysisChain->SetName("aodTree");
+ else AliFatal("Only ESD and AOD type is implemented!!!");
+
//Event list
TEventList *fEventList = new TEventList();
AliXMLCollection *collection = AliXMLCollection::Open(wn);
//Event list
TEventList *fEventList = new TEventList();
AliXMLCollection *collection = AliXMLCollection::Open(wn);
collection->Reset();
while (collection->Next()) {
AliInfo(Form("Adding: %s",collection->GetTURL("")));
collection->Reset();
while (collection->Next()) {
AliInfo(Form("Adding: %s",collection->GetTURL("")));
- fESDchain->Add(collection->GetTURL(""));
+ fAnalysisChain->Add(collection->GetTURL(""));
TEntryList *list = (TEntryList *)collection->GetEventList("");
for(Int_t i = 0; i < list->GetN(); i++) fEventList->Enter(iAccepted+list->GetEntry(i));
TEntryList *list = (TEntryList *)collection->GetEventList("");
for(Int_t i = 0; i < list->GetN(); i++) fEventList->Enter(iAccepted+list->GetEntry(i));
else if(fsystem == "PbPb") iAccepted += 1;
}
else if(fsystem == "PbPb") iAccepted += 1;
}
- fESDchain->SetEventList(fEventList);
+ fAnalysisChain->SetEventList(fEventList);
AliInfo(Form("Number of selected events: %d",fEventList->GetN()));
AliInfo(Form("Number of selected events: %d",fEventList->GetN()));
}
//___________________________________________________________________________
}
//___________________________________________________________________________
TString fAliceFile = treename;
Int_t iAccepted = 0;
TChain *fAnalysisChain = new TChain();
TString fAliceFile = treename;
Int_t iAccepted = 0;
TChain *fAnalysisChain = new TChain();
- if(fAliceFile == "esdTree") {
- //ESD file chain
- fAnalysisChain->SetName("esdTree");
- } else if(fAliceFile == "aodTree") {
- //AOD file chain
- fAnalysisChain->SetName("aodTree");
- AliFatal("AOD case not yet implemented!!!");
- }
+ if(fAliceFile == "esdTree") fAnalysisChain->SetName("esdTree");
+ else if(fAliceFile == "aodTree") fAnalysisChain->SetName("aodTree");
else AliFatal("Inconsistent tree name - use esdTree or aodTree!");
else AliFatal("Inconsistent tree name - use esdTree or aodTree!");
//Event list
TEntryList *fGlobalList = new TEntryList();
AliXMLCollection *collection = AliXMLCollection::Open(collectionname);
//Event list
TEntryList *fGlobalList = new TEntryList();
AliXMLCollection *collection = AliXMLCollection::Open(collectionname);
class AliTagAnalysis : public TObject {
public:
AliTagAnalysis();
class AliTagAnalysis : public TObject {
public:
AliTagAnalysis();
+ AliTagAnalysis(const char* type);
+ void SetType(const char* type) {fAnalysisType = type;}
+ const char* GetType() {return fAnalysisType.Data();}
Bool_t AddTagsFile(const char *alienUrl);
void ChainLocalTags(const char *dirname);
void ChainGridTags(TGridResult *result);
Bool_t AddTagsFile(const char *alienUrl);
void ChainLocalTags(const char *dirname);
void ChainGridTags(TGridResult *result);
TChain *fChain; //tag chain
TChain *fChain; //tag chain
+ TString fAnalysisType; //define the type of analysis (esd or aod)
+
//____________________________________________________//
private:
AliTagAnalysis(const AliTagAnalysis & source);
//____________________________________________________//
private:
AliTagAnalysis(const AliTagAnalysis & source);