Skip to content
15 changes: 11 additions & 4 deletions Detectors/MUON/MCH/Base/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,14 @@
# submit itself to any jurisdiction.

o2_add_library(MCHBase
SOURCES src/Mapping.cxx src/DigitBlock.cxx
src/PreClusterBlock.cxx src/ClusterBlock.cxx
src/TrackBlock.cxx
PUBLIC_LINK_LIBRARIES ROOT::Core FairRoot::Base FairMQ::FairMQ)
SOURCES
src/ClusterBlock.cxx
src/Digit.cxx
src/DigitBlock.cxx
src/Mapping.cxx
src/PreClusterBlock.cxx
src/TrackBlock.cxx
PUBLIC_LINK_LIBRARIES ROOT::Core FairRoot::Base FairMQ::FairMQ)

o2_target_root_dictionary(MCHBase
HEADERS include/MCHBase/Digit.h)
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
* @author Michael Winn
*/

#ifndef ALICEO2_MCH_DIGIT_H_
#define ALICEO2_MCH_DIGIT_H_
#ifndef ALICEO2_MCH_BASE_DIGIT_H_
#define ALICEO2_MCH_BASE_DIGIT_H_

#include "CommonDataFormat/TimeStamp.h"
#include "Rtypes.h"

namespace o2
{
Expand All @@ -25,28 +25,30 @@ namespace mch

// \class Digit
/// \brief MCH digit implementation
using DigitBase = o2::dataformats::TimeStamp<double>;
class Digit : public DigitBase
class Digit
{
public:
Digit() = default;

Digit(double time, int detid, int pad, double adc);
Digit(double time, int detid, int pad, unsigned long adc);
~Digit() = default;

bool operator==(const Digit&) const;

double getTimeStamp() const { return mTime; }

int getDetID() const { return mDetID; }
void setDetID(int detid) { mDetID = detid; }

int getPadID() const { return mPadID; }
void setPadID(int pad) { mPadID = pad; }

double getADC() const { return mADC; }
void setADC(double adc) { mADC = adc; }
unsigned long getADC() const { return mADC; }
void setADC(unsigned long adc) { mADC = adc; }

private:
double mTime;
int mDetID;
int mPadID; /// PadIndex to which the digit corresponds to
double mADC; /// Amplitude of signal
int mPadID; /// PadIndex to which the digit corresponds to
unsigned long mADC; /// Amplitude of signal

ClassDefNV(Digit, 1);
}; //class Digit
Expand Down
35 changes: 35 additions & 0 deletions Detectors/MUON/MCH/Base/src/Digit.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Copyright CERN and copyright holders of ALICE O2. This software is
// distributed under the terms of the GNU General Public License v3 (GPL
// Version 3), copied verbatim in the file "COPYING".
//
// See http://alice-o2.web.cern.ch/license for full licensing information.
//
// 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 "MCHBase/Digit.h"
#include <cmath>

namespace o2::mch
{

bool closeEnough(double x, double y, double eps = 1E-6)
{
return std::fabs(x - y) <= eps * std::max(1.0, std::max(std::fabs(x), std::fabs(y)));
}

Digit::Digit(double time, int detid, int pad, unsigned long adc)
: mTime(time), mDetID(detid), mPadID(pad), mADC(adc)
{
}

bool Digit::operator==(const Digit& other) const
{
return mDetID == other.mDetID &&
mPadID == other.mPadID &&
mADC == other.mADC &&
closeEnough(mTime, other.mTime);
}

} // namespace o2::mch
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

#include "MCHSimulation/Digit.h"
#ifdef __CLING__

using namespace o2::mch;
#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;

ClassImp(o2::mch::Digit);
#pragma link C++ namespace o2;
#pragma link C++ namespace o2::mch;

Digit::Digit(double time, int detid, int pad, double adc)
: DigitBase(time), mDetID(detid), mPadID(pad), mADC(adc)
{
}
#pragma link C++ class o2::mch::Digit + ;
#pragma link C++ class std::vector < o2::mch::Digit> + ;

#endif
7 changes: 3 additions & 4 deletions Detectors/MUON/MCH/Simulation/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

o2_add_library(MCHSimulation
SOURCES src/Detector.cxx
src/Digit.cxx
src/Digitizer.cxx
src/Geometry.cxx
src/GeometryTest.cxx
Expand All @@ -26,13 +25,13 @@ o2_add_library(MCHSimulation
src/Station345Geometry.h
src/Stepper.cxx
src/Stepper.h
PUBLIC_LINK_LIBRARIES O2::SimulationDataFormat
PUBLIC_LINK_LIBRARIES O2::SimulationDataFormat
O2::MCHBase
O2::MCHMappingImpl3 O2::DetectorsBase
RapidJSON::RapidJSON)

o2_target_root_dictionary(MCHSimulation
HEADERS include/MCHSimulation/Detector.h
include/MCHSimulation/Digit.h
include/MCHSimulation/Digitizer.h
include/MCHSimulation/Geometry.h
include/MCHSimulation/GeometryTest.h
Expand All @@ -42,6 +41,6 @@ o2_target_root_dictionary(MCHSimulation
if(BUILD_TESTING)
add_subdirectory(test)
o2_add_test_root_macro(macros/drawMCHGeometry.C
PUBLIC_LINK_LIBRARIES O2::MCHSimulation
PUBLIC_LINK_LIBRARIES O2::MCHSimulation O2::MCHBase
LABELS "muon;mch")
endif()
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#ifndef O2_MCH_SIMULATION_MCHDIGITIZER_H_
#define O2_MCH_SIMULATION_MCHDIGITIZER_H_

#include "MCHSimulation/Digit.h"
#include "MCHBase/Digit.h"
#include "MCHSimulation/Hit.h"

#include "SimulationDataFormat/MCCompLabel.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#ifndef O2_MCH_SIMULATION_RESPONSE_H_
#define O2_MCH_SIMULATION_RESPONSE_H_

#include "MCHSimulation/Digit.h"
#include "MCHBase/Digit.h"
#include "MCHSimulation/Detector.h"
#include "MCHSimulation/Hit.h"

Expand All @@ -37,7 +37,7 @@ class Response
float etocharge(float edepos);
double chargePadfraction(float xmin, float xmax, float ymin, float ymax);
double chargefrac1d(float min, float max, double k2, double sqrtk3, double k4);
double response(float charge);
unsigned long response(float charge);
float getAnod(float x);
float chargeCorr();

Expand Down
4 changes: 2 additions & 2 deletions Detectors/MUON/MCH/Simulation/src/Response.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ double Response::chargefrac1d(float min, float max, double k2, double sqrtk3, do
return 2. * k4 * (TMath::ATan(u2) - TMath::ATan(u1));
}
//______________________________________________________________________
double Response::response(float charge)
unsigned long Response::response(float charge)
{
//FEE effects
return charge;
return (unsigned long)charge;
}
//______________________________________________________________________
float Response::getAnod(float x)
Expand Down
2 changes: 1 addition & 1 deletion Detectors/MUON/MCH/Simulation/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ o2_add_test(simulation
COMPONENT_NAME mchsimulation
SOURCES testDigitMerging.cxx DigitMerging.cxx testGeometry.cxx
testDigitization.cxx testResponse.cxx
PUBLIC_LINK_LIBRARIES O2::MCHSimulation
PUBLIC_LINK_LIBRARIES O2::MCHSimulation O2::MCHBase
LABELS muon mch long CONFIGURATIONS RelWithDebInfo)

if(benchmark_FOUND)
Expand Down
2 changes: 1 addition & 1 deletion Detectors/MUON/MCH/Simulation/test/DigitMerging.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#define O2_MCH_SIMULATION_TEST_DIGITMERGING_H

#include <vector>
#include "MCHSimulation/Digit.h"
#include "MCHBase/Digit.h"
#include "SimulationDataFormat/MCCompLabel.h"

std::vector<o2::mch::Digit> mergeDigitsMW(const std::vector<o2::mch::Digit>& inputDigits, const std::vector<o2::MCCompLabel>& labels);
Expand Down
2 changes: 1 addition & 1 deletion Detectors/MUON/MCH/Simulation/test/benchDigitMerging.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// or submit itself to any jurisdiction.

#include "benchmark/benchmark.h"
#include "MCHSimulation/Digit.h"
#include "MCHBase/Digit.h"
#include "DigitMerging.h"
#include <ctime>
#include <cstdlib>
Expand Down
2 changes: 1 addition & 1 deletion Detectors/MUON/MCH/Simulation/test/testDigitMerging.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

#include <boost/test/unit_test.hpp>

#include "MCHSimulation/Digit.h"
#include "MCHBase/Digit.h"
#include "SimulationDataFormat/MCCompLabel.h"
#include "DigitMerging.h"
#include "boost/format.hpp"
Expand Down
2 changes: 1 addition & 1 deletion Detectors/MUON/MCH/Simulation/test/testDigitization.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include <boost/test/unit_test.hpp>

#include "TGeoManager.h"
#include "MCHSimulation/Digit.h"
#include "MCHBase/Digit.h"
#include "MCHSimulation/Digitizer.h"
#include "MCHSimulation/Hit.h"
#include "MCHSimulation/Geometry.h"
Expand Down
1 change: 1 addition & 0 deletions Steer/DigitizerWorkflow/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ o2_add_executable(digitizer-workflow
O2::ITSMFTSimulation
O2::ITSSimulation
O2::MCHSimulation
O2::MCHBase
O2::MFTSimulation
O2::MIDSimulation
O2::PHOSSimulation
Expand Down
2 changes: 1 addition & 1 deletion Steer/DigitizerWorkflow/src/MCHDigitWriterSpec.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include "Framework/DataProcessorSpec.h"
#include "DPLUtils/MakeRootTreeWriterSpec.h"
#include "Framework/InputSpec.h"
#include "MCHSimulation/Digit.h"
#include "MCHBase/Digit.h"
#include <SimulationDataFormat/MCCompLabel.h>
#include <SimulationDataFormat/MCTruthContainer.h>

Expand Down
2 changes: 1 addition & 1 deletion Steer/DigitizerWorkflow/src/MCHDigitizerSpec.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include <SimulationDataFormat/MCTruthContainer.h>
#include "Framework/Task.h"
#include "DataFormatsParameters/GRPObject.h"
#include "MCHSimulation/Digit.h"
#include "MCHBase/Digit.h"
#include "MCHSimulation/Digitizer.h"
#include "MCHSimulation/Detector.h"
#include "DetectorsBase/GeometryManager.h"
Expand Down
1 change: 1 addition & 0 deletions run/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ target_link_libraries(allsim
O2::Field
O2::HMPIDSimulation
O2::ITSSimulation
O2::MCHBase
O2::MCHSimulation
O2::MFTSimulation
O2::MIDSimulation
Expand Down