Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:27:20

0001 // -*- C++ -*-
0002 //
0003 // Package:     Core
0004 // Class  :     FWViewType
0005 //
0006 // Implementation:
0007 //     [Notes on implementation]
0008 //
0009 // Original Author:  Alja Mrak-Tadel
0010 //         Created:  Fri Mar 26 12:25:02 CET 2010
0011 //
0012 
0013 // system include files
0014 
0015 // user include files
0016 #include "Fireworks/Core/interface/FWViewType.h"
0017 #include "Fireworks/Core/interface/fwLog.h"
0018 
0019 //
0020 // constants, enums and typedefs
0021 //
0022 
0023 //
0024 // static data member definitions
0025 //
0026 
0027 const int FWViewType::kAllRPZBits = kRhoPhiBit | kRhoZBit | kRhoPhiPFBit;
0028 const int FWViewType::kAll3DBits = kISpyBit | k3DBit;
0029 const int FWViewType::kAllLegoBits = kLegoBit | kLegoHFBit | kLegoPFECALBit;
0030 
0031 std::string FWViewType::sName[FWViewType::kTypeSize];
0032 
0033 FWViewType::static_initializer::static_initializer() {
0034   sName[kRhoPhi] = "Rho Phi";
0035   sName[kRhoZ] = "Rho Z";
0036   sName[k3D] = "3D Tower";
0037   sName[kISpy] = "3D RecHit";
0038   sName[kGlimpse] = "Glimpse";
0039   sName[kLego] = "Lego";
0040   sName[kLegoHF] = "HF";
0041   sName[kTable] = "Table";
0042   sName[kTableHLT] = "HLT Table";
0043   sName[kTableL1] = "L1 Table";
0044   sName[kLegoPFECAL] = "PF ECAL Lego";
0045   sName[kRhoPhiPF] = "PF Rho Phi";
0046   sName[kGeometryTable] = "Geometry Table";
0047   sName[kOverlapTable] = "Overlap Table";
0048 }
0049 
0050 FWViewType::static_initializer init_statics;
0051 
0052 //
0053 // constructors and destructor
0054 //
0055 FWViewType::FWViewType(EType t) : m_id(t) {}
0056 
0057 FWViewType::~FWViewType() {}
0058 
0059 //
0060 // member functions
0061 //
0062 
0063 //
0064 // const member functions
0065 //
0066 const std::string& FWViewType::name() const { return sName[m_id]; }
0067 
0068 FWViewType::EType FWViewType::id() const { return m_id; }
0069 //
0070 // static member functions
0071 //
0072 const std::string& FWViewType::idToName(int id) { return sName[id]; }
0073 
0074 const std::string& switchName(const std::string& old, FWViewType::EType id) {
0075   fwLog(fwlog::kDebug) << old << " view has been renamed to " << FWViewType::idToName(id) << ".\n";
0076   return (const std::string&)FWViewType::idToName(id);
0077 }
0078 
0079 const std::string& FWViewType::checkNameWithViewVersion(const std::string& refName, unsigned int version) {
0080   // printf("version %d %s \n", version, refName.c_str());fflush(stdout);
0081   if (version < 2) {
0082     if (refName == "TriggerTable")
0083       return switchName(refName, FWViewType::kTableHLT);
0084     else if (refName == "L1TriggerTable")
0085       return switchName(refName, FWViewType::kTableL1);
0086   }
0087   if (version < 3) {
0088     if (refName == "3D Lego")
0089       return switchName(refName, FWViewType::kLego);
0090   }
0091   if (version < 7) {
0092     if (refName == "iSpy")
0093       return switchName(refName, FWViewType::kISpy);
0094     if (refName == "3D")
0095       return switchName(refName, FWViewType::k3D);
0096   }
0097   return refName;
0098 }
0099 
0100 bool FWViewType::isProjected(int id) { return (id == kRhoPhi || id == kRhoZ || id == kRhoPhiPF); }
0101 
0102 bool FWViewType::isLego(int id) { return (id == kLego || id == kLegoHF || id == kLegoPFECAL); }