CMS 3D CMS Logo

FWViewEnergyScale.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Core
4 // Class : FWViewEnergyScale
5 //
6 // Implementation:
7 // [Notes on implementation]
8 //
9 // Original Author: Alja Mrak-Tadel
10 // Created: Fri Jun 18 20:37:44 CEST 2010
11 //
12 
13 #include <stdexcept>
14 #include <iostream>
15 #include <boost/bind.hpp>
16 
17 #include "Rtypes.h"
18 #include "TMath.h"
23 
26  m_scaleMode(this, "ScaleMode", 1l, 1l, 2l),
27  m_fixedValToHeight(this, "EnergyToLength [GeV/m]", 50.0, 1.0, 1000.0),
28  m_maxTowerHeight(this, "MaximumLength [m]", 3.0, 0.01, 30.0),
29  m_plotEt(this, "PlotEt", true),
30  m_name(name),
31  m_scaleFactor3D(1.f),
32  m_scaleFactorLego(0.05f) {
33  m_scaleMode.addEntry(kFixedScale, "FixedScale");
34  m_scaleMode.addEntry(kAutoScale, "AutomaticScale");
35  m_scaleMode.addEntry(kCombinedScale, "CombinedScale");
36 
40  m_plotEt.changed_.connect(boost::bind(&FWViewEnergyScale::scaleParameterChanged, this));
41 }
42 
44 
45 //________________________________________________________
46 
48 
49 float FWViewEnergyScale::calculateScaleFactor(float iMaxVal, bool isLego) const {
50  // check if in combined mode
51  int mode = m_scaleMode.value();
52  if (mode == kCombinedScale) {
54  // printf("COMBINED \n");
55  }
56  // get converison
57 
58  if (mode == kFixedScale) {
59  // printf("fixed mode %f \n",m_fixedValToHeight.value());
60  // apply default constructor height
61  float length = isLego ? TMath::Pi() : 100;
62  return length / m_fixedValToHeight.value();
63  } else {
64  float length = isLego ? TMath::Pi() : (100 * m_maxTowerHeight.value());
65  // printf("[%d] length %f max %f \n", isLego, length, iMaxVal);
66  return length / iMaxVal;
67  }
68 }
69 
71  m_scaleFactor3D = calculateScaleFactor(iMaxVal, false);
72  m_scaleFactorLego = calculateScaleFactor(iMaxVal, true);
73 }
74 
76  for (const_iterator it = begin(), itEnd = end(); it != itEnd; ++it) {
77  (*it)->setFrom(iFrom);
78  }
79 }
80 
81 void FWViewEnergyScale::SetFromCmsShowCommonConfig(long mode, float convert, float maxH, bool et) {
84  m_maxTowerHeight.set(maxH);
85  m_plotEt.set(et > 0);
86 }
FWViewEnergyScale::m_scaleFactor3D
float m_scaleFactor3D
Definition: FWViewEnergyScale.h:74
FWParameterizable::const_iterator
std::vector< FWParameterBase * >::const_iterator const_iterator
Definition: FWParameterizable.h:34
FWViewEnergyScale::calculateScaleFactor
float calculateScaleFactor(float iMaxVal, bool isLego) const
Definition: FWViewEnergyScale.cc:49
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
FWEveView.h
ALCARECOPromptCalibProdSiPixelAli0T_cff.mode
mode
Definition: ALCARECOPromptCalibProdSiPixelAli0T_cff.py:96
FWEnumParameter::addEntry
bool addEntry(Long_t id, const std::string &txt)
Definition: FWEnumParameter.h:53
FWParameterizable::end
const_iterator end() const
Definition: FWParameterizable.h:38
FWViewEnergyScale::updateScaleFactors
void updateScaleFactors(float iMaxVal)
Definition: FWViewEnergyScale.cc:70
FWGenericParameter::set
void set(T iValue)
Definition: FWGenericParameter.h:70
FWViewEnergyScale::m_plotEt
FWBoolParameter m_plotEt
Definition: FWViewEnergyScale.h:63
FWParameterizable::begin
const_iterator begin() const
Definition: FWParameterizable.h:36
FWViewEnergyScale::scaleParameterChanged
void scaleParameterChanged() const
Definition: FWViewEnergyScale.cc:47
FWGenericParameter::changed_
sigc::signal< void, T > changed_
Definition: FWGenericParameter.h:75
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
fileCollector.convert
def convert(infile, ofile)
Definition: fileCollector.py:47
funct::true
true
Definition: Factorize.h:173
FWViewEnergyScale::setFrom
void setFrom(const FWConfiguration &) override
Definition: FWViewEnergyScale.cc:75
FWConfigurableParameterizable
Definition: FWConfigurableParameterizable.h:29
FWViewEnergyScale::kFixedScale
Definition: FWViewEnergyScale.h:38
FWViewEnergyScale::kCombinedScale
Definition: FWViewEnergyScale.h:38
FWViewEnergyScale::SetFromCmsShowCommonConfig
void SetFromCmsShowCommonConfig(long mode, float convert, float maxH, bool et)
Definition: FWViewEnergyScale.cc:81
EgHLTOffHistBins_cfi.et
et
Definition: EgHLTOffHistBins_cfi.py:8
FWViewEnergyScale::m_maxTowerHeight
FWDoubleParameter m_maxTowerHeight
Definition: FWViewEnergyScale.h:62
cmsLHEtoEOSManager.l
l
Definition: cmsLHEtoEOSManager.py:193
FWGenericParameter::value
T value() const
Definition: FWGenericParameter.h:50
CmsShowCommon.h
FWViewEnergyScale::~FWViewEnergyScale
~FWViewEnergyScale() override
Definition: FWViewEnergyScale.cc:43
FWViewEnergyScale::m_scaleMode
FWEnumParameter m_scaleMode
Definition: FWViewEnergyScale.h:60
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
Pi
const double Pi
Definition: CosmicMuonParameters.h:18
FWViewEnergyScale::parameterChanged_
sigc::signal< void > parameterChanged_
Definition: FWViewEnergyScale.h:51
FWViewEnergyScale.h
FWConfiguration
Definition: FWConfiguration.h:31
FWViewEnergyScale::m_fixedValToHeight
FWDoubleParameter m_fixedValToHeight
Definition: FWViewEnergyScale.h:61
FWViewEnergyScale::kAutoScale
Definition: FWViewEnergyScale.h:38
BeamSplash_cfg.version
version
Definition: BeamSplash_cfg.py:45
FWViewEnergyScale::m_scaleFactorLego
float m_scaleFactorLego
Definition: FWViewEnergyScale.h:75
FWViewEnergyScale::FWViewEnergyScale
FWViewEnergyScale(std::string name, int version)
Definition: FWViewEnergyScale.cc:24
Context.h