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 <functional>
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 
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 }
const double Pi
FWDoubleParameter m_fixedValToHeight
const_iterator begin() const
FWBoolParameter m_plotEt
void updateScaleFactors(float iMaxVal)
std::vector< FWParameterBase * >::const_iterator const_iterator
const_iterator end() const
void scaleParameterChanged() const
void SetFromCmsShowCommonConfig(long mode, float convert, float maxH, bool et)
bool addEntry(Long_t id, const std::string &txt)
double f[11][100]
void setFrom(const FWConfiguration &) override
sigc::signal< void()> parameterChanged_
def convert(infile, ofile)
FWDoubleParameter m_maxTowerHeight
FWEnumParameter m_scaleMode
~FWViewEnergyScale() override
sigc::signal< void(T)> changed_
FWViewEnergyScale(std::string name, int version)
float calculateScaleFactor(float iMaxVal, bool isLego) const