]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Adding the possibility to analyse AODs:
authorpanos <panos@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 22 Aug 2007 10:04:30 +0000 (10:04 +0000)
committerpanos <panos@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 22 Aug 2007 10:04:30 +0000 (10:04 +0000)
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

ANALYSIS/AliTagAnalysis.cxx
ANALYSIS/AliTagAnalysis.h

index bfe382b22c805c67be5781a48747f2881afb471e..530808d15ace3702f9070c931f82990944793aa8 100644 (file)
@@ -50,11 +50,23 @@ AliTagAnalysis::AliTagAnalysis():
   TObject(),
   ftagresult(0x0),
   fTagDirName(),
   TObject(),
   ftagresult(0x0),
   fTagDirName(),
-  fChain(0x0)
+  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
@@ -88,8 +100,11 @@ void AliTagAnalysis::ChainLocalTags(const char *dirname) {
   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;
@@ -133,7 +148,10 @@ TChain *AliTagAnalysis::QueryTags(AliRunTagCuts *runTagCuts, AliLHCTagCuts *lhcT
   //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());
@@ -190,7 +208,10 @@ TChain *AliTagAnalysis::QueryTags(const char *fRunCut, const char *fLHCCut, cons
   //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());
@@ -365,8 +386,12 @@ TChain *AliTagAnalysis::GetInputChain(const char* system, const char *wn) {
   // 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);
@@ -374,7 +399,7 @@ TChain *AliTagAnalysis::GetInputChain(const char* system, const char *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));
 
@@ -382,11 +407,11 @@ TChain *AliTagAnalysis::GetInputChain(const char* system, const char *wn) {
     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()));
 
-  return fESDchain;
+  return fAnalysisChain;
 }
 
 //___________________________________________________________________________
 }
 
 //___________________________________________________________________________
@@ -395,15 +420,10 @@ TChain *AliTagAnalysis::GetChainFromCollection(const char* collectionname, const
   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);
index 02165b72a1983c9739b894870b1ac99f15eda4a2..ca4a256ba1da3572125959724905ea05ed7c0517 100644 (file)
@@ -40,8 +40,11 @@ class TTreeFormula;
 class AliTagAnalysis : public TObject {
  public:
   AliTagAnalysis();
 class AliTagAnalysis : public TObject {
  public:
   AliTagAnalysis();
+  AliTagAnalysis(const char* type);
   ~AliTagAnalysis(); 
   
   ~AliTagAnalysis(); 
   
+  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);
@@ -62,6 +65,8 @@ class AliTagAnalysis : public TObject {
   
   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);