Skip to content

Commit b8ec70f

Browse files
committed
Basic HMPID digitizer workflow
This commit provides a basic DPL digitizer workflow for HMPID. It achieves: - rudimentary digits and first conversion from hits - a Digitizer class - DPL components for digitization With this, everything is there to have the workflow running. The following steps need to be done next: - correct hit -> digits conversion - consider cross talk (hit influencing multiple pads) - implement digit pileup + zero suppression - finish IO of digits - add treatment of MC labels This commit relates to https://alice.its.cern.ch/jira/browse/O2-384 Authors: @gvolpe79, @sawenzel
1 parent 93ba0a8 commit b8ec70f

File tree

18 files changed

+544
-7
lines changed

18 files changed

+544
-7
lines changed

Detectors/HMPID/base/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ O2_SETUP(NAME ${MODULE_NAME})
44

55
set(SRCS
66
src/Param.cxx
7+
src/Digit.cxx
78
)
89
set(HEADERS
910
include/${MODULE_NAME}/Param.h
11+
include/${MODULE_NAME}/Digit.h
1012
)
1113

1214
Set(LINKDEF src/HMPIDBaseLinkDef.h)
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
// Copyright CERN and copyright holders of ALICE O2. This software is
2+
// distributed under the terms of the GNU General Public License v3 (GPL
3+
// Version 3), copied verbatim in the file "COPYING".
4+
//
5+
// See http://alice-o2.web.cern.ch/license for full licensing information.
6+
//
7+
// In applying this license CERN does not waive the privileges and immunities
8+
// granted to it by virtue of its status as an Intergovernmental Organization
9+
// or submit itself to any jurisdiction.
10+
11+
#ifndef DETECTORS_HMPID_BASE_INCLUDE_HMPIDBASE_DIGIT_H_
12+
#define DETECTORS_HMPID_BASE_INCLUDE_HMPIDBASE_DIGIT_H_
13+
14+
#include "CommonDataFormat/TimeStamp.h"
15+
#include "HMPIDBase/Hit.h" // for hit
16+
#include "HMPIDBase/Param.h" // for param
17+
#include "TMath.h"
18+
19+
namespace o2
20+
{
21+
namespace hmpid
22+
{
23+
24+
/// \class Digit
25+
/// \brief HMPID digit implementation
26+
using DigitBase = o2::dataformats::TimeStamp<double>;
27+
class Digit : public DigitBase
28+
{
29+
public:
30+
Digit() = default;
31+
Digit(float charge) : mQ(charge) {}
32+
float getCharge() const { return mQ; }
33+
int getPadID() const { return mPad; }
34+
35+
Digit(HitType const& hit)
36+
{
37+
int pc, px, py;
38+
float localX;
39+
float localY;
40+
41+
// chamber number is in detID
42+
const auto chamber = hit.GetDetectorID();
43+
44+
double tmp[3] = { hit.GetX(), hit.GetY(), hit.GetZ() };
45+
Param::Instance()->Mars2Lors(chamber, tmp, localX, localY);
46+
47+
Param::Lors2Pad(localX, localY, pc, px, py);
48+
49+
// TODO: check if this digit is valid
50+
// mark as invalid otherwise
51+
52+
// calculate pad id
53+
mPad = Param::Abs(chamber, pc, px, py);
54+
55+
// calculate charge
56+
mQ = /*fQHit **/ InMathieson(localX, localY);
57+
58+
// what about time stamp??
59+
}
60+
61+
private:
62+
float mQ = 0.;
63+
int mPad = 0.; // -1 indicates invalid digit
64+
65+
float LorsX() const { return Param::LorsX(Param::A2P(mPad), Param::A2X(mPad)); } //center of the pad x, [cm]
66+
float LorsY() const { return Param::LorsY(Param::A2P(mPad), Param::A2Y(mPad)); } //center of the pad y, [cm]
67+
68+
float IntPartMathiX(float x) const
69+
{
70+
// Integration of Mathieson.
71+
// This is the answer to electrostatic problem of charge distrubution in MWPC described elsewhere. (NIM A370(1988)602-603)
72+
// Arguments: x,y- position of the center of Mathieson distribution
73+
// Returns: a charge fraction [0-1] imposed into the pad
74+
auto shift1 = -LorsX() + 0.5 * Param::SizePadX();
75+
auto shift2 = -LorsX() - 0.5 * Param::SizePadX();
76+
77+
auto ux1 = Param::SqrtK3x() * TMath::TanH(Param::K2x() * (x + shift1) / Param::PitchAnodeCathode());
78+
auto ux2 = Param::SqrtK3x() * TMath::TanH(Param::K2x() * (x + shift2) / o2::hmpid::Param::PitchAnodeCathode());
79+
80+
return o2::hmpid::Param::K4x() * (TMath::ATan(ux2) - TMath::ATan(ux1));
81+
}
82+
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
83+
84+
Double_t IntPartMathiY(Double_t y) const
85+
{
86+
// Integration of Mathieson.
87+
// This is the answer to electrostatic problem of charge distrubution in MWPC described elsewhere. (NIM A370(1988)602-603)
88+
// Arguments: x,y- position of the center of Mathieson distribution
89+
// Returns: a charge fraction [0-1] imposed into the pad
90+
Double_t shift1 = -LorsY() + 0.5 * o2::hmpid::Param::SizePadY();
91+
Double_t shift2 = -LorsY() - 0.5 * o2::hmpid::Param::SizePadY();
92+
93+
Double_t uy1 = Param::SqrtK3y() * TMath::TanH(Param::K2y() * (y + shift1) / Param::PitchAnodeCathode());
94+
Double_t uy2 = Param::SqrtK3y() * TMath::TanH(Param::K2y() * (y + shift2) / Param::PitchAnodeCathode());
95+
96+
return Param::K4y() * (TMath::ATan(uy2) - TMath::ATan(uy1));
97+
}
98+
99+
float InMathieson(float localX, float localY) const
100+
{
101+
return 4. * IntPartMathiX(localX) * IntPartMathiY(localY);
102+
}
103+
104+
ClassDefNV(Digit, 1);
105+
};
106+
107+
} // namespace hmpid
108+
} // namespace o2
109+
110+
#endif /* DETECTORS_HMPID_BASE_INCLUDE_HMPIDBASE_DIGIT_H_ */
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Copyright CERN and copyright holders of ALICE O2. This software is
2+
// distributed under the terms of the GNU General Public License v3 (GPL
3+
// Version 3), copied verbatim in the file "COPYING".
4+
//
5+
// See http://alice-o2.web.cern.ch/license for full licensing information.
6+
//
7+
// In applying this license CERN does not waive the privileges and immunities
8+
// granted to it by virtue of its status as an Intergovernmental Organization
9+
// or submit itself to any jurisdiction.
10+
11+
#ifndef DETECTORS_HMPID_BASE_INCLUDE_HMPIDBASE_HIT_H_
12+
#define DETECTORS_HMPID_BASE_INCLUDE_HMPIDBASE_HIT_H_
13+
14+
#include "SimulationDataFormat/BaseHits.h"
15+
16+
namespace o2
17+
{
18+
namespace hmpid
19+
{
20+
21+
// define HMPID hit type
22+
using HitType = o2::BasicXYZEHit<float>;
23+
24+
} // namespace hmpid
25+
} // namespace o2
26+
27+
#endif /* DETECTORS_HMPID_BASE_INCLUDE_HMPIDBASE_HIT_H_ */

Detectors/HMPID/base/include/HMPIDBase/Param.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ class Param
9393
//ThMax (degree) of the camber ch
9494
float ChThMax(Int_t ch) { return Lors2Mars(ch, LorsX(ch, kMaxPcx) - mX, LorsY(ch, kMaxPcy) - mY).Theta() * r2d(); }
9595

96-
inline static void Lors2Pad(float x, float y, Int_t& pc, Int_t& px, Int_t& py); //(x,y)->(pc,px,py)
96+
static void Lors2Pad(float x, float y, Int_t& pc, Int_t& px, Int_t& py); //(x,y)->(pc,px,py)
9797

9898
//(ch,pc,padx,pady)-> abs pad
9999
static Int_t Abs(Int_t ch, Int_t pc, Int_t x, Int_t y) { return ch * 100000000 + pc * 1000000 + x * 1000 + y; }

Detectors/HMPID/base/src/Digit.cxx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright CERN and copyright holders of ALICE O2. This software is
2+
// distributed under the terms of the GNU General Public License v3 (GPL
3+
// Version 3), copied verbatim in the file "COPYING".
4+
//
5+
// See http://alice-o2.web.cern.ch/license for full licensing information.
6+
//
7+
// In applying this license CERN does not waive the privileges and immunities
8+
// granted to it by virtue of its status as an Intergovernmental Organization
9+
// or submit itself to any jurisdiction.
10+
11+
#include "HMPIDBase/Digit.h"
12+
#include <iostream>
13+
14+
using namespace o2::hmpid;
15+
16+
ClassImp(o2::hmpid::Digit);

Detectors/HMPID/base/src/HMPIDBaseLinkDef.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
#pragma link off all classes;
1515
#pragma link off all functions;
1616

17-
#pragma link C++ class o2::hmpid::Param;
17+
#pragma link C++ class o2::hmpid::Param + ;
18+
#pragma link C++ class o2::hmpid::Digit + ;
19+
#pragma link C++ class vector < o2::hmpid::Digit> + ;
1820

1921
#endif

Detectors/HMPID/simulation/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ O2_SETUP(NAME ${MODULE_NAME})
44

55
set(SRCS
66
src/Detector.cxx
7+
src/HMPIDDigitizer.cxx
78
)
89
set(HEADERS
910
include/${MODULE_NAME}/Detector.h
11+
include/${MODULE_NAME}/HMPIDDigitizer.h
1012
)
1113

1214
Set(LINKDEF src/HMPIDSimulationLinkDef.h)

Detectors/HMPID/simulation/include/HMPIDSimulation/Detector.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
#include <vector>
1515
#include "DetectorsBase/Detector.h"
16-
#include "SimulationDataFormat/BaseHits.h"
16+
#include "HMPIDBase/Hit.h"
1717

1818
class TGeoVolume;
1919
class TGeoHMatrix;
@@ -22,10 +22,6 @@ namespace o2
2222
{
2323
namespace hmpid
2424
{
25-
26-
// define HMPID hit type
27-
using HitType = o2::BasicXYZEHit<float>;
28-
2925
class Detector : public o2::Base::DetImpl<Detector>
3026
{
3127
public:
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
// Copyright CERN and copyright holders of ALICE O2. This software is
2+
// distributed under the terms of the GNU General Public License v3 (GPL
3+
// Version 3), copied verbatim in the file "COPYING".
4+
//
5+
// See http://alice-o2.web.cern.ch/license for full licensing information.
6+
//
7+
// In applying this license CERN does not waive the privileges and immunities
8+
// granted to it by virtue of its status as an Intergovernmental Organization
9+
// or submit itself to any jurisdiction.
10+
11+
#ifndef DETECTORS_HMPID_SIMULATION_INCLUDE_HMPIDSIMULATION_HMPIDDIGITIZER_H_
12+
#define DETECTORS_HMPID_SIMULATION_INCLUDE_HMPIDSIMULATION_HMPIDDIGITIZER_H_
13+
14+
#include "HMPIDBase/Digit.h"
15+
#include "HMPIDSimulation/Detector.h" // for the hit
16+
#include <vector>
17+
18+
namespace o2
19+
{
20+
namespace hmpid
21+
{
22+
23+
class HMPIDDigitizer
24+
{
25+
public:
26+
void setEventTime(double timeNS) { mTime = timeNS; }
27+
void setEventID(int eventID) { mEventID = eventID; }
28+
void setSrcID(int sID) { mSrcID = sID; }
29+
30+
// this will process hits and fill the digit vector with digits which are finalized
31+
void process(std::vector<o2::hmpid::HitType> const&, std::vector<o2::hmpid::Digit>& digit);
32+
33+
private:
34+
double mTime = 0.;
35+
int mEventID = 0;
36+
int mSrcID = 0;
37+
38+
// internal buffers for digits
39+
std::vector<o2::hmpid::Digit> mSummable;
40+
std::vector<o2::hmpid::Digit> mFinal;
41+
42+
// other stuff needed for digitizaton
43+
44+
ClassDefNV(HMPIDDigitizer, 1);
45+
};
46+
} // namespace hmpid
47+
} // namespace o2
48+
49+
#endif /* DETECTORS_HMPID_SIMULATION_INCLUDE_HMPIDSIMULATION_HMPIDDIGITIZER_H_ */
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Copyright CERN and copyright holders of ALICE O2. This software is
2+
// distributed under the terms of the GNU General Public License v3 (GPL
3+
// Version 3), copied verbatim in the file "COPYING".
4+
//
5+
// See http://alice-o2.web.cern.ch/license for full licensing information.
6+
//
7+
// In applying this license CERN does not waive the privileges and immunities
8+
// granted to it by virtue of its status as an Intergovernmental Organization
9+
// or submit itself to any jurisdiction.
10+
11+
#include "HMPIDSimulation/HMPIDDigitizer.h"
12+
#include "HMPIDBase/Digit.h"
13+
14+
using namespace o2::hmpid;
15+
16+
ClassImp(HMPIDDigitizer);
17+
18+
// this will process hits and fill the digit vector with digits which are finalized
19+
void HMPIDDigitizer::process(std::vector<o2::hmpid::HitType> const& hits, std::vector<o2::hmpid::Digit>& digits)
20+
{
21+
// this is a very simple variant that creates one digit from one hit
22+
// conversion is done in the digit constructor
23+
// TODO: introduce cross-talk, pile-up, etc.
24+
for (auto& hit : hits) {
25+
digits.emplace_back(hit);
26+
}
27+
}

0 commit comments

Comments
 (0)