Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:52:11

0001 #ifndef CONDTOOLS_HCAL_VISUALIZEHFPHASE1PMTPARAMS_H_
0002 #define CONDTOOLS_HCAL_VISUALIZEHFPHASE1PMTPARAMS_H_
0003 
0004 #include <vector>
0005 #include <sstream>
0006 
0007 #include "CondTools/Hcal/interface/CmdLine.h"
0008 #include "DataFormats/HcalDetId/interface/HcalDetId.h"
0009 #include "CondFormats/HcalObjects/interface/HFPhase1PMTParams.h"
0010 
0011 struct VisualizationOptions {
0012   // Initialize the visualization options to some meaningful defaults
0013   double minCharge{-1.0e2};
0014   double maxCharge{1.0e3};
0015   double minTDC{0.0};
0016   double maxTDC{25.0};
0017   double minAsymm{-5.0};
0018   double maxAsymm{5.0};
0019   unsigned plotPoints{1000};
0020   bool verbose{false};
0021 
0022   void load(cmdline::CmdLine& cmdline) {
0023     cmdline.option(nullptr, "--minAsymm") >> minAsymm;
0024     cmdline.option(nullptr, "--maxAsymm") >> maxAsymm;
0025     cmdline.option(nullptr, "--minCharge") >> minCharge;
0026     cmdline.option(nullptr, "--maxCharge") >> maxCharge;
0027     cmdline.option(nullptr, "--minTDC") >> minTDC;
0028     cmdline.option(nullptr, "--maxTDC") >> maxTDC;
0029     cmdline.option(nullptr, "--plotPoints") >> plotPoints;
0030     verbose = cmdline.has("-v");
0031   }
0032 
0033   static const char* options() {
0034     return "[-v] [--minAsymm a0] [--maxAsymm a1] [--minCharge Qmin] "
0035            "[--maxCharge Qmax] [--minTDC t0] [--maxTDC t1] [--plotPoints n]";
0036   }
0037 
0038   const char* description() const {
0039     if (descr_.empty()) {
0040       std::ostringstream os;
0041 
0042       os << "  --minAsymm   (default " << minAsymm << ") minimum value of charge asymmetry for plot axes\n\n";
0043       os << "  --maxAsymm   (default " << maxAsymm << ") maximum value of charge asymmetry for plot axes\n\n";
0044       os << "  --minCharge  (default " << minCharge << ") minimum value of charge for plot axes\n\n";
0045       os << "  --maxCharge  (default " << maxCharge << ") maximum value of charge for plot axes\n\n";
0046       os << "  --maxTDC     (default " << minTDC << ") minimum value of TDC time for plot axes\n\n";
0047       os << "  --maxTDC     (default " << maxTDC << ") maximum value of TDC time for plot axes\n\n";
0048       os << "  -v           (verbose) print various diagnostics "
0049          << "to the standard output\n";
0050 
0051       descr_ = os.str();
0052     }
0053     return descr_.c_str();
0054   }
0055 
0056 private:
0057   mutable std::string descr_;
0058 };
0059 
0060 void visualizeHFPhase1PMTParams(const std::vector<HcalDetId>& idVec,
0061                                 const HFPhase1PMTParams& cuts,
0062                                 const VisualizationOptions& options,
0063                                 const HFPhase1PMTParams* reference = nullptr);
0064 
0065 #endif  // CONDTOOLS_HCAL_VISUALIZEHFPHASE1PMTPARAMS_H_