forked from AliceO2Group/AliceO2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDigiParams.cxx
More file actions
84 lines (75 loc) · 2.92 KB
/
DigiParams.cxx
File metadata and controls
84 lines (75 loc) · 2.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
// 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 DigiParams.cxx
/// \brief Implementation of the TRK digitization steering params. Based on the ITS2 code.
#include <cassert>
#include "Framework/Logger.h"
#include "TRKSimulation/DigiParams.h"
#include "TRKSimulation/ChipSimResponse.h"
using namespace o2::trk;
DigiParams::DigiParams()
{
// make sure the defaults are consistent
setNSimSteps(mNSimSteps);
}
void DigiParams::setROFrameLength(float lNS)
{
// set ROFrame length in nanosecongs
mROFrameLength = lNS;
assert(mROFrameLength > 1.);
mROFrameLengthInv = 1. / mROFrameLength;
}
void DigiParams::setNSimSteps(int v)
{
// set number of sampling steps in silicon
mNSimSteps = v > 0 ? v : 1;
mNSimStepsInv = 1.f / mNSimSteps;
}
void DigiParams::setChargeThreshold(int v, float frac2Account)
{
// set charge threshold for digits creation and its fraction to account
// contribution from single hit
mChargeThreshold = v;
mMinChargeToAccount = v * frac2Account;
if (mMinChargeToAccount < 0 || mMinChargeToAccount > mChargeThreshold) {
mMinChargeToAccount = mChargeThreshold;
}
LOG(info) << "Set charge threshold to " << mChargeThreshold
<< ", single hit will be accounted from " << mMinChargeToAccount
<< " electrons";
}
//______________________________________________
void DigiParams::print() const
{
// print settings
printf("TRK digitization params:\n");
printf("Continuous readout : %s\n", mIsContinuous ? "ON" : "OFF");
printf("Readout Frame Length(ns) : %f\n", mROFrameLength);
printf("Strobe delay (ns) : %f\n", mStrobeDelay);
printf("Strobe length (ns) : %f\n", mStrobeLength);
printf("Threshold (N electrons) : %d\n", mChargeThreshold);
printf("Min N electrons to account : %d\n", mMinChargeToAccount);
printf("Number of charge sharing steps : %d\n", mNSimSteps);
printf("ELoss to N electrons factor : %e\n", mEnergyToNElectrons);
printf("Noise level per pixel : %e\n", mNoisePerPixel);
printf("Charge time-response:\n");
mSignalShape.print();
}
void DigiParams::setAlpSimResponse(const o2::itsmft::AlpideSimResponse* resp)
{
LOG(debug) << "Response function data path: " << resp->getDataPath();
LOG(debug) << "Response function info: ";
// resp->print();
if (!resp) {
LOGP(fatal, "cannot set response function from null");
}
mAlpSimResponse = std::make_unique<o2::trk::ChipSimResponse>(resp);
}