54 using namespace HepMC;
64 useNewLHCInfo_(iConfig.getParameter<
bool>(
"useNewLHCInfo")),
66 outputFile_(iConfig.getParameter<
string>(
"outputFile")),
68 h_vtx_x_(new TH1D(
"h_vtx_x",
";vtx_x (mm)", 100, 0., 0.)),
69 h_vtx_y_(new TH1D(
"h_vtx_y",
";vtx_y (mm)", 100, 0., 0.)),
70 h_vtx_z_(new TH1D(
"h_vtx_z",
";vtx_z (mm)", 100, 0., 0.)),
71 h_vtx_t_(new TH1D(
"h_vtx_t",
";vtx_t (mm)", 100, 0., 0.)),
73 h_xi_(new TH1D(
"h_xi",
";#xi", 100, 0., 0.30)),
74 h_th_x_(new TH1D(
"h_th_x",
";#theta^{*}_{x}", 100, -300E-6, +300E-6)),
75 h_th_y_(new TH1D(
"h_th_y",
";#theta^{*}_{y}", 100, -300E-6, +300E-6)) {}
82 desc.add<
std::string>(
"lhcInfoLabel",
"")->setComment(
"label of the LHCInfo record");
83 desc.add<
std::string>(
"lhcInfoPerLSLabel",
"")->setComment(
"label of the LHCInfoPerLS record");
84 desc.add<
std::string>(
"lhcInfoPerFillLabel",
"")->setComment(
"label of the LHCInfoPerFill record");
85 desc.add<
bool>(
"useNewLHCInfo",
false)->setComment(
"flag whether to use new LHCInfoPer* records or old LHCInfo");
89 descriptions.
add(
"ctppsHepMCDistributionPlotterDefault",
desc);
103 const auto pos = (*vit)->position();
111 for (
auto it = hepMCEvent->particles_begin();
it != hepMCEvent->particles_end(); ++
it) {
115 if (
part->pdg_id() != 2212)
118 if (
part->status() != 1)
124 const auto &mom =
part->momentum();
125 const double p_nom = lhcInfoCombined.
energy;
127 if (mom.rho() / p_nom < 0.7)
130 const double xi_simu = (p_nom - mom.e()) / p_nom;
131 const double th_x_simu = mom.x() / mom.rho();
132 const double th_y_simu = mom.y() / mom.rho();
134 h_xi_->Fill(xi_simu);
143 auto f_out = std::make_unique<TFile>(
outputFile_.c_str(),
"recreate");
std::unique_ptr< TH1D > h_vtx_t_
const bool useNewLHCInfo_
const edm::EDGetTokenT< edm::HepMCProduct > tokenHepMC_
std::unique_ptr< TH1D > h_vtx_x_
const edm::ESGetToken< LHCInfoPerFill, LHCInfoPerFillRcd > lhcInfoPerFillToken_
CTPPSHepMCDistributionPlotter(const edm::ParameterSet &)
const edm::ESGetToken< LHCInfo, LHCInfoRcd > lhcInfoToken_
#define DEFINE_FWK_MODULE(type)
const edm::ESGetToken< LHCInfoPerLS, LHCInfoPerLSRcd > lhcInfoPerLSToken_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::unique_ptr< TH1D > h_th_x_
const HepMC::GenEvent * GetEvent() const
std::unique_ptr< TH1D > h_xi_
std::unique_ptr< TH1D > h_vtx_y_
std::unique_ptr< TH1D > h_th_y_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void analyze(const edm::Event &, const edm::EventSetup &) override
const std::string outputFile_
std::unique_ptr< TH1D > h_vtx_z_
VertexRefVector::iterator vertex_iterator
iterator over a vector of references to Vertex objects in the same collection