25 #include "TProfile2D.h" 52 std::unique_ptr<TH1D>
h_x;
53 std::unique_ptr<TH1D>
h_y;
58 const double bin_size_x = (
pixel) ? pitch *
cos(18.4 / 180. *
M_PI) : 100E-3;
60 h2_y_vs_x.reset(
new TH2D(
"",
"", 300, -10., +70., 300, -30., +30.));
61 p_y_vs_x.reset(
new TProfile(
"",
"", 300, -10., +70.));
63 int n_mi = ceil(10. / bin_size_x);
64 int n_pl = ceil(70. / bin_size_x);
66 h_x.reset(
new TH1D(
"",
"", n_mi + n_pl, -n_mi * bin_size_x, +n_pl * bin_size_x));
68 h_y.reset(
new TH1D(
"",
"", 300, -15., +15.));
74 h2_y_vs_x->Fill(x, y);
81 h2_y_vs_x->Write(
"h2_y_vs_x");
82 p_y_vs_x->Write(
"p_y_vs_x");
91 std::unique_ptr<TH1D> h_de_x,
h_de_y;
96 : h_de_x(new TH1D(
"",
";x^{F} - x^{N}", 100, -1., +1.)),
97 h_de_y(new TH1D(
"",
";y^{F} - y^{N}", 100, -1., +1.)),
98 p_de_x_vs_x(new TProfile(
"",
";x^{N};x^{F} - x^{N}", 40, 0., 40.)),
99 p_de_y_vs_x(new TProfile(
"",
";x^{N};y^{F} - y^{N}", 40, 0., 40.)),
100 p2_de_x_vs_x_y(new TProfile2D(
"",
";x;y", 40, 0., 40., 40, -20., +20.)),
101 p2_de_y_vs_x_y(new TProfile2D(
"",
";x;y", 40, 0., 40., 40, -20., +20.)) {}
103 void fill(
double x_N,
double y_N,
double x_F,
double y_F) {
104 h_de_x->Fill(x_F - x_N);
105 h_de_y->Fill(y_F - y_N);
107 p_de_x_vs_x->Fill(x_N, x_F - x_N);
108 p_de_y_vs_x->Fill(x_N, y_F - y_N);
110 p2_de_x_vs_x_y->Fill(x_N, y_N, x_F - x_N);
111 p2_de_y_vs_x_y->Fill(x_N, y_N, y_F - y_N);
115 h_de_x->Write(
"h_de_x");
116 h_de_y->Write(
"h_de_y");
118 p_de_x_vs_x->Write(
"p_de_x_vs_x");
119 p_de_y_vs_x->Write(
"p_de_y_vs_x");
121 p2_de_x_vs_x_y->Write(
"p2_de_x_vs_x_y");
122 p2_de_y_vs_x_y->Write(
"p2_de_y_vs_x_y");
133 x_pitch_pixels_(iConfig.getUntrackedParameter<double>(
"x_pitch_pixels", 150E-3)),
144 for (
const auto& trk : *tracks) {
146 unsigned int rpDecId =
rpId.arm() * 100 +
rpId.station() * 10 +
rpId.rp();
153 pl.fill(trk.getX(), trk.getY());
156 for (
const auto& t1 : *tracks) {
159 for (
const auto& t2 : *tracks) {
162 if (rpId1.arm() != rpId2.arm())
165 if (rpId1.station() == 0 && rpId2.station() == 2)
166 armPlots[rpId1.arm()].fill(t1.getX(), t1.getY(), t2.getX(), t2.getY());
174 auto f_out = std::make_unique<TFile>(
outputFile_.c_str(),
"recreate");
176 for (
const auto& it :
rpPlots) {
177 gDirectory = f_out->mkdir(Form(
"RP %u", it.first));
182 gDirectory = f_out->mkdir(Form(
"arm %u", it.first));
std::unique_ptr< TProfile2D > p2_de_y_vs_x_y
std::unique_ptr< TProfile > p_de_y_vs_x
bool getByToken(EDGetToken token, Handle< PROD > &result) const
void analyze(const edm::Event &, const edm::EventSetup &) override
std::unique_ptr< TH1D > h_y
std::map< unsigned int, ArmPlots > armPlots
~CTPPSTrackDistributionPlotter() override
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
#define DEFINE_FWK_MODULE(type)
Cos< T >::type cos(const T &t)
edm::EDGetTokenT< CTPPSLocalTrackLiteCollection > tracksToken_
void fill(double x, double y)
std::unique_ptr< TH1D > h_x
std::unique_ptr< TProfile > p_y_vs_x
std::map< unsigned int, RPPlots > rpPlots
std::vector< CTPPSLocalTrackLite > CTPPSLocalTrackLiteCollection
Collection of CTPPSLocalTrackLite objects.
std::unique_ptr< TH1D > h_de_y
Base class for CTPPS detector IDs.
std::unique_ptr< TH2D > h2_y_vs_x
void init(bool pixel, double pitch)
CTPPSTrackDistributionPlotter(const edm::ParameterSet &)
void fill(double x_N, double y_N, double x_F, double y_F)