File indexing completed on 2026-06-28 07:38:10
0001 R__LOAD_LIBRARY(libfmt.so)
0002 #include "fmt/core.h"
0003
0004 #include "ROOT/RDataFrame.hxx"
0005 #include "Math/Vector3D.h"
0006
0007
0008 #include "TCanvas.h"
0009
0010
0011
0012
0013
0014
0015
0016 #include "TChain.h"
0017
0018
0019 #include "edm4hep/SimTrackerHitCollection.h"
0020
0021
0022 void b0_tracker_hits(const char* fname = "./sim_output/sim_forward_protons.edm4hep.root"){
0023
0024 ROOT::EnableImplicitMT();
0025 double degree = TMath::Pi()/180.0;
0026
0027 TChain* t = new TChain("events");
0028 t->Add(fname);
0029
0030 ROOT::RDataFrame d0(*t);
0031
0032 auto hits_eta = [&](const std::vector<edm4hep::SimTrackerHitData>& hits) {
0033 std::vector<double> result;
0034 for (const auto& h : hits) {
0035 ROOT::Math::XYZVector vec(h.position.x,h.position.y,h.position.z);
0036 result.push_back(vec.eta());
0037 std::cout << vec.eta() << "\n";
0038 }
0039 return result;
0040 };
0041
0042 auto d1 = d0.Define("hits_eta", hits_eta, {"B0TrackerHits"});
0043
0044 auto h1 = d1.Histo1D({"h1", "hits_eta", 100, 0,20}, "hits_eta");
0045 TCanvas* c = new TCanvas();
0046 h1->DrawCopy();
0047 c->SaveAs("results/far_forward/b0/hits_eta.png");
0048 c->SaveAs("results/far_forward/b0/hits_eta.pdf");
0049 auto n1 = h1->GetMean();
0050 std::cout << "Pseudorapidity of hits: " << n1 << std::endl;
0051
0052
0053
0054
0055
0056 }