Skip to content

Commit

Permalink
Fixed clang warnings + minor simplifications (cms-sw#15)
Browse files Browse the repository at this point in the history
* tweak

* tweak

* Fixed clang warnings and small simplifications

* Fixed clang warnings and small simplifications
  • Loading branch information
tomalin authored May 15, 2020
1 parent de9b0a8 commit 167d60a
Show file tree
Hide file tree
Showing 13 changed files with 122 additions and 231 deletions.
4 changes: 3 additions & 1 deletion L1Trigger/TrackFindingTMTT/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ editing if necessary variables: GEOMETRY (CMS geometry version), inputMCtxt (MC
- Look at the performance histograms Hist.root (explained in class "Histos" below)

2) cmsRun -n 4 L1TrackNtupleMaker_cfg.py
after editing it to change L1TRACKALGO = 'TMTT'. This writes a TTree with the fitfitted L1 tracks to file in a TTTrack collection, from which tracking performance can be studied with ROOT macro. L1TrackNtuplePlot.C.
after editing it to change L1TRACKALGO = 'TMTT'. This writes a TTree of the fitted L1 tracks to .root file, from which tracking performance can be studied with ROOT macro L1Trigger/TrackFindingTracklet/test/L1TrackNtuplePlot.C. Other values of L1TRACKALGO permit to run the Hybrid or Tracklet emulation, or floating point emulation.

Both (1) & (2) are able to write a dataset containing the TTTrack collection of the fitted tracks.

N.B. .txt files listing available MC samples can be found in https://github.com/cms-data/L1Trigger-TrackFindingTMTT .

Expand Down
15 changes: 11 additions & 4 deletions L1Trigger/TrackFindingTMTT/interface/GlobalCacheTMTT.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,33 +18,40 @@

namespace tmtt {

namespace {
std::mutex myMutex;
}

class GlobalCacheTMTT {
public:
GlobalCacheTMTT(const edm::ParameterSet& iConfig)
: settings_(iConfig), // Python configuration params
htRphiErrMon_({0., 0, 0, 0}), // rphi HT error monitoring
htRphiErrMon_(), // rphi HT error monitoring
stubWindowSuggest_(&settings_), // Recommend FE stub window sizes.
hists_(&settings_) // Histograms
{
hists_.book();
}

// Get functions
Settings& settings() const { return settings_; }
const Settings& settings() const { return settings_; }
HTrphi::ErrorMonitor& htRphiErrMon() const { return htRphiErrMon_; }
StubWindowSuggest& stubWindowSuggest() const { return stubWindowSuggest_; }
const std::list<TrackerModule>& listTrackerModule() const { return listTrackerModule_; }
Histos& hists() const { return hists_; }

// Set functions
void setListTrackerModule(const std::list<TrackerModule>& list) const {
// Only need one copy of tracker geoemtry for histogramming.
// Allow only one thread to run this function at a time
std::lock_guard<std::mutex> myGuard(myMutex);

// Only need one copy of tracker geometry for histogramming.
if (listTrackerModule_.size() == 0)
listTrackerModule_ = list;
}

private:
mutable Settings settings_;
Settings settings_;
mutable HTrphi::ErrorMonitor htRphiErrMon_;
mutable StubWindowSuggest stubWindowSuggest_;
mutable std::list<TrackerModule> listTrackerModule_;
Expand Down
38 changes: 5 additions & 33 deletions L1Trigger/TrackFindingTMTT/interface/Settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,6 @@ namespace tmtt {
double minPtToReduceLayers() const { return minPtToReduceLayers_; }
// Change min. number of layers cut to (MinStubLayers - 1) for tracks in these rapidity sectors.
const std::vector<unsigned int>& etaSecsReduceLayers() const { return etaSecsReduceLayers_; }
// Define layers using layer ID (true) or by bins in radius of 5 cm width (false)?
bool useLayerID() const { return useLayerID_; }
//Reduce this layer ID, so that it takes no more than 8 different values in any eta region (simplifies firmware)?
bool reduceLayerID() const { return reduceLayerID_; }

Expand Down Expand Up @@ -391,16 +389,10 @@ namespace tmtt {
double trackerOuterRadius() const { return 112.7; } // max. occuring stub radius.
double trackerInnerRadius() const { return 21.8; } // min. occuring stub radius.
double trackerHalfLength() const { return 270.; } // half-length of tracker.
double layerIDfromRadiusBin() const {
return 6.;
} // When counting stubs in layers, actually histogram stubs in distance from beam-line with this bin size.
double crazyStubCut() const {
return 0.01;
} // Stubs differing from TP trajectory by more than this in phi are assumed to come from delta rays etc.

//=== Set and get B-field value in Tesla.
// N.B. This must bet std::set for each event, and can't be initialized at the beginning of the job.
void setMagneticField(float magneticField) { magneticField_ = magneticField; }

//=== Set and get B-field value (mutable) in Tesla.
// N.B. This must bet std::set for each run, and can't be initialized at the beginning of the job.
void setMagneticField(float magneticField) const { magneticField_ = magneticField; }
float magneticField() const {
if (magneticField_ == 0.)
throw cms::Exception("LogicError") << "Settings: You attempted to access the B field before it was initialized";
Expand All @@ -410,15 +402,6 @@ namespace tmtt {
//=== Settings used for HYBRID TRACKING code only.
// Is hybrid tracking in use?
bool hybrid() const { return hybrid_; }
// Info about geometry, needed for use of hybrid outside CMSSW.
double ssStripPitch() const { return ssStripPitch_; }
double ssNStrips() const { return ssNStrips_; }
double ssStripLength() const { return ssStripLength_; }
double psPixelPitch() const { return psPixelPitch_; }
double psNStrips() const { return psNStrips_; }
double psPixelLength() const { return psPixelLength_; }
// max z at which non-tilted modules are found in 3 barrel PS layers. (Element 0 not used).
const std::vector<float>& zMaxNonTilted() const { return zMaxNonTilted_; }

private:
// Input tags for ES & ED data.
Expand Down Expand Up @@ -560,7 +543,6 @@ namespace tmtt {
unsigned int minStubLayers_;
double minPtToReduceLayers_;
std::vector<unsigned int> etaSecsReduceLayers_;
bool useLayerID_;
bool reduceLayerID_;

// Specification of algorithm to eliminate duplicate tracks
Expand Down Expand Up @@ -599,7 +581,6 @@ namespace tmtt {
double residualCut_;
//
unsigned kalmanDebugLevel_;
bool kalmanFillInternalHists_;
unsigned int kalmanMinNumStubs_;
unsigned int kalmanMaxNumStubs_;
bool kalmanAddBeamConstr_;
Expand Down Expand Up @@ -661,19 +642,10 @@ namespace tmtt {
bool writeOutEdmFile_;

// B-field in Tesla
std::atomic<float> magneticField_;
mutable std::atomic<float> magneticField_;

// Hybrid tracking
bool hybrid_;

double psPixelPitch_;
double psNStrips_;
double psPixelLength_;
double ssStripPitch_;
double ssNStrips_;
double ssStripLength_;

std::vector<float> zMaxNonTilted_;
};

} // namespace tmtt
Expand Down
42 changes: 21 additions & 21 deletions L1Trigger/TrackFindingTMTT/interface/Stub.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,23 @@ namespace tmtt {
class Stub {
public:
// Hybrid L1 tracking: stub constructor.
Stub(double phi,
double r,
double z,
double bend,
unsigned int layerId,
bool psModule,
bool barrel,
unsigned int iphi,
double alpha,
const Settings* settings,
unsigned int ID,
unsigned int iPhiSec);

Stub(const Settings* settings,
unsigned int idStub,
double phi,
double r,
double z,
double bend,
unsigned int iphi,
double alpha,
unsigned int layerId,
unsigned int iPhiSec,
bool psModule,
bool barrel,
bool tiltedBarrel,
float stripPitch,
float stripLength,
unsigned int nStrips);

// TMTT L1 tracking: stub constructor.
Stub(const TTStubRef& ttStubRef,
unsigned int index_in_vStubs,
Expand Down Expand Up @@ -182,15 +186,9 @@ namespace tmtt {
float sigmaR() const { return (barrel() ? 0. : sigmaPar()); }
float sigmaZ() const { return (barrel() ? sigmaPar() : 0.); }
// Hit resolution perpendicular to strip. Measures phi.
float sigmaPerp() const {
static const float f = sqrt(1. / 12);
return f * stripPitch_;
}
float sigmaPerp() const {return invRoot12 * stripPitch_;}
// Hit resolution parallel to strip. Measures r or z.
float sigmaPar() const {
static const float f = sqrt(1. / 12.);
return f * stripLength_;
}
float sigmaPar() const {return invRoot12 * stripLength_;}

//--- These module variables could be taken directly from trackerModule_, were it not for need
//--- to support Hybrid.
Expand Down Expand Up @@ -291,6 +289,8 @@ namespace tmtt {
unsigned int nStrips_;

const float rejectedStubBend_ = 99999.; // Bend set to this if stub rejected.

const float invRoot12 = sqrt(1./12.);
};

} // namespace tmtt
Expand Down
12 changes: 4 additions & 8 deletions L1Trigger/TrackFindingTMTT/interface/TrackerModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,9 @@ namespace tmtt {
// Strip length (or pixel pitch along longest axis).
float stripLength() const { return stripLength_; }
// Hit resolution perpendicular to strip (or to longest pixel axis). Measures phi.
float sigmaPerp() const {
static const float f = sqrt(1. / 12.);
return f * stripPitch_;
}
float sigmaPerp() const {return invRoot12 * stripPitch_;}
// Hit resolution parallel to strip (or to longest pixel axis). Measures r or z.
float sigmaPar() const {
static const float f = sqrt(1. / 12.);
return f * stripLength_;
}
float sigmaPar() const {return invRoot12 * stripLength_;}
// Sensor pitch over separation.
float pitchOverSep() const { return stripPitch_ / sensorSpacing_; }
// "B" parameter correction for module tilt.
Expand Down Expand Up @@ -134,6 +128,8 @@ namespace tmtt {
unsigned int moduleTypeID_;

ModuleTypeCfg moduleTypeCfg_;

float invRoot12 = sqrt(1./12.);
};

} // namespace tmtt
Expand Down
1 change: 0 additions & 1 deletion L1Trigger/TrackFindingTMTT/plugins/TMTrackProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ namespace tmtt {
// Pointers to TTTrack collections for ED output.
auto htTTTracksForOutput = std::make_unique<TTTrackCollection>();
auto rzTTTracksForOutput = std::make_unique<TTTrackCollection>();
const unsigned int nFitAlgs = trackFitters_.size();
map<string, unique_ptr<TTTrackCollection>> allFitTTTracksForOutput;
for (const string& fitterName : trackFitters_) {
auto fitTTTracksForOutput = std::make_unique<TTTrackCollection>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,6 @@
# (Histogram "AlgEffVsEtaSec" will help you identify which sectors to declare).
#EtaSecsReduceLayers = cms.vuint32(),
EtaSecsReduceLayers = cms.vuint32(5,12),
# Define layers using layer ID (true) or by bins in radius of 5 cm width (false).
UseLayerID = cms.bool(True),
# Reduce this layer ID, so that it takes no more than 8 different values in any eta region (simplifies firmware).
ReducedLayerID = cms.bool(True)
),
Expand Down
1 change: 0 additions & 1 deletion L1Trigger/TrackFindingTMTT/src/ConverterToTTTrack.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ namespace tmtt {
hitPattern = 0;
d0 = 0.;
z0 = 0;
;
tanL = 0;
chi2rphi = 0.;
chi2rz = 0;
Expand Down
1 change: 0 additions & 1 deletion L1Trigger/TrackFindingTMTT/src/MiniHTstage.cc
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,6 @@ namespace tmtt {
numStubsPerLinkStage2[encodedLinkYZ] += numStubs;

} else {
newerLink = newLink;
newererLink = newLink;
}
unsigned int trueLinkID =
Expand Down
Loading

0 comments on commit 167d60a

Please sign in to comment.