File indexing completed on 2024-09-27 07:02:36
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 #include "common_bench/particles.h"
0022 #include "common_bench/benchmark.h"
0023 #include "common_bench/mt.h"
0024 #include "common_bench/util.h"
0025
0026 void b0_tracker_hits(const char* fname = "./sim_output/sim_forward_protons.edm4hep.root"){
0027
0028 ROOT::EnableImplicitMT();
0029 double degree = TMath::Pi()/180.0;
0030
0031 TChain* t = new TChain("events");
0032 t->Add(fname);
0033
0034 ROOT::RDataFrame d0(*t);
0035
0036 auto hits_eta = [&](const std::vector<edm4hep::SimTrackerHitData>& hits) {
0037 std::vector<double> result;
0038 for (const auto& h : hits) {
0039 ROOT::Math::XYZVector vec(h.position.x,h.position.y,h.position.z);
0040 result.push_back(vec.eta());
0041 std::cout << vec.eta() << "\n";
0042 }
0043 return result;
0044 };
0045
0046 auto d1 = d0.Define("hits_eta", hits_eta, {"B0TrackerHits"});
0047
0048 auto h1 = d1.Histo1D({"h1", "hits_eta", 100, 0,20}, "hits_eta");
0049 TCanvas* c = new TCanvas();
0050 h1->DrawCopy();
0051 c->SaveAs("results/far_forward/b0/hits_eta.png");
0052 c->SaveAs("results/far_forward/b0/hits_eta.pdf");
0053 auto n1 = h1->GetMean();
0054 std::cout << "Pseudorapidity of hits: " << n1 << std::endl;
0055
0056
0057
0058
0059
0060 }
0061