53 produces<edm::ValueMap<int>>(
"arm");
54 produces<nanoaod::FlatTable>(
"ppsTrackTable");
56 produces<edm::ValueMap<int>>(
"protonRPId");
70 std::vector<int> multiRP_arm;
73 std::vector<float> trackX, trackY, trackTime, trackTimeUnc;
74 std::vector<int> multiRPProtonIdx,
decRPId, rpType;
75 std::vector<int> singleRPProtonIdx, singleRP_protonRPId;
80 const auto &num_proton = hRecoProtonsSingleRP->size();
81 singleRP_protonRPId.reserve(num_proton);
83 for (
const auto &proton : *hRecoProtonsSingleRP) {
85 unsigned int rpDecId =
rpId.arm() * 100 +
rpId.station() * 10 +
rpId.rp();
86 singleRP_protonRPId.push_back(rpDecId);
92 const auto &num_proton = hRecoProtonsMultiRP->size();
93 multiRP_arm.reserve(num_proton);
95 for (
const auto &proton : *hRecoProtonsMultiRP) {
96 multiRP_arm.push_back((proton.pz() < 0.) ? 1 : 0);
101 for (
unsigned int tr_idx = 0; tr_idx < ppsTracksLite->size(); ++tr_idx) {
102 const auto &tr = ppsTracksLite->at(tr_idx);
107 unsigned int rpDecId =
rpId.arm() * 100 +
rpId.station() * 10 +
rpId.rp();
109 signed int singleRP_idx = -1;
110 for (
unsigned int p_idx = 0; p_idx < hRecoProtonsSingleRP->size(); ++p_idx) {
111 const auto &proton = hRecoProtonsSingleRP->at(p_idx);
113 for (
const auto &ref : proton.contributingLocalTracks()) {
114 if (ref.key() == tr_idx) {
115 singleRP_idx = p_idx;
121 signed int multiRP_idx = -1;
122 for (
unsigned int p_idx = 0; p_idx < hRecoProtonsMultiRP->size(); ++p_idx) {
123 const auto &proton = hRecoProtonsMultiRP->at(p_idx);
125 for (
const auto &ref : proton.contributingLocalTracks()) {
126 if (ref.key() == tr_idx) {
134 singleRPProtonIdx.push_back(singleRP_idx);
135 multiRPProtonIdx.push_back(multiRP_idx);
137 rpType.push_back(
rpId.subdetId());
138 trackX.push_back(tr.x());
139 trackY.push_back(tr.y());
140 trackTime.push_back(tr.time());
141 trackTimeUnc.push_back(tr.timeUnc());
147 for (
unsigned int p_idx = 0; p_idx < hRecoProtonsMultiRP->size(); ++p_idx) {
148 const auto &proton = hRecoProtonsMultiRP->at(p_idx);
149 multiRP_arm.push_back((proton.pz() < 0.) ? 1 : 0);
151 for (
const auto &ref : proton.contributingLocalTracks()) {
152 multiRPProtonIdx.push_back(p_idx);
154 unsigned int rpDecId =
rpId.arm() * 100 +
rpId.station() * 10 +
rpId.rp();
156 rpType.push_back(
rpId.subdetId());
157 trackX.push_back(ref->x());
158 trackY.push_back(ref->y());
159 trackTime.push_back(ref->time());
160 trackTimeUnc.push_back(ref->timeUnc());
168 fillermultiArm.
insert(hRecoProtonsMultiRP, multiRP_arm.begin(), multiRP_arm.end());
169 fillermultiArm.
fill();
174 fillerID.
insert(hRecoProtonsSingleRP, singleRP_protonRPId.begin(), singleRP_protonRPId.end());
179 auto ppsTab = std::make_unique<nanoaod::FlatTable>(trackX.size(),
"PPSLocalTrack",
false);
180 ppsTab->addColumn<
int>(
"multiRPProtonIdx", multiRPProtonIdx,
"local track - proton correspondence");
182 ppsTab->addColumn<
int>(
"singleRPProtonIdx", singleRPProtonIdx,
"local track - proton correspondence");
183 ppsTab->addColumn<
float>(
"x", trackX,
"local track x", 16);
184 ppsTab->addColumn<
float>(
"y", trackY,
"local track y", 13);
185 ppsTab->addColumn<
float>(
"time", trackTime,
"local track time", 16);
186 ppsTab->addColumn<
float>(
"timeUnc", trackTimeUnc,
"local track time uncertainty", 13);
187 ppsTab->addColumn<
int>(
"decRPId",
decRPId,
"local track detector dec id");
188 ppsTab->addColumn<
int>(
"rpType", rpType,
"strip=3, pixel=4, diamond=5, timing=6");
189 ppsTab->setDoc(
"ppsLocalTrack variables");
201 desc.add<
edm::InputTag>(
"tagRecoProtonsMulti")->setComment(
"multiRP proton collection");
202 desc.add<
edm::InputTag>(
"tagRecoProtonsSingle")->setComment(
"singleRP proton collection");
203 desc.add<
edm::InputTag>(
"tagTrackLite")->setComment(
"pps local tracks lite collection");
204 desc.add<
bool>(
"storeSingleRPProtons")->setComment(
"flag to store singleRP protons and associated tracks");
205 descriptions.
add(
"ProtonProducer",
desc);
const edm::EDGetTokenT< reco::ForwardProtonCollection > tokenRecoProtonsMultiRP_
Local (=single RP) track with essential information only.
~ProtonProducer() override
void insert(const H &h, I begin, I end)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const edm::EDGetTokenT< reco::ForwardProtonCollection > tokenRecoProtonsSingleRP_
#define DEFINE_FWK_MODULE(type)
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_
void produce(edm::StreamID id, edm::Event &iEvent, const edm::EventSetup &iSetup) const override