46 h_de_th_x(new TH1D(
"",
";#Delta#theta_{x} (rad)", 100, 0., 0.)),
47 h_de_th_y(new TH1D(
"",
";#Delta#theta_{y} (rad)", 100, 0., 0.)),
48 h_de_p(new TH1D(
"",
";#Deltap (GeV)", 100, 0., 0.)) {}
52 h_de_th_x->Write(
"h_de_th_x");
53 h_de_th_y->Write(
"h_de_th_y");
54 h_de_p->Write(
"h_de_p");
65 using namespace HepMC;
73 h_de_vtx_x_(new TH1D(
"h_de_vtx_x",
";#Delta vtx_{x} (mm)", 100, 0., 0.)),
74 h_de_vtx_y_(new TH1D(
"h_de_vtx_y",
";#Delta vtx_{y} (mm)", 100, 0., 0.)),
75 h_de_vtx_z_(new TH1D(
"h_de_vtx_z",
";#Delta vtx_{z} (mm)", 100, 0., 0.))
92 GenEvent::vertex_const_iterator vold, vnew;
93 for (vold = orig->vertices_begin(), vnew = smear->vertices_begin();
94 vold != orig->vertices_end() && vnew != smear->vertices_end(); ++vold, ++vnew)
96 const FourVector &vo = (*vold)->position();
97 const FourVector &vn = (*vnew)->position();
106 GenEvent::particle_const_iterator pold, pnew;
107 for (pold = orig->particles_begin(), pnew = smear->particles_begin();
108 pold != orig->particles_end() && pnew != smear->particles_end(); ++pold, ++pnew)
110 FourVector
o = (*pold)->momentum(),
n = (*pnew)->momentum();
114 const double thetaLim = 0.01;
115 double th = o.theta();
119 if (th > (
M_PI - thetaLim))
134 double othx = o.x() / o.rho(), othy = o.y() / o.rho();
135 double nthx =
n.x() /
n.rho(), nthy =
n.y() /
n.rho();
137 sp.h_de_p->Fill(
n.rho() - o.rho());
139 sp.h_de_th_x->Fill(nthx - othx);
140 sp.h_de_th_y->Fill(nthy - othy);
148 auto f_out = std::make_unique<TFile>(
outputFile_.c_str(),
"recreate");
154 gDirectory = f_out->mkdir(
"sector 45");
157 gDirectory = f_out->mkdir(
"sector 56");
void analyze(const edm::Event &, const edm::EventSetup &) override
~CTPPSBeamSmearingValidator() override
bool getByToken(EDGetToken token, Handle< PROD > &result) const
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
std::unique_ptr< TH1D > h_de_vtx_z_
#define DEFINE_FWK_MODULE(type)
std::unique_ptr< TH1D > h_de_vtx_x_
edm::EDGetTokenT< edm::HepMCProduct > tokenAfterSmearing_
std::unique_ptr< TH1D > h_de_th_y
std::unique_ptr< TH1D > h_de_vtx_y_
const HepMC::GenEvent * GetEvent() const
std::unique_ptr< TH1D > h_de_p
std::unique_ptr< TH1D > h_de_th_x
edm::EDGetTokenT< edm::HepMCProduct > tokenBeforeSmearing_
std::map< unsigned int, SectorPlots > sectorPlots_
CTPPSBeamSmearingValidator(const edm::ParameterSet &)