20 edm::LogInfo(
"CosmicRegionalSeedGenerator") <<
"Begin Run:: Constructing CosmicRegionalSeedGenerator";
41 jetsPtMin_ = regionInJetsCheckPSet.getParameter<
double>(
"jetsPtMin");
56 std::vector<std::unique_ptr<TrackingRegion>>
result;
75 LogDebug(
"CosmicRegionalSeedGenerator") <<
"Seeding on stand alone muons ";
85 <<
") in the event - Please verify the name of the muon collection";
89 LogDebug(
"CosmicRegionalSeedGenerator") <<
"Muons collection size = " << muonsHandle->size();
98 for (reco::MuonCollection::const_iterator staMuon = muonsHandle->begin(); staMuon != muonsHandle->end();
101 if (!staMuon->isStandAloneMuon()) {
102 LogDebug(
"CosmicRegionalSeedGenerator") <<
"This muon is not a stand alone muon";
107 if (
abs(staMuon->standAloneMuon()->eta()) > 1.5)
111 LogDebug(
"CosmicRegionalSeedGenerator") <<
"Muon stand alone found in the collection - in muons chambers: \n " 112 <<
"Position = " << staMuon->standAloneMuon()->outerPosition() <<
"\n " 113 <<
"Momentum = " << staMuon->standAloneMuon()->outerMomentum() <<
"\n " 114 <<
"Eta = " << staMuon->standAloneMuon()->eta() <<
"\n " 115 <<
"Phi = " << staMuon->standAloneMuon()->phi();
119 GlobalPoint initialRegionPosition(staMuon->standAloneMuon()->referencePoint().x(),
120 staMuon->standAloneMuon()->referencePoint().y(),
121 staMuon->standAloneMuon()->referencePoint().z());
122 GlobalVector initialRegionMomentum(staMuon->standAloneMuon()->momentum().x(),
123 staMuon->standAloneMuon()->momentum().y(),
124 staMuon->standAloneMuon()->momentum().z());
125 int charge = (
int)staMuon->standAloneMuon()->charge();
127 LogDebug(
"CosmicRegionalSeedGenerator") <<
"Initial region - Reference point of the sta muon: \n " 128 <<
"Position = " << initialRegionPosition <<
"\n " 129 <<
"Momentum = " << initialRegionMomentum <<
"\n " 130 <<
"Eta = " << initialRegionPosition.eta() <<
"\n " 131 <<
"Phi = " << initialRegionPosition.phi() <<
"\n " 135 if (staMuon->standAloneMuon()->outerPosition().y() > 0)
136 initialRegionMomentum *= -1;
138 initialRegionPosition, initialRegionMomentum,
charge,
propagator.magneticField());
143 if (!
outer.isValid()) {
145 LogDebug(
"CosmicRegionalSeedGenerator") <<
"Trajectory state on surface not valid";
153 LogDebug(
"CosmicRegionalSeedGenerator")
154 <<
"Region after propagation: \n " 155 <<
"Position = " <<
outer.globalPosition() <<
"\n " 156 <<
"Momentum = " <<
outer.globalMomentum() <<
"\n " 157 <<
"R = " << regionPosition.
perp() <<
" ---- z = " << regionPosition.
z() <<
"\n " 158 <<
"Eta = " <<
outer.globalPosition().eta() <<
"\n " 159 <<
"Phi = " <<
outer.globalPosition().phi();
165 LogDebug(
"CosmicRegionalSeedGenerator") <<
"Step back vector = " <<
v <<
"\n";
169 double delta_R_min = 1000.;
170 for (CaloJetCollection::const_iterator
jet = caloJetsHandle->begin();
jet != caloJetsHandle->end();
jet++) {
174 double deta = center.
eta() -
jet->eta();
175 double dphi = fabs(center.
phi() -
jet->phi());
186 LogDebug(
"CosmicRegionalSeedGenerator") <<
"Region built too close from a jet";
193 result.push_back(std::make_unique<CosmicTrackingRegion>(
196 LogDebug(
"CosmicRegionalSeedGenerator")
197 <<
"Final CosmicTrackingRegion \n " 198 <<
"Position = " << center <<
"\n " 199 <<
"Direction = " <<
result.back()->direction() <<
"\n " 200 <<
"Distance from the region on the layer = " << (regionPosition - center).
mag() <<
"\n " 201 <<
"Eta = " << center.
eta() <<
"\n " 202 <<
"Phi = " << center.
phi();
214 LogDebug(
"CosmicRegionalSeedGenerator") <<
"Seeding on cosmic muons tracks";
222 if (!cosmicMuonsHandle.
isValid()) {
225 <<
") in the event - Please verify the name of the muon reco track collection";
229 LogDebug(
"CosmicRegionalSeedGenerator") <<
"Cosmic muons tracks collection size = " << cosmicMuonsHandle->size();
238 for (reco::TrackCollection::const_iterator cosmicMuon = cosmicMuonsHandle->begin();
239 cosmicMuon != cosmicMuonsHandle->end();
242 if (
abs(cosmicMuon->eta()) > 1.5)
247 cosmicMuon->referencePoint().x(), cosmicMuon->referencePoint().y(), cosmicMuon->referencePoint().z());
249 cosmicMuon->momentum().x(), cosmicMuon->momentum().y(), cosmicMuon->momentum().z());
252 LogDebug(
"CosmicRegionalSeedGenerator") <<
"Position and momentum of the muon track in the muon chambers: \n " 253 <<
"x = " << cosmicMuon->outerPosition().x() <<
"\n " 254 <<
"y = " << cosmicMuon->outerPosition().y() <<
"\n " 255 <<
"y = " << cosmicMuon->pt() <<
"\n " 256 <<
"Initial region - Reference point of the cosmic muon track: \n " 257 <<
"Position = " << initialRegionPosition <<
"\n " 258 <<
"Momentum = " << initialRegionMomentum <<
"\n " 259 <<
"Eta = " << initialRegionPosition.eta() <<
"\n " 260 <<
"Phi = " << initialRegionPosition.phi() <<
"\n " 264 if (cosmicMuon->outerPosition().y() > 0 && cosmicMuon->momentum().y() < 0)
265 initialRegionMomentum *= -1;
267 initialRegionPosition, initialRegionMomentum,
charge,
propagator.magneticField());
272 if (!
outer.isValid()) {
274 LogDebug(
"CosmicRegionalSeedGenerator") <<
"Trajectory state on surface not valid";
282 LogDebug(
"CosmicRegionalSeedGenerator")
283 <<
"Region after propagation: \n " 284 <<
"Position = " <<
outer.globalPosition() <<
"\n " 285 <<
"Momentum = " <<
outer.globalMomentum() <<
"\n " 286 <<
"R = " << regionPosition.
perp() <<
" ---- z = " << regionPosition.
z() <<
"\n " 287 <<
"Eta = " <<
outer.globalPosition().eta() <<
"\n " 288 <<
"Phi = " <<
outer.globalPosition().phi();
294 LogDebug(
"CosmicRegionalSeedGenerator") <<
"Step back vector = " <<
v <<
"\n";
298 double delta_R_min = 1000.;
299 for (CaloJetCollection::const_iterator
jet = caloJetsHandle->begin();
jet != caloJetsHandle->end();
jet++) {
303 double deta = center.
eta() -
jet->eta();
304 double dphi = fabs(center.
phi() -
jet->phi());
315 LogDebug(
"CosmicRegionalSeedGenerator") <<
"Region built too close from a jet";
321 result.push_back(std::make_unique<CosmicTrackingRegion>(
324 LogDebug(
"CosmicRegionalSeedGenerator")
325 <<
"Final CosmicTrackingRegion \n " 326 <<
"Position = " << center <<
"\n " 327 <<
"Direction = " <<
result.back()->direction() <<
"\n " 328 <<
"Distance from the region on the layer = " << (regionPosition - center).
mag() <<
"\n " 329 <<
"Eta = " << center.
eta() <<
"\n " 330 <<
"Phi = " << center.
phi();
342 LogDebug(
"CosmicRegionalSeedGenerator") <<
"Seeding on L2 muons";
351 if (!L2MuonsHandle.
isValid()) {
353 <<
") in the event - Please verify the name of the L2 muon collection";
357 LogDebug(
"CosmicRegionalSeedGenerator") <<
"L2 muons collection size = " << L2MuonsHandle->size();
362 for (reco::RecoChargedCandidateCollection::const_iterator
L2Muon = L2MuonsHandle->begin();
363 L2Muon != L2MuonsHandle->end();
368 if (
abs(tkL2Muon->eta()) > 1.5)
373 tkL2Muon->referencePoint().x(), tkL2Muon->referencePoint().y(), tkL2Muon->referencePoint().z());
374 GlobalVector initialRegionMomentum(tkL2Muon->momentum().x(), tkL2Muon->momentum().y(), tkL2Muon->momentum().z());
377 LogDebug(
"CosmicRegionalSeedGenerator") <<
"Position and momentum of the L2 muon track in the muon chambers: \n " 378 <<
"x = " << tkL2Muon->outerPosition().x() <<
"\n " 379 <<
"y = " << tkL2Muon->outerPosition().y() <<
"\n " 380 <<
"y = " << tkL2Muon->pt() <<
"\n " 381 <<
"Initial region - Reference point of the L2 muon track: \n " 382 <<
"Position = " << initialRegionPosition <<
"\n " 383 <<
"Momentum = " << initialRegionMomentum <<
"\n " 384 <<
"Eta = " << initialRegionPosition.eta() <<
"\n " 385 <<
"Phi = " << initialRegionPosition.phi() <<
"\n " 389 if (tkL2Muon->outerPosition().y() > 0) {
390 LogDebug(
"CosmicRegionalSeedGenerator") <<
"L2 muon in the TOP --- Region not created";
395 initialRegionPosition, initialRegionMomentum,
charge,
propagator.magneticField());
400 if (!
outer.isValid()) {
402 LogDebug(
"CosmicRegionalSeedGenerator") <<
"Trajectory state on surface not valid";
410 LogDebug(
"CosmicRegionalSeedGenerator")
411 <<
"Region after propagation: \n " 412 <<
"Position = " <<
outer.globalPosition() <<
"\n " 413 <<
"Momentum = " <<
outer.globalMomentum() <<
"\n " 414 <<
"R = " << regionPosition.
perp() <<
" ---- z = " << regionPosition.
z() <<
"\n " 415 <<
"Eta = " <<
outer.globalPosition().eta() <<
"\n " 416 <<
"Phi = " <<
outer.globalPosition().phi();
422 LogDebug(
"CosmicRegionalSeedGenerator") <<
"Step back vector = " <<
v <<
"\n";
425 result.push_back(std::make_unique<CosmicTrackingRegion>(
428 LogDebug(
"CosmicRegionalSeedGenerator")
429 <<
"Final L2TrackingRegion \n " 430 <<
"Position = " << center <<
"\n " 431 <<
"Direction = " <<
result.back()->direction() <<
"\n " 432 <<
"Distance from the region on the layer = " << (regionPosition - center).
mag() <<
"\n " 433 <<
"Eta = " << center.
eta() <<
"\n " 434 <<
"Phi = " << center.
phi();
edm::EDGetTokenT< reco::TrackCollection > recoTrackMuonsToken_
T getParameter(std::string const &) const
bool doJetsExclusionCheck_
edm::EDGetTokenT< reco::CaloJetCollection > recoCaloJetsToken_
double deltaRExclusionSize_
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
edm::InputTag recoL2MuonsCollection_
edm::InputTag recoTrackMuonsCollection_
Geom::Phi< T > phi() const
T const * product() const
constexpr bool isUninitialized() const noexcept
std::vector< Track > TrackCollection
collection of Tracks
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magfieldToken_
Log< level::Error, false > LogError
std::vector< Muon > MuonCollection
collection of Muon objects
std::vector< std::unique_ptr< TrackingRegion > > regions(const edm::Event &event, const edm::EventSetup &es) const override
edm::ESGetToken< Propagator, TrackingComponentsRecord > propagatorToken_
Abs< T >::type abs(const T &t)
edm::EDGetTokenT< reco::MuonCollection > recoMuonsToken_
double delta_R(double eta1, double phi1, double eta2, double phi2)
edm::EDGetTokenT< MeasurementTrackerEvent > measurementTrackerEventToken_
Log< level::Info, false > LogInfo
std::vector< RecoChargedCandidate > RecoChargedCandidateCollection
collectin of RecoChargedCandidate objects
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
edm::InputTag recoMuonsCollection_
Vector3DBase unit() const
edm::EDGetTokenT< reco::RecoChargedCandidateCollection > recoL2MuonsToken_
CosmicRegionalSeedGenerator(const edm::ParameterSet &conf, edm::ConsumesCollector &&iC)
std::vector< CaloJet > CaloJetCollection
collection of CaloJet objects
edm::InputTag recoCaloJetsCollection_