Skip to content

Commit

Permalink
final tof params object (#25)
Browse files Browse the repository at this point in the history
* [FOCAL] Add stand-alone decoder of pad data (AliceO2Group#10211)

* Tpc idc aggregator (AliceO2Group#10233)

* increase factorize lanes to 10

* Increase number of Buffer to 100

* DPL Analysis: add possibility to set maximum size of output files (AliceO2Group#10232)

* DPL: improve services to support multiple DP running on the same device

* DPL: complain when using the wrong context

* DPL: fix globalStream and streamSalt()

* DPL: Move to use serviceregistryref rather than context

* DPL: Make TimingInfo and DataAllocator stream services

* DPL: do not allow copies of DataProcessorContext

* DPL: Use stream ServiceRegistryRef in DataProcessingDevice::doRun

* MCTruthContainer: possibility to register index without a label

This should be useful when a object (digit) has no associated label.

https://alice.its.cern.ch/jira/browse/O2-3352

* GPU: Add experimental V5 TPC ZS with entropy-reduced DLBZS

* Process both dead and noise channels for MID

* Allow to set different thresholds for MID dead and noisy channels

* Fix MFT-MCH-MID labeling for Event Display

* TPC: Remove all A/C-splitted versions, and non-FLP versions of the TPC IDC workflows

* TPC Clusterizer: Fix comparison between packed and unpacked charge in noisy pad filter.

* EMCAL: drop need for own InfoLogger

* EMCAL & QC: do not require InfoLoggerContext

* Do not cache DataProcessingContext & TimingInfo

Spotted by some syntetic run. The copy was taking 10% of the CPU
utilization.

* DPL: use consumeWhenAny inside defineByName

* DPL: do not load infologger by default unless running under control

* TimeSlot calib allow multiple inputs for process()

And per default make the container type the same as the input type.
Useful in case the object send to the aggregator is in itself already
a container as for example a histogram.

* TRD calib simplify aggregators for which input and container types are identical

* Add CTP lumi information to TPC SCD calib

* added features for more flexibility + new run types

* Save run type for Event Display, show file modification date in Event Display

* change fatal to warning, add possibility to dump bad data

* Revert "GPU: Workaround for reoccuring HIP problem parsing host-code during device compilation"

This reverts commit 73c10d5.

* Fix compilation issue with LOG(): workaround

* DPL: Forward FMQ io-threads option

* Digitizerworkflow: Make sure CCDB 'condition-not-after' is always available

small (temp) step for
https://alice.its.cern.ch/jira/browse/O2-3317

* Calib workflow: TPC IDC aggregator proxy can now use 2 io-threads, to help with the performance problem receiving many messages

* Update COOKBOOK.md

* Residual aggregator output dir specified automatically (AliceO2Group#10245)

* add helper to get nominal field (AliceO2Group#10256)

* Add aod-writer options resdir and maxfilesize as command line options

* IDCs: Add option to write IDCDelta to calibration file (AliceO2Group#10260)

* IDCs: Add option to write IDCDelta to calibration file

* IDCs: fix creation of calib file

* IDCs: Fix start range of for loop for C-Side

* Rename nThreads option for TPC encoder (AliceO2Group#10263)

* Fast TOF local coordinate extraction

* Do not read TPC tracks and/or clusters unless explicitly asked

* Optionally accept ITS-TPC AB tracks

* Temporary use simplified version of propagateToAlphaX

* Add extra track types to RecoContainer::getTrackParamOut

* Extend storing of XRho in TrackLTIntegral to all propagation methods

* multiple fixes for alignment

* only 1st millepeded pipeline writes control files

* Protect macro compilation by a semaphore

* IDCs: Disable offset for validity range when storing IDCs in the CCDB (AliceO2Group#10249)

- GainMap using tracks: Store also the RMS map in the CCDB

* Don't truncate float calorimeter energies to int in EventDisplay

* ZDC - Better error reporting during data taking (AliceO2Group#10262)

* Correct cabling for modules 6 and 7 (ZPC towers)

* Improving warning and error messages

* Improved formatting

* Improved formatting

* TRD: TRDTrackWriterSpec: Fix input labels for tree branches (AliceO2Group#10266)

Trivial fix.

Signed-off-by: Felix Schlepper <[email protected]>

Signed-off-by: Felix Schlepper <[email protected]>

* Adjust Fairlogger-->InfoLogger Severity-->Level mapping

* Fix: TRD CTF decoder --correct-trd-trigger-offset had no effect

* optinally apply alignment in the BarrelAlignmentSpec

* Make tolerance for creation-time fallback in CCDB query timestamp configurable

If the timestamp extracted from the TF orbit (as it may happen for calibration runs)
differs from the TF creation time by more than --condition-time-tolerance (in ms)
then the creation time is used for CCDB query.
Negative tolerance will impose using TF creation time.

* TRD add pretrigger phase to digits (AliceO2Group#10243)

* Move MC stack to DetectorsBase

This is a restructuring commit to
reduce library coupling and to avoid cycling dependencies
for future developments:

a) The VMC stack implementation belongs more logically
   to Detectors/Base as an implementation of a Virtual Monte
   Carlo functionality and less as a fundamental O2 simulation data layout

b) remove some uneccessary includes

* Calib workflow: Remove deprecated mode where SACs were router via EPNs

* Calib workflow: indicate whether output proxies are for sporadic or for timeframe data in get_proxy_connection

* DPL: Add option to not drop old timeSlices based on oldestPossible via env variable

* MCH: remove deIdsForAllMCH from elecmap lib (moved to MCHConstants lib)

* DPL: exception on fatal

Not sure what happened to it...

* Fixes in ITS T2L matrix + debug output

* Collision context generalizations and use in transport sim

Collision context improvements:
a) able to generate more than one timeframe at a time
b) timeframe indicexing within collision context

We can now also pass the collision context to the transport
simulation. This brings the following advantages:
a) simulate the right number of events
b) ability to pregenerate all events for all timeframes (less overheads)
c) improved vertex matching for embedding (in future)
d) support for more generic event sequences (beyond simple
   signal-background embedding with background reuse)

* TRD update digit comments

* TRD tracking add default error for B=0

* TRD raw reader skips links with corrupt digit HC headers

* TRD tracker reset cov for inwards refit

* TRD: Add getPadCol() to tracklets

* Bugfix for TRD TrackTriggerRecord

* TRD tracking: open search road

* Protections added in DCS DPs processing (AliceO2Group#10215)

* Protections added in DCS DPs processing

* Fixing white space

* minors

* DPL: fix warning

* DPL: add helper to wrap algorithms

* TRD: Tracker: Add padrow crossing information (AliceO2Group#10229)

* TRD: Tracker: Add padrow crossing information

This patch adds to the GPUTRDTrack one new members:
     1. mIsPadrowCrossing:
        unsigned char -> bits 0 to 5 indicate if in a layer the track
        crossed a padrow.
        Rational: Charge information is lost in these tracklets and
        one should possibly even discard those Tracks for gain
        calibration and PID.

Additionally, this was added to TrackQC.

Signed-off-by: Felix Schlepper <[email protected]>

* TRD: Tracker: Indicate that there was neighboring tracklet

This helps later to identify whether z-row merging should be done to
recover the full charge information.

Signed-off-by: Felix Schlepper <[email protected]>

* TRD: Tracker: Indicate if a padrow crossing was found

This removes a previous bug, where when a padrow crossing was found the
check for neighboring tracklets was skipped. Additionally, the 7th bit
is used to indicate whether or not a padrow in a track was found.

Signed-off-by: Felix Schlepper <[email protected]>

Signed-off-by: Felix Schlepper <[email protected]>

* Fix mask of MFTMCHMID

GlobalTrackID::MFTMCHMID was inserted between TPCTRDTOF and ITSTPCTRDTOF while
the related masks were defined in the TPCTRDTOF, ITSTPCTRDTOF, MFTMCHMID order.
Fortunately, the masks are not stored in the persistent data so we can simply
swap them (and MFTMCHMID is not used though we should keep it at its current
position for backward compatibility)

* Add test workflow for analysis

* small fix for collision context tool

didn't work for arbitrary timeframe id (offsets)

* Fix TPC_WORKFLOW_FILTER_DIGITS_OUTSIDE_OF_TF

* Use LOG(alarm) instead of std::cerr

* Calib workflow: fix error messages

* If MFTMCH and MCHMID are enabled, enable MFTMCHMID as well in EventDisplay

* TRD: calibration: vDrift and ExB (AliceO2Group#10053)

* TRD: CalibratorVdExB: Reuse previous fit result

This allows without interacting with the ccdb reusing the previous
fit result.
In the next patch I will a mechanism to skip updates for chambers
which have too few entries in a slot.

Signed-off-by: Felix Schlepper <[email protected]>

* TRD: CalibratorVdExB: Require minimum amount of entries in profile refit

This patch allows to specify an addition value via
`--min-entries-chamber` which set an requirement on the minimum amount
of entries required for refitting an updating the previous values.

Due to name clash, I renamed `--min-entries` to `--min-entries-total`
clarifying the distinction.

The next patch will finally allow pulling the initial fit values from the
ccdb e.g. the previous time the calibrator ran.

Signed-off-by: Felix Schlepper <[email protected]>

* TRD: CalibratorVdExB: Query if fit values from previous Run can be used.

If there was a run within the last ~hour, we can reuse the ccdb object
since object is still valid for the current time period.
Else we start from scratch.

Signed-off-by: Felix Schlepper <[email protected]>

* TRD: CalibratorVdExB: Made anodeplane a constant

Signed-off-by: Felix Schlepper <[email protected]>

* TRD: CalibratorVdExB: Clang-format on all touched files

This is just a minor patch on all files the previous patches touched.
Mostly comment alignment which IMHO are nicer.
Also some minor touch-ups on comments to allow doxygen to pickup as
proper documentation.

Signed-off-by: Felix Schlepper <[email protected]>
Signed-off-by: Felix Schlepper <[email protected]>

* TRD: CalibratorVdExB: Reuse Fitter

This avoids instantiating a similar object all the time.
Now it is done once during the init and then just reused.
Hopefully, this provides a small performance boost.

Signed-off-by: Felix Schlepper <[email protected]>

* TRD: CalibratorVdExB: Avoid divide by zero

In the TrackletTransformer we query multiple times for the vDrift value
to divide by it.
The fit can now not be zero, minimum 0.01.

I promoted the default value to a constant.

Signed-off-by: Felix Schlepper <[email protected]>

* TRD: CalibratorVdExB: Take Distance of Anode from Geometry

As suggested by @martenole this value can be taken from Geometry of the detector.

Signed-off-by: Felix Schlepper <[email protected]>

* TRD: CalibratorVdExB: Better message and check for retrieving object

Signed-off-by: Felix Schlepper <[email protected]>

* TRD: CalibratorVdExB: Use default constants

Signed-off-by: Felix Schlepper <[email protected]>

* TRD: CalibratorVdExB: Added configurable parameters for VDrift&ExB

This patch allows configurable parameters to be added for QC.
Included are two configurables for vdriftExB calibration.

Signed-off-by: Felix Schlepper <[email protected]>
Signed-off-by: Felix Schlepper <[email protected]>

* TRD: CalibratorVdExB: Moved arguments to config helper

This proposed patch moves the cli arguments to the confighelper and
updates the README.

Signed-off-by: Felix Schlepper <[email protected]>

Signed-off-by: Felix Schlepper <[email protected]>
Signed-off-by: Felix Schlepper <[email protected]>

* optionally throttle CCDB logs to infologger

Option --throttling-delay <N=300000> makes sure that at most 1 important (propagated to infologger)
message is logged for the uploads to given CCDB path in last N ms.

* Demote ccdb query announce and /Returning cached entry/ logging to debug

* IDC deltas always on

* update SCALETRACKS_TPC_TIMEGAIN

* [FOCAL-9] Write decoded ASIC header to tree

Instead of writing header word write header information
(header, BC, counters, trailer) separately.

* CollisionContext: Option to ensure that a timeframe has at least one collision

* TRD: QC: Add global track id to TrackQC (AliceO2Group#10300)

This patch allows for offline extraction of additional TOF PID.
And will allow a cleaner cuts for the TRD PID model building.

Signed-off-by: Felix Schlepper <[email protected]>

Signed-off-by: Felix Schlepper <[email protected]>

* DPL: rate limiting

* Optionally truncate TPC digits that fall beyond orbit limit

Default does not change. But O2DPG MC workflows
can influence this via DigiParams.

https://alice.its.cern.ch/jira/browse/O2-3382

* Fix: SYNTHETIC and NOISE run types were swapped

* Fit the full candidate with KF (AliceO2Group#10271)

* Fit the full candidate with KF

* Fix chirality after up/down swap

* Avoid using curvature with B=0

* CM Pad-by-Pad option, load pad variations from CCDB, CM corrected digits

* GPU: Fix initialiation of GPU magnetic field if 0-field should be used but magnet current is not exactly 0

* DPL: fix warnings in ASoA.h

* TPC: Add debug option to dump CompressedClusters struct to stdout

* TPC Track Model Decoding: Better cuts to distinguish underflow / overflow

* Make some functions static, fix a typo

* TPC: CTF Skimming should use correct solenoidBz and nHbfPerTf

* TPC CTF Skimming: Fix possible overflow in BC range check

* DPL: avoid copying the TaskName too often

* DPL: fix warnings in histogram registry

* HistogramRegistry: avoid unneded copies and allocations

* HistogramRegistry: avoid dance back and forward with types

We know at build time that a TH1F is a TH1, no need to ask
ROOT at runtime about it.

* [FT0] Quick fix of errors in SYNTHETIC runs (set DataIsValid flag in sim)

* DPL: fix typo in documentation

* Fix printout in TPCVDriftTglCalibSpec

* Fix SVertexer: vector element ref. used after vector expansion

* Add countsFV0 to LumiInfo as backup for nominal FT0 lumi

* Dummy driver device with no input and dummy output

Sometimes we need a workflow to execute some number of loops with the timing info
injected according to some policy, e.g. to fetch certain ccdb objects via DPL fetcher.
In this case this device can be added as an upstream one in the workflow equiped with the
HBFUtilsInitializer stuff which allow to steer timing info via dynamically added
--hbfutils-config option

For the real example of usage see barrel-aligment-workflow.cxx: it allows to
use it as a simple executable w/o real input TF data but with the proper timing.

* Barrel alignment fixes

* FST: Give proper error message when rawAll.cfg missing

* FST: Option to enable / disable QED part

* GPU Workflow: fix configKeyValue to override solenoidBz

* Reduce some debug verbosity

* GPU: Display of magnetic field should create field from GRP if not already loaded

* GPU: Standalone visualization can run without data

* TPC CTF Skimming: Implement eta-cut on unassigned clusters

* TPC: Do not check triggered mode setting if TPC is not read out

* CPV: add dpl ccdb fitcher to digitizer

* [ITS, ITS3] Add first version of ITS3 descriptor in ITS geometry (AliceO2Group#10289)

* Apply naming conventions

* Add first version of DTS3 descriptr in ITS geometry

* Remove leftover comment

* Fix format

* Fix whitespace

* Attempt to fix circular dependencies

* Fix whitespaces

* Fix CI

* Fix format

* Fix CI

* Implement Matteo's comment

* Allow to set the MID HV from CCDB

* TRD: Simplify link stats (AliceO2Group#10315)

* Make sure detector CTF header default constructor is called

* TRD fix digit phase comments (AliceO2Group#10331)

* ctpdev: scalers reply (AliceO2Group#10317)

* dev: counters reply

* clang

* DPL: set TimingInfo field accordingly on new Run

* Remove stray GlobalFwdTrackReaderSpec file

* Make the track color configurable in EventDisplay

* TPC Track Model Compression: Store Bz field and max time bin with data

* first version of DCS config proxy

* Second version of TPC DCS Config proxy

* L1phase calib summary histo added; warning fixes

* [FWDMatcher] Protection for invalid BC diff

* ITS DCS parser: add always run number to metadata (AliceO2Group#10320)

* ITS DCS parser: add always run number to metadata

* clang

* [FOCAL-9] Port mapping for pads from QC

Mapping pad channel to position on pad layer

* fix in TOF matching (time) to account for integrated times

* Optionally apply BC shift to triggered detectors in CTF decoding

The TriggerOffsetsParam configurableParam got array of custom corrections per detector (0 by default)
which can be applied to triggered detectors IR as an ADDITIVE correction during CTF decoding.
Note that this convention is opposite to that for the LM_L0 convention which is subtracted from the
encoded IR (at the moment only for the TRD if an option --correct-trd-trigger-offset was provided to the
ctf-reader). Therefore, for the TRD, if this option is ON, the effect of the correction is
ir_corrected = ir_decoded - TriggerOffsetsParam::LM_L0 + TriggerOffsetsParam::customOffset[TRD];
while for other EMC,PHS,CPV and HMP (and TRD in absence of --correct-trd-trigger-offset) it is simply
ir_corrected = ir_decoded + TriggerOffsetsParam::customOffset[<det>];

In case the correction moves the IR before the TF 1st orbit, the trigger is discarded.

Extra: ZDC in pbpb2022 was reseting the orbit internally to 1 at the SOR: implemented the shift also for it.

* [EMCAL-841] Fix switched energy and time in cell calibration

- Calibrated time and calibrated energy were switched which results in
  wrong values energy and time in the AO2D file

* TRD: QC: Enable output for full configuration (AliceO2Group#10307)

This patch allows outputting the full vdrift exb calibration to a file.

Additionally, it adds a previously missed function call to update the
configKeyValues from cli args.

Signed-off-by: Felix Schlepper <[email protected]>

* FST: Fix problem with NUMA pinning in 4-gpu workflow

* FST: OPTIMIZED_PARALLEL_ASYNC should only be set externally

* Fix TPC Entropy encoder with dictionary from CCDB tree object

* o2-sim: fail hard upon errors during loading cuts from JSON

* Add track size enlargement for EventDisplay screenshots

* Special treatment for shifts of ZDC triggers at BC=0,3563

These special triggers can be shifted only orbit-wise but the BC must remain unchanged

* Fix TPC CTF IO test

Compare data-members explicitly to avoid padding problems in blockwise comparison

* Update RuntimeError.cxx

* Fix swapped pitch and yaw angles in the AlignParam

* When root-outputs are requested, write also TRD tracklets/digits

* Introduce optional ITS ROF delay in nBC in the AlpideParam

* Account for possible ITS ROF delay in ITS-TPC matching

* account for eventual ITS/MFT ROF bias in vertexing/matching

* Introduce optional global time bias for ITS-TPC refitted time

* Update MCTrack ClassDef

* Make HepMC and native status available for MC gen

* HepMC and Gen status codes handled/entangled via Union as one single
  integer

* some common functionality to en-/decode

* encoding fully implemented for Pythia8, O2Kine and HepMC generators

* be backwards-compatible wrt to HepMC status code

* O2Kine generator now sets the status code correctly

* use ParticleStatus::kToBeDone for TParticle in generators at
  Generator::importParticles to indicate whether to-be-done or not

* Add first template of param container

* Update param contaniner

* Add executable

* finalizing tof params object

Signed-off-by: Felix Schlepper <[email protected]>
Signed-off-by: Felix Schlepper <[email protected]>
Co-authored-by: Markus Fasel <[email protected]>
Co-authored-by: rmunzer <[email protected]>
Co-authored-by: Giulio Eulisse <[email protected]>
Co-authored-by: Sandro Wenzel <[email protected]>
Co-authored-by: David Rohr <[email protected]>
Co-authored-by: dstocco <[email protected]>
Co-authored-by: nowakowp <[email protected]>
Co-authored-by: Felix Weiglhofer <[email protected]>
Co-authored-by: Ole Schmidt <[email protected]>
Co-authored-by: iravasen <[email protected]>
Co-authored-by: wiechula <[email protected]>
Co-authored-by: Matteo Concas <[email protected]>
Co-authored-by: Jan Fiete <[email protected]>
Co-authored-by: Paul <[email protected]>
Co-authored-by: Matthias Kleiner <[email protected]>
Co-authored-by: shahoian <[email protected]>
Co-authored-by: cortesep <[email protected]>
Co-authored-by: Felix Schlepper <[email protected]>
Co-authored-by: Sean <[email protected]>
Co-authored-by: Laurent Aphecetche <[email protected]>
Co-authored-by: gvolpe79 <[email protected]>
Co-authored-by: Chiara Zampolli <[email protected]>
Co-authored-by: Maximiliano Puccio <[email protected]>
Co-authored-by: Maciej Slupecki <[email protected]>
Co-authored-by: sevdokim <[email protected]>
Co-authored-by: Fabrizio <[email protected]>
Co-authored-by: Roman Lietava <[email protected]>
Co-authored-by: Rafael Pezzi <[email protected]>
Co-authored-by: Dmitri Peresunko <[email protected]>
Co-authored-by: Joshua Koenig <[email protected]>
Co-authored-by: Benedikt Volkel <[email protected]>
Co-authored-by: Nicolò Jacazio <[email protected]>
Co-authored-by: Nicolò Jacazio <[email protected]>
  • Loading branch information
1 parent f8491a9 commit 399320f
Show file tree
Hide file tree
Showing 442 changed files with 8,428 additions and 13,407 deletions.
8 changes: 4 additions & 4 deletions Common/Field/src/MagneticWrapperChebyshev.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1206,15 +1206,15 @@ void MagneticWrapperChebyshev::buildTable(Int_t npar, TObjArray* parArr, Int_t&
nSegYDipArr.Set(nZSeg);
float xyz[3];
for (int iz = 0; iz < nZSeg; iz++) {
printf("\nZSegment#%d %+e : %+e\n", iz, tmpSegZ[iz], tmpSegZ[iz + 1]);
LOGF(debug, "\nZSegment#%d %+e : %+e\n", iz, tmpSegZ[iz], tmpSegZ[iz + 1]);
int ny = segmentDimension(&tmpSegY, parArr, npar, 1, 1, -1, 1, -1, tmpSegZ[iz], tmpSegZ[iz + 1]) - 1;
segYArr.Set(ny + nYSeg);
for (int iy = 0; iy < ny; iy++) {
segYArr[nYSeg + iy] = tmpSegY[iy];
}
begSegYDipArr[iz] = nYSeg;
nSegYDipArr[iz] = ny;
printf(" Found %d YSegments, to start from %d\n", ny, begSegYDipArr[iz]);
LOGF(debug, " Found %d YSegments, to start from %d\n", ny, begSegYDipArr[iz]);

// for each slice in Z and Y create segmentation in X
begSegXDipArr.Set(nYSeg + ny);
Expand All @@ -1223,7 +1223,7 @@ void MagneticWrapperChebyshev::buildTable(Int_t npar, TObjArray* parArr, Int_t&

for (int iy = 0; iy < ny; iy++) {
int isg = nYSeg + iy;
printf("\n YSegment#%d %+e : %+e\n", iy, tmpSegY[iy], tmpSegY[iy + 1]);
LOGF(debug, "\n YSegment#%d %+e : %+e\n", iy, tmpSegY[iy], tmpSegY[iy + 1]);
int nx =
segmentDimension(&tmpSegX, parArr, npar, 0, 1, -1, tmpSegY[iy], tmpSegY[iy + 1], tmpSegZ[iz], tmpSegZ[iz + 1]) -
1;
Expand All @@ -1234,7 +1234,7 @@ void MagneticWrapperChebyshev::buildTable(Int_t npar, TObjArray* parArr, Int_t&
}
begSegXDipArr[isg] = nXSeg;
nSegXDipArr[isg] = nx;
printf(" Found %d XSegments, to start from %d\n", nx, begSegXDipArr[isg]);
LOGF(debug, " Found %d XSegments, to start from %d\n", nx, begSegXDipArr[isg]);

segIDArr.Set(nXSeg + nx);

Expand Down
2 changes: 1 addition & 1 deletion Common/SimConfig/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ o2_add_library(SimConfig
src/DigiParams.cxx src/G4Params.cxx
src/MatMapParams.cxx
PUBLIC_LINK_LIBRARIES O2::CommonUtils
O2::DetectorsCommonDataFormats
O2::DetectorsCommonDataFormats O2::SimulationDataFormat
FairRoot::Base Boost::program_options)


Expand Down
3 changes: 2 additions & 1 deletion Common/SimConfig/include/SimConfig/DigiParams.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ struct DigiParams : public o2::conf::ConfigurableParamHelper<DigiParams> {
std::string digitizationgeometry_prefix = ""; // with which geometry prefix we digitized -> leave empty as this needs to be filled by the digitizer workflow
std::string grpfile = ""; // which GRP file to use --> leave empty as this needs to be filled by the digitizer workflow
bool mctruth = true; // whether to create labels

int maxOrbitsToDigitize = -1; // Digitizer can use this to truncate digits that fall beyond an orbit limit (relative to start of digization) given by this param; -1 means no limit imposed
// This parameter should typically be set to coincide with a single timeframe length or multiples thereof.
O2ParamDef(DigiParams, "DigiParams");
};

Expand Down
5 changes: 5 additions & 0 deletions Common/SimConfig/include/SimConfig/SimConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ struct SimConfigData {
bool mAsService = false; // if simulation should be run as service/deamon (does not exit after run)
bool mNoGeant = false; // if Geant transport should be turned off (when one is only interested in the generated events)
bool mIsRun5 = false; // true if the simulation is for Run 5
std::string mFromCollisionContext = ""; // string denoting a collision context file; If given, this file will be used to determine number of events

ClassDefNV(SimConfigData, 4);
};
Expand Down Expand Up @@ -150,6 +151,9 @@ class SimConfig
private:
SimConfigData mConfigData; //!

// adjust/overwrite some option settings when collision context is used
void adjustFromCollContext();

ClassDefNV(SimConfig, 1);
};

Expand Down Expand Up @@ -177,6 +181,7 @@ struct SimReconfigData {
unsigned int primaryChunkSize; // defining max granularity for input primaries of a sim job
ULong_t startSeed; // base for random number seeds
bool stop; // to shut down the service
std::string mFromCollisionContext = ""; // string denoting a collision context file; If given, this file will be used to determine number of events

ClassDefNV(SimReconfigData, 1);
};
Expand Down
55 changes: 54 additions & 1 deletion Common/SimConfig/src/SimConfig.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

#include <SimConfig/SimConfig.h>
#include <DetectorsCommonDataFormats/DetID.h>
#include <SimulationDataFormat/DigitizationContext.h>
#include <boost/program_options.hpp>
#include <iostream>
#include <fairlogger/Logger.h>
Expand Down Expand Up @@ -57,6 +58,7 @@ void SimConfig::initOptions(boost::program_options::options_description& options
"run", bpo::value<int>()->default_value(-1), "ALICE run number")(
"asservice", bpo::value<bool>()->default_value(false), "run in service/server mode")(
"noGeant", bpo::bool_switch(), "prohibits any Geant transport/physics (by using tight cuts)");
options.add_options()("fromCollContext", bpo::value<std::string>()->default_value(""), "Use a pregenerated collision context to infer number of events to simulate, how to embedd them, the vertex position etc. Takes precedence of other options such as \"--nEvents\".");
}

void SimConfig::determineActiveModules(std::vector<std::string> const& inputargs, std::vector<std::string> const& skippedModules, std::vector<std::string>& activeModules, bool mIsRun5)
Expand Down Expand Up @@ -215,6 +217,8 @@ bool SimConfig::resetFromParsedMap(boost::program_options::variables_map const&
if (vm.count("noemptyevents")) {
mConfigData.mFilterNoHitEvents = true;
}
mConfigData.mFromCollisionContext = vm["fromCollContext"].as<std::string>();
adjustFromCollContext();

// analyse field options
// either: "ccdb" or +-2[U],+-5[U] and 0[U]; +-<intKGaus>U
Expand Down Expand Up @@ -259,6 +263,55 @@ bool SimConfig::parseFieldString(std::string const& fieldstring, int& fieldvalue
return true;
}

void SimConfig::adjustFromCollContext()
{
// When we use pregenerated collision contexts, some options
// need to be auto-adjusted. Do so and inform about this in the logs.
if (mConfigData.mFromCollisionContext == "") {
return;
}

auto context = o2::steer::DigitizationContext::loadFromFile(mConfigData.mFromCollisionContext);
if (context) {
// find the events belonging to a source that corresponds to a sim prefix
LOG(info) << "Looking up simprefixes " << mConfigData.mOutputPrefix;
int sourceid = context->findSimPrefix(mConfigData.mOutputPrefix);
if (sourceid == -1) {
LOG(error) << "Could not find collisions with sim prefix " << mConfigData.mOutputPrefix << " in the collision context. The collision contet specifies the following prefixes:";
for (auto& prefix : context->getSimPrefixes()) {
LOG(info) << prefix;
}
LOG(fatal) << "Aborting due to prefix error";
} else {
auto collisionmap = context->getCollisionIndicesForSource(sourceid);
LOG(info) << "Found " << collisionmap.size() << " events in the collisioncontext for prefix " << mConfigData.mOutputPrefix;

// check if collisionmap is dense (otherwise it will get screwed up with order/indexing in ROOT output)
bool good = true;
for (auto index = 0; index < collisionmap.size(); ++index) {
if (collisionmap.find(index) == collisionmap.end()) {
good = false;
}
}
if (!good) {
LOG(fatal) << "events in collisioncontext are non-compact ";
}

// do some adjustments based on the number of events to be simulated
if (mConfigData.mNEvents == 0 || mConfigData.mNEvents == collisionmap.size()) {
// we take what is specified in the context
mConfigData.mNEvents = collisionmap.size();
} else {
LOG(warning) << "The number of events on the command line and in the collision context differ. Taking the min of the 2";
mConfigData.mNEvents = std::min((size_t)mConfigData.mNEvents, collisionmap.size());
}
LOG(info) << "Setting number of events to simulate to " << mConfigData.mNEvents;
}
} else {
LOG(fatal) << "Could not open collision context file " << mConfigData.mFromCollisionContext;
}
}

bool SimConfig::resetFromArguments(int argc, char* argv[])
{
namespace bpo = boost::program_options;
Expand Down Expand Up @@ -300,7 +353,7 @@ bool parseSimReconfigFromString(std::string const& argumentstring, SimReconfigDa
bpo::options_description options("Allowed options");

options.add_options()(
"nEvents,n", bpo::value<unsigned int>(&data.nEvents)->default_value(1), "number of events")(
"nEvents,n", bpo::value<unsigned int>(&data.nEvents)->default_value(0), "number of events")(
"generator,g", bpo::value<std::string>(&data.generator)->default_value("boxgen"), "Event generator to be used.")(
"trigger,t", bpo::value<std::string>(&data.trigger)->default_value(""), "Event generator trigger to be used.")(
"startEvent", bpo::value<unsigned int>(&data.startEvent)->default_value(0), "index of first event to be used (when applicable)")(
Expand Down
5 changes: 3 additions & 2 deletions DataFormats/Detectors/CTP/include/DataFormatsCTP/CTF.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,15 @@ namespace ctp

/// Header for a single CTF
struct CTFHeader : public o2::ctf::CTFDictHeader {
uint64_t lumiCounts = 0; /// Luminosity counts moving average over lumiNHBFs orbits
uint64_t lumiCounts = 0; /// FT0 Luminosity counts moving average over lumiNHBFs orbits
uint64_t lumiCountsFV0 = 0; /// FV0 Luminosity counts moving average over lumiNHBFs orbits
uint32_t lumiNHBFs = 0; /// Number of HBFs over which lumi is integrated
uint32_t lumiOrbit = 0; /// 1st orbit of TF where lumi was updated, can be compared with firstOrbit
uint32_t nTriggers = 0; /// number of triggers
uint32_t firstOrbit = 0; /// orbit of 1st trigger
uint16_t firstBC = 0; /// bc of 1st trigger

ClassDefNV(CTFHeader, 2);
ClassDefNV(CTFHeader, 3);
};

/// wrapper for the Entropy-encoded trigger inputs and classes of the TF
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ class CTPRunManager
void init();
int loadRun(const std::string& cfg);
int startRun(const std::string& cfg);
int stopRun(uint32_t irun);
int stopRun(uint32_t irun, long timeStamp);
int addScalers(uint32_t irun, std::time_t time);
int processMessage(std::string& topic, const std::string& message);
void printActiveRuns() const;
Expand Down
7 changes: 5 additions & 2 deletions DataFormats/Detectors/CTP/include/DataFormatsCTP/LumiInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,13 @@ struct LumiInfo {
LumiInfo() = default;
uint32_t orbit = 0; // orbit of TF when was updated
uint32_t nHBFCounted = 0; // length of interval in HB
uint64_t counts = 0; // counts in the interval
uint64_t counts = 0; // counts in the interval for the nominal lumi detector (FT0)
uint64_t countsFV0 = 0; // connts for FV0 (less reliable)
float getLumi() const { return nHBFCounted > 0 ? float(counts / (nHBFCounted * o2::constants::lhc::LHCOrbitMUS * 1e-6)) : 0.f; }
float getLumiFV0() const { return nHBFCounted > 0 ? float(countsFV0 / (nHBFCounted * o2::constants::lhc::LHCOrbitMUS * 1e-6)) : 0.f; }
float getLumiError() const { return nHBFCounted > 0 ? float(std::sqrt(counts) / (nHBFCounted * o2::constants::lhc::LHCOrbitMUS * 1e-6)) : 0.f; }
ClassDefNV(LumiInfo, 1);
float getLumiFV0Error() const { return nHBFCounted > 0 ? float(std::sqrt(countsFV0) / (nHBFCounted * o2::constants::lhc::LHCOrbitMUS * 1e-6)) : 0.f; }
ClassDefNV(LumiInfo, 2);
};
} // namespace ctp

Expand Down
4 changes: 4 additions & 0 deletions DataFormats/Detectors/CTP/include/DataFormatsCTP/Scalers.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ struct CTPScalerO2 {
uint64_t l1Before;
uint64_t l1After;
void printStream(std::ostream& stream) const;
void printFromZero(std::ostream& stream, CTPScalerO2& scaler0) const;
ClassDefNV(CTPScalerO2, 1);
};
struct CTPScalerRecordRaw {
Expand All @@ -77,6 +78,7 @@ struct CTPScalerRecordO2 {
std::vector<CTPScalerO2> scalers;
std::vector<uint64_t> scalersDets;
void printStream(std::ostream& stream) const;
void printFromZero(std::ostream& stream, CTPScalerRecordO2& record0) const;
ClassDefNV(CTPScalerRecordO2, 3);
};
class CTPRunScalers
Expand All @@ -85,6 +87,8 @@ class CTPRunScalers
CTPRunScalers() = default;

void printStream(std::ostream& stream) const;
void printO2(std::ostream& stream) const;
void printFromZero(std::ostream& stream) const;
void printClasses(std::ostream& stream) const;
std::vector<uint32_t> getClassIndexes() const;
std::vector<CTPScalerRecordO2>& getScalerRecordO2() { return mScalerRecordO2; };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ namespace o2
namespace ctp
{
struct TriggerOffsetsParam : public o2::conf::ConfigurableParamHelper<TriggerOffsetsParam> {
static constexpr int MaxNDet = 32; // take with margin to account for possible changes / upgrades
int64_t LM_L0 = 15;
int64_t L0_L1 = 280;

int64_t customOffset[MaxNDet] = {};
O2ParamDef(TriggerOffsetsParam, "TriggerOffsetsParam"); // boilerplate stuff + make principal key
};
} // namespace ctp
Expand Down
38 changes: 26 additions & 12 deletions DataFormats/Detectors/CTP/src/Configuration.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -608,11 +608,26 @@ void CTPRunManager::init()
int CTPRunManager::loadRun(const std::string& cfg)
{
LOG(info) << "Loading run: " << cfg;
const auto now = std::chrono::system_clock::now();
const long timeStamp = std::chrono::duration_cast<std::chrono::milliseconds>(now.time_since_epoch()).count();
auto now = std::chrono::system_clock::now();
long timeStamp = std::chrono::duration_cast<std::chrono::milliseconds>(now.time_since_epoch()).count();
LOG(info) << "Timestamp real time:" << timeStamp;
size_t pos = cfg.find(" ");
std::string cfgmod = cfg;
if (pos == std::string::npos) {
LOG(warning) << "Space not found in CTP config";
} else {
std::string f = cfg.substr(0, pos);
if (f.find("run") == std::string::npos) {
double_t tt = std::stold(f);
timeStamp = (tt * 1000.);
LOG(info) << "Timestamp file:" << timeStamp;
cfgmod = cfg.substr(pos, cfg.size());
LOG(info) << "ctpcfg: using ctp time";
}
}
CTPActiveRun* activerun = new CTPActiveRun;
activerun->timeStart = timeStamp;
activerun->cfg.loadConfigurationRun3(cfg);
activerun->cfg.loadConfigurationRun3(cfgmod);
activerun->cfg.printStream(std::cout);
//
uint32_t runnumber = activerun->cfg.getRunNumber();
Expand All @@ -629,16 +644,16 @@ int CTPRunManager::startRun(const std::string& cfg)
{
return 0;
}
int CTPRunManager::stopRun(uint32_t irun)
int CTPRunManager::stopRun(uint32_t irun, long timeStamp)
{
LOG(info) << "Stopping run index: " << irun;
if (mActiveRuns[irun] == nullptr) {
LOG(error) << "No config for run index:" << irun;
return 1;
}
const auto now = std::chrono::system_clock::now();
const long timeStamp = std::chrono::duration_cast<std::chrono::milliseconds>(now.time_since_epoch()).count();
mActiveRuns[irun]->timeStop = timeStamp;
// const auto now = std::chrono::system_clock::now();
// const long timeStamp = std::chrono::duration_cast<std::chrono::milliseconds>(now.time_since_epoch()).count();
mActiveRuns[irun]->timeStop = timeStamp * 1000.;
saveRunScalersToCCDB(irun);
delete mActiveRuns[irun];
mActiveRuns[irun] = nullptr;
Expand Down Expand Up @@ -707,17 +722,16 @@ int CTPRunManager::processMessage(std::string& topic, const std::string& message
LOG(info) << "Processing message with topic:" << topic;
std::string firstcounters;
if (topic.find("ctpconfig") != std::string::npos) {
LOG(info) << "ctpcfg received";
LOG(info) << "ctpconfig received";
loadRun(message);
return 0;
}
if (topic.find("sox") != std::string::npos) {
// get config
size_t irun = message.find("run");
if (irun == std::string::npos) {
LOG(error) << "run keyword not found in SOX:\n"
<< message;
return 1;
LOG(warning) << "run keyword not found in SOX";
irun = message.size();
}
LOG(info) << "SOX received, Run keyword position:" << irun;
std::string cfg = message.substr(irun, message.size() - irun);
Expand Down Expand Up @@ -782,7 +796,7 @@ int CTPRunManager::processMessage(std::string& topic, const std::string& message
addScalers(i, tt);
mActiveRunNumbers[i] = 0;
mEOX = 0;
stopRun(i);
stopRun(i, tt);
}
}
mEOX = 0;
Expand Down
Loading

0 comments on commit 399320f

Please sign in to comment.