Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:12:21

0001 // Tell emacs that this is a C++ source
0002 //  -*- C++ -*-.
0003 #ifndef PROTOTYPE4_PROTOTYPE4FEM_H
0004 #define PROTOTYPE4_PROTOTYPE4FEM_H
0005 
0006 #include <map>
0007 #include <string>
0008 #include <vector>
0009 
0010 namespace PROTOTYPE4_FEM
0011 {
0012 /*! Packet ID */
0013 const int PACKET_ID = 21351;
0014 
0015 /*! Number of ADC Samples per tower */
0016 const int NSAMPLES = 31;
0017 
0018 //! Mask to obtain ADC from DWord data
0019 const int ADC_DATA_MASK = (1 << 14) - 1;
0020 
0021 /*! Number of Inner HCAL towers */
0022 const int NCH_IHCAL_ROWS = 4;
0023 const int NCH_IHCAL_COLUMNS = 4;
0024 
0025 /*! Number of Outer HCAL towers */
0026 const int NCH_OHCAL_ROWS = 4;
0027 const int NCH_OHCAL_COLUMNS = 4;
0028 
0029 /*! Number of EMCAL towers */
0030 const int NCH_EMCAL_ROWS = 8;
0031 const int NCH_EMCAL_COLUMNS = 8;
0032 
0033 /*! Error assigned to saturated ADCs */
0034 const int SATURATED_ADC_ERROR = 100;
0035 
0036 /*! Error assigned to dead channels */
0037 const int DEAD_CHANNEL_ERROR = 300;
0038 
0039 //! FEM mapping of channel -> calorimeter col and rows
0040 int GetChannelNumber(const std::string &caloname, int i_column, int i_row);
0041 
0042 //! Abhisek's power-law + exp fit
0043 bool SampleFit_PowerLawExp(              //
0044     const std::vector<double> &samples,  //
0045     double &peak,                        //
0046     double &peak_sample,                 //
0047     double &pedstal,                     //
0048     const int verbosity = 0);
0049 
0050 //! Power law double exp fit
0051 bool SampleFit_PowerLawDoubleExp(        //
0052     const std::vector<double> &samples,  //
0053     double &peak,                        //! peak amplitude.
0054     double &peak_sample,                 //! peak sample position. Fixed to the input value if
0055                                          //! NOT NAN
0056     double &pedestal,                    //! pedestal
0057     std::map<int, double>
0058         &parameters_io,  //! IO for fullset of parameters. If a parameter exist
0059                          //! and not an NAN, the fit parameter will be fixed to
0060                          //! that value. The order of the parameters are
0061                          //! ("Amplitude 1", "Sample Start", "Power", "Peak Time
0062                          //! 1", "Pedestal", "Amplitude 2", "Peak Time 2")
0063     const int verbosity = 0);
0064 
0065 //! Just return the max sample...
0066 bool SampleFit_PeakSample(               //
0067     const std::vector<double> &samples,  //
0068     double &peak,                        //! peak amplitude.
0069     double &peak_sample,                 //! peak sample position. Fixed to the input value if
0070                                          //! NOT NAN
0071     double &pedestal,                    //! pedestal
0072     const int verbosity = 0);
0073 
0074 // Abhisek's power-law + exp signal shape model
0075 double SignalShape_PowerLawExp(double *x, double *par);
0076 double SignalShape_PowerLawDoubleExp(double *x, double *par);
0077 
0078 //! special treatment for EMCal tagging packet
0079 //! See also
0080 //! https://wiki.bnl.gov/sPHENIX/index.php/2017_calorimeter_beam_test#What_is_new_in_the_data_structures_in_2017
0081 //! Result stored in RUN_INFO node under variable EMCAL_Is_HighEta
0082 const int PACKET_EMCAL_HIGHETA_FLAG = 905;
0083 }  // namespace PROTOTYPE4_FEM
0084 
0085 #endif