17 #include "TLorentzVector.h" 23 referenceTrackProducer_(
26 daughterMass_(iConfig.getParameter<double>(
"daughterMass")),
27 maxJetPt_(iConfig.getParameter<double>(
"maxJetPt")),
28 fillInvariantMass_(iConfig.getParameter<
bool>(
"fillInvariantMass")),
29 fillRawIdMap_(iConfig.getParameter<
bool>(
"fillRawIdMap")),
30 runsOnReco_(iConfig.getParameter<
bool>(
"runsOnReco")),
31 useSignedR_(iConfig.getParameter<
bool>(
"useSignedR")) {
49 histname =
"InvariantMass_";
60 histname =
"TrackPtPositive_";
62 histname +
AlgoName, histname +
AlgoName, TrackPtPositiveBin, TrackPtPositiveMin, TrackPtPositiveMax);
69 histname =
"TrackPtNegative_";
71 histname +
AlgoName, histname +
AlgoName, TrackPtNegativeBin, TrackPtNegativeMin, TrackPtNegativeMax);
74 histname =
"TrackQuality_";
90 histname =
"SumCharge_";
98 histname =
"TrackCurvature_";
116 histname =
"MinJetDeltaR_";
129 histname =
"MinTrackDeltaR_";
138 histname =
"AlCaRecoTrackEfficiency_";
152 histname =
"Hits_ZvsR_";
159 histname =
"Hits_XvsY_";
163 histname =
"Hits_perDetId_";
194 edm::LogError(
"Alignment") <<
"invalid trackcollection encountered!";
201 edm::LogError(
"Alignment") <<
"invalid reference track-collection encountered!";
207 edm::LogError(
"Alignment") <<
"invalid geometry found in event setup!";
212 edm::LogError(
"Alignment") <<
"invalid magnetic field configuration encountered!";
219 if (!
jets.isValid()) {
220 edm::LogError(
"Alignment") <<
"no jet collection found in event!";
229 double sumOfCharges = 0;
233 double minJetDeltaR2 = 10 * 10;
234 for (
const auto &itJet : *
jets) {
246 double minTrackDeltaR2 = 10 * 10;
249 if (dR2 < minTrackDeltaR2 && dR2 > 1
e-12)
250 minTrackDeltaR2 =
dR2;
261 double curv = -
track.charge() * 0.002998 *
B /
track.pt();
268 sumOfCharges +=
track.charge();
274 if ((*trackCollection).size() == 2) {
275 TLorentzVector track0(
276 (*trackCollection).at(0).px(),
277 (*trackCollection).at(0).py(),
278 (*trackCollection).at(0).pz(),
280 TLorentzVector track1(
281 (*trackCollection).at(1).px(),
282 (*trackCollection).at(1).py(),
283 (*trackCollection).at(1).pz(),
285 TLorentzVector mother = track0 + track1;
289 edm::LogInfo(
"Alignment") <<
"wrong number of tracks trackcollection encountered: " << (*trackCollection).size();
298 for (
auto const &iHit :
track.recHits()) {
299 if (iHit->isValid()) {
300 const DetId geoId(iHit->geographicalId());
307 double r =
sqrt(globP.x() * globP.x() + globP.y() * globP.y());
309 r *= globP.y() / fabs(globP.y());
324 std::vector<int> sortedRawIds;
325 for (
const auto &iDetId :
geometry.detUnitIds()) {
326 sortedRawIds.push_back(iDetId.rawId());
328 std::sort(sortedRawIds.begin(), sortedRawIds.end());
331 for (
const auto &iRawId : sortedRawIds) {
342 desc.setComment(
"Generic track analyzer to check ALCARECO Tracker Alignment specific sample quantities");
349 desc.add<
double>(
"maxJetPt", 10.)->setComment(
"GeV");
350 desc.add<
bool>(
"fillInvariantMass",
false);
351 desc.add<
bool>(
"runsOnReco",
false);
352 desc.add<
bool>(
"useSignedR",
false);
353 desc.add<
bool>(
"fillRawIdMap",
false);
354 desc.add<
unsigned int>(
"MassBin", 100);
355 desc.add<
double>(
"MassMin", 0.0);
356 desc.add<
double>(
"MassMax", 100.0);
357 desc.add<
unsigned int>(
"TrackPtBin", 110);
358 desc.add<
double>(
"TrackPtMin", 0.0);
359 desc.add<
double>(
"TrackPtMax", 110.);
360 desc.add<
unsigned int>(
"TrackCurvatureBin", 2000);
361 desc.add<
double>(
"TrackCurvatureMin", -0.01)->setComment(
"1/GeV");
362 desc.add<
double>(
"TrackCurvatureMax", 0.01)->setComment(
"1/GeV");
363 desc.add<
unsigned int>(
"SumChargeBin", 11);
364 desc.add<
double>(
"SumChargeMin", -5.5);
365 desc.add<
double>(
"SumChargeMax", 5.5);
366 desc.add<
unsigned int>(
"JetPtBin", 100);
367 desc.add<
double>(
"JetPtMin", 0.0);
368 desc.add<
double>(
"JetPtMax", 50.0);
369 desc.add<
unsigned int>(
"MinJetDeltaRBin", 100);
370 desc.add<
double>(
"MinJetDeltaRMin", 0);
371 desc.add<
double>(
"MinJetDeltaRMax", 10);
372 desc.add<
unsigned int>(
"MinTrackDeltaRBin", 100);
373 desc.add<
double>(
"MinTrackDeltaRMin", 0);
374 desc.add<
double>(
"MinTrackDeltaRMax", 3.2);
375 desc.add<
unsigned int>(
"TrackEfficiencyBin", 102);
376 desc.add<
double>(
"TrackEfficiencyMin", -0.01);
377 desc.add<
double>(
"TrackEfficiencyMax", 1.01);
378 desc.add<
unsigned int>(
"HitMapsZBin", 300);
379 desc.add<
double>(
"HitMapZMax", 300.)->setComment(
"cm");
380 desc.add<
unsigned int>(
"HitMapsRBin", 120);
381 desc.add<
double>(
"HitMapRMax", 120.)->setComment(
"cm");
std::map< int, int > binByRawId_
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
T getParameter(std::string const &) const
static std::string qualityName(TrackQuality)
void analyze(const edm::Event &, const edm::EventSetup &) override
virtual void setCurrentFolder(std::string const &fullpath)
const bool fillInvariantMass_
void fillRawIdMap(const TrackerGeometry &geometry)
TrackQuality
track quality
MonitorElement * TrackQuality_
std::vector< Track > TrackCollection
collection of Tracks
MonitorElement * minJetDeltaR_
Log< level::Error, false > LogError
const edm::EDGetTokenT< reco::TrackCollection > trackProducer_
const edm::EDGetTokenT< reco::CaloJetCollection > jetCollection_
MonitorElement * Hits_XvsY_
MonitorElement * Hits_ZvsR_
MonitorElement * AlCaRecoTrackEfficiency_
const double daughterMass_
MonitorElement * sumCharge_
ALPAKA_FN_ACC static ALPAKA_FN_INLINE float dR2(Position4 pos1, Position4 pos2)
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > mfToken_
MonitorElement * invariantMass_
MonitorElement * TrackPtNegative_
void fillHitmaps(const reco::Track &track, const TrackerGeometry &geometry)
#define DEFINE_FWK_MODULE(type)
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
const edm::EDGetTokenT< reco::TrackCollection > referenceTrackProducer_
static void fillDescriptions(edm::ConfigurationDescriptions &)
Log< level::Info, false > LogInfo
MonitorElement * Hits_perDetId_
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
static constexpr const double kMuonMass_
MonitorElement * TrackCurvature_
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
MonitorElement * minTrackDeltaR_
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
MonitorElement * TrackPtPositive_
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tkGeomToken_
std::vector< CaloJet > CaloJetCollection
collection of CaloJet objects
TkAlCaRecoMonitor(const edm::ParameterSet &)
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)