25 #include "TProfile2D.h" 56 std::unique_ptr<TH1D>
h_x;
57 std::unique_ptr<TH1D>
h_y;
63 const double bin_size_x = (
pixel) ? pitch *
cos(18.4 / 180. *
M_PI) : 100E-3;
65 h2_y_vs_x.reset(
new TH2D(
"",
"", 300, -10., +70., 600, -30., +30.));
66 p_y_vs_x.reset(
new TProfile(
"",
"", 300, -10., +70.));
68 int n_mi = ceil(10. / bin_size_x);
69 int n_pl = ceil(70. / bin_size_x);
71 h_x.reset(
new TH1D(
"",
"", n_mi + n_pl, -n_mi * bin_size_x, +n_pl * bin_size_x));
73 h_y.reset(
new TH1D(
"",
"", 300, -15., +15.));
75 h_time.reset(
new TH1D(
"",
";time", 500, -50., +50.));
81 h2_y_vs_x->Fill(x, y);
89 h2_y_vs_x->Write(
"h2_y_vs_x");
90 p_y_vs_x->Write(
"p_y_vs_x");
93 h_time->Write(
"h_time");
109 unsigned int sN = 0, s1 = 0;
112 std::map<unsigned int, std::map<unsigned int, Stat>>
m_stat;
115 : h_de_x(new TH1D(
"",
";x^{F} - x^{N}", 100, -1., +1.)),
116 h_de_y(new TH1D(
"",
";y^{F} - y^{N}", 100, -1., +1.)),
117 p_de_x_vs_x(new TProfile(
"",
";x^{N};x^{F} - x^{N}", 40, 0., 40.)),
118 p_de_y_vs_x(new TProfile(
"",
";x^{N};y^{F} - y^{N}", 40, 0., 40.)),
119 p2_de_x_vs_x_y(new TProfile2D(
"",
";x;y", 40, 0., 40., 40, -20., +20.)),
120 p2_de_y_vs_x_y(new TProfile2D(
"",
";x;y", 40, 0., 40., 40, -20., +20.)),
121 h2_de_x_vs_x(new TH2D(
"",
";x^{N};x^{F} - x^{N}", 80, 0., 40., 100, -1., +1.)),
122 h2_de_y_vs_x(new TH2D(
"",
";x^{N};y^{F} - y^{N}", 80, 0., 40., 100, -1., +1.)),
123 h2_de_y_vs_de_x(new TH2D(
"",
";x^{F} - x^{N};y^{F} - y^{N}", 100, -1., +1., 100, -1., +1.)) {}
125 void fill(
double x_N,
double y_N,
double x_F,
double y_F) {
126 h_de_x->Fill(x_F - x_N);
127 h_de_y->Fill(y_F - y_N);
129 p_de_x_vs_x->Fill(x_N, x_F - x_N);
130 p_de_y_vs_x->Fill(x_N, y_F - y_N);
132 p2_de_x_vs_x_y->Fill(x_N, y_N, x_F - x_N);
133 p2_de_y_vs_x_y->Fill(x_N, y_N, y_F - y_N);
135 h2_de_x_vs_x->Fill(x_N, x_F - x_N);
136 h2_de_y_vs_x->Fill(x_N, y_F - y_N);
138 h2_de_y_vs_de_x->Fill(x_F - x_N, y_F - y_N);
142 h_de_x->Write(
"h_de_x");
143 h_de_y->Write(
"h_de_y");
145 p_de_x_vs_x->Write(
"p_de_x_vs_x");
146 p_de_y_vs_x->Write(
"p_de_y_vs_x");
148 p2_de_x_vs_x_y->Write(
"p2_de_x_vs_x_y");
149 p2_de_y_vs_x_y->Write(
"p2_de_y_vs_x_y");
151 h2_de_x_vs_x->Write(
"h2_de_x_vs_x");
152 h2_de_y_vs_x->Write(
"h2_de_y_vs_x");
154 h2_de_y_vs_de_x->Write(
"h2_de_y_vs_de_x");
156 for (
const auto& rp : m_stat) {
157 TGraph*
g =
new TGraph();
160 sprintf(buf,
"g_mean_track_mult_run_%u", rp.first);
163 for (
const auto& lsp : rp.second) {
164 const int idx = g->GetN();
165 const double m = (lsp.second.s1 > 0) ?
double(lsp.second.sN) / lsp.second.s1 : 0.;
166 g->SetPoint(idx, lsp.first, m);
181 x_pitch_pixels_(iConfig.getUntrackedParameter<double>(
"x_pitch_pixels", 150E-3)),
199 std::map<unsigned int, unsigned int> m_mult;
201 for (
const auto& trk : *tracks) {
203 unsigned int rpDecId =
rpId.arm() * 100 +
rpId.station() * 10 +
rpId.rp();
210 pl.fill(trk.getX(), trk.getY(), trk.getTime());
212 m_mult[
rpId.arm()]++;
215 for (
unsigned int arm = 0;
arm < 2; ++
arm) {
218 st.sN += m_mult[
arm];
221 for (
const auto& t1 : *tracks) {
224 for (
const auto& t2 : *tracks) {
227 if (rpId1.arm() != rpId2.arm())
232 const unsigned int rpDecId1 = rpId1.arm() * 100 + rpId1.station() * 10 + rpId1.rp();
233 const unsigned int rpDecId2 = rpId2.arm() * 100 + rpId2.station() * 10 + rpId2.rp();
235 if (rpDecId1 == ap.rpId_N && rpDecId2 == ap.rpId_F)
236 ap.fill(t1.getX(), t1.getY(), t2.getX(), t2.getY());
257 auto f_out = std::make_unique<TFile>(
outputFile_.c_str(),
"recreate");
259 for (
const auto& it :
rpPlots) {
260 gDirectory = f_out->mkdir(Form(
"RP %u", it.first));
265 gDirectory = f_out->mkdir(Form(
"arm %u", it.first));
T getParameter(std::string const &) const
std::unique_ptr< TProfile2D > p2_de_y_vs_x_y
std::map< unsigned int, unsigned int > events_per_arm_
unsigned int events_total_
std::unique_ptr< TH2D > h2_de_y_vs_de_x
std::unique_ptr< TProfile > p_de_y_vs_x
std::unique_ptr< TH2D > h2_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
LuminosityBlockNumber_t luminosityBlock() const
~CTPPSTrackDistributionPlotter() override
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
std::map< unsigned int, std::map< unsigned int, Stat > > m_stat
std::unique_ptr< TH1D > h_time
#define DEFINE_FWK_MODULE(type)
Cos< T >::type cos(const T &t)
edm::EDGetTokenT< CTPPSLocalTrackLiteCollection > tracksToken_
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)
void fill(double x, double y, double time)