Project
Loading...
Searching...
No Matches
HMPIDDigitizer.h
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
12#ifndef DETECTORS_HMPID_SIMULATION_INCLUDE_HMPIDSIMULATION_HMPIDDIGITIZER_H_
13#define DETECTORS_HMPID_SIMULATION_INCLUDE_HMPIDSIMULATION_HMPIDDIGITIZER_H_
14
17#include "HMPIDSimulation/Detector.h" // for the hit
20#include <vector>
21
22namespace o2
23{
24namespace hmpid
25{
26
28{
29 public:
30 // set event time and return true if it is within the active hold/data-taking time
31 // or false otherwise (in which case we don't need to do digitization)
32 bool setEventTime(double timeNS)
33 {
34 if ((timeNS - mCurrentTriggerTime) > TRACKHOLDTIME) {
35 return false;
36 } else {
37 return true;
38 }
39 }
40
41 // set a trigger; returns true if accepted or false if busy
42 // (assuming some extern decision on this time)
43 bool setTriggerTime(double timeNS)
44 {
45 if (mReadoutCounter == -1) {
46 // for the first trigger no busy check necessary
47 mCurrentTriggerTime = timeNS;
48 mReadoutCounter++;
49 mBc = o2::InteractionRecord::ns2bc(mCurrentTriggerTime, mOrbit);
50 return true;
51 } else {
52 if ((timeNS - mCurrentTriggerTime) > BUSYTIME) {
53 mCurrentTriggerTime = timeNS;
54 mBc = o2::InteractionRecord::ns2bc(mCurrentTriggerTime, mOrbit);
55 mReadoutCounter++;
56 return true;
57 } else {
58 return false;
59 }
60 }
61 }
62 // void setOrbit(double timeNS) {mOrbit = }
63 uint32_t getOrbit() { return mOrbit; };
64 uint16_t getBc() { return mBc; };
65
66 void setEventID(int eventID) { mEventID = eventID; }
67 void setSrcID(int sID) { mSrcID = sID; }
68
69 // user can pass a label container to be filled ... this activates the label mechanism
70 // the passed label container can be readout after call to process
75
76 // this will process hits and fill the digit vector with digits which are finalized
77 void process(std::vector<o2::hmpid::HitType> const&, std::vector<o2::hmpid::Digit>& digit);
78
79 // flush accumulated digits into the given container
80 void flush(std::vector<o2::hmpid::Digit>& digit);
81 // reset internal data structures
82 void reset();
83
84 private:
85 void zeroSuppress(std::vector<o2::hmpid::Digit> const& digits, std::vector<o2::hmpid::Digit>& newdigits,
88
89 float getThreshold(o2::hmpid::Digit const&) const; // gives back threshold to apply for a certain digit
90 // (using noise and other tables for pad)
91
92 double mCurrentTriggerTime = 0.;
93 uint32_t mOrbit = 0;
94 uint16_t mBc = 0;
95
96 int mEventID = 0;
97 int mSrcID = 0;
98
99 std::vector<o2::hmpid::Digit> mDigits; // internal store for digits
100
101 constexpr static double TRACKHOLDTIME = 1200; // defines the window for pile-up after a trigger received in nanoseconds
102 constexpr static double BUSYTIME = 40000; // the time for which no new trigger can be received in nanoseconds
103
104 std::map<int, int> mIndexForPad;
105
106 std::vector<int> mInvolvedPads;
107
108 int mReadoutCounter = -1;
109
110 // other stuff needed for digitization
111 o2::dataformats::MCTruthContainer<o2::MCCompLabel> mTmpLabelContainer; // temp label container as workspace
112 o2::dataformats::MCTruthContainer<o2::MCCompLabel>* mRegisteredLabelContainer = nullptr; // label container to be filled
113
114 ClassDefNV(HMPIDDigitizer, 1);
115};
116} // namespace hmpid
117} // namespace o2
118
119#endif /* DETECTORS_HMPID_SIMULATION_INCLUDE_HMPIDSIMULATION_HMPIDDIGITIZER_H_ */
unsigned short int uint16_t
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to process
std::vector< o2::MCCompLabel > labels
Definition of a container to keep Monte Carlo truth external to simulation objects.
A container to hold and manage MC truth information/labels.
HMPID Digit declaration.
Definition Digit.h:36
void setEventID(int eventID)
bool setTriggerTime(double timeNS)
void flush(std::vector< o2::hmpid::Digit > &digit)
void setLabelContainer(o2::dataformats::MCTruthContainer< o2::MCCompLabel > *labels)
bool setEventTime(double timeNS)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
static int ns2bc(double ns, unsigned int &orb)
std::vector< Digit > digits