]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
First setup for passing histogram lists
authorsnelling <snelling@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 7 Jun 2008 21:51:23 +0000 (21:51 +0000)
committersnelling <snelling@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 7 Jun 2008 21:51:23 +0000 (21:51 +0000)
PWG2/FLOW/AliAnalysisTaskScalarProduct.cxx
PWG2/FLOW/AliAnalysisTaskScalarProduct.h
PWG2/FLOW/AliFlowAnalysisWithScalarProduct.cxx
PWG2/FLOW/AliFlowAnalysisWithScalarProduct.h
PWG2/FLOW/macros/runProof.C
PWG2/FLOW/macros/runProofScalarProduct.C [new file with mode: 0644]

index cb4e4e26bde44cd6a938896fd4277a20b5aa7dbf..f777d11063fed5a4df213cd14533533655748374 100644 (file)
@@ -47,11 +47,12 @@ ClassImp(AliAnalysisTaskScalarProduct)
 //________________________________________________________________________
 AliAnalysisTaskScalarProduct::AliAnalysisTaskScalarProduct(const char *name) : 
   AliAnalysisTask(name, ""), 
-  fESD(0),
-  fAOD(0),
-  fSP(0),
-  fEventMaker(0),
-  fAnalysisType("ESD")
+  fESD(NULL),
+  fAOD(NULL),
+  fSP(NULL),
+  fEventMaker(NULL),
+  fAnalysisType("ESD"),
+  fListHistos(NULL)
 {
   // Constructor
   cout<<"AliAnalysisTaskScalarProduct::AliAnalysisTaskScalarProduct(const char *name)"<<endl;
@@ -61,6 +62,12 @@ AliAnalysisTaskScalarProduct::AliAnalysisTaskScalarProduct(const char *name) :
   DefineInput(0, TChain::Class());
   // Output slot #0 writes into a TList container
   DefineOutput(0, TList::Class());  
+
+ //event maker
+  fEventMaker = new AliFlowEventSimpleMaker();
+  //Analyser
+  fSP  = new AliFlowAnalysisWithScalarProduct() ;
+  fSP-> Init();
 }
 
 //________________________________________________________________________
@@ -124,26 +131,14 @@ void AliAnalysisTaskScalarProduct::CreateOutputObjects()
 {
   // Called once
   cout<<"AliAnalysisTaskScalarProduct::CreateOutputObjects()"<<endl;
+  
 
-  if (!(fAnalysisType == "AOD" || fAnalysisType == "ESD" || fAnalysisType == "MC")) {
-    cout<<"WRONG ANALYSIS TYPE! only ESD, AOD and MC are allowed."<<endl;
-    exit(1);
+  if (fSP->GetHistList()) {
+       fSP->GetHistList()->Print();
+//     *fListHistos = new TList();
+       fListHistos = fSP->GetHistList();
   }
-
-  //event maker
-  fEventMaker = new AliFlowEventSimpleMaker();
-  //Analyser
-  fSP  = new AliFlowAnalysisWithScalarProduct() ;
-
-  //output file
-  TString outputName = "outputFromScalarProductAnalysis" ;
-  outputName += fAnalysisType.Data() ;
-  outputName += ".root" ;
-  fSP->SetHistFileName( outputName.Data() );
-    
-  fSP-> Init();
-
-
+  else {Printf("ERROR: Could not retrieve histogram list"); }
 }
 
 //________________________________________________________________________
@@ -202,6 +197,7 @@ void AliAnalysisTaskScalarProduct::Exec(Option_t *)
     delete fEvent;
   }
 
+  PostData(0,fListHistos);
 }      
 
 //________________________________________________________________________
@@ -209,7 +205,7 @@ void AliAnalysisTaskScalarProduct::Terminate(Option_t *)
 {
   // Called once at the end of the query
   fSP->Finish();
-  PostData(0,fSP->GetHistFile());
+  PostData(0,fListHistos);
 
   delete fSP;
   delete fEventMaker;
index d9b110df1939c806141514a75c054d80029cec51..7ef07f579ab677e51f8b1b6328dc130c3068440e 100644 (file)
@@ -40,6 +40,7 @@ class AliAnalysisTaskScalarProduct : public AliAnalysisTask {
   AliFlowAnalysisWithScalarProduct* fSP;  // analysis object
   AliFlowEventSimpleMaker* fEventMaker;   // FlowEventSimple maker object
   TString fAnalysisType;                  // can be MC, ESD or AOD
+  TList  *fListHistos;                    //collection of output
 
   ClassDef(AliAnalysisTaskScalarProduct, 1); // example of analysis
 };
index 8c0e0317acf64fabc17e9ab3df6d7922439d78f8..32dcb3a4d9132d743004e3df6c37557cd42102bb 100644 (file)
@@ -17,6 +17,7 @@
  
 #include "Riostream.h"  //needed as include
 #include "TFile.h"      //needed as include
+#include "TList.h"
 #include "TMath.h"
 #include "TProfile.h"
 #include "TVector2.h"
@@ -46,20 +47,17 @@ ClassImp(AliFlowAnalysisWithScalarProduct)
   fQ(NULL),
   fU(NULL),
   fEventNumber(0),
-  fTrack(NULL),
   fDebug(kFALSE),
-  fHistFileName(0),
-  fHistFile(NULL),
+  fHistList(NULL),
   fHistProUQ(NULL),
   fCommonHists(NULL)
 {
-
   // Constructor.
   fU = new TVector2;
   fQ = new AliFlowVector;
+  fHistList = new TList(); 
   //  fQ.Set(0.,0.);           // flow vector
   //  fU.Set(0.,0.);           // particle unit vector
-
 }
  //-----------------------------------------------------------------------
 
@@ -68,6 +66,7 @@ ClassImp(AliFlowAnalysisWithScalarProduct)
  {
    delete fU;
    delete fQ;
+   delete fHistList;
    //destructor
    
  }
@@ -77,22 +76,23 @@ ClassImp(AliFlowAnalysisWithScalarProduct)
 void AliFlowAnalysisWithScalarProduct::Init() {
 
   //Define all histograms
-  cout<<"---Analysis with the Scalar Product Method---"<<endl;
+  cout<<"---Analysis with the Scalar Product Method--- Init"<<endl;
 
   Int_t fNbinsPt = AliFlowCommonConstants::GetNbinsPt();
   Double_t  fPtMin = AliFlowCommonConstants::GetPtMin();            
   Double_t  fPtMax = AliFlowCommonConstants::GetPtMax();
 
   // analysis file (output)
-  fHistFile = new TFile(fHistFileName.Data(),"RECREATE") ;
 
   fHistProUQ = new TProfile("Flow_UQ_SP","Flow_UQ_SP",fNbinsPt,fPtMin,fPtMax);
   fHistProUQ->SetXTitle("p_t (GeV)");
   fHistProUQ->SetYTitle("<uQ>");
+  fHistList->Add(fHistProUQ);
 
   fCommonHists = new AliFlowCommonHist("SP");
   //fCommonHistsRes = new AliFlowCommonHistResults("SP");
+  fHistList->Add(fCommonHists); 
+
   fEventNumber = 0;  //set number of events to zero
       
 } 
@@ -112,6 +112,7 @@ void AliFlowAnalysisWithScalarProduct::Make(AliFlowEventSimple* anEvent) {
     //Double_t fMult =  fQ.GetMult();
             
     //loop over the tracks of the event
+    AliFlowTrackSimple*   fTrack = NULL; 
     Int_t fNumberOfTracks = anEvent->NumberOfTracks(); 
     for (Int_t i=0;i<fNumberOfTracks;i++) 
       {
@@ -149,7 +150,7 @@ void AliFlowAnalysisWithScalarProduct::Make(AliFlowEventSimple* anEvent) {
          }  
        }//track selected
       }//loop over tracks
-         
+        
     fEventNumber++;
     cout<<"@@@@@ "<<fEventNumber<<" events processed"<<endl;
   }
@@ -164,7 +165,7 @@ void AliFlowAnalysisWithScalarProduct::Finish() {
   fHistProUQ->Draw();
 
   // write to file
-  fHistFile->Write();
+//  fHistFile->Write();
          
   cout<<".....finished"<<endl;
  }
index 3b36bea18ff1be21646559a94a61754931a0b8ee..600e96ec8562e2688a93d9fb97626f77e628815a 100644 (file)
@@ -8,16 +8,17 @@
 #define AliFlowAnalysisWithScalarProduct_H
 
 #include "TVector2.h"          //called explicitly
-#include "AliFlowVector.h"
 #include "TString.h"
 
+#include "AliFlowVector.h"
+
 class AliFlowTrackSimple;
 class AliFlowEventSimple;
 class AliFlowCommonHist;
 //class AliFlowCommonHistResults;
 
 class TProfile;
-class TFile;
+class TList;
 class Riostream;
 
 
@@ -43,33 +44,24 @@ class AliFlowAnalysisWithScalarProduct {
 
 
    // Output 
-   void            SetHistFileName(TString name) { this->fHistFileName = name ; } // Sets output file name
-   TString  GetHistFileName() const      { return this->fHistFileName ; } // Gets output file name
-   TFile*   GetHistFile() const           { return this->fHistFile ; }     // Gets output file
+   TList*   GetHistList() const           { return this->fHistList ; }     // Gets output histogram list
   
    
  private:
   AliFlowAnalysisWithScalarProduct(const AliFlowAnalysisWithScalarProduct& aAnalysis);
   AliFlowAnalysisWithScalarProduct& operator=(const AliFlowAnalysisWithScalarProduct& aAnalysis); 
    
-  //  AliFlowVector  fQ;       // flow vector
-  //   TVector2  fU;            // particle unit vector
   AliFlowVector  *fQ;       // flow vector
-  TVector2  *fU;            // particle unit vector
+  TVector2       *fU;       // particle unit vector
    
-  Int_t     fEventNumber;  // event counter
+  Int_t          fEventNumber;  // event counter
          
-  AliFlowTrackSimple*   fTrack ;     //!
-     
-  Bool_t       fDebug ;            //! flag for lyz analysis: more print statements
+  Bool_t         fDebug ;            // flag for lyz analysis: more print statements
 
-  TString      fHistFileName;      //!
-  TFile*       fHistFile;          //!
-  
-  TProfile*      fHistProUQ;              //!
+  TList*         fHistList;      
+  TProfile*      fHistProUQ; 
 
-  AliFlowCommonHist* fCommonHists;              //!
-  //AliFlowCommonHistResults* fCommonHistsRes;    //!
+  AliFlowCommonHist* fCommonHists;  
 
   ClassDef(AliFlowAnalysisWithScalarProduct,0)  // macro for rootcint
     };
index 8d7b465a45a8431129bcf9db49da32378bcd33bb..01eed7bc2274c3847fb9eb5463e2c0dec27554b0 100644 (file)
@@ -23,12 +23,8 @@ void runProof() {
   gProof->AddIncludePath("./PWG2AOD/AOD");
   gProof->AddIncludePath("./PWG2flow/FLOW");
 
-  gProof->Load("AliAnalysisTaskCumulants.cxx++g");
 
-  TChain *chain = 0x0;
-
-  gROOT->LoadMacro("CreateESDChain.C");
-  chain = CreateESDChain("ESD82XX_30K.txt",200);
+  //  TChain *chain = 0x0;
 
   //____________________________________________//
   // Make the analysis manager
@@ -38,13 +34,21 @@ void runProof() {
   mgr->SetInputEventHandler(esdH);  
   //____________________________________________//
   // 1st Pt task
-  AliAnalysisTaskFemto *task1 = new AliAnalysisTaskFemto("TaskCumulants");
+  AliAnalysisTaskScalarProduct *task1 = new AliAnalysisTaskScalarProduct("TaskScalarProduct");
 
   mgr->AddTask(task1);
 
+
+
+  // Create chain of input files
+  gROOT->LoadMacro("CreateESDChain.C");
+  chain = CreateESDChain("ESD82XX_30K.txt",200);
+
+
   // Create containers for input/output
   AliAnalysisDataContainer *cinput1 = mgr->CreateContainer("cchain1",TChain::Class(),AliAnalysisManager::kInputContainer);
-  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("clist1", TList::Class(),AliAnalysisManager::kOutputContainer,"OutputFromCumulantAnlysisESD.root");
+  //  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("clist1", TList::Class(),AliAnalysisManager::kOutputContainer,"OutputFromCumulantAnlysisESD.root");
+  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("clist1", TList::Class(),AliAnalysisManager::kOutputContainer,"outputFromScalarProductAnalysisESD.root");
   
   //____________________________________________//
   mgr->ConnectInput(task1,0,cinput1);
diff --git a/PWG2/FLOW/macros/runProofScalarProduct.C b/PWG2/FLOW/macros/runProofScalarProduct.C
new file mode 100644 (file)
index 0000000..60241f4
--- /dev/null
@@ -0,0 +1,64 @@
+void runProofScalarProduct() {
+  TStopwatch timer;
+  timer.Start();
+
+  printf("*** Connect to PROOF ***\n");
+  TProof::Open("snelling@lxb6046.cern.ch");
+
+  gProof->UploadPackage("STEERBase.par");
+  gProof->EnablePackage("STEERBase");
+  gProof->UploadPackage("ESD.par");
+  gProof->EnablePackage("ESD");
+  gProof->UploadPackage("AOD.par");
+  gProof->EnablePackage("AOD");
+  gProof->UploadPackage("ANALYSIS.par");
+  gProof->EnablePackage("ANALYSIS");
+  gProof->UploadPackage("ANALYSISalice.par");
+  gProof->EnablePackage("ANALYSISalice");
+  gProof->UploadPackage("PWG2AOD.par");
+  gProof->EnablePackage("PWG2AOD");
+  gProof->UploadPackage("PWG2flow.par");
+  gProof->EnablePackage("PWG2flow");
+  gSystem->SetIncludePath("-I$ROOTSYS/include -I./PWG2flow/FLOW -I./ESD -I./AOD -I./ANALYSIS -I./PWG2AOD/AOD");
+  gProof->AddIncludePath("./PWG2AOD/AOD");
+  gProof->AddIncludePath("./PWG2flow/FLOW");
+
+
+  //  TChain *chain = 0x0;
+
+  //____________________________________________//
+  // Make the analysis manager
+  AliAnalysisManager *mgr = new AliAnalysisManager("TestManager");
+  AliESDInputHandler* esdH = new AliESDInputHandler;
+  esdH->SetInactiveBranches("FMD CaloCluster");
+  mgr->SetInputEventHandler(esdH);  
+  //____________________________________________//
+  // 1st Pt task
+  AliAnalysisTaskScalarProduct *task1 = new AliAnalysisTaskScalarProduct("TaskScalarProduct");
+
+  mgr->AddTask(task1);
+
+
+
+  // Create chain of input files
+  gROOT->LoadMacro("CreateESDChain.C");
+  chain = CreateESDChain("ESD82XX_30K.txt",200);
+
+
+  // Create containers for input/output
+  AliAnalysisDataContainer *cinput1 = mgr->CreateContainer("cchain1",TChain::Class(),AliAnalysisManager::kInputContainer);
+  //  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("clist1", TList::Class(),AliAnalysisManager::kOutputContainer,"OutputFromCumulantAnlysisESD.root");
+  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("clist1", TList::Class(),AliAnalysisManager::kOutputContainer,"outputFromScalarProductAnalysisESD.root");
+  
+  //____________________________________________//
+  mgr->ConnectInput(task1,0,cinput1);
+  mgr->ConnectOutput(task1,0,coutput1);
+
+  if (!mgr->InitAnalysis()) return;
+  mgr->PrintStatus();
+  mgr->StartAnalysis("proof",chain);
+
+  timer.Stop();
+  timer.Print();
+}
+