Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented new strategy to generate OI seeds for displaced muons #38076

Merged
merged 4 commits into from May 31, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
105 changes: 100 additions & 5 deletions RecoMuon/TrackerSeedGenerator/plugins/TSGForOIFromL2.cc
Expand Up @@ -47,8 +47,11 @@ TSGForOIFromL2::TSGForOIFromL2(const edm::ParameterSet& iConfig)
SF4_(iConfig.getParameter<double>("SF4")),
SF5_(iConfig.getParameter<double>("SF5")),
SF6_(iConfig.getParameter<double>("SF6")),
SFHld_(iConfig.getParameter<double>("SFHld")),
SFHd_(iConfig.getParameter<double>("SFHd")),
tsosDiff1_(iConfig.getParameter<double>("tsosDiff1")),
tsosDiff2_(iConfig.getParameter<double>("tsosDiff2")),
displacedReco_(iConfig.getParameter<bool>("displacedReco")),
propagatorName_(iConfig.getParameter<std::string>("propagatorName")),
theCategory_(std::string("Muon|RecoMuon|TSGForOIFromL2")),
estimatorToken_(esConsumes(edm::ESInputTag("", estimatorName_))),
Expand All @@ -72,6 +75,7 @@ void TSGForOIFromL2::produce(edm::StreamID sid, edm::Event& iEvent, const edm::E
unsigned int hitlessSeedsMadeIP = 0;
unsigned int hitlessSeedsMadeMuS = 0;
unsigned int hitSeedsMade = 0;
unsigned int hitSeedsMadeMuS = 0;

// Surface used to make a TSOS at the PCA to the beamline
Plane::PlanePointer dummyPlane = Plane::build(Plane::PositionType(), Plane::RotationType());
Expand Down Expand Up @@ -167,6 +171,7 @@ void TSGForOIFromL2::produce(edm::StreamID sid, edm::Event& iEvent, const edm::E
hitlessSeedsMadeIP = 0;
hitlessSeedsMadeMuS = 0;
hitSeedsMade = 0;
hitSeedsMadeMuS = 0;

// calculate scale factors
double errorSFHits = (adjustErrorsDynamicallyForHits_ ? calculateSFFromL2(l2) : fixedErrorRescalingForHits_);
Expand Down Expand Up @@ -201,7 +206,7 @@ void TSGForOIFromL2::produce(edm::StreamID sid, edm::Event& iEvent, const edm::E
layerCount,
out);

if (useBoth) {
if (useBoth && !displacedReco_) {
if (useHitLessSeeds_ && hitlessSeedsMadeMuS < maxHitlessSeeds_ && numSeedsMade < maxSeeds_)
makeSeedsWithoutHits(**it,
outerTkStateOutside,
Expand All @@ -218,7 +223,7 @@ void TSGForOIFromL2::produce(edm::StreamID sid, edm::Event& iEvent, const edm::E
}

// Reset number of seeds if in overlap region
if (absL2muonEta > minEtaForTEC_ && absL2muonEta < maxEtaForTOB_) {
if (absL2muonEta > minEtaForTEC_ && absL2muonEta < maxEtaForTOB_ && !displacedReco_) {
numSeedsMade = 0;
hitlessSeedsMadeIP = 0;
hitlessSeedsMadeMuS = 0;
Expand Down Expand Up @@ -252,7 +257,7 @@ void TSGForOIFromL2::produce(edm::StreamID sid, edm::Event& iEvent, const edm::E
layerCount,
out);

if (useBoth) {
if (useBoth && !displacedReco_) {
if (useHitLessSeeds_ && hitlessSeedsMadeMuS < maxHitlessSeeds_ && numSeedsMade < maxSeeds_)
makeSeedsWithoutHits(**it,
outerTkStateOutside,
Expand Down Expand Up @@ -295,7 +300,7 @@ void TSGForOIFromL2::produce(edm::StreamID sid, edm::Event& iEvent, const edm::E
layerCount,
out);

if (useBoth) {
if (useBoth && !displacedReco_) {
if (useHitLessSeeds_ && hitlessSeedsMadeMuS < maxHitlessSeeds_ && numSeedsMade < maxSeeds_)
makeSeedsWithoutHits(**it,
outerTkStateOutside,
Expand All @@ -311,6 +316,93 @@ void TSGForOIFromL2::produce(edm::StreamID sid, edm::Event& iEvent, const edm::E
<< " , layerCount = " << layerCount << std::endl;
}

// Displaced Reconstruction
if (displacedReco_ && outerTkStateOutside.isValid()) {
layerCount = 0;
for (auto it = tob.rbegin(); it != tob.rend(); ++it) {
LogTrace("TSGForOIFromL2") << "TSGForOIFromL2::produce: looping in TOB layer " << layerCount << std::endl;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
LogTrace("TSGForOIFromL2") << "TSGForOIFromL2::produce: looping in TOB layer " << layerCount << std::endl;
LogTrace("TSGForOIFromL2") << "TSGForOIFromL2::produce: looping in TOB layer " << layerCount;

if (useHitLessSeeds_ && hitlessSeedsMadeMuS < maxHitlessSeeds_ && numSeedsMade < maxSeeds_)
makeSeedsWithoutHits(**it,
outerTkStateOutside,
*(propagatorOpposite.get()),
estimatorH,
errorSFHitless * SFHld_,
hitlessSeedsMadeMuS,
numSeedsMade,
out);
if (hitSeedsMadeMuS < maxHitSeeds_ && numSeedsMade < maxSeeds_)
makeSeedsFromHits(**it,
outerTkStateOutside,
*(propagatorOpposite.get()),
estimatorH,
measurementTrackerH,
errorSFHits * SFHd_,
hitSeedsMadeMuS,
numSeedsMade,
layerCount,
out);
}
LogTrace("TSGForOIFromL2") << "TSGForOIFromL2:::produce: NumSeedsMade = " << numSeedsMade
<< " , layerCount = " << layerCount << std::endl;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<< " , layerCount = " << layerCount << std::endl;
<< " , layerCount = " << layerCount;

if (L2muonEta > 0.0) {
layerCount = 0;
for (auto it = tecPositive.rbegin(); it != tecPositive.rend(); ++it) {
LogTrace("TSGForOIFromL2") << "TSGForOIFromL2::produce: looping in TEC+ layer " << layerCount << std::endl;
if (useHitLessSeeds_ && hitlessSeedsMadeMuS < maxHitlessSeeds_ && numSeedsMade < maxSeeds_)
makeSeedsWithoutHits(**it,
outerTkStateOutside,
*(propagatorOpposite.get()),
estimatorH,
errorSFHitless * SFHld_,
hitlessSeedsMadeMuS,
numSeedsMade,
out);
if (hitSeedsMadeMuS < maxHitSeeds_ && numSeedsMade < maxSeeds_)
makeSeedsFromHits(**it,
outerTkStateOutside,
*(propagatorOpposite.get()),
estimatorH,
measurementTrackerH,
errorSFHits * SFHd_,
hitSeedsMadeMuS,
numSeedsMade,
layerCount,
out);
}
LogTrace("TSGForOIFromL2") << "TSGForOIFromL2:::produce: NumSeedsMade = " << numSeedsMade
<< " , layerCount = " << layerCount << std::endl;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<< " , layerCount = " << layerCount << std::endl;
<< " , layerCount = " << layerCount;

}

if (L2muonEta < 0.0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (L2muonEta < 0.0) {
else if (L2muonEta < 0.0) {

What should happen in the case L2muonEta==0?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can enter the first, but I think It doesn't really matter.

layerCount = 0;
for (auto it = tecNegative.rbegin(); it != tecNegative.rend(); ++it) {
LogTrace("TSGForOIFromL2") << "TSGForOIFromL2::produce: looping in TEC- layer " << layerCount << std::endl;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
LogTrace("TSGForOIFromL2") << "TSGForOIFromL2::produce: looping in TEC- layer " << layerCount << std::endl;
LogTrace("TSGForOIFromL2") << "TSGForOIFromL2::produce: looping in TEC- layer " << layerCount;

if (useHitLessSeeds_ && hitlessSeedsMadeMuS < maxHitlessSeeds_ && numSeedsMade < maxSeeds_)
makeSeedsWithoutHits(**it,
outerTkStateOutside,
*(propagatorOpposite.get()),
estimatorH,
errorSFHitless * SFHld_,
hitlessSeedsMadeMuS,
numSeedsMade,
out);
if (hitSeedsMadeMuS < maxHitSeeds_ && numSeedsMade < maxSeeds_)
makeSeedsFromHits(**it,
outerTkStateOutside,
*(propagatorOpposite.get()),
estimatorH,
measurementTrackerH,
errorSFHits * SFHd_,
hitSeedsMadeMuS,
numSeedsMade,
layerCount,
out);
}
LogTrace("TSGForOIFromL2") << "TSGForOIFromL2:::produce: NumSeedsMade = " << numSeedsMade
<< " , layerCount = " << layerCount << std::endl;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<< " , layerCount = " << layerCount << std::endl;
<< " , layerCount = " << layerCount;

}
}

for (std::vector<TrajectorySeed>::iterator it = out.begin(); it != out.end(); ++it) {
result->push_back(*it);
}
Expand Down Expand Up @@ -425,7 +517,7 @@ void TSGForOIFromL2::makeSeedsFromHits(const GeometricSearchDet& layer,
hitSeedsMade++;
if (found == numOfHitsToTry_)
break;
if (hitSeedsMade > maxHitSeeds_)
if (hitSeedsMade > maxHitSeeds_) //
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (hitSeedsMade > maxHitSeeds_) //
if (hitSeedsMade > maxHitSeeds_)

return;
}

Expand Down Expand Up @@ -541,8 +633,11 @@ void TSGForOIFromL2::fillDescriptions(edm::ConfigurationDescriptions& descriptio
desc.add<double>("SF4", 7.0);
desc.add<double>("SF5", 10.0);
desc.add<double>("SF6", 2.0);
desc.add<double>("SFHld", 2.0);
desc.add<double>("SFHd", 4.0);
desc.add<double>("tsosDiff1", 0.2);
desc.add<double>("tsosDiff2", 0.02);
desc.add<bool>("displacedReco", false);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add setComments with the meaning of these new variables (I know the other variables do not have such comments, but one has to start somewhere). Example

desc.add<double>("SFHld", 2.0)->setComment("To Be Filled");

desc.add<std::string>("propagatorName", "PropagatorWithMaterialParabolicMf");
descriptions.add("TSGForOIFromL2", desc);
}
Expand Down
4 changes: 4 additions & 0 deletions RecoMuon/TrackerSeedGenerator/plugins/TSGForOIFromL2.h
Expand Up @@ -91,11 +91,15 @@ class TSGForOIFromL2 : public edm::global::EDProducer<> {
const double pT1_, pT2_, pT3_;
const double eta1_, eta2_, eta3_, eta4_, eta5_, eta6_, eta7_;
const double SF1_, SF2_, SF3_, SF4_, SF5_, SF6_;
const double SFHld_, SFHd_;

/// Distance of L2 TSOSs before and after updated with vertex
const double tsosDiff1_;
const double tsosDiff2_;

/// Displaced reconstruction
const bool displacedReco_;

/// Counters and flags for the implementation
const std::string propagatorName_;
const std::string theCategory_;
Expand Down