Skip to content

Commit 55bba28

Browse files
jmyrchashahor02
authored andcommitted
o2-eve-export-workflow: added EMCAL export
1 parent 6d13ff1 commit 55bba28

2 files changed

Lines changed: 67 additions & 0 deletions

File tree

EventVisualisation/Workflow/include/EveWorkflow/EveWorkflowHelper.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ namespace o2::phos
4949
class Geometry;
5050
}
5151

52+
namespace o2::emcal
53+
{
54+
class Geometry;
55+
}
56+
5257
namespace o2::event_visualisation
5358
{
5459
using GID = o2::dataformats::GlobalTrackID;
@@ -118,6 +123,8 @@ class EveWorkflowHelper
118123
void drawTPCTRD(GID gid, float trackTime, GID::Source source = GID::TPCTRD);
119124
void drawTPCTOF(GID gid, float trackTime);
120125
void drawPHOS();
126+
void drawEMCAL();
127+
121128
void drawAODBarrel(AODBarrelTrack const& track, float trackTime);
122129
void drawAODMFT(AODMFTTrack const& track, float trackTime);
123130
void drawITSClusters(GID gid, float trackTime);
@@ -155,6 +162,7 @@ class EveWorkflowHelper
155162
o2::mft::GeometryTGeo* mMFTGeom;
156163
o2::its::GeometryTGeo* mITSGeom;
157164
o2::phos::Geometry* mPHOSGeom;
165+
o2::emcal::Geometry* mEMCALGeom;
158166

159167
float mMUS2TPCTimeBins = 5.0098627;
160168
float mITSROFrameLengthMUS = 0; ///< ITS RO frame in mus

EventVisualisation/Workflow/src/EveWorkflowHelper.cxx

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include "MFTBase/GeometryTGeo.h"
3333
#include "ITSBase/GeometryTGeo.h"
3434
#include "PHOSBase/Geometry.h"
35+
#include "EMCALBase/Geometry.h"
3536
#include <TGeoBBox.h>
3637
#include <tuple>
3738
#include <gsl/span>
@@ -175,6 +176,7 @@ void EveWorkflowHelper::selectTracks(const CalibObjectsConst* calib,
175176
void EveWorkflowHelper::draw()
176177
{
177178
this->drawPHOS();
179+
this->drawEMCAL();
178180

179181
for (size_t it = 0; it < mTrackSet.trackGID.size(); it++) {
180182
const auto& gid = mTrackSet.trackGID[it];
@@ -370,6 +372,62 @@ void EveWorkflowHelper::drawPHOS()
370372
}
371373
}
372374

375+
void EveWorkflowHelper::drawEMCAL()
376+
{
377+
// LOG(info) << mRecoCont.getEMCALCells().size() << "----------------------------------------------------------------------------- !mRecoCont.getEMCALCells().size()";
378+
auto triggers = mRecoCont.getEMCALTriggers();
379+
for (auto trigger : triggers) {
380+
// trigger.getBCData().toLong() // timestamp in ns
381+
// trigger.getFirstEntry()
382+
// trigger.getFirstEntry() range in the emcal cell vector in RecoContainer
383+
// this will be towers belongs to BC (the same for emcal/phos) ++mattermost
384+
}
385+
386+
for (auto emcal : mRecoCont.getEMCALCells()) {
387+
int id = emcal.getTower();
388+
// supermodule ID, module number, index of cell in module in phi, index of cell in module in eta
389+
auto index = this->mEMCALGeom->GetCellIndex(id);
390+
// Point3D with x,y,z coordinates of cell with absId inside SM
391+
auto relPosCell = this->mEMCALGeom->RelPosCellInSModule(id);
392+
TGeoNode* node = gGeoManager->GetTopVolume()->FindNode("XEN1");
393+
auto nSupermodules = this->mEMCALGeom->GetNumberOfSuperModules();
394+
auto fPhiTileSize = this->mEMCALGeom->GetPhiTileSize();
395+
auto fEtaTileSize = this->mEMCALGeom->GetEtaTileSize();
396+
auto sm = std::get<0>(index);
397+
auto module_number = std::get<1>(index);
398+
auto index_module_phi = std::get<2>(index);
399+
auto index_module_eta = std::get<3>(index);
400+
401+
const TGeoHMatrix* matrix = this->mEMCALGeom->GetMatrixForSuperModuleFromGeoManager(sm);
402+
const Double_t* translation = matrix->GetTranslation();
403+
/*
404+
LOG(info) << "EMCAL -----------------------------------------------------------------------------------------------";
405+
LOG(info) << "EMCAL id: "<< id << " emcal.getTower()";
406+
LOG(info) << "EMCAL relPosCell: "<< relPosCell << " this->mEMCALGeom->RelPosCellInSModule(id);";
407+
LOG(info) << "EMCAL nSupermodules: "<< nSupermodules << " this->mEMCALGeom->GetNumberOfSuperModules()";
408+
LOG(info) << "EMCAL fPhiTileSize: "<< fPhiTileSize << " this->mEMCALGeom->GetPhiTileSize()";
409+
LOG(info) << "EMCAL fEtaTileSize: "<< fEtaTileSize << " this->mEMCALGeom->GetEtaTileSize();" ;
410+
LOG(info) << "EMCAL node: "<< node ;
411+
LOG(info) << "EMCAL sm: "<< sm ;
412+
LOG(info) << "EMCAL module_number: "<< module_number ;
413+
LOG(info) << "EMCAL index_module_phi: "<< index_module_phi ;
414+
LOG(info) << "EMCAL index_module_eta: "<< index_module_eta ;
415+
LOG(info) << "EMCAL translation: "<< "["<<translation[0]<<","<<translation[1]<<","<<translation[2]<<"]" ;
416+
*/
417+
TVector3 gPos;
418+
gPos[0] = translation[0] + relPosCell.X();
419+
gPos[1] = translation[1] + relPosCell.Y();
420+
gPos[2] = translation[2] + relPosCell.Z();
421+
auto vCalo = mEvent.addCalo({.time = static_cast<float>(emcal.getTimeStamp()),
422+
.energy = emcal.getEnergy(),
423+
.phi = (float)gPos.Phi(),
424+
.eta = (float)gPos.Eta(),
425+
.PID = 0,
426+
.gid = GID::getSourceName(GID::EMC),
427+
.source = GID::EMC});
428+
}
429+
}
430+
373431
void EveWorkflowHelper::drawITSTPC(GID gid, float trackTime, GID::Source source)
374432
{
375433
// LOG(info) << "EveWorkflowHelper::drawITSTPC " << gid;
@@ -723,6 +781,7 @@ EveWorkflowHelper::EveWorkflowHelper(const FilterSet& enabledFilters, std::size_
723781
this->mMFTGeom->fillMatrixCache(o2::math_utils::bit2Mask(o2::math_utils::TransformType::T2L, o2::math_utils::TransformType::L2G));
724782
this->mITSGeom = o2::its::GeometryTGeo::Instance();
725783
this->mITSGeom->fillMatrixCache(o2::math_utils::bit2Mask(o2::math_utils::TransformType::T2L, o2::math_utils::TransformType::T2GRot, o2::math_utils::TransformType::L2G));
784+
this->mEMCALGeom = o2::emcal::Geometry::GetInstance("");
726785
this->mPHOSGeom = o2::phos::Geometry::GetInstance("");
727786
this->mTPCFastTransform = (o2::tpc::TPCFastTransformHelperO2::instance()->create(0));
728787
const auto& elParams = o2::tpc::ParameterElectronics::Instance();

0 commit comments

Comments
 (0)