Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:11:51

0001 #ifndef _FWPFEcalRecHitLegoProxyBuilder_H_
0002 #define _FWPFEcalRecHitLegoProxyBuilder_H_
0003 
0004 // -*- C++ -*-
0005 //
0006 // Package:     ParticleFlow
0007 // Class  :     FWPFEcalRecHitLegoProxyBuilder
0008 //
0009 // Implementation:
0010 //     <Notes on implementation>
0011 //
0012 // Original Author:  Simon Harris
0013 //
0014 
0015 // System include files
0016 #include <cmath>
0017 #include "TEveCompound.h"
0018 
0019 // User include files
0020 #include "Fireworks/Core/interface/FWProxyBuilderTemplate.h"
0021 #include "Fireworks/Core/interface/FWEventItem.h"
0022 #include "Fireworks/Core/interface/FWGeometry.h"
0023 #include "Fireworks/Core/interface/Context.h"
0024 
0025 #include "DataFormats/EcalRecHit/interface/EcalRecHit.h"
0026 #include "Fireworks/ParticleFlow/interface/FWPFLegoRecHit.h"
0027 #include "Fireworks/ParticleFlow/interface/FWPFMaths.h"
0028 
0029 #include "Fireworks/Core/interface/FWViewContext.h"
0030 #include "Fireworks/Core/interface/FWViewEnergyScale.h"
0031 
0032 //-----------------------------------------------------------------------------
0033 // FWPFEcalRecHitLegoProxyBuilder
0034 //-----------------------------------------------------------------------------
0035 
0036 class FWPFEcalRecHitLegoProxyBuilder : public FWProxyBuilderTemplate<EcalRecHit> {
0037 public:
0038   // ---------------- Constructor(s)/Destructor ----------------------
0039   FWPFEcalRecHitLegoProxyBuilder() : m_maxEnergy(0), m_maxEt(0), m_maxEnergyLog(0), m_maxEtLog(0) {}
0040   ~FWPFEcalRecHitLegoProxyBuilder() override {}
0041 
0042   static std::string typeOfBuilder() { return "simple#"; }
0043 
0044   // --------------------- Member Functions --------------------------
0045   void build(const FWEventItem* iItem, TEveElementList* product, const FWViewContext*) override;
0046 
0047   void scaleProduct(TEveElementList* parent, FWViewType::EType, const FWViewContext* vc) override;
0048   bool havePerViewProduct(FWViewType::EType) const override { return true; }
0049   void cleanLocal() override;
0050 
0051   // Needed by FWPFLegoRecHit
0052   TEveVector calculateCentre(const std::vector<TEveVector>& corners) const;
0053   float getMaxValLog(bool et) const { return et ? m_maxEtLog : m_maxEnergyLog; }
0054   float getMaxVal(bool et) const { return et ? m_maxEt : m_maxEnergy; }
0055 
0056   REGISTER_PROXYBUILDER_METHODS();
0057 
0058 protected:
0059   // --------------------- Member Functions --------------------------
0060   void localModelChanges(const FWModelId& iId,
0061                          TEveElement* iCompound,
0062                          FWViewType::EType viewType,
0063                          const FWViewContext* vc) override;
0064 
0065 public:
0066   // Disable default copy constructor
0067   FWPFEcalRecHitLegoProxyBuilder(const FWPFEcalRecHitLegoProxyBuilder&) = delete;
0068   // Disable default assignment operator
0069   const FWPFEcalRecHitLegoProxyBuilder& operator=(const FWPFEcalRecHitLegoProxyBuilder&) = delete;
0070 
0071 private:
0072   // ----------------------- Data Members ----------------------------
0073   float m_maxEnergy;
0074   float m_maxEt;
0075   float m_maxEnergyLog;
0076   float m_maxEtLog;
0077   std::vector<FWPFLegoRecHit*> m_recHits;
0078 };
0079 #endif
0080 //=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_