added skeleton for AliROCRawAnalysis and a few other updates
authorekman <ekman@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 8 Nov 2006 16:04:20 +0000 (16:04 +0000)
committerekman <ekman@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 8 Nov 2006 16:04:20 +0000 (16:04 +0000)
PWG0/CreateESDChain.C
PWG0/PWG0selectorsLinkDef.h
PWG0/TPC/AliROCESDAnalysisSelector.cxx
PWG0/TPC/AliROCRawAnalysisSelector.cxx [new file with mode: 0644]
PWG0/TPC/AliROCRawAnalysisSelector.h [new file with mode: 0644]
PWG0/TPC/runROCRawAnalysis.C [new file with mode: 0644]
PWG0/libPWG0selectors.pkg

index b28f0dc..7c51a7d 100644 (file)
@@ -160,8 +160,14 @@ void ChainToTextFile(TChain* chain, const char* target)
   ofstream outfile;
   outfile.open(target);
 
-  while ((obj = iter->Next()))
-    outfile << obj->GetTitle() << endl;
+  while ((obj = iter->Next())) {
+    TString fileName(obj->GetTitle());
+    
+    fileName.Remove(fileName.Length()-13);
+
+    cout << fileName.Data() << endl;
+    outfile << fileName.Data() << endl;
+  }
 
   outfile.close();
 
@@ -176,3 +182,45 @@ void LookupWrite(TChain* chain, const char* target)
 
   ChainToTextFile(chain, target);
 }
+
+
+
+TChain* CreateRawChain(const char* aDataDir, Int_t aRuns = 20) {
+
+  TChain* chain = new TChain("RAW");
+  
+  // ########################################################
+  // get the data dir  
+  Char_t execDir[256];
+  sprintf(execDir,gSystem->pwd());
+  TSystemDirectory* baseDir = new TSystemDirectory(".",aDataDir);
+  TList* fileList           = baseDir->GetListOfFiles();
+  Int_t nFiles              = fileList->GetEntries();
+  // go back to the dir where this script is executed
+  gSystem->cd(execDir);
+
+  // ########################################################
+  // loop over files 
+  Int_t counter = 0;
+  for (Int_t r=0; r<nFiles; r++) {
+    
+    if (counter>aRuns)
+      break;
+    
+    TSystemFile* presentFile = (TSystemFile*)fileList->At(r);
+    if (!presentFile || presentFile->IsDirectory())
+      continue;
+    
+    if (!(TString(presentFile->GetName()).Contains(".root")))
+      continue;
+    
+    counter++;
+    
+    //cout << Form("%s/%s",aDataDir,presentFile->GetName()) << endl;
+    
+    chain->AddFile(Form("%s/%s",aDataDir,presentFile->GetName()));
+  }
+
+
+
+}
index 52a9de4..09f4931 100644 (file)
@@ -16,5 +16,6 @@
 #pragma link C++ class AlidNdEtaSystematicsSelector+;
 #pragma link C++ class AliTestESDtrackCutsSelector+;
 #pragma link C++ class AliROCESDAnalysisSelector+;
+#pragma link C++ class AliROCRawAnalysisSelector+;
 
 #endif
index 3bd86b9..770296c 100644 (file)
@@ -167,19 +167,18 @@ Bool_t AliROCESDAnalysisSelector::Process(Long64_t entry)
 
       Int_t detector = cluster->GetDetector();
       
-      if (detector < 0 || detector >= kTPCSectors)
-      {
-        AliDebug(AliLog::kDebug, Form("We found a cluster from invalid sector %d", detector));
-        continue;
+      if (detector < 0 || detector >= kTPCSectors) {
+       AliDebug(AliLog::kDebug, Form("We found a cluster from invalid sector %d", detector));
+       continue;
       }
-
+      
       // TODO: find a clever way to handle the time      
       //      if (fESD->GetTimeStamp()<1160000000)
       //       continue;
 
       if (!fClusterHistograms[detector])
       {
-        fClusterHistograms[detector] = new AliTPCClusterHistograms(detector),"",fESD->GetTimeStamp(),fESD->GetTimeStamp()+7*60*60);
+        fClusterHistograms[detector] = new AliTPCClusterHistograms(detector,"",fESD->GetTimeStamp(),fESD->GetTimeStamp()+7*60*60);
       }
       
       fClusterHistograms[detector]->FillCluster(cluster, fESD->GetTimeStamp());
diff --git a/PWG0/TPC/AliROCRawAnalysisSelector.cxx b/PWG0/TPC/AliROCRawAnalysisSelector.cxx
new file mode 100644 (file)
index 0000000..3470b63
--- /dev/null
@@ -0,0 +1,107 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/* $Id$ */
+
+
+#include "AliROCRawAnalysisSelector.h"
+
+#include <AliLog.h>
+
+#include <TFile.h>
+#include <TTree.h>
+#include <TCanvas.h>
+
+
+ClassImp(AliROCRawAnalysisSelector)
+
+AliROCRawAnalysisSelector::AliROCRawAnalysisSelector() :
+  AliSelector()
+{
+  //
+  // Constructor. Initialization of pointers
+  //
+  
+  //  for (Int_t i=0; i<kTPCSectors; i++)
+  // fClusterHistograms[i] = 0;
+}
+
+AliROCRawAnalysisSelector::~AliROCRawAnalysisSelector()
+{
+  //
+  // Destructor
+  //
+}
+
+void AliROCRawAnalysisSelector::SlaveBegin(TTree* tree)
+{
+  //
+  
+  AliSelector::SlaveBegin(tree);
+} 
+
+void AliROCRawAnalysisSelector::Init(TTree *tree)
+{
+  // The Init() function is called when the selector needs to initialize
+  // a new tree or chain. Typically here the branch addresses of the tree
+  // will be set. It is normaly not necessary to make changes to the
+  // generated code, but the routine can be extended by the user if needed.
+  // Init() will be called many times when running with PROOF.
+
+  AliSelector::Init(tree);
+
+  // Set branch address
+  //if (tree)
+  //  tree->SetBranchAddress("rawevent", &fRawEvent);
+    
+}
+
+Bool_t AliROCRawAnalysisSelector::Process(Long64_t entry)
+{
+  //
+  // Implement your analysis here. Do not forget to call the parent class Process by
+  // if (AliSelector::Process(entry) == kFALSE)
+  //   return kFALSE;
+  //
+
+  if (AliSelector::Process(entry) == kFALSE)
+    return kFALSE;
+
+  
+   
+  return kTRUE;
+}
+
+void AliROCRawAnalysisSelector::SlaveTerminate()
+{
+  //
+  
+  //for (Int_t i=0; i<kTPCSectors; i++)
+  // if (fClusterHistograms[i])
+  //    fOutput->Add(fClusterHistograms[i]);
+} 
+
+void AliROCRawAnalysisSelector::Terminate()
+{
+  // TODO read from output list for PROOF
+    
+  TFile* file = TFile::Open("rocRaw.root", "RECREATE");
+  
+  //  for (Int_t i=0; i<kTPCSectors; i++)
+  //  if (fClusterHistograms[i])
+  //    fClusterHistograms[i]->SaveHistograms();
+
+  file->Close();
+} 
diff --git a/PWG0/TPC/AliROCRawAnalysisSelector.h b/PWG0/TPC/AliROCRawAnalysisSelector.h
new file mode 100644 (file)
index 0000000..f2e6d4a
--- /dev/null
@@ -0,0 +1,36 @@
+/* $Id$ */
+
+#ifndef AliROCRawAnalysisSelector_H
+#define AliROCRawAnalysisSelector_H
+
+#include "AliSelector.h"
+
+
+// 
+// TODO explain this
+//
+
+class AliROCRawAnalysisSelector : public AliSelector {
+  public:
+  
+    AliROCRawAnalysisSelector();
+    virtual ~AliROCRawAnalysisSelector();
+
+    virtual void    SlaveBegin(TTree* tree);
+    virtual void    Init(TTree *tree);
+    virtual Bool_t  Process(Long64_t entry);
+    virtual void    SlaveTerminate();
+    virtual void    Terminate();
+
+ protected:
+
+    
+
+ private:
+    AliROCRawAnalysisSelector(const AliROCRawAnalysisSelector&);
+    AliROCRawAnalysisSelector& operator=(const AliROCRawAnalysisSelector&);
+
+  ClassDef(AliROCRawAnalysisSelector, 0);
+};
+
+#endif
diff --git a/PWG0/TPC/runROCRawAnalysis.C b/PWG0/TPC/runROCRawAnalysis.C
new file mode 100644 (file)
index 0000000..c93a410
--- /dev/null
@@ -0,0 +1,38 @@
+/* $Id$ */
+
+//
+// 
+//
+
+#include "../CreateESDChain.C"
+#include "../PWG0Helper.C"
+
+void runROCESDAnalysis(Char_t* dataDir, Int_t nRuns=20, Int_t offset=0, Bool_t aDebug = kFALSE, Bool_t aProof = kFALSE, 
+    const char* option = "", const char* proofServer = "jgrosseo@lxb6046")
+{
+  if (aProof)
+    connectProof(proofServer);
+
+  TString libraries("libEG;libGeom;libPWG0base");
+  TString packages;
+
+  if (!prepareQuery(libraries, packages, 2))
+    return;
+
+  TChain* chain = CreateRawChain(dataDir, nRuns);
+  
+  TList inputList;
+  
+  TString selectorName = "AliROCESDAnalysisSelector";
+  AliLog::SetClassDebugLevel(selectorName, AliLog::kInfo);
+
+  if (aDebug != kFALSE)
+  {
+    AliLog::SetClassDebugLevel(selectorName, AliLog::kDebug);
+    selectorName += ".cxx+g";
+  }
+  else
+    selectorName += ".cxx+";
+
+  Int_t result = executeQuery(chain, &inputList, selectorName, option);
+}
index c498d0c..db8398c 100644 (file)
@@ -10,7 +10,8 @@ HDRS = dNdEta/AlidNdEtaCorrectionSelector.h \
        dNdEta/AliMultiplicityMCSelector.h \
        dNdEta/AlidNdEtaSystematicsSelector.h \
        esdTrackCuts/AliTestESDtrackCutsSelector.h \
-       TPC/AliROCESDAnalysisSelector.h
+       TPC/AliROCESDAnalysisSelector.h \
+       TPC/AliROCRawAnalysisSelector.h
 
 SRCS = $(HDRS:.h=.cxx)