Skip to content
Snippets Groups Projects
Commit bbb4b0e1 authored by Daniel Wielanek's avatar Daniel Wielanek Committed by Administrator
Browse files

Adding v0 stuff.

parent 60d6c742
No related branches found
No related tags found
No related merge requests found
Showing
with 653 additions and 2 deletions
/* Copyright (C) 2025-2025 Warsaw University of Technology, Warsaw
SPDX-License-Identifier: GPL-3.0-only
Authors: Daniel Wielanek [committer] */
#include "HalCbmReader.h"
#include "HalCbmEvent.h"
#include "HalCbmFullEvent.h"
#include "HalCbmMCEvent.h"
#include <RtypesCore.h>
#include <TString.h>
#include <Hal/StdString.h>
namespace Hal
{
} /* namespace Hal */
HalCbmReader::HalCbmReader(TString opt)
{
if (Hal::Std::FindParam(opt, "reco", false) && Hal::Std::FindParam(opt, "mc", false)) {
SetFormat(new HalCbmFullEvent());
}
else if (Hal::Std::FindParam(opt, "mc", false)) {
SetFormat(new HalCbmMCEvent());
}
else {
SetFormat(new HalCbmEvent());
}
}
HalCbmReader::~HalCbmReader() {}
/* Copyright (C) 2025-2025 Warsaw University of Technology, Warsaw
SPDX-License-Identifier: GPL-3.0-only
Authors: Daniel Wielanek [committer] */
#ifndef CBMROOT_V0_ANALYSIS_PWGC2F_FEMTOSCOPY_HAL_FORMAT_HALCBMREADER_H_
#define CBMROOT_V0_ANALYSIS_PWGC2F_FEMTOSCOPY_HAL_FORMAT_HALCBMREADER_H_
#include <Hal/Reader.h>
namespace Hal
{
class EventInterface;
}
class HalCbmReader : public Hal::Reader {
public:
HalCbmReader(TString opt = "mc+reco");
virtual ~HalCbmReader();
ClassDef(HalCbmReader, 1)
};
#endif /* CBMROOT_V0_ANALYSIS_PWGC2F_FEMTOSCOPY_HAL_FORMAT_HALCBMREADER_H_ */
/* Copyright (C) 2025-2025 Warsaw University of Technology, Warsaw
SPDX-License-Identifier: GPL-3.0-only
Authors: Daniel Wielanek [committer] */
#include "HalCbmV0Builder.h"
#include "HalCbmAnalysisManager.h"
#include "HalCbmDetectorID.h"
#include "HalCbmTrack.h"
#include "HalCbmV0TempTrack.h"
#include "HalCbmV0Track.h"
#include <TClonesArray.h>
#include <TDatabasePDG.h>
#include <TParticlePDG.h>
#include <Hal/Cout.h>
#include <Hal/DataManager.h>
namespace Hal
{
} /* namespace Hal */
HalCbmV0Builder::v0rawInfo HalCbmV0Builder::Convert(const AnalysisTree::Particle& p)
{
HalCbmV0Builder::v0rawInfo v0Info;
v0Info.chi2geo = p.GetField<float>(fV0Container->GetFieldIds().chi2geo);
v0Info.chi2_prim_first = p.GetField<float>(fV0Container->GetFieldIds().chi2_prim_first);
v0Info.chi2_prim_second = p.GetField<float>(fV0Container->GetFieldIds().chi2_prim_second);
v0Info.chi2_topo = p.GetField<float>(fV0Container->GetFieldIds().chi2_topo);
v0Info.cosine_first = p.GetField<float>(fV0Container->GetFieldIds().cosine_first);
v0Info.cosine_second = p.GetField<float>(fV0Container->GetFieldIds().cosine_second);
v0Info.cosine_topo = p.GetField<float>(fV0Container->GetFieldIds().cosine_topo);
v0Info.distance = p.GetField<float>(fV0Container->GetFieldIds().distance);
v0Info.l = p.GetField<float>(fV0Container->GetFieldIds().l);
v0Info.l_dl = p.GetField<float>(fV0Container->GetFieldIds().l_over_dl);
v0Info.mass = p.GetField<float>(fV0Container->GetFieldIds().mass);
v0Info.px = p.GetField<float>(fV0Container->GetFieldIds().px);
v0Info.py = p.GetField<float>(fV0Container->GetFieldIds().py);
v0Info.pz = p.GetField<float>(fV0Container->GetFieldIds().pz);
v0Info.x = p.GetField<float>(fV0Container->GetFieldIds().x);
v0Info.y = p.GetField<float>(fV0Container->GetFieldIds().y);
v0Info.z = p.GetField<float>(fV0Container->GetFieldIds().z);
v0Info.pid = p.GetField<int>(fV0Container->GetFieldIds().pdg);
v0Info.dau1id = p.GetField<int>(fV0Container->GetFieldIds().dau1id);
v0Info.dau2id = p.GetField<int>(fV0Container->GetFieldIds().dau2id);
#ifdef DEBUG_EXTR
v0Info.dau1px = p.GetField<float>(fV0Container->GetFieldIds().dau1px);
v0Info.dau1py = p.GetField<float>(fV0Container->GetFieldIds().dau1py);
v0Info.dau1pz = p.GetField<float>(fV0Container->GetFieldIds().dau1pz);
v0Info.dau1x = p.GetField<float>(fV0Container->GetFieldIds().dau1x);
v0Info.dau1y = p.GetField<float>(fV0Container->GetFieldIds().dau1y);
v0Info.dau1z = p.GetField<float>(fV0Container->GetFieldIds().dau1z);
v0Info.dau2px = p.GetField<float>(fV0Container->GetFieldIds().dau2px);
v0Info.dau2py = p.GetField<float>(fV0Container->GetFieldIds().dau2py);
v0Info.dau2pz = p.GetField<float>(fV0Container->GetFieldIds().dau2pz);
v0Info.dau2x = p.GetField<float>(fV0Container->GetFieldIds().dau2x);
v0Info.dau2y = p.GetField<float>(fV0Container->GetFieldIds().dau2y);
v0Info.dau2z = p.GetField<float>(fV0Container->GetFieldIds().dau2z);
#endif
return v0Info;
}
HalCbmV0Builder::HalCbmV0Builder(Int_t motherPid, Int_t posdau, Int_t negdau)
: fPidMom(motherPid)
, fPidPosDau(posdau)
, fPidNegDau(negdau)
{
}
HalCbmV0Builder::EInitFlag HalCbmV0Builder::Init()
{
fSimContainer = (CbmAnaTreeMcContainer*) Hal::DataManager::Instance()->GetObject(HalCbm::GetContainerName("mc"));
fRecoContainer = (CbmAnaTreeRecoContainer*) Hal::DataManager::Instance()->GetObject(HalCbm::GetContainerName("reco"));
fV0Container = (CbmAnaTreeV0Container*) Hal::DataManager::Instance()->GetObject(HalCbm::GetContainerName("v0"));
auto trk = TDatabasePDG::Instance()->GetParticle(fPidMom);
if (!trk) {
Hal::Cout::PrintInfo(Form("HalCbmV0Builder::Init cannot find selected mother PID=%i", fPidMom), Hal::EInfo::kError);
return EInitFlag::kERROR;
}
fMass = trk->Mass();
if (!fV0Container) {
Hal::Cout::PrintInfo("HalCbmV0Builder::Init cannot find V0 data", Hal::EInfo::kError);
return EInitFlag::kERROR;
}
if (!fRecoContainer) {
Hal::Cout::PrintInfo("HalCbmV0Builder::Init cannot find reco data", Hal::EInfo::kError);
return EInitFlag::kERROR;
}
fV0Temp = (TClonesArray*) Hal::DataManager::Instance()->GetObject("TempV0.");
if (!fV0Temp) {
fV0Temp = new TClonesArray("HalCbmV0TempTrack");
Hal::DataManager::Instance()->Register("TempV0.", "TempV0", fV0Temp, kFALSE);
fOwner = kTRUE;
}
return EInitFlag::kSUCCESS;
}
void HalCbmV0Builder::Exec(Option_t* /*option*/)
{
auto recoCont = fRecoContainer->GetVtxTracks();
auto recoMatch = fRecoContainer->GetVtx2Sim();
auto sim = fSimContainer->GetParticles();
int charge_field = fRecoContainer->GetFieldIds().vtx_q;
int nv0s = fV0Container->GetParticles()->GetNumberOfChannels();
int mother_field = fSimContainer->GetFieldIds().motherId;
int ent = 0;
if (fOwner) {
fV0Temp->Clear("");
fV0Temp->ExpandCreateFast(nv0s);
}
else {
ent = fV0Temp->GetEntriesFast();
fV0Temp->ExpandCreateFast(ent + nv0s);
}
for (int i = 0; i < nv0s; i++) {
auto particleV0 = fV0Container->GetParticles()->GetChannel(i);
auto v0struct = Convert(particleV0);
auto dau1 = recoCont->GetChannel(v0struct.dau1id);
auto dau2 = recoCont->GetChannel(v0struct.dau2id);
int ch1 = dau1.GetField<int>(charge_field);
int ch2 = dau2.GetField<int>(charge_field);
AnalysisTree::Track daupos = dau1, dauneg = dau2;
if (ch1 < 0 && ch2 > 0) { // daughters swap
daupos = dau2;
dauneg = dau1;
int temp = v0struct.dau1id;
v0struct.dau1id = v0struct.dau2id;
v0struct.dau2id = temp;
}
auto v0Track = (HalCbmV0TempTrack*) fV0Temp->ConstructedAt(ent + i);
v0Track->GetTrack().SetVertexChi2(v0struct.chi2_topo);
double e = TMath::Sqrt(v0struct.px * v0struct.px + v0struct.py * v0struct.py + v0struct.pz * v0struct.pz
+ v0struct.mass * v0struct.mass);
v0Track->GetTrack().SetMomentum(v0struct.px, v0struct.py, v0struct.pz, e);
v0Track->GetTrack().SetDCA(v0struct.x, v0struct.y, v0struct.z);
int field_hit = fRecoContainer->GetFieldIds().vtx_mvdhits;
int field_sts = fRecoContainer->GetFieldIds().vtx_nhits;
v0Track->GetTrack().SetNMvdHits(daupos.GetField<int>(field_hit) + dauneg.GetField<int>(field_hit));
v0Track->GetTrack().SetNStsHits(daupos.GetField<int>(field_sts) + dauneg.GetField<int>(field_sts)
- daupos.GetField<int>(field_hit) - dauneg.GetField<int>(field_hit));
v0Track->GetV0().SetPdgDaughters(fPidPosDau, fPidNegDau);
v0Track->GetV0().SetPosId(v0struct.dau1id);
v0Track->GetV0().SetNegId(v0struct.dau2id);
v0Track->GetV0().SetDecLenght(v0struct.l);
v0Track->GetV0().SetDecDl(v0struct.l_dl);
v0Track->GetV0().SetDauDist(v0struct.distance);
#ifdef DEBUG_EXTR
v0Track->GetV0().SetMomentumPos(TVector3(v0struct.dau1px, v0struct.dau1py, v0struct.dau1pz));
v0Track->GetV0().SetMomentumNeg(TVector3(v0struct.dau2px, v0struct.dau2py, v0struct.dau2pz));
#else
v0Track->GetV0().SetMomentumPos(TVector3(daupos.GetPx(), daupos.GetPy(), daupos.GetPz()));
v0Track->GetV0().SetMomentumNeg(TVector3(dauneg.GetPx(), dauneg.GetPy(), dauneg.GetPz()));
#endif
v0Track->GetV0().SetMcId(v0struct.pid);
v0Track->SetMcId(-1);
//mc matching
if (!recoMatch) continue;
int mc1 = recoMatch->GetMatchDirect(v0struct.dau1id);
int mc2 = recoMatch->GetMatchDirect(v0struct.dau2id);
if (fBeFriendly) {
if (mc1 >= 0 && mc2 >= 0) {
auto mctrack1 = sim->GetChannel(mc1);
auto mctrack2 = sim->GetChannel(mc2);
int mom1 = mctrack1.GetField<int>(mother_field);
int mom2 = mctrack2.GetField<int>(mother_field);
v0Track->SetMcId(mom1);
}
else if (mc1 >= 0) {
auto mctrack = sim->GetChannel(mc1);
v0Track->SetMcId(mctrack.GetField<int>(mother_field));
}
else if (mc2 >= 0) {
auto mctrack = sim->GetChannel(mc2);
v0Track->SetMcId(mctrack.GetField<int>(mother_field));
}
}
else {
if (mc1 < 0) continue;
if (mc2 < 0) continue;
auto mctrack1 = sim->GetChannel(mc1);
auto mctrack2 = sim->GetChannel(mc2);
int mom1 = mctrack1.GetField<int>(mother_field);
int mom2 = mctrack2.GetField<int>(mother_field);
if (mom1 == mom2) {
v0Track->SetMcId(mom1);
}
}
}
}
HalCbmV0Builder::~HalCbmV0Builder() {}
/* Copyright (C) 2025-2025 Warsaw University of Technology, Warsaw
SPDX-License-Identifier: GPL-3.0-only
Authors: Daniel Wielanek [committer] */
#ifndef CBMROOT_V0_ANALYSIS_PWGC2F_FEMTOSCOPY_HAL_HELPERS_HALCBMV0BUILDER_H_
#define CBMROOT_V0_ANALYSIS_PWGC2F_FEMTOSCOPY_HAL_HELPERS_HALCBMV0BUILDER_H_
#include "CbmAnaTreeContainer.h"
#include <Hal/Task.h>
class CbmAnaTreeV0Container;
class TClonesArray;
namespace AnalysisTree
{
class Particle;
}
class HalCbmV0Builder : public Hal::Task {
struct v0rawInfo {
float chi2geo, chi2_prim_first;
float chi2_prim_second, chi2_topo;
float cosine_first, cosine_second, cosine_topo;
float distance, l, l_dl;
float mass, px, py, pz;
float x, y, z;
int dau1id, dau2id, pid, id;
int mcid;
#ifdef DEBUG_EXTR
int dau1px, dau1py, dau1pz, dau1x, dau1y, dau1z;
int dau2px, dau2py, dau2pz, dau2x, dau2y, dau2z;
#endif
};
Int_t fPidMom;
Int_t fPidPosDau;
Int_t fPidNegDau;
Bool_t fBeFriendly = {kFALSE};
Double_t fMass = {0};
AnaTreeV0Ids fFields;
CbmAnaTreeV0Container* fV0Container = {nullptr};
CbmAnaTreeRecoContainer* fRecoContainer = {nullptr};
CbmAnaTreeMcContainer* fSimContainer = {nullptr};
TClonesArray* fV0Temp = {nullptr};
Bool_t fOwner = {kFALSE};
v0rawInfo Convert(const AnalysisTree::Particle& p);
public:
HalCbmV0Builder(Int_t motherPid = 3321, Int_t posdau = 2212, Int_t negdau = -211);
virtual EInitFlag Init();
void BeFriendly() { fBeFriendly = kTRUE; }
virtual void Exec(Option_t* option = "");
virtual ~HalCbmV0Builder();
ClassDef(HalCbmV0Builder, 1)
};
#endif /* CBMROOT_V0_ANALYSIS_PWGC2F_FEMTOSCOPY_HAL_HELPERS_HALCBMV0BUILDER_H_ */
/* Copyright (C) 2025-2025 Warsaw University of Technology, Warsaw
SPDX-License-Identifier: GPL-3.0-only
Authors: Daniel Wielanek [committer] */
#include "HalCbmV0TempTrack.h"
#include <TLorentzVector.h>
#include <TVector3.h>
#include <Hal/Event.h>
#include <Hal/ExpTrack.h>
#include <Hal/Track.h>
#include <Hal/V0Track.h>
Double_t HalCbmV0TempTrack::GetValue(kTriggerCut val)
{
switch (val) {
case kTriggerCut::kChi2Geo: {
return fV0Hidden.GetChi2geo();
} break;
case kTriggerCut::kChi2PrimFirst: {
return fV0Hidden.GetChi2Pos();
} break;
case kTriggerCut::kChi2PrimSecond: {
return fV0Hidden.GetChi2Neg();
} break;
case kTriggerCut::kChi2Topo: {
//return fV0Hidden.GetChi2topo();
} break;
case kTriggerCut::kCosineFirst: {
return fCosinePos;
} break;
case kTriggerCut::kCosineSecond: {
return fCosineNeg;
} break;
case kTriggerCut::kDistance: {
return fV0Hidden.GetChi2Pos();
} break;
case kTriggerCut::kL: {
return fV0Hidden.GetDecLength();
} break;
case kTriggerCut::kDl: {
return fV0Hidden.GetDecDl();
} break;
case kTriggerCut::kMass: {
return 0;
} break;
case kTriggerCut::kPt: {
return fRecoTrack.GetMomentum().Pt();
} break;
case kTriggerCut::kEta: {
return fRecoTrack.GetMomentum().Eta();
} break;
case kTriggerCut::kRxy: {
return fRecoTrack.GetDCA().Pt();
} break;
case kTriggerCut::kRz: {
return fRecoTrack.GetDCA().Z();
} break;
case kTriggerCut::kCosineTopo: {
return fCosineTopo;
} break;
case kTriggerCut::kPid: {
return fV0Hidden.GetPdg();
} break;
}
return 0;
}
void HalCbmV0TempTrack::ComputeStuff(Hal::Event* event, Hal::Track* assignedTrack)
{
auto dau1 = (HalCbmTrack*) event->GetTrack(fV0Hidden.GetPosId());
auto dau2 = (HalCbmTrack*) event->GetTrack(fV0Hidden.GetNegId());
TVector3 vtx = event->GetVertex()->Vect();
auto expTrack = (Hal::ExpTrack*) assignedTrack;
TVector3 pos(expTrack->GetDCA()); //or + event pos?
TVector3 mom(expTrack->GetPx(), expTrack->GetPy(), expTrack->GetPz());
auto shift = mom.Unit() * fV0Hidden.GetDecLength() + vtx; //new position + pos gorsze wyniki
fV0Hidden.SetDecayPos(shift.X(), shift.Y(), shift.Z());
TVector3 dau1mom, dau2mom, dau1pos, dau2pos;
dau1pos = dau1->GetHelix().Eval(shift.Z(), dau1mom);
dau2pos = dau2->GetHelix().Eval(shift.Z(), dau2mom);
#ifdef DEBUG_EXTR
std::cout << "DECPOS " << std::endl;
std::cout << __FILE__ << "____" << std::endl;
auto print = [](TString t, TVector3 x) {
std::cout << Form("%4.4f %4.4f %4.4f %s", x.X(), x.Y(), x.Z(), t.Data()) << std::endl;
};
print("Dau1dec", dau1pos);
print("Dau2dec", dau2pos);
print("Dau1vec", dau1mom);
print("Dau2vec", dau2mom);
#endif
fV0Hidden.SetMomPos(dau1mom.X(), dau1mom.Y(), dau1mom.Z());
fV0Hidden.SetMomNeg(dau2mom.X(), dau2mom.Y(), dau2mom.Z());
fV0Hidden.Recalc(*assignedTrack);
}
/* Copyright (C) 2025-2025 Warsaw University of Technology, Warsaw
SPDX-License-Identifier: GPL-3.0-only
Authors: Daniel Wielanek [committer] */
#ifndef CBMROOT_V0_ANALYSIS_PWGC2F_FEMTOSCOPY_HAL_HELPERS_V0_HALCBMV0TEMPTRACK_H_
#define CBMROOT_V0_ANALYSIS_PWGC2F_FEMTOSCOPY_HAL_HELPERS_V0_HALCBMV0TEMPTRACK_H_
#include "HalCbmTrack.h"
#include "HalCbmV0Track.h"
#include <Rtypes.h>
#include <RtypesCore.h>
class HalCbmV0TempTrack : public TObject {
HalCbmV0Track fV0Hidden;
HalCbmTrack fRecoTrack;
Int_t fMcId = {-1}; //match id
Double_t fCosinePos = {0};
Double_t fCosineNeg = {0};
Double_t fCosineTopo = {0};
Double_t fDl = {0};
public:
enum class kTriggerCut
{
kChi2Geo = 0,
kChi2PrimFirst = 1,
kChi2PrimSecond = 2,
kChi2Topo = 3,
kCosineFirst = 4,
kCosineSecond = 5,
kDistance = 6,
kL = 7,
kDl = 8,
kMass = 9,
kPt = 10,
kEta = 11,
kRxy = 12,
kRz = 13,
kCosineTopo = 14,
kPid = 15,
};
HalCbmV0TempTrack(){};
Double_t GetValue(kTriggerCut val);
void SetCosPos(Double_t val) { fCosinePos = val; }
void SetCosNeg(Double_t val) { fCosineNeg = val; }
void SetCosTopo(Double_t val) { fCosineTopo = val; }
void SetDL(Double_t val) { fDl = val; }
HalCbmV0Track& GetV0() { return fV0Hidden; }
HalCbmTrack& GetTrack() { return fRecoTrack; }
void ComputeStuff(Hal::Event* event,
Hal::Track* assignedTrack); //compute missing fields (not available in root trees)
void SetMcId(Int_t mc) { fMcId = mc; };
Int_t GetMcId() const { return fMcId; }
virtual ~HalCbmV0TempTrack(){};
ClassDef(HalCbmV0TempTrack, 1);
};
#endif /* CBMROOT_V0_ANALYSIS_PWGC2F_FEMTOSCOPY_HAL_HELPERS_V0_HALCBMV0TEMPTRACK_H_ */
/* Copyright (C) 2025-2025 Warsaw University of Technology, Warsaw
SPDX-License-Identifier: GPL-3.0-only
Authors: Daniel Wielanek [committer] */
#include "HalCbmV0Track.h"
void HalCbmV0Track::CopyData(V0Track* v)
{
Hal::V0Track::CopyData(v);
HalCbmV0Track* v0 = (HalCbmV0Track*) (v);
fMcId = v0->fMcId;
fDecDl = v0->fDecDl;
fChi2geo = v0->fChi2geo;
fChi2First = v0->fChi2First;
fChi2Second = v0->fChi2Second;
}
/* Copyright (C) 2025-2025 Warsaw University of Technology, Warsaw
SPDX-License-Identifier: GPL-3.0-only
Authors: Daniel Wielanek [committer] */
#ifndef CBMROOT_V0_ANALYSIS_PWGC2F_FEMTOSCOPY_HAL_FORMAT_V0_HALCBMV0TRACK_H_
#define CBMROOT_V0_ANALYSIS_PWGC2F_FEMTOSCOPY_HAL_FORMAT_V0_HALCBMV0TRACK_H_
#include <Hal/V0Track.h>
class HalCbmV0Track : public Hal::V0Track {
Int_t fMcId = {-1};
Float_t fDecDl = {0};
Float_t fChi2geo = {0};
Float_t fChi2First = {0};
Float_t fChi2Second = {0};
public:
HalCbmV0Track(){};
virtual ~HalCbmV0Track() {}
virtual void CopyData(V0Track* v);
void SetChi2geo(Float_t Chi2geo) { fChi2geo = Chi2geo; }
void SetDecDl(Float_t DecDl) { fDecDl = DecDl; }
void SetMcId(Int_t McId) { fMcId = McId; }
void SetChi2Dau(Double_t pos, Double_t neg)
{
fChi2First = pos;
fChi2Second = neg;
}
Float_t GetChi2geo() const { return fChi2geo; }
Float_t GetDecDl() const { return fDecDl; }
Float_t GetChi2Pos() const { return fChi2First; }
Float_t GetChi2Neg() const { return fChi2Second; }
Int_t GetMcId() const { return fMcId; };
ClassDef(HalCbmV0Track, 1)
};
#endif /* CBMROOT_V0_ANALYSIS_PWGC2F_FEMTOSCOPY_HAL_FORMAT_V0_HALCBMV0TRACK_H_ */
/* Copyright (C) 2025-2025 Warsaw University of Technology, Warsaw
SPDX-License-Identifier: GPL-3.0-only
Authors: Daniel Wielanek [committer] */
#include "HalCbmV0TrackTrigger.h"
HalCbmV0TrackTrigger::HalCbmV0TrackTrigger() {}
Bool_t HalCbmV0TrackTrigger::Pass(HalCbmV0TempTrack& /*tr*/) { return kTRUE; }
/* Copyright (C) 2025-2025 Warsaw University of Technology, Warsaw
SPDX-License-Identifier: GPL-3.0-only
Authors: Daniel Wielanek [committer] */
//TODO complete this class
#ifndef CBMROOT_V0_ANALYSIS_PWGC2F_FEMTOSCOPY_HAL_FORMAT_V0_HALCBMV0TRACKTRIGGER_H_
#define CBMROOT_V0_ANALYSIS_PWGC2F_FEMTOSCOPY_HAL_FORMAT_V0_HALCBMV0TRACKTRIGGER_H_
#include "HalCbmV0TempTrack.h"
#include <TObject.h>
class HalCbmV0TrackTrigger : public TObject {
Double_t fMin[16];
Double_t fMax[16];
void SetCut(Double_t lo, Double_t hi, HalCbmV0TempTrack::kTriggerCut pos)
{
int poz = static_cast<int>(pos);
fMin[poz] = lo;
fMax[poz] = hi;
}
public:
HalCbmV0TrackTrigger();
void SetChi2GeoCut(Double_t lo, Double_t hi) { SetCut(lo, hi, HalCbmV0TempTrack::kTriggerCut::kChi2Geo); }
void SetChi2PosDauCut(Double_t lo, Double_t hi) { SetCut(lo, hi, HalCbmV0TempTrack::kTriggerCut::kChi2PrimFirst); }
void SetChi2NegDauCut(Double_t lo, Double_t hi) { SetCut(lo, hi, HalCbmV0TempTrack::kTriggerCut::kChi2PrimSecond); }
void SetChi2TopoCut(Double_t lo, Double_t hi) { SetCut(lo, hi, HalCbmV0TempTrack::kTriggerCut::kChi2Topo); }
void SetCosTopoCut(Double_t lo, Double_t hi) { SetCut(lo, hi, HalCbmV0TempTrack::kTriggerCut::kCosineTopo); }
void SetCosPosDauCut(Double_t lo, Double_t hi) { SetCut(lo, hi, HalCbmV0TempTrack::kTriggerCut::kCosineFirst); }
void SetCosNegDauCut(Double_t lo, Double_t hi) { SetCut(lo, hi, HalCbmV0TempTrack::kTriggerCut::kCosineSecond); }
void SetDauDistCut(Double_t lo, Double_t hi) { SetCut(lo, hi, HalCbmV0TempTrack::kTriggerCut::kDistance); }
void SetDecLenCut(Double_t lo, Double_t hi) { SetCut(lo, hi, HalCbmV0TempTrack::kTriggerCut::kL); }
void SetDeltaDecLenCut(Double_t lo, Double_t hi) { SetCut(lo, hi, HalCbmV0TempTrack::kTriggerCut::kDl); }
void SetMassCut(Double_t lo, Double_t hi) { SetCut(lo, hi, HalCbmV0TempTrack::kTriggerCut::kMass); }
void SetPtCut(Double_t lo, Double_t hi) { SetCut(lo, hi, HalCbmV0TempTrack::kTriggerCut::kPt); }
void SetEtaCut(Double_t lo, Double_t hi) { SetCut(lo, hi, HalCbmV0TempTrack::kTriggerCut::kEta); }
void SetDCAxyCut(Double_t lo, Double_t hi) { SetCut(lo, hi, HalCbmV0TempTrack::kTriggerCut::kRxy); }
void SetDCAz(Double_t lo, Double_t hi) { SetCut(lo, hi, HalCbmV0TempTrack::kTriggerCut::kRz); }
Bool_t Pass(HalCbmV0TempTrack& tr);
virtual ~HalCbmV0TrackTrigger(){};
ClassDef(HalCbmV0TrackTrigger, 1)
};
#endif /* CBMROOT_V0_ANALYSIS_PWGC2F_FEMTOSCOPY_HAL_FORMAT_V0_HALCBMV0TRACKTRIGGER_H_ */
...@@ -94,12 +94,12 @@ Hal::FemtoBasicAna* MakeAna(Bool_t speedUp) ...@@ -94,12 +94,12 @@ Hal::FemtoBasicAna* MakeAna(Bool_t speedUp)
* speed up analysis by using compression and special HBT format * speed up analysis by using compression and special HBT format
* the sts exit distance and phi* are calculated once per track * the sts exit distance and phi* are calculated once per track
*/ */
task->SetFormat(new HalCbmFullEvent(), Hal::EFormatDepth::kNonBuffered); // task->SetFormat(new HalCbmFullEvent(), Hal::EFormatDepth::kNonBuffered);
task->SetFormat(new HalCbmHbtFullEvent(), Hal::EFormatDepth::kBuffered); task->SetFormat(new HalCbmHbtFullEvent(), Hal::EFormatDepth::kBuffered);
task->SetFormatOption(Hal::EventAna::EFormatOption::kCompress); task->SetFormatOption(Hal::EventAna::EFormatOption::kCompress);
} }
else { else {
task->SetFormat(new HalCbmFullEvent()); //task->SetFormat(new HalCbmFullEvent());
} }
SetEventCut(task); SetEventCut(task);
SetTrackCuts(task); SetTrackCuts(task);
......
/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw
SPDX-License-Identifier: GPL-3.0-only
Authors: Daniel Wielanek [committer] */
#ifndef __CLING__
#include "CbmAnaTreeSource.h"
#include "CbmFieldMap.h"
#include "FairFileSource.h"
#include "FairParRootFileIo.h"
#include "FemtoBasicAna.h"
#include "HalCbmAnalysisManager.h"
#include "HalCbmReader.h"
#include "HalCbmSource.h"
#include "HalCbmV0Builder.h"
#include "TFile.h"
#include "data/CbmDefs.h"
#include <FairLogger.h>
#include <FairRun.h>
#include <FairRunAna.h>
#include <RtypesCore.h>
#include <TStopwatch.h>
#include <TString.h>
#include <TTimer.h>
#include <cstdio>
#include <iostream>
#include <Hal/AnalysisManager.h>
#include <Hal/DataFormat.h>
#include <Hal/PropertyMonitorX.h>
#include <Hal/PropertyMonitorXY.h>
#include <Hal/Source.h>
using namespace std;
#endif
#include "hbt_common.C"
#define KRONOS
/**
* analysis macro done via FairRoot
* @param task
*/
void hbt_v0(TString inFile = "3000.analysistree.root", TString outFile = "test2.root")
{
HalCbmAnalysisManager* manager = new HalCbmAnalysisManager();
auto source = new HalCbmSource(inFile);
source->AddFriend("v0.root");
manager->SetSource(source);
manager->SetOutput(outFile);
HalCbmV0Builder* v0 =
new HalCbmV0Builder(Hal::Const::LambdaPID(), Hal::Const::ProtonPID(), -Hal::Const::PionPlusPID());
manager->AddTask(v0);
auto reader = new HalCbmReader();
manager->AddTask(reader);
Hal::FemtoBasicAna* task = MakeAna(kTRUE);
task->SetPdg(Hal::Const::LambdaPID()); //switch to lambda PID
Hal::TrackFieldMonitorXY armenteros(Hal::DataFieldID::Track::EV0::kAlphaArm, Hal::DataFieldID::Track::EV0::kPtArm);
armenteros.SetXaxis(200, -1, 1);
armenteros.SetYaxis(200, 0, 1);
task->AddCutMonitor(armenteros);
manager->AddTask(task);
TStopwatch timer;
timer.Start();
manager->Init();
manager->Run(0, 1000);
Double_t rtime = timer.RealTime(), ctime = timer.CpuTime();
printf("RealTime=%f seconds, CpuTime=%f seconds\n", rtime, ctime);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment