CMS 3D CMS Logo

FWECALCaloDataDetailViewBuilder.h
Go to the documentation of this file.
1 #include "Rtypes.h"
6 
7 #include <map>
8 #include <vector>
9 
10 namespace edm {
11  class EventBase;
12 }
13 
14 class FWGeometry;
15 class TEveCaloData;
16 class TEveCaloDataVec;
17 class TEveCaloLego;
18 
19 // builder class for ecal detail view
21 public:
22  // construct an ecal detail view builder
23  // the arguments are the event, a pointer to geometry object,
24  // the eta and phi position to show,
25  // the half width of the region (in indices, e.g. iEta) and
26  // the default color for the hits.
28  const FWGeometry *geom,
29  float eta,
30  float phi,
31  int size = 50,
32  Color_t defaultColor = kMagenta + 1)
33  : m_event(event), m_geom(geom), m_eta(eta), m_phi(phi), m_size(size), m_defaultColor(defaultColor) {}
34 
35  // draw the ecal information with the preset colors
36  // (if any colors have been preset)
37  TEveCaloLego *build();
38 
39  TEveCaloData *buildCaloData(bool xyEE);
40 
41  // set colors of some predefined detids
42  void setColor(Color_t color, const std::vector<DetId> &detIds);
43 
44  // show superclusters using two alternating colors
45  // to make adjacent clusters visible
46  void showSuperClusters(Color_t color1 = kGreen + 2, Color_t color2 = kTeal);
47 
48  // show a specific supercluster in a specific color
49  void showSuperCluster(const reco::SuperCluster &cluster, Color_t color = kYellow);
50 
51  // add legends; returns final y
52  double makeLegend(double x0 = 0.02,
53  double y0 = 0.95,
54  Color_t clustered1 = kGreen + 1,
55  Color_t clustered2 = kTeal,
56  Color_t supercluster = kYellow);
57 
58 private:
59  // fill data
60  void fillData(const EcalRecHitCollection *hits, TEveCaloDataVec *data, bool xyEE);
61  const edm::EventBase *m_event; // the event
62  const FWGeometry *m_geom; // the geometry
63  float m_eta; // eta position view centred on
64  float m_phi; // phi position view centred on
65  int m_size; // view half width in number of crystals
66  Color_t m_defaultColor; // default color for crystals
67 
68  // for keeping track of what det id goes in what slice
69  std::map<DetId, int> m_detIdsToColor;
70 
71  // for keeping track of the colors to use for each slice
72  std::vector<Color_t> m_colors;
73 
74  // sorting function to sort super clusters by eta.
75  static bool superClusterEtaLess(const reco::CaloCluster &lhs, const reco::CaloCluster &rhs) {
76  return (lhs.eta() < rhs.eta());
77  }
78 };
size
Write out results.
FWECALCaloDataDetailViewBuilder(const edm::EventBase *event, const FWGeometry *geom, float eta, float phi, int size=50, Color_t defaultColor=kMagenta+1)
void showSuperCluster(const reco::SuperCluster &cluster, Color_t color=kYellow)
static bool superClusterEtaLess(const reco::CaloCluster &lhs, const reco::CaloCluster &rhs)
double makeLegend(double x0=0.02, double y0=0.95, Color_t clustered1=kGreen+1, Color_t clustered2=kTeal, Color_t supercluster=kYellow)
void setColor(Color_t color, const std::vector< DetId > &detIds)
void fillData(const EcalRecHitCollection *hits, TEveCaloDataVec *data, bool xyEE)
HLT enums.
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
double eta() const
pseudorapidity of cluster centroid
Definition: CaloCluster.h:181
void showSuperClusters(Color_t color1=kGreen+2, Color_t color2=kTeal)
Definition: event.py:1