Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include "TEveBoxSet.h"
00015
00016 #include "Fireworks/Core/interface/fwLog.h"
00017 #include "Fireworks/Core/interface/FWSimpleProxyBuilderTemplate.h"
00018 #include "Fireworks/Core/interface/FWEventItem.h"
00019 #include "Fireworks/Core/interface/FWViewType.h"
00020 #include "Fireworks/Electrons/interface/makeSuperCluster.h"
00021
00022 #include "DataFormats/EgammaCandidates/interface/Photon.h"
00023
00024 #include "Fireworks/Core/interface/FWGeometry.h"
00025
00026 class FWPhotonProxyBuilder : public FWSimpleProxyBuilderTemplate<reco::Photon>
00027 {
00028 public:
00029 FWPhotonProxyBuilder( void ) {}
00030
00031 virtual ~FWPhotonProxyBuilder( void ) {}
00032
00033 virtual bool haveSingleProduct( void ) const { return false; }
00034
00035 REGISTER_PROXYBUILDER_METHODS();
00036
00037 private:
00038 FWPhotonProxyBuilder( const FWPhotonProxyBuilder& );
00039 const FWPhotonProxyBuilder& operator=( const FWPhotonProxyBuilder& );
00040
00041 virtual void buildViewType( const reco::Photon& photon, unsigned int iIndex, TEveElement& oItemHolder, FWViewType::EType type , const FWViewContext*);
00042 };
00043
00044 void
00045 FWPhotonProxyBuilder::buildViewType( const reco::Photon& photon, unsigned int iIndex, TEveElement& oItemHolder, FWViewType::EType type , const FWViewContext*)
00046 {
00047 const FWGeometry *geom = item()->getGeom();
00048
00049 if( type == FWViewType::kRhoPhi || type == FWViewType::kRhoPhiPF )
00050 {
00051 fireworks::makeRhoPhiSuperCluster( this,
00052 photon.superCluster(),
00053 photon.phi(),
00054 oItemHolder );
00055 }
00056
00057 else if( type == FWViewType::kRhoZ )
00058 fireworks::makeRhoZSuperCluster( this,
00059 photon.superCluster(),
00060 photon.phi(),
00061 oItemHolder );
00062
00063 else if( type == FWViewType::kISpy )
00064 {
00065 std::vector<std::pair<DetId, float> > detIds = photon.superCluster()->hitsAndFractions();
00066
00067 TEveBoxSet* boxset = new TEveBoxSet();
00068 boxset->Reset(TEveBoxSet::kBT_FreeBox, true, 64);
00069 boxset->UseSingleColor();
00070 boxset->SetPickable(1);
00071
00072 for( std::vector<std::pair<DetId, float> >::iterator id = detIds.begin(), ide = detIds.end();
00073 id != ide; ++id )
00074 {
00075 const float* corners = geom->getCorners( id->first.rawId() );
00076
00077 if( corners == 0 )
00078 {
00079 fwLog( fwlog::kWarning )
00080 << "No corners available for supercluster constituent" << std::endl;
00081 continue;
00082 }
00083 boxset->AddBox( &corners[0]);
00084 }
00085
00086 boxset->RefitPlex();
00087 setupAddElement(boxset, &oItemHolder);
00088 }
00089 }
00090
00091 REGISTER_FWPROXYBUILDER( FWPhotonProxyBuilder, reco::Photon, "Photons", FWViewType::kAllRPZBits | FWViewType::kAll3DBits );