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_";
87 histname =
"SumCharge_";
95 histname =
"TrackCurvature_";
113 histname =
"MinJetDeltaR_";
126 histname =
"MinTrackDeltaR_";
135 histname =
"AlCaRecoTrackEfficiency_";
149 histname =
"Hits_ZvsR_";
156 histname =
"Hits_XvsY_";
160 histname =
"Hits_perDetId_";
191 edm::LogError(
"Alignment") <<
"invalid trackcollection encountered!";
198 edm::LogError(
"Alignment") <<
"invalid reference track-collection encountered!";
204 edm::LogError(
"Alignment") <<
"invalid geometry found in event setup!";
209 edm::LogError(
"Alignment") <<
"invalid magnetic field configuration encountered!";
216 if (!
jets.isValid()) {
217 edm::LogError(
"Alignment") <<
"no jet collection found in event!";
226 double sumOfCharges = 0;
230 double minJetDeltaR2 = 10 * 10;
231 for (
const auto &itJet : *
jets) {
234 if (itJet.pt() >
maxJetPt_ && dR2 < minJetDeltaR2)
243 double minTrackDeltaR2 = 10 * 10;
246 if (dR2 < minTrackDeltaR2 && dR2 > 1
e-12)
247 minTrackDeltaR2 = dR2;
258 double curv = -
track.charge() * 0.002998 *
B /
track.pt();
265 sumOfCharges +=
track.charge();
271 if ((*trackCollection).size() == 2) {
272 TLorentzVector track0(
273 (*trackCollection).at(0).px(),
274 (*trackCollection).at(0).py(),
275 (*trackCollection).at(0).pz(),
277 TLorentzVector track1(
278 (*trackCollection).at(1).px(),
279 (*trackCollection).at(1).py(),
280 (*trackCollection).at(1).pz(),
282 TLorentzVector mother = track0 + track1;
286 edm::LogInfo(
"Alignment") <<
"wrong number of tracks trackcollection encountered: " << (*trackCollection).size();
295 for (
auto const &iHit :
track.recHits()) {
296 if (iHit->isValid()) {
297 const DetId geoId(iHit->geographicalId());
304 double r =
sqrt(globP.x() * globP.x() + globP.y() * globP.y());
306 r *= globP.y() / fabs(globP.y());
321 std::vector<int> sortedRawIds;
322 for (
const auto &iDetId :
geometry.detUnitIds()) {
323 sortedRawIds.push_back(iDetId.rawId());
325 std::sort(sortedRawIds.begin(), sortedRawIds.end());
328 for (
const auto &iRawId : sortedRawIds) {
339 desc.setComment(
"Generic track analyzer to check ALCARECO Tracker Alignment specific sample quantities");
346 desc.add<
double>(
"maxJetPt", 10.)->setComment(
"GeV");
347 desc.add<
bool>(
"fillInvariantMass",
false);
348 desc.add<
bool>(
"runsOnReco",
false);
349 desc.add<
bool>(
"useSignedR",
false);
350 desc.add<
bool>(
"fillRawIdMap",
false);
351 desc.add<
unsigned int>(
"MassBin", 100);
352 desc.add<
double>(
"MassMin", 0.0);
353 desc.add<
double>(
"MassMax", 100.0);
354 desc.add<
unsigned int>(
"TrackPtBin", 110);
355 desc.add<
double>(
"TrackPtMin", 0.0);
356 desc.add<
double>(
"TrackPtMax", 110.);
357 desc.add<
unsigned int>(
"TrackCurvatureBin", 2000);
358 desc.add<
double>(
"TrackCurvatureMin", -0.01)->setComment(
"1/GeV");
359 desc.add<
double>(
"TrackCurvatureMax", 0.01)->setComment(
"1/GeV");
360 desc.add<
unsigned int>(
"SumChargeBin", 11);
361 desc.add<
double>(
"SumChargeMin", -5.5);
362 desc.add<
double>(
"SumChargeMax", 5.5);
363 desc.add<
unsigned int>(
"JetPtBin", 100);
364 desc.add<
double>(
"JetPtMin", 0.0);
365 desc.add<
double>(
"JetPtMax", 50.0);
366 desc.add<
unsigned int>(
"MinJetDeltaRBin", 100);
367 desc.add<
double>(
"MinJetDeltaRMin", 0);
368 desc.add<
double>(
"MinJetDeltaRMax", 10);
369 desc.add<
unsigned int>(
"MinTrackDeltaRBin", 100);
370 desc.add<
double>(
"MinTrackDeltaRMin", 0);
371 desc.add<
double>(
"MinTrackDeltaRMax", 3.2);
372 desc.add<
unsigned int>(
"TrackEfficiencyBin", 102);
373 desc.add<
double>(
"TrackEfficiencyMin", -0.01);
374 desc.add<
double>(
"TrackEfficiencyMax", 1.01);
375 desc.add<
unsigned int>(
"HitMapsZBin", 300);
376 desc.add<
double>(
"HitMapZMax", 300.)->setComment(
"cm");
377 desc.add<
unsigned int>(
"HitMapsRBin", 120);
378 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_
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)