Skip to content

Commit 2861b9b

Browse files
authored
Merge pull request #8926 from jmyrcha/dev3
o2-eve-workflow: generating phos,
1 parent 42f7ffa commit 2861b9b

10 files changed

Lines changed: 99 additions & 31 deletions

File tree

EventVisualisation/Base/src/GeometryManager.cxx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,6 @@ TEveGeoShape* GeometryManager::getGeometryForDetector(string detectorName)
6060
f->Close();
6161

6262
geomShape->SetName(detectorName.c_str());
63-
// tricks for different R-Phi geom of TPC:
64-
if (detectorName == "RPH") { // use all other parameters of regular TPC geom
65-
detectorName = "TPC";
66-
}
6763

6864
// prepare geometry to be drawn including all children
6965
drawDeep(geomShape,
@@ -88,7 +84,7 @@ void GeometryManager::drawDeep(TEveGeoShape* geomShape, Color_t color, Char_t tr
8884
}
8985
if (lineColor >= 0) {
9086
geomShape->SetLineColor(lineColor);
91-
geomShape->SetLineWidth(0.1);
87+
geomShape->SetLineWidth(1); // 0.1
9288
geomShape->SetDrawFrame(true);
9389
} else {
9490
geomShape->SetDrawFrame(false);
@@ -108,7 +104,7 @@ void GeometryManager::drawDeep(TEveGeoShape* geomShape, Color_t color, Char_t tr
108104
}
109105
if (lineColor >= 0) {
110106
geomShape->SetLineColor(lineColor);
111-
geomShape->SetLineWidth(0.1);
107+
geomShape->SetLineWidth(1); // 0.1
112108
geomShape->SetDrawFrame(true);
113109
} else {
114110
geomShape->SetDrawFrame(false);

EventVisualisation/DataConverter/include/EventVisualisationDataConverter/VisualisationEvent.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ class VisualisationEvent
5050
};
5151
static GIDVisualisation mVis;
5252
VisualisationEvent();
53-
VisualisationEvent(std::string fileName);
5453
VisualisationEvent(const VisualisationEvent& source, EVisualisationGroup filter, float minTime, float maxTime);
5554

5655
/// constructor parametrisation (Value Object) for VisualisationEvent class
@@ -68,6 +67,8 @@ class VisualisationEvent
6867
// Default constructor
6968
VisualisationEvent(const VisualisationEventVO vo);
7069

70+
void appendAnotherEventCalo(const VisualisationEvent& another);
71+
7172
VisualisationTrack* addTrack(VisualisationTrack::VisualisationTrackVO vo)
7273
{
7374
mTracks.emplace_back(vo);
@@ -87,6 +88,12 @@ class VisualisationEvent
8788
return mTracks.back().addCluster(pos);
8889
}
8990

91+
VisualisationCalo* addCalo(VisualisationCalo::VisualisationCaloVO vo)
92+
{
93+
mCalo.emplace_back(vo);
94+
return &mCalo.back();
95+
}
96+
9097
// Multiplicity getter
9198
int GetMultiplicity() const
9299
{

EventVisualisation/DataConverter/include/EventVisualisationDataConverter/VisualisationEventJSONSerializer.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ class VisualisationEventJSONSerializer : public VisualisationEventSerializer
5050
public:
5151
bool fromFile(VisualisationEvent& event, std::string fileName) override;
5252
void toFile(const VisualisationEvent& event, std::string fileName) override;
53+
~VisualisationEventJSONSerializer() override = default;
5354
};
5455

5556
} // namespace event_visualisation

EventVisualisation/DataConverter/include/EventVisualisationDataConverter/VisualisationEventSerializer.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,14 @@ class VisualisationEventSerializer
3434

3535
public:
3636
static VisualisationEventSerializer* getInstance() { return instance; }
37+
static void setInstance(VisualisationEventSerializer* newInstance)
38+
{ // take ownership
39+
delete instance;
40+
instance = newInstance;
41+
}
3742
virtual bool fromFile(VisualisationEvent& event, std::string fileName) = 0;
3843
virtual void toFile(const VisualisationEvent& event, std::string fileName) = 0;
44+
virtual ~VisualisationEventSerializer() = default;
3945
};
4046

4147
} // namespace event_visualisation

EventVisualisation/DataConverter/src/VisualisationEvent.cxx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,13 @@ VisualisationEvent::VisualisationEvent(VisualisationEventVO vo)
101101
this->mMaxTimeOfTracks = numeric_limits<float>::min();
102102
}
103103

104+
void VisualisationEvent::appendAnotherEventCalo(const VisualisationEvent& another)
105+
{
106+
for (auto calo : another.getCalorimetersSpan()) {
107+
this->mCalo.push_back(calo);
108+
}
109+
}
110+
104111
VisualisationEvent::VisualisationEvent(const VisualisationEvent& source, EVisualisationGroup filter, float minTime, float maxTime)
105112
{
106113
for (auto it = source.mTracks.begin(); it != source.mTracks.end(); ++it) {

EventVisualisation/View/src/EventManager.cxx

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,9 @@
2222
#include "EventVisualisationView/Options.h"
2323
#include "EventVisualisationDataConverter/VisualisationEvent.h"
2424
#include <EventVisualisationBase/DataSourceOnline.h>
25-
25+
#include "EventVisualisationBase/ConfigurationManager.h"
2626
#include <TEveManager.h>
2727
#include <TEveTrack.h>
28-
#include <TEveProjectionManager.h>
2928
#include <TEveTrackPropagator.h>
3029
#include <TEnv.h>
3130
#include <TEveElement.h>
@@ -70,16 +69,22 @@ void EventManager::displayCurrentEvent()
7069
dataTypeLists[i] = new TEveElementList(gDataTypeNames[i].c_str());
7170
}
7271

72+
VisualisationEvent event; // collect calorimeters in one drawing step
7373
auto displayList = getDataSource()->getVisualisationList(no, EventManagerFrame::getInstance().getMinTimeFrameSliderValue(), EventManagerFrame::getInstance().getMaxTimeFrameSliderValue(), EventManagerFrame::MaxRange);
7474
for (auto it = displayList.begin(); it != displayList.end(); ++it) {
75-
displayVisualisationEvent(it->first, gVisualisationGroupName[it->second]);
75+
if (it->second == EVisualisationGroup::EMC || it->second == EVisualisationGroup::PHS) {
76+
event.appendAnotherEventCalo(it->first);
77+
} else {
78+
displayVisualisationEvent(it->first, gVisualisationGroupName[it->second]);
79+
}
7680
}
81+
displayCalorimeters(event);
7782

7883
for (int i = 0; i < EVisualisationDataType::NdataTypes; ++i) {
79-
MultiView::getInstance()->registerElement(dataTypeLists[i]);
84+
if (i != EVisualisationGroup::EMC && i != EVisualisationGroup::PHS) {
85+
MultiView::getInstance()->registerElement(dataTypeLists[i]);
86+
}
8087
}
81-
// displayCalorimeters(displayList[0].first);
82-
8388
MultiView::getInstance()->getAnnotation()->SetText(TString::Format("Run: %d", getDataSource()->getRunNumber()));
8489
}
8590
MultiView::getInstance()->redraw3D();
@@ -175,12 +180,9 @@ void EventManager::displayVisualisationEvent(VisualisationEvent& event, const st
175180
for (size_t i = 0; i < trackCount; ++i) {
176181
VisualisationTrack track = event.getTrack(i);
177182
TEveRecTrackD t;
178-
// double* p = track.getMomentum();
179-
// t.fP = {p[0], p[1], p[2]};
180183
t.fSign = track.getCharge() > 0 ? 1 : -1;
181184
auto* vistrack = new TEveTrack(&t, &TEveTrackPropagator::fgDefault);
182185
vistrack->SetLineColor(kMagenta);
183-
// vistrack->SetName(detectorName + " track: " + i);
184186
vistrack->SetName(track.getGIDAsString().c_str());
185187
size_t pointCount = track.getPointCount();
186188
vistrack->Reset(pointCount);
@@ -226,37 +228,42 @@ void EventManager::displayVisualisationEvent(VisualisationEvent& event, const st
226228

227229
LOG(info) << "tracks: " << trackCount << " detector: " << detectorName << ":" << dataTypeLists[EVisualisationDataType::Tracks]->NumChildren();
228230
LOG(info) << "clusters: " << clusterCount << " detector: " << detectorName << ":" << dataTypeLists[EVisualisationDataType::Clusters]->NumChildren();
229-
230-
displayCalorimeters(event);
231231
}
232232

233233
void EventManager::displayCalorimeters(VisualisationEvent& event)
234234
{
235235
int size = event.getCaloCount();
236236
if (size > 0) {
237-
auto data = new TEveCaloDataVec(1);
237+
TEnv settings;
238+
ConfigurationManager::getInstance().getConfig(settings);
239+
const bool showAxes = settings.GetValue("axes.show", false);
240+
241+
auto data = new TEveCaloDataVec(2); // number of detectors
238242
data->IncDenyDestroy();
239-
data->RefSliceInfo(0).Setup("Data", 0.3, kYellow);
243+
data->RefSliceInfo(0).Setup("emcal", 0.3, settings.GetValue("emcal.tower.color", kYellow));
244+
data->RefSliceInfo(1).Setup("phos", 0.3, settings.GetValue("phos.tower.color", kYellow));
240245

241246
for (auto calo : event.getCalorimetersSpan()) {
242247
const float dX = 0.173333;
243-
const float dY = 0.104667;
248+
const float dY = 0.104667; // to trzeba wziac ze stałych
244249
data->AddTower(calo.getEta(), calo.getEta() + dX, calo.getPhi(), calo.getPhi() + dY);
245-
data->FillSlice(0, calo.getEnergy());
250+
data->FillSlice(calo.getSource() == o2::dataformats::GlobalTrackID::PHS ? 1 : 0, calo.getEnergy()); // do ktorego slice
246251
}
247252

248253
data->DataChanged();
249254
data->SetAxisFromBins();
250255

251-
float barrelRadius = 375;
252256
float endCalPosition = 400;
253257

254258
auto calo3d = new TEveCalo3D(data);
259+
calo3d->SetName("Calorimeters");
255260

256-
calo3d->SetBarrelRadius(barrelRadius);
257-
calo3d->SetEndCapPos(endCalPosition);
261+
calo3d->SetBarrelRadius(settings.GetValue("barrel.radius", 375)); // barel staring point
262+
calo3d->SetEndCapPos(endCalPosition); // scaling factor
263+
calo3d->SetRnrFrame(false, false); // do not draw barel
258264

259265
dataTypeLists[EVisualisationDataType::Calorimeters]->AddElement(calo3d);
266+
MultiView::getInstance()->registerElement(calo3d);
260267
}
261268
}
262269

EventVisualisation/View/src/MultiView.cxx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,6 @@ void MultiView::registerGeometry(TEveGeoShape* geom, bool threeD, bool rPhi, boo
186186
LOG(error) << "MultiView::registerGeometry -- geometry is NULL!";
187187
exit(-1);
188188
}
189-
// mGeomVector.push_back(geom);
190-
191189
TEveProjectionManager* projection;
192190

193191
if (threeD) {
@@ -227,8 +225,6 @@ void MultiView::registerElement(TEveElement* event)
227225
gEve->GetCurrentEvent()->AddElement(event);
228226
getProjection(ProjectionRphi)->ImportElements(event, getScene(SceneRphiEvent));
229227
getProjection(ProjectionZrho)->ImportElements(event, getScene(SceneZrhoEvent));
230-
231-
gEve->Redraw3D();
232228
}
233229

234230
void MultiView::destroyAllEvents()

EventVisualisation/Workflow/include/EveWorkflow/EveWorkflowHelper.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,21 @@ namespace o2::itsmft
3434
class TopologyDictionary;
3535
}
3636

37+
namespace o2::mft
38+
{
39+
class GeometryTGeo;
40+
}
41+
42+
namespace o2::its
43+
{
44+
class GeometryTGeo;
45+
}
46+
47+
namespace o2::phos
48+
{
49+
class Geometry;
50+
}
51+
3752
namespace o2::event_visualisation
3853
{
3954
using GID = o2::dataformats::GlobalTrackID;
@@ -138,6 +153,7 @@ class EveWorkflowHelper
138153
void drawTPCTRDTOF(GID gid, float trackTime);
139154
void drawTPCTRD(GID gid, float trackTime);
140155
void drawTPCTOF(GID gid, float trackTime);
156+
void drawPHOS();
141157
void drawAODBarrel(AODBarrelTrack const& track, float trackTime);
142158
void drawAODMFT(AODMFTTrack const& track, float trackTime);
143159
void drawITSClusters(GID gid, float trackTime);
@@ -176,6 +192,8 @@ class EveWorkflowHelper
176192
std::vector<o2::BaseCluster<float>> mMFTClustersArray;
177193
o2::mft::GeometryTGeo* mMFTGeom;
178194
o2::its::GeometryTGeo* mITSGeom;
195+
o2::phos::Geometry* mPHOSGeom;
196+
179197
float mMUS2TPCTimeBins = 5.0098627;
180198
float mITSROFrameLengthMUS = 0; ///< ITS RO frame in mus
181199
float mMFTROFrameLengthMUS = 0; ///< MFT RO frame in mus

EventVisualisation/Workflow/src/EveWorkflowHelper.cxx

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@
2828
#include "DataFormatsITSMFT/TrkClusRef.h"
2929
#include "ITSMFTBase/DPLAlpideParam.h"
3030
#include "CommonDataFormat/IRFrame.h"
31+
#include "MFTBase/GeometryTGeo.h"
32+
#include "ITSBase/GeometryTGeo.h"
33+
#include "PHOSBase/Geometry.h"
34+
#include <TGeoBBox.h>
35+
#include <tuple>
3136

3237
using namespace o2::event_visualisation;
3338

@@ -121,6 +126,8 @@ void EveWorkflowHelper::selectTracks(const CalibObjectsConst* calib,
121126

122127
void EveWorkflowHelper::draw()
123128
{
129+
this->drawPHOS();
130+
124131
for (size_t it = 0; it < mTrackSet.trackGID.size(); it++) {
125132
const auto& gid = mTrackSet.trackGID[it];
126133
auto tim = mTrackSet.trackTime[it];
@@ -282,6 +289,28 @@ void EveWorkflowHelper::prepareMFTClusters(const o2::itsmft::TopologyDictionary*
282289
}
283290
}
284291

292+
void EveWorkflowHelper::drawPHOS()
293+
{
294+
for (auto phos : mRecoCont.getPHOSCells()) {
295+
char relativeLocalPositionInModule[3]; // relative (local) position within module
296+
float x, z;
297+
o2::phos::Geometry::absToRelNumbering(phos.getAbsId(), relativeLocalPositionInModule);
298+
o2::phos::Geometry::absIdToRelPosInModule(phos.getAbsId(), x, z);
299+
TVector3 gPos;
300+
301+
// convert local position in module to global position in ALICE including actual mis-aslignment read with GetInstance("Run3")
302+
this->mPHOSGeom->local2Global(relativeLocalPositionInModule[0], x, z, gPos);
303+
304+
auto vCalo = mEvent.addCalo({.time = static_cast<float>(phos.getTime()),
305+
.energy = phos.getEnergy(),
306+
.phi = (float)gPos.Phi(),
307+
.eta = (float)gPos.Eta(),
308+
.PID = 0,
309+
.gid = GID::getSourceName(GID::PHS),
310+
.source = GID::PHS});
311+
}
312+
}
313+
285314
void EveWorkflowHelper::drawITSTPC(GID gid, float trackTime, GID::Source source)
286315
{
287316
// LOG(info) << "EveWorkflowHelper::drawITSTPC " << gid;
@@ -653,6 +682,7 @@ EveWorkflowHelper::EveWorkflowHelper(const FilterSet& enabledFilters, std::size_
653682
this->mMFTGeom->fillMatrixCache(o2::math_utils::bit2Mask(o2::math_utils::TransformType::T2L, o2::math_utils::TransformType::L2G));
654683
this->mITSGeom = o2::its::GeometryTGeo::Instance();
655684
this->mITSGeom->fillMatrixCache(o2::math_utils::bit2Mask(o2::math_utils::TransformType::T2L, o2::math_utils::TransformType::T2GRot, o2::math_utils::TransformType::L2G));
685+
this->mPHOSGeom = o2::phos::Geometry::GetInstance("");
656686
this->mTPCFastTransform = (o2::tpc::TPCFastTransformHelperO2::instance()->create(0));
657687
const auto& elParams = o2::tpc::ParameterElectronics::Instance();
658688
mMUS2TPCTimeBins = 1. / elParams.ZbinWidth;

EventVisualisation/Workflow/src/O2DPLDisplay.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,8 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
184184
int numberOfFiles = cfgc.options().get<int>("number-of_files");
185185
int numberOfTracks = cfgc.options().get<int>("number-of_tracks");
186186

187-
GID::mask_t allowedTracks = GID::getSourcesMask("ITS,TPC,MFT,MCH,ITS-TPC,ITS-TPC-TOF,TPC-TRD,ITS-TPC-TRD,MID");
188-
GID::mask_t allowedClusters = GID::getSourcesMask("ITS,TPC,MFT,MCH,TRD,TOF,MID,TRD");
187+
GID::mask_t allowedTracks = GID::getSourcesMask("ITS,TPC,MFT,MCH,ITS-TPC,ITS-TPC-TOF,TPC-TRD,ITS-TPC-TRD,MID,PHS,EMC");
188+
GID::mask_t allowedClusters = GID::getSourcesMask("ITS,TPC,MFT,MCH,TRD,TOF,MID,TRD,PHS,EMC");
189189

190190
GlobalTrackID::mask_t srcTrk = GlobalTrackID::getSourcesMask(cfgc.options().get<std::string>("display-tracks")) & allowedTracks;
191191
GlobalTrackID::mask_t srcCl = GlobalTrackID::getSourcesMask(cfgc.options().get<std::string>("display-clusters")) & allowedClusters;

0 commit comments

Comments
 (0)