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.);
142 std::vector<std::tuple<int, int, int>>
calcTimeframeIndices(
long startOrbit,
long orbitsPerTF,
double orbitsEarly = 0.,
long nTimeframes = -1)
const;
164 void setCTPDigits(std::vector<o2::ctp::CTPDigit>
const* ctpdigits)
const
166 mCTPTrigger = ctpdigits;
175 std::vector<o2::ctp::CTPDigit>
const*
getCTPDigits()
const {
return mCTPTrigger; }
180 int mMaxPartNumber = 0;
181 uint32_t mFirstOrbitForSampling = 0;
185 std::vector<o2::InteractionTimeRecord> mEventRecords;
187 std::vector<std::vector<o2::steer::EventPart>> mEventParts;
190 std::vector<math_utils::Point3D<float>> mInteractionVertices;
193 std::vector<o2::InteractionTimeRecord> mEventRecordsWithQED;
194 std::vector<std::vector<o2::steer::EventPart>> mEventPartsWithQED;
198 std::vector<std::string> mSimPrefixes;
199 std::string mQEDSimPrefix;
202 mutable std::vector<o2::ctp::CTPDigit>
const* mCTPTrigger =
nullptr;
203 mutable bool mHasTrigger =
false;
209 float mDigitizerInteractionRate{-1};
220 std::vector<T>* hits)
const
222 if (
chains.size() <= sourceID) {
225 auto br =
chains[sourceID]->GetBranch(brname);
227 LOG(
error) <<
"No branch found with name " << brname;
230 br->SetAddress(&hits);
231 auto maxEntries = br->GetEntries();
233 entryID %= maxEntries;
235 br->GetEntry(entryID);
definition of CTPDigit, CTPInputDigit
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 s
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 Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char e
Header of the General Run Parameters object.
char error[CURL_ERROR_SIZE]
std::vector< TChain * > chains
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
int setInteractionVertices(std::vector< math_utils::Point3D< float > > const &vertices)
void setSimPrefixes(std::vector< std::string > const &p)
std::vector< std::tuple< int, int, int > > calcTimeframeIndices(long startOrbit, long orbitsPerTF, double orbitsEarly=0., long nTimeframes=-1) const
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)
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
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"