]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Allowing to switch off branches (calo+FMD for PDC06) - Andreas)
authorpanos <panos@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 21 Nov 2007 14:25:29 +0000 (14:25 +0000)
committerpanos <panos@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 21 Nov 2007 14:25:29 +0000 (14:25 +0000)
STEER/AliESDTagCreator.cxx
STEER/AliESDTagCreator.h

index 363ffca12f7b080b05e8b0532d5ddf448c01b673..bcdcfd226a66565f9ab1e9e424e727b7ae366927 100644 (file)
@@ -53,6 +53,7 @@ ClassImp(AliESDTagCreator)
     AliTagCreator(),
     fChain(new TChain("esdTree")), fGUIDList(new TList()), 
     fMD5List(new TList()), fTURLList(new TList()), 
+    fBranches(""),
     meminfo(new MemInfo_t) {
   //==============Default constructor for a AliESDTagCreator================
 }
@@ -102,6 +103,10 @@ Bool_t AliESDTagCreator::ReadGridCollection(TGridResult *fresult) {
   
   AliInfo(Form("ESD chain created......."));   
   AliInfo(Form("Chain entries: %d",fChain->GetEntries()));     
+  //
+  // Switch of branches on user request
+  SwitchOffBranches();
+       
   CreateTag(fChain,"grid");
   
   return kTRUE;
@@ -143,6 +148,11 @@ Bool_t AliESDTagCreator::ReadLocalCollection(const char *localpath) {
 
   AliInfo(Form("ESD chain created......."));   
   AliInfo(Form("Chain entries: %d",fChain->GetEntries()));     
+
+  //
+  // Switch of branches on user request
+  SwitchOffBranches();
+
   CreateTag(fChain,"local");
 
   return kTRUE;
@@ -176,6 +186,11 @@ Bool_t AliESDTagCreator::ReadCAFCollection(const char *filename) {
 
   AliInfo(Form("ESD chain created......."));   
   AliInfo(Form("Chain entries: %d",fChain->GetEntries()));     
+
+  //
+  // Switch of branches on user request
+  SwitchOffBranches();
+  
   CreateTag(fChain,"proof");
 
   return kTRUE;
@@ -1194,6 +1209,12 @@ void AliESDTagCreator::CreateESDTags(Int_t fFirstEvent, Int_t fLastEvent, TList
   Int_t fVertexflag;
   Int_t iRunNumber = 0;
   TString fVertexName("default");
+
+  AliRunTag *tag = new AliRunTag();
+  AliEventTag *evTag = new AliEventTag();
+  TTree ttag("T","A Tree with event tags");
+  TBranch * btag = ttag.Branch("AliTAG", &tag);
+  btag->SetCompressionLevel(9);
   
   AliInfo(Form("Creating the ESD tags......."));       
 
@@ -1217,18 +1238,12 @@ void AliESDTagCreator::CreateESDTags(Int_t fFirstEvent, Int_t fLastEvent, TList
 
   char fileName[256];
   sprintf(fileName, "Run%d.Event%d_%d.ESD.tag.root", 
-         iInitRunNumber,fFirstEvent,lastEvent);
+         tag->GetRunId(),fFirstEvent,lastEvent);
   AliInfo(Form("writing tags to file %s", fileName));
   AliDebug(1, Form("writing tags to file %s", fileName));
  
   TFile* ftag = TFile::Open(fileName, "recreate");
  
-  AliRunTag *tag = new AliRunTag();
-  AliEventTag *evTag = new AliEventTag();
-  TTree ttag("T","A Tree with event tags");
-  TBranch * btag = ttag.Branch("AliTAG", &tag);
-  btag->SetCompressionLevel(9);
-
   if(fLastEvent != -1) iNumberOfEvents = fLastEvent + 1;
   for (Int_t iEventNumber = fFirstEvent; iEventNumber < iNumberOfEvents; iEventNumber++) {
     ntrack = 0;
@@ -1448,3 +1463,16 @@ void AliESDTagCreator::CreateESDTags(Int_t fFirstEvent, Int_t fLastEvent, TList
   delete evTag;
 }
 
+void AliESDTagCreator::SwitchOffBranches() const
+{
+  //
+  // Switch of branches on user request
+    TObjArray * tokens = fBranches.Tokenize(" ");
+    Int_t ntok = tokens->GetEntries();
+    for (Int_t i = 0; i < ntok; i++) 
+    {
+       TString str = ((TObjString*) tokens->At(i))->GetString();
+       fChain->SetBranchStatus(Form("%s%s%s","*", str.Data(), "*"), 0);
+       AliInfo(Form("Branch %s switched off \n", str.Data()));
+    }
+}
index d634a26788f848358597a0845e16702f2673d9f0..6f2e2bae3a886cf25a57355bde30ad36e054362f 100644 (file)
@@ -43,6 +43,8 @@ class AliESDTagCreator : public AliTagCreator {
 
   void CreateESDTags(Int_t fFirstEvent, Int_t fLastEvent, TList *grpList);
 
+  void SetInactiveBranches(const char* branches) {fBranches = branches;}
+
   Bool_t ReadGridCollection(TGridResult *result);
   Bool_t ReadLocalCollection(const char *localpath);
   Bool_t ReadCAFCollection(const char *filename);
@@ -51,14 +53,15 @@ class AliESDTagCreator : public AliTagCreator {
   void CreateTag(TChain *chain, const char* type);
   void CreateTag(TFile* file, const char *guid, const char *md5, const char *turl, Long64_t size, Int_t Counter);
   void CreateTag(TFile* file, const char *filepath, Int_t Counter);
-
  private:
-  TChain *fChain; //chain of esd files
-  TList  *fGUIDList; //TList of guid TObjString
-  TList  *fMD5List; //TList of md5 TObjString
-  TList  *fTURLList; //TList of turl TObjString
+  void SwitchOffBranches() const;
+ private:
+  TChain *fChain;     //chain of esd files
+  TList  *fGUIDList;  //TList of guid TObjString
+  TList  *fMD5List;   //TList of md5 TObjString
+  TList  *fTURLList;  //TList of turl TObjString
+  TString fBranches;  //List of branches to be switched off (separated by space
   MemInfo_t *meminfo; //mem info
-
   ClassDef(AliESDTagCreator,0)  
 };