|
pflib v3.12.0-1-g716e801
Pretty Fine HGCROC Interaction Library
|
housing of higher-level methods for repeatable tasks More...
Classes | |
| class | DataFitter |
| Data class that stores information about each point in a 1d space. More... | |
Functions | |
| std::array< double, 72 > | get_toa_efficiencies (int i_roc, const pflib::packing::SingleECONDRocErxMapping &mapping, const std::vector< pflib::packing::MultiSampleECONDEventPacket > &data) |
| calculate the highest TOA_VREF value for each link, for which there is a non-zero TOA efficiency | |
| void | get_param (Target *tgt, DecodeAndBuffer &buffer, const std::size_t &nevents, int &step, std::map< int, std::vector< int > > &pedestals_l0, std::map< int, std::vector< double > > &stds_l0, std::map< int, std::vector< int > > &pedestals_l1, std::map< int, std::vector< double > > &stds_l1, std::map< int, std::vector< int > > &inv_vrefs, std::map< int, std::array< int, 2 > > &noinv_vref) |
| Collect inv_vref data for the constant input noinv_vref parameter. | |
| std::map< int, std::map< std::string, std::map< std::string, uint64_t > > > | global_pedestal_level (Target *tgt) |
| Find the inv_vref and noinv_vref parameters. | |
| static std::array< int, 72 > | get_adc_medians (int i_roc, const pflib::packing::SingleECONDRocErxMapping &mapping, const std::vector< pflib::packing::MultiSampleECONDEventPacket > &data) |
| get the medians of the channel ADC values | |
| std::map< int, std::map< std::string, std::map< std::string, uint64_t > > > | local_pedestal_level (Target *tgt) |
| Level pedestals so that they are all within noise of their link median. | |
| std::map< int, std::map< std::string, std::map< std::string, uint64_t > > > | toa_scan (Target *tgt) |
| Find toa_vref per link Find trim_toa per channel. | |
| std::map< int, std::map< std::string, std::map< std::string, uint64_t > > > | toa_vref_scan (Target *tgt, bool scan_all=false, bool write_csv=false, const std::string &csv_filepath="") |
| Find TOA threshold voltage reference to align TOA values. | |
| std::map< int, std::map< std::string, std::map< std::string, uint64_t > > > | tot_scan (Target *tgt) |
| Find tot_vref per link and trim_tot per channel. | |
| std::map< int, std::map< std::string, std::map< std::string, uint64_t > > > | trim_toa_scan (Target *tgt) |
| Find trim_toa to align TOA for each channel. | |
housing of higher-level methods for repeatable tasks
Calculate the TRIM_TOA for each channel that best aligns all of them to a common threshold voltage, charge injection pulse (calib).
|
static |
get the medians of the channel ADC values
This may be helpful in some other contexts, but since it depends on the packing library it cannot go into utility. Just keeping it here for now, maybe move it into its own header/impl in algorithm.
| [in] | data | buffer of single-roc packet data |
reserve a vector of the appropriate size to avoid repeating allocation time for all 72 channels
| void pflib::algorithm::get_param | ( | Target * | tgt, |
| DecodeAndBuffer & | buffer, | ||
| const std::size_t & | nevents, | ||
| int & | step, | ||
| std::map< int, std::vector< int > > & | pedestals_l0, | ||
| std::map< int, std::vector< double > > & | stds_l0, | ||
| std::map< int, std::vector< int > > & | pedestals_l1, | ||
| std::map< int, std::vector< double > > & | stds_l1, | ||
| std::map< int, std::vector< int > > & | inv_vrefs, | ||
| std::map< int, std::array< int, 2 > > & | noinv_vref ) |
Collect inv_vref data for the constant input noinv_vref parameter.
Loops over the whole inv_vref range.
| std::array< double, 72 > pflib::algorithm::get_toa_efficiencies | ( | int | i_roc, |
| const pflib::packing::SingleECONDRocErxMapping & | mapping, | ||
| const std::vector< pflib::packing::MultiSampleECONDEventPacket > & | data ) |
calculate the highest TOA_VREF value for each link, for which there is a non-zero TOA efficiency
reserve a vector of the appropriate size to avoid repeating allocation time for all 72 channels
we assume that the data provided is not empty otherwise the efficiency calculation is meaningless
| std::map< int, std::map< std::string, std::map< std::string, uint64_t > > > pflib::algorithm::global_pedestal_level | ( | Target * | tgt | ) |
Find the inv_vref and noinv_vref parameters.
| [in] | tgt | pointer to Target to interact with |
| std::map< int, std::map< std::string, std::map< std::string, uint64_t > > > pflib::algorithm::local_pedestal_level | ( | Target * | tgt | ) |
Level pedestals so that they are all within noise of their link median.
| [in] | tgt | pointer to Target to interact with |
do three runs of 100 samples each to have well defined pedestals
| std::map< int, std::map< std::string, std::map< std::string, uint64_t > > > pflib::algorithm::toa_scan | ( | Target * | tgt | ) |
Find toa_vref per link Find trim_toa per channel.
| [in] | tgt | pointer to Target to interact with |
| std::map< int, std::map< std::string, std::map< std::string, uint64_t > > > pflib::algorithm::toa_vref_scan | ( | Target * | tgt, |
| bool | scan_all = false, | ||
| bool | write_csv = false, | ||
| const std::string & | csv_filepath = "" ) |
Find TOA threshold voltage reference to align TOA values.
| [in] | tgt | pointer to Target to interact with |
| std::map< int, std::map< std::string, std::map< std::string, uint64_t > > > pflib::algorithm::tot_scan | ( | Target * | tgt | ) |
Find tot_vref per link and trim_tot per channel.
| [in] | tgt | pointer to Target to interact with |
| std::map< int, std::map< std::string, std::map< std::string, uint64_t > > > pflib::algorithm::trim_toa_scan | ( | Target * | tgt | ) |
Find trim_toa to align TOA for each channel.
| [in] | tgt | pointer to Target to interact with |
Charge injection scan (100 samples) while varying TRIM_TOA. Purpose is to align TRIM_TOA for each channel. Calculates TOA efficiency while looking at charge injection data. Then uses A NORMAL Linear Regression to calculate the aligned TRIM_TOA value for each channel to match a common "calib" value.
Sets the offset between teh charge injection command and the following L1A. @TODO This should probably be determined once and not changed within these algorithms.
The general format that I chose to have this loop over was: CH –Trim_toa -—CALIB ---—Data collection -----—Data for the target channel on each ROC simultaneously, from the one charge injection run -—Stopping the CALIB loop for a given Trim_toa value once it had reached a point where each ROC has had an efficiency of <0.9 at least once -—Appending the data to the previously made final_data object
Now that we have the data, we need to analyze it.
We'll be looking for the turn-on (threshold) points for each channel at each trim_toa value. The turn-on (threshold) point is the first point where toa_efficiency goes reaches an efficiency of >0.9. The toa_efficiency a given trim_toa/calib/channel combination.
We'll be using a normal Linear Regression because I have found that other regressions produce lower quality values