Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 11:25:48

0001 #ifndef DD4hep_TrackingMaterialPlotter_h
0002 #define DD4hep_TrackingMaterialPlotter_h
0003 
0004 #include <algorithm>
0005 #include <vector>
0006 #include <sstream>
0007 #include <iostream>
0008 #include <iomanip>
0009 
0010 #include <TH2F.h>
0011 #include <TColor.h>
0012 
0013 #include "DD4hep_XHistogram.h"
0014 class MaterialAccountingStep;
0015 
0016 class DD4hep_TrackingMaterialPlotter {
0017 public:
0018   typedef std::pair<double, double> Range;
0019 
0020   DD4hep_TrackingMaterialPlotter(float maxZ, float maxR, float resolution);
0021   void plotSegmentUnassigned(const MaterialAccountingStep& step);
0022   void plotSegmentInLayer(const MaterialAccountingStep& step, int layer);
0023 
0024   void normalize(void) { m_tracker.normalize(); }
0025 
0026   void draw(void);
0027 
0028 private:
0029   DD4hep_XHistogram m_tracker;
0030 
0031   std::vector<int> m_color;
0032   std::vector<int> m_gradient;
0033 
0034   void fill_color();
0035   unsigned int fill_gradient(const TColor& first, const TColor& last, unsigned int steps = 100, unsigned int index = 0);
0036   unsigned int fill_gradient(const unsigned int& first,
0037                              const unsigned int& last,
0038                              const unsigned int& steps = 100,
0039                              const unsigned int& index = 0);
0040 };
0041 
0042 #endif  //  DD4hep_TrackingMaterialPlotter_h