CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Friends
PPSDirectSimulationData Class Reference

#include <PPSDirectSimulationData.h>

Public Types

typedef std::pair< std::string, std::string > FileObject
 

Public Member Functions

std::map< unsigned int, FileObject > & getEfficienciesPerPlane ()
 
std::map< unsigned int, FileObject > & getEfficienciesPerRP ()
 
const std::string & getEmpiricalAperture45 () const
 
const std::string & getEmpiricalAperture56 () const
 
const std::string & getTimeResolutionDiamonds45 () const
 
const std::string & getTimeResolutionDiamonds56 () const
 
std::map< unsigned int, std::unique_ptr< TH2F > > loadEffeciencyHistogramsPerPlane () const
 
std::map< unsigned int, std::unique_ptr< TH2F > > loadEffeciencyHistogramsPerRP () const
 
 PPSDirectSimulationData ()
 
void setEmpiricalAperture45 (std::string s)
 
void setEmpiricalAperture56 (std::string s)
 
void setTimeResolutionDiamonds45 (std::string s)
 
void setTimeResolutionDiamonds56 (std::string s)
 
 ~PPSDirectSimulationData ()
 

Private Member Functions

template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 

Static Private Member Functions

static std::unique_ptr< TH2F > loadObject (const std::string &file, const std::string &object)
 
static std::string replace (std::string input, const std::string &from, const std::string &to)
 

Private Attributes

std::map< unsigned int, FileObjectefficienciesPerPlane_
 
std::map< unsigned int, FileObjectefficienciesPerRP_
 
std::string empiricalAperture45_
 
std::string empiricalAperture56_
 
std::string timeResolutionDiamonds45_
 
std::string timeResolutionDiamonds56_
 

Friends

class boost::serialization::access
 
template<typename CondSerializationT , typename Enabled >
struct cond::serialization::access
 

Detailed Description

Definition at line 9 of file PPSDirectSimulationData.h.

Member Typedef Documentation

◆ FileObject

typedef std::pair<std::string, std::string> PPSDirectSimulationData::FileObject

Definition at line 14 of file PPSDirectSimulationData.h.

Constructor & Destructor Documentation

◆ PPSDirectSimulationData()

PPSDirectSimulationData::PPSDirectSimulationData ( )

◆ ~PPSDirectSimulationData()

PPSDirectSimulationData::~PPSDirectSimulationData ( )

Definition at line 22 of file PPSDirectSimulationData.cc.

22 {}

Member Function Documentation

◆ getEfficienciesPerPlane()

std::map< unsigned int, PPSDirectSimulationData::FileObject > & PPSDirectSimulationData::getEfficienciesPerPlane ( )

Definition at line 34 of file PPSDirectSimulationData.cc.

References efficienciesPerPlane_.

Referenced by CTPPSCompositeESSource::buildDirectSimuData().

34  {
35  return efficienciesPerPlane_;
36 };
std::map< unsigned int, FileObject > efficienciesPerPlane_

◆ getEfficienciesPerRP()

std::map< unsigned int, PPSDirectSimulationData::FileObject > & PPSDirectSimulationData::getEfficienciesPerRP ( )

Definition at line 31 of file PPSDirectSimulationData.cc.

References efficienciesPerRP_.

Referenced by CTPPSCompositeESSource::buildDirectSimuData().

31  {
32  return efficienciesPerRP_;
33 }
std::map< unsigned int, FileObject > efficienciesPerRP_

◆ getEmpiricalAperture45()

const std::string & PPSDirectSimulationData::getEmpiricalAperture45 ( ) const

Definition at line 25 of file PPSDirectSimulationData.cc.

References empiricalAperture45_.

25 { return empiricalAperture45_; }

◆ getEmpiricalAperture56()

const std::string & PPSDirectSimulationData::getEmpiricalAperture56 ( ) const

Definition at line 26 of file PPSDirectSimulationData.cc.

References empiricalAperture56_.

26 { return empiricalAperture56_; }

◆ getTimeResolutionDiamonds45()

const std::string & PPSDirectSimulationData::getTimeResolutionDiamonds45 ( ) const

Definition at line 28 of file PPSDirectSimulationData.cc.

References timeResolutionDiamonds45_.

◆ getTimeResolutionDiamonds56()

const std::string & PPSDirectSimulationData::getTimeResolutionDiamonds56 ( ) const

Definition at line 29 of file PPSDirectSimulationData.cc.

References timeResolutionDiamonds56_.

◆ loadEffeciencyHistogramsPerPlane()

std::map< unsigned int, std::unique_ptr< TH2F > > PPSDirectSimulationData::loadEffeciencyHistogramsPerPlane ( ) const

Definition at line 54 of file PPSDirectSimulationData.cc.

References CTPPSDetId::arm(), efficienciesPerPlane_, loadObject(), replace(), mps_fire::result, CTPPSDetId::rp(), CTPPSDetId::sdTimingDiamond, CTPPSDetId::sdTrackingPixel, CTPPSDetId::sdTrackingStrip, CTPPSDetId::station(), DetId::subdetId(), and cond::impl::to_string().

54  {
55  std::map<unsigned int, std::unique_ptr<TH2F>> result;
56 
57  for (const auto &it : efficienciesPerPlane_) {
58  CTPPSDetId rpId(it.first);
59 
60  if (rpId.subdetId() == CTPPSDetId::sdTrackingStrip) {
61  for (unsigned int pl = 0; pl < 10; ++pl) {
62  TotemRPDetId plId(rpId.arm(), rpId.station(), rpId.rp(), pl);
63  result[plId] = loadObject(it.second.first, replace(it.second.second, "<detid>", std::to_string(pl)));
64  }
65  }
66 
67  if (rpId.subdetId() == CTPPSDetId::sdTrackingPixel) {
68  for (unsigned int pl = 0; pl < 6; ++pl) {
69  CTPPSPixelDetId plId(rpId.arm(), rpId.station(), rpId.rp(), pl);
70  result[plId] = loadObject(it.second.first, replace(it.second.second, "<detid>", std::to_string(pl)));
71  }
72  }
73 
74  if (rpId.subdetId() == CTPPSDetId::sdTimingDiamond) {
75  for (unsigned int pl = 0; pl < 4; ++pl) {
76  CTPPSDiamondDetId plId(rpId.arm(), rpId.station(), rpId.rp(), pl);
77  result[plId] = loadObject(it.second.first, replace(it.second.second, "<detid>", std::to_string(pl)));
78  }
79  }
80  }
81 
82  return result;
83 }
Detector ID class for TOTEM Si strip detectors.
Definition: TotemRPDetId.h:30
static std::string replace(std::string input, const std::string &from, const std::string &to)
std::string to_string(const V &value)
Definition: OMSAccess.h:77
static std::unique_ptr< TH2F > loadObject(const std::string &file, const std::string &object)
Base class for CTPPS detector IDs.
Definition: CTPPSDetId.h:32
Detector ID class for CTPPS Timing Diamond detectors. Bits [19:31] : Assigend in CTPPSDetId Calss Bit...
std::map< unsigned int, FileObject > efficienciesPerPlane_

◆ loadEffeciencyHistogramsPerRP()

std::map< unsigned int, std::unique_ptr< TH2F > > PPSDirectSimulationData::loadEffeciencyHistogramsPerRP ( ) const

Definition at line 45 of file PPSDirectSimulationData.cc.

References efficienciesPerRP_, loadObject(), and mps_fire::result.

45  {
46  std::map<unsigned int, std::unique_ptr<TH2F>> result;
47 
48  for (const auto &it : efficienciesPerRP_)
49  result[it.first] = loadObject(it.second.first, it.second.second);
50 
51  return result;
52 }
std::map< unsigned int, FileObject > efficienciesPerRP_
static std::unique_ptr< TH2F > loadObject(const std::string &file, const std::string &object)

◆ loadObject()

std::unique_ptr< TH2F > PPSDirectSimulationData::loadObject ( const std::string &  file,
const std::string &  object 
)
staticprivate

Definition at line 85 of file PPSDirectSimulationData.cc.

References Exception, and geometryDiff::file.

Referenced by loadEffeciencyHistogramsPerPlane(), and loadEffeciencyHistogramsPerRP().

85  {
86  edm::FileInPath fip(file.c_str());
87  TFile *f_in = TFile::Open(fip.fullPath().c_str());
88  if (!f_in)
89  throw cms::Exception("PPS") << "Cannot open file '" << fip.fullPath() << "'.";
90 
91  TH2F *o_in = (TH2F *)f_in->Get(object.c_str());
92  if (!o_in)
93  throw cms::Exception("PPS") << "Cannot load object '" << object << "' from file '" << fip.fullPath() << "'.";
94 
95  // disassociate histogram from the file
96  o_in->SetDirectory(nullptr);
97 
98  delete f_in;
99 
100  return std::unique_ptr<TH2F>(o_in);
101 }

◆ replace()

std::string PPSDirectSimulationData::replace ( std::string  input,
const std::string &  from,
const std::string &  to 
)
staticprivate

Definition at line 103 of file PPSDirectSimulationData.cc.

References input.

Referenced by loadEffeciencyHistogramsPerPlane().

103  {
104  size_t start_pos = 0;
105  while ((start_pos = input.find(from, start_pos)) != std::string::npos) {
106  input.replace(start_pos, from.length(), to);
107  start_pos += to.length();
108  }
109  return input;
110 }
static std::string const input
Definition: EdmProvDump.cc:50

◆ serialize()

template<class Archive >
void PPSDirectSimulationData::serialize ( Archive &  ar,
const unsigned int  version 
)
private

◆ setEmpiricalAperture45()

void PPSDirectSimulationData::setEmpiricalAperture45 ( std::string  s)

◆ setEmpiricalAperture56()

void PPSDirectSimulationData::setEmpiricalAperture56 ( std::string  s)

◆ setTimeResolutionDiamonds45()

void PPSDirectSimulationData::setTimeResolutionDiamonds45 ( std::string  s)

◆ setTimeResolutionDiamonds56()

void PPSDirectSimulationData::setTimeResolutionDiamonds56 ( std::string  s)

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Definition at line 49 of file PPSDirectSimulationData.h.

◆ cond::serialization::access

template<typename CondSerializationT , typename Enabled >
friend struct cond::serialization::access
friend

Definition at line 49 of file PPSDirectSimulationData.h.

Member Data Documentation

◆ efficienciesPerPlane_

std::map<unsigned int, FileObject> PPSDirectSimulationData::efficienciesPerPlane_
private

◆ efficienciesPerRP_

std::map<unsigned int, FileObject> PPSDirectSimulationData::efficienciesPerRP_
private

◆ empiricalAperture45_

std::string PPSDirectSimulationData::empiricalAperture45_
private

Definition at line 38 of file PPSDirectSimulationData.h.

Referenced by getEmpiricalAperture45(), and setEmpiricalAperture45().

◆ empiricalAperture56_

std::string PPSDirectSimulationData::empiricalAperture56_
private

Definition at line 39 of file PPSDirectSimulationData.h.

Referenced by getEmpiricalAperture56(), and setEmpiricalAperture56().

◆ timeResolutionDiamonds45_

std::string PPSDirectSimulationData::timeResolutionDiamonds45_
private

◆ timeResolutionDiamonds56_

std::string PPSDirectSimulationData::timeResolutionDiamonds56_
private