Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:17:53

0001 #ifndef MICROMEGAS_MICROMEGASCOMBINEDDATADECODER_H
0002 #define MICROMEGAS_MICROMEGASCOMBINEDDATADECODER_H
0003 
0004 /*!
0005  * \file MicromegasCombinedDataDecoder.h
0006  * \author Hugo Pereira Da Costa <hugo.pereira-da-costa@cea.fr>
0007  */
0008 
0009 #include "MicromegasCalibrationData.h"
0010 #include "MicromegasHotChannelMapData.h"
0011 #include "MicromegasMapping.h"
0012 
0013 #include <fun4all/SubsysReco.h>
0014 
0015 #include <memory>
0016 #include <string>
0017 
0018 class PHCompositeNode;
0019 
0020 /// micromegas raw data decoder
0021 class MicromegasCombinedDataDecoder : public SubsysReco
0022 {
0023  public:
0024   /// constructor
0025   MicromegasCombinedDataDecoder(const std::string& name = "MicromegasCombinedDataDecoder");
0026 
0027   /// global initialization
0028   int Init(PHCompositeNode*) override;
0029 
0030   /// run initialization
0031   int InitRun(PHCompositeNode*) override;
0032 
0033   /// event processing
0034   int process_event(PHCompositeNode*) override;
0035 
0036   /// end of processing
0037   int End(PHCompositeNode*) override;
0038 
0039   /// calibration file
0040   void set_calibration_file(const std::string& value) { m_calibration_filename = value; }
0041 
0042   /// hot channel map
0043   void set_hot_channel_map_file(const std::string& value) { m_hot_channel_map_filename = value; }
0044 
0045   /// set number of RMS sigma used to defined static threshold on a given channel
0046   void set_n_sigma(double value) { m_n_sigma = value; }
0047 
0048   /// set minimum ADC value, disregarding pedestal and RMS.
0049   /** This removes faulty channels for which calibration has failed */
0050   void set_min_adc(double value) { m_min_adc = value; }
0051 
0052   /// set min sample for noise estimation
0053   void set_sample_min(uint16_t value) { m_sample_min = value; }
0054 
0055   /// set min sample for noise estimation
0056   void set_sample_max(uint16_t value) { m_sample_max = value; }
0057 
0058  private:
0059   //! raw node
0060   std::string m_rawhitnodename = "MICROMEGASRAWHIT";
0061 
0062   //!@name calibration filename
0063   //@{
0064   std::string m_calibration_filename = "TPOT_Pedestal_000.root";
0065   MicromegasCalibrationData m_calibration_data;
0066   //@}
0067 
0068   //!@name hot channel map
0069   //@{
0070   std::string m_hot_channel_map_filename;
0071   MicromegasHotChannelMapData m_hot_channels;
0072   //@}
0073 
0074   //! mapping
0075   MicromegasMapping m_mapping;
0076 
0077   /// number of RMS sigma used to define threshold
0078   double m_n_sigma = 5;
0079 
0080   //! minimum ADC value, disregarding pedestal and RMS.
0081   /* This removes faulty channels for which calibration has failed */
0082   double m_min_adc = 50;
0083 
0084   /// min sample for signal
0085   uint16_t m_sample_min = 0;
0086 
0087   /// max sample for signal
0088   uint16_t m_sample_max = 100;
0089 
0090   /// keep track of number of hits per hitsetid
0091   using hitcountmap_t = std::map<TrkrDefs::hitsetkey, int>;
0092   hitcountmap_t m_hitcounts;
0093 };
0094 
0095 #endif