AliDebug(AliLog::kDebug, "<-");
// fPID.DumpPriors();
- OpenFile ( 0 );
+ OpenFile(0);
fOutList = new TList();
fOutList->SetOwner();
AliRsnPair *def=0;
if (def)
{
def->Init();
- //listTmp->Add(def->GenerateHistograms(mgr->GetName()));
- def->GenerateHistograms(mgr->GetName(), listTmp);
+ listTmp->Add(def->GenerateHistograms(mgr->GetName()));
+ //def->GenerateHistograms(mgr->GetName(), listTmp);
//def->Print();
}
}
fOutList->Add(listTmp);
}
- fRsnEventBuffer = new AliRsnEventBuffer(100);
+ fRsnEventBuffer = new AliRsnEventBuffer(1000);
// fRsnEventBuffer = new AliRsnEventBuffer ( 10000 ,kFALSE );
AliDebug(AliLog::kDebug, "->");
//=========================================================
if (fEntry++%1000==0)
- AliInfo(Form("Event %d",-1));
+ AliInfo(Form("Event %d",fEntry-1));
AliRsnEvent *curEvent = GetRsnEventFromInputType();
if (!curEvent) return;
public:
AliRsnAnalysisSE(const char *name = "AliRsnAnalysisSE");
AliRsnAnalysisSE(const AliRsnAnalysisSE& copy): AliRsnAnalysisTaskSEBase(copy),
- fPairMgrs(0),fOutList(0x0),fRsnEventBuffer(0x0),fNumOfEventsInBuffer(100) {}
+ fPairMgrs(0),fOutList(0x0),fRsnEventBuffer(0x0),fNumOfEventsInBuffer(100) {}
AliRsnAnalysisSE& operator= (const AliRsnAnalysisSE&) {return *this;}
~AliRsnAnalysisSE();
//_____________________________________________________________________________
AliRsnAnalysisTask2ndStep::AliRsnAnalysisTask2ndStep(const char *name) :
- AliAnalysisTaskSE(name),
- fOutList(0x0),
- fPairMgrs(0x0),
- fEventBuffer(0x0),
- fRsnHandlerAOD(0x0),
- fAnalysisMgr(0x0)
+ AliAnalysisTaskSE(name),
+ fOutList(0x0),
+ fPairMgrs(0x0),
+ fEventBuffer(0x0),
+ fRsnHandlerAOD(0x0),
+ fAnalysisMgr(0x0)
{
//
// Default constructor
//
- DefineOutput(1, TList::Class());
+ DefineOutput(1, TList::Class());
}
//_____________________________________________________________________________
// 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);
+ 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);
}
//_____________________________________________________________________________
//
// 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;
+ 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);
}
-
- 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("<---");
+ fOutList->Add(listTmp);
+ }
+ fEventBuffer = new AliRsnEventBuffer(1000);
+
+ AliInfo("<---");
}
//_____________________________________________________________________________
//
// 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);
+
+ 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);
}
//_____________________________________________________________________________
// A simple check on the output list
//
- fOutList = dynamic_cast<TList*>(GetOutputData(1));
- if (!fOutList) { AliError("--- Output list not available ---"); return; }
- fOutList->Print();
+ fOutList = dynamic_cast<TList*>(GetOutputData(1));
+ if (!fOutList) { AliError("--- Output list not available ---"); return; }
+ fOutList->Print();
}
//_____________________________________________________________________________
// 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);
- }
+ // 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::AddPairMgr(AliRsnPairMgr *pairmgr)
{
- if (!fPairMgrs) fPairMgrs = new TObjArray;
- fPairMgrs->Add(pairmgr);
+ if (!fPairMgrs) fPairMgrs = new TObjArray;
+ fPairMgrs->Add(pairmgr);
}
void PostEventProcess();
private:
-
+
AliRsnAnalysisTask2ndStep(const AliRsnAnalysisTask2ndStep& copy) :
AliAnalysisTaskSE(copy),fOutList(0x0),fPairMgrs(0x0),fEventBuffer(0x0),
fRsnHandlerAOD(0x0),fAnalysisMgr(0x0) {}
AliRsnAnalysisTask2ndStep& operator= (const AliRsnAnalysisTask2ndStep&) {return *this;}
-
+
TList *fOutList; // list of output histograms
TObjArray *fPairMgrs; // array if pair managers used
AliRsnEventBuffer *fEventBuffer; // event buffer
//
-// Class AliRsnBaseAT
+// Class AliRsnAnalysisTaskBase
//
// TODO
//
#include "AliRsnEvent.h"
#include "AliMCEvent.h"
-#include "AliRsnBaseAT.h"
+#include "AliRsnAnalysisTaskBase.h"
-ClassImp(AliRsnBaseAT)
+ClassImp(AliRsnAnalysisTaskBase)
//________________________________________________________________________
-AliRsnBaseAT::AliRsnBaseAT(const char *name)
+AliRsnAnalysisTaskBase::AliRsnAnalysisTaskBase(const char *name)
: AliAnalysisTask(name, ""),
fNumOfEvents(100),
fUseAutoHandler(100),
}
//________________________________________________________________________
-void AliRsnBaseAT::InitIOVars()
+void AliRsnAnalysisTaskBase::InitIOVars()
{
//=========================================================
// Initial values for constructor
}
//________________________________________________________________________
-void AliRsnBaseAT::LocalInit()
+void AliRsnAnalysisTaskBase::LocalInit()
{
//=========================================================
// LocalInit()
}
//________________________________________________________________________
-Bool_t AliRsnBaseAT::Notify()
+Bool_t AliRsnAnalysisTaskBase::Notify()
{
//=========================================================
// Notify()
}
//________________________________________________________________________
-void AliRsnBaseAT::SetInputType(EInputType type,AliAnalysisManager* am,Bool_t autohandler, Short_t inputIndex)
+void AliRsnAnalysisTaskBase::SetInputType(EInputType type,AliAnalysisManager* am,Bool_t autohandler, Short_t inputIndex)
{
//=========================================================
// Sets input type.
}
//________________________________________________________________________
-void AliRsnBaseAT::ConnectInputData(Option_t *)
+void AliRsnAnalysisTaskBase::ConnectInputData(Option_t *)
{
//=========================================================
// ConectInputData() for AliAnalysisTask
-// just define myTask->SetInputType ( AliRsnBaseAT::kRSN ); for Rsn input
-// just define myTask->SetInputType ( AliRsnBaseAT::kESDMC ); for ESD and MC input
-// just define myTask->SetInputType ( AliRsnBaseAT::kAOD ); for Rsn input
+// 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 AliRsnBaseAT::ConnectInputDataByInputType(EInputType type ,Short_t inputIndex)
+void AliRsnAnalysisTaskBase::ConnectInputDataByInputType(EInputType type ,Short_t inputIndex)
{
//=========================================================
// Connect input data by input type
AliDebug(AliLog::kDebug, "->");
}
//________________________________________________________________________
-void AliRsnBaseAT::ConnectRSN(Short_t inputIndex)
+void AliRsnAnalysisTaskBase::ConnectRSN(Short_t inputIndex)
{
//=========================================================
// Connect input data by RSN input type
AliDebug(AliLog::kDebug, "->");
}
-void AliRsnBaseAT::ConnectESD(Short_t inputIndex)
+void AliRsnAnalysisTaskBase::ConnectESD(Short_t inputIndex)
{
//=========================================================
// Connect input data by ESD input type
}
//________________________________________________________________________
-void AliRsnBaseAT::ConnectESDMC(Short_t inputIndex)
+void AliRsnAnalysisTaskBase::ConnectESDMC(Short_t inputIndex)
{
//=========================================================
// Connect input data by ESDMC input type
}
//________________________________________________________________________
-void AliRsnBaseAT::ConnectAOD(Short_t inputIndex)
+void AliRsnAnalysisTaskBase::ConnectAOD(Short_t inputIndex)
{
//=========================================================
// Connect input data by AOD input type
}
//________________________________________________________________________
-AliRsnEvent * AliRsnBaseAT::GetRsnEventFromInputType(const Short_t & index)
+AliRsnEvent * AliRsnAnalysisTaskBase::GetRsnEventFromInputType(const Short_t & index)
{
//=========================================================
// Gets Evetn from input type
//________________________________________________________________________
-AliRsnEvent * AliRsnBaseAT::GetRsnFromAOD(const Short_t & index)
+AliRsnEvent * AliRsnAnalysisTaskBase::GetRsnFromAOD(const Short_t & index)
{
//=========================================================
// Gets RSN event from AOD
}
//________________________________________________________________________
-AliRsnEvent * AliRsnBaseAT::GetRsnFromESD(const Short_t & index)
+AliRsnEvent * AliRsnAnalysisTaskBase::GetRsnFromESD(const Short_t & index)
{
//=========================================================
// Gets RSN event from ESD
return fRSN[index];
}
//________________________________________________________________________
-AliRsnEvent * AliRsnBaseAT::GetRsnFromESDMC(const Short_t & index)
+AliRsnEvent * AliRsnAnalysisTaskBase::GetRsnFromESDMC(const Short_t & index)
{
//=========================================================
// Gets RSN event from ESD and MC
return fRSN[index];
}
//________________________________________________________________________
-AliRsnEvent * AliRsnBaseAT::GetRsnFromRSN(const Short_t & index)
+AliRsnEvent * AliRsnAnalysisTaskBase::GetRsnFromRSN(const Short_t & index)
{
//=========================================================
// Gets RSN event from RSN
}
//________________________________________________________________________
-void AliRsnBaseAT::UseAutoHandler(const Bool_t & theValue)
+void AliRsnAnalysisTaskBase::UseAutoHandler(const Bool_t & theValue)
{
//=========================================================
// Sets should create handlers
//\r
-// Class AliRsnBaseAT\r
+// Class AliRsnAnalysisTaskBase\r
//\r
// TODO\r
//\r
// authors: Martin Vala (martin.vala@cern.ch)\r
// Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it)\r
//\r
-#ifndef ALIRSNBASEAT_H\r
-#define ALIRSNBASEAT_H\r
+#ifndef ALIRSNANALYSISTASKBASE_H\r
+#define ALIRSNANALYSISTASKBASE_H\r
\r
#include <TChain.h>\r
\r
#include "AliAODInputHandler.h"\r
\r
\r
-class AliRsnBaseAT : public AliAnalysisTask\r
+class AliRsnAnalysisTaskBase : public AliAnalysisTask\r
{\r
public:\r
- AliRsnBaseAT(const char *name = "AliRsnBaseAT");\r
- AliRsnBaseAT(const AliRsnBaseAT& copy):AliAnalysisTask(copy),\r
- fNumOfEvents(0),fUseAutoHandler(kTRUE),\r
- fRsnInput(1),fReader(),fPID(),fAnalysisMgr(0x0) {}\r
- AliRsnBaseAT& operator= (const AliRsnBaseAT&) {return *this;}\r
- virtual ~AliRsnBaseAT() {/* Does nothing*/}\r
+ AliRsnAnalysisTaskBase(const char *name = "AliRsnAnalysisTaskBase");\r
+ AliRsnAnalysisTaskBase(const AliRsnAnalysisTaskBase& copy):AliAnalysisTask(copy),\r
+ fNumOfEvents(0),fUseAutoHandler(kTRUE),\r
+ fRsnInput(1),fReader(),fPID(),fAnalysisMgr(0x0) {}\r
+ AliRsnAnalysisTaskBase& operator= (const AliRsnAnalysisTaskBase&) {return *this;}\r
+ virtual ~AliRsnAnalysisTaskBase() {/* Does nothing*/}\r
\r
enum EInputType\r
{\r
\r
AliRsnReader *GetReader() { return &fReader; }\r
AliRsnPID *GetPID() { return &fPID;}\r
- \r
+\r
protected:\r
\r
Long64_t fNumOfEvents; // number of events\r
virtual AliRsnEvent* GetRsnFromRSN(const Short_t &index=0);\r
\r
\r
- ClassDef(AliRsnBaseAT, 1)\r
+ ClassDef(AliRsnAnalysisTaskBase, 1)\r
};\r
\r
#endif\r
//_____________________________________________________________________________
AliRsnAnalysisTaskSEBase::AliRsnAnalysisTaskSEBase(const char *name) :
- AliAnalysisTaskSE(name),
- fUseAutoHandler(kTRUE),
- fReader(),
- fPID(),
- fAnalysisMgr(0x0) // pointer to current AnalysisMgr
+ AliAnalysisTaskSE(name),
+ fUseAutoHandler(kTRUE),
+ fReader(),
+ fPID(),
+ fAnalysisMgr(0x0) // pointer to current AnalysisMgr
{
//
// Default constructor
//
- InitIOVars();
- DefineInput(0, TChain::Class());
+ InitIOVars();
+ DefineInput(0, TChain::Class());
}
//_____________________________________________________________________________
//
// 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;
+
+ 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;
}
//_____________________________________________________________________________
//
// LocalInit()
//
- AliAnalysisTaskSE::LocalInit();
+ AliAnalysisTaskSE::LocalInit();
}
//_____________________________________________________________________________
// Notify()
//
- return AliAnalysisTaskSE::Notify();
+ return AliAnalysisTaskSE::Notify();
}
//_____________________________________________________________________________
// 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:
- fRsnESDEH[0] = new AliESDInputHandler();
- if (fRsnESDEH[0]) fAnalysisMgr->SetInputEventHandler(fRsnESDEH[0]);
- break;
- case kESDMC:
- fRsnESDEH[0] = new AliESDInputHandler();
- fRsnMCEH[0] = new AliMCEventHandler();
- if ((fRsnESDEH[0]) && (fRsnMCEH[0])) {
- fAnalysisMgr->SetInputEventHandler(fRsnESDEH[0]);
- fAnalysisMgr->SetMCtruthEventHandler(fRsnMCEH[0]);
- }
- break;
- case kMC:
- fRsnMCEH[0] = new AliMCEventHandler();
- if (fRsnMCEH[0]) {
- fAnalysisMgr->SetMCtruthEventHandler(fRsnMCEH[0]);
- }
- break;
- case kRSN:
- AliError("Not Implemented Yet ...");
- break;
- default:
- AliError("Type not supported ...");
- break;
- }
+ 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:
+ fRsnESDEH[0] = new AliESDInputHandler();
+ if (fRsnESDEH[0]) fAnalysisMgr->SetInputEventHandler(fRsnESDEH[0]);
+ break;
+ case kESDMC:
+ 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:
+// AliError("Not Implemented Yet ...");
+ break;
+ default:
+ AliError("Type not supported ...");
+ break;
+ }
}
//_____________________________________________________________________________
// 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);
+ if (fInputType[0] != kRSN) AliAnalysisTaskSE::ConnectInputData();
+
+ // connects input handlers according to the type of analysis being done
+ ConnectInputDataByInputType(fInputType[0], 0);
}
//_____________________________________________________________________________
//
// Connect input data dependint on the input type used.
//
- AliDebug(AliLog::kDebug, "<-");
-
- switch (type)
- {
- case kAOD:
- ConnectAOD(inputIndex);
- break;
- case kESD:
- ConnectESD(inputIndex);
- break;
- case kESDMC:
- ConnectESDMC(inputIndex);
- break;
- case kMC:
- ConnectESDMC(inputIndex);
- break;
- case kRSN:
- ConnectRSN(inputIndex);
- break;
- default:
- AliError("Type not supported ...");
- break;
- }
-
- AliDebug(AliLog::kDebug, "->");
+ AliDebug(AliLog::kDebug, "<-");
+
+ switch (type)
+ {
+ case kAOD:
+ ConnectAOD(inputIndex);
+ break;
+ case kESD:
+ ConnectESD(inputIndex);
+ break;
+ case kESDMC:
+ 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, "->");
+ 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, "->");
}
//_____________________________________________________________________________
// Connect input data by ESD input type
//
- AliDebug(AliLog::kDebug, "<-");
- fRsnESD[inputIndex] = (AliESDEvent*)fInputEvent;
- AliDebug(AliLog::kDebug, "->");
+ AliDebug(AliLog::kDebug, "<-");
+ fRsnESD[inputIndex] = (AliESDEvent*)fInputEvent;
+ AliDebug(AliLog::kDebug, "->");
}
// Connect input data by ESDMC input type
//
- AliDebug(AliLog::kDebug, "<-");
- fRsnESD[inputIndex] = (AliESDEvent*)fInputEvent;
- //fRSNMC[inputIndex] = fMCEvent;
- AliDebug(AliLog::kDebug, "->");
+ AliDebug(AliLog::kDebug, "<-");
+ fRsnESD[inputIndex] = (AliESDEvent*)fInputEvent;
+ //fRSNMC[inputIndex] = fMCEvent;
+ AliDebug(AliLog::kDebug, "->");
}
//_____________________________________________________________________________
// Connect input data by AOD input type
//
- AliDebug(AliLog::kDebug, "<-");
+ 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();
+ }
- 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, "->");
+ AliDebug(AliLog::kDebug, "->");
}
//_____________________________________________________________________________
// Gets Event from input type
//
- switch (fInputType[index])
- {
- case kAOD: return GetRsnFromAOD(index);
- case kESD: return GetRsnFromESD(index);
- case kESDMC: return GetRsnFromESDMC(index);
- case kMC: return GetRsnFromMC(index);
- case kRSN: return GetRsnFromRSN(index);
- default:
- AliError("Type not supported ...");
- return (AliRsnEvent*) 0x0;
- }
-
- return (AliRsnEvent*) 0x0;
+ switch (fInputType[index])
+ {
+ case kAOD: return GetRsnFromAOD(index);
+ case kESD: return GetRsnFromESD(index);
+ case kESDMC: return GetRsnFromESDMC(index);
+ case kMC: return GetRsnFromMC(index);
+ case kRSN: return GetRsnFromRSN(index);
+ default:
+ AliError("Type not supported ...");
+ return (AliRsnEvent*) 0x0;
+ }
+
+ return (AliRsnEvent*) 0x0;
}
//_____________________________________________________________________________
// 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];
+ 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];
}
//_____________________________________________________________________________
// 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])) return (AliRsnEvent*) 0x0;
-
- if (!fPID.Process(fRSN[index]))
- {
- AliWarning("Failed PID");
- return (AliRsnEvent*) 0x0;
- }
-
- return fRSN[index];
+ 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])) return (AliRsnEvent*) 0x0;
+
+ if (!fPID.Process(fRSN[index]))
+ {
+ AliWarning("Failed PID");
+ return (AliRsnEvent*) 0x0;
+ }
+
+ return fRSN[index];
}
//_____________________________________________________________________________
// Gets RSN event from ESD
//
- if (!fRSN[index])
- {
- fRSN[index] = new AliRsnEvent();
- fRSN[index]->SetName("rsnEvents");
- fRSN[index]->Init();
- }
-
- // clear pevious event
- fRSN[index]->Clear();
- fRsnMC[index] = MCEvent();
-
- if (!fReader.FillFromMC(fRSN[index], fRsnMC[index])) return (AliRsnEvent*) 0x0;
- fRSN[index]->FillPIDArrays();
- return fRSN[index];
+ 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;
+ //if (!fReader.FillFromESD(fRSN[index], fRsnESD[index], fRsnMC[index])) return (AliRsnEvent*) 0x0;
+ fPID.Process(fRSN[index]);
+ fRSN[index]->FillPIDArrays(3000);
+ return fRSN[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];
+ 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];
}
//_____________________________________________________________________________
// Gets RSN event from RSN
// not fully implemented yet
//
- AliRsnEvent *event = fRSN[index];
- return event;
+ AliRsnEvent *event = fRSN[index];
+ return event;
}
\r
enum EInputType\r
{\r
- kAOD = 0,\r
- kESD,\r
- kESDMC,\r
- kMC,\r
- kRSN,\r
- kLastIndex\r
+ kAOD = 0,\r
+ kESD,\r
+ kESDMC,\r
+ kMC,\r
+ kRSN,\r
+ kLastIndex\r
};\r
\r
virtual void InitIOVars();\r
//________________________________________________________________________
AliRsnComparisonAT::AliRsnComparisonAT(const char*name)
- : AliRsnBaseAT(name),fOutList(0x0),fMyInputNum(1),fMyPIDInputNum(0)
+ : AliRsnAnalysisTaskBase(name),fOutList(0x0),fMyInputNum(1),fMyPIDInputNum(0)
{
//=========================================================
// Default constructor
// Sets default values for input and output
//=========================================================
AliDebug(AliLog::kDebug, "<-");
- AliRsnBaseAT::InitIOVars();
+ AliRsnAnalysisTaskBase::InitIOVars();
fOutList = 0;
AliDebug(AliLog::kDebug, "->");
}
#include "AliRsnDaughter.h"
#include "AliRsnEvent.h"
-#include "AliRsnBaseAT.h"
+#include "AliRsnAnalysisTaskBase.h"
#include "AliRsnCut.h"
#include "AliRsnCutSet.h"
-class AliRsnComparisonAT : public AliRsnBaseAT
+class AliRsnComparisonAT : public AliRsnAnalysisTaskBase
{
public:
private:
-
+
AliRsnComparisonAT(const AliRsnComparisonAT&)
- : AliRsnBaseAT(""),fOutList(0x0),fMyInputNum(1),fMyPIDInputNum(0) {}
+ : AliRsnAnalysisTaskBase(""),fOutList(0x0),fMyInputNum(1),fMyPIDInputNum(0) {}
AliRsnComparisonAT& operator=(const AliRsnComparisonAT&) {return *this;}
TList *fOutList; // output list
kY,
kLastParameterType
};
-
+
enum EHistoType
{
kIndent=0,
void FillPIDHistograms(AliRsnDaughter *daughter);
void FillPIDHistograms(AliESDtrack *track,AliMCEvent *mc=0);
void FillPIDHistograms(AliMCParticle *mctrack);
-
+
void FillHistograms(AliMCParticle *mctrack);
void SetCurrentESDPID(const EPIDType& type,const Double_t&divValue = 0.0);
void SetESDstatus(const ULong_t status);
void SetESDTrackQualityCuts(const Int_t& its=-1,const Int_t& tpc=-1,const Int_t& trd=-1);
private:
-
- AliRsnComparisonObj(const AliRsnComparisonObj& copy)
- : TNamed(copy),fCurrentComparisonType(kParticleInfo),fCurrentESDPID(kEsd),
- fESDstatus(0),fITSClusters(0),fTPCClusters(0),fTRDClusters(0),fPIDDivValue(0.) {}
+
+ AliRsnComparisonObj(const AliRsnComparisonObj& copy)
+ : TNamed(copy),fCurrentComparisonType(kParticleInfo),fCurrentESDPID(kEsd),
+ fESDstatus(0),fITSClusters(0),fTPCClusters(0),fTRDClusters(0),fPIDDivValue(0.) {}
const AliRsnComparisonObj& operator=(const AliRsnComparisonObj&) {return *this;}
EComparisonType fCurrentComparisonType;
Int_t fITSClusters;
Int_t fTPCClusters;
Int_t fTRDClusters;
-
+
Double_t fPIDDivValue;
TH1D *fHistosPartInfo[kLastParameterType][2][AliRsnPID::kSpeciesAll];
TH1D *fHistosPID[kLastFormat][kLastHistoType][AliRsnPID::kSpecies+1];
-
+
TString GetFormatName(EFormat type);
TString GetHistoTypeName(EHistoType type);
case kEtaMC:
if (mcinfo) return IsBetween(mcinfo->Eta());
else return kTRUE;
+ case kNSigma:
+ return IsBetween(daughter->NSigmaToVertex());
/*
- case kEsdNSigma:
- return IsBetween (daughter->GetNSigma());
case kEsdNSigmaCalculate:
- return IsBetween (daughter->GetESDInfo()->GetNSigmaCalculate());
+ return IsBetween (daughter->GetESDInfo()->GetNSigmaCalculate());
*/
default:
AliWarning("Requested a cut which cannot be applied to a single track");
return kTRUE;
}
+//________________________________________________________________________________________________________________
+Bool_t AliRsnCut::IsSelected(ETarget type, AliRsnEvent * ev1, AliRsnEvent * ev2)
+{
+ AliDebug(AliLog::kDebug, "<-");
+
+ Double_t valueD;
+ Int_t valueI;
+
+ switch (fType)
+ {
+ case kMultiplicityDifference:
+ valueI = TMath::Abs(ev1->GetMultiplicity() - ev2->GetMultiplicity());
+ return IsBetween((Int_t)valueI);
+ case kVzDifference:
+ valueD = TMath::Abs(ev1->GetVz() - ev2->GetVz());
+ return IsBetween((Double_t)valueD);
+ case kPhiMeanDifference:
+ valueD = TMath::Abs(ev1->GetPhiMean() - ev2->GetPhiMean());
+ return IsBetween((Double_t)valueD);
+ default:
+ AliWarning("Requested a cut which cannot be applied to an event");
+ return kTRUE;
+ }
+
+ return kTRUE;
+}
+
//________________________________________________________________________________________________________________
void AliRsnCut::PrintAllValues()
{
kPIDType,
kPIDProb,
kMultiplicity,
+ kMultiplicityDifference,
+ kPhiMeanDifference,
+ kVzDifference,
kLastCutType
};
kParticle = 0,
kPair,
kEvent,
- kMixEventFinderCut,
+ kMixEvent,
kLastCutTarget
};
Bool_t IsSelected(ETarget tgt, AliRsnDaughter *daughter);
Bool_t IsSelected(ETarget tgt, AliRsnPairParticle *pair);
Bool_t IsSelected(ETarget tgt, AliRsnEvent *event);
+ Bool_t IsSelected(ETarget tgt, AliRsnEvent *ev1, AliRsnEvent *ev2);
void PrintAllValues();
AliRsnCutSet *fCutSets[AliRsnCut::kLastCutTarget]; // cut definitions for all targets
- ClassDef(AliRsnCutMgr, 1); // dictionary
+ ClassDef(AliRsnCutMgr, 1) // dictionary
};
#endif
+//
+// Class AliRsnCutSet
+//
+// This is the front-end for cut management and checking.
+// It must be prepared by adding all required single cuts,
+// and then with a logical expression which combines all cuts
+// with the "AND", "OR" and "NOT" operators.
+//
+
#include "AliLog.h"
#include "AliRsnCut.h"
return boolReturn;
}
+//_____________________________________________________________________________
+Bool_t AliRsnCutSet::IsSelected(AliRsnCut::ETarget type, AliRsnEvent * ev1, AliRsnEvent *ev2)
+{
+//
+// Checks an object according to the cut expression defined here.
+//
+
+ Int_t i;
+ if (!fNumOfCuts) return kTRUE;
+
+ Bool_t boolReturn = kTRUE;
+ AliRsnCut *cut;
+ for (i = 0; i < fNumOfCuts; i++)
+ {
+ cut = (AliRsnCut*) fCuts.At(i);
+ fBoolValues[i] = cut->IsSelected(type,ev1,ev2);
+ }
+
+ if (fIsScheme) boolReturn = Passed();
+ return boolReturn;
+}
+
//_____________________________________________________________________________
void AliRsnCutSet::SetCutScheme(const TString & theValue)
{
-/**************************************************************************
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice *
- **************************************************************************/
-
//
-// class AliRsnCutSet
-// Combination of simple cuts
+// Class AliRsnCutSet
+//
+// This is the front-end for cut management and checking.
+// It must be prepared by adding all required single cuts,
+// and then with a logical expression which combines all cuts
+// with the "AND", "OR" and "NOT" operators.
+//
+// author: M. Vala (martin.vala@cern.ch)
//
#ifndef ALIRSNCUTSET_H
Bool_t IsSelected(AliRsnCut::ETarget type, AliRsnDaughter *daughter);
Bool_t IsSelected(AliRsnCut::ETarget type, AliRsnPairParticle *pair);
Bool_t IsSelected(AliRsnCut::ETarget type, AliRsnEvent *event);
+ Bool_t IsSelected(AliRsnCut::ETarget type, AliRsnEvent *ev1, AliRsnEvent *ev2);
void SetBoolValue(Bool_t theValue,Int_t index) { fBoolValues[index] = theValue; }
Bool_t GetBoolValue(Int_t index) const { return fBoolValues[index]; }
AliRsnExpression *fExpression; // pointer to AliRsnExpression
- ClassDef(AliRsnCutSet,1); // ROOT dictionary
+ ClassDef(AliRsnCutSet,1) // ROOT dictionary
};
#endif
//
// Class AliRsnDaughter
//
+// Light-weight AOD object which contains all required track details
+// which are used for resonance analysis.
+// Provides converters from all kinds of input track type: ESD, AOD and MC.
//
-// Light-weight 'track' object into an internal format used
-// for further steps of resonance analysis.
-// Provides converters from all kinds of input track type
-// (ESD, AOD and MC).
-// Contains also a facility to compute invariant mass of a pair.
-//
-// author: A. Pulvirenti --- email: alberto.pulvirenti@ct.infn.it
+// authors: A. Pulvirenti (alberto.pulvirenti@ct.infn.it)
+// M. Vala (martin.vala@cern.ch)
//
#include <Riostream.h>
fLabel(-1),
fCharge(0),
fFlags(0),
+ fKink(0),
fMass(0.0),
+ fChi2(0.0),
+ fNSigmaToVertex(-1.0),
+ fITSnum(0),
+ fTPCnum(0),
fRealisticPID(AliRsnPID::kUnknown),
fMCInfo(0x0)
{
fLabel(copy.fLabel),
fCharge(copy.fCharge),
fFlags(copy.fFlags),
+ fKink(copy.fKink),
fMass(copy.fMass),
+ fChi2(copy.fChi2),
+ fNSigmaToVertex(copy.fNSigmaToVertex),
+ fITSnum(copy.fITSnum),
+ fTPCnum(copy.fTPCnum),
fRealisticPID(copy.fRealisticPID),
fMCInfo(0x0)
{
fLabel(-1),
fCharge(0),
fFlags(0),
+ fKink(0),
fMass(0.0),
+ fChi2(0.0),
+ fNSigmaToVertex(-1.0),
+ fITSnum(0),
+ fTPCnum(0),
fRealisticPID(AliRsnPID::kUnknown),
fMCInfo(0x0)
{
fLabel(-1),
fCharge(0),
fFlags(0),
+ fKink(0),
fMass(0.0),
+ fChi2(0.0),
+ fNSigmaToVertex(-1.0),
+ fITSnum(0),
+ fTPCnum(0),
fRealisticPID(AliRsnPID::kUnknown),
fMCInfo(0x0)
{
fLabel(-1),
fCharge(0),
fFlags(0),
+ fKink(0),
fMass(0.0),
+ fChi2(0.0),
+ fNSigmaToVertex(-1.0),
+ fITSnum(0),
+ fTPCnum(0),
fRealisticPID(AliRsnPID::kUnknown),
fMCInfo(0x0)
{
fLabel = copy.fLabel;
fCharge = copy.fCharge;
fFlags = copy.fFlags;
+ fKink = copy.fKink;
+ fChi2 = copy.fChi2;
+ fNSigmaToVertex = copy.fNSigmaToVertex;
+ fITSnum = copy.fITSnum;
+ fTPCnum = copy.fTPCnum;
Int_t i;
for (i = 0; i < AliRsnPID::kSpecies; i++)
}
}
+//_____________________________________________________________________________
+void AliRsnDaughter::RotateP(Double_t angle)
+{
+//
+// Rotate the momentum along Z axis by an angle
+//
+
+ Double_t s = TMath::Sin(angle);
+ Double_t c = TMath::Cos(angle);
+ Double_t xx = fP[0];
+ fP[0] = c*xx - s*fP[1];
+ fP[1] = s*xx + c*fP[1];
+}
+
//_____________________________________________________________________________
void AliRsnDaughter::SetPIDWeight(Int_t i, Double_t value)
{
return kFALSE;
}
- // copy momentum and vertex
+ // copy momentum, vertex, chi2 and number of clusters
if (!useTPCInnerParam)
{
esdTrack->GetPxPyPz(fP);
esdTrack->GetXYZ(fV);
+ fChi2 = esdTrack->GetConstrainedChi2();
+ fITSnum = esdTrack->GetITSclusters(0x0);
+ fTPCnum = esdTrack->GetTPCclusters(0x0);
}
else
{
if (!esdTrack->GetTPCInnerParam()) return kFALSE;
esdTrack->GetTPCInnerParam()->GetPxPyPz(fP);
esdTrack->GetTPCInnerParam()->GetXYZ(fV);
+ fChi2 = esdTrack->GetTPCchi2();
+ fITSnum = 0;
+ fTPCnum = 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) fKink = -1;
+ else if (ik[0] > 0 || ik[1] > 0 || ik[2] > 0) fKink = 1;
+ else fKink = 0;
+
Double_t p = esdTrack->P();
// copy PID weights
- Int_t i;
Double_t pid[5];
if (!useTPCInnerParam)
{
// copy charge sign
fCharge = (Short_t)esdTrack->Charge();
+ // calculate N sigma to vertex
+ SetNSigmaToVertex(fESDTrackCuts.GetSigmaToVertex(esdTrack));
+
+
return kTRUE;
}
fV[1] = aodTrack->Yv();
fV[2] = aodTrack->Zv();
+ // chi2
+ fChi2 = aodTrack->Chi2perNDF();
+
// copy PID weights
Int_t i;
for (i = 0; i < 5; i++) fPIDWeight[i] = aodTrack->PID()[i];
// recognize charge sign from PDG code sign
Int_t pdg = particle->GetPdgCode();
Int_t absPDG = TMath::Abs(pdg);
- if (absPDG <= 15)
+ if (absPDG == 11 || absPDG == 13)
{
if (pdg > 0) fCharge = -1; else fCharge = 1;
}
- else if (absPDG < 3000)
+ else if (absPDG == 211 || absPDG == 321 || absPDG == 2212)
{
if (pdg > 0) fCharge = 1; else fCharge = -1;
}
else
{
+ // when trying to "adopt" a neutral track (photon, neutron, etc.)
+ // for the moment a "failed" message is returned
fCharge = 0;
return kFALSE;
}
}
//_____________________________________________________________________________
-void AliRsnDaughter::GetESDPID(AliESDtrack * track, Double_t * pid,EPIDType pidType, Double_t divValue, Double_t val)
+void AliRsnDaughter::GetESDPID
+(AliESDtrack * track, Double_t * pid, EPIDType pidType, Double_t divValue, Double_t val)
{
//
-// return PID from EPIDType type
+// A simple method to define PID weights by combining the ones
+// from single detectors by multiplication.
+// In the case when 'kITS_TPC_TOF_SP' option is chosen, a separation value
+// defines if the TOF signal must be included or not.
+// This value is usually the transverse momentum, but here it is left undefined.
//
+ Int_t i;
Double_t ctmp[AliRsnPID::kSpecies];
+
switch (pidType)
{
case kEsd :
case kITS_TPC :
track->GetITSpid(pid);
track->GetTPCpid(ctmp);
- for (Int_t i=0;i<5;i++) pid[i]*=ctmp[i];
+ for (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];
+ for (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];
+ for (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];
+ for (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];
+ for (i = 0; i < AliRsnPID::kSpecies; i++) pid[i] *= ctmp[i];
break;
case kITS_TPC_TOF_SP :
- if (val<divValue)
+ if (val < divValue)
{
track->GetITSpid(pid);
track->GetTPCpid(ctmp);
- for (Int_t i=0;i<AliRsnPID::kSpecies;i++) pid[i]*=ctmp[i];
+ for (i = 0; i < AliRsnPID::kSpecies; i++) pid[i] *= ctmp[i];
}
else
{
}
break;
default:
-// AliWarning("Unrecognized value of EPIDType argument");
- for (Int_t i=0;i<AliRsnPID::kSpecies;i++) pid[i]=1.0;
+ AliLog::Message(AliLog::kError,
+ "Unrecognized value of EPIDType argument",
+ "", "AliRsnDaughter", "GetESDPID", __FILE__, __LINE__);
+ for (i = 0; i < AliRsnPID::kSpecies; i++) pid[i] = 1.0;
break;
}
}
-
// which are used for resonance analysis.
// Provides converters from all kinds of input track type: ESD, AOD and MC.
//
-// author: A. Pulvirenti --- email: alberto.pulvirenti@ct.infn.it
+// authors: A. Pulvirenti (alberto.pulvirenti@ct.infn.it)
+// M. Vala (martin.vala@cern.ch)
//
#ifndef ALIRSNDAUGHTER_H
#include "AliVParticle.h"
#include "AliRsnPID.h"
+#include "AliESDtrackCuts.h"
class TParticle;
kLastPIDType
};
-
AliRsnDaughter();
AliRsnDaughter(const AliRsnDaughter ©);
AliRsnDaughter(AliESDtrack *track, Bool_t useTPCInnerParam = kFALSE);
virtual Double_t Pt() const {return TMath::Sqrt(Px()*Px() + Py()*Py());}
virtual Double_t OneOverPt() const {return 1.0 / Pt();}
virtual Bool_t PxPyPz(Double_t p[3]) const {p[0] = Px(); p[1] = Py(); p[2] = Pz(); return kTRUE;}
+ virtual Double_t Chi2() const {return fChi2;}
void SetPx(Double_t value) {fP[0] = value;}
void SetPy(Double_t value) {fP[1] = value;}
void SetPz(Double_t value) {fP[2] = value;}
void SetP(Double_t px, Double_t py, Double_t pz) {SetPx(px); SetPy(py); SetPz(pz);}
void SetM(Double_t m) {fMass = m;}
+ void SetChi2(Double_t chi2) {fChi2 = chi2;}
+ void RotateP(Double_t angle);
// DCA vertex
virtual Double_t Xv() const {return fV[0];}
// Charge
virtual Short_t Charge() const {return fCharge;}
+ virtual Char_t Kink() const {return fKink;}
+ virtual Bool_t IsKinkMother() const {return (fKink < 0);}
+ virtual Bool_t IsKinkDaughter() const {return (fKink > 0);}
void SetCharge(Short_t value) {fCharge = value;}
+ void SetKink(Char_t kink) {fKink = kink;}
// PID
virtual const Double_t* PID() const {return fPIDWeight;}
AliRsnPID::EType PIDType(Double_t &prob) const;
// check that contains a given ESD flag
+ UInt_t GetFlags() {return fFlags;}
Bool_t CheckFlag(ULong_t flag) {return ((fFlags & flag) == flag);}
// information getters from objects
- Bool_t Adopt(AliESDtrack *track, EPIDType pidType = kEsd,Double_t divValue = 0.0,Bool_t useTPCInnerParam = kFALSE);
+ Bool_t Adopt(AliESDtrack *track, EPIDType pidType = kEsd, Double_t divValue = 0.0, Bool_t useTPCInnerParam = kFALSE);
Bool_t Adopt(AliAODTrack *track);
Bool_t Adopt(AliMCParticle *track);
Int_t GetLabel() const {return -1;}
void SetIndex(Int_t value) {fIndex = value;}
void SetLabel(Int_t value) {fLabel = value;}
+
+ // N sigma to vertex
+ Float_t NSigmaToVertex() const { return fNSigmaToVertex; }
+ void SetNSigmaToVertex(const Float_t& theValue) { fNSigmaToVertex = theValue; }
+
+
+ // ITS/TPC clusters
+ Int_t NumberOfITSClusters() const {return fITSnum;}
+ Int_t NumberOfTPCClusters() const {return fTPCnum;}
+ void SetNumberOfITSClusters(Int_t n) {fITSnum = n;}
+ void SetNumberOfTPCClusters(Int_t n) {fTPCnum = n;}
// Utilities
void Print(Option_t *option = "ALL") const;
virtual Bool_t IsSortable() const {return kTRUE;}
virtual Int_t Compare(const TObject* obj) const;
+
private:
+ static void GetESDPID
+ (AliESDtrack *track, Double_t *pid, EPIDType pidType = kEsd,
+ Double_t divValue = -1.0, Double_t val = -1.0);
+
Int_t fIndex; // index of source object (ESD/AOD/MC) in its collection
Int_t fLabel; // label assigned to the track (act. by GEANT3)
Short_t fCharge; // charge sign
ULong_t fFlags; // status flags
+ Char_t fKink; // kink index
Double_t fP[3]; // vector momentum (x, y, z)
Double_t fV[3]; // DCA vertex (x, y, z)
Double_t fMass; // mass (assigned externally)
+ Double_t fChi2; // chi square of track
+ Float_t fNSigmaToVertex; // N sigma to vertex
+
+ Int_t fITSnum; // number of ITS clusters
+ Int_t fTPCnum; // number of TPC clusters
AliRsnPID::EType fRealisticPID; // PID from Bayesian probs (largest one)
Double_t fPIDProb[AliRsnPID::kSpecies]; // PID probabilities (Bayesian comp.)
Double_t fPIDWeight[AliRsnPID::kSpecies]; // PID weights
AliRsnMCInfo *fMCInfo; // reference to particle object (if any)
+
+ AliESDtrackCuts fESDTrackCuts; //! tmp object of AliESDtrackCuts for fNSigmaToVertex
static EPIDMethod fgPIDMethod; // flag to define how the PID is computed for this object
- static void GetESDPID(AliESDtrack *track,Double_t *pid,EPIDType pidType = kEsd,Double_t divValue=-1.0,Double_t val=-1.0);
-
- ClassDef(AliRsnDaughter, 4);
+ ClassDef(AliRsnDaughter, 4)
};
#endif
}
//_____________________________________________________________________________
-void AliRsnEvent::FillPIDArrays()
+void AliRsnEvent::FillPIDArrays(Int_t arraySizeInit)
{
//
// Initializes and fills the AliRsnPIDIndex objects containing
if (fNoPID) delete fNoPID;
if (fPerfectPID) delete fPerfectPID;
if (fRealisticPID) delete fRealisticPID;
- fNoPID = new AliRsnPIDIndex(2000);
- fPerfectPID = new AliRsnPIDIndex(2000);
- fRealisticPID = new AliRsnPIDIndex(2000);
+ fNoPID = new AliRsnPIDIndex(arraySizeInit);
+ fPerfectPID = new AliRsnPIDIndex(arraySizeInit);
+ fRealisticPID = new AliRsnPIDIndex(arraySizeInit);
// set the default type to Realistic
AliRsnDaughter::SetPIDMethod(AliRsnDaughter::kRealistic);
}
}
+//_____________________________________________________________________________
+void AliRsnEvent::MakeComputations()
+{
+//
+// Computes all required overall variables:
+// - multiplicity
+// - mean phi of tracks
+//
+
+ if (!fTracks) {
+ fMult = 0;
+ fPhiMean = 0.0;
+ }
+ else {
+ fMult = fTracks->GetEntries();
+ fPhiMean = 0.0;
+
+ AliRsnDaughter *d = 0;
+ TObjArrayIter next(fTracks);
+ while ( (d = (AliRsnDaughter*)next()) ) {
+ fPhiMean += d->Phi();
+ }
+ fPhiMean /= (Double_t)fMult;
+ }
+}
+
//_____________________________________________________________________________
void AliRsnEvent::CorrectByPrimaryVertex()
{
}
}
+/*
//_____________________________________________________________________________
Int_t AliRsnEvent::GetMultiplicity() const
{
if (!fTracks) return 0;
return fTracks->GetEntries();
}
+*/
//_____________________________________________________________________________
Int_t AliRsnEvent::GetNCharged(Char_t sign)
TClonesArray* GetTracks() {return fTracks;}
TArrayI* GetCharged(Char_t sign);
TArrayI* GetTracksArray(AliRsnDaughter::EPIDMethod method, Char_t sign, AliRsnPID::EType type);
- void FillPIDArrays();
+ void FillPIDArrays(Int_t arraySizeDefault = 1000);
void SortTracks() {fTracks->Sort();}
void Print(Option_t *option = "") const;
+ void MakeComputations();
// Primary vertex
Double_t GetPrimaryVertexX() const {return fPVx;}
Double_t GetPrimaryVertexY() const {return fPVy;}
Double_t GetPrimaryVertexZ() const {return fPVz;}
void GetPrimaryVertex(Double_t &x, Double_t &y, Double_t &z) const {x=fPVx;y=fPVy;z=fPVz;}
+ Double_t GetVz() const {return GetPrimaryVertexZ();}
void SetPrimaryVertexX(Double_t value) {fPVx = value;}
void SetPrimaryVertexY(Double_t value) {fPVy = value;}
void SetPrimaryVertexZ(Double_t value) {fPVz = value;}
void CorrectByPrimaryVertex();
// Multiplicity
- Int_t GetMultiplicity() const;
+ Int_t GetMultiplicity() const {return fMult;}
Int_t GetNCharged(Char_t sign);
+
+ // Mean phi
+ Double_t GetPhiMean() const {return fPhiMean;}
private:
Double_t fPVx; // position of
Double_t fPVy; // primary
Double_t fPVz; // vertex
+ Double_t fPhiMean; // mean "phi" coord of all tracks
+ Int_t fMult; // track multiplicity
TClonesArray *fTracks; // collection of particles
//
#include "AliLog.h"
+
+#include "AliRsnCut.h"
+#include "AliRsnCutSet.h"
#include "AliRsnEventBuffer.h"
ClassImp(AliRsnEventBuffer)
if (fEventsBufferIndex >= fEventsBufferSize - 1) ResetIndex();
fEventsBufferIndex++;
- if (fEventsBuffer[fEventsBufferIndex])
+ if (fEventsBuffer[fEventsBufferIndex]) {
+ //AliInfo("Replacing event");
*fEventsBuffer[fEventsBufferIndex] = *event;
- else
+ }
+ else {
+ //AliInfo("New event");
fEventsBuffer[fEventsBufferIndex] = new AliRsnEvent(*event);
+ }
+
+ // correct for primary vertex
+ fEventsBuffer[fEventsBufferIndex]->CorrectByPrimaryVertex();
+}
+
+//_____________________________________________________________________________
+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;
}
//_____________________________________________________________________________
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) 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)
{
#include "AliRsnEvent.h"
+class AliRsnCutSet;
+
class AliRsnEventBuffer : public TObject
{
public:
void ResetIndex();
void AddEvent(AliRsnEvent *event);
+ Int_t IndexOf(AliRsnEvent *event);
AliRsnEvent *GetEvent(Int_t index) ;
AliRsnEvent *GetCurrentEvent();
AliRsnEvent *GetNextEvent();
+ AliRsnEvent *GetNextGoodEvent(Int_t &start, AliRsnCutSet *cuts = 0);
void SetEventsBufferSize(const Int_t& theValue) { fEventsBufferSize = theValue; }
Int_t GetEventsBufferSize() const { return fEventsBufferSize; }
// 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
+// 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.
//
//
#include <Riostream.h>
#include <TH1.h>
-#include <TH2.h>
#include <TList.h>
#include <TString.h>
//________________________________________________________________________________________
AliRsnFunction::AliRsnFunction() :
- fFcnType(kFcnTypes),
- fUseBins(kFALSE),
- fSkipOutsideInterval(kFALSE),
- fBins(0),
- fBinningCut(),
- fBinningCutType(AliRsnCut::kLastCutType),
- fHistoDef(0x0)
+ fFcnType(kFcnTypes),
+ fRotAngle(0.0),
+ fUseBins(kFALSE),
+ fSkipOutsideInterval(kFALSE),
+ fBins(0),
+ fBinningCut(),
+ fBinningCutType(AliRsnCut::kLastCutType),
+ fHistoDef(0x0)
{
//
// Constructor.
// 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++) {
+ for (i = 0; i < 100; i++)
+ {
fHisto[i] = 0x0;
}
}
//________________________________________________________________________________________
AliRsnFunction::AliRsnFunction
(EFcnType type, AliRsnHistoDef *hd, Bool_t skipOut) :
- fFcnType(type),
- fUseBins(kFALSE),
- fSkipOutsideInterval(skipOut),
- fBins(0),
- fBinningCut(),
- fBinningCutType(AliRsnCut::kLastCutType),
- fHistoDef(hd)
+ fFcnType(type),
+ fRotAngle(0.0),
+ fUseBins(kFALSE),
+ fSkipOutsideInterval(skipOut),
+ fBins(0),
+ fBinningCut(),
+ fBinningCutType(AliRsnCut::kLastCutType),
+ fHistoDef(hd)
{
//
// Constructor.
// 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++) {
+ for (i = 0; i < 100; i++)
+ {
fHisto[i] = 0x0;
}
}
//________________________________________________________________________________________
AliRsnFunction::AliRsnFunction(const AliRsnFunction ©) :
- TObject(copy),
- fFcnType(copy.fFcnType),
- fUseBins(copy.fUseBins),
- fSkipOutsideInterval(copy.fSkipOutsideInterval),
- fBins(0),
- fBinningCut(),
- fBinningCutType(AliRsnCut::kLastCutType),
- fHistoDef(copy.fHistoDef)
+ TObject(copy),
+ fFcnType(copy.fFcnType),
+ fRotAngle(copy.fRotAngle),
+ fUseBins(copy.fUseBins),
+ fSkipOutsideInterval(copy.fSkipOutsideInterval),
+ fBins(0),
+ fBinningCut(),
+ fBinningCutType(AliRsnCut::kLastCutType),
+ fHistoDef(copy.fHistoDef)
{
//
// Copy constructor.
//
Int_t i, n = 100;
- for (i = 0; i < n; i++) {
+ for (i = 0; i < n; i++)
+ {
fHisto[i] = 0x0;
}
-
- if (fUseBins) {
+
+ if (fUseBins)
+ {
n = copy.fBins.GetSize();
Double_t *array = new Double_t[n];
for (i = 0; i < n; i++) array[i] = copy.fBins[i];
//
Int_t i;
- for (i = 0; i < 100; i++) {
+ for (i = 0; i < 100; i++)
+ {
delete fHisto[i];
fHisto[i] = 0x0;
}
//
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
TList *histos = new TList;
histos->SetName(Form("%s", GetFcnName().Data()));
-
- // a general histogram is always added,
+
+ // a general histogram is always added,
// which overrides the binning and collects everything
fHisto[0] = new TH1D(histoName, histoTitle, nbins, min, max);
histos->AddLast(fHisto[0]);
-
- // if requested a binning w.r. to some cut variable, histograms are added
+
+ // 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];
- if (fUseBins) {
- for (ibin = 0, i = 1; ibin < fBins.GetSize() - 1; ibin++, i++) {
+ if (fUseBins)
+ {
+ for (ibin = 0, i = 1; ibin < fBins.GetSize() - 1; ibin++, i++)
+ {
sprintf(hName, "%s[%.2f-%.2f]", histoName, fBins[ibin], fBins[ibin+1]);
sprintf(hTitle, "%s [%.2f-%.2f]", histoTitle, fBins[ibin], fBins[ibin+1]);
fHisto[i] = new TH1D(hName, hTitle, nbins, min, max);
histos->AddLast(fHisto[i]);
}
}
-
+
// returns the full list at the end
return histos;
}
//
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) {
+ if (!histos)
+ {
AliError("NULL target list!");
return;
}
-
- // a general histogram is always added,
+
+ // a general histogram is always added,
// which overrides the binning and collects everything
fHisto[0] = new TH1D(histoName, histoTitle, nbins, min, max);
histos->AddLast(fHisto[0]);
-
- // if requested a binning w.r. to some cut variable, histograms are added
+
+ // 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];
- if (fUseBins) {
- for (ibin = 0, i = 1; ibin < fBins.GetSize() - 1; ibin++, i++) {
+ if (fUseBins)
+ {
+ for (ibin = 0, i = 1; ibin < fBins.GetSize() - 1; ibin++, i++)
+ {
sprintf(hName, "%s[%.2f-%.2f]", histoName, fBins[ibin], fBins[ibin+1]);
sprintf(hTitle, "%s [%.2f-%.2f]", histoTitle, fBins[ibin], fBins[ibin+1]);
fHisto[i] = new TH1D(hName, hTitle, nbins, min, max);
//
// 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++) {
+ for (i = 0; i < nBins; i++)
+ {
fBins[i] = min + (Double_t)i * step;
}
}
Int_t i;
fBinningCutType = type;
fBins.Set(nbins);
- for (i = 0; i < nbins; i++) {
+ for (i = 0; i < nbins; i++)
+ {
fBins[i] = bins[i];
}
}
TString text("Undef");
- switch (fFcnType) {
- case kInvMass:
- text = "IM";
- break;
- case kInvMassMC:
- text = "IM_MC";
- break;
- case kResolution:
- text = "RES";
- break;
- case kPtSpectrum:
- text = "PT";
- default:
- AliError("Type not defined");
+ 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";
+ default:
+ AliError("Type not defined");
}
-
+
return text;
}
//
// 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";
- default:
- AliError("Type not defined");
+ 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";
+ default:
+ AliError("Type not defined");
}
-
+
return text;
}
Double_t value = FcnValue(pair, ref);
if (fSkipOutsideInterval)
- {
- if (value < fHistoDef->GetMin()) return kFALSE;
- if (value > fHistoDef->GetMax()) return kFALSE;
- }
-
+ {
+ if (value < fHistoDef->GetMin()) return kFALSE;
+ if (value > fHistoDef->GetMax()) return kFALSE;
+ }
+
// fill global histogram
if (weight == 0.0) fHisto[0]->Fill(value);
else fHisto[0]->Fill(value, weight);
-
+
// if bins are allocated, find right one and fill it
- if (fUseBins) {
+ if (fUseBins)
+ {
Int_t i, ibin;
- for (ibin = 0, i = 1; ibin < fBins.GetSize() - 1; ibin++, i++) {
+ for (ibin = 0, i = 1; ibin < fBins.GetSize() - 1; ibin++, i++)
+ {
if (!fHisto[i]) continue;
fBinningCut.SetCutValues(fBinningCutType, fBins[ibin], fBins[ibin+1]);
- if (fBinningCut.IsSelected(AliRsnCut::kPair, pair)) {
+ if (fBinningCut.IsSelected(AliRsnCut::kPair, pair))
+ {
if (weight == 0.0) fHisto[i]->Fill(value);
else fHisto[i]->Fill(value, weight);
break;
}
}
}
-
+
return kTRUE;
}
// It computes the value which must be used to fill the histogram.
//
- switch (fFcnType) {
- case kInvMass:
- return pair->GetInvMass(ref->GetMass(0), ref->GetMass(1));
- case kInvMassMC:
- return pair->GetInvMassMC(ref->GetMass(0), ref->GetMass(1));
- case kResolution:
- return FcnResolution(pair, ref);
- case kPtSpectrum:
- return pair->GetPt();
- default:
- AliError("Type not defined");
+ switch (fFcnType)
+ {
+ case kInvMass:
+ return pair->GetInvMass(ref->GetMass(0), ref->GetMass(1));
+ case kInvMassMC:
+ return pair->GetInvMassMC(ref->GetMass(0), ref->GetMass(1));
+ case kInvMassRotated:
+ //AliInfo(Form("*** ROTATION ANGLE = %f ***", fRotAngle));
+ //AliInfo(Form("UNROTATED INV MASS = %f", pair->GetInvMass(ref->GetMass(0), ref->GetMass(1))));
+ //pair->GetDaughter(1)->Print("P");
+ pair->GetDaughter(1)->RotateP(fRotAngle * TMath::DegToRad());
+ pair->ResetPair();
+ //AliInfo(Form(" ROTATED INV MASS = %f", pair->GetInvMass(ref->GetMass(0), ref->GetMass(1))));
+ //pair->GetDaughter(1)->Print("P");
+ return pair->GetInvMass(ref->GetMass(0), ref->GetMass(1));
+ case kResolution:
+ return FcnResolution(pair, ref);
+ case kPtSpectrum:
+ return pair->GetPt();
+ default:
+ AliError("Type not defined");
}
-
+
return 0.0;
}
Double_t recInvMass = pair->GetInvMass(ref->GetMass(0), ref->GetMass(1));
Double_t simInvMass = pair->GetInvMassMC(ref->GetMass(0), ref->GetMass(1));
-
+
return (simInvMass - recInvMass) / simInvMass;
}
// 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
+// 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.
//
//
class AliRsnFunction : public TObject
{
-public:
+ public:
enum EFcnType
{
kInvMass,
kInvMassMC,
+ kInvMassRotated,
kResolution,
kPtSpectrum,
kFcnTypes
AliRsnHistoDef* GetHistoDef() {return fHistoDef;}
TString GetFcnName();
TString GetFcnTitle();
-
+
void SetBinningCut(AliRsnCut::EType type, Double_t min, Double_t max, Double_t step);
- void SetBinningCut(AliRsnCut::EType type, Int_t nbins, Double_t *bins);
+ void SetBinningCut(AliRsnCut::EType type, Int_t nbins, Double_t *bins);
void SetHistoDef(AliRsnHistoDef *def) {fHistoDef = def;}
+ void SetRotationAngle(Double_t rotAngle) {fRotAngle = rotAngle;}
// working routines
TList* Init(const char *histoName, const char *histoTitle);
Bool_t Fill(AliRsnPairParticle *pair, AliRsnPairDef *ref, Double_t weight = 0.0);
Double_t FcnValue(AliRsnPairParticle *pair, AliRsnPairDef *ref);
-private:
-
+ private:
+
const AliRsnFunction& operator=(const AliRsnFunction ©);
-
+
Double_t FcnResolution(AliRsnPairParticle *pair, AliRsnPairDef *pd);
-
+
EFcnType fFcnType; // function type
+
+ Double_t fRotAngle; // rotation angle (for "rotated" invMass)
Bool_t fUseBins; // flag to choose if binning is used
Bool_t fSkipOutsideInterval; // skip pairs which fall outside histogram interval
-
+
TArrayD fBins; // low edge of each bin (upper is the low edge of next bin)
AliRsnCut fBinningCut; // binning cut
AliRsnCut::EType fBinningCutType;// binning cut type
AliRsnHistoDef *fHistoDef; // definitions for histogram
TH1D *fHisto[100]; // binned histograms
-
+
// ROOT dictionary
ClassDef(AliRsnFunction, 1)
};
//_____________________________________________________________________________
AliRsnHistoDef::AliRsnHistoDef() :
- fNBins(0),
- fMin(0.0),
- fMax(0.0)
+ fNBins(0),
+ fMin(0.0),
+ fMax(0.0)
{
//
// Default constructor
//_____________________________________________________________________________
AliRsnHistoDef::AliRsnHistoDef
(Int_t nbins, Double_t min, Double_t max) :
- fNBins(0),
- fMin(0.0),
- fMax(0.0)
+ fNBins(0),
+ fMin(0.0),
+ fMax(0.0)
{
//
// 1D histo definition.
//
- SetBins(nbins, min, max);
+ SetBins(nbins, min, max);
}
//_____________________________________________________________________________
//
// Binning for histogram.
//
- fNBins = n;
-
- if (min < max) {
- fMin = min;
- fMax = max;
- }
- else {
- fMin = max;
- fMax = min;
- }
+ fNBins = n;
+
+ if (min < max)
+ {
+ fMin = min;
+ fMax = max;
+ }
+ else
+ {
+ fMin = max;
+ fMax = min;
+ }
}
// Histogram definition.
// Contains required informations to create a histogram
// with fixed bin size: number of bins, minimum and maximum.
-// Variable bin sizes are not considered because they are
+// Variable bin sizes are not considered because they are
// not used as typical output of analysis in this package.
//
+//
+// 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)
+AliRsnMCInfo::AliRsnMCInfo() :
+ TObject(), fEnergy(0), fPDG(0), fMother(-1), fMotherPDG(0)
{
//
// Default constructor.
-// Initializes all data-members with meaningless values.
+// Initializes all data-members to meaningless values.
//
- for (Int_t i = 0; i < 3; i++) fP[i] = 0.0;
+
+ Int_t i;
+ for (i = 0; i < 3; i++) fP[i] = 0.0;
}
//_____________________________________________________________________________
-AliRsnMCInfo::AliRsnMCInfo(const AliRsnMCInfo & copy) : TObject(copy),
+AliRsnMCInfo::AliRsnMCInfo(const AliRsnMCInfo & copy) :
+ TObject(copy),
fEnergy(copy.fEnergy),
fPDG(copy.fPDG),
fMother(copy.fMother),
{
//
// Copy constructor.
-// Initializes all data-members with meaningless values.
//
- for (Int_t i = 0; i < 3; i++) fP[i] = copy.fP[i];
-
+ Int_t i;
+ for (i = 0; i < 3; i++) fP[i] = copy.fP[i];
}
//_____________________________________________________________________________
AliRsnMCInfo::~AliRsnMCInfo()
{
+//
+// Destructor.
+// Does nothing because there are no pointers to clean.
+//
}
//_____________________________________________________________________________
void AliRsnMCInfo::Adopt(TParticle * particle)
{
//
-// Copies data from a TParticle into "this":
-// - PDG code
-// - GEANT label of mother (if any, otherwise -1)
-// If the argument is NULL, nothing is done, and an alert
-// is given by the method.
+// Uses a TParticle to initialize its data members.
+// If the argument is NULL, nothing is done and an error message is returned.
//
if (!particle)
-#ifndef AliRsnMCInfo_h
-#define AliRsnMCInfo_h
+//
+// 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.
+//
+// authors: A. Pulvirenti (alberto.pulvirenti@ct.infn.it)
+// M. Vala (martin.vala@cern.ch)
+//
+
+#ifndef ALIRSNMCINFO_H
+#define ALIRSNMCINFO_H
-#include <AliVParticle.h>
#include <TParticle.h>
#include <TMath.h>
class AliRsnMCInfo : public TObject
{
public:
+
AliRsnMCInfo();
AliRsnMCInfo(const AliRsnMCInfo ©);
void Adopt(TParticle *part);
// 4-momentum
- virtual Double_t E() const {return fEnergy;}
- virtual Double_t E(Double_t mass) {return TMath::Sqrt(mass*mass + P2());}
- virtual Double_t M() const {return TMath::Sqrt(fEnergy*fEnergy - P2());}
- virtual Double_t P2() const {return Px()*Px() + Py()*Py() + Pz()*Pz();}
- virtual Double_t P() const {return TMath::Sqrt(P2());}
- virtual Double_t Px() const {return fP[0];}
- virtual Double_t Py() const {return fP[1];}
- virtual Double_t Pz() const {return fP[2];}
- virtual Double_t Pt() const {return TMath::Sqrt(Px() *Px() + Py() *Py());}
- virtual Double_t OneOverPt() const {return 1.0 / Pt();}
- virtual Bool_t PxPyPz(Double_t p[3]) const {p[0] = Px(); p[1] = Py(); p[2] = Pz(); return kTRUE;}
-
- virtual Double_t Phi() const {return TMath::ATan2(Py(), Px());}
- virtual Double_t Theta() const {return TMath::ATan2(Pt(), Pz());}
- virtual Double_t Eta() const {return -TMath::Log(TMath::Tan(0.5*Theta()));}
- virtual Double_t Y() const {return TMath::Log((E() + Pz()) / (E() - Pz()));}
-
- void SetPx(Double_t value) {fP[0] = value;}
- void SetPy(Double_t value) {fP[1] = value;}
- void SetPz(Double_t value) {fP[2] = value;}
- void SetP(Double_t px, Double_t py, Double_t pz) {SetPx(px); SetPy(py); SetPz(pz);}
- void SetE(Double_t e) {fEnergy = e;}
-
- Int_t PDG() const {return fPDG;}
- Int_t Mother() const {return fMother;}
- Short_t MotherPDG() const {return fMotherPDG;}
- void SetPDG(Int_t pdg) {fPDG = pdg;}
- void SetMother(Int_t mlabel) {fMother = mlabel;}
- void SetMotherPDG(Int_t pdg) {fMotherPDG = (Short_t) pdg;}
+ Double_t E() const {return fEnergy;}
+ Double_t E(Double_t mass) {return TMath::Sqrt(mass*mass + P2());}
+ Double_t M() const {return TMath::Sqrt(fEnergy*fEnergy - P2());}
+ Double_t P2() const {return Px()*Px() + Py()*Py() + Pz()*Pz();}
+ Double_t P() const {return TMath::Sqrt(P2());}
+ Double_t Px() const {return fP[0];}
+ Double_t Py() const {return fP[1];}
+ Double_t Pz() const {return fP[2];}
+ Double_t Pt() const {return TMath::Sqrt(Px() *Px() + Py() *Py());}
+ Double_t OneOverPt() const {return 1.0 / Pt();}
+ Bool_t PxPyPz(Double_t p[3]) const {p[0] = Px(); p[1] = Py(); p[2] = Pz(); return kTRUE;}
+
+ Double_t Phi() const {return TMath::ATan2(Py(), Px());}
+ Double_t Theta() const {return TMath::ATan2(Pt(), Pz());}
+ Double_t Eta() const {return -TMath::Log(TMath::Tan(0.5*Theta()));}
+ Double_t Y() const {return 0.5 * TMath::Log((E() + Pz()) / (E() - Pz()));}
+
+ void SetPx(Double_t value) {fP[0] = value;}
+ void SetPy(Double_t value) {fP[1] = value;}
+ void SetPz(Double_t value) {fP[2] = value;}
+ void SetP(Double_t px, Double_t py, Double_t pz) {SetPx(px); SetPy(py); SetPz(pz);}
+ void SetE(Double_t e) {fEnergy = e;}
+
+ Int_t PDG() const {return fPDG;}
+ Int_t Mother() const {return fMother;}
+ Short_t MotherPDG() const {return fMotherPDG;}
+ void SetPDG(Int_t pdg) {fPDG = pdg;}
+ void SetMother(Int_t mlabel) {fMother = mlabel;}
+ void SetMotherPDG(Int_t pdg) {fMotherPDG = (Short_t) pdg;}
private:
-/**************************************************************************
- * 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 AliRsnPID
-// -------------------
-// Simple collection of reconstructed tracks
-// selected from an ESD event
-// to be used for analysis.
-// .........................................
//
-// author: A. Pulvirenti (email: alberto.pulvirenti@ct.infn.it)
-//-------------------------------------------------------------------------
+// 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 "AliRsnPID.h"
-ClassImp ( AliRsnPID )
+ClassImp(AliRsnPID)
- const Double_t AliRsnPID::fgkParticleMass[AliRsnPID::kSpeciesAll + 1] =
+const Double_t AliRsnPID::fgkParticleMass[AliRsnPID::kSpeciesAll + 1] =
{
0.00051099892, // electron
0.105658369, // muon
//_____________________________________________________________________________
AliRsnPID::AliRsnPID() :
- TNamed ( "RsnPID", "" ),
- fMaxPt ( 100.0 ),
- fMinProb ( 0.0 )
+ TNamed("RsnPID", ""),
+ fMaxPt(100.0),
+ fMinProb(0.0)
{
//
// Constructor.
//
Int_t i;
- for ( i = 0; i < kSpecies; i++ ) fPrior[i] = 0.0;
+ for (i = 0; i < kSpecies; i++) fPrior[i] = 0.0;
// gDirectory->Append(this, kTRUE);
}
//_____________________________________________________________________________
-AliRsnPID::EType AliRsnPID::InternalType ( Int_t pdg )
+AliRsnPID::EType AliRsnPID::InternalType(Int_t pdg)
//
// Return the internal enum value corresponding to the PDG
// code passed as argument, if possible.
//
{
EType value;
- Int_t absPDG = TMath::Abs ( pdg );
+ Int_t absPDG = TMath::Abs(pdg);
- switch ( absPDG )
+ switch (absPDG)
{
case 11:
value = kElectron;
//_____________________________________________________________________________
-Int_t AliRsnPID::PDGCode ( EType type )
+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 )
+ if (type >= kElectron && type <= kUnknown)
{
return fgkParticlePDG[type];
}
}
//_____________________________________________________________________________
-const char* AliRsnPID::ParticleName ( EType type, Bool_t shortName )
+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 >= kElectron && type <= kSpeciesAll )
+ if (type >= 0 && type <= kSpeciesAll)
{
return shortName ? fgkParticleNameShort[type] : fgkParticleNameLong[type];
}
}
//_____________________________________________________________________________
-const char* AliRsnPID::ParticleNameLatex ( EType type )
+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 )
+ if (type >= kElectron && type <= kSpeciesAll)
{
return fgkParticleNameLatex[type];
}
}
//_____________________________________________________________________________
-Double_t AliRsnPID::ParticleMass ( EType type )
+Double_t AliRsnPID::ParticleMass(EType type)
{
//
// Returns the mass corresponding to the particle type
Int_t pdg = PDGCode(type);
return db->GetParticle(pdg)->Mass();
*/
- if ( type >= kElectron && type < kSpeciesAll ) return fgkParticleMass[type];
+ if (type >= kElectron && type < kSpeciesAll) return fgkParticleMass[type];
return 0.0;
}
//_____________________________________________________________________________
-Bool_t AliRsnPID::ComputeProbs ( AliRsnDaughter *daughter )
+Bool_t AliRsnPID::ComputeProbs(AliRsnDaughter *daughter)
{
//
// Uses the Bayesian combination of prior probabilities
// reset all PID probabilities to 0.0
Int_t i;
- for ( i = 0; i < kSpecies; i++ ) daughter->SetPIDProb ( i, 1.0 / ( Double_t ) kSpecies );
+ 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++ )
+ for (i = 0; i < kSpecies; i++)
{
- prob[i] = fPrior[i] * daughter->PID() [i];
+ prob[i] = fPrior[i] * daughter->PID()[i];
sum += prob[i];
}
- if ( sum <= ( Double_t ) 0. )
+ if (sum <= (Double_t) 0.)
{
- AliError ( Form ( "Sum of weights = %f <= 0", sum ) );
+ AliError(Form("Sum of weights = %f <= 0", sum));
return kFALSE;
}
// normalize
- for ( i = 0; i < kSpecies; i++ )
+ for (i = 0; i < kSpecies; i++)
{
prob[i] /= sum;
- daughter->SetPIDProb ( i, prob[i] );
+ daughter->SetPIDProb(i, prob[i]);
}
-
+
daughter->AssignRealisticPID();
Double_t assprob;
AliRsnDaughter::SetPIDMethod(AliRsnDaughter::kRealistic);
}
//_____________________________________________________________________________
-Bool_t AliRsnPID::IdentifiedAs ( AliRsnDaughter *d, EType type, Short_t charge )
+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.
// is kFALSE even when the type and charge are matched.
//
- EType dType = TrackType ( d );
- if ( dType != type ) return kFALSE;
- if ( charge == 0 )
+ EType dType = TrackType(d);
+ if (dType != type) return kFALSE;
+ if (charge == 0)
{
return kTRUE;
}
- else if ( charge > 0 )
+ else if (charge > 0)
{
- return ( d->Charge() > 0 );
+ return (d->Charge() > 0);
}
else
{
- return ( d->Charge() < 0 );
+ return (d->Charge() < 0);
}
}
//_____________________________________________________________________________
-AliRsnPID::EType AliRsnPID::TrackType ( AliRsnDaughter *d )
+AliRsnPID::EType AliRsnPID::TrackType(AliRsnDaughter *d)
{
//
// Returns the track type according to the object settings
//
Double_t prob;
- EType type = d->PIDType ( prob );
+ EType type = d->PIDType(prob);
- if ( d->Pt() > fMaxPt ) return kUnknown;
- if ( prob < fMinProb ) return kUnknown;
+ if (d->Pt() > fMaxPt) return kUnknown;
+ if (prob < fMinProb) return kUnknown;
return type;
}
//_____________________________________________________________________________
-Bool_t AliRsnPID::Process ( AliRsnEvent *event )
+Bool_t AliRsnPID::Process(AliRsnEvent *event)
{
//
// Performs identification for all tracks in a given event.
//
Bool_t check = kTRUE;
- if ( !event ) return check;
- if ( !event->GetTracks() ) return check;
- if ( event->GetTracks()->IsEmpty() ) return check;
+ 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() ) )
+ TObjArrayIter iter(event->GetTracks());
+ while ((daughter = (AliRsnDaughter*) iter.Next()))
{
- check = check && ComputeProbs ( daughter );
+ check = check && ComputeProbs(daughter);
}
event->FillPIDArrays();
//_____________________________________________________________________________
-void AliRsnPID::SetPriorProbability ( EType type, Double_t p )
+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 )
+ if (type >= kElectron && type < kSpecies)
{
fPrior[type] = p;
}
Int_t i;
Char_t msg[200];
- for ( i = 0; i < kSpecies; i++ )
+ for (i = 0; i < kSpecies; i++)
{
- sprintf ( msg, "Prior probability for '%s' = %3.5f", fgkParticleNameLong[i], fPrior[i] );
- AliInfo ( msg );
+ sprintf(msg, "Prior probability for '%s' = %3.5f", fgkParticleNameLong[i], fPrior[i]);
+ AliInfo(msg);
}
}
-/**************************************************************************
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice *
- **************************************************************************/
-
-/* $Id: AliRsnPID.h,v 1.5 2007/02/21 14:33:25 pulvir Exp $ */
-
-//-------------------------------------------------------------------------
-// Class AliRsnPID
-// Simple collection of reconstructed tracks, selected from an ESD event
//
-// author: A. Pulvirenti (email: alberto.pulvirenti@ct.infn.it)
-//-------------------------------------------------------------------------
+// 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)
+//
#ifndef ALIRSNPID_H
#define ALIRSNPID_H
-/**************************************************************************
- * 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 AliRsnPIDIndex ***
+//
+// Class AliRsnPIDIndex
//
// It sorts the indexes of all tracks in an AliRsnEvent
// for a fast retrieval of them according to charge and PID.
-/**************************************************************************
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice *
- **************************************************************************/
-
//
-// *** Class AliRsnPIDIndex ***
+// Class AliRsnPIDIndex
//
// It sorts the indexes of all tracks in an AliRsnEvent
// for a fast retrieval of them according to charge and PID.
{
public:
- AliRsnPIDIndex(Int_t num = 2000);
+ AliRsnPIDIndex(Int_t num = 1000);
AliRsnPIDIndex(const AliRsnPIDIndex ©);
AliRsnPIDIndex& operator= (const AliRsnPIDIndex& copy);
//_____________________________________________________________________________
AliRsnPair::AliRsnPair
-(EPairType type, AliRsnPairDef *def, Int_t mixNum) :
- TObject(),
- fIsMixed(kFALSE),
- fUseMC(kFALSE),
- fIsLikeSign(kFALSE),
- fMixNum(mixNum),
- fPairDef(def),
- fPairType(type),
- fTypePID(AliRsnDaughter::kRealistic),
- fCutMgr(0),
- fFunctions("AliRsnFunction", 0)
+(EPairType type, AliRsnPairDef *def, Int_t mixNum, Double_t mixVzCut, Int_t mixMultCut) :
+ TObject(),
+ fIsMixed(kFALSE),
+ fUseMC(kFALSE),
+ fIsLikeSign(kFALSE),
+ fMixNum(mixNum),
+ fMixingCut(0x0),
+ fPairDef(def),
+ fPairType(type),
+ fTypePID(AliRsnDaughter::kRealistic),
+ fCutMgr(0),
+ fFunctions("AliRsnFunction", 0)
{
//
// Default constructor
AliInfo(Form("Number of functions %d", fFunctions.GetEntries()));
switch(fTypePID) {
case AliRsnDaughter::kNoPID:
- AliInfo("PID method: none");
- break;
+ AliInfo("PID method: none");
+ break;
case AliRsnDaughter::kRealistic:
- AliInfo("PID method: realistic");
- break;
+ AliInfo("PID method: realistic");
+ break;
case AliRsnDaughter::kPerfect:
- AliInfo("PID method: perfect");
- break;
+ AliInfo("PID method: perfect");
+ break;
default:
- AliInfo("PID method: undefined");
+ AliInfo("PID method: undefined");
}
}
AliRsnEvent *e1 = buf->GetCurrentEvent();
if (!e1) return;
- if (e1->GetMultiplicity() < 1) return;
+// if (e1->GetMultiplicity() < 1) return;
TArrayI* array1 = e1->GetTracksArray(fTypePID, fPairDef->GetCharge(0), fPairDef->GetType(0));
-
+
Int_t i = 0;
Int_t numMixed = 0;
- Int_t lastOkEvent = 1;
+ Int_t lastOkEvent = 0;
TArrayI* array2 = 0;
for (i = 0; i < fMixNum; i++)
{
// find other event by event cut
- AliRsnEvent *e2 = FindEventByEventCut(buf, lastOkEvent);
+ AliRsnEvent *e2 = 0;
+ e2 = FindEventByEventCut(buf, lastOkEvent);
if (!e2) return;
- if (e2->GetMultiplicity() < 1) return;
+// if (e2->GetMultiplicity() < 1) continue;
array2 = e2->GetTracksArray(fTypePID, fPairDef->GetCharge(1), fPairDef->GetType(1));
LoopPair(e1, array1, e2, array2);
numMixed++;
+ lastOkEvent++;
}
// if (fIsMixed) AliInfo (Form ("NumMixed = %d",numMixed));
}
if (fIsMixed)
{
- returnEvent = buf->GetEvent(buf->GetEventsBufferIndex() - num);
+ //returnEvent = buf->GetEvent(buf->GetEventsBufferIndex() - num);
+ returnEvent = buf->GetNextGoodEvent(num);
}
else
{
// using the arrays of indexes and the events containing them.
//
- if (!a1) {AliError("No TArrayI 1 from currentEvent->GetTracksArray(...)"); return;}
- if (!a2) {AliError("No TArrayI 2 from currentEvent->GetTracksArray(...)"); return;}
+ if (!a1) {AliDebug(4, "No TArrayI 1 from currentEvent->GetTracksArray(...)"); return;}
+ if (!a2) {AliDebug(4, "No TArrayI 2 from currentEvent->GetTracksArray(...)"); return;}
AliRsnDaughter::SetPIDMethod(fTypePID);
AliRsnDaughter *daughter1 = 0;
}
//_____________________________________________________________________________
-TString AliRsnPair::GetPairTypeName(EPairType type)
+TString AliRsnPair::GetPairTypeName(EPairType type)
{
//
// Returns type name, made with particle names ant chosen PID
}
//_____________________________________________________________________________
-TString AliRsnPair::GetPairName()
+TString AliRsnPair::GetPairName()
{
//
// Retruns pair name
//
// Adds a new computing function
//
-// if (!fFunctions) fFunctions = new TList;
- //fFunctions.Add((AliRsnFunction *)fcn->Clone());
Int_t size = fFunctions.GetEntries();
new(fFunctions[size]) AliRsnFunction(*fcn);
- //fFunctions.AddLast(fcopy);
}
//________________________________________________________________________________________
enum EPairType
{
- kNoPID = 0, kNoPIDMix,
- kRealisticPID, kRealisticPIDMix,
- kPerfectPID, kPerfectPIDMix,
- kTruePairs,
- kPairTypes
+ kNoPID = 0, kNoPIDMix,
+ kRealisticPID, kRealisticPIDMix,
+ kPerfectPID, kPerfectPIDMix,
+ kTruePairs,
+ kPairTypes
};
- enum EOutputType
- {
- kInvMass = 0,
- kInvMassResolution,
- kOutputTypes
- };
-
-
- AliRsnPair (EPairType type = kRealisticPID, AliRsnPairDef *def = 0, Int_t mixNum = 1);
+ AliRsnPair(EPairType type = kRealisticPID, AliRsnPairDef *def = 0,
+ Int_t mixNum = 1, Double_t mixVzCut = 1.0, Int_t mixMultCut = 10);
~AliRsnPair();
void Init();
void Print();
void ProcessPair(AliRsnEventBuffer *buf);
void SetCutMgr(AliRsnCutMgr* theValue) { fCutMgr = theValue; }
+ void SetMixingCut(AliRsnCutSet* theValue) { fMixingCut = theValue; }
void AddFunction(AliRsnFunction *fcn);
TList* GenerateHistograms(TString prefix = "");
void GenerateHistograms(TString prefix, TList *tgt);
TString GetPairHistTitle(AliRsnFunction *fcn, TString text="");
private:
-
+
AliRsnPair (const AliRsnPair ©) : TObject(copy),
- fIsMixed(kFALSE),fUseMC(kFALSE),fIsLikeSign(kFALSE),fMixNum(1),
- fPairDef(0x0),fPairType(kPairTypes),fTypePID(AliRsnDaughter::kRealistic),
- fCutMgr(0x0),fFunctions("AliRsnFunction",0) {}
+ fIsMixed(kFALSE),fUseMC(kFALSE),fIsLikeSign(kFALSE),fMixNum(1),fMixingCut(0x0),
+ fPairDef(0x0),fPairType(kPairTypes),fTypePID(AliRsnDaughter::kRealistic),
+ fCutMgr(0x0),fFunctions("AliRsnFunction",0) {}
AliRsnPair& operator=(const AliRsnPair&) {return *this;}
void SetUp(EPairType type); // sets up all flags
AliRsnEvent* FindEventByEventCut(AliRsnEventBuffer *buf,Int_t & num);
void LoopPair(AliRsnEvent *ev1,TArrayI *a1,AliRsnEvent *ev2,TArrayI *a2);
- void FillHistogram(EOutputType type,AliRsnPairParticle*pairPart);
- void FillEffMass(EOutputType type,AliRsnPairParticle*pairPart);
- void FillResolution(EOutputType type,AliRsnPairParticle*pairPart);
-
- TString GetOutputTypeName(EOutputType type);
- TString GetOutputTypeTitle(EOutputType type);
-
Bool_t CutPass(AliRsnDaughter *d);
Bool_t CutPass(AliRsnPairParticle *p);
Bool_t CutPass(AliRsnEvent *e);
Bool_t fUseMC; // using MC inv. mass ?
Bool_t fIsLikeSign; // is a like-sign pair ?
Int_t fMixNum; // number of mixed events
+ AliRsnCutSet *fMixingCut; // cut for event mixing
// work management
AliRsnPairDef *fPairDef; // pair definition (particles, charges)
// must be defined before starting event processing.
//
- Int_t i;
- for (i = 0; i < 2; i++) {
- fCharge[i] = '0';
- fMass[i] = 0.0;
- fType[i] = AliRsnPID::kUnknown;
- }
+ Int_t i;
+ for (i = 0; i < 2; i++)
+ {
+ fCharge[i] = '0';
+ fMass[i] = 0.0;
+ fType[i] = AliRsnPID::kUnknown;
+ }
}
//_____________________________________________________________________________
// This constructor allows to define all the working parameters.
//
- SetPair(sign1, type1, sign2, type2);
+ SetPair(sign1, type1, sign2, type2);
}
//_____________________________________________________________________________
// This constructor allows to define all the working parameters.
//
- SetPair(sign1, type1, sign2, type2);
+ SetPair(sign1, type1, sign2, type2);
}
// Copy constructor with standard behavior
//
- SetPair(copy.fCharge[0], copy.fType[0], copy.fCharge[1], copy.fType[1]);
+ SetPair(copy.fCharge[0], copy.fType[0], copy.fCharge[1], copy.fType[1]);
}
//_____________________________________________________________________________
// Assignment operator with standard behavior.
//
- fMotherPDG = copy.fMotherPDG;
- SetPair(copy.fCharge[0], copy.fType[0], copy.fCharge[1], copy.fType[1]);
+ fMotherPDG = copy.fMotherPDG;
+ SetPair(copy.fCharge[0], copy.fType[0], copy.fCharge[1], copy.fType[1]);
- return (*this);
+ return (*this);
}
//_____________________________________________________________________________
// Set one element of the pair
// and returns warnings if the type is not valid.
//
- if (i < 0 || i > 1) {
- AliError("Index out of range");
- return kFALSE;
- }
- if (charge != '+' && charge != '-') {
- AliError(Form("Character '%c' not recognized as charge sign"));
- return kFALSE;
- }
- if (type < AliRsnPID::kElectron && type > AliRsnPID::kUnknown) {
- AliError("Type index out of enumeration range");
- return kFALSE;
- }
- fCharge[i] = charge;
- fType[i] = type;
- fMass[i] = AliRsnPID::ParticleMass(type);
-
- return kTRUE;
+ if (i < 0 || i > 1)
+ {
+ AliError("Index out of range");
+ return kFALSE;
+ }
+ if (charge != '+' && charge != '-')
+ {
+ AliError(Form("Character '%c' not recognized as charge sign"));
+ return kFALSE;
+ }
+ if (type < AliRsnPID::kElectron && type > AliRsnPID::kUnknown)
+ {
+ AliError("Type index out of enumeration range");
+ return kFALSE;
+ }
+ fCharge[i] = charge;
+ fType[i] = type;
+ fMass[i] = AliRsnPID::ParticleMass(type);
+
+ return kTRUE;
}
//_____________________________________________________________________________
// Set both elements of the pair,
// returning logical AND of check for each one.
//
- Bool_t part1 = SetPairElement(0, charge1, type1);
- Bool_t part2 = SetPairElement(1, charge2, type2);
-
- return (part1 && part2);
+ Bool_t part1 = SetPairElement(0, charge1, type1);
+ Bool_t part2 = SetPairElement(1, charge2, type2);
+
+ return (part1 && part2);
}
//_____________________________________________________________________________
// according to the order of appearance in argument list.
//
- Double_t prob0 = d0->PIDProb()[fType[0]];
- Double_t prob1 = d1->PIDProb()[fType[1]];
+ Double_t prob0 = d0->PIDProb()[fType[0]];
+ Double_t prob1 = d1->PIDProb()[fType[1]];
- return prob0*prob1;
+ return prob0*prob1;
}
//_____________________________________________________________________________
// Returns a compact string with the name of the pair,
// to be used for naming objects related to it.
//
-
- TString sName;
- sName += AliRsnPID::ParticleName(fType[0]);
- sName += fCharge[0];
- sName += AliRsnPID::ParticleName(fType[1]);
- sName += fCharge[1];
-
- return sName;
+
+ TString sName;
+ sName += AliRsnPID::ParticleName(fType[0]);
+ sName += fCharge[0];
+ sName += AliRsnPID::ParticleName(fType[1]);
+ sName += fCharge[1];
+
+ return sName;
}
-/**************************************************************************
- * 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 AliRsnPairMgr ***
+// Class AliRsnPairMgr
//
-// TODO
+// 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.
//
-// authors: A. Pulvirenti (email: alberto.pulvirenti@ct.infn.it)
-// M. Vala (email: martin.vala@cern.ch)
+// 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 )
+ClassImp(AliRsnPairMgr)
//_____________________________________________________________________________
-AliRsnPairMgr::AliRsnPairMgr ( const char*name )
- : TNamed ( name,name),fPairs(0)
+AliRsnPairMgr::AliRsnPairMgr(const char*name) :
+ TNamed(name,name),
+ fPairs(0)
{
-//=========================================================
+//
// Default constructor
-//=========================================================
-
+//
}
//_____________________________________________________________________________
AliRsnPairMgr::~AliRsnPairMgr()
{
-//=========================================================
+//
// Destructor
-//=========================================================
-
+//
}
//_____________________________________________________________________________
-void AliRsnPairMgr::AddPair ( AliRsnPair * pair )
+void AliRsnPairMgr::AddPair(AliRsnPair *pair)
{
-//=========================================================
+//
// Adds pair
-//=========================================================
+//
- fPairs.Add ( ( AliRsnPair * ) pair );
+ fPairs.Add((AliRsnPair*)pair);
}
//_____________________________________________________________________________
void AliRsnPairMgr::PrintPairs()
{
-//=========================================================
+//
// Prints all pairs
-//=========================================================
- AliRsnPair * pair=0;
- for ( Int_t i=0;i<fPairs.GetEntriesFast() ;i++ )
- {
- pair = ( AliRsnPair * ) fPairs.At ( i );
- pair->Print();
- }
+//
+
+ AliRsnPair *pair = 0;
+ TObjArrayIter next(&fPairs);
+ while ((pair = (AliRsnPair*)next())) pair->Print();
}
//
-// *** Class AliRsnPairMgr ***
+// Class AliRsnPairMgr
//
-// TODO
+// 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.
//
-// authors: A. Pulvirenti (email: alberto.pulvirenti@ct.infn.it)
-// M. Vala (email: martin.vala@cern.ch)
+// 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)
//
-#ifndef ALIRSNMVPAIRMGR_H
-#define ALIRSNMVPAIRMGR_H
+#ifndef ALIRSNPAIRMGR_H
+#define ALIRSNPAIRMGR_H
#include "AliRsnPair.h"
class AliRsnPairMgr : public TNamed
{
public:
- AliRsnPairMgr(const char*name="default");
+ AliRsnPairMgr(const char*name = "default");
~AliRsnPairMgr();
- void AddPair ( AliRsnPair *pair );
- TObjArray *GetPairs() { return &fPairs; }
- void PrintPairs();
+ void AddPair(AliRsnPair *pair);
+ TObjArray *GetPairs() { return &fPairs; }
+ void PrintPairs();
private:
- TObjArray fPairs; // array of pairs
-
- ClassDef ( AliRsnPairMgr, 1 )
+ TObjArray fPairs; // array of pairs
+
+ ClassDef(AliRsnPairMgr, 1)
};
#endif
-/**************************************************************************
- * 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 AliRsnPairParticle
//
// Implementation of a pair of tracks, for several purposes
// - computing the total 4-momentum & inv. mass for output histos filling
// - evaluating cut checks on the pair of particles
+// - evaluating any kind of kinematic value over their sum
//
-// author: Martin Vala (martin.vala@cern.ch)
-// revised by: Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it)
+// authors: Martin Vala (martin.vala@cern.ch)
+// Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it)
//
#include "AliLog.h"
// Mass in argument #1 is assigned to first track in the pair (fDaughter[0]),
// mass in argument #2 is assigned to second track in the pair (fDaughter[1])
// Then, the invariant mass of the pair is computed by using their total momentum
-// and the sum of their energies as they result from assigned masses.
+// and the sum of their energies computed after assigned masses.
//
if (!fDaughter[0] || !fDaughter[1])
// Mass in argument #1 is assigned to first track in the pair (fDaughter[0]),
// mass in argument #2 is assigned to second track in the pair (fDaughter[1])
// Then, the invariant mass of the pair is computed by using their total momentum
-// and the sum of their energies as they result from assigned masses.
+// and the sum of their energies.
//
if (!fDaughter[0] || !fDaughter[1])
etot += fDaughter[1]->GetMCInfo()->E(mass1);
// compute & return invariant mass
- return TMath::Sqrt(etot * etot - GetP2());
+ return TMath::Sqrt(etot * etot - GetP2MC());
}
//_____________________________________________________________________________
// Compute total pair energy from the sum of single track energies
// with a necessary mass hypothesis (rec. values).
//
- Double_t etot = 0.0;
- etot += fDaughter[0]->E(mass0);
- etot += fDaughter[1]->E(mass1);
-
- return etot;
+
+ Double_t etot = 0.0;
+ etot += fDaughter[0]->E(mass0);
+ etot += fDaughter[1]->E(mass1);
+
+ return etot;
}
//_____________________________________________________________________________
// Compute total pair energy from the sum of single track energies
// with a necessary mass hypothesis (MC values).
//
- Double_t etot = 0.0;
- etot += fDaughter[0]->GetMCInfo()->E(mass0);
- etot += fDaughter[1]->GetMCInfo()->E(mass1);
-
- return etot;
+ Double_t etot = 0.0;
+ etot += fDaughter[0]->GetMCInfo()->E(mass0);
+ etot += fDaughter[1]->GetMCInfo()->E(mass1);
+
+ return etot;
}
//_____________________________________________________________________________
for (i = 0; i < 3; i++) fPTot[i] = fPTrack[0][i] + fPTrack[1][i];
}
+//_____________________________________________________________________________
+void AliRsnPairParticle::ResetPair()
+{
+//
+// Computes the total momentum for REC data and MC if available
+//
+
+ Int_t i;
+
+ // copy MC info (if available)
+ if (fDaughter[0]->GetMCInfo() && fDaughter[1]->GetMCInfo())
+ {
+ for (i = 0; i < 2; i++)
+ {
+ fPTrackMC[i][0] = fDaughter[i]->GetMCInfo()->Px();
+ fPTrackMC[i][1] = fDaughter[i]->GetMCInfo()->Py();
+ fPTrackMC[i][2] = fDaughter[i]->GetMCInfo()->Pz();
+ fMotherPDG[i] = fDaughter[i]->GetMCInfo()->MotherPDG();
+ }
+ for (i = 0; i < 3; i++) fPTotMC[i] = fPTrackMC[0][i] + fPTrackMC[1][i];
+ }
+
+ // copy reconstructed info (always available)
+ for (i = 0; i < 2; i++)
+ {
+ fPTrack[i][0] = fDaughter[i]->Px();
+ fPTrack[i][1] = fDaughter[i]->Py();
+ fPTrack[i][2] = fDaughter[i]->Pz();
+ }
+ for (i = 0; i < 3; i++) fPTot[i] = fPTrack[0][i] + fPTrack[1][i];
+}
+
//_____________________________________________________________________________
void AliRsnPairParticle::PrintInfo(const Option_t *option)
{
-/**************************************************************************
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice *
- **************************************************************************/
-
//
// Class AliRsnPairParticle
//
// Implementation of a pair of tracks, for several purposes
// - computing the total 4-momentum & inv. mass for output histos filling
// - evaluating cut checks on the pair of particles
+// - evaluating any kind of kinematic value over their sum
//
-// author: Martin Vala (martin.vala@cern.ch)
-// revised by: Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it)
+// authors: Martin Vala (martin.vala@cern.ch)
+// Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it)
//
#ifndef ALIRSNPAIRPARTICLE_H
Double_t GetPz() const {return fPTot[2];}
Double_t GetPt() const {return TMath::Sqrt(GetPt2());}
Double_t GetPhi() const {return TMath::Pi() + TMath::ATan2(-fPTot[1], -fPTot[0]);}
- Double_t GetTheta() const {if(fPTot[2]==0.0){return TMath::PiOver2();}else{return TMath::ACos(fPTot[2]/GetP());}}
+ Double_t GetTheta() const {if (fPTot[2]==0.0){return TMath::PiOver2();}
+ else{return TMath::ACos(fPTot[2]/GetP());}}
Double_t GetEta() const {return -TMath::Log(TMath::ATan(0.5*GetTheta()));}
Double_t GetY(Double_t m1, Double_t m2) const {return 0.5*TMath::Log((GetEtot(m1,m2)+fPTot[2])/(GetEtot(m1,m2)-fPTot[2]));}
Double_t GetPzMC() const {return fPTotMC[2];}
Double_t GetPtMC() const {return TMath::Sqrt(GetPt2MC());}
Double_t GetPhiMC() const {return TMath::Pi() + TMath::ATan2(-fPTotMC[1], -fPTotMC[0]);}
- Double_t GetThetaMC() const {if(fPTotMC[2]==0.0){return TMath::PiOver2();}else{return TMath::ACos(fPTotMC[2]/GetPMC());}}
+ Double_t GetThetaMC() const {if (fPTotMC[2]==0.0){return TMath::PiOver2();}
+ else{return TMath::ACos(fPTotMC[2]/GetPMC());}}
Double_t GetEtaMC() const {return -TMath::Log(TMath::ATan(0.5*GetThetaMC()));}
Double_t GetYMC(Double_t m1, Double_t m2) const {return 0.5*TMath::Log((GetEtotMC(m1,m2)+fPTotMC[2])/(GetEtotMC(m1,m2)-fPTotMC[2]));}
Bool_t IsTruePair(Int_t refPDG = 0);
void SetPair(AliRsnDaughter *daughter1, AliRsnDaughter *daughter2);
+ void ResetPair();
void PrintInfo(const Option_t *option = "");
private:
fPIDDivValue(0.0),
fITSClusters(0),
fTPCClusters(0),
- fTRDClusters(0)
+ fTRDClusters(0),
+ fTrackRefs(0),
+ fTrackRefsITS(0),
+ fTrackRefsTPC(0)
{
//
// Constructor.
}
else
{
- vertex[0] = esd->GetPrimaryVertexTPC()->GetXv();
- vertex[1] = esd->GetPrimaryVertexTPC()->GetYv();
- vertex[2] = esd->GetPrimaryVertexTPC()->GetZv();
+ // 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();
+
+ // 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]);
// set index and label and add this object to the output container
temp.SetIndex(index);
temp.SetLabel(label);
+ temp.ShiftZero(vertex[0], vertex[1], vertex[2]);
AliRsnDaughter *ptr = rsn->AddTrack(temp);
// if problems occurred while storing, that pointer is NULL
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");
}
// compute total multiplicity
+ rsn->MakeComputations();
if (rsn->GetMultiplicity() <= 0)
{
AliDebug(1, "Zero multiplicity in this event");
rsn->SetPrimaryVertex(vertex[0], vertex[1], vertex[2]);
// store tracks from MC
- Int_t index, labmum;
+ Int_t i, index, labmum, nHitsITS, nHitsTPC, nRef;
Bool_t check;
AliRsnDaughter temp;
for (index = 0; index < ntracks; index++)
{
// get and check MC track
AliMCParticle *mcTrack = mc->GetTrack(index);
- // if particle has no track references, it is rejected
- if (mcTrack->GetNumberOfTrackReferences() <= 0) continue;
+ // check particle track references
+ nRef = mcTrack->GetNumberOfTrackReferences();
+ if (fTrackRefs > 0 && nRef < fTrackRefs) continue;
+ else if (fTrackRefsITS > 0 || fTrackRefsTPC > 0)
+ {
+ nHitsITS = nHitsTPC = 0;
+ for (i = 0; i < nRef; i++) {
+ AliTrackReference *trackRef = mcTrack->GetTrackReference(i);
+ if(trackRef)
+ {
+ Int_t detectorId = trackRef->DetectorId();
+ switch(detectorId) {
+ case AliTrackReference::kITS : nHitsITS++ ; break ;
+ case AliTrackReference::kTPC : nHitsTPC++ ; break ;
+ default : break ;
+ }
+ }
+ }
+ if (fTrackRefsITS > 0 && nHitsITS < fTrackRefsITS) continue;
+ if (fTrackRefsTPC > 0 && nHitsTPC < fTrackRefsTPC) continue;
+ }
// try to insert in the RsnDaughter its data
check = temp.Adopt(mcTrack);
if (!check) continue;
}
// compute total multiplicity
+ rsn->MakeComputations();
if (rsn->GetMultiplicity() <= 0)
{
AliDebug(1, "Zero multiplicity in this event");
// sets PID TYPE
void SetPIDtype(const AliRsnDaughter::EPIDType& theValue = AliRsnDaughter::kEsd, Double_t divValue = 0.0);
AliRsnDaughter::EPIDType GetPIDtype() const { return fCurrentPIDtype; }
+
+ // set limits in track references
+ void SetTrackRefs(Int_t value) {fTrackRefs = value;}
+ void SetTrackRefsITS(Int_t value) {fTrackRefsITS = value;}
+ void SetTrackRefsTPC(Int_t value) {fTrackRefsTPC = value;}
// sets Sectors cut
void SetITSTPCTRDSectors(const Int_t& its = -1, const Int_t& tpc = -1, const Int_t& trd = -1);
Int_t fITSClusters; //
Int_t fTPCClusters; //
Int_t fTRDClusters; //
+ Int_t fTrackRefs; // minimum required track references for MC reading
+ Int_t fTrackRefsITS; // minimum required track references for MC reading (ITS)
+ Int_t fTrackRefsTPC; // minimum required track references for MC reading (TPC)
+
private:
//_____________________________________________________________________________
AliRsnReaderTask::AliRsnReaderTask() :
- AliRsnBaseAT(),
+ AliRsnAnalysisTaskBase(),
fRsnTree(0x0)
{
//=========================================================
//_____________________________________________________________________________
AliRsnReaderTask::AliRsnReaderTask(const char *name) :
- AliRsnBaseAT(name),
+ AliRsnAnalysisTaskBase(name),
fRsnTree(0x0)
{
//=========================================================
//_____________________________________________________________________________
AliRsnReaderTask::AliRsnReaderTask(const AliRsnReaderTask& obj) :
- AliRsnBaseAT(obj),
+ AliRsnAnalysisTaskBase(obj),
fRsnTree(0x0)
{
//=========================================================
// Init values for input and output data
//=========================================================
AliDebug(AliLog::kDebug, "<-");
- AliRsnBaseAT::InitIOVars();
+ AliRsnAnalysisTaskBase::InitIOVars();
AliDebug(AliLog::kDebug, "->");
}
#ifndef ALIRSNREADERTASK_H
#define ALIRSNREADERTASK_H
-#include "AliRsnBaseAT.h"
+#include "AliRsnAnalysisTaskBase.h"
class AliRsnPID;
class AliRsnReader;
-class AliRsnReaderTask : public AliRsnBaseAT
+class AliRsnReaderTask : public AliRsnAnalysisTaskBase
{
public:
// 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;
- }
+ {
+ 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
class AliRsnReaderTaskSE : public AliRsnAnalysisTaskSEBase
{
-public:
+ public:
AliRsnReaderTaskSE();
AliRsnReaderTaskSE(const char *name);
// AliRsnPID* GetPID() {return fPID;}
AliRsnEvent* GetCurrentEvent() {return fRsnEvent;}
-private:
+ private:
AliRsnReaderTaskSE(const AliRsnReaderTaskSE ©) :
- AliRsnAnalysisTaskSEBase(copy),fRsnEvent(0x0) { /*nothing*/ }
+ AliRsnAnalysisTaskSEBase(copy),fRsnEvent(0x0) { /*nothing*/ }
AliRsnReaderTaskSE& operator=(const AliRsnReaderTaskSE&)
- { /*nothing*/ return (*this); }
+ { /*nothing*/ return (*this); }
AliRsnEvent *fRsnEvent; // output events in the AliRsnEvent format