@@ -88,12 +88,11 @@ void EventManager::displayCurrentEvent()
8888 auto displayList = dataSource->getVisualisationList (no, EventManagerFrame::getInstance ().getMinTimeFrameSliderValue (), EventManagerFrame::getInstance ().getMaxTimeFrameSliderValue (), EventManagerFrame::MaxRange);
8989 for (auto it = displayList.begin (); it != displayList.end (); ++it) {
9090 if (it->second == EVisualisationGroup::EMC || it->second == EVisualisationGroup::PHS ) {
91- event. appendAnotherEventCalo (it->first );
91+ displayCalorimeters (it->first , gVisualisationGroupName [it-> second ] );
9292 } else {
9393 displayVisualisationEvent (it->first , gVisualisationGroupName [it->second ]);
9494 }
9595 }
96- displayCalorimeters (event);
9796
9897 for (int i = 0 ; i < EVisualisationDataType::NdataTypes; ++i) {
9998 multiView->registerElement (dataTypeLists[i]);
@@ -253,61 +252,67 @@ void EventManager::displayVisualisationEvent(VisualisationEvent& event, const st
253252 LOG (info) << " clusters: " << clusterCount << " detector: " << detectorName << " :" << dataTypeLists[EVisualisationDataType::Clusters]->NumChildren ();
254253}
255254
256- void EventManager::displayCalorimeters (VisualisationEvent& event)
255+ void EventManager::displayCalorimeters (VisualisationEvent& event, const std::string& detectorName )
257256{
258- struct CaloInfo {
259- unsigned int index;
260- std::string name;
261- std::string configColor;
262- int defaultColor;
263- float sizeEta;
264- float sizePhi;
265- std::string configNoise;
266- float defaultNoise;
267- };
268-
269- // TODO: calculate values based on info available in O2
270- const std::unordered_map<o2::dataformats::GlobalTrackID::Source, CaloInfo> caloInfos =
271- {
272- {o2::dataformats::GlobalTrackID::EMC , {0 , " emcal" , " emcal.tower.color" , kYellow , 0.0143 , 0.0143 , " emcal.tower.noise" , 0 }},
273- {o2::dataformats::GlobalTrackID::PHS , {1 , " phos" , " phos.tower.color" , kYellow , 0.0046 , 0.00478 , " phos.tower.noise" , 200 }},
274- };
275-
276257 int size = event.getCaloCount ();
277258 if (size > 0 ) {
259+ const std::string detector = detectorName == " EMC" ? " emcal" : " phos" ;
260+ struct CaloInfo {
261+ std::string name;
262+ std::string configColor;
263+ int defaultColor;
264+ std::string configSizeEta;
265+ float sizeEta;
266+ std::string configSizePhi;
267+ float sizePhi;
268+ std::string configNoise;
269+ float defaultNoise;
270+ std::string configTransparency;
271+ int defaultTransparency;
272+ std::string configBarrelRadius;
273+ int defaultBarrelRadius;
274+ double scale;
275+ };
278276 TEnv settings;
279277 ConfigurationManager::getInstance ().getConfig (settings);
280- const bool showAxes = settings.GetValue (" axes.show" , false );
281278
282- auto data = new TEveCaloDataVec (caloInfos.size ());
279+ // TODO: calculate values based on info available in O2
280+ static const std::unordered_map<o2::dataformats::GlobalTrackID::Source, CaloInfo> caloInfos =
281+ {
282+ {o2::dataformats::GlobalTrackID::EMC , {" emcal" , " emcal.tower.color" , kYellow , " emcal.tower.size.eta" , 0.0143 , " emcal.tower.size.phi" , 0.0143 , " emcal.tower.noise" , 0 , " emcal.tower.transparency" , 101 , " emcal.barel.radius" , 500 , settings.GetValue (" emcal.tower.scale" , 1.0 )}},
283+ {o2::dataformats::GlobalTrackID::PHS , {" phos" , " phos.tower.color" , kYellow , " phos.tower.size.eta" , 0.0046 , " phos.tower.size.eta" , 0.00478 , " phos.tower.noise" , 200 , " phos.tower.transparency" , 101 , " phos.barel.radius" , 550 , settings.GetValue (" phos.tower.scale" , 1.0 )}},
284+ };
285+
286+ auto data = new TEveCaloDataVec (1 );
283287 data->IncDenyDestroy ();
288+ auto key = detectorName == " EMC" ? o2::dataformats::GlobalTrackID::EMC : o2::dataformats::GlobalTrackID::PHS ;
284289
285- for (const auto & [det, info] : caloInfos) {
286- data->RefSliceInfo (info.index ).Setup (info.name .c_str (), settings.GetValue (info.configNoise .c_str (), info.defaultNoise ), settings.GetValue (info.configColor .c_str (), info.defaultColor ));
287- }
290+ const CaloInfo& info = caloInfos.at (key);
291+ data->RefSliceInfo (0 ).Setup (info.name .c_str (),
292+ settings.GetValue (info.configNoise .c_str (), info.defaultNoise ),
293+ settings.GetValue (info.configColor .c_str (), info.defaultColor ),
294+ settings.GetValue (info.configTransparency .c_str (), info.defaultTransparency ));
295+
296+ const auto dEta = settings.GetValue (info.configSizeEta .c_str (), info.sizeEta ) / 2.0 ;
297+ const auto dPhi = settings.GetValue (info.configSizePhi .c_str (), info.sizePhi ) / 2.0 ;
298+ const float barrelRadius = settings.GetValue (info.configBarrelRadius .c_str (), info.defaultBarrelRadius );
288299
289300 for (const auto & calo : event.getCalorimetersSpan ()) {
290- const auto & info = caloInfos.at (calo.getSource ());
291- const auto dEta = info.sizeEta / 2 ;
292- const auto dPhi = info.sizePhi / 2 ;
293301 data->AddTower (calo.getEta () - dEta, calo.getEta () + dEta, calo.getPhi () - dPhi, calo.getPhi () + dPhi);
294- data->FillSlice (info.index , calo.getEnergy ());
302+ data->FillSlice (0 , info.scale * calo.getEnergy ());
295303 }
296304
297305 data->DataChanged ();
298306 data->SetAxisFromBins ();
299307
300- const float barrelRadius = settings.GetValue (" barrel.radius" , 375 );
301-
302308 auto calo3d = new TEveCalo3D (data);
303- calo3d->SetName (" Calorimeters " );
309+ calo3d->SetName (detectorName. c_str () );
304310
305311 calo3d->SetBarrelRadius (barrelRadius);
306312 calo3d->SetEndCapPos (barrelRadius);
307313 calo3d->SetRnrFrame (false , false ); // do not draw barrel grid
308314
309315 dataTypeLists[EVisualisationDataType::Calorimeters]->AddElement (calo3d);
310- MultiView::getInstance ()->registerElement (calo3d);
311316 }
312317}
313318
0 commit comments