51 produces<edm::ValueMap<int>>(
"arm");
52 produces<nanoaod::FlatTable>(
"ppsTrackTable");
54 produces<edm::ValueMap<int>>(
"protonRPId");
72 std::vector<int> multiRP_arm;
75 std::vector<float> trackX, trackY, trackTime, trackTimeUnc;
76 std::vector<int> multiRPProtonIdx,
decRPId, rpType;
77 std::vector<int> singleRPProtonIdx, singleRP_protonRPId;
82 const auto &num_proton = hRecoProtonsSingleRP->size();
83 singleRP_protonRPId.reserve(num_proton);
85 for (
const auto &proton : *hRecoProtonsSingleRP) {
86 CTPPSDetId rpId((*proton.contributingLocalTracks().begin())->getRPId());
87 unsigned int rpDecId =
rpId.arm() * 100 +
rpId.station() * 10 +
rpId.rp();
88 singleRP_protonRPId.push_back(rpDecId);
94 const auto &num_proton = hRecoProtonsMultiRP->size();
95 multiRP_arm.reserve(num_proton);
97 for (
const auto &proton : *hRecoProtonsMultiRP) {
98 multiRP_arm.push_back((proton.pz() < 0.) ? 1 : 0);
103 for (
unsigned int tr_idx = 0; tr_idx < ppsTracksLite->size(); ++tr_idx) {
104 const auto &tr = ppsTracksLite->at(tr_idx);
109 unsigned int rpDecId =
rpId.arm() * 100 +
rpId.station() * 10 +
rpId.rp();
111 signed int singleRP_idx = -1;
112 for (
unsigned int p_idx = 0; p_idx < hRecoProtonsSingleRP->size(); ++p_idx) {
113 const auto &proton = hRecoProtonsSingleRP->at(p_idx);
115 for (
const auto &ref : proton.contributingLocalTracks()) {
116 if (ref.key() == tr_idx) {
117 singleRP_idx = p_idx;
123 signed int multiRP_idx = -1;
124 for (
unsigned int p_idx = 0; p_idx < hRecoProtonsMultiRP->size(); ++p_idx) {
125 const auto &proton = hRecoProtonsMultiRP->at(p_idx);
127 for (
const auto &ref : proton.contributingLocalTracks()) {
128 if (ref.key() == tr_idx) {
136 singleRPProtonIdx.push_back(singleRP_idx);
137 multiRPProtonIdx.push_back(multiRP_idx);
138 decRPId.push_back(rpDecId);
139 rpType.push_back(
rpId.subdetId());
140 trackX.push_back(tr.getX());
141 trackY.push_back(tr.getY());
142 trackTime.push_back(tr.getTime());
143 trackTimeUnc.push_back(tr.getTimeUnc());
149 for (
unsigned int p_idx = 0; p_idx < hRecoProtonsMultiRP->size(); ++p_idx) {
150 const auto &proton = hRecoProtonsMultiRP->at(p_idx);
151 multiRP_arm.push_back((proton.pz() < 0.) ? 1 : 0);
153 for (
const auto &ref : proton.contributingLocalTracks()) {
154 multiRPProtonIdx.push_back(p_idx);
156 unsigned int rpDecId =
rpId.arm() * 100 +
rpId.station() * 10 +
rpId.rp();
157 decRPId.push_back(rpDecId);
158 rpType.push_back(
rpId.subdetId());
159 trackX.push_back(ref->getX());
160 trackY.push_back(ref->getY());
161 trackTime.push_back(ref->getTime());
162 trackTimeUnc.push_back(ref->getTimeUnc());
170 fillermultiArm.
insert(hRecoProtonsMultiRP, multiRP_arm.begin(), multiRP_arm.end());
171 fillermultiArm.
fill();
176 fillerID.
insert(hRecoProtonsSingleRP, singleRP_protonRPId.begin(), singleRP_protonRPId.end());
181 auto ppsTab = std::make_unique<nanoaod::FlatTable>(trackX.size(),
"PPSLocalTrack",
false);
191 ppsTab->setDoc(
"ppsLocalTrack variables");
203 desc.
add<
edm::InputTag>(
"tagRecoProtonsMulti")->setComment(
"multiRP proton collection");
204 desc.
add<
edm::InputTag>(
"tagRecoProtonsSingle")->setComment(
"singleRP proton collection");
205 desc.
add<
edm::InputTag>(
"tagTrackLite")->setComment(
"pps local tracks lite collection");
206 desc.
add<
bool>(
"storeSingleRPProtons")->setComment(
"flag to store singleRP protons and associated tracks");
207 descriptions.
add(
"ProtonProducer", desc);
const edm::EDGetTokenT< reco::ForwardProtonCollection > tokenRecoProtonsMultiRP_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Local (=single RP) track with essential information only.
~ProtonProducer() override
bool getByToken(EDGetToken token, Handle< PROD > &result) const
void insert(const H &h, I begin, I end)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
#define DEFINE_FWK_MODULE(type)
const edm::EDGetTokenT< reco::ForwardProtonCollection > tokenRecoProtonsSingleRP_
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void produce(edm::StreamID id, edm::Event &iEvent, const edm::EventSetup &iSetup) const override
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Base class for CTPPS detector IDs.
ProtonProducer(edm::ParameterSet const &ps)
const edm::EDGetTokenT< std::vector< CTPPSLocalTrackLite > > tokenTracksLite_
std::vector< ForwardProton > ForwardProtonCollection
Collection of ForwardProton objects.
EDGetTokenT< ProductType > mayConsume(edm::InputTag const &tag)
const bool storeSingleRPProtons_