CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
PPSFilteredProtonProducer Class Reference

Module to apply Proton POG quality criteria. More...

Inheritance diagram for PPSFilteredProtonProducer:
edm::stream::EDProducer<>

Public Member Functions

 PPSFilteredProtonProducer (const edm::ParameterSet &)
 
 ~PPSFilteredProtonProducer () override=default
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Member Functions

void endStream () override
 
bool IsTrackOK (const CTPPSLocalTrackLite &tr, unsigned int idx, std::ostringstream &log)
 check one track More...
 
void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

unsigned int n_protons_multi_rp_all
 
unsigned int n_protons_multi_rp_kept
 
unsigned int n_protons_single_rp_all
 counters More...
 
unsigned int n_protons_single_rp_kept
 
bool protons_multi_rp_check_valid_fit_
 
double protons_multi_rp_chi_sq_max_
 
bool protons_multi_rp_include_
 
edm::EDGetTokenT< reco::ForwardProtonCollectionprotons_multi_rp_input_token_
 
double protons_multi_rp_normalised_chi_sq_max_
 
std::string protons_multi_rp_output_label_
 
bool protons_single_rp_include_
 
edm::EDGetTokenT< reco::ForwardProtonCollectionprotons_single_rp_input_token_
 
std::string protons_single_rp_output_label_
 
double tracks_all_local_angle_x_max_
 
double tracks_all_local_angle_y_max_
 
std::vector< unsigned int > tracks_pixel_forbidden_RecoInfo_values_
 
double tracks_pixel_normalised_chi_sq_max_
 
unsigned int tracks_pixel_number_of_hits_min_
 
edm::EDGetTokenT< CTPPSLocalTrackLiteCollectiontracksToken_
 
bool verbosity_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

Module to apply Proton POG quality criteria.

Definition at line 21 of file PPSFilteredProtonProducer.cc.

Constructor & Destructor Documentation

PPSFilteredProtonProducer::PPSFilteredProtonProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 64 of file PPSFilteredProtonProducer.cc.

References edm::ParameterSet::getParameterSet(), protons_multi_rp_check_valid_fit_, protons_multi_rp_chi_sq_max_, protons_multi_rp_include_, protons_multi_rp_input_token_, protons_multi_rp_normalised_chi_sq_max_, protons_multi_rp_output_label_, protons_cff::protons_single_rp, protons_single_rp_include_, protons_single_rp_input_token_, protons_single_rp_output_label_, AlCaHLTBitMon_QueryRunRegistry::string, tracks_all_local_angle_x_max_, tracks_all_local_angle_y_max_, tracks_pixel_forbidden_RecoInfo_values_, tracks_pixel_normalised_chi_sq_max_, and tracks_pixel_number_of_hits_min_.

65  : verbosity_(iConfig.getUntrackedParameter<bool>("verbosity")),
70  const auto &tracks_all = iConfig.getParameterSet("tracks_all");
71  tracks_all_local_angle_x_max_ = tracks_all.getParameter<double>("local_angle_x_max");
72  tracks_all_local_angle_y_max_ = tracks_all.getParameter<double>("local_angle_y_max");
73 
74  const auto &tracks_pixel = iConfig.getParameterSet("tracks_pixel");
76  tracks_pixel.getParameter<std::vector<unsigned int>>("forbidden_RecoInfo_values");
77  tracks_pixel_number_of_hits_min_ = tracks_pixel.getParameter<unsigned int>("number_of_hits_min");
78  tracks_pixel_normalised_chi_sq_max_ = tracks_pixel.getParameter<double>("normalised_chi_sq_max");
79 
80  const auto &protons_single_rp = iConfig.getParameterSet("protons_single_rp");
81  protons_single_rp_include_ = protons_single_rp.getParameter<bool>("include");
83  consumes<reco::ForwardProtonCollection>(protons_single_rp.getParameter<edm::InputTag>("input_tag"));
84  protons_single_rp_output_label_ = protons_single_rp.getParameter<std::string>("output_label");
85 
86  const auto &protons_multi_rp = iConfig.getParameterSet("protons_multi_rp");
87  protons_multi_rp_include_ = protons_multi_rp.getParameter<bool>("include");
89  consumes<reco::ForwardProtonCollection>(protons_multi_rp.getParameter<edm::InputTag>("input_tag"));
90  protons_multi_rp_output_label_ = protons_multi_rp.getParameter<std::string>("output_label");
91  protons_multi_rp_check_valid_fit_ = protons_multi_rp.getParameter<bool>("check_valid_fit");
92  protons_multi_rp_chi_sq_max_ = protons_multi_rp.getParameter<double>("chi_sq_max");
93  protons_multi_rp_normalised_chi_sq_max_ = protons_multi_rp.getParameter<double>("normalised_chi_sq_max");
94 
96  produces<reco::ForwardProtonCollection>(protons_single_rp_output_label_);
97 
99  produces<reco::ForwardProtonCollection>(protons_multi_rp_output_label_);
100 }
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< reco::ForwardProtonCollection > protons_single_rp_input_token_
unsigned int n_protons_single_rp_all
counters
edm::EDGetTokenT< reco::ForwardProtonCollection > protons_multi_rp_input_token_
ParameterSet const & getParameterSet(std::string const &) const
std::vector< unsigned int > tracks_pixel_forbidden_RecoInfo_values_
PPSFilteredProtonProducer::~PPSFilteredProtonProducer ( )
overridedefault

Member Function Documentation

void PPSFilteredProtonProducer::endStream ( )
overrideprivate

Definition at line 255 of file PPSFilteredProtonProducer.cc.

References DEFINE_FWK_MODULE, n_protons_multi_rp_all, n_protons_multi_rp_kept, n_protons_single_rp_all, and n_protons_single_rp_kept.

255  {
256  edm::LogInfo("PPS")
257  << "single-RP protons: total=" << n_protons_single_rp_all << ", kept=" << n_protons_single_rp_kept
258  << " --> keep rate="
260  << "%\n"
261  << "multi-RP protons: total=" << n_protons_multi_rp_all << ", kept=" << n_protons_multi_rp_kept
262  << " --> keep rate="
263  << ((n_protons_multi_rp_all > 0) ? double(n_protons_multi_rp_kept) / n_protons_multi_rp_all * 100. : 0.) << "%";
264 }
unsigned int n_protons_single_rp_all
counters
void PPSFilteredProtonProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 104 of file PPSFilteredProtonProducer.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), edm::ParameterSetDescription::addUntracked(), allShiftedPlanes, createfilelist::int, mixedPlanes, protons_cff::protons_single_rp, edm::ParameterDescriptionNode::setComment(), and AlCaHLTBitMon_QueryRunRegistry::string.

104  {
106 
107  desc.addUntracked<bool>("verbosity", false)->setComment("verbosity");
108 
109  edm::ParameterSetDescription tracks_all;
110  tracks_all.add<double>("local_angle_x_max", 0.020)
111  ->setComment("maximum absolute value of local horizontal angle, in rad");
112  tracks_all.add<double>("local_angle_y_max", 0.020)
113  ->setComment("maximum absolute value of local horizontal angle, in rad");
114  desc.add<edm::ParameterSetDescription>("tracks_all", tracks_all)->setComment("settings for all tracks");
115 
116  edm::ParameterSetDescription tracks_pixel;
117  const std::vector<unsigned int> def_for_RecoInfo_vals = {
120  tracks_pixel.add<std::vector<unsigned int>>("forbidden_RecoInfo_values", def_for_RecoInfo_vals)
121  ->setComment("list of forbidden RecoInfo values");
122  tracks_pixel.add<unsigned int>("number_of_hits_min", 0)->setComment("minimum required number of hits");
123  tracks_pixel.add<double>("normalised_chi_sq_max", 1E100)->setComment("maximum tolerated chi square / ndof");
124  desc.add<edm::ParameterSetDescription>("tracks_pixel", tracks_pixel)
125  ->setComment("specific settings for pixel-RP tracks");
126 
128  protons_single_rp.add<bool>("include", true)->setComment("flag whether single-RP protons should be processed");
129  protons_single_rp.add<edm::InputTag>("input_tag", edm::InputTag("ctppsProtons", "singleRP"))->setComment("input tag");
130  protons_single_rp.add<std::string>("output_label", "singleRP")->setComment("output label");
131  desc.add<edm::ParameterSetDescription>("protons_single_rp", protons_single_rp)
132  ->setComment("settings for single-RP protons");
133 
134  edm::ParameterSetDescription protons_multi_rp;
135  protons_multi_rp.add<bool>("include", true)->setComment("flag whether multi-RP protons should be processed");
136  protons_multi_rp.add<edm::InputTag>("input_tag", edm::InputTag("ctppsProtons", "multiRP"))->setComment("input tag");
137  protons_multi_rp.add<std::string>("output_label", "multiRP")->setComment("output label");
138  protons_multi_rp.add<bool>("check_valid_fit", true)->setComment("flag whether validFit should be checked");
139  protons_multi_rp.add<double>("chi_sq_max", 1E-4)->setComment("maximum tolerated value of chi square");
140  protons_multi_rp.add<double>("normalised_chi_sq_max", 1E100)
141  ->setComment("maximum tolerated value of chi square / ndof, applied only if ndof > 0");
142  desc.add<edm::ParameterSetDescription>("protons_multi_rp", protons_multi_rp)
143  ->setComment("settings for multi-RP protons");
144 
145  descriptions.add("ppsFilteredProtonProducer", desc);
146 }
void setComment(std::string const &value)
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
bool PPSFilteredProtonProducer::IsTrackOK ( const CTPPSLocalTrackLite tr,
unsigned int  idx,
std::ostringstream &  log 
)
private

check one track

Definition at line 150 of file PPSFilteredProtonProducer.cc.

References funct::abs(), spr::find(), CTPPSLocalTrackLite::getChiSquaredOverNDF(), CTPPSLocalTrackLite::getNumberOfPointsUsedForFit(), CTPPSLocalTrackLite::getPixelTrackRecoInfo(), CTPPSLocalTrackLite::getRPId(), CTPPSLocalTrackLite::getTx(), CTPPSLocalTrackLite::getTy(), createfilelist::int, convertSQLiteXML::ok, year_2016_postTS2_cff::rpId, CTPPSDetId::sdTrackingPixel, tracks_all_local_angle_x_max_, tracks_all_local_angle_y_max_, tracks_pixel_forbidden_RecoInfo_values_, tracks_pixel_normalised_chi_sq_max_, tracks_pixel_number_of_hits_min_, and verbosity_.

Referenced by produce().

150  {
151  bool ok = true;
152 
153  // checks for all tracks
156 
157  // pixel checks
158  const CTPPSDetId rpId(tr.getRPId());
159  if (rpId.subdetId() == CTPPSDetId::sdTrackingPixel) {
165  }
166 
167  if (!ok && verbosity_)
168  log << "track idx=" << idx << " does not fulfil criteria." << std::endl;
169 
170  return ok;
171 }
float getTx() const
returns the track horizontal angle
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
CTPPSpixelLocalTrackReconstructionInfo getPixelTrackRecoInfo() const
returns the track reconstruction info byte
uint32_t getRPId() const
returns the RP id
float getChiSquaredOverNDF() const
returns the track fit chi Squared over NDF
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
Base class for CTPPS detector IDs.
Definition: CTPPSDetId.h:32
unsigned short getNumberOfPointsUsedForFit() const
returns the number of points used for fit
std::vector< unsigned int > tracks_pixel_forbidden_RecoInfo_values_
float getTy() const
returns the track vertical angle
void PPSFilteredProtonProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 175 of file PPSFilteredProtonProducer.cc.

References edm::Event::get(), IsTrackOK(), keep, eostools::move(), n_protons_multi_rp_all, n_protons_multi_rp_kept, n_protons_single_rp_all, n_protons_single_rp_kept, protons_multi_rp_check_valid_fit_, protons_multi_rp_chi_sq_max_, protons_multi_rp_include_, protons_multi_rp_input_token_, protons_multi_rp_normalised_chi_sq_max_, protons_multi_rp_output_label_, protons_single_rp_include_, protons_single_rp_input_token_, protons_single_rp_output_label_, edm::Event::put(), and verbosity_.

175  {
176  std::ostringstream ssLog;
177 
178  // process single-RP protons
181  std::unique_ptr<reco::ForwardProtonCollection> pOutputProtons(new reco::ForwardProtonCollection);
182 
183  for (const auto &proton : hInputProtons) {
184  bool keep = true;
185 
186  // no specific checks for single-RP protons
187 
188  // test contributing tracks
189  for (const auto &tr_ref : proton.contributingLocalTracks()) {
190  if (!keep)
191  break;
192 
193  keep &= IsTrackOK(*tr_ref, tr_ref.key(), ssLog);
194  }
195 
197 
198  if (keep) {
200  pOutputProtons->push_back(proton);
201  } else {
202  if (verbosity_)
203  ssLog << "single-RP proton idx=" << n_protons_single_rp_all - 1 << " excluded." << std::endl;
204  }
205  }
206 
207  iEvent.put(std::move(pOutputProtons), protons_single_rp_output_label_);
208  }
209 
210  // process multi-RP protons
212  reco::ForwardProtonCollection const &hInputProtons = iEvent.get(protons_multi_rp_input_token_);
213  std::unique_ptr<reco::ForwardProtonCollection> pOutputProtons(new reco::ForwardProtonCollection);
214 
215  for (const auto &proton : hInputProtons) {
216  bool keep = true;
217 
218  // multi-RP proton checks
220  keep &= proton.validFit();
221 
222  keep &= (proton.chi2() <= protons_multi_rp_chi_sq_max_);
223 
224  if (proton.ndof() > 0)
225  keep &= (proton.normalizedChi2() <= protons_multi_rp_normalised_chi_sq_max_);
226 
227  // test contributing tracks
228  for (const auto &tr_ref : proton.contributingLocalTracks()) {
229  if (!keep)
230  break;
231 
232  keep &= IsTrackOK(*tr_ref, tr_ref.key(), ssLog);
233  }
234 
236 
237  if (keep) {
239  pOutputProtons->push_back(proton);
240  } else {
241  if (verbosity_)
242  ssLog << "multi-RP proton idx=" << n_protons_multi_rp_all - 1 << " excluded." << std::endl;
243  }
244  }
245 
246  iEvent.put(std::move(pOutputProtons), protons_multi_rp_output_label_);
247  }
248 
249  if (verbosity_ && !ssLog.str().empty())
250  edm::LogInfo("PPS") << ssLog.str();
251 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:125
edm::EDGetTokenT< reco::ForwardProtonCollection > protons_single_rp_input_token_
const int keep
bool get(ProductID const &oid, Handle< PROD > &result) const
Definition: Event.h:326
unsigned int n_protons_single_rp_all
counters
edm::EDGetTokenT< reco::ForwardProtonCollection > protons_multi_rp_input_token_
bool IsTrackOK(const CTPPSLocalTrackLite &tr, unsigned int idx, std::ostringstream &log)
check one track
std::vector< ForwardProton > ForwardProtonCollection
Collection of ForwardProton objects.
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

unsigned int PPSFilteredProtonProducer::n_protons_multi_rp_all
private

Definition at line 56 of file PPSFilteredProtonProducer.cc.

Referenced by endStream(), and produce().

unsigned int PPSFilteredProtonProducer::n_protons_multi_rp_kept
private

Definition at line 56 of file PPSFilteredProtonProducer.cc.

Referenced by endStream(), and produce().

unsigned int PPSFilteredProtonProducer::n_protons_single_rp_all
private

counters

Definition at line 55 of file PPSFilteredProtonProducer.cc.

Referenced by endStream(), and produce().

unsigned int PPSFilteredProtonProducer::n_protons_single_rp_kept
private

Definition at line 55 of file PPSFilteredProtonProducer.cc.

Referenced by endStream(), and produce().

bool PPSFilteredProtonProducer::protons_multi_rp_check_valid_fit_
private

Definition at line 50 of file PPSFilteredProtonProducer.cc.

Referenced by PPSFilteredProtonProducer(), and produce().

double PPSFilteredProtonProducer::protons_multi_rp_chi_sq_max_
private

Definition at line 51 of file PPSFilteredProtonProducer.cc.

Referenced by PPSFilteredProtonProducer(), and produce().

bool PPSFilteredProtonProducer::protons_multi_rp_include_
private

Definition at line 46 of file PPSFilteredProtonProducer.cc.

Referenced by PPSFilteredProtonProducer(), and produce().

edm::EDGetTokenT<reco::ForwardProtonCollection> PPSFilteredProtonProducer::protons_multi_rp_input_token_
private

Definition at line 47 of file PPSFilteredProtonProducer.cc.

Referenced by PPSFilteredProtonProducer(), and produce().

double PPSFilteredProtonProducer::protons_multi_rp_normalised_chi_sq_max_
private

Definition at line 52 of file PPSFilteredProtonProducer.cc.

Referenced by PPSFilteredProtonProducer(), and produce().

std::string PPSFilteredProtonProducer::protons_multi_rp_output_label_
private

Definition at line 48 of file PPSFilteredProtonProducer.cc.

Referenced by PPSFilteredProtonProducer(), and produce().

bool PPSFilteredProtonProducer::protons_single_rp_include_
private

Definition at line 42 of file PPSFilteredProtonProducer.cc.

Referenced by PPSFilteredProtonProducer(), and produce().

edm::EDGetTokenT<reco::ForwardProtonCollection> PPSFilteredProtonProducer::protons_single_rp_input_token_
private

Definition at line 43 of file PPSFilteredProtonProducer.cc.

Referenced by PPSFilteredProtonProducer(), and produce().

std::string PPSFilteredProtonProducer::protons_single_rp_output_label_
private

Definition at line 44 of file PPSFilteredProtonProducer.cc.

Referenced by PPSFilteredProtonProducer(), and produce().

double PPSFilteredProtonProducer::tracks_all_local_angle_x_max_
private

Definition at line 36 of file PPSFilteredProtonProducer.cc.

Referenced by IsTrackOK(), and PPSFilteredProtonProducer().

double PPSFilteredProtonProducer::tracks_all_local_angle_y_max_
private

Definition at line 36 of file PPSFilteredProtonProducer.cc.

Referenced by IsTrackOK(), and PPSFilteredProtonProducer().

std::vector<unsigned int> PPSFilteredProtonProducer::tracks_pixel_forbidden_RecoInfo_values_
private

Definition at line 38 of file PPSFilteredProtonProducer.cc.

Referenced by IsTrackOK(), and PPSFilteredProtonProducer().

double PPSFilteredProtonProducer::tracks_pixel_normalised_chi_sq_max_
private

Definition at line 40 of file PPSFilteredProtonProducer.cc.

Referenced by IsTrackOK(), and PPSFilteredProtonProducer().

unsigned int PPSFilteredProtonProducer::tracks_pixel_number_of_hits_min_
private

Definition at line 39 of file PPSFilteredProtonProducer.cc.

Referenced by IsTrackOK(), and PPSFilteredProtonProducer().

edm::EDGetTokenT<CTPPSLocalTrackLiteCollection> PPSFilteredProtonProducer::tracksToken_
private

Definition at line 32 of file PPSFilteredProtonProducer.cc.

bool PPSFilteredProtonProducer::verbosity_
private

Definition at line 34 of file PPSFilteredProtonProducer.cc.

Referenced by IsTrackOK(), and produce().