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

add number of TTCluster to DTC analzyer end job summary #109

Merged
merged 2 commits into from
Nov 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions L1Trigger/TrackerDTC/python/Analyzer_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

TrackerDTCAnalyzer_params = cms.PSet (

InputTagAccepted = cms.InputTag( "TrackerDTCProducer", "StubAccepted" ), # dtc passed stubs selection
InputTagLost = cms.InputTag( "TrackerDTCProducer", "StubLost" ), # dtc lost stubs selection
InputTagTTStubDetSetVec = cms.InputTag( "TTStubsFromPhase2TrackerDigis", "StubAccepted" ), # original TTStub selection
InputTagTTClusterAssMap = cms.InputTag( "TTClusterAssociatorFromPixelDigis", "ClusterAccepted" ), # tag of AssociationMap between TTCluster and TrackingParticles
UseMCTruth = cms.bool( True ) # eneables analyze of TPs
InputTagAccepted = cms.InputTag( "TrackerDTCProducer", "StubAccepted" ), # dtc passed stubs selection
InputTagLost = cms.InputTag( "TrackerDTCProducer", "StubLost" ), # dtc lost stubs selection
InputTagTTStubDetSetVec = cms.InputTag( "TTStubsFromPhase2TrackerDigis", "StubAccepted" ), # original TTStub selection
InputTagTTClusterDetSetVec = cms.InputTag( "TTClustersFromPhase2TrackerDigis", "ClusterInclusive" ), # original TTCluster selection
InputTagTTClusterAssMap = cms.InputTag( "TTClusterAssociatorFromPixelDigis", "ClusterAccepted" ), # tag of AssociationMap between TTCluster and TrackingParticles
UseMCTruth = cms.bool( True ) # eneables analyze of TPs # eneables analyze of TPs

)
21 changes: 18 additions & 3 deletions L1Trigger/TrackerDTC/test/Analyzer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ namespace trackerDTC {
EDGetTokenT<TTDTC> getTokenTTDTCLost_;
// ED input token of TT stubs
EDGetTokenT<TTStubDetSetVec> getTokenTTStubDetSetVec_;
// ED input token of TTClsuter
EDGetTokenT<TTClusterDetSetVec> getTokenTTClusterDetSetVec_;
// ED input token of TTCluster to TPPtr association
EDGetTokenT<TTClusterAssMap> getTokenTTClusterAssMap_;
// Setup token
Expand Down Expand Up @@ -158,8 +160,10 @@ namespace trackerDTC {
getTokenTTDTCLost_ = consumes<TTDTC>(inputTagLost);
if (useMCTruth_) {
const auto& inputTagTTStubDetSetVec = iConfig.getParameter<InputTag>("InputTagTTStubDetSetVec");
const auto& inputTagTTClusterDetSetVec = iConfig.getParameter<InputTag>("InputTagTTClusterDetSetVec");
const auto& inputTagTTClusterAssMap = iConfig.getParameter<InputTag>("InputTagTTClusterAssMap");
getTokenTTStubDetSetVec_ = consumes<TTStubDetSetVec>(inputTagTTStubDetSetVec);
getTokenTTClusterDetSetVec_ = consumes<TTClusterDetSetVec>(inputTagTTClusterDetSetVec);
getTokenTTClusterAssMap_ = consumes<TTClusterAssMap>(inputTagTTClusterAssMap);
}
// book ES product
Expand Down Expand Up @@ -193,6 +197,12 @@ namespace trackerDTC {
assoc(handleTTStubDetSetVec, handleTTClusterAssMap, mapAllTPsAllStubs);
// organize reconstrucable TrackingParticles used for efficiency measurements
convert(mapAllTPsAllStubs, mapAllStubsTPs);
Handle<TTClusterDetSetVec> handleTTClusterDetSetVec;
iEvent.getByToken<TTClusterDetSetVec>(getTokenTTClusterDetSetVec_, handleTTClusterDetSetVec);
int nCluster(0);
for (const auto& detSet : *handleTTClusterDetSetVec)
nCluster += detSet.size();
profMC_->Fill(6, nCluster / (double)setup_->numRegions());
}
// read in dtc products
Handle<TTDTC> handleTTDTCAccepted;
Expand Down Expand Up @@ -403,12 +413,16 @@ namespace trackerDTC {
const double errStubsMatched = profMC_->GetBinError(2);
const double errTPsReco = profMC_->GetBinError(3);
const double errTPsEff = profMC_->GetBinError(4);
const vector<double> nums = {numStubs, numStubsMatched, numTPsReco, numTPsEff};
const vector<double> errs = {errStubs, errStubsMatched, errTPsReco, errTPsEff};
const double numCluster = profMC_->GetBinContent(6);
const double errCluster = profMC_->GetBinError(6);
const vector<double> nums = {numStubs, numStubsMatched, numTPsReco, numTPsEff, numCluster};
const vector<double> errs = {errStubs, errStubsMatched, errTPsReco, errTPsEff, errCluster};
const int wNums = ceil(log10(*max_element(nums.begin(), nums.end()))) + 5;
const int wErrs = ceil(log10(*max_element(errs.begin(), errs.end()))) + 5;
log_ << "=============================================================" << endl;
log_ << " MC SUMMARY " << endl;
log_ << "number of cluster per TFP = " << setw(wNums) << numCluster << " +- " << setw(wErrs) << errCluster
<< endl;
log_ << "number of stubs per TFP = " << setw(wNums) << numStubs << " +- " << setw(wErrs) << errStubs
<< endl;
log_ << "number of matched stubs per TFP = " << setw(wNums) << numStubsMatched << " +- " << setw(wErrs)
Expand Down Expand Up @@ -465,12 +479,13 @@ namespace trackerDTC {
TFileDirectory dir;
// mc
dir = fs->mkdir("MC");
profMC_ = dir.make<TProfile>("Counts", ";", 5, 0.5, 5.5);
profMC_ = dir.make<TProfile>("Counts", ";", 6, 0.5, 6.5);
profMC_->GetXaxis()->SetBinLabel(1, "Stubs");
profMC_->GetXaxis()->SetBinLabel(2, "Matched Stubs");
profMC_->GetXaxis()->SetBinLabel(3, "reco TPs");
profMC_->GetXaxis()->SetBinLabel(4, "eff TPs");
profMC_->GetXaxis()->SetBinLabel(5, "total eff TPs");
profMC_->GetXaxis()->SetBinLabel(6, "Cluster");
constexpr array<int, NumEfficiency> binsEff{{9 * 8, 10, 16, 10, 30, 24}};
constexpr array<pair<double, double>, NumEfficiency> rangesEff{
{{-M_PI, M_PI}, {0., 100.}, {-1. / 3., 1. / 3.}, {-5., 5.}, {-15., 15.}, {-2.4, 2.4}}};
Expand Down
2 changes: 1 addition & 1 deletion L1Trigger/TrackerTFP/test/AnalyzerDemonstrator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ namespace trackerTFP {
const int offsetStubs = (region * numChannelTracks + channelTracks) * numChannelStubs;
if (tracks)
convert(handleTracks->at(offsetTracks + channelTracks), bits);
if (stubs){
if (stubs) {
for (int channelStubs = 0; channelStubs < numChannelStubs; channelStubs++)
convert(handleStubs->at(offsetStubs + channelStubs), bits);
}
Expand Down