Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-11 09:40:23

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 #pragma once
0010 
0011 #include "Acts/EventData/SpacePointContainer2.hpp"
0012 #include "Acts/EventData/SpacePointProxy2.hpp"
0013 #include "Acts/EventData/Types.hpp"
0014 
0015 class TChain;
0016 class TTree;
0017 
0018 namespace ActsPlugins {
0019 
0020 /// Root space point reading and writing utility
0021 class RootSpacePointIo {
0022  public:
0023   /// @brief sets the branch connection for writing to a file
0024   ///
0025   /// @param ttree the TTree to write to
0026   /// @param spacePoints the space points to write
0027   void connectForWrite(TTree& ttree,
0028                        const Acts::SpacePointContainer2& spacePoints);
0029 
0030   /// @brief sets the branch connection for reading from a file
0031   ///
0032   /// @param tchain the TChain to read from
0033   /// @param spacePoints the space points to read into
0034   void connectForRead(TChain& tchain,
0035                       const Acts::SpacePointContainer2& spacePoints);
0036 
0037   /// @brief Write a space point to the tree
0038   /// @note the caller has to do the TTree::Fill() after this call
0039   ///
0040   /// @param spacePoint the space point to write
0041   void write(const Acts::ConstSpacePointProxy2& spacePoint);
0042 
0043   /// @brief Write the space points to the tree
0044   ///
0045   /// @param spacePoints the space points to write
0046   /// @param ttree the TTree to write to
0047   void write(const Acts::SpacePointContainer2& spacePoints, TTree& ttree);
0048 
0049   /// @brief Read a space point from the tree
0050   /// @note the caller has to do the TChain::GetEntry() before this call
0051   ///
0052   /// @param spacePoint the space point to read into
0053   /// @param index the original index of the space point in the ROOT file
0054   void read(Acts::MutableSpacePointProxy2& spacePoint,
0055             Acts::SpacePointIndex2 index);
0056 
0057   /// @brief Read the space points from the tree
0058   ///
0059   /// @param tchain the TChain to read from
0060   /// @param spacePoints the space points to read into
0061   void read(TChain& tchain, Acts::SpacePointContainer2& spacePoints);
0062 
0063  private:
0064   float m_x = 0;
0065   float m_y = 0;
0066   float m_z = 0;
0067 
0068   float m_t = 0;
0069 
0070   float m_r = 0;
0071 
0072   float m_varZ = 0;
0073   float m_varR = 0;
0074 };
0075 
0076 }  // namespace ActsPlugins