#pragma link C++ class AliRsnPairDef+;
#pragma link C++ class AliRsnHistoDef+;
+#pragma link C++ class AliRsnFunctionDef+;
#pragma link C++ class AliRsnFunction+;
+#pragma link C++ class AliRsnFunctionNew+;
#pragma link C++ class AliRsnPair+;
#pragma link C++ class AliRsnPairMgr+;
{
mgr = (AliRsnPairMgr *) fPairMgrs.At(iMgr);
if (!mgr) continue;
- listTmp = new TList();
- listTmp->SetName(mgr->GetName());
+ //listTmp = new TList();
+ //listTmp->SetName(mgr->GetName());
for (Int_t i=0;i< mgr->GetPairs()->GetEntriesFast();i++)
{
def = (AliRsnPair *) mgr->GetPairs()->At(i);
if (def)
{
- listTmp->Add(def->GenerateHistograms(mgr->GetName()));
+ //listTmp->Add(def->GenerateHistograms(mgr->GetName()));
+ def->GenerateHistograms(mgr->GetName(), fOutList);
if (def->IsMixed()) fDoesMixing = kTRUE;
}
}
- fOutList->Add(listTmp);
+ //fOutList->Add(listTmp);
}
TH1I *hUsed = new TH1I("hRsnUsed", "skipped and used events in this analysis", 2, 0, 2);
: AliAnalysisTask(name, ""),
fNumOfEvents(100),
fUseAutoHandler(100),
- fRsnInput(),
fReader(),
fPID(),
fAnalysisMgr(0x0)
{
fChain[i] = 0;
fRSN[i] = 0;
- fESD[i] = 0;
- fMC[i] = 0;
- fAOD[i] = 0;
- fESDEH[i] = 0;
- fMCEH[i] = 0;
- fAODEH[i] = 0;
+ fRsnESD[i] = 0;
+ fRsnMC[i] = 0;
+ fRsnAOD[i] = 0;
+ fRsnESDEH[i] = 0;
+ fRsnMCEH[i] = 0;
+ fRsnAODEH[i] = 0;
fInputType[i] = kRSN;
}
return AliAnalysisTask::Notify();
}
-//________________________________________________________________________
-void AliRsnAnalysisTaskBase::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.
-// When autohandler is kTRUE handlers are created and sets
-// to AliAnalysisManager (fAnalysisMgr) if exists
-//=========================================================
-
- AliDebug(AliLog::kDebug, "<-");
+// When autohandler is kTRUE handlers are created and connected
+// to the passed AliAnalysisManager if it exists.
+// The internal AliAnalysisManager object is redirected to the passed one.
+//
fInputType[inputIndex] = type;
fAnalysisMgr = am;
UseAutoHandler(autohandler);
-
if (!fUseAutoHandler) return;
if (!fAnalysisMgr)
{
- AliWarning(Form("fAnalysisMgr is %p and fUseAutoHandler is %d",fAnalysisMgr,fUseAutoHandler));
+ AliWarning(Form("fAnalysisMgr is %p and fUseAutoHandler is %d", fAnalysisMgr, fUseAutoHandler));
return;
}
switch (fInputType[inputIndex])
{
case kAOD:
- {
- if (fAnalysisMgr)
- {
- fAODEH[0] = new AliAODInputHandler();
- if (fAODEH[0])
- fAnalysisMgr->SetInputEventHandler(fAODEH[0]);
- }
+ fRsnAODEH[0] = new AliAODInputHandler();
+ if (fRsnAODEH[0]) fAnalysisMgr->SetInputEventHandler(fRsnAODEH[0]);
break;
- }
case kESD:
- {
- if (fAnalysisMgr)
- {
- fESDEH[0] = new AliESDInputHandler();
- if (fESDEH[0])
- fAnalysisMgr->SetInputEventHandler(fESDEH[0]);
- }
-
+ case kESDTPC:
+ fRsnESDEH[0] = new AliESDInputHandler();
+ if (fRsnESDEH[0]) fAnalysisMgr->SetInputEventHandler(fRsnESDEH[0]);
break;
- }
case kESDMC:
- {
- if (fAnalysisMgr)
+ case kESDMCTPC:
+ case kMC:
+ fRsnESDEH[0] = new AliESDInputHandler();
+ fRsnMCEH[0] = new AliMCEventHandler();
+ if ((fRsnESDEH[0]) && (fRsnMCEH[0]))
{
- fESDEH[0] = new AliESDInputHandler();
- fMCEH[0] = new AliMCEventHandler();
- if ((fESDEH[0]) && (fMCEH[0]))
- {
- fAnalysisMgr->SetInputEventHandler(fESDEH[0]);
- fAnalysisMgr->SetMCtruthEventHandler(fMCEH[0]);
- }
+ fAnalysisMgr->SetInputEventHandler(fRsnESDEH[0]);
+ fAnalysisMgr->SetMCtruthEventHandler(fRsnMCEH[0]);
}
break;
- }
- case kMC:
- AliError("Not Implemented Yet ...");
- break;
case kRSN:
- {
- AliError("Not Implemented Yet ...");
break;
- }
default:
AliError("Type not supported ...");
break;
}
- AliDebug(AliLog::kDebug, "->");
-}
+ // check if the TPC only is used
+ if (fInputType[inputIndex] == kESDTPC || fInputType[inputIndex] == kESDMCTPC) fReader.SetTPCOnly();
+
+}
//________________________________________________________________________
void AliRsnAnalysisTaskBase::ConnectInputData(Option_t *)
{
switch (type)
{
case kAOD:
- {
ConnectAOD(inputIndex);
break;
- }
case kESD:
- {
+ case kESDTPC:
ConnectESD(inputIndex);
break;
- }
case kESDMC:
- {
- ConnectESDMC(inputIndex);
- break;
- }
+ case kESDMCTPC:
case kMC:
- AliError("Not Implemented Yet ...");
+ ConnectESDMC(inputIndex);
break;
case kRSN:
- {
ConnectRSN(inputIndex);
break;
- }
default:
AliError("Type not supported ...");
break;
}
+
AliDebug(AliLog::kDebug, "->");
}
-//________________________________________________________________________
+//_____________________________________________________________________________
void AliRsnAnalysisTaskBase::ConnectRSN(Short_t inputIndex)
{
-//=========================================================
+//
// Connect input data by RSN input type
-//=========================================================
+//
AliDebug(AliLog::kDebug, "<-");
+
char ** address = (char **) GetBranchAddress(inputIndex, "rsnEvents");
if (address)
{
fRSN[inputIndex] = 0;
SetBranchAddress(inputIndex, "rsnEvents", &fRSN[inputIndex]);
}
+
AliDebug(AliLog::kDebug, "->");
}
+//_____________________________________________________________________________
void AliRsnAnalysisTaskBase::ConnectESD(Short_t inputIndex)
{
-//=========================================================
+//
// Connect input data by ESD input type
-//=========================================================
-
+//
AliDebug(AliLog::kDebug, "<-");
-
TTree* tree = dynamic_cast<TTree*>(GetInputData(inputIndex));
if (!tree) { AliError("Could not read chain from input slot 0"); }
else
if (!esdH) { AliError("Could not get ESDInputHandler"); }
else
- fESD[inputIndex] = esdH->GetEvent();
+ fRsnESD[inputIndex] = esdH->GetEvent();
}
AliDebug(AliLog::kDebug, "->");
-
}
-//________________________________________________________________________
+
+//_____________________________________________________________________________
void AliRsnAnalysisTaskBase::ConnectESDMC(Short_t inputIndex)
{
-//=========================================================
+//
// Connect input data by ESDMC input type
-//=========================================================
+//
AliDebug(AliLog::kDebug, "<-");
-
-
TTree* tree = dynamic_cast<TTree*>(GetInputData(inputIndex));
if (!tree) { AliError("Could not read chain from input slot 0"); }
else
if (!esdH) { AliError("Could not get ESDInputHandler"); }
else
- fESD[inputIndex] = esdH->GetEvent();
+ fRsnESD[inputIndex] = esdH->GetEvent();
}
AliDebug(AliLog::kDebug, "->");
-
}
-//________________________________________________________________________
+
+//_____________________________________________________________________________
void AliRsnAnalysisTaskBase::ConnectAOD(Short_t inputIndex)
{
-//=========================================================
+//
// Connect input data by AOD input type
-//=========================================================
+//
AliDebug(AliLog::kDebug, "<-");
else
{
AliAODInputHandler *aodH = dynamic_cast<AliAODInputHandler*>(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
-
if (!aodH) { AliError("Could not get AODInputHandler"); }
- else
- {
- fAOD[inputIndex] = aodH->GetEvent();
- }
+ else fRsnAOD[inputIndex] = aodH->GetEvent();
}
+
AliDebug(AliLog::kDebug, "->");
}
-//________________________________________________________________________
+//_____________________________________________________________________________
AliRsnEvent * AliRsnAnalysisTaskBase::GetRsnEventFromInputType(const Short_t & index)
{
-//=========================================================
-// Gets Evetn from input type
-//=========================================================
+//
+// Gets Event from input type
+//
switch (fInputType[index])
{
- case kAOD:
- {
- return GetRsnFromAOD(index);
- break;
- }
- case kESD:
- {
- AliWarning("Not Implemented Yet ...");
- return GetRsnFromESD(index);
- break;
- }
- case kESDMC:
- {
- return GetRsnFromESDMC(index);
- break;
- }
- case kMC:
- AliWarning("Not Implemented Yet ...");
- return (AliRsnEvent*) 0x0;
- break;
- case kRSN:
- {
- return GetRsnFromRSN(index);
- break;
- }
+ case kAOD: return GetRsnFromAOD(index);
+ case kESD: return GetRsnFromESD(index);
+ case kESDMC: return GetRsnFromESDMC(index);
+ case kESDTPC: return GetRsnFromESD(index);
+ case kESDMCTPC: return GetRsnFromESDMC(index);
+ case kMC: return GetRsnFromMC(index);
+ case kRSN: return GetRsnFromRSN(index);
default:
AliError("Type not supported ...");
return (AliRsnEvent*) 0x0;
- break;
}
+
return (AliRsnEvent*) 0x0;
}
-
-
-//________________________________________________________________________
+//_____________________________________________________________________________
AliRsnEvent * AliRsnAnalysisTaskBase::GetRsnFromAOD(const Short_t & index)
{
-//=========================================================
+//
// Gets RSN event from AOD
-//=========================================================
+//
- if (!fAOD[index]) { AliError("fAOD not available."); return (AliRsnEvent *) 0x0; }
+ if (!fRsnAOD[index])
+ {
+ AliError("fRsnAOD not available.");
+ return (AliRsnEvent *) 0x0;
+ }
if (!fRSN[0])
{
fRSN[0]->SetName("rsnEvents");
fRSN[0]->Init();
}
+
// clear pevious event
fRSN[0]->Clear();
-
- if (!fReader.Fill(fRSN[0], (AliVEvent*) fAOD[index]))
- {
- return (AliRsnEvent*) 0x0;
- };
-
+ if (!fReader.FillFromAOD(fRSN[0], fRsnAOD[index])) return (AliRsnEvent*) 0x0;
if (!fPID.Process(fRSN[0])) AliWarning("Failed PID");
return (AliRsnEvent*) fRSN[0];
-
}
-//________________________________________________________________________
+
+//_____________________________________________________________________________
AliRsnEvent * AliRsnAnalysisTaskBase::GetRsnFromESD(const Short_t & index)
{
-//=========================================================
+//
// Gets RSN event from ESD
-//=========================================================
+//
- if (!fESD[index]) { AliError("fESD not available."); return (AliRsnEvent *) 0x0; }
+ if (!fRsnESD[index])
+ {
+ AliError("fRsnESD not available.");
+ return (AliRsnEvent *) 0x0;
+ }
if (!fRSN[index])
{
fRSN[index]->SetName("rsnEvents");
fRSN[index]->Init();
}
+
// clear pevious event
fRSN[index]->Clear();
- if (!fReader.Fill(fRSN[index], (AliVEvent*) fESD[index]))
+ if (!fReader.FillFromESD(fRSN[index], fRsnESD[index], 0x0)) return (AliRsnEvent*) 0x0;
+
+ if (!fPID.Process(fRSN[index]))
{
+ AliWarning("Failed PID");
return (AliRsnEvent*) 0x0;
- };
-
- if (!fPID.Process(fRSN[index])) AliWarning("Failed PID");
+ }
return fRSN[index];
}
-//________________________________________________________________________
-AliRsnEvent * AliRsnAnalysisTaskBase::GetRsnFromESDMC(const Short_t & index)
+
+//_____________________________________________________________________________
+AliRsnEvent * AliRsnAnalysisTaskBase::GetRsnFromMC(const Short_t & index)
{
-//=========================================================
-// Gets RSN event from ESD and MC
-//=========================================================
+//
+// Gets RSN event from ESD
+//
- if (!fESD[index]) { AliError("fESD not available."); return (AliRsnEvent *) 0x0; }
AliMCEventHandler* mcHandler = dynamic_cast<AliMCEventHandler*>(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
if (!mcHandler) { AliError("Could not retrieve MC event handler"); return (AliRsnEvent *) 0x0; }
+ if (!fRsnESD[index])
+ {
+ AliError("fRsnESD not available.");
+ return (AliRsnEvent *) 0x0;
+ }
+
if (!fRSN[index])
{
fRSN[index] = new AliRsnEvent();
fRSN[index]->SetName("rsnEvents");
fRSN[index]->Init();
}
+
// clear pevious event
fRSN[index]->Clear();
- fMC[index] = mcHandler->MCEvent();
+ fRsnMC[index] = mcHandler->MCEvent();
- if (!fMC[index]) return (AliRsnEvent *) 0x0;
+ if (!fRsnMC[index]) return (AliRsnEvent *) 0x0;
+ if (!fReader.FillFromMC(fRSN[index], fRsnMC[index])) return (AliRsnEvent*) 0x0;
+ fPID.Process(fRSN[index]);
+ return fRSN[index];
+}
+
+//_____________________________________________________________________________
+AliRsnEvent * AliRsnAnalysisTaskBase::GetRsnFromESDMC(const Short_t & index)
+{
+//
+// Gets RSN event from ESD and MC
+//
- if (!fReader.Fill(fRSN[index], (AliVEvent*) fESD[index],fMC[index]))
+ AliMCEventHandler* mcHandler = dynamic_cast<AliMCEventHandler*>(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
+ if (!mcHandler) { AliError("Could not retrieve MC event handler"); return (AliRsnEvent *) 0x0; }
+
+ if (!fRsnESD[index])
{
- return (AliRsnEvent*) 0x0;
- };
+ AliError("fRsnESD not available.");
+ return (AliRsnEvent *) 0x0;
+ }
+ if (!fRSN[index])
+ {
+ fRSN[index] = new AliRsnEvent();
+ fRSN[index]->SetName("rsnEvents");
+ fRSN[index]->Init();
+ }
+
+ // clear pevious event
+ fRSN[index]->Clear();
+ fRsnMC[index] = mcHandler->MCEvent();
+
+ if (!fRsnMC[index]) return (AliRsnEvent *) 0x0;
+ if (!fReader.FillFromESD(fRSN[index], fRsnESD[index], fRsnMC[index])) return (AliRsnEvent*) 0x0;
if (!fPID.Process(fRSN[index]))
{
AliWarning("Failed PID");
return fRSN[index];
}
-//________________________________________________________________________
+
+//_____________________________________________________________________________
AliRsnEvent * AliRsnAnalysisTaskBase::GetRsnFromRSN(const Short_t & index)
{
-//=========================================================
+//
// Gets RSN event from RSN
// not fully implemented yet
-//=========================================================
-
+//
AliRsnEvent *event = fRSN[index];
-// if ( fRsnEventBuffer->GetDeleteBufferWhenReset() == kTRUE )
-// {
-// event = ( AliRsnEvent * ) fRSN[index]->Clone();
-// }
-// AliInfo ( Form ( "%p %p",event,fRSN[index] ) );
return event;
}
-
-//________________________________________________________________________
-void AliRsnAnalysisTaskBase::UseAutoHandler(const Bool_t & theValue)
-{
-//=========================================================
-// Sets should create handlers
-//=========================================================
- fUseAutoHandler = theValue;
-}
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
+ fReader(),fPID(),fAnalysisMgr(0x0) {}\r
AliRsnAnalysisTaskBase& operator= (const AliRsnAnalysisTaskBase&) {return *this;}\r
virtual ~AliRsnAnalysisTaskBase() {/* Does nothing*/}\r
\r
kAOD = 0,\r
kESD,\r
kESDMC,\r
+ kESDTPC,\r
+ kESDMCTPC,\r
kMC,\r
kRSN,\r
kLastIndex\r
void SetAnalysisMgr(AliAnalysisManager* theValue) { fAnalysisMgr = theValue; }\r
AliAnalysisManager* GetAnalysisMgr() const { return fAnalysisMgr; }\r
\r
- AliESDInputHandler* GetESDHandler(const Int_t& theValue=0) const { return fESDEH[theValue]; }\r
- AliMCEventHandler* GetMCHandler(const Int_t& theValue=0) const { return fMCEH[theValue]; }\r
- AliAODInputHandler* GetAODHandler(const Int_t& theValue=0) const { return fAODEH[theValue]; }\r
+ AliESDInputHandler* GetESDHandler(const Int_t& theValue=0) const { return fRsnESDEH[theValue]; }\r
+ AliMCEventHandler* GetMCHandler(const Int_t& theValue=0) const { return fRsnMCEH[theValue]; }\r
+ AliAODInputHandler* GetAODHandler(const Int_t& theValue=0) const { return fRsnAODEH[theValue]; }\r
\r
AliRsnReader *GetReader() { return &fReader; }\r
AliRsnPID *GetPID() { return &fPID;}\r
\r
Long64_t fNumOfEvents; // number of events\r
\r
- TChain *fChain[2]; // input chain\r
+ TChain *fChain[2]; // input chain\r
EInputType fInputType[2]; // input type\r
Bool_t fUseAutoHandler; // flag if should create handler\r
\r
- AliRsnEvent *fRSN[2]; // RsnMV event\r
- AliESDEvent *fESD[2]; // ESD event\r
- AliMCEvent *fMC[2]; // ESD event\r
- AliAODEvent *fAOD[2]; // AOD event\r
+ AliRsnEvent *fRSN[2]; // RSN (internal format) event\r
+ AliESDEvent *fRsnESD[2]; // ESD event\r
+ AliMCEvent *fRsnMC[2]; // ESD event\r
+ AliAODEvent *fRsnAOD[2]; // AOD event\r
\r
- AliESDInputHandler *fESDEH[2]; // ESD event handler\r
- AliMCEventHandler *fMCEH[2]; // ESD event handler\r
- AliAODInputHandler *fAODEH[2]; // AOD event handler\r
+ AliESDInputHandler *fRsnESDEH[2]; // ESD event handler\r
+ AliMCEventHandler *fRsnMCEH[2]; // ESD event handler\r
+ AliAODInputHandler *fRsnAODEH[2]; // AOD event handler\r
\r
-\r
- TObjArray fRsnInput; // array of rsn input (reader,pid,...)\r
- AliRsnReader fReader; // Reader\r
- AliRsnPID fPID; // PID\r
+ AliRsnReader fReader; // Reader\r
+ AliRsnPID fPID; // PID\r
\r
AliAnalysisManager *fAnalysisMgr; // pointer to current AnalysisMgr\r
\r
- virtual void UseAutoHandler(const Bool_t& theValue);\r
+ virtual void UseAutoHandler(const Bool_t& theValue) {fUseAutoHandler = theValue;}\r
\r
virtual void ConnectInputDataByInputType(EInputType type ,Short_t inputIndex=0);\r
virtual void ConnectRSN(Short_t inputIndex);\r
virtual AliRsnEvent* GetRsnFromESD(const Short_t &index=0);\r
virtual AliRsnEvent* GetRsnFromESDMC(const Short_t &index=0);\r
virtual AliRsnEvent* GetRsnFromRSN(const Short_t &index=0);\r
+ virtual AliRsnEvent* GetRsnFromMC(const Short_t &index=0);\r
\r
\r
ClassDef(AliRsnAnalysisTaskBase, 1)\r
cut = IsBetween(daughter->PIDProb()[(AliRsnPID::EType)fIMin]);
//cout << (AliRsnPID::EType)fIMin << ' ' << daughter->PIDProb()[(AliRsnPID::EType)fIMin] << ' ' << (cut?"OK":"NO") << endl;
return cut;
+ case kAssignedPID:
+ pidType = daughter->AssignedPID();
+ return MatchesValue((Int_t)pidType);
case kTruePID:
pdg = TMath::Abs(mcinfo->PDG());
cut = MatchesValue(pdg);
switch (fType)
{
+ case kTrueMultiplicity:
+ return IsBetween((Int_t) event->GetTrueMultiplicity());
case kMultiplicity:
return IsBetween((Int_t) event->GetMultiplicity());
case kVz:
switch (fType)
{
case kMultiplicityDifference:
- valueI = TMath::Abs(ev1->GetMultiplicity() - ev2->GetMultiplicity());
+ valueI = TMath::Abs(ev1->GetTrueMultiplicity() - ev2->GetTrueMultiplicity());
return IsBetween((Int_t)valueI);
case kMultiplicityRatio:
mult1 = (Double_t)ev1->GetMultiplicity();
kPIDType,
kPIDProb,
kPIDProbForSpecies,
+ kAssignedPID,
kTruePID,
kVz,
+ kTrueMultiplicity,
kMultiplicity,
kMultiplicityDifference,
kMultiplicityRatio,
}
//_____________________________________________________________________________
-void AliRsnDaughter::AssignRealisticPID()
+void AliRsnDaughter::RealisticPID()
{
//
// Assign realistic PID from largest probability
// 4-momentum
virtual Double_t E() const {return TMath::Sqrt(fMass*fMass + P2());}
virtual Double_t E(Double_t mass) {SetM(mass); return E();}
+ virtual Double_t E(AliRsnPID::EType pid) {AssignPID(pid); return E();}
virtual Double_t M() const {return fMass;}
virtual Double_t P2() const {return Px()*Px() + Py()*Py() + Pz()*Pz();}
virtual Double_t P() const {return TMath::Sqrt(P2());}
void SetPIDProb(Int_t i, Double_t value) {if (i>=0&&i<AliRsnPID::kSpecies)fPIDProb[i]=value;}
void SetPIDWeight(Int_t i, Double_t value) {if (i>=0&&i<AliRsnPID::kSpecies)fPIDWeight[i]=value;}
static void SetPIDMethod(EPIDMethod method) {fgPIDMethod = method;}
- void AssignRealisticPID();
+ void RealisticPID();
+ void AssignPID(AliRsnPID::EType pid) {fAssignedPID = pid; fMass = AliRsnPID::ParticleMass(pid);}
AliRsnPID::EType PIDType(Double_t &prob) const;
+ AliRsnPID::EType AssignedPID() {return fAssignedPID;}
// check that contains a given ESD flag
void SetFlags(ULong_t flags) {fFlags = flags;}
Int_t fITSnum; // number of ITS clusters
Int_t fTPCnum; // number of TPC clusters
+ AliRsnPID::EType fAssignedPID; // PID assigned to define mass
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
void SetPrimaryVertexMC(Double_t x, Double_t y, Double_t z) {fPVxMC=x;fPVyMC=y;fPVzMC=z;}
// Multiplicity
+ void SetTrueMultiplicity(Int_t value) {fTrueMult = value;}
+ Int_t GetTrueMultiplicity() {return fTrueMult;}
Int_t GetMultiplicity() const {return fMult;}
Int_t GetNCharged(Char_t sign);
Double_t fPVzMC; // vertex in MC
TClonesArray *fTracks; // collection of particles
+ Int_t fTrueMult; // true multiplicity taken from source event
AliRsnPIDIndex *fNoPID; // array index only for charged tracks
AliRsnPIDIndex *fPerfectPID; // array index for perfect PID
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
--- /dev/null
+//
+// Class AliRsnFunctionDef
+//
+// This class defines a base classe to implement a function
+// which uses the internal RSN package event format (AliRsnEvent).
+// It contains some default flags which turn out to be useful:
+// - a flag to select only the "true" pairs (tracks from same resonance)
+// - a flag to know if the computation is done over two events (mixing)
+//
+// Any kind of analysis object should be implemented as inheriting from this
+// because the AliRsnAnalyzer which executes the analysis will accept a collection
+// of such objects, in order to have a unique format of processing method
+//
+// The user who implements a kind of computation type should inherit from
+// this class and override the virtual functions defined in it, which
+// initialize the final output histogram and define how to process data.
+//
+//
+// author: A. Pulvirenti (email: alberto.pulvirenti@ct.infn.it)
+//
+
+#include <Riostream.h>
+
+#include <TH1.h>
+#include <TList.h>
+#include <TString.h>
+
+#include "AliLog.h"
+
+#include "AliRsnPairParticle.h"
+#include "AliRsnPairDef.h"
+//#include "AliRsnCut.h"
+//#include "AliRsnMCInfo.h"
+//#include "AliRsnDaughter.h"
+//#include "AliRsnEvent.h"
+
+
+#include "AliRsnFunctionDef.h"
+
+ClassImp(AliRsnFunctionDef)
+
+//________________________________________________________________________________________
+AliRsnFunctionDef::AliRsnFunctionDef() :
+ fFcnType(kFcnTypes),
+ fNBinsX(0),
+ fXmin(0.0),
+ fXmax(0.0),
+ fYUsed(0),
+ fRotAngle(0.0)
+{
+ //
+ // Constructor.
+ // The histogram data member cannot be passed externally,
+ // its initialization MUST be defined inside the Init() method,
+ // which must be overridden in any derivate implementation.
+ //
+
+ Int_t j;
+ for (j = 0 ; j < kBinMax; j++)
+ {
+ fNBinsY[j] = 0;
+ fYbins[j].Set(0);
+ }
+}
+
+//________________________________________________________________________________________
+AliRsnFunctionDef::AliRsnFunctionDef
+(EFcnType type, Int_t nbins, Double_t min, Double_t max) :
+ fFcnType(type),
+ fNBinsX(nbins),
+ fXmin(min),
+ fXmax(max),
+ fYUsed(0),
+ fRotAngle(0.0)
+{
+ //
+ // Constructor.
+ // The histogram data member cannot be passed externally,
+ // its initialization MUST be defined inside the Init() method,
+ // which must be overridden in any derivate implementation.
+ //
+
+ Int_t j;
+ for (j = 0 ; j < kBinMax; j++)
+ {
+ fNBinsY[j] = 0;
+ fYbins[j].Set(0);
+ }
+}
+
+//________________________________________________________________________________________
+AliRsnFunctionDef::AliRsnFunctionDef(const AliRsnFunctionDef ©) :
+ TObject(copy),
+ fFcnType(copy.fFcnType),
+ fNBinsX(copy.fNBinsX),
+ fXmin(copy.fXmin),
+ fXmax(copy.fXmax),
+ fYUsed(copy.fYUsed),
+ fRotAngle(copy.fRotAngle)
+{
+ //
+ // Copy constructor.
+ // Calls the functions to define binning.
+ //
+
+ Int_t i, j, nbins;
+
+ for (i = 0; i < fYUsed; i++)
+ {
+ nbins = copy.fNBinsY[i];
+ if (!nbins) continue;
+ fYbins[i].Set(nbins);
+ for (j = 0; j < nbins; j++) fYbins[i][j] = copy.fYbins[i][j];
+ }
+}
+//________________________________________________________________________________________
+const AliRsnFunctionDef& AliRsnFunctionDef::operator=(const AliRsnFunctionDef& copy)
+{
+ //
+ // Assignment operator.
+ // Behaves like copy constructor.
+ // Also in this case, the histogram is not copied, and,
+ // if it was present, it is destroyed and will need to be recreated.
+ //
+
+ fFcnType = copy.fFcnType;
+ fNBinsX = copy.fNBinsX;
+ fXmin = copy.fXmin;
+ fXmax = copy.fXmax;
+ fYUsed = copy.fYUsed;
+ fRotAngle = copy.fRotAngle;
+
+ Int_t i, j, nbins;
+
+ for (i = 0; i < fYUsed; i++)
+ {
+ nbins = copy.fNBinsY[i];
+ if (!nbins) continue;
+ fYbins[i].Set(nbins);
+ for (j = 0; j < nbins; j++) fYbins[i][j] = copy.fYbins[i][j];
+ }
+
+ return (*this);
+}
+
+//________________________________________________________________________________________
+void AliRsnFunctionDef::SetBinningY
+(Int_t i, EFcnBinType type, Double_t xmin, Double_t xmax, Double_t step)
+{
+//
+// Define a secondary binning with fixed bins of given step
+//
+
+ if (i >= fYUsed) return;
+
+ Int_t ib;
+
+ fBinType[i] = type;
+ fNBinsY[i] = (Int_t)((xmax - xmin) / step) + 2;
+ fYbins[i].Set(fNBinsY[i]);
+
+ for (ib = 0; ib < fNBinsY[i]; ib++)
+ {
+ fYbins[i][ib] = xmin + (Double_t)ib * step;
+ }
+}
+
+//________________________________________________________________________________________
+void AliRsnFunctionDef::SetBinningY
+(Int_t i, EFcnBinType type, Int_t nbins, Double_t *bins)
+{
+//
+// Define a secondary binning with variable bins
+//
+
+ if (i >= fYUsed) return;
+
+ fBinType[i] = type;
+
+ Int_t ib;
+
+ fYbins[i].Set(nbins);
+ fNBinsY[i] = nbins;
+ for (ib = 0; ib < nbins; ib++)
+ {
+ fYbins[i][ib] = bins[ib];
+ }
+}
+
+//________________________________________________________________________________________
+Bool_t AliRsnFunctionDef::AddBinningY(EFcnBinType type, Double_t xmin, Double_t xmax, Double_t step)
+{
+//
+// Add a new secondary binning with fixed bins of given step
+//
+
+ if (fYUsed >= kBinMax)
+ {
+ AliError(Form("Cannot create a new binning: maximum allowed of %d is reached", kBinMax));
+ return kFALSE;
+ }
+
+ fYUsed++;
+ SetBinningY(fYUsed - 1, type, xmin, xmax, step);
+
+ return kTRUE;
+}
+
+//________________________________________________________________________________________
+Bool_t AliRsnFunctionDef::AddBinningY(EFcnBinType type, Int_t nbins, Double_t *bins)
+{
+//
+// Define a secondary binning with variable bins
+//
+
+ if (fYUsed >= kBinMax)
+ {
+ AliError(Form("Cannot create a new binning: maximum allowed of %d is reached", kBinMax));
+ return kFALSE;
+ }
+
+ fYUsed++;
+ SetBinningY(fYUsed - 1, type, nbins, bins);
+
+ return kTRUE;
+}
+
+//________________________________________________________________________________________
+TString AliRsnFunctionDef::GetFcnName()
+{
+ //
+ // Return a string which names the function type
+ //
+
+ TString text("Undef");
+
+ switch (fFcnType)
+ {
+ case kInvMass:
+ text = "IM";
+ break;
+ case kInvMassMC:
+ text = "IM_MC";
+ break;
+ case kInvMassRotated:
+ text = Form("IMR%.2f", fRotAngle);
+ break;
+ case kResolution:
+ text = "RES";
+ break;
+ case kPtSpectrum:
+ text = "PT";
+ break;
+ case kEtaSpectrum:
+ text = "ETA";
+ break;
+ default:
+ AliError("Type not defined");
+ }
+
+ return text;
+}
+
+//________________________________________________________________________________________
+TString AliRsnFunctionDef::GetFcnTitle()
+{
+ //
+ // Return a string which names the function type
+ //
+
+ TString text("Undef");
+
+ switch (fFcnType)
+ {
+ case kInvMass:
+ text = "Invariant mass";
+ break;
+ case kInvMassMC:
+ text = "Invariant mass (MC)";
+ break;
+ case kResolution:
+ text = "Resolution";
+ break;
+ case kPtSpectrum:
+ text = "p_{#perp} distribution";
+ break;
+ case kEtaSpectrum:
+ text = "#eta distribution";
+ break;
+ default:
+ AliError("Type not defined");
+ }
+
+ return text;
+}
+
+//________________________________________________________________________________________
+TString AliRsnFunctionDef::GetBinningName(Int_t i)
+{
+ //
+ // Return a string which names the function type
+ //
+
+ TString text("Undef");
+
+ if (i >= kBinMax) return text;
+
+ switch (fBinType[i])
+ {
+ case kPt:
+ text = "PT";
+ break;
+ case kEta:
+ text = "ETA";
+ break;
+ default:
+ AliError("Type not defined");
+ }
+
+ return text;
+}
+
+//________________________________________________________________________________________
+Double_t AliRsnFunctionDef::EvalX(AliRsnPairParticle *pair, AliRsnPairDef *ref)
+{
+//
+// Evaluate X value according to selected type
+//
+
+ Double_t recInvMass = pair->GetInvMass(ref->GetMass(0), ref->GetMass(1));
+ Double_t simInvMass = pair->GetInvMassMC(ref->GetMass(0), ref->GetMass(1));
+
+ switch (fFcnType)
+ {
+ case kInvMass:
+ return recInvMass;
+ case kInvMassMC:
+ return simInvMass;
+ case kInvMassRotated:
+ pair->GetDaughter(1)->RotateP(fRotAngle * TMath::DegToRad());
+ pair->ResetPair();
+ return pair->GetInvMass(ref->GetMass(0), ref->GetMass(1));
+ case kResolution:
+ return (simInvMass - recInvMass) / simInvMass;
+ case kPtSpectrum:
+ return pair->GetPt();
+ case kEtaSpectrum:
+ return pair->GetEta();
+ default:
+ AliError("Type not defined");
+ return 1000.0;
+ }
+}
+
+//________________________________________________________________________________________
+Double_t AliRsnFunctionDef::EvalY(Int_t i, AliRsnPairParticle *pair)
+{
+//
+// Evaluate Y value according to selected type
+//
+
+ if (i >= fYUsed) return 1000.0;
+
+ switch (fBinType[i])
+ {
+ case kPt:
+ return pair->GetPt();
+ case kEta:
+ return pair->GetEta();
+ default:
+ AliError("Binning type not defined");
+ return 1000.0;
+ }
+}
+
+//________________________________________________________________________________________
+void AliRsnFunctionDef::Print(Option_t* /*opt*/)
+{
+//
+// Print details on this function
+//
+
+ Int_t i, j;
+
+ cout << "DEFINITION X TYPE: " << GetFcnName().Data() << endl;
+ cout << "DEFINITION Y TYPES = " << fYUsed << endl;
+
+ for (i = 0; i < fYUsed; i++) {
+ cout << "Y TYPE #" << i << ": " << GetBinningName(i) << " [bins = ";
+ for (j = 0; j < fYbins[i].GetSize(); j++) {
+ cout << fYbins[i][j] << ' ';
+ }
+ cout << endl;
+ }
+}
--- /dev/null
+//
+// Class AliRsnFunctionDef
+//
+// This class defines a base classe to implement a typical computation
+// which uses the internal RSN package event format (AliRsnEvent).
+// It contains some default flags which turn out to be useful:
+// - a flag to select only the "true" pairs (tracks from same resonance)
+// - a flag to know if the computation is done over two events (mixing)
+//
+// Any kind of analysis object should be implemented as inheriting from this
+// because the AliRsnAnalyzer which executes the analysis will accept a collection
+// of such objects, in order to have a unique format of processing method
+//
+// The user who implements a kind of computation type should inherit from
+// this class and override the virtual functions defined in it, which
+// initialize the final output histogram and define how to process data.
+//
+//
+// author: A. Pulvirenti (email: alberto.pulvirenti@ct.infn.it)
+//
+
+#ifndef ALIRSNFUNCTIONDEF_H
+#define ALIRSNFUNCTIONDEF_H
+
+#include <TArrayD.h>
+#include <TString.h>
+
+class AliRsnFunctionDef : public TObject
+{
+ public:
+
+ enum EFcnType
+ {
+ kInvMass,
+ kInvMassMC,
+ kInvMassRotated,
+ kResolution,
+ kPtSpectrum,
+ kEtaSpectrum,
+ kFcnTypes
+ };
+
+ enum EFcnBinType
+ {
+ kPt, // binning in Pt of the pair
+ kEta, // binning in Eta of the pair
+ kBinningTypes
+ };
+
+ enum EConstValue
+ {
+ kBinMax = 5
+ };
+
+ AliRsnFunctionDef();
+ AliRsnFunctionDef(EFcnType type, Int_t nbins, Double_t min, Double_t max);
+ AliRsnFunctionDef(const AliRsnFunctionDef ©);
+ const AliRsnFunctionDef& operator=(const AliRsnFunctionDef ©);
+ virtual ~AliRsnFunctionDef() { }
+
+ // names
+ TString GetFcnName();
+ TString GetFcnTitle();
+ TString GetBinningName(Int_t i);
+
+ // main histogram definition
+ EFcnType GetType() {return fFcnType;}
+ Int_t GetNBinsX() {return fNBinsX;}
+ Double_t GetXmin() {return fXmin;}
+ Double_t GetXmax() {return fXmax;}
+ void SetBinningX(Int_t nbins, Double_t xmin, Double_t xmax) {fNBinsX=nbins;fXmin=xmin;fXmax=xmax;}
+
+ // secondary binning definition
+ Int_t GetMaxYBinUsed() {return fYUsed;}
+ Int_t GetNBinsY(Int_t i) {if (i<=fYUsed) return fNBinsY[i]; else return 0;}
+ TArrayD* GetYbins(Int_t i) {if (i<=fYUsed) return &fYbins[i]; else return 0x0;}
+ EFcnBinType GetYtype(Int_t i) {if (i<=fYUsed) return fBinType[i]; else return (EFcnBinType)0;}
+ void SetBinningY(Int_t i, EFcnBinType type, Double_t xmin, Double_t xmax, Double_t step);
+ void SetBinningY(Int_t i, EFcnBinType type, Int_t nbins, Double_t *bins);
+ Bool_t AddBinningY(EFcnBinType type, Double_t min, Double_t max, Double_t step);
+ Bool_t AddBinningY(EFcnBinType type, Int_t nbins, Double_t *bins);
+
+ // rotation angle
+ void SetRotationAngle(Double_t rotAngle) {fRotAngle = rotAngle;}
+
+ // computations
+ Double_t EvalX(AliRsnPairParticle *pair, AliRsnPairDef *ref);
+ Double_t EvalY(Int_t i, AliRsnPairParticle *pair);
+
+ // other
+ void Print(Option_t *opt = "");
+
+ private:
+
+ EFcnType fFcnType; // function type
+
+ Int_t fNBinsX; // primary histogram bins
+ Double_t fXmin; // primary histogram low edge
+ Double_t fXmax; // primary histogram up edge
+
+ Int_t fYUsed; // index of last secondary binning used
+ EFcnBinType fBinType[kBinMax]; // binning type
+ Int_t fNBinsY[kBinMax]; // secondary bins number
+ TArrayD fYbins[kBinMax]; // secondary histogram bins
+
+ Double_t fRotAngle; // rotation angle (for "rotated" invMass)
+
+ ClassDef(AliRsnFunctionDef,1)
+};
+
+#endif
+
--- /dev/null
+//
+// Class AliRsnFunctionNew
+//
+// This class defines a base classe to implement a function
+// which uses the internal RSN package event format (AliRsnEvent).
+// It contains some default flags which turn out to be useful:
+// - a flag to select only the "true" pairs (tracks from same resonance)
+// - a flag to know if the computation is done over two events (mixing)
+//
+// Any kind of analysis object should be implemented as inheriting from this
+// because the AliRsnAnalyzer which executes the analysis will accept a collection
+// of such objects, in order to have a unique format of processing method
+//
+// The user who implements a kind of computation type should inherit from
+// this class and override the virtual functions defined in it, which
+// initialize the final output histogram and define how to process data.
+//
+//
+// author: A. Pulvirenti (email: alberto.pulvirenti@ct.infn.it)
+//
+
+#include <Riostream.h>
+
+#include <TH1.h>
+#include <TH2.h>
+#include <TList.h>
+#include <TString.h>
+
+#include "AliLog.h"
+
+#include "AliRsnMCInfo.h"
+#include "AliRsnDaughter.h"
+#include "AliRsnEvent.h"
+#include "AliRsnPairDef.h"
+#include "AliRsnCut.h"
+
+#include "AliRsnFunctionNew.h"
+
+ClassImp(AliRsnFunctionNew)
+
+//________________________________________________________________________________________
+AliRsnFunctionNew::AliRsnFunctionNew() :
+ fFcnDef(0x0),
+ fHistoTot(0x0)
+{
+ //
+ // Constructor.
+ // The histogram data member cannot be passed externally,
+ // its initialization MUST be defined inside the Init() method,
+ // which must be overridden in any derivate implementation.
+ //
+
+ Int_t i;
+ for (i = 0 ; i < AliRsnFunctionDef::kBinMax; i++) fHistoBin[i] = 0x0;
+}
+
+//________________________________________________________________________________________
+AliRsnFunctionNew::AliRsnFunctionNew(AliRsnFunctionDef *fd) :
+ fFcnDef(fd),
+ fHistoTot(0x0)
+{
+ //
+ // Constructor.
+ // The histogram data member cannot be passed externally,
+ // its initialization MUST be defined inside the Init() method,
+ // which must be overridden in any derivate implementation.
+ //
+
+ Int_t i;
+ for (i = 0 ; i < AliRsnFunctionDef::kBinMax; i++) fHistoBin[i] = 0x0;
+}
+
+//________________________________________________________________________________________
+AliRsnFunctionNew::AliRsnFunctionNew(const AliRsnFunctionNew ©) :
+ TObject(copy),
+ fFcnDef(copy.fFcnDef),
+ fHistoTot(0x0)
+{
+ //
+ // Copy constructor.
+ // Calls the function to define binning.
+ //
+
+ Int_t i;
+ for (i = 0 ; i < AliRsnFunctionDef::kBinMax; i++) fHistoBin[i] = 0x0;
+}
+//________________________________________________________________________________________
+const AliRsnFunctionNew& AliRsnFunctionNew::operator=(const AliRsnFunctionNew& /*copy*/)
+{
+ //
+ // Assignment operator.
+ // Behaves like copy constructor.
+ // Also in this case, the histogram is not copied, and,
+ // if it was present, it is destroyed and will need to be recreated.
+ //
+
+ return (*this);
+}
+//________________________________________________________________________________________
+void AliRsnFunctionNew::Clear(Option_t* /*option*/)
+{
+ //
+ // Clear arrays and histogram.
+ // For the sake of security, all pointers are also set explicitly to NULL.
+ //
+
+ Int_t i;
+ for (i = 0 ; i < AliRsnFunctionDef::kBinMax; i++)
+ {
+ delete fHistoBin[i];
+ fHistoBin[i] = 0x0;
+ }
+
+ delete fHistoTot;
+ fHistoTot = 0x0;
+}
+
+//________________________________________________________________________________________
+TList* AliRsnFunctionNew::Init(const char *histoName, const char *histoTitle)
+{
+ //
+ // Initialization function.
+ // By default, it initializes the owned histogram using the method
+ // from AliRsnHistoDef class, giving the same name and title of this.
+ // A user can override this behaviour, if necessary.
+ // Before creating, the HistoDef is checked for proper initialization.
+ //
+
+ Clear();
+
+ Int_t nbins = fFcnDef->GetNBinsX();
+ Double_t min = fFcnDef->GetXmin(), max = fFcnDef->GetXmax();
+
+ // list is created and named after the general
+ // settings used for the contained histograms
+ TList *histos = new TList;
+ histos->SetName(Form("%s", fFcnDef->GetFcnName().Data()));
+
+ // a general histogram is always added,
+ // which overrides the binning and collects everything
+ fHistoTot = new TH1D(histoName, histoTitle, nbins, min, max);
+ fHistoTot->Sumw2();
+ histos->AddLast(fHistoTot);
+
+ // if requested a binning w.r. to some cut variable, histograms are added
+ // for that in this part of the method (one per each bin)
+ Char_t hName[255];
+ Char_t hTitle[255];
+ Int_t j, binMax = fFcnDef->GetMaxYBinUsed();
+ if (binMax > 0)
+ {
+ for (j = 0 ; j < binMax; j++)
+ {
+ Int_t nY = fFcnDef->GetNBinsY(j);
+ TArrayD *binsY = fFcnDef->GetYbins(j);
+ Double_t *arrY = binsY->GetArray();
+ sprintf(hName, "%s_%02d_%s", histoName, j, fFcnDef->GetBinningName(j).Data());
+ sprintf(hTitle, "%s [%s]", histoTitle, fFcnDef->GetBinningName(j).Data());
+ fHistoBin[j] = new TH2D(hName, hTitle, nbins, min, max, nY - 1, arrY);
+ fHistoBin[j]->Sumw2();
+ histos->AddLast(fHistoBin[j]);
+ }
+ }
+
+ // returns the full list at the end
+ return histos;
+}
+
+//________________________________________________________________________________________
+void AliRsnFunctionNew::Init(const char *histoName, const char *histoTitle, TList *histos)
+{
+ //
+ // Initialization function.
+ // By default, it initializes the owned histogram using the method
+ // from AliRsnHistoDef class, giving the same name and title of this.
+ // A user can override this behaviour, if necessary.
+ // Before creating, the HistoDef is checked for proper initialization.
+ //
+
+ Clear();
+
+ Int_t nbins = fFcnDef->GetNBinsX();
+ Double_t min = fFcnDef->GetXmin(), max = fFcnDef->GetXmax();
+
+ // list is not created but its existence is checked
+ if (!histos) return;
+
+ // a general histogram is always added,
+ // which overrides the binning and collects everything
+ fHistoTot = new TH1D(histoName, histoTitle, nbins, min, max);
+ fHistoTot->Sumw2();
+ histos->AddLast(fHistoTot);
+
+ // if requested a binning w.r. to some cut variable, histograms are added
+ // for that in this part of the method (one per each bin)
+ Char_t hName[255];
+ Char_t hTitle[255];
+ Int_t j, binMax = fFcnDef->GetMaxYBinUsed();
+ if (binMax > 0)
+ {
+ for (j = 0 ; j < binMax; j++)
+ {
+ Int_t nY = fFcnDef->GetNBinsY(j);
+ TArrayD *binsY = fFcnDef->GetYbins(j);
+ sprintf(hName, "%s_%02d_%s", histoName, j, fFcnDef->GetBinningName(j).Data());
+ sprintf(hTitle, "%s [%s]", histoTitle, fFcnDef->GetBinningName(j).Data());
+ fHistoBin[j] = new TH2D(hName, hTitle, nbins, min, max, nY, binsY->GetArray());
+ fHistoBin[j]->Sumw2();
+ histos->AddLast(fHistoBin[j]);
+ }
+ }
+}
+
+//________________________________________________________________________________________
+Bool_t AliRsnFunctionNew::Fill(AliRsnPairParticle *pair, AliRsnPairDef *ref)
+{
+ //
+ // Fillse the histogram with data contained in a defined pair.
+ // This method must be overidden by an appropriate definition in each inheriting class.
+ //
+
+ Double_t valueY, valueX = fFcnDef->EvalX(pair, ref);
+
+ // fill global histogram
+ fHistoTot->Fill(valueX);
+
+ // if bins are allocated, fill them
+ Int_t j, binMax = fFcnDef->GetMaxYBinUsed();
+ if (binMax > 0)
+ {
+ for (j = 0 ; j < binMax; j++)
+ {
+ valueY = fFcnDef->EvalY(j, pair);
+ if (fHistoBin[j]) fHistoBin[j]->Fill(valueX, valueY);
+ }
+ }
+
+ return kTRUE;
+}
--- /dev/null
+//
+// Class AliRsn Fcn
+//
+// This class defines a base classe to implement a typical computation
+// which uses the internal RSN package event format (AliRsnEvent).
+// It contains some default flags which turn out to be useful:
+// - a flag to select only the "true" pairs (tracks from same resonance)
+// - a flag to know if the computation is done over two events (mixing)
+//
+// Any kind of analysis object should be implemented as inheriting from this
+// because the AliRsnAnalyzer which executes the analysis will accept a collection
+// of such objects, in order to have a unique format of processing method
+//
+// The user who implements a kind of computation type should inherit from
+// this class and override the virtual functions defined in it, which
+// initialize the final output histogram and define how to process data.
+//
+//
+// author: A. Pulvirenti (email: alberto.pulvirenti@ct.infn.it)
+//
+
+#ifndef ALIRsnFunctionNew_H
+#define ALIRsnFunctionNew_H
+
+#include <TArrayD.h>
+#include <TString.h>
+
+//#include "AliRsnCut.h"
+#include "AliRsnFunctionDef.h"
+#include "AliRsnPairParticle.h"
+
+class TH1D;
+class TH2D;
+class AliRsnEvent;
+
+class AliRsnFunctionNew : public TObject
+{
+
+ public:
+
+ AliRsnFunctionNew();
+ AliRsnFunctionNew(AliRsnFunctionDef *fd);
+ AliRsnFunctionNew(const AliRsnFunctionNew ©);
+ virtual ~AliRsnFunctionNew() {Clear();}
+ virtual void Clear(Option_t *option = "");
+
+ void SetFunctionDef(AliRsnFunctionDef *def) {fFcnDef = def;}
+ AliRsnFunctionDef* GetFunctionDef() {return fFcnDef;}
+ TString GetFcnName();
+ TString GetFcnTitle();
+
+ // working routines
+ TList* Init(const char *histoName, const char *histoTitle);
+ void Init(const char *histoName, const char *histoTitle, TList *tgt);
+ Bool_t Fill(AliRsnPairParticle *pair, AliRsnPairDef *ref);
+
+ private:
+
+ const AliRsnFunctionNew& operator=(const AliRsnFunctionNew ©);
+
+ AliRsnFunctionDef *fFcnDef; // definitions
+ TH1D *fHistoTot; // integrated histogram
+ TH2D *fHistoBin[AliRsnFunctionDef::kBinMax]; // binned histograms
+
+ // ROOT dictionary
+ ClassDef(AliRsnFunctionNew, 1)
+};
+
+#endif
daughter->SetPIDProb(i, prob[i]);
}
- daughter->AssignRealisticPID();
+ daughter->RealisticPID();
Double_t assprob;
AliRsnDaughter::SetPIDMethod(AliRsnDaughter::kRealistic);
AliRsnPID::EType type = daughter->PIDType(assprob);
ClassImp(AliRsnPIDDefESD)
//_____________________________________________________________________________
-AliRsnPIDDefESD::AliRsnPIDDefESD() : fUseESDWeights(kTRUE)
-{
+AliRsnPIDDefESD::AliRsnPIDDefESD() : fUseESDWeights(kTRUE) {
//
// Default constructor.
// By default, it is set for using ESD weights,
for (i = 0; i < kDetectors; i++) {
fUseDet[i] = kTRUE;
fDivValue[i] = 0.0;
+ fUseHigher[i] = kTRUE;
}
}
//_____________________________________________________________________________
AliRsnPIDDefESD::AliRsnPIDDefESD(const AliRsnPIDDefESD& copy) :
- TObject(copy),
- fUseESDWeights(copy.fUseESDWeights)
-{
+ TObject(copy),
+ fUseESDWeights(copy.fUseESDWeights) {
//
// Copy constructor.
// Implemented to manage passing of this object to functions
for (i = 0; i < kDetectors; i++) {
fUseDet[i] = copy.fUseDet[i];
fDivValue[i] = copy.fDivValue[i];
+ fUseHigher[i] = copy.fUseHigher[i];
}
}
//_____________________________________________________________________________
-void AliRsnPIDDefESD::SetScheme(EScheme scheme, Double_t divValue)
-{
+void AliRsnPIDDefESD::SetScheme(EScheme scheme, Double_t divValue) {
//
// Set one of the predefined schemes
//
SetDivValue(kTPC, 0.0);
SetDivValue(kTOF, divValue);
break;
+ case kSchemeITSandTPCorTOFwithSP:
+ fUseESDWeights = kFALSE;
+ ExcludeAll();
+ IncludeDet(kITS);
+ IncludeDet(kTPC);
+ IncludeDet(kTOF);
+ SetDivValue(kITS, divValue, kFALSE);
+ SetDivValue(kTPC, divValue, kFALSE);
+ SetDivValue(kTOF, divValue, kTRUE);
+ break;
default:
AliWarning("PID scheme unrecognized. Set to ESD");
fUseESDWeights = kTRUE;
}
//_____________________________________________________________________________
-void AliRsnPIDDefESD::ComputeWeights(AliESDtrack *track, Double_t *weights)
-{
+void AliRsnPIDDefESD::ComputeWeights(AliESDtrack *track, Double_t *weights) {
//
// Computes the global PID weights using the given ranges
//
Int_t i, j;
for (i = 0; i < kDetectors; i++) {
- if (!fUseDet[i] || pt < fDivValue[i]) {
+// if (!fUseDet[i] || pt < fDivValue[i])
+ if (!fUseDet[i] || !CheckDivValue((EDetector)i,pt)) {
for (j = 0; j < AliRsnPID::kSpecies; j++) {
w[i][j] = 1.0;
}
}
//_____________________________________________________________________________
-void AliRsnPIDDefESD::PrintStatus()
-{
+void AliRsnPIDDefESD::PrintStatus() {
//
// Print informations about this object configurations
//
if (fUseESDWeights) {
AliInfo("Using ESD weights");
- }
- else {
+ } else {
AliInfo("NOT using ESD weights");
}
Int_t i;
for (i = 0; i < kDetectors; i++) {
- AliInfo(Form("Detector name: %s -- accepted: %s -- divValue = %3.1f", DetName((EDetector)i), (fUseDet[i]?"YES":"NO"), fDivValue[i]));
+ AliInfo(Form("Detector name: %s -- accepted: %s -- divValue = %3.1f useHigher = %s", DetName((EDetector)i), (fUseDet[i]?"YES":"NO"), fDivValue[i],(fUseHigher[i]?"YES":"NO")));
}
AliInfo("===== PIDDef status messages -- END");
}
//_____________________________________________________________________________
-const char* AliRsnPIDDefESD::DetName(EDetector det)
-{
+const char* AliRsnPIDDefESD::DetName(EDetector det) {
//
// Detector name for messages
//
default: return "undef";
}
}
+
+//_____________________________________________________________________________
+void AliRsnPIDDefESD::SetDivValue(EDetector det, Double_t value, Bool_t userHigher) {
+//
+// Sets div.value properties for detector
+//
+ if (CheckBounds(det)) {
+ fDivValue[det] = value;
+ fUseHigher[det] = userHigher;
+ }
+}
+
+//_____________________________________________________________________________
+Bool_t AliRsnPIDDefESD::CheckDivValue(EDetector det,Double_t value) {
+//
+// Sets div.value properties for detector
+//
+ if (CheckBounds(det)) {
+ if (fUseHigher[det]) {
+ if (value > fDivValue[det]) return kTRUE;
+ else return kFALSE;
+ } else {
+ if (value < fDivValue[det]) return kTRUE;
+ else return kFALSE;
+ }
+ }
+
+ return kTRUE;
+}
class AliESDtrack;
-class AliRsnPIDDefESD : public TObject
-{
+class AliRsnPIDDefESD : public TObject {
public:
- enum EDetector
- {
+ enum EDetector {
kITS,
kTPC,
kTRD,
kDetectors
};
- enum EScheme
- {
+ enum EScheme {
kSchemeESD = 0,
kSchemeITS,
kSchemeTPC,
kSchemeTPCandTOF,
kSchemeITSandTPCandTOF,
kSchemeITSandTPCandTOFwithSP,
+ kSchemeITSandTPCorTOFwithSP,
kSchemeLastPIDType
};
void ExcludeDet(EDetector det) {if (CheckBounds(det)) fUseDet[det] = kFALSE;}
void IncludeAll() { Int_t det; for (det = 0; det < kDetectors; det++) fUseDet[det] = kTRUE; }
void ExcludeAll() { Int_t det; for (det = 0; det < kDetectors; det++) fUseDet[det] = kFALSE; }
- void SetDivValue(EDetector det, Double_t value) {if (CheckBounds(det)) fDivValue[det] = value;}
+ void SetDivValue(EDetector det, Double_t value,Bool_t userHigher=kTRUE);
void ComputeWeights(AliESDtrack *track, Double_t *weights);
void PrintStatus();
const char* DetName(EDetector);
private:
Bool_t CheckBounds(EDetector det) { return (det >= kITS && det < kDetectors); }
+ Bool_t CheckDivValue(EDetector det,Double_t value);
Bool_t fUseESDWeights; // with this flag, ESD weights are used
Bool_t fUseDet[kDetectors]; // flag to switch off info from a detector
- Double_t fDivValue[kDetectors]; // division value for detector weight acceptance (accepted above this value)
+ Double_t fDivValue[kDetectors]; // division value for detector weight acceptance
+ Double_t fUseHigher[kDetectors]; // accepted higher or lower then div value
ClassDef(AliRsnPIDDefESD,1);
};
AliRsnDaughter *daughter1 = 0;
AliRsnDaughter *daughter2 = 0;
AliRsnFunction *fcn = 0;
+ //AliRsnFunctionNew *fnew = 0;
Bool_t isLikeSign = fPairDef->IsLikeSign();
Int_t j, startj = 0;
// get track #1
daughter1 = (AliRsnDaughter *) ev1->GetTrack(a1->At(i));
if (!daughter1) continue;
+ // assign PID and mass of particle of type #1
+ daughter1->AssignPID(fPairDef->GetType(0));
// cuts on track #1
if (!CutPass(daughter1)) continue;
// get track #2
{
daughter2 = (AliRsnDaughter *) ev2->GetTrack(a2->At(j));
if (!daughter2) continue;
+ // assign PID and mass of particle of type #2
+ daughter2->AssignPID(fPairDef->GetType(0));
// cuts on track #2
if (!CutPass(daughter2)) continue;
// make pair
while ( (fcn = (AliRsnFunction*)nextFcn()) ) {
fcn->Fill(&pairParticle, fPairDef);
}
+ /*
+ while ( (fnew = (AliRsnFunction*)nextFcn()) ) {
+ fnew->Fill(&pairParticle, fPairDef);
+ }
+ */
}
}
}
new (fFunctions[size]) AliRsnFunction(*fcn);
}
+/*
+//_____________________________________________________________________________
+void AliRsnPair::AddFunction(AliRsnFunctionDef *fcn)
+{
+//
+// Adds a new computing function
+//
+
+ Int_t size = fFunctions.GetEntries();
+ new (fFunctions[size]) AliRsnFunctionNew(fcn);
+}
+*/
+
//________________________________________________________________________________________
Bool_t AliRsnPair::CutPass(AliRsnDaughter *d)
{
#include "AliRsnEvent.h"
#include "AliRsnCutMgr.h"
#include "AliRsnHistoDef.h"
+#include "AliRsnFunctionDef.h"
+#include "AliRsnFunctionNew.h"
class AliRsnFunction;
void ProcessPair(AliRsnEvent *ev1, AliRsnEvent *ev2 = 0);
void SetCutMgr(AliRsnCutMgr* theValue) { fCutMgr = theValue; }
void AddFunction(AliRsnFunction *fcn);
+ //void AddFunction(AliRsnFunctionDef *fcn);
TList* GenerateHistograms(TString prefix = "");
void GenerateHistograms(TString prefix, TList *tgt);
TString GetPairName() const;
TString GetPairHistName(AliRsnFunction *fcn, TString text = "") const;
TString GetPairHistTitle(AliRsnFunction *fcn, TString text = "") const;
+ //TString GetPairHistName(AliRsnFunctionNew *fcn, TString text = "") const;
+ //TString GetPairHistTitle(AliRsnFunctionNew *fcn, TString text = "") const;
private:
#include "AliESDtrack.h"
#include "AliESDVertex.h"
#include "AliESDtrackCuts.h"
+#include "AliMultiplicity.h"
#include "AliAODEvent.h"
#include "AliAODTrack.h"
Int_t ntracks = esd->GetNumberOfTracks();
if (!ntracks) return kFALSE;
+ // set SPD multiplicity
+ const AliMultiplicity* SPDMult = esd->GetMultiplicity();
+ Int_t nTracklets = SPDMult->GetNumberOfTracklets();
+ rsn->SetTrueMultiplicity(nTracklets);
+
// if required with the flag, scans the event
// and searches all split tracks (= 2 tracks with the same label);
// for each pair of split tracks, only the better (best chi2) is kept
// get number of tracks
Int_t ntracks = aod->GetNTracks();
if (!ntracks) return kFALSE;
+ rsn->SetTrueMultiplicity(ntracks);
// get primary vertex
Double_t vertex[3];
vz = (Double_t)fvertex[2];
rsn->SetPrimaryVertex(vx, vy, vz);
rsn->SetPrimaryVertexMC(vx, vy, vz);
+ rsn->SetTrueMultiplicity(stack->GetNprimary());
// store tracks from MC
Int_t i, index, labmum, nRef, nRefITS, nRefTPC, detectorID;
RESONANCES/AliRsnReaderTaskSE.cxx \
RESONANCES/AliRsnPairDef.cxx \
RESONANCES/AliRsnHistoDef.cxx \
+ RESONANCES/AliRsnFunctionDef.cxx \
RESONANCES/AliRsnFunction.cxx \
+ RESONANCES/AliRsnFunctionNew.cxx \
RESONANCES/AliRsnPair.cxx \
RESONANCES/AliRsnPairMgr.cxx \
RESONANCES/AliRsnAnalysisTaskSEBase.cxx \