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  ArmPlots
 
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
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () 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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (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::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
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::map< unsigned int, ArmPlotsarm_plots_
 
edm::ESGetToken< LHCInterpolatedOpticalFunctionsSetCollection, CTPPSInterpolatedOpticsRcdopticsESToken_
 
std::string outputFile_
 
std::map< unsigned int, RPPlotsrp_plots_
 
unsigned int rpId_45_F_
 
unsigned int rpId_45_N_
 
unsigned int rpId_56_F_
 
unsigned int rpId_56_N_
 

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
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 26 of file CTPPSOpticsPlotter.cc.

Constructor & Destructor Documentation

◆ CTPPSOpticsPlotter()

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

Definition at line 107 of file CTPPSOpticsPlotter.cc.

109  : opticsESToken_(esConsumes(ESInputTag("", iConfig.getParameter<std::string>("opticsLabel")))),
110 
111  rpId_45_N_(iConfig.getParameter<unsigned int>("rpId_45_N")),
112  rpId_45_F_(iConfig.getParameter<unsigned int>("rpId_45_F")),
113  rpId_56_N_(iConfig.getParameter<unsigned int>("rpId_56_N")),
114  rpId_56_F_(iConfig.getParameter<unsigned int>("rpId_56_F")),
115 
116  outputFile_(iConfig.getParameter<string>("outputFile")) {
117  arm_plots_[0].id_N = rpId_45_N_;
118  arm_plots_[0].id_F = rpId_45_F_;
119 
120  arm_plots_[1].id_N = rpId_56_N_;
121  arm_plots_[1].id_F = rpId_56_F_;

References arm_plots_, rpId_45_F_, rpId_45_N_, rpId_56_F_, and rpId_56_N_.

Member Function Documentation

◆ analyze()

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

Implements edm::one::EDAnalyzerBase.

Definition at line 125 of file CTPPSOpticsPlotter.cc.

126  {
127  // stop if plots already made
128  if (!rp_plots_.empty())
129  return;
130 
131  // get conditions
132  const auto& opticalFunctions = iSetup.getData(opticsESToken_);
133 
134  // stop if conditions invalid
135  if (opticalFunctions.empty())
136  return;
137 
138  // make per-RP plots
139  for (const auto& it : opticalFunctions) {
140  CTPPSDetId rpId(it.first);
141  unsigned int rpDecId = rpId.arm() * 100 + rpId.station() * 10 + rpId.rp();
142 
143  auto& pl = rp_plots_[rpDecId];
144 
145  LHCInterpolatedOpticalFunctionsSet::Kinematics k_in_beam = {0., 0., 0., 0., 0.};
147  it.second.transport(k_in_beam, k_out_beam);
148 
149  const double vtx_ep = 1E-4; // cm
150  const double th_ep = 1E-6; // rad
151 
152  for (double xi = 0.; xi < 0.30001; xi += 0.001) {
153  LHCInterpolatedOpticalFunctionsSet::Kinematics k_in_xi = {0., 0., 0., 0., xi};
155  it.second.transport(k_in_xi, k_out_xi);
156 
157  LHCInterpolatedOpticalFunctionsSet::Kinematics k_in_xi_vtx_x = {vtx_ep, 0., 0., 0., xi};
159  it.second.transport(k_in_xi_vtx_x, k_out_xi_vtx_x);
160 
161  LHCInterpolatedOpticalFunctionsSet::Kinematics k_in_xi_th_x = {0., th_ep, 0., 0., xi};
163  it.second.transport(k_in_xi_th_x, k_out_xi_th_x);
164 
165  LHCInterpolatedOpticalFunctionsSet::Kinematics k_in_xi_vtx_y = {0., 0., vtx_ep, 0., xi};
167  it.second.transport(k_in_xi_vtx_y, k_out_xi_vtx_y);
168 
169  LHCInterpolatedOpticalFunctionsSet::Kinematics k_in_xi_th_y = {0., 0., 0., th_ep, xi};
171  it.second.transport(k_in_xi_th_y, k_out_xi_th_y);
172 
173  int idx = pl.g_v_x_vs_xi->GetN();
174 
175  pl.g_v_x_vs_xi->SetPoint(idx, xi, (k_out_xi_vtx_x.x - k_out_xi.x) / vtx_ep);
176  pl.g_L_x_vs_xi->SetPoint(idx, xi, (k_out_xi_th_x.x - k_out_xi.x) / th_ep);
177  pl.g_x_D_vs_xi->SetPoint(idx, xi, k_out_xi.x - k_out_beam.x);
178 
179  pl.g_v_y_vs_xi->SetPoint(idx, xi, (k_out_xi_vtx_y.y - k_out_xi.y) / vtx_ep);
180  pl.g_L_y_vs_xi->SetPoint(idx, xi, (k_out_xi_th_y.y - k_out_xi.y) / th_ep);
181  pl.g_y_D_vs_xi->SetPoint(idx, xi, k_out_xi.y - k_out_beam.y);
182 
183  pl.h_y_vs_x_disp->SetPoint(idx, k_out_xi.x - k_out_beam.x, k_out_xi.y - k_out_beam.y);
184  }
185  }
186 
187  // make per-arm plots
188  for (const auto& ap : arm_plots_) {
189  // find optics objects
190  const LHCInterpolatedOpticalFunctionsSet *opt_N = nullptr, *opt_F = nullptr;
191 
192  for (const auto& it : opticalFunctions) {
193  CTPPSDetId rpId(it.first);
194  unsigned int rpDecId = rpId.arm() * 100 + rpId.station() * 10 + rpId.rp();
195 
196  if (rpDecId == ap.second.id_N)
197  opt_N = &it.second;
198  if (rpDecId == ap.second.id_F)
199  opt_F = &it.second;
200  }
201 
202  if (!opt_N || !opt_F) {
203  edm::LogError("CTPPSOpticsPlotter::analyze") << "Cannot find optics objects for arm " << ap.first;
204  continue;
205  }
206 
207  LHCInterpolatedOpticalFunctionsSet::Kinematics k_in_beam = {0., 0., 0., 0., 0.};
208 
209  LHCInterpolatedOpticalFunctionsSet::Kinematics k_out_beam_N, k_out_beam_F;
210  opt_N->transport(k_in_beam, k_out_beam_N);
211  opt_F->transport(k_in_beam, k_out_beam_F);
212 
213  for (double xi = 0.; xi < 0.30001; xi += 0.001) {
214  LHCInterpolatedOpticalFunctionsSet::Kinematics k_in_xi = {0., 0., 0., 0., xi};
215 
216  LHCInterpolatedOpticalFunctionsSet::Kinematics k_out_xi_N, k_out_xi_F;
217  opt_N->transport(k_in_xi, k_out_xi_N);
218  opt_F->transport(k_in_xi, k_out_xi_F);
219 
220  int idx = ap.second.g_de_x_vs_x_disp->GetN();
221 
222  ap.second.g_de_x_vs_x_disp->SetPoint(
223  idx, k_out_xi_N.x - k_out_beam_N.x, (k_out_xi_F.x - k_out_beam_F.x) - (k_out_xi_N.x - k_out_beam_N.x));
224  ap.second.g_de_y_vs_x_disp->SetPoint(
225  idx, k_out_xi_N.x - k_out_beam_N.x, (k_out_xi_F.y - k_out_beam_F.y) - (k_out_xi_N.y - k_out_beam_N.y));
226  }
227  }

References arm_plots_, edm::EventSetup::getData(), heavyIonCSV_trainingSettings::idx, OpticalFunctionsConfig_cfi::opticalFunctions, opticsESToken_, rp_plots_, profile_2016_postTS2_cff::rpId, LHCInterpolatedOpticalFunctionsSet::transport(), LHCInterpolatedOpticalFunctionsSet::Kinematics::x, protons_cff::xi, and LHCInterpolatedOpticalFunctionsSet::Kinematics::y.

◆ endJob()

void CTPPSOpticsPlotter::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 231 of file CTPPSOpticsPlotter.cc.

232  {
233  auto f_out = std::make_unique<TFile>(outputFile_.c_str(), "recreate");
234 
235  for (const auto& p : rp_plots_) {
236  gDirectory = f_out->mkdir(Form("%u", p.first));
237  p.second.write();
238  }
239 
240  for (const auto& p : arm_plots_) {
241  gDirectory = f_out->mkdir(Form("arm %u", p.first));
242  p.second.write();
243  }

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

Member Data Documentation

◆ arm_plots_

std::map<unsigned int, ArmPlots> CTPPSOpticsPlotter::arm_plots_
private

Definition at line 99 of file CTPPSOpticsPlotter.cc.

Referenced by analyze(), CTPPSOpticsPlotter(), and endJob().

◆ opticsESToken_

Definition at line 36 of file CTPPSOpticsPlotter.cc.

Referenced by analyze().

◆ outputFile_

std::string CTPPSOpticsPlotter::outputFile_
private

Definition at line 41 of file CTPPSOpticsPlotter.cc.

Referenced by endJob().

◆ rp_plots_

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

Definition at line 81 of file CTPPSOpticsPlotter.cc.

Referenced by analyze(), and endJob().

◆ rpId_45_F_

unsigned int CTPPSOpticsPlotter::rpId_45_F_
private

Definition at line 38 of file CTPPSOpticsPlotter.cc.

Referenced by CTPPSOpticsPlotter().

◆ rpId_45_N_

unsigned int CTPPSOpticsPlotter::rpId_45_N_
private

Definition at line 38 of file CTPPSOpticsPlotter.cc.

Referenced by CTPPSOpticsPlotter().

◆ rpId_56_F_

unsigned int CTPPSOpticsPlotter::rpId_56_F_
private

Definition at line 39 of file CTPPSOpticsPlotter.cc.

Referenced by CTPPSOpticsPlotter().

◆ rpId_56_N_

unsigned int CTPPSOpticsPlotter::rpId_56_N_
private

Definition at line 39 of file CTPPSOpticsPlotter.cc.

Referenced by CTPPSOpticsPlotter().

edm::ESInputTag
Definition: ESInputTag.h:87
LHCInterpolatedOpticalFunctionsSet::Kinematics
proton kinematics description
Definition: LHCInterpolatedOpticalFunctionsSet.h:28
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
CTPPSOpticsPlotter::rpId_45_F_
unsigned int rpId_45_F_
Definition: CTPPSOpticsPlotter.cc:38
CTPPSOpticsPlotter::rpId_56_F_
unsigned int rpId_56_F_
Definition: CTPPSOpticsPlotter.cc:39
heavyIonCSV_trainingSettings.idx
idx
Definition: heavyIonCSV_trainingSettings.py:5
CTPPSOpticsPlotter::rpId_56_N_
unsigned int rpId_56_N_
Definition: CTPPSOpticsPlotter.cc:39
LHCInterpolatedOpticalFunctionsSet::Kinematics::y
double y
Definition: LHCInterpolatedOpticalFunctionsSet.h:31
CTPPSOpticsPlotter::opticsESToken_
edm::ESGetToken< LHCInterpolatedOpticalFunctionsSetCollection, CTPPSInterpolatedOpticsRcd > opticsESToken_
Definition: CTPPSOpticsPlotter.cc:36
LHCInterpolatedOpticalFunctionsSet::Kinematics::x
double x
Definition: LHCInterpolatedOpticalFunctionsSet.h:29
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
CTPPSOpticsPlotter::rp_plots_
std::map< unsigned int, RPPlots > rp_plots_
Definition: CTPPSOpticsPlotter.cc:81
LHCInterpolatedOpticalFunctionsSet
Set of optical functions corresponding to one scoring plane along LHC, including splines for interpol...
Definition: LHCInterpolatedOpticalFunctionsSet.h:14
CTPPSOpticsPlotter::outputFile_
std::string outputFile_
Definition: CTPPSOpticsPlotter.cc:41
CTPPSDetId
Base class for CTPPS detector IDs.
Definition: CTPPSDetId.h:31
CTPPSOpticsPlotter::rpId_45_N_
unsigned int rpId_45_N_
Definition: CTPPSOpticsPlotter.cc:38
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:127
profile_2016_postTS2_cff.rpId
rpId
Definition: profile_2016_postTS2_cff.py:21
protons_cff.xi
xi
Definition: protons_cff.py:35
CTPPSOpticsPlotter::arm_plots_
std::map< unsigned int, ArmPlots > arm_plots_
Definition: CTPPSOpticsPlotter.cc:99
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::EDConsumerBase::esConsumes
auto esConsumes()
Definition: EDConsumerBase.h:202
LHCInterpolatedOpticalFunctionsSet::transport
void transport(const Kinematics &input, Kinematics &output, bool calculateAngles=false) const
transports proton according to the splines
Definition: LHCInterpolatedOpticalFunctionsSet.cc:17
OpticalFunctionsConfig_cfi.opticalFunctions
opticalFunctions
Definition: OpticalFunctionsConfig_cfi.py:16