VisualizationOptions

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
#ifndef CONDTOOLS_HCAL_VISUALIZEHFPHASE1PMTPARAMS_H_
#define CONDTOOLS_HCAL_VISUALIZEHFPHASE1PMTPARAMS_H_

#include <vector>
#include <sstream>

#include "CondTools/Hcal/interface/CmdLine.h"
#include "DataFormats/HcalDetId/interface/HcalDetId.h"
#include "CondFormats/HcalObjects/interface/HFPhase1PMTParams.h"

struct VisualizationOptions {
  // Initialize the visualization options to some meaningful defaults
  double minCharge{-1.0e2};
  double maxCharge{1.0e3};
  double minTDC{0.0};
  double maxTDC{25.0};
  double minAsymm{-5.0};
  double maxAsymm{5.0};
  unsigned plotPoints{1000};
  bool verbose{false};

  void load(cmdline::CmdLine& cmdline) {
    cmdline.option(nullptr, "--minAsymm") >> minAsymm;
    cmdline.option(nullptr, "--maxAsymm") >> maxAsymm;
    cmdline.option(nullptr, "--minCharge") >> minCharge;
    cmdline.option(nullptr, "--maxCharge") >> maxCharge;
    cmdline.option(nullptr, "--minTDC") >> minTDC;
    cmdline.option(nullptr, "--maxTDC") >> maxTDC;
    cmdline.option(nullptr, "--plotPoints") >> plotPoints;
    verbose = cmdline.has("-v");
  }

  static const char* options() {
    return "[-v] [--minAsymm a0] [--maxAsymm a1] [--minCharge Qmin] "
           "[--maxCharge Qmax] [--minTDC t0] [--maxTDC t1] [--plotPoints n]";
  }

  const char* description() const {
    if (descr_.empty()) {
      std::ostringstream os;

      os << "  --minAsymm   (default " << minAsymm << ") minimum value of charge asymmetry for plot axes\n\n";
      os << "  --maxAsymm   (default " << maxAsymm << ") maximum value of charge asymmetry for plot axes\n\n";
      os << "  --minCharge  (default " << minCharge << ") minimum value of charge for plot axes\n\n";
      os << "  --maxCharge  (default " << maxCharge << ") maximum value of charge for plot axes\n\n";
      os << "  --maxTDC     (default " << minTDC << ") minimum value of TDC time for plot axes\n\n";
      os << "  --maxTDC     (default " << maxTDC << ") maximum value of TDC time for plot axes\n\n";
      os << "  -v           (verbose) print various diagnostics "
         << "to the standard output\n";

      descr_ = os.str();
    }
    return descr_.c_str();
  }

private:
  mutable std::string descr_;
};

void visualizeHFPhase1PMTParams(const std::vector<HcalDetId>& idVec,
                                const HFPhase1PMTParams& cuts,
                                const VisualizationOptions& options,
                                const HFPhase1PMTParams* reference = nullptr);

#endif  // CONDTOOLS_HCAL_VISUALIZEHFPHASE1PMTPARAMS_H_