CMS 3D CMS Logo

OuterTrackerMonitorTTTrack.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Phase2OuterTracker
4 // Class: Phase2OuterTracker
5 //
13 //
14 // Original Author: Isis Marina Van Parijs
15 // Created: Mon, 16 Feb 2014 15:49:32 GMT
16 //
17 
18 // system include files
19 #include <memory>
20 #include <vector>
21 #include <numeric>
22 #include <iostream>
23 #include <fstream>
24 
25 // user include files
29 //#include "DataFormats/L1TrackTrigger/interface/TTTrack.h" // does not exist yet in 81X
34 
35 
36 //
37 // constructors and destructor
38 //
40 : dqmStore_(edm::Service<DQMStore>().operator->()), conf_(iConfig)
41 {
42  topFolderName_ = conf_.getParameter<std::string>("TopFolderName");
43  //tagTTTracksToken_ = consumes<edmNew::DetSetVector< TTTrack< Ref_Phase2TrackerDigi_ > > > (conf_.getParameter<edm::InputTag>("TTTracks") );
44  HQDelim_ = conf_.getParameter<int>("HQDelim");
45 }
46 
48 {
49  // do anything here that needs to be done at desctruction time
50  // (e.g. close files, deallocate resources etc.)
51 }
52 
53 //
54 // member functions
55 //
56 
57 // ------------ method called for each event ------------
59 {
60  /*
62  edm::Handle< std::vector< TTTrack< Ref_Phase2TrackerDigi_ > > > Phase2TrackerDigiTTTrackHandle;
63  iEvent.getByToken( tagTTTracksToken_, Phase2TrackerDigiTTTrackHandle );
64 
65  unsigned int numHQTracks = 0;
66  unsigned int numLQTracks = 0;
67  unsigned int numTracks = 0;
68 
70  if ( Phase2TrackerDigiTTTrackHandle->size() > 0 )
71  {
73  unsigned int tkCnt = 0;
74  std::vector< TTTrack< Ref_Phase2TrackerDigi_ > >::const_iterator iterTTTrack;
75  for ( iterTTTrack = Phase2TrackerDigiTTTrackHandle->begin();iterTTTrack != Phase2TrackerDigiTTTrackHandle->end();++iterTTTrack )
76  {
78  edm::Ptr< TTTrack< Ref_Phase2TrackerDigi_ > > tempTrackPtr( Phase2TrackerDigiTTTrackHandle, tkCnt++ );
79  numTracks++;
80 
81  unsigned int nStubs = tempTrackPtr->getStubRefs().size();
82 
83  double trackPt = tempTrackPtr->getMomentum().perp();
84  double trackPhi = tempTrackPtr->getMomentum().phi();
85  double trackEta = tempTrackPtr->getMomentum().eta();
86  double trackVtxZ0 = tempTrackPtr->getPOCA().z();
87  double trackChi2 = tempTrackPtr->getChi2();
88  double trackChi2R = tempTrackPtr->getChi2Red();
89 
90  Track_NStubs->Fill(nStubs);
91 
92  if ( nStubs >= HQDelim_ )
93  {
94  numHQTracks++;
95 
96  Track_HQ_Pt->Fill( trackPt );
97  Track_HQ_Eta->Fill( trackEta );
98  Track_HQ_Phi->Fill( trackPhi );
99  Track_HQ_VtxZ0->Fill( trackVtxZ0 );
100  Track_HQ_Chi2->Fill( trackChi2 );
101  Track_HQ_Chi2Red->Fill( trackChi2R );
102 
103  Track_HQ_Chi2_NStubs->Fill( nStubs, trackChi2 );
104  Track_HQ_Chi2Red_NStubs->Fill( nStubs, trackChi2R );
105  }
106  else
107  {
108  numLQTracks++;
109 
110  Track_LQ_Pt->Fill( trackPt );
111  Track_LQ_Eta->Fill( trackEta );
112  Track_LQ_Phi->Fill( trackPhi );
113  Track_LQ_VtxZ0->Fill( trackVtxZ0 );
114  Track_LQ_Chi2->Fill( trackChi2 );
115  Track_LQ_Chi2Red->Fill( trackChi2R );
116 
117  Track_LQ_Chi2_NStubs->Fill( nStubs, trackChi2 );
118  Track_LQ_Chi2Red_NStubs->Fill( nStubs, trackChi2R );
119  }
120  } // End of loop over TTTracks
121 
122  } // End TTTracks from pixeldigis
123 
124  Track_N->Fill(numTracks);
125  Track_HQ_N->Fill( numHQTracks );
126  Track_LQ_N->Fill( numLQTracks );
127  */
128 } // end of method
129 
130 
131 // ------------ method called once each job just before starting event loop ------------
132 void
134 {
136 
138 
139  //Nb of tracks
140  edm::ParameterSet psTrack_N = conf_.getParameter<edm::ParameterSet>("TH1_NTracks");
141  HistoName = "Track_N";
142  Track_N = dqmStore_->book1D(HistoName, HistoName,
143  psTrack_N.getParameter<int32_t>("Nbinsx"),
144  psTrack_N.getParameter<double>("xmin"),
145  psTrack_N.getParameter<double>("xmax"));
146  Track_N->setAxisTitle("# L1 Tracks", 1);
147  Track_N->setAxisTitle("# Events", 2);
148 
149  //Nb of stubs
150  edm::ParameterSet psTrack_NStubs = conf_.getParameter<edm::ParameterSet>("TH1_NStubs");
151  HistoName = "Track_NStubs";
152  Track_NStubs = dqmStore_->book1D(HistoName, HistoName,
153  psTrack_NStubs.getParameter<int32_t>("Nbinsx"),
154  psTrack_NStubs.getParameter<double>("xmin"),
155  psTrack_NStubs.getParameter<double>("xmax"));
156  Track_NStubs->setAxisTitle("# L1 Stubs per L1 Track", 1);
157  Track_NStubs->setAxisTitle("# L1 Tracks", 2);
158 
159 
162 
163  // Nb of L1Tracks
164  HistoName = "Track_LQ_N";
165  Track_LQ_N = dqmStore_->book1D(HistoName, HistoName,
166  psTrack_N.getParameter<int32_t>("Nbinsx"),
167  psTrack_N.getParameter<double>("xmin"),
168  psTrack_N.getParameter<double>("xmax"));
169  Track_LQ_N->setAxisTitle("# L1 Tracks", 1);
170  Track_LQ_N->setAxisTitle("# Events", 2);
171 
172  //Pt of the tracks
173  edm::ParameterSet psTrack_Pt = conf_.getParameter<edm::ParameterSet>("TH1_Track_Pt");
174  HistoName = "Track_LQ_Pt";
175  Track_LQ_Pt = dqmStore_->book1D(HistoName, HistoName,
176  psTrack_Pt.getParameter<int32_t>("Nbinsx"),
177  psTrack_Pt.getParameter<double>("xmin"),
178  psTrack_Pt.getParameter<double>("xmax"));
179  Track_LQ_Pt->setAxisTitle("p_{T} [GeV]", 1);
180  Track_LQ_Pt->setAxisTitle("# L1 Tracks", 2);
181 
182  //Phi
183  edm::ParameterSet psTrack_Phi = conf_.getParameter<edm::ParameterSet>("TH1_Track_Phi");
184  HistoName = "Track_LQ_Phi";
185  Track_LQ_Phi = dqmStore_->book1D(HistoName, HistoName,
186  psTrack_Phi.getParameter<int32_t>("Nbinsx"),
187  psTrack_Phi.getParameter<double>("xmin"),
188  psTrack_Phi.getParameter<double>("xmax"));
189  Track_LQ_Phi->setAxisTitle("#phi", 1);
190  Track_LQ_Phi->setAxisTitle("# L1 Tracks", 2);
191 
192  //Eta
193  edm::ParameterSet psTrack_Eta = conf_.getParameter<edm::ParameterSet>("TH1_Track_Eta");
194  HistoName = "Track_LQ_Eta";
195  Track_LQ_Eta = dqmStore_->book1D(HistoName, HistoName,
196  psTrack_Eta.getParameter<int32_t>("Nbinsx"),
197  psTrack_Eta.getParameter<double>("xmin"),
198  psTrack_Eta.getParameter<double>("xmax"));
199  Track_LQ_Eta->setAxisTitle("#eta", 1);
200  Track_LQ_Eta->setAxisTitle("# L1 Tracks", 2);
201 
202  //VtxZ0
203  edm::ParameterSet psTrack_VtxZ0 = conf_.getParameter<edm::ParameterSet>("TH1_Track_VtxZ0");
204  HistoName = "Track_LQ_VtxZ0";
205  Track_LQ_VtxZ0 = dqmStore_->book1D(HistoName, HistoName,
206  psTrack_VtxZ0.getParameter<int32_t>("Nbinsx"),
207  psTrack_VtxZ0.getParameter<double>("xmin"),
208  psTrack_VtxZ0.getParameter<double>("xmax"));
209  Track_LQ_VtxZ0->setAxisTitle("L1 Track vertex position z [cm]", 1);
210  Track_LQ_VtxZ0->setAxisTitle("# L1 Tracks", 2);
211 
212  //chi2
213  edm::ParameterSet psTrack_Chi2 = conf_.getParameter<edm::ParameterSet>("TH1_Track_Chi2");
214  HistoName = "Track_LQ_Chi2";
215  Track_LQ_Chi2 = dqmStore_->book1D(HistoName, HistoName,
216  psTrack_Chi2.getParameter<int32_t>("Nbinsx"),
217  psTrack_Chi2.getParameter<double>("xmin"),
218  psTrack_Chi2.getParameter<double>("xmax"));
219  Track_LQ_Chi2->setAxisTitle("L1 Track #chi^{2}", 1);
220  Track_LQ_Chi2->setAxisTitle("# L1 Tracks", 2);
221 
222  //chi2Red
223  edm::ParameterSet psTrack_Chi2Red = conf_.getParameter<edm::ParameterSet>("TH1_Track_Chi2R");
224  HistoName = "Track_LQ_Chi2Red";
225  Track_LQ_Chi2Red = dqmStore_->book1D(HistoName, HistoName,
226  psTrack_Chi2Red.getParameter<int32_t>("Nbinsx"),
227  psTrack_Chi2Red.getParameter<double>("xmin"),
228  psTrack_Chi2Red.getParameter<double>("xmax"));
229  Track_LQ_Chi2Red->setAxisTitle("L1 Track #chi^{2}/ndf", 1);
230  Track_LQ_Chi2Red->setAxisTitle("# L1 Tracks", 2);
231 
232  edm::ParameterSet psTrack_Chi2_NStubs = conf_.getParameter<edm::ParameterSet>("TH2_Track_Chi2_NStubs");
233  HistoName = "Track_LQ_Chi2_NStubs";
234  Track_LQ_Chi2_NStubs = dqmStore_->book2D(HistoName, HistoName,
235  psTrack_Chi2_NStubs.getParameter<int32_t>("Nbinsx"),
236  psTrack_Chi2_NStubs.getParameter<double>("xmin"),
237  psTrack_Chi2_NStubs.getParameter<double>("xmax"),
238  psTrack_Chi2_NStubs.getParameter<int32_t>("Nbinsy"),
239  psTrack_Chi2_NStubs.getParameter<double>("ymin"),
240  psTrack_Chi2_NStubs.getParameter<double>("ymax"));
241  Track_LQ_Chi2_NStubs->setAxisTitle("# L1 Stubs", 1);
242  Track_LQ_Chi2_NStubs->setAxisTitle("L1 Track #chi^{2}", 2);
243 
244  edm::ParameterSet psTrack_Chi2Red_NStubs = conf_.getParameter<edm::ParameterSet>("TH2_Track_Chi2R_NStubs");
245  HistoName = "Track_LQ_Chi2Red_NStubs";
246  Track_LQ_Chi2Red_NStubs = dqmStore_->book2D(HistoName, HistoName,
247  psTrack_Chi2Red_NStubs.getParameter<int32_t>("Nbinsx"),
248  psTrack_Chi2Red_NStubs.getParameter<double>("xmin"),
249  psTrack_Chi2Red_NStubs.getParameter<double>("xmax"),
250  psTrack_Chi2Red_NStubs.getParameter<int32_t>("Nbinsy"),
251  psTrack_Chi2Red_NStubs.getParameter<double>("ymin"),
252  psTrack_Chi2Red_NStubs.getParameter<double>("ymax"));
253  Track_LQ_Chi2Red_NStubs->setAxisTitle("# L1 Stubs", 1);
254  Track_LQ_Chi2Red_NStubs->setAxisTitle("L1 Track #chi^{2}/ndf", 2);
255 
256 
259 
260  // Nb of L1Tracks
261  HistoName = "Track_HQ_N";
262  Track_HQ_N = dqmStore_->book1D(HistoName, HistoName,
263  psTrack_N.getParameter<int32_t>("Nbinsx"),
264  psTrack_N.getParameter<double>("xmin"),
265  psTrack_N.getParameter<double>("xmax"));
266  Track_HQ_N->setAxisTitle("# L1 Tracks", 1);
267  Track_HQ_N->setAxisTitle("# Events", 2);
268 
269  //Pt of the tracks
270  HistoName = "Track_HQ_Pt";
271  Track_HQ_Pt = dqmStore_->book1D(HistoName, HistoName,
272  psTrack_Pt.getParameter<int32_t>("Nbinsx"),
273  psTrack_Pt.getParameter<double>("xmin"),
274  psTrack_Pt.getParameter<double>("xmax"));
275  Track_HQ_Pt->setAxisTitle("p_{T} [GeV]", 1);
276  Track_HQ_Pt->setAxisTitle("# L1 Tracks", 2);
277 
278  //Phi
279  HistoName = "Track_HQ_Phi";
280  Track_HQ_Phi = dqmStore_->book1D(HistoName, HistoName,
281  psTrack_Phi.getParameter<int32_t>("Nbinsx"),
282  psTrack_Phi.getParameter<double>("xmin"),
283  psTrack_Phi.getParameter<double>("xmax"));
284  Track_HQ_Phi->setAxisTitle("#phi", 1);
285  Track_HQ_Phi->setAxisTitle("# L1 Tracks", 2);
286 
287  //Eta
288  HistoName = "Track_HQ_Eta";
289  Track_HQ_Eta = dqmStore_->book1D(HistoName, HistoName,
290  psTrack_Eta.getParameter<int32_t>("Nbinsx"),
291  psTrack_Eta.getParameter<double>("xmin"),
292  psTrack_Eta.getParameter<double>("xmax"));
293  Track_HQ_Eta->setAxisTitle("#eta", 1);
294  Track_HQ_Eta->setAxisTitle("# L1 Tracks", 2);
295 
296  //VtxZ0
297  HistoName = "Track_HQ_VtxZ0";
298  Track_HQ_VtxZ0 = dqmStore_->book1D(HistoName, HistoName,
299  psTrack_VtxZ0.getParameter<int32_t>("Nbinsx"),
300  psTrack_VtxZ0.getParameter<double>("xmin"),
301  psTrack_VtxZ0.getParameter<double>("xmax"));
302  Track_HQ_VtxZ0->setAxisTitle("L1 Track vertex position z [cm]", 1);
303  Track_HQ_VtxZ0->setAxisTitle("# L1 Tracks", 2);
304 
305  //chi2
306  HistoName = "Track_HQ_Chi2";
307  Track_HQ_Chi2 = dqmStore_->book1D(HistoName, HistoName,
308  psTrack_Chi2.getParameter<int32_t>("Nbinsx"),
309  psTrack_Chi2.getParameter<double>("xmin"),
310  psTrack_Chi2.getParameter<double>("xmax"));
311  Track_HQ_Chi2->setAxisTitle("L1 Track #chi^{2}", 1);
312  Track_HQ_Chi2->setAxisTitle("# L1 Tracks", 2);
313 
314  //chi2Red
315  HistoName = "Track_HQ_Chi2Red";
316  Track_HQ_Chi2Red = dqmStore_->book1D(HistoName, HistoName,
317  psTrack_Chi2Red.getParameter<int32_t>("Nbinsx"),
318  psTrack_Chi2Red.getParameter<double>("xmin"),
319  psTrack_Chi2Red.getParameter<double>("xmax"));
320  Track_HQ_Chi2Red->setAxisTitle("L1 Track #chi^{2}/ndf", 1);
321  Track_HQ_Chi2Red->setAxisTitle("# L1 Tracks", 2);
322 
323  HistoName = "Track_HQ_Chi2_NStubs";
324  Track_HQ_Chi2_NStubs = dqmStore_->book2D(HistoName, HistoName,
325  psTrack_Chi2_NStubs.getParameter<int32_t>("Nbinsx"),
326  psTrack_Chi2_NStubs.getParameter<double>("xmin"),
327  psTrack_Chi2_NStubs.getParameter<double>("xmax"),
328  psTrack_Chi2_NStubs.getParameter<int32_t>("Nbinsy"),
329  psTrack_Chi2_NStubs.getParameter<double>("ymin"),
330  psTrack_Chi2_NStubs.getParameter<double>("ymax"));
331  Track_HQ_Chi2_NStubs->setAxisTitle("# L1 Stubs", 1);
332  Track_HQ_Chi2_NStubs->setAxisTitle("L1 Track #chi^{2}", 2);
333 
334  HistoName = "Track_HQ_Chi2Red_NStubs";
335  Track_HQ_Chi2Red_NStubs = dqmStore_->book2D(HistoName, HistoName,
336  psTrack_Chi2Red_NStubs.getParameter<int32_t>("Nbinsx"),
337  psTrack_Chi2Red_NStubs.getParameter<double>("xmin"),
338  psTrack_Chi2Red_NStubs.getParameter<double>("xmax"),
339  psTrack_Chi2Red_NStubs.getParameter<int32_t>("Nbinsy"),
340  psTrack_Chi2Red_NStubs.getParameter<double>("ymin"),
341  psTrack_Chi2Red_NStubs.getParameter<double>("ymax"));
342  Track_HQ_Chi2Red_NStubs->setAxisTitle("# L1 Stubs", 1);
343  Track_HQ_Chi2Red_NStubs->setAxisTitle("L1 Track #chi^{2}/ndf", 2);
344 
345 }//end of method
346 
347 // ------------ method called once each job just after ending the event loop ------------
348 void
350 {
351 
352 }
353 
T getParameter(std::string const &) const
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:1035
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
int iEvent
Definition: GenABIO.cc:230
virtual void analyze(const edm::Event &, const edm::EventSetup &)
MonitorElement * Track_HQ_N
High-quality TTTracks (made from at least X TTStubs)
OuterTrackerMonitorTTTrack(const edm::ParameterSet &)
MonitorElement * Track_LQ_N
Low-quality TTTracks (made from less than X TTStubs)
std::string HistoName
HLT enums.
virtual void beginRun(const edm::Run &, const edm::EventSetup &)
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:1163
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:741
Definition: Run.h:42