File indexing completed on 2024-04-06 12:31:03
0001 #ifndef DD4hep_TrackingMaterialAnalyser_h
0002 #define DD4hep_TrackingMaterialAnalyser_h
0003 #include <string>
0004 #include <vector>
0005
0006 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0007 #include "FWCore/Framework/interface/Event.h"
0008 #include "FWCore/Framework/interface/EventSetup.h"
0009 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0010 #include "FWCore/Utilities/interface/InputTag.h"
0011
0012 #include "SimDataFormats/ValidationFormats/interface/MaterialAccountingTrack.h"
0013 #include "DD4hep_MaterialAccountingGroup.h"
0014 #include "DD4hep_TrackingMaterialPlotter.h"
0015
0016 class DD4hep_TrackingMaterialAnalyser : public edm::one::EDAnalyzer<> {
0017 public:
0018 explicit DD4hep_TrackingMaterialAnalyser(const edm::ParameterSet &);
0019 ~DD4hep_TrackingMaterialAnalyser() override;
0020
0021 private:
0022 enum SplitMode { NEAREST_LAYER, INNER_LAYER, OUTER_LAYER, UNDEFINED };
0023
0024 void analyze(const edm::Event &, const edm::EventSetup &) override;
0025 void beginJob() override {}
0026 void endJob() override;
0027
0028 void split(MaterialAccountingTrack &track);
0029 int findLayer(const MaterialAccountingDetector &detector);
0030
0031 void saveParameters(const char *name);
0032 void saveXml(const char *name);
0033 void saveLayerPlots();
0034
0035 edm::EDGetTokenT<std::vector<MaterialAccountingTrack> > m_materialToken;
0036 edm::ESGetToken<cms::DDCompactView, IdealGeometryRecord> m_dddToken;
0037 SplitMode m_splitMode;
0038 bool m_skipAfterLastDetector;
0039 bool m_skipBeforeFirstDetector;
0040 bool m_saveSummaryPlot;
0041 bool m_saveDetailedPlots;
0042 bool m_saveParameters;
0043 bool m_saveXml;
0044 bool m_isHGCal;
0045 bool m_isHFNose;
0046 std::vector<DD4hep_MaterialAccountingGroup *> m_groups;
0047 std::vector<std::string> m_groupNames;
0048 std::unique_ptr<DD4hep_TrackingMaterialPlotter> m_plotter;
0049 };
0050
0051 #endif