CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Member Functions | Private Attributes
CTPPSOpticsPlotter Class Reference
Inheritance diagram for CTPPSOpticsPlotter:
edm::one::EDAnalyzer<> edm::one::EDAnalyzerBase edm::EDConsumerBase

Classes

struct  RPPlots
 

Public Member Functions

 CTPPSOpticsPlotter (const edm::ParameterSet &)
 
- Public Member Functions inherited from edm::one::EDAnalyzer<>
 EDAnalyzer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDAnalyzerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void endJob () override
 

Private Attributes

std::string opticsLabel_
 
std::string outputFile_
 
std::map< unsigned int, RPPlotsrp_plots_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 27 of file CTPPSOpticsPlotter.cc.

Constructor & Destructor Documentation

CTPPSOpticsPlotter::CTPPSOpticsPlotter ( const edm::ParameterSet iConfig)
explicit

Definition at line 87 of file CTPPSOpticsPlotter.cc.

88  : opticsLabel_(iConfig.getParameter<std::string>("opticsLabel")),
89  outputFile_(iConfig.getParameter<string>("outputFile")) {}
T getParameter(std::string const &) const

Member Function Documentation

void CTPPSOpticsPlotter::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 93 of file CTPPSOpticsPlotter.cc.

References CTPPSDetId::arm(), edm::EventSetup::get(), training_settings::idx, opticsLabel_, CTPPSDetId::rp(), rp_plots_, year_2016_postTS2_cff::rpId, CTPPSDetId::station(), LHCInterpolatedOpticalFunctionsSet::Kinematics::x, hybridSuperClusters_cfi::xi, and LHCInterpolatedOpticalFunctionsSet::Kinematics::y.

93  {
94  // stop if plots already made
95  if (!rp_plots_.empty())
96  return;
97 
98  // get conditions
100  iSetup.get<CTPPSInterpolatedOpticsRcd>().get(opticsLabel_, hOpticalFunctions);
101 
102  // stop if conditions invalid
103  if (hOpticalFunctions->empty())
104  return;
105 
106  // make plots
107  for (const auto& it : *hOpticalFunctions) {
108  CTPPSDetId rpId(it.first);
109  unsigned int rpDecId = rpId.arm() * 100 + rpId.station() * 10 + rpId.rp();
110 
111  auto& pl = rp_plots_[rpDecId];
112 
113  LHCInterpolatedOpticalFunctionsSet::Kinematics k_in_beam = {0., 0., 0., 0., 0.};
115  it.second.transport(k_in_beam, k_out_beam);
116 
117  const double vtx_ep = 1E-4; // cm
118  const double th_ep = 1E-6; // rad
119 
120  for (double xi = 0.; xi < 0.30001; xi += 0.001) {
121  LHCInterpolatedOpticalFunctionsSet::Kinematics k_in_xi = {0., 0., 0., 0., xi};
123  it.second.transport(k_in_xi, k_out_xi);
124 
125  LHCInterpolatedOpticalFunctionsSet::Kinematics k_in_xi_vtx_x = {vtx_ep, 0., 0., 0., xi};
127  it.second.transport(k_in_xi_vtx_x, k_out_xi_vtx_x);
128 
129  LHCInterpolatedOpticalFunctionsSet::Kinematics k_in_xi_th_x = {0., th_ep, 0., 0., xi};
131  it.second.transport(k_in_xi_th_x, k_out_xi_th_x);
132 
133  LHCInterpolatedOpticalFunctionsSet::Kinematics k_in_xi_vtx_y = {0., 0., vtx_ep, 0., xi};
135  it.second.transport(k_in_xi_vtx_y, k_out_xi_vtx_y);
136 
137  LHCInterpolatedOpticalFunctionsSet::Kinematics k_in_xi_th_y = {0., 0., 0., th_ep, xi};
139  it.second.transport(k_in_xi_th_y, k_out_xi_th_y);
140 
141  int idx = pl.g_v_x_vs_xi->GetN();
142 
143  pl.g_v_x_vs_xi->SetPoint(idx, xi, (k_out_xi_vtx_x.x - k_out_xi.x) / vtx_ep);
144  pl.g_L_x_vs_xi->SetPoint(idx, xi, (k_out_xi_th_x.x - k_out_xi.x) / th_ep);
145  pl.g_x_D_vs_xi->SetPoint(idx, xi, k_out_xi.x - k_out_beam.x);
146 
147  pl.g_v_y_vs_xi->SetPoint(idx, xi, (k_out_xi_vtx_y.y - k_out_xi.y) / vtx_ep);
148  pl.g_L_y_vs_xi->SetPoint(idx, xi, (k_out_xi_th_y.y - k_out_xi.y) / th_ep);
149  pl.g_y_D_vs_xi->SetPoint(idx, xi, k_out_xi.y - k_out_beam.y);
150 
151  pl.h_y_vs_x_disp->SetPoint(idx, k_out_xi.x - k_out_beam.x, k_out_xi.y - k_out_beam.y);
152  }
153  }
154 }
std::map< unsigned int, RPPlots > rp_plots_
Base class for CTPPS detector IDs.
Definition: CTPPSDetId.h:32
T get() const
Definition: EventSetup.h:71
void CTPPSOpticsPlotter::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 158 of file CTPPSOpticsPlotter.cc.

References DEFINE_FWK_MODULE, outputFile_, AlCaHLTBitMon_ParallelJobs::p, and rp_plots_.

158  {
159  auto f_out = std::make_unique<TFile>(outputFile_.c_str(), "recreate");
160 
161  for (const auto& p : rp_plots_) {
162  gDirectory = f_out->mkdir(Form("%u", p.first));
163  p.second.write();
164  }
165 }
std::map< unsigned int, RPPlots > rp_plots_

Member Data Documentation

std::string CTPPSOpticsPlotter::opticsLabel_
private

Definition at line 35 of file CTPPSOpticsPlotter.cc.

Referenced by analyze().

std::string CTPPSOpticsPlotter::outputFile_
private

Definition at line 37 of file CTPPSOpticsPlotter.cc.

Referenced by endJob().

std::map<unsigned int, RPPlots> CTPPSOpticsPlotter::rp_plots_
private

Definition at line 77 of file CTPPSOpticsPlotter.cc.

Referenced by analyze(), and endJob().