Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:02:38

0001 #ifndef CondFormats_SiStripObjects_CalibrationScanAnalysis_H
0002 #define CondFormats_SiStripObjects_CalibrationScanAnalysis_H
0003 
0004 #include "CondFormats/SiStripObjects/interface/CommissioningAnalysis.h"
0005 #include "DataFormats/SiStripCommon/interface/SiStripConstants.h"
0006 #include <sstream>
0007 #include <vector>
0008 #include <map>
0009 #include "TGraph.h"
0010 #include "TGraph2D.h"
0011 #include <cstdint>
0012 
0013 /**
0014    @class CalibrationScanAnalysis
0015    @author R. Gerosa
0016    @brief Analysis for calibration scans
0017 */
0018 
0019 class CalibrationScanAnalysis : public CommissioningAnalysis {
0020 public:
0021   CalibrationScanAnalysis(const uint32_t& key, const bool& deconv);
0022   CalibrationScanAnalysis(const bool& deconv);
0023 
0024   ~CalibrationScanAnalysis() override { ; }
0025 
0026   void addOneCalibrationPoint(const std::string& key);
0027 
0028   friend class CalibrationScanAlgorithm;
0029 
0030   inline const VBool isValid(const std::string& key) { return isvalid_[key]; }  // analysis validity
0031   bool isValid() const override;
0032 
0033   inline const VFloat& amplitude(const std::string& key) {
0034     return amplitude_[key];
0035   }  // key stands for isha_%d_vfs_%d values
0036   inline const VFloat& tail(const std::string& key) { return tail_[key]; }
0037   inline const VFloat& riseTime(const std::string& key) { return riseTime_[key]; }
0038   inline const VFloat& decayTime(const std::string& key) { return decayTime_[key]; }
0039   inline const VFloat& turnOn(const std::string& key) { return turnOn_[key]; }
0040   inline const VFloat& peakTime(const std::string& key) { return peakTime_[key]; }
0041   inline const VFloat& undershoot(const std::string& key) { return undershoot_[key]; }
0042   inline const VFloat& baseline(const std::string& key) { return baseline_[key]; }
0043   inline const VFloat& smearing(const std::string& key) { return smearing_[key]; }
0044   inline const VFloat& chi2(const std::string& key) { return chi2_[key]; }
0045 
0046   inline const VFloat& tunedAmplitude() { return tunedAmplitude_; }
0047   inline const VFloat& tunedTail() { return tunedTail_; }
0048   inline const VFloat& tunedRiseTime() { return tunedRiseTime_; }
0049   inline const VFloat& tunedDecayTime() { return tunedDecayTime_; }
0050   inline const VFloat& tunedTurnOn() { return tunedTurnOn_; }
0051   inline const VFloat& tunedPeakTime() { return tunedPeakTime_; }
0052   inline const VFloat& tunedUndershoot() { return tunedUndershoot_; }
0053   inline const VFloat& tunedBaseline() { return tunedBaseline_; }
0054   inline const VFloat& tunedSmearing() { return tunedSmearing_; }
0055   inline const VFloat& tunedChi2() { return tunedChi2_; }
0056 
0057   inline const VInt& tunedISHA() { return tunedISHA_; }
0058   inline const VInt& tunedVFS() { return tunedVFS_; }
0059 
0060   inline const std::vector<TGraph*>& decayTimeVsVFS() { return decayTime_vs_vfs_; }
0061   inline const std::vector<TGraph*>& riseTimeVsISHA() { return riseTime_vs_isha_; }
0062   inline const std::vector<TGraph2D*>& decayTimeVsISHAVsVFS() { return decayTime_vs_isha_vfs_; }
0063   inline const std::vector<TGraph2D*>& riseTimeVsISHAVsVFS() { return riseTime_vs_isha_vfs_; }
0064 
0065   inline const VInt& bestISHA() { return isha_; }
0066   inline const VInt& bestVFS() { return vfs_; }
0067 
0068   inline bool deconvMode() { return deconv_; }
0069 
0070   void print(std::stringstream&, uint32_t not_used = 0) override;
0071   void reset() override;
0072 
0073   /** Values for quality cuts */
0074   static const float minAmplitudeThreshold_;
0075   static const float minBaselineThreshold_;
0076   static const float maxBaselineThreshold_;
0077   static const float maxChi2Threshold_;
0078   static const float minDecayTimeThreshold_;
0079   static const float maxDecayTimeThreshold_;
0080   static const float minPeakTimeThreshold_;
0081   static const float maxPeakTimeThreshold_;
0082   static const float minRiseTimeThreshold_;
0083   static const float maxRiseTimeThreshold_;
0084   static const float minTurnOnThreshold_;
0085   static const float maxTurnOnThreshold_;
0086   static const float minISHAforVFSTune_;
0087   static const float maxISHAforVFSTune_;
0088   static const float VFSrange_;
0089 
0090 private:
0091   /** Parameters extracted from the fit of pulse shape */
0092   std::map<std::string, VFloat> amplitude_;
0093   std::map<std::string, VFloat> tail_;
0094   std::map<std::string, VFloat> riseTime_;
0095   std::map<std::string, VFloat> decayTime_;
0096   std::map<std::string, VFloat> turnOn_;
0097   std::map<std::string, VFloat> peakTime_;
0098   std::map<std::string, VFloat> undershoot_;
0099   std::map<std::string, VFloat> baseline_;
0100   std::map<std::string, VFloat> smearing_;
0101   std::map<std::string, VFloat> chi2_;
0102   std::map<std::string, VBool> isvalid_;
0103 
0104   bool deconv_;
0105 
0106   /** Best isha and vfs values --> one per APV --> interpolate linearly allows a better evaluation compared to the point scanned */
0107   std::vector<TGraph*> decayTime_vs_vfs_;
0108   std::vector<TGraph*> riseTime_vs_isha_;
0109   std::vector<TGraph2D*> riseTime_vs_isha_vfs_;
0110   std::vector<TGraph2D*> decayTime_vs_isha_vfs_;
0111 
0112   VInt isha_;
0113   VInt vfs_;
0114 
0115   /** properties of pulse shapes closes to the optimal ISHA and VFS values */
0116   VFloat tunedAmplitude_, tunedTail_;
0117   VFloat tunedRiseTime_, tunedDecayTime_;
0118   VFloat tunedTurnOn_, tunedPeakTime_;
0119   VFloat tunedUndershoot_, tunedBaseline_;
0120   VFloat tunedSmearing_, tunedChi2_;
0121   VInt tunedISHA_, tunedVFS_;
0122 };
0123 
0124 #endif  // CondFormats_SiStripObjects_CalibrationScanAnalysis_H