Project
Loading...
Searching...
No Matches
LaserTrack.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
15
16#include <memory>
17#include <fstream>
18#include <iostream>
19#include <sstream>
20#include <vector>
21#include <fairlogger/Logger.h>
22
23#include "TFile.h"
24#include "TTree.h"
25
27
28using namespace o2::tpc;
29
31{
32 int id;
33 float x, alpha, p0, p1, p2, p3, p4;
34
35 const std::string o2Root(std::getenv("O2_ROOT"));
36 const std::string file = o2Root + "/share/Detectors/TPC/files/laserTrackData.txt";
37
38 std::string line;
39 std::ifstream infile(file, std::ifstream::in);
40
41 if (!infile.is_open()) {
42 LOG(error) << "Could not open laser track file " << file;
43 return;
44 }
45
46 while (std::getline(infile, line)) {
47 std::stringstream streamLine(line);
48 streamLine >> id >> x >> alpha >> p0 >> p1 >> p2 >> p3 >> p4;
49
50 //printf("%3d: %f %f %f %f %f %f %f \n", id, x, alpha, p0, p1, p2, p3, p4);
51 mLaserTracks[id] = LaserTrack(id, x, alpha, {p0, p1, p2, p3, p4});
52 }
53}
54
55void LaserTrackContainer::dumpToTree(const std::string_view fileName)
56{
59 const auto& tracks = c.getLaserTracks();
60 std::vector<LaserTrack> vtracks;
61
62 for (const auto& track : tracks) {
63 vtracks.emplace_back(track);
64 }
65
66 std::unique_ptr<TFile> fout(TFile::Open(fileName.data(), "recreate"));
67 TTree t("laserTracks", "Laser Tracks");
68 t.Branch("tracks", &vtracks);
69 t.Fill();
70 fout->Write();
71 fout->Close();
72}
constexpr int p2()
constexpr int p1()
constexpr to accelerate the coordinates changing
uint32_t c
Definition RawData.h:2
void loadTracksFromFile()
load laser tracks from file
static void dumpToTree(const std::string_view fileName)
dump tracks to a tree for simple visualization
GLfloat GLfloat GLfloat alpha
Definition glcorearb.h:279
GLint GLenum GLint x
Definition glcorearb.h:403
GLuint id
Definition glcorearb.h:650
Global TPC definitions and constants.
Definition SimTraits.h:167
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"