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