92 for (
auto iterTP: *trackingParticleHandle) {
96 int tmp_eventid = iterTP.eventId().event();
97 float tmp_tp_pt = iterTP.pt();
98 float tmp_tp_phi = iterTP.phi();
99 float tmp_tp_eta = iterTP.eta();
102 std::vector< edm::Ref< edmNew::DetSetVector< TTStub< Ref_Phase2TrackerDigi_ > >,
TTStub< Ref_Phase2TrackerDigi_ > > > theStubRefs = MCTruthTTStubHandle->findTTStubRefs(tp_ptr);
104 int hasStubInLayer[11] = {0};
105 for (
unsigned int is=0; is<theStubRefs.size(); is++) {
106 DetId detid( theStubRefs.at(is)->getDetId() );
109 layer = static_cast<int>(tTopo->
layer(detid)) - 1;
111 layer = static_cast<int>(tTopo->
layer(detid)) + 5;
114 if (MCTruthTTStubHandle->findTrackingParticlePtr(theStubRefs.at(is)).isNull() && hasStubInLayer[layer]<2)
115 hasStubInLayer[layer] = 1;
117 hasStubInLayer[layer] = 2;
120 int nStubLayerTP = 0;
121 int nStubLayerTP_g = 0;
123 if ( hasStubInLayer[
isum] >= 1)
125 else if ( hasStubInLayer[
isum] == 2)
141 if ( MCTruthTTStubHandle.
isValid() ) {
142 std::vector< edm::Ref< edmNew::DetSetVector< TTStub< Ref_Phase2TrackerDigi_ > >,
TTStub< Ref_Phase2TrackerDigi_ > > > theStubRefs = MCTruthTTStubHandle->findTTStubRefs(tp_ptr);
143 nStubTP = (
int) theStubRefs.size();
145 if ( MCTruthTTClusterHandle.
isValid() && MCTruthTTClusterHandle->findTTClusterRefs(tp_ptr).empty() )
148 float tmp_tp_vz = iterTP.vz();
149 float tmp_tp_vx = iterTP.vx();
150 float tmp_tp_vy = iterTP.vy();
151 float tmp_tp_charge = tp_ptr->
charge();
152 int tmp_tp_pdgid = iterTP.pdgId();
157 float tmp_tp_t =
tan(2.0 * atan(1.0) - 2.0 * atan(
exp(-tmp_tp_eta)));
158 float delx = -tmp_tp_vx;
159 float dely = -tmp_tp_vy;
160 float K = 0.01 * 0.5696 / tmp_tp_pt * tmp_tp_charge;
161 float A = 1. / (2. * K);
162 float tmp_tp_x0p = delx - A *
sin(tmp_tp_phi);
163 float tmp_tp_y0p = dely + A *
cos(tmp_tp_phi);
164 float tmp_tp_rp =
sqrt(tmp_tp_x0p * tmp_tp_x0p + tmp_tp_y0p * tmp_tp_y0p);
165 static double pi = 4.0 * atan(1.0);
166 float delphi = tmp_tp_phi - atan2(-K * tmp_tp_x0p, K * tmp_tp_y0p);
172 float tmp_tp_VtxZ = tmp_tp_vz + tmp_tp_t * delphi / (2.0 * K);
173 float tmp_tp_VtxR =
sqrt(tmp_tp_vx * tmp_tp_vx + tmp_tp_vy * tmp_tp_vy);
174 float tmp_tp_d0 = tmp_tp_charge * tmp_tp_rp - (1. / (2. * K));
178 float other_d0 = -tmp_tp_vx *
sin(tmp_tp_phi) + tmp_tp_vy *
cos(tmp_tp_phi);
179 tmp_tp_d0 = tmp_tp_d0 * (-1);
181 tmp_tp_d0 = other_d0;
182 tmp_tp_VtxZ = tmp_tp_vz;
188 if (tmp_tp_VtxR < 1.0) {
196 if (tmp_tp_VtxR > 1.0)
209 float i_chi2dof = 99999;
210 if ( MCTruthTTTrackHandle.
isValid() ) {
211 std::vector< edm::Ptr< TTTrack< Ref_Phase2TrackerDigi_ > > > matchedTracks =
212 MCTruthTTTrackHandle->findTTTrackPtrs(tp_ptr);
220 for (
auto thisTrack: matchedTracks) {
221 if (!MCTruthTTTrackHandle->isGenuine(thisTrack))
227 int tmp_trk_nstub = thisTrack->getStubRefs().size();
230 float dmatch_pt = 999;
231 float dmatch_eta = 999;
232 float dmatch_phi = 999;
236 dmatch_pt = std::fabs(my_tp->
p4().pt() - tmp_tp_pt);
237 dmatch_eta = std::fabs(my_tp->
p4().eta() - tmp_tp_eta);
238 dmatch_phi = std::fabs(my_tp->
p4().phi() - tmp_tp_phi);
239 match_id = my_tp->
pdgId();
240 float tmp_trk_chi2dof = (thisTrack->getChi2(
L1Tk_nPar)) / (2*tmp_trk_nstub -
L1Tk_nPar);
243 if (dmatch_pt<0.1 && dmatch_eta<0.1 && dmatch_phi<0.1 && tmp_tp_pdgid==match_id) {
245 if (i_track < 0 || tmp_trk_chi2dof < i_chi2dof) {
246 i_track = trkCounter;
247 i_chi2dof = tmp_trk_chi2dof;
256 float tmp_matchtrk_pt = -999;
257 float tmp_matchtrk_eta = -999;
258 float tmp_matchtrk_phi = -999;
259 float tmp_matchtrk_VtxZ = -999;
260 float tmp_matchtrk_chi2 = -999;
261 float tmp_matchtrk_chi2dof = -999;
262 int tmp_matchTrk_nStub = -999;
263 float tmp_matchtrk_d0 = -999;
265 tmp_matchtrk_pt = matchedTracks[i_track]->getMomentum(
L1Tk_nPar).perp();
266 tmp_matchtrk_eta = matchedTracks[i_track]->getMomentum(
L1Tk_nPar).eta();
267 tmp_matchtrk_phi = matchedTracks[i_track]->getMomentum(
L1Tk_nPar).phi();
268 tmp_matchtrk_VtxZ = matchedTracks[i_track]->getPOCA(
L1Tk_nPar).z();
269 tmp_matchtrk_chi2 = matchedTracks[i_track]->getChi2(
L1Tk_nPar);
270 tmp_matchtrk_chi2dof = matchedTracks[i_track]->getChi2Red(
L1Tk_nPar);
271 tmp_matchTrk_nStub = (
int) matchedTracks[i_track]->getStubRefs().size();
277 float tmp_matchtrk_x0 = matchedTracks[i_track]->getPOCA(
L1Tk_nPar).x();
278 float tmp_matchtrk_y0 = matchedTracks[i_track]->getPOCA(
L1Tk_nPar).y();
279 tmp_matchtrk_d0 = -tmp_matchtrk_x0*
sin(tmp_matchtrk_phi) + tmp_matchtrk_y0*
cos(tmp_matchtrk_phi);
283 if (tmp_matchTrk_nStub < L1Tk_minNStub || tmp_matchtrk_chi2 >
L1Tk_maxChi2 289 if (tmp_tp_pt>0 && tmp_tp_pt<=10)
297 float pt_diff = tmp_matchtrk_pt - tmp_tp_pt;
298 float pt_res = pt_diff/tmp_tp_pt;
299 float eta_res = tmp_matchtrk_eta - tmp_tp_eta;
300 float phi_res = tmp_matchtrk_phi - tmp_tp_phi;
301 float VtxZ_res = tmp_matchtrk_VtxZ - tmp_tp_VtxZ;
302 float d0_res = tmp_matchtrk_d0 - tmp_tp_d0;
311 if (std::fabs(tmp_tp_eta) >= 0 && std::fabs(tmp_tp_eta) < 0.7) {
316 if (tmp_tp_pt >= 2 && tmp_tp_pt < 3)
318 else if (tmp_tp_pt >= 3 && tmp_tp_pt < 8)
320 else if (tmp_tp_pt >= 8)
322 }
else if (std::fabs(tmp_tp_eta) >= 0.7 && std::fabs(tmp_tp_eta) < 1.0) {
327 if (tmp_tp_pt >= 2 && tmp_tp_pt < 3)
329 else if (tmp_tp_pt >= 3 && tmp_tp_pt < 8)
331 else if (tmp_tp_pt >= 8)
333 }
else if (std::fabs(tmp_tp_eta) >= 1.0 && std::fabs(tmp_tp_eta) < 1.2) {
338 if (tmp_tp_pt >= 2 && tmp_tp_pt < 3)
340 else if (tmp_tp_pt >= 3 && tmp_tp_pt < 8)
342 else if (tmp_tp_pt >= 8)
344 }
else if (std::fabs(tmp_tp_eta) >= 1.2 && std::fabs(tmp_tp_eta) < 1.6) {
349 if (tmp_tp_pt >= 2 && tmp_tp_pt < 3)
351 else if (tmp_tp_pt >= 3 && tmp_tp_pt < 8)
353 else if (tmp_tp_pt >= 8)
355 }
else if (std::fabs(tmp_tp_eta) >= 1.6 && std::fabs(tmp_tp_eta) < 2.0) {
360 if (tmp_tp_pt >= 2 && tmp_tp_pt < 3)
362 else if (tmp_tp_pt >= 3 && tmp_tp_pt < 8)
364 else if (tmp_tp_pt >= 8)
367 else if (std::fabs(tmp_tp_eta) >= 2.0 && std::fabs(tmp_tp_eta) <= 2.4) {
372 if (tmp_tp_pt >= 2 && tmp_tp_pt < 3)
374 else if (tmp_tp_pt >= 3 && tmp_tp_pt < 8)
376 else if (tmp_tp_pt >= 8)
394 HistoName =
"trackParts_Pt";
405 HistoName =
"trackParts_Eta";
416 HistoName =
"trackParts_Phi";
429 HistoName =
"Track_MatchedChi2";
440 HistoName =
"Track_MatchedChi2Red";
463 HistoName =
"match_tp_pt";
474 HistoName =
"tp_pt_zoom";
484 HistoName =
"match_tp_pt_zoom";
495 HistoName =
"tp_eta";
505 HistoName =
"match_tp_eta";
526 HistoName =
"match_tp_d0";
537 HistoName =
"tp_VtxR";
547 HistoName =
"match_tp_VtxR";
558 HistoName =
"tp_VtxZ";
568 HistoName =
"match_tp_VtxZ";
581 HistoName =
"res_pt";
592 HistoName =
"res_eta";
603 HistoName =
"res_ptRel";
614 HistoName =
"reseta_eta0to0p7";
624 HistoName =
"reseta_eta0p7to1";
634 HistoName =
"reseta_eta1to1p2";
644 HistoName =
"reseta_eta1p2to1p6";
654 HistoName =
"reseta_eta1p6to2";
664 HistoName =
"reseta_eta2to2p4";
676 HistoName =
"respt_eta0to0p7_pt2to3";
686 HistoName =
"respt_eta0p7to1_pt2to3";
696 HistoName =
"respt_eta1to1p2_pt2to3";
706 HistoName =
"respt_eta1p2to1p6_pt2to3";
716 HistoName =
"respt_eta1p6to2_pt2to3";
726 HistoName =
"respt_eta2to2p4_pt2to3";
737 HistoName =
"respt_eta0to0p7_pt3to8";
747 HistoName =
"respt_eta0p7to1_pt3to8";
757 HistoName =
"respt_eta1to1p2_pt3to8";
767 HistoName =
"respt_eta1p2to1p6_pt3to8";
777 HistoName =
"respt_eta1p6to2_pt3to8";
787 HistoName =
"respt_eta2to2p4_pt3to8";
798 HistoName =
"respt_eta0to0p7_pt8toInf";
808 HistoName =
"respt_eta0p7to1_pt8toInf";
818 HistoName =
"respt_eta1to1p2_pt8toInf";
828 HistoName =
"respt_eta1p2to1p6_pt8toInf";
838 HistoName =
"respt_eta1p6to2_pt8toInf";
848 HistoName =
"respt_eta2to2p4_pt8toInf";
860 HistoName =
"resphi_eta0to0p7";
870 HistoName =
"resphi_eta0p7to1";
880 HistoName =
"resphi_eta1to1p2";
890 HistoName =
"resphi_eta1p2to1p6";
900 HistoName =
"resphi_eta1p6to2";
910 HistoName =
"resphi_eta2to2p4";
922 HistoName =
"resVtxZ_eta0to0p7";
932 HistoName =
"resVtxZ_eta0p7to1";
942 HistoName =
"resVtxZ_eta1to1p2";
952 HistoName =
"resVtxZ_eta1p2to1p6";
962 HistoName =
"resVtxZ_eta1p6to2";
972 HistoName =
"resVtxZ_eta2to2p4";
984 HistoName =
"resd0_eta0to0p7";
994 HistoName =
"resd0_eta0p7to1";
1004 HistoName =
"resd0_eta1to1p2";
1014 HistoName =
"resd0_eta1p2to1p6";
1024 HistoName =
"resd0_eta1p6to2";
1034 HistoName =
"resd0_eta2to2p4";
const LorentzVector & p4() const
Four-momentum Lorentz vector. Note this is taken from the first SimTrack only.
MonitorElement * resd0_eta1to1p2
MonitorElement * match_tp_d0
T getParameter(std::string const &) const
MonitorElement * match_tp_VtxR
MonitorElement * respt_eta2to2p4_pt8toInf
MonitorElement * Track_MatchedChi2
MonitorElement * resVtxZ_eta1to1p2
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
MonitorElement * resVtxZ_eta1p6to2
MonitorElement * trackParts_Phi
bool getByToken(EDGetToken token, Handle< PROD > &result) const
MonitorElement * match_tp_pt
MonitorElement * trackParts_Pt
int pdgId() const
PDG ID.
Sin< T >::type sin(const T &t)
MonitorElement * respt_eta1p6to2_pt3to8
MonitorElement * match_tp_eta
MonitorElement * reseta_eta1p6to2
~OuterTrackerMonitorTrackingParticles() override
MonitorElement * resd0_eta1p6to2
MonitorElement * reseta_eta1to1p2
edm::EDGetTokenT< std::vector< TrackingParticle > > trackingParticleToken_
MonitorElement * match_tp_VtxZ
MonitorElement * tp_pt_zoom
MonitorElement * respt_eta0to0p7_pt3to8
float charge() const
Electric charge. Note this is taken from the first SimTrack only.
#define DEFINE_FWK_MODULE(type)
MonitorElement * resphi_eta0to0p7
void setCurrentFolder(std::string const &fullpath)
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
MonitorElement * book1D(Args &&...args)
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
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
MonitorElement * resVtxZ_eta1p2to1p6
std::string topFolderName_
MonitorElement * Track_MatchedChi2Red
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 * resphi_eta1to1p2
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
T const * product() const
MonitorElement * respt_eta1p2to1p6_pt3to8
MonitorElement * resphi_eta1p6to2
MonitorElement * respt_eta0to0p7_pt8toInf
MonitorElement * res_ptRel
MonitorElement * trackParts_Eta
MonitorElement * resd0_eta0to0p7