58 auto h_xi_rat = std::make_unique<TH1D>(*h_xi_acc);
60 h_xi_rat->Write(
"h_xi_rat");
73 :
h_m_all(new TH1D(
"",
";m (GeV)", 100, 0., 2500.)),
74 h_m_acc(new TH1D(
"",
";m (GeV)", 100, 0., 2500.)),
77 h2_y_vs_m_all(new TH2D(
"",
";m (GeV);y", 25, 0., 2500., 25, -1.5, +1.5)),
78 h2_y_vs_m_acc(new TH2D(
"",
";m (GeV);y", 25, 0., 2500., 25, -1.5, +1.5)) {}
80 void fill(
double xi_45,
double xi_56,
bool acc) {
81 const double p_nom = 6500.;
82 const double m = 2. * p_nom *
sqrt(xi_45 * xi_56);
83 const double y =
log(xi_45 / xi_56) / 2.;
100 auto h_m_rat = std::make_unique<TH1D>(*h_m_acc);
101 h_m_rat->Divide(
h_m_all.get());
102 h_m_rat->Write(
"h_m_rat");
107 auto h2_xi_45_vs_xi_56_rat = std::make_unique<TH2D>(*h2_xi_45_vs_xi_56_acc);
109 h2_xi_45_vs_xi_56_rat->Write(
"h2_xi_45_vs_xi_56_rat");
114 auto h2_y_vs_m_rat = std::make_unique<TH2D>(*h2_y_vs_m_acc);
116 h2_y_vs_m_rat->Write(
"h2_y_vs_m_rat");
128 using namespace HepMC;
135 rpId_45_N_(iConfig.getParameter<unsigned
int>(
"rpId_45_N")),
136 rpId_45_F_(iConfig.getParameter<unsigned
int>(
"rpId_45_F")),
137 rpId_56_N_(iConfig.getParameter<unsigned
int>(
"rpId_56_N")),
138 rpId_56_F_(iConfig.getParameter<unsigned
int>(
"rpId_56_F")),
139 outputFile_(iConfig.getParameter<
string>(
"outputFile")) {
168 bool proton_45_set =
false;
169 bool proton_56_set =
false;
170 FourVector mom_45, mom_56;
172 for (
auto it = hepMCEvent->particles_begin(); it != hepMCEvent->particles_end(); ++it) {
173 const auto &
part = *it;
176 if (
part->pdg_id() != 2212)
179 if (
part->status() != 1)
185 const auto &mom =
part->momentum();
193 LogError(
"CTPPSAcceptancePlotter") <<
"Multiple protons found in sector 45.";
197 proton_45_set =
true;
202 LogError(
"CTPPSAcceptancePlotter") <<
"Multiple protons found in sector 56.";
206 proton_56_set =
true;
212 if (!proton_45_set || !proton_56_set)
216 const double p_nom = 6500.;
217 const double xi_45 = (p_nom - mom_45.e()) / p_nom;
218 const double xi_56 = (p_nom - mom_56.e()) / p_nom;
221 map<unsigned int, bool> trackPresent;
222 for (
const auto &trk : *hTracks) {
224 unsigned int rpDecId = rpId.
arm() * 100 + rpId.station() * 10 + rpId.rp();
225 trackPresent[rpDecId] =
true;
232 for (
const auto rpId :
rpIds) {
233 acc &= trackPresent[rpId];
240 const double xi = (
arm == 0) ? xi_45 : xi_56;
247 for (
const auto rpId :
rpIds)
248 acc &= trackPresent[rpId];
257 auto f_out = std::make_unique<TFile>(
outputFile_.c_str(),
"recreate");
261 for (
const auto &rpId :
p.first) {
267 gDirectory = f_out->mkdir(
dirName.c_str());
273 for (
const auto &rpId :
p.first) {
279 gDirectory = f_out->mkdir(
dirName.c_str());
std::unique_ptr< TH1D > h_xi_acc
#define DEFINE_FWK_MODULE(type)
CTPPSAcceptancePlotter(const edm::ParameterSet &)
Log< level::Error, false > LogError
std::unique_ptr< TH1D > h_m_acc
std::unique_ptr< TH1D > h_xi_all
std::unique_ptr< TH1D > h_m_all
std::unique_ptr< TH2D > h2_y_vs_m_all
std::unique_ptr< TH2D > h2_xi_45_vs_xi_56_acc
std::map< std::set< unsigned int >, SingleArmPlots > singleArmPlots
edm::EDGetTokenT< edm::HepMCProduct > tokenHepMC_
std::vector< std::set< unsigned int > > singleArmConfigurations
std::map< std::set< unsigned int >, DoubleArmPlots > doubleArmPlots
const HepMC::GenEvent * GetEvent() const
edm::EDGetTokenT< CTPPSLocalTrackLiteCollection > tokenTracks_
void fill(double xi_45, double xi_56, bool acc)
std::unique_ptr< TH2D > h2_xi_45_vs_xi_56_all
std::vector< CTPPSLocalTrackLite > CTPPSLocalTrackLiteCollection
Collection of CTPPSLocalTrackLite objects.
Base class for CTPPS detector IDs.
void fill(double xi, bool acc)
std::unique_ptr< TH2D > h2_y_vs_m_acc
void analyze(const edm::Event &, const edm::EventSetup &) override
std::vector< std::set< unsigned int > > doubleArmConfigurations