CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FWCaloTauProxyBuilder.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Calo
4 // Class : FWCaloTauProxyBuilder
5 //
6 // Implementation:
7 // <Notes on implementation>
8 //
9 // Original Author:
10 // Created: Sun Jan 6 23:57:00 EST 2008
11 //
12 
13 // system include files
14 #include "TEveCompound.h"
15 #include "TGeoTube.h"
16 #include "TEveGeoNode.h"
17 #include "TEveStraightLineSet.h"
18 #include "TEveTrack.h"
19 
20 // user include files
26 
30 
31 class FWViewContext;
32 
34 {
35 public:
38 
40 
41 private:
42  FWCaloTauProxyBuilder(const FWCaloTauProxyBuilder&); // stop default
43  const FWCaloTauProxyBuilder& operator=(const FWCaloTauProxyBuilder&); // stop default
44 
45  virtual void buildViewType( const FWEventItem* iItem, TEveElementList* product, FWViewType::EType viewType , const FWViewContext* vc);
46 
47 };
48 
49 void
50 FWCaloTauProxyBuilder::buildViewType( const FWEventItem* iItem, TEveElementList* product, FWViewType::EType viewType , const FWViewContext* vc)
51 {
52  reco::CaloTauCollection const * caloTaus = 0;
53  iItem->get( caloTaus );
54  if( caloTaus == 0 ) return;
55 
56 
57  Int_t idx = 0;
58  for( reco::CaloTauCollection::const_iterator it = caloTaus->begin(), itEnd = caloTaus->end(); it != itEnd; ++it, ++idx)
59  {
60  TEveCompound* comp = createCompound();
61 
62  if (viewType == FWViewType::kLego)
63  {
64  fireworks::addCircle( (*it).eta(), (*it).phi(), 0.5, 20, comp, this );
65  }
66  else
67  {
68  try {
69  const reco::CaloTauTagInfo *tauTagInfo = dynamic_cast<const reco::CaloTauTagInfo*>(((*it).caloTauTagInfoRef().get()));
70  const reco::CaloJet *jet = dynamic_cast<const reco::CaloJet*>((tauTagInfo->calojetRef().get()));
71 
72  int min = 100;
73  int max = -100;
74  std::vector<double> phis;
75  std::vector<CaloTowerPtr> towers = jet->getCaloConstituents();
76  for( std::vector<CaloTowerPtr>::const_iterator tower = towers.begin(), towerEnd = towers.end();
77  tower != towerEnd; ++tower )
78  {
79  unsigned int ieta = 41 + (*tower)->id().ieta();
80  if( ieta > 40 ) --ieta;
81  assert( ieta <= 82 );
82 
83  if( int(ieta) > max ) max = ieta;
84  if( int(ieta) < min ) min = ieta;
85  m_phis.push_back( (*tower)->phi() );
86  }
87  if( min > max ) {
88  min = 0; max = 0;
89  }
90  const std::vector<std::pair<double, double> > thetaBins = fireworks::thetaBins();
91  m_minTheta = thetaBins[min].first;
92  m_maxTheta = thetaBins[max].second;
93 
94  buildBaseTau(*it, jet, comp, viewType, vc);
95  m_phis.clear();
96  }
97  catch (std::exception& e)
98  {
99  fwLog(fwlog::kInfo) << "FWPFTauProxyBuilder missing PFTauTagInfo. Skip drawing of jets.\n";
100  buildBaseTau(*it, 0, comp, viewType, vc);
101  }
102  }
103  setupAddElement( comp, product );
104  }
105 }
106 
107 
#define REGISTER_FWPROXYBUILDER(_name_, _type_, _purpose_, _view_)
Jets made from CaloTowers.
Definition: CaloJet.h:29
static const int kAllRPZBits
Definition: FWViewType.h:58
const CaloJetRef & calojetRef() const
const FWCaloTauProxyBuilder & operator=(const FWCaloTauProxyBuilder &)
std::vector< std::pair< double, double > > thetaBins()
Definition: thetaBins.cc:48
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
void get(const T *&oData) const
Definition: FWEventItem.h:84
virtual void buildViewType(const FWEventItem *iItem, TEveElementList *product, FWViewType::EType viewType, const FWViewContext *vc)
virtual std::vector< CaloTowerPtr > getCaloConstituents() const
get all constituents
Definition: CaloJet.cc:93
static const int kAll3DBits
Definition: FWViewType.h:59
std::vector< CaloTau > CaloTauCollection
collection of CaloTau objects
Definition: CaloTauFwd.h:9
void buildBaseTau(const reco::BaseTau &iTau, const reco::Jet *iJet, TEveElement *comp, FWViewType::EType type, const FWViewContext *vc)
const T & max(const T &a, const T &b)
void addCircle(double eta, double phi, double radius, const unsigned int nLineSegments, TEveElement *comp, FWProxyBuilderBase *pb)
#define fwLog(_level_)
Definition: fwLog.h:50
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
TEveCompound * createCompound(bool set_color=true, bool propagate_color_to_all_children=false) const
std::vector< double > m_phis
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:242