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 ( )

Definition at line 15 of file PPSDirectSimulationData.cc.

◆ ~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.

34  {
35  return efficienciesPerPlane_;
36 };

References efficienciesPerPlane_.

Referenced by CTPPSCompositeESSource::buildDirectSimuData().

◆ getEfficienciesPerRP()

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

Definition at line 31 of file PPSDirectSimulationData.cc.

31  {
32  return efficienciesPerRP_;
33 }

References efficienciesPerRP_.

Referenced by CTPPSCompositeESSource::buildDirectSimuData().

◆ getEmpiricalAperture45()

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

Definition at line 25 of file PPSDirectSimulationData.cc.

25 { return empiricalAperture45_; }

References empiricalAperture45_.

◆ getEmpiricalAperture56()

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

Definition at line 26 of file PPSDirectSimulationData.cc.

26 { return empiricalAperture56_; }

References empiricalAperture56_.

◆ getTimeResolutionDiamonds45()

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

Definition at line 28 of file PPSDirectSimulationData.cc.

28 { return timeResolutionDiamonds45_; }

References timeResolutionDiamonds45_.

◆ getTimeResolutionDiamonds56()

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

Definition at line 29 of file PPSDirectSimulationData.cc.

29 { return timeResolutionDiamonds56_; }

References timeResolutionDiamonds56_.

◆ loadEffeciencyHistogramsPerPlane()

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

Definition at line 54 of file PPSDirectSimulationData.cc.

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 }

References efficienciesPerPlane_, loadObject(), replace(), mps_fire::result, profile_2016_postTS2_cff::rpId, CTPPSDetId::sdTimingDiamond, CTPPSDetId::sdTrackingPixel, and CTPPSDetId::sdTrackingStrip.

◆ loadEffeciencyHistogramsPerRP()

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

Definition at line 45 of file PPSDirectSimulationData.cc.

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 }

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

◆ loadObject()

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

Definition at line 85 of file PPSDirectSimulationData.cc.

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 }

References Exception, and geometryDiff::file.

Referenced by loadEffeciencyHistogramsPerPlane(), and loadEffeciencyHistogramsPerRP().

◆ 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.

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 }

References input.

Referenced by loadEffeciencyHistogramsPerPlane().

◆ 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
input
static const std::string input
Definition: EdmProvDump.cc:48
PPSDirectSimulationData::efficienciesPerPlane_
std::map< unsigned int, FileObject > efficienciesPerPlane_
Definition: PPSDirectSimulationData.h:44
PPSDirectSimulationData::empiricalAperture45_
std::string empiricalAperture45_
Definition: PPSDirectSimulationData.h:38
to
PPSDirectSimulationData::empiricalAperture56_
std::string empiricalAperture56_
Definition: PPSDirectSimulationData.h:39
edm::FileInPath
Definition: FileInPath.h:61
CTPPSDetId::sdTrackingStrip
Definition: CTPPSDetId.h:44
alignCSCRings.s
s
Definition: alignCSCRings.py:92
CTPPSDetId::sdTimingDiamond
Definition: CTPPSDetId.h:44
PPSDirectSimulationData::efficienciesPerRP_
std::map< unsigned int, FileObject > efficienciesPerRP_
Definition: PPSDirectSimulationData.h:44
PPSDirectSimulationData::loadObject
static std::unique_ptr< TH2F > loadObject(const std::string &file, const std::string &object)
Definition: PPSDirectSimulationData.cc:85
CTPPSDetId::sdTrackingPixel
Definition: CTPPSDetId.h:44
geometryDiff.file
file
Definition: geometryDiff.py:13
CTPPSDiamondDetId
Detector ID class for CTPPS Timing Diamond detectors. Bits [19:31] : Assigend in CTPPSDetId Calss Bit...
Definition: CTPPSDiamondDetId.h:24
CTPPSDetId
Base class for CTPPS detector IDs.
Definition: CTPPSDetId.h:31
CTPPSPixelDetId
Definition: CTPPSPixelDetId.h:16
PPSDirectSimulationData::timeResolutionDiamonds56_
std::string timeResolutionDiamonds56_
Definition: PPSDirectSimulationData.h:42
profile_2016_postTS2_cff.rpId
rpId
Definition: profile_2016_postTS2_cff.py:21
Exception
Definition: hltDiff.cc:245
PPSDirectSimulationData::replace
static std::string replace(std::string input, const std::string &from, const std::string &to)
Definition: PPSDirectSimulationData.cc:103
PPSDirectSimulationData::timeResolutionDiamonds45_
std::string timeResolutionDiamonds45_
Definition: PPSDirectSimulationData.h:41
mps_fire.result
result
Definition: mps_fire.py:311
TotemRPDetId
Detector ID class for TOTEM Si strip detectors.
Definition: TotemRPDetId.h:29