87 for (
const auto &iterTP : *trackingParticleHandle) {
92 float tmp_tp_pt = iterTP.pt();
93 float tmp_tp_phi = iterTP.phi();
94 float tmp_tp_eta = iterTP.eta();
98 theStubRefs = MCTruthTTStubHandle->findTTStubRefs(tp_ptr);
100 int hasStubInLayer[11] = {0};
101 for (
unsigned int is = 0; is < theStubRefs.size(); is++) {
102 DetId detid(theStubRefs.at(is)->getDetId());
105 layer = static_cast<int>(tTopo->
layer(detid)) - 1;
107 layer = static_cast<int>(tTopo->
layer(detid)) + 5;
110 if (MCTruthTTStubHandle->findTrackingParticlePtr(theStubRefs.at(is)).isNull() && hasStubInLayer[
layer] < 2)
111 hasStubInLayer[layer] = 1;
113 hasStubInLayer[
layer] = 2;
116 int nStubLayerTP = 0;
118 if (hasStubInLayer[
isum] >= 1)
134 if (MCTruthTTStubHandle.
isValid()) {
136 theStubRefs = MCTruthTTStubHandle->findTTStubRefs(tp_ptr);
137 nStubTP = (int)theStubRefs.size();
139 if (MCTruthTTClusterHandle.
isValid() && MCTruthTTClusterHandle->findTTClusterRefs(tp_ptr).empty())
142 float tmp_tp_vz = iterTP.vz();
143 float tmp_tp_vx = iterTP.vx();
144 float tmp_tp_vy = iterTP.vy();
145 float tmp_tp_charge = tp_ptr->charge();
146 int tmp_tp_pdgid = iterTP.pdgId();
151 float tmp_tp_t =
tan(2.0 * atan(1.0) - 2.0 * atan(
exp(-tmp_tp_eta)));
152 float delx = -tmp_tp_vx;
153 float dely = -tmp_tp_vy;
154 float K = 0.01 * 0.5696 / tmp_tp_pt * tmp_tp_charge;
155 float A = 1. / (2. * K);
156 float tmp_tp_x0p = delx - A *
sin(tmp_tp_phi);
157 float tmp_tp_y0p = dely + A *
cos(tmp_tp_phi);
158 float tmp_tp_rp =
sqrt(tmp_tp_x0p * tmp_tp_x0p + tmp_tp_y0p * tmp_tp_y0p);
159 static double pi = 4.0 * atan(1.0);
160 float delphi = tmp_tp_phi - atan2(-K * tmp_tp_x0p, K * tmp_tp_y0p);
166 float tmp_tp_VtxZ = tmp_tp_vz + tmp_tp_t * delphi / (2.0 * K);
167 float tmp_tp_VtxR =
sqrt(tmp_tp_vx * tmp_tp_vx + tmp_tp_vy * tmp_tp_vy);
168 float tmp_tp_d0 = tmp_tp_charge * tmp_tp_rp - (1. / (2. * K));
172 float other_d0 = -tmp_tp_vx *
sin(tmp_tp_phi) + tmp_tp_vy *
cos(tmp_tp_phi);
173 tmp_tp_d0 = tmp_tp_d0 * (-1);
175 tmp_tp_d0 = other_d0;
176 tmp_tp_VtxZ = tmp_tp_vz;
182 if (tmp_tp_VtxR < 1.0) {
190 if (tmp_tp_VtxR > 1.0)
203 float i_chi2dof = 99999;
204 if (MCTruthTTTrackHandle.
isValid()) {
205 std::vector<edm::Ptr<TTTrack<Ref_Phase2TrackerDigi_>>> matchedTracks =
206 MCTruthTTTrackHandle->findTTTrackPtrs(tp_ptr);
214 for (
const auto &thisTrack : matchedTracks) {
215 if (!MCTruthTTTrackHandle->isGenuine(thisTrack))
221 int tmp_trk_nstub = thisTrack->getStubRefs().size();
224 float dmatch_pt = 999;
225 float dmatch_eta = 999;
226 float dmatch_phi = 999;
230 dmatch_pt = std::fabs(my_tp->p4().pt() - tmp_tp_pt);
231 dmatch_eta = std::fabs(my_tp->p4().eta() - tmp_tp_eta);
232 dmatch_phi = std::fabs(my_tp->p4().phi() - tmp_tp_phi);
233 match_id = my_tp->pdgId();
234 float tmp_trk_chi2dof = thisTrack->chi2Red();
237 if (dmatch_pt < 0.1 && dmatch_eta < 0.1 && dmatch_phi < 0.1 && tmp_tp_pdgid == match_id) {
239 if (i_track < 0 || tmp_trk_chi2dof < i_chi2dof) {
240 i_track = trkCounter;
241 i_chi2dof = tmp_trk_chi2dof;
250 float tmp_matchtrk_pt = -999;
251 float tmp_matchtrk_eta = -999;
252 float tmp_matchtrk_phi = -999;
253 float tmp_matchtrk_VtxZ = -999;
254 float tmp_matchtrk_chi2dof = -999;
255 int tmp_matchTrk_nStub = -999;
256 float tmp_matchtrk_d0 = -999;
258 tmp_matchtrk_pt = matchedTracks[i_track]->momentum().perp();
259 tmp_matchtrk_eta = matchedTracks[i_track]->momentum().eta();
260 tmp_matchtrk_phi = matchedTracks[i_track]->momentum().phi();
261 tmp_matchtrk_VtxZ = matchedTracks[i_track]->z0();
262 tmp_matchtrk_chi2dof = matchedTracks[i_track]->chi2Red();
263 tmp_matchTrk_nStub = (int)matchedTracks[i_track]->getStubRefs().size();
266 float tmp_matchtrk_x0 = matchedTracks[i_track]->POCA().x();
267 float tmp_matchtrk_y0 = matchedTracks[i_track]->POCA().y();
268 tmp_matchtrk_d0 = -tmp_matchtrk_x0 *
sin(tmp_matchtrk_phi) + tmp_matchtrk_y0 *
cos(tmp_matchtrk_phi);
271 if (tmp_matchTrk_nStub < L1Tk_minNStub || tmp_matchtrk_chi2dof >
L1Tk_maxChi2dof)
276 if (tmp_tp_pt > 0 && tmp_tp_pt <= 10)
284 float pt_diff = tmp_matchtrk_pt - tmp_tp_pt;
285 float pt_res = pt_diff / tmp_tp_pt;
286 float eta_res = tmp_matchtrk_eta - tmp_tp_eta;
287 float phi_res = tmp_matchtrk_phi - tmp_tp_phi;
288 float VtxZ_res = tmp_matchtrk_VtxZ - tmp_tp_VtxZ;
289 float d0_res = tmp_matchtrk_d0 - tmp_tp_d0;
298 if (std::fabs(tmp_tp_eta) >= 0 && std::fabs(tmp_tp_eta) < 0.7) {
303 if (tmp_tp_pt >= 2 && tmp_tp_pt < 3)
305 else if (tmp_tp_pt >= 3 && tmp_tp_pt < 8)
307 else if (tmp_tp_pt >= 8)
309 }
else if (std::fabs(tmp_tp_eta) >= 0.7 && std::fabs(tmp_tp_eta) < 1.0) {
314 if (tmp_tp_pt >= 2 && tmp_tp_pt < 3)
316 else if (tmp_tp_pt >= 3 && tmp_tp_pt < 8)
318 else if (tmp_tp_pt >= 8)
320 }
else if (std::fabs(tmp_tp_eta) >= 1.0 && std::fabs(tmp_tp_eta) < 1.2) {
325 if (tmp_tp_pt >= 2 && tmp_tp_pt < 3)
327 else if (tmp_tp_pt >= 3 && tmp_tp_pt < 8)
329 else if (tmp_tp_pt >= 8)
331 }
else if (std::fabs(tmp_tp_eta) >= 1.2 && std::fabs(tmp_tp_eta) < 1.6) {
336 if (tmp_tp_pt >= 2 && tmp_tp_pt < 3)
338 else if (tmp_tp_pt >= 3 && tmp_tp_pt < 8)
340 else if (tmp_tp_pt >= 8)
342 }
else if (std::fabs(tmp_tp_eta) >= 1.6 && std::fabs(tmp_tp_eta) < 2.0) {
347 if (tmp_tp_pt >= 2 && tmp_tp_pt < 3)
349 else if (tmp_tp_pt >= 3 && tmp_tp_pt < 8)
351 else if (tmp_tp_pt >= 8)
353 }
else if (std::fabs(tmp_tp_eta) >= 2.0 && std::fabs(tmp_tp_eta) <= 2.4) {
358 if (tmp_tp_pt >= 2 && tmp_tp_pt < 3)
360 else if (tmp_tp_pt >= 3 && tmp_tp_pt < 8)
362 else if (tmp_tp_pt >= 8)
380 HistoName =
"trackParts_Pt";
391 HistoName =
"trackParts_Eta";
402 HistoName =
"trackParts_Phi";
425 HistoName =
"match_tp_pt";
436 HistoName =
"tp_pt_zoom";
446 HistoName =
"match_tp_pt_zoom";
457 HistoName =
"tp_eta";
467 HistoName =
"match_tp_eta";
488 HistoName =
"match_tp_d0";
499 HistoName =
"tp_VtxR";
509 HistoName =
"match_tp_VtxR";
520 HistoName =
"tp_VtxZ";
530 HistoName =
"match_tp_VtxZ";
543 HistoName =
"res_pt";
554 HistoName =
"res_eta";
565 HistoName =
"res_ptRel";
576 HistoName =
"reseta_eta0to0p7";
586 HistoName =
"reseta_eta0p7to1";
596 HistoName =
"reseta_eta1to1p2";
606 HistoName =
"reseta_eta1p2to1p6";
616 HistoName =
"reseta_eta1p6to2";
626 HistoName =
"reseta_eta2to2p4";
638 HistoName =
"respt_eta0to0p7_pt2to3";
648 HistoName =
"respt_eta0p7to1_pt2to3";
658 HistoName =
"respt_eta1to1p2_pt2to3";
668 HistoName =
"respt_eta1p2to1p6_pt2to3";
678 HistoName =
"respt_eta1p6to2_pt2to3";
688 HistoName =
"respt_eta2to2p4_pt2to3";
699 HistoName =
"respt_eta0to0p7_pt3to8";
709 HistoName =
"respt_eta0p7to1_pt3to8";
719 HistoName =
"respt_eta1to1p2_pt3to8";
729 HistoName =
"respt_eta1p2to1p6_pt3to8";
739 HistoName =
"respt_eta1p6to2_pt3to8";
749 HistoName =
"respt_eta2to2p4_pt3to8";
760 HistoName =
"respt_eta0to0p7_pt8toInf";
770 HistoName =
"respt_eta0p7to1_pt8toInf";
780 HistoName =
"respt_eta1to1p2_pt8toInf";
790 HistoName =
"respt_eta1p2to1p6_pt8toInf";
800 HistoName =
"respt_eta1p6to2_pt8toInf";
810 HistoName =
"respt_eta2to2p4_pt8toInf";
822 HistoName =
"resphi_eta0to0p7";
832 HistoName =
"resphi_eta0p7to1";
842 HistoName =
"resphi_eta1to1p2";
852 HistoName =
"resphi_eta1p2to1p6";
862 HistoName =
"resphi_eta1p6to2";
872 HistoName =
"resphi_eta2to2p4";
884 HistoName =
"resVtxZ_eta0to0p7";
894 HistoName =
"resVtxZ_eta0p7to1";
904 HistoName =
"resVtxZ_eta1to1p2";
914 HistoName =
"resVtxZ_eta1p2to1p6";
924 HistoName =
"resVtxZ_eta1p6to2";
934 HistoName =
"resVtxZ_eta2to2p4";
946 HistoName =
"resd0_eta0to0p7";
956 HistoName =
"resd0_eta0p7to1";
966 HistoName =
"resd0_eta1to1p2";
976 HistoName =
"resd0_eta1p2to1p6";
986 HistoName =
"resd0_eta1p6to2";
996 HistoName =
"resd0_eta2to2p4";
MonitorElement * resd0_eta1to1p2
MonitorElement * match_tp_d0
MonitorElement * match_tp_VtxR
MonitorElement * respt_eta2to2p4_pt8toInf
MonitorElement * resVtxZ_eta1to1p2
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
MonitorElement * resVtxZ_eta1p6to2
virtual void setCurrentFolder(std::string const &fullpath)
MonitorElement * trackParts_Phi
bool getByToken(EDGetToken token, Handle< PROD > &result) const
MonitorElement * match_tp_pt
MonitorElement * trackParts_Pt
#define DEFINE_FWK_MODULE(type)
Sin< T >::type sin(const T &t)
MonitorElement * respt_eta1p6to2_pt3to8
MonitorElement * match_tp_eta
MonitorElement * reseta_eta1p6to2
~OuterTrackerMonitorTrackingParticles() override
Exp< T >::type exp(const T &t)
MonitorElement * resd0_eta1p6to2
MonitorElement * reseta_eta1to1p2
constexpr std::array< uint8_t, layerIndexSize > layer
edm::EDGetTokenT< std::vector< TrackingParticle > > trackingParticleToken_
bool getData(T &iHolder) const
MonitorElement * match_tp_VtxZ
MonitorElement * tp_pt_zoom
MonitorElement * respt_eta0to0p7_pt3to8
MonitorElement * resphi_eta0to0p7
MonitorElement * reseta_eta2to2p4
edm::EDGetTokenT< TTTrackAssociationMap< Ref_Phase2TrackerDigi_ > > ttTrackMCTruthToken_
MonitorElement * respt_eta1to1p2_pt3to8
MonitorElement * respt_eta1to1p2_pt8toInf
Cos< T >::type cos(const T &t)
MonitorElement * resd0_eta1p2to1p6
Tan< T >::type tan(const T &t)
MonitorElement * respt_eta1p2to1p6_pt2to3
edm::EDGetTokenT< TTClusterAssociationMap< Ref_Phase2TrackerDigi_ > > ttClusterMCTruthToken_
MonitorElement * reseta_eta1p2to1p6
MonitorElement * resphi_eta0p7to1
MonitorElement * respt_eta0p7to1_pt8toInf
static constexpr auto TOB
MonitorElement * resd0_eta2to2p4
MonitorElement * resVtxZ_eta0p7to1
MonitorElement * resphi_eta2to2p4
Class to store the L1 Track Trigger stubs.
MonitorElement * match_tp_pt_zoom
MonitorElement * resVtxZ_eta2to2p4
MonitorElement * respt_eta0p7to1_pt3to8
MonitorElement * respt_eta2to2p4_pt2to3
MonitorElement * resVtxZ_eta0to0p7
edm::EDGetTokenT< TTStubAssociationMap< Ref_Phase2TrackerDigi_ > > ttStubMCTruthToken_
MonitorElement * respt_eta1p2to1p6_pt8toInf
MonitorElement * respt_eta1p6to2_pt2to3
MonitorElement * resphi_eta1p2to1p6
MonitorElement * reseta_eta0to0p7
MonitorElement * respt_eta0p7to1_pt2to3
MonitorElement * reseta_eta0p7to1
T getParameter(std::string const &) const
MonitorElement * resVtxZ_eta1p2to1p6
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > m_topoToken
std::string topFolderName_
unsigned int layer(const DetId &id) const
void analyze(const edm::Event &, const edm::EventSetup &) override
MonitorElement * respt_eta0to0p7_pt2to3
MonitorElement * respt_eta1p6to2_pt8toInf
MonitorElement * respt_eta2to2p4_pt3to8
MonitorElement * resd0_eta0p7to1
MonitorElement * respt_eta1to1p2_pt2to3
OuterTrackerMonitorTrackingParticles(const edm::ParameterSet &)
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
MonitorElement * resphi_eta1to1p2
static constexpr auto TID
MonitorElement * respt_eta1p2to1p6_pt3to8
MonitorElement * resphi_eta1p6to2
MonitorElement * respt_eta0to0p7_pt8toInf
MonitorElement * res_ptRel
MonitorElement * trackParts_Eta
MonitorElement * resd0_eta0to0p7
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)