Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef Fireworks_Calo_FWECALDetailViewBuilder_h
0002 #define Fireworks_Calo_FWECALDetailViewBuilder_h
0003 
0004 #include "Rtypes.h"
0005 #include <map>
0006 #include <vector>
0007 #include "DataFormats/DetId/interface/DetId.h"
0008 #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
0009 #include "DataFormats/EgammaReco/interface/SuperClusterFwd.h"
0010 #include "DataFormats/CaloRecHit/interface/CaloClusterFwd.h"
0011 #include "Fireworks/Calo/interface/FWBoxRecHit.h"
0012 
0013 namespace edm {
0014   class EventBase;
0015 }
0016 
0017 class FWGeometry;
0018 class TEveCaloDataVec;
0019 class TEveCaloLego;
0020 
0021 // builder class for ecal detail view
0022 class FWECALDetailViewBuilder {
0023 public:
0024   // construct an ecal detail view builder
0025   // the arguments are the event, a pointer to geometry object,
0026   // the eta and phi position to show,
0027   // the half width of the region (in indices, e.g. iEta) and
0028   // the default color for the hits.
0029   FWECALDetailViewBuilder(const edm::EventBase *event,
0030                           const FWGeometry *geom,
0031                           float eta,
0032                           float phi,
0033                           int size = 50,
0034                           Color_t defaultColor = kMagenta + 1);
0035 
0036   // draw the ecal information with the preset colors
0037   // (if any colors have been preset)
0038   TEveCaloLego *build();
0039 
0040   TEveCaloData *buildCaloData(bool xyEE);
0041 
0042   // set colors of some predefined detids
0043   void setColor(Color_t color, const std::vector<DetId> &detIds);
0044 
0045   // show superclusters using two alternating colors
0046   // to make adjacent clusters visible
0047   void showSuperClusters(Color_t color1 = kGreen + 2, Color_t color2 = kTeal);
0048 
0049   // show a specific supercluster in a specific color
0050   void showSuperCluster(const reco::SuperCluster &cluster, Color_t color = kYellow);
0051 
0052   // add legends; returns final y
0053   double makeLegend(double x0 = 0.02,
0054                     double y0 = 0.95,
0055                     Color_t clustered1 = kGreen + 1,
0056                     Color_t clustered2 = kTeal,
0057                     Color_t supercluster = kYellow);
0058 
0059 private:
0060   // fill data
0061   void fillData(TEveCaloDataVec *data);
0062 
0063   void fillEtaPhi(const EcalRecHitCollection *hits, TEveCaloDataVec *data);
0064 
0065   const edm::EventBase *m_event;  // the event
0066   const FWGeometry *m_geom;       // the geometry
0067   float m_eta;                    // eta position view centred on
0068   float m_phi;                    // phi position view centred on
0069   int m_size;                     // view half width in number of crystals
0070   Color_t m_defaultColor;         // default color for crystals
0071 
0072   std::vector<FWBoxRecHit *> m_boxes;
0073 
0074   // for keeping track of what det id goes in what slice
0075   std::map<DetId, int> m_detIdsToColor;
0076 
0077   TEveElement *m_towerList;
0078 
0079   // sorting function to sort super clusters by eta.
0080   static bool superClusterEtaLess(const reco::CaloCluster &lhs, const reco::CaloCluster &rhs) {
0081     return (lhs.eta() < rhs.eta());
0082   }
0083 
0084   float sizeRad() const;
0085 };
0086 
0087 #endif  // Fireworks_Calo_FWECALDetailViewBuilder_h