53 static void globalEndJob(
Count const* iCount);
74 if (type ==
"Default")
75 theTrackTransformer = std::make_unique<TrackTransformer>(trackTransformerParam);
76 else if (type ==
"GlobalCosmicMuonsForAlignment")
77 theTrackTransformer = std::make_unique<TrackTransformerForGlobalCosmicMuons>(trackTransformerParam);
78 else if (type ==
"CosmicMuonsForAlignment")
79 theTrackTransformer = std::make_unique<TrackTransformerForCosmicMuons>(trackTransformerParam);
82 <<
"The selected algorithm does not exist" 84 <<
"Possible choices are:" 86 <<
"Type = [Default, GlobalCosmicMuonsForAlignment, CosmicMuonsForAlignment]";
89 produces<vector<Trajectory>>(
"Refitted");
90 produces<TrajTrackAssociationCollection>(
"Refitted");
106 LogTrace(metname) <<
"Refit of the tracks done without any failure";
116 theTrackTransformer->setServices(setup);
119 auto trajectoryCollection = std::make_unique<vector<Trajectory>>();
126 event.getByToken(theTracksToken, tracks);
129 auto trajTrackMap = std::make_unique<TrajTrackAssociationCollection>(trajectoryCollectionRefProd,
tracks);
135 for (
auto const& newTrack : *tracks) {
136 ++(globalCache()->theNTracks);
138 auto const& trajectoriesSM = theTrackTransformer->transform(newTrack);
140 if (!trajectoriesSM.empty()) {
142 trajectoryCollection->push_back(trajectoriesSM.front());
145 trajTrackMap->insert(
Ref<vector<Trajectory>>(trajectoryCollectionRefProd, trajectoryIndex++),
148 LogTrace(metname) <<
"Error in the Track refitting. This should not happen";
149 ++(globalCache()->theNFailures);
152 LogTrace(metname) <<
"Load the Trajectory Collection";
153 event.put(
move(trajectoryCollection),
"Refitted");
154 event.put(
move(trajTrackMap),
"Refitted");
T getParameter(std::string const &) const
std::remove_cv< typename std::remove_reference< argument_type >::type >::type key_type
std::atomic< int > theNFailures
const std::string metname
edm::EDGetTokenT< reco::TrackCollection > theTracksToken
TracksToTrajectories(const edm::ParameterSet &, const Count *)
Constructor.
#define DEFINE_FWK_MODULE(type)
std::unique_ptr< TrackTransformerBase > theTrackTransformer
~TracksToTrajectories() override
Destructor.
void produce(edm::Event &, const edm::EventSetup &) override
Convert a reco::TrackCollection into std::vector<Trajectory>
static void globalEndJob(Count const *iCount)
static std::unique_ptr< Count > initializeGlobalCache(edm::ParameterSet const &)
ParameterSet const & parameterSet(Provenance const &provenance)
std::atomic< int > theNTracks