CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TrackBuildingAnalyzer.cc
Go to the documentation of this file.
10 
15 #include <string>
16 #include "TMath.h"
17 
18 #include <iostream>
19 
21  : conf_( iConfig )
22  , SeedPt(NULL)
23  , SeedEta(NULL)
24  , SeedPhi(NULL)
25  , SeedTheta(NULL)
26  , SeedQ(NULL)
27  , SeedDxy(NULL)
28  , SeedDz(NULL)
29  , NumberOfRecHitsPerSeed(NULL)
30  , NumberOfRecHitsPerSeedVsPhiProfile(NULL)
31  , NumberOfRecHitsPerSeedVsEtaProfile(NULL)
32 {
33 }
34 
36 {
37 }
38 
40 {
41 
42  // parameters from the configuration
43  std::string AlgoName = conf_.getParameter<std::string>("AlgoName");
44  std::string MEFolderName = conf_.getParameter<std::string>("FolderName");
45 
46  // use the AlgoName and Quality Name
47  std::string CatagoryName = AlgoName;
48 
49  // get binning from the configuration
50  int TrackPtBin = conf_.getParameter<int>( "TrackPtBin");
51  double TrackPtMin = conf_.getParameter<double>("TrackPtMin");
52  double TrackPtMax = conf_.getParameter<double>("TrackPtMax");
53 
54  int PhiBin = conf_.getParameter<int>( "PhiBin");
55  double PhiMin = conf_.getParameter<double>("PhiMin");
56  double PhiMax = conf_.getParameter<double>("PhiMax");
57 
58  int EtaBin = conf_.getParameter<int>( "EtaBin");
59  double EtaMin = conf_.getParameter<double>("EtaMin");
60  double EtaMax = conf_.getParameter<double>("EtaMax");
61 
62  int ThetaBin = conf_.getParameter<int>( "ThetaBin");
63  double ThetaMin = conf_.getParameter<double>("ThetaMin");
64  double ThetaMax = conf_.getParameter<double>("ThetaMax");
65 
66  int TrackQBin = conf_.getParameter<int>( "TrackQBin");
67  double TrackQMin = conf_.getParameter<double>("TrackQMin");
68  double TrackQMax = conf_.getParameter<double>("TrackQMax");
69 
70  int SeedDxyBin = conf_.getParameter<int>( "SeedDxyBin");
71  double SeedDxyMin = conf_.getParameter<double>("SeedDxyMin");
72  double SeedDxyMax = conf_.getParameter<double>("SeedDxyMax");
73 
74  int SeedDzBin = conf_.getParameter<int>( "SeedDzBin");
75  double SeedDzMin = conf_.getParameter<double>("SeedDzMin");
76  double SeedDzMax = conf_.getParameter<double>("SeedDzMax");
77 
78  int SeedHitBin = conf_.getParameter<int>( "SeedHitBin");
79  double SeedHitMin = conf_.getParameter<double>("SeedHitMin");
80  double SeedHitMax = conf_.getParameter<double>("SeedHitMax");
81 
82  int TCDxyBin = conf_.getParameter<int>( "TCDxyBin");
83  double TCDxyMin = conf_.getParameter<double>("TCDxyMin");
84  double TCDxyMax = conf_.getParameter<double>("TCDxyMax");
85 
86  int TCDzBin = conf_.getParameter<int>( "TCDzBin");
87  double TCDzMin = conf_.getParameter<double>("TCDzMin");
88  double TCDzMax = conf_.getParameter<double>("TCDzMax");
89 
90  int TCHitBin = conf_.getParameter<int>( "TCHitBin");
91  double TCHitMin = conf_.getParameter<double>("TCHitMin");
92  double TCHitMax = conf_.getParameter<double>("TCHitMax");
93 
94  dqmStore_->setCurrentFolder(MEFolderName);
95 
96  // book the Seed histograms
97  // ---------------------------------------------------------------------------------//
98  dqmStore_->setCurrentFolder(MEFolderName+"/TrackBuilding");
99 
100  histname = "SeedPt_";
101  SeedPt = dqmStore_->book1D(histname+CatagoryName, histname+CatagoryName, TrackPtBin, TrackPtMin, TrackPtMax);
102  SeedPt->setAxisTitle("Seed p_{T} (GeV/c)", 1);
103  SeedPt->setAxisTitle("Number of Seeds", 2);
104 
105  histname = "SeedEta_";
106  SeedEta = dqmStore_->book1D(histname+CatagoryName, histname+CatagoryName, EtaBin, EtaMin, EtaMax);
107  SeedEta->setAxisTitle("Seed #eta", 1);
108  SeedEta->setAxisTitle("Number of Seeds", 2);
109 
110  histname = "SeedPhi_";
111  SeedPhi = dqmStore_->book1D(histname+CatagoryName, histname+CatagoryName, PhiBin, PhiMin, PhiMax);
112  SeedPhi->setAxisTitle("Seed #phi", 1);
113  SeedPhi->setAxisTitle("Number of Seed", 2);
114 
115  histname = "SeedTheta_";
116  SeedTheta = dqmStore_->book1D(histname+CatagoryName, histname+CatagoryName, ThetaBin, ThetaMin, ThetaMax);
117  SeedTheta->setAxisTitle("Seed #theta", 1);
118  SeedTheta->setAxisTitle("Number of Seeds", 2);
119 
120  histname = "SeedQ_";
121  SeedQ = dqmStore_->book1D(histname+CatagoryName, histname+CatagoryName, TrackQBin, TrackQMin, TrackQMax);
122  SeedQ->setAxisTitle("Seed Charge", 1);
123  SeedQ->setAxisTitle("Number of Seeds",2);
124 
125  histname = "SeedDxy_";
126  SeedDxy = dqmStore_->book1D(histname+CatagoryName, histname+CatagoryName, SeedDxyBin, SeedDxyMin, SeedDxyMax);
127  SeedDxy->setAxisTitle("Seed d_{xy} (cm)", 1);
128  SeedDxy->setAxisTitle("Number of Seeds",2);
129 
130  histname = "SeedDz_";
131  SeedDz = dqmStore_->book1D(histname+CatagoryName, histname+CatagoryName, SeedDzBin, SeedDzMin, SeedDzMax);
132  SeedDz->setAxisTitle("Seed d_{z} (cm)", 1);
133  SeedDz->setAxisTitle("Number of Seeds",2);
134 
135  histname = "NumberOfRecHitsPerSeed_";
136  NumberOfRecHitsPerSeed = dqmStore_->book1D(histname+CatagoryName, histname+CatagoryName, SeedHitBin, SeedHitMin, SeedHitMax);
137  NumberOfRecHitsPerSeed->setAxisTitle("Number of RecHits per Seed", 1);
138  NumberOfRecHitsPerSeed->setAxisTitle("Number of Seeds",2);
139 
140  histname = "NumberOfRecHitsPerSeedVsPhiProfile_";
141  NumberOfRecHitsPerSeedVsPhiProfile = dqmStore_->bookProfile(histname+CatagoryName, histname+CatagoryName, PhiBin, PhiMin, PhiMax, SeedHitBin, SeedHitMin, SeedHitMax,"s");
143  NumberOfRecHitsPerSeedVsPhiProfile->setAxisTitle("Number of RecHits of each Seed",2);
144 
145  histname = "NumberOfRecHitsPerSeedVsEtaProfile_";
146  NumberOfRecHitsPerSeedVsEtaProfile = dqmStore_->bookProfile(histname+CatagoryName, histname+CatagoryName, EtaBin, EtaMin, EtaMax, SeedHitBin, SeedHitMin, SeedHitMax,"s");
148  NumberOfRecHitsPerSeedVsEtaProfile->setAxisTitle("Number of RecHits of each Seed",2);
149 
150  // book the TrackCandidate histograms
151  // ---------------------------------------------------------------------------------//
152  dqmStore_->setCurrentFolder(MEFolderName+"/TrackBuilding");
153 
154  histname = "TrackCandPt_";
155  TrackCandPt = dqmStore_->book1D(histname+CatagoryName, histname+CatagoryName, TrackPtBin, TrackPtMin, TrackPtMax);
156  TrackCandPt->setAxisTitle("Track Candidate p_{T} (GeV/c)", 1);
157  TrackCandPt->setAxisTitle("Number of Track Candidates", 2);
158 
159  histname = "TrackCandEta_";
160  TrackCandEta = dqmStore_->book1D(histname+CatagoryName, histname+CatagoryName, EtaBin, EtaMin, EtaMax);
161  TrackCandEta->setAxisTitle("Track Candidate #eta", 1);
162  TrackCandEta->setAxisTitle("Number of Track Candidates", 2);
163 
164  histname = "TrackCandPhi_";
165  TrackCandPhi = dqmStore_->book1D(histname+CatagoryName, histname+CatagoryName, PhiBin, PhiMin, PhiMax);
166  TrackCandPhi->setAxisTitle("Track Candidate #phi", 1);
167  TrackCandPhi->setAxisTitle("Number of Track Candidates", 2);
168 
169  histname = "TrackCandTheta_";
170  TrackCandTheta = dqmStore_->book1D(histname+CatagoryName, histname+CatagoryName, ThetaBin, ThetaMin, ThetaMax);
171  TrackCandTheta->setAxisTitle("Track Candidate #theta", 1);
172  TrackCandTheta->setAxisTitle("Number of Track Candidates", 2);
173 
174  histname = "TrackCandQ_";
175  TrackCandQ = dqmStore_->book1D(histname+CatagoryName, histname+CatagoryName, TrackQBin, TrackQMin, TrackQMax);
176  TrackCandQ->setAxisTitle("Track Candidate Charge", 1);
177  TrackCandQ->setAxisTitle("Number of Track Candidates",2);
178 
179  histname = "TrackCandDxy_";
180  TrackCandDxy = dqmStore_->book1D(histname+CatagoryName, histname+CatagoryName, TCDxyBin, TCDxyMin, TCDxyMax);
181  TrackCandDxy->setAxisTitle("Track Candidate d_{xy} (cm)", 1);
182  TrackCandDxy->setAxisTitle("Number of Track Candidates",2);
183 
184  histname = "TrackCandDz_";
185  TrackCandDz = dqmStore_->book1D(histname+CatagoryName, histname+CatagoryName, TCDzBin, TCDzMin, TCDzMax);
186  TrackCandDz->setAxisTitle("Track Candidate d_{z} (cm)", 1);
187  TrackCandDz->setAxisTitle("Number of Track Candidates",2);
188 
189  histname = "NumberOfRecHitsPerTrackCand_";
190  NumberOfRecHitsPerTrackCand = dqmStore_->book1D(histname+CatagoryName, histname+CatagoryName, TCHitBin, TCHitMin, TCHitMax);
191  NumberOfRecHitsPerTrackCand->setAxisTitle("Number of RecHits per Track Candidate", 1);
192  NumberOfRecHitsPerTrackCand->setAxisTitle("Number of Track Candidates",2);
193 
194  histname = "NumberOfRecHitsPerTrackCandVsPhiProfile_";
195  NumberOfRecHitsPerTrackCandVsPhiProfile = dqmStore_->bookProfile(histname+CatagoryName, histname+CatagoryName, PhiBin, PhiMin, PhiMax, TCHitBin, TCHitMin, TCHitMax,"s");
196  NumberOfRecHitsPerTrackCandVsPhiProfile->setAxisTitle("Track Candidate #phi",1);
197  NumberOfRecHitsPerTrackCandVsPhiProfile->setAxisTitle("Number of RecHits of each Track Candidate",2);
198 
199  histname = "NumberOfRecHitsPerTrackCandVsEtaProfile_";
200  NumberOfRecHitsPerTrackCandVsEtaProfile = dqmStore_->bookProfile(histname+CatagoryName, histname+CatagoryName, EtaBin, EtaMin, EtaMax, TCHitBin, TCHitMin, TCHitMax,"s");
201  NumberOfRecHitsPerTrackCandVsEtaProfile->setAxisTitle("Track Candidate #eta",1);
202  NumberOfRecHitsPerTrackCandVsEtaProfile->setAxisTitle("Number of RecHits of each Track Candidate",2);
203 }
204 
205 // -- Analyse
206 // ---------------------------------------------------------------------------------//
208 (
209  const edm::Event& iEvent,
210  const edm::EventSetup& iSetup,
211  const TrajectorySeed& candidate,
212  const reco::BeamSpot& bs,
213  const edm::ESHandle<MagneticField>& theMF,
215 )
216 {
217 
218  TrajectoryStateTransform tsTransform;
219  TSCBLBuilderNoMaterial tscblBuilder;
220 
221  //get parameters and errors from the candidate state
222  TransientTrackingRecHit::RecHitPointer recHit = theTTRHBuilder->build(&*(candidate.recHits().second-1));
223  TrajectoryStateOnSurface state = tsTransform.transientState( candidate.startingState(), recHit->surface(), theMF.product());
224  TrajectoryStateClosestToBeamLine tsAtClosestApproachSeed = tscblBuilder(*state.freeState(),bs);//as in TrackProducerAlgorithm
225  if(!(tsAtClosestApproachSeed.isValid())) {
226  edm::LogVerbatim("TrackBuilding") << "TrajectoryStateClosestToBeamLine not valid";
227  return;
228  }
229  GlobalPoint v0 = tsAtClosestApproachSeed.trackStateAtPCA().position();
230  GlobalVector p = tsAtClosestApproachSeed.trackStateAtPCA().momentum();
231  GlobalPoint v(v0.x()-bs.x0(),v0.y()-bs.y0(),v0.z()-bs.z0());
232 
233  double pt = sqrt(state.globalMomentum().perp2());
234  double eta = state.globalMomentum().eta();
235  double phi = state.globalMomentum().phi();
236  double theta = state.globalMomentum().theta();
237  //double pm = sqrt(state.globalMomentum().mag2());
238  //double pz = state.globalMomentum().z();
239  //double qoverp = tsAtClosestApproachSeed.trackStateAtPCA().charge()/p.mag();
240  //double theta = p.theta();
241  //double lambda = M_PI/2-p.theta();
242  double numberOfHits = candidate.recHits().second-candidate.recHits().first;
243  double dxy = (-v.x()*sin(p.phi())+v.y()*cos(p.phi()));
244  double dz = v.z() - (v.x()*p.x()+v.y()*p.y())/p.perp() * p.z()/p.perp();
245 
246  // fill the ME's
247  SeedQ->Fill( state.charge() );
248  SeedPt->Fill( pt );
249  SeedEta->Fill( eta );
250  SeedPhi->Fill( phi );
251  SeedTheta->Fill( theta );
252  SeedDxy->Fill( dxy );
253  SeedDz->Fill( dz );
254  NumberOfRecHitsPerSeed->Fill( numberOfHits );
255  NumberOfRecHitsPerSeedVsEtaProfile->Fill( eta, numberOfHits );
256  NumberOfRecHitsPerSeedVsPhiProfile->Fill( phi, numberOfHits );
257 }
258 
259 // -- Analyse
260 // ---------------------------------------------------------------------------------//
262 (
263  const edm::Event& iEvent,
264  const edm::EventSetup& iSetup,
265  const TrackCandidate& candidate,
266  const reco::BeamSpot& bs,
267  const edm::ESHandle<MagneticField>& theMF,
269 )
270 {
271 
272  TrajectoryStateTransform tsTransform;
273  TSCBLBuilderNoMaterial tscblBuilder;
274 
275  //get parameters and errors from the candidate state
276  TransientTrackingRecHit::RecHitPointer recHit = theTTRHBuilder->build(&*(candidate.recHits().second-1));
277  TrajectoryStateOnSurface state = tsTransform.transientState( candidate.trajectoryStateOnDet(), recHit->surface(), theMF.product());
278  TrajectoryStateClosestToBeamLine tsAtClosestApproachTrackCand = tscblBuilder(*state.freeState(),bs);//as in TrackProducerAlgorithm
279  if(!(tsAtClosestApproachTrackCand.isValid())) {
280  edm::LogVerbatim("TrackBuilding") << "TrajectoryStateClosestToBeamLine not valid";
281  return;
282  }
283  GlobalPoint v0 = tsAtClosestApproachTrackCand.trackStateAtPCA().position();
284  GlobalVector p = tsAtClosestApproachTrackCand.trackStateAtPCA().momentum();
285  GlobalPoint v(v0.x()-bs.x0(),v0.y()-bs.y0(),v0.z()-bs.z0());
286 
287  double pt = sqrt(state.globalMomentum().perp2());
288  double eta = state.globalMomentum().eta();
289  double phi = state.globalMomentum().phi();
290  double theta = state.globalMomentum().theta();
291  //double pm = sqrt(state.globalMomentum().mag2());
292  //double pz = state.globalMomentum().z();
293  //double qoverp = tsAtClosestApproachTrackCand.trackStateAtPCA().charge()/p.mag();
294  //double theta = p.theta();
295  //double lambda = M_PI/2-p.theta();
296  double numberOfHits = candidate.recHits().second-candidate.recHits().first;
297  double dxy = (-v.x()*sin(p.phi())+v.y()*cos(p.phi()));
298  double dz = v.z() - (v.x()*p.x()+v.y()*p.y())/p.perp() * p.z()/p.perp();
299 
300  // fill the ME's
301  TrackCandQ->Fill( state.charge() );
302  TrackCandPt->Fill( pt );
303  TrackCandEta->Fill( eta );
304  TrackCandPhi->Fill( phi );
305  TrackCandTheta->Fill( theta );
306  TrackCandDxy->Fill( dxy );
307  TrackCandDz->Fill( dz );
308  NumberOfRecHitsPerTrackCand->Fill( numberOfHits );
309  NumberOfRecHitsPerTrackCandVsEtaProfile->Fill( eta, numberOfHits );
310  NumberOfRecHitsPerTrackCandVsPhiProfile->Fill( phi, numberOfHits );
311 }
MonitorElement * NumberOfRecHitsPerTrackCandVsPhiProfile
MonitorElement * TrackCandPt
T getParameter(std::string const &) const
double z0() const
z coordinate
Definition: BeamSpot.h:69
T perp() const
Definition: PV3DBase.h:66
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:519
range recHits() const
MonitorElement * TrackCandDz
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Phi< T > phi() const
Definition: PV3DBase.h:63
T y() const
Definition: PV3DBase.h:57
#define NULL
Definition: scimark2.h:8
Geom::Theta< T > theta() const
T perp2() const
Definition: PV3DBase.h:65
MonitorElement * TrackCandPhi
T eta() const
Geom::Theta< T > theta() const
Definition: PV3DBase.h:69
MonitorElement * NumberOfRecHitsPerTrackCandVsEtaProfile
PTrajectoryStateOnDet const & trajectoryStateOnDet() const
MonitorElement * NumberOfRecHitsPerSeed
virtual void analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup, const TrajectorySeed &seed, const reco::BeamSpot &bs, const edm::ESHandle< MagneticField > &theMF, const edm::ESHandle< TransientTrackingRecHitBuilder > &theTTRHBuilder)
int iEvent
Definition: GenABIO.cc:243
MonitorElement * NumberOfRecHitsPerSeedVsPhiProfile
FreeTrajectoryState * freeState(bool withErrors=true) const
MonitorElement * TrackCandDxy
T sqrt(T t)
Definition: SSEVec.h:28
T z() const
Definition: PV3DBase.h:58
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
MonitorElement * TrackCandEta
TrajectoryStateOnSurface transientState(const PTrajectoryStateOnDet &ts, const Surface *surface, const MagneticField *field) const
MonitorElement * bookProfile(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, const char *option="s")
Definition: DQMStore.cc:833
TrackBuildingAnalyzer(const edm::ParameterSet &)
GlobalVector momentum() const
virtual void beginJob(DQMStore *dqmStore_)
GlobalPoint position() const
PTrajectoryStateOnDet const & startingState() const
T const * product() const
Definition: ESHandle.h:62
range recHits() const
MonitorElement * TrackCandTheta
char state
Definition: procUtils.cc:75
T eta() const
Definition: PV3DBase.h:70
GlobalVector globalMomentum() const
double y0() const
y coordinate
Definition: BeamSpot.h:67
MonitorElement * NumberOfRecHitsPerSeedVsEtaProfile
T x() const
Definition: PV3DBase.h:56
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
MonitorElement * NumberOfRecHitsPerTrackCand
mathSSE::Vec4< T > v
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:237
double x0() const
x coordinate
Definition: BeamSpot.h:65
Definition: DDAxes.h:10