54 static void globalEndJob(
Count const* iCount);
75 if (
type ==
"Default")
76 theTrackTransformer = std::make_unique<TrackTransformer>(trackTransformerParam, consumesCollector());
77 else if (
type ==
"GlobalCosmicMuonsForAlignment")
79 std::make_unique<TrackTransformerForGlobalCosmicMuons>(trackTransformerParam, consumesCollector());
80 else if (
type ==
"CosmicMuonsForAlignment")
81 theTrackTransformer = std::make_unique<TrackTransformerForCosmicMuons>(trackTransformerParam, consumesCollector());
84 <<
"The selected algorithm does not exist" 86 <<
"Possible choices are:" 88 <<
"Type = [Default, GlobalCosmicMuonsForAlignment, CosmicMuonsForAlignment]";
91 produces<vector<Trajectory>>(
"Refitted");
92 produces<TrajTrackAssociationCollection>(
"Refitted");
99 constexpr
char metname[] =
"Reco|TrackingTools|TracksToTrajectories";
104 if (theNFailures != 0)
105 LogWarning(
metname) <<
"During the refit there were " << theNFailures <<
" out of " << theNTracks
106 <<
" tracks, i.e. failure rate is: " << double(theNFailures) / theNTracks;
115 constexpr
char metname[] =
"Reco|TrackingTools|TracksToTrajectories";
118 theTrackTransformer->setServices(
setup);
121 auto trajectoryCollection = std::make_unique<vector<Trajectory>>();
128 event.getByToken(theTracksToken,
tracks);
131 auto trajTrackMap = std::make_unique<TrajTrackAssociationCollection>(trajectoryCollectionRefProd,
tracks);
137 for (
auto const& newTrack : *
tracks) {
138 ++(globalCache()->theNTracks);
140 auto const& trajectoriesSM = theTrackTransformer->transform(newTrack);
142 if (!trajectoriesSM.empty()) {
144 trajectoryCollection->push_back(trajectoriesSM.front());
147 trajTrackMap->insert(
Ref<vector<Trajectory>>(trajectoryCollectionRefProd, trajectoryIndex++),
150 LogTrace(
metname) <<
"Error in the Track refitting. This should not happen";
151 ++(globalCache()->theNFailures);
155 event.put(
move(trajectoryCollection),
"Refitted");
156 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
ParameterSet const & parameterSet(StableProvenance const &provenance, ProcessHistory const &history)
TracksToTrajectories(const edm::ParameterSet &, const Count *)
Constructor.
std::unique_ptr< TrackTransformerBase > theTrackTransformer
#define DEFINE_FWK_MODULE(type)
auto const & tracks
cannot be loose
~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 &)
Log< level::Warning, false > LogWarning
std::atomic< int > theNTracks