Skip to content
Snippets Groups Projects

B0tracker basics

Files

#include "ROOT/RDataFrame.hxx"
#include "Math/Vector3D.h"
//#include "Math/Vector4D.h"
//#include "Math/VectorUtil.h"
#include "TCanvas.h"
//#include "TLegend.h"
//#include "TMath.h"
//#include "TRandom3.h"
//#include "TFile.h"
//#include "TH1F.h"
//#include "TH1D.h"
//#include "TTree.h"
#include "TChain.h"
//#include "TF1.h"
#include "dd4pod/Geant4ParticleCollection.h"
#include "dd4pod/TrackerHitCollection.h"
#include "common_bench/particles.h"
#include "common_bench/benchmark.h"
#include "common_bench/mt.h"
#include "common_bench/util.h"
#include "fmt/core.h"
#include "dd4pod/TrackerHitCollection.h"
void b0_tracker_hits(const char* fname = "./sim_output/sim_forward_protons.root"){
ROOT::EnableImplicitMT(); // Tell ROOT you want to go parallel
double degree = TMath::Pi()/180.0;
TChain* t = new TChain("events");
t->Add(fname);
ROOT::RDataFrame d0(*t);
auto hits_eta = [&](const std::vector<eic::TrackerHitData>& hits) {
std::vector<double> result;
for (const auto& h : hits) {
result.push_back(h->position.eta());
}
return result;
};
auto d1 = d0.Define("hits_eta", hits_eta, {"B0TrackerHits"});
auto h1 = d1.Histo1D(TH1D("h1", "hits_eta", 100, 0,20), "hits_eta");
auto n1 = h1->GetMean();
std::cout << "Pseudorapidity of hits: " << n1 << std::endl;
TCanvas* c = new TCanvas();
h1->DrawClone();
h1->SaveAs("results/b0_tracker_hits_eta.png");
h1->SaveAs("results/b0_tracker_hits_eta.pdf");
//if (n1 < 5) {
// std::quick_exit(1);
//}
}
Loading