Skip to content

Commit

Permalink
Digit class extension for simple drawing
Browse files Browse the repository at this point in the history
  • Loading branch information
wiechula committed Jun 3, 2024
1 parent ad2b119 commit a2c661f
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Detectors/TPC/calibration/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ o2_add_library(TPCCalibration
src/TPCScaler.cxx
src/CorrMapParam.cxx
src/TPCMShapeCorrection.cxx
src/DigitAdd.cxx
PUBLIC_LINK_LIBRARIES O2::DataFormatsTPC O2::TPCBase
O2::TPCReconstruction ROOT::Minuit
Microsoft.GSL::GSL
Expand Down Expand Up @@ -109,7 +110,8 @@ o2_target_root_dictionary(TPCCalibration
include/TPCCalibration/CalculatedEdx.h
include/TPCCalibration/TPCScaler.h
include/TPCCalibration/CorrMapParam.h
include/TPCCalibration/TPCMShapeCorrection.h)
include/TPCCalibration/TPCMShapeCorrection.h
include/TPCCalibration/DigitAdd.h)

o2_add_test_root_macro(macro/comparePedestalsAndNoise.C
PUBLIC_LINK_LIBRARIES O2::TPCBase
Expand Down
39 changes: 39 additions & 0 deletions Detectors/TPC/calibration/include/TPCCalibration/DigitAdd.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

/// \file DigitAdd.h
/// \brief Extension of TPC Digit adding draw query functions for simple drawing
/// \author Jens Wiechula ([email protected])

#ifndef ALICEO2_TPC_DIGITADD_H_
#define ALICEO2_TPC_DIGITADD_H_

#include "DataFormatsTPC/Digit.h"

namespace o2::tpc
{
/// \class Digit
class DigitAdd : public Digit
{
public:
int sector() const;
float lx() const;
float ly() const;
float gx() const;
float gy() const;
float cpad() const;

ClassDefNV(DigitAdd, 1)
};

} // namespace o2::tpc

#endif // ALICEO2_TPC_DIGITADD_H_
54 changes: 54 additions & 0 deletions Detectors/TPC/calibration/src/DigitAdd.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

#include "GPUTPCGeometry.h"
#include "TPCBase/Mapper.h"
#include "TPCBase/CRU.h"
#include "TPCCalibration/DigitAdd.h"

using namespace o2::tpc;

int DigitAdd::sector() const
{
return CRU(mCRU).sector();
}

float DigitAdd::lx() const
{
const GPUCA_NAMESPACE::gpu::GPUTPCGeometry gpuGeom;
return gpuGeom.Row2X(mRow);
}

float DigitAdd::ly() const
{
const GPUCA_NAMESPACE::gpu::GPUTPCGeometry gpuGeom;
return gpuGeom.LinearPad2Y(sector(), mRow, getPad());
}

float DigitAdd::gx() const
{
const LocalPosition2D l2D{lx(), ly()};
const auto g2D = Mapper::LocalToGlobal(l2D, Sector(sector()));
return g2D.x();
}

float DigitAdd::gy() const
{
const LocalPosition2D l2D{lx(), ly()};
const auto g2D = Mapper::LocalToGlobal(l2D, Sector(sector()));
return g2D.y();
}

float DigitAdd::cpad() const
{
const GPUCA_NAMESPACE::gpu::GPUTPCGeometry gpuGeom;
return getPad() - gpuGeom.NPads(mRow) / 2.f;
}
2 changes: 2 additions & 0 deletions Detectors/TPC/calibration/src/TPCCalibrationLinkDef.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,6 @@
#pragma link C++ class o2::tpc::TPCMShapeCorrection + ;
#pragma link C++ struct o2::tpc::TPCMShape + ;
#pragma link C++ struct o2::tpc::BoundaryPotentialIFC + ;
#pragma link C++ class o2::tpc::DigitAdd + ;
#pragma link C++ class std::vector < o2::tpc::DigitAdd> + ;
#endif

0 comments on commit a2c661f

Please sign in to comment.