//_____________________________________________________________________________
AliRsnAnalysisME::AliRsnAnalysisME(const char *name) :
AliRsnVAnalysisTaskME(name),
- fRsnAnalysisManager()
+ fRsnAnalysisManager(),
+ fPIDIndex(0),
+ fPIDIndexMix(0),
+ fEvent(),
+ fEventMix(),
+ fESDCuts(0)
{
//
// Default constructor
}
AliRsnAnalysisME::AliRsnAnalysisME(const AliRsnAnalysisME& copy) : AliRsnVAnalysisTaskME(copy),
- fRsnAnalysisManager(copy.fRsnAnalysisManager)
+ fRsnAnalysisManager(copy.fRsnAnalysisManager),
+ fPIDIndex(copy.fPIDIndex),
+ fPIDIndexMix(copy.fPIDIndexMix),
+ fEvent(copy.fEvent),
+ fEventMix(copy.fEvent),
+ fESDCuts(copy.fESDCuts)
{
AliDebug(AliLog::kDebug+2,"<-");
AliDebug(AliLog::kDebug+2,"->");
\r
private:\r
\r
+ AliRsnAnalysisME& operator=(const AliRsnAnalysisME& /*copy*/) {return *this;}\r
+\r
AliRsnAnalysisManager fRsnAnalysisManager; // analysis main engine\r
AliRsnPIDIndex fPIDIndex; // utility --> PID sorter\r
- AliRsnEvent fEvent; // utility --> event interface\r
AliRsnPIDIndex fPIDIndexMix; // utility --> PID sorter (mixed event)\r
+ AliRsnEvent fEvent; // utility --> event interface\r
AliRsnEvent fEventMix; // utility --> event interface (mixed event)\r
\r
AliESDtrackCuts *fESDCuts; // ESD track cuts\r
}
//_____________________________________________________________________________
-void AliRsnAnalysisManager::Add(AliRsnPairManager *pair)
+//void AliRsnAnalysisManager::Add(AliRsnPairManager *pair)
+void AliRsnAnalysisManager::Add(TObject *objPairMgr)
{
//
// Adds a new pair manager to the list.
//
AliDebug(AliLog::kDebug+2,"<-");
+ AliRsnPairManager *pair = dynamic_cast<AliRsnPairManager*>(objPairMgr);
if (!pair) {
AliWarning(Form("AliRsnPairManager is %p. Skipping ...", pair));
AliRsnAnalysisManager(const char*name = "defaultAnalysisMgr");
- virtual void Add(AliRsnPairManager *pair);
+ //virtual void Add(AliRsnPairManager *pair);
+ virtual void Add(TObject *pair);
virtual void AddConfig(TString config, TString prefix, TString functionName = "");
virtual void PrintArray() const;
virtual void Print(Option_t *option = "") const;
AliRsnAnalysisSE::AliRsnAnalysisSE(const char *name) :
AliRsnVAnalysisTaskSE(name),
fRsnAnalysisManager(),
+ fPIDIndex(0),
+ fEvent(),
fESDCuts(0)
{
//
}
AliRsnAnalysisSE::AliRsnAnalysisSE(const AliRsnAnalysisSE& copy) : AliRsnVAnalysisTaskSE(copy),
- fRsnAnalysisManager(copy.fRsnAnalysisManager)
+ fRsnAnalysisManager(copy.fRsnAnalysisManager),
+ fPIDIndex(copy.fPIDIndex),
+ fEvent(copy.fEvent),
+ fESDCuts(copy.fESDCuts)
{
AliDebug(AliLog::kDebug+2,"<-");
AliDebug(AliLog::kDebug+2,"->");
\r
private:\r
\r
+ AliRsnAnalysisSE& operator=(const AliRsnAnalysisSE& /*copy*/) {return *this;}\r
+\r
AliRsnAnalysisManager fRsnAnalysisManager; // analysis main engine\r
AliRsnPIDIndex fPIDIndex; // utility --> PID sorter\r
AliRsnEvent fEvent; // utility --> event interface\r
+++ /dev/null
-//
-// Class AliRsnAnalysisTask2ndStep
-//
-// TODO
-//
-// authors: Martin Vala (martin.vala@cern.ch)
-// Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it)
-//
-#include <TTree.h>
-#include <TChain.h>
-#include <TH1F.h>
-#include <TList.h>
-#include <TObjArray.h>
-
-#include "AliLog.h"
-
-#include "AliAODEvent.h"
-#include "AliAODInputHandler.h"
-#include "AliAnalysisManager.h"
-#include "AliAnalysisTaskSE.h"
-
-#include "AliRsnEvent.h"
-#include "AliRsnPair.h"
-#include "AliRsnPairMgr.h"
-
-#include "AliRsnAnalysisTask2ndStep.h"
-
-ClassImp(AliRsnAnalysisTask2ndStep)
-
-//_____________________________________________________________________________
-AliRsnAnalysisTask2ndStep::AliRsnAnalysisTask2ndStep(const char *name) :
- AliAnalysisTaskSE(name),
- fOutList(0x0),
- fPairMgrs(0x0),
- fEventBuffer(0x0),
- fRsnHandlerAOD(0x0),
- fAnalysisMgr(0x0)
-{
-//
-// Default constructor
-//
-
- DefineOutput(1, TList::Class());
-}
-
-//_____________________________________________________________________________
-void AliRsnAnalysisTask2ndStep::CreateHandlers(AliAnalysisManager* am)
-{
-//
-// Sets the handlers.
-//
-
- fAnalysisMgr = am;
- if (!fAnalysisMgr)
- {
- AliWarning("Passed a NULL AnalysisManager!");
- return;
- }
-
- // this task is made only for building histograms from
- // a set of RSN events saved as non-standard branches in AOD tree
- fRsnHandlerAOD = new AliAODInputHandler();
- if (fRsnHandlerAOD) fAnalysisMgr->SetInputEventHandler(fRsnHandlerAOD);
-}
-
-//_____________________________________________________________________________
-void AliRsnAnalysisTask2ndStep::UserCreateOutputObjects()
-{
-//
-// Creates output objects, as a TList of all histograms
-//
- AliInfo("--->");
-
- //OpenFile (1);
- if (fOutList)
- {
- fOutList->Clear();
- delete fOutList;
- }
- fOutList = new TList();
- fOutList->SetOwner();
- AliRsnPairMgr *pairMgr = 0x0;
- AliRsnPair *pair = 0x0;
-
- if (!fPairMgrs)
- {
- AliError("No pair managers defined!");
- return;
- }
-
- TObjArrayIter next(fPairMgrs);
- while ((pairMgr = (AliRsnPairMgr*)next()))
- {
- TList *listTmp = new TList();
- listTmp->SetName(pairMgr->GetName());
- TObjArrayIter nextPair(pairMgr->GetPairs());
- while ((pair = (AliRsnPair*)nextPair()))
- {
- pair->Init();
- //pair->Print();
- pair->GenerateHistograms(pairMgr->GetName(), listTmp);
- //listTmp->Add(pair->GenerateHistograms(pairMgr->GetName()));
- //fOutList->Add(listTmp);
- }
- fOutList->Add(listTmp);
- }
- fEventBuffer = new AliRsnEventBuffer(1000);
-
- AliInfo("<---");
-}
-
-//_____________________________________________________________________________
-void AliRsnAnalysisTask2ndStep::UserExec(Option_t *)
-{
-//
-// Executes the task
-//
-
- if (fEntry++ % 1000 == 0) AliInfo(Form("Event %d",-1));
-
- // retrieve AOD
- AliAODEvent *aod = dynamic_cast<AliAODEvent*>(fInputEvent);
-
- // find RSN event
- AliRsnEvent *rsn = (AliRsnEvent*)(aod->GetList()->FindObject("rsnEvents"));
-
- // execute analysis
- ProcessEventAnalysis(rsn);
- PostEventProcess();
-
- PostData(1, fOutList);
-}
-
-//_____________________________________________________________________________
-void AliRsnAnalysisTask2ndStep::Terminate(Option_t *)
-{
-//
-// A simple check on the output list
-//
-
- fOutList = dynamic_cast<TList*>(GetOutputData(1));
- if (!fOutList) { AliError("--- Output list not available ---"); return; }
- fOutList->Print();
-}
-
-//_____________________________________________________________________________
-void AliRsnAnalysisTask2ndStep::ProcessEventAnalysis(AliRsnEvent *curEvent)
-{
-//
-// Process of one event
-//
-
- // Adds event to Event Buffer
- fEventBuffer->AddEvent(curEvent);
-
- // loop over all Pair managers
- AliRsnPair *pair = 0;
- AliRsnPairMgr *mgr = 0;
- TObjArrayIter nextMgr(fPairMgrs);
- while ((mgr = (AliRsnPairMgr*)nextMgr()))
- {
- TObjArrayIter nextPair(mgr->GetPairs());
- while ((pair = (AliRsnPair*)nextPair()))
- {
- pair->ProcessPair(fEventBuffer);
- }
- }
-}
-
-//_____________________________________________________________________________
-void AliRsnAnalysisTask2ndStep::PostEventProcess()
-{
-//
-// Some work done after event processing
-//
-
-}
-
-//_____________________________________________________________________________
-void AliRsnAnalysisTask2ndStep::AddPairMgr(AliRsnPairMgr *pairmgr)
-{
- if (!fPairMgrs) fPairMgrs = new TObjArray;
- fPairMgrs->Add(pairmgr);
-}
+++ /dev/null
-//
-// Class AliRsnAnalysisTaskBase
-//
-// TODO
-//
-// authors: Martin Vala (martin.vala@cern.ch)
-// Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it)
-//
-#include <TTree.h>
-#include <TH1F.h>
-#include <TCanvas.h>
-
-#include "AliLog.h"
-
-#include "AliAnalysisManager.h"
-#include "AliAnalysisTask.h"
-
-#include "AliESDEvent.h"
-#include "AliAODEvent.h"
-#include "AliRsnEvent.h"
-#include "AliMCEvent.h"
-
-#include "AliRsnAnalysisTaskBase.h"
-
-
-ClassImp(AliRsnAnalysisTaskBase)
-
-//________________________________________________________________________
-AliRsnAnalysisTaskBase::AliRsnAnalysisTaskBase(const char *name)
- : AliAnalysisTask(name, ""),
- fNumOfEvents(100),
- fUseAutoHandler(100),
- fReader(),
- fPID(),
- fAnalysisMgr(0x0)
-{
-//=========================================================
-// Default constructor
-//=========================================================
- InitIOVars();
- DefineInput(0, TChain::Class());
-// DefineInput ( 1, AliRsnReader::Class() );
-// DefineInput ( 2, AliRsnPID::Class() );
-}
-
-//________________________________________________________________________
-void AliRsnAnalysisTaskBase::InitIOVars()
-{
-//=========================================================
-// Initial values for constructor
-//=========================================================
- AliDebug(AliLog::kDebug, "<-");
-
- fNumOfEvents=0;
- fUseAutoHandler = kFALSE;
- for (Int_t i=0;i<2;i++)
- {
- fChain[i] = 0;
- fRSN[i] = 0;
- fRsnESD[i] = 0;
- fRsnMC[i] = 0;
- fRsnAOD[i] = 0;
- fRsnESDEH[i] = 0;
- fRsnMCEH[i] = 0;
- fRsnAODEH[i] = 0;
- fInputType[i] = kRSN;
- }
-
- fAnalysisMgr=0;
-
- AliDebug(AliLog::kDebug, "->");
-}
-
-//________________________________________________________________________
-void AliRsnAnalysisTaskBase::LocalInit()
-{
-//=========================================================
-// LocalInit()
-//=========================================================
-}
-
-//________________________________________________________________________
-Bool_t AliRsnAnalysisTaskBase::Notify()
-{
-//=========================================================
-// Notify()
-//=========================================================
-
- return AliAnalysisTask::Notify();
-}
-
-//_____________________________________________________________________________
-void AliRsnAnalysisTaskBase::SetInputType(EInputType type, AliAnalysisManager* am, Bool_t autohandler, Short_t inputIndex)
-{
-//
-// Sets input type.
-// When autohandler is kTRUE handlers are created and connected
-// to the passed AliAnalysisManager if it exists.
-// The internal AliAnalysisManager object is redirected to the passed one.
-//
-
- fInputType[inputIndex] = type;
- fAnalysisMgr = am;
-
- UseAutoHandler(autohandler);
- if (!fUseAutoHandler) return;
-
- if (!fAnalysisMgr)
- {
- AliWarning(Form("fAnalysisMgr is %p and fUseAutoHandler is %d", fAnalysisMgr, fUseAutoHandler));
- return;
- }
-
- switch (fInputType[inputIndex])
- {
- case kAOD:
- fRsnAODEH[0] = new AliAODInputHandler();
- if (fRsnAODEH[0]) fAnalysisMgr->SetInputEventHandler(fRsnAODEH[0]);
- break;
- case kESD:
- case kESDTPC:
- fRsnESDEH[0] = new AliESDInputHandler();
- if (fRsnESDEH[0]) fAnalysisMgr->SetInputEventHandler(fRsnESDEH[0]);
- break;
- case kESDMC:
- case kESDMCTPC:
- case kMC:
- fRsnESDEH[0] = new AliESDInputHandler();
- fRsnMCEH[0] = new AliMCEventHandler();
- if ((fRsnESDEH[0]) && (fRsnMCEH[0]))
- {
- fAnalysisMgr->SetInputEventHandler(fRsnESDEH[0]);
- fAnalysisMgr->SetMCtruthEventHandler(fRsnMCEH[0]);
- }
- break;
- case kRSN:
- break;
- default:
- AliError("Type not supported ...");
- break;
- }
-
- // check if the TPC only is used
- if (fInputType[inputIndex] == kESDTPC || fInputType[inputIndex] == kESDMCTPC) fReader.SetTPCOnly();
-
-}
-//________________________________________________________________________
-void AliRsnAnalysisTaskBase::ConnectInputData(Option_t *)
-{
-//=========================================================
-// ConectInputData() for AliAnalysisTask
-// just define myTask->SetInputType ( AliRsnAnalysisTaskBase::kRSN ); for Rsn input
-// just define myTask->SetInputType ( AliRsnAnalysisTaskBase::kESDMC ); for ESD and MC input
-// just define myTask->SetInputType ( AliRsnAnalysisTaskBase::kAOD ); for Rsn input
-//=========================================================
-
- ConnectInputDataByInputType(fInputType[0],0);
-}
-
-void AliRsnAnalysisTaskBase::ConnectInputDataByInputType(EInputType type ,Short_t inputIndex)
-{
-//=========================================================
-// Connect input data by input type
-//=========================================================
-
- AliDebug(AliLog::kDebug, "<-");
-
- switch (type)
- {
- case kAOD:
- ConnectAOD(inputIndex);
- break;
- case kESD:
- case kESDTPC:
- ConnectESD(inputIndex);
- break;
- case kESDMC:
- case kESDMCTPC:
- case kMC:
- ConnectESDMC(inputIndex);
- break;
- case kRSN:
- ConnectRSN(inputIndex);
- break;
- default:
- AliError("Type not supported ...");
- break;
- }
-
- AliDebug(AliLog::kDebug, "->");
-}
-//_____________________________________________________________________________
-void AliRsnAnalysisTaskBase::ConnectRSN(Short_t inputIndex)
-{
-//
-// Connect input data by RSN input type
-//
-
- AliDebug(AliLog::kDebug, "<-");
-
- char ** address = (char **) GetBranchAddress(inputIndex, "rsnEvents");
- if (address)
- {
- fRSN[inputIndex] = (AliRsnEvent*)(*address);
- }
- else
- {
- fRSN[inputIndex] = 0;
- SetBranchAddress(inputIndex, "rsnEvents", &fRSN[inputIndex]);
- }
-
- AliDebug(AliLog::kDebug, "->");
-}
-
-//_____________________________________________________________________________
-void AliRsnAnalysisTaskBase::ConnectESD(Short_t inputIndex)
-{
-//
-// Connect input data by ESD input type
-//
- AliDebug(AliLog::kDebug, "<-");
- TTree* tree = dynamic_cast<TTree*>(GetInputData(inputIndex));
- if (!tree) { AliError("Could not read chain from input slot 0"); }
- else
- {
- // Disable all branches, we want to process only MC
-// tree->SetBranchStatus("*", kFALSE);
-// tree->SetBranchStatus("fTracks.*", kTRUE);
-
- AliESDInputHandler *esdH = dynamic_cast<AliESDInputHandler*>(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
-
- if (!esdH) { AliError("Could not get ESDInputHandler"); }
- else
- fRsnESD[inputIndex] = esdH->GetEvent();
- }
- AliDebug(AliLog::kDebug, "->");
-}
-
-//_____________________________________________________________________________
-void AliRsnAnalysisTaskBase::ConnectESDMC(Short_t inputIndex)
-{
-//
-// Connect input data by ESDMC input type
-//
-
- AliDebug(AliLog::kDebug, "<-");
- TTree* tree = dynamic_cast<TTree*>(GetInputData(inputIndex));
- if (!tree) { AliError("Could not read chain from input slot 0"); }
- else
- {
- // Disable all branches, we want to process only MC
-// tree->SetBranchStatus("*", kFALSE);
-// tree->SetBranchStatus("fTracks.*", kTRUE);
-
- AliESDInputHandler *esdH = dynamic_cast<AliESDInputHandler*>(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
-
- if (!esdH) { AliError("Could not get ESDInputHandler"); }
- else
- fRsnESD[inputIndex] = esdH->GetEvent();
- }
- AliDebug(AliLog::kDebug, "->");
-}
-
-//_____________________________________________________________________________
-void AliRsnAnalysisTaskBase::ConnectAOD(Short_t inputIndex)
-{
-//
-// Connect input data by AOD input type
-//
-
- AliDebug(AliLog::kDebug, "<-");
-
- TTree* tree = dynamic_cast<TTree*>(GetInputData(inputIndex));
- if (!tree) { AliError("Could not read chain from input slot 0");}
- else
- {
- AliAODInputHandler *aodH = dynamic_cast<AliAODInputHandler*>(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
- if (!aodH) { AliError("Could not get AODInputHandler"); }
- else fRsnAOD[inputIndex] = aodH->GetEvent();
- }
-
- AliDebug(AliLog::kDebug, "->");
-}
-
-//_____________________________________________________________________________
-AliRsnEvent * AliRsnAnalysisTaskBase::GetRsnEventFromInputType(const Short_t & index)
-{
-//
-// Gets Event from input type
-//
-
- switch (fInputType[index])
- {
- case kAOD: return GetRsnFromAOD(index);
- case kESD: return GetRsnFromESD(index);
- case kESDMC: return GetRsnFromESDMC(index);
- case kESDTPC: return GetRsnFromESD(index);
- case kESDMCTPC: return GetRsnFromESDMC(index);
- case kMC: return GetRsnFromMC(index);
- case kRSN: return GetRsnFromRSN(index);
- default:
- AliError("Type not supported ...");
- return (AliRsnEvent*) 0x0;
- }
-
- return (AliRsnEvent*) 0x0;
-}
-
-//_____________________________________________________________________________
-AliRsnEvent * AliRsnAnalysisTaskBase::GetRsnFromAOD(const Short_t & index)
-{
-//
-// Gets RSN event from AOD
-//
-
- if (!fRsnAOD[index])
- {
- AliError("fRsnAOD not available.");
- return (AliRsnEvent *) 0x0;
- }
-
- if (!fRSN[0])
- {
- fRSN[0] = new AliRsnEvent();
- fRSN[0]->SetName("rsnEvents");
- fRSN[0]->Init();
- }
-
- // clear pevious event
- fRSN[0]->Clear();
- if (!fReader.FillFromAOD(fRSN[0], fRsnAOD[index])) return (AliRsnEvent*) 0x0;
- if (!fPID.Process(fRSN[0])) AliWarning("Failed PID");
-
- return (AliRsnEvent*) fRSN[0];
-}
-
-//_____________________________________________________________________________
-AliRsnEvent * AliRsnAnalysisTaskBase::GetRsnFromESD(const Short_t & index)
-{
-//
-// Gets RSN event from ESD
-//
-
- if (!fRsnESD[index])
- {
- AliError("fRsnESD not available.");
- return (AliRsnEvent *) 0x0;
- }
-
- if (!fRSN[index])
- {
- fRSN[index] = new AliRsnEvent();
- fRSN[index]->SetName("rsnEvents");
- fRSN[index]->Init();
- }
-
- // clear pevious event
- fRSN[index]->Clear();
-
- if (!fReader.FillFromESD(fRSN[index], fRsnESD[index], 0x0)) return (AliRsnEvent*) 0x0;
-
- if (!fPID.Process(fRSN[index]))
- {
- AliWarning("Failed PID");
- return (AliRsnEvent*) 0x0;
- }
-
- return fRSN[index];
-}
-
-//_____________________________________________________________________________
-AliRsnEvent * AliRsnAnalysisTaskBase::GetRsnFromMC(const Short_t & index)
-{
-//
-// Gets RSN event from ESD
-//
-
- AliMCEventHandler* mcHandler = dynamic_cast<AliMCEventHandler*>(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
- if (!mcHandler) { AliError("Could not retrieve MC event handler"); return (AliRsnEvent *) 0x0; }
-
- if (!fRsnESD[index])
- {
- AliError("fRsnESD not available.");
- return (AliRsnEvent *) 0x0;
- }
-
- if (!fRSN[index])
- {
- fRSN[index] = new AliRsnEvent();
- fRSN[index]->SetName("rsnEvents");
- fRSN[index]->Init();
- }
-
- // clear pevious event
- fRSN[index]->Clear();
-
- fRsnMC[index] = mcHandler->MCEvent();
-
- if (!fRsnMC[index]) return (AliRsnEvent *) 0x0;
- if (!fReader.FillFromMC(fRSN[index], fRsnMC[index])) return (AliRsnEvent*) 0x0;
- fPID.Process(fRSN[index]);
- return fRSN[index];
-}
-
-//_____________________________________________________________________________
-AliRsnEvent * AliRsnAnalysisTaskBase::GetRsnFromESDMC(const Short_t & index)
-{
-//
-// Gets RSN event from ESD and MC
-//
-
- AliMCEventHandler* mcHandler = dynamic_cast<AliMCEventHandler*>(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
- if (!mcHandler) { AliError("Could not retrieve MC event handler"); return (AliRsnEvent *) 0x0; }
-
- if (!fRsnESD[index])
- {
- AliError("fRsnESD not available.");
- return (AliRsnEvent *) 0x0;
- }
-
- if (!fRSN[index])
- {
- fRSN[index] = new AliRsnEvent();
- fRSN[index]->SetName("rsnEvents");
- fRSN[index]->Init();
- }
-
- // clear pevious event
- fRSN[index]->Clear();
- fRsnMC[index] = mcHandler->MCEvent();
-
- if (!fRsnMC[index]) return (AliRsnEvent *) 0x0;
- if (!fReader.FillFromESD(fRSN[index], fRsnESD[index], fRsnMC[index])) return (AliRsnEvent*) 0x0;
- if (!fPID.Process(fRSN[index]))
- {
- AliWarning("Failed PID");
- return (AliRsnEvent*) 0x0;
- }
-
- return fRSN[index];
-}
-
-//_____________________________________________________________________________
-AliRsnEvent * AliRsnAnalysisTaskBase::GetRsnFromRSN(const Short_t & index)
-{
-//
-// Gets RSN event from RSN
-// not fully implemented yet
-//
- AliRsnEvent *event = fRSN[index];
- return event;
-}
+++ /dev/null
-//
-// Class AliRsnAnalysisTaskSEBase
-//
-// TODO
-//
-// authors: Martin Vala (martin.vala@cern.ch)
-// Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it)
-//
-#include <TTree.h>
-#include <TH1F.h>
-#include <TCanvas.h>
-
-#include "AliLog.h"
-
-#include "AliAnalysisManager.h"
-#include "AliAnalysisTaskSE.h"
-
-#include "AliESDEvent.h"
-#include "AliAODEvent.h"
-#include "AliRsnEvent.h"
-#include "AliMCEvent.h"
-
-#include "AliRsnMCInfo.h"
-#include "AliRsnDaughter.h"
-#include "AliRsnAnalysisTaskSEBase.h"
-
-
-ClassImp(AliRsnAnalysisTaskSEBase)
-
-//_____________________________________________________________________________
-AliRsnAnalysisTaskSEBase::AliRsnAnalysisTaskSEBase(const char *name) :
- AliAnalysisTaskSE(name),
- fUseAutoHandler(kTRUE),
- fReader(),
- //fPID(),
- fAnalysisMgr(0x0) // pointer to current AnalysisMgr
-{
-//
-// Default constructor
-//
- InitIOVars();
- DefineInput(0, TChain::Class());
-}
-
-//_____________________________________________________________________________
-void AliRsnAnalysisTaskSEBase::InitIOVars()
-{
-//
-// Initial values for constructor
-//
-
- fUseAutoHandler = kFALSE;
-
- Int_t i;
- for (i = 0; i < 2; i++)
- {
- fChain[i] = 0;
- fRSN[i] = 0;
- fRsnESD[i] = 0;
- fRsnMC[i] = 0;
- fRsnAOD[i] = 0;
- fRsnESDEH[i] = 0;
- fRsnMCEH[i] = 0;
- fRsnAODEH[i] = 0;
- fInputType[i] = kRSN;
- }
-
- fAnalysisMgr = 0;
-}
-
-//_____________________________________________________________________________
-void AliRsnAnalysisTaskSEBase::LocalInit()
-{
-//
-// LocalInit()
-//
- AliAnalysisTaskSE::LocalInit();
-}
-
-//_____________________________________________________________________________
-Bool_t AliRsnAnalysisTaskSEBase::Notify()
-{
-//
-// Notify()
-//
-
- return AliAnalysisTaskSE::Notify();
-}
-
-//_____________________________________________________________________________
-void AliRsnAnalysisTaskSEBase::SetInputType
-(EInputType type, AliAnalysisManager* am, Bool_t autohandler, Short_t inputIndex)
-{
-//
-// Sets input type.
-// When autohandler is kTRUE handlers are created and connected
-// to the passed AliAnalysisManager if it exists.
-// The internal AliAnalysisManager object is redirected to the passed one.
-//
-
- fInputType[inputIndex] = type;
- fAnalysisMgr = am;
-
- UseAutoHandler(autohandler);
- if (!fUseAutoHandler) return;
-
- if (!fAnalysisMgr)
- {
- AliWarning(Form("fAnalysisMgr is %p and fUseAutoHandler is %d", fAnalysisMgr, fUseAutoHandler));
- return;
- }
-
- switch (fInputType[inputIndex])
- {
- case kAOD:
- fRsnAODEH[0] = new AliAODInputHandler();
- if (fRsnAODEH[0]) fAnalysisMgr->SetInputEventHandler(fRsnAODEH[0]);
- break;
- case kESD:
- case kESDTPC:
- fRsnESDEH[0] = new AliESDInputHandler();
- if (fRsnESDEH[0]) fAnalysisMgr->SetInputEventHandler(fRsnESDEH[0]);
- break;
- case kESDMC:
- case kESDMCTPC:
- case kMC:
- fRsnESDEH[0] = new AliESDInputHandler();
- fRsnMCEH[0] = new AliMCEventHandler();
- if ((fRsnESDEH[0]) && (fRsnMCEH[0]))
- {
- fAnalysisMgr->SetInputEventHandler(fRsnESDEH[0]);
- fAnalysisMgr->SetMCtruthEventHandler(fRsnMCEH[0]);
- }
- break;
- case kRSN:
- break;
- default:
- AliError("Type not supported ...");
- break;
- }
-
- // check if the TPC only is used
- if (fInputType[inputIndex] == kESDTPC || fInputType[inputIndex] == kESDMCTPC) fReader.SetTPCOnly();
-}
-
-//_____________________________________________________________________________
-void AliRsnAnalysisTaskSEBase::ConnectInputData(Option_t *)
-{
-//
-// ConnectInputData() for AliAnalysisTaskSE
-// just define myTask->SetInputType ( AliRsnAnalysisTaskSEBase::kRSN ); for Rsn input
-// just define myTask->SetInputType ( AliRsnAnalysisTaskSEBase::kESDMC ); for ESD and MC input
-// just define myTask->SetInputType ( AliRsnAnalysisTaskSEBase::kAOD ); for Rsn input
-//
-
- if (fInputType[0] != kRSN) AliAnalysisTaskSE::ConnectInputData();
-
- // connects input handlers according to the type of analysis being done
- ConnectInputDataByInputType(fInputType[0], 0);
-}
-
-//_____________________________________________________________________________
-void AliRsnAnalysisTaskSEBase::ConnectInputDataByInputType
-(EInputType type, Short_t inputIndex)
-{
-//
-// Connect input data dependint on the input type used.
-//
- AliDebug(AliLog::kDebug, "<-");
-
- switch (type)
- {
- case kAOD:
- ConnectAOD(inputIndex);
- break;
- case kESD:
- case kESDTPC:
- ConnectESD(inputIndex);
- break;
- case kESDMC:
- case kESDMCTPC:
- case kMC:
- ConnectESDMC(inputIndex);
- break;
- case kRSN:
- ConnectRSN(inputIndex);
- break;
- default:
- AliError("Type not supported ...");
- break;
- }
-
- AliDebug(AliLog::kDebug, "->");
-}
-//_____________________________________________________________________________
-void AliRsnAnalysisTaskSEBase::ConnectRSN(Short_t inputIndex)
-{
-//
-// Connect input data by RSN input type
-//
-
- AliDebug(AliLog::kDebug, "<-");
-
- char ** address = (char **) GetBranchAddress(inputIndex, "rsnEvents");
- if (address)
- {
- fRSN[inputIndex] = (AliRsnEvent*)(*address);
- }
- else
- {
- fRSN[inputIndex] = 0;
- SetBranchAddress(inputIndex, "rsnEvents", &fRSN[inputIndex]);
- }
-
- AliDebug(AliLog::kDebug, "->");
-}
-
-//_____________________________________________________________________________
-void AliRsnAnalysisTaskSEBase::ConnectESD(Short_t inputIndex)
-{
-//
-// Connect input data by ESD input type
-//
-
- AliDebug(AliLog::kDebug, "<-");
- fRsnESD[inputIndex] = (AliESDEvent*)fInputEvent;
- AliDebug(AliLog::kDebug, "->");
-
-}
-
-//_____________________________________________________________________________
-void AliRsnAnalysisTaskSEBase::ConnectESDMC(Short_t inputIndex)
-{
-//
-// Connect input data by ESDMC input type
-//
-
- AliDebug(AliLog::kDebug, "<-");
- fRsnESD[inputIndex] = (AliESDEvent*)fInputEvent;
- //fRSNMC[inputIndex] = fMCEvent;
- AliDebug(AliLog::kDebug, "->");
-}
-
-//_____________________________________________________________________________
-void AliRsnAnalysisTaskSEBase::ConnectAOD(Short_t inputIndex)
-{
-//
-// Connect input data by AOD input type
-//
-
- AliDebug(AliLog::kDebug, "<-");
-
- TTree* tree = dynamic_cast<TTree*>(GetInputData(inputIndex));
- if (!tree) { AliError("Could not read chain from input slot 0");}
- else
- {
- AliAODInputHandler *aodH = dynamic_cast<AliAODInputHandler*>(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
- if (!aodH) { AliError("Could not get AODInputHandler"); }
- else fRsnAOD[inputIndex] = aodH->GetEvent();
- }
-
- AliDebug(AliLog::kDebug, "->");
-}
-
-//_____________________________________________________________________________
-AliRsnEvent * AliRsnAnalysisTaskSEBase::GetRsnEventFromInputType(const Short_t & index)
-{
-//
-// Gets Event from input type
-//
-
- switch (fInputType[index])
- {
- case kAOD: return GetRsnFromAOD(index);
- case kESD: return GetRsnFromESD(index);
- case kESDMC: return GetRsnFromESDMC(index);
- case kESDTPC: return GetRsnFromESD(index);
- case kESDMCTPC: return GetRsnFromESDMC(index);
- case kMC: return GetRsnFromMC(index);
- case kRSN: return GetRsnFromRSN(index);
- default:
- AliError("Type not supported ...");
- return (AliRsnEvent*) 0x0;
- }
-
- return (AliRsnEvent*) 0x0;
-}
-
-//_____________________________________________________________________________
-AliRsnEvent * AliRsnAnalysisTaskSEBase::GetRsnFromAOD(const Short_t & index)
-{
-//
-// Gets RSN event from AOD
-//
-
- if (!fRsnAOD[index])
- {
- AliError("fRsnAOD not available.");
- return (AliRsnEvent *) 0x0;
- }
-
- if (!fRSN[0])
- {
- fRSN[0] = new AliRsnEvent();
- fRSN[0]->SetName("rsnEvents");
- fRSN[0]->Init();
- }
-
- // clear pevious event
- fRSN[0]->Clear();
- if (!fReader.FillFromAOD(fRSN[0], fRsnAOD[index])) return (AliRsnEvent*) 0x0;
- //if (!fPID.Process(fRSN[0])) AliWarning("Failed PID");
-
- return (AliRsnEvent*) fRSN[0];
-}
-
-//_____________________________________________________________________________
-AliRsnEvent * AliRsnAnalysisTaskSEBase::GetRsnFromESD(const Short_t & index)
-{
-//
-// Gets RSN event from ESD
-//
-
- if (!fRsnESD[index])
- {
- AliError("fRsnESD not available.");
- return (AliRsnEvent *) 0x0;
- }
-
- if (!fRSN[index])
- {
- fRSN[index] = new AliRsnEvent();
- fRSN[index]->SetName("rsnEvents");
- fRSN[index]->Init();
- }
-
- // clear pevious event
- fRSN[index]->Clear();
-
- if (!fReader.FillFromESD(fRSN[index], fRsnESD[index], 0x0)) return (AliRsnEvent*) 0x0;
-
- //if (!fPID.Process(fRSN[index]))
- //{
- // AliWarning("Failed PID");
- // return (AliRsnEvent*) 0x0;
- //}
-
- return fRSN[index];
-}
-
-//_____________________________________________________________________________
-AliRsnEvent * AliRsnAnalysisTaskSEBase::GetRsnFromMC(const Short_t & index)
-{
-//
-// Gets RSN event from ESD
-//
-
- if (!fRsnESD[index])
- {
- AliError("fRsnESD not available.");
- return (AliRsnEvent *) 0x0;
- }
-
- if (!fRSN[index])
- {
- fRSN[index] = new AliRsnEvent();
- fRSN[index]->SetName("rsnEvents");
- fRSN[index]->Init();
- }
-
- // clear pevious event
- fRSN[index]->Clear();
- fRsnMC[index] = MCEvent();
-
- if (!fRsnMC[index]) return (AliRsnEvent *) 0x0;
- if (!fReader.FillFromMC(fRSN[index], fRsnMC[index])) return (AliRsnEvent*) 0x0;
- //fPID.Process(fRSN[index]);
- return fRSN[index];
-}
-
-//_____________________________________________________________________________
-AliRsnEvent * AliRsnAnalysisTaskSEBase::GetRsnFromESDMC(const Short_t & index)
-{
-//
-// Gets RSN event from ESD and MC
-//
-
- if (!fRsnESD[index])
- {
- AliError("fRsnESD not available.");
- return (AliRsnEvent *) 0x0;
- }
-
- if (!fRSN[index])
- {
- fRSN[index] = new AliRsnEvent();
- fRSN[index]->SetName("rsnEvents");
- fRSN[index]->Init();
- }
-
- // clear pevious event
- fRSN[index]->Clear();
- fRsnMC[index] = MCEvent();
-
- if (!fRsnMC[index]) return (AliRsnEvent *) 0x0;
- if (!fReader.FillFromESD(fRSN[index], fRsnESD[index], fRsnMC[index])) return (AliRsnEvent*) 0x0;
- //if (!fPID.Process(fRSN[index]))
- //{
- // AliWarning("Failed PID");
- // return (AliRsnEvent*) 0x0;
- //}
-
- return fRSN[index];
-}
-
-//_____________________________________________________________________________
-AliRsnEvent * AliRsnAnalysisTaskSEBase::GetRsnFromRSN(const Short_t & index)
-{
-//
-// Gets RSN event from RSN
-// not fully implemented yet
-//
- AliRsnEvent *event = fRSN[index];
- return event;
-}
+++ /dev/null
-//
-// Class AliRsnComparisonAT
-//
-// TODO
-//
-// authors: Martin Vala (martin.vala@cern.ch)
-// Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it)
-//
-#include "TChain.h"
-#include "TTree.h"
-#include "TH1F.h"
-#include "TFolder.h"
-#include "TCanvas.h"
-#include "TClonesArray.h"
-
-#include "AliLog.h"
-
-#include "AliESDtrack.h"
-#include "AliMCEvent.h"
-
-#include "AliRsnMCInfo.h"
-#include "AliRsnComparisonObj.h"
-#include "AliRsnComparisonAT.h"
-
-ClassImp(AliRsnComparisonAT)
-
-//________________________________________________________________________
-AliRsnComparisonAT::AliRsnComparisonAT(const char*name)
- : AliRsnAnalysisTaskBase(name),fOutList(0x0),fMyInputNum(1),fMyPIDInputNum(0)
-{
-//=========================================================
-// Default constructor
-//=========================================================
-
- InitIOVars();
-
- DefineOutput(0, TList::Class());
-}
-
-//________________________________________________________________________
-void AliRsnComparisonAT::InitIOVars()
-{
-//=========================================================
-// Sets default values for input and output
-//=========================================================
- AliDebug(AliLog::kDebug, "<-");
- AliRsnAnalysisTaskBase::InitIOVars();
- fOutList = 0;
- AliDebug(AliLog::kDebug, "->");
-}
-
-//________________________________________________________________________
-void AliRsnComparisonAT::LocalInit()
-{
-//=========================================================
-// Local init
-//=========================================================
-}
-
-//________________________________________________________________________
-void AliRsnComparisonAT::CreateOutputObjects()
-{
-//=========================================================
-// CreateOutputObjects()
-//=========================================================
- AliDebug(AliLog::kDebug, "<-");
-
-// AliRsnDaughter::SetPIDMethod ( AliRsnDaughter::kRealistic );
-// fReader = dynamic_cast<AliRsnReader*> ( GetInputData ( 1 ) );
-// fPID = dynamic_cast<AliRsnPID*> ( GetInputData ( 2 ) );
-
-
- OpenFile(0);
- fOutList = new TList();
- AliRsnComparisonObj* obj;
-
- TList *listMainParticle,*listMainPID,*listPID,*listParticle,*listTmp;
-
- listMainParticle = new TList();
- listMainParticle->SetName("MCParticles");
- for (Int_t i=0;i<fMyInput[0].GetEntries();i++)
- {
- obj = (AliRsnComparisonObj*) fMyInput[0].At(i);
- if (!obj) continue;
- listParticle = obj->GenerateParticleInfoHistogramList("");
- if (!listParticle)
- {
- AliError(Form("List not crated for i=%d",i));
- continue;
- }
-
- listMainParticle->Add(listParticle);
- }
- fOutList->Add(listMainParticle);
- if (fMyPIDInputNum>0)
- {
- listMainPID = new TList();
- listMainPID->SetName("PID");
- for (Int_t j=0;j<fMyPIDInputNum;j++)
- {
- listPID = new TList();
- listPID->SetName(fMyPIDInput[j].GetName());
- for (Int_t i=0;i<fMyPIDInput[j].GetEntries();i++)
- {
- obj = (AliRsnComparisonObj*) fMyPIDInput[j].At(i);
- if (!obj) continue;
- listTmp = obj->GeneratePIDHistogramList(fMyPIDInput[j].GetName());
- if (!listTmp)
- {
- AliError(Form("List not crated for i=%d",i));
- continue;
- }
- listPID->Add(listTmp);
-
- }
- listMainPID->Add(listPID);
- }
- fOutList->Add(listMainPID);
-// listMainPID->Print();
- }
- AliDebug(AliLog::kDebug, "->");
-}
-
-//________________________________________________________________________
-void AliRsnComparisonAT::Exec(Option_t *)
-{
-//=========================================================
-// Exec()
-//=========================================================
-
- if (fInputType[0]==kESDMC)
- {
- fRSN[0] = GetRsnEventFromInputType(0);
- LoopOverESDtracks();
- LoopOverMCtracks();
- }
-
-
- if (!fRSN[0]) return;
- LoopOverRSNDaughters();
-
- if (fInputType[0]==kESDMC)
- {
- delete fRSN[0];
- fRSN[0] = 0;
- }
-
-// fNumEventsProcessed++;
- PostData(0, fOutList);
-}
-
-//________________________________________________________________________
-void AliRsnComparisonAT::Terminate(Option_t *)
-{
-//=========================================================
-// Terminate()
-//=========================================================
- AliDebug(AliLog::kDebug, "<-");
- fOutList = dynamic_cast<TList*>(GetOutputData(0));
- if (!fOutList)
- {
- AliError(" fOutList not available");
- return;
- }
-
- AliDebug(AliLog::kDebug, "->");
-}
-
-//________________________________________________________________________
-void AliRsnComparisonAT::LoopOverESDtracks()
-{
-//=========================================================
-// Loop over all ESD tracks
-//=========================================================
- if (!fESD[0]) return;
-// AliInfo(Form("%d",fESD[0]->GetNumberOfTracks()));
- AliRsnComparisonObj* input=0;
- for (Int_t i=0;i< fESD[0]->GetNumberOfTracks(); i++)
- {
- AliESDtrack *esdtrack = fESD[0]->GetTrack(i);
- for (Int_t j=0;j<fMyInputNum;j++)
- {
- for (Int_t k=0;i<fMyInput[j].GetEntries();k++)
- {
- input = (AliRsnComparisonObj*) fMyInput[j].At(k);
-// input->FillPIDHistograms(esdtrack, fMC[0]);
- }
- }
- for (Int_t j=0;j<fMyPIDInputNum;j++)
- {
- for (Int_t k=0;i<fMyPIDInput[j].GetEntries();k++)
- {
- input = (AliRsnComparisonObj*) fMyPIDInput[j].At(k);
- input->FillPIDHistograms(esdtrack, fMC[0]);
- }
- }
- }
-}
-
-//________________________________________________________________________
-void AliRsnComparisonAT::LoopOverMCtracks()
-{
-//=========================================================
-// Loop over all MC tracks
-//=========================================================
-
- if (!fMC[0]) return;
-
- AliRsnComparisonObj* input=0;
- AliMCParticle *mctrack;
- for (Int_t i=0;i<fMC[0]->GetNumberOfTracks(); i++)
- {
- mctrack = fMC[0]->GetTrack(i);
- if (!mctrack) {AliInfo("mctrack == null");continue;}
- for (Int_t j=0;j<fMyInputNum;j++)
- {
- for (Int_t k=0;k<fMyInput[j].GetEntries();k++)
- {
- input = (AliRsnComparisonObj*) fMyInput[j].At(k);
- input->FillHistograms(mctrack);
- }
- }
- for (Int_t j=0;j<fMyPIDInputNum;j++)
- {
- for (Int_t k=0;k<fMyPIDInput[j].GetEntries();k++)
- {
- input = (AliRsnComparisonObj*) fMyPIDInput[j].At(k);
- input->FillPIDHistograms(mctrack);
- }
- }
- }
-}
-
-//________________________________________________________________________
-void AliRsnComparisonAT::LoopOverRSNDaughters()
-{
-//=========================================================
-// Loop over all rsn daughters
-//=========================================================
-
- TClonesArray *tracks = (TClonesArray*) fRSN[0]->GetTracks();
- AliRsnDaughter *daughter=0;
- AliRsnComparisonObj* input=0;
- for (Int_t i=0;i< tracks->GetEntriesFast(); i++)
- {
- daughter = (AliRsnDaughter*) tracks->At(i);
- for (Int_t j=0;j<fMyInputNum;j++)
- {
- for (Int_t k=0;k<fMyInput[j].GetEntries();k++)
- {
- input = (AliRsnComparisonObj*) fMyInput[j].At(k);
-// input->FillPIDHistograms(daughter);
- }
- }
- for (Int_t j=0;j<fMyPIDInputNum;j++)
- {
- for (Int_t k=0;k<fMyPIDInput[j].GetEntries();k++)
- {
- input = (AliRsnComparisonObj*) fMyPIDInput[j].At(k);
- input->FillPIDHistograms(daughter);
- }
- }
- }
-}
-
-//________________________________________________________________________
-void AliRsnComparisonAT::PrintStat()
-{
-//=========================================================
-// Print stat
-//=========================================================
- AliDebug(AliLog::kDebug, "<-");
-
- AliDebug(AliLog::kDebug, "->");
-}
-
-void AliRsnComparisonAT::AddMyInput(AliRsnComparisonObj * obj, const Int_t & index)
-{
-// if ( ( index<0 ) || ( index>kMyInputNum ) ) return;
-
- fMyInput[index].Add(obj);
-// AliInfo(Form("%d %s",fMyInput[index].GetEntries(),fMyInput[index].GetName()));
-}
-
-void AliRsnComparisonAT::AddMyPIDInput(AliRsnComparisonObj * obj, const Int_t & index)
-{
-// if ( ( index<0 ) || ( index>kMyInputNum ) ) return;
-
- fMyPIDInput[index].Add(obj);
-// AliInfo(Form("%d %s",fMyInput[index].GetEntries(),fMyInput[index].GetName()));
-}
-
-void AliRsnComparisonAT::SetMyPIDInputName(TString name, const Int_t & index)
-{
- fMyPIDInput[index].SetName(name.Data());
-}
-
+++ /dev/null
-//
-// *** Class AliRsnComparisonObj ***
-//
-// TODO
-//
-// authors: A. Pulvirenti (email: alberto.pulvirenti@ct.infn.it)
-// M. Vala (email: martin.vala@cern.ch)
-//
-
-#include "AliLog.h"
-
-#include "AliRsnDaughter.h"
-#include "AliRsnMCInfo.h"
-
-#include "AliRsnComparisonObj.h"
-
-ClassImp(AliRsnComparisonObj)
-
-//_____________________________________________________________________________
-AliRsnComparisonObj::AliRsnComparisonObj(const char *name)
- : TNamed(name,name),fCurrentComparisonType(kParticleInfo),fCurrentESDPID(kEsd),
- fESDstatus(0),fITSClusters(0),fTPCClusters(0),fTRDClusters(0),fPIDDivValue(0.)
-{
-//=========================================================
-// Default constructor
-//=========================================================
- TH1::SetDefaultSumw2();
-
- for (Int_t i=0;i<kLastFormat;i++)
- for (Int_t j=0;j<kLastHistoType;j++)
- for (Int_t k=0;k<AliRsnPID::kSpecies+1;k++)
- fHistosPID[i][j][k] = 0;
-
- for (Int_t i=0;i<kLastParameterType;i++)
- for (Int_t j=0;j<2;j++)
- for (Int_t k=0;k<AliRsnPID::kSpeciesAll;k++)
- fHistosPartInfo[i][j][k] = 0;
-
- fPriorProbs[0]=0.02;
- fPriorProbs[1]=0.02;
- fPriorProbs[2]=0.83;
- fPriorProbs[3]=0.07;
- fPriorProbs[4]=0.06;
- fITSClusters = -1;
- fTPCClusters = -1;
- fTRDClusters = -1;
- fPIDDivValue = 0.0;
-
-}
-//_____________________________________________________________________________
-AliRsnComparisonObj::~AliRsnComparisonObj()
-{
-//=========================================================
-// Destructor
-//=========================================================
-}
-
-//________________________________________________________________________
-TList * AliRsnComparisonObj::GeneratePIDHistogramList(TString prefix)
-{
-//=========================================================
-// Generate histograms
-//=========================================================
-
- TList *list = new TList();
- list->SetName(GetName());
-
- TString varname("p");
- for (Int_t i=0;i<kLastFormat;i++)
- for (Int_t j=0;j<kLastHistoType;j++)
- for (Int_t k=0;k<AliRsnPID::kSpecies+1;k++)
- {
- if ((i == kMC) && (j>kIndent)) continue;
-
- fHistosPID[i][j][k]= new TH1D(Form("%s_%s_%s_%s_%s_%s",prefix.Data(),GetName(),varname.Data(),AliRsnPID::ParticleName((AliRsnPID::EType) k),GetFormatName((EFormat) i).Data(),GetHistoTypeName((EHistoType) j).Data()),Form("%s %s %s %s %s",GetName(),varname.Data(),AliRsnPID::ParticleNameLatex((AliRsnPID::EType) k),GetFormatName((EFormat) i).Data(),GetHistoTypeName((EHistoType) j).Data()),1000,0,5);
- list->Add(fHistosPID[i][j][k]);
- }
-
- return list;
-}
-
-TList * AliRsnComparisonObj::GenerateParticleInfoHistogramList(TString prefix)
-{
- TList *list = new TList();
- list->SetName(GetName());
- TString charge;
- if (!prefix.IsNull())
- prefix+="_";
-
- Int_t bins[] = {1000,1000,1000,1000};
- Double_t min[] = {0.0,0.0,-10.0,-10.0};
- Double_t max[] = {5.0,5.0,10.0,10.0};
-
- for (Int_t i=0;i<kLastParameterType;i++)
- for (Int_t j=0;j<2;j++)
- for (Int_t k=0;k<AliRsnPID::kSpeciesAll;k++)
- {
-// if (k == AliRsnPID::kUnknown) continue;
-// if ((j>0) && (k>AliRsnPID::kSpecies-1)) continue;
- charge = (j>0) ? "-":"+";
- AliInfo(Form("%s%s %d%d",AliRsnPID::ParticleName((AliRsnPID::EType) k),charge.Data(),j,k));
-// if (k>AliRsnPID::kSpecies-1) charge="";
- fHistosPartInfo[i][j][k]= new TH1D(Form("%s%s%s_%s",prefix.Data(),AliRsnPID::ParticleName((AliRsnPID::EType) k),charge.Data(),GetParameterName((EParameterType) i).Data()),Form("%s%s %s",AliRsnPID::ParticleNameLatex((AliRsnPID::EType) k),charge.Data(),GetParameterName((EParameterType) i).Data()),bins[i],min[i],max[i]);
- list->Add(fHistosPartInfo[i][j][k]);
- }
- return list;
-}
-
-//________________________________________________________________________
-void AliRsnComparisonObj::FillPIDHistograms(AliRsnDaughter * daughter)
-{
-//=========================================================
-// Fill Histograms with AliRsnDaughter info
-//=========================================================
-
- if (!(daughter->CheckFlag(fESDstatus))) return;
-
- daughter->AssignRealisticPID();
-
- Double_t prob;
- Double_t p = daughter->P();
- Int_t indexType = (Int_t) daughter->PIDType(prob);
- Int_t pdg = daughter->GetMCInfo()->PDG();
- Int_t indexTypeFromPDG = (Int_t) AliRsnPID::InternalType(pdg);
-
- fHistosPID[kRSN][kIndent][indexType]->Fill(p);
- fHistosPID[kRSN][kTrue][indexTypeFromPDG]->Fill(p);
-
- if (indexType == indexTypeFromPDG)
- fHistosPID[kRSN][kGood][indexType]->Fill(p);
- else
- fHistosPID[kRSN][kFake][indexType]->Fill(p);
-}
-
-//________________________________________________________________________
-void AliRsnComparisonObj::FillPIDHistograms(AliESDtrack * track,AliMCEvent *mc)
-{
-//=========================================================
-// Fill Histograms with AliRsnDaughter info
-//=========================================================
-
- if (fITSClusters>0)
- if (track->GetITSclusters(0) < fITSClusters) return;
-
- if (fTPCClusters>0)
- if (track->GetTPCclusters(0) < fTPCClusters) return;
-
- if (fTRDClusters>0)
- if (track->GetTRDclusters(0) < fTRDClusters) return;
-
- ULong_t status = track->GetStatus();
- if (!((fESDstatus & status) == fESDstatus)) return;
-
- Int_t label = track->GetLabel();
- AliMCParticle *mctrack = mc->GetTrack(TMath::Abs(label));
-
- Double_t p = track->P();
- Int_t pdg =0;
- Int_t indexTypeFromPDG = AliRsnPID::kUnknown;
- if (mctrack)
- {
- pdg = mctrack->Particle()->GetPdgCode();
- indexTypeFromPDG = (Int_t) AliRsnPID::InternalType(pdg);
- }
- Double_t pid[5];
- GetESDPID(track,pid,p);
-
-
- if (fCurrentESDPID == kITS_TPC_TOF_SP)
- if (p>0.7)
- if (!track->IsOn(AliESDtrack::kTOFpid)) return;
-
- Int_t i;
- Double_t sum = 0.0, prob[AliRsnPID::kSpecies];
- for (i = 0; i < AliRsnPID::kSpecies; i++)
- {
- prob[i] = fPriorProbs[i] * pid[i];
- sum += prob[i];
- }
-
- if (sum <= (Double_t) 0.0)
- {
- AliError(Form("Sum of weights = %f <= 0", sum));
- return;
- }
-
-
- // normalize
- for (i = 0; i < AliRsnPID::kSpecies; i++)
- {
- prob[i] /= sum;
- }
-
- Int_t indexType = 0;
- Double_t pmax = prob[0];
- for (i = 1; i < AliRsnPID::kSpecies; i++)
- {
- if (prob[i] > pmax)
- {
- indexType = i;
- pmax = prob[i];
- }
- }
-
- fHistosPID[kESD][kIndent][indexType]->Fill(p);
- fHistosPID[kESD][kTrue][indexTypeFromPDG]->Fill(p);
-
- if (indexType == indexTypeFromPDG)
- fHistosPID[kESD][kGood][indexType]->Fill(p);
- else
- fHistosPID[kESD][kFake][indexType]->Fill(p);
-
-}
-
-//________________________________________________________________________
-void AliRsnComparisonObj::FillPIDHistograms(AliMCParticle * mctrack)
-{
-//=========================================================
-// Fill Histograms with mctrack info
-//=========================================================
-
- if (!mctrack) { AliError("mctrack is null"); return;}
-
- Double_t p = mctrack->P();
- Int_t pdg = mctrack->Particle()->GetPdgCode();
- Int_t indexTypeFromPDG = (Int_t) AliRsnPID::InternalType(pdg);
- if (indexTypeFromPDG < AliRsnPID::kSpecies)
- fHistosPID[kMC][kIndent][indexTypeFromPDG]->Fill(p);
-}
-
-void AliRsnComparisonObj::FillHistograms(AliMCParticle * mctrack)
-{
- Int_t charge;
- if (!mctrack) { AliError("mctrack is null"); return;}
-
- Int_t pdg = mctrack->Particle()->GetPdgCode();
-// if (pdg>0) charge=0;
- charge = (pdg>0) ? 0 : 1;
-// if (TMath::Abs(pdg) == 333 ) AliInfo(Form("%d",charge));
- if (pdg == 11) charge = 1;
- if (pdg == -11) charge = 0;
-
- Int_t indexTypeFromPDG = (Int_t) AliRsnPID::InternalType(pdg);
- for (Int_t i=0;i<kLastParameterType;i++)
- fHistosPartInfo[i][charge][indexTypeFromPDG]->Fill(GetParameterNameValue((EParameterType)i,mctrack));
-}
-
-//________________________________________________________________________
-TString AliRsnComparisonObj::GetFormatName(EFormat type)
-{
-//=========================================================
-// returns Format Name
-//=========================================================
- switch (type)
- {
- case kRSN :
- return "RSN";
- break;
- case kESD :
- return "ESD";
- break;
- case kMC :
- return "MC";
- break;
- default:
- AliWarning("Unrecognized value of EOutputType argument");
- break;
- }
- return "";
-}
-
-//________________________________________________________________________
-TString AliRsnComparisonObj::GetHistoTypeName(EHistoType type)
-{
-//=========================================================
-// returns Histo Type Name
-//=========================================================
- switch (type)
- {
- case kIndent :
- return "Ident";
- case kGood :
- return "Good";
- case kFake :
- return "Fake";
- case kTrue :
- return "True";
- default:
- AliWarning("Unrecognized value of EHistoType argument");
- break;
- }
- return "XXX";
-}
-
-void AliRsnComparisonObj::GetESDPID(AliESDtrack *track,Double_t *pid,Double_t p)
-{
- Double_t ctmp[AliRsnPID::kSpecies];
- switch (fCurrentESDPID)
- {
- case kEsd :
- track->GetESDpid(pid);
- break;
- case kITS :
- track->GetITSpid(pid);
- break;
- case kTPC :
- track->GetTPCpid(pid);
- break;
- case kTOF :
- track->GetTOFpid(pid);
- break;
- case kITS_TPC :
- track->GetITSpid(pid);
- track->GetTPCpid(ctmp);
- for (Int_t i=0;i<5;i++) pid[i]*=ctmp[i];
- break;
- case kITS_TOF :
- track->GetITSpid(pid);
- track->GetTOFpid(ctmp);
- for (Int_t i=0;i<AliRsnPID::kSpecies;i++) pid[i]*=ctmp[i];
- break;
- case kTPC_TOF :
- track->GetTPCpid(pid);
- track->GetTOFpid(ctmp);
- for (Int_t i=0;i<AliRsnPID::kSpecies;i++) pid[i]*=ctmp[i];
- break;
- case kITS_TPC_TOF :
- track->GetITSpid(pid);
- track->GetTPCpid(ctmp);
- for (Int_t i=0;i<AliRsnPID::kSpecies;i++) pid[i]*=ctmp[i];
- track->GetTOFpid(ctmp);
- for (Int_t i=0;i<AliRsnPID::kSpecies;i++) pid[i]*=ctmp[i];
- break;
- case kITS_TPC_TOF_SP :
-
- if (p<fPIDDivValue)
- {
- track->GetITSpid(pid);
- track->GetTPCpid(ctmp);
- for (Int_t i=0;i<AliRsnPID::kSpecies;i++) pid[i]*=ctmp[i];
- }
- else
- {
- track->GetTOFpid(pid);
- }
- break;
- default:
- AliWarning("Unrecognized value of EPIDType argument");
- for (Int_t i=0;i<AliRsnPID::kSpecies;i++) pid[i]=1.0;
- break;
- }
-}
-
-void AliRsnComparisonObj::SetESDTrackQualityCuts(const Int_t & its, const Int_t & tpc, const Int_t & trd)
-{
- fITSClusters = its;
- fTPCClusters = tpc;
- fTRDClusters = trd;
-}
-
-void AliRsnComparisonObj::SetESDstatus(const ULong_t status)
-{
- fESDstatus = status;
-}
-
-void AliRsnComparisonObj::SetCurrentESDPID(const EPIDType & type, const Double_t & divValue)
-{
- fCurrentESDPID = type;
- fPIDDivValue = divValue;
-}
-
-TString AliRsnComparisonObj::GetParameterName(EParameterType type)
-{
- switch (type)
- {
- case kP :
- return "p";
- case kPt :
- return "pt";
- case kEta :
- return "eta";
- case kY :
- return "y";
- default:
- break;
- }
- return "?";
-}
-
-Double_t AliRsnComparisonObj::GetParameterNameValue(EParameterType type,AliMCParticle * mctrack)
-{
- switch (type)
- {
- case kP :
- return mctrack->P();
- case kPt :
- return mctrack->Pt();
- case kEta :
- return mctrack->Eta();
- case kY :
- return mctrack->Y();
- default:
- break;
- }
- return -10000.0;
-}
-
}
//_________________________________________________________________________________________________
-Bool_t AliRsnCut::IsSelected(ETarget tgt, AliRsnDaughter *track)
+Bool_t AliRsnCut::IsSelected(ETarget /*tgt*/, AliRsnDaughter* /*track*/)
{
//
// Virtual cut-checking method.
}
//_________________________________________________________________________________________________
-Bool_t AliRsnCut::IsSelected(ETarget tgt, AliRsnPairParticle *pair)
+Bool_t AliRsnCut::IsSelected(ETarget /*tgt*/, AliRsnPairParticle* /*pair*/)
{
//
// Virtual cut-checking method.
}
//_________________________________________________________________________________________________
-Bool_t AliRsnCut::IsSelected(ETarget tgt, AliRsnEvent *event)
+Bool_t AliRsnCut::IsSelected(ETarget /*tgt*/, AliRsnEvent* /*event*/)
{
//
// Virtual cut-checking method.
}
//_________________________________________________________________________________________________
-Bool_t AliRsnCut::IsSelected(ETarget tgt, AliRsnEvent *ev1, AliRsnEvent *ev2)
+Bool_t AliRsnCut::IsSelected(ETarget /*tgt*/, AliRsnEvent* /*ev1*/, AliRsnEvent* /*ev2*/)
{
//
// Virtual cut-checking method.
}
//_________________________________________________________________________________________________
-Bool_t AliRsnCutBetheBloch::IsSelected(ETarget tgt, AliRsnPairParticle *pair)
+Bool_t AliRsnCutBetheBloch::IsSelected(ETarget /*tgt*/, AliRsnPairParticle* /*pair*/)
{
//
// Cut checker
}
//_________________________________________________________________________________________________
-Bool_t AliRsnCutBetheBloch::IsSelected(ETarget tgt, AliRsnEvent *event)
+Bool_t AliRsnCutBetheBloch::IsSelected(ETarget /*tgt*/, AliRsnEvent* /*event*/)
{
//
// Cut checker
}
//_________________________________________________________________________________________________
-Bool_t AliRsnCutBetheBloch::IsSelected(ETarget tgt, AliRsnEvent *ev1, AliRsnEvent *ev2)
+Bool_t AliRsnCutBetheBloch::IsSelected(ETarget /*tgt*/, AliRsnEvent* /*ev1*/, AliRsnEvent* /*ev2*/)
{
//
// Cut checker
fParticle(refMC),
fMotherPDG(0),
fStatus(0),
+ fDr(0.0),
+ fDz(0.0),
fRef(ref)
{
//
fParticle(copy.fParticle),
fMotherPDG(copy.fMotherPDG),
fStatus(copy.fStatus),
+ fDr(copy.fDr),
+ fDz(copy.fDz),
fRef(copy.fRef)
{
//
fParticle = copy.fParticle;
fMotherPDG = copy.fMotherPDG;
fStatus = copy.fStatus;
+ fDr = copy.fDr;
+ fDz = copy.fDz;
fRef = copy.fRef;
}
//_____________________________________________________________________________
-AliESDtrack* AliRsnDaughter::GetRefESD()
+AliESDtrack* AliRsnDaughter::GetRefESD()
{
//
// Return a reference in format of ESD track
Int_t i, ik[3];
for (i = 0; i < 3; i++) ik[i] = esdTrack->GetKinkIndex(i);
-
+
if (ik[0] < 0 || ik[1] < 0 || ik[2] < 0) {
SetKinkMother();
}
// - F --> flags
// - I --> identification (PID, probability and mass)
// - W --> PID weights
-// - M --> Montecarlo (from AliRsnMCInfo)
+// - M --> Montecarlo
// - L --> index & label
// - A --> angles
// - ALL --> All oprions switched on
+++ /dev/null
-/**************************************************************************
- * 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. *
- **************************************************************************/
-
-//
-// Class AliRsnEventBuffer
-//
-// Implements a temporary buffer of many AliRsnEvent objects
-// which is useful for event mixing.
-//
-// author: Martin Vala (Martin.Vala@cern.ch)
-// revised by: A. Pulvirenti (alberto.pulvirenti@ct.infn.it)
-//
-
-#include "AliLog.h"
-
-#include "AliRsnCut.h"
-#include "AliRsnCutSet.h"
-#include "AliRsnEventBuffer.h"
-
-ClassImp(AliRsnEventBuffer)
-
-//_____________________________________________________________________________
-AliRsnEventBuffer::AliRsnEventBuffer(Int_t buffSize, Bool_t deleteBufferWhenReset) :
- fDeleteBufferWhenReset(deleteBufferWhenReset),
- fEventsBufferSize(buffSize),
- fEventsBufferIndex(-1)
-{
-//
-// Constructor.
-// Initializes to NULL all AliRsnEvent pointers.
-//
-
- Int_t i;
- for (i = 0; i < fEventsBufferSize; i++) fEventsBuffer[i] = 0;
-}
-
-//_____________________________________________________________________________
-AliRsnEventBuffer::~AliRsnEventBuffer()
-{
-//
-// Destructor.
-// Actually does nothing.
-//
-
- //ClearBuffer();
-}
-
-//_____________________________________________________________________________
-void AliRsnEventBuffer::ClearBuffer()
-{
-//
-// Clears buffer, resetting all pointers.
-// If an event is on the HEAP, it is deleted.
-//
- Int_t i;
- for (i = 0; i < fEventsBufferSize; i++)
- {
- AliDebug(1, Form("Clearing slot #%p in buffer", fEventsBuffer[i]));
- if (fEventsBuffer[i]->IsOnHeap()) delete fEventsBuffer[i];
- fEventsBuffer[i] = 0;
- }
-}
-
-//_____________________________________________________________________________
-void AliRsnEventBuffer::ResetIndex()
-{
-//
-// Resets the index for accessing events in buffer
-//
- fEventsBufferIndex = -1;
- if (fDeleteBufferWhenReset == kTRUE) ClearBuffer();
-}
-
-//_____________________________________________________________________________
-void AliRsnEventBuffer::AddEvent(AliRsnEvent * event)
-{
-//
-// Insert a new event in the buffer.
-// Since the buffer has a fixed size, when the last index is reached,
-// the new event replaces the oldest one in the buffer
-//
-
- if (fEventsBufferIndex >= fEventsBufferSize - 1) ResetIndex();
- fEventsBufferIndex++;
- if (fEventsBuffer[fEventsBufferIndex]) {
- //AliInfo("Replacing event");
- *fEventsBuffer[fEventsBufferIndex] = *event;
- }
- else {
- //AliInfo("New event");
- fEventsBuffer[fEventsBufferIndex] = new AliRsnEvent(*event);
- }
-}
-
-//_____________________________________________________________________________
-Int_t AliRsnEventBuffer::IndexOf(AliRsnEvent * event)
-{
-//
-// Return position of the event
-//
-
- Int_t i;
- for (i = 0; i < fEventsBufferSize; i++) {
- if (event == fEventsBuffer[i]) return i;
- }
-
- return -1;
-}
-
-//_____________________________________________________________________________
-AliRsnEvent* AliRsnEventBuffer::GetCurrentEvent()
-{
-//
-// Returns the current event in the buffer
-//
- return GetEvent(fEventsBufferIndex);
-}
-
-//_____________________________________________________________________________
-AliRsnEvent * AliRsnEventBuffer::GetNextEvent()
-{
-//
-// Returns next event in the buffer w.r. to current
-//
- if (fEventsBufferIndex == fEventsBufferSize - 1) return GetEvent(0);
- else return GetEvent(fEventsBufferIndex + 1);
-}
-
-//_____________________________________________________________________________
-AliRsnEvent * AliRsnEventBuffer::GetNextGoodEvent
-(Int_t &start, AliRsnCutSet *cuts)
-{
-//
-// Scans the buffer starting from 'start' in order to
-// find another event which satisfies the cuts defined in 'cuts'.
-// If it finds such an event, returns it and upgrades the 'start' value
-// to its position, otherwise returns NULL.
-//
-
- Int_t i = start;
- AliRsnEvent *ref = GetCurrentEvent();
- AliRsnEvent *ev = 0x0;
- for(;;i--) {
- ev = GetEvent(i);
- if (ev == ref) continue;
- if (!ev) break;
- if (!cuts) {
- start = i;
- return ev;
- }
- else if (cuts->IsSelected(AliRsnCut::kMixEvent, ref, ev)) {
- start = i;
- return ev;
- }
- }
-
- return 0x0;
-}
-
-//_____________________________________________________________________________
-AliRsnEvent * AliRsnEventBuffer::GetEvent(Int_t index)
-{
-//
-// Returns an event in the buffer, provided its index
-//
- if (index < 0 || index >= fEventsBufferSize)
- {
- AliDebug(AliLog::kError,Form("Index out of range (index = %d , size = %d)", index, fEventsBufferSize));
- return 0x0;
- }
- return (AliRsnEvent*)fEventsBuffer[index];
-}
-
-//_____________________________________________________________________________
-Int_t AliRsnEventBuffer::NEmptySlots()
-{
-//
-// Tells if the buffer is completely filled or has empty slots
-//
- Int_t i, counter = 0;
- for (i = 0; i < fEventsBufferSize; i++)
- {
- if (!fEventsBuffer[i]) counter++;
- }
-
- return counter;
-}
+++ /dev/null
-//
-// Class AliRsnEventFunction
-//
-// This class defines a base classe to implement a function
-// which uses the internal RSN package event format (AliRsnEvent).
-// It contains some default flags which turn out to be useful:
-// - a flag to select only the "true" pairs (tracks from same resonance)
-// - a flag to know if the computation is done over two events (mixing)
-//
-// Any kind of analysis object should be implemented as inheriting from this
-// because the AliRsnAnalyzer which executes the analysis will accept a collection
-// of such objects, in order to have a unique format of processing method
-//
-// The user who implements a kind of computation type should inherit from
-// this class and override the virtual functions defined in it, which
-// initialize the final output histogram and define how to process data.
-//
-//
-// author: A. Pulvirenti (email: alberto.pulvirenti@ct.infn.it)
-//
-
-#include <Riostream.h>
-
-#include <TH1.h>
-#include <TList.h>
-#include <TString.h>
-
-#include "AliLog.h"
-
-#include "AliRsnMCInfo.h"
-#include "AliRsnDaughter.h"
-#include "AliRsnEvent.h"
-#include "AliRsnPairDef.h"
-#include "AliRsnCut.h"
-#include "AliRsnCutSet.h"
-
-#include "AliRsnEventFunction.h"
-
-ClassImp(AliRsnEventFunction)
-
-//________________________________________________________________________________________
-AliRsnEventFunction::AliRsnEventFunction() :
- fType(kTypes),
- fPIDMethod(AliRsnDaughter::kNoPID),
- fPIDType(AliRsnPID::kUnknown),
- fCharge('0'),
- fLeadPtMin(0.0),
- fAccept(kFALSE),
- fUseBins(kFALSE),
- fBins(0),
- fBinningCut(),
- fBinningCutType(AliRsnCut::kLastCutType),
- fEventCuts(0x0),
- fTrackCuts(0x0),
- fHistoDef(0x0)
-{
- //
- // Constructor.
- // The histogram data member cannot be passed externally,
- // its initialization MUST be defined inside the Init() method,
- // which must be overridden in any derivate implementation.
- //
-
- Int_t i;
- for (i = 0; i < 100; i++)
- {
- fHisto[i] = 0x0;
- }
-}
-
-//________________________________________________________________________________________
-AliRsnEventFunction::AliRsnEventFunction
-(EType type, AliRsnHistoDef *hd, AliRsnDaughter::EPIDMethod pidMethod,
- AliRsnPID::EType pidType, Char_t sign) :
- fType(type),
- fPIDMethod(pidMethod),
- fPIDType(pidType),
- fCharge(sign),
- fLeadPtMin(0.0),
- fAccept(kFALSE),
- fUseBins(kFALSE),
- fBins(0),
- fBinningCut(),
- fBinningCutType(AliRsnCut::kLastCutType),
- fEventCuts(0x0),
- fTrackCuts(0x0),
- fHistoDef(hd)
-{
- //
- // Constructor.
- // The histogram data member cannot be passed externally,
- // its initialization MUST be defined inside the Init() method,
- // which must be overridden in any derivate implementation.
- //
-
- Int_t i;
- for (i = 0; i < 100; i++)
- {
- fHisto[i] = 0x0;
- }
-}
-
-//________________________________________________________________________________________
-AliRsnEventFunction::AliRsnEventFunction(const AliRsnEventFunction ©) :
- TObject(copy),
- fType(copy.fType),
- fPIDMethod(copy.fPIDMethod),
- fPIDType(copy.fPIDType),
- fCharge(copy.fCharge),
- fLeadPtMin(copy.fLeadPtMin),
- fAccept(kFALSE),
- fUseBins(copy.fUseBins),
- fBins(0),
- fBinningCut(),
- fBinningCutType(AliRsnCut::kLastCutType),
- fEventCuts(copy.fEventCuts),
- fTrackCuts(copy.fTrackCuts),
- fHistoDef(copy.fHistoDef)
-{
- //
- // Constructor.
- // The histogram data member cannot be passed externally,
- // its initialization MUST be defined inside the Init() method,
- // which must be overridden in any derivate implementation.
- //
-
- Int_t i, n = 100;
- for (i = 0; i < n; i++)
- {
- fHisto[i] = 0x0;
- }
-
- if (fUseBins)
- {
- n = copy.fBins.GetSize();
- Double_t *array = new Double_t[n];
- for (i = 0; i < n; i++) array[i] = copy.fBins[i];
- SetBinningCut(copy.fBinningCutType, copy.fBins.GetSize(), array);
- delete [] array;
- }
-}
-
-//________________________________________________________________________________________
-void AliRsnEventFunction::Clear(Option_t* /*option*/)
-{
- //
- // Clear arrays and histogram.
- // For the sake of security, all pointers are also set explicitly to NULL.
- //
-
- Int_t i;
- for (i = 0; i < 100; i++)
- {
- delete fHisto[i];
- fHisto[i] = 0x0;
- }
-}
-
-//________________________________________________________________________________________
-void AliRsnEventFunction::Init(TList *histos)
-{
- //
- // Initialization function.
- // By default, it initializes the owned histogram using the method
- // from AliRsnHistoDef class, giving the same name and title of this.
- // A user can override this behaviour, if necessary.
- // Before creating, the HistoDef is checked for proper initialization.
- //
-
- Clear();
-
- Int_t i, ibin, nbins = fHistoDef->GetNBins();
- Double_t min = fHistoDef->GetMin(), max = fHistoDef->GetMax();
-
- // list is created and named after the general
- // settings used for the contained histograms
- if (!histos)
- {
- AliError("NULL target list!");
- return;
- }
-
- // a general histogram is always added,
- // which overrides the binning and collects everything
- fHisto[0] = new TH1D(GetFcnName(), "", nbins, min, max);
- histos->AddLast(fHisto[0]);
-
- // if requested a binning w.r. to some cut variable, histograms are added
- // for that in this part of the method (one per each bin)
- Char_t hName[255];
- if (fUseBins)
- {
- for (ibin = 0, i = 1; ibin < fBins.GetSize() - 1; ibin++, i++)
- {
- sprintf(hName, "%s[%.2f-%.2f]", GetFcnName().Data(), fBins[ibin], fBins[ibin+1]);
- fHisto[i] = new TH1D(hName, "", nbins, min, max);
- histos->AddLast(fHisto[i]);
- }
- }
-}
-
-//________________________________________________________________________________________
-void AliRsnEventFunction::SetBinningCut
-(AliRsnCut::EType type, Double_t min, Double_t max, Double_t step)
-{
- //
- // Set fixed bins
- //
-
- fUseBins = kTRUE;
-
- Int_t i, nBins = (Int_t)((max - min) / step) + 1;
- fBinningCutType = type;
- fBins.Set(nBins);
- for (i = 0; i < nBins; i++)
- {
- fBins[i] = min + (Double_t)i * step;
- }
-}
-
-//________________________________________________________________________________________
-void AliRsnEventFunction::SetBinningCut
-(AliRsnCut::EType type, Int_t nbins, Double_t *bins)
-{
- //
- // Set variable bins
- //
-
- fUseBins = kTRUE;
-
- Int_t i;
- fBinningCutType = type;
- fBins.Set(nbins);
- for (i = 0; i < nbins; i++)
- {
- fBins[i] = bins[i];
- }
-}
-
-//________________________________________________________________________________________
-TString AliRsnEventFunction::GetFcnName()
-{
- //
- // Return a string which names the function type
- //
-
- TString text("Undef");
-
- switch (fType)
- {
- case kMultiplicity:
- text = "MULT";
- break;
- case kLeadingMomentum:
- text = "PLEAD";
- break;
- case kLeadingTheta:
- text = "LEADTHETA";
- break;
- case kAverageMomentum:
- text = "PAVG";
- break;
- case kAngleLeadingMean:
- text = "ANGLEADMEAN";
- break;
- case kAngleLeadingRMS:
- text = "ANGLEADRMS";
- break;
- case kVtResolution:
- text = "VTRES";
- break;
- case kVzResolution:
- text = "VZRES";
- break;
- default:
- AliError("Type not defined");
- }
-
- switch (fPIDMethod)
- {
- case AliRsnDaughter::kNoPID:
- text += "_NOPID_";
- break;
- case AliRsnDaughter::kPerfect:
- text += "_PERFECT_";
- break;
- case AliRsnDaughter::kRealistic:
- text += "_REALISTIC_";
- break;
- default:
- AliError("PID method not defined");
- }
-
- text += AliRsnPID::ParticleName(fPIDType);
- text += fCharge;
-
- if (fEventCuts) {
- text += '_';
- text += fEventCuts->GetName();
- }
- if (fTrackCuts) {
- text += '_';
- text += fTrackCuts->GetName();
- }
-
- return text;
-}
-
-//________________________________________________________________________________________
-Bool_t AliRsnEventFunction::Fill(AliRsnEvent *event)
-{
- //
- // Fillse the histogram with data contained in a defined pair.
- // This method must be overidden by an appropriate definition in each inheriting class.
- //
-
- if (fEventCuts) if (!fEventCuts->IsSelected(AliRsnCut::kEvent, event)) return kFALSE;
-
- // first of all, set all selection definitions, using the ones in this object
- event->SetSelectionPIDType(fPIDType);
- event->SetSelectionCharge(fCharge);
- event->SetSelectionPIDMethod(fPIDMethod);
- event->SetSelectionTrackCuts(fTrackCuts);
-
- Double_t value = FcnValue(event);
- if (!fAccept) return kFALSE;
-
- // fill global histogram
- fHisto[0]->Fill(value);
-
- // if bins are allocated, find right one and fill it
- if (fUseBins)
- {
- Int_t i, ibin;
- for (ibin = 0, i = 1; ibin < fBins.GetSize() - 1; ibin++, i++)
- {
- if (!fHisto[i]) continue;
- fBinningCut.SetCutValues(fBinningCutType, (Double_t)fBins[ibin], (Double_t)fBins[ibin+1]);
- fBinningCut.SetCutValues(fBinningCutType, (Int_t)fBins[ibin], (Int_t)fBins[ibin+1]);
- if (fBinningCut.IsSelected(AliRsnCut::kEvent, event))
- {
- fHisto[i]->Fill(value);
- break;
- }
- }
- }
-
- return kTRUE;
-}
-
-//________________________________________________________________________________________
-Double_t AliRsnEventFunction::FcnValue(AliRsnEvent *event)
-{
- //
- // This method must be overridden in all inheritin functions.
- // It computes the value which must be used to fill the histogram.
- //
-
- Int_t count;
- Double_t output, v[3], vMC[3], vt, vtMC, mean = 0.0, rms = 0.0;
- AliRsnDaughter *trk = 0x0;
-
- switch (fType)
- {
- case kMultiplicity:
- fAccept = kTRUE;
- output = (Double_t)event->GetMultiplicity();
- break;
- case kLeadingMomentum:
- trk = event->GetLeadingParticle(fLeadPtMin);
- if (trk) {
- fAccept = kTRUE;
- output = trk->P();
- }
- else {
- fAccept = kFALSE;
- output = 0.0;
- }
- break;
- case kLeadingTheta:
- trk = event->GetLeadingParticle(fLeadPtMin);
- if (trk) {
- fAccept = kTRUE;
- output = trk->Theta();
- }
- else {
- fAccept = kFALSE;
- output = 0.0;
- }
- break;
- case kAverageMomentum:
- output = event->GetAverageMomentum(count);
- fAccept = (count > 0);
- break;
- case kAngleLeadingMean:
- case kAngleLeadingRMS:
- fAccept = event->GetAngleDistrWRLeading(mean, rms, fLeadPtMin);
- if (fType == kAngleLeadingMean) output = mean; else output = rms;
- break;
- case kVzResolution:
- case kVtResolution:
- fAccept = kTRUE;
- v[0] = event->GetPrimaryVertexX();
- v[1] = event->GetPrimaryVertexY();
- v[2] = event->GetPrimaryVertexZ();
- vMC[0] = event->GetPrimaryVertexXMC();
- vMC[1] = event->GetPrimaryVertexYMC();
- vMC[2] = event->GetPrimaryVertexZMC();
- vt = TMath::Sqrt(v[0]*v[0] + v[1]*v[1]);
- vtMC = TMath::Sqrt(vMC[0]*vMC[0] + vMC[1]*vMC[1]);
- if (fType == kVtResolution) return (vt - vtMC); else return (v[2] - vMC[2]);
- break;
- default:
- AliError(Form("Type '%d' not supported for EVENT functions", fType));
- fAccept = kFALSE;
- output = 0.0;
- }
-
- return output;
-}
-
+++ /dev/null
-//
-// Class AliRsnEventTaskSE
-//
-// TODO
-//
-// authors: Martin Vala (martin.vala@cern.ch)
-// Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it)
-//
-
-#include <Riostream.h>
-#include <TList.h>
-
-#include "AliLog.h"
-
-#include "AliAnalysisManager.h"
-
-#include "AliRsnEvent.h"
-#include "AliRsnEventFunction.h"
-#include "AliRsnEventTaskSE.h"
-
-ClassImp(AliRsnEventTaskSE)
-
-//________________________________________________________________________
-AliRsnEventTaskSE::AliRsnEventTaskSE(const char * name) :
- AliRsnAnalysisTaskSEBase(name),
- fEventFunctions("AliRsnEventFunction", 0),
- fOutList(0x0)
-{
-//
-// Default constructor
-//
-
- InitIOVars();
- DefineOutput(1, TList::Class());
-}
-
-//________________________________________________________________________
-AliRsnEventTaskSE::~AliRsnEventTaskSE()
-{
-//
-// Destructor
-//
-}
-
-//________________________________________________________________________
-void AliRsnEventTaskSE::InitIOVars()
-{
-//
-// Init input output values
-//
-
- AliRsnAnalysisTaskSEBase::InitIOVars();
- fOutList = 0;
-}
-
-//________________________________________________________________________
-void AliRsnEventTaskSE::UserCreateOutputObjects()
-{
-//
-// UserCreateOutputObjects() of AliAnalysisTaskSE
-//
-
- OpenFile(0);
- fOutList = new TList();
- fOutList->SetOwner();
- fOutList->SetName("EventFunctions");
-
- AliRsnEventFunction *fcn = 0;
- TObjArrayIter next(&fEventFunctions);
-
- while ( (fcn = (AliRsnEventFunction*)next()) )
- {
- fcn->Init(fOutList);
- }
-
- AliInfo("*************************** List");
- fOutList->Print();
- AliInfo("*********************** End List");
-}
-
-//________________________________________________________________________
-void AliRsnEventTaskSE::UserExec(Option_t *)
-{
-//
-// UserExec() of AliAnalysisTaskSE
-//
-
- if (fEntry++ % 100 == 0) cout << "[" << GetName() << "]: event " << fEntry-1 << endl;
-
- AliRsnEvent *curEvent = GetRsnEventFromInputType();
- if (!curEvent) return;
-
- AliRsnEventFunction *fcn = 0;
- TObjArrayIter next(&fEventFunctions);
-
- while ( (fcn = (AliRsnEventFunction*)next()) )
- {
- fcn->Fill(curEvent);
- }
-
- PostData(1, fOutList);
-}
-
-//________________________________________________________________________
-void AliRsnEventTaskSE::Terminate(Option_t *)
-{
-//
-// Terminate() of AliAnalysisTask
-//
-
- fOutList = dynamic_cast<TList*>(GetOutputData(1));
- if (!fOutList) { AliError("*** Output list not available ***"); return; }
- fOutList->Print();
-}
-
-//________________________________________________________________________
-void AliRsnEventTaskSE::AddEventFunction(AliRsnEventFunction *fcn)
-{
- Int_t size = fEventFunctions.GetEntries();
- new (fEventFunctions[size]) AliRsnEventFunction(*fcn);
- AliInfo(Form("Function name: %s", fcn->GetFcnName().Data()));
-}
AliRsnDaughter* GetTrack() {return fTrack;}
AliRsnPairParticle* GetPair() {return fPair;}
AliRsnEvent* GetEvent() {return fEvent;}
- AliRsnHistoDef* GetMainHistoDef(AliRsnHistoDef *hd) {return fHistoDef[0];}
- AliRsnHistoDef* GetPrimaryBinningHistoDef(AliRsnHistoDef *hd) {return fHistoDef[1];}
- AliRsnHistoDef* GetSecondaryBinningHistoDef(AliRsnHistoDef *hd) { return fHistoDef[2];}
+ AliRsnHistoDef* GetMainHistoDef() {return fHistoDef[0];}
+ AliRsnHistoDef* GetPrimaryBinningHistoDef() {return fHistoDef[1];}
+ AliRsnHistoDef* GetSecondaryBinningHistoDef() { return fHistoDef[2];}
TH1* CreateHistogram(const char *histoName, const char *histoTitle);
+++ /dev/null
-//
-// Class AliRsnFunctionDef
-//
-// This class defines a base classe to implement a function
-// which uses the internal RSN package event format (AliRsnEvent).
-// It contains some default flags which turn out to be useful:
-// - a flag to select only the "true" pairs (tracks from same resonance)
-// - a flag to know if the computation is done over two events (mixing)
-//
-// Any kind of analysis object should be implemented as inheriting from this
-// because the AliRsnAnalyzer which executes the analysis will accept a collection
-// of such objects, in order to have a unique format of processing method
-//
-// The user who implements a kind of computation type should inherit from
-// this class and override the virtual functions defined in it, which
-// initialize the final output histogram and define how to process data.
-//
-//
-// author: A. Pulvirenti (email: alberto.pulvirenti@ct.infn.it)
-//
-
-#include <Riostream.h>
-
-#include <TH1.h>
-#include <TList.h>
-#include <TString.h>
-
-#include "AliLog.h"
-
-#include "AliRsnPairParticle.h"
-#include "AliRsnPairDef.h"
-//#include "AliRsnCut.h"
-//#include "AliRsnMCInfo.h"
-//#include "AliRsnDaughter.h"
-//#include "AliRsnEvent.h"
-
-
-#include "AliRsnFunctionDef.h"
-
-ClassImp(AliRsnFunctionDef)
-
-//________________________________________________________________________________________
-AliRsnFunctionDef::AliRsnFunctionDef() :
- fFcnType(kFcnTypes),
- fNBinsX(0),
- fXmin(0.0),
- fXmax(0.0),
- fYUsed(0),
- fRotAngle(0.0)
-{
- //
- // Constructor.
- // The histogram data member cannot be passed externally,
- // its initialization MUST be defined inside the Init() method,
- // which must be overridden in any derivate implementation.
- //
-
- Int_t j;
- for (j = 0 ; j < kBinMax; j++)
- {
- fNBinsY[j] = 0;
- fYbins[j].Set(0);
- }
-}
-
-//________________________________________________________________________________________
-AliRsnFunctionDef::AliRsnFunctionDef
-(EFcnType type, Int_t nbins, Double_t min, Double_t max) :
- fFcnType(type),
- fNBinsX(nbins),
- fXmin(min),
- fXmax(max),
- fYUsed(0),
- fRotAngle(0.0)
-{
- //
- // Constructor.
- // The histogram data member cannot be passed externally,
- // its initialization MUST be defined inside the Init() method,
- // which must be overridden in any derivate implementation.
- //
-
- Int_t j;
- for (j = 0 ; j < kBinMax; j++)
- {
- fNBinsY[j] = 0;
- fYbins[j].Set(0);
- }
-}
-
-//________________________________________________________________________________________
-AliRsnFunctionDef::AliRsnFunctionDef(const AliRsnFunctionDef ©) :
- TObject(copy),
- fFcnType(copy.fFcnType),
- fNBinsX(copy.fNBinsX),
- fXmin(copy.fXmin),
- fXmax(copy.fXmax),
- fYUsed(copy.fYUsed),
- fRotAngle(copy.fRotAngle)
-{
- //
- // Copy constructor.
- // Calls the functions to define binning.
- //
-
- Int_t i, j, nbins;
-
- for (i = 0; i < fYUsed; i++)
- {
- nbins = copy.fNBinsY[i];
- if (!nbins) continue;
- fYbins[i].Set(nbins);
- for (j = 0; j < nbins; j++) fYbins[i][j] = copy.fYbins[i][j];
- }
-}
-//________________________________________________________________________________________
-const AliRsnFunctionDef& AliRsnFunctionDef::operator=(const AliRsnFunctionDef& copy)
-{
- //
- // Assignment operator.
- // Behaves like copy constructor.
- // Also in this case, the histogram is not copied, and,
- // if it was present, it is destroyed and will need to be recreated.
- //
-
- fFcnType = copy.fFcnType;
- fNBinsX = copy.fNBinsX;
- fXmin = copy.fXmin;
- fXmax = copy.fXmax;
- fYUsed = copy.fYUsed;
- fRotAngle = copy.fRotAngle;
-
- Int_t i, j, nbins;
-
- for (i = 0; i < fYUsed; i++)
- {
- nbins = copy.fNBinsY[i];
- if (!nbins) continue;
- fYbins[i].Set(nbins);
- for (j = 0; j < nbins; j++) fYbins[i][j] = copy.fYbins[i][j];
- }
-
- return (*this);
-}
-
-//________________________________________________________________________________________
-void AliRsnFunctionDef::SetBinningY
-(Int_t i, EFcnBinType type, Double_t xmin, Double_t xmax, Double_t step)
-{
-//
-// Define a secondary binning with fixed bins of given step
-//
-
- if (i >= fYUsed) return;
-
- Int_t ib;
-
- fBinType[i] = type;
- fNBinsY[i] = (Int_t)((xmax - xmin) / step) + 2;
- fYbins[i].Set(fNBinsY[i]);
-
- for (ib = 0; ib < fNBinsY[i]; ib++)
- {
- fYbins[i][ib] = xmin + (Double_t)ib * step;
- }
-}
-
-//________________________________________________________________________________________
-void AliRsnFunctionDef::SetBinningY
-(Int_t i, EFcnBinType type, Int_t nbins, Double_t *bins)
-{
-//
-// Define a secondary binning with variable bins
-//
-
- if (i >= fYUsed) return;
-
- fBinType[i] = type;
-
- Int_t ib;
-
- fYbins[i].Set(nbins);
- fNBinsY[i] = nbins;
- for (ib = 0; ib < nbins; ib++)
- {
- fYbins[i][ib] = bins[ib];
- }
-}
-
-//________________________________________________________________________________________
-Bool_t AliRsnFunctionDef::AddBinningY(EFcnBinType type, Double_t xmin, Double_t xmax, Double_t step)
-{
-//
-// Add a new secondary binning with fixed bins of given step
-//
-
- if (fYUsed >= kBinMax)
- {
- AliError(Form("Cannot create a new binning: maximum allowed of %d is reached", kBinMax));
- return kFALSE;
- }
-
- fYUsed++;
- SetBinningY(fYUsed - 1, type, xmin, xmax, step);
-
- return kTRUE;
-}
-
-//________________________________________________________________________________________
-Bool_t AliRsnFunctionDef::AddBinningY(EFcnBinType type, Int_t nbins, Double_t *bins)
-{
-//
-// Define a secondary binning with variable bins
-//
-
- if (fYUsed >= kBinMax)
- {
- AliError(Form("Cannot create a new binning: maximum allowed of %d is reached", kBinMax));
- return kFALSE;
- }
-
- fYUsed++;
- SetBinningY(fYUsed - 1, type, nbins, bins);
-
- return kTRUE;
-}
-
-//________________________________________________________________________________________
-TString AliRsnFunctionDef::GetFcnName()
-{
- //
- // Return a string which names the function type
- //
-
- TString text("Undef");
-
- switch (fFcnType)
- {
- case kInvMass:
- text = "IM";
- break;
- case kInvMassMC:
- text = "IM_MC";
- break;
- case kInvMassRotated:
- text = Form("IMR%.2f", fRotAngle);
- break;
- case kResolution:
- text = "RES";
- break;
- case kPtSpectrum:
- text = "PT";
- break;
- case kEtaSpectrum:
- text = "ETA";
- break;
- default:
- AliError("Type not defined");
- }
-
- return text;
-}
-
-//________________________________________________________________________________________
-TString AliRsnFunctionDef::GetFcnTitle()
-{
- //
- // Return a string which names the function type
- //
-
- TString text("Undef");
-
- switch (fFcnType)
- {
- case kInvMass:
- text = "Invariant mass";
- break;
- case kInvMassMC:
- text = "Invariant mass (MC)";
- break;
- case kResolution:
- text = "Resolution";
- break;
- case kPtSpectrum:
- text = "p_{#perp} distribution";
- break;
- case kEtaSpectrum:
- text = "#eta distribution";
- break;
- default:
- AliError("Type not defined");
- }
-
- return text;
-}
-
-//________________________________________________________________________________________
-TString AliRsnFunctionDef::GetBinningName(Int_t i)
-{
- //
- // Return a string which names the function type
- //
-
- TString text("Undef");
-
- if (i >= kBinMax) return text;
-
- switch (fBinType[i])
- {
- case kPt:
- text = "PT";
- break;
- case kEta:
- text = "ETA";
- break;
- default:
- AliError("Type not defined");
- }
-
- return text;
-}
-
-//________________________________________________________________________________________
-Double_t AliRsnFunctionDef::EvalX(AliRsnPairParticle *pair, AliRsnPairDef *ref)
-{
-//
-// Evaluate X value according to selected type
-//
-
- Double_t recInvMass = pair->GetInvMass(ref->GetMass(0), ref->GetMass(1));
- Double_t simInvMass = pair->GetInvMassMC(ref->GetMass(0), ref->GetMass(1));
-
- switch (fFcnType)
- {
- case kInvMass:
- return recInvMass;
- case kInvMassMC:
- return simInvMass;
- case kInvMassRotated:
- pair->GetDaughter(1)->RotateP(fRotAngle * TMath::DegToRad());
- pair->ResetPair();
- return pair->GetInvMass(ref->GetMass(0), ref->GetMass(1));
- case kResolution:
- return (simInvMass - recInvMass) / simInvMass;
- case kPtSpectrum:
- return pair->GetPt();
- case kEtaSpectrum:
- return pair->GetEta();
- default:
- AliError("Type not defined");
- return 1000.0;
- }
-}
-
-//________________________________________________________________________________________
-Double_t AliRsnFunctionDef::EvalY(Int_t i, AliRsnPairParticle *pair)
-{
-//
-// Evaluate Y value according to selected type
-//
-
- if (i >= fYUsed) return 1000.0;
-
- switch (fBinType[i])
- {
- case kPt:
- return pair->GetPt();
- case kEta:
- return pair->GetEta();
- default:
- AliError("Binning type not defined");
- return 1000.0;
- }
-}
-
-//________________________________________________________________________________________
-void AliRsnFunctionDef::Print(Option_t* /*opt*/)
-{
-//
-// Print details on this function
-//
-
- Int_t i, j;
-
- cout << "DEFINITION X TYPE: " << GetFcnName().Data() << endl;
- cout << "DEFINITION Y TYPES = " << fYUsed << endl;
-
- for (i = 0; i < fYUsed; i++) {
- cout << "Y TYPE #" << i << ": " << GetBinningName(i) << " [bins = ";
- for (j = 0; j < fYbins[i].GetSize(); j++) {
- cout << fYbins[i][j] << ' ';
- }
- cout << endl;
- }
-}
+++ /dev/null
-//
-// Class AliRsnFunctionNew
-//
-// This class defines a base classe to implement a function
-// which uses the internal RSN package event format (AliRsnEvent).
-// It contains some default flags which turn out to be useful:
-// - a flag to select only the "true" pairs (tracks from same resonance)
-// - a flag to know if the computation is done over two events (mixing)
-//
-// Any kind of analysis object should be implemented as inheriting from this
-// because the AliRsnAnalyzer which executes the analysis will accept a collection
-// of such objects, in order to have a unique format of processing method
-//
-// The user who implements a kind of computation type should inherit from
-// this class and override the virtual functions defined in it, which
-// initialize the final output histogram and define how to process data.
-//
-//
-// author: A. Pulvirenti (email: alberto.pulvirenti@ct.infn.it)
-//
-
-#include <Riostream.h>
-
-#include <TH1.h>
-#include <TH2.h>
-#include <TList.h>
-#include <TString.h>
-
-#include "AliLog.h"
-
-#include "AliRsnMCInfo.h"
-#include "AliRsnDaughter.h"
-#include "AliRsnEvent.h"
-#include "AliRsnPairDef.h"
-#include "AliRsnCut.h"
-
-#include "AliRsnFunctionNew.h"
-
-ClassImp(AliRsnFunctionNew)
-
-//________________________________________________________________________________________
-AliRsnFunctionNew::AliRsnFunctionNew() :
- fFcnDef(0x0),
- fHistoTot(0x0)
-{
- //
- // Constructor.
- // The histogram data member cannot be passed externally,
- // its initialization MUST be defined inside the Init() method,
- // which must be overridden in any derivate implementation.
- //
-
- Int_t i;
- for (i = 0 ; i < AliRsnFunctionDef::kBinMax; i++) fHistoBin[i] = 0x0;
-}
-
-//________________________________________________________________________________________
-AliRsnFunctionNew::AliRsnFunctionNew(AliRsnFunctionDef *fd) :
- fFcnDef(fd),
- fHistoTot(0x0)
-{
- //
- // Constructor.
- // The histogram data member cannot be passed externally,
- // its initialization MUST be defined inside the Init() method,
- // which must be overridden in any derivate implementation.
- //
-
- Int_t i;
- for (i = 0 ; i < AliRsnFunctionDef::kBinMax; i++) fHistoBin[i] = 0x0;
-}
-
-//________________________________________________________________________________________
-AliRsnFunctionNew::AliRsnFunctionNew(const AliRsnFunctionNew ©) :
- TObject(copy),
- fFcnDef(copy.fFcnDef),
- fHistoTot(0x0)
-{
- //
- // Copy constructor.
- // Calls the function to define binning.
- //
-
- Int_t i;
- for (i = 0 ; i < AliRsnFunctionDef::kBinMax; i++) fHistoBin[i] = 0x0;
-}
-//________________________________________________________________________________________
-const AliRsnFunctionNew& AliRsnFunctionNew::operator=(const AliRsnFunctionNew& /*copy*/)
-{
- //
- // Assignment operator.
- // Behaves like copy constructor.
- // Also in this case, the histogram is not copied, and,
- // if it was present, it is destroyed and will need to be recreated.
- //
-
- return (*this);
-}
-//________________________________________________________________________________________
-void AliRsnFunctionNew::Clear(Option_t* /*option*/)
-{
- //
- // Clear arrays and histogram.
- // For the sake of security, all pointers are also set explicitly to NULL.
- //
-
- Int_t i;
- for (i = 0 ; i < AliRsnFunctionDef::kBinMax; i++)
- {
- delete fHistoBin[i];
- fHistoBin[i] = 0x0;
- }
-
- delete fHistoTot;
- fHistoTot = 0x0;
-}
-
-//________________________________________________________________________________________
-TList* AliRsnFunctionNew::Init(const char *histoName, const char *histoTitle)
-{
- //
- // Initialization function.
- // By default, it initializes the owned histogram using the method
- // from AliRsnHistoDef class, giving the same name and title of this.
- // A user can override this behaviour, if necessary.
- // Before creating, the HistoDef is checked for proper initialization.
- //
-
- Clear();
-
- Int_t nbins = fFcnDef->GetNBinsX();
- Double_t min = fFcnDef->GetXmin(), max = fFcnDef->GetXmax();
-
- // list is created and named after the general
- // settings used for the contained histograms
- TList *histos = new TList;
- histos->SetName(Form("%s", fFcnDef->GetFcnName().Data()));
-
- // a general histogram is always added,
- // which overrides the binning and collects everything
- fHistoTot = new TH1D(histoName, histoTitle, nbins, min, max);
- fHistoTot->Sumw2();
- histos->AddLast(fHistoTot);
-
- // if requested a binning w.r. to some cut variable, histograms are added
- // for that in this part of the method (one per each bin)
- Char_t hName[255];
- Char_t hTitle[255];
- Int_t j, binMax = fFcnDef->GetMaxYBinUsed();
- if (binMax > 0)
- {
- for (j = 0 ; j < binMax; j++)
- {
- Int_t nY = fFcnDef->GetNBinsY(j);
- TArrayD *binsY = fFcnDef->GetYbins(j);
- Double_t *arrY = binsY->GetArray();
- sprintf(hName, "%s_%02d_%s", histoName, j, fFcnDef->GetBinningName(j).Data());
- sprintf(hTitle, "%s [%s]", histoTitle, fFcnDef->GetBinningName(j).Data());
- fHistoBin[j] = new TH2D(hName, hTitle, nbins, min, max, nY - 1, arrY);
- fHistoBin[j]->Sumw2();
- histos->AddLast(fHistoBin[j]);
- }
- }
-
- // returns the full list at the end
- return histos;
-}
-
-//________________________________________________________________________________________
-void AliRsnFunctionNew::Init(const char *histoName, const char *histoTitle, TList *histos)
-{
- //
- // Initialization function.
- // By default, it initializes the owned histogram using the method
- // from AliRsnHistoDef class, giving the same name and title of this.
- // A user can override this behaviour, if necessary.
- // Before creating, the HistoDef is checked for proper initialization.
- //
-
- Clear();
-
- Int_t nbins = fFcnDef->GetNBinsX();
- Double_t min = fFcnDef->GetXmin(), max = fFcnDef->GetXmax();
-
- // list is not created but its existence is checked
- if (!histos) return;
-
- // a general histogram is always added,
- // which overrides the binning and collects everything
- fHistoTot = new TH1D(histoName, histoTitle, nbins, min, max);
- fHistoTot->Sumw2();
- histos->AddLast(fHistoTot);
-
- // if requested a binning w.r. to some cut variable, histograms are added
- // for that in this part of the method (one per each bin)
- Char_t hName[255];
- Char_t hTitle[255];
- Int_t j, binMax = fFcnDef->GetMaxYBinUsed();
- if (binMax > 0)
- {
- for (j = 0 ; j < binMax; j++)
- {
- Int_t nY = fFcnDef->GetNBinsY(j);
- TArrayD *binsY = fFcnDef->GetYbins(j);
- sprintf(hName, "%s_%02d_%s", histoName, j, fFcnDef->GetBinningName(j).Data());
- sprintf(hTitle, "%s [%s]", histoTitle, fFcnDef->GetBinningName(j).Data());
- fHistoBin[j] = new TH2D(hName, hTitle, nbins, min, max, nY, binsY->GetArray());
- fHistoBin[j]->Sumw2();
- histos->AddLast(fHistoBin[j]);
- }
- }
-}
-
-//________________________________________________________________________________________
-Bool_t AliRsnFunctionNew::Fill(AliRsnPairParticle *pair, AliRsnPairDef *ref)
-{
- //
- // Fillse the histogram with data contained in a defined pair.
- // This method must be overidden by an appropriate definition in each inheriting class.
- //
-
- Double_t valueY, valueX = fFcnDef->EvalX(pair, ref);
-
- // fill global histogram
- fHistoTot->Fill(valueX);
-
- // if bins are allocated, fill them
- Int_t j, binMax = fFcnDef->GetMaxYBinUsed();
- if (binMax > 0)
- {
- for (j = 0 ; j < binMax; j++)
- {
- valueY = fFcnDef->EvalY(j, pair);
- if (fHistoBin[j]) fHistoBin[j]->Fill(valueX, valueY);
- }
- }
-
- return kTRUE;
-}
+++ /dev/null
-//
-// Class AliRsnMCInfo
-//
-// Contains informations from the MonteCarlo particle is associated to a track.
-// It is used when looking at "perfect" PID and at "true" pairs, but the user
-// does not need to access its methods.
-//
-
-#include "AliLog.h"
-
-#include "AliRsnMCInfo.h"
-
-ClassImp(AliRsnMCInfo)
-
-//_____________________________________________________________________________
-AliRsnMCInfo::AliRsnMCInfo() :
- TObject(), fEnergy(0), fPDG(0), fMother(-1), fMotherPDG(0)
-{
-//
-// Default constructor.
-// Initializes all data-members to meaningless values.
-//
-
- Int_t i;
- for (i = 0; i < 3; i++) fP[i] = fV[i] = 0.0;
-}
-
-//_____________________________________________________________________________
-AliRsnMCInfo::AliRsnMCInfo(const AliRsnMCInfo & copy) :
- TObject(copy),
- fEnergy(copy.fEnergy),
- fPDG(copy.fPDG),
- fMother(copy.fMother),
- fMotherPDG(copy.fMotherPDG)
-{
-//
-// Copy constructor.
-//
-
- Int_t i;
- for (i = 0; i < 3; i++) {
- fP[i] = copy.fP[i];
- fV[i] = copy.fV[i];
- }
-}
-
-//_____________________________________________________________________________
-AliRsnMCInfo::~AliRsnMCInfo()
-{
-//
-// Destructor.
-// Does nothing because there are no pointers to clean.
-//
-}
-
-//_____________________________________________________________________________
-void AliRsnMCInfo::Adopt(TParticle * particle)
-{
-//
-// Uses a TParticle to initialize its data members.
-// If the argument is NULL, nothing is done and an error message is returned.
-//
-
- if (!particle) return;
-
- fP[0] = particle->Px();
- fP[1] = particle->Py();
- fP[2] = particle->Pz();
-
- fV[0] = particle->Vx();
- fV[1] = particle->Vy();
- fV[2] = particle->Vz();
-
- fEnergy = particle->Energy();
-
- fPDG = particle->GetPdgCode();
- fMother = particle->GetFirstMother();
- fMotherPDG = (Short_t) 0;
-}
+++ /dev/null
-//
-// Class AliRsnPID
-//
-// Processes the tracks to compute PID probabilities,
-// by combining the prior probabilities with the PID weights
-// stored in each AliRsnDaughter
-//
-// authors: A. Pulvirenti (alberto.pulvirenti@ct.infn.it)
-// M. Vala (martin.vala@cern.ch)
-//
-
-
-#include <TMath.h>
-#include <TDirectory.h>
-
-#include "AliLog.h"
-#include "AliRsnMCInfo.h"
-#include "AliRsnDaughter.h"
-#include "AliRsnEvent.h"
-
-#include "AliRsnPID.h"
-
-ClassImp(AliRsnPID)
-
-const Double_t AliRsnPID::fgkParticleMass[AliRsnPID::kSpeciesAll + 1] =
-{
- 0.00051099892, // electron
- 0.105658369, // muon
- 0.13957018, // pion
- 0.493677, // kaon
- 0.93827203, // proton
- 0.0, // nothing
- 1.019413, // phi
- 3.09693 // jpsi
-};
-
-const char* AliRsnPID::fgkParticleNameLong[AliRsnPID::kSpeciesAll + 1] =
-{
- "electron",
- "muon",
- "pion",
- "kaon",
- "proton",
- "unknown",
- "phi",
- "jpsi"
-};
-
-const char* AliRsnPID::fgkParticleNameShort[AliRsnPID::kSpeciesAll + 1] =
-{
- "e",
- "mu",
- "pi",
- "K",
- "p",
- "unk",
- "phi",
- "jpsi"
-};
-
-const char* AliRsnPID::fgkParticleNameLatex[AliRsnPID::kSpeciesAll + 1] =
-{
- "e",
- "#mu",
- "#pi",
- "K",
- "p",
- "?",
- "#phi",
- "J/#psi"
-};
-
-const Int_t AliRsnPID::fgkParticlePDG[AliRsnPID::kSpeciesAll + 1] =
-{
- 11,
- 13,
- 211,
- 321,
- 2212,
- 0,
- 333,
- 443
-};
-
-//_____________________________________________________________________________
-AliRsnPID::AliRsnPID() :
- TNamed("RsnPID", ""),
- fMaxPt(100.0),
- fMinProb(0.0),
- fPIDArraysSize(1000)
-{
-//
-// Constructor.
-// Adds also the object in the default directory of the session.
-//
-
- Int_t i;
- for (i = 0; i < kSpecies; i++) fPrior[i] = 0.2;
-}
-
-//_____________________________________________________________________________
-AliRsnPID::EType AliRsnPID::InternalType(Int_t pdg)
-//
-// Return the internal enum value corresponding to the PDG
-// code passed as argument, if possible.
-// Otherwise, returns 'kUnknown' by default.
-//
-{
- EType value;
- Int_t absPDG = TMath::Abs(pdg);
-
- switch (absPDG)
- {
- case 11:
- value = kElectron;
- break;
- case 13:
- value = kMuon;
- break;
- case 211:
- value = kPion;
- break;
- case 321:
- value = kKaon;
- break;
- case 2212:
- value = kProton;
- break;
- case 333:
- value = kPhi;
- break;
- case 443:
- value = kJPsi;
- break;
- default:
- value = kUnknown;
- }
- return value;
-}
-
-
-//_____________________________________________________________________________
-Int_t AliRsnPID::PDGCode(EType type)
-{
-//
-// Returns the PDG code of the particle type
-// specified as argument (w.r. to the internal enum)
-//
-
- if (type >= kElectron && type <= kUnknown)
- {
- return fgkParticlePDG[type];
- }
- else
- {
- return 0;
- }
-}
-
-//_____________________________________________________________________________
-const char* AliRsnPID::ParticleName(EType type, Bool_t shortName)
-{
-//
-// Returns the name of the particle type
-// specified as argument (w.r. to the internal enum)
-//
-
- if (type >= 0 && type <= kSpeciesAll)
- {
- return shortName ? fgkParticleNameShort[type] : fgkParticleNameLong[type];
- }
- else
- {
- return shortName ? "unk" : "unknown";
- }
-}
-
-//_____________________________________________________________________________
-const char* AliRsnPID::ParticleNameLatex(EType type)
-{
-//
-// Returns the name of the particle type
-// specified as argument (w.r. to the internal enum)
-//
-
- if (type >= kElectron && type <= kSpeciesAll)
- {
- return fgkParticleNameLatex[type];
- }
- else
- {
- return "?";
- }
-}
-
-//_____________________________________________________________________________
-Double_t AliRsnPID::ParticleMass(EType type)
-{
-//
-// Returns the mass corresponding to the particle type
-// specified as argument (w.r. to the internal enum)
-//
- /*
- TDatabasePDG *db = TDatabasePDG::Instance();
- Int_t pdg = PDGCode(type);
- return db->GetParticle(pdg)->Mass();
- */
- if (type >= kElectron && type < kSpeciesAll) return fgkParticleMass[type];
- return 0.0;
-}
-
-//_____________________________________________________________________________
-Bool_t AliRsnPID::ComputeProbs(AliRsnDaughter *daughter)
-{
-//
-// Uses the Bayesian combination of prior probabilities
-// with the PID weights of the passed object to compute
-// the overall PID probabilities for each particle type.
-//
-// Once this computation is done, the argument is assigned
-// the PID corresponding to the largest probability,
-// and its data members are updated accordingly.
-// If the track Pt is larger than the cut defined (fMaxPt)
-// or the probability is smaller than the cut defined (fMinProb),
-// the track is considered unidentified.
-//
-// If the identification procedure encounters errors,
-// the return value will be "FALSE", otherwise it is "TRUE".
-//
-
- // reset all PID probabilities to 0.0
- Int_t i;
- for (i = 0; i < kSpecies; i++) daughter->SetPIDProb(i, 1.0 / (Double_t) kSpecies);
-
- // multiply weights and priors
- Double_t sum = 0.0, prob[kSpecies];
- for (i = 0; i < kSpecies; i++)
- {
- prob[i] = fPrior[i] * daughter->PID()[i];
- sum += prob[i];
- }
- if (sum <= (Double_t) 0.)
- {
- AliError(Form("Sum of weights = %f <= 0", sum));
- return kFALSE;
- }
-
- // normalize
- for (i = 0; i < kSpecies; i++)
- {
- prob[i] /= sum;
- daughter->SetPIDProb(i, prob[i]);
- }
-
- daughter->RealisticPID();
- Double_t assprob;
- AliRsnDaughter::SetPIDMethod(AliRsnDaughter::kRealistic);
- AliRsnPID::EType type = daughter->PIDType(assprob);
- AliDebug(5, Form("Assigned PID: %s [%.2f %]", AliRsnPID::ParticleName(type), assprob*100.));
-
- return kTRUE;
-}
-
-//_____________________________________________________________________________
-Bool_t AliRsnPID::IdentifiedAs(AliRsnDaughter *d, EType type, Short_t charge)
-{
-//
-// Tells if a particle has can be identified to be of a given tipe and charge.
-// If the charge is zero, the check is done only on the PID type, otherwise
-// both charge and PID type are required to match.
-// If the track momentum is larger than the pt threshold passed to this object,
-// or the maximum probability is smaller than the prob thrashold, the return value
-// is kFALSE even when the type and charge are matched.
-//
-
- EType dType = TrackType(d);
- if (dType != type) return kFALSE;
- if (charge == 0)
- {
- return kTRUE;
- }
- else if (charge > 0)
- {
- return (d->Charge() > 0);
- }
- else
- {
- return (d->Charge() < 0);
- }
-}
-
-//_____________________________________________________________________________
-AliRsnPID::EType AliRsnPID::TrackType(AliRsnDaughter *d)
-{
-//
-// Returns the track type according to the object settings
-// and to the static settings in the AliRsnDaughter object.
-//
-
- Double_t prob;
- EType type = d->PIDType(prob);
-
- if (d->Pt() > fMaxPt) return kUnknown;
- if (prob < fMinProb) return kUnknown;
-
- return type;
-}
-
-//_____________________________________________________________________________
-Bool_t AliRsnPID::Process(AliRsnEvent *event)
-{
-//
-// Performs identification for all tracks in a given event.
-// Returns the logical AND of all PID operations.
-//
-
- Bool_t check = kTRUE;
- if (!event) return check;
- if (!event->GetTracks()) return check;
- if (event->GetTracks()->IsEmpty()) return check;
-
- AliRsnDaughter *daughter = 0;
- TObjArrayIter iter(event->GetTracks());
- while ((daughter = (AliRsnDaughter*) iter.Next()))
- {
- check = check && ComputeProbs(daughter);
- }
- event->FillPIDArrays(fPIDArraysSize);
-
- return check;
-}
-
-
-//_____________________________________________________________________________
-void AliRsnPID::SetPriorProbability(EType type, Double_t p)
-{
-//
-// Sets the prior probability for Realistic PID, for a
-// given particle species.
-//
-
- if (type >= kElectron && type < kSpecies)
- {
- fPrior[type] = p;
- }
-}
-
-//_____________________________________________________________________________
-void AliRsnPID::DumpPriors()
-{
-//
-// Print all prior probabilities
-//
-
- Int_t i;
- Char_t msg[200];
-
- for (i = 0; i < kSpecies; i++)
- {
- sprintf(msg, "Prior probability for '%s' = %3.5f", fgkParticleNameLong[i], fPrior[i]);
- AliInfo(msg);
- }
-}
+++ /dev/null
-/**************************************************************************
- * 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. *
- **************************************************************************/
-
-//-------------------------------------------------------------------------
-// Class AliRsnPIDWeightsMgr
-// -------------------
-// Simple collection of reconstructed tracks
-// selected from an ESD event
-// to be used for analysis.
-// .........................................
-//
-// author: A. Pulvirenti (email: alberto.pulvirenti@ct.infn.it)
-//-------------------------------------------------------------------------
-
-#include <TMath.h>
-#include <TString.h>
-#include <TClonesArray.h>
-#include <TDatabasePDG.h>
-
-#include "AliLog.h"
-#include "AliRsnPIDWeightsMgr.h"
-
-ClassImp(AliRsnPIDWeightsMgr)
-
-//_____________________________________________________________________________
-AliRsnPIDWeightsMgr::AliRsnPIDWeightsMgr()
-{
-//
-// Default and unique constructor which initializes arrays
-//
- Int_t i, j;
- for (i = 0; i < kDetectors; i++)
- {
- for (j = 0; j < AliRsnPID::kSpecies; j++) fWeights[i][j] = 0.0;
- fDetPtMin[i] = 0.0;
- fDetPtMax[i] = 1E25;
- fUseDet[i] = kTRUE;
- }
-}
-
-//_____________________________________________________________________________
-void AliRsnPIDWeightsMgr::SetDetectorWeights(EDetector det, Double_t *weights)
-{
-//
-// Copy into the array the PID weights of a detector
-//
-
- Int_t i;
- if (!CheckBounds(det)) return;
- for (i = 0; i < AliRsnPID::kSpecies; i++) fWeights[det][i] = weights[i];
-}
-
-//_____________________________________________________________________________
-void AliRsnPIDWeightsMgr::SetAcceptanceRange(EDetector det, Double_t ptmin, Double_t ptmax)
-{
-//
-// Sets a range in pt for which the PID weights of this detector
-// are accepted in the global computation, in the case that one
-// did not accept to use the global ESD pid.
-//
-
- if (!CheckBounds(det)) return;
-
- // swap values if necessary
- if (ptmin > ptmax)
- {
- AliWarning("Values passed in wrong order. Swapping");
- Double_t temp = ptmin;
- ptmin = ptmax;
- ptmax = temp;
- }
- fDetPtMin[det] = ptmin;
- fDetPtMax[det] = ptmax;
-}
-
-//_____________________________________________________________________________
-Double_t AliRsnPIDWeightsMgr::GetWeight(AliRsnPID::EType type, Double_t pt)
-{
-//
-// Computes the global PID weights using the given ranges
-//
-
- if (type < 0 or type >= AliRsnPID::kSpecies)
- {
- AliError("Index out of range");
- return kFALSE;
- }
-
- Int_t i;
- Double_t prob = 1.0;
- for (i = 0; i < kDetectors; i++)
- {
- //AliInfo(Form("weights[%d] = %f %f %f %f %f", i, fWeights[i][0], fWeights[i][1], fWeights[i][2], fWeights[i][3], fWeights[i][4], fWeights[i][5]));
- if (!fUseDet[i]) continue;
- if (pt < fDetPtMin[i] || pt > fDetPtMax[i]) continue;
- prob *= fWeights[i][type];
- }
-
- return prob;
-}
-
-//_____________________________________________________________________________
-Bool_t AliRsnPIDWeightsMgr::CheckBounds(EDetector det)
-{
-//
-// Bounds checker
-//
-
- if (det < 0 or det >= kDetectors)
- {
- AliError("Index out of range");
- return kFALSE;
- }
-
- return kTRUE;
-}
fCutMgr(0),
fFunctions("AliRsnFunction", 0),
fTrack1(),
- fTrack2()
+ fTrack2(),
+ fPairParticle()
{
//
// Default constructor
}
//_____________________________________________________________________________
-void AliRsnPairManager::Add(AliRsnPair *pair)
+//void AliRsnPairManager::Add(AliRsnPair *pair)
+void AliRsnPairManager::Add(TObject *objPair)
{
//
// Adds a new AliRsnPair to the list owned by this object.
//
AliDebug(AliLog::kDebug+2, "<-");
+ AliRsnPair *pair = dynamic_cast<AliRsnPair*>(objPair);
if (!pair) {
AliWarning(Form("Pair is %p. Skipping ...", pair));
AliRsnPairManager(const char *name = "defaultPairMgr");
- virtual void Add(AliRsnPair *pair);
+ //virtual void Add(AliRsnPair *pair);
+ virtual void Add(TObject *pair);
virtual void AddPair(AliRsnPair *pair) {Add(pair);}
virtual void PrintArray() const;
virtual void Print(Option_t *option = "") const;
+++ /dev/null
-//
-// Class AliRsnPairMgr
-//
-// A collection of pairs for an analysis.
-// The function of this collection is just for purposes of well-sorting
-// the analyzed pairs into upper-level groups, in the case of a wide
-// analysis containing many resonances at once, or different settings for the same one.
-//
-// Each PairMgr will result in a separate list of histograms, which
-// can be seen as a folder in the output file, whose name is given by this object.
-//
-// author: M. Vala (email: martin.vala@cern.ch)
-//
-
-#include "AliLog.h"
-
-#include "AliRsnPairMgr.h"
-
-ClassImp(AliRsnPairMgr)
-
-//_____________________________________________________________________________
-AliRsnPairMgr::AliRsnPairMgr(const char*name) :
- TNamed(name,name),
- fPairs(0)
-{
-//
-// Default constructor
-//
-}
-
-//_____________________________________________________________________________
-AliRsnPairMgr::~AliRsnPairMgr()
-{
-//
-// Destructor
-//
-}
-
-//_____________________________________________________________________________
-void AliRsnPairMgr::AddPair(AliRsnPair *pair)
-{
-//
-// Adds pair
-//
-
- fPairs.Add((AliRsnPair*)pair);
-}
-
-//_____________________________________________________________________________
-void AliRsnPairMgr::PrintPairs()
-{
-//
-// Prints all pairs
-//
-
- AliRsnPair *pair = 0;
- TObjArrayIter next(&fPairs);
- while ((pair = (AliRsnPair*)next())) pair->Print();
-}
+++ /dev/null
-//
-// Class AliRsnReader
-//
-// This is the universal converter from any kind of source event
-// (i.e. ESD, standard AOD, MC) into the internal non-standard
-// AOD format used by RSN package.
-// ---
-// This class reads all tracks in an input event and converts them
-// into AliRsnDaughters, and computes preliminarily the PID probabilities
-// by doing the Bayesian combination of a set of assigned prior probabilities
-// with the PID weights defined in each track.
-// ---
-// When filling the output event (AliRsnEvent), some arrays of indexes
-// are created in order to organize tracks according to their PID and charge,
-// which will then be used in further analysis steps.
-//
-// author: A. Pulvirenti (alberto.pulvirenti@ct.infn.it)
-//
-
-#include <Riostream.h>
-#include <TString.h>
-
-#include "AliLog.h"
-
-#include "AliVEvent.h"
-
-#include "AliESDEvent.h"
-#include "AliESDtrack.h"
-#include "AliESDVertex.h"
-#include "AliESDtrackCuts.h"
-#include "AliMultiplicity.h"
-
-#include "AliAODEvent.h"
-#include "AliAODTrack.h"
-#include "AliAODVertex.h"
-
-#include "AliStack.h"
-#include "AliMCEvent.h"
-#include "AliMCParticle.h"
-#include "AliGenEventHeader.h"
-
-#include "AliRsnMCInfo.h"
-#include "AliRsnDaughter.h"
-#include "AliRsnEvent.h"
-#include "AliRsnPIDDefESD.h"
-#include "AliRsnCut.h"
-
-#include "AliRsnReader.h"
-
-ClassImp(AliRsnReader)
-
-//_____________________________________________________________________________
-AliRsnReader::AliRsnReader() :
- fCheckSplit(kFALSE),
- fRejectFakes(kFALSE),
- fTPCOnly(kFALSE),
- fUseESDTrackCuts(kFALSE),
- fUseRsnTrackCuts(kFALSE),
- fCheckVertexStatus(kFALSE),
- fMinNContributors(0),
- fPID(),
- fPIDDef(),
- fPIDArraysSize(1000),
- fITSClusters(0),
- fTPCClusters(0),
- fTRDClusters(0),
- fTrackRefs(0),
- fTrackRefsITS(0),
- fTrackRefsTPC(0),
- fESDTrackCuts(),
- fRsnTrackCuts("primaryCuts")
-{
-//
-// Constructor.
-//
-}
-
-//_____________________________________________________________________________
-Bool_t AliRsnReader::AreSplitted(AliESDtrack *track1, AliESDtrack *track2)
-{
-//
-// Checks if two tracks are splitted.
-// Currently, two split tracks are the ones which
-// have equal GEANT labels.
-// On real data, this criterion will have to change
-// into an "experimental" one.
-//
-
- Int_t lab1 = TMath::Abs(track1->GetLabel());
- Int_t lab2 = TMath::Abs(track2->GetLabel());
-
- return (lab1 == lab2);
-}
-
-//_____________________________________________________________________________
-Bool_t AliRsnReader::ResolveSplit(AliESDtrack *track1, AliESDtrack *track2)
-{
-//
-// Resolves a split of two tracks.
-// Only two values can be returned:
-// kTRUE --> accept "track1" and reject "track2"
-// kFALSE --> accept "track2" and reject "track1"
-//
-
- Double_t chiSq1 = track1->GetConstrainedChi2();
- Double_t chiSq2 = track2->GetConstrainedChi2();
-
- if (chiSq1 < chiSq2) return 1; else return 2;
-}
-
-//_____________________________________________________________________________
-void AliRsnReader::SetTPCOnly(Bool_t doit)
-{
-//
-// Set the flag for TPC only.
-// If this is true, exclude all other detectors from PID
-//
-
- fTPCOnly = doit;
-
- if (fTPCOnly) {
- fPIDDef.ExcludeAll();
- fPIDDef.IncludeDet(AliRsnPIDDefESD::kTPC);
- fPIDDef.SetDivValue(AliRsnPIDDefESD::kTPC, 0.0);
- }
-}
-
-//_____________________________________________________________________________
-Bool_t AliRsnReader::ConvertTrack(AliRsnDaughter *daughter, AliESDtrack *esdTrack)
-{
-//
-// Translates an ESD track into a RSN daughter
-//
-
- if (!esdTrack) {
- AliError("Passed NULL object: nothing done");
- return kFALSE;
- }
-
- Double_t p[3], v[3], pid[AliRsnPID::kSpecies];
-
- // copy values which don't need treatment:
- // momentum, vertex, chi2, flags, charge, number of TPC and ITS clusters
- esdTrack->GetPxPyPz(p);
- daughter->SetP(p[0], p[1], p[2]);
- esdTrack->GetXYZ(v);
- daughter->SetV(v[0], v[1], v[2]);
- daughter->SetChi2(esdTrack->GetConstrainedChi2());
- daughter->SetFlags(esdTrack->GetStatus());
- daughter->SetCharge((Short_t)esdTrack->Charge());
- daughter->SetNumberOfITSClusters(esdTrack->GetITSclusters(0x0));
- daughter->SetNumberOfTPCClusters(esdTrack->GetTPCclusters(0x0));
-
- // define the kink index:
- // 0 = no kink
- // 1 = kink daughter
- // -1 = kink mother
- Int_t i, ik[3];
- for (i = 0; i < 3; i++) ik[i] = esdTrack->GetKinkIndex(i);
- if (ik[0] < 0 || ik[1] < 0 || ik[2] < 0) daughter->SetKinkMother();
- else if (ik[0] > 0 || ik[1] > 0 || ik[2] > 0) daughter->SetKinkDaughter();
- else daughter->SetNoKink();
-
- // store PID weights according to definition
- // check: if the sum of all weights is null, the adoption fails
- Double_t sum = 0.0;
- fPIDDef.ComputeWeights(esdTrack, pid);
- for (i = 0; i < AliRsnPID::kSpecies; i++)
- {
- daughter->SetPIDWeight(i, pid[i]);
- sum += pid[i];
- }
- if (sum <= 0.0) return kFALSE;
-
- // compute probabilities
- if (!fPID.ComputeProbs(daughter)) return kFALSE;
-
- // calculate N sigma to vertex
- AliESDtrackCuts trkCut;
- daughter->SetNSigmaToVertex(trkCut.GetSigmaToVertex(esdTrack));
-
- return kTRUE;
-}
-
-//_____________________________________________________________________________
-Bool_t AliRsnReader::ConvertTrack(AliRsnDaughter *daughter, AliAODTrack *aodTrack)
-{
-//
-// Translates an AOD track into a RSN daughter
-//
-
- if (!aodTrack)
- {
- AliError("Passed NULL object: nothing done");
- return kFALSE;
- }
-
- // copy momentum and vertex
- daughter->SetP(aodTrack->Px(), aodTrack->Py(), aodTrack->Pz());
- daughter->SetV(aodTrack->Xv(), aodTrack->Yv(), aodTrack->Zv());
-
- // chi2
- daughter->SetChi2(aodTrack->Chi2perNDF());
-
- // copy PID weights
- Int_t i;
- for (i = 0; i < 5; i++) daughter->SetPIDWeight(i, aodTrack->PID()[i]);
-
- // compute probabilities
- if (!fPID.ComputeProbs(daughter)) return kFALSE;
-
- // copy flags
- daughter->SetFlags(aodTrack->GetStatus());
-
- // copy sign
- daughter->SetCharge(aodTrack->Charge());
-
- return kTRUE;
-}
-
-//_____________________________________________________________________________
-Bool_t AliRsnReader::ConvertTrack(AliRsnDaughter *daughter, TParticle *particle)
-{
-//
-// Translates an MC particle into a RSN daughter
-//
-
- if (!particle) return kFALSE;
-
- // copy other MC info (mother PDG code cannot be retrieved here)
- daughter->InitMCInfo(particle);
-
- // copy momentum and vertex
- daughter->SetP(particle->Px(), particle->Py(), particle->Pz());
- daughter->SetV(particle->Vx(), particle->Vy(), particle->Vz());
-
- // recognize charge sign from PDG code sign
- Int_t pdg = particle->GetPdgCode();
- Int_t absPDG = TMath::Abs(pdg);
- if (absPDG == 11 || absPDG == 13)
- {
- if (pdg > 0) daughter->SetCharge(-1); else daughter->SetCharge(1);
- }
- else if (absPDG == 211 || absPDG == 321 || absPDG == 2212)
- {
- if (pdg > 0) daughter->SetCharge(1); else daughter->SetCharge(-1);
- }
- else
- {
- // when trying to "adopt" a neutral track (photon, neutron, etc.)
- // for the moment a "failed" message is returned
- return kFALSE;
- }
-
- // flags and PID weights make no sense with MC tracks
- daughter->SetFlags(0);
- for (pdg = 0; pdg < AliRsnPID::kSpecies; pdg++) daughter->SetPIDWeight(pdg, 0.0);
- daughter->SetPIDWeight(AliRsnPID::InternalType(absPDG), 1.0);
-
- // compute probabilities
- if (!fPID.ComputeProbs(daughter)) return kFALSE;
-
- return kTRUE;
-}
-
-//_____________________________________________________________________________
-Bool_t AliRsnReader::Fill
-(AliRsnEvent *rsn, AliVEvent *event, AliMCEvent *mc)
-{
-//
-// According to the class type of event and the selected source
-// recalls one of the private reading methods to fill the RsnEvent
-// passed by reference as first argument.
-//
-
- Bool_t success = kFALSE;
- TString str(event->ClassName());
-
- if (!str.CompareTo("AliESDEvent")) {
- AliDebug(1, "Reading an ESD event");
- success = FillFromESD(rsn, (AliESDEvent*)event, mc);
- }
- else if (!str.CompareTo("AliAODEvent")) {
- AliDebug(1, "Reading an AOD event");
- success = FillFromAOD(rsn, (AliAODEvent*)event, mc);
- }
- else if (!str.CompareTo("AliMCEvent")) {
- AliDebug(1, "Reading an MC event");
- success = FillFromMC(rsn, (AliMCEvent*)event);
- }
- else {
- AliError(Form("ClassName '%s' not recognized as possible source data: aborting.", str.Data()));
- return kFALSE;
- }
-
- return success;
-}
-
-//_____________________________________________________________________________
-Bool_t AliRsnReader::FillFromESD(AliRsnEvent *rsn, AliESDEvent *esd, AliMCEvent *mc)
-{
-//
-// Filler from an ESD event.
-// Stores all tracks (if a filter is defined, it will store
-// only the ones which survive the cuts).
-// If a reference MC event is provided, it is used to store
-// the MC informations for each track (true PDG code,
-// GEANT label of mother, PDG code of mother, if any).
-// When this is used, the 'source' flag of the output
-// AliRsnEvent object will be set to 'kESD'.
-//
-
- // retrieve stack (if possible)
- AliStack *stack = 0x0;
- if (mc) stack = mc->Stack();
-
- // set MC primary vertex if present
- TArrayF fvertex(3);
- Double_t mcvx = 0., mcvy = 0., mcvz = 0.;
- if (mc) {
- mc->GenEventHeader()->PrimaryVertex(fvertex);
- mcvx = (Double_t)fvertex[0];
- mcvy = (Double_t)fvertex[1];
- mcvz = (Double_t)fvertex[2];
- rsn->SetPrimaryVertexMC(mcvx, mcvy, mcvz);
- }
-
- // get number of tracks
- Int_t ntracks = esd->GetNumberOfTracks();
- if (!ntracks) return kFALSE;
-
- // set SPD multiplicity
- const AliMultiplicity* SPDMult = esd->GetMultiplicity();
- Int_t nTracklets = SPDMult->GetNumberOfTracklets();
- rsn->SetTrueMultiplicity(nTracklets);
-
- // if required with the flag, scans the event
- // and searches all split tracks (= 2 tracks with the same label);
- // for each pair of split tracks, only the better (best chi2) is kept
- // and the other is rejected: this info is stored into a Boolean array
- Int_t i, i1, i2;
- Bool_t *accept = new Bool_t[ntracks];
- for (i = 0; i < ntracks; i++) accept[i] = kTRUE;
- if (fCheckSplit) {
- for (i1 = 0; i1 < ntracks; i1++) {
- AliESDtrack *track1 = esd->GetTrack(i1);
- for (i2 = i1 + 1; i2 < ntracks; i2++) {
- AliESDtrack *track2 = esd->GetTrack(i2);
- if (AreSplitted(track1, track2)) {
- if (ResolveSplit(track1, track2)) accept[i2] = kFALSE;
- else accept[i1] = kFALSE;
- }
- }
- }
- }
-
- // get primary vertex
- Double_t vertex[3];
- if (!fTPCOnly) {
- // when taking vertex from ESD event there are two options:
- // if a vertex with tracks was successfully reconstructed,
- // it is used for computing DCA;
- // otherwise, the one computed with SPD is used.
- // This is known from the "Status" parameter of the vertex itself.
- const AliESDVertex *v = esd->GetPrimaryVertex();
- if (!v->GetStatus()) v = esd->GetPrimaryVertexSPD();
- if (fCheckVertexStatus && (v->GetStatus() == kFALSE)) return kFALSE;
- if (fMinNContributors > 0 && v->GetNContributors() < fMinNContributors) return kFALSE;
-
- // get primary vertex
- vertex[0] = (Double_t)v->GetXv();
- vertex[1] = (Double_t)v->GetYv();
- vertex[2] = (Double_t)v->GetZv();
- }
- else {
- const AliESDVertex *v = esd->GetPrimaryVertexTPC();
- if (fCheckVertexStatus && v->GetStatus() == kFALSE) return kFALSE;
- if (fMinNContributors > 0 && v->GetNContributors() < fMinNContributors) return kFALSE;
-
- // get primary vertex
- vertex[0] = (Double_t)v->GetXv();
- vertex[1] = (Double_t)v->GetYv();
- vertex[2] = (Double_t)v->GetZv();
- }
- rsn->SetPrimaryVertex(vertex[0], vertex[1], vertex[2]);
-
- // store tracks from ESD
- Float_t p[2], cov[3];
- Int_t index, label, labmum;
- Bool_t check;
- AliRsnDaughter temp;
- AliESDtrack *esdTrack = 0x0, esdTrackTmp;
- for (index = 0; index < ntracks; index++) {
- // skip track recognized as the worse one in a splitted pair
- if (!accept[index]) {
- AliDebug(10, Form("Rejecting split track #%d in this event", index));
- continue;
- }
- // get ESD track
- esdTrack = esd->GetTrack(index);
- // check for ESD track cuts (if required)
- if (fUseESDTrackCuts && (!fESDTrackCuts.AcceptTrack(esdTrack))) continue;
- // check for fake tracks
- label = esdTrack->GetLabel();
- if (fRejectFakes && (label < 0)) continue;
- // check for minimum number of clusters in ITS, TPC and TRD
- if (fITSClusters > 0 && (esdTrack->GetITSclusters(0x0) < fITSClusters)) if (!fTPCOnly) continue;
- if (fTPCClusters > 0 && (esdTrack->GetTPCclusters(0x0) < fTPCClusters)) continue;
- if (fTRDClusters > 0 && (esdTrack->GetTRDclusters(0x0) < fTRDClusters)) if (!fTPCOnly) continue;
- // switch to TPC data if required
- if (fTPCOnly) {
- esdTrack->GetImpactParametersTPC(p, cov);
- if (p[0] == 0. && p[1] == 0.) {
- esdTrack->RelateToVertexTPC(esd->GetPrimaryVertexTPC(), esd->GetMagneticField(), kVeryBig);
- }
- check = esdTrack->FillTPCOnlyTrack(esdTrackTmp);
- if (check) esdTrack = &esdTrackTmp; else continue;
- }
- // try to get information from this track
- // output value tells if this was successful or not
- check = ConvertTrack(&temp, esdTrack);
- if (!check) {
- AliDebug(10, Form("Failed adopting track #%d", index));
- continue;
- }
-
- // if stack is present, copy MC info
- if (stack) {
- TParticle *part = stack->Particle(TMath::Abs(label));
- if (part) {
- temp.InitMCInfo(part);
- labmum = part->GetFirstMother();
- if (labmum >= 0) {
- TParticle *mum = stack->Particle(labmum);
- temp.GetMCInfo()->SetMotherPDG(mum->GetPdgCode());
- }
- }
- }
-
- // set index and label
- temp.SetIndex(index);
- temp.SetLabel(label);
-
- // check this object against the Rsn cuts (if required)
- if (fUseRsnTrackCuts) {
- if (!fRsnTrackCuts.IsSelected(AliRsnCut::kParticle, &temp)) continue;
- }
-
- // try to add track to collection and returns an error in case of problems
- AliRsnDaughter *ptr = rsn->AddTrack(temp);
- if (!ptr) AliWarning(Form("Failed storing track#%d", index));
- }
-
- // compute total multiplicity
- rsn->MakeComputations();
- if (rsn->GetMultiplicity() <= 0) {
- AliDebug(1, "Zero Multiplicity in this event");
- return kFALSE;
- }
-
- // correct tracks for primary vertex
- //rsn->CorrectTracks();
-
- // fill the PID index arrays
- rsn->FillPIDArrays(fPIDArraysSize);
-
- return kTRUE;
-}
-
-//_____________________________________________________________________________
-Bool_t AliRsnReader::FillFromAOD(AliRsnEvent *rsn, AliAODEvent *aod, AliMCEvent *mc)
-{
-//
-// Filler from an AOD event.
-// Stores all tracks (if a filter is defined, it will store
-// only the ones which survive the cuts).
-// If a reference MC event is provided, it is used to store
-// the MC informations for each track (true PDG code,
-// GEANT label of mother, PDG code of mother, if any).
-// When this is used, the 'source' flag of the output
-// AliRsnEvent object will be set to 'kAOD'.
-//
-
- // retrieve stack (if possible)
- AliStack *stack = 0x0;
- if (mc) stack = mc->Stack();
-
- // get number of tracks
- Int_t ntracks = aod->GetNTracks();
- if (!ntracks) return kFALSE;
- rsn->SetTrueMultiplicity(ntracks);
-
- // get primary vertex
- Double_t vertex[3];
- vertex[0] = aod->GetPrimaryVertex()->GetX();
- vertex[1] = aod->GetPrimaryVertex()->GetY();
- vertex[2] = aod->GetPrimaryVertex()->GetZ();
- rsn->SetPrimaryVertex(vertex[0], vertex[1], vertex[2]);
-
- // set MC primary vertex if present
- TArrayF fvertex(3);
- Double_t mcvx = 0., mcvy = 0., mcvz = 0.;
- if (mc) {
- mc->GenEventHeader()->PrimaryVertex(fvertex);
- mcvx = (Double_t)fvertex[0];
- mcvy = (Double_t)fvertex[1];
- mcvz = (Double_t)fvertex[2];
- rsn->SetPrimaryVertexMC(mcvx, mcvy, mcvz);
- }
-
- // store tracks from ESD
- Int_t index, label, labmum;
- Bool_t check;
- AliAODTrack *aodTrack = 0;
- AliRsnDaughter temp;
- TObjArrayIter iter(aod->GetTracks());
- while ((aodTrack = (AliAODTrack*)iter.Next()))
- {
- // retrieve index
- index = aod->GetTracks()->IndexOf(aodTrack);
- label = aodTrack->GetLabel();
- if (fRejectFakes && (label < 0)) continue;
- // copy ESD track data into RsnDaughter
- // if unsuccessful, this track is skipped
- check = ConvertTrack(&temp, aodTrack);
- if (!check) continue;
- // if stack is present, copy MC info
- if (stack)
- {
- TParticle *part = stack->Particle(TMath::Abs(label));
- if (part)
- {
- temp.InitMCInfo(part);
- labmum = part->GetFirstMother();
- if (labmum >= 0)
- {
- TParticle *mum = stack->Particle(labmum);
- temp.GetMCInfo()->SetMotherPDG(mum->GetPdgCode());
- }
- }
- }
- // set index and label and add this object to the output container
- temp.SetIndex(index);
- temp.SetLabel(label);
-
- // check this object against the Rsn cuts (if required)
- if (fUseRsnTrackCuts) {
- if (!fRsnTrackCuts.IsSelected(AliRsnCut::kParticle, &temp)) continue;
- }
-
- AliRsnDaughter *ptr = rsn->AddTrack(temp);
- // if problems occurred while storin, that pointer is NULL
- if (!ptr) AliWarning(Form("Failed storing track#%d"));
- }
-
- // compute total multiplicity
- rsn->MakeComputations();
- if (rsn->GetMultiplicity() <= 0)
- {
- AliDebug(1, "Zero multiplicity in this event");
- return kFALSE;
- }
-
- // fill the PID index arrays
- rsn->FillPIDArrays(fPIDArraysSize);
-
- // correct tracks for primary vertex
- rsn->CorrectTracks();
-
- return kTRUE;
-}
-
-//_____________________________________________________________________________
-Bool_t AliRsnReader::FillFromMC(AliRsnEvent *rsn, AliMCEvent *mc)
-{
-//
-// Filler from an ESD event.
-// Stores all tracks which generate at least one
-// TrackReference (a point in a sensitive volume).
-// In this case, the MC info is stored by default and
-// perfect particle identification is the unique available.
-// When this is used, the 'source' flag of the output
-// AliRsnEvent object will be set to 'kMC'.
-//
-
- // get number of tracks
- Int_t ntracks = mc->GetNumberOfTracks();
- if (!ntracks) return kFALSE;
-
- AliStack *stack = mc->Stack();
-
- // get primary vertex
- TArrayF fvertex(3);
- Double_t vx, vy, vz;
- mc->GenEventHeader()->PrimaryVertex(fvertex);
- vx = (Double_t)fvertex[0];
- vy = (Double_t)fvertex[1];
- vz = (Double_t)fvertex[2];
- rsn->SetPrimaryVertex(vx, vy, vz);
- rsn->SetPrimaryVertexMC(vx, vy, vz);
- rsn->SetTrueMultiplicity(stack->GetNprimary());
-
- // store tracks from MC
- Int_t i, index, labmum, nRef, nRefITS, nRefTPC, detectorID;
- AliRsnDaughter temp;
- for (index = 0; index < ntracks; index++)
- {
- // get MC track & take index and label
- AliMCParticle *mcTrack = mc->GetTrack(index);
- temp.SetIndex(index);
- temp.SetLabel(mcTrack->Label());
-
- // check particle track references
- nRef = mcTrack->GetNumberOfTrackReferences();
- for (i = 0, nRefITS = 0, nRefTPC = 0; i < nRef; i++) {
- AliTrackReference *trackRef = mcTrack->GetTrackReference(i);
- if (!trackRef) continue;
- detectorID = trackRef->DetectorId();
- switch (detectorID) {
- case AliTrackReference::kITS : nRefITS++; break;
- case AliTrackReference::kTPC : nRefTPC++; break;
- default: break;
- }
- }
- if (fTrackRefs > 0 && nRef < fTrackRefs) continue;
- if (fTrackRefsITS > 0 && nRefITS < fTrackRefsITS) continue;
- if (fTrackRefsTPC > 0 && nRefTPC < fTrackRefsTPC) continue;
-
- // try to insert in the RsnDaughter its data
- TParticle *mcPart = mcTrack->Particle();
- if (!ConvertTrack(&temp, mcPart)) continue;
-
- // assign mother label and PDG code (if any)
- labmum = temp.GetMCInfo()->Mother();
- if (labmum >= 0) {
- TParticle *mum = stack->Particle(labmum);
- temp.GetMCInfo()->SetMotherPDG(mum->GetPdgCode());
- }
-
- // check this object against the Rsn cuts (if required)
- if (fUseRsnTrackCuts) {
- if (!fRsnTrackCuts.IsSelected(AliRsnCut::kParticle, &temp)) continue;
- }
-
- AliRsnDaughter *ptr = rsn->AddTrack(temp);
- if (!ptr) AliWarning(Form("Failed storing track #%d", index));
- }
-
- // compute total multiplicity
- rsn->MakeComputations();
- if (rsn->GetMultiplicity() <= 0)
- {
- AliDebug(1, "Zero multiplicity in this event");
- return kFALSE;
- }
-
- // fill the PID index arrays
- rsn->FillPIDArrays(fPIDArraysSize);
-
- // correct tracks for primary vertex
- rsn->CorrectTracks();
-
- return kTRUE;
-}
+++ /dev/null
-//
-// Class AliRsnReaderTask
-//
-// An AnalysisTask object to convert any kind of source event type (ESD/AOD/MC)
-// into the RSN internal format (AliRsnEvent).
-// The output of this task is a TTree with converted events, which is saved in a file
-// and can then be processed as many times as desired, to build invariant mass spectra.
-// ---
-// authors: Martin Vala (martin.vala@cern.ch)
-// Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it)
-//
-
-#include "AliLog.h"
-
-#include "AliAnalysisManager.h"
-#include "AliMCEventHandler.h"
-#include "AliMCEvent.h"
-#include "AliESDInputHandler.h"
-#include "AliAODInputHandler.h"
-#include "AliAODHandler.h"
-
-#include "AliRsnEvent.h"
-#include "AliRsnReader.h"
-#include "AliRsnPID.h"
-#include "AliRsnReaderTask.h"
-
-ClassImp(AliRsnReaderTask)
-
-//_____________________________________________________________________________
-AliRsnReaderTask::AliRsnReaderTask() :
- AliRsnAnalysisTaskBase(),
- fRsnTree(0x0)
-{
-//=========================================================
-// Default constructor (not recommended)
-//=========================================================
-}
-
-//_____________________________________________________________________________
-AliRsnReaderTask::AliRsnReaderTask(const char *name) :
- AliRsnAnalysisTaskBase(name),
- fRsnTree(0x0)
-{
-//=========================================================
-// Working constructor (recommended)
-//=========================================================
- InitIOVars();
- DefineOutput(0, TTree::Class());
-}
-
-//_____________________________________________________________________________
-AliRsnReaderTask::AliRsnReaderTask(const AliRsnReaderTask& obj) :
- AliRsnAnalysisTaskBase(obj),
- fRsnTree(0x0)
-{
-//=========================================================
-// Copy constructor (not recommended)
-//=========================================================
-}
-
-//_____________________________________________________________________________
-AliRsnReaderTask& AliRsnReaderTask::operator= (const AliRsnReaderTask& /*obj*/)
-{
-//=========================================================
-// Assignment operator (not recommended)
-//=========================================================
-
- AliInfo("Not implemented. Avoid using the assignment operator");
- return *this;
-}
-
-//_____________________________________________________________________________
-void AliRsnReaderTask::InitIOVars()
-{
-//=========================================================
-// Init values for input and output data
-//=========================================================
- AliDebug(AliLog::kDebug, "<-");
- AliRsnAnalysisTaskBase::InitIOVars();
- AliDebug(AliLog::kDebug, "->");
-}
-
-//_____________________________________________________________________________
-void AliRsnReaderTask::CreateOutputObjects()
-{
-//=========================================================
-// Create the output container
-//=========================================================
-
- AliDebug(1, "Creating output objects");
- OpenFile(0);
- fRsnTree = new TTree("aodTree", "AliRsnEvents");
-
- fRSN[0] = new AliRsnEvent();
- fRSN[0]->SetName("rsnEvents");
- fRSN[0]->Init();
- fRsnTree->Branch("rsnEvents","AliRsnEvent",&fRSN[0]);
-// AddAODBranch("AliRsnEvent", &fRsnEvent);
-}
-
-//_____________________________________________________________________________
-void AliRsnReaderTask::LocalInit()
-{
-//=========================================================
-// Initialization
-//=========================================================
-
- AliDebug(1, "Initializing");
-}
-
-Bool_t AliRsnReaderTask::Notify()
-{
- return kTRUE;
-}
-
-//_____________________________________________________________________________
-void AliRsnReaderTask::Exec(Option_t */*option*/)
-{
-//=========================================================
-// Loops on input container to store data of all tracks.
-// Uses the AliRsnReader methods to save them in the output.
-//=========================================================
-
- fRSN[0] = GetRsnEventFromInputType(0);
- if (!fRSN[0]) return;
-
- AliDebug(1, Form("Collected %d tracks", fRSN[0]->GetMultiplicity()));
-
- fRsnTree->Fill();
- PostData(0, fRsnTree);
-}
-
-//_____________________________________________________________________________
-void AliRsnReaderTask::Terminate(Option_t */*option*/)
-{
-//=========================================================
-// Terminate analysis
-//=========================================================
-
- AliDebug(1, "Terminating");
-}
-
+++ /dev/null
-//
-// Class AliRsnReaderTaskSE
-//
-// An AnalysisTask object to convert any kind of source event type (ESD/AOD/MC)
-// into the RSN internal format (AliRsnEvent).
-// The output of this task is a TTree with converted events, which is saved in a file
-// and can then be processed as many times as desired, to build invariant mass spectra.
-// ---
-// original author: A. Pulvirenti (alberto.pulvirenti@ct.infn.it)
-// adapted for Analysis Framework by: R. Vernet (renaud.vernet@cern.ch)
-//
-
-#include "AliLog.h"
-
-#include "AliAnalysisManager.h"
-
-#include "AliMCEvent.h"
-#include "AliMCEventHandler.h"
-
-#include "AliESDInputHandler.h"
-#include "AliAODInputHandler.h"
-#include "AliAODHandler.h"
-
-#include "AliRsnPID.h"
-#include "AliRsnEvent.h"
-#include "AliRsnReader.h"
-#include "AliRsnReaderTaskSE.h"
-
-ClassImp(AliRsnReaderTaskSE)
-
-//_____________________________________________________________________________
-AliRsnReaderTaskSE::AliRsnReaderTaskSE() :
- AliRsnAnalysisTaskSEBase(),
- fRsnEvent(0x0)
-{
-//
-// Default constructor (not recommended)
-//
-}
-
-//_____________________________________________________________________________
-AliRsnReaderTaskSE::AliRsnReaderTaskSE(const char *name) :
- AliRsnAnalysisTaskSEBase(name),
- fRsnEvent(0x0)
-{
-//
-// Working constructor (recommended)
-//
-}
-
-//_____________________________________________________________________________
-void AliRsnReaderTaskSE::UserCreateOutputObjects()
-{
-//
-// Instantiates the output object (AliRsnEvent) and adds a branch
-// to the non-standard AOD output TTree to include it.
-// Checks that the necessary data member objects for
-// conversion and PID are allocated. If this is not the case,
-// raises a fatal error which breaks the AliRoot session.
-//
-
- fRsnEvent = new AliRsnEvent();
- fRsnEvent->SetName("rsnEvents");
- fRsnEvent->Init();
- AddAODBranch("AliRsnEvent", &fRsnEvent);
-}
-
-//_____________________________________________________________________________
-void AliRsnReaderTaskSE::Init()
-{
-//
-// Inherited function.
-// Here it does not need to do anything, so it is left dummy.
-//
-}
-
-//_____________________________________________________________________________
-void AliRsnReaderTaskSE::UserExec(Option_t */*option*/)
-{
-//
-// Execution core of the class.
-// Uses the AliRsnReader and AliRsnPID methods to convert input data
-// and store them in the output AOD event, with all required computations.
-//
-
- AliDebug(1,Form("Reading event %d", ++fEntry));
-
- // before adding new data, the ones from previous event
- // must be cleared explicitly
- fRsnEvent->Clear();
-
-
- // step 1: conversion
- Bool_t ok = kFALSE;
- switch (fInputType[0])
- {
- case kAOD:
- AliDebug(5, "Reading AOD event...");
- ok = fReader.FillFromAOD(fRsnEvent, (AliAODEvent*)fInputEvent, fMCEvent);
- AliDebug(5, "...done");
- break;
- case kESD:
- AliDebug(5, "Reading ESD event...");
- ok = fReader.FillFromESD(fRsnEvent, (AliESDEvent*)fInputEvent, fMCEvent);
- AliDebug(5, "...done");
- break;
- case kESDMC:
- AliDebug(5, "Reading ESD event with MC...");
- ok = fReader.FillFromESD(fRsnEvent, (AliESDEvent*)fInputEvent, fMCEvent);
- AliDebug(5, "...done");
- break;
- case kMC:
- AliDebug(5, "Reading MC only event...");
- ok = fReader.FillFromMC(fRsnEvent, fMCEvent);
- AliDebug(5, "...done");
- break;
- default:
- AliError("Type not supported ...");
- return;
- }
- if (!ok) AliWarning("Failed reading");
-
- // step 2: PID probability computation
- //if (!fPID.Process(fRsnEvent)) AliWarning("Failed PID");
-
- AliDebug(1,Form("Collected %d tracks", fRsnEvent->GetMultiplicity()));
-}
-
-//_____________________________________________________________________________
-void AliRsnReaderTaskSE::Terminate(Option_t */*option*/)
-{
-//
-// Inherited function.
-// Here it does not need to do anything, so it is left dummy.
-//
-}
//_____________________________________________________________________________
AliRsnVATProcessInfo::AliRsnVATProcessInfo(const char *name) : TNamed(name,name),
fHistUsedEvents(0x0),
+ fNumOfTracks(0),
fPrintInfoNumber(1000)
{
AliDebug(AliLog::kDebug+2,"<-");
//_____________________________________________________________________________
AliRsnVATProcessInfo::AliRsnVATProcessInfo(const AliRsnVATProcessInfo& copy) : TNamed(copy),
fHistUsedEvents(copy.fHistUsedEvents),
+ fNumOfTracks(copy.fNumOfTracks),
fPrintInfoNumber(copy.fPrintInfoNumber)
{
if ((num+1)%fPrintInfoNumber == 0){
AliInfo(Form("Events processed %d",num+1));
}
-
+
}