adding macro to clean datasets on CAF
authorjgrosseo <jgrosseo@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 2 Dec 2009 09:32:14 +0000 (09:32 +0000)
committerjgrosseo <jgrosseo@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 2 Dec 2009 09:32:14 +0000 (09:32 +0000)
prod/acrcaf/clean/clean.C [new file with mode: 0644]

diff --git a/prod/acrcaf/clean/clean.C b/prod/acrcaf/clean/clean.C
new file mode 100644 (file)
index 0000000..b10df5b
--- /dev/null
@@ -0,0 +1,60 @@
+void clean()
+{
+  // Login to CAF
+  TProof::Open("aliprod@alicecaf");
+  
+  TMap* map = gProof->GetDataSets("/ALIREC/aliprod");
+  
+  Int_t max = 0;
+  
+  TIterator* iter = map->MakeIterator();
+  TObjString* str = 0;
+  while ((str = (TObjString*) iter->Next()))
+  {
+    //str->Print();
+    
+    TObjArray* tokens = str->String().Tokenize("/");
+    if (tokens->GetEntries() < 3)
+      continue;
+      
+    //tokens->Print();
+    
+    TString str2(((TObjString*) tokens->At(2))->String());
+    str2.ReplaceAll("run", "");
+      
+    Int_t run = str2.Atoi();
+    
+    //Printf("%d", run);
+    
+    max = TMath::Max(max, run);
+  }
+  
+  Printf("Maximum run number found is %d", max);
+  
+  Int_t removeUntil = max - 2000;
+  
+  Printf("Removing all datasets for runs with smaller run numbers than %d", removeUntil);
+  
+  iter->Reset();
+  
+  while ((str = (TObjString*) iter->Next()))
+  {
+    TObjArray* tokens = str->String().Tokenize("/");
+    if (tokens->GetEntries() < 3)
+      continue;
+      
+    //tokens->Print();
+    
+    TString str2(((TObjString*) tokens->At(2))->String());
+    str2.ReplaceAll("run", "");
+      
+    Int_t run = str2.Atoi();
+    
+    if (run < removeUntil)
+    {
+      Printf("Removing run %d", run);
+      
+      gProof->RemoveDataSet(str->String());
+    }
+  }
+}