52 return std::make_unique<Count>();
56 static void globalEndJob(
Count const* iCount);
80 if(type ==
"Default") theTrackTransformer = std::make_unique<TrackTransformer>(trackTransformerParam);
81 else if(type ==
"GlobalCosmicMuonsForAlignment") theTrackTransformer = std::make_unique<TrackTransformerForGlobalCosmicMuons>(trackTransformerParam);
82 else if(type ==
"CosmicMuonsForAlignment") theTrackTransformer = std::make_unique<TrackTransformerForCosmicMuons>(trackTransformerParam);
85 <<
"The selected algorithm does not exist" 87 <<
"Possible choices are:" 89 <<
"Type = [Default, GlobalCosmicMuonsForAlignment, CosmicMuonsForAlignment]";
92 produces<vector<Trajectory> >(
"Refitted");
93 produces<TrajTrackAssociationCollection>(
"Refitted");
107 LogWarning(metname) <<
"During the refit there were " 110 LogTrace(metname) <<
"Refit of the tracks done without any failure";
121 theTrackTransformer->setServices(setup);
124 auto trajectoryCollection = std::make_unique<vector<Trajectory>>();
128 =
event.getRefBeforePut<vector<Trajectory> >(
"Refitted");
132 event.getByToken(theTracksToken, tracks);
135 auto trajTrackMap = std::make_unique<TrajTrackAssociationCollection>(trajectoryCollectionRefProd,
tracks);
141 for (
auto const & newTrack : *tracks ) {
143 ++(globalCache()->theNTracks);
145 auto const & trajectoriesSM = theTrackTransformer->transform(newTrack);
147 if(!trajectoriesSM.empty()){
149 trajectoryCollection->push_back(trajectoriesSM.front());
152 trajTrackMap->insert(
Ref<vector<Trajectory> >(trajectoryCollectionRefProd,trajectoryIndex++),
156 LogTrace(metname) <<
"Error in the Track refitting. This should not happen";
157 ++(globalCache()->theNFailures);
160 LogTrace(metname)<<
"Load the Trajectory Collection";
161 event.put(
move(trajectoryCollection),
"Refitted");
162 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
def setup(process, global_tag, zero_tesla=False)
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