CMS 3D CMS Logo

HTrack.cc
Go to the documentation of this file.
6 
7 //#include "DQMServices/Core/interface/DQMStore.h"
9 
10 #include "TFile.h"
11 #include "TDirectory.h"
12 
13 using namespace std;
14 
15 HTrack::HTrack(DQMStore::IBooker& ibooker, string dirName_, string name, string whereIs)
16  : theName(name.c_str()), where(whereIs.c_str()) {
17  ibooker.cd();
18  std::string dirName = dirName_;
19  dirName += "/";
20  dirName += name;
21  dirName += "_";
22  dirName += whereIs;
23 
24  ibooker.setCurrentFolder(dirName);
25  hVariables = new HTrackVariables(ibooker, dirName, name, whereIs);
26 
27  ibooker.cd();
28  string resName = dirName;
29  resName += "/Resolution";
30  hResolution = new HResolution(ibooker, resName, name + "_Res", whereIs);
31  ibooker.cd();
32  ibooker.setCurrentFolder(dirName);
33  hTDRResolution = new HResolution(ibooker, resName, name + "_TDRRes", whereIs);
34 
35  ibooker.cd();
36  ibooker.setCurrentFolder(dirName);
37  string pullName = dirName;
38  pullName += "/Pull";
39  hPull = new HResolution(ibooker, pullName, name + "_Pull", whereIs);
40  hTDRPull = new HResolution(ibooker, pullName, name + "_TDRPull", whereIs);
41 
42  doSubHisto = false;
43 
44  if (doSubHisto) {
45  ibooker.cd();
46  ibooker.setCurrentFolder(dirName);
47  string subName = dirName;
48  subName += "/subHistos";
49  // [5-10] GeV range
50  hResolution_5_10 = new HResolution(ibooker, subName, name + "_Res_Pt_5_10", whereIs);
51  hTDRResolution_5_10 = new HResolution(ibooker, subName, name + "_TDRRes_Pt_5_10", whereIs);
52  hPull_5_10 = new HResolution(ibooker, subName, name + "_Pull_Pt_5_10", whereIs);
53 
54  hResolution_10_40 = new HResolution(ibooker, subName, name + "_Res_Pt_10_40", whereIs);
55  hTDRResolution_10_40 = new HResolution(ibooker, subName, name + "_TDRRes_Pt_10_40", whereIs);
56  hPull_10_40 = new HResolution(ibooker, subName, name + "_Pull_Pt_10_40", whereIs);
57 
58  hResolution_40_70 = new HResolution(ibooker, subName, name + "_Res_Pt_40_70", whereIs);
59  hTDRResolution_40_70 = new HResolution(ibooker, subName, name + "_TDRRes_Pt_40_70", whereIs);
60  hPull_40_70 = new HResolution(ibooker, subName, name + "_Pull_Pt_40_70", whereIs);
61 
62  hResolution_70_100 = new HResolution(ibooker, subName, name + "_Res_Pt_70_100", whereIs);
63  hTDRResolution_70_100 = new HResolution(ibooker, subName, name + "_TDRRes_Pt_70_100", whereIs);
64  hPull_70_100 = new HResolution(ibooker, subName, name + "_Pull_Pt_70_100", whereIs);
65 
66  hResolution_08 = new HResolution(ibooker, subName, name + "_Res_Eta_08", whereIs);
67  hTDRResolution_08 = new HResolution(ibooker, subName, name + "_TDRRes_Eta_08", whereIs);
68  hPull_08 = new HResolution(ibooker, subName, name + "_Pull_Eta_08", whereIs);
69 
70  hResolution_08_12 = new HResolution(ibooker, subName, name + "_Res_Eta_08_12", whereIs);
71  hTDRResolution_08_12 = new HResolution(ibooker, subName, name + "_TDRRes_Eta_08_12", whereIs);
72  hPull_08_12 = new HResolution(ibooker, subName, name + "_Pull_Eta_08_12", whereIs);
73 
74  hResolution_12_21 = new HResolution(ibooker, subName, name + "_Res_Eta_12_21", whereIs);
75  hTDRResolution_12_21 = new HResolution(ibooker, subName, name + "_TDRRes_Eta_12_21", whereIs);
76  hPull_12_21 = new HResolution(ibooker, subName, name + "_Pull_Eta_12_21", whereIs);
77 
78  hResolution_12_24 = new HResolution(ibooker, subName, name + "_Res_Eta_12_24", whereIs);
79  hTDRResolution_12_24 = new HResolution(ibooker, subName, name + "_TDRRes_Eta_12_24", whereIs);
80  hPull_12_24 = new HResolution(ibooker, subName, name + "_Pull_Eta_12_24", whereIs);
81 
82  hResolution_12_21_plus = new HResolution(ibooker, subName, name + "_Res_Eta_12_21_plus", whereIs);
83  hTDRResolution_12_21_plus = new HResolution(ibooker, subName, name + "_TDRRes_Eta_12_21_plus", whereIs);
84  hPull_12_21_plus = new HResolution(ibooker, subName, name + "_Pull_Eta_12_21_plus", whereIs);
85 
86  hResolution_12_24_plus = new HResolution(ibooker, subName, name + "_Res_Eta_12_24_plus", whereIs);
87  hTDRResolution_12_24_plus = new HResolution(ibooker, subName, name + "_TDRRes_Eta_12_24_plus", whereIs);
88  hPull_12_24_plus = new HResolution(ibooker, subName, name + "_Pull_Eta_12_24_plus", whereIs);
89 
90  hResolution_12_21_minus = new HResolution(ibooker, subName, name + "_Res_Eta_12_21_minus", whereIs);
91  hTDRResolution_12_21_minus = new HResolution(ibooker, subName, name + "_TDRRes_Eta_12_21_minus", whereIs);
92  hPull_12_21_minus = new HResolution(ibooker, subName, name + "_Pull_Eta_12_21_minus", whereIs);
93 
94  hResolution_12_24_minus = new HResolution(ibooker, subName, name + "_Res_Eta_12_24_minus", whereIs);
95  hTDRResolution_12_24_minus = new HResolution(ibooker, subName, name + "_TDRRes_Eta_12_24_minus", whereIs);
96  hPull_12_24_minus = new HResolution(ibooker, subName, name + "_Pull_Eta_12_24_minus", whereIs);
97  }
98 }
99 
100 double HTrack::pull(double rec, double sim, double sigmarec) { return (rec - sim) / sigmarec; }
101 
102 double HTrack::resolution(double rec, double sim) { return (rec - sim) / sim; }
103 
105 
107  hVariables->Fill(
108  fts.momentum().mag(), fts.momentum().perp(), fts.momentum().eta(), fts.momentum().phi(), fts.charge());
109 }
110 
112 
114  return hVariables->computeEfficiency(sim, ibooker);
115 }
116 
119 }
120 
122  // Global Resolution
124  computePull(fts, simTrack, hPull);
125 
126  // TDR Resolution
128  // computeTDRPull(fts,simTracks,hTDRPull);
129 
130  hVariables->Fill(sqrt(simTrack.momentum().Perp2()), simTrack.momentum().eta(),
131  simTrack.momentum().phi()); //FIXME
132 
133  if (doSubHisto) {
134  // [5-10] GeV range
135  if (sqrt(simTrack.momentum().Perp2()) < 10) {
139  }
140 
141  // [10-40] GeV range
142  if (sqrt(simTrack.momentum().Perp2()) >= 10 && sqrt(simTrack.momentum().Perp2()) < 40) {
146  }
147 
148  // [40-70] GeV range
149  if (sqrt(simTrack.momentum().Perp2()) >= 40 && sqrt(simTrack.momentum().Perp2()) < 70) {
153  }
154 
155  // [70-100] GeV range
156  if (sqrt(simTrack.momentum().Perp2()) >= 70 && sqrt(simTrack.momentum().Perp2()) < 100) {
160  }
161 
162  // eta range |eta|<0.8
163  if (abs(simTrack.momentum().eta()) <= 0.8) {
167  }
168 
169  // eta range 0.8<|eta|<1.2
170  if (abs(simTrack.momentum().eta()) > 0.8 && abs(simTrack.momentum().eta()) <= 1.2) {
174  }
175 
176  // eta range 1.2<|eta|<2.1
177  if (abs(simTrack.momentum().eta()) > 1.2 && abs(simTrack.momentum().eta()) <= 2.1) {
181 
182  if (simTrack.momentum().eta() > 0) {
186  } else {
190  }
191  }
192 
193  // eta range 1.2<|eta|<2.4
194  if (abs(simTrack.momentum().eta()) > 1.2 && abs(simTrack.momentum().eta()) <= 2.4) {
198 
199  if (simTrack.momentum().eta() > 0) {
203  } else {
207  }
208  }
209  }
210 }
211 
213  hReso->Fill(simTrack.momentum().mag(),
214  sqrt(simTrack.momentum().Perp2()),
215  simTrack.momentum().eta(),
216  simTrack.momentum().phi(),
217  resolution(fts.momentum().mag(), simTrack.momentum().mag()),
218  resolution(fts.momentum().perp(), sqrt(simTrack.momentum().Perp2())),
219  fts.momentum().eta() - simTrack.momentum().eta(),
220  fts.momentum().phi() - simTrack.momentum().phi(),
221  fts.charge() + simTrack.type() / abs(simTrack.type())); // FIXME
222 }
223 
225  int simCharge = -simTrack.type() / abs(simTrack.type());
226 
227  double invSimP = (simTrack.momentum().mag() == 0) ? 0 : simTrack.momentum().mag();
228  double signedInverseRecMom = (simTrack.momentum().mag() == 0) ? 0 : fts.signedInverseMomentum();
229 
230  hReso->Fill(simTrack.momentum().mag(),
231  sqrt(simTrack.momentum().Perp2()),
232  simTrack.momentum().eta(),
233  simTrack.momentum().phi(),
234  resolution(signedInverseRecMom, simCharge * invSimP),
235  resolution(fts.charge() / fts.momentum().perp(), simCharge / sqrt(simTrack.momentum().Perp2())));
236 }
237 
239  // x,y,z, px,py,pz
241 
242  double partialPterror = errors[3][3] * pow(fts.momentum().x(), 2) + errors[4][4] * pow(fts.momentum().y(), 2);
243 
244  // sqrt( (px*spx)^2 + (py*spy)^2 ) / pt
245  double pterror = sqrt(partialPterror) / fts.momentum().perp();
246 
247  // sqrt( (px*spx)^2 + (py*spy)^2 + (pz*spz)^2 ) / p
248  double perror = sqrt(partialPterror + errors[5][5] * pow(fts.momentum().z(), 2)) / fts.momentum().mag();
249 
250  double phierror = sqrt(fts.curvilinearError().matrix()[2][2]);
251 
252  double etaerror = sqrt(fts.curvilinearError().matrix()[1][1]) * abs(sin(fts.momentum().theta()));
253 
254  hReso->Fill(simTrack.momentum().mag(),
255  sqrt(simTrack.momentum().Perp2()),
256  simTrack.momentum().eta(),
257  simTrack.momentum().phi(),
258  pull(fts.momentum().mag(), simTrack.momentum().mag(), perror),
259  pull(fts.momentum().perp(), sqrt(simTrack.momentum().Perp2()), pterror),
260  pull(fts.momentum().eta(), simTrack.momentum().eta(), etaerror),
261  pull(fts.momentum().phi(), simTrack.momentum().phi(), phierror),
262  pull(fts.charge(), -simTrack.type() / abs(simTrack.type()), 1.)); // FIXME
263 }
FreeTrajectoryState::momentum
GlobalVector momentum() const
Definition: FreeTrajectoryState.h:68
HTrack::hPull_40_70
HResolution * hPull_40_70
Definition: HTrack.h:63
TrajectoryStateOnSurface.h
cscDigiValidation_cfi.simTrack
simTrack
Definition: cscDigiValidation_cfi.py:29
FreeTrajectoryState.h
HTrack::hTDRResolution_08_12
HResolution * hTDRResolution_08_12
Definition: HTrack.h:77
HTrackVariables
Definition: Histograms.h:23
HTrack::hTDRResolution_12_24_minus
HResolution * hTDRResolution_12_24_minus
Definition: HTrack.h:107
HTrack.h
HTrack::hResolution_12_21_minus
HResolution * hResolution_12_21_minus
Definition: HTrack.h:101
HTrack::hPull_12_21_minus
HResolution * hPull_12_21_minus
Definition: HTrack.h:103
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
HTrack::hPull_12_24_minus
HResolution * hPull_12_24_minus
Definition: HTrack.h:108
PV3DBase::theta
Geom::Theta< T > theta() const
Definition: PV3DBase.h:72
HTrack::hPull_08_12
HResolution * hPull_08_12
Definition: HTrack.h:78
HTrack::hTDRPull
HResolution * hTDRPull
Definition: HTrack.h:48
FreeTrajectoryState::charge
TrackCharge charge() const
Definition: FreeTrajectoryState.h:69
HTrack::hTDRResolution_70_100
HResolution * hTDRResolution_70_100
Definition: HTrack.h:67
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
HTrack::computeResolution
void computeResolution(const FreeTrajectoryState &fts, SimTrack &simTracks, HResolution *hReso)
Definition: HTrack.cc:212
HTrack::hTDRResolution_12_24_plus
HResolution * hTDRResolution_12_24_plus
Definition: HTrack.h:97
HTrack::hPull
HResolution * hPull
Definition: HTrack.h:44
FreeTrajectoryState::signedInverseMomentum
double signedInverseMomentum() const
Definition: FreeTrajectoryState.h:70
HTrack::hTDRResolution_12_24
HResolution * hTDRResolution_12_24
Definition: HTrack.h:87
HTrack::hResolution_12_24_plus
HResolution * hResolution_12_24_plus
Definition: HTrack.h:96
HTrack::hResolution_70_100
HResolution * hResolution_70_100
Definition: HTrack.h:66
MultiTrackValidator_cfi.sim
sim
Definition: MultiTrackValidator_cfi.py:42
HTrack::hTDRResolution_40_70
HResolution * hTDRResolution_40_70
Definition: HTrack.h:62
HTrackVariables::Fill
void Fill(double p, double pt, double eta, double phi, double charge)
Definition: Histograms.h:72
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
HTrack::HTrack
HTrack(DQMStore::IBooker &, std::string, std::string name, std::string whereIs="")
Definition: HTrack.cc:15
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
HTrack::hTDRResolution_08
HResolution * hTDRResolution_08
Definition: HTrack.h:72
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
HResolution::Fill
Int_t Fill(Double_t x, Double_t y) override
Definition: Histograms.h:1830
TrajectoryStateOnSurface::freeState
FreeTrajectoryState const * freeState(bool withErrors=true) const
Definition: TrajectoryStateOnSurface.h:58
FreeTrajectoryState::cartesianError
CartesianTrajectoryError cartesianError() const
Definition: FreeTrajectoryState.h:81
errors
Definition: errors.py:1
HTrack::hPull_12_21
HResolution * hPull_12_21
Definition: HTrack.h:83
Service.h
FreeTrajectoryState::curvilinearError
const CurvilinearTrajectoryError & curvilinearError() const
Definition: FreeTrajectoryState.h:89
HTrack::hPull_08
HResolution * hPull_08
Definition: HTrack.h:73
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
HTrack::FillDeltaR
void FillDeltaR(double)
Definition: HTrack.cc:111
Histograms.h
HTrack::computePull
void computePull(const FreeTrajectoryState &fts, SimTrack &simTracks, HResolution *hReso)
Definition: HTrack.cc:238
AlgebraicSymMatrix66
ROOT::Math::SMatrix< double, 6, 6, ROOT::Math::MatRepSym< double, 6 > > AlgebraicSymMatrix66
Definition: AlgebraicROOTObjects.h:24
HTrack::hTDRResolution_12_21_plus
HResolution * hTDRResolution_12_21_plus
Definition: HTrack.h:92
dqm::implementation::NavigatorBase::cd
virtual void cd()
Definition: DQMStore.cc:29
HTrack::computeResolutionAndPull
void computeResolutionAndPull(TrajectoryStateOnSurface &vtx, SimTrack &simTrack)
Definition: HTrack.cc:117
PbPb_ZMuSkimMuonDPG_cff.deltaR
deltaR
Definition: PbPb_ZMuSkimMuonDPG_cff.py:63
HTrack::hTDRResolution_12_21_minus
HResolution * hTDRResolution_12_21_minus
Definition: HTrack.h:102
HTrack::hPull_12_21_plus
HResolution * hPull_12_21_plus
Definition: HTrack.h:93
HTrackVariables::computeEfficiency
double computeEfficiency(HTrackVariables *sim, DQMStore::IBooker &ibooker)
Definition: Histograms.h:89
etaerror
Definition: HIMultiTrackSelector.h:50
HTrack::hResolution_12_21
HResolution * hResolution_12_21
Definition: HTrack.h:81
HTrack::hPull_12_24
HResolution * hPull_12_24
Definition: HTrack.h:88
sim
Definition: GeometryProducer.h:20
HResolution
Definition: Histograms.h:1802
HTrack::hTDRResolution_12_21
HResolution * hTDRResolution_12_21
Definition: HTrack.h:82
PV3DBase::eta
T eta() const
Definition: PV3DBase.h:73
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
HTrack::resolution
double resolution(double rec, double sim)
Definition: HTrack.cc:102
HTrack::hTDRResolution
HResolution * hTDRResolution
Definition: HTrack.h:47
HTrack::computeTDRResolution
void computeTDRResolution(const FreeTrajectoryState &fts, SimTrack &simTracks, HResolution *hReso)
Definition: HTrack.cc:224
HTrack::hResolution_08
HResolution * hResolution_08
Definition: HTrack.h:71
HTrack::Fill
void Fill(TrajectoryStateOnSurface &)
Definition: HTrack.cc:104
HTrack::doSubHisto
bool doSubHisto
Definition: HTrack.h:113
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
CartesianTrajectoryError::matrix
const AlgebraicSymMatrix66 & matrix() const
Definition: CartesianTrajectoryError.h:28
PV3DBase::mag
T mag() const
Definition: PV3DBase.h:64
HTrack::hResolution_12_24
HResolution * hResolution_12_24
Definition: HTrack.h:86
HTrack::pull
double pull(double rec, double sim, double sigmarec)
Definition: HTrack.cc:100
HTrack::hResolution_10_40
HResolution * hResolution_10_40
Definition: HTrack.h:56
std
Definition: JetResolutionObject.h:76
HTrack::hResolution_12_21_plus
HResolution * hResolution_12_21_plus
Definition: HTrack.h:91
HTrack::hTDRResolution_5_10
HResolution * hTDRResolution_5_10
Definition: HTrack.h:52
FreeTrajectoryState
Definition: FreeTrajectoryState.h:27
SimTrack
Definition: SimTrack.h:9
HTrack::hTDRResolution_10_40
HResolution * hTDRResolution_10_40
Definition: HTrack.h:57
HTrack::hPull_10_40
HResolution * hPull_10_40
Definition: HTrack.h:58
HTrackVariables::FillDeltaR
void FillDeltaR(double deltaR)
Definition: Histograms.h:87
HTrack::computeEfficiency
double computeEfficiency(HTrackVariables *sim, DQMStore::IBooker &)
Definition: HTrack.cc:113
TrackerOfflineValidation_Dqm_cff.dirName
dirName
Definition: TrackerOfflineValidation_Dqm_cff.py:55
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
HiEvtPlane_cfi.pterror
pterror
Definition: HiEvtPlane_cfi.py:24
HTrack::hPull_5_10
HResolution * hPull_5_10
Definition: HTrack.h:53
dqm::implementation::IBooker
Definition: DQMStore.h:43
HTrack::hResolution_12_24_minus
HResolution * hResolution_12_24_minus
Definition: HTrack.h:106
HTrack::hResolution_5_10
HResolution * hResolution_5_10
Definition: HTrack.h:51
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
SimTrack.h
HTrack::hPull_12_24_plus
HResolution * hPull_12_24_plus
Definition: HTrack.h:98
HTrack::hVariables
HTrackVariables * hVariables
Definition: HTrack.h:40
PV3DBase::perp
T perp() const
Definition: PV3DBase.h:69
HTrack::hResolution_40_70
HResolution * hResolution_40_70
Definition: HTrack.h:61
PV3DBase::phi
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
CurvilinearTrajectoryError::matrix
const AlgebraicSymMatrix55 & matrix() const
Definition: CurvilinearTrajectoryError.h:61
HTrack::hPull_70_100
HResolution * hPull_70_100
Definition: HTrack.h:68
HTrack::hResolution_08_12
HResolution * hResolution_08_12
Definition: HTrack.h:76
HTrack::hResolution
HResolution * hResolution
Definition: HTrack.h:43