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 
46  virtual void buildViewType( const FWEventItem* iItem, TEveElementList* product, FWViewType::EType viewType , const FWViewContext* vc);
47 
48 };
49 
50 void
51 FWCaloTauProxyBuilder::buildViewType( const FWEventItem* iItem, TEveElementList* product, FWViewType::EType viewType , const FWViewContext* vc)
52 {
53  reco::CaloTauCollection const * caloTaus = 0;
54  iItem->get( caloTaus );
55  if( caloTaus == 0 ) return;
56 
57 
58  Int_t idx = 0;
59  for( reco::CaloTauCollection::const_iterator it = caloTaus->begin(), itEnd = caloTaus->end(); it != itEnd; ++it, ++idx)
60  {
61  TEveCompound* comp = createCompound();
62 
63  if (viewType == FWViewType::kLego)
64  {
65  fireworks::addCircle( (*it).eta(), (*it).phi(), 0.5, 20, comp, this );
66  }
67  else
68  {
69  try {
70  const reco::CaloTauTagInfo *tauTagInfo = dynamic_cast<const reco::CaloTauTagInfo*>(((*it).caloTauTagInfoRef().get()));
71  const reco::CaloJet *jet = dynamic_cast<const reco::CaloJet*>((tauTagInfo->calojetRef().get()));
72 
73  int min = 100;
74  int max = -100;
75  std::vector<double> phis;
76  std::vector<CaloTowerPtr> towers = jet->getCaloConstituents();
77  for( std::vector<CaloTowerPtr>::const_iterator tower = towers.begin(), towerEnd = towers.end();
78  tower != towerEnd; ++tower )
79  {
80  unsigned int ieta = 41 + (*tower)->id().ieta();
81  if( ieta > 40 ) --ieta;
82  assert( ieta <= 82 );
83 
84  if( int(ieta) > max ) max = ieta;
85  if( int(ieta) < min ) min = ieta;
86  m_phis.push_back( (*tower)->phi() );
87  }
88  if( min > max ) {
89  min = 0; max = 0;
90  }
91  const std::vector<std::pair<double, double> > thetaBins = fireworks::thetaBins();
92  m_minTheta = thetaBins[min].first;
93  m_maxTheta = thetaBins[max].second;
94 
95  buildBaseTau(*it, jet, comp, viewType, vc);
96  m_phis.clear();
97  }
98  catch (std::exception& e)
99  {
100  fwLog(fwlog::kInfo) << "FWPFTauProxyBuilder missing PFTauTagInfo. Skip drawing of jets.\n";
101  buildBaseTau(*it, 0, comp, viewType, vc);
102  }
103  }
104  setupAddElement( comp, product );
105  }
106 }
107 
108 
virtual void buildViewType(const FWEventItem *iItem, TEveElementList *, FWViewType::EType, const FWViewContext *)
#define REGISTER_PROXYBUILDER_METHODS()
#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
assert(m_qm.get())
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)
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:242
void addCircle(double eta, double phi, double radius, const unsigned int nLineSegments, TEveElement *comp, FWProxyBuilderBase *pb)
T min(T a, T b)
Definition: MathUtil.h:58
#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