26 #include "TProfile2D.h" 58 std::unique_ptr<TH1D>
h_x;
59 std::unique_ptr<TH1D>
h_y;
70 const double bin_size_x = (
pixel) ? pitch *
cos(18.4 / 180. *
M_PI) : 100E-3;
72 h2_y_vs_x = std::make_unique<TH2D>(
"",
"", 300, -10., +70., 600, -30., +30.);
73 p_y_vs_x = std::make_unique<TProfile>(
"",
"", 300, -10., +70.);
75 int n_mi =
ceil(10. / bin_size_x);
76 int n_pl =
ceil(70. / bin_size_x);
78 h_x = std::make_unique<TH1D>(
"",
"", n_mi + n_pl, -n_mi * bin_size_x, +n_pl * bin_size_x);
80 h_y = std::make_unique<TH1D>(
"",
"", 300, -15., +15.);
82 h_time = std::make_unique<TH1D>(
"",
";time", 500, -50., +50.);
85 std::make_unique<TH2D>(
"h2_de_x_vs_x",
"h2_de_x_vs_x;x;distance in x axis", 300, -30., +30., 300, -3., +3.);
87 std::make_unique<TH2D>(
"h2_de_x_vs_y",
"h2_de_x_vs_y;y;distance in x axis", 300, -30., +30., 300, -3., +3.);
89 std::make_unique<TH2D>(
"h2_de_y_vs_x",
"h2_de_y_vs_x;x;distance in y axis", 300, -30., +30., 300, -3., +3.);
91 std::make_unique<TH2D>(
"h2_de_y_vs_y",
"h2_de_y_vs_y;y;distance in y axis", 300, -30., +30., 300, -3., +3.);
134 std::map<unsigned int, std::map<unsigned int, Stat>>
m_stat;
137 :
h_de_x(new TH1D(
"",
";x^{F} - x^{N}", 100, -1., +1.)),
138 h_de_y(new TH1D(
"",
";y^{F} - y^{N}", 100, -1., +1.)),
140 p_de_x_vs_x(new TProfile(
"",
";x^{N};x^{F} - x^{N}", 80, 0., 40.,
"s")),
141 p_de_y_vs_x(new TProfile(
"",
";x^{N};y^{F} - y^{N}", 80, 0., 40.,
"s")),
143 p_de_x_vs_y(new TProfile(
"",
";y^{N};x^{F} - x^{N}", 80, -20., +20.,
"s")),
144 p_de_y_vs_y(new TProfile(
"",
";y^{N};y^{F} - y^{N}", 80, -20., +20.,
"s")),
146 p2_de_x_vs_x_y(new TProfile2D(
"",
";x;y;x^{F} - x^{N}", 80, 0., 40., 80, -20., +20.,
"s")),
147 p2_de_y_vs_x_y(new TProfile2D(
"",
";x;y;y^{F} - y^{N}", 80, 0., 40., 80, -20., +20.,
"s")),
149 h2_de_x_vs_x(new TH2D(
"",
";x^{N};x^{F} - x^{N}", 80, 0., 40., 100, -1., +1.)),
150 h2_de_y_vs_x(new TH2D(
"",
";x^{N};y^{F} - y^{N}", 80, 0., 40., 100, -1., +1.)),
151 h2_de_y_vs_de_x(new TH2D(
"",
";x^{F} - x^{N};y^{F} - y^{N}", 100, -1., +1., 100, -1., +1.)) {}
153 void fill(
double x_N,
double y_N,
double x_F,
double y_F) {
196 for (
const auto& rp :
m_stat) {
197 TGraph*
g =
new TGraph();
200 sprintf(
buf,
"g_mean_track_mult_run_%u", rp.first);
203 for (
const auto& lsp : rp.second) {
204 const int idx =
g->GetN();
205 const double m = (lsp.second.s1 > 0) ?
double(lsp.second.sN) / lsp.second.s1 : 0.;
206 g->SetPoint(
idx, lsp.first,
m);
214 std::unique_ptr<TH1D>
output =
215 std::make_unique<TH1D>(
"",
p->GetTitle(),
p->GetNbinsX(),
p->GetXaxis()->GetXmin(),
p->GetXaxis()->GetXmax());
217 for (
int bi = 1; bi <=
output->GetNbinsX(); ++bi)
218 output->SetBinContent(bi,
p->GetBinError(bi));
224 std::unique_ptr<TH2D>
output = std::make_unique<TH2D>(
"",
227 p->GetXaxis()->GetXmin(),
228 p->GetXaxis()->GetXmax(),
230 p->GetYaxis()->GetXmin(),
231 p->GetYaxis()->GetXmax());
233 for (
int bi_x = 1; bi_x <=
output->GetNbinsX(); ++bi_x)
234 for (
int bi_y = 1; bi_y <=
output->GetNbinsY(); ++bi_y)
235 output->SetBinContent(bi_x, bi_y,
p->GetBinError(bi_x, bi_y));
248 x_pitch_pixels_(iConfig.getUntrackedParameter<double>(
"x_pitch_pixels", 150E-3)),
249 outputFile_(iConfig.getParameter<
std::
string>(
"outputFile")),
266 std::map<unsigned int, unsigned int> m_mult;
268 for (
const auto& trk : *
tracks) {
270 unsigned int rpDecId =
rpId.arm() * 100 +
rpId.station() * 10 +
rpId.rp();
277 pl.fillOneTrack(trk.x(), trk.y(), trk.time());
279 m_mult[
rpId.arm()]++;
282 for (
unsigned int arm = 0;
arm < 2; ++
arm) {
285 st.sN += m_mult[
arm];
294 if (rpId1.arm() != rpId2.arm())
299 const unsigned int rpDecId1 = rpId1.arm() * 100 + rpId1.station() * 10 + rpId1.rp();
300 const unsigned int rpDecId2 = rpId2.arm() * 100 + rpId2.station() * 10 + rpId2.rp();
302 if (rpDecId1 == ap.rpId_N && rpDecId2 == ap.rpId_F)
303 ap.fill(
t1.x(),
t1.y(),
t2.x(),
t2.y());
307 for (
unsigned int i = 0;
i <
tracks->size(); ++
i) {
308 for (
unsigned int j = 0;
j <
tracks->size(); ++
j) {
312 const auto& tr_i =
tracks->at(
i);
313 const auto& tr_j =
tracks->at(
j);
315 if (tr_i.rpId() != tr_j.rpId())
319 unsigned int rpDecId =
rpId.arm() * 100 +
rpId.station() * 10 +
rpId.rp();
323 pl.h2_de_x_vs_x->Fill(tr_i.x(), tr_j.x() - tr_i.x());
324 pl.h2_de_x_vs_y->Fill(tr_i.y(), tr_j.x() - tr_i.x());
325 pl.h2_de_y_vs_x->Fill(tr_i.x(), tr_j.y() - tr_i.y());
326 pl.h2_de_y_vs_y->Fill(tr_i.y(), tr_j.y() - tr_i.y());
347 auto f_out = std::make_unique<TFile>(
outputFile_.c_str(),
"recreate");
350 gDirectory = f_out->mkdir(Form(
"RP %u",
it.first));
355 gDirectory = f_out->mkdir(Form(
"arm %u",
it.first));
constexpr int32_t ceil(float num)
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
static std::unique_ptr< TH2D > buildRMSHistogram(const std::unique_ptr< TProfile2D > &p)
std::unique_ptr< TProfile2D > p2_de_x_vs_x_y
std::unique_ptr< TH2D > h2_de_x_vs_y
std::unique_ptr< TH1D > h_de_x
void analyze(const edm::Event &, const edm::EventSetup &) override
std::unique_ptr< TH1D > h_y
std::map< unsigned int, ArmPlots > armPlots
std::unique_ptr< TProfile > p_de_x_vs_x
std::unique_ptr< TH2D > h2_de_x_vs_x
~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
std::map< unsigned int, std::map< unsigned int, Stat > > m_stat
std::unique_ptr< TH1D > h_time
std::unique_ptr< TH2D > h2_de_y_vs_x
std::unique_ptr< TH2D > h2_de_y_vs_y
Cos< T >::type cos(const T &t)
edm::EDGetTokenT< CTPPSLocalTrackLiteCollection > tracksToken_
#define DEFINE_FWK_MODULE(type)
static std::unique_ptr< TH1D > buildRMSHistogram(const std::unique_ptr< TProfile > &p)
std::unique_ptr< TH1D > h_x
std::unique_ptr< TProfile > p_y_vs_x
std::unique_ptr< TProfile > p_de_x_vs_y
std::unique_ptr< TH2D > h2_de_x_vs_x
std::map< unsigned int, RPPlots > rpPlots
Log< level::Info, false > LogInfo
void fillOneTrack(double x, double y, double time)
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)
std::unique_ptr< TProfile > p_de_y_vs_y
CTPPSTrackDistributionPlotter(const edm::ParameterSet &)
void fill(double x_N, double y_N, double x_F, double y_F)