File indexing completed on 2025-12-19 09:18:43
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef MVTXCALIB_MVTXFAKEHITRATE_H
0010 #define MVTXCALIB_MVTXFAKEHITRATE_H
0011
0012 #include <fun4all/SubsysReco.h>
0013
0014 #include <cstdint>
0015 #include <string>
0016 #include <vector>
0017
0018 class PHCompositeNode;
0019 class MvtxHitMap;
0020 class MvtxPixelMask;
0021 class MvtxRawEvtHeader;
0022 class MvtxRawHitContainer;
0023 class TTree;
0024 class TH1;
0025
0026 class MvtxFakeHitRate : public SubsysReco
0027 {
0028 public:
0029 MvtxFakeHitRate(const std::string& name = "MvtxFakeHitRate")
0030 : SubsysReco(name)
0031 {}
0032
0033 ~MvtxFakeHitRate() override;
0034
0035
0036 int InitRun(PHCompositeNode* ) override;
0037 int process_event(PHCompositeNode* topNode) override;
0038 int End(PHCompositeNode* ) override;
0039
0040 void SetOutputfile(const std::string& name) { m_outputfile = name; }
0041 void SetMaxMaskedPixels(int n) { m_max_masked_pixels = n; }
0042 void SelectLayer(int layer = 0) { m_target_layer = layer; }
0043 void StartFromCDB(bool start = true) { m_load_from_cdb = start; }
0044
0045 private:
0046
0047 std::string m_outputfile{"mvtx_fhr.root"};
0048
0049 int m_max_masked_pixels{1000};
0050 bool m_masked_pixels_in_file{false};
0051 uint64_t m_last_strobe{0};
0052
0053 int m_target_layer{-1};
0054
0055
0056 bool m_load_from_cdb{false};
0057 MvtxPixelMask* m_hot_pixel_mask{nullptr};
0058
0059
0060 MvtxHitMap* m_hit_map{nullptr};
0061
0062
0063 MvtxRawEvtHeader* m_mvtx_raw_event_header{nullptr};
0064 MvtxRawHitContainer* m_mvtx_raw_hit_container{nullptr};
0065
0066 TTree* m_tree{nullptr};
0067 int m_num_strobes{0};
0068 int m_num_masked_pixels{0};
0069 double m_noise_threshold{0.0};
0070 std::vector<uint64_t> m_masked_pixels{};
0071
0072 TTree* m_current_mask{nullptr};
0073 int m_current_nmasked{0};
0074 double m_current_threshold{0.0};
0075 std::vector<uint64_t> m_current_masked_pixels{};
0076
0077 TH1* m_threshold_vs_nmasked{nullptr};
0078
0079 int get_nodes(PHCompositeNode* topNode);
0080 int FillCurrentMaskTree();
0081 int CalcFHR();
0082
0083 double calc_threshold(int nhits) const;
0084 };
0085
0086 #endif