12#ifndef ALICEO2_SIMULATIONDATAFORMAT_RUNCONTEXT_H
13#define ALICEO2_SIMULATIONDATAFORMAT_RUNCONTEXT_H
23#include <unordered_map>
35constexpr static int QEDSOURCEID = 99;
68 std::vector<o2::InteractionTimeRecord>&
getEventRecords(
bool withQED =
false) {
return withQED ? mEventRecordsWithQED : mEventRecords; }
69 std::vector<std::vector<o2::steer::EventPart>>&
getEventParts(
bool withQED =
false) {
return withQED ? mEventPartsWithQED : mEventParts; }
71 const std::vector<o2::InteractionTimeRecord>&
getEventRecords(
bool withQED =
false)
const {
return withQED ? mEventRecordsWithQED : mEventRecords; }
72 const std::vector<std::vector<o2::steer::EventPart>>&
getEventParts(
bool withQED =
false)
const {
return withQED ? mEventPartsWithQED : mEventParts; }
92 std::vector<std::string>
const&
getSimPrefixes()
const {
return mSimPrefixes; }
97 void fillQED(std::string_view QEDprefix,
int max_events,
double qedrate);
101 void fillQED(std::string_view QEDprefix, std::vector<o2::InteractionTimeRecord>
const& irecord,
int max_events = -1,
bool fromKinematics =
true);
123 template <
typename T>
128 std::vector<T>* hits)
const;
135 void applyMaxCollisionFilter(std::vector<std::tuple<int, int, int>>& timeframeindices,
long startOrbit,
long orbitsPerTF,
int maxColl,
double orbitsEarly = 0.);
138 std::vector<std::tuple<int, int, int>>
calcTimeframeIndices(
long startOrbit,
long orbitsPerTF,
double orbitsEarly = 0.)
const;
154 void setCTPDigits(std::vector<o2::ctp::CTPDigit>
const* ctpdigits)
const
156 mCTPTrigger = ctpdigits;
165 std::vector<o2::ctp::CTPDigit>
const*
getCTPDigits()
const {
return mCTPTrigger; }
170 int mMaxPartNumber = 0;
171 uint32_t mFirstOrbitForSampling = 0;
175 std::vector<o2::InteractionTimeRecord> mEventRecords;
177 std::vector<std::vector<o2::steer::EventPart>> mEventParts;
180 std::vector<math_utils::Point3D<float>> mInteractionVertices;
183 std::vector<o2::InteractionTimeRecord> mEventRecordsWithQED;
184 std::vector<std::vector<o2::steer::EventPart>> mEventPartsWithQED;
188 std::vector<std::string> mSimPrefixes;
189 std::string mQEDSimPrefix;
192 mutable std::vector<o2::ctp::CTPDigit>
const* mCTPTrigger =
nullptr;
193 mutable bool mHasTrigger =
false;
199 float mDigitizerInteractionRate{-1};
210 std::vector<T>* hits)
const
212 if (chains.size() <= sourceID) {
215 auto br = chains[sourceID]->GetBranch(brname);
217 LOG(error) <<
"No branch found with name " << brname;
220 br->SetAddress(&hits);
221 br->GetEntry(entryID);
definition of CTPDigit, CTPInputDigit
Header of the General Run Parameters object.
int getNBunches(int dir=-1) const
Static class with identifiers, bitmasks and names for ALICE detectors.
DigitizationContext extractSingleTimeframe(int timeframeid, std::vector< std::tuple< int, int, int > > const &timeframeindices, std::vector< int > const &sources_to_offset)
bool checkVertexCompatibility(bool verbose=false) const
Check collision parts for vertex consistency.
void fillQED(std::string_view QEDprefix, int max_events, double qedrate)
add QED contributions to context, giving prefix; maximal event number and qed interaction rate
float getDigitizerInteractionRate() const
bool initSimChains(o2::detectors::DetID detid, std::vector< TChain * > &simchains) const
std::unordered_map< int, int > getCollisionIndicesForSource(int source) const
void printCollisionSummary(bool withQED=false, int truncateOutputTo=-1) const
std::vector< math_utils::Point3D< float > > const & getInteractionVertices() const
const std::vector< o2::InteractionTimeRecord > & getEventRecords(bool withQED=false) const
int findSimPrefix(std::string const &prefix) const
float getCalculatedInteractionRate() const
returns the main (hadronic interaction rate) associated to this digitization context
void applyMaxCollisionFilter(std::vector< std::tuple< int, int, int > > &timeframeindices, long startOrbit, long orbitsPerTF, int maxColl, double orbitsEarly=0.)
int getMaxNumberParts() const
void setCTPDigits(std::vector< o2::ctp::CTPDigit > const *ctpdigits) const
const std::vector< std::vector< o2::steer::EventPart > > & getEventParts(bool withQED=false) const
void setSimPrefixes(std::vector< std::string > const &p)
std::vector< o2::InteractionTimeRecord > & getEventRecords(bool withQED=false)
void setNCollisions(int n)
bool hasTriggerInput() const
int getNCollisions() const
bool initSimKinematicsChains(std::vector< TChain * > &simkinematicschains) const
o2::parameters::GRPObject const & getGRP() const
returns the GRP object associated to this context
bool isQEDProvided() const
void sampleInteractionVertices(o2::dataformats::MeanVertexObject const &v)
std::vector< std::vector< o2::steer::EventPart > > & getEventParts(bool withQED=false)
void setMaxNumberParts(int maxp)
std::vector< o2::ctp::CTPDigit > const * getCTPDigits() const
void setFirstOrbitForSampling(uint32_t o)
std::vector< std::string > const & getSimPrefixes() const
const o2::BunchFilling & getBunchFilling() const
uint32_t getFirstOrbitForSampling() const
void saveToFile(std::string_view filename) const
void setBunchFilling(o2::BunchFilling const &bf)
std::vector< std::tuple< int, int, int > > calcTimeframeIndices(long startOrbit, long orbitsPerTF, double orbitsEarly=0.) const
get timeframe structure --> index markers where timeframe starts/ends/is_influenced_by
void retrieveHits(std::vector< TChain * > const &chains, const char *brname, int sourceID, int entryID, std::vector< T > *hits) const
function reading the hits from a chain (previously initialized with initSimChains
void setDigitizerInteractionRate(float intRate)
static DigitizationContext * loadFromFile(std::string_view filename="")
GLsizei GLsizei GLchar * source
constexpr double LHCRevFreq
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
static bool isBackGround(EventPart e)
static bool isSignal(EventPart e)
static bool isQED(EventPart e)
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"