Skip to content

Commit

Permalink
Simplify eve options, shift TPC tracks by PV time and apply dca cuts
Browse files Browse the repository at this point in the history
  • Loading branch information
shahor02 committed Nov 5, 2024
1 parent 5934a6a commit 831670f
Show file tree
Hide file tree
Showing 9 changed files with 250 additions and 200 deletions.
5 changes: 4 additions & 1 deletion EventVisualisation/Base/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@ o2_add_library(EventVisualisationBase
src/GeometryManager.cxx
src/FileWatcher.cxx
src/DirectoryLoader.cxx

src/EveConfParam.cxx
PUBLIC_LINK_LIBRARIES ROOT::Eve
O2::CCDB
O2::EventVisualisationDataConverter
O2::DetectorsBase
)

o2_target_root_dictionary(EventVisualisationBase
HEADERS include/EventVisualisationBase/EveConfParam.h)
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// 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.

#ifndef ALICE_O2_EVENTVISUALISATION_CONFIG_H
#define ALICE_O2_EVENTVISUALISATION_CONFIG_H
#include "CommonUtils/ConfigurableParam.h"
#include "CommonUtils/ConfigurableParamHelper.h"

namespace o2::event_visualisation
{
struct EveConfParam : o2::conf::ConfigurableParamHelper<EveConfParam> {
float EMCCellTimeMax = 100.f; // Max. EMCAL cell time (in ns)
float EMCCellEnergyMin = 0.3f; // Min. EMCAL cell energy (in GeV)

float timeMinMax[2] = {-999.f, -999.f}; // if min<max (microseconds), show only track in this range of every TF

int maxFiles = 150; // maximum number of json files in folder
int maxTracks = -1; // maximum number of track stored in json file (-1 means no limit)
int maxBytes = 3000000; // number of bytes stored in time interval which stops producing new data file (-1 means no limit)

int maxPVs = -1; // if > 0: enable PV mode and limit max number of vertices
int minTracks = -1; // don't create file if less than the specified number of all tracks is present
int minITSTracks = -1; // don't create file if less than the specified number of ITS tracks is present
int onlyNthEvent = -1; // process only every nth event (if > 1)
float PVXYZMin[3] = {-999.f, -999.f, -999.f}; // primary vertex min x,y,z
float PVXYZMax[3] = {999.f, 999.f, 999.f}; // primary vertex max x,y,z
float TPCOnlyMaxDCARZ[2] = {-999.f, -999.f}; // max DCA r,z (if positive) for TPC only tracks in the primary vertex mode
float TPCEtaAbsMax = -1.f; // if positive, show TPC tracks only below this abs eta

bool PVMode = false; // produce jsons with individual primary vertices, not total time frame data
bool PVTriggersMode = false; // instead of drawing vertices with tracks (and maybe calorimeter triggers), draw vertices with calorimeter triggers (and maybe tracks)"
bool trackSorting = false; // sort track by track time before applying filters
bool filterITSROF = false; // don't display tracks outside ITS readout frame
bool calibrateEMC = true; // apply on-the-fly EMCAL calibration

O2ParamDef(EveConfParam, "eveconf");
};
} // namespace o2::event_visualisation

#endif
14 changes: 14 additions & 0 deletions EventVisualisation/Base/src/EveConfParam.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// 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.

#include "EventVisualisationBase/EveConfParam.h"

O2ParamImpl(o2::event_visualisation::EveConfParam);
22 changes: 22 additions & 0 deletions EventVisualisation/Base/src/EventVisualisationBaseLinkDef.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// 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.

#ifdef __CLING__

#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;

#pragma link C++ class o2::event_visualisation::EveConfParam + ;

#pragma link C++ class o2::conf::ConfigurableParamHelper < o2::event_visualisation::EveConfParam> + ;

#endif
37 changes: 12 additions & 25 deletions EventVisualisation/Workflow/include/EveWorkflow/EveWorkflowHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "ITSBase/GeometryTGeo.h"
#include "TPCFastTransform.h"
#include "TPCReconstruction/TPCFastTransformHelperO2.h"
#include "DataFormatsTPC/VDriftCorrFact.h"
#include "Framework/AnalysisDataModel.h"
#include "DetectorsVertexing/PVertexerParams.h"

Expand Down Expand Up @@ -124,27 +125,17 @@ class EveWorkflowHelper

using AODMFTTracks = aod::MFTTracks;
using AODMFTTrack = AODMFTTracks::iterator;

enum Filter : uint8_t {
ITSROF,
TimeBracket,
EtaBracket,
TotalNTracks,
NFilters
};

using FilterSet = std::bitset<Filter::NFilters>;

using Bracket = o2::math_utils::Bracketf_t;

EveWorkflowHelper(const FilterSet& enabledFilters = {}, std::size_t maxNTracks = -1, const Bracket& timeBracket = {}, const Bracket& etaBracket = {}, bool primaryVertexMode = false);
EveWorkflowHelper();
static std::vector<PNT> getTrackPoints(const o2::track::TrackPar& trc, float minR, float maxR, float maxStep, float minZ = -25000, float maxZ = 25000);
void setTPCVDrift(const o2::tpc::VDriftCorrFact* v);
void selectTracks(const CalibObjectsConst* calib, GID::mask_t maskCl, GID::mask_t maskTrk, GID::mask_t maskMatch);
void selectTowers();
void setITSROFs();
void addTrackToEvent(const o2::track::TrackPar& tr, GID gid, float trackTime, float dz, GID::Source source = GID::NSources, float maxStep = 4.f);
void draw(std::size_t primaryVertexIdx, bool sortTracks);
void drawTPC(GID gid, float trackTime);
void drawTPC(GID gid, float trackTime, float dz = 0.f);
void drawITS(GID gid, float trackTime);
void drawMFT(GID gid, float trackTime);
void drawMCH(GID gid, float trackTime);
Expand All @@ -170,7 +161,7 @@ class EveWorkflowHelper
void drawMFTTrack(GID gid, o2::track::TrackParFwd track, float trackTime);
void drawForwardTrack(GID gid, mch::TrackParam track, float startZ, float endZ, float trackTime);
void drawITSClusters(GID gid);
void drawTPCClusters(GID gid);
void drawTPCClusters(GID gid, float trackTimeTB = -2.e9); // if trackTimeTB<-1.e9, then use tpcTrack.getTime0()
void drawMFTClusters(GID gid);
void drawMCHClusters(GID gid);
void drawMIDClusters(GID gid);
Expand All @@ -194,17 +185,14 @@ class EveWorkflowHelper

void save(const std::string& jsonPath, const std::string& ext, int numberOfFiles);

FilterSet mEnabledFilters;
std::size_t mMaxNTracks;
Bracket mTimeBracket;
Bracket mEtaBracket;
bool mPrimaryVertexMode;
bool mUseTimeBracket = false;
bool mUseEtaBracketTPC = false;
Bracket mTimeBracket{};
Bracket mEtaBracketTPC;
const o2::globaltracking::RecoContainer* mRecoCont = nullptr;
const o2::globaltracking::RecoContainer* getRecoContainer() const { return mRecoCont; }
void setRecoContainer(const o2::globaltracking::RecoContainer* rc) { mRecoCont = rc; }
void setEMCALCellRecalibrator(o2::emcal::CellRecalibrator* calibrator) { mEMCALCalib = calibrator; }
void setMaxEMCALCellTime(float maxtime) { mEMCALMaxCellTime = maxtime; }
void setMinEMCALCellEnergy(float minenergy) { mEMCALMinCellEnergy = minenergy; }
TracksSet mTrackSet;
o2::event_visualisation::VisualisationEvent mEvent;
std::unordered_map<GID, std::size_t> mTotalDataTypes;
Expand All @@ -220,13 +208,12 @@ class EveWorkflowHelper
o2::phos::Geometry* mPHOSGeom;
o2::emcal::Geometry* mEMCALGeom;
o2::emcal::CellRecalibrator* mEMCALCalib = nullptr;

float mMUS2TPCTimeBins = 5.0098627;
const o2::tpc::VDriftCorrFact* mTPCVDrift = nullptr;
float mMUS2TPCTimeBins = 5.0098627f;
float mTPCTimeBins2MUS = 0.199606f;
float mITSROFrameLengthMUS = 0; ///< ITS RO frame in mus
float mMFTROFrameLengthMUS = 0; ///< MFT RO frame in mus
float mTPCBin2MUS = 0;
float mEMCALMaxCellTime = 100.; ///< EMCAL cell time cut (in ns)
float mEMCALMinCellEnergy = 0.3; ///< EMCAL cell energy cut (in GeV)
static int BCDiffErrCount;
const o2::vertexing::PVertexerParams* mPVParams = nullptr;
};
Expand Down
35 changes: 5 additions & 30 deletions EventVisualisation/Workflow/include/EveWorkflow/O2DPLDisplay.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

#include "ReconstructionDataFormats/GlobalTrackID.h"
#include "DataFormatsGlobalTracking/RecoContainer.h"
#include "TPCCalibration/VDriftHelper.h"
#include "DetectorsBase/GRPGeomHelper.h"
#include "EMCALCalib/CellRecalibrator.h"
#include "EMCALWorkflow/CalibLoader.h"
Expand Down Expand Up @@ -58,14 +59,9 @@ class O2DPLDisplaySpec : public o2::framework::Task
std::shared_ptr<o2::base::GRPGeomRequest> gr,
std::shared_ptr<o2::emcal::CalibLoader> emcCalibLoader,
const std::string& jsonPath, const std::string& ext,
std::chrono::milliseconds timeInterval, int numberOfFiles, int numberOfTracks, int numberOfBytes,
bool eveHostNameMatch, int minITSTracks, int minTracks, bool filterITSROF, bool filterTime,
const EveWorkflowHelper::Bracket& timeBracket, bool removeTPCEta,
const EveWorkflowHelper::Bracket& etaBracket, bool trackSorting, int onlyNthEvent,
bool primaryVertex, int maxPrimaryVertices, bool primaryVertexTriggers,
float primaryVertexMinZ, float primaryVertexMaxZ, float primaryVertexMinX, float primaryVertexMaxX, float primaryVertexMinY, float primaryVertexMaxY,
float maxEMCALCellTime, float minEMCALCellEnergy)
: mDisableWrite(disableWrite), mUseMC(useMC), mTrkMask(trkMask), mClMask(clMask), mDataRequest(dataRequest), mGGCCDBRequest(gr), mEMCALCalibLoader(emcCalibLoader), mJsonPath(jsonPath), mExt(ext), mTimeInterval(timeInterval), mNumberOfFiles(numberOfFiles), mNumberOfTracks(numberOfTracks), mNumberOfBytes(numberOfBytes), mEveHostNameMatch(eveHostNameMatch), mMinITSTracks(minITSTracks), mMinTracks(minTracks), mFilterITSROF(filterITSROF), mFilterTime(filterTime), mTimeBracket(timeBracket), mRemoveTPCEta(removeTPCEta), mEtaBracket(etaBracket), mTrackSorting(trackSorting), mOnlyNthEvent(onlyNthEvent), mPrimaryVertexMode(primaryVertex), mMaxPrimaryVertices(maxPrimaryVertices), mPrimaryVertexTriggers(primaryVertexTriggers), mPrimaryVertexMinZ(primaryVertexMinZ), mPrimaryVertexMaxZ(primaryVertexMaxZ), mPrimaryVertexMinX(primaryVertexMinX), mPrimaryVertexMaxX(primaryVertexMaxX), mPrimaryVertexMinY(primaryVertexMinY), mPrimaryVertexMaxY(primaryVertexMaxY), mEMCALMaxCellTime(maxEMCALCellTime), mEMCALMinCellEnergy(minEMCALCellEnergy), mRunType(o2::parameters::GRPECS::NONE)
std::chrono::milliseconds timeInterval,
bool eveHostNameMatch)
: mDisableWrite(disableWrite), mUseMC(useMC), mTrkMask(trkMask), mClMask(clMask), mDataRequest(dataRequest), mGGCCDBRequest(gr), mEMCALCalibLoader(emcCalibLoader), mJsonPath(jsonPath), mExt(ext), mTimeInterval(timeInterval), mEveHostNameMatch(eveHostNameMatch), mRunType(o2::parameters::GRPECS::NONE)

{
this->mTimeStamp = std::chrono::high_resolution_clock::now() - timeInterval; // first run meets condition
Expand All @@ -82,32 +78,10 @@ class O2DPLDisplaySpec : public o2::framework::Task
bool mDisableWrite = false; // skip writing result (for testing performance)
bool mUseMC = false;
bool mEveHostNameMatch; // empty or correct hostname
int mMinITSTracks; // minimum number of ITS tracks to produce a file
int mMinTracks; // minimum number of all tracks to produce a file
bool mFilterITSROF; // don't display tracks outside ITS readout frame
bool mFilterTime; // don't display tracks outside [min, max] range in TF time
bool mRemoveTPCEta; // don't display TPC tracks inside [min, max] eta range
bool mPrimaryVertexMode; // produce files per primary vertex
EveWorkflowHelper::Bracket mTimeBracket; // [min, max] range in TF time for the filter
EveWorkflowHelper::Bracket mEtaBracket; // [min, max] eta range for the TPC tracks removal
std::string mJsonPath; // folder where files are stored
std::string mExt; // extension of created files (".json" or ".root")
std::chrono::milliseconds mTimeInterval; // minimal interval between files in milliseconds
int mNumberOfFiles; // maximum number of files in folder - newer replaces older
int mNumberOfTracks; // maximum number of track in single file (0 means no limit)
int mNumberOfBytes; // number of bytes stored in period which causes stopping saving a new file
bool mTrackSorting; // perform sorting tracks by track time before applying filters
int mOnlyNthEvent; // process only every nth event.
int mMaxPrimaryVertices; // max number of primary vertices to draw per time frame
bool mPrimaryVertexTriggers; // instead of drawing vertices with tracks (and maybe calorimeter triggers), draw vertices with calorimeter triggers (and maybe tracks)
float mPrimaryVertexMinZ; // minimum z position of the primary vertex
float mPrimaryVertexMaxZ; // maximum z position of the primary vertex
float mPrimaryVertexMinX; // minimum x position of the primary vertex
float mPrimaryVertexMaxX; // maximum x position of the primary vertex
float mPrimaryVertexMinY; // minimum y position of the primary vertex
float mPrimaryVertexMaxY; // maximum y position of the primary vertex
float mEMCALMaxCellTime; // max abs EMCAL cell time (in ns)
float mEMCALMinCellEnergy; // min EMCAL cell energy (in GeV)
int mEventCounter = 0;
std::chrono::time_point<std::chrono::high_resolution_clock> mTimeStamp;

Expand All @@ -119,6 +93,7 @@ class O2DPLDisplaySpec : public o2::framework::Task
std::shared_ptr<o2::base::GRPGeomRequest> mGGCCDBRequest;
std::shared_ptr<o2::emcal::CalibLoader> mEMCALCalibLoader;
std::unique_ptr<o2::emcal::CellRecalibrator> mEMCALCalibrator;
o2::tpc::VDriftHelper mTPCVDriftHelper{};
};

} // namespace o2::event_visualisation
Expand Down
Loading

0 comments on commit 831670f

Please sign in to comment.