22 edm::LogInfo(
"CosmicRegionalSeedGenerator") <<
"Begin Run:: Constructing CosmicRegionalSeedGenerator";
43 jetsPtMin_ = regionInJetsCheckPSet.getParameter<
double>(
"jetsPtMin");
58 std::vector<std::unique_ptr<TrackingRegion>>
result;
72 LogDebug(
"CosmicRegionalSeedGenerator") <<
"Seeding on stand alone muons ";
82 <<
") in the event - Please verify the name of the muon collection";
86 LogDebug(
"CosmicRegionalSeedGenerator") <<
"Muons collection size = " << muonsHandle->size();
106 for (reco::MuonCollection::const_iterator staMuon = muonsHandle->begin(); staMuon != muonsHandle->end();
109 if (!staMuon->isStandAloneMuon()) {
110 LogDebug(
"CosmicRegionalSeedGenerator") <<
"This muon is not a stand alone muon";
115 if (
abs(staMuon->standAloneMuon()->eta()) > 1.5)
120 LogDebug(
"CosmicRegionalSeedGenerator") <<
"Muon stand alone found in the collection - in muons chambers: \n "
121 <<
"Position = " << staMuon->standAloneMuon()->outerPosition() <<
"\n "
122 <<
"Momentum = " << staMuon->standAloneMuon()->outerMomentum() <<
"\n "
123 <<
"Eta = " << staMuon->standAloneMuon()->eta() <<
"\n "
124 <<
"Phi = " << staMuon->standAloneMuon()->phi();
128 GlobalPoint initialRegionPosition(staMuon->standAloneMuon()->referencePoint().x(),
129 staMuon->standAloneMuon()->referencePoint().y(),
130 staMuon->standAloneMuon()->referencePoint().z());
131 GlobalVector initialRegionMomentum(staMuon->standAloneMuon()->momentum().x(),
132 staMuon->standAloneMuon()->momentum().y(),
133 staMuon->standAloneMuon()->momentum().z());
134 int charge = (
int)staMuon->standAloneMuon()->charge();
136 LogDebug(
"CosmicRegionalSeedGenerator") <<
"Initial region - Reference point of the sta muon: \n "
137 <<
"Position = " << initialRegionPosition <<
"\n "
138 <<
"Momentum = " << initialRegionMomentum <<
"\n "
139 <<
"Eta = " << initialRegionPosition.eta() <<
"\n "
140 <<
"Phi = " << initialRegionPosition.phi() <<
"\n "
144 if (staMuon->standAloneMuon()->outerPosition().y() > 0)
145 initialRegionMomentum *= -1;
152 if (!
outer.isValid()) {
154 LogDebug(
"CosmicRegionalSeedGenerator") <<
"Trajectory state on surface not valid";
162 LogDebug(
"CosmicRegionalSeedGenerator")
163 <<
"Region after propagation: \n "
164 <<
"Position = " <<
outer.globalPosition() <<
"\n "
165 <<
"Momentum = " <<
outer.globalMomentum() <<
"\n "
166 <<
"R = " << regionPosition.
perp() <<
" ---- z = " << regionPosition.
z() <<
"\n "
167 <<
"Eta = " <<
outer.globalPosition().eta() <<
"\n "
168 <<
"Phi = " <<
outer.globalPosition().phi();
174 LogDebug(
"CosmicRegionalSeedGenerator") <<
"Step back vector = " <<
v <<
"\n";
178 double delta_R_min = 1000.;
179 for (CaloJetCollection::const_iterator
jet = caloJetsHandle->begin();
jet != caloJetsHandle->end();
jet++) {
183 double deta = center.
eta() -
jet->eta();
184 double dphi = fabs(center.
phi() -
jet->phi());
195 LogDebug(
"CosmicRegionalSeedGenerator") <<
"Region built too close from a jet";
202 result.push_back(std::make_unique<CosmicTrackingRegion>(
205 LogDebug(
"CosmicRegionalSeedGenerator")
206 <<
"Final CosmicTrackingRegion \n "
207 <<
"Position = " << center <<
"\n "
208 <<
"Direction = " <<
result.back()->direction() <<
"\n "
209 <<
"Distance from the region on the layer = " << (regionPosition - center).
mag() <<
"\n "
210 <<
"Eta = " << center.
eta() <<
"\n "
211 <<
"Phi = " << center.
phi();
223 LogDebug(
"CosmicRegionalSeedGenerator") <<
"Seeding on cosmic muons tracks";
231 if (!cosmicMuonsHandle.
isValid()) {
234 <<
") in the event - Please verify the name of the muon reco track collection";
238 LogDebug(
"CosmicRegionalSeedGenerator") <<
"Cosmic muons tracks collection size = " << cosmicMuonsHandle->size();
257 for (reco::TrackCollection::const_iterator cosmicMuon = cosmicMuonsHandle->begin();
258 cosmicMuon != cosmicMuonsHandle->end();
261 if (
abs(cosmicMuon->eta()) > 1.5)
268 cosmicMuon->referencePoint().x(), cosmicMuon->referencePoint().y(), cosmicMuon->referencePoint().z());
270 cosmicMuon->momentum().x(), cosmicMuon->momentum().y(), cosmicMuon->momentum().z());
273 LogDebug(
"CosmicRegionalSeedGenerator") <<
"Position and momentum of the muon track in the muon chambers: \n "
274 <<
"x = " << cosmicMuon->outerPosition().x() <<
"\n "
275 <<
"y = " << cosmicMuon->outerPosition().y() <<
"\n "
276 <<
"y = " << cosmicMuon->pt() <<
"\n "
277 <<
"Initial region - Reference point of the cosmic muon track: \n "
278 <<
"Position = " << initialRegionPosition <<
"\n "
279 <<
"Momentum = " << initialRegionMomentum <<
"\n "
280 <<
"Eta = " << initialRegionPosition.eta() <<
"\n "
281 <<
"Phi = " << initialRegionPosition.phi() <<
"\n "
285 if (cosmicMuon->outerPosition().y() > 0 && cosmicMuon->momentum().y() < 0)
286 initialRegionMomentum *= -1;
293 if (!
outer.isValid()) {
295 LogDebug(
"CosmicRegionalSeedGenerator") <<
"Trajectory state on surface not valid";
303 LogDebug(
"CosmicRegionalSeedGenerator")
304 <<
"Region after propagation: \n "
305 <<
"Position = " <<
outer.globalPosition() <<
"\n "
306 <<
"Momentum = " <<
outer.globalMomentum() <<
"\n "
307 <<
"R = " << regionPosition.
perp() <<
" ---- z = " << regionPosition.
z() <<
"\n "
308 <<
"Eta = " <<
outer.globalPosition().eta() <<
"\n "
309 <<
"Phi = " <<
outer.globalPosition().phi();
315 LogDebug(
"CosmicRegionalSeedGenerator") <<
"Step back vector = " <<
v <<
"\n";
319 double delta_R_min = 1000.;
320 for (CaloJetCollection::const_iterator
jet = caloJetsHandle->begin();
jet != caloJetsHandle->end();
jet++) {
324 double deta = center.
eta() -
jet->eta();
325 double dphi = fabs(center.
phi() -
jet->phi());
336 LogDebug(
"CosmicRegionalSeedGenerator") <<
"Region built too close from a jet";
342 result.push_back(std::make_unique<CosmicTrackingRegion>(
345 LogDebug(
"CosmicRegionalSeedGenerator")
346 <<
"Final CosmicTrackingRegion \n "
347 <<
"Position = " << center <<
"\n "
348 <<
"Direction = " <<
result.back()->direction() <<
"\n "
349 <<
"Distance from the region on the layer = " << (regionPosition - center).
mag() <<
"\n "
350 <<
"Eta = " << center.
eta() <<
"\n "
351 <<
"Phi = " << center.
phi();
363 LogDebug(
"CosmicRegionalSeedGenerator") <<
"Seeding on L2 muons";
372 if (!L2MuonsHandle.
isValid()) {
374 <<
") in the event - Please verify the name of the L2 muon collection";
378 LogDebug(
"CosmicRegionalSeedGenerator") <<
"L2 muons collection size = " << L2MuonsHandle->size();
393 for (reco::RecoChargedCandidateCollection::const_iterator L2Muon = L2MuonsHandle->begin();
394 L2Muon != L2MuonsHandle->end();
399 if (
abs(tkL2Muon->eta()) > 1.5)
406 tkL2Muon->referencePoint().x(), tkL2Muon->referencePoint().y(), tkL2Muon->referencePoint().z());
407 GlobalVector initialRegionMomentum(tkL2Muon->momentum().x(), tkL2Muon->momentum().y(), tkL2Muon->momentum().z());
410 LogDebug(
"CosmicRegionalSeedGenerator") <<
"Position and momentum of the L2 muon track in the muon chambers: \n "
411 <<
"x = " << tkL2Muon->outerPosition().x() <<
"\n "
412 <<
"y = " << tkL2Muon->outerPosition().y() <<
"\n "
413 <<
"y = " << tkL2Muon->pt() <<
"\n "
414 <<
"Initial region - Reference point of the L2 muon track: \n "
415 <<
"Position = " << initialRegionPosition <<
"\n "
416 <<
"Momentum = " << initialRegionMomentum <<
"\n "
417 <<
"Eta = " << initialRegionPosition.eta() <<
"\n "
418 <<
"Phi = " << initialRegionPosition.phi() <<
"\n "
422 if (tkL2Muon->outerPosition().y() > 0) {
423 LogDebug(
"CosmicRegionalSeedGenerator") <<
"L2 muon in the TOP --- Region not created";
433 if (!
outer.isValid()) {
435 LogDebug(
"CosmicRegionalSeedGenerator") <<
"Trajectory state on surface not valid";
443 LogDebug(
"CosmicRegionalSeedGenerator")
444 <<
"Region after propagation: \n "
445 <<
"Position = " <<
outer.globalPosition() <<
"\n "
446 <<
"Momentum = " <<
outer.globalMomentum() <<
"\n "
447 <<
"R = " << regionPosition.
perp() <<
" ---- z = " << regionPosition.
z() <<
"\n "
448 <<
"Eta = " <<
outer.globalPosition().eta() <<
"\n "
449 <<
"Phi = " <<
outer.globalPosition().phi();
455 LogDebug(
"CosmicRegionalSeedGenerator") <<
"Step back vector = " <<
v <<
"\n";
458 result.push_back(std::make_unique<CosmicTrackingRegion>(
461 LogDebug(
"CosmicRegionalSeedGenerator")
462 <<
"Final L2TrackingRegion \n "
463 <<
"Position = " << center <<
"\n "
464 <<
"Direction = " <<
result.back()->direction() <<
"\n "
465 <<
"Distance from the region on the layer = " << (regionPosition - center).
mag() <<
"\n "
466 <<
"Eta = " << center.
eta() <<
"\n "
467 <<
"Phi = " << center.
phi();