Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add fillDescriptions to modules used in cosmics HLT reco #46647

Merged
merged 2 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions HLTrigger/Configuration/python/customizeHLTforCMSSW.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,21 @@ def customiseForOffline(process):

return process

def customiseHLTFor46647(process):
for prod in producers_by_type(process, 'CtfSpecialSeedGenerator'):
if hasattr(prod, "DontCountDetsAboveNClusters"):
value = prod.DontCountDetsAboveNClusters.value()
delattr(prod, "DontCountDetsAboveNClusters")
# Replace it with cms.uint32
prod.DontCountDetsAboveNClusters = cms.uint32(value)

for prod in producers_by_type(process, 'SeedCombiner'):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This for loop is inside the for loop from above, is this really the intention?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no.

if hasattr(prod, "PairCollection"):
delattr(prod, "PairCollection")
if hasattr(prod, "TripletCollection"):
delattr(prod, "TripletCollection")

return process

# CMSSW version specific customizations
def customizeHLTforCMSSW(process, menuType="GRun"):
Expand All @@ -57,4 +72,6 @@ def customizeHLTforCMSSW(process, menuType="GRun"):
# add call to action function in proper order: newest last!
# process = customiseFor12718(process)

process = customiseHLTFor46647(process)

return process
5 changes: 1 addition & 4 deletions RecoTracker/Configuration/python/RecoTrackerP5_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@
from RecoTracker.TkSeedGenerator.GlobalCombinedSeeds_cff import *
combinedP5SeedsForCTF = RecoTracker.TkSeedGenerator.GlobalCombinedSeeds_cfi.globalCombinedSeeds.clone(
seedCollections = ['combinatorialcosmicseedfinderP5',
'simpleCosmicBONSeeds'],
#backward compatibility 2.2/3.1
PairCollection = cms.InputTag('combinatorialcosmicseedfinderP5'),
TripletCollection = cms.InputTag('simpleCosmicBONSeeds')
'simpleCosmicBONSeeds']
)

from RecoTracker.CkfPattern.CkfTrackCandidatesP5_cff import *
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@
* from combinations of hits in pairs of strip layers
*/
//FWK
#include "FWCore/Framework/interface/stream/EDProducer.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/Framework/interface/stream/EDProducer.h"
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
//DataFormats
#include "DataFormats/Common/interface/Handle.h"
#include "DataFormats/TrajectorySeed/interface/TrajectorySeedCollection.h"
Expand Down Expand Up @@ -42,14 +44,15 @@ class CtfSpecialSeedGenerator : public edm::stream::EDProducer<> {
typedef TrajectoryStateOnSurface TSOS;

CtfSpecialSeedGenerator(const edm::ParameterSet& conf);

~CtfSpecialSeedGenerator() override; //{};
~CtfSpecialSeedGenerator() override = default;

void beginRun(edm::Run const&, edm::EventSetup const&) override;
void endRun(edm::Run const&, edm::EventSetup const&) override;

void produce(edm::Event& e, const edm::EventSetup& c) override;

static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);

private:
bool run(const edm::EventSetup& c, const edm::Event& e, TrajectorySeedCollection& output);

Expand Down
90 changes: 77 additions & 13 deletions RecoTracker/SpecialSeedGenerators/src/CtfSpecialSeedGenerator.cc
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
#include "RecoTracker/SpecialSeedGenerators/interface/CtfSpecialSeedGenerator.h"
#include "DataFormats/TrackerCommon/interface/TrackerTopology.h"
#include "Geometry/Records/interface/TrackerTopologyRcd.h"
#include "DataFormats/GeometrySurface/interface/RectangularPlaneBounds.h"
#include "TrackingTools/GeomPropagators/interface/StraightLinePlaneCrossing.h"

#include "RecoTracker/TkTrackingRegions/interface/TrackingRegionProducerFactory.h"
#include "RecoTracker/TkTrackingRegions/interface/TrackingRegion.h"
#include "RecoTracker/TkTrackingRegions/interface/OrderedHitsGeneratorFactory.h"
#include "RecoTracker/TkSeedingLayers/interface/OrderedSeedingHits.h"
#include "DataFormats/TrackerCommon/interface/TrackerTopology.h"
#include "FWCore/Framework/interface/ConsumesCollector.h"

#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/Framework/interface/ConsumesCollector.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "Geometry/Records/interface/TrackerTopologyRcd.h"
#include "RecoTracker/SpecialSeedGenerators/interface/CtfSpecialSeedGenerator.h"
#include "RecoTracker/TkSeedingLayers/interface/OrderedSeedingHits.h"
#include "RecoTracker/TkTrackingRegions/interface/OrderedHitsGeneratorFactory.h"
#include "RecoTracker/TkTrackingRegions/interface/TrackingRegion.h"
#include "RecoTracker/TkTrackingRegions/interface/TrackingRegionProducerFactory.h"
#include "TrackingTools/GeomPropagators/interface/StraightLinePlaneCrossing.h"

using namespace ctfseeding;

Expand Down Expand Up @@ -48,8 +46,6 @@ CtfSpecialSeedGenerator::CtfSpecialSeedGenerator(const edm::ParameterSet& conf)
}
}

CtfSpecialSeedGenerator::~CtfSpecialSeedGenerator() = default;

void CtfSpecialSeedGenerator::endRun(edm::Run const&, edm::EventSetup const&) { theSeedBuilder.reset(); }

void CtfSpecialSeedGenerator::beginRun(edm::Run const&, const edm::EventSetup& iSetup) {
Expand Down Expand Up @@ -278,3 +274,71 @@ bool CtfSpecialSeedGenerator::postCheck(const TrajectorySeed& seed) {
<< " position on Lower scintillator " << positionLower.second;
return false;
}

void CtfSpecialSeedGenerator::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
edm::ParameterSetDescription desc;

// Top-level parameters
desc.add<double>("SeedMomentum", 5.0);
desc.add<double>("ErrorRescaling", 50.0);
desc.add<bool>("UseScintillatorsConstraint", true);
desc.add<std::string>("TTRHBuilder", "WithTrackAngle");
desc.add<bool>("SeedsFromPositiveY", true);
desc.add<bool>("SeedsFromNegativeY", false);
desc.add<bool>("CheckHitsAreOnDifferentLayers", false);
desc.add<bool>("SetMomentum", true);
desc.add<bool>("requireBOFF", false);
desc.add<int32_t>("maxSeeds", 10000);

// call the cluster checker to insert directly the configuration
ClusterChecker::fillDescriptions(desc);

// Vector parameters
desc.add<std::vector<int>>("Charges", {-1});

// RegionFactoryPSet (nested PSet)
{
edm::ParameterSetDescription ps_RegionFactoryPSet;
ps_RegionFactoryPSet.add<std::string>("ComponentName", "GlobalRegionProducer");

edm::ParameterSetDescription ps_RegionPSet;
ps_RegionPSet.setAllowAnything();
ps_RegionFactoryPSet.add("RegionPSet", ps_RegionPSet)->setComment("");
desc.add<edm::ParameterSetDescription>("RegionFactoryPSet", ps_RegionFactoryPSet);
}

// UpperScintillatorParameters (nested PSet)
{
edm::ParameterSetDescription ps_UpperScintillatorParameters;
ps_UpperScintillatorParameters.add<double>("LenghtInZ", 100.0);
ps_UpperScintillatorParameters.add<double>("GlobalX", 0.0);
ps_UpperScintillatorParameters.add<double>("GlobalY", 300.0);
ps_UpperScintillatorParameters.add<double>("GlobalZ", 50.0);
ps_UpperScintillatorParameters.add<double>("WidthInX", 100.0);
desc.add<edm::ParameterSetDescription>("UpperScintillatorParameters", ps_UpperScintillatorParameters);
}

// LowerScintillatorParameters (nested PSet)
{
edm::ParameterSetDescription ps_LowerScintillatorParameters;
ps_LowerScintillatorParameters.add<double>("LenghtInZ", 100.0);
ps_LowerScintillatorParameters.add<double>("GlobalX", 0.0);
ps_LowerScintillatorParameters.add<double>("GlobalY", -100.0);
ps_LowerScintillatorParameters.add<double>("GlobalZ", 50.0);
ps_LowerScintillatorParameters.add<double>("WidthInX", 100.0);
desc.add<edm::ParameterSetDescription>("LowerScintillatorParameters", ps_LowerScintillatorParameters);
}

// OrderedHitsFactoryPSets (VPSet)
{
edm::ParameterSetDescription ps_OrderedHitsFactoryPSet;
ps_OrderedHitsFactoryPSet.setAllowAnything();
std::vector<edm::ParameterSet> default_OrderedHitsFactoryPSet(1);

// Add the VPSet (OrderedHitsFactoryPSets) to the top-level description
desc.addVPSet("OrderedHitsFactoryPSets", ps_OrderedHitsFactoryPSet, default_OrderedHitsFactoryPSet);
}

// Add the top-level description to the descriptions
descriptions.addWithDefaultLabel(desc);
}
9 changes: 7 additions & 2 deletions RecoTracker/TkSeedGenerator/plugins/SeedCombiner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ SeedCombiner::SeedCombiner(const edm::ParameterSet& cfg) {
}
}

SeedCombiner::~SeedCombiner() {}

void SeedCombiner::produce(edm::Event& ev, const edm::EventSetup& es) {
// Read inputs, and count total seeds
size_t ninputs = inputCollections_.size();
Expand Down Expand Up @@ -85,3 +83,10 @@ void SeedCombiner::produce(edm::Event& ev, const edm::EventSetup& es) {
// Save result into the event
ev.put(std::move(result));
}

void SeedCombiner::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
edm::ParameterSetDescription desc;
desc.add<std::vector<edm::InputTag> >("seedCollections", {});
desc.addOptional<std::vector<edm::InputTag> >("clusterRemovalInfos", {});
descriptions.addWithDefaultLabel(desc);
}
10 changes: 7 additions & 3 deletions RecoTracker/TkSeedGenerator/plugins/SeedCombiner.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
#define RecoTracker_TkSeedGenerator_SeedCombiner_H

#include <vector>
#include "FWCore/Framework/interface/stream/EDProducer.h"
#include "DataFormats/TrajectorySeed/interface/TrajectorySeedCollection.h"
#include "DataFormats/TrackerRecHit2D/interface/ClusterRemovalInfo.h"
#include "DataFormats/TrajectorySeed/interface/TrajectorySeedCollection.h"
#include "FWCore/Framework/interface/stream/EDProducer.h"
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
#include "FWCore/Utilities/interface/InputTag.h"
#include "FWCore/Utilities/interface/Visibility.h"

Expand All @@ -17,7 +19,9 @@ namespace edm {
class dso_hidden SeedCombiner : public edm::stream::EDProducer<> {
public:
SeedCombiner(const edm::ParameterSet& cfg);
~SeedCombiner() override;
~SeedCombiner() override = default;

static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);

void produce(edm::Event& ev, const edm::EventSetup& es) override;

Expand Down
1 change: 1 addition & 0 deletions RecoTracker/TkSeedGenerator/src/ClusterChecker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ void ClusterChecker::fillDescriptions(edm::ParameterSetDescription& desc) {
desc.add<edm::InputTag>("PixelClusterCollectionLabel", edm::InputTag("siPixelClusters"));
desc.add<std::string>("cut",
"strip < 400000 && pixel < 40000 && (strip < 50000 + 10*pixel) && (pixel < 5000 + 0.1*strip)");
desc.add<uint32_t>("DontCountDetsAboveNClusters", 0);
}

ClusterChecker::~ClusterChecker() {}
Expand Down