183 for (
const auto &iterTP : *trackingParticleHandle) {
188 float tmp_tp_pt = iterTP.pt();
189 float tmp_tp_phi = iterTP.phi();
190 float tmp_tp_eta = iterTP.eta();
194 theStubRefs = MCTruthTTStubHandle->findTTStubRefs(tp_ptr);
196 int hasStubInLayer[11] = {0};
197 for (
unsigned int is = 0; is < theStubRefs.size(); is++) {
198 DetId detid(theStubRefs.at(is)->getDetId());
201 layer = static_cast<int>(tTopo->
layer(detid)) - 1;
203 layer = static_cast<int>(tTopo->
layer(detid)) + 5;
206 if (MCTruthTTStubHandle->findTrackingParticlePtr(theStubRefs.at(is)).isNull() && hasStubInLayer[
layer] < 2)
207 hasStubInLayer[
layer] = 1;
209 hasStubInLayer[
layer] = 2;
212 int nStubLayerTP = 0;
214 if (hasStubInLayer[
isum] >= 1)
230 if (MCTruthTTStubHandle.
isValid()) {
232 theStubRefs = MCTruthTTStubHandle->findTTStubRefs(tp_ptr);
233 nStubTP = (
int)theStubRefs.size();
235 if (MCTruthTTClusterHandle.
isValid() && MCTruthTTClusterHandle->findTTClusterRefs(tp_ptr).empty())
238 float tmp_tp_vz = iterTP.vz();
239 float tmp_tp_vx = iterTP.vx();
240 float tmp_tp_vy = iterTP.vy();
241 float tmp_tp_charge = tp_ptr->
charge();
242 int tmp_tp_pdgid = iterTP.pdgId();
247 float tmp_tp_t =
tan(2.0 * atan(1.0) - 2.0 * atan(
exp(-tmp_tp_eta)));
248 float delx = -tmp_tp_vx;
249 float dely = -tmp_tp_vy;
250 float K = 0.01 * 0.5696 / tmp_tp_pt * tmp_tp_charge;
251 float A = 1. / (2. * K);
252 float tmp_tp_x0p = delx -
A *
sin(tmp_tp_phi);
253 float tmp_tp_y0p = dely +
A *
cos(tmp_tp_phi);
254 float tmp_tp_rp =
sqrt(tmp_tp_x0p * tmp_tp_x0p + tmp_tp_y0p * tmp_tp_y0p);
255 static double pi = 4.0 * atan(1.0);
256 float delphi = tmp_tp_phi - atan2(-K * tmp_tp_x0p, K * tmp_tp_y0p);
262 float tmp_tp_VtxZ = tmp_tp_vz + tmp_tp_t * delphi / (2.0 * K);
263 float tmp_tp_VtxR =
sqrt(tmp_tp_vx * tmp_tp_vx + tmp_tp_vy * tmp_tp_vy);
264 float tmp_tp_d0 = tmp_tp_charge * tmp_tp_rp - (1. / (2. * K));
268 float other_d0 = -tmp_tp_vx *
sin(tmp_tp_phi) + tmp_tp_vy *
cos(tmp_tp_phi);
269 tmp_tp_d0 = tmp_tp_d0 * (-1);
271 tmp_tp_d0 = other_d0;
272 tmp_tp_VtxZ = tmp_tp_vz;
278 if (tmp_tp_VtxR < 1.0) {
286 if (tmp_tp_VtxR > 1.0)
299 float i_chi2dof = 99999;
300 if (MCTruthTTTrackHandle.
isValid()) {
301 std::vector<edm::Ptr<TTTrack<Ref_Phase2TrackerDigi_>>> matchedTracks =
302 MCTruthTTTrackHandle->findTTTrackPtrs(tp_ptr);
310 for (
const auto &thisTrack : matchedTracks) {
311 if (!MCTruthTTTrackHandle->isGenuine(thisTrack))
317 int tmp_trk_nstub = thisTrack->getStubRefs().size();
320 float dmatch_pt = 999;
321 float dmatch_eta = 999;
322 float dmatch_phi = 999;
326 dmatch_pt = std::fabs(my_tp->
p4().pt() - tmp_tp_pt);
327 dmatch_eta = std::fabs(my_tp->
p4().eta() - tmp_tp_eta);
328 dmatch_phi = std::fabs(my_tp->
p4().phi() - tmp_tp_phi);
329 match_id = my_tp->
pdgId();
330 float tmp_trk_chi2dof = thisTrack->chi2Red();
333 if (dmatch_pt < 0.1 && dmatch_eta < 0.1 && dmatch_phi < 0.1 && tmp_tp_pdgid == match_id) {
335 if (i_track < 0 || tmp_trk_chi2dof < i_chi2dof) {
336 i_track = trkCounter;
337 i_chi2dof = tmp_trk_chi2dof;
346 float tmp_matchtrk_pt = -999;
347 float tmp_matchtrk_eta = -999;
348 float tmp_matchtrk_phi = -999;
349 float tmp_matchtrk_VtxZ = -999;
350 float tmp_matchtrk_chi2dof = -999;
351 int tmp_matchTrk_nStub = -999;
352 float tmp_matchtrk_d0 = -999;
354 tmp_matchtrk_pt = matchedTracks[i_track]->momentum().perp();
355 tmp_matchtrk_eta = matchedTracks[i_track]->momentum().eta();
356 tmp_matchtrk_phi = matchedTracks[i_track]->momentum().phi();
357 tmp_matchtrk_VtxZ = matchedTracks[i_track]->z0();
358 tmp_matchtrk_chi2dof = matchedTracks[i_track]->chi2Red();
359 tmp_matchTrk_nStub = (
int)matchedTracks[i_track]->getStubRefs().size();
362 float tmp_matchtrk_x0 = matchedTracks[i_track]->POCA().x();
363 float tmp_matchtrk_y0 = matchedTracks[i_track]->POCA().y();
364 tmp_matchtrk_d0 = -tmp_matchtrk_x0 *
sin(tmp_matchtrk_phi) + tmp_matchtrk_y0 *
cos(tmp_matchtrk_phi);
367 if (tmp_matchTrk_nStub < L1Tk_minNStub || tmp_matchtrk_chi2dof >
L1Tk_maxChi2dof)
372 if (tmp_tp_pt > 0 && tmp_tp_pt <= 10)
380 float pt_diff = tmp_matchtrk_pt - tmp_tp_pt;
381 float pt_res = pt_diff / tmp_tp_pt;
382 float eta_res = tmp_matchtrk_eta - tmp_tp_eta;
383 float phi_res = tmp_matchtrk_phi - tmp_tp_phi;
384 float VtxZ_res = tmp_matchtrk_VtxZ - tmp_tp_VtxZ;
385 float d0_res = tmp_matchtrk_d0 - tmp_tp_d0;
394 if (std::fabs(tmp_tp_eta) >= 0 && std::fabs(tmp_tp_eta) < 0.7) {
399 if (tmp_tp_pt >= 2 && tmp_tp_pt < 3)
401 else if (tmp_tp_pt >= 3 && tmp_tp_pt < 8)
403 else if (tmp_tp_pt >= 8)
405 }
else if (std::fabs(tmp_tp_eta) >= 0.7 && std::fabs(tmp_tp_eta) < 1.0) {
410 if (tmp_tp_pt >= 2 && tmp_tp_pt < 3)
412 else if (tmp_tp_pt >= 3 && tmp_tp_pt < 8)
414 else if (tmp_tp_pt >= 8)
416 }
else if (std::fabs(tmp_tp_eta) >= 1.0 && std::fabs(tmp_tp_eta) < 1.2) {
421 if (tmp_tp_pt >= 2 && tmp_tp_pt < 3)
423 else if (tmp_tp_pt >= 3 && tmp_tp_pt < 8)
425 else if (tmp_tp_pt >= 8)
427 }
else if (std::fabs(tmp_tp_eta) >= 1.2 && std::fabs(tmp_tp_eta) < 1.6) {
432 if (tmp_tp_pt >= 2 && tmp_tp_pt < 3)
434 else if (tmp_tp_pt >= 3 && tmp_tp_pt < 8)
436 else if (tmp_tp_pt >= 8)
438 }
else if (std::fabs(tmp_tp_eta) >= 1.6 && std::fabs(tmp_tp_eta) < 2.0) {
443 if (tmp_tp_pt >= 2 && tmp_tp_pt < 3)
445 else if (tmp_tp_pt >= 3 && tmp_tp_pt < 8)
447 else if (tmp_tp_pt >= 8)
449 }
else if (std::fabs(tmp_tp_eta) >= 2.0 && std::fabs(tmp_tp_eta) <= 2.4) {
454 if (tmp_tp_pt >= 2 && tmp_tp_pt < 3)
456 else if (tmp_tp_pt >= 3 && tmp_tp_pt < 8)
458 else if (tmp_tp_pt >= 8)
886 HistoName =
"respt_eta1p2to1p6_pt8toInf";
1110 psd0.
add<
int>(
"Nbinsx", 45);
1111 psd0.
add<
double>(
"xmax", 3);
1112 psd0.
add<
double>(
"xmin", -3);
1117 psd0.
add<
int>(
"Nbinsx", 60);
1118 psd0.
add<
double>(
"xmax", 3.141592653589793);
1119 psd0.
add<
double>(
"xmin", -3.141592653589793);
1124 psd0.
add<
int>(
"Nbinsx", 45);
1125 psd0.
add<
double>(
"xmax", 100);
1126 psd0.
add<
double>(
"xmin", 0);
1131 psd0.
add<
int>(
"Nbinsx", 200);
1132 psd0.
add<
double>(
"xmax", 0.5);
1133 psd0.
add<
double>(
"xmin", -0.5);
1138 psd0.
add<
int>(
"Nbinsx", 50);
1139 psd0.
add<
double>(
"xmax", 100);
1140 psd0.
add<
double>(
"xmin", 0);
1145 psd0.
add<
int>(
"Nbinsx", 50);
1146 psd0.
add<
double>(
"xmax", 10);
1147 psd0.
add<
double>(
"xmin", 0);
1152 psd0.
add<
int>(
"Nbinsx", 50);
1153 psd0.
add<
double>(
"xmax", 2.5);
1154 psd0.
add<
double>(
"xmin", -2.5);
1159 psd0.
add<
int>(
"Nbinsx", 50);
1160 psd0.
add<
double>(
"xmax", 2);
1161 psd0.
add<
double>(
"xmin", -2);
1166 psd0.
add<
int>(
"Nbinsx", 50);
1167 psd0.
add<
double>(
"xmax", 5);
1168 psd0.
add<
double>(
"xmin", -5);
1173 psd0.
add<
int>(
"Nbinsx", 50);
1174 psd0.
add<
double>(
"xmax", 30);
1175 psd0.
add<
double>(
"xmin", -30);
1180 psd0.
add<
int>(
"Nbinsx", 100);
1181 psd0.
add<
double>(
"xmax", 0.2);
1182 psd0.
add<
double>(
"xmin", -0.2);
1187 psd0.
add<
int>(
"Nbinsx", 100);
1188 psd0.
add<
double>(
"xmax", 0.01);
1189 psd0.
add<
double>(
"xmin", -0.01);
1194 psd0.
add<
int>(
"Nbinsx", 100);
1195 psd0.
add<
double>(
"xmax", 0.01);
1196 psd0.
add<
double>(
"xmin", -0.01);
1201 psd0.
add<
int>(
"Nbinsx", 100);
1202 psd0.
add<
double>(
"xmax", 1.0);
1203 psd0.
add<
double>(
"xmin", -1.0);
1208 psd0.
add<
int>(
"Nbinsx", 100);
1209 psd0.
add<
double>(
"xmax", 0.05);
1210 psd0.
add<
double>(
"xmin", -0.05);
1218 edm::InputTag(
"TTClusterAssociatorFromPixelDigis",
"ClusterAccepted"));
1219 desc.add<
int>(
"L1Tk_minNStub", 4);
1220 desc.add<
double>(
"L1Tk_maxChi2dof", 25.0);
1221 desc.add<
int>(
"TP_minNStub", 4);
1222 desc.add<
int>(
"TP_minNLayersStub", 4);
1223 desc.add<
double>(
"TP_minPt", 2.0);
1224 desc.add<
double>(
"TP_maxEta", 2.4);
1225 desc.add<
double>(
"TP_maxVtxZ", 15.0);
1226 descriptions.
add(
"Phase2OTValidateTrackingParticles",
desc);
MonitorElement * respt_eta0p7to1_pt8toInf
MonitorElement * respt_eta1to1p2_pt3to8
T getParameter(std::string const &) const
MonitorElement * resd0_eta1to1p2
MonitorElement * match_tp_pt_zoom
Phase2OTValidateTrackingParticles(const edm::ParameterSet &)
MonitorElement * respt_eta2to2p4_pt3to8
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
MonitorElement * respt_eta2to2p4_pt2to3
virtual void setCurrentFolder(std::string const &fullpath)
MonitorElement * respt_eta1to1p2_pt2to3
MonitorElement * resphi_eta1to1p2
MonitorElement * trackParts_Eta
Sin< T >::type sin(const T &t)
MonitorElement * reseta_eta1p6to2
MonitorElement * resVtxZ_eta0p7to1
MonitorElement * resd0_eta0to0p7
MonitorElement * resphi_eta0to0p7
MonitorElement * trackParts_Pt
MonitorElement * resphi_eta1p6to2
MonitorElement * resVtxZ_eta1p2to1p6
MonitorElement * respt_eta0to0p7_pt2to3
MonitorElement * reseta_eta0to0p7
unsigned int layer(const DetId &id) const
MonitorElement * resVtxZ_eta0to0p7
MonitorElement * resd0_eta2to2p4
MonitorElement * tp_pt_zoom
MonitorElement * respt_eta1to1p2_pt8toInf
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
MonitorElement * resd0_eta0p7to1
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > m_topoToken
edm::EDGetTokenT< std::vector< TrackingParticle > > trackingParticleToken_
MonitorElement * trackParts_Phi
Cos< T >::type cos(const T &t)
Tan< T >::type tan(const T &t)
MonitorElement * respt_eta1p2to1p6_pt8toInf
MonitorElement * respt_eta1p6to2_pt8toInf
MonitorElement * resd0_eta1p6to2
#define DEFINE_FWK_MODULE(type)
MonitorElement * reseta_eta1to1p2
MonitorElement * reseta_eta2to2p4
static constexpr auto TOB
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Class to store the L1 Track Trigger stubs.
edm::EDGetTokenT< TTTrackAssociationMap< Ref_Phase2TrackerDigi_ > > ttTrackMCTruthToken_
MonitorElement * respt_eta0to0p7_pt3to8
edm::EDGetTokenT< TTClusterAssociationMap< Ref_Phase2TrackerDigi_ > > ttClusterMCTruthToken_
MonitorElement * respt_eta1p2to1p6_pt3to8
MonitorElement * respt_eta0to0p7_pt8toInf
MonitorElement * respt_eta0p7to1_pt2to3
MonitorElement * resphi_eta0p7to1
MonitorElement * match_tp_VtxR
MonitorElement * resd0_eta1p2to1p6
std::string topFolderName_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
const LorentzVector & p4() const
Four-momentum Lorentz vector. Note this is taken from the first SimTrack only.
MonitorElement * reseta_eta1p2to1p6
MonitorElement * respt_eta2to2p4_pt8toInf
MonitorElement * match_tp_eta
MonitorElement * respt_eta1p2to1p6_pt2to3
MonitorElement * respt_eta1p6to2_pt2to3
MonitorElement * match_tp_VtxZ
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
MonitorElement * resphi_eta1p2to1p6
MonitorElement * res_ptRel
~Phase2OTValidateTrackingParticles() override
MonitorElement * resphi_eta2to2p4
MonitorElement * respt_eta0p7to1_pt3to8
void analyze(const edm::Event &, const edm::EventSetup &) override
MonitorElement * resVtxZ_eta2to2p4
MonitorElement * respt_eta1p6to2_pt3to8
edm::EDGetTokenT< TTStubAssociationMap< Ref_Phase2TrackerDigi_ > > ttStubMCTruthToken_
MonitorElement * match_tp_d0
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
MonitorElement * resVtxZ_eta1to1p2
MonitorElement * reseta_eta0p7to1
static constexpr auto TID
MonitorElement * resVtxZ_eta1p6to2
MonitorElement * match_tp_pt
float charge() const
Electric charge. Note this is taken from the first SimTrack only.
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)