49 h_xi_all(new TH1D(
"",
";#xi", 100, 0., 0.25)),
50 h_xi_acc(new TH1D(
"",
";#xi", 100, 0., 0.25))
62 h_xi_all->Write(
"h_xi_all");
63 h_xi_acc->Write(
"h_xi_acc");
65 auto h_xi_rat = std::make_unique<TH1D>(*h_xi_acc);
66 h_xi_rat->Divide(h_xi_all.get());
67 h_xi_rat->Write(
"h_xi_rat");
81 h_m_all(new TH1D(
"",
";m (GeV)", 100, 0., 2500.)),
82 h_m_acc(new TH1D(
"",
";m (GeV)", 100, 0., 2500.)),
83 h2_xi_45_vs_xi_56_all(new TH2D(
"",
";xi_56;xi_45", 25, 0., 0.25, 25, 0., 0.25)),
84 h2_xi_45_vs_xi_56_acc(new TH2D(
"",
";xi_56;xi_45", 25, 0., 0.25, 25, 0., 0.25)),
85 h2_y_vs_m_all(new TH2D(
"",
";m (GeV);y", 25, 0., 2500., 25, -1.5, +1.5)),
86 h2_y_vs_m_acc(new TH2D(
"",
";m (GeV);y", 25, 0., 2500., 25, -1.5, +1.5))
89 void fill(
double xi_45,
double xi_56,
bool acc)
91 const double p_nom = 6500.;
92 const double m = 2. * p_nom *
sqrt(xi_45 * xi_56);
93 const double y =
log(xi_45 / xi_56) / 2.;
96 h2_xi_45_vs_xi_56_all->Fill(xi_56, xi_45);
97 h2_y_vs_m_all->Fill(m, y);
101 h2_xi_45_vs_xi_56_acc->Fill(xi_56, xi_45);
102 h2_y_vs_m_acc->Fill(m, y);
108 h_m_all->Write(
"h_m_all");
109 h_m_acc->Write(
"h_m_acc");
111 auto h_m_rat = std::make_unique<TH1D>(*h_m_acc);
112 h_m_rat->Divide(h_m_all.get());
113 h_m_rat->Write(
"h_m_rat");
115 h2_xi_45_vs_xi_56_all->Write(
"h2_xi_45_vs_xi_56_all");
116 h2_xi_45_vs_xi_56_acc->Write(
"h2_xi_45_vs_xi_56_acc");
118 auto h2_xi_45_vs_xi_56_rat = std::make_unique<TH2D>(*h2_xi_45_vs_xi_56_acc);
119 h2_xi_45_vs_xi_56_rat->Divide(h2_xi_45_vs_xi_56_all.get());
120 h2_xi_45_vs_xi_56_rat->Write(
"h2_xi_45_vs_xi_56_rat");
122 h2_y_vs_m_all->Write(
"h2_y_vs_m_all");
123 h2_y_vs_m_acc->Write(
"h2_y_vs_m_acc");
125 auto h2_y_vs_m_rat = std::make_unique<TH2D>(*h2_y_vs_m_acc);
126 h2_y_vs_m_rat->Divide(h2_y_vs_m_all.get());
127 h2_y_vs_m_rat->Write(
"h2_y_vs_m_rat");
139 using namespace HepMC;
146 rpId_45_N_ (iConfig.getParameter<unsigned
int>(
"rpId_45_N")),
147 rpId_45_F_ (iConfig.getParameter<unsigned
int>(
"rpId_45_F")),
148 rpId_56_N_ (iConfig.getParameter<unsigned
int>(
"rpId_56_N")),
149 rpId_56_F_ (iConfig.getParameter<unsigned
int>(
"rpId_56_F")),
181 bool proton_45_set =
false;
182 bool proton_56_set =
false;
183 FourVector mom_45, mom_56;
185 for (
auto it = hepMCEvent->particles_begin(); it != hepMCEvent->particles_end(); ++it)
187 const auto &
part = *it;
190 if (
part->pdg_id() != 2212)
193 if (
part->status() != 1)
199 const auto &mom =
part->momentum();
209 LogError(
"CTPPSAcceptancePlotter") <<
"Multiple protons found in sector 45.";
213 proton_45_set =
true;
219 LogError(
"CTPPSAcceptancePlotter") <<
"Multiple protons found in sector 56.";
223 proton_56_set =
true;
229 if (!proton_45_set || !proton_56_set)
233 const double p_nom = 6500.;
234 const double xi_45 = (p_nom - mom_45.e()) / p_nom;
235 const double xi_56 = (p_nom - mom_56.e()) / p_nom;
238 map<unsigned int, bool> trackPresent;
239 for (
const auto& trk : *hTracks)
242 unsigned int rpDecId = rpId.
arm()*100 + rpId.station()*10 + rpId.rp();
243 trackPresent[rpDecId] =
true;
251 for (
const auto rpId : rpIds)
253 acc &= trackPresent[rpId];
260 const double xi = (arm == 0) ? xi_45 : xi_56;
268 for (
const auto rpId : rpIds)
269 acc &= trackPresent[rpId];
280 auto f_out = std::make_unique<TFile>(
outputFile_.c_str(),
"recreate");
284 for (
const auto &rpId :
p.first) {
285 if (!dirName.empty())
287 dirName += Form(
"%u", rpId);
290 gDirectory = f_out->mkdir(dirName.c_str());
296 for (
const auto &rpId :
p.first) {
297 if (!dirName.empty())
299 dirName += Form(
"%u", rpId);
302 gDirectory = f_out->mkdir(dirName.c_str());
std::unique_ptr< TH1D > h_xi_acc
bool getByToken(EDGetToken token, Handle< PROD > &result) const
CTPPSAcceptancePlotter(const edm::ParameterSet &)
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
#define DEFINE_FWK_MODULE(type)
std::unique_ptr< TH1D > h_xi_all
std::unique_ptr< TH1D > h_m_all
std::unique_ptr< TH2D > h2_y_vs_m_all
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
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
const HepMC::GenEvent * GetEvent() const
std::vector< CTPPSLocalTrackLite > CTPPSLocalTrackLiteCollection
Collection of CTPPSLocalTrackLite objects.
Base class for CTPPS detector IDs.
void fill(double xi, bool acc)
void analyze(const edm::Event &, const edm::EventSetup &) override
std::vector< std::set< unsigned int > > doubleArmConfigurations