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();
99 for (reco::MuonCollection::const_iterator staMuon = muonsHandle->begin(); staMuon != muonsHandle->end();
102 if (!staMuon->isStandAloneMuon()) {
103 LogDebug(
"CosmicRegionalSeedGenerator") <<
"This muon is not a stand alone muon";
108 if (
abs(staMuon->standAloneMuon()->eta()) > 1.5)
113 LogDebug(
"CosmicRegionalSeedGenerator") <<
"Muon stand alone found in the collection - in muons chambers: \n " 114 <<
"Position = " << staMuon->standAloneMuon()->outerPosition() <<
"\n " 115 <<
"Momentum = " << staMuon->standAloneMuon()->outerMomentum() <<
"\n " 116 <<
"Eta = " << staMuon->standAloneMuon()->eta() <<
"\n " 117 <<
"Phi = " << staMuon->standAloneMuon()->phi();
121 GlobalPoint initialRegionPosition(staMuon->standAloneMuon()->referencePoint().x(),
122 staMuon->standAloneMuon()->referencePoint().y(),
123 staMuon->standAloneMuon()->referencePoint().z());
124 GlobalVector initialRegionMomentum(staMuon->standAloneMuon()->momentum().x(),
125 staMuon->standAloneMuon()->momentum().y(),
126 staMuon->standAloneMuon()->momentum().z());
127 int charge = (
int)staMuon->standAloneMuon()->charge();
129 LogDebug(
"CosmicRegionalSeedGenerator") <<
"Initial region - Reference point of the sta muon: \n " 130 <<
"Position = " << initialRegionPosition <<
"\n " 131 <<
"Momentum = " << initialRegionMomentum <<
"\n " 132 <<
"Eta = " << initialRegionPosition.eta() <<
"\n " 133 <<
"Phi = " << initialRegionPosition.phi() <<
"\n " 137 if (staMuon->standAloneMuon()->outerPosition().y() > 0)
138 initialRegionMomentum *= -1;
140 initialRegionPosition, initialRegionMomentum,
charge,
propagator.magneticField());
145 if (!
outer.isValid()) {
147 LogDebug(
"CosmicRegionalSeedGenerator") <<
"Trajectory state on surface not valid";
155 LogDebug(
"CosmicRegionalSeedGenerator")
156 <<
"Region after propagation: \n " 157 <<
"Position = " <<
outer.globalPosition() <<
"\n " 158 <<
"Momentum = " <<
outer.globalMomentum() <<
"\n " 159 <<
"R = " << regionPosition.
perp() <<
" ---- z = " << regionPosition.
z() <<
"\n " 160 <<
"Eta = " <<
outer.globalPosition().eta() <<
"\n " 161 <<
"Phi = " <<
outer.globalPosition().phi();
167 LogDebug(
"CosmicRegionalSeedGenerator") <<
"Step back vector = " <<
v <<
"\n";
171 double delta_R_min = 1000.;
172 for (CaloJetCollection::const_iterator
jet = caloJetsHandle->begin();
jet != caloJetsHandle->end();
jet++) {
176 double deta = center.
eta() -
jet->eta();
177 double dphi = fabs(center.
phi() -
jet->phi());
188 LogDebug(
"CosmicRegionalSeedGenerator") <<
"Region built too close from a jet";
195 result.push_back(std::make_unique<CosmicTrackingRegion>(
198 LogDebug(
"CosmicRegionalSeedGenerator")
199 <<
"Final CosmicTrackingRegion \n " 200 <<
"Position = " << center <<
"\n " 201 <<
"Direction = " <<
result.back()->direction() <<
"\n " 202 <<
"Distance from the region on the layer = " << (regionPosition - center).
mag() <<
"\n " 203 <<
"Eta = " << center.
eta() <<
"\n " 204 <<
"Phi = " << center.
phi();
216 LogDebug(
"CosmicRegionalSeedGenerator") <<
"Seeding on cosmic muons tracks";
224 if (!cosmicMuonsHandle.
isValid()) {
227 <<
") in the event - Please verify the name of the muon reco track collection";
231 LogDebug(
"CosmicRegionalSeedGenerator") <<
"Cosmic muons tracks collection size = " << cosmicMuonsHandle->size();
241 for (reco::TrackCollection::const_iterator cosmicMuon = cosmicMuonsHandle->begin();
242 cosmicMuon != cosmicMuonsHandle->end();
245 if (
abs(cosmicMuon->eta()) > 1.5)
252 cosmicMuon->referencePoint().x(), cosmicMuon->referencePoint().y(), cosmicMuon->referencePoint().z());
254 cosmicMuon->momentum().x(), cosmicMuon->momentum().y(), cosmicMuon->momentum().z());
257 LogDebug(
"CosmicRegionalSeedGenerator") <<
"Position and momentum of the muon track in the muon chambers: \n " 258 <<
"x = " << cosmicMuon->outerPosition().x() <<
"\n " 259 <<
"y = " << cosmicMuon->outerPosition().y() <<
"\n " 260 <<
"y = " << cosmicMuon->pt() <<
"\n " 261 <<
"Initial region - Reference point of the cosmic muon track: \n " 262 <<
"Position = " << initialRegionPosition <<
"\n " 263 <<
"Momentum = " << initialRegionMomentum <<
"\n " 264 <<
"Eta = " << initialRegionPosition.eta() <<
"\n " 265 <<
"Phi = " << initialRegionPosition.phi() <<
"\n " 269 if (cosmicMuon->outerPosition().y() > 0 && cosmicMuon->momentum().y() < 0)
270 initialRegionMomentum *= -1;
272 initialRegionPosition, initialRegionMomentum,
charge,
propagator.magneticField());
277 if (!
outer.isValid()) {
279 LogDebug(
"CosmicRegionalSeedGenerator") <<
"Trajectory state on surface not valid";
287 LogDebug(
"CosmicRegionalSeedGenerator")
288 <<
"Region after propagation: \n " 289 <<
"Position = " <<
outer.globalPosition() <<
"\n " 290 <<
"Momentum = " <<
outer.globalMomentum() <<
"\n " 291 <<
"R = " << regionPosition.
perp() <<
" ---- z = " << regionPosition.
z() <<
"\n " 292 <<
"Eta = " <<
outer.globalPosition().eta() <<
"\n " 293 <<
"Phi = " <<
outer.globalPosition().phi();
299 LogDebug(
"CosmicRegionalSeedGenerator") <<
"Step back vector = " <<
v <<
"\n";
303 double delta_R_min = 1000.;
304 for (CaloJetCollection::const_iterator
jet = caloJetsHandle->begin();
jet != caloJetsHandle->end();
jet++) {
308 double deta = center.
eta() -
jet->eta();
309 double dphi = fabs(center.
phi() -
jet->phi());
320 LogDebug(
"CosmicRegionalSeedGenerator") <<
"Region built too close from a jet";
326 result.push_back(std::make_unique<CosmicTrackingRegion>(
329 LogDebug(
"CosmicRegionalSeedGenerator")
330 <<
"Final CosmicTrackingRegion \n " 331 <<
"Position = " << center <<
"\n " 332 <<
"Direction = " <<
result.back()->direction() <<
"\n " 333 <<
"Distance from the region on the layer = " << (regionPosition - center).
mag() <<
"\n " 334 <<
"Eta = " << center.
eta() <<
"\n " 335 <<
"Phi = " << center.
phi();
347 LogDebug(
"CosmicRegionalSeedGenerator") <<
"Seeding on L2 muons";
356 if (!L2MuonsHandle.
isValid()) {
358 <<
") in the event - Please verify the name of the L2 muon collection";
362 LogDebug(
"CosmicRegionalSeedGenerator") <<
"L2 muons collection size = " << L2MuonsHandle->size();
368 for (reco::RecoChargedCandidateCollection::const_iterator
L2Muon = L2MuonsHandle->begin();
369 L2Muon != L2MuonsHandle->end();
374 if (
abs(tkL2Muon->eta()) > 1.5)
381 tkL2Muon->referencePoint().x(), tkL2Muon->referencePoint().y(), tkL2Muon->referencePoint().z());
382 GlobalVector initialRegionMomentum(tkL2Muon->momentum().x(), tkL2Muon->momentum().y(), tkL2Muon->momentum().z());
385 LogDebug(
"CosmicRegionalSeedGenerator") <<
"Position and momentum of the L2 muon track in the muon chambers: \n " 386 <<
"x = " << tkL2Muon->outerPosition().x() <<
"\n " 387 <<
"y = " << tkL2Muon->outerPosition().y() <<
"\n " 388 <<
"y = " << tkL2Muon->pt() <<
"\n " 389 <<
"Initial region - Reference point of the L2 muon track: \n " 390 <<
"Position = " << initialRegionPosition <<
"\n " 391 <<
"Momentum = " << initialRegionMomentum <<
"\n " 392 <<
"Eta = " << initialRegionPosition.eta() <<
"\n " 393 <<
"Phi = " << initialRegionPosition.phi() <<
"\n " 397 if (tkL2Muon->outerPosition().y() > 0) {
398 LogDebug(
"CosmicRegionalSeedGenerator") <<
"L2 muon in the TOP --- Region not created";
403 initialRegionPosition, initialRegionMomentum,
charge,
propagator.magneticField());
408 if (!
outer.isValid()) {
410 LogDebug(
"CosmicRegionalSeedGenerator") <<
"Trajectory state on surface not valid";
418 LogDebug(
"CosmicRegionalSeedGenerator")
419 <<
"Region after propagation: \n " 420 <<
"Position = " <<
outer.globalPosition() <<
"\n " 421 <<
"Momentum = " <<
outer.globalMomentum() <<
"\n " 422 <<
"R = " << regionPosition.
perp() <<
" ---- z = " << regionPosition.
z() <<
"\n " 423 <<
"Eta = " <<
outer.globalPosition().eta() <<
"\n " 424 <<
"Phi = " <<
outer.globalPosition().phi();
430 LogDebug(
"CosmicRegionalSeedGenerator") <<
"Step back vector = " <<
v <<
"\n";
433 result.push_back(std::make_unique<CosmicTrackingRegion>(
436 LogDebug(
"CosmicRegionalSeedGenerator")
437 <<
"Final L2TrackingRegion \n " 438 <<
"Position = " << center <<
"\n " 439 <<
"Direction = " <<
result.back()->direction() <<
"\n " 440 <<
"Distance from the region on the layer = " << (regionPosition - center).
mag() <<
"\n " 441 <<
"Eta = " << center.
eta() <<
"\n " 442 <<
"Phi = " << center.
phi();
edm::EDGetTokenT< reco::TrackCollection > recoTrackMuonsToken_
T getParameter(std::string const &) const
bool doJetsExclusionCheck_
edm::EDGetTokenT< reco::CaloJetCollection > recoCaloJetsToken_
double deltaRExclusionSize_
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)
bool getData(T &iHolder) const
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_