46 std::unique_ptr<reco::ConversionTrackCollection>
outputTrks;
57 produces<reco::ConversionTrackCollection>();
86 if (trackCollection1.
isValid()) {
87 TC1 = trackCollection1.
product();
91 edm::LogWarning(
"ConversionTrackMerger") <<
"1st TrackCollection not found;" 92 <<
" will only clean 2nd TrackCollection ";
99 if (trackCollection2.
isValid()) {
100 TC2 = trackCollection2.
product();
104 edm::LogWarning(
"ConversionTrackMerger") <<
"2nd TrackCollection not found;" 105 <<
" will only clean 1st TrackCollection ";
110 outputTrks = std::make_unique<reco::ConversionTrackCollection>();
113 std::vector<int> selected1;
114 for (
unsigned int i = 0;
i < tC1.size(); ++
i) {
115 selected1.push_back(1);
117 std::vector<int> selected2;
118 for (
unsigned int i = 0;
i < tC2.size(); ++
i) {
119 selected2.push_back(1);
122 std::map<reco::ConversionTrackCollection::const_iterator, std::vector<const TrackingRecHit*> > rh1;
123 std::map<reco::ConversionTrackCollection::const_iterator, std::vector<const TrackingRecHit*> > rh2;
124 for (reco::ConversionTrackCollection::const_iterator
track = tC1.begin();
track != tC1.end(); ++
track) {
132 for (reco::ConversionTrackCollection::const_iterator
track = tC2.begin();
track != tC2.end(); ++
track) {
141 if ((!tC1.empty()) && (!tC2.empty())) {
143 for (reco::ConversionTrackCollection::iterator
track = tC1.begin();
track != tC1.end(); ++
track) {
151 track->setIsArbitratedMergedEcalGeneral(
track->isArbitratedMergedEcalGeneral() &&
154 std::vector<const TrackingRecHit*>& iHits = rh1[
track];
155 unsigned nh1 = iHits.size();
157 for (reco::ConversionTrackCollection::iterator track2 = tC2.begin(); track2 != tC2.end(); ++track2) {
163 track2->setIsArbitratedEcalSeeded(track2->isArbitratedEcalSeeded() &&
166 track2->setIsArbitratedMergedEcalGeneral(track2->isArbitratedMergedEcalGeneral() &&
169 std::vector<const TrackingRecHit*>& jHits = rh2[track2];
170 unsigned nh2 = jHits.size();
172 int firstoverlap = 0;
173 for (
unsigned ih = 0; ih < nh1; ++ih) {
176 for (
unsigned jh = 0; jh < nh2; ++jh) {
188 int nhit1 =
track->track()->numberOfValidHits();
189 int nhit2 = track2->track()->numberOfValidHits();
192 if ((noverlap - firstoverlap) > (
std::min(nhit1, nhit2) - firstoverlap) *
shareFrac &&
193 (!
checkCharge ||
track->track()->charge() * track2->track()->charge() > 0)) {
201 bool keepFirst = (nhit1 > nhit2 ||
202 (nhit1 == nhit2 &&
track->track()->normalizedChi2() < track2->track()->normalizedChi2()));
206 keepFirst &= !(probFirst <= minProb && probSecond >
minProb);
208 bool keepSecond = !keepFirst;
214 track->setIsTrackerOnly(
track->isTrackerOnly() &&
217 track->setIsArbitratedEcalSeeded(
track->isArbitratedEcalSeeded() &&
221 track->setIsArbitratedMerged(
track->isArbitratedMerged() &&
225 track->setIsArbitratedMergedEcalGeneral(
track->isArbitratedMergedEcalGeneral() &&
232 track2->setIsTrackerOnly(track2->isTrackerOnly() &&
235 track2->setIsArbitratedEcalSeeded(track2->isArbitratedEcalSeeded() &&
239 track2->setIsArbitratedMerged(track2->isArbitratedMerged() &&
243 track2->setIsArbitratedMergedEcalGeneral(track2->isArbitratedMergedEcalGeneral() &&
259 for (reco::ConversionTrackCollection::const_iterator
track = tC1.begin();
track != tC1.end(); ++
track, ++
i) {
273 for (reco::ConversionTrackCollection::const_iterator
track = tC2.begin();
track != tC2.end(); ++
track, ++
i) {
T getParameter(std::string const &) const
T const * product() const
edm::EDGetTokenT< reco::ConversionTrackCollection > trackProducer1
std::vector< ConversionTrack > ConversionTrackCollection
collection of ConversionTracks
arbitratedMergedPreferCollection
std::unique_ptr< reco::ConversionTrackCollection > outputTrks
arbitratedEcalSeededPreferCollection
float ChiSquaredProbability(double chiSquared, double nrDOF)
ConversionTrackMerger(const edm::ParameterSet &conf)
~ConversionTrackMerger() override
#define DEFINE_FWK_MODULE(type)
trackerOnlyPreferCollection
arbitratedMergedEcalGeneralPreferCollection
Log< level::Warning, false > LogWarning
void produce(edm::Event &e, const edm::EventSetup &c) override
edm::EDGetTokenT< reco::ConversionTrackCollection > trackProducer2