]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWGLF/SPECTRA/ChargedHadrons/dNdPt/AlidNdPtTask.cxx
end-of-line normalization
[u/mrichter/AliRoot.git] / PWGLF / SPECTRA / ChargedHadrons / dNdPt / AlidNdPtTask.cxx
index af919f4e2878d769e84880d0d7ff755ffc383024..e9ecf9a1c845a169d2c5a8ad92d1016295e52f77 100644 (file)
-/**************************************************************************\r
-* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *\r
-*                                                                        *\r
-* Author: The ALICE Off-line Project.                                    *\r
-* Contributors are mentioned in the code where appropriate.              *\r
-*                                                                        *\r
-* Permission to use, copy, modify and distribute this software and its   *\r
-* documentation strictly for non-commercial purposes is hereby granted   *\r
-* without fee, provided that the above copyright notice appears in all   *\r
-* copies and that both the copyright notice and this permission notice   *\r
-* appear in the supporting documentation. The authors make no claims     *\r
-* about the suitability of this software for any purpose. It is          *\r
-* provided "as is" without express or implied warranty.                  *\r
-**************************************************************************/\r
-\r
-#include "iostream"\r
-\r
-#include "TChain.h"\r
-#include "TTree.h"\r
-#include "TH1F.h"\r
-#include "TCanvas.h"\r
-#include "TList.h"\r
-#include "TFile.h"\r
-\r
-#include "AliAnalysisTask.h"\r
-#include "AliAnalysisManager.h"\r
-#include "AliESDEvent.h"\r
-#include "AliESDInputHandler.h"\r
-#include "AliESDVertex.h"\r
-#include "AliTracker.h"\r
-#include "AliGeomManager.h"\r
-\r
-#include "AliCentrality.h"\r
-#include "AliESDVZERO.h"\r
-#include "AliMultiplicity.h"\r
-\r
-#include "AliESDtrackCuts.h"\r
-#include "AliMCEventHandler.h"\r
-#include "AlidNdPt.h"\r
-#include "AlidNdPtEventCuts.h"\r
-#include "AlidNdPtAcceptanceCuts.h"\r
-\r
-#include "AlidNdPtTask.h"\r
-\r
-using namespace std;\r
-\r
-ClassImp(AlidNdPtTask)\r
-\r
-//_____________________________________________________________________________\r
-AlidNdPtTask::AlidNdPtTask(const char *name) \r
-  : AliAnalysisTaskSE(name)\r
-  , fESD(0)\r
-  , fMC(0)\r
-  , fOutput(0)\r
-  , fPitList(0)\r
-  , fCompList(0)\r
-  , fUseMCInfo(kFALSE)\r
-{\r
-  // Constructor\r
-\r
-  // Define input and output slots here\r
-  DefineOutput(1, TList::Class());\r
-\r
-  // create the list for comparison objects\r
-  fCompList = new TList;\r
-}\r
-\r
-//_____________________________________________________________________________\r
-AlidNdPtTask::~AlidNdPtTask()\r
-{\r
-  if(fOutput) delete fOutput;  fOutput =0; \r
-  if(fCompList) delete fCompList;  fCompList =0; \r
-}\r
-\r
-//____________________________________________________________________________\r
-Bool_t AlidNdPtTask::Notify()\r
-{\r
-  static Int_t count = 0;\r
-  count++;\r
-  //Printf("Processing %d. file: %s", count, ((TTree*) GetInputData(0))->GetCurrentFile()->GetName());\r
-  TTree *chain = (TChain*)GetInputData(0);\r
-  if(chain)\r
-    Printf("Processing %d. file: %s", count, chain->GetCurrentFile()->GetName());\r
-\r
-  /*\r
-  TChain *chain = (TChain*)GetInputData(0);\r
-  AliESDInputHandler *esdH = dynamic_cast<AliESDInputHandler*> (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());\r
-  if (!esdH) {\r
-    Printf("ERROR: Could not get ESDInputHandler");\r
-    return kFALSE;\r
-  } else {\r
-    if(chain)\r
-    Printf("chain->GetCurrentFile()->GetName() %s", chain->GetCurrentFile()->GetName());\r
-  }\r
-  */\r
-\r
-return kTRUE;\r
-}\r
-\r
-//_____________________________________________________________________________\r
-Bool_t AlidNdPtTask::AddAnalysisObject(AlidNdPt *pObj) \r
-{\r
-  // add analysis object to the list\r
-  if(pObj == 0) {\r
-    Printf("ERROR: Could not add comparison object");\r
-    return kFALSE;\r
-  }\r
-\r
-  // add object to the list\r
-  fCompList->AddLast(pObj);\r
-       \r
-return kTRUE;\r
-}\r
-\r
-//_____________________________________________________________________________\r
-void AlidNdPtTask::UserCreateOutputObjects()\r
-{\r
-  // Create histograms\r
-  // Called once\r
-\r
-  OpenFile(1, "RECREATE");\r
-\r
-  //\r
-  // create output list\r
-  //\r
-  fOutput = new TList;\r
-  fOutput->SetOwner();\r
-  fPitList = fOutput->MakeIterator();\r
-\r
-  // add dNdPt analysis objects to the output\r
-  AlidNdPt *pObj=0;\r
-  Int_t count=0;\r
-  TIterator *pitCompList = fCompList->MakeIterator();\r
-  pitCompList->Reset();\r
-  while(( pObj = (AlidNdPt *)pitCompList->Next()) != NULL) {\r
-    fOutput->Add(pObj);\r
-    count++;\r
-  }\r
-  Printf("UserCreateOutputObjects(): Number of output objects: %d \n", count);\r
-\r
-  PostData(1, fOutput);\r
-}\r
-\r
-//_____________________________________________________________________________\r
-void AlidNdPtTask::UserExec(Option_t *) \r
-{\r
-  //\r
-  // Called for each event\r
-  //\r
-\r
-  // ESD event\r
-  fESD = (AliESDEvent*) (InputEvent());\r
-  if (!fESD) {\r
-    Printf("ERROR: ESD event not available");\r
-    return;\r
-  }\r
-\r
-  // MC event\r
-  if(fUseMCInfo) {\r
-    fMC = MCEvent();\r
-    if (!fMC) {\r
-      Printf("ERROR: MC event not available");\r
-      return;\r
-    }\r
-  }\r
-\r
-\r
-    AlidNdPt *pObj = 0;\r
-    fPitList->Reset();\r
-    while((pObj = (AlidNdPt *)fPitList->Next()) != NULL) {\r
-      pObj->Process(fESD,fMC);\r
-    }\r
-\r
-\r
-  // Post output data.\r
-  PostData(1, fOutput);\r
-}\r
-\r
-//_____________________________________________________________________________\r
-void AlidNdPtTask::FinishTaskOutput() \r
-{\r
-  //\r
-  // Called one at the end \r
-  // locally on working node\r
-  //\r
-   // check output data\r
-  fOutput = dynamic_cast<TList*> (GetOutputData(1));\r
-  if (!fOutput) {\r
-    Printf("ERROR: AlidNdPtTask::FinishTaskOutput(): Output data not avaiable GetOutputData(1)==0x0 ..." );\r
-    return;\r
-  }\r
-\r
-  AlidNdPt* pObj=0;\r
-  TIterator* itOut = fOutput->MakeIterator();\r
-  itOut->Reset();\r
-  while(( pObj = dynamic_cast<AlidNdPt*>(itOut->Next())) != NULL) {\r
-    if(pObj->GetAnalyseOutput()) { \r
-      pObj->Analyse();\r
-    }\r
-  }\r
-\r
-  // Post output data.\r
-  PostData(1, fOutput);\r
-}\r
-\r
-//_____________________________________________________________________________\r
-void AlidNdPtTask::Terminate(Option_t *) \r
-{\r
-  // Called one at the end \r
-  \r
-  // check output data\r
-  fOutput = dynamic_cast<TList*> (GetOutputData(1));\r
-  if (!fOutput) {\r
-    Printf("ERROR: AlidNdPtTask::Terminate(): Output data not avaiable GetOutputData(0)==0x0 ..." );\r
-    return;\r
-  }\r
-}\r
+/**************************************************************************
+* 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.                  *
+**************************************************************************/
+
+#include "iostream"
+
+#include "TChain.h"
+#include "TTree.h"
+#include "TH1F.h"
+#include "TCanvas.h"
+#include "TList.h"
+#include "TFile.h"
+
+#include "AliAnalysisTask.h"
+#include "AliAnalysisManager.h"
+#include "AliESDEvent.h"
+#include "AliESDInputHandler.h"
+#include "AliESDVertex.h"
+#include "AliTracker.h"
+#include "AliGeomManager.h"
+
+#include "AliCentrality.h"
+#include "AliESDVZERO.h"
+#include "AliMultiplicity.h"
+
+#include "AliESDtrackCuts.h"
+#include "AliMCEventHandler.h"
+#include "AlidNdPt.h"
+#include "AlidNdPtEventCuts.h"
+#include "AlidNdPtAcceptanceCuts.h"
+
+#include "AlidNdPtTask.h"
+
+using namespace std;
+
+ClassImp(AlidNdPtTask)
+
+//_____________________________________________________________________________
+AlidNdPtTask::AlidNdPtTask(const char *name) 
+  : AliAnalysisTaskSE(name)
+  , fESD(0)
+  , fMC(0)
+  , fOutput(0)
+  , fPitList(0)
+  , fCompList(0)
+  , fUseMCInfo(kFALSE)
+{
+  // Constructor
+
+  // Define input and output slots here
+  DefineOutput(1, TList::Class());
+
+  // create the list for comparison objects
+  fCompList = new TList;
+}
+
+//_____________________________________________________________________________
+AlidNdPtTask::~AlidNdPtTask()
+{
+  if(fOutput) delete fOutput;  fOutput =0; 
+  if(fCompList) delete fCompList;  fCompList =0; 
+}
+
+//____________________________________________________________________________
+Bool_t AlidNdPtTask::Notify()
+{
+  static Int_t count = 0;
+  count++;
+  //Printf("Processing %d. file: %s", count, ((TTree*) GetInputData(0))->GetCurrentFile()->GetName());
+  TTree *chain = (TChain*)GetInputData(0);
+  if(chain)
+    Printf("Processing %d. file: %s", count, chain->GetCurrentFile()->GetName());
+
+  /*
+  TChain *chain = (TChain*)GetInputData(0);
+  AliESDInputHandler *esdH = dynamic_cast<AliESDInputHandler*> (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
+  if (!esdH) {
+    Printf("ERROR: Could not get ESDInputHandler");
+    return kFALSE;
+  } else {
+    if(chain)
+    Printf("chain->GetCurrentFile()->GetName() %s", chain->GetCurrentFile()->GetName());
+  }
+  */
+
+return kTRUE;
+}
+
+//_____________________________________________________________________________
+Bool_t AlidNdPtTask::AddAnalysisObject(AlidNdPt *pObj) 
+{
+  // add analysis object to the list
+  if(pObj == 0) {
+    Printf("ERROR: Could not add comparison object");
+    return kFALSE;
+  }
+
+  // add object to the list
+  fCompList->AddLast(pObj);
+       
+return kTRUE;
+}
+
+//_____________________________________________________________________________
+void AlidNdPtTask::UserCreateOutputObjects()
+{
+  // Create histograms
+  // Called once
+
+  OpenFile(1, "RECREATE");
+
+  //
+  // create output list
+  //
+  fOutput = new TList;
+  fOutput->SetOwner();
+  fPitList = fOutput->MakeIterator();
+
+  // add dNdPt analysis objects to the output
+  AlidNdPt *pObj=0;
+  Int_t count=0;
+  TIterator *pitCompList = fCompList->MakeIterator();
+  pitCompList->Reset();
+  while(( pObj = (AlidNdPt *)pitCompList->Next()) != NULL) {
+    fOutput->Add(pObj);
+    count++;
+  }
+  Printf("UserCreateOutputObjects(): Number of output objects: %d \n", count);
+
+  PostData(1, fOutput);
+}
+
+//_____________________________________________________________________________
+void AlidNdPtTask::UserExec(Option_t *) 
+{
+  //
+  // Called for each event
+  //
+
+  // ESD event
+  fESD = (AliESDEvent*) (InputEvent());
+  if (!fESD) {
+    Printf("ERROR: ESD event not available");
+    return;
+  }
+
+  // MC event
+  if(fUseMCInfo) {
+    fMC = MCEvent();
+    if (!fMC) {
+      Printf("ERROR: MC event not available");
+      return;
+    }
+  }
+
+
+    AlidNdPt *pObj = 0;
+    fPitList->Reset();
+    while((pObj = (AlidNdPt *)fPitList->Next()) != NULL) {
+      pObj->Process(fESD,fMC);
+    }
+
+
+  // Post output data.
+  PostData(1, fOutput);
+}
+
+//_____________________________________________________________________________
+void AlidNdPtTask::FinishTaskOutput() 
+{
+  //
+  // Called one at the end 
+  // locally on working node
+  //
+   // check output data
+  fOutput = dynamic_cast<TList*> (GetOutputData(1));
+  if (!fOutput) {
+    Printf("ERROR: AlidNdPtTask::FinishTaskOutput(): Output data not avaiable GetOutputData(1)==0x0 ..." );
+    return;
+  }
+
+  AlidNdPt* pObj=0;
+  TIterator* itOut = fOutput->MakeIterator();
+  itOut->Reset();
+  while(( pObj = dynamic_cast<AlidNdPt*>(itOut->Next())) != NULL) {
+    if(pObj->GetAnalyseOutput()) { 
+      pObj->Analyse();
+    }
+  }
+
+  // Post output data.
+  PostData(1, fOutput);
+}
+
+//_____________________________________________________________________________
+void AlidNdPtTask::Terminate(Option_t *) 
+{
+  // Called one at the end 
+  
+  // check output data
+  fOutput = dynamic_cast<TList*> (GetOutputData(1));
+  if (!fOutput) {
+    Printf("ERROR: AlidNdPtTask::Terminate(): Output data not avaiable GetOutputData(0)==0x0 ..." );
+    return;
+  }
+}