From 8bf6f1f8b8ba76b490c12d1a38392dd7f09ec687 Mon Sep 17 00:00:00 2001 From: Alja Mrak-Tadel Date: Mon, 11 Jul 2016 14:53:04 -0700 Subject: [PATCH 01/31] Search for detail views for complete list of plugins instad of available plugins. --- Fireworks/Core/src/FWDetailViewManager.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Fireworks/Core/src/FWDetailViewManager.cc b/Fireworks/Core/src/FWDetailViewManager.cc index 7e0f66d9cf5bc..f6b9bb47ab87a 100644 --- a/Fireworks/Core/src/FWDetailViewManager.cc +++ b/Fireworks/Core/src/FWDetailViewManager.cc @@ -138,12 +138,12 @@ FWDetailViewManager::findViewersFor(const std::string& iType) const if(itFind != m_typeToViewers.end()) { return itFind->second; } - //create a list of the available ViewManager's + std::set detailViews; - std::vector available = FWDetailViewFactory::get()->available(); - std::transform(available.begin(), - available.end(), + std::vector all = edmplugin::PluginManager::get()->categoryToInfos().find(FWDetailViewFactory::get()->category())->second; + std::transform(all.begin(), + all.end(), std::inserter(detailViews,detailViews.begin()), boost::bind(&edmplugin::PluginInfo::name_,_1)); unsigned int closestMatch= 0xFFFFFFFF; From 3cb81b0fbfe1d7261c73f3022104bbaf591848c3 Mon Sep 17 00:00:00 2001 From: Alja Mrak-Tadel Date: Mon, 11 Jul 2016 14:53:31 -0700 Subject: [PATCH 02/31] Allow more than 2 types of detail view. --- Fireworks/Core/src/FWModelContextMenuHandler.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Fireworks/Core/src/FWModelContextMenuHandler.cc b/Fireworks/Core/src/FWModelContextMenuHandler.cc index 2ca59b5d43309..2521e23b17eb2 100644 --- a/Fireworks/Core/src/FWModelContextMenuHandler.cc +++ b/Fireworks/Core/src/FWModelContextMenuHandler.cc @@ -41,7 +41,7 @@ enum MenuOptions { kSetColorMO, // kPrint, kOpenDetailViewMO, - kAfterOpenDetailViewMO, + kAfterOpenDetailViewMO=10, kOpen3DRegion, kOpenObjectControllerMO=100, kOpenCollectionControllerMO, From 0ddd678cbc5d3637753e699248d2cb4b54ecae05 Mon Sep 17 00:00:00 2001 From: Alja Mrak-Tadel Date: Mon, 11 Jul 2016 15:51:43 -0700 Subject: [PATCH 03/31] Changes in legend. --- Fireworks/Calo/src/FWECALDetailViewBase.icc | 119 ++++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 Fireworks/Calo/src/FWECALDetailViewBase.icc diff --git a/Fireworks/Calo/src/FWECALDetailViewBase.icc b/Fireworks/Calo/src/FWECALDetailViewBase.icc new file mode 100644 index 0000000000000..39de7e3c448a2 --- /dev/null +++ b/Fireworks/Calo/src/FWECALDetailViewBase.icc @@ -0,0 +1,119 @@ + +// ROOT includes +#include "TLatex.h" +#include "TEveCalo.h" +#include "TEveStraightLineSet.h" +#include "TEvePointSet.h" +#include "TEveScene.h" +#include "TEveViewer.h" +#include "TGLViewer.h" +#include "TGLOverlay.h" +#include "TCanvas.h" +#include "TLegend.h" +#include "TEveCaloLegoOverlay.h" +#include "TRootEmbeddedCanvas.h" + +// Fireworks includes +#include "Fireworks/Calo/interface/FWECALDetailViewBase.h" +#include "Fireworks/Calo/interface/FWECALDetailViewBuilder.h" +#include "Fireworks/Core/interface/FWColorManager.h" +#include "Fireworks/Core/interface/FWModelId.h" +#include "Fireworks/Core/interface/FWEventItem.h" +#include "Fireworks/Core/interface/FWGLEventHandler.h" + +// CMSSW includes +#include "DataFormats/Candidate/interface/Candidate.h" +#include "DataFormats/EcalDetId/interface/EcalSubdetector.h" + + +template +FWECALDetailViewBase::FWECALDetailViewBase () : m_data(0), m_builder(0), m_legend(0) +{ +} +template +FWECALDetailViewBase::~FWECALDetailViewBase () +{ + FWDetailViewGL::m_eveViewer->GetGLViewer()->DeleteOverlayElements(TGLOverlayElement::kUser); + + delete m_builder; + if (m_data) m_data->DecDenyDestroy(); +} + +template +void FWECALDetailViewBase::build( const FWModelId &id, const T* element ) +{ + double eta = element->eta(); + double phi = element->phi(); + + // build ECAL objects + m_builder = new FWECALDetailViewBuilder( id.item()->getEvent(), id.item()->getGeom(), eta, phi, 25); + + TEveCaloLego* lego = m_builder->build(); + m_data = lego->GetData(); + m_data->IncDenyDestroy(); // needed ??? + FWDetailViewGL::m_eveScene->AddElement( lego ); + + m_legend = new TLegend(0.01, 0.01, 0.99, 0.99, 0, "NDC"); + m_legend->SetTextSize(0.075); + m_legend->SetBorderSize(0); + m_legend->SetMargin(0.15); + m_legend->SetEntrySeparation(0.05); + + + // draw axis at the window corners + if (1) + { + TEveCaloLegoOverlay* overlay = new TEveCaloLegoOverlay(); + overlay->SetShowPlane( kFALSE ); + overlay->SetShowPerspective( kFALSE ); + overlay->SetCaloLego( lego ); + overlay->SetShowScales( 1 ); // temporary + + FWDetailViewGL::viewerGL()->AddOverlayElement( overlay ); + } + // set event handler and flip camera to top view at beginning + // FWDetailViewGL::viewerGL()->SetCurrentCamera( TGLViewer::kCameraOrthoXOY ); + FWGLEventHandler* eh = + new FWGLEventHandler( (TGWindow*) FWDetailViewGL::viewerGL()->GetGLWidget(), (TObject*) FWDetailViewGL::viewerGL(), lego ); + FWDetailViewGL::viewerGL()->SetEventHandler( eh ); + FWDetailViewGL::viewerGL()->ResetCamerasAfterNextUpdate(); + FWDetailViewGL::viewerGL()->UpdateScene(kFALSE); + gEve->Redraw3D(); + + setTextInfo( id, element ); +} + +template +void FWECALDetailViewBase::setTextInfo( const FWModelId& id, const T* element ) +{ + FWDetailViewGL::m_infoCanvas->cd(); + + float_t x = 0.02; + float y = 0.95; + + TLatex* latex = new TLatex( x, y, "" ); + const double textsize( 0.1 ); + latex->SetTextSize( textsize ); + + latex->DrawLatex( x, y, id.item()->modelName( id.index() ).c_str() ); + y -= latex->GetTextSize()*0.8; + + latex->SetTextSize( textsize * 0.8 ); + float lineH = latex->GetTextSize()*0.6; + + latex->DrawLatex( x, y, Form( "#eta = %0.2f" , element->eta())); + y -= lineH; + latex->DrawLatex( x, y, Form( "#phi = %0.2f" , element->phi())); + y -= lineH; + // summary + if( element->charge() > 0 ) + latex->DrawLatex( x, y, "charge = +1" ); + else + latex->DrawLatex( x, y, "charge = -1" ); + y -= lineH; + + m_legend->SetY2(y); + m_legend->Draw(); + m_legend = 0; // Deleted together with TPad. +} + From 332fad57cf9a1020c79907ce4eef30ad5e94cb5e Mon Sep 17 00:00:00 2001 From: Alja Mrak-Tadel Date: Mon, 11 Jul 2016 15:57:17 -0700 Subject: [PATCH 04/31] New ECAL rechit detail view. --- .../Calo/interface/FWECALDetailViewBase.h | 37 +++++++++++++++++++ Fireworks/Calo/src/FWECALDetailViewBase.icc | 2 +- Fireworks/Candidates/plugins/BuildFile.xml | 1 + .../plugins/FWCandidateECALDetailView.cc | 20 ++++++++++ Fireworks/Tracks/plugins/BuildFile.xml | 1 + .../Tracks/plugins/FWTrackECALDetailView.cc | 20 ++++++++++ 6 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 Fireworks/Calo/interface/FWECALDetailViewBase.h create mode 100644 Fireworks/Candidates/plugins/FWCandidateECALDetailView.cc create mode 100644 Fireworks/Tracks/plugins/FWTrackECALDetailView.cc diff --git a/Fireworks/Calo/interface/FWECALDetailViewBase.h b/Fireworks/Calo/interface/FWECALDetailViewBase.h new file mode 100644 index 0000000000000..fef3902cf265c --- /dev/null +++ b/Fireworks/Calo/interface/FWECALDetailViewBase.h @@ -0,0 +1,37 @@ +#ifndef Fireworks_Core_FWFWEcalDetailViewBase_h +#define Fireworks_Core_FWFWEcalDetailViewBase_h + +// #include "TEveViewer.h" +#include "Fireworks/Core/interface/FWDetailViewGL.h" + +class TEveCaloData; +class TEveCaloLego; +class TLegend; +class FWECALDetailViewBuilder; + +template +class FWECALDetailViewBase : public FWDetailViewGL { + public: + FWECALDetailViewBase ();//: m_data(0), m_builder(0), m_legend(0) {} + virtual ~FWECALDetailViewBase();// { delete m_data; } + + +protected: + TEveCaloData *m_data; + FWECALDetailViewBuilder *m_builder; + TLegend *m_legend; + +private: + using FWDetailView::build; + void build(const FWModelId &id, const T*); + + using FWDetailViewGL::setTextInfo; + void setTextInfo(const FWModelId &id, const T*); + +}; + + +#include "Fireworks/Calo/src/FWECALDetailViewBase.icc" + +#endif + diff --git a/Fireworks/Calo/src/FWECALDetailViewBase.icc b/Fireworks/Calo/src/FWECALDetailViewBase.icc index 39de7e3c448a2..5affa17c7b33d 100644 --- a/Fireworks/Calo/src/FWECALDetailViewBase.icc +++ b/Fireworks/Calo/src/FWECALDetailViewBase.icc @@ -72,7 +72,7 @@ void FWECALDetailViewBase::build( const FWModelId &id, const T* element ) FWDetailViewGL::viewerGL()->AddOverlayElement( overlay ); } // set event handler and flip camera to top view at beginning - // FWDetailViewGL::viewerGL()->SetCurrentCamera( TGLViewer::kCameraOrthoXOY ); + FWDetailViewGL::viewerGL()->SetCurrentCamera( TGLViewer::kCameraPerspXOY ); FWGLEventHandler* eh = new FWGLEventHandler( (TGWindow*) FWDetailViewGL::viewerGL()->GetGLWidget(), (TObject*) FWDetailViewGL::viewerGL(), lego ); FWDetailViewGL::viewerGL()->SetEventHandler( eh ); diff --git a/Fireworks/Candidates/plugins/BuildFile.xml b/Fireworks/Candidates/plugins/BuildFile.xml index b53b25d5adbb7..fa33dd693e856 100644 --- a/Fireworks/Candidates/plugins/BuildFile.xml +++ b/Fireworks/Candidates/plugins/BuildFile.xml @@ -3,5 +3,6 @@ + diff --git a/Fireworks/Candidates/plugins/FWCandidateECALDetailView.cc b/Fireworks/Candidates/plugins/FWCandidateECALDetailView.cc new file mode 100644 index 0000000000000..c2d5a1cb22c36 --- /dev/null +++ b/Fireworks/Candidates/plugins/FWCandidateECALDetailView.cc @@ -0,0 +1,20 @@ +#include "Fireworks/Calo/interface/FWECALDetailViewBase.h" +#include "DataFormats/Candidate/interface/Candidate.h" + +class FWCandidateECALDetailView: public FWECALDetailViewBase +{ +public: + FWCandidateECALDetailView() {} + virtual ~FWCandidateECALDetailView() {} + +private: + FWCandidateECALDetailView(const FWCandidateECALDetailView&); // stop default + const FWCandidateECALDetailView& operator=(const FWCandidateECALDetailView&); // stop default + + +}; + +REGISTER_FWDETAILVIEW(FWCandidateECALDetailView, ECAL,ecalRecHit ); +REGISTER_FWDETAILVIEW(FWCandidateECALDetailView, ECAL,reducedEcalRecHitsEB); + + diff --git a/Fireworks/Tracks/plugins/BuildFile.xml b/Fireworks/Tracks/plugins/BuildFile.xml index 6c365833a5f62..1b0171b30c816 100644 --- a/Fireworks/Tracks/plugins/BuildFile.xml +++ b/Fireworks/Tracks/plugins/BuildFile.xml @@ -12,6 +12,7 @@ + diff --git a/Fireworks/Tracks/plugins/FWTrackECALDetailView.cc b/Fireworks/Tracks/plugins/FWTrackECALDetailView.cc new file mode 100644 index 0000000000000..cd6f8bdfd2950 --- /dev/null +++ b/Fireworks/Tracks/plugins/FWTrackECALDetailView.cc @@ -0,0 +1,20 @@ +#include "Fireworks/Calo/interface/FWECALDetailViewBase.h" +#include "DataFormats/TrackReco/interface/TrackBase.h" + +class FWTrackECALDetailView: public FWECALDetailViewBase +{ +public: + FWTrackECALDetailView() {} + virtual ~FWTrackECALDetailView() {} + +private: + FWTrackECALDetailView(const FWTrackECALDetailView&); // stop default + const FWTrackECALDetailView& operator=(const FWTrackECALDetailView&); // stop default + + +}; + +REGISTER_FWDETAILVIEW(FWTrackECALDetailView, ECAL,ecalRecHit ); +REGISTER_FWDETAILVIEW(FWTrackECALDetailView, ECAL,reducedEcalRecHitsEB); + + From 7741888ad2487cdc5e78c51fc1aa194a725a26ad Mon Sep 17 00:00:00 2001 From: Alja Mrak-Tadel Date: Thu, 14 Jul 2016 12:06:31 -0700 Subject: [PATCH 05/31] Separate filling for XY and EtaPhi histogram. --- .../Calo/interface/FWECALDetailViewBuilder.h | 5 + Fireworks/Calo/src/FWECALDetailViewBuilder.cc | 268 +++++++++++------- 2 files changed, 167 insertions(+), 106 deletions(-) diff --git a/Fireworks/Calo/interface/FWECALDetailViewBuilder.h b/Fireworks/Calo/interface/FWECALDetailViewBuilder.h index b9ddf0dc36c10..ce141eec44b3b 100644 --- a/Fireworks/Calo/interface/FWECALDetailViewBuilder.h +++ b/Fireworks/Calo/interface/FWECALDetailViewBuilder.h @@ -68,6 +68,11 @@ class FWECALDetailViewBuilder { // fill data void fillData(const EcalRecHitCollection *hits, TEveCaloDataVec *data, bool xyEE); + + + void fillDataEtaPhi(const EcalRecHitCollection *hits, TEveCaloDataVec *data); + void fillDataXY(const EcalRecHitCollection *hits, TEveCaloDataVec *data); + const edm::EventBase *m_event; // the event const FWGeometry *m_geom; // the geometry float m_eta; // eta position view centred on diff --git a/Fireworks/Calo/src/FWECALDetailViewBuilder.cc b/Fireworks/Calo/src/FWECALDetailViewBuilder.cc index 32b0883279da0..6f5bd2de80f81 100644 --- a/Fireworks/Calo/src/FWECALDetailViewBuilder.cc +++ b/Fireworks/Calo/src/FWECALDetailViewBuilder.cc @@ -4,6 +4,7 @@ #include "TEveCaloData.h" #include "TEveViewer.h" +#include "TEvePointSet.h" #include "TEveCalo.h" #include "TAxis.h" #include "TMath.h" @@ -15,6 +16,8 @@ #include "Fireworks/Core/interface/FWGeometry.h" #include "Fireworks/Core/interface/fw3dlego_xbins.h" #include "Fireworks/Core/interface/fwLog.h" +#include "Fireworks/Core/interface/Context.h" + #include "DataFormats/FWLite/interface/Handle.h" #include "DataFormats/EgammaReco/interface/SuperCluster.h" @@ -102,9 +105,17 @@ TEveCaloData* FWECALDetailViewBuilder::buildCaloData(bool xyEE) data->RefSliceInfo(i + 1).Setup( "hits (clustered)", 0.0, m_colors[i] ); } + bool coordinatesEtaPhi = true; + // AMT should use size here ... but it is not clear in which units it is, hardcode 1 + if (xyEE && ((fabs(m_eta) - 0.2) > fireworks::Context::getInstance()->caloTransEta())) { + coordinatesEtaPhi = false; + } + + printf("coordinates XY = %d \n", !coordinatesEtaPhi); + if( handle_hits.isValid() ) { - fillData( hits, data, xyEE ); + fillData( hits, data, coordinatesEtaPhi ); } // axis @@ -115,7 +126,7 @@ TEveCaloData* FWECALDetailViewBuilder::buildCaloData(bool xyEE) // add dummy background float x = m_size*TMath::DegToRad(); - if (fabs(m_eta) < 1.5 || xyEE == false) { + if (coordinatesEtaPhi == false ) { etaMin = m_eta -x; etaMax = m_eta +x; phiMin = m_phi -x; @@ -144,7 +155,7 @@ TEveCaloData* FWECALDetailViewBuilder::buildCaloData(bool xyEE) data->GetPhiLimits(phiMin, phiMax); // printf("data rng %f %f %f %f\n",etaMin, etaMax, phiMin, phiMax ); - if (fabs(m_eta) > 1.5 && xyEE ) { + if (coordinatesEtaPhi == false) { eta_axis = new TAxis(10, etaMin, etaMax); phi_axis = new TAxis(10, phiMin, phiMax); eta_axis->SetTitle("X[cm]"); @@ -205,6 +216,16 @@ TEveCaloLego* FWECALDetailViewBuilder::build() lego->SetAutoRebin(kFALSE); lego->Set2DMode(TEveCaloLego::kValSizeOutline); lego->SetName("ECALDetail Lego"); + + TEvePointSet* ps = new TEvePointSet("vv"); + ps->SetNextPoint(m_eta, m_phi, 0.1); + ps->SetMarkerSize(0.1); + ps->SetMarkerStyle(2); + ps->SetMainColor(kGreen); + ps->SetMarkerColor(kGreen); + lego->AddElement(ps); + + return lego; } @@ -279,129 +300,164 @@ FWECALDetailViewBuilder::showSuperClusters( Color_t color1, Color_t color2 ) } } -void -FWECALDetailViewBuilder::fillData( const EcalRecHitCollection *hits, - TEveCaloDataVec *data, bool xyEE ) -{ - const float barrelCR = m_size*0.0172; // barrel cell range - - // loop on all the detids - for( EcalRecHitCollection::const_iterator k = hits->begin(), kEnd = hits->end(); - k != kEnd; ++k ) - { - // get reco geometry - double centerEta = 0; - double centerPhi = 0; - const float* points = m_geom->getCorners( k->id().rawId()); - if( points != 0 ) - { - TEveVector v; - int j = 0; - for( int i = 0; i < 8; ++i ) - { - v += TEveVector( points[j], points[j + 1], points[j + 2] ); - j +=3; - } - centerEta = v.Eta(); - centerPhi = v.Phi(); - } - else - fwLog( fwlog::kInfo ) << "cannot get geometry for DetId: "<< k->id().rawId() << ". Ignored.\n"; - - double size = k->energy() / cosh( centerEta ); + +//------------------------------------------------------------------ +namespace { + struct DetIdTower { + DetIdTower(const EcalRecHit& hit, const FWGeometry* geom, std::map& detIdsToColor) : + m_points(0), m_slice(0), m_height(0) { + m_points = geom->getCorners( hit.id().rawId()); + if( m_points != 0 ) + { + int j = 0; + for( int i = 0; i < 8; ++i ) + { + m_center += TEveVector( m_points[j], m_points[j + 1], m_points[j + 2] ); + j +=3; + } + + m_center *= 1.f/8.0f; + } + else + fwLog( fwlog::kInfo ) << "cannot get geometry for DetId: "<< hit.id().rawId() << ". Ignored.\n"; + + std::map::const_iterator itr = detIdsToColor.find(hit.id().rawId()); + if (itr != detIdsToColor.end()) m_slice = itr->second; - // check what slice to put in - int slice = 0; - std::map::const_iterator itr = m_detIdsToColor.find(k->id()); - if (itr != m_detIdsToColor.end()) slice = itr->second; + m_height = hit.energy() / cosh( m_center.Eta() ); - // if in the EB - if( k->id().subdetId() == EcalBarrel || xyEE == false ) - { - // do phi wrapping - if( centerPhi > m_phi + M_PI) centerPhi -= 2 * M_PI; - if( centerPhi < m_phi - M_PI) centerPhi += 2 * M_PI; - - // check if the hit is in the window to be drawn - if( !( fabs( centerEta - m_eta ) < barrelCR - && fabs( centerPhi - m_phi ) < barrelCR )) continue; - - double minEta(10), maxEta(-10), minPhi(4), maxPhi(-4); - if( points != 0 ) - { + } + + const float* m_points; + TEveVector m_center; + int m_slice; + double m_height; + + }; +} + +//------------------------------------------------------------------ +void +FWECALDetailViewBuilder::fillDataEtaPhi( const EcalRecHitCollection *hits,TEveCaloDataVec *data) +{ + const float area = m_size*0.0172; // barrel cell range, AMT this is available in context + printf("area size %f \n", area ); + + int cntt = 0; + for( EcalRecHitCollection::const_iterator k = hits->begin(); k != hits->end(); ++k) + { + if( k->id().subdetId() != EcalBarrel) + continue; // AMT is this necessary ? + + DetIdTower tower(*k, m_geom, m_detIdsToColor); + if (tower.m_points) + { + float centerEta = tower.m_center.Eta(); + float centerPhi = tower.m_center.Phi(); + /* + + // do phi wrapping + if( centerPhi > m_phi + M_PI) centerPhi -= 2 * M_PI; + if( centerPhi < m_phi - M_PI) centerPhi += 2 * M_PI; + + // calorimeter crystalls have slightly non-symetrical form in eta-phi projection // so if we simply get the largest eta and phi, cells will overlap // therefore we get a smaller eta-phi range representing the inner square // we also should use only points from the inner face of the crystal, since // non-projecting direction of crystals leads to large shift in eta on outter // face. - int j = 0; + */ float eps = 0.005; + double minEta(10), maxEta(-10), minPhi(4), maxPhi(-4); + /* + int j = 0; for( unsigned int i = 0; i < 8; ++i ) { - TEveVector crystal( points[j], points[j + 1], points[j + 2] ); - j += 3; - double eta = crystal.Eta(); - double phi = crystal.Phi(); - if ( ((k->id().subdetId() == EcalBarrel) && (crystal.Perp() > 135) )|| ((k->id().subdetId() == EcalEndcap) && (crystal.Perp() > 155))) continue; - if ( minEta - eta > eps) minEta = eta; - if ( eta - minEta > 0 && eta - minEta < eps ) minEta = eta; - if ( eta - maxEta > eps) maxEta = eta; - if ( maxEta - eta > 0 && maxEta - eta < eps ) maxEta = eta; - if ( minPhi - phi > eps) minPhi = phi; - if ( phi - minPhi > 0 && phi - minPhi < eps ) minPhi = phi; - if ( phi - maxPhi > eps) maxPhi = phi; - if ( maxPhi - phi > 0 && maxPhi - phi < eps ) maxPhi = phi; + TEveVector crystal( tower.m_points[j], tower.m_points[j + 1], tower.m_points[j + 2] ); + j += 3; + double eta = crystal.Eta(); + double phi = crystal.Phi(); + if ( ((k->id().subdetId() == EcalBarrel) && (crystal.Perp() > 135) )|| ((k->id().subdetId() == EcalEndcap) && (crystal.Perp() > 155))) continue; + if ( minEta - eta > eps) minEta = eta; + if ( eta - minEta > 0 && eta - minEta < eps ) minEta = eta; + if ( eta - maxEta > eps) maxEta = eta; + if ( maxEta - eta > 0 && maxEta - eta < eps ) maxEta = eta; + if ( minPhi - phi > eps) minPhi = phi; + if ( phi - minPhi > 0 && phi - minPhi < eps ) minPhi = phi; + if ( phi - maxPhi > eps) maxPhi = phi; + if ( maxPhi - phi > 0 && maxPhi - phi < eps ) maxPhi = phi; } - } - else - { - double delta = 0.0172 * 0.5; - minEta = centerEta - delta; - maxEta = centerEta + delta; - minPhi = centerPhi - delta; - maxPhi = centerPhi + delta; - } - if( minPhi >= ( m_phi - barrelCR ) && maxPhi <= ( m_phi + barrelCR ) && - minEta >= ( m_eta - barrelCR ) && maxEta <= ( m_eta + barrelCR )) - { - // printf("add %f %f %f %f \n",minEta, maxEta, minPhi, maxPhi ); - data->AddTower( minEta, maxEta, minPhi, maxPhi ); - data->FillSlice( slice, size ); - } - // otherwise in the EE - } - else if( k->id().subdetId() == EcalEndcap ) - { - // check if the hit is in the window to be drawn - double crystalSize = m_size * 0.0172; - if( !( fabs( centerEta - m_eta ) < ( crystalSize ) - && fabs( centerPhi - m_phi ) < ( crystalSize ))) + */ + + minEta = centerEta - eps; + maxEta = centerEta + eps; + minPhi = centerPhi - eps; + maxPhi = centerPhi + eps; + + if( minPhi >= ( m_phi - area ) && maxPhi <= ( m_phi + area ) && + minEta >= ( m_eta - area ) && maxEta <= ( m_eta + area )) + { + tower.m_center.Dump(); + // printf("add (%f %f %f %f ) , value = %f\n",minEta, maxEta, minPhi, maxPhi, tower.m_height ); + data->AddTower( tower.m_center.Eta() -eps, tower.m_center.Eta() + eps, tower.m_center.Phi() -eps,tower.m_center.Phi() +eps ); + data->FillSlice( tower.m_slice, tower.m_height ); + cntt++; + } + } + } + printf("added %d towers \n", cntt); +} + + +void +FWECALDetailViewBuilder::fillDataXY( const EcalRecHitCollection *hits,TEveCaloDataVec *data) +{ + double crystalSize = m_size /** TMath::DegToRad()*/; // AMT this should be legoXYSize + + for( EcalRecHitCollection::const_iterator k = hits->begin(); k != hits->end(); ++k) + { + DetIdTower tower(*k, m_geom, m_detIdsToColor); + + // check if the hit is in the window to be drawn + if( !( fabs( tower.m_center.Eta() - m_eta ) < ( crystalSize ) + && fabs( tower.m_center.Phi() - m_phi ) < ( crystalSize ))) continue; - if( points != 0 ) - { + if( tower.m_points != 0 ) + { double minX(9999), maxX(-9999), minY(9999), maxY(-9999); int j = 0; for( unsigned int i = 0; i < 8; ++i ) { - TEveVector crystal( points[j], points[j + 1], points[j + 2] ); - j += 3; - double x = crystal.fX; - double y = crystal.fY; - if( fabs( crystal.fZ ) > 330 ) continue; - if( minX - x > 0.01 ) minX = x; - if( x - maxX > 0.01 ) maxX = x; - if( minY - y > 0.01 ) minY = y; - if( y - maxY > 0.01 ) maxY = y; + TEveVector crystal( tower.m_points[j], tower.m_points[j + 1], tower.m_points[j + 2] ); + j += 3; + double x = crystal.fX; + double y = crystal.fY; + if( fabs( crystal.fZ ) > 330 ) continue; + if( minX - x > 0.01 ) minX = x; + if( x - maxX > 0.01 ) maxX = x; + if( minY - y > 0.01 ) minY = y; + if( y - maxY > 0.01 ) maxY = y; } data->AddTower( minX, maxX, minY, maxY ); - // printf("EE add %f %f %f %f \n",minX, maxX, minY, maxY ); - } - data->FillSlice( slice, size ); - } - } // end loop on hits - + data->FillSlice( tower.m_slice, tower.m_height ); + } + } +} + +//--------------------------------------------------------------------------------------- + + +void +FWECALDetailViewBuilder::fillData( const EcalRecHitCollection *hits, + TEveCaloDataVec *data, bool coordinatesEtaPhi ) +{ + if (coordinatesEtaPhi) + fillDataEtaPhi(hits, data); + else + fillDataXY(hits, data); + data->DataChanged(); } From ac8caffc1e14c6eeb9c590f056132a41c4a44c2b Mon Sep 17 00:00:00 2001 From: Alja Mrak-Tadel Date: Thu, 14 Jul 2016 13:18:03 -0700 Subject: [PATCH 06/31] Add marker. --- .../Calo/interface/FWECALDetailViewBuilder.h | 9 +- Fireworks/Calo/src/FWECALDetailViewBuilder.cc | 229 +++++++++--------- 2 files changed, 126 insertions(+), 112 deletions(-) diff --git a/Fireworks/Calo/interface/FWECALDetailViewBuilder.h b/Fireworks/Calo/interface/FWECALDetailViewBuilder.h index ce141eec44b3b..383c09b14d1e3 100644 --- a/Fireworks/Calo/interface/FWECALDetailViewBuilder.h +++ b/Fireworks/Calo/interface/FWECALDetailViewBuilder.h @@ -39,7 +39,7 @@ class FWECALDetailViewBuilder { Color_t defaultColor = kMagenta+1) : m_event(event), m_geom(geom), m_eta(eta), m_phi(phi), m_size(size), - m_defaultColor(defaultColor){ + m_defaultColor(defaultColor), m_coordinatesEtaPhi(true){ } // draw the ecal information with the preset colors @@ -77,9 +77,9 @@ class FWECALDetailViewBuilder { const FWGeometry *m_geom; // the geometry float m_eta; // eta position view centred on float m_phi; // phi position view centred on - int m_size; // view half width in number of crystals + int m_size; // view half width in number of crystals Color_t m_defaultColor; // default color for crystals - + bool m_coordinatesEtaPhi; // for keeping track of what det id goes in what slice std::map m_detIdsToColor; @@ -92,4 +92,7 @@ class FWECALDetailViewBuilder { return ( lhs.eta() < rhs.eta()); } + float sizeRad() const; + float sizeXY() const; + }; diff --git a/Fireworks/Calo/src/FWECALDetailViewBuilder.cc b/Fireworks/Calo/src/FWECALDetailViewBuilder.cc index 6f5bd2de80f81..0f0656e2c1b91 100644 --- a/Fireworks/Calo/src/FWECALDetailViewBuilder.cc +++ b/Fireworks/Calo/src/FWECALDetailViewBuilder.cc @@ -99,23 +99,23 @@ TEveCaloData* FWECALDetailViewBuilder::buildCaloData(bool xyEE) // data TEveCaloDataVec* data = new TEveCaloDataVec( 1 + m_colors.size() ); + data->SetWrapTwoPi(false); data->RefSliceInfo(0).Setup("hits (not clustered)", 0.0, m_defaultColor ); for( size_t i = 0; i < m_colors.size(); ++i ) { data->RefSliceInfo(i + 1).Setup( "hits (clustered)", 0.0, m_colors[i] ); } - bool coordinatesEtaPhi = true; - // AMT should use size here ... but it is not clear in which units it is, hardcode 1 - if (xyEE && ((fabs(m_eta) - 0.2) > fireworks::Context::getInstance()->caloTransEta())) { - coordinatesEtaPhi = false; - } - printf("coordinates XY = %d \n", !coordinatesEtaPhi); + // AMT should use size here ... + if (xyEE && ((fabs(m_eta)) > fireworks::Context::getInstance()->caloTransEta())) { + m_coordinatesEtaPhi = false; + } + // printf("coordinates XY = %d \n", !m_coordinatesEtaPhi); if( handle_hits.isValid() ) { - fillData( hits, data, coordinatesEtaPhi ); + fillData( hits, data, m_coordinatesEtaPhi ); } // axis @@ -125,8 +125,8 @@ TEveCaloData* FWECALDetailViewBuilder::buildCaloData(bool xyEE) fwLog(fwlog::kWarning) <<"FWECALDetailViewBuilder::build():: No hits found in " << Form("FWECALDetailViewBuilder::build():: No hits found in eta[%f] phi[%f] region", m_eta, m_phi)<<".\n"; // add dummy background - float x = m_size*TMath::DegToRad(); - if (coordinatesEtaPhi == false ) { + float x = sizeRad(); + if (m_coordinatesEtaPhi == false ) { etaMin = m_eta -x; etaMax = m_eta +x; phiMin = m_phi -x; @@ -155,7 +155,7 @@ TEveCaloData* FWECALDetailViewBuilder::buildCaloData(bool xyEE) data->GetPhiLimits(phiMin, phiMax); // printf("data rng %f %f %f %f\n",etaMin, etaMax, phiMin, phiMax ); - if (coordinatesEtaPhi == false) { + if (m_coordinatesEtaPhi == false) { eta_axis = new TAxis(10, etaMin, etaMax); phi_axis = new TAxis(10, phiMin, phiMax); eta_axis->SetTitle("X[cm]"); @@ -205,6 +205,7 @@ TEveCaloLego* FWECALDetailViewBuilder::build() // lego TEveCaloLego *lego = new TEveCaloLego(data); + lego->SetAutoRange(false); lego->SetDrawNumberCellPixels(100); // scale and translate to real world coordinates lego->SetEta(etaMin, etaMax); @@ -217,9 +218,14 @@ TEveCaloLego* FWECALDetailViewBuilder::build() lego->Set2DMode(TEveCaloLego::kValSizeOutline); lego->SetName("ECALDetail Lego"); + TEvePointSet* ps = new TEvePointSet("vv"); - ps->SetNextPoint(m_eta, m_phi, 0.1); - ps->SetMarkerSize(0.1); + ps->SetNextPoint(m_eta, m_phi, 0.01); + if (m_coordinatesEtaPhi) + ps->SetMarkerSize(0.05); + else + ps->SetMarkerSize(3); + ps->SetMarkerStyle(2); ps->SetMainColor(kGreen); ps->SetMarkerColor(kGreen); @@ -287,8 +293,8 @@ FWECALDetailViewBuilder::showSuperClusters( Color_t color1, Color_t color2 ) std::sort( sorted.begin(), sorted.end(), superClusterEtaLess ); for( size_t i = 0; i < sorted.size(); ++i ) { - if( !(fabs(sorted[i].eta() - m_eta) < (m_size*0.0172) - && fabs(sorted[i].phi() - m_phi) < (m_size*0.0172)) ) + if( !(fabs(sorted[i].eta() - m_eta) < sizeRad() + && fabs(sorted[i].phi() - m_phi) < sizeRad()) ) continue; if( colorIndex %2 == 0 ) @@ -340,110 +346,103 @@ namespace { void FWECALDetailViewBuilder::fillDataEtaPhi( const EcalRecHitCollection *hits,TEveCaloDataVec *data) { - const float area = m_size*0.0172; // barrel cell range, AMT this is available in context - printf("area size %f \n", area ); - - int cntt = 0; - for( EcalRecHitCollection::const_iterator k = hits->begin(); k != hits->end(); ++k) - { - if( k->id().subdetId() != EcalBarrel) - continue; // AMT is this necessary ? - - DetIdTower tower(*k, m_geom, m_detIdsToColor); - if (tower.m_points) - { - float centerEta = tower.m_center.Eta(); - float centerPhi = tower.m_center.Phi(); - /* - - // do phi wrapping - if( centerPhi > m_phi + M_PI) centerPhi -= 2 * M_PI; - if( centerPhi < m_phi - M_PI) centerPhi += 2 * M_PI; - - - // calorimeter crystalls have slightly non-symetrical form in eta-phi projection - // so if we simply get the largest eta and phi, cells will overlap - // therefore we get a smaller eta-phi range representing the inner square - // we also should use only points from the inner face of the crystal, since - // non-projecting direction of crystals leads to large shift in eta on outter - // face. - */ - float eps = 0.005; - double minEta(10), maxEta(-10), minPhi(4), maxPhi(-4); - /* - int j = 0; - for( unsigned int i = 0; i < 8; ++i ) - { - TEveVector crystal( tower.m_points[j], tower.m_points[j + 1], tower.m_points[j + 2] ); - j += 3; - double eta = crystal.Eta(); - double phi = crystal.Phi(); - if ( ((k->id().subdetId() == EcalBarrel) && (crystal.Perp() > 135) )|| ((k->id().subdetId() == EcalEndcap) && (crystal.Perp() > 155))) continue; - if ( minEta - eta > eps) minEta = eta; - if ( eta - minEta > 0 && eta - minEta < eps ) minEta = eta; - if ( eta - maxEta > eps) maxEta = eta; - if ( maxEta - eta > 0 && maxEta - eta < eps ) maxEta = eta; - if ( minPhi - phi > eps) minPhi = phi; - if ( phi - minPhi > 0 && phi - minPhi < eps ) minPhi = phi; - if ( phi - maxPhi > eps) maxPhi = phi; - if ( maxPhi - phi > 0 && maxPhi - phi < eps ) maxPhi = phi; - } - */ + const float area = sizeRad(); // barrel cell range, AMT this is available in context - minEta = centerEta - eps; - maxEta = centerEta + eps; - minPhi = centerPhi - eps; - maxPhi = centerPhi + eps; + for( EcalRecHitCollection::const_iterator k = hits->begin(); k != hits->end(); ++k) + { + if( k->id().subdetId() != EcalBarrel) + continue; // AMT is this necessary ? + + DetIdTower tower(*k, m_geom, m_detIdsToColor); + if (tower.m_points) + { + /* + + float centerEta = tower.m_center.Eta(); + float centerPhi = tower.m_center.Phi(); + // do phi wrapping + if( centerPhi > m_phi + M_PI) centerPhi -= 2 * M_PI; + if( centerPhi < m_phi - M_PI) centerPhi += 2 * M_PI; + */ + + // calorimeter crystalls have slightly non-symetrical form in eta-phi projection + // so if we simply get the largest eta and phi, cells will overlap + // therefore we get a smaller eta-phi range representing the inner square + // we also should use only points from the inner face of the crystal, since + // non-projecting direction of crystals leads to large shift in eta on outter + // face. + - if( minPhi >= ( m_phi - area ) && maxPhi <= ( m_phi + area ) && - minEta >= ( m_eta - area ) && maxEta <= ( m_eta + area )) - { - tower.m_center.Dump(); - // printf("add (%f %f %f %f ) , value = %f\n",minEta, maxEta, minPhi, maxPhi, tower.m_height ); - data->AddTower( tower.m_center.Eta() -eps, tower.m_center.Eta() + eps, tower.m_center.Phi() -eps,tower.m_center.Phi() +eps ); - data->FillSlice( tower.m_slice, tower.m_height ); - cntt++; - } - } - } - printf("added %d towers \n", cntt); -} + + float eps = 0.005; + double minEta(10), maxEta(-10), minPhi(4), maxPhi(-4); + int j = 0; + for( unsigned int i = 0; i < 8; ++i ) + { + TEveVector crystal( tower.m_points[j], tower.m_points[j + 1], tower.m_points[j + 2] ); + j += 3; + double eta = crystal.Eta(); + double phi = crystal.Phi(); + if ( ((k->id().subdetId() == EcalBarrel) && (crystal.Perp() > 135) )|| ((k->id().subdetId() == EcalEndcap) && (crystal.Perp() > 155))) continue; + if ( minEta - eta > eps) minEta = eta; + if ( eta - minEta > 0 && eta - minEta < eps ) minEta = eta; + if ( eta - maxEta > eps) maxEta = eta; + if ( maxEta - eta > 0 && maxEta - eta < eps ) maxEta = eta; + if ( minPhi - phi > eps) minPhi = phi; + if ( phi - minPhi > 0 && phi - minPhi < eps ) minPhi = phi; + if ( phi - maxPhi > eps) maxPhi = phi; + if ( maxPhi - phi > 0 && maxPhi - phi < eps ) maxPhi = phi; + } + + if( minPhi >= ( m_phi - area ) && maxPhi <= ( m_phi + area ) && + minEta >= ( m_eta - area ) && maxEta <= ( m_eta + area )) + { + // printf("add (%f %f %f %f ) , value = %f\n",minEta, maxEta, minPhi, maxPhi, tower.m_height ); + // data->AddTower( tower.m_center.Eta() -eps, tower.m_center.Eta() + eps, tower.m_center.Phi() -eps,tower.m_center.Phi() +eps ); + + data->AddTower( minEta, maxEta, minPhi, maxPhi ); + data->FillSlice( tower.m_slice, tower.m_height ); + } // in rng + } // pnts + } // loop hits +} + void FWECALDetailViewBuilder::fillDataXY( const EcalRecHitCollection *hits,TEveCaloDataVec *data) { - double crystalSize = m_size /** TMath::DegToRad()*/; // AMT this should be legoXYSize + double crystalSize = sizeXY(); - for( EcalRecHitCollection::const_iterator k = hits->begin(); k != hits->end(); ++k) - { - DetIdTower tower(*k, m_geom, m_detIdsToColor); + for( EcalRecHitCollection::const_iterator k = hits->begin(); k != hits->end(); ++k) + { + DetIdTower tower(*k, m_geom, m_detIdsToColor); - // check if the hit is in the window to be drawn - if( !( fabs( tower.m_center.Eta() - m_eta ) < ( crystalSize ) - && fabs( tower.m_center.Phi() - m_phi ) < ( crystalSize ))) - continue; + // check if the hit is in the window to be drawn + if( !( fabs( tower.m_center.Eta() - m_eta ) < ( crystalSize ) + && fabs( tower.m_center.Phi() - m_phi ) < ( crystalSize ))) + continue; - if( tower.m_points != 0 ) - { - double minX(9999), maxX(-9999), minY(9999), maxY(-9999); - int j = 0; - for( unsigned int i = 0; i < 8; ++i ) - { - TEveVector crystal( tower.m_points[j], tower.m_points[j + 1], tower.m_points[j + 2] ); - j += 3; - double x = crystal.fX; - double y = crystal.fY; - if( fabs( crystal.fZ ) > 330 ) continue; - if( minX - x > 0.01 ) minX = x; - if( x - maxX > 0.01 ) maxX = x; - if( minY - y > 0.01 ) minY = y; - if( y - maxY > 0.01 ) maxY = y; - } - data->AddTower( minX, maxX, minY, maxY ); - data->FillSlice( tower.m_slice, tower.m_height ); - } - } + if( tower.m_points != 0 ) + { + double minX(9999), maxX(-9999), minY(9999), maxY(-9999); + int j = 0; + for( unsigned int i = 0; i < 8; ++i ) + { + TEveVector crystal( tower.m_points[j], tower.m_points[j + 1], tower.m_points[j + 2] ); + j += 3; + double x = crystal.fX; + double y = crystal.fY; + if( fabs( crystal.fZ ) > 330 ) continue; + if( minX - x > 0.01 ) minX = x; + if( x - maxX > 0.01 ) maxX = x; + if( minY - y > 0.01 ) minY = y; + if( y - maxY > 0.01 ) maxY = y; + } + data->AddTower( minX, maxX, minY, maxY ); + data->FillSlice( tower.m_slice, tower.m_height ); + } + } } //--------------------------------------------------------------------------------------- @@ -453,7 +452,7 @@ void FWECALDetailViewBuilder::fillData( const EcalRecHitCollection *hits, TEveCaloDataVec *data, bool coordinatesEtaPhi ) { - if (coordinatesEtaPhi) + if (m_coordinatesEtaPhi) fillDataEtaPhi(hits, data); else fillDataXY(hits, data); @@ -507,3 +506,15 @@ FWECALDetailViewBuilder::makeLegend( double x0, double y0, return y; } +//______________________________________________________________________________ +float FWECALDetailViewBuilder::sizeXY() const +{ + return m_size*0.5; +} + +float FWECALDetailViewBuilder::sizeRad() const +{ + float rs = m_size * TMath::DegToRad(); + return rs; +} + From 60157f24c2c1411711965ed070a3f9f91cd17e05 Mon Sep 17 00:00:00 2001 From: Alja Mrak-Tadel Date: Fri, 15 Jul 2016 11:20:58 -0700 Subject: [PATCH 07/31] Handle numeric errors around -Pi , Pi. --- Fireworks/Calo/src/FWECALDetailViewBuilder.cc | 99 ++++++++++++------- 1 file changed, 64 insertions(+), 35 deletions(-) diff --git a/Fireworks/Calo/src/FWECALDetailViewBuilder.cc b/Fireworks/Calo/src/FWECALDetailViewBuilder.cc index 0f0656e2c1b91..403d38707fa9a 100644 --- a/Fireworks/Calo/src/FWECALDetailViewBuilder.cc +++ b/Fireworks/Calo/src/FWECALDetailViewBuilder.cc @@ -108,7 +108,7 @@ TEveCaloData* FWECALDetailViewBuilder::buildCaloData(bool xyEE) // AMT should use size here ... - if (xyEE && ((fabs(m_eta)) > fireworks::Context::getInstance()->caloTransEta())) { + if (xyEE == false || ((fabs(m_eta)) > fireworks::Context::getInstance()->caloTransEta())) { m_coordinatesEtaPhi = false; } @@ -135,8 +135,13 @@ TEveCaloData* FWECALDetailViewBuilder::buildCaloData(bool xyEE) } else { - float theta = TEveCaloData::EtaToTheta(m_eta); - float r = TMath::Tan(theta) * 290; + float r = 1; + // add if for AOD METs in barrel at eta == 0 + if (fabs(m_eta) > 0.01) { + float theta = TEveCaloData::EtaToTheta(m_eta); + r = TMath::Tan(theta) * 290; + } + else phiMin = r * TMath::Cos(m_phi - x) -300; phiMax = r * TMath::Cos(m_phi + x) + 300; etaMin = r * TMath::Sin(m_phi - x) - 300; @@ -316,13 +321,13 @@ namespace { if( m_points != 0 ) { int j = 0; - for( int i = 0; i < 8; ++i ) + for( int i = 0; i < 4; ++i ) { m_center += TEveVector( m_points[j], m_points[j + 1], m_points[j + 2] ); j +=3; } - m_center *= 1.f/8.0f; + m_center *= 1.f/4.0f; } else fwLog( fwlog::kInfo ) << "cannot get geometry for DetId: "<< hit.id().rawId() << ". Ignored.\n"; @@ -348,46 +353,61 @@ FWECALDetailViewBuilder::fillDataEtaPhi( const EcalRecHitCollection *hits,TEveCa { const float area = sizeRad(); // barrel cell range, AMT this is available in context + float eps = 0.005; + + double eta1 = m_eta - area; + double eta2 = m_eta + area; + + double phi1 = m_phi - area; + double phi2 = m_phi + area; + + + + // check if we are in -Pi|Pi area + int wrapPhi = 0; + if (TMath::Abs(phi1) > TMath::Pi() || TMath::Abs(phi2) > TMath::Pi()) { + wrapPhi = m_phi > 0 ? 1 : -1; + //printf("wrap phi %d \n", wrapPhi); + //printf("phi range [%f, %f]\n", phi1, phi2); + } + for( EcalRecHitCollection::const_iterator k = hits->begin(); k != hits->end(); ++k) { - if( k->id().subdetId() != EcalBarrel) - continue; // AMT is this necessary ? - DetIdTower tower(*k, m_geom, m_detIdsToColor); if (tower.m_points) { - /* - - float centerEta = tower.m_center.Eta(); - float centerPhi = tower.m_center.Phi(); - // do phi wrapping - if( centerPhi > m_phi + M_PI) centerPhi -= 2 * M_PI; - if( centerPhi < m_phi - M_PI) centerPhi += 2 * M_PI; - */ + // float centerEta = tower.m_center.Eta(); + float centerPhi = tower.m_center.Phi(); // calorimeter crystalls have slightly non-symetrical form in eta-phi projection // so if we simply get the largest eta and phi, cells will overlap // therefore we get a smaller eta-phi range representing the inner square // we also should use only points from the inner face of the crystal, since // non-projecting direction of crystals leads to large shift in eta on outter - // face. - - - float eps = 0.005; - double minEta(10), maxEta(-10), minPhi(4), maxPhi(-4); - int j = 0; - for( unsigned int i = 0; i < 8; ++i ) + double minEta(10), maxEta(-10), minPhi(6), maxPhi(-6); + for( unsigned int i = 0; i < 4; ++i ) { - TEveVector crystal( tower.m_points[j], tower.m_points[j + 1], tower.m_points[j + 2] ); - j += 3; + + TEveVector crystal( tower.m_points[i*3], tower.m_points[i*3 + 1], tower.m_points[i*3 + 2] ); double eta = crystal.Eta(); - double phi = crystal.Phi(); - if ( ((k->id().subdetId() == EcalBarrel) && (crystal.Perp() > 135) )|| ((k->id().subdetId() == EcalEndcap) && (crystal.Perp() > 155))) continue; if ( minEta - eta > eps) minEta = eta; if ( eta - minEta > 0 && eta - minEta < eps ) minEta = eta; if ( eta - maxEta > eps) maxEta = eta; if ( maxEta - eta > 0 && maxEta - eta < eps ) maxEta = eta; + + + + // there are bins running exactly in the middle of Pi + double phi = crystal.Phi(); + + + if (fabs(fabs(centerPhi) -TMath::Pi()) < 0.06 ){ + // if (dump) printf("fixing phi %f, ceneter %f\n", phi, centerPhi); + if (centerPhi < 0 && phi > 0 ) phi -= TMath::TwoPi(); + if (centerPhi > 0 && phi < 0 ) phi += TMath::TwoPi(); + } + if ( minPhi - phi > eps) minPhi = phi; if ( phi - minPhi > 0 && phi - minPhi < eps ) minPhi = phi; if ( phi - maxPhi > eps) maxPhi = phi; @@ -395,17 +415,26 @@ FWECALDetailViewBuilder::fillDataEtaPhi( const EcalRecHitCollection *hits,TEveCa } - - if( minPhi >= ( m_phi - area ) && maxPhi <= ( m_phi + area ) && - minEta >= ( m_eta - area ) && maxEta <= ( m_eta + area )) - { + + if ((minEta > eta1 && maxEta < eta2) == false ) + continue; + + + bool passPhi = (centerPhi > phi1 && centerPhi < phi2 ); + if (!passPhi && wrapPhi) { + centerPhi += wrapPhi * TMath::TwoPi();; + minPhi += wrapPhi * TMath::TwoPi(); + maxPhi += wrapPhi * TMath::TwoPi(); + passPhi = (centerPhi > phi1 && centerPhi < phi2 ); + } + + if (passPhi) { // printf("add (%f %f %f %f ) , value = %f\n",minEta, maxEta, minPhi, maxPhi, tower.m_height ); - // data->AddTower( tower.m_center.Eta() -eps, tower.m_center.Eta() + eps, tower.m_center.Phi() -eps,tower.m_center.Phi() +eps ); - data->AddTower( minEta, maxEta, minPhi, maxPhi ); data->FillSlice( tower.m_slice, tower.m_height ); - } // in rng - } // pnts + } + + } // if have geom } // loop hits } From b4765bde67607a1f6d7df33f94cd85cc84d7c051 Mon Sep 17 00:00:00 2001 From: Alja Mrak-Tadel Date: Fri, 15 Jul 2016 11:37:43 -0700 Subject: [PATCH 08/31] Remove debug print. --- Fireworks/Core/src/FWColorManager.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/Fireworks/Core/src/FWColorManager.cc b/Fireworks/Core/src/FWColorManager.cc index 3bc659e3da491..284999de557d7 100644 --- a/Fireworks/Core/src/FWColorManager.cc +++ b/Fireworks/Core/src/FWColorManager.cc @@ -251,7 +251,6 @@ void FWColorManager::setBackgroundAndBrightness(BackgroundColorIndex iIndex, int b) { m_gammaOff = -b*0.1f; - printf("set brightnes %f\n", m_gammaOff); setBackgroundColorIndex(iIndex); } From 8284ebd63ffe109dd3276315ecc04ea825b2e72c Mon Sep 17 00:00:00 2001 From: Alja Mrak-Tadel Date: Fri, 15 Jul 2016 14:10:44 -0700 Subject: [PATCH 09/31] set orthographic camera by the default. --- Fireworks/Calo/src/FWECALDetailViewBase.icc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Fireworks/Calo/src/FWECALDetailViewBase.icc b/Fireworks/Calo/src/FWECALDetailViewBase.icc index 5affa17c7b33d..c6afb7a4b8ad5 100644 --- a/Fireworks/Calo/src/FWECALDetailViewBase.icc +++ b/Fireworks/Calo/src/FWECALDetailViewBase.icc @@ -72,7 +72,7 @@ void FWECALDetailViewBase::build( const FWModelId &id, const T* element ) FWDetailViewGL::viewerGL()->AddOverlayElement( overlay ); } // set event handler and flip camera to top view at beginning - FWDetailViewGL::viewerGL()->SetCurrentCamera( TGLViewer::kCameraPerspXOY ); + FWDetailViewGL::viewerGL()->SetCurrentCamera( TGLViewer::kCameraOrthoXOY ); FWGLEventHandler* eh = new FWGLEventHandler( (TGWindow*) FWDetailViewGL::viewerGL()->GetGLWidget(), (TObject*) FWDetailViewGL::viewerGL(), lego ); FWDetailViewGL::viewerGL()->SetEventHandler( eh ); From 3cda059379daec7ecc6706415dba862f09ed2827 Mon Sep 17 00:00:00 2001 From: Alja Mrak-Tadel Date: Fri, 15 Jul 2016 14:15:49 -0700 Subject: [PATCH 10/31] draw EB and EE. --- Fireworks/Calo/interface/FWECALDetailViewBuilder.h | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Fireworks/Calo/interface/FWECALDetailViewBuilder.h b/Fireworks/Calo/interface/FWECALDetailViewBuilder.h index 383c09b14d1e3..33f3ed2b1bb07 100644 --- a/Fireworks/Calo/interface/FWECALDetailViewBuilder.h +++ b/Fireworks/Calo/interface/FWECALDetailViewBuilder.h @@ -66,12 +66,10 @@ class FWECALDetailViewBuilder { private: // fill data - void fillData(const EcalRecHitCollection *hits, - TEveCaloDataVec *data, bool xyEE); - + void fillData(TEveCaloDataVec *data); - void fillDataEtaPhi(const EcalRecHitCollection *hits, TEveCaloDataVec *data); - void fillDataXY(const EcalRecHitCollection *hits, TEveCaloDataVec *data); + void fillEtaPhi(const EcalRecHitCollection *hits, TEveCaloDataVec *data); + void fillXY(const EcalRecHitCollection *hits, TEveCaloDataVec *data); const edm::EventBase *m_event; // the event const FWGeometry *m_geom; // the geometry From 3330fba2a0bccb12fb157663ec93b0a11904f2e9 Mon Sep 17 00:00:00 2001 From: Alja Mrak-Tadel Date: Fri, 15 Jul 2016 14:16:08 -0700 Subject: [PATCH 11/31] comment out marker --- Fireworks/Calo/src/FWECALDetailViewBuilder.cc | 212 +++++++++--------- 1 file changed, 112 insertions(+), 100 deletions(-) diff --git a/Fireworks/Calo/src/FWECALDetailViewBuilder.cc b/Fireworks/Calo/src/FWECALDetailViewBuilder.cc index 403d38707fa9a..cbf2950dac812 100644 --- a/Fireworks/Calo/src/FWECALDetailViewBuilder.cc +++ b/Fireworks/Calo/src/FWECALDetailViewBuilder.cc @@ -32,71 +32,6 @@ TEveCaloData* FWECALDetailViewBuilder::buildCaloData(bool xyEE) { // get the hits from the event - edm::Handle handle_hits; - const EcalRecHitCollection *hits = 0; - - if (fabs(m_eta) < 1.5) - { - try - { - edm::InputTag tag("ecalRecHit", "EcalRecHitsEB"); - m_event->getByLabel(tag, handle_hits); - if (handle_hits.isValid()) - { - hits = &*handle_hits; - } - } - catch (...) - { - fwLog(fwlog::kWarning) <<"FWECALDetailViewBuilder::build():: Failed to access EcalRecHitsEB collection." << std::endl; - } - if ( ! handle_hits.isValid()) { - try{ - edm::InputTag tag("reducedEcalRecHitsEB"); - m_event->getByLabel(tag, handle_hits); - if (handle_hits.isValid()) - { - hits = &*handle_hits; - } - - } - catch (...) - { - fwLog(fwlog::kWarning) <<"FWECALDetailViewBuilder::build():: Failed to access reducedEcalRecHitsEB collection." << std::endl; - } - } - } - else - { - try - { - edm::InputTag tag("ecalRecHit", "EcalRecHitsEE"); - m_event->getByLabel(tag, handle_hits); - if (handle_hits.isValid()) - hits = &*handle_hits; - } - catch (...) - { - fwLog(fwlog::kWarning) <<"FWECALDetailViewBuilder::build():: Failed to access ecalRecHitsEE collection." << std::endl; - } - - if ( ! handle_hits.isValid()) { - try { - edm::InputTag tag("reducedEcalRecHitsEE"); - m_event->getByLabel(tag, handle_hits); - if (handle_hits.isValid()) - { - hits = &*handle_hits; - } - - } - catch (...) - { - fwLog(fwlog::kWarning) <<"FWECALDetailViewBuilder::build():: Failed to access reducedEcalRecHitsEE collection." << std::endl; - } - } - } - // data TEveCaloDataVec* data = new TEveCaloDataVec( 1 + m_colors.size() ); data->SetWrapTwoPi(false); @@ -107,16 +42,13 @@ TEveCaloData* FWECALDetailViewBuilder::buildCaloData(bool xyEE) } - // AMT should use size here ... if (xyEE == false || ((fabs(m_eta)) > fireworks::Context::getInstance()->caloTransEta())) { m_coordinatesEtaPhi = false; } - // printf("coordinates XY = %d \n", !m_coordinatesEtaPhi); - if( handle_hits.isValid() ) - { - fillData( hits, data, m_coordinatesEtaPhi ); - } + //printf("coordinates (m_eta = %f) coordinatesXY = %d \n",m_eta, !m_coordinatesEtaPhi); + + fillData(data); // axis Double_t etaMin(0), etaMax(0), phiMin(0), phiMax(0); @@ -223,19 +155,23 @@ TEveCaloLego* FWECALDetailViewBuilder::build() lego->Set2DMode(TEveCaloLego::kValSizeOutline); lego->SetName("ECALDetail Lego"); - - TEvePointSet* ps = new TEvePointSet("vv"); - ps->SetNextPoint(m_eta, m_phi, 0.01); - if (m_coordinatesEtaPhi) + /* + TEvePointSet* ps = new TEvePointSet("origin"); + if (m_coordinatesEtaPhi) { + ps->SetNextPoint(m_eta, m_phi, 0.01); ps->SetMarkerSize(0.05); - else - ps->SetMarkerSize(3); - + } + else { + float theta = TEveCaloData::EtaToTheta(m_eta); + double r = TMath::Tan(theta) * 315; + ps->SetNextPoint(r*TMath::Cos(m_phi), r*TMath::Sin(m_phi), 0.01); + ps->SetMarkerSize(3); + } ps->SetMarkerStyle(2); ps->SetMainColor(kGreen); ps->SetMarkerColor(kGreen); lego->AddElement(ps); - + */ return lego; @@ -349,7 +285,7 @@ namespace { //------------------------------------------------------------------ void -FWECALDetailViewBuilder::fillDataEtaPhi( const EcalRecHitCollection *hits,TEveCaloDataVec *data) +FWECALDetailViewBuilder::fillEtaPhi( const EcalRecHitCollection *hits,TEveCaloDataVec *data) { const float area = sizeRad(); // barrel cell range, AMT this is available in context @@ -439,30 +375,34 @@ FWECALDetailViewBuilder::fillDataEtaPhi( const EcalRecHitCollection *hits,TEveCa } void -FWECALDetailViewBuilder::fillDataXY( const EcalRecHitCollection *hits,TEveCaloDataVec *data) +FWECALDetailViewBuilder::fillXY( const EcalRecHitCollection *hits,TEveCaloDataVec *data) { - double crystalSize = sizeXY(); + double crystalSize2 = sizeXY()*sizeXY(); + float theta = TEveCaloData::EtaToTheta(m_eta); + double r = TMath::Tan(theta) * 315; + TEveVector p(r*TMath::Cos(m_phi), r*TMath::Sin(m_phi), 0.f); + + for( EcalRecHitCollection::const_iterator k = hits->begin(); k != hits->end(); ++k) { DetIdTower tower(*k, m_geom, m_detIdsToColor); - - // check if the hit is in the window to be drawn - if( !( fabs( tower.m_center.Eta() - m_eta ) < ( crystalSize ) - && fabs( tower.m_center.Phi() - m_phi ) < ( crystalSize ))) - continue; - + + if( (k->id().subdetId() == EcalBarrel) && fabs( tower.m_center.Eta() - m_eta ) > sizeRad() ) continue; + if( (k->id().subdetId() == EcalBarrel) && fabs( tower.m_center.Phi() - m_phi ) > sizeRad() ) continue; + + TEveVector t2( tower.m_points[0], tower.m_points[1], 0); + TEveVector d = p; d -= t2; + if (d.Mag2() > crystalSize2) continue; + if( tower.m_points != 0 ) { double minX(9999), maxX(-9999), minY(9999), maxY(-9999); - int j = 0; - for( unsigned int i = 0; i < 8; ++i ) + for( unsigned int i = 0; i < 4; ++i ) { - TEveVector crystal( tower.m_points[j], tower.m_points[j + 1], tower.m_points[j + 2] ); - j += 3; + TEveVector crystal( tower.m_points[3*i], tower.m_points[3*i + 1], tower.m_points[3*i + 2] ); double x = crystal.fX; double y = crystal.fY; - if( fabs( crystal.fZ ) > 330 ) continue; if( minX - x > 0.01 ) minX = x; if( x - maxX > 0.01 ) maxX = x; if( minY - y > 0.01 ) minY = y; @@ -478,13 +418,85 @@ FWECALDetailViewBuilder::fillDataXY( const EcalRecHitCollection *hits,TEveCaloDa void -FWECALDetailViewBuilder::fillData( const EcalRecHitCollection *hits, - TEveCaloDataVec *data, bool coordinatesEtaPhi ) +FWECALDetailViewBuilder::fillData( TEveCaloDataVec *data) { - if (m_coordinatesEtaPhi) - fillDataEtaPhi(hits, data); - else - fillDataXY(hits, data); + + { // barrel + const EcalRecHitCollection *hitsEB = 0; + edm::Handle handle_hitsEB; + try + { + edm::InputTag tag("ecalRecHit", "EcalRecHitsEB"); + m_event->getByLabel(tag, handle_hitsEB); + if (handle_hitsEB.isValid()) + { + hitsEB = &*handle_hitsEB; + } + } + catch (...) + { + fwLog(fwlog::kWarning) <<"FWECALDetailViewBuilder::build():: Failed to access EcalRecHitsEB collection." << std::endl; + } + if ( ! handle_hitsEB.isValid()) { + try{ + edm::InputTag tag("reducedEcalRecHitsEB"); + m_event->getByLabel(tag, handle_hitsEB); + if (handle_hitsEB.isValid()) + { + hitsEB = &*handle_hitsEB; + } + + } + catch (...) + { + fwLog(fwlog::kWarning) <<"FWECALDetailViewBuilder::build():: Failed to access reducedEcalRecHitsEB collection." << std::endl; + } + } + + if( handle_hitsEB.isValid() ) + { + m_coordinatesEtaPhi ? fillEtaPhi( hitsEB, data) : fillXY( hitsEB, data ); + } + } + + {// endcap + + const EcalRecHitCollection *hitsEE = 0; + edm::Handle handle_hitsEE; + try + { + edm::InputTag tag("ecalRecHit", "EcalRecHitsEE"); + m_event->getByLabel(tag, handle_hitsEE); + if (handle_hitsEE.isValid()) + hitsEE = &*handle_hitsEE; + } + catch (...) + { + fwLog(fwlog::kWarning) <<"FWECALDetailViewBuilder::build():: Failed to access ecalRecHitsEE collection." << std::endl; + } + + if ( ! handle_hitsEE.isValid()) { + try { + edm::InputTag tag("reducedEcalRecHitsEE"); + m_event->getByLabel(tag, handle_hitsEE); + if (handle_hitsEE.isValid()) + { + hitsEE = &*handle_hitsEE; + } + + } + catch (...) + { + fwLog(fwlog::kWarning) <<"FWECALDetailViewBuilder::build():: Failed to access reducedEcalRecHitsEE collection." << std::endl; + } + + } + + if( handle_hitsEE.isValid() ) + { + m_coordinatesEtaPhi ? fillEtaPhi( hitsEE, data) : fillXY( hitsEE, data); + } + } data->DataChanged(); } @@ -538,7 +550,7 @@ FWECALDetailViewBuilder::makeLegend( double x0, double y0, //______________________________________________________________________________ float FWECALDetailViewBuilder::sizeXY() const { - return m_size*0.5; + return m_size *1.5; } float FWECALDetailViewBuilder::sizeRad() const From b2856697aa5a68534c4740e3cd192b86e7221809 Mon Sep 17 00:00:00 2001 From: Alja Mrak-Tadel Date: Thu, 21 Jul 2016 13:46:06 -0700 Subject: [PATCH 12/31] Draw TEvBox for tower. Leave TEveCaloData empty. --- Fireworks/Calo/interface/FWBoxRecHit.h | 70 +++ .../Calo/interface/FWECALDetailViewBuilder.h | 18 +- Fireworks/Calo/src/FWBoxRecHit.cc | 192 +++++++++ Fireworks/Calo/src/FWECALDetailViewBuilder.cc | 406 ++++++++---------- 4 files changed, 443 insertions(+), 243 deletions(-) create mode 100644 Fireworks/Calo/interface/FWBoxRecHit.h create mode 100644 Fireworks/Calo/src/FWBoxRecHit.cc diff --git a/Fireworks/Calo/interface/FWBoxRecHit.h b/Fireworks/Calo/interface/FWBoxRecHit.h new file mode 100644 index 0000000000000..207fd2d5e9380 --- /dev/null +++ b/Fireworks/Calo/interface/FWBoxRecHit.h @@ -0,0 +1,70 @@ +#ifndef _FWBOXRECHIT_H_ +#define _FWBOXRECHIT_H_ + +// -*- C++ -*- +// +// Package: ParticleFlow +// Class : FWBoxRecHit +// +// Implementation: +// +// +// Original Author: Simon Harris +// + +// System include files +#include "TEveBox.h" +#include "TEveCompound.h" +#include "TEveStraightLineSet.h" + +#include "TEveCaloData.h" +#include "TEveChunkManager.h" + +// User include files +#include "Fireworks/Core/interface/FWViewContext.h" +#include "Fireworks/Core/interface/FWViewEnergyScale.h" +#include "Fireworks/Core/interface/Context.h" + +// Forward declarations +class FWProxyBuilderBase; + +//----------------------------------------------------------------------------- +// FWBoxRechHit +//----------------------------------------------------------------------------- +class FWBoxRecHit +{ + public: + // ---------------- Constructor(s)/Destructor ---------------------- + FWBoxRecHit( const std::vector &corners, TEveElement *comp,float e , float et); + virtual ~FWBoxRecHit(){} + + // --------------------- Member Functions -------------------------- + void updateScale( float scale, float maxLogVal, bool plotEt); + void setSquareColor( Color_t c ) { m_ls->SetMarkerColor(c); m_ls->SetLineColor(kBlack); } + + TEveBox *getTower() { return m_tower; } + void setLine(int idx, float x1, float y1, float z1, float x2, float y2, float z2); + void addLine( float x1, float y1, float z1, float x2, float y2, float z2 ); + void addLine( const TEveVector &v1, const TEveVector &v2 ); + float getEnergy( bool b ) const { return b ? m_et : m_energy; } + bool isTallest() const { return m_isTallest; } + void setIsTallest( ); + + private: + FWBoxRecHit( const FWBoxRecHit& ); // Disable default + const FWBoxRecHit& operator=( const FWBoxRecHit& ); // Disable default + + // --------------------- Member Functions -------------------------- + void setupEveBox( std::vector &corners, float scale ); + void buildTower( const std::vector &corners); + void buildLineSet( const std::vector &corners); + + // ----------------------- Data Members ---------------------------- + TEveBox *m_tower; + TEveStraightLineSet *m_ls; + float m_energy; + float m_et; + bool m_isTallest; +}; +#endif +//=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_ diff --git a/Fireworks/Calo/interface/FWECALDetailViewBuilder.h b/Fireworks/Calo/interface/FWECALDetailViewBuilder.h index 33f3ed2b1bb07..d58cdae246e1b 100644 --- a/Fireworks/Calo/interface/FWECALDetailViewBuilder.h +++ b/Fireworks/Calo/interface/FWECALDetailViewBuilder.h @@ -5,6 +5,7 @@ #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" #include "DataFormats/EgammaReco/interface/SuperClusterFwd.h" #include "DataFormats/CaloRecHit/interface/CaloClusterFwd.h" +#include "Fireworks/Calo/interface/FWBoxRecHit.h" namespace edm { class EventBase; @@ -35,12 +36,8 @@ class FWECALDetailViewBuilder { // the half width of the region (in indices, e.g. iEta) and // the default color for the hits. FWECALDetailViewBuilder(const edm::EventBase *event, const FWGeometry* geom, - float eta, float phi, int size = 50, - Color_t defaultColor = kMagenta+1) - : m_event(event), m_geom(geom), - m_eta(eta), m_phi(phi), m_size(size), - m_defaultColor(defaultColor), m_coordinatesEtaPhi(true){ - } + float eta, float phi, int size = 50 , Color_t defaultColor = kMagenta+1); + // draw the ecal information with the preset colors // (if any colors have been preset) @@ -69,7 +66,6 @@ class FWECALDetailViewBuilder { void fillData(TEveCaloDataVec *data); void fillEtaPhi(const EcalRecHitCollection *hits, TEveCaloDataVec *data); - void fillXY(const EcalRecHitCollection *hits, TEveCaloDataVec *data); const edm::EventBase *m_event; // the event const FWGeometry *m_geom; // the geometry @@ -77,13 +73,19 @@ class FWECALDetailViewBuilder { float m_phi; // phi position view centred on int m_size; // view half width in number of crystals Color_t m_defaultColor; // default color for crystals - bool m_coordinatesEtaPhi; + + + std::vector m_boxes; + // for keeping track of what det id goes in what slice std::map m_detIdsToColor; // for keeping track of the colors to use for each slice std::vector m_colors; + + TEveElement* m_towerList; + // sorting function to sort super clusters by eta. static bool superClusterEtaLess(const reco::CaloCluster &lhs, const reco::CaloCluster &rhs) { diff --git a/Fireworks/Calo/src/FWBoxRecHit.cc b/Fireworks/Calo/src/FWBoxRecHit.cc new file mode 100644 index 0000000000000..c3da259885631 --- /dev/null +++ b/Fireworks/Calo/src/FWBoxRecHit.cc @@ -0,0 +1,192 @@ +#include "Fireworks/Calo/interface/FWBoxRecHit.h" +#include "Fireworks/Core/interface/Context.h" +#include "Fireworks/Core/interface/FWViewEnergyScale.h" +#include "Fireworks/Core/interface/CmsShowCommon.h" + + +//______________________________________________________________________________ +FWBoxRecHit::FWBoxRecHit( const std::vector &corners, TEveElement *comp,float e , float et): + m_tower(0), m_ls(0), m_energy(e), m_et(et), m_isTallest(false) +{ + buildTower( corners); + buildLineSet( corners); + + comp->AddElement( m_tower); + comp->AddElement( m_ls ); +} + +//______________________________________________________________________________ +/* + FWViewEnergyScale* + FWBoxRecHit::getEnergyScale() const + { + return fireworks::Context::getInstance()->commonPrefs()->getEnergyScale(); + } +*/ + +//______________________________________________________________________________ +void +FWBoxRecHit::setupEveBox( std::vector &corners, float scale ) +{ + // printf("---\n"); + // TEveVector z(0.f, 0.f, 0.f); + for( size_t i = 0; i < 4; ++i) + { + int j = i + 4; + corners[i+4].fZ = scale; + m_tower->SetVertex( i, corners[i] ); + m_tower->SetVertex( j, corners[j] ); + // printf("%ld -> %f, %f , height=%f \n",i, corners[i].fX, corners[i].fY, scale); + } + + m_tower->SetPickable( true ); + m_tower->SetDrawFrame(false); + m_tower->SetLineWidth( 1.0 ); + m_tower->SetLineColor( kBlack ); +} + +//______________________________________________________________________________ +void +FWBoxRecHit::buildTower( const std::vector &corners ) +{ + m_tower = new TEveBox( "EcalRecHitTower" ); + std::vector towerCorners = corners; + /* + FWViewEnergyScale *caloScale = 1;//getEnergyScale(); + float val = caloScale->getPlotEt() ? m_et : m_energy; + float scale = caloScale->getScaleFactorLego() * val; + + if( scale < 0 ) + scale *= -1; + */ + setupEveBox( towerCorners, 0.01f ); +} + +//______________________________________________________________________________ +void +FWBoxRecHit::buildLineSet( const std::vector &corners ) +{ + m_ls = new TEveStraightLineSet( "EcalRecHitLineSet" ); + + + + const float *data; + TEveVector c; + for( unsigned int i = 0; i < 4; ++i ) + { + data = m_tower->GetVertex( i ); + c.fX += data[0]; + c.fY += data[1]; + m_ls->AddLine( data[0], data[1], 0, data[0], data[1], 0); + + } + c *= 0.25; + + + // last line is trick to add a marker in line set + m_ls->SetMarkerStyle( 1 ); + m_ls->AddLine( c.fX, c.fY, c.fZ, c.fX, c.fY, c.fZ ); + m_ls->AddMarker( 0, 0. ); + + + m_ls->ResetBBox(); + m_ls->ComputeBBox(); + float* bb = m_ls->GetBBox(); +} + +//______________________________________________________________________________ +void +FWBoxRecHit::updateScale(float scaleFac, float maxLogVal, bool plotEt ) +{ + // FWViewEnergyScale *caloScale = getEnergyScale(); + // + //float scale = caloScale->getScaleFactorLego() * val; + + // printf("scale %f %f\n", caloScale->getValToHeight(), val); +float val = plotEt ? m_et : m_energy; + float scale = scaleFac * val; + // Reposition top points of tower + const float *data; + TEveVector c; + for( unsigned int i = 0; i < 4; ++i ) + { + data = m_tower->GetVertex( i ); + c.fX += data[0]; + c.fY += data[1]; + m_tower->SetVertex( i, data[0], data[1], 0 ); + m_tower->SetVertex( i+4, data[0], data[1], scale); + } + c *= 0.25; + if (0) c.Dump(); + + // Scale lineset + float s = log( 1 + val ) / maxLogVal; + float d = 0.5 * ( m_tower->GetVertex(1)[0] -m_tower->GetVertex(0)[0]); + d *= s; + float z = scale * 1.001; + setLine(0, c.fX - d, c.fY -d, z, c.fX + d, c.fY -d, z); + setLine(1, c.fX + d, c.fY -d, z, c.fX + d, c.fY +d, z); + setLine(2, c.fX + d, c.fY +d, z, c.fX - d, c.fY +d, z); + setLine(3, c.fX - d, c.fY +d, z, c.fX - d, c.fY -d, z); + + if( m_isTallest ) + { + if (m_ls->GetMarkerPlex().N() < 5) { + m_ls->AddLine( c.fX, c.fY, c.fZ , c.fX, c.fY, c.fZ); + m_ls->AddLine( c.fX, c.fY, c.fZ , c.fX, c.fY, c.fZ); + } + + // This is the tallest tower and hence two additional lines needs scaling + setLine( 4, c.fX - d, c.fY - d, z, c.fX + d, c.fY + d, z ); + setLine( 5, c.fX - d, c.fY + d, z, c.fX + d, c.fY - d, z ); + } + + TEveStraightLineSet::Marker_t* m = ((TEveStraightLineSet::Marker_t*)(m_ls->GetMarkerPlex().Atom(0))); + m->fV[0] = c.fX; m->fV[1] = c.fY; m->fV[2] = z; + + // stamp changed elements + + m_ls->ComputeBBox(); + // float* bb = m_ls->GetBBox(); + m_tower->StampTransBBox(); + m_ls->StampTransBBox(); +} + +//______________________________________________________________________________ +void FWBoxRecHit::setLine(int idx, float x1, float y1, float z1, float x2, float y2, float z2) +{ + // AMT: this func should go in TEveStraightLineSet class + + TEveStraightLineSet::Line_t* l = ((TEveStraightLineSet::Line_t*)(m_ls->GetLinePlex().Atom(idx))); + + l->fV1[0] = x1; + l->fV1[1] = y1; + l->fV1[2] = z1; + + l->fV2[0] = x2; + l->fV2[1] = y2; + l->fV2[2] = z2; +} + +//______________________________________________________________________________ +void +FWBoxRecHit::setIsTallest( ) +{ + m_isTallest = true; + + +} + +//______________________________________________________________________________ +void +FWBoxRecHit::addLine( float x1, float y1, float z1, float x2, float y2, float z2 ) +{ + m_ls->AddLine( x1, y1, z1, x2, y2, z2 ); +} + +//______________________________________________________________________________ +void +FWBoxRecHit::addLine( const TEveVector &v1, const TEveVector &v2 ) +{ + m_ls->AddLine(v1.fX, v1.fY, v1.fZ, v2.fX, v2.fY, v2.fZ); +} diff --git a/Fireworks/Calo/src/FWECALDetailViewBuilder.cc b/Fireworks/Calo/src/FWECALDetailViewBuilder.cc index cbf2950dac812..9ec4a5c64a03e 100644 --- a/Fireworks/Calo/src/FWECALDetailViewBuilder.cc +++ b/Fireworks/Calo/src/FWECALDetailViewBuilder.cc @@ -13,6 +13,7 @@ #include "Fireworks/Core/interface/FWDetailViewBase.h" #include "Fireworks/Calo/interface/FWECALDetailViewBuilder.h" +#include "Fireworks/Calo/interface/FWBoxRecHit.h" #include "Fireworks/Core/interface/FWGeometry.h" #include "Fireworks/Core/interface/fw3dlego_xbins.h" #include "Fireworks/Core/interface/fwLog.h" @@ -28,6 +29,17 @@ #include + +FWECALDetailViewBuilder::FWECALDetailViewBuilder(const edm::EventBase *event, const FWGeometry* geom, + float eta, float phi, int size , Color_t defaultColor) + +: m_event(event), m_geom(geom), + m_eta(eta), m_phi(phi), m_size(size), + m_defaultColor(defaultColor), m_towerList(0) +{ +} + + TEveCaloData* FWECALDetailViewBuilder::buildCaloData(bool xyEE) { // get the hits from the event @@ -42,88 +54,49 @@ TEveCaloData* FWECALDetailViewBuilder::buildCaloData(bool xyEE) } - if (xyEE == false || ((fabs(m_eta)) > fireworks::Context::getInstance()->caloTransEta())) { - m_coordinatesEtaPhi = false; - } - - //printf("coordinates (m_eta = %f) coordinatesXY = %d \n",m_eta, !m_coordinatesEtaPhi); - + fillData(data); // axis - Double_t etaMin(0), etaMax(0), phiMin(0), phiMax(0); - if (data->Empty()) - { - fwLog(fwlog::kWarning) <<"FWECALDetailViewBuilder::build():: No hits found in " << Form("FWECALDetailViewBuilder::build():: No hits found in eta[%f] phi[%f] region", m_eta, m_phi)<<".\n"; - - // add dummy background - float x = sizeRad(); - if (m_coordinatesEtaPhi == false ) { - etaMin = m_eta -x; - etaMax = m_eta +x; - phiMin = m_phi -x; - phiMax = m_phi +x; - data->AddTower(etaMin, etaMax, phiMin, phiMax); - } - else - { - float r = 1; - // add if for AOD METs in barrel at eta == 0 - if (fabs(m_eta) > 0.01) { - float theta = TEveCaloData::EtaToTheta(m_eta); - r = TMath::Tan(theta) * 290; - } - else - phiMin = r * TMath::Cos(m_phi - x) -300; - phiMax = r * TMath::Cos(m_phi + x) + 300; - etaMin = r * TMath::Sin(m_phi - x) - 300; - etaMax = r * TMath::Sin(m_phi + x) + 300; - data->AddTower(TMath::Min(etaMin, etaMax), TMath::Max(etaMin, etaMax), - TMath::Min(phiMin, phiMax), TMath::Max(phiMin, phiMax)); + float etaMin = m_eta - sizeRad(); + float etaMax = m_eta + sizeRad(); + float phiMin = m_phi - sizeRad(); + float phiMax = m_phi + sizeRad(); - } - data->FillSlice(0, 0.1); - } + data->AddTower(m_eta - sizeRad(), m_eta + sizeRad(), m_phi - sizeRad(), m_phi + sizeRad()); + + data->FillSlice(0, 0.1); + TAxis* eta_axis = 0; TAxis* phi_axis = 0; - data->GetEtaLimits(etaMin, etaMax); - data->GetPhiLimits(phiMin, phiMax); - // printf("data rng %f %f %f %f\n",etaMin, etaMax, phiMin, phiMax ); - - if (m_coordinatesEtaPhi == false) { - eta_axis = new TAxis(10, etaMin, etaMax); - phi_axis = new TAxis(10, phiMin, phiMax); - eta_axis->SetTitle("X[cm]"); - phi_axis->SetTitle("Y[cm]"); - phi_axis->SetTitleSize(0.05); - eta_axis->SetTitleSize(0.05); - } else { - std::vector etaBinsWithinLimits; - etaBinsWithinLimits.push_back(etaMin); - for (unsigned int i=0; i<83; ++i) - if ( fw3dlego::xbins[i] > etaMin && fw3dlego::xbins[i] < etaMax ) - etaBinsWithinLimits.push_back(fw3dlego::xbins[i]); - etaBinsWithinLimits.push_back(etaMax); - - std::vector phiBinsWithinLimits; - phiBinsWithinLimits.push_back(phiMin); - for ( double phi = -M_PI; phi < M_PI; phi += M_PI/36 ) - if ( phi > phiMin && phi < phiMax ) - phiBinsWithinLimits.push_back(phi); - phiBinsWithinLimits.push_back(phiMax); - - eta_axis = new TAxis((int)etaBinsWithinLimits.size() -1, &etaBinsWithinLimits[0]); - phi_axis = new TAxis((int)phiBinsWithinLimits.size() -1, &phiBinsWithinLimits[0]); - - eta_axis->SetTitleFont(122); - eta_axis->SetTitle("h"); - eta_axis->SetTitleSize(0.07); - phi_axis->SetTitleFont(122); - phi_axis->SetTitle("f"); - phi_axis->SetTitleSize(0.07); - } + + // printf("data rng %f %f %f %f\n",etaMin, etaMax, phiMin, phiMax ); + std::vector etaBinsWithinLimits; + etaBinsWithinLimits.push_back(etaMin); + for (unsigned int i=0; i<83; ++i) + if ( fw3dlego::xbins[i] > etaMin && fw3dlego::xbins[i] < etaMax ) + etaBinsWithinLimits.push_back(fw3dlego::xbins[i]); + etaBinsWithinLimits.push_back(etaMax); + + std::vector phiBinsWithinLimits; + phiBinsWithinLimits.push_back(phiMin); + for ( double phi = -M_PI; phi < M_PI; phi += M_PI/36 ) + if ( phi > phiMin && phi < phiMax ) + phiBinsWithinLimits.push_back(phi); + phiBinsWithinLimits.push_back(phiMax); + + eta_axis = new TAxis((int)etaBinsWithinLimits.size() -1, &etaBinsWithinLimits[0]); + phi_axis = new TAxis((int)phiBinsWithinLimits.size() -1, &phiBinsWithinLimits[0]); + + eta_axis->SetTitleFont(122); + eta_axis->SetTitle("h"); + eta_axis->SetTitleSize(0.07); + phi_axis->SetTitleFont(122); + phi_axis->SetTitle("f"); + phi_axis->SetTitleSize(0.07); + eta_axis->SetNdivisions(510); phi_axis->SetNdivisions(510); data->SetEtaBins(eta_axis); @@ -134,44 +107,45 @@ TEveCaloData* FWECALDetailViewBuilder::buildCaloData(bool xyEE) //_______________________________________________________________ TEveCaloLego* FWECALDetailViewBuilder::build() { - TEveCaloData* data = buildCaloData(true); - - double etaMin, etaMax, phiMin, phiMax; - data->GetEtaLimits(etaMin, etaMax); - data->GetPhiLimits(phiMin, phiMax); + + // axis + float etaMin = m_eta - sizeRad(); + float etaMax = m_eta + sizeRad(); + float phiMin = m_phi - sizeRad(); + float phiMax = m_phi + sizeRad(); + m_towerList = new TEveElementList("TowerHolder"); + TEveCaloData* data = buildCaloData(true); + // lego - TEveCaloLego *lego = new TEveCaloLego(data); + TEveCaloLego *lego = new TEveCaloLego(); + lego->SetData(data); + lego->AddElement(m_towerList); lego->SetAutoRange(false); lego->SetDrawNumberCellPixels(100); // scale and translate to real world coordinates lego->SetEta(etaMin, etaMax); lego->SetPhiWithRng((phiMin+phiMax)*0.5, (phiMax-phiMin)*0.5); // phi range = 2* phiOffset - Double_t legoScale = ((etaMax - etaMin) < (phiMax - phiMin)) ? (etaMax - etaMin) : (phiMax - phiMin); + Double_t legoScale = sizeRad() *2; lego->InitMainTrans(); lego->RefMainTrans().SetScale(legoScale, legoScale, legoScale*0.5); - lego->RefMainTrans().SetPos((etaMax+etaMin)*0.5, (phiMax+phiMin)*0.5, 0); + lego->RefMainTrans().SetPos(m_eta, m_phi, 0); lego->SetAutoRebin(kFALSE); - lego->Set2DMode(TEveCaloLego::kValSizeOutline); lego->SetName("ECALDetail Lego"); - /* + // cut & paste from FWLegoViewBase + lego->SetScaleAbs(true); + lego->SetHasFixedHeightIn2DMode(true); + lego->SetFixedHeightValIn2DMode(0.001); + + TEvePointSet* ps = new TEvePointSet("origin"); - if (m_coordinatesEtaPhi) { ps->SetNextPoint(m_eta, m_phi, 0.01); ps->SetMarkerSize(0.05); - } - else { - float theta = TEveCaloData::EtaToTheta(m_eta); - double r = TMath::Tan(theta) * 315; - ps->SetNextPoint(r*TMath::Cos(m_phi), r*TMath::Sin(m_phi), 0.01); - ps->SetMarkerSize(3); - } ps->SetMarkerStyle(2); ps->SetMainColor(kGreen); ps->SetMarkerColor(kGreen); lego->AddElement(ps); - */ return lego; @@ -247,173 +221,114 @@ FWECALDetailViewBuilder::showSuperClusters( Color_t color1, Color_t color2 ) } } +/* -//------------------------------------------------------------------ -namespace { - struct DetIdTower { - DetIdTower(const EcalRecHit& hit, const FWGeometry* geom, std::map& detIdsToColor) : - m_points(0), m_slice(0), m_height(0) { - m_points = geom->getCorners( hit.id().rawId()); - if( m_points != 0 ) - { - int j = 0; - for( int i = 0; i < 4; ++i ) - { - m_center += TEveVector( m_points[j], m_points[j + 1], m_points[j + 2] ); - j +=3; - } - - m_center *= 1.f/4.0f; + if (fabs(fabs(centerPhi) -TMath::Pi()) < 0.06 ){ + // if (dump) printf("fixing phi %f, ceneter %f\n", phi, centerPhi); + if (centerPhi < 0 && phi > 0 ) phi -= TMath::TwoPi(); + if (centerPhi > 0 && phi < 0 ) phi += TMath::TwoPi(); } - else - fwLog( fwlog::kInfo ) << "cannot get geometry for DetId: "<< hit.id().rawId() << ". Ignored.\n"; +*/ - std::map::const_iterator itr = detIdsToColor.find(hit.id().rawId()); - if (itr != detIdsToColor.end()) m_slice = itr->second; - - m_height = hit.energy() / cosh( m_center.Eta() ); - - } +namespace { +float +calculateEt( const TEveVector ¢re, float e ) +{ + TEveVector vec = centre; + float et; - const float* m_points; - TEveVector m_center; - int m_slice; - double m_height; + vec.Normalize(); + vec *= e; + et = vec.Perp(); - }; + return et; } +} //------------------------------------------------------------------ void FWECALDetailViewBuilder::fillEtaPhi( const EcalRecHitCollection *hits,TEveCaloDataVec *data) { + const float area = sizeRad(); // barrel cell range, AMT this is available in context - float eps = 0.005; - double eta1 = m_eta - area; double eta2 = m_eta + area; - double phi1 = m_phi - area; double phi2 = m_phi + area; - + // float maxEnergyLog = 0, maxEnergy = 0, maxEt = 0, maxEtLog = 0; + /* // check if we are in -Pi|Pi area int wrapPhi = 0; if (TMath::Abs(phi1) > TMath::Pi() || TMath::Abs(phi2) > TMath::Pi()) { wrapPhi = m_phi > 0 ? 1 : -1; //printf("wrap phi %d \n", wrapPhi); //printf("phi range [%f, %f]\n", phi1, phi2); - } - - for( EcalRecHitCollection::const_iterator k = hits->begin(); k != hits->end(); ++k) - { - DetIdTower tower(*k, m_geom, m_detIdsToColor); - if (tower.m_points) - { - // float centerEta = tower.m_center.Eta(); - float centerPhi = tower.m_center.Phi(); - - // calorimeter crystalls have slightly non-symetrical form in eta-phi projection - // so if we simply get the largest eta and phi, cells will overlap - // therefore we get a smaller eta-phi range representing the inner square - // we also should use only points from the inner face of the crystal, since - // non-projecting direction of crystals leads to large shift in eta on outter - - double minEta(10), maxEta(-10), minPhi(6), maxPhi(-6); - for( unsigned int i = 0; i < 4; ++i ) - { - - TEveVector crystal( tower.m_points[i*3], tower.m_points[i*3 + 1], tower.m_points[i*3 + 2] ); - double eta = crystal.Eta(); - if ( minEta - eta > eps) minEta = eta; - if ( eta - minEta > 0 && eta - minEta < eps ) minEta = eta; - if ( eta - maxEta > eps) maxEta = eta; - if ( maxEta - eta > 0 && maxEta - eta < eps ) maxEta = eta; - - - - // there are bins running exactly in the middle of Pi - double phi = crystal.Phi(); - - - if (fabs(fabs(centerPhi) -TMath::Pi()) < 0.06 ){ - // if (dump) printf("fixing phi %f, ceneter %f\n", phi, centerPhi); - if (centerPhi < 0 && phi > 0 ) phi -= TMath::TwoPi(); - if (centerPhi > 0 && phi < 0 ) phi += TMath::TwoPi(); - } - - if ( minPhi - phi > eps) minPhi = phi; - if ( phi - minPhi > 0 && phi - minPhi < eps ) minPhi = phi; - if ( phi - maxPhi > eps) maxPhi = phi; - if ( maxPhi - phi > 0 && maxPhi - phi < eps ) maxPhi = phi; - } - - - - if ((minEta > eta1 && maxEta < eta2) == false ) - continue; - - - bool passPhi = (centerPhi > phi1 && centerPhi < phi2 ); - if (!passPhi && wrapPhi) { - centerPhi += wrapPhi * TMath::TwoPi();; - minPhi += wrapPhi * TMath::TwoPi(); - maxPhi += wrapPhi * TMath::TwoPi(); - passPhi = (centerPhi > phi1 && centerPhi < phi2 ); - } - - if (passPhi) { - // printf("add (%f %f %f %f ) , value = %f\n",minEta, maxEta, minPhi, maxPhi, tower.m_height ); - data->AddTower( minEta, maxEta, minPhi, maxPhi ); - data->FillSlice( tower.m_slice, tower.m_height ); - } - - } // if have geom + }*/ + std::vector boxes; + for( EcalRecHitCollection::const_iterator hitIt = hits->begin(); hitIt != hits->end(); ++hitIt) + { + const float *corners = m_geom->getCorners( hitIt->detid() ); + float energy, et; + std::vector etaphiCorners(8); + + if( corners == 0 ) + continue; + + + for( int i = 0; i < 4; ++i ) + { + TEveVector cv = TEveVector( corners[i*3], corners[i*3+1], corners[i*3+2] ); + etaphiCorners[i].fX = cv.Eta(); // Conversion of rechit X/Y values for plotting in Eta/Phi + etaphiCorners[i].fY = cv.Phi(); + etaphiCorners[i].fZ = 0.0; + + etaphiCorners[i+4].fX = etaphiCorners[i].fX; // Top can simply be plotted exactly over the top of the bottom face + etaphiCorners[i+4].fY = etaphiCorners[i].fY; + etaphiCorners[i+4].fZ = 0.001; + // printf("%f %f %d \n", etaphiCorners[i].fX, etaphiCorners[i].fY, i); + } + + TEveVector center; + for( int i = 0; i < 4; ++i ) + center += etaphiCorners[i]; + center *= 1.f / 4.f; + + + if ( center.fX < eta1 || center.fX > eta2) continue; + if ( center.fY < phi1 || center.fY > phi2) continue; + + + + // Stop phi wrap + float dPhi1 = etaphiCorners[2].fY - etaphiCorners[1].fY; + float dPhi2 = etaphiCorners[3].fY - etaphiCorners[0].fY; + float dPhi3 = etaphiCorners[1].fY - etaphiCorners[2].fY; + float dPhi4 = etaphiCorners[0].fY - etaphiCorners[3].fY; + + if( dPhi1 > 1 ) + etaphiCorners[2].fY = etaphiCorners[2].fY - ( 2 * TMath::Pi() ); + if( dPhi2 > 1 ) + etaphiCorners[3].fY = etaphiCorners[3].fY - ( 2 * TMath::Pi() ); + if( dPhi3 > 1 ) + etaphiCorners[2].fY = etaphiCorners[2].fY + ( 2 * TMath::Pi() ); + if( dPhi4 > 1 ) + etaphiCorners[3].fY = etaphiCorners[3].fY + ( 2 * TMath::Pi() ); + + + + energy = hitIt->energy(); + et = calculateEt( center, energy ); + m_boxes.push_back(new FWBoxRecHit( etaphiCorners, m_towerList, energy, et )); } // loop hits -} -void -FWECALDetailViewBuilder::fillXY( const EcalRecHitCollection *hits,TEveCaloDataVec *data) -{ - double crystalSize2 = sizeXY()*sizeXY(); - float theta = TEveCaloData::EtaToTheta(m_eta); - double r = TMath::Tan(theta) * 315; - TEveVector p(r*TMath::Cos(m_phi), r*TMath::Sin(m_phi), 0.f); - - - - for( EcalRecHitCollection::const_iterator k = hits->begin(); k != hits->end(); ++k) - { - DetIdTower tower(*k, m_geom, m_detIdsToColor); - if( (k->id().subdetId() == EcalBarrel) && fabs( tower.m_center.Eta() - m_eta ) > sizeRad() ) continue; - if( (k->id().subdetId() == EcalBarrel) && fabs( tower.m_center.Phi() - m_phi ) > sizeRad() ) continue; - TEveVector t2( tower.m_points[0], tower.m_points[1], 0); - TEveVector d = p; d -= t2; - if (d.Mag2() > crystalSize2) continue; - - if( tower.m_points != 0 ) - { - double minX(9999), maxX(-9999), minY(9999), maxY(-9999); - for( unsigned int i = 0; i < 4; ++i ) - { - TEveVector crystal( tower.m_points[3*i], tower.m_points[3*i + 1], tower.m_points[3*i + 2] ); - double x = crystal.fX; - double y = crystal.fY; - if( minX - x > 0.01 ) minX = x; - if( x - maxX > 0.01 ) maxX = x; - if( minY - y > 0.01 ) minY = y; - if( y - maxY > 0.01 ) maxY = y; - } - data->AddTower( minX, maxX, minY, maxY ); - data->FillSlice( tower.m_slice, tower.m_height ); - } - } } + //--------------------------------------------------------------------------------------- @@ -435,7 +350,7 @@ FWECALDetailViewBuilder::fillData( TEveCaloDataVec *data) } catch (...) { - fwLog(fwlog::kWarning) <<"FWECALDetailViewBuilder::build():: Failed to access EcalRecHitsEB collection." << std::endl; + fwLog(fwlog::kWarning) <<"FWECALDetailViewBuilder::fillData():: Failed to access EcalRecHitsEB collection." << std::endl; } if ( ! handle_hitsEB.isValid()) { try{ @@ -449,13 +364,13 @@ FWECALDetailViewBuilder::fillData( TEveCaloDataVec *data) } catch (...) { - fwLog(fwlog::kWarning) <<"FWECALDetailViewBuilder::build():: Failed to access reducedEcalRecHitsEB collection." << std::endl; + fwLog(fwlog::kWarning) <<"FWECALDetailViewBuilder::filData():: Failed to access reducedEcalRecHitsEB collection." << std::endl; } } if( handle_hitsEB.isValid() ) { - m_coordinatesEtaPhi ? fillEtaPhi( hitsEB, data) : fillXY( hitsEB, data ); + fillEtaPhi( hitsEB, data); } } @@ -472,7 +387,7 @@ FWECALDetailViewBuilder::fillData( TEveCaloDataVec *data) } catch (...) { - fwLog(fwlog::kWarning) <<"FWECALDetailViewBuilder::build():: Failed to access ecalRecHitsEE collection." << std::endl; + fwLog(fwlog::kWarning) <<"FWECALDetailViewBuilder::fillData():: Failed to access ecalRecHitsEE collection." << std::endl; } if ( ! handle_hitsEE.isValid()) { @@ -487,17 +402,38 @@ FWECALDetailViewBuilder::fillData( TEveCaloDataVec *data) } catch (...) { - fwLog(fwlog::kWarning) <<"FWECALDetailViewBuilder::build():: Failed to access reducedEcalRecHitsEE collection." << std::endl; + fwLog(fwlog::kWarning) <<"FWECALDetailViewBuilder::fillData():: Failed to access reducedEcalRecHitsEE collection." << std::endl; } } if( handle_hitsEE.isValid() ) { - m_coordinatesEtaPhi ? fillEtaPhi( hitsEE, data) : fillXY( hitsEE, data); + fillEtaPhi( hitsEE, data); } } + bool plotEt = true; + float maxEnergy = 0; + int maxEnergyIdx = 0; + // get max energy in EE and EB + + int cnt = 0; + for (auto & i : m_boxes) { + if (i->getEnergy(plotEt) > maxEnergy) { + maxEnergy = i->getEnergy(plotEt); + maxEnergyIdx = cnt; + } + cnt++; + } + + m_boxes[maxEnergyIdx]->setIsTallest(); + + // AMT ... max size can be an external parameter + float scale = 0.3/maxEnergy; + for (auto & i : m_boxes) + i->updateScale(scale, log(maxEnergy), plotEt); + data->DataChanged(); } From ff0ca3fd4ad6777d248e7d6e3483e922a2300234 Mon Sep 17 00:00:00 2001 From: Alja Mrak-Tadel Date: Thu, 21 Jul 2016 14:35:47 -0700 Subject: [PATCH 13/31] add tooltip --- Fireworks/Calo/src/FWBoxRecHit.cc | 1 - Fireworks/Calo/src/FWECALDetailViewBuilder.cc | 7 +++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Fireworks/Calo/src/FWBoxRecHit.cc b/Fireworks/Calo/src/FWBoxRecHit.cc index c3da259885631..2d65329531dd3 100644 --- a/Fireworks/Calo/src/FWBoxRecHit.cc +++ b/Fireworks/Calo/src/FWBoxRecHit.cc @@ -91,7 +91,6 @@ FWBoxRecHit::buildLineSet( const std::vector &corners ) m_ls->ResetBBox(); m_ls->ComputeBBox(); - float* bb = m_ls->GetBBox(); } //______________________________________________________________________________ diff --git a/Fireworks/Calo/src/FWECALDetailViewBuilder.cc b/Fireworks/Calo/src/FWECALDetailViewBuilder.cc index 9ec4a5c64a03e..246f86eba9c1d 100644 --- a/Fireworks/Calo/src/FWECALDetailViewBuilder.cc +++ b/Fireworks/Calo/src/FWECALDetailViewBuilder.cc @@ -321,7 +321,14 @@ FWECALDetailViewBuilder::fillEtaPhi( const EcalRecHitCollection *hits,TEveCaloDa energy = hitIt->energy(); et = calculateEt( center, energy ); + Color_t bcolor = m_defaultColor; + std::map::const_iterator itr = m_detIdsToColor.find(hitIt->id()); + if (itr != m_detIdsToColor.end()) bcolor = itr->second; + m_boxes.push_back(new FWBoxRecHit( etaphiCorners, m_towerList, energy, et )); + m_boxes.back()->getTower()->SetMainColor(bcolor); + m_boxes.back()->getTower()->SetTitle(Form("rawId = %d, et = %f", hitIt->id().rawId(), et)); + } // loop hits From e2d25d6fcec4e680828082e943eb5c9daa8a3be3 Mon Sep 17 00:00:00 2001 From: Alja Mrak-Tadel Date: Thu, 21 Jul 2016 15:08:39 -0700 Subject: [PATCH 14/31] remove oboslete code --- Fireworks/Calo/src/FWECALDetailViewBuilder.cc | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/Fireworks/Calo/src/FWECALDetailViewBuilder.cc b/Fireworks/Calo/src/FWECALDetailViewBuilder.cc index 246f86eba9c1d..278216b332f13 100644 --- a/Fireworks/Calo/src/FWECALDetailViewBuilder.cc +++ b/Fireworks/Calo/src/FWECALDetailViewBuilder.cc @@ -40,7 +40,7 @@ FWECALDetailViewBuilder::FWECALDetailViewBuilder(const edm::EventBase *event, co } -TEveCaloData* FWECALDetailViewBuilder::buildCaloData(bool xyEE) +TEveCaloData* FWECALDetailViewBuilder::buildCaloData(bool) { // get the hits from the event @@ -249,7 +249,7 @@ calculateEt( const TEveVector ¢re, float e ) void FWECALDetailViewBuilder::fillEtaPhi( const EcalRecHitCollection *hits,TEveCaloDataVec *data) { - + // printf("filletaphi \n"); const float area = sizeRad(); // barrel cell range, AMT this is available in context double eta1 = m_eta - area; @@ -258,15 +258,6 @@ FWECALDetailViewBuilder::fillEtaPhi( const EcalRecHitCollection *hits,TEveCaloDa double phi2 = m_phi + area; - // float maxEnergyLog = 0, maxEnergy = 0, maxEt = 0, maxEtLog = 0; - /* - // check if we are in -Pi|Pi area - int wrapPhi = 0; - if (TMath::Abs(phi1) > TMath::Pi() || TMath::Abs(phi2) > TMath::Pi()) { - wrapPhi = m_phi > 0 ? 1 : -1; - //printf("wrap phi %d \n", wrapPhi); - //printf("phi range [%f, %f]\n", phi1, phi2); - }*/ std::vector boxes; for( EcalRecHitCollection::const_iterator hitIt = hits->begin(); hitIt != hits->end(); ++hitIt) { @@ -491,10 +482,6 @@ FWECALDetailViewBuilder::makeLegend( double x0, double y0, return y; } //______________________________________________________________________________ -float FWECALDetailViewBuilder::sizeXY() const -{ - return m_size *1.5; -} float FWECALDetailViewBuilder::sizeRad() const { From 7e014bebfe967b44c3774e2e693b4bb32b03fe47 Mon Sep 17 00:00:00 2001 From: Alja Mrak-Tadel Date: Thu, 21 Jul 2016 15:09:23 -0700 Subject: [PATCH 15/31] debug superclusters. --- Fireworks/Electrons/plugins/FWElectronDetailView.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Fireworks/Electrons/plugins/FWElectronDetailView.cc b/Fireworks/Electrons/plugins/FWElectronDetailView.cc index 800d81efe478c..7dd9f95c072df 100644 --- a/Fireworks/Electrons/plugins/FWElectronDetailView.cc +++ b/Fireworks/Electrons/plugins/FWElectronDetailView.cc @@ -70,14 +70,16 @@ FWElectronDetailView::build( const FWModelId &id, const reco::GsfElectron* iElec eta = iElectron->eta(); phi = iElectron->phi(); } + printf("eta %f phi %f \n", eta, phi); // build ECAL objects m_builder = new FWECALDetailViewBuilder( id.item()->getEvent(), id.item()->getGeom(), eta, phi, 25); - + /* m_builder->showSuperClusters(); if( iElectron->superCluster().isAvailable() ) m_builder->showSuperCluster( *(iElectron->superCluster() ), kYellow); + */ TEveCaloLego* lego = m_builder->build(); m_data = lego->GetData(); m_eveScene->AddElement( lego ); @@ -89,7 +91,7 @@ FWElectronDetailView::build( const FWModelId &id, const reco::GsfElectron* iElec m_legend->SetEntrySeparation(0.05); // add Electron specific details - if( iElectron->superCluster().isAvailable() ) { + if( 0 && iElectron->superCluster().isAvailable() ) { addTrackPointsInCaloData( iElectron, lego ); drawCrossHair( iElectron, lego, m_eveScene ); addSceneInfo( iElectron, m_eveScene ); From c107a9781f80466bd5da36fcd759e22572b845ed Mon Sep 17 00:00:00 2001 From: Alja Mrak-Tadel Date: Fri, 22 Jul 2016 13:24:43 -0700 Subject: [PATCH 16/31] remove EE specifics. --- .../Electrons/plugins/FWPhotonDetailView.cc | 30 +++++++------------ 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/Fireworks/Electrons/plugins/FWPhotonDetailView.cc b/Fireworks/Electrons/plugins/FWPhotonDetailView.cc index 5bb4eda156198..61944b91068e3 100644 --- a/Fireworks/Electrons/plugins/FWPhotonDetailView.cc +++ b/Fireworks/Electrons/plugins/FWPhotonDetailView.cc @@ -11,7 +11,7 @@ #include "TCanvas.h" #include "TEveCaloLegoOverlay.h" -#include "DataFormats/EcalDetId/interface/EcalSubdetector.h" + #include "DataFormats/EgammaCandidates/interface/Photon.h" #include "Fireworks/Electrons/plugins/FWPhotonDetailView.h" @@ -109,22 +109,16 @@ FWPhotonDetailView::setTextInfo(const FWModelId& id, const reco::Photon *photon) void FWPhotonDetailView::addSceneInfo(const reco::Photon *i, TEveElementList* tList) { - unsigned int subdetId(0); - if ( !i->superCluster()->seed()->hitsAndFractions().empty() ) - subdetId = i->superCluster()->seed()->hitsAndFractions().front().first.subdetId(); // points for centroids Double_t x(0), y(0), z(0); TEvePointSet *scposition = new TEvePointSet("sc position"); scposition->SetPickable(kTRUE); scposition->SetTitle("Super cluster centroid"); - if (subdetId == EcalBarrel) { - x = i->caloPosition().eta(); - y = i->caloPosition().phi(); - } else if (subdetId == EcalEndcap) { - x = i->caloPosition().x(); - y = i->caloPosition().y(); - } + + x = i->caloPosition().eta(); + y = i->caloPosition().phi(); + scposition->SetNextPoint(x,y,z); scposition->SetMarkerSize(1); scposition->SetMarkerStyle(4); @@ -135,15 +129,11 @@ FWPhotonDetailView::addSceneInfo(const reco::Photon *i, TEveElementList* tList) TEvePointSet *seedposition = new TEvePointSet("seed position"); seedposition->SetTitle("Seed cluster centroid"); seedposition->SetPickable(kTRUE); - if (subdetId == EcalBarrel) { - x = i->superCluster()->seed()->position().eta(); - y = i->superCluster()->seed()->position().phi(); - seedposition->SetMarkerSize(0.01); - } else if (subdetId == EcalEndcap) { - x = i->superCluster()->seed()->position().x(); - y = i->superCluster()->seed()->position().y(); - seedposition->SetMarkerSize(1); - } + + x = i->superCluster()->seed()->position().eta(); + y = i->superCluster()->seed()->position().phi(); + seedposition->SetMarkerSize(0.01); + seedposition->SetNextPoint(x, y, z); seedposition->SetMarkerStyle(2); seedposition->SetMarkerColor(kRed); From af4253bf48f13b37f1d9c251ee6d1dc53f6d3bb2 Mon Sep 17 00:00:00 2001 From: Alja Mrak-Tadel Date: Fri, 22 Jul 2016 13:25:39 -0700 Subject: [PATCH 17/31] remove EE specifics. comment out addTrackPointsinCaloData. --- .../Electrons/plugins/FWElectronDetailView.cc | 116 +++++------------- 1 file changed, 29 insertions(+), 87 deletions(-) diff --git a/Fireworks/Electrons/plugins/FWElectronDetailView.cc b/Fireworks/Electrons/plugins/FWElectronDetailView.cc index 7dd9f95c072df..01607a6de13cf 100644 --- a/Fireworks/Electrons/plugins/FWElectronDetailView.cc +++ b/Fireworks/Electrons/plugins/FWElectronDetailView.cc @@ -27,7 +27,7 @@ #include "Fireworks/Core/interface/FWGLEventHandler.h" // CMSSW includes -#include "DataFormats/EcalDetId/interface/EcalSubdetector.h" + #include "DataFormats/EgammaCandidates/interface/GsfElectron.h" #include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h" @@ -70,16 +70,15 @@ FWElectronDetailView::build( const FWModelId &id, const reco::GsfElectron* iElec eta = iElectron->eta(); phi = iElectron->phi(); } - printf("eta %f phi %f \n", eta, phi); // build ECAL objects m_builder = new FWECALDetailViewBuilder( id.item()->getEvent(), id.item()->getGeom(), eta, phi, 25); - /* + m_builder->showSuperClusters(); if( iElectron->superCluster().isAvailable() ) m_builder->showSuperCluster( *(iElectron->superCluster() ), kYellow); - */ + TEveCaloLego* lego = m_builder->build(); m_data = lego->GetData(); m_eveScene->AddElement( lego ); @@ -195,11 +194,6 @@ FWElectronDetailView::setTextInfo( const FWModelId& id, const reco::GsfElectron void FWElectronDetailView::drawCrossHair (const reco::GsfElectron* i, TEveCaloLego *lego, TEveElementList* tList) { - unsigned int subdetId( 0 ); - - if( !i->superCluster()->seed()->hitsAndFractions().empty() ) - subdetId = i->superCluster()->seed()->hitsAndFractions().front().first.subdetId(); - double ymax = lego->GetPhiMax(); double ymin = lego->GetPhiMin(); double xmax = lego->GetEtaMax(); @@ -211,23 +205,15 @@ FWElectronDetailView::drawCrossHair (const reco::GsfElectron* i, TEveCaloLego *l const double eta = i->superCluster()->seed()->position().eta() - i->deltaEtaSeedClusterTrackAtCalo(); const double phi = i->superCluster()->seed()->position().phi() - - i->deltaPhiSeedClusterTrackAtCalo(); + i->deltaPhiSeedClusterTrackAtCalo(); TEveStraightLineSet *trackpositionAtCalo = new TEveStraightLineSet("sc trackpositionAtCalo"); trackpositionAtCalo->SetPickable(kTRUE); trackpositionAtCalo->SetTitle("Track position at Calo propagating from the outermost state"); - if (subdetId == EcalBarrel) - { - trackpositionAtCalo->AddLine(eta, ymin, 0, eta, ymax, 0); - trackpositionAtCalo->AddLine(xmin, phi, 0, xmax, phi, 0); - } - else if (subdetId == EcalEndcap) - { - TVector3 pos; - pos.SetPtEtaPhi(i->superCluster()->seed()->position().rho(), eta, phi); - trackpositionAtCalo->AddLine(pos.X(), ymin, 0, pos.X(), ymax, 0); - trackpositionAtCalo->AddLine(xmin, pos.Y(), 0, xmax,pos.Y(),0); - } + + trackpositionAtCalo->AddLine(eta, ymin, 0, eta, ymax, 0); + trackpositionAtCalo->AddLine(xmin, phi, 0, xmax, phi, 0); + trackpositionAtCalo->SetDepthTest(kFALSE); trackpositionAtCalo->SetLineColor(kBlue); tList->AddElement(trackpositionAtCalo); @@ -244,18 +230,10 @@ FWElectronDetailView::drawCrossHair (const reco::GsfElectron* i, TEveCaloLego *l Double_t eta = i->caloPosition().eta() - deltaEtaSuperClusterTrackAtVtx(*i); Double_t phi = i->caloPosition().phi() - deltaPhiSuperClusterTrackAtVtx(*i); - if (subdetId == EcalBarrel) - { - pinposition->AddLine(eta, ymax, 0, eta, ymin, 0); - pinposition->AddLine(xmin, phi, 0, xmax, phi, 0); - } - else if (subdetId == EcalEndcap) - { - TVector3 pos; - pos.SetPtEtaPhi(i->caloPosition().rho(), eta, phi); - pinposition->AddLine(pos.X(),ymin, 0, pos.X(), ymax, 0); - pinposition->AddLine(xmin, pos.Y(), 0, xmax, pos.Y(), 0); - } + + pinposition->AddLine(eta, ymax, 0, eta, ymin, 0); + pinposition->AddLine(xmin, phi, 0, xmax, phi, 0); + pinposition->SetDepthTest(kFALSE); pinposition->SetLineColor(kRed); tList->AddElement(pinposition); @@ -299,11 +277,7 @@ FWElectronDetailView::checkRange( Double_t &em, Double_t& eM, Double_t &pm, Doub void FWElectronDetailView::addTrackPointsInCaloData( const reco::GsfElectron *i, TEveCaloLego* lego ) { - unsigned int subdetId(0); - - if ( !i->superCluster()->seed()->hitsAndFractions().empty() ) - subdetId = i->superCluster()->seed()->hitsAndFractions().front().first.subdetId(); - + return; TEveCaloDataVec* data = (TEveCaloDataVec*)lego->GetData(); Double_t em, eM, pm, pM; data->GetEtaLimits(em, eM); @@ -319,34 +293,17 @@ FWElectronDetailView::addTrackPointsInCaloData( const reco::GsfElectron *i, TEve double phi = i->superCluster()->seed()->position().phi() - i->deltaPhiSeedClusterTrackAtCalo(); - if (subdetId == EcalBarrel) - { - if (checkRange(em, eM, pm, pM, eta, phi)) - changed = kTRUE; - } - else if (subdetId == EcalEndcap) { - TVector3 pos; - pos.SetPtEtaPhi(i->superCluster()->seed()->position().rho(),eta, phi); - if (checkRange(em, eM, pm, pM, pos.X(), pos.Y())) - changed = kTRUE; - - } + + if (checkRange(em, eM, pm, pM, eta, phi)) + changed = kTRUE; } // pinposition { double eta = i->caloPosition().eta() - deltaEtaSuperClusterTrackAtVtx(*i); double phi = i->caloPosition().phi() - deltaPhiSuperClusterTrackAtVtx(*i); - if (subdetId == EcalBarrel) - { - if (checkRange(em, eM, pm, pM, eta, phi)) - changed = kTRUE; - } - else if (subdetId == EcalEndcap) { - TVector3 pos; - pos.SetPtEtaPhi(i->caloPosition().rho(), eta, phi); - if (checkRange(em, eM, pm, pM, pos.X(), pos.Y())) - changed = kTRUE; - } + + if (checkRange(em, eM, pm, pM, eta, phi)) + changed = kTRUE; } if (changed) { @@ -365,25 +322,17 @@ FWElectronDetailView::addTrackPointsInCaloData( const reco::GsfElectron *i, TEve void FWElectronDetailView::addSceneInfo(const reco::GsfElectron *i, TEveElementList* tList) { - unsigned int subdetId(0); - - if ( !i->superCluster()->seed()->hitsAndFractions().empty() ) - subdetId = i->superCluster()->seed()->hitsAndFractions().front().first.subdetId(); - // centroids Double_t x(0), y(0), z(0); Double_t delta(0.02); - if (subdetId == EcalEndcap) delta = 2.5; + TEveStraightLineSet *scposition = new TEveStraightLineSet("sc position"); scposition->SetPickable(kTRUE); scposition->SetTitle("Super cluster centroid"); - if (subdetId == EcalBarrel) { - x = i->caloPosition().eta(); - y = i->caloPosition().phi(); - } else if (subdetId == EcalEndcap) { - x = i->caloPosition().x(); - y = i->caloPosition().y(); - } + + x = i->caloPosition().eta(); + y = i->caloPosition().phi(); + scposition->AddLine(x-delta,y,z,x+delta,y,z); scposition->AddLine(x,y-delta,z,x,y+delta,z); scposition->AddLine(x,y,z-delta,x,y,z+delta); @@ -400,13 +349,10 @@ FWElectronDetailView::addSceneInfo(const reco::GsfElectron *i, TEveElementList* TEveStraightLineSet *seedposition = new TEveStraightLineSet("seed position"); seedposition->SetTitle("Seed cluster centroid"); seedposition->SetPickable(kTRUE); - if (subdetId == EcalBarrel) { + x = i->superCluster()->seed()->position().eta(); y = i->superCluster()->seed()->position().phi(); - } else if (subdetId == EcalEndcap) { - x = i->superCluster()->seed()->position().x(); - y = i->superCluster()->seed()->position().y(); - } + seedposition->AddLine(x-delta,y-delta,z,x+delta,y+delta,z); seedposition->AddLine(x-delta,y+delta,z,x+delta,y-delta,z); seedposition->SetLineColor(kRed); @@ -426,13 +372,9 @@ FWElectronDetailView::addSceneInfo(const reco::GsfElectron *i, TEveElementList* TEveStraightLineSet *eldirection = new TEveStraightLineSet("seed position"); eldirection->SetTitle("Electron direction at vertex"); eldirection->SetPickable(kTRUE); - if (subdetId == EcalBarrel) { - x = i->eta(); - y = i->phi(); - }else{ - x = 310*fabs(tan(i->theta()))*cos(i->phi()); - y = 310*fabs(tan(i->theta()))*sin(i->phi()); - } + + x = i->eta(); + y = i->phi(); eldirection->AddLine(x-delta,y-delta,z,x+delta,y+delta,z); eldirection->AddLine(x-delta,y+delta,z,x+delta,y-delta,z); eldirection->SetLineColor(kGreen); From 94ae43fab5bffc793e1dd86d59e0797037e889b6 Mon Sep 17 00:00:00 2001 From: Alja Mrak-Tadel Date: Fri, 22 Jul 2016 13:44:11 -0700 Subject: [PATCH 18/31] set supercluster colors --- .../Calo/interface/FWECALDetailViewBuilder.h | 4 --- Fireworks/Calo/src/FWECALDetailViewBuilder.cc | 27 ++----------------- 2 files changed, 2 insertions(+), 29 deletions(-) diff --git a/Fireworks/Calo/interface/FWECALDetailViewBuilder.h b/Fireworks/Calo/interface/FWECALDetailViewBuilder.h index d58cdae246e1b..5d949990d1886 100644 --- a/Fireworks/Calo/interface/FWECALDetailViewBuilder.h +++ b/Fireworks/Calo/interface/FWECALDetailViewBuilder.h @@ -80,10 +80,6 @@ class FWECALDetailViewBuilder { // for keeping track of what det id goes in what slice std::map m_detIdsToColor; - // for keeping track of the colors to use for each slice - std::vector m_colors; - - TEveElement* m_towerList; // sorting function to sort super clusters by eta. diff --git a/Fireworks/Calo/src/FWECALDetailViewBuilder.cc b/Fireworks/Calo/src/FWECALDetailViewBuilder.cc index 278216b332f13..d8ea3428aa127 100644 --- a/Fireworks/Calo/src/FWECALDetailViewBuilder.cc +++ b/Fireworks/Calo/src/FWECALDetailViewBuilder.cc @@ -45,15 +45,9 @@ TEveCaloData* FWECALDetailViewBuilder::buildCaloData(bool) // get the hits from the event // data - TEveCaloDataVec* data = new TEveCaloDataVec( 1 + m_colors.size() ); + TEveCaloDataVec* data = new TEveCaloDataVec( 1); data->SetWrapTwoPi(false); data->RefSliceInfo(0).Setup("hits (not clustered)", 0.0, m_defaultColor ); - for( size_t i = 0; i < m_colors.size(); ++i ) - { - data->RefSliceInfo(i + 1).Setup( "hits (clustered)", 0.0, m_colors[i] ); - } - - fillData(data); @@ -153,15 +147,8 @@ TEveCaloLego* FWECALDetailViewBuilder::build() void FWECALDetailViewBuilder::setColor(Color_t color, const std::vector &detIds) { - - m_colors.push_back(color); - - // get the slice for this group of detIds - // note that the zeroth slice is the default one (all else) - int slice = m_colors.size(); - // take a note of which slice these detids are going to go into for (size_t i = 0; i < detIds.size(); ++i) - m_detIdsToColor[detIds[i]] = slice; + m_detIdsToColor[detIds[i]] = color; } void @@ -221,14 +208,6 @@ FWECALDetailViewBuilder::showSuperClusters( Color_t color1, Color_t color2 ) } } -/* - - if (fabs(fabs(centerPhi) -TMath::Pi()) < 0.06 ){ - // if (dump) printf("fixing phi %f, ceneter %f\n", phi, centerPhi); - if (centerPhi < 0 && phi > 0 ) phi -= TMath::TwoPi(); - if (centerPhi > 0 && phi < 0 ) phi += TMath::TwoPi(); - } -*/ namespace { float @@ -322,8 +301,6 @@ FWECALDetailViewBuilder::fillEtaPhi( const EcalRecHitCollection *hits,TEveCaloDa } // loop hits - - } From a4ea594890f651b82742af95c05ca12b6e42e828 Mon Sep 17 00:00:00 2001 From: Alja Mrak-Tadel Date: Fri, 22 Jul 2016 15:09:29 -0700 Subject: [PATCH 19/31] Draw the tallest with a cross --- Fireworks/Calo/src/FWBoxRecHit.cc | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/Fireworks/Calo/src/FWBoxRecHit.cc b/Fireworks/Calo/src/FWBoxRecHit.cc index 2d65329531dd3..afed348cd201b 100644 --- a/Fireworks/Calo/src/FWBoxRecHit.cc +++ b/Fireworks/Calo/src/FWBoxRecHit.cc @@ -68,7 +68,6 @@ FWBoxRecHit::buildLineSet( const std::vector &corners ) { m_ls = new TEveStraightLineSet( "EcalRecHitLineSet" ); - const float *data; TEveVector c; @@ -130,14 +129,10 @@ float val = plotEt ? m_et : m_energy; if( m_isTallest ) { - if (m_ls->GetMarkerPlex().N() < 5) { - m_ls->AddLine( c.fX, c.fY, c.fZ , c.fX, c.fY, c.fZ); - m_ls->AddLine( c.fX, c.fY, c.fZ , c.fX, c.fY, c.fZ); - } - - // This is the tallest tower and hence two additional lines needs scaling - setLine( 4, c.fX - d, c.fY - d, z, c.fX + d, c.fY + d, z ); - setLine( 5, c.fX - d, c.fY + d, z, c.fX + d, c.fY - d, z ); + + m_ls->AddLine( c.fX - d, c.fY - d, z, c.fX + d, c.fY + d, z ); + m_ls->AddLine( c.fX - d, c.fY + d, z, c.fX + d, c.fY - d, z ); + m_ls->GetMarkerPlex().Refit(); } TEveStraightLineSet::Marker_t* m = ((TEveStraightLineSet::Marker_t*)(m_ls->GetMarkerPlex().Atom(0))); From 218c5ced50b880db5ddf536090aa337d49a5efa3 Mon Sep 17 00:00:00 2001 From: Alja Mrak-Tadel Date: Fri, 22 Jul 2016 15:26:41 -0700 Subject: [PATCH 20/31] Draw outline. --- Fireworks/Calo/src/FWECALDetailViewBuilder.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Fireworks/Calo/src/FWECALDetailViewBuilder.cc b/Fireworks/Calo/src/FWECALDetailViewBuilder.cc index d8ea3428aa127..4e2f8e3edbd23 100644 --- a/Fireworks/Calo/src/FWECALDetailViewBuilder.cc +++ b/Fireworks/Calo/src/FWECALDetailViewBuilder.cc @@ -123,7 +123,7 @@ TEveCaloLego* FWECALDetailViewBuilder::build() Double_t legoScale = sizeRad() *2; lego->InitMainTrans(); lego->RefMainTrans().SetScale(legoScale, legoScale, legoScale*0.5); - lego->RefMainTrans().SetPos(m_eta, m_phi, 0); + lego->RefMainTrans().SetPos(m_eta, m_phi, -0.01); lego->SetAutoRebin(kFALSE); lego->SetName("ECALDetail Lego"); @@ -406,9 +406,10 @@ FWECALDetailViewBuilder::fillData( TEveCaloDataVec *data) // AMT ... max size can be an external parameter float scale = 0.3/maxEnergy; - for (auto & i : m_boxes) + for (auto & i : m_boxes) { i->updateScale(scale, log(maxEnergy), plotEt); - + i->getTower()->SetDrawFrame(true); + } data->DataChanged(); } From 5d616c76cb5b6bf4f9256db95fe25c3c4cc76e38 Mon Sep 17 00:00:00 2001 From: Alja Mrak-Tadel Date: Fri, 29 Jul 2016 13:52:57 -0700 Subject: [PATCH 21/31] Draw 3DCaloLego in conversion detail view. --- .../FWECALCaloDataDetailViewBuilder.h | 92 ++++ .../src/FWECALCaloDataDetailViewBuilder.cc | 453 ++++++++++++++++++ .../plugins/FWConvTrackHitsDetailView.cc | 4 +- 3 files changed, 547 insertions(+), 2 deletions(-) create mode 100644 Fireworks/Calo/interface/FWECALCaloDataDetailViewBuilder.h create mode 100644 Fireworks/Calo/src/FWECALCaloDataDetailViewBuilder.cc diff --git a/Fireworks/Calo/interface/FWECALCaloDataDetailViewBuilder.h b/Fireworks/Calo/interface/FWECALCaloDataDetailViewBuilder.h new file mode 100644 index 0000000000000..9e4a977555a2b --- /dev/null +++ b/Fireworks/Calo/interface/FWECALCaloDataDetailViewBuilder.h @@ -0,0 +1,92 @@ +#include "Rtypes.h" +#include +#include +#include "DataFormats/DetId/interface/DetId.h" +#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" +#include "DataFormats/EgammaReco/interface/SuperClusterFwd.h" +#include "DataFormats/CaloRecHit/interface/CaloClusterFwd.h" + +namespace edm { + class EventBase; +} + +class FWGeometry; +class TEveCaloDataVec; +class TEveCaloLego; +/* + +// Less than operator for sorting clusters according to eta +class superClsterEtaLess : public std::binary_function +{ +public: + bool operator()(const reco::CaloCluster &lhs, const reco::CaloCluster &rhs) + { + return ( lhs.eta() < rhs.eta()) ; + } +}; +*/ + +// builder class for ecal detail view +class FWECALCaloDataDetailViewBuilder { + +public: + + // construct an ecal detail view builder + // the arguments are the event, a pointer to geometry object, + // the eta and phi position to show, + // the half width of the region (in indices, e.g. iEta) and + // the default color for the hits. + FWECALCaloDataDetailViewBuilder(const edm::EventBase *event, const FWGeometry* geom, + float eta, float phi, int size = 50, + Color_t defaultColor = kMagenta+1) + : m_event(event), m_geom(geom), + m_eta(eta), m_phi(phi), m_size(size), + m_defaultColor(defaultColor){ + } + + // draw the ecal information with the preset colors + // (if any colors have been preset) + TEveCaloLego* build(); + + TEveCaloData* buildCaloData(bool xyEE); + + // set colors of some predefined detids + void setColor(Color_t color, const std::vector &detIds); + + // show superclusters using two alternating colors + // to make adjacent clusters visible + void showSuperClusters(Color_t color1=kGreen+2, Color_t color2=kTeal); + + // show a specific supercluster in a specific color + void showSuperCluster(const reco::SuperCluster &cluster, Color_t color=kYellow); + + // add legends; returns final y + double makeLegend(double x0 = 0.02, double y0 = 0.95, + Color_t clustered1=kGreen+1, Color_t clustered2=kTeal, + Color_t supercluster=kYellow); + +private: + + // fill data + void fillData(const EcalRecHitCollection *hits, + TEveCaloDataVec *data, bool xyEE); + const edm::EventBase *m_event; // the event + const FWGeometry *m_geom; // the geometry + float m_eta; // eta position view centred on + float m_phi; // phi position view centred on + int m_size; // view half width in number of crystals + Color_t m_defaultColor; // default color for crystals + + // for keeping track of what det id goes in what slice + std::map m_detIdsToColor; + + // for keeping track of the colors to use for each slice + std::vector m_colors; + + // sorting function to sort super clusters by eta. + static bool superClusterEtaLess(const reco::CaloCluster &lhs, const reco::CaloCluster &rhs) + { + return ( lhs.eta() < rhs.eta()); + } + +}; diff --git a/Fireworks/Calo/src/FWECALCaloDataDetailViewBuilder.cc b/Fireworks/Calo/src/FWECALCaloDataDetailViewBuilder.cc new file mode 100644 index 0000000000000..fa473f584e5f1 --- /dev/null +++ b/Fireworks/Calo/src/FWECALCaloDataDetailViewBuilder.cc @@ -0,0 +1,453 @@ +// FIXME - needed to set fixed eta-phi limits. Without the +// visible area may change widely depending on energy +// deposition availability + +#include "TEveCaloData.h" +#include "TEveViewer.h" +#include "TEveCalo.h" +#include "TAxis.h" +#include "TMath.h" +#include "THLimitsFinder.h" +#include "TLatex.h" + +#include "Fireworks/Core/interface/FWDetailViewBase.h" +#include "Fireworks/Calo/interface/FWECALCaloDataDetailViewBuilder.h" +#include "Fireworks/Core/interface/FWGeometry.h" +#include "Fireworks/Core/interface/fw3dlego_xbins.h" +#include "Fireworks/Core/interface/fwLog.h" + +#include "DataFormats/FWLite/interface/Handle.h" +#include "DataFormats/EgammaReco/interface/SuperCluster.h" +#include "DataFormats/EcalDetId/interface/EcalSubdetector.h" + +#include "TGeoMatrix.h" +#include "TEveTrans.h" + +#include + +TEveCaloData* FWECALCaloDataDetailViewBuilder::buildCaloData(bool xyEE) +{ + // get the hits from the event + + edm::Handle handle_hits; + const EcalRecHitCollection *hits = 0; + + if (fabs(m_eta) < 1.5) + { + try + { + edm::InputTag tag("ecalRecHit", "EcalRecHitsEB"); + m_event->getByLabel(tag, handle_hits); + if (handle_hits.isValid()) + { + hits = &*handle_hits; + } + } + catch (...) + { + fwLog(fwlog::kWarning) <<"FWECALCaloDataDetailViewBuilder::build():: Failed to access EcalRecHitsEB collection." << std::endl; + } + if ( ! handle_hits.isValid()) { + try{ + edm::InputTag tag("reducedEcalRecHitsEB"); + m_event->getByLabel(tag, handle_hits); + if (handle_hits.isValid()) + { + hits = &*handle_hits; + } + + } + catch (...) + { + fwLog(fwlog::kWarning) <<"FWECALCaloDataDetailViewBuilder::build():: Failed to access reducedEcalRecHitsEB collection." << std::endl; + } + } + } + else + { + try + { + edm::InputTag tag("ecalRecHit", "EcalRecHitsEE"); + m_event->getByLabel(tag, handle_hits); + if (handle_hits.isValid()) + hits = &*handle_hits; + } + catch (...) + { + fwLog(fwlog::kWarning) <<"FWECALCaloDataDetailViewBuilder::build():: Failed to access ecalRecHitsEE collection." << std::endl; + } + + if ( ! handle_hits.isValid()) { + try { + edm::InputTag tag("reducedEcalRecHitsEE"); + m_event->getByLabel(tag, handle_hits); + if (handle_hits.isValid()) + { + hits = &*handle_hits; + } + + } + catch (...) + { + fwLog(fwlog::kWarning) <<"FWECALCaloDataDetailViewBuilder::build():: Failed to access reducedEcalRecHitsEE collection." << std::endl; + } + } + } + + // data + TEveCaloDataVec* data = new TEveCaloDataVec( 1 + m_colors.size() ); + data->RefSliceInfo(0).Setup("hits (not clustered)", 0.0, m_defaultColor ); + for( size_t i = 0; i < m_colors.size(); ++i ) + { + data->RefSliceInfo(i + 1).Setup( "hits (clustered)", 0.0, m_colors[i] ); + } + + if( handle_hits.isValid() ) + { + fillData( hits, data, xyEE ); + } + + // axis + Double_t etaMin(0), etaMax(0), phiMin(0), phiMax(0); + if (data->Empty()) + { + fwLog(fwlog::kWarning) <<"FWECALCaloDataDetailViewBuilder::build():: No hits found in " << Form("FWECALCaloDataDetailViewBuilder::build():: No hits found in eta[%f] phi[%f] region", m_eta, m_phi)<<".\n"; + + // add dummy background + float x = m_size*TMath::DegToRad(); + if (fabs(m_eta) < 1.5 || xyEE == false) { + etaMin = m_eta -x; + etaMax = m_eta +x; + phiMin = m_phi -x; + phiMax = m_phi +x; + data->AddTower(etaMin, etaMax, phiMin, phiMax); + } + else + { + float theta = TEveCaloData::EtaToTheta(m_eta); + float r = TMath::Tan(theta) * 290; + phiMin = r * TMath::Cos(m_phi - x) -300; + phiMax = r * TMath::Cos(m_phi + x) + 300; + etaMin = r * TMath::Sin(m_phi - x) - 300; + etaMax = r * TMath::Sin(m_phi + x) + 300; + data->AddTower(TMath::Min(etaMin, etaMax), TMath::Max(etaMin, etaMax), + TMath::Min(phiMin, phiMax), TMath::Max(phiMin, phiMax)); + + } + data->FillSlice(0, 0.1); + } + + + TAxis* eta_axis = 0; + TAxis* phi_axis = 0; + data->GetEtaLimits(etaMin, etaMax); + data->GetPhiLimits(phiMin, phiMax); + // printf("data rng %f %f %f %f\n",etaMin, etaMax, phiMin, phiMax ); + + if (fabs(m_eta) > 1.5 && xyEE ) { + eta_axis = new TAxis(10, etaMin, etaMax); + phi_axis = new TAxis(10, phiMin, phiMax); + eta_axis->SetTitle("X[cm]"); + phi_axis->SetTitle("Y[cm]"); + phi_axis->SetTitleSize(0.05); + eta_axis->SetTitleSize(0.05); + } else { + std::vector etaBinsWithinLimits; + etaBinsWithinLimits.push_back(etaMin); + for (unsigned int i=0; i<83; ++i) + if ( fw3dlego::xbins[i] > etaMin && fw3dlego::xbins[i] < etaMax ) + etaBinsWithinLimits.push_back(fw3dlego::xbins[i]); + etaBinsWithinLimits.push_back(etaMax); + + std::vector phiBinsWithinLimits; + phiBinsWithinLimits.push_back(phiMin); + for ( double phi = -M_PI; phi < M_PI; phi += M_PI/36 ) + if ( phi > phiMin && phi < phiMax ) + phiBinsWithinLimits.push_back(phi); + phiBinsWithinLimits.push_back(phiMax); + + eta_axis = new TAxis((int)etaBinsWithinLimits.size() -1, &etaBinsWithinLimits[0]); + phi_axis = new TAxis((int)phiBinsWithinLimits.size() -1, &phiBinsWithinLimits[0]); + + eta_axis->SetTitleFont(122); + eta_axis->SetTitle("h"); + eta_axis->SetTitleSize(0.07); + phi_axis->SetTitleFont(122); + phi_axis->SetTitle("f"); + phi_axis->SetTitleSize(0.07); + } + eta_axis->SetNdivisions(510); + phi_axis->SetNdivisions(510); + data->SetEtaBins(eta_axis); + data->SetPhiBins(phi_axis); + return data; +} + +//_______________________________________________________________ +TEveCaloLego* FWECALCaloDataDetailViewBuilder::build() +{ + TEveCaloData* data = buildCaloData(true); + + double etaMin, etaMax, phiMin, phiMax; + data->GetEtaLimits(etaMin, etaMax); + data->GetPhiLimits(phiMin, phiMax); + + // lego + TEveCaloLego *lego = new TEveCaloLego(data); + lego->SetDrawNumberCellPixels(100); + // scale and translate to real world coordinates + lego->SetEta(etaMin, etaMax); + lego->SetPhiWithRng((phiMin+phiMax)*0.5, (phiMax-phiMin)*0.5); // phi range = 2* phiOffset + Double_t legoScale = ((etaMax - etaMin) < (phiMax - phiMin)) ? (etaMax - etaMin) : (phiMax - phiMin); + lego->InitMainTrans(); + lego->RefMainTrans().SetScale(legoScale, legoScale, legoScale*0.5); + lego->RefMainTrans().SetPos((etaMax+etaMin)*0.5, (phiMax+phiMin)*0.5, 0); + lego->SetAutoRebin(kFALSE); + lego->Set2DMode(TEveCaloLego::kValSizeOutline); + lego->SetName("ECALDetail Lego"); + return lego; + +} + +void FWECALCaloDataDetailViewBuilder::setColor(Color_t color, const std::vector &detIds) +{ + + m_colors.push_back(color); + + // get the slice for this group of detIds + // note that the zeroth slice is the default one (all else) + int slice = m_colors.size(); + // take a note of which slice these detids are going to go into + for (size_t i = 0; i < detIds.size(); ++i) + m_detIdsToColor[detIds[i]] = slice; +} + +void +FWECALCaloDataDetailViewBuilder::showSuperCluster( const reco::SuperCluster &cluster, Color_t color ) +{ + std::vector clusterDetIds; + const std::vector > &hitsAndFractions = cluster.hitsAndFractions(); + for (size_t j = 0; j < hitsAndFractions.size(); ++j) + { + clusterDetIds.push_back(hitsAndFractions[j].first); + } + + setColor( color, clusterDetIds ); +} + +void +FWECALCaloDataDetailViewBuilder::showSuperClusters( Color_t color1, Color_t color2 ) +{ + // get the superclusters from the event + edm::Handle collection; + + if( fabs( m_eta ) < 1.5 ) { + try { + m_event->getByLabel(edm::InputTag("correctedHybridSuperClusters"), collection); + } + catch (...) + { + fwLog(fwlog::kWarning) <<"no barrel superclusters are available" << std::endl; + } + } else { + try { + m_event->getByLabel(edm::InputTag("correctedMulti5x5SuperClustersWithPreshower"), collection); + } + catch (...) + { + fwLog(fwlog::kWarning) <<"no endcap superclusters are available" << std::endl; + } + } + if( collection.isValid() ) + { + unsigned int colorIndex = 0; + // sort clusters in eta so neighboring clusters have distinct colors + reco::SuperClusterCollection sorted = *collection.product(); + std::sort( sorted.begin(), sorted.end(), superClusterEtaLess ); + for( size_t i = 0; i < sorted.size(); ++i ) + { + if( !(fabs(sorted[i].eta() - m_eta) < (m_size*0.0172) + && fabs(sorted[i].phi() - m_phi) < (m_size*0.0172)) ) + continue; + + if( colorIndex %2 == 0 ) + showSuperCluster( sorted[i], color1 ); + else + showSuperCluster( sorted[i], color2 ); + ++colorIndex; + } + } +} + +void +FWECALCaloDataDetailViewBuilder::fillData( const EcalRecHitCollection *hits, + TEveCaloDataVec *data, bool xyEE ) +{ + const float barrelCR = m_size*0.0172; // barrel cell range + + // loop on all the detids + for( EcalRecHitCollection::const_iterator k = hits->begin(), kEnd = hits->end(); + k != kEnd; ++k ) + { + // get reco geometry + double centerEta = 0; + double centerPhi = 0; + const float* points = m_geom->getCorners( k->id().rawId()); + if( points != 0 ) + { + TEveVector v; + int j = 0; + for( int i = 0; i < 8; ++i ) + { + v += TEveVector( points[j], points[j + 1], points[j + 2] ); + j +=3; + } + centerEta = v.Eta(); + centerPhi = v.Phi(); + } + else + fwLog( fwlog::kInfo ) << "cannot get geometry for DetId: "<< k->id().rawId() << ". Ignored.\n"; + + double size = k->energy() / cosh( centerEta ); + + // check what slice to put in + int slice = 0; + std::map::const_iterator itr = m_detIdsToColor.find(k->id()); + if (itr != m_detIdsToColor.end()) slice = itr->second; + + // if in the EB + if( k->id().subdetId() == EcalBarrel || xyEE == false ) + { + // do phi wrapping + if( centerPhi > m_phi + M_PI) centerPhi -= 2 * M_PI; + if( centerPhi < m_phi - M_PI) centerPhi += 2 * M_PI; + + // check if the hit is in the window to be drawn + if( !( fabs( centerEta - m_eta ) < barrelCR + && fabs( centerPhi - m_phi ) < barrelCR )) continue; + + double minEta(10), maxEta(-10), minPhi(4), maxPhi(-4); + if( points != 0 ) + { + // calorimeter crystalls have slightly non-symetrical form in eta-phi projection + // so if we simply get the largest eta and phi, cells will overlap + // therefore we get a smaller eta-phi range representing the inner square + // we also should use only points from the inner face of the crystal, since + // non-projecting direction of crystals leads to large shift in eta on outter + // face. + int j = 0; + float eps = 0.005; + for( unsigned int i = 0; i < 8; ++i ) + { + TEveVector crystal( points[j], points[j + 1], points[j + 2] ); + j += 3; + double eta = crystal.Eta(); + double phi = crystal.Phi(); + if ( ((k->id().subdetId() == EcalBarrel) && (crystal.Perp() > 135) )|| ((k->id().subdetId() == EcalEndcap) && (crystal.Perp() > 155))) continue; + if ( minEta - eta > eps) minEta = eta; + if ( eta - minEta > 0 && eta - minEta < eps ) minEta = eta; + if ( eta - maxEta > eps) maxEta = eta; + if ( maxEta - eta > 0 && maxEta - eta < eps ) maxEta = eta; + if ( minPhi - phi > eps) minPhi = phi; + if ( phi - minPhi > 0 && phi - minPhi < eps ) minPhi = phi; + if ( phi - maxPhi > eps) maxPhi = phi; + if ( maxPhi - phi > 0 && maxPhi - phi < eps ) maxPhi = phi; + } + } + else + { + double delta = 0.0172 * 0.5; + minEta = centerEta - delta; + maxEta = centerEta + delta; + minPhi = centerPhi - delta; + maxPhi = centerPhi + delta; + } + if( minPhi >= ( m_phi - barrelCR ) && maxPhi <= ( m_phi + barrelCR ) && + minEta >= ( m_eta - barrelCR ) && maxEta <= ( m_eta + barrelCR )) + { + // printf("add %f %f %f %f \n",minEta, maxEta, minPhi, maxPhi ); + data->AddTower( minEta, maxEta, minPhi, maxPhi ); + data->FillSlice( slice, size ); + } + // otherwise in the EE + } + else if( k->id().subdetId() == EcalEndcap ) + { + // check if the hit is in the window to be drawn + double crystalSize = m_size * 0.0172; + if( !( fabs( centerEta - m_eta ) < ( crystalSize ) + && fabs( centerPhi - m_phi ) < ( crystalSize ))) + continue; + + if( points != 0 ) + { + double minX(9999), maxX(-9999), minY(9999), maxY(-9999); + int j = 0; + for( unsigned int i = 0; i < 8; ++i ) + { + TEveVector crystal( points[j], points[j + 1], points[j + 2] ); + j += 3; + double x = crystal.fX; + double y = crystal.fY; + if( fabs( crystal.fZ ) > 330 ) continue; + if( minX - x > 0.01 ) minX = x; + if( x - maxX > 0.01 ) maxX = x; + if( minY - y > 0.01 ) minY = y; + if( y - maxY > 0.01 ) maxY = y; + } + data->AddTower( minX, maxX, minY, maxY ); + // printf("EE add %f %f %f %f \n",minX, maxX, minY, maxY ); + } + data->FillSlice( slice, size ); + } + } // end loop on hits + + data->DataChanged(); +} + +double +FWECALCaloDataDetailViewBuilder::makeLegend( double x0, double y0, + Color_t clustered1, Color_t clustered2, + Color_t supercluster + ) +{ + Double_t fontsize = 0.07; + TLatex* latex = new TLatex(); + Double_t x = x0; + Double_t y = y0; + Double_t boxH = 0.25*fontsize; + Double_t yStep = 0.04; + + y -= yStep; + latex->DrawLatex(x, y, "Energy types:"); + y -= yStep; + + Double_t pos[4]; + pos[0] = x+0.05; + pos[2] = x+0.20; + + pos[1] = y; pos[3] = pos[1] + boxH; + FWDetailViewBase::drawCanvasBox(pos, m_defaultColor); + latex->DrawLatex(x+0.25, y, "unclustered"); + y -= yStep; + if (clustered1<0) return y; + + pos[1] = y; pos[3] = pos[1] + boxH; + FWDetailViewBase::drawCanvasBox(pos, clustered1); + latex->DrawLatex(x+0.25, y, "clustered"); + y -= yStep; + if (clustered2<0) return y; + + pos[1] = y; pos[3] = pos[1] + boxH; + FWDetailViewBase::drawCanvasBox(pos, clustered2); + latex->DrawLatex(x+0.25, y, "clustered"); + y -= yStep; + if (supercluster<0) return y; + + pos[1] = y; pos[3] = pos[1] + boxH; + FWDetailViewBase::drawCanvasBox(pos, supercluster); + latex->DrawLatex(x+0.25, y, "super-cluster"); + y -= yStep; + + return y; +} diff --git a/Fireworks/Electrons/plugins/FWConvTrackHitsDetailView.cc b/Fireworks/Electrons/plugins/FWConvTrackHitsDetailView.cc index a135402d26d86..686f8a905a068 100644 --- a/Fireworks/Electrons/plugins/FWConvTrackHitsDetailView.cc +++ b/Fireworks/Electrons/plugins/FWConvTrackHitsDetailView.cc @@ -34,7 +34,7 @@ #include "Fireworks/Core/interface/FWMagField.h" #include "Fireworks/Core/interface/FWBeamSpot.h" #include "Fireworks/Core/interface/fwLog.h" -#include "Fireworks/Calo/interface/FWECALDetailViewBuilder.h" +#include "Fireworks/Calo/interface/FWECALCaloDataDetailViewBuilder.h" #include "Fireworks/Electrons/plugins/FWConvTrackHitsDetailView.h" #include "DataFormats/EgammaCandidates/interface/Conversion.h" @@ -233,7 +233,7 @@ FWConvTrackHitsDetailView::build (const FWModelId &id, const reco::Conversion* c float phi = conv->pairMomentum().phi(); float eta = conv->pairMomentum().eta(); - FWECALDetailViewBuilder caloBld( id.item()->getEvent(), id.item()->getGeom(), eta, phi, 30); + FWECALCaloDataDetailViewBuilder caloBld( id.item()->getEvent(), id.item()->getGeom(), eta, phi, 30); TEveCaloData* data = caloBld.buildCaloData(false); // AMT!!! this is memory leak, check why it needs to be added TEveCalo3D* calo3d = new TEveCalo3D(data); From 01a40cea8957b867cff5c6fbb223f647b2c757c9 Mon Sep 17 00:00:00 2001 From: Alja Mrak-Tadel Date: Fri, 29 Jul 2016 14:34:58 -0700 Subject: [PATCH 22/31] Remove color palette shortcut. --- Fireworks/Core/src/CmsShowMainFrame.cc | 41 +------------------------- 1 file changed, 1 insertion(+), 40 deletions(-) diff --git a/Fireworks/Core/src/CmsShowMainFrame.cc b/Fireworks/Core/src/CmsShowMainFrame.cc index 4dc7a03076cfe..1b0d0c1a5317d 100644 --- a/Fireworks/Core/src/CmsShowMainFrame.cc +++ b/Fireworks/Core/src/CmsShowMainFrame.cc @@ -264,46 +264,7 @@ CmsShowMainFrame::CmsShowMainFrame(const TGWindow *p,UInt_t w,UInt_t h,FWGUIMana menuTopFrame->AddFrame(menuBar, new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0)); - { - TGHorizontalFrame* hft = new TGHorizontalFrame(menuTopFrame); - menuTopFrame->AddFrame(hft, new TGLayoutHints(kLHintsLeft, 73, 0, 3, 0)); - hft->SetBackgroundColor(backgroundColor); - - - - TGLabel *label = new TGLabel(hft, "New palettes functions: "); - label->SetTextJustify(kTextCenterX); - label->SetTextColor(0xaa4488); - label->SetBackgroundColor(backgroundColor); - fireworks::Context* ctx = fireworks::Context::getInstance(); - hft->AddFrame(label, new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 0, 2, 0)); - - { - TGTextButton* b = new TGTextButton(hft, " Change color palette "); - hft->AddFrame(b,new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0) ); - b->SetBackgroundColor(backgroundColor); - b->SetForegroundColor(0xffffff); - b->SetToolTipText("Also available through Common preferences dialog"); - b->Connect("Clicked()", "CmsShowCommon", ctx->commonPrefs(), "loopPalettes()"); - } - { - TGTextButton* b = new TGTextButton(hft, " Permute colors "); - hft->AddFrame(b,new TGLayoutHints(kLHintsLeft, 5, 0, 0, 0) ); - b->SetBackgroundColor(backgroundColor); - b->SetForegroundColor(0xffffff); - b->Connect("Clicked()", "CmsShowCommon", ctx->commonPrefs(), "permuteColors()"); - - } - { - TGTextButton* b = new TGTextButton(hft, " Randomize colors "); - hft->AddFrame(b,new TGLayoutHints(kLHintsLeft, 5, 0, 0, 0) ); - b->SetBackgroundColor(backgroundColor); - b->SetForegroundColor(0xffffff); - b->Connect("Clicked()", "CmsShowCommon", ctx->commonPrefs(), "randomizeColors()"); - - } - } - + AddFrame(menuTopFrame, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0)); // !!!! MT Line separating menu from other window components. From 747851490e8e67d0051694c854f6180940c55e18 Mon Sep 17 00:00:00 2001 From: Alja Mrak-Tadel Date: Fri, 29 Jul 2016 14:48:20 -0700 Subject: [PATCH 23/31] Make track line width configurable. --- .../plugins/FWElectronProxyBuilder.cc | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Fireworks/Electrons/plugins/FWElectronProxyBuilder.cc b/Fireworks/Electrons/plugins/FWElectronProxyBuilder.cc index f0940220ac42d..4d027879d3e7f 100644 --- a/Fireworks/Electrons/plugins/FWElectronProxyBuilder.cc +++ b/Fireworks/Electrons/plugins/FWElectronProxyBuilder.cc @@ -24,6 +24,8 @@ #include "DataFormats/EgammaCandidates/interface/GsfElectron.h" #include "DataFormats/GsfTrackReco/interface/GsfTrack.h" +#include "Fireworks/Core/interface/FWProxyBuilderConfiguration.h" + //////////////////////////////////////////////////////////////////////////////// // // 3D and RPZ proxy builder with shared track list @@ -43,6 +45,9 @@ class FWElectronProxyBuilder : public FWSimpleProxyBuilderTemplate::buildViewType; virtual void buildViewType(const reco::GsfElectron& iData, unsigned int iIndex, TEveElement& oItemHolder, FWViewType::EType type , const FWViewContext*) override; + using FWSimpleProxyBuilderTemplate::setItem; + virtual void setItem(const FWEventItem* iItem); + REGISTER_PROXYBUILDER_METHODS(); private: @@ -68,11 +73,24 @@ FWElectronProxyBuilder::~FWElectronProxyBuilder() m_common->DecDenyDestroy(); } + +void +FWElectronProxyBuilder::setItem(const FWEventItem* iItem) +{ + FWProxyBuilderBase::setItem(iItem); + + if (iItem) { + iItem->getConfig()->assertParam("LineWidth", long(1), long(1), long(4)); + } +} + + TEveElementList* FWElectronProxyBuilder::requestCommon() { if( m_common->HasChildren() == false ) { + int width = item()->getConfig()->value("LineWidth"); for (int i = 0; i < static_cast(item()->size()); ++i) { const reco::GsfElectron& electron = modelData(i); @@ -85,6 +103,7 @@ FWElectronProxyBuilder::requestCommon() track = fireworks::prepareCandidate( electron, context().getTrackPropagator()); track->MakeTrack(); + track->SetLineWidth(width); setupElement( track ); m_common->AddElement( track ); } From 5df69630afa68c09eb805e22bb68e35853d6d82c Mon Sep 17 00:00:00 2001 From: Alja Mrak-Tadel Date: Fri, 29 Jul 2016 16:07:25 -0700 Subject: [PATCH 24/31] Make supercluster colors a tone darker. --- Fireworks/Electrons/plugins/FWElectronDetailView.cc | 4 ++-- Fireworks/Electrons/plugins/FWPhotonDetailView.cc | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Fireworks/Electrons/plugins/FWElectronDetailView.cc b/Fireworks/Electrons/plugins/FWElectronDetailView.cc index 01607a6de13cf..691f2f8e958f6 100644 --- a/Fireworks/Electrons/plugins/FWElectronDetailView.cc +++ b/Fireworks/Electrons/plugins/FWElectronDetailView.cc @@ -77,7 +77,7 @@ FWElectronDetailView::build( const FWModelId &id, const reco::GsfElectron* iElec m_builder->showSuperClusters(); if( iElectron->superCluster().isAvailable() ) - m_builder->showSuperCluster( *(iElectron->superCluster() ), kYellow); + m_builder->showSuperCluster( *(iElectron->superCluster() ), kYellow + 1); TEveCaloLego* lego = m_builder->build(); m_data = lego->GetData(); @@ -377,7 +377,7 @@ FWElectronDetailView::addSceneInfo(const reco::GsfElectron *i, TEveElementList* y = i->phi(); eldirection->AddLine(x-delta,y-delta,z,x+delta,y+delta,z); eldirection->AddLine(x-delta,y+delta,z,x+delta,y-delta,z); - eldirection->SetLineColor(kGreen); + eldirection->SetLineColor(kGreen + 1); eldirection->SetDepthTest(kFALSE); tList->AddElement(eldirection); diff --git a/Fireworks/Electrons/plugins/FWPhotonDetailView.cc b/Fireworks/Electrons/plugins/FWPhotonDetailView.cc index 61944b91068e3..4d8eb735fa6af 100644 --- a/Fireworks/Electrons/plugins/FWPhotonDetailView.cc +++ b/Fireworks/Electrons/plugins/FWPhotonDetailView.cc @@ -50,7 +50,7 @@ void FWPhotonDetailView::build (const FWModelId &id, const reco::Photon* iPhoton m_builder->showSuperClusters(); if ( iPhoton->superCluster().isAvailable() ) - m_builder->showSuperCluster(*(iPhoton->superCluster()), kYellow); + m_builder->showSuperCluster(*(iPhoton->superCluster()), kYellow + 1); TEveCaloLego* lego = m_builder->build(); m_data = lego->GetData(); From cc0a27762141ebb1d2a58d944e8cca38d4b442ca Mon Sep 17 00:00:00 2001 From: Alja Mrak-Tadel Date: Fri, 29 Jul 2016 16:08:40 -0700 Subject: [PATCH 25/31] Put line and box in a compound. --- Fireworks/Calo/src/FWBoxRecHit.cc | 10 ++++++++-- Fireworks/Calo/src/FWECALDetailViewBuilder.cc | 8 +++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/Fireworks/Calo/src/FWBoxRecHit.cc b/Fireworks/Calo/src/FWBoxRecHit.cc index afed348cd201b..0a6aeeec5ad4d 100644 --- a/Fireworks/Calo/src/FWBoxRecHit.cc +++ b/Fireworks/Calo/src/FWBoxRecHit.cc @@ -1,3 +1,5 @@ +#include "TEveCompound.h" + #include "Fireworks/Calo/interface/FWBoxRecHit.h" #include "Fireworks/Core/interface/Context.h" #include "Fireworks/Core/interface/FWViewEnergyScale.h" @@ -11,8 +13,12 @@ FWBoxRecHit::FWBoxRecHit( const std::vector &corners, TEveElement *c buildTower( corners); buildLineSet( corners); - comp->AddElement( m_tower); - comp->AddElement( m_ls ); + TEveCompound* h = new TEveCompound(); + h->CSCApplyMainColorToAllChildren(); + + h->AddElement( m_tower); + h->AddElement( m_ls ); + comp->AddElement(h); } //______________________________________________________________________________ diff --git a/Fireworks/Calo/src/FWECALDetailViewBuilder.cc b/Fireworks/Calo/src/FWECALDetailViewBuilder.cc index 4e2f8e3edbd23..d03582d084f40 100644 --- a/Fireworks/Calo/src/FWECALDetailViewBuilder.cc +++ b/Fireworks/Calo/src/FWECALDetailViewBuilder.cc @@ -6,6 +6,7 @@ #include "TEveViewer.h" #include "TEvePointSet.h" #include "TEveCalo.h" +#include "TEveCompound.h" #include "TAxis.h" #include "TMath.h" #include "THLimitsFinder.h" @@ -296,9 +297,10 @@ FWECALDetailViewBuilder::fillEtaPhi( const EcalRecHitCollection *hits,TEveCaloDa if (itr != m_detIdsToColor.end()) bcolor = itr->second; m_boxes.push_back(new FWBoxRecHit( etaphiCorners, m_towerList, energy, et )); - m_boxes.back()->getTower()->SetMainColor(bcolor); - m_boxes.back()->getTower()->SetTitle(Form("rawId = %d, et = %f", hitIt->id().rawId(), et)); - + TEveElement::List_i pIt = m_boxes.back()->getTower()->BeginParents(); + TEveCompound* comp = dynamic_cast(*pIt); + comp->SetMainColor(bcolor); + comp->SetElementTitle(Form("rawId = %d, et = %f", hitIt->id().rawId(), et)); } // loop hits } From 452f87cbb6f33bd1f8af3cc652566da869521859 Mon Sep 17 00:00:00 2001 From: Alja Mrak-Tadel Date: Fri, 29 Jul 2016 16:10:35 -0700 Subject: [PATCH 26/31] Don't draw ecal barrel by the default. --- Fireworks/Core/src/FW3DViewBase.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Fireworks/Core/src/FW3DViewBase.cc b/Fireworks/Core/src/FW3DViewBase.cc index 5cc8c2d65407c..1ea25cc778bb8 100644 --- a/Fireworks/Core/src/FW3DViewBase.cc +++ b/Fireworks/Core/src/FW3DViewBase.cc @@ -113,7 +113,7 @@ FW3DViewBase::FW3DViewBase(TEveWindowSlot* iParent, FWViewType::EType typeId, un m_showTrackerBarrel(this, "Show Tracker Barrel", false ), m_showTrackerEndcap(this, "Show Tracker Endcap", false), m_ecalBarrel(0), - m_showEcalBarrel(this, "Show Ecal Barrel", typeId == FWViewType::kISpy ? true : false), + m_showEcalBarrel(this, "Show Ecal Barrel", false), m_rnrStyle(this, "Render Style", 0l, 0l, 2l), m_selectable(this, "Enable Tooltips", false), m_cameraType(this, "Camera Type", 0l, 0l, 5l), From 13df64685a49882bd811f269eb586cab5ae2f099 Mon Sep 17 00:00:00 2001 From: Alja Mrak-Tadel Date: Fri, 29 Jul 2016 21:39:37 -0700 Subject: [PATCH 27/31] have consistent box and line color. --- Fireworks/Calo/src/FWBoxRecHit.cc | 9 +++------ Fireworks/Calo/src/FWECALDetailViewBuilder.cc | 7 ++++--- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/Fireworks/Calo/src/FWBoxRecHit.cc b/Fireworks/Calo/src/FWBoxRecHit.cc index 0a6aeeec5ad4d..730a331658fdd 100644 --- a/Fireworks/Calo/src/FWBoxRecHit.cc +++ b/Fireworks/Calo/src/FWBoxRecHit.cc @@ -7,18 +7,17 @@ //______________________________________________________________________________ -FWBoxRecHit::FWBoxRecHit( const std::vector &corners, TEveElement *comp,float e , float et): +FWBoxRecHit::FWBoxRecHit( const std::vector &corners, TEveElement *list,float e , float et): m_tower(0), m_ls(0), m_energy(e), m_et(et), m_isTallest(false) { buildTower( corners); buildLineSet( corners); - TEveCompound* h = new TEveCompound(); + TEveCompound* h = new TEveCompound("rechit box", "tower"); + list->AddElement(h); h->CSCApplyMainColorToAllChildren(); - h->AddElement( m_tower); h->AddElement( m_ls ); - comp->AddElement(h); } //______________________________________________________________________________ @@ -45,8 +44,6 @@ FWBoxRecHit::setupEveBox( std::vector &corners, float scale ) // printf("%ld -> %f, %f , height=%f \n",i, corners[i].fX, corners[i].fY, scale); } - m_tower->SetPickable( true ); - m_tower->SetDrawFrame(false); m_tower->SetLineWidth( 1.0 ); m_tower->SetLineColor( kBlack ); } diff --git a/Fireworks/Calo/src/FWECALDetailViewBuilder.cc b/Fireworks/Calo/src/FWECALDetailViewBuilder.cc index d03582d084f40..a54c9dbe0308e 100644 --- a/Fireworks/Calo/src/FWECALDetailViewBuilder.cc +++ b/Fireworks/Calo/src/FWECALDetailViewBuilder.cc @@ -135,8 +135,8 @@ TEveCaloLego* FWECALDetailViewBuilder::build() TEvePointSet* ps = new TEvePointSet("origin"); - ps->SetNextPoint(m_eta, m_phi, 0.01); - ps->SetMarkerSize(0.05); + ps->SetNextPoint(m_eta, m_phi, 0.01); + ps->SetMarkerSize(0.05); ps->SetMarkerStyle(2); ps->SetMainColor(kGreen); ps->SetMarkerColor(kGreen); @@ -300,7 +300,8 @@ FWECALDetailViewBuilder::fillEtaPhi( const EcalRecHitCollection *hits,TEveCaloDa TEveElement::List_i pIt = m_boxes.back()->getTower()->BeginParents(); TEveCompound* comp = dynamic_cast(*pIt); comp->SetMainColor(bcolor); - comp->SetElementTitle(Form("rawId = %d, et = %f", hitIt->id().rawId(), et)); + m_boxes.back()->getTower()->SetPickable(true); + m_boxes.back()->getTower()->SetElementTitle(Form("rawId = %d, et = %f", hitIt->id().rawId(), et)); } // loop hits } From 735b4c6974c21c8a40e1f0338a23c92c2a091c0f Mon Sep 17 00:00:00 2001 From: Alja Mrak-Tadel Date: Mon, 1 Aug 2016 14:26:27 -0700 Subject: [PATCH 28/31] Search for reducedEGamma collection : miniaod case. --- Fireworks/Calo/src/FWECALDetailViewBuilder.cc | 50 ++++++++++++++++++- 1 file changed, 48 insertions(+), 2 deletions(-) diff --git a/Fireworks/Calo/src/FWECALDetailViewBuilder.cc b/Fireworks/Calo/src/FWECALDetailViewBuilder.cc index a54c9dbe0308e..dc3c9c0869c63 100644 --- a/Fireworks/Calo/src/FWECALDetailViewBuilder.cc +++ b/Fireworks/Calo/src/FWECALDetailViewBuilder.cc @@ -313,10 +313,11 @@ FWECALDetailViewBuilder::fillEtaPhi( const EcalRecHitCollection *hits,TEveCaloDa void FWECALDetailViewBuilder::fillData( TEveCaloDataVec *data) { - { // barrel const EcalRecHitCollection *hitsEB = 0; edm::Handle handle_hitsEB; + + // RECO try { edm::InputTag tag("ecalRecHit", "EcalRecHitsEB"); @@ -330,6 +331,9 @@ FWECALDetailViewBuilder::fillData( TEveCaloDataVec *data) { fwLog(fwlog::kWarning) <<"FWECALDetailViewBuilder::fillData():: Failed to access EcalRecHitsEB collection." << std::endl; } + + + // AOD if ( ! handle_hitsEB.isValid()) { try{ edm::InputTag tag("reducedEcalRecHitsEB"); @@ -346,6 +350,26 @@ FWECALDetailViewBuilder::fillData( TEveCaloDataVec *data) } } + // MINIAOD + if ( ! handle_hitsEB.isValid()) { + try{ + edm::InputTag tag("reducedEgamma", "reducedEBRecHits"); + m_event->getByLabel(tag, handle_hitsEB); + if (handle_hitsEB.isValid()) + { + hitsEB = &*handle_hitsEB; + } + + + + + } + catch (...) + { + fwLog(fwlog::kWarning) <<"FWECALDetailViewBuilder::filData():: Failed to access reducedEgamma collection." << std::endl; + } + } + if( handle_hitsEB.isValid() ) { fillEtaPhi( hitsEB, data); @@ -356,6 +380,8 @@ FWECALDetailViewBuilder::fillData( TEveCaloDataVec *data) const EcalRecHitCollection *hitsEE = 0; edm::Handle handle_hitsEE; + + // RECO try { edm::InputTag tag("ecalRecHit", "EcalRecHitsEE"); @@ -368,6 +394,7 @@ FWECALDetailViewBuilder::fillData( TEveCaloDataVec *data) fwLog(fwlog::kWarning) <<"FWECALDetailViewBuilder::fillData():: Failed to access ecalRecHitsEE collection." << std::endl; } + // AOD if ( ! handle_hitsEE.isValid()) { try { edm::InputTag tag("reducedEcalRecHitsEE"); @@ -382,6 +409,23 @@ FWECALDetailViewBuilder::fillData( TEveCaloDataVec *data) { fwLog(fwlog::kWarning) <<"FWECALDetailViewBuilder::fillData():: Failed to access reducedEcalRecHitsEE collection." << std::endl; } + + // MINIAOD + if ( ! handle_hitsEE.isValid()) { + try { + edm::InputTag tag("reducedEgamma", "reducedEERecHits"); + m_event->getByLabel(tag, handle_hitsEE); + if (handle_hitsEE.isValid()) + { + hitsEE = &*handle_hitsEE; + } + + } + catch (...) + { + fwLog(fwlog::kWarning) <<"FWECALDetailViewBuilder::fillData():: Failed to access reducedEcalRecHitsEE collection." << std::endl; + } + } } @@ -391,6 +435,8 @@ FWECALDetailViewBuilder::fillData( TEveCaloDataVec *data) } } + if ( m_boxes.empty()) return; + bool plotEt = true; float maxEnergy = 0; int maxEnergyIdx = 0; @@ -410,7 +456,7 @@ FWECALDetailViewBuilder::fillData( TEveCaloDataVec *data) // AMT ... max size can be an external parameter float scale = 0.3/maxEnergy; for (auto & i : m_boxes) { - i->updateScale(scale, log(maxEnergy), plotEt); + i->updateScale(scale, log(maxEnergy + 1), plotEt); i->getTower()->SetDrawFrame(true); } data->DataChanged(); From 6e7d260a3e167491c8584d1edc66da4b5c599a20 Mon Sep 17 00:00:00 2001 From: Alja Mrak-Tadel Date: Mon, 1 Aug 2016 14:27:29 -0700 Subject: [PATCH 29/31] Remove debug print --- Fireworks/Core/src/CmsShowModelPopup.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/Fireworks/Core/src/CmsShowModelPopup.cc b/Fireworks/Core/src/CmsShowModelPopup.cc index 86c516ea1240d..e2b2ff204d69c 100644 --- a/Fireworks/Core/src/CmsShowModelPopup.cc +++ b/Fireworks/Core/src/CmsShowModelPopup.cc @@ -194,7 +194,6 @@ CmsShowModelPopup::fillModelPopup(const FWSelectionManager& iSelMgr) TGTextButton *button; for(size_t index = m_openDetailedViewButtons.size(); index < viewChoices.size(); ++index) { - printf("add new button %s \n ", viewChoices[index].c_str()); button = new TGTextButton(this, "dummy", index); AddFrame(button, new TGLayoutHints(kLHintsExpandX, 4, 4, 4, 4)); TGCompositeFrame* cf = (TGCompositeFrame*)button->GetParent(); From 936f56578cf047b39619430d0e32ddd0d161237b Mon Sep 17 00:00:00 2001 From: Alja Mrak-Tadel Date: Mon, 1 Aug 2016 14:31:22 -0700 Subject: [PATCH 30/31] Skip consumers (dependent module registration) for eacal rec hit based detail views. In general need ecalRecHit_, reducedEcalRecHitsEB, or reducedEgamma. I presume the data will have one of those which is checked in FWECALDetailViewBuilder. --- .../Candidates/plugins/FWCandidateECALDetailView.cc | 9 ++++++++- Fireworks/Electrons/plugins/FWConvTrackHitsDetailView.cc | 5 ++++- Fireworks/Electrons/plugins/FWPhotonDetailView.cc | 5 +++++ Fireworks/Muons/plugins/FWMuonDetailView.cc | 4 ++++ Fireworks/Tracks/plugins/FWTrackECALDetailView.cc | 6 ++++-- 5 files changed, 25 insertions(+), 4 deletions(-) diff --git a/Fireworks/Candidates/plugins/FWCandidateECALDetailView.cc b/Fireworks/Candidates/plugins/FWCandidateECALDetailView.cc index c2d5a1cb22c36..b8d99f63fef0a 100644 --- a/Fireworks/Candidates/plugins/FWCandidateECALDetailView.cc +++ b/Fireworks/Candidates/plugins/FWCandidateECALDetailView.cc @@ -14,7 +14,14 @@ class FWCandidateECALDetailView: public FWECALDetailViewBase }; +REGISTER_FWDETAILVIEW(FWCandidateECALDetailView, ECAL); + +/* +// reco REGISTER_FWDETAILVIEW(FWCandidateECALDetailView, ECAL,ecalRecHit ); +// aod REGISTER_FWDETAILVIEW(FWCandidateECALDetailView, ECAL,reducedEcalRecHitsEB); - +// miniaod +REGISTER_FWDETAILVIEW(FWCandidateECALDetailView, ECAL,reducedEgamma); +*/ diff --git a/Fireworks/Electrons/plugins/FWConvTrackHitsDetailView.cc b/Fireworks/Electrons/plugins/FWConvTrackHitsDetailView.cc index 686f8a905a068..91c3dc490cc27 100644 --- a/Fireworks/Electrons/plugins/FWConvTrackHitsDetailView.cc +++ b/Fireworks/Electrons/plugins/FWConvTrackHitsDetailView.cc @@ -660,6 +660,9 @@ void FWConvTrackHitsDetailView::camera3Callback() } - +REGISTER_FWDETAILVIEW(FWConvTrackHitsDetailView, Conversion); +/* REGISTER_FWDETAILVIEW(FWConvTrackHitsDetailView, Conversion, ecalRecHit); REGISTER_FWDETAILVIEW(FWConvTrackHitsDetailView, Conversion, reducedEcalRecHitsEB); +REGISTER_FWDETAILVIEW(FWConvTrackHitsDetailView, Conversion, reducedEGamma); +*/ diff --git a/Fireworks/Electrons/plugins/FWPhotonDetailView.cc b/Fireworks/Electrons/plugins/FWPhotonDetailView.cc index 4d8eb735fa6af..1f1a773f53e7c 100644 --- a/Fireworks/Electrons/plugins/FWPhotonDetailView.cc +++ b/Fireworks/Electrons/plugins/FWPhotonDetailView.cc @@ -140,5 +140,10 @@ FWPhotonDetailView::addSceneInfo(const reco::Photon *i, TEveElementList* tList) tList->AddElement(seedposition); } +REGISTER_FWDETAILVIEW(FWPhotonDetailView,Photon); + +/* REGISTER_FWDETAILVIEW(FWPhotonDetailView,Photon,ecalRecHit); REGISTER_FWDETAILVIEW(FWPhotonDetailView,Photon,reducedEcalRecHitsEB); +REGISTER_FWDETAILVIEW(FWPhotonDetailView,Photon,reducedEGamma); +*/ diff --git a/Fireworks/Muons/plugins/FWMuonDetailView.cc b/Fireworks/Muons/plugins/FWMuonDetailView.cc index 5d212750617cf..b44792ddc6782 100644 --- a/Fireworks/Muons/plugins/FWMuonDetailView.cc +++ b/Fireworks/Muons/plugins/FWMuonDetailView.cc @@ -232,5 +232,9 @@ FWMuonDetailView::addSceneInfo(const reco::Muon *i, TEveElementList* tList) } +REGISTER_FWDETAILVIEW(FWMuonDetailView,Muon); +/* +REGISTER_FWDETAILVIEW(FWMuonDetailView,Muon,reducedEGamma); REGISTER_FWDETAILVIEW(FWMuonDetailView,Muon,ecalRecHit); REGISTER_FWDETAILVIEW(FWMuonDetailView,Muon,reducedEcalRecHitsEB); +*/ diff --git a/Fireworks/Tracks/plugins/FWTrackECALDetailView.cc b/Fireworks/Tracks/plugins/FWTrackECALDetailView.cc index cd6f8bdfd2950..e40be5999406d 100644 --- a/Fireworks/Tracks/plugins/FWTrackECALDetailView.cc +++ b/Fireworks/Tracks/plugins/FWTrackECALDetailView.cc @@ -14,7 +14,9 @@ class FWTrackECALDetailView: public FWECALDetailViewBase }; +REGISTER_FWDETAILVIEW(FWTrackECALDetailView, ECAL ); +/* REGISTER_FWDETAILVIEW(FWTrackECALDetailView, ECAL,ecalRecHit ); REGISTER_FWDETAILVIEW(FWTrackECALDetailView, ECAL,reducedEcalRecHitsEB); - - +REGISTER_FWDETAILVIEW(FWPhotonDetailView,Photon,reducedEGamma); +*/ From 694b0645825bed2484f64c8386e2d1d7f1904fa7 Mon Sep 17 00:00:00 2001 From: alja Date: Mon, 22 Aug 2016 11:03:38 -0700 Subject: [PATCH 31/31] Remove obsolete code. --- Fireworks/Calo/interface/FWECALDetailViewBuilder.h | 1 - 1 file changed, 1 deletion(-) diff --git a/Fireworks/Calo/interface/FWECALDetailViewBuilder.h b/Fireworks/Calo/interface/FWECALDetailViewBuilder.h index 5d949990d1886..660c3093b864a 100644 --- a/Fireworks/Calo/interface/FWECALDetailViewBuilder.h +++ b/Fireworks/Calo/interface/FWECALDetailViewBuilder.h @@ -89,6 +89,5 @@ class FWECALDetailViewBuilder { } float sizeRad() const; - float sizeXY() const; };