diff --git a/RecoPPS/ProtonReconstruction/plugins/PPSFilteredProtonProducer.cc b/RecoPPS/ProtonReconstruction/plugins/PPSFilteredProtonProducer.cc index 07a057421a520..0a7ad2502ce8a 100644 --- a/RecoPPS/ProtonReconstruction/plugins/PPSFilteredProtonProducer.cc +++ b/RecoPPS/ProtonReconstruction/plugins/PPSFilteredProtonProducer.cc @@ -62,31 +62,31 @@ class PPSFilteredProtonProducer : public edm::stream::EDProducer<> { //---------------------------------------------------------------------------------------------------- PPSFilteredProtonProducer::PPSFilteredProtonProducer(const edm::ParameterSet &iConfig) - : verbosity_(iConfig.getUntrackedParameter("verbosity", 0)), - n_protons_single_rp_all(0), - n_protons_single_rp_kept(0), - n_protons_multi_rp_all(0), - n_protons_multi_rp_kept(0) { + : verbosity_(iConfig.getUntrackedParameter("verbosity")), + n_protons_single_rp_all(0), + n_protons_single_rp_kept(0), + n_protons_multi_rp_all(0), + n_protons_multi_rp_kept(0) { const auto &tracks_all = iConfig.getParameterSet("tracks_all"); tracks_all_local_angle_x_max_ = tracks_all.getParameter("local_angle_x_max"); tracks_all_local_angle_y_max_ = tracks_all.getParameter("local_angle_y_max"); const auto &tracks_pixel = iConfig.getParameterSet("tracks_pixel"); tracks_pixel_forbidden_RecoInfo_values_ = - tracks_pixel.getParameter>("forbidden_RecoInfo_values"); + tracks_pixel.getParameter>("forbidden_RecoInfo_values"); tracks_pixel_number_of_hits_min_ = tracks_pixel.getParameter("number_of_hits_min"); tracks_pixel_normalised_chi_sq_max_ = tracks_pixel.getParameter("normalised_chi_sq_max"); const auto &protons_single_rp = iConfig.getParameterSet("protons_single_rp"); protons_single_rp_include_ = protons_single_rp.getParameter("include"); protons_single_rp_input_token_ = - consumes(protons_single_rp.getParameter("input_tag")); + consumes(protons_single_rp.getParameter("input_tag")); protons_single_rp_output_label_ = protons_single_rp.getParameter("output_label"); const auto &protons_multi_rp = iConfig.getParameterSet("protons_multi_rp"); protons_multi_rp_include_ = protons_multi_rp.getParameter("include"); protons_multi_rp_input_token_ = - consumes(protons_multi_rp.getParameter("input_tag")); + consumes(protons_multi_rp.getParameter("input_tag")); protons_multi_rp_output_label_ = protons_multi_rp.getParameter("output_label"); protons_multi_rp_check_valid_fit_ = protons_multi_rp.getParameter("check_valid_fit"); protons_multi_rp_chi_sq_max_ = protons_multi_rp.getParameter("chi_sq_max"); @@ -104,25 +104,25 @@ PPSFilteredProtonProducer::PPSFilteredProtonProducer(const edm::ParameterSet &iC void PPSFilteredProtonProducer::fillDescriptions(edm::ConfigurationDescriptions &descriptions) { edm::ParameterSetDescription desc; - desc.addUntracked("verbosity", 0)->setComment("verbosity level"); + desc.addUntracked("verbosity", false)->setComment("verbosity"); edm::ParameterSetDescription tracks_all; tracks_all.add("local_angle_x_max", 0.020) - ->setComment("maximum absolute value of local horizontal angle, in rad"); + ->setComment("maximum absolute value of local horizontal angle, in rad"); tracks_all.add("local_angle_y_max", 0.020) - ->setComment("maximum absolute value of local horizontal angle, in rad"); + ->setComment("maximum absolute value of local horizontal angle, in rad"); desc.add("tracks_all", tracks_all)->setComment("settings for all tracks"); edm::ParameterSetDescription tracks_pixel; const std::vector def_for_RecoInfo_vals = { - (unsigned int)CTPPSpixelLocalTrackReconstructionInfo::allShiftedPlanes, - (unsigned int)CTPPSpixelLocalTrackReconstructionInfo::mixedPlanes}; + (unsigned int)CTPPSpixelLocalTrackReconstructionInfo::allShiftedPlanes, + (unsigned int)CTPPSpixelLocalTrackReconstructionInfo::mixedPlanes}; tracks_pixel.add>("forbidden_RecoInfo_values", def_for_RecoInfo_vals) - ->setComment("list of forbidden RecoInfo values"); + ->setComment("list of forbidden RecoInfo values"); tracks_pixel.add("number_of_hits_min", 0)->setComment("minimum required number of hits"); tracks_pixel.add("normalised_chi_sq_max", 1E100)->setComment("maximum tolerated chi square / ndof"); desc.add("tracks_pixel", tracks_pixel) - ->setComment("specific settings for pixel-RP tracks"); + ->setComment("specific settings for pixel-RP tracks"); edm::ParameterSetDescription protons_single_rp; protons_single_rp.add("include", true)->setComment("flag whether single-RP protons should be processed"); @@ -177,14 +177,10 @@ void PPSFilteredProtonProducer::produce(edm::Event &iEvent, const edm::EventSetu // process single-RP protons if (protons_single_rp_include_) { - edm::Handle hInputProtons; - iEvent.getByToken(protons_single_rp_input_token_, hInputProtons); - + reco::ForwardProtonCollection const &hInputProtons = iEvent.get(protons_single_rp_input_token_); std::unique_ptr pOutputProtons(new reco::ForwardProtonCollection); - for (unsigned int pr_idx = 0; pr_idx < hInputProtons->size(); ++pr_idx) { - const auto &proton = hInputProtons->at(pr_idx); - + for (const auto &proton : hInputProtons) { bool keep = true; // no specific checks for single-RP protons @@ -204,7 +200,7 @@ void PPSFilteredProtonProducer::produce(edm::Event &iEvent, const edm::EventSetu pOutputProtons->push_back(proton); } else { if (verbosity_) - ssLog << "single-RP proton idx=" << pr_idx << " excluded." << std::endl; + ssLog << "single-RP proton idx=" << n_protons_single_rp_all - 1 << " excluded." << std::endl; } } @@ -213,14 +209,10 @@ void PPSFilteredProtonProducer::produce(edm::Event &iEvent, const edm::EventSetu // process multi-RP protons if (protons_multi_rp_include_) { - edm::Handle hInputProtons; - iEvent.getByToken(protons_multi_rp_input_token_, hInputProtons); - + reco::ForwardProtonCollection const &hInputProtons = iEvent.get(protons_multi_rp_input_token_); std::unique_ptr pOutputProtons(new reco::ForwardProtonCollection); - for (unsigned int pr_idx = 0; pr_idx < hInputProtons->size(); ++pr_idx) { - const auto &proton = hInputProtons->at(pr_idx); - + for (const auto &proton : hInputProtons) { bool keep = true; // multi-RP proton checks @@ -247,7 +239,7 @@ void PPSFilteredProtonProducer::produce(edm::Event &iEvent, const edm::EventSetu pOutputProtons->push_back(proton); } else { if (verbosity_) - ssLog << "multi-RP proton idx=" << pr_idx << " excluded." << std::endl; + ssLog << "multi-RP proton idx=" << n_protons_multi_rp_all - 1 << " excluded." << std::endl; } } @@ -262,13 +254,13 @@ void PPSFilteredProtonProducer::produce(edm::Event &iEvent, const edm::EventSetu void PPSFilteredProtonProducer::endStream() { edm::LogInfo("PPS") - << "single-RP protons: total=" << n_protons_single_rp_all << ", kept=" << n_protons_single_rp_kept - << " --> keep rate=" - << ((n_protons_single_rp_all > 0) ? double(n_protons_single_rp_kept) / n_protons_single_rp_all * 100. : 0.) - << "%\n" - << "multi-RP protons: total=" << n_protons_multi_rp_all << ", kept=" << n_protons_multi_rp_kept - << " --> keep rate=" - << ((n_protons_multi_rp_all > 0) ? double(n_protons_multi_rp_kept) / n_protons_multi_rp_all * 100. : 0.) << "%"; + << "single-RP protons: total=" << n_protons_single_rp_all << ", kept=" << n_protons_single_rp_kept + << " --> keep rate=" + << ((n_protons_single_rp_all > 0) ? double(n_protons_single_rp_kept) / n_protons_single_rp_all * 100. : 0.) + << "%\n" + << "multi-RP protons: total=" << n_protons_multi_rp_all << ", kept=" << n_protons_multi_rp_kept + << " --> keep rate=" + << ((n_protons_multi_rp_all > 0) ? double(n_protons_multi_rp_kept) / n_protons_multi_rp_all * 100. : 0.) << "%"; } //----------------------------------------------------------------------------------------------------