CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SiStripTrackingRecHitsValid.cc
Go to the documentation of this file.
1 // File: SiStripTrackingRecHitsValid.cc
2 // // Author: Arnaud Gay.
3 // Creation Date: July 2006.
4 //
5 //--------------------------------------------
6 
7 #include <memory>
8 #include <string>
9 #include <iostream>
10 #include <TMath.h>
12 
16 
18 
23 
33 
36 
38 
39 using namespace std;
40 
41 // ROOT
42 #include "TROOT.h"
43 #include "TFile.h"
44 #include "TTree.h"
45 #include "TBranch.h"
46 #include "TH1.h"
47 #include "TH2.h"
48 class TFile;
49 
51 {
52 
53  conf_ = ps;
54 
55  // slices
56 
57  //Read config file
58  //MTCCtrack_ = ps.getParameter<bool>("MTCCtrack");
59  outputFile_ = ps.getUntrackedParameter<string>("outputFile", "striptrackingrechitshisto.root");
60  //src_ = ps.getUntrackedParameter<std::string>( "src" );
61  //builderName_ = ps.getParameter<std::string>("TTRHBuilder");
62 
63  // Book histograms
65  // dbe_->showDirStructure();
66 
67  dbe_->setCurrentFolder("Tracking/TrackingRecHits/Strip/ALL");
68 
69  Char_t histo[200];
70 
71  sprintf(histo,"Errx_LF");
72  meErrxLF = dbe_->book1D(histo,"RecHit err(x) Local Frame coord.",100,0,0.005);
73  // const float Entries1 = meErrxLF->getEntries();
74 
75  sprintf(histo,"Errx_MF");
76  meErrxMF = dbe_->book1D(histo,"RecHit err(x) Meas. Frame coord.",100,0,0.5);
77 
78  sprintf(histo,"Res_LF");
79  meResLF = dbe_->book1D(histo,"RecHit Residual",100,-0.02,+0.02);
80 
81  sprintf(histo,"Res_MF");
82  meResMF = dbe_->book1D(histo,"RecHit Residual",100,-2,+2);
83 
84  sprintf(histo,"Pull_LF");
85  mePullLF = dbe_->book1D(histo,"Pull",100,-5.,5.);
86 
87  sprintf(histo,"Pull_MF");
88  mePullMF = dbe_->book1D(histo,"Pull",100,-5.,5.);
89 
90  sprintf(histo,"Category");
91  meCategory = dbe_->book1D(histo,"Cluster Category",10,0.,10.);
92 
93  sprintf(histo,"Trackwidth");
94  meTrackwidth = dbe_->book1D(histo,"Track width",100,0.,4.);
95 
96  sprintf(histo,"Expectedwidth");
97  meExpectedwidth = dbe_->book1D(histo,"Expected width",10,0.,10.);
98 
99  sprintf(histo,"Clusterwidth");
100  meClusterwidth = dbe_->book1D(histo,"Cluster width",10,0.,10.);
101 
102  sprintf(histo,"Trackanglealpha");
103  meTrackanglealpha = dbe_->book1D(histo,"Track angle alpha",100,-100.,100.);
104 
105  sprintf(histo,"Trackanglebeta");
106  meTrackanglebeta = dbe_->book1D(histo,"Track angle beta",100,-100.,100.);
107 
108  sprintf(histo,"ErrxMFTrackwidthProfile_WClus1");
109  meErrxMFTrackwidthProfileWClus1 = dbe_->bookProfile(histo,"Resolution Track width Profile", 12, 0., 4.,100, 0.,2.,"s");
110 
111  sprintf(histo,"ErrxMFTrackwidthProfile_WClus2");
112  meErrxMFTrackwidthProfileWClus2 = dbe_->bookProfile(histo,"Resolution Track width Profile", 12, 0., 4.,100, 0.,2.,"");
113 
114  sprintf(histo,"ErrxMFTrackwidthProfile_WClus3");
115  meErrxMFTrackwidthProfileWClus3 = dbe_->bookProfile(histo,"Resolution Track width Profile", 12, 0., 4.,100, 0.,2.,"s");
116 
117  sprintf(histo,"ErrxMFTrackwidthProfile_WClus4");
118  meErrxMFTrackwidthProfileWClus4 = dbe_->bookProfile(histo,"Resolution Track width Profile", 12, 0., 4.,100, 0.,2.,"s");
119 
120  sprintf(histo,"ResMFTrackwidthProfile_WClus1");
121  meResMFTrackwidthProfileWClus1 = dbe_->bookProfile(histo,"Resolution Track width Profile", 12, 0., 4.,100, 0.,2.,"s");
122 
123  sprintf(histo,"ResMFTrackwidthProfile_WClus2");
124  meResMFTrackwidthProfileWClus2 = dbe_->bookProfile(histo,"Resolution Track width Profile", 12, 0., 4.,100, 0.,2.,"");
125  sprintf(histo,"ResMFTrackwidthProfile_WClus21");
126  meResMFTrackwidthProfileWClus21 = dbe_->bookProfile(histo,"Resolution Track width Profile", 12, 0., 4.,100, -2.,2.,"");
127  sprintf(histo,"ResMFTrackwidthProfile_WClus22");
128  meResMFTrackwidthProfileWClus22 = dbe_->bookProfile(histo,"Resolution Track width Profile", 12, 0., 4.,100, -5.,5.,"");
129  sprintf(histo,"ResMFTrackwidthProfile_WClus23");
130  meResMFTrackwidthProfileWClus23 = dbe_->bookProfile(histo,"Resolution Track width Profile", 12, 0., 4.,100, -0.5,0.5,"");
131  //sprintf(histo,"ResMFTrackwidthProfile_WClus2");
132  //meResMFTrackwidthProfileWClus22 = dbe_->bookProfile(histo,"Resolution Track width Profile", 12, 0., 4., 0.,2.,"s");
133 
134  sprintf(histo,"ResMFTrackwidthProfile_WClus3");
135  meResMFTrackwidthProfileWClus3 = dbe_->bookProfile(histo,"Resolution Track width Profile", 12, 0., 4.,100, 0.,2.,"s");
136 
137  sprintf(histo,"ResMFTrackwidthProfile_WClus4");
138  meResMFTrackwidthProfileWClus4 = dbe_->bookProfile(histo,"Resolution Track width Profile", 12, 0., 4.,100, 0.,2.,"s");
139 
140  sprintf(histo,"ErrxMFTrackwidthProfile");
141  meErrxMFTrackwidthProfile = dbe_->bookProfile(histo,"Resolution Track width Profile", 12, 0., 4.,100, 0.,2.,"s");
142 
143  sprintf(histo,"ErrxMFTrackwidthProfile_Category1");
144  meErrxMFTrackwidthProfileCategory1 = dbe_->bookProfile(histo,"Resolution Track width Profile Category1", 12, 0., 4.,100, -2.,2.,"s");
145  sprintf(histo,"ErrxMFTrackwidthProfile_Category2");
146  meErrxMFTrackwidthProfileCategory2 = dbe_->bookProfile(histo,"Resolution Track width Profile Category2", 12, 0., 4.,100, -2.,2.,"s");
147 
148  sprintf(histo,"ErrxMFTrackwidthProfile_Category3");
149  meErrxMFTrackwidthProfileCategory3 = dbe_->bookProfile(histo,"Resolution Track width Profile Category3", 12, 0., 4.,100, -2.,2.,"s");
150 
151  sprintf(histo,"ErrxMFTrackwidthProfile_Category4");
152  meErrxMFTrackwidthProfileCategory4 = dbe_->bookProfile(histo,"Resolution Track width Profile Category4", 12, 0., 4.,100, -2.,2.,"s");
153 
154  sprintf(histo,"ErrxMFClusterwidthProfile_Category1");
155  meErrxMFClusterwidthProfileCategory1= dbe_->bookProfile(histo,"Resolution Cluster width Profile Category1", 100, 0., 10.,100, -2.,2.,"s");
156 
157  sprintf(histo,"ErrxMFAngleProfile");
158  meErrxMFAngleProfile = dbe_->bookProfile(histo,"Resolution Angle Profile", 100, 0., 60.,100, 0.,2.,"s");
159 
160  dbe_->setCurrentFolder("Tracking/TrackingRecHits/Strip/TIB");
161  //one histo per Layer rphi hits
162  for(int i = 0 ;i<4 ; i++) {
163  Char_t histo[200];
164  sprintf(histo,"Nstp_rphi_layer%dtib",i+1);
165  meNstpRphiTIB[i] = dbe_->book1D(histo,"RecHit Cluster Size",20,0.5,20.5);
166  sprintf(histo,"Adc_rphi_layer%dtib",i+1);
167  meAdcRphiTIB[i] = dbe_->book1D(histo,"RecHit Cluster Charge",100,0.,300.);
168  sprintf(histo,"Posx_rphi_layer%dtib",i+1);
169  mePosxRphiTIB[i] = dbe_->book1D(histo,"RecHit x coord.",100,-6.0,+6.0);
170 
171  sprintf(histo,"Errx_LF_rphi_layer%dtib",i+1);
172  meErrxLFRphiTIB[i] = dbe_->book1D(histo,"RecHit err(x) Local Frame coord.",100,0,0.005);
173  sprintf(histo,"Errx_MF_rphi_layer%dtib",i+1);
174  meErrxMFRphiTIB[i] = dbe_->book1D(histo,"RecHit err(x) Meas. Frame coord.",100,0,0.5);
175 
176  sprintf(histo,"Res_LF_rphi_layer%dtib",i+1);
177  meResLFRphiTIB[i] = dbe_->book1D(histo,"RecHit Residual",100,-0.02,+0.02);
178  sprintf(histo,"Res_MF_rphi_layer%dtib",i+1);
179  meResMFRphiTIB[i] = dbe_->book1D(histo,"RecHit Residual",100,-2,+2);
180 
181  sprintf(histo,"Pull_LF_rphi_layer%dtib",i+1);
182  mePullLFRphiTIB[i] = dbe_->book1D(histo,"Pull",100,-5.,5.);
183  sprintf(histo,"Pull_MF_rphi_layer%dtib",i+1);
184  mePullMFRphiTIB[i] = dbe_->book1D(histo,"Pull",100,-5.,5.);
185 
186  sprintf(histo,"Trackangle_rphi_layer%dtib",i+1);
187  meTrackangleRphiTIB[i] = dbe_->book1D(histo,"Track angle",100,-20.,20.);
188 
189  sprintf(histo,"Trackanglebeta_rphi_layer%dtib",i+1);
190  meTrackanglebetaRphiTIB[i] = dbe_->book1D(histo,"Track angle beta",100,-20.,20.);
191 
192  sprintf(histo,"Trackangle2_rphi_layer%dtib",i+1);
193  meTrackangle2RphiTIB[i] = dbe_->book1D(histo,"Track angle",100,-20.,20.);
194 
195  sprintf(histo,"PullTrackangleProfile_rphi_layer%dtib",i+1);
196  mePullTrackangleProfileRphiTIB[i] = dbe_->bookProfile(histo,"Pull Track angle Profile", 100, -20., 20.,100, -2.,2.,"s");
197 
198  sprintf(histo,"Trackwidth_rphi_layer%dtib",i+1);
199  meTrackwidthRphiTIB[i] = dbe_->book1D(histo,"Track width",100,0.,1.);
200 
201  sprintf(histo,"Expectedwidth_rphi_layer%dtib",i+1);
202  meExpectedwidthRphiTIB[i] = dbe_->book1D(histo,"Expected width",10,0.,10.);
203 
204  sprintf(histo,"Clusterwidth_rphi_layer%dtib",i+1);
205  meClusterwidthRphiTIB[i] = dbe_->book1D(histo,"Cluster width",10,0.,10.);
206 
207  sprintf(histo,"Category_rphi_layer%dtib",i+1);
208  meCategoryRphiTIB[i] = dbe_->book1D(histo,"Cluster Category",10,0.,10.);
209 
210  sprintf(histo,"PullTrackwidthProfile_rphi_layer%dtib",i+1);
211  mePullTrackwidthProfileRphiTIB[i] = dbe_->bookProfile(histo,"Pull Track width Profile", 100, 0., 1.,100, -2.,2.,"s");
212 
213  sprintf(histo,"PullTrackwidthProfile_Category1_rphi_layer%dtib",i+1);
214  mePullTrackwidthProfileCategory1RphiTIB[i] = dbe_->bookProfile(histo,"Pull Track width Profile Category1", 100, 0., 1.,100, -2.,2.,"s");
215 
216  sprintf(histo,"PullTrackwidthProfile_Category2_rphi_layer%dtib",i+1);
217  mePullTrackwidthProfileCategory2RphiTIB[i] = dbe_->bookProfile(histo,"Pull Track width Profile Category2", 100, 0., 1.,100, -2.,2.,"s");
218 
219  sprintf(histo,"PullTrackwidthProfile_Category3_rphi_layer%dtib",i+1);
220  mePullTrackwidthProfileCategory3RphiTIB[i] = dbe_->bookProfile(histo,"Pull Track width Profile Category3", 100, 0., 1.,100, -2.,2.,"s");
221 
222  sprintf(histo,"PullTrackwidthProfile_Category4_rphi_layer%dtib",i+1);
223  mePullTrackwidthProfileCategory4RphiTIB[i] = dbe_->bookProfile(histo,"Pull Track width Profile Category4", 100, 0., 1.,100, -2.,2.,"s");
224 
225  sprintf(histo,"ErrxMFTrackwidthProfile_rphi_layer%dtib",i+1);
226  meErrxMFTrackwidthProfileRphiTIB[i] = dbe_->bookProfile(histo,"Resolution Track width Profile", 12, 0., 4.,100, -2.,2.,"s");
227 
228 
229  sprintf(histo,"ErrxMFTrackwidthProfile_WClus1_rphi_layer%dtib",i+1);
230  meErrxMFTrackwidthProfileWclus1RphiTIB[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Wclus1", 12, 0., 4.,100, -2.,2.,"s");
231 
232  sprintf(histo,"ErrxMFTrackwidthProfile_WClus2_rphi_layer%dtib",i+1);
233  meErrxMFTrackwidthProfileWclus2RphiTIB[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Wclus1", 12, 0., 4.,100, -2.,2.,"s");
234 
235  sprintf(histo,"ErrxMFTrackwidthProfile_WClus3_rphi_layer%dtib",i+1);
236  meErrxMFTrackwidthProfileWclus3RphiTIB[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Wclus1", 12, 0., 4.,100, -2.,2.,"s");
237 
238  sprintf(histo,"ErrxMFTrackwidthProfile_WClus4_rphi_layer%dtib",i+1);
239  meErrxMFTrackwidthProfileWclus4RphiTIB[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Wclus1", 12, 0., 4.,100, -2.,2.,"s");
240 
241  sprintf(histo,"ResMFTrackwidthProfile_WClus1_rphi_layer%dtib",i+1);
242  meResMFTrackwidthProfileWclus1RphiTIB[i] = dbe_->bookProfile(histo,"Residue Track width Profile Wclus1", 12, 0., 4.,100, -2.,2.,"s");
243  sprintf(histo,"ResMFTrackwidthProfile_WClus2_rphi_layer%dtib",i+1);
244  meResMFTrackwidthProfileWclus2RphiTIB[i] = dbe_->bookProfile(histo,"Residue Track width Profile Wclus1", 12, 0., 4.,100, -2.,2.,"s");
245 
246  sprintf(histo,"ResMFTrackwidthProfile_WClus3_rphi_layer%dtib",i+1);
247  meResMFTrackwidthProfileWclus3RphiTIB[i] = dbe_->bookProfile(histo,"Residue Track width Profile Wclus1", 12, 0., 4.,100, -2.,2.,"s");
248 
249  sprintf(histo,"ResMFTrackwidthProfile_WClus4_rphi_layer%dtib",i+1);
250  meResMFTrackwidthProfileWclus4RphiTIB[i] = dbe_->bookProfile(histo,"Residue Track width Profile Wclus1", 12, 0., 4.,100, -2.,2.,"s");
251 
252 
253 
254  sprintf(histo,"ErrxMFTrackwidthProfile_Category1_rphi_layer%dtib",i+1);
255  meErrxMFTrackwidthProfileCategory1RphiTIB[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Category1", 12, 0., 4.,100, -2.,2.,"s");
256 
257  sprintf(histo,"ErrxMFTrackwidthProfile_Category2_rphi_layer%dtib",i+1);
258  meErrxMFTrackwidthProfileCategory2RphiTIB[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Category2", 12, 0., 4.,100, -2.,2.,"s");
259 
260  sprintf(histo,"ErrxMFTrackwidthProfile_Category3_rphi_layer%dtib",i+1);
261  meErrxMFTrackwidthProfileCategory3RphiTIB[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Category3", 12, 0., 4.,100, -2.,2.,"s");
262 
263  sprintf(histo,"ErrxMFTrackwidthProfile_Category4_rphi_layer%dtib",i+1);
264  meErrxMFTrackwidthProfileCategory4RphiTIB[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Category4", 12, 0., 4.,100, -2.,2.,"s");
265 
266  sprintf(histo,"ErrxMFAngleProfile_rphi_layer%dtib",i+1);
267  meErrxMFAngleProfileRphiTIB[i] = dbe_->bookProfile(histo,"Resolution Angle Profile", 100, 0., 1.,100, -2.,2.,"s");
268 
269  sprintf(histo,"ErrxMFClusterwidthProfile_Category1_rphi_layer%dtib",i+1);
270  meErrxMFClusterwidthProfileCategory1RphiTIB[i] = dbe_->bookProfile(histo,"Resolution Cluster width Profile Category1", 100, 0., 10.,100, -2.,2.,"s");
271 
272  }
273 
274  //one histo per Layer stereo and matched hits
275  for(int i = 0 ;i<2 ; i++) {
276  Char_t histo[200];
277  sprintf(histo,"Nstp_sas_layer%dtib",i+1);
278  meNstpSasTIB[i] = dbe_->book1D(histo,"RecHit Cluster Size",20,0.5,20.5);
279  sprintf(histo,"Adc_sas_layer%dtib",i+1);
280  meAdcSasTIB[i] = dbe_->book1D(histo,"RecHit Cluster Charge",100,0.,300.);
281  sprintf(histo,"Posx_sas_layer%dtib",i+1);
282  mePosxSasTIB[i] = dbe_->book1D(histo,"RecHit x coord.",100,-6.0,+6.0);
283 
284  sprintf(histo,"Errx_LF_sas_layer%dtib",i+1);
285  meErrxLFSasTIB[i] = dbe_->book1D(histo,"RecHit err(x) coord.",100,0.,0.005);
286  sprintf(histo,"Errx_MF_sas_layer%dtib",i+1);
287  meErrxMFSasTIB[i] = dbe_->book1D(histo,"RecHit err(x) coord.",100,0.,0.5);
288 
289  sprintf(histo,"Res_LF_sas_layer%dtib",i+1);
290  meResLFSasTIB[i] = dbe_->book1D(histo,"RecHit Residual",100,-0.02,+0.02);
291  sprintf(histo,"Res_MF_sas_layer%dtib",i+1);
292  meResMFSasTIB[i] = dbe_->book1D(histo,"RecHit Residual",100,-2,+2);
293 
294  sprintf(histo,"Pull_LF_sas_layer%dtib",i+1);
295  mePullLFSasTIB[i] = dbe_->book1D(histo,"Pull",100,-4.,4.);
296  sprintf(histo,"Pull_MF_sas_layer%dtib",i+1);
297  mePullMFSasTIB[i] = dbe_->book1D(histo,"Pull",100,-4.,4.);
298 
299  sprintf(histo,"Trackangle_sas_layer%dtib",i+1);
300  meTrackangleSasTIB[i] = dbe_->book1D(histo,"Track angle",100,-40.,40.);
301 
302  sprintf(histo,"Trackanglebeta_sas_layer%dtib",i+1);
303  meTrackanglebetaSasTIB[i] = dbe_->book1D(histo,"Track angle beta",100,-40.,40.);
304 
305  sprintf(histo,"PullTrackangleProfile_sas_layer%dtib",i+1);
306  mePullTrackangleProfileSasTIB[i] = dbe_->bookProfile(histo,"Pull Track angle Profile", 100, -40., 40.,100,-4.,4.,"s");
307 
308  sprintf(histo,"Trackwidth_sas_layer%dtib",i+1);
309  meTrackwidthSasTIB[i] = dbe_->book1D(histo,"Track width",100,0.,1.);
310 
311  sprintf(histo,"Expectedwidth_sas_layer%dtib",i+1);
312  meExpectedwidthSasTIB[i] = dbe_->book1D(histo,"Expected width",10,0.,10.);
313 
314  sprintf(histo,"Clusterwidth_sas_layer%dtib",i+1);
315  meClusterwidthSasTIB[i] = dbe_->book1D(histo,"Cluster width",10,0.,10.);
316 
317  sprintf(histo,"Category_sas_layer%dtib",i+1);
318  meCategorySasTIB[i] = dbe_->book1D(histo,"Cluster Category",10,0.,10.);
319 
320  sprintf(histo,"PullTrackwidthProfile_sas_layer%dtib",i+1);
321  mePullTrackwidthProfileSasTIB[i] = dbe_->bookProfile(histo,"Pull Track width Profile", 100, 0., 1.,100, -2.,2.,"s");
322 
323  sprintf(histo,"PullTrackwidthProfile_Category1_sas_layer%dtib",i+1);
324  mePullTrackwidthProfileCategory1SasTIB[i] = dbe_->bookProfile(histo,"Pull Track width Profile Category1", 100, 0., 1.,100, -2.,2.,"s");
325 
326  sprintf(histo,"PullTrackwidthProfile_Category2_sas_layer%dtib",i+1);
327  mePullTrackwidthProfileCategory2SasTIB[i] = dbe_->bookProfile(histo,"Pull Track width Profile Category2", 100, 0., 1.,100, -2.,2.,"s");
328 
329  sprintf(histo,"PullTrackwidthProfile_Category3_sas_layer%dtib",i+1);
330  mePullTrackwidthProfileCategory3SasTIB[i] = dbe_->bookProfile(histo,"Pull Track width Profile Category3", 100, 0., 1.,100, -2.,2.,"s");
331 
332  sprintf(histo,"PullTrackwidthProfile_Category4_sas_layer%dtib",i+1);
333  mePullTrackwidthProfileCategory4SasTIB[i] = dbe_->bookProfile(histo,"Pull Track width Profile Category4", 100, 0., 1.,100, -2.,2.,"s");
334 
335  sprintf(histo,"ErrxMFTrackwidthProfile_sas_layer%dtib",i+1);
336  meErrxMFTrackwidthProfileSasTIB[i] = dbe_->bookProfile(histo,"Resolution Track width Profile", 12,0.,4.,100, -2.,2.,"s");
337 
338  sprintf(histo,"ErrxMFTrackwidthProfile_Category1_sas_layer%dtib",i+1);
339  meErrxMFTrackwidthProfileCategory1SasTIB[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Category1", 12,0.,4.,100, -2.,2.,"s");
340  sprintf(histo,"ErrxMFTrackwidthProfile_Category2_sas_layer%dtib",i+1);
341  meErrxMFTrackwidthProfileCategory2SasTIB[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Category2", 12,0.,4.,100, -2.,2.,"s");
342  sprintf(histo,"ErrxMFTrackwidthProfile_Category3_sas_layer%dtib",i+1);
343  meErrxMFTrackwidthProfileCategory3SasTIB[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Category3", 12,0.,4.,100, -2.,2.,"s");
344  sprintf(histo,"ErrxMFTrackwidthProfile_Category4_sas_layer%dtib",i+1);
345  meErrxMFTrackwidthProfileCategory4SasTIB[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Category4", 12,0.,4.,100, -2.,2.,"s");
346 
347  sprintf(histo,"ErrxMFAngleProfile_sas_layer%dtib",i+1);
348  meErrxMFAngleProfileSasTIB[i] = dbe_->bookProfile(histo,"Resolution Angle Profile", 100, 0., 1.,100, -2.,2.,"s");
349 
350  sprintf(histo,"ErrxMFClusterwidthProfile_Category1_sas_layer%dtib",i+1);
351  meErrxMFClusterwidthProfileCategory1SasTIB[i] = dbe_->bookProfile(histo,"Resolution Cluster width Profile Category1", 100, 0., 10.,100, -2.,2.,"s");
352 
353 
354 
355  sprintf(histo,"Posx_matched_layer%dtib",i+1);
356  mePosxMatchedTIB[i] = dbe_->book1D(histo,"RecHit x coord.",100,-6.0, +6.0);
357  sprintf(histo,"Posy_matched_layer%dtib",i+1);
358  mePosyMatchedTIB[i] = dbe_->book1D(histo,"RecHit y coord.",100,-6.0, +6.0);
359  sprintf(histo,"Errx_matched_layer%dtib",i+1);
360  meErrxMatchedTIB[i] = dbe_->book1D(histo,"RecHit err(x) coord.",100,0., 0.05);
361  sprintf(histo,"Erry_matched_layer%dtib",i+1);
362  meErryMatchedTIB[i] = dbe_->book1D(histo,"RecHit err(y) coord.",100,0., 0.05);
363  sprintf(histo,"Resx_matched_layer%dtib",i+1);
364  meResxMatchedTIB[i] = dbe_->book1D(histo,"RecHit Res(x) coord.",100,-0.02, +0.02);
365  sprintf(histo,"Resy_matched_layer%dtib",i+1);
366  meResyMatchedTIB[i] = dbe_->book1D(histo,"RecHit Res(y) coord.",100,-1., +1.);
367  sprintf(histo,"Pullx_matched_layer%dtib",i+1);
368  mePullxMatchedTIB[i] = dbe_->book1D(histo,"Pull",100,-5.,5.);
369  sprintf(histo,"Pully_matched_layer%dtib",i+1);
370  mePullyMatchedTIB[i] = dbe_->book1D(histo,"Pull",100,-5.,5.);
371  }
372 
373  dbe_->setCurrentFolder("Tracking/TrackingRecHits/Strip/TOB");
374  //one histo per Layer rphi hits
375  for(int i = 0 ;i<6 ; i++) {
376  Char_t histo[200];
377  sprintf(histo,"Nstp_rphi_layer%dtob",i+1);
378  meNstpRphiTOB[i] = dbe_->book1D(histo,"RecHit Cluster Size",20,0.5,20.5);
379  sprintf(histo,"Adc_rphi_layer%dtob",i+1);
380  meAdcRphiTOB[i] = dbe_->book1D(histo,"RecHit Cluster Charge",100,0.,300.);
381  sprintf(histo,"Posx_rphi_layer%dtob",i+1);
382  mePosxRphiTOB[i] = dbe_->book1D(histo,"RecHit x coord.",100,-6.0,+6.0);
383 
384  sprintf(histo,"Errx_LF_rphi_layer%dtob",i+1);
385  meErrxLFRphiTOB[i] = dbe_->book1D(histo,"RecHit err(x) coord.",100,0,0.01);
386  sprintf(histo,"Errx_MF_rphi_layer%dtob",i+1);
387  meErrxMFRphiTOB[i] = dbe_->book1D(histo,"RecHit err(x) coord.",100,0,0.5);
388 
389  sprintf(histo,"Res_LF_rphi_layer%dtob",i+1);
390  meResLFRphiTOB[i] = dbe_->book1D(histo,"RecHit Residual",100,-0.02,+0.02);
391  sprintf(histo,"Res_MF_rphi_layer%dtob",i+1);
392  meResMFRphiTOB[i] = dbe_->book1D(histo,"RecHit Residual",100,-2,2);
393 
394  sprintf(histo,"Pull_LF_rphi_layer%dtob",i+1);
395  mePullLFRphiTOB[i] = dbe_->book1D(histo,"Pull",100,-5.,5.);
396  sprintf(histo,"Pull_MF_rphi_layer%dtob",i+1);
397  mePullMFRphiTOB[i] = dbe_->book1D(histo,"Pull",100,-5.,5.);
398 
399  sprintf(histo,"Trackangle_rphi_layer%dtob",i+1);
400  meTrackangleRphiTOB[i] = dbe_->book1D(histo,"Track angle",100,-20.,20.);
401 
402  sprintf(histo,"Trackanglebeta_rphi_layer%dtob",i+1);
403  meTrackanglebetaRphiTOB[i] = dbe_->book1D(histo,"Track angle beta",100,-20.,20.);
404 
405  sprintf(histo,"PullTrackangleProfile_rphi_layer%dtob",i+1);
406  mePullTrackangleProfileRphiTOB[i] = dbe_->bookProfile(histo,"Pull Track angle Profile", 100, -20., 20.,100,-5.,5.,"s");
407 
408  sprintf(histo,"Trackwidth_rphi_layer%dtob",i+1);
409  meTrackwidthRphiTOB[i] = dbe_->book1D(histo,"Track width",100,0.,4.);
410 
411  sprintf(histo,"Expectedwidth_rphi_layer%dtob",i+1);
412  meExpectedwidthRphiTOB[i] = dbe_->book1D(histo,"Expected width",10,0.,10.);
413 
414  sprintf(histo,"Clusterwidth_rphi_layer%dtob",i+1);
415  meClusterwidthRphiTOB[i] = dbe_->book1D(histo,"Cluster width",10,0.,10.);
416 
417  sprintf(histo,"Category_rphi_layer%dtob",i+1);
418  meCategoryRphiTOB[i] = dbe_->book1D(histo,"Cluster Category",10,0.,10.);
419 
420  sprintf(histo,"PullTrackwidthProfile_rphi_layer%dtob",i+1);
421  mePullTrackwidthProfileRphiTOB[i] = dbe_->bookProfile(histo,"Pull Track width Profile", 100, 0., 1.,100, -2.,2.,"s");
422 
423  sprintf(histo,"PullTrackwidthProfile_Category1_rphi_layer%dtob",i+1);
424  mePullTrackwidthProfileCategory1RphiTOB[i] = dbe_->bookProfile(histo,"Pull Track width Profile Category1", 100, 0., 1.,100, -2.,2.,"s");
425 
426  sprintf(histo,"PullTrackwidthProfile_Category2_rphi_layer%dtob",i+1);
427  mePullTrackwidthProfileCategory2RphiTOB[i] = dbe_->bookProfile(histo,"Pull Track width Profile Category2", 100, 0., 1.,100, -2.,2.,"s");
428 
429  sprintf(histo,"PullTrackwidthProfile_Category3_rphi_layer%dtob",i+1);
430  mePullTrackwidthProfileCategory3RphiTOB[i] = dbe_->bookProfile(histo,"Pull Track width Profile Category3", 100, 0., 1.,100, -2.,2.,"s");
431 
432  sprintf(histo,"PullTrackwidthProfile_Category4_rphi_layer%dtob",i+1);
433  mePullTrackwidthProfileCategory4RphiTOB[i] = dbe_->bookProfile(histo,"Pull Track width Profile Category4", 100, 0., 1.,100, -2.,2.,"s");
434 
435  sprintf(histo,"ErrxMFTrackwidthProfile_rphi_layer%dtob",i+1);
436  meErrxMFTrackwidthProfileRphiTOB[i] = dbe_->bookProfile(histo,"Resolution Track width Profile", 12,0.,4.,100, -2.,2.,"s");
437 
438  sprintf(histo,"ErrxMFTrackwidthProfile_WClus1_rphi_layer%dtob",i+1);
439  meErrxMFTrackwidthProfileWclus1RphiTOB[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Wclus1", 12, 0., 4.,100, -2.,2.,"s");
440 
441  sprintf(histo,"ErrxMFTrackwidthProfile_WClus2_rphi_layer%dtob",i+1);
442  meErrxMFTrackwidthProfileWclus2RphiTOB[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Wclus1", 12, 0., 4.,100, -2.,2.,"s");
443 
444  sprintf(histo,"ErrxMFTrackwidthProfile_WClus3_rphi_layer%dtob",i+1);
445  meErrxMFTrackwidthProfileWclus3RphiTOB[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Wclus1", 12, 0., 4.,100, -2.,2.,"s");
446 
447  sprintf(histo,"ErrxMFTrackwidthProfile_WClus4_rphi_layer%dtob",i+1);
448  meErrxMFTrackwidthProfileWclus4RphiTOB[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Wclus1", 12, 0., 4.,100, -2.,2.,"s");
449 
450  sprintf(histo,"ResMFTrackwidthProfile_WClus1_rphi_layer%dtob",i+1);
451  meResMFTrackwidthProfileWclus1RphiTOB[i] = dbe_->bookProfile(histo,"Residue Track width Profile Wclus1", 12, 0., 4.,100, -2.,2.,"s");
452  sprintf(histo,"ResMFTrackwidthProfile_WClus2_rphi_layer%dtob",i+1);
453  meResMFTrackwidthProfileWclus2RphiTOB[i] = dbe_->bookProfile(histo,"Residue Track width Profile Wclus1", 12, 0., 4.,100, -2.,2.,"s");
454 
455  sprintf(histo,"ResMFTrackwidthProfile_WClus3_rphi_layer%dtob",i+1);
456  meResMFTrackwidthProfileWclus3RphiTOB[i] = dbe_->bookProfile(histo,"Residue Track width Profile Wclus1", 12, 0., 4.,100, -2.,2.,"s");
457 
458  sprintf(histo,"ResMFTrackwidthProfile_WClus4_rphi_layer%dtob",i+1);
459  meResMFTrackwidthProfileWclus4RphiTOB[i] = dbe_->bookProfile(histo,"Residue Track width Profile Wclus1", 12, 0., 4.,100, -2.,2.,"s");
460 
461 
462 
463  sprintf(histo,"ErrxMFTrackwidthProfile_Category1_rphi_layer%dtob",i+1);
464  meErrxMFTrackwidthProfileCategory1RphiTOB[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Category1", 12,0.,4.,100, -2.,2.,"s");
465 
466  sprintf(histo,"ErrxMFTrackwidthProfile_Category2_rphi_layer%dtob",i+1);
467  meErrxMFTrackwidthProfileCategory2RphiTOB[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Category2", 12,0.,4.,100, -2.,2.,"s");
468 
469  sprintf(histo,"ErrxMFTrackwidthProfile_Category3_rphi_layer%dtob",i+1);
470  meErrxMFTrackwidthProfileCategory3RphiTOB[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Category3", 12,0.,4.,100, -2.,2.,"s");
471 
472  sprintf(histo,"ErrxMFTrackwidthProfile_Category4_rphi_layer%dtob",i+1);
473  meErrxMFTrackwidthProfileCategory4RphiTOB[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Category4", 12,0.,4.,100, -2.,2.,"s");
474 
475  sprintf(histo,"ErrxMFAngleProfile_rphi_layer%dtob",i+1);
476  meErrxMFAngleProfileRphiTOB[i] = dbe_->bookProfile(histo,"Resolution Angle Profile", 100, 0., 1.,100, -2.,2.,"s");
477 
478  sprintf(histo,"ErrxMFClusterwidthProfile_Category1_rphi_layer%dtob",i+1);
479  meErrxMFClusterwidthProfileCategory1RphiTOB[i] = dbe_->bookProfile(histo,"Resolution Cluster width Profile Category1", 100, 0., 10.,100, -2.,2.,"s");
480 
481  }
482 
483  //one histo per Layer stereo and matched hits
484  for(int i = 0 ;i<2 ; i++) {
485  Char_t histo[200];
486  sprintf(histo,"Nstp_sas_layer%dtob",i+1);
487  meNstpSasTOB[i] = dbe_->book1D(histo,"RecHit Cluster Size",20,0.5,20.5);
488  sprintf(histo,"Adc_sas_layer%dtob",i+1);
489  meAdcSasTOB[i] = dbe_->book1D(histo,"RecHit Cluster Charge",100,0.,300.);
490  sprintf(histo,"Posx_sas_layer%dtob",i+1);
491  mePosxSasTOB[i] = dbe_->book1D(histo,"RecHit x coord.",100,-6.0,+6.0);
492 
493  sprintf(histo,"Errx_LF_sas_layer%dtob",i+1);
494  meErrxLFSasTOB[i] = dbe_->book1D(histo,"RecHit err(x) coord.",100,0.,0.01);
495  sprintf(histo,"Errx_MF_sas_layer%dtob",i+1);
496  meErrxMFSasTOB[i] = dbe_->book1D(histo,"RecHit err(x) coord.",100,0.,0.5);
497 
498  sprintf(histo,"Res_LF_sas_layer%dtob",i+1);
499  meResLFSasTOB[i] = dbe_->book1D(histo,"RecHit Residual",100,-0.02,+0.02);
500  sprintf(histo,"Res_MF_sas_layer%dtob",i+1);
501  meResMFSasTOB[i] = dbe_->book1D(histo,"RecHit Residual",100,-2,2);
502 
503  sprintf(histo,"Pull_LF_sas_layer%dtob",i+1);
504  mePullLFSasTOB[i] = dbe_->book1D(histo,"Pull",100,-5.,5.);
505  sprintf(histo,"Pull_MF_sas_layer%dtob",i+1);
506  mePullMFSasTOB[i] = dbe_->book1D(histo,"Pull",100,-5.,5.);
507 
508  sprintf(histo,"Trackangle_sas_layer%dtob",i+1);
509  meTrackangleSasTOB[i] = dbe_->book1D(histo,"Track angle",100,-25.,25.);
510 
511  sprintf(histo,"Trackanglebeta_sas_layer%dtob",i+1);
512  meTrackanglebetaSasTOB[i] = dbe_->book1D(histo,"Track angle beta",100,-25.,25.);
513 
514  sprintf(histo,"PullTrackangleProfile_sas_layer%dtob",i+1);
515  mePullTrackangleProfileSasTOB[i] = dbe_->bookProfile(histo,"Pull Track angle Profile", 100, -25., 25. ,100 , -5., 5.,"s");
516 
517  sprintf(histo,"Trackwidth_sas_layer%dtob",i+1);
518  meTrackwidthSasTOB[i] = dbe_->book1D(histo,"Track width",100,0.,1.);
519 
520  sprintf(histo,"Expectedwidth_sas_layer%dtob",i+1);
521  meExpectedwidthSasTOB[i] = dbe_->book1D(histo,"Expected width",10,0.,10.);
522 
523  sprintf(histo,"Clusterwidth_sas_layer%dtob",i+1);
524  meClusterwidthSasTOB[i] = dbe_->book1D(histo,"Cluster width",10,0.,10.);
525 
526  sprintf(histo,"Category_sas_layer%dtob",i+1);
527  meCategorySasTOB[i] = dbe_->book1D(histo,"Cluster Category",10,0.,10.);
528 
529  sprintf(histo,"PullTrackwidthProfile_sas_layer%dtob",i+1);
530  mePullTrackwidthProfileSasTOB[i] = dbe_->bookProfile(histo,"Pull Track width Profile", 100, 0., 1.,100, -2.,2.,"s");
531 
532  sprintf(histo,"PullTrackwidthProfile_Category1_sas_layer%dtob",i+1);
533  mePullTrackwidthProfileCategory1SasTOB[i] = dbe_->bookProfile(histo,"Pull Track width Profile Category1", 100, 0., 1.,100, -2.,2.,"s");
534 
535  sprintf(histo,"PullTrackwidthProfile_Category2_sas_layer%dtob",i+1);
536  mePullTrackwidthProfileCategory2SasTOB[i] = dbe_->bookProfile(histo,"Pull Track width Profile Category2", 100, 0., 1.,100, -2.,2.,"s");
537 
538  sprintf(histo,"PullTrackwidthProfile_Category3_sas_layer%dtob",i+1);
539  mePullTrackwidthProfileCategory3SasTOB[i] = dbe_->bookProfile(histo,"Pull Track width Profile Category3", 100, 0., 1.,100, -2.,2.,"s");
540 
541  sprintf(histo,"PullTrackwidthProfile_Category4_sas_layer%dtob",i+1);
542  mePullTrackwidthProfileCategory4SasTOB[i] = dbe_->bookProfile(histo,"Pull Track width Profile Category4", 100, 0., 1.,100, -2.,2.,"s");
543 
544  sprintf(histo,"ErrxMFTrackwidthProfile_sas_layer%dtob",i+1);
545  meErrxMFTrackwidthProfileSasTOB[i] = dbe_->bookProfile(histo,"Resolution Track width Profile", 12,0.,4.,100, -2.,2.,"s");
546 
547  sprintf(histo,"ErrxMFTrackwidthProfile_Category1_sas_layer%dtob",i+1);
548  meErrxMFTrackwidthProfileCategory1SasTOB[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Category1", 12,0.,4.,100, -2.,2.,"s");
549  sprintf(histo,"ErrxMFTrackwidthProfile_Category2_sas_layer%dtob",i+1);
550  meErrxMFTrackwidthProfileCategory2SasTOB[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Category2", 12,0.,4.,100, -2.,2.,"s");
551  sprintf(histo,"ErrxMFTrackwidthProfile_Category3_sas_layer%dtob",i+1);
552  meErrxMFTrackwidthProfileCategory3SasTOB[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Category3", 12,0.,4.,100, -2.,2.,"s");
553  sprintf(histo,"ErrxMFTrackwidthProfile_Category4_sas_layer%dtob",i+1);
554  meErrxMFTrackwidthProfileCategory4SasTOB[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Category4", 12,0.,4.,100, -2.,2.,"s");
555 
556  sprintf(histo,"ErrxMFAngleProfile_sas_layer%dtob",i+1);
557  meErrxMFAngleProfileSasTOB[i] = dbe_->bookProfile(histo,"Resolution Angle Profile", 100, 0., 1.,100, -2.,2.,"s");
558 
559  sprintf(histo,"ErrxMFClusterwidthProfile_Category1_sas_layer%dtob",i+1);
560  meErrxMFClusterwidthProfileCategory1SasTOB[i] = dbe_->bookProfile(histo,"Resolution Cluster width Profile Category1", 100, 0., 10.,100, -2.,2.,"s");
561 
562  sprintf(histo,"Posx_matched_layer%dtob",i+1);
563  mePosxMatchedTOB[i] = dbe_->book1D(histo,"RecHit x coord.",100,-6.0, +6.0);
564  sprintf(histo,"Posy_matched_layer%dtob",i+1);
565  mePosyMatchedTOB[i] = dbe_->book1D(histo,"RecHit y coord.",100,-6.0, +6.0);
566  sprintf(histo,"Errx_matched_layer%dtob",i+1);
567  meErrxMatchedTOB[i] = dbe_->book1D(histo,"RecHit err(x) coord.",100,0., 0.05);
568  sprintf(histo,"Erry_matched_layer%dtob",i+1);
569  meErryMatchedTOB[i] = dbe_->book1D(histo,"RecHit err(y) coord.",100,0., 0.05);
570  sprintf(histo,"Resx_matched_layer%dtob",i+1);
571  meResxMatchedTOB[i] = dbe_->book1D(histo,"RecHit Res(x) coord.",100,-0.02, +0.02);
572  sprintf(histo,"Resy_matched_layer%dtob",i+1);
573  meResyMatchedTOB[i] = dbe_->book1D(histo,"RecHit Res(y) coord.",100,-1., +1.);
574  sprintf(histo,"Pullx_matched_layer%dtob",i+1);
575  mePullxMatchedTOB[i] = dbe_->book1D(histo,"Pull",100,-5.,5.);
576  sprintf(histo,"Pully_matched_layer%dtob",i+1);
577  mePullyMatchedTOB[i] = dbe_->book1D(histo,"Pull",100,-5.,5.);
578  }
579 
580  dbe_->setCurrentFolder("Tracking/TrackingRecHits/Strip/TID");
581  //one histo per Ring rphi hits: 3 rings, 6 disks, 2 inner rings are glued
582  for(int i = 0 ;i<3 ; i++) {
583  Char_t histo[200];
584  sprintf(histo,"Nstp_rphi_layer%dtid",i+1);
585  meNstpRphiTID[i] = dbe_->book1D(histo,"RecHit Cluster Size",20,0.5,20.5);
586  sprintf(histo,"Adc_rphi_layer%dtid",i+1);
587  meAdcRphiTID[i] = dbe_->book1D(histo,"RecHit Cluster Charge",100,0.,300.);
588  sprintf(histo,"Posx_rphi_layer%dtid",i+1);
589  mePosxRphiTID[i] = dbe_->book1D(histo,"RecHit x coord.",100,-6.0,+6.0);
590  sprintf(histo,"Errx_LF_rphi_layer%dtid",i+1);
591  meErrxLFRphiTID[i] = dbe_->book1D(histo,"RecHit err(x) coord.",100,0,0.5);
592  sprintf(histo,"Errx_MF_rphi_layer%dtid",i+1);
593  meErrxMFRphiTID[i] = dbe_->book1D(histo,"RecHit err(x) coord.",100,0,0.5);
594  sprintf(histo,"Res_LF_rphi_layer%dtid",i+1);
595  meResLFRphiTID[i] = dbe_->book1D(histo,"RecHit Residual",100,-0.5,+0.5);
596  sprintf(histo,"Res_MF_rphi_layer%dtid",i+1);
597  meResMFRphiTID[i] = dbe_->book1D(histo,"RecHit Residual",100,-2,2);
598  sprintf(histo,"Pull_LF_rphi_layer%dtid",i+1);
599  mePullLFRphiTID[i] = dbe_->book1D(histo,"Pull",100,-5.,5.);
600  sprintf(histo,"Pull_MF_rphi_layer%dtid",i+1);
601  mePullMFRphiTID[i] = dbe_->book1D(histo,"Pull",100,-5.,5.);
602  sprintf(histo,"Trackangle_rphi_layer%dtid",i+1);
603  meTrackangleRphiTID[i] = dbe_->book1D(histo,"Track angle",100,-20.,20.);
604 
605  sprintf(histo,"Trackanglebeta_rphi_layer%dtid",i+1);
606  meTrackanglebetaRphiTID[i] = dbe_->book1D(histo,"Track angle beta",100,-20.,20.);
607 
608  sprintf(histo,"PullTrackangleProfile_rphi_layer%dtid",i+1);
609  mePullTrackangleProfileRphiTID[i] = dbe_->bookProfile(histo,"Pull Track angle Profile", 100, -20., 20.,100, -5., 5.,"s");
610 
611  sprintf(histo,"Trackwidth_rphi_layer%dtid",i+1);
612  meTrackwidthRphiTID[i] = dbe_->book1D(histo,"Track width",100,0.,1.);
613 
614  sprintf(histo,"Expectedwidth_rphi_layer%dtid",i+1);
615  meExpectedwidthRphiTID[i] = dbe_->book1D(histo,"Expected width",10,0.,10.);
616 
617  sprintf(histo,"Clusterwidth_rphi_layer%dtid",i+1);
618  meClusterwidthRphiTID[i] = dbe_->book1D(histo,"Cluster width",10,0.,10.);
619 
620  sprintf(histo,"Category_rphi_layer%dtid",i+1);
621  meCategoryRphiTID[i] = dbe_->book1D(histo,"Cluster Category",10,0.,10.);
622 
623  sprintf(histo,"PullTrackwidthProfile_rphi_layer%dtid",i+1);
624  mePullTrackwidthProfileRphiTID[i] = dbe_->bookProfile(histo,"Pull Track width Profile", 100, 0., 1.,100, -2.,2.,"s");
625 
626  sprintf(histo,"PullTrackwidthProfile_Category1_rphi_layer%dtid",i+1);
627  mePullTrackwidthProfileCategory1RphiTID[i] = dbe_->bookProfile(histo,"Pull Track width Profile Category1", 100, 0., 1.,100, -2.,2.,"s");
628 
629  sprintf(histo,"PullTrackwidthProfile_Category2_rphi_layer%dtid",i+1);
630  mePullTrackwidthProfileCategory2RphiTID[i] = dbe_->bookProfile(histo,"Pull Track width Profile Category2", 100, 0., 1.,100, -2.,2.,"s");
631 
632  sprintf(histo,"PullTrackwidthProfile_Category3_rphi_layer%dtid",i+1);
633  mePullTrackwidthProfileCategory3RphiTID[i] = dbe_->bookProfile(histo,"Pull Track width Profile Category3", 100, 0., 1.,100, -2.,2.,"s");
634 
635  sprintf(histo,"PullTrackwidthProfile_Category4_rphi_layer%dtid",i+1);
636  mePullTrackwidthProfileCategory4RphiTID[i] = dbe_->bookProfile(histo,"Pull Track width Profile Category4", 100, 0., 1.,100, -2.,2.,"s");
637 
638  sprintf(histo,"ErrxMFTrackwidthProfile_rphi_layer%dtid",i+1);
639  meErrxMFTrackwidthProfileRphiTID[i] = dbe_->bookProfile(histo,"Resolution Track width Profile", 12,0.,4.,100, -2.,2.,"s");
640 
641  sprintf(histo,"ErrxMFTrackwidthProfile_Category1_rphi_layer%dtid",i+1);
642  meErrxMFTrackwidthProfileCategory1RphiTID[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Category1", 12,0.,4.,100, -2.,2.,"s");
643  sprintf(histo,"ErrxMFTrackwidthProfile_Category2_rphi_layer%dtid",i+1);
644  meErrxMFTrackwidthProfileCategory2RphiTID[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Category2", 12,0.,4.,100, -2.,2.,"s");
645  sprintf(histo,"ErrxMFTrackwidthProfile_Category3_rphi_layer%dtid",i+1);
646  meErrxMFTrackwidthProfileCategory3RphiTID[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Category3", 12,0.,4.,100, -2.,2.,"s");
647  sprintf(histo,"ErrxMFTrackwidthProfile_Category4_rphi_layer%dtid",i+1);
648  meErrxMFTrackwidthProfileCategory4RphiTID[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Category4", 12,0.,4.,100, -2.,2.,"s");
649 
650  sprintf(histo,"ErrxMFAngleProfile_rphi_layer%dtid",i+1);
651  meErrxMFAngleProfileRphiTID[i] = dbe_->bookProfile(histo,"Resolution Angle Profile", 100, 0., 1.,100, -2.,2.,"s");
652 
653  sprintf(histo,"ErrxMFClusterwidthProfile_Category1_rphi_layer%dtid",i+1);
654  meErrxMFClusterwidthProfileCategory1RphiTID[i] = dbe_->bookProfile(histo,"Resolution Cluster width Profile Category1", 100, 0., 10.,100, -2.,2.,"s");
655 
656  }
657 
658  //one histo per Ring stereo and matched hits
659  for(int i = 0 ;i<2 ; i++) {
660  Char_t histo[200];
661  sprintf(histo,"Nstp_sas_layer%dtid",i+1);
662  meNstpSasTID[i] = dbe_->book1D(histo,"RecHit Cluster Size",20,0.5,20.5);
663  sprintf(histo,"Adc_sas_layer%dtid",i+1);
664  meAdcSasTID[i] = dbe_->book1D(histo,"RecHit Cluster Charge",100,0.,300.);
665  sprintf(histo,"Posx_sas_layer%dtid",i+1);
666  mePosxSasTID[i] = dbe_->book1D(histo,"RecHit x coord.",100,-6.0,+6.0);
667  sprintf(histo,"Errx_LF_sas_layer%dtid",i+1);
668  meErrxLFSasTID[i] = dbe_->book1D(histo,"RecHit err(x) coord.",100,0.,0.5);
669  sprintf(histo,"Errx_MF_sas_layer%dtid",i+1);
670  meErrxMFSasTID[i] = dbe_->book1D(histo,"RecHit err(x) coord.",100,0.,0.5);
671  sprintf(histo,"Res_LF_sas_layer%dtid",i+1);
672  meResLFSasTID[i] = dbe_->book1D(histo,"RecHit Residual",100,-0.5,+0.5);
673  sprintf(histo,"Res_MF_sas_layer%dtid",i+1);
674  meResMFSasTID[i] = dbe_->book1D(histo,"RecHit Residual",100,-2,2);
675  sprintf(histo,"Pull_LF_sas_layer%dtid",i+1);
676  mePullLFSasTID[i] = dbe_->book1D(histo,"Pull",100,-5.,5.);
677  sprintf(histo,"Pull_MF_sas_layer%dtid",i+1);
678  mePullMFSasTID[i] = dbe_->book1D(histo,"Pull",100,-5.,5.);
679  sprintf(histo,"Trackangle_sas_layer%dtid",i+1);
680  meTrackangleSasTID[i] = dbe_->book1D(histo,"Track angle",100,-20.,20.);
681  sprintf(histo,"Trackanglebeta_sas_layer%dtid",i+1);
682  meTrackanglebetaSasTID[i] = dbe_->book1D(histo,"Track angle beta",100,-20.,20.);
683 
684  sprintf(histo,"PullTrackangleProfile_sas_layer%dtid",i+1);
685  mePullTrackangleProfileSasTID[i] = dbe_->bookProfile(histo,"Pull Track angle Profile", 100, -20., 20.,100, -5., 5.,"s");
686 
687  sprintf(histo,"Trackwidth_sas_layer%dtid",i+1);
688  meTrackwidthSasTID[i] = dbe_->book1D(histo,"Track width",100,0.,1.);
689 
690  sprintf(histo,"Expectedwidth_sas_layer%dtid",i+1);
691  meExpectedwidthSasTID[i] = dbe_->book1D(histo,"Expected width",10,0.,10.);
692 
693  sprintf(histo,"Clusterwidth_sas_layer%dtid",i+1);
694  meClusterwidthSasTID[i] = dbe_->book1D(histo,"Cluster width",10,0.,10.);
695 
696  sprintf(histo,"Category_sas_layer%dtid",i+1);
697  meCategorySasTID[i] = dbe_->book1D(histo,"Cluster Category",10,0.,10.);
698 
699  sprintf(histo,"PullTrackwidthProfile_sas_layer%dtid",i+1);
700  mePullTrackwidthProfileSasTID[i] = dbe_->bookProfile(histo,"Pull Track width Profile", 100, 0., 1.,100, -2.,2.,"s");
701 
702  sprintf(histo,"PullTrackwidthProfile_Category1_sas_layer%dtid",i+1);
703  mePullTrackwidthProfileCategory1SasTID[i] = dbe_->bookProfile(histo,"Pull Track width Profile Category1", 100, 0., 1.,100, -2.,2.,"s");
704 
705  sprintf(histo,"PullTrackwidthProfile_Category2_sas_layer%dtid",i+1);
706  mePullTrackwidthProfileCategory2SasTID[i] = dbe_->bookProfile(histo,"Pull Track width Profile Category2", 100, 0., 1.,100, -2.,2.,"s");
707 
708  sprintf(histo,"PullTrackwidthProfile_Category3_sas_layer%dtid",i+1);
709  mePullTrackwidthProfileCategory3SasTID[i] = dbe_->bookProfile(histo,"Pull Track width Profile Category3", 100, 0., 1.,100, -2.,2.,"s");
710 
711  sprintf(histo,"PullTrackwidthProfile_Category4_sas_layer%dtid",i+1);
712  mePullTrackwidthProfileCategory4SasTID[i] = dbe_->bookProfile(histo,"Pull Track width Profile Category4", 100, 0., 1.,100, -2.,2.,"s");
713 
714  sprintf(histo,"ErrxMFTrackwidthProfile_sas_layer%dtid",i+1);
715  meErrxMFTrackwidthProfileSasTID[i] = dbe_->bookProfile(histo,"Resolution Track width Profile", 12,0.,4.,100, -2.,2.,"s");
716 
717  sprintf(histo,"ErrxMFTrackwidthProfile_Category1_sas_layer%dtid",i+1);
718  meErrxMFTrackwidthProfileCategory1SasTID[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Category1", 12,0.,4.,100, -2.,2.,"s");
719  sprintf(histo,"ErrxMFTrackwidthProfile_Category2_sas_layer%dtid",i+1);
720  meErrxMFTrackwidthProfileCategory2SasTID[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Category2", 12,0.,4.,100, -2.,2.,"s");
721  sprintf(histo,"ErrxMFTrackwidthProfile_Category3_sas_layer%dtid",i+1);
722  meErrxMFTrackwidthProfileCategory3SasTID[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Category3", 12,0.,4.,100, -2.,2.,"s");
723  sprintf(histo,"ErrxMFTrackwidthProfile_Category4_sas_layer%dtid",i+1);
724  meErrxMFTrackwidthProfileCategory4SasTID[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Category4", 12,0.,4.,100, -2.,2.,"s");
725 
726  sprintf(histo,"ErrxMFAngleProfile_sas_layer%dtid",i+1);
727  meErrxMFAngleProfileSasTID[i] = dbe_->bookProfile(histo,"Resolution Angle Profile", 100, 0., 1.,100, -2.,2.,"s");
728 
729  sprintf(histo,"ErrxMFClusterwidthProfile_Category1_sas_layer%dtid",i+1);
730  meErrxMFClusterwidthProfileCategory1SasTID[i] = dbe_->bookProfile(histo,"Resolution Cluster width Profile Category1", 100, 0., 10.,100, -2.,2.,"s");
731 
732  sprintf(histo,"Posx_matched_layer%dtid",i+1);
733  mePosxMatchedTID[i] = dbe_->book1D(histo,"RecHit x coord.",100,-6.0, +6.0);
734  sprintf(histo,"Posy_matched_layer%dtid",i+1);
735  mePosyMatchedTID[i] = dbe_->book1D(histo,"RecHit y coord.",100,-6.0, +6.0);
736  sprintf(histo,"Errx_matched_layer%dtid",i+1);
737  meErrxMatchedTID[i] = dbe_->book1D(histo,"RecHit err(x) coord.",100,0., 0.02);
738  sprintf(histo,"Erry_matched_layer%dtid",i+1);
739  meErryMatchedTID[i] = dbe_->book1D(histo,"RecHit err(y) coord.",100,0., 0.1);
740  sprintf(histo,"Resx_matched_layer%dtid",i+1);
741  meResxMatchedTID[i] = dbe_->book1D(histo,"RecHit Res(x) coord.",100,-0.2, +0.2);
742  sprintf(histo,"Resy_matched_layer%dtid",i+1);
743  meResyMatchedTID[i] = dbe_->book1D(histo,"RecHit Res(y) coord.",100,-1., +1.);
744  sprintf(histo,"Pullx_matched_layer%dtid",i+1);
745  mePullxMatchedTID[i] = dbe_->book1D(histo,"Pull",100,-5.,5.);
746  sprintf(histo,"Pully_matched_layer%dtid",i+1);
747  mePullyMatchedTID[i] = dbe_->book1D(histo,"Pull",100,-5.,5.);
748  }
749 
750  dbe_->setCurrentFolder("Tracking/TrackingRecHits/Strip/TEC");
751  //one histo per Ring rphi hits: 7 rings, 18 disks. Innermost 3 rings are same as TID above.
752  for(int i = 0 ;i<7 ; i++) {
753  Char_t histo[200];
754  sprintf(histo,"Nstp_rphi_layer%dtec",i+1);
755  meNstpRphiTEC[i] = dbe_->book1D(histo,"RecHit Cluster Size",20,0.5,20.5);
756  sprintf(histo,"Adc_rphi_layer%dtec",i+1);
757  meAdcRphiTEC[i] = dbe_->book1D(histo,"RecHit Cluster Charge",100,0.,300.);
758  sprintf(histo,"Posx_rphi_layer%dtec",i+1);
759  mePosxRphiTEC[i] = dbe_->book1D(histo,"RecHit x coord.",100,-6.0,+6.0);
760 
761  sprintf(histo,"Errx_LF_rphi_layer%dtec",i+1);
762  meErrxLFRphiTEC[i] = dbe_->book1D(histo,"RecHit err(x) coord.",100,0,0.5);
763  sprintf(histo,"Errx_MF_rphi_layer%dtec",i+1);
764  meErrxMFRphiTEC[i] = dbe_->book1D(histo,"RecHit err(x) coord.",100,0,0.5);
765 
766  sprintf(histo,"Res_LF_rphi_layer%dtec",i+1);
767  meResLFRphiTEC[i] = dbe_->book1D(histo,"RecHit Residual",100,-0.5,+0.5);
768  sprintf(histo,"Res_MF_rphi_layer%dtec",i+1);
769  meResMFRphiTEC[i] = dbe_->book1D(histo,"RecHit Residual",100,-2,2);
770 
771  sprintf(histo,"Pull_LF_rphi_layer%dtec",i+1);
772  mePullLFRphiTEC[i] = dbe_->book1D(histo,"Pull",100,-5.,5.);
773  sprintf(histo,"Pull_MF_rphi_layer%dtec",i+1);
774  mePullMFRphiTEC[i] = dbe_->book1D(histo,"Pull",100,-5.,5.);
775 
776  sprintf(histo,"Trackangle_rphi_layer%dtec",i+1);
777  meTrackangleRphiTEC[i] = dbe_->book1D(histo,"Track angle",100,-10.,10.);
778 
779  sprintf(histo,"Trackanglebeta_rphi_layer%dtec",i+1);
780  meTrackanglebetaRphiTEC[i] = dbe_->book1D(histo,"Track angle beta",100,-10.,10.);
781 
782  sprintf(histo,"PullTrackangleProfile_rphi_layer%dtec",i+1);
783  mePullTrackangleProfileRphiTEC[i] = dbe_->bookProfile(histo,"Pull Track angle Profile", 100, -10., 10.,100, -5., 5.,"s");
784 
785  sprintf(histo,"Trackwidth_rphi_layer%dtec",i+1);
786  meTrackwidthRphiTEC[i] = dbe_->book1D(histo,"Track width",100,0.,1.);
787 
788  sprintf(histo,"Expectedwidth_rphi_layer%dtec",i+1);
789  meExpectedwidthRphiTEC[i] = dbe_->book1D(histo,"Expected width",10,0.,10.);
790 
791  sprintf(histo,"Clusterwidth_rphi_layer%dtec",i+1);
792  meClusterwidthRphiTEC[i] = dbe_->book1D(histo,"Cluster width",10,0.,10.);
793 
794  sprintf(histo,"Category_rphi_layer%dtec",i+1);
795  meCategoryRphiTEC[i] = dbe_->book1D(histo,"Cluster Category",10,0.,10.);
796 
797  sprintf(histo,"PullTrackwidthProfile_rphi_layer%dtec",i+1);
798  mePullTrackwidthProfileRphiTEC[i] = dbe_->bookProfile(histo,"Pull Track width Profile", 100, 0., 1.,100, -2.,2.,"s");
799 
800  sprintf(histo,"PullTrackwidthProfile_Category1_rphi_layer%dtec",i+1);
801  mePullTrackwidthProfileCategory1RphiTEC[i] = dbe_->bookProfile(histo,"Pull Track width Profile Category1", 100, 0., 1.,100, -2.,2.,"s");
802 
803  sprintf(histo,"PullTrackwidthProfile_Category2_rphi_layer%dtec",i+1);
804  mePullTrackwidthProfileCategory2RphiTEC[i] = dbe_->bookProfile(histo,"Pull Track width Profile Category2", 100, 0., 1.,100, -2.,2.,"s");
805 
806  sprintf(histo,"PullTrackwidthProfile_Category3_rphi_layer%dtec",i+1);
807  mePullTrackwidthProfileCategory3RphiTEC[i] = dbe_->bookProfile(histo,"Pull Track width Profile Category3", 100, 0., 1.,100, -2.,2.,"s");
808 
809  sprintf(histo,"PullTrackwidthProfile_Category4_rphi_layer%dtec",i+1);
810  mePullTrackwidthProfileCategory4RphiTEC[i] = dbe_->bookProfile(histo,"Pull Track width Profile Category4", 100, 0., 1.,100, -2.,2.,"s");
811 
812  sprintf(histo,"ErrxMFTrackwidthProfile_rphi_layer%dtec",i+1);
813  meErrxMFTrackwidthProfileRphiTEC[i] = dbe_->bookProfile(histo,"Resolution Track width Profile", 12,0.,4.,100, -2.,2.,"s");
814 
815  sprintf(histo,"ErrxMFTrackwidthProfile_Category1_rphi_layer%dtec",i+1);
816  meErrxMFTrackwidthProfileCategory1RphiTEC[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Category1", 12,0.,4.,100, -2.,2.,"s");
817  sprintf(histo,"ErrxMFTrackwidthProfile_Category2_rphi_layer%dtec",i+1);
818  meErrxMFTrackwidthProfileCategory2RphiTEC[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Category2", 12,0.,4.,100, -2.,2.,"s");
819  sprintf(histo,"ErrxMFTrackwidthProfile_Category3_rphi_layer%dtec",i+1);
820  meErrxMFTrackwidthProfileCategory3RphiTEC[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Category3", 12,0.,4.,100, -2.,2.,"s");
821  sprintf(histo,"ErrxMFTrackwidthProfile_Category4_rphi_layer%dtec",i+1);
822  meErrxMFTrackwidthProfileCategory4RphiTEC[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Category4", 12,0.,4.,100, -2.,2.,"s");
823 
824  sprintf(histo,"ErrxMFAngleProfile_rphi_layer%dtec",i+1);
825  meErrxMFAngleProfileRphiTEC[i] = dbe_->bookProfile(histo,"Resolution Angle Profile", 100, 0., 1.,100, -2.,2.,"s");
826 
827  sprintf(histo,"ErrxMFClusterwidthProfile_Category1_rphi_layer%dtec",i+1);
828  meErrxMFClusterwidthProfileCategory1RphiTEC[i] = dbe_->bookProfile(histo,"Resolution Cluster width Profile Category1", 100, 0., 10.,100, -2.,2.,"s");
829 
830  }
831 
832  //one histo per Layer stereo and matched hits: rings 1,2,5 are double sided
833  for(int i = 0 ;i<5 ; i++) {
834  if(i == 0 || i == 1 || i == 4) {
835  Char_t histo[200];
836  sprintf(histo,"Nstp_sas_layer%dtec",i+1);
837  meNstpSasTEC[i] = dbe_->book1D(histo,"RecHit Cluster Size",20,0.5,20.5);
838  sprintf(histo,"Adc_sas_layer%dtec",i+1);
839  meAdcSasTEC[i] = dbe_->book1D(histo,"RecHit Cluster Charge",100,0.,300.);
840  sprintf(histo,"Posx_sas_layer%dtec",i+1);
841  mePosxSasTEC[i] = dbe_->book1D(histo,"RecHit x coord.",100,-6.0,+6.0);
842  sprintf(histo,"Errx_LF_sas_layer%dtec",i+1);
843  meErrxLFSasTEC[i] = dbe_->book1D(histo,"RecHit err(x) coord.",100,0.,0.5);
844  sprintf(histo,"Errx_MF_sas_layer%dtec",i+1);
845  meErrxMFSasTEC[i] = dbe_->book1D(histo,"RecHit err(x) coord.",100,0.,0.5);
846  sprintf(histo,"Res_LF_sas_layer%dtec",i+1);
847  meResLFSasTEC[i] = dbe_->book1D(histo,"RecHit Residual",100,-0.5,+0.5);
848  sprintf(histo,"Res_MF_sas_layer%dtec",i+1);
849  meResMFSasTEC[i] = dbe_->book1D(histo,"RecHit Residual",100,-2,+2);
850  sprintf(histo,"Pull_LF_sas_layer%dtec",i+1);
851  mePullLFSasTEC[i] = dbe_->book1D(histo,"Pull",100,-5.,5.);
852  sprintf(histo,"Pull_MF_sas_layer%dtec",i+1);
853  mePullMFSasTEC[i] = dbe_->book1D(histo,"Pull",100,-5.,5.);
854  sprintf(histo,"Trackangle_sas_layer%dtec",i+1);
855  meTrackangleSasTEC[i] = dbe_->book1D(histo,"Track angle",100,-10.,10.);
856  sprintf(histo,"Trackanglebeta_sas_layer%dtec",i+1);
857  meTrackanglebetaSasTEC[i] = dbe_->book1D(histo,"Track angle beta",100,-10.,10.);
858 
859  sprintf(histo,"PullTrackangleProfile_sas_layer%dtec",i+1);
860  mePullTrackangleProfileSasTEC[i] = dbe_->bookProfile(histo,"Pull Track angle Profile", 100, -10., 10.,100, -5., 5.,"s");
861 
862  sprintf(histo,"Trackwidth_sas_layer%dtec",i+1);
863  meTrackwidthSasTEC[i] = dbe_->book1D(histo,"Track width",100,0.,1.);
864 
865  sprintf(histo,"Expectedwidth_sas_layer%dtec",i+1);
866  meExpectedwidthSasTEC[i] = dbe_->book1D(histo,"Expected width",10,0.,10.);
867 
868  sprintf(histo,"Clusterwidth_sas_layer%dtec",i+1);
869  meClusterwidthSasTEC[i] = dbe_->book1D(histo,"Cluster width",10,0.,10.);
870 
871  sprintf(histo,"Category_sas_layer%dtec",i+1);
872  meCategorySasTEC[i] = dbe_->book1D(histo,"Cluster Category",10,0.,10.);
873 
874  sprintf(histo,"PullTrackwidthProfile_sas_layer%dtec",i+1);
875  mePullTrackwidthProfileSasTEC[i] = dbe_->bookProfile(histo,"Pull Track width Profile", 100, 0., 1.,100, -2.,2.,"s");
876 
877  sprintf(histo,"PullTrackwidthProfile_Category1_sas_layer%dtec",i+1);
878  mePullTrackwidthProfileCategory1SasTEC[i] = dbe_->bookProfile(histo,"Pull Track width Profile Category1", 100, 0., 1.,100, -2.,2.,"s");
879 
880  sprintf(histo,"PullTrackwidthProfile_Category2_sas_layer%dtec",i+1);
881  mePullTrackwidthProfileCategory2SasTEC[i] = dbe_->bookProfile(histo,"Pull Track width Profile Category2", 100, 0., 1.,100, -2.,2.,"s");
882 
883  sprintf(histo,"PullTrackwidthProfile_Category3_sas_layer%dtec",i+1);
884  mePullTrackwidthProfileCategory3SasTEC[i] = dbe_->bookProfile(histo,"Pull Track width Profile Category3", 100, 0., 1.,100, -2.,2.,"s");
885 
886  sprintf(histo,"PullTrackwidthProfile_Category4_sas_layer%dtec",i+1);
887  mePullTrackwidthProfileCategory4SasTEC[i] = dbe_->bookProfile(histo,"Pull Track width Profile Category4", 100, 0., 1.,100, -2.,2.,"s");
888 
889  sprintf(histo,"ErrxMFTrackwidthProfile_sas_layer%dtec",i+1);
890  meErrxMFTrackwidthProfileSasTEC[i] = dbe_->bookProfile(histo,"Resolution Track width Profile", 12,0.,4.,100, -2.,2.,"s");
891 
892  sprintf(histo,"ErrxMFTrackwidthProfile_Category1_sas_layer%dtec",i+1);
893  meErrxMFTrackwidthProfileCategory1SasTEC[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Category1", 12,0.,4.,100, -2.,2.,"s");
894  sprintf(histo,"ErrxMFTrackwidthProfile_Category2_sas_layer%dtec",i+1);
895  meErrxMFTrackwidthProfileCategory2SasTEC[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Category2", 12,0.,4.,100, -2.,2.,"s");
896  sprintf(histo,"ErrxMFTrackwidthProfile_Category3_sas_layer%dtec",i+1);
897  meErrxMFTrackwidthProfileCategory3SasTEC[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Category3", 12,0.,4.,100, -2.,2.,"s");
898  sprintf(histo,"ErrxMFTrackwidthProfile_Category4_sas_layer%dtec",i+1);
899  meErrxMFTrackwidthProfileCategory4SasTEC[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Category4", 12,0.,4.,100, -2.,2.,"s");
900 
901  sprintf(histo,"ErrxMFAngleProfile_sas_layer%dtec",i+1);
902  meErrxMFAngleProfileSasTEC[i] = dbe_->bookProfile(histo,"Resolution Angle Profile", 100, 0., 1.,100, -2.,2.,"s");
903 
904  sprintf(histo,"ErrxMFClusterwidthProfile_Category1_sas_layer%dtec",i+1);
905  meErrxMFClusterwidthProfileCategory1SasTEC[i] = dbe_->bookProfile(histo,"Resolution Cluster width Profile Category1", 100, 0., 10.,100, -2.,2.,"s");
906 
907  sprintf(histo,"Posx_matched_layer%dtec",i+1);
908  mePosxMatchedTEC[i] = dbe_->book1D(histo,"RecHit x coord.",100,-6.0, +6.0);
909  sprintf(histo,"Posy_matched_layer%dtec",i+1);
910  mePosyMatchedTEC[i] = dbe_->book1D(histo,"RecHit y coord.",100,-8.0, +8.0);
911  sprintf(histo,"Errx_matched_layer%dtec",i+1);
912  meErrxMatchedTEC[i] = dbe_->book1D(histo,"RecHit err(x) coord.",100,0., 0.02);
913  sprintf(histo,"Erry_matched_layer%dtec",i+1);
914  meErryMatchedTEC[i] = dbe_->book1D(histo,"RecHit err(y) coord.",100,0., 0.1);
915  sprintf(histo,"Resx_matched_layer%dtec",i+1);
916  meResxMatchedTEC[i] = dbe_->book1D(histo,"RecHit Res(x) coord.",100,-0.2, +0.2);
917  sprintf(histo,"Resy_matched_layer%dtec",i+1);
918  meResyMatchedTEC[i] = dbe_->book1D(histo,"RecHit Res(y) coord.",100,-1., +1.);
919  sprintf(histo,"Pullx_matched_layer%dtec",i+1);
920  mePullxMatchedTEC[i] = dbe_->book1D(histo,"Pull",100,-5.,5.);
921  sprintf(histo,"Pully_matched_layer%dtec",i+1);
922  mePullyMatchedTEC[i] = dbe_->book1D(histo,"Pull",100,-5.,5.);
923  }
924  }
925 
926 
927 }
928 
930 
931  /*
932  dbe_->setCurrentFolder("Tracking/TrackingRecHits/Strip/ALL");
933 
934  PullvsTrackwidth->FitSlicesY();
935  ErrxMFvsTrackwidth->FitSlicesY();
936  PullvsExpectedwidth->FitSlicesY();
937  PullvsClusterwidth->FitSlicesY();
938  PullvsTrackangle->FitSlicesY();
939  PullvsTrackanglebeta->FitSlicesY();
940 
941  PullvsTrackwidthTIB->FitSlicesY();
942  PullvsExpectedwidthTIB->FitSlicesY();
943  PullvsClusterwidthTIB->FitSlicesY();
944  PullvsTrackangleTIB->FitSlicesY();
945  PullvsTrackanglebetaTIB->FitSlicesY();
946 
947  PullvsTrackwidthTOB->FitSlicesY();
948  PullvsExpectedwidthTOB->FitSlicesY();
949  PullvsClusterwidthTOB->FitSlicesY();
950  PullvsTrackangleTOB->FitSlicesY();
951  PullvsTrackanglebetaTOB->FitSlicesY();
952 
953  PullvsTrackwidthTID->FitSlicesY();
954  PullvsExpectedwidthTID->FitSlicesY();
955  PullvsClusterwidthTID->FitSlicesY();
956  PullvsTrackangleTID->FitSlicesY();
957  PullvsTrackanglebetaTID->FitSlicesY();
958 
959  PullvsTrackwidthTEC->FitSlicesY();
960  PullvsExpectedwidthTEC->FitSlicesY();
961  PullvsClusterwidthTEC->FitSlicesY();
962  PullvsTrackangleTEC->FitSlicesY();
963  PullvsTrackanglebetaTEC->FitSlicesY();
964 
965  //int aaa = Pullvstrackwidth_1->GetEntries();ErrxMFvsTrackwidth
966 
967  TH1D *PullvsTrackwidth_2 = (TH1D*)gDirectory->Get("PullvsTrackwidth_2");
968  TH1D *PullvsExpectedwidth_2 = (TH1D*)gDirectory->Get("PullvsExpectedwidth_2");
969  TH1D *PullvsClusterwidth_2 = (TH1D*)gDirectory->Get("PullvsClusterwidth_2");
970  TH1D *PullvsTrackangle_2 = (TH1D*)gDirectory->Get("PullvsTrackangle_2");
971  TH1D *PullvsTrackanglebeta_2 = (TH1D*)gDirectory->Get("PullvsTrackanglebeta_2");
972 
973  TH1D *PullvsTrackwidthTIB_2 = (TH1D*)gDirectory->Get("PullvsTrackwidthTIB_2");
974  TH1D *PullvsExpectedwidthTIB_2 = (TH1D*)gDirectory->Get("PullvsExpectedwidthTIB_2");
975  TH1D *PullvsClusterwidthTIB_2 = (TH1D*)gDirectory->Get("PullvsClusterwidthTIB_2");
976  TH1D *PullvsTrackangleTIB_2 = (TH1D*)gDirectory->Get("PullvsTrackangleTIB_2");
977  TH1D *PullvsTrackanglebetaTIB_2 = (TH1D*)gDirectory->Get("PullvsTrackanglebetaTIB_2");
978 
979  TH1D *PullvsTrackwidthTOB_2 = (TH1D*)gDirectory->Get("PullvsTrackwidthTOB_2");
980  TH1D *PullvsExpectedwidthTOB_2 = (TH1D*)gDirectory->Get("PullvsExpectedwidthTOB_2");
981  TH1D *PullvsClusterwidthTOB_2 = (TH1D*)gDirectory->Get("PullvsClusterwidthTOB_2");
982  TH1D *PullvsTrackangleTOB_2 = (TH1D*)gDirectory->Get("PullvsTrackangleTOB_2");
983  TH1D *PullvsTrackanglebetaTOB_2 = (TH1D*)gDirectory->Get("PullvsTrackanglebetaTOB_2");
984 
985  TH1D *PullvsTrackwidthTID_2 = (TH1D*)gDirectory->Get("PullvsTrackwidthTID_2");
986  TH1D *PullvsExpectedwidthTID_2 = (TH1D*)gDirectory->Get("PullvsExpectedwidthTID_2");
987  TH1D *PullvsClusterwidthTID_2 = (TH1D*)gDirectory->Get("PullvsClusterwidthTID_2");
988  TH1D *PullvsTrackangleTID_2 = (TH1D*)gDirectory->Get("PullvsTrackangleTID_2");
989  TH1D *PullvsTrackanglebetaTID_2 = (TH1D*)gDirectory->Get("PullvsTrackanglebetaTID_2");
990 
991  TH1D *PullvsTrackwidthTEC_2 = (TH1D*)gDirectory->Get("PullvsTrackwidthTEC_2");
992  TH1D *PullvsExpectedwidthTEC_2 = (TH1D*)gDirectory->Get("PullvsExpectedwidthTEC_2");
993  TH1D *PullvsClusterwidthTEC_2 = (TH1D*)gDirectory->Get("PullvsClusterwidthTEC_2");
994  TH1D *PullvsTrackangleTEC_2 = (TH1D*)gDirectory->Get("PullvsTrackangleTEC_2");
995  TH1D *PullvsTrackanglebetaTEC_2 = (TH1D*)gDirectory->Get("PullvsTrackanglebetaTEC_2");
996 
997  //cout<<"h2_1->GetEntries() = "<<PullvsTrackwidth_1->GetEntries()<<endl;
998  //cout<<"ddbb1"<<endl;
999  unsigned int NBINSPullvsTrackwidth =PullvsTrackwidth_2->GetNbinsX();
1000  unsigned int NBINSPullvsClusterwidth = PullvsClusterwidth_2->GetNbinsX();
1001  unsigned int NBINSPullvsExpectedwidth = PullvsExpectedwidth_2->GetNbinsX();
1002  //cout<<"ddbb2"<<endl;
1003  unsigned int NBINSPullvsTrackangle = PullvsTrackangle_2->GetNbinsX();
1004  unsigned int NBINSPullvsTrackanglebeta = PullvsTrackanglebeta_2->GetNbinsX();
1005  //cout<<"ddbb3"<<endl;
1006 
1007  PullRMSvsTrackwidth = dbe_->book1D("PullRMSvsTrackwidth", "PullRMSvsTrackwidth",NBINSPullvsTrackwidth ,0.,4.);
1008  PullRMSvsClusterwidth = dbe_->book1D("PullRMSvsClusterwidth", "PullRMSvsClusterwidth",NBINSPullvsClusterwidth ,0.5,8.5);
1009  PullRMSvsExpectedwidth = dbe_->book1D("PullRMSvsExpectedwidth", "PullRMSvsExpectedwidth",NBINSPullvsExpectedwidth ,0.5,4.5);
1010  PullRMSvsTrackangle = dbe_->book1D("PullRMSvsTrackangle", "PullRMSvsTrackangle",NBINSPullvsTrackangle ,0.,90.);
1011  PullRMSvsTrackanglebeta = dbe_->book1D("PullRMSvsTrackanglebeta", "PullRMSvsTrackanglebeta",NBINSPullvsTrackanglebeta ,0.,90.);
1012 
1013  PullRMSvsTrackwidthTIB = dbe_->book1D("PullRMSvsTrackwidthTIB", "PullRMSvsTrackwidthTIB",NBINSPullvsTrackwidth ,0.,4.);
1014  PullRMSvsClusterwidthTIB = dbe_->book1D("PullRMSvsClusterwidthTIB", "PullRMSvsClusterwidthTIB",NBINSPullvsClusterwidth ,0.5,8.5);
1015  PullRMSvsExpectedwidthTIB = dbe_->book1D("PullRMSvsExpectedwidthTIB", "PullRMSvsExpectedwidthTIB",NBINSPullvsExpectedwidth ,0.5,4.5);
1016  PullRMSvsTrackangleTIB = dbe_->book1D("PullRMSvsTrackangleTIB", "PullRMSvsTrackangleTIB",NBINSPullvsTrackangle ,0.,90.);
1017  PullRMSvsTrackanglebetaTIB = dbe_->book1D("PullRMSvsTrackanglebetaTIB", "PullRMSvsTrackanglebetaTIB",NBINSPullvsTrackanglebeta ,0.,90.);
1018 
1019  PullRMSvsTrackwidthTOB = dbe_->book1D("PullRMSvsTrackwidthTOB", "PullRMSvsTrackwidthTOB",NBINSPullvsTrackwidth ,0.,4.);
1020  PullRMSvsClusterwidthTOB = dbe_->book1D("PullRMSvsClusterwidthTOB", "PullRMSvsClusterwidthTOB",NBINSPullvsClusterwidth ,0.5,8.5);
1021  PullRMSvsExpectedwidthTOB = dbe_->book1D("PullRMSvsExpectedwidthTOB", "PullRMSvsExpectedwidthTOB",NBINSPullvsExpectedwidth ,0.5,4.5);
1022  PullRMSvsTrackangleTOB = dbe_->book1D("PullRMSvsTrackangleTOB", "PullRMSvsTrackangleTOB",NBINSPullvsTrackangle ,0.,90.);
1023  PullRMSvsTrackanglebetaTOB = dbe_->book1D("PullRMSvsTrackanglebetaTOB", "PullRMSvsTrackanglebetaTOB",NBINSPullvsTrackanglebeta ,0.,90.);
1024 
1025  PullRMSvsTrackwidthTID = dbe_->book1D("PullRMSvsTrackwidthTID", "PullRMSvsTrackwidthTID",NBINSPullvsTrackwidth ,0.,4.);
1026  PullRMSvsClusterwidthTID = dbe_->book1D("PullRMSvsClusterwidthTID", "PullRMSvsClusterwidthTID",NBINSPullvsClusterwidth ,0.5,8.5);
1027  PullRMSvsExpectedwidthTID = dbe_->book1D("PullRMSvsExpectedwidthTID", "PullRMSvsExpectedwidthTID",NBINSPullvsExpectedwidth ,0.5,4.5);
1028  PullRMSvsTrackangleTID = dbe_->book1D("PullRMSvsTrackangleTID", "PullRMSvsTrackangleTID",NBINSPullvsTrackangle ,0.,90.);
1029  PullRMSvsTrackanglebetaTID = dbe_->book1D("PullRMSvsTrackanglebetaTID", "PullRMSvsTrackanglebetaTID",NBINSPullvsTrackanglebeta ,0.,90.);
1030 
1031  PullRMSvsTrackwidthTEC = dbe_->book1D("PullRMSvsTrackwidthTEC", "PullRMSvsTrackwidthTEC",NBINSPullvsTrackwidth ,0.,4.);
1032  PullRMSvsClusterwidthTEC = dbe_->book1D("PullRMSvsClusterwidthTEC", "PullRMSvsClusterwidthTEC",NBINSPullvsClusterwidth ,0.5,8.5);
1033  PullRMSvsExpectedwidthTEC = dbe_->book1D("PullRMSvsExpectedwidthTEC", "PullRMSvsExpectedwidthTEC",NBINSPullvsExpectedwidth ,0.5,4.5);
1034  PullRMSvsTrackangleTEC = dbe_->book1D("PullRMSvsTrackangleTEC", "PullRMSvsTrackangleTEC",NBINSPullvsTrackangle ,0.,90.);
1035  PullRMSvsTrackanglebetaTEC = dbe_->book1D("PullRMSvsTrackanglebetaTEC", "PullRMSvsTrackanglebetaTEC",NBINSPullvsTrackanglebeta ,0.,90.);
1036 
1037  //cout<<"ddbb5"<<endl;
1038  for(unsigned int i = 0; i !=NBINSPullvsTrackwidth ; ++i){
1039  PullRMSvsTrackwidth->setBinContent(i,PullvsTrackwidth_2 ->GetBinContent(i));
1040  PullRMSvsTrackwidth->setBinError(i,PullvsTrackwidth_2 ->GetBinError(i));
1041  PullRMSvsTrackwidthTIB->setBinContent(i,PullvsTrackwidthTIB_2 ->GetBinContent(i));
1042  PullRMSvsTrackwidthTIB->setBinError(i,PullvsTrackwidthTIB_2 ->GetBinError(i));
1043  PullRMSvsTrackwidthTOB->setBinContent(i,PullvsTrackwidthTOB_2 ->GetBinContent(i));
1044  PullRMSvsTrackwidthTOB->setBinError(i,PullvsTrackwidthTOB_2 ->GetBinError(i));
1045  PullRMSvsTrackwidthTID->setBinContent(i,PullvsTrackwidthTID_2 ->GetBinContent(i));
1046  PullRMSvsTrackwidthTID->setBinError(i,PullvsTrackwidthTID_2 ->GetBinError(i));
1047  PullRMSvsTrackwidthTEC->setBinContent(i,PullvsTrackwidthTEC_2 ->GetBinContent(i));
1048  PullRMSvsTrackwidthTEC->setBinError(i,PullvsTrackwidthTEC_2 ->GetBinError(i));
1049  }
1050  //cout<<"ddbb6"<<endl;
1051  for(unsigned int i = 0; i != NBINSPullvsClusterwidth; ++i){
1052  PullRMSvsClusterwidth->setBinContent(i,PullvsClusterwidth_2 ->GetBinContent(i));
1053  PullRMSvsClusterwidth->setBinError(i,PullvsClusterwidth_2 ->GetBinError(i));
1054  PullRMSvsClusterwidthTIB->setBinContent(i,PullvsClusterwidthTIB_2 ->GetBinContent(i));
1055  PullRMSvsClusterwidthTIB->setBinError(i,PullvsClusterwidthTIB_2 ->GetBinError(i));
1056  PullRMSvsClusterwidthTOB->setBinContent(i,PullvsClusterwidthTOB_2 ->GetBinContent(i));
1057  PullRMSvsClusterwidthTOB->setBinError(i,PullvsClusterwidthTOB_2 ->GetBinError(i));
1058  PullRMSvsClusterwidthTID->setBinContent(i,PullvsClusterwidthTID_2 ->GetBinContent(i));
1059  PullRMSvsClusterwidthTID->setBinError(i,PullvsClusterwidthTID_2 ->GetBinError(i));
1060  PullRMSvsClusterwidthTEC->setBinContent(i,PullvsClusterwidthTEC_2 ->GetBinContent(i));
1061  PullRMSvsClusterwidthTEC->setBinError(i,PullvsClusterwidthTEC_2 ->GetBinError(i));
1062  }
1063  //cout<<"ddbb7"<<endl;
1064  for(unsigned int i = 0; i != NBINSPullvsExpectedwidth; ++i){
1065  PullRMSvsExpectedwidth->setBinContent(i,PullvsExpectedwidth_2 ->GetBinContent(i));
1066  PullRMSvsExpectedwidth->setBinError(i,PullvsExpectedwidth_2 ->GetBinError(i));
1067  PullRMSvsExpectedwidthTIB->setBinContent(i,PullvsExpectedwidthTIB_2 ->GetBinContent(i));
1068  PullRMSvsExpectedwidthTIB->setBinError(i,PullvsExpectedwidthTIB_2 ->GetBinError(i));
1069  PullRMSvsExpectedwidthTOB->setBinContent(i,PullvsExpectedwidthTOB_2 ->GetBinContent(i));
1070  PullRMSvsExpectedwidthTOB->setBinError(i,PullvsExpectedwidthTOB_2 ->GetBinError(i));
1071  PullRMSvsExpectedwidthTID->setBinContent(i,PullvsExpectedwidthTID_2 ->GetBinContent(i));
1072  PullRMSvsExpectedwidthTID->setBinError(i,PullvsExpectedwidthTID_2 ->GetBinError(i));
1073  PullRMSvsExpectedwidthTEC->setBinContent(i,PullvsExpectedwidthTEC_2 ->GetBinContent(i));
1074  PullRMSvsExpectedwidthTEC->setBinError(i,PullvsExpectedwidthTEC_2 ->GetBinError(i));
1075  }
1076  //cout<<"ddbb8"<<endl;
1077  for(unsigned int i = 0; i != NBINSPullvsTrackangle; ++i){
1078  PullRMSvsTrackangle->setBinContent(i,PullvsTrackangle_2 ->GetBinContent(i));
1079  PullRMSvsTrackangle->setBinError(i,PullvsTrackangle_2 ->GetBinError(i));
1080  PullRMSvsTrackangleTIB->setBinContent(i,PullvsTrackangleTIB_2 ->GetBinContent(i));
1081  PullRMSvsTrackangleTIB->setBinError(i,PullvsTrackangleTIB_2 ->GetBinError(i));
1082  PullRMSvsTrackangleTOB->setBinContent(i,PullvsTrackangleTOB_2 ->GetBinContent(i));
1083  PullRMSvsTrackangleTOB->setBinError(i,PullvsTrackangleTOB_2 ->GetBinError(i));
1084  PullRMSvsTrackangleTID->setBinContent(i,PullvsTrackangleTID_2 ->GetBinContent(i));
1085  PullRMSvsTrackangleTID->setBinError(i,PullvsTrackangleTID_2 ->GetBinError(i));
1086  PullRMSvsTrackangleTEC->setBinContent(i,PullvsTrackangleTEC_2 ->GetBinContent(i));
1087  PullRMSvsTrackangleTEC->setBinError(i,PullvsTrackangleTEC_2 ->GetBinError(i));
1088  }
1089  //cout<<"ddbb9"<<endl;
1090  for(unsigned int i = 0; i !=NBINSPullvsTrackanglebeta ; ++i){
1091  PullRMSvsTrackanglebeta->setBinContent(i,PullvsTrackanglebeta_2 ->GetBinContent(i));
1092  PullRMSvsTrackanglebeta->setBinError(i,PullvsTrackanglebeta_2 ->GetBinError(i));
1093  PullRMSvsTrackanglebetaTIB->setBinContent(i,PullvsTrackanglebetaTIB_2 ->GetBinContent(i));
1094  PullRMSvsTrackanglebetaTIB->setBinError(i,PullvsTrackanglebetaTIB_2 ->GetBinError(i));
1095  PullRMSvsTrackanglebetaTOB->setBinContent(i,PullvsTrackanglebetaTOB_2 ->GetBinContent(i));
1096  PullRMSvsTrackanglebetaTOB->setBinError(i,PullvsTrackanglebetaTOB_2 ->GetBinError(i));
1097  PullRMSvsTrackanglebetaTID->setBinContent(i,PullvsTrackanglebetaTID_2 ->GetBinContent(i));
1098  PullRMSvsTrackanglebetaTID->setBinError(i,PullvsTrackanglebetaTID_2 ->GetBinError(i));
1099  PullRMSvsTrackanglebetaTEC->setBinContent(i,PullvsTrackanglebetaTEC_2 ->GetBinContent(i));
1100  PullRMSvsTrackanglebetaTEC->setBinError(i,PullvsTrackanglebetaTEC_2 ->GetBinError(i));
1101  }
1102 */
1103 
1104 
1105 
1106  /*
1107  dbe_->setCurrentFolder("Tracking/TrackingRecHits/Strip/ALL");
1108  unsigned int NBINS = meErrxMFTrackwidthProfile->getNbinsX();
1109  float Entries = meErrxMFTrackwidthProfile->getEntries();
1110  cout<<"Entries = "<<Entries<<endl;
1111  cout<<"NBINS = "<<NBINS<<endl;
1112  NBINS=100;
1113  new_1D = dbe_->book1D("my_name", "my_title", NBINS,0.,5.);
1114  for(unsigned int i = 0; i != NBINS; ++i){
1115  cout<<"i, getBinError(i) = "<<i<<";"<<meErrxMFTrackwidthProfile ->getBinError(i)<<endl;
1116  new_1D->setBinContent(i,meErrxMFTrackwidthProfile ->getBinError(i));
1117  }
1118  */
1119 
1120  /*
1121  myFile->cd();
1122 
1123  PositionSHx->Write();
1124  Diff->Write();
1125  SecondStrip->Write();
1126  ErrxMF->Write();
1127  ErrxMFvsTrackwidth->Write();
1128  ResMFvsTrackwidth->Write();
1129  ResMFvsTrackwidthWClus1->Write();
1130  ResMFvsTrackwidthWClus1Wexp1->Write();
1131  ResMFvsTrackwidthWClus1Wexp2->Write();
1132  ResMFvsTrackwidthWClus1Wexp3->Write();
1133  ResMFvsTrackwidthWClus1Wexp4->Write();
1134  ResMFvsTrackwidthWClus2->Write();
1135  ResMFvsTrackwidthWClus2Wexp1->Write();
1136  ResMFvsTrackwidthWClus2Wexp2->Write();
1137  ResMFvsTrackwidthWClus2Wexp3->Write();
1138  ResMFvsTrackwidthWClus2Wexp4->Write();
1139  ResMFvsTrackwidthWClus3->Write();
1140  ResMFvsTrackwidthWClus3Wexp1->Write();
1141  ResMFvsTrackwidthWClus3Wexp2->Write();
1142  ResMFvsTrackwidthWClus3Wexp3->Write();
1143  ResMFvsTrackwidthWClus3Wexp4->Write();
1144  ResMFvsTrackwidthWClus4->Write();
1145  ResMFvsTrackwidthWClus4Wexp1->Write();
1146  ResMFvsTrackwidthWClus4Wexp2->Write();
1147  ResMFvsTrackwidthWClus4Wexp3->Write();
1148  ResMFvsTrackwidthWClus4Wexp4->Write();
1149  ErrxMFvsTrackwidthWClus1->Write();
1150  ErrxMFvsTrackwidthWClus2->Write();
1151  ErrxMFvsTrackwidthWClus3->Write();
1152  ErrxMFvsTrackwidthWClus4->Write();
1153 
1154  ResMFvsTrackwidthCategory2->Write();
1155  ResMFvsTrackwidthCategory3->Write();
1156  ResMFvsTrackwidthCategory4->Write();
1157 
1158  ErrxMFvsTrackwidthCategory2->Write();
1159  ErrxMFvsTrackwidthCategory3->Write();
1160  ErrxMFvsTrackwidthCategory4->Write();
1161 
1162  // ErrxMFvsTrackwidth_1->Write();
1163  //ErrxMFvsTrackwidth_2->Write();
1164 
1165  PullvsTrackwidth->Write();
1166  //PullvsTrackwidth_1 ->Write();
1167  //PullvsTrackwidth_2 ->Write();
1168  PullvsExpectedwidth->Write();
1169  PullvsExpectedwidth_1 ->Write();
1170  PullvsExpectedwidth_2 ->Write();
1171  PullvsClusterwidth->Write();
1172  PullvsClusterwidth_1 ->Write();
1173  PullvsClusterwidth_2 ->Write();
1174  PullvsTrackangle->Write();
1175  PullvsTrackangle_1 ->Write();
1176  PullvsTrackangle_2 ->Write();
1177  PullvsTrackanglebeta->Write();
1178  PullvsTrackanglebeta_1 ->Write();
1179  PullvsTrackanglebeta_2 ->Write();
1180  myFile->Close();
1181  */
1182 
1183 
1184  if ( outputFile_.size() != 0 && dbe_ ) dbe_->save(outputFile_);
1185 }
1186 
1187 // Virtual destructor needed.
1189 
1190 }
1191 
1192 // Functions that gets called by framework every event
1194 {
1195 
1196  // EventID e.id() ;
1197 
1198  // float diff=0;
1199  //float positionshx = 0;
1200  //int secondstrip = 0;
1201 
1202  int isrechitrphi = 0;
1203  int isrechitsas = 0;
1204  int isrechitmatched = 0;
1205 
1206  float anglealpha=0;
1207  float anglebeta=0;
1208  float Wtrack;
1209  int Wexp;
1210  int clusterWidth;
1211  DetId detid;
1212  uint32_t myid;
1213 
1215  LocalError error;
1216  MeasurementPoint Mposition;
1217  MeasurementError Merror;
1218 
1219  int clusiz=0;
1220  int totcharge=0;
1221 
1222 
1223  float mindist = 999999;
1224  float dist;
1225  std::vector<PSimHit> matched;
1226 
1227  TrackerHitAssociator associate(e, conf_);
1228  PSimHit closest;
1229 
1230 
1231 
1233  es.get<TrackerDigiGeometryRecord> ().get (pDD);
1234  const TrackerGeometry &tracker(*pDD);
1235 
1236  const TrackerGeometry * tracker2;
1238  es.get<TrackerDigiGeometryRecord>().get(estracker);
1239  tracker2=&(* estracker);
1240 
1242  //iRecord.getRecord<IdealMagneticFieldRecord>().get(magfield );
1243  es.get<IdealMagneticFieldRecord>().get(magfield );
1244  // magfield_ = magfield;
1245  //const magfield_
1246  const MagneticField & magfield_ (*magfield);
1247  magfield2_ = &magfield_;
1248 
1249 
1251  es.get<TkStripCPERecord>().get("SimpleStripCPE",stripcpe);
1252 
1253  //
1254 
1255 
1256  // Mangano's
1257 
1258  edm::Handle<vector<Trajectory> > trajCollectionHandle;
1259  e.getByLabel(conf_.getParameter<string>("trajectoryInput"),trajCollectionHandle);
1260 
1261  edm::LogVerbatim("TrajectoryAnalyzer") << "trajColl->size(): " << trajCollectionHandle->size() ;
1262 
1263  //cout<<"trajColl->size() = "<<trajCollectionHandle->size()<<endl;
1264 
1265  for(vector<Trajectory>::const_iterator it = trajCollectionHandle->begin(); it!=trajCollectionHandle->end();it++){
1266 
1267  edm::LogVerbatim("TrajectoryAnalyzer") << "this traj has " << it->foundHits() << " valid hits" << " , "
1268  << "isValid: " << it->isValid() ;
1269 
1270  vector<TrajectoryMeasurement> tmColl = it->measurements();
1271  for(vector<TrajectoryMeasurement>::const_iterator itTraj = tmColl.begin(); itTraj!=tmColl.end(); itTraj++){
1272  if(! itTraj->updatedState().isValid()) continue;
1273 
1274 // edm::LogVerbatim("TrajectoryAnalyzer") << "tm number: " << (itTraj - tmColl.begin()) + 1<< " , "
1275 // << "tm.backwardState.pt: " << itTraj->backwardPredictedState().globalMomentum().perp() << " , "
1276 // << "tm.forwardState.pt: " << itTraj->forwardPredictedState().globalMomentum().perp() << " , "
1277 // << "tm.updatedState.pt: " << itTraj->updatedState().globalMomentum().perp() << " , "
1278 // << "tm.globalPos.perp: " << itTraj->updatedState().globalPosition().perp() ;
1279 
1280  if ( itTraj->updatedState().globalMomentum().perp() < 1.) continue;
1281 
1282  TrajectoryStateOnSurface tsos=itTraj->updatedState();
1283  LocalVector trackdirection=tsos.localDirection();
1284 
1285  DetId detid2 = itTraj->recHit()->geographicalId();
1286 
1287  const TransientTrackingRecHit::ConstRecHitPointer thit2=itTraj->recHit();
1288  const SiStripMatchedRecHit2D* matchedhit=dynamic_cast<const SiStripMatchedRecHit2D*>((*thit2).hit());
1289  const SiStripRecHit2D* hit2d=dynamic_cast<const SiStripRecHit2D*>((*thit2).hit());
1290  const SiStripRecHit1D* hit1d=dynamic_cast<const SiStripRecHit1D*>((*thit2).hit());
1291  //if(matchedhit) cout<<"manganomatchedhit"<<endl;
1292  //if(hit) cout<<"manganosimplehit"<<endl;
1293  //if (hit && matchedhit) cout<<"manganosimpleandmatchedhit"<<endl;
1294  const TrackingRecHit *thit = (*thit2).hit();
1295 
1296  detid = (thit)->geographicalId();
1297  myid=((thit)->geographicalId()).rawId();
1298 
1299  StripSubdetector StripSubdet = (StripSubdetector) detid;
1300 
1301  isrechitmatched = 0;
1302 
1303  if(matchedhit){
1304 
1305  isrechitmatched = 1;
1306 
1307  position = (thit)->localPosition();
1308  // Mposition = topol.measurementPosition(position);
1309  error = (thit)->localPositionError();
1310  // Merror = topol.measurementError(position,error);
1311  rechitmatchedx = position.x();
1312  rechitmatchedy = position.y();
1313  rechitmatchedz = position.z();
1314  rechitmatchederrxx = error.xx();
1315  rechitmatchederrxy = error.xy();
1316  rechitmatchederryy = error.yy();
1317 
1318  //Association of the rechit to the simhit
1319  mindist = 999999;
1320  float distx, disty;
1321  std::pair<LocalPoint,LocalVector> closestPair;
1322  matched.clear();
1323  matched = associate.associateHit(*matchedhit);
1324  if(!matched.empty()){
1325  //project simhit;
1326  const GluedGeomDet* gluedDet = (const GluedGeomDet*)tracker.idToDet(matchedhit->geographicalId());
1327  const StripGeomDetUnit* partnerstripdet =(StripGeomDetUnit*) gluedDet->stereoDet();
1328  std::pair<LocalPoint,LocalVector> hitPair;
1329  for(vector<PSimHit>::const_iterator m=matched.begin(); m<matched.end(); m++){
1330  //project simhit;
1331  hitPair= projectHit((*m),partnerstripdet,gluedDet->surface());
1332  distx = fabs(rechitmatchedx - hitPair.first.x());
1333  disty = fabs(rechitmatchedy - hitPair.first.y());
1334  dist = distx*distx+disty*disty;
1335  if(sqrt(dist)<mindist){
1336  mindist = dist;
1337  closestPair = hitPair;
1338  }
1339  }
1340  rechitmatchedresx = rechitmatchedx - closestPair.first.x();
1341  rechitmatchedresy = rechitmatchedy - closestPair.first.y();
1342  rechitmatchedpullx = ((thit)->localPosition().x() - (closestPair.first.x()))/sqrt(error.xx());
1343  rechitmatchedpully = ((thit)->localPosition().y() - (closestPair.first.y()))/sqrt(error.yy());
1344  }
1345  }
1346 
1347  //Filling Histograms for Matched hits
1348 
1349  if(isrechitmatched){
1350 
1351  if (detid.subdetId() == int(StripSubdetector::TIB)){
1352  TIBDetId tibid(myid);
1353  int Tibisrechitmatched = isrechitmatched;
1354  int ilay = tibid.layer() - 1; //for histogram filling
1355  if(Tibisrechitmatched>0){
1363 
1364  }
1365  }
1366 
1367  if (detid.subdetId() == int(StripSubdetector::TOB)){
1368  TOBDetId tobid(myid);
1369  int Tobisrechitmatched = isrechitmatched;
1370  int ilay = tobid.layer() - 1; //for histogram filling
1371  if(Tobisrechitmatched>0){
1380  }
1381  }
1382  if (detid.subdetId() == int(StripSubdetector::TID)){
1383  TIDDetId tidid(myid);
1384  int Tidisrechitmatched = isrechitmatched;
1385  int ilay = tidid.ring() - 1; //for histogram filling
1386  if(Tidisrechitmatched>0){
1395  }
1396  }
1397  if (detid.subdetId() == int(StripSubdetector::TEC)){
1398  TECDetId tecid(myid);
1399  int Tecisrechitmatched = isrechitmatched;
1400  int ilay = tecid.ring() - 1; //for histogram filling
1401  if(Tecisrechitmatched>0){
1410  }
1411  }
1412 
1413  }
1414 
1415 
1417  // simple hits from matched hits
1419  // Reset variables
1420 
1421  isrechitrphi = 0;
1422  isrechitsas = 0;
1423  rechitrphix =0;
1424  rechitrphierrxLF =0;
1425  rechitrphierrxMF =0;
1426  rechitrphiy =0;
1427  rechitrphiz =0;
1428  rechitsasx =0;
1429  rechitsaserrxLF =0;
1430  rechitsaserrxMF =0;
1431  rechitsasy =0;
1432  rechitsasz =0;
1433  clusizrphi =0;
1434  clusizsas =0;
1435  cluchgrphi =0;
1436  cluchgsas =0;
1437  rechitrphiresLF=-999.;
1438  rechitrphiresMF=-999.;
1439  rechitrphipullLF=-999.;
1440  rechitrphipullMF=-999.;
1446  rechitrphicategory =0;
1447  rechitrphithickness = 0.;
1448  rechitsasresLF=-999.;
1449  rechitsasresMF=-999.;
1450  rechitsaspullLF=-999.;
1451  rechitsaspullMF=-999.;
1454  rechitsasthickness = 0;
1455 
1456  GluedGeomDet * gdet;
1457  const GeomDetUnit * monodet;
1458  const SiStripRecHit2D *monohit;
1459  const StripGeomDetUnit * stripdet;
1460 
1461  if (matchedhit)
1462  {
1463  auto hm =matchedhit->monoHit();
1464  monohit=&hm;
1465  // const GeomDetUnit * monodet=gdet->monoDet();
1466  gdet=(GluedGeomDet *)tracker2->idToDet(matchedhit->geographicalId());
1467  monodet=gdet->monoDet();
1468  GlobalVector gtrkdir=gdet->toGlobal(trackdirection);
1469  LocalVector monotkdir=monodet->toLocal(gtrkdir);
1470  // const GeomDetUnit * det = tracker.idToDetUnit(detid);
1471  //stripdet=(const StripGeomDetUnit*)(gdet);
1472  stripdet=(const StripGeomDetUnit*)(monodet);
1473  // const StripTopology &topol2=(const StripTopology&)stripdet->topology();
1474 
1475  if(monotkdir.z()!=0){
1476  anglealpha = atan(monotkdir.x()/monotkdir.z())*180/TMath::Pi();
1477  anglebeta = atan(monotkdir.y()/monotkdir.z())*180/TMath::Pi();
1478  }
1479 
1480  if(monohit){
1481 
1482  const StripTopology &topol=(const StripTopology&)stripdet->topology();
1483 
1484  position = monohit->localPosition();
1485  error = monohit->localPositionError();
1486  Mposition = topol.measurementPosition(position);
1487  Merror = topol.measurementError(position,error);
1488 
1489  LocalVector drift = stripcpe->driftDirection(stripdet);
1490  float thickness=stripdet->surface().bounds().thickness();
1491  rechitrphithickness = thickness;
1492 
1493  //cout<<"thickness = "<<thickness<<endl;
1494  float pitch = topol.localPitch(position);
1495  //cout<<"Valid:pitch = "<<pitch<<endl;
1496  float tanalpha = tan(anglealpha/57.3);
1497  //cout<<"Valid:tanalpha = "<<tanalpha<<endl;
1498  float tanalphaL = drift.x()/drift.z();
1499  //float tanalphaLbis = driftbis.x()/driftbis.z();
1500  //float tanalphaLter = driftter.x()/driftter.z();
1501  //cout<<"Validmonofrommatched:drift.x() = "<<drift.x()<<endl;
1502  //cout<<"Valid:drift.x() = "<<drift.x()<<endl;
1503  //cout<<"Valid:driftbis.x() = "<<driftbis.x()<<endl;
1504  //cout<<"Valid:driftter.x() = "<<driftter.x()<<endl;
1505  //cout<<"Valid:driftter.z() = "<<driftter.z()<<endl;
1506  //cout<<"Valid:tanalphaL = "<<tanalphaL<<endl;
1507  Wtrack = fabs((thickness/pitch)*tanalpha - (thickness/pitch)*tanalphaL);
1508  //cout<<"Valid1:Wtrack = "<<Wtrack<<endl;
1509  float SLorentz = 0.5*(thickness/pitch)*tanalphaL;
1510  //int nstrips = topol.nstrips();
1511  //clusterWidth = cluster->amplitudes().size();
1512  int Sp = int(position.x()/pitch+SLorentz+0.5*Wtrack);
1513  int Sm = int(position.x()/pitch+SLorentz-0.5*Wtrack);
1514  Wexp = 1+Sp-Sm;
1515  //cout<<"DebugLine22"<<endl;
1516 
1517  isrechitrphi = 1;
1518  //cout<<"DebugLine23"<<endl;
1519  // const edm::Ref<edm::DetSetVector<SiStripCluster>, SiStripCluster, edm::refhelper::FindForDetSetVector<SiStripCluster> > cluster=hit->cluster();
1520  SiStripRecHit2D::ClusterRef cluster=monohit->cluster();
1521  //SiStripRecHit1D::ClusterRef cluster=monohit->cluster();
1522  clusiz=0;
1523  totcharge=0;
1524  clusiz = cluster->amplitudes().size();
1525  // cout<<"clusiz = "<<clusiz<<endl;
1526  const std::vector<uint8_t> amplitudes=cluster->amplitudes();
1527  for(size_t ia=0; ia<amplitudes.size();ia++){
1528  totcharge+=amplitudes[ia];
1529  }
1530  rechitrphix = position.x();
1531  rechitrphiy = position.y();
1532  rechitrphiz = position.z();
1533  rechitrphierrxLF = error.xx();
1534  rechitrphierrxMF = Merror.uu();
1535  // cout<<"rechitrphierrxMF from Matched hit= "<<sqrt(rechitrphierrxMF)<<endl;
1536  clusizrphi = clusiz;
1537  cluchgrphi = totcharge;
1538 
1539  //Association of the rechit to the simhit
1540  mindist = 999999;
1541  matched.clear();
1542  // matched = associate.associateHit(*hit);
1543  matched = associate.associateHit(*monohit);
1544  if(!matched.empty()){
1545  // cout << "\t\t\tmatched " << matched.size() << endl;
1546  // cout<<"associatesimplehit"<<endl;
1547  for(vector<PSimHit>::const_iterator m=matched.begin(); m<matched.end(); m++){
1548  dist = abs((monohit)->localPosition().x() - (*m).localPosition().x());
1549  if(dist<mindist){
1550  mindist = dist;
1551  closest = (*m);
1552  }
1553  rechitrphiresLF = rechitrphix - closest.localPosition().x();
1554  rechitrphiresMF = Mposition.x() - (topol.measurementPosition(closest.localPosition())).x();
1557  //cout<<"rechitrphiresMF == "<<rechitrphiresMF<<endl;
1558  //cout<<"rechitrphierrxMF == "<<rechitrphierrxMF<<endl;
1559  //cout<<"rechitrphierrxLF == "<<rechitrphierrxLF<<endl;
1560  //cout<<"rechitrphipullMF == "<<rechitrphipullMF<<endl;
1561 
1562  }
1563  }
1564  rechitrphitrackangle = anglealpha;
1565  rechitrphitrackanglebeta = anglebeta;
1566  //rechitrphitrackangle = tanalphaL;
1567  //cout<<"Wtrack = "<<Wtrack<<endl;
1568  rechitrphitrackwidth = Wtrack;
1569  rechitrphiexpectedwidth = Wexp;
1570  clusterWidth = clusiz;
1571  unsigned int iopt;
1572  if (clusterWidth > Wexp + 2) {
1573  iopt = 1;
1574  } else if (Wexp == 1) {
1575  iopt = 2;
1576  } else if (clusterWidth <= Wexp) {
1577  iopt = 3;
1578  } else {
1579  iopt = 4;
1580  }
1581  rechitrphicategory = iopt;
1582  }
1583 
1584  auto s =matchedhit->stereoHit();
1585  const SiStripRecHit2D *stereohit=&s;
1586  const GeomDetUnit * stereodet=gdet->stereoDet();
1587  // GlobalVector
1588  gtrkdir=gdet->toGlobal(trackdirection);
1589  LocalVector stereotkdir=stereodet->toLocal(gtrkdir);
1590  if(stereotkdir.z()!=0){
1591  anglealpha = atan(stereotkdir.x()/stereotkdir.z())*180/TMath::Pi();
1592  anglebeta = atan(stereotkdir.y()/stereotkdir.z())*180/TMath::Pi();
1593  }
1594 
1595  if (stereohit)
1596  {
1597  // cout<<"stereohit from matched hit"<<endl;
1598  isrechitsas = 1;
1599  SiStripRecHit2D::ClusterRef cluster=stereohit->cluster();
1600 
1601  // const GeomDetUnit * det = tracker.idToDetUnit(detid2);
1602  const StripGeomDetUnit * stripdet=(const StripGeomDetUnit*)(stereodet);
1603  const StripTopology &topol=(const StripTopology&)stripdet->topology();
1604 
1605  position = stereohit->localPosition();
1606  // Mposition = topol.measurementPosition(position);
1607  error = stereohit->localPositionError();
1608  Mposition = topol.measurementPosition(position);
1609  Merror = topol.measurementError(position,error);
1610 
1611  //LocalVector drift= driftDirection(stripdet);
1612  LocalVector drift = stripcpe->driftDirection(stripdet);
1613  float thickness=stripdet->surface().bounds().thickness();
1614  rechitsasthickness = thickness;
1615  //cout<<"thickness = "<<thickness<<endl;
1616  float pitch = topol.localPitch(position);
1617  //cout<<"Valid:pitch = "<<pitch<<endl;
1618  float tanalpha = tan(anglealpha/57.3);
1619  //cout<<"Valid:tanalpha = "<<tanalpha<<endl;
1620  float tanalphaL = drift.x()/drift.z();
1621  //cout<<"Validstereofrommatched:drift.x() = "<<drift.x()<<endl;
1622  //cout<<"Valid:drift.z() = "<<drift.z()<<endl;
1623  //cout<<"Valid:tanalphaL = "<<tanalphaL<<endl;
1624  Wtrack = fabs((thickness/pitch)*tanalpha - (thickness/pitch)*tanalphaL);
1625  //cout<<"Valid:Wtrack = "<<Wtrack<<endl;
1626  float SLorentz = 0.5*(thickness/pitch)*tanalphaL;
1627  //int nstrips = topol.nstrips();
1628  int Sp = int(position.x()/pitch+SLorentz+0.5*Wtrack);
1629  int Sm = int(position.x()/pitch+SLorentz-0.5*Wtrack);
1630  Wexp = 1+Sp-Sm;
1631 
1632 
1633  clusiz=0;
1634  totcharge=0;
1635  clusiz = cluster->amplitudes().size();
1636  const std::vector<uint8_t> amplitudes=cluster->amplitudes();
1637  for(size_t ia=0; ia<amplitudes.size();ia++){
1638  totcharge+=amplitudes[ia];
1639  }
1640  rechitsasx = position.x();
1641  rechitsasy = position.y();
1642  rechitsasz = position.z();
1643  rechitsaserrxLF = error.xx();
1644  // cout<<"rechitsaserrxLF = "<<rechitsaserrxLF<<endl;
1645  rechitsaserrxMF = Merror.uu();
1646  // cout<<"rechitsaserrxMF from Matched hit = "<<sqrt(rechitsaserrxMF)<<endl;
1647  clusizsas = clusiz;
1648  cluchgsas = totcharge;
1649 
1650  //Association of the rechit to the simhit
1651  mindist = 999999;
1652  matched.clear();
1653  matched = associate.associateHit(*stereohit);
1654  if(!matched.empty()){
1655  // cout << "\t\t\tmatched " << matched.size() << endl;
1656  for(vector<PSimHit>::const_iterator m=matched.begin(); m<matched.end(); m++){
1657  dist = abs((stereohit)->localPosition().x() - (*m).localPosition().x());
1658  if(dist<mindist){
1659  mindist = dist;
1660  closest = (*m);
1661  }
1662 
1663  rechitsasresLF = rechitsasx - closest.localPosition().x();
1664  rechitsasresMF = Mposition.x() - (topol.measurementPosition(closest.localPosition())).x();
1667 
1668 // cout<<"rechitsasresMF == "<<rechitsasresMF<<endl;
1669 // cout<<"rechitsaserrxMF == "<<rechitsaserrxMF<<endl;
1670 // cout<<"rechitsaserrxLF == "<<rechitsaserrxLF<<endl;
1671 // cout<<"rechitsaspullMF == "<<rechitsaspullMF<<endl;
1672 
1673  }
1674  }
1675  rechitsastrackangle = anglealpha;
1676  rechitsastrackanglebeta = anglebeta;
1677  rechitsastrackwidth = Wtrack;
1678  rechitsasexpectedwidth = Wexp;
1679 
1680  clusterWidth = clusiz;
1681  unsigned int iopt;
1682  if (clusterWidth > Wexp + 2) {
1683  iopt = 1;
1684  } else if (Wexp == 1) {
1685  iopt = 2;
1686  } else if (clusterWidth <= Wexp) {
1687  iopt = 3;
1688  } else {
1689  iopt = 4;
1690  }
1691  rechitsascategory = iopt;
1692  }
1693  }
1694 
1695 
1696  // A VIRER !!!!!!!!!!!!!!!!!!!!
1697 
1698  // isrechitrphi = 0;
1699  //isrechitsas = 0;
1700 
1701 
1702  if(hit1d){
1703  // simple hits are mono or stereo
1704  // cout<<"simple hit"<<endl;
1705  if (StripSubdet.stereo() == 0){
1706  isrechitrphi = 1;
1707  // cout<<"simple hit mono"<<endl;
1708 
1709  const GeomDetUnit * det = tracker.idToDetUnit(detid2);
1710  const StripGeomDetUnit * stripdet=(const StripGeomDetUnit*)(det);
1711  const StripTopology &topol=(const StripTopology&)stripdet->topology();
1712 
1713  float anglealpha = atan(trackdirection.x()/trackdirection.z())*180/TMath::Pi();
1714  float anglebeta = atan(trackdirection.y()/trackdirection.z())*180/TMath::Pi();
1715 
1716  //SiStripRecHit2D::ClusterRef cluster=hit->cluster();
1717  SiStripRecHit1D::ClusterRef cluster=hit1d->cluster();
1718 
1719  position = thit->localPosition();
1720  error = thit->localPositionError();
1721  Mposition = topol.measurementPosition(position);
1722  Merror = topol.measurementError(position,error);
1723 
1724  LocalVector drift = stripcpe->driftDirection(stripdet);
1725  float thickness=stripdet->surface().bounds().thickness();
1726  rechitrphithickness = thickness;
1727  //cout<<"Valid:thickness = "<<thickness<<endl;
1728  float pitch = topol.localPitch(position);
1729  //cout<<"Valid:pitch = "<<pitch<<endl;
1730  float tanalpha = tan(anglealpha/57.3);
1731  //cout<<"Valid:tanalpha = "<<tanalpha<<endl;
1732  float tanalphaL = drift.x()/drift.z();
1733  //cout<<"Valid:tanalphaL = "<<tanalphaL<<endl;
1734  // float tanalphaLcpe = driftcpe.x()/driftcpe.z();
1735  //cout<<"Valid:tanalphaLcpe = "<<tanalphaLcpe<<endl;
1736  //cout<<"Validmono:drift.x() = "<<drift.x()<<endl;
1737  //cout<<"Valid:drift.z() = "<<drift.z()<<endl;
1738  //cout<<"Valid:tanalphaL = "<<tanalphaL<<endl;
1739  Wtrack = fabs((thickness/pitch)*tanalpha - (thickness/pitch)*tanalphaL);
1740  // fabs((thickness/pitch)*tanalpha - (thickness/pitch)*tanalphaL);
1741  //cout<<"Valid2:Wtrack = "<<Wtrack<<endl;
1742  float SLorentz = 0.5*(thickness/pitch)*tanalphaL;
1743  //int nstrips = topol.nstrips();
1744  int Sp = int(position.x()/pitch+SLorentz+0.5*Wtrack);
1745  int Sm = int(position.x()/pitch+SLorentz-0.5*Wtrack);
1746  Wexp = 1+Sp-Sm;
1747 
1748  clusiz=0;
1749  totcharge=0;
1750  clusiz = cluster->amplitudes().size();
1751  //cout<<"cluster->firstStrip() = "<<cluster->firstStrip()<<endl;
1752  const std::vector<uint8_t> amplitudes=cluster->amplitudes();
1753  for(size_t ia=0; ia<amplitudes.size();ia++){
1754  totcharge+=amplitudes[ia];
1755  }
1756  rechitrphix = position.x();
1757  rechitrphiy = position.y();
1758  rechitrphiz = position.z();
1759  rechitrphierrx = error.xx();
1760  rechitrphierrxLF = error.xx();
1761  rechitrphierrxMF = Merror.uu();
1762  //cout<<"rechitrphierrxMF simple hit= "<<sqrt(rechitrphierrxMF)<<endl;
1763  clusizrphi = clusiz;
1764  //cout<<"clusizrphi = "<<clusiz<<endl;
1765  cluchgrphi = totcharge;
1766 
1767  //Association of the rechit to the simhit
1768  mindist = 999999;
1769  matched.clear();
1770  matched = associate.associateHit(*hit1d);
1771  if(!matched.empty()){
1772  // cout << "\t\t\tmatched " << matched.size() << endl;
1773  for(vector<PSimHit>::const_iterator m=matched.begin(); m<matched.end(); m++){
1774  dist = abs((hit1d)->localPosition().x() - (*m).localPosition().x());
1775  if(dist<mindist){
1776  mindist = dist;
1777  closest = (*m);
1778  }
1779  rechitrphiresLF = rechitrphix - closest.localPosition().x();
1780  rechitrphiresMF = Mposition.x() - (topol.measurementPosition(closest.localPosition())).x();
1781  rechitrphipullLF = (thit->localPosition().x() - (closest).localPosition().x())/sqrt(error.xx());
1783  }
1784  }
1785  rechitrphitrackangle = anglealpha;
1786  rechitrphitrackanglebeta = anglebeta;
1787  rechitrphitrackwidth = Wtrack;
1788  rechitrphiexpectedwidth = Wexp;
1789 
1790  clusterWidth = clusiz;
1791  unsigned int iopt;
1792  if (clusterWidth > Wexp + 2) {
1793  iopt = 1;
1794  } else if (Wexp == 1) {
1795  iopt = 2;
1796  } else if (clusterWidth <= Wexp) {
1797  iopt = 3;
1798  } else {
1799  iopt = 4;
1800  }
1801  rechitrphicategory = iopt;
1802 
1803 // if (rechitrphiexpectedwidth == 1 && clusterWidth == 3) {
1804 // //if ( clusterWidth == 3) {
1805 // cout<<"TRUE"<<endl;
1806 // cout<<"TestClus2:Position SH = "<<(closest).localPosition().x()<<" , "<<(topol.measurementPosition(closest.localPosition())).x()<<endl;
1807 // cout<<"TestClus2:Position RH = "<<thit->localPosition().x()<<" ,"<<Mposition.x()<<endl;
1808 // cout<<"TestClus2:residue = "<<rechitrphiresMF<<endl;
1809 // short firstStrip = cluster->firstStrip();
1810 // short lastStrip = firstStrip + clusterWidth - 1;
1811 // cout<<"TestClus2:firstStrip = "<<firstStrip<<endl;
1812 // cout<<"TestClus2:lastStrip = "<<lastStrip<<endl;
1813 // cout<<"TestClus2:detid = "<<detid.subdetId()<<endl;
1814 // for(size_t ia=0; ia<amplitudes.size();ia++){
1815 // cout<<"ia, TestClus2:charge= "<<ia<<" , "<<amplitudes[ia]<<endl;
1816 // }
1817 // cout<<"TestClus2:Trackwidth = "<<Wtrack<<endl;
1818 // }
1819 
1820 
1821  //cout<<"rechitrphicategory = "<<rechitrphicategory<<endl;
1822 
1823  // if ((detid.subdetId() == int(StripSubdetector::TID)) || (detid.subdetId() == int(StripSubdetector::TEC))) {
1824  //if ((detid.subdetId() == int(StripSubdetector::TIB))) {
1825 
1826 // if (clusterWidth ==2 && Wexp == 1 && Wtrack<0.1) {
1827 // cout<<"TestClus:begin"<<endl;
1828 // LocalVector drift2 = drift * fabs(thickness/drift.z());
1829 // LocalPoint result2=LocalPoint(position.x()-drift2.x()/2,position.y()-drift2.y()/2,0);
1830 // MeasurementPoint mpoint=topol.measurementPosition(result2);
1831 // cout<<"TestClus:Position SH = "<<(closest).localPosition().x()<<" , "<<(topol.measurementPosition(closest.localPosition())).x()<<endl;
1832 // cout<<"TestClus:Position RH = "<<thit->localPosition().x()<<" ,"<<Mposition.x()<<endl;
1833 // cout<<"TestClus:Position RH no drift= "<<thit->localPosition().x() - drift2.x()/2<<" , "<<mpoint.x()<<endl;
1834 // cout<<"TestClus:Drift= "<<drift.x()<<endl;
1835 // cout<<"TestClus:residue = "<<rechitrphiresMF<<endl;
1836 // for(size_t ia=0; ia<amplitudes.size();ia++){
1837 // cout<<"ia, TestClus:charge= "<<ia<<" , "<<amplitudes[ia]<<endl;
1838 // }
1839 // cout<<"TestClus:Trackwidth = "<<Wtrack<<endl;
1840 // short firstStrip = cluster->firstStrip();
1841 // short lastStrip = firstStrip + clusterWidth - 1;
1842 // cout<<"TestClus:firstStrip = "<<firstStrip<<endl;
1843 // cout<<"TestClus:lastStrip = "<<lastStrip<<endl;
1844 // cout<<"TestClus:detid = "<<detid.subdetId()<<endl;
1845 // int nstrips = topol.nstrips();
1846 // cout<<"TestClus:nstrips = "<<nstrips<<endl;
1847 // cout<<"TestClus:anglealpha = "<<anglealpha<<endl;
1848 // cout<<"TestClus:end"<<endl;
1849 // positionshx = (topol.measurementPosition(closest.localPosition())).x();
1850 
1851 // if ((positionshx - int(positionshx)) > 0.5) {
1852 // if (lastStrip > int(positionshx)) secondstrip = 1;
1853 // if (lastStrip = int(positionshx)) secondstrip = -1;
1854 // }
1855 // if ((positionshx - int(positionshx)) < 0.5) {
1856 // if (lastStrip > int(positionshx)) secondstrip = -1;
1857 // if (lastStrip = int(positionshx)) secondstrip = 1;
1858 // }
1859 
1860 // }
1861 
1862  //}
1863 
1864 // cout<<"int() = "<<int((topol.measurementPosition(closest.localPosition())).x())<<endl;
1865 // diff = int((topol.measurementPosition(closest.localPosition())).x()) -topol.measurementPosition(closest.localPosition()).x();
1866 // cout<<"diff = "<<diff<<endl;
1867 // if (clusterWidth ==2 && Wexp == 1 && Wtrack<1) {
1868 // if ((abs(1 + diff) <0.2) || (abs(diff) <0.2)) {
1869 // // isrechitrphi = 0;
1870 // cout<<"vire"<<endl;
1871 // }
1872 // }
1873 // positionshx = (topol.measurementPosition(closest.localPosition())).x();
1874 
1875 
1876  }
1877 
1878  if (StripSubdet.stereo() == 1){
1879 
1880  //cout<<"simple hit stereo"<<endl;
1881  isrechitsas = 1;
1882 
1883  const GeomDetUnit * det = tracker.idToDetUnit(detid2);
1884  const StripGeomDetUnit * stripdet=(const StripGeomDetUnit*)(det);
1885  const StripTopology &topol=(const StripTopology&)stripdet->topology();
1886 
1887  float anglealpha = atan(trackdirection.x()/trackdirection.z())*180/TMath::Pi();
1888  float anglebeta = atan(trackdirection.y()/trackdirection.z())*180/TMath::Pi();
1889 
1890  //SiStripRecHit2D::ClusterRef cluster=hit->cluster();
1891  SiStripRecHit1D::ClusterRef cluster=hit1d->cluster();
1892 
1893 
1894  position = thit->localPosition();
1895  error = thit->localPositionError();
1896  Mposition = topol.measurementPosition(position);
1897  Merror = topol.measurementError(position,error);
1898 
1899  // LocalVector drift= driftDirection(stripdet);
1900  LocalVector drift = stripcpe->driftDirection(stripdet);
1901  float thickness=stripdet->surface().bounds().thickness();
1902  rechitsasthickness = thickness;
1903  //cout<<"thickness = "<<thickness<<endl;
1904  float pitch = topol.localPitch(position);
1905  //cout<<"Valid:pitch = "<<pitch<<endl;
1906  float tanalpha = tan(anglealpha/57.3);
1907  //cout<<"Valid:tanalpha = "<<tanalpha<<endl;
1908  float tanalphaL = drift.x()/drift.z();
1909  //cout<<"Validstereo:drift.x() = "<<drift.x()<<endl;
1910  //cout<<"Valid:drift.z() = "<<drift.z()<<endl;
1911  //cout<<"Valid:tanalphaL = "<<tanalphaL<<endl;
1912  Wtrack = fabs((thickness/pitch)*tanalpha - (thickness/pitch)*tanalphaL);
1913  //cout<<"Valid:Wtrack = "<<Wtrack<<endl;
1914  float SLorentz = 0.5*(thickness/pitch)*tanalphaL;
1915  //int nstrips = topol.nstrips();
1916  int Sp = int(position.x()/pitch+SLorentz+0.5*Wtrack);
1917  int Sm = int(position.x()/pitch+SLorentz-0.5*Wtrack);
1918  Wexp = 1+Sp-Sm;
1919 
1920  clusiz=0;
1921  totcharge=0;
1922  clusiz = cluster->amplitudes().size();
1923  const std::vector<uint8_t> amplitudes=cluster->amplitudes();
1924  for(size_t ia=0; ia<amplitudes.size();ia++){
1925  totcharge+=amplitudes[ia];
1926  }
1927  rechitsasx = position.x();
1928  rechitsasy = position.y();
1929  rechitsasz = position.z();
1930  rechitsaserrxLF = error.xx();
1931  //cout<<"rechitsaserrxLF = "<<rechitsaserrxLF<<endl;
1932  rechitsaserrxMF = Merror.uu();
1933  //cout<<"rechitsaserrxMF simple hit= "<<sqrt(rechitsaserrxMF)<<endl;
1934  clusizsas = clusiz;
1935  cluchgsas = totcharge;
1936 
1937  //Association of the rechit to the simhit
1938  mindist = 999999;
1939  matched.clear();
1940  matched = associate.associateHit(*hit1d);
1941  if(!matched.empty()){
1942  // cout << "\t\t\tmatched " << matched.size() << endl;
1943  for(vector<PSimHit>::const_iterator m=matched.begin(); m<matched.end(); m++){
1944  dist = abs((hit1d)->localPosition().x() - (*m).localPosition().x());
1945  if(dist<mindist){
1946  mindist = dist;
1947  closest = (*m);
1948  }
1949 
1950  rechitsasresLF = rechitsasx - closest.localPosition().x();
1951  rechitsasresMF = Mposition.x() - (topol.measurementPosition(closest.localPosition())).x();
1952  rechitsaspullLF = (thit->localPosition().x() - (closest).localPosition().x())/sqrt(error.xx());
1954 
1955  }
1956  }
1957  rechitsastrackangle = anglealpha;
1958  rechitsastrackanglebeta = anglebeta;
1959  rechitsastrackwidth = Wtrack;
1960  rechitsasexpectedwidth = Wexp;
1961 
1962  clusterWidth = clusiz;
1963  unsigned int iopt;
1964  if (clusterWidth > Wexp + 2) {
1965  iopt = 1;
1966  } else if (Wexp == 1) {
1967  iopt = 2;
1968  } else if (clusterWidth <= Wexp) {
1969  iopt = 3;
1970  } else {
1971  iopt = 4;
1972  }
1973  rechitsascategory = iopt;
1974  }
1975  //isrechitsas = 0;
1976  }
1977 
1978 
1979  if(hit2d){
1980  // simple hits are mono or stereo
1981  // cout<<"simple hit"<<endl;
1982  if (StripSubdet.stereo() == 0){
1983  isrechitrphi = 1;
1984  // cout<<"simple hit mono"<<endl;
1985 
1986  const GeomDetUnit * det = tracker.idToDetUnit(detid2);
1987  const StripGeomDetUnit * stripdet=(const StripGeomDetUnit*)(det);
1988  const StripTopology &topol=(const StripTopology&)stripdet->topology();
1989 
1990  float anglealpha = atan(trackdirection.x()/trackdirection.z())*180/TMath::Pi();
1991  float anglebeta = atan(trackdirection.y()/trackdirection.z())*180/TMath::Pi();
1992 
1993  SiStripRecHit2D::ClusterRef cluster=hit2d->cluster();
1994 
1995  position = thit->localPosition();
1996  error = thit->localPositionError();
1997  Mposition = topol.measurementPosition(position);
1998  Merror = topol.measurementError(position,error);
1999 
2000  LocalVector drift = stripcpe->driftDirection(stripdet);
2001  float thickness=stripdet->surface().bounds().thickness();
2002  rechitrphithickness = thickness;
2003  //cout<<"Valid:thickness = "<<thickness<<endl;
2004  float pitch = topol.localPitch(position);
2005  //cout<<"Valid:pitch = "<<pitch<<endl;
2006  float tanalpha = tan(anglealpha/57.3);
2007  //cout<<"Valid:tanalpha = "<<tanalpha<<endl;
2008  float tanalphaL = drift.x()/drift.z();
2009  //cout<<"Valid:tanalphaL = "<<tanalphaL<<endl;
2010  // float tanalphaLcpe = driftcpe.x()/driftcpe.z();
2011  //cout<<"Valid:tanalphaLcpe = "<<tanalphaLcpe<<endl;
2012  //cout<<"Validmono:drift.x() = "<<drift.x()<<endl;
2013  //cout<<"Valid:drift.z() = "<<drift.z()<<endl;
2014  //cout<<"Valid:tanalphaL = "<<tanalphaL<<endl;
2015  Wtrack = fabs((thickness/pitch)*tanalpha - (thickness/pitch)*tanalphaL);
2016  // fabs((thickness/pitch)*tanalpha - (thickness/pitch)*tanalphaL);
2017  //cout<<"Valid2:Wtrack = "<<Wtrack<<endl;
2018  float SLorentz = 0.5*(thickness/pitch)*tanalphaL;
2019  //int nstrips = topol.nstrips();
2020  int Sp = int(position.x()/pitch+SLorentz+0.5*Wtrack);
2021  int Sm = int(position.x()/pitch+SLorentz-0.5*Wtrack);
2022  Wexp = 1+Sp-Sm;
2023 
2024  clusiz=0;
2025  totcharge=0;
2026  clusiz = cluster->amplitudes().size();
2027  //cout<<"cluster->firstStrip() = "<<cluster->firstStrip()<<endl;
2028  const std::vector<uint8_t> amplitudes=cluster->amplitudes();
2029  for(size_t ia=0; ia<amplitudes.size();ia++){
2030  totcharge+=amplitudes[ia];
2031  }
2032  rechitrphix = position.x();
2033  rechitrphiy = position.y();
2034  rechitrphiz = position.z();
2035  rechitrphierrx = error.xx();
2036  rechitrphierrxLF = error.xx();
2037  rechitrphierrxMF = Merror.uu();
2038  //cout<<"rechitrphierrxMF simple hit= "<<sqrt(rechitrphierrxMF)<<endl;
2039  clusizrphi = clusiz;
2040  //cout<<"clusizrphi = "<<clusiz<<endl;
2041  cluchgrphi = totcharge;
2042 
2043  //Association of the rechit to the simhit
2044  mindist = 999999;
2045  matched.clear();
2046  matched = associate.associateHit(*hit2d);
2047  if(!matched.empty()){
2048  // cout << "\t\t\tmatched " << matched.size() << endl;
2049  for(vector<PSimHit>::const_iterator m=matched.begin(); m<matched.end(); m++){
2050  dist = abs((hit2d)->localPosition().x() - (*m).localPosition().x());
2051  if(dist<mindist){
2052  mindist = dist;
2053  closest = (*m);
2054  }
2055  rechitrphiresLF = rechitrphix - closest.localPosition().x();
2056  rechitrphiresMF = Mposition.x() - (topol.measurementPosition(closest.localPosition())).x();
2057  rechitrphipullLF = (thit->localPosition().x() - (closest).localPosition().x())/sqrt(error.xx());
2059  }
2060  }
2061  rechitrphitrackangle = anglealpha;
2062  rechitrphitrackanglebeta = anglebeta;
2063  rechitrphitrackwidth = Wtrack;
2064  rechitrphiexpectedwidth = Wexp;
2065 
2066  clusterWidth = clusiz;
2067  unsigned int iopt;
2068  if (clusterWidth > Wexp + 2) {
2069  iopt = 1;
2070  } else if (Wexp == 1) {
2071  iopt = 2;
2072  } else if (clusterWidth <= Wexp) {
2073  iopt = 3;
2074  } else {
2075  iopt = 4;
2076  }
2077  rechitrphicategory = iopt;
2078 
2079 // if (rechitrphiexpectedwidth == 1 && clusterWidth == 3) {
2080 // //if ( clusterWidth == 3) {
2081 // cout<<"TRUE"<<endl;
2082 // cout<<"TestClus2:Position SH = "<<(closest).localPosition().x()<<" , "<<(topol.measurementPosition(closest.localPosition())).x()<<endl;
2083 // cout<<"TestClus2:Position RH = "<<thit->localPosition().x()<<" ,"<<Mposition.x()<<endl;
2084 // cout<<"TestClus2:residue = "<<rechitrphiresMF<<endl;
2085 // short firstStrip = cluster->firstStrip();
2086 // short lastStrip = firstStrip + clusterWidth - 1;
2087 // cout<<"TestClus2:firstStrip = "<<firstStrip<<endl;
2088 // cout<<"TestClus2:lastStrip = "<<lastStrip<<endl;
2089 // cout<<"TestClus2:detid = "<<detid.subdetId()<<endl;
2090 // for(size_t ia=0; ia<amplitudes.size();ia++){
2091 // cout<<"ia, TestClus2:charge= "<<ia<<" , "<<amplitudes[ia]<<endl;
2092 // }
2093 // cout<<"TestClus2:Trackwidth = "<<Wtrack<<endl;
2094 // }
2095 
2096 
2097  //cout<<"rechitrphicategory = "<<rechitrphicategory<<endl;
2098 
2099  // if ((detid.subdetId() == int(StripSubdetector::TID)) || (detid.subdetId() == int(StripSubdetector::TEC))) {
2100  //if ((detid.subdetId() == int(StripSubdetector::TIB))) {
2101 
2102 // if (clusterWidth ==2 && Wexp == 1 && Wtrack<0.1) {
2103 // cout<<"TestClus:begin"<<endl;
2104 // LocalVector drift2 = drift * fabs(thickness/drift.z());
2105 // LocalPoint result2=LocalPoint(position.x()-drift2.x()/2,position.y()-drift2.y()/2,0);
2106 // MeasurementPoint mpoint=topol.measurementPosition(result2);
2107 // cout<<"TestClus:Position SH = "<<(closest).localPosition().x()<<" , "<<(topol.measurementPosition(closest.localPosition())).x()<<endl;
2108 // cout<<"TestClus:Position RH = "<<thit->localPosition().x()<<" ,"<<Mposition.x()<<endl;
2109 // cout<<"TestClus:Position RH no drift= "<<thit->localPosition().x() - drift2.x()/2<<" , "<<mpoint.x()<<endl;
2110 // cout<<"TestClus:Drift= "<<drift.x()<<endl;
2111 // cout<<"TestClus:residue = "<<rechitrphiresMF<<endl;
2112 // for(size_t ia=0; ia<amplitudes.size();ia++){
2113 // cout<<"ia, TestClus:charge= "<<ia<<" , "<<amplitudes[ia]<<endl;
2114 // }
2115 // cout<<"TestClus:Trackwidth = "<<Wtrack<<endl;
2116 // short firstStrip = cluster->firstStrip();
2117 // short lastStrip = firstStrip + clusterWidth - 1;
2118 // cout<<"TestClus:firstStrip = "<<firstStrip<<endl;
2119 // cout<<"TestClus:lastStrip = "<<lastStrip<<endl;
2120 // cout<<"TestClus:detid = "<<detid.subdetId()<<endl;
2121 // int nstrips = topol.nstrips();
2122 // cout<<"TestClus:nstrips = "<<nstrips<<endl;
2123 // cout<<"TestClus:anglealpha = "<<anglealpha<<endl;
2124 // cout<<"TestClus:end"<<endl;
2125 // positionshx = (topol.measurementPosition(closest.localPosition())).x();
2126 
2127 // if ((positionshx - int(positionshx)) > 0.5) {
2128 // if (lastStrip > int(positionshx)) secondstrip = 1;
2129 // if (lastStrip = int(positionshx)) secondstrip = -1;
2130 // }
2131 // if ((positionshx - int(positionshx)) < 0.5) {
2132 // if (lastStrip > int(positionshx)) secondstrip = -1;
2133 // if (lastStrip = int(positionshx)) secondstrip = 1;
2134 // }
2135 
2136 // }
2137 
2138  //}
2139 
2140 // cout<<"int() = "<<int((topol.measurementPosition(closest.localPosition())).x())<<endl;
2141 // diff = int((topol.measurementPosition(closest.localPosition())).x()) -topol.measurementPosition(closest.localPosition()).x();
2142 // cout<<"diff = "<<diff<<endl;
2143 // if (clusterWidth ==2 && Wexp == 1 && Wtrack<1) {
2144 // if ((abs(1 + diff) <0.2) || (abs(diff) <0.2)) {
2145 // // isrechitrphi = 0;
2146 // cout<<"vire"<<endl;
2147 // }
2148 // }
2149 // positionshx = (topol.measurementPosition(closest.localPosition())).x();
2150 
2151 
2152  }
2153 
2154  if (StripSubdet.stereo() == 1){
2155 
2156  //cout<<"simple hit stereo"<<endl;
2157  isrechitsas = 1;
2158 
2159  const GeomDetUnit * det = tracker.idToDetUnit(detid2);
2160  const StripGeomDetUnit * stripdet=(const StripGeomDetUnit*)(det);
2161  const StripTopology &topol=(const StripTopology&)stripdet->topology();
2162 
2163  float anglealpha = atan(trackdirection.x()/trackdirection.z())*180/TMath::Pi();
2164  float anglebeta = atan(trackdirection.y()/trackdirection.z())*180/TMath::Pi();
2165 
2166  SiStripRecHit2D::ClusterRef cluster=hit2d->cluster();
2167 
2168 
2169  position = thit->localPosition();
2170  error = thit->localPositionError();
2171  Mposition = topol.measurementPosition(position);
2172  Merror = topol.measurementError(position,error);
2173 
2174  // LocalVector drift= driftDirection(stripdet);
2175  LocalVector drift = stripcpe->driftDirection(stripdet);
2176  float thickness=stripdet->surface().bounds().thickness();
2177  rechitsasthickness = thickness;
2178  //cout<<"thickness = "<<thickness<<endl;
2179  float pitch = topol.localPitch(position);
2180  //cout<<"Valid:pitch = "<<pitch<<endl;
2181  float tanalpha = tan(anglealpha/57.3);
2182  //cout<<"Valid:tanalpha = "<<tanalpha<<endl;
2183  float tanalphaL = drift.x()/drift.z();
2184  //cout<<"Validstereo:drift.x() = "<<drift.x()<<endl;
2185  //cout<<"Valid:drift.z() = "<<drift.z()<<endl;
2186  //cout<<"Valid:tanalphaL = "<<tanalphaL<<endl;
2187  Wtrack = fabs((thickness/pitch)*tanalpha - (thickness/pitch)*tanalphaL);
2188  //cout<<"Valid:Wtrack = "<<Wtrack<<endl;
2189  float SLorentz = 0.5*(thickness/pitch)*tanalphaL;
2190  //int nstrips = topol.nstrips();
2191  int Sp = int(position.x()/pitch+SLorentz+0.5*Wtrack);
2192  int Sm = int(position.x()/pitch+SLorentz-0.5*Wtrack);
2193  Wexp = 1+Sp-Sm;
2194 
2195  clusiz=0;
2196  totcharge=0;
2197  clusiz = cluster->amplitudes().size();
2198  const std::vector<uint8_t> amplitudes=cluster->amplitudes();
2199  for(size_t ia=0; ia<amplitudes.size();ia++){
2200  totcharge+=amplitudes[ia];
2201  }
2202  rechitsasx = position.x();
2203  rechitsasy = position.y();
2204  rechitsasz = position.z();
2205  rechitsaserrxLF = error.xx();
2206  //cout<<"rechitsaserrxLF = "<<rechitsaserrxLF<<endl;
2207  rechitsaserrxMF = Merror.uu();
2208  //cout<<"rechitsaserrxMF simple hit= "<<sqrt(rechitsaserrxMF)<<endl;
2209  clusizsas = clusiz;
2210  cluchgsas = totcharge;
2211 
2212  //Association of the rechit to the simhit
2213  mindist = 999999;
2214  matched.clear();
2215  matched = associate.associateHit(*hit2d);
2216  if(!matched.empty()){
2217  // cout << "\t\t\tmatched " << matched.size() << endl;
2218  for(vector<PSimHit>::const_iterator m=matched.begin(); m<matched.end(); m++){
2219  dist = abs((hit2d)->localPosition().x() - (*m).localPosition().x());
2220  if(dist<mindist){
2221  mindist = dist;
2222  closest = (*m);
2223  }
2224 
2225  rechitsasresLF = rechitsasx - closest.localPosition().x();
2226  rechitsasresMF = Mposition.x() - (topol.measurementPosition(closest.localPosition())).x();
2227  rechitsaspullLF = (thit->localPosition().x() - (closest).localPosition().x())/sqrt(error.xx());
2229 
2230  }
2231  }
2232  rechitsastrackangle = anglealpha;
2233  rechitsastrackanglebeta = anglebeta;
2234  rechitsastrackwidth = Wtrack;
2235  rechitsasexpectedwidth = Wexp;
2236 
2237  clusterWidth = clusiz;
2238  unsigned int iopt;
2239  if (clusterWidth > Wexp + 2) {
2240  iopt = 1;
2241  } else if (Wexp == 1) {
2242  iopt = 2;
2243  } else if (clusterWidth <= Wexp) {
2244  iopt = 3;
2245  } else {
2246  iopt = 4;
2247  }
2248  rechitsascategory = iopt;
2249  }
2250  //isrechitsas = 0;
2251 
2252  }
2253 
2254  //Filling Histograms for simple hits
2255  //cout<<"isrechitrphi,isrechitsas = "<<isrechitrphi<<","<<isrechitsas<<endl;
2256 
2257  float CutThickness=0.04;
2258  CutThickness=0.;
2259 
2260  if(isrechitrphi>0 || isrechitsas>0){
2261 
2262 
2263  if (isrechitrphi>0) {
2264 
2265  //cout<<"rechitrphitrackwidth,rechitrphipullMF = "<<rechitrphitrackwidth<<" "<<rechitrphipullMF<<endl;
2266  /*
2267  if (rechitrphithickness > CutThickness)
2268  {
2269  PullvsTrackwidth->Fill(rechitrphitrackwidth,rechitrphipullMF);
2270 
2271  if (clusizrphi ==2 && rechitrphiexpectedwidth == 1 && rechitrphitrackwidth<0.1) {
2272  //Diff->Fill(-diff);
2273 
2274  // if ((detid.subdetId() == int(StripSubdetector::TID)) || (detid.subdetId() == int(StripSubdetector::TEC))) {
2275  //SecondStrip->Fill(secondstrip);
2276  // }
2277  }
2278  // Diff->Fill(-diff);
2279 
2280  //PositionSHx->Fill(positionshx);
2281 
2282  // ErrxMF->Fill(sqrt(rechitrphierrxMF));
2283  //cout<<"ICI1:rechitrphitrackwidth = "<<rechitrphitrackwidth<<endl;
2284  //ErrxMFvsTrackwidth->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
2285  ResMFvsTrackwidth->Fill(rechitrphitrackwidth,rechitrphiresMF);
2286 
2287  PullvsClusterwidth->Fill(clusizrphi,rechitrphipullMF);
2288  PullvsExpectedwidth->Fill(rechitrphiexpectedwidth,rechitrphipullMF);
2289  PullvsTrackangle->Fill(rechitrphitrackangle,rechitrphipullMF);
2290  PullvsTrackanglebeta->Fill(rechitrphitrackanglebeta,rechitrphipullMF);
2291 
2292  }
2293  */
2294 
2301 
2304 
2305  if (clusizrphi == 1) {
2308  if (rechitrphithickness > CutThickness)
2309  {
2310  //if ((detid.subdetId() == int(StripSubdetector::TIB)) || (detid.subdetId() == int(StripSubdetector::TOB)))
2311  //{
2312  /*
2313  ResMFvsTrackwidthWClus1->Fill(rechitrphitrackwidth,rechitrphiresMF);
2314  if (rechitrphiexpectedwidth==1) ResMFvsTrackwidthWClus1Wexp1->Fill(rechitrphitrackwidth,rechitrphiresMF);
2315  if (rechitrphiexpectedwidth==2) ResMFvsTrackwidthWClus1Wexp2->Fill(rechitrphitrackwidth,rechitrphiresMF);
2316  if (rechitrphiexpectedwidth==3) ResMFvsTrackwidthWClus1Wexp3->Fill(rechitrphitrackwidth,rechitrphiresMF);
2317  if (rechitrphiexpectedwidth==4) ResMFvsTrackwidthWClus1Wexp4->Fill(rechitrphitrackwidth,rechitrphiresMF);
2318  ErrxMFvsTrackwidthWClus1->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
2319  */
2320  //}
2321  }
2322  }
2323  if (clusizrphi == 2) {
2329  if (rechitrphithickness > CutThickness)
2330  {
2331  // if ((detid.subdetId() == int(StripSubdetector::TIB)) || (detid.subdetId() == int(StripSubdetector::TOB)))
2332  //{
2333  if ((detid.subdetId() == int(StripSubdetector::TID)) || (detid.subdetId() == int(StripSubdetector::TEC))){
2334  /* ResMFvsTrackwidthWClus2->Fill(rechitrphitrackwidth,rechitrphiresMF);
2335  if (rechitrphiexpectedwidth==1) ResMFvsTrackwidthWClus2Wexp1->Fill(rechitrphitrackwidth,rechitrphiresMF);
2336  if (rechitrphiexpectedwidth==2) ResMFvsTrackwidthWClus2Wexp2->Fill(rechitrphitrackwidth,rechitrphiresMF);
2337  if (rechitrphiexpectedwidth==3) ResMFvsTrackwidthWClus2Wexp3->Fill(rechitrphitrackwidth,rechitrphiresMF);
2338  if (rechitrphiexpectedwidth==4) ResMFvsTrackwidthWClus2Wexp4->Fill(rechitrphitrackwidth,rechitrphiresMF);*/
2339  }
2340  // meResMFTrackwidthProfileWClus22->Fill(rechitrphitrackwidth,rechitrphiresMF);
2341  //cout<<"ICI2:rechitrphitrackwidth = "<<rechitrphitrackwidth<<endl;
2342 
2343  //ErrxMFvsTrackwidthWClus2->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
2344  // }
2345  }
2346  }
2347  if (clusizrphi == 3) {
2350  if (rechitrphithickness > CutThickness)
2351  {
2352  //if ((detid.subdetId() == int(StripSubdetector::TIB)) || (detid.subdetId() == int(StripSubdetector::TOB)))
2353  //{
2354  /*
2355  ResMFvsTrackwidthWClus3->Fill(rechitrphitrackwidth,rechitrphiresMF);
2356  if (rechitrphiexpectedwidth==1) ResMFvsTrackwidthWClus3Wexp1->Fill(rechitrphitrackwidth,rechitrphiresMF);
2357  if (rechitrphiexpectedwidth==2) ResMFvsTrackwidthWClus3Wexp2->Fill(rechitrphitrackwidth,rechitrphiresMF);
2358  if (rechitrphiexpectedwidth==3) ResMFvsTrackwidthWClus3Wexp3->Fill(rechitrphitrackwidth,rechitrphiresMF);
2359  if (rechitrphiexpectedwidth==4) ResMFvsTrackwidthWClus3Wexp4->Fill(rechitrphitrackwidth,rechitrphiresMF);
2360  ErrxMFvsTrackwidthWClus3->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
2361  */
2362  // }
2363  }
2364  }
2365  if (clusizrphi == 4) {
2368  if (rechitrphithickness > CutThickness)
2369  {
2370  //if ((detid.subdetId() == int(StripSubdetector::TIB)) || (detid.subdetId() == int(StripSubdetector::TOB)))
2371  //{
2372  /* ResMFvsTrackwidthWClus4->Fill(rechitrphitrackwidth,rechitrphiresMF);
2373  if (rechitrphiexpectedwidth==1) ResMFvsTrackwidthWClus4Wexp1->Fill(rechitrphitrackwidth,rechitrphiresMF);
2374  if (rechitrphiexpectedwidth==2) ResMFvsTrackwidthWClus4Wexp2->Fill(rechitrphitrackwidth,rechitrphiresMF);
2375  if (rechitrphiexpectedwidth==3) ResMFvsTrackwidthWClus4Wexp3->Fill(rechitrphitrackwidth,rechitrphiresMF);
2376  if (rechitrphiexpectedwidth==4) ResMFvsTrackwidthWClus4Wexp4->Fill(rechitrphitrackwidth,rechitrphiresMF);
2377  ErrxMFvsTrackwidthWClus4->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));*/
2378  //}
2379  }
2380  }
2381 
2382  if (rechitrphicategory == 1) {
2385  }
2386  if (rechitrphicategory == 2) {
2388  //ResMFvsTrackwidthCategory2->Fill(rechitrphitrackwidth,rechitrphiresMF);
2389  // ErrxMFvsTrackwidthCategory2->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
2390  }
2391  if (rechitrphicategory == 3) {
2393  //ResMFvsTrackwidthCategory3->Fill(rechitrphitrackwidth,rechitrphiresMF);
2394  //ErrxMFvsTrackwidthCategory3->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
2395  }
2396  if (rechitrphicategory == 4) {
2398  //ResMFvsTrackwidthCategory4->Fill(rechitrphitrackwidth,rechitrphiresMF);
2399  //ErrxMFvsTrackwidthCategory4->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
2400  }
2401  //const unsigned int NBINS = meErrxMFTrackwidthProfile->getNbinsX();
2402  //cout<<"NBINS2 = "<<NBINS<<endl;
2403 
2405  //const unsigned int NBINS3 = meErrxMF->getNbinsX();
2406  //cout<<"NBINS3 = "<<NBINS<<endl;
2412 
2413  }
2414 
2415  if (isrechitsas>0) {
2416 
2417  if (rechitsasthickness > CutThickness)
2418  {
2419  /*
2420  PullvsTrackwidth->Fill(rechitsastrackwidth,rechitsaspullMF);
2421  //cout<<"rechitsaserrxMF"<<rechitsaserrxMF<<endl;
2422  // ErrxMF->Fill(sqrt(rechitsaserrxMF));
2423  ErrxMFvsTrackwidth->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
2424  ResMFvsTrackwidth->Fill(rechitsastrackwidth,rechitsasresMF);
2425 
2426 
2427  PullvsClusterwidth->Fill(clusizsas,rechitsaspullMF);
2428  PullvsExpectedwidth->Fill(rechitsasexpectedwidth,rechitsaspullMF);
2429  PullvsTrackangle->Fill(rechitsastrackangle,rechitsaspullMF);
2430  PullvsTrackanglebeta->Fill(rechitsastrackanglebeta,rechitsaspullMF);
2431  */
2432  }
2433 
2434 
2441 
2444 
2445  if (clusizsas == 1) {
2448  if (rechitsasthickness > CutThickness)
2449  {
2450  //if ((detid.subdetId() == int(StripSubdetector::TIB)) || (detid.subdetId() == int(StripSubdetector::TOB)))
2451  //{
2452  /*
2453  ResMFvsTrackwidthWClus1->Fill(rechitsastrackwidth,rechitsasresMF);
2454  if (rechitsasexpectedwidth==1) ResMFvsTrackwidthWClus1Wexp1->Fill(rechitsastrackwidth,rechitsasresMF);
2455  if (rechitsasexpectedwidth==2) ResMFvsTrackwidthWClus1Wexp2->Fill(rechitsastrackwidth,rechitsasresMF);
2456  if (rechitsasexpectedwidth==3) ResMFvsTrackwidthWClus1Wexp3->Fill(rechitsastrackwidth,rechitsasresMF);
2457  if (rechitsasexpectedwidth==4) ResMFvsTrackwidthWClus1Wexp4->Fill(rechitsastrackwidth,rechitsasresMF);
2458  ErrxMFvsTrackwidthWClus1->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
2459  */
2460  //}
2461  }
2462  }
2463 
2464  if (clusizsas == 2) {
2467  if (rechitsasthickness > CutThickness)
2468  {
2469  // if ((detid.subdetId() == int(StripSubdetector::TIB)) || (detid.subdetId() == int(StripSubdetector::TOB)))
2470  //{
2471  /*
2472  ResMFvsTrackwidthWClus2->Fill(rechitsastrackwidth,rechitsasresMF);
2473  if (rechitsasexpectedwidth==1) ResMFvsTrackwidthWClus2Wexp1->Fill(rechitsastrackwidth,rechitsasresMF);
2474  if (rechitsasexpectedwidth==2) ResMFvsTrackwidthWClus2Wexp2->Fill(rechitsastrackwidth,rechitsasresMF);
2475  if (rechitsasexpectedwidth==3) ResMFvsTrackwidthWClus2Wexp3->Fill(rechitsastrackwidth,rechitsasresMF);
2476  if (rechitsasexpectedwidth==4) ResMFvsTrackwidthWClus2Wexp4->Fill(rechitsastrackwidth,rechitsasresMF);
2477  ErrxMFvsTrackwidthWClus2->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
2478  */
2479  //}
2480  }
2481  }
2482  if (clusizsas == 3) {
2485  if (rechitsasthickness > CutThickness)
2486  {
2487  //if ((detid.subdetId() == int(StripSubdetector::TIB)) || (detid.subdetId() == int(StripSubdetector::TOB)))
2488  // {
2489  /*
2490  ResMFvsTrackwidthWClus3->Fill(rechitsastrackwidth,rechitsasresMF);
2491  if (rechitsasexpectedwidth==1) ResMFvsTrackwidthWClus3Wexp1->Fill(rechitsastrackwidth,rechitsasresMF);
2492  if (rechitsasexpectedwidth==2) ResMFvsTrackwidthWClus3Wexp2->Fill(rechitsastrackwidth,rechitsasresMF);
2493  if (rechitsasexpectedwidth==3) ResMFvsTrackwidthWClus3Wexp3->Fill(rechitsastrackwidth,rechitsasresMF);
2494  if (rechitsasexpectedwidth==4) ResMFvsTrackwidthWClus3Wexp4->Fill(rechitsastrackwidth,rechitsasresMF);
2495  ErrxMFvsTrackwidthWClus3->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
2496  */
2497  //}
2498  }
2499  }
2500  if (clusizsas == 4) {
2503  if (rechitsasthickness > CutThickness)
2504  {
2505  //if ((detid.subdetId() == int(StripSubdetector::TIB)) || (detid.subdetId() == int(StripSubdetector::TOB)))
2506  //{
2507  /*
2508  ResMFvsTrackwidthWClus4->Fill(rechitsastrackwidth,rechitsasresMF);
2509  if (rechitsasexpectedwidth==1) ResMFvsTrackwidthWClus4Wexp1->Fill(rechitsastrackwidth,rechitsasresMF);
2510  if (rechitsasexpectedwidth==2) ResMFvsTrackwidthWClus4Wexp2->Fill(rechitsastrackwidth,rechitsasresMF);
2511  if (rechitsasexpectedwidth==3) ResMFvsTrackwidthWClus4Wexp3->Fill(rechitsastrackwidth,rechitsasresMF);
2512  if (rechitsasexpectedwidth==4) ResMFvsTrackwidthWClus4Wexp4->Fill(rechitsastrackwidth,rechitsasresMF);
2513  ErrxMFvsTrackwidthWClus4->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
2514  */
2515  // }
2516  }
2517  }
2518  if (rechitsascategory == 1) {
2521  }
2522  if (rechitsascategory == 2) {
2524  //ResMFvsTrackwidthCategory2->Fill(rechitsastrackwidth,rechitsasresMF);
2525  //ErrxMFvsTrackwidthCategory2->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
2526  }
2527  if (rechitsascategory == 3) {
2529  //ResMFvsTrackwidthCategory3->Fill(rechitsastrackwidth,rechitsasresMF);
2530  //ErrxMFvsTrackwidthCategory3->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
2531  }
2532  if (rechitsascategory == 4) {
2534  //ResMFvsTrackwidthCategory4->Fill(rechitsastrackwidth,rechitsasresMF);
2535  //ErrxMFvsTrackwidthCategory4->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
2536  }
2537 
2544 
2545  }
2546 
2547 
2548  if (detid.subdetId() == int(StripSubdetector::TIB)){
2549  TIBDetId tibid(myid);
2550  int Tibisrechitrphi = isrechitrphi;
2551  int Tibisrechitsas = isrechitsas;
2552  //cout<<"Tibisrechitrphi,Tibisrechitsas = "<<Tibisrechitrphi<<" "<<Tibisrechitsas<<endl;
2553  int ilay = tibid.layer() - 1; //for histogram filling
2554  //cout<<"ilay1 = "<<ilay<<endl;
2555  if(Tibisrechitrphi!=0){
2556  if (rechitrphithickness > CutThickness)
2557  {
2558  /*PullvsTrackwidthTIB->Fill(rechitrphitrackwidth,rechitrphipullMF);
2559  PullvsClusterwidthTIB->Fill(clusizrphi,rechitrphipullMF);
2560  PullvsExpectedwidthTIB->Fill(rechitrphiexpectedwidth,rechitrphipullMF);
2561  PullvsTrackangleTIB->Fill(rechitrphitrackangle,rechitrphipullMF);
2562  PullvsTrackanglebetaTIB->Fill(rechitrphitrackanglebeta,rechitrphipullMF);*/
2563  }
2564  //cout<<"TIB:rechitrphitrackwidth,rechitrphipullMF = "<<rechitrphitrackwidth<<" "<<rechitrphipullMF<<endl;
2565  //cout<<"ilay2 = "<<ilay<<endl;
2566  //cout<<"je suis la RPHI"<<endl;
2567  meNstpRphiTIB[ilay]->Fill(clusizrphi);
2568  meAdcRphiTIB[ilay]->Fill(cluchgrphi);
2569  mePosxRphiTIB[ilay]->Fill(rechitrphix);
2579  if (clusizrphi == 1) {
2582  }
2583  if (clusizrphi == 2) {
2586  }
2587  if (clusizrphi == 3) {
2590  }
2591  if (clusizrphi == 4) {
2594  }
2595 
2596 
2597  if (rechitrphicategory == 1) {
2601  }
2602  if (rechitrphicategory == 2) {
2605  }
2606  if (rechitrphicategory == 3) {
2609  }
2610  if (rechitrphicategory == 4) {
2613  }
2620  }
2621  if(Tibisrechitsas!=0){
2622  if (rechitsasthickness > CutThickness)
2623  {
2624  /* PullvsTrackwidthTIB->Fill(rechitsastrackwidth,rechitsaspullMF);
2625  PullvsClusterwidthTIB->Fill(clusizsas,rechitsaspullMF);
2626  PullvsExpectedwidthTIB->Fill(rechitsasexpectedwidth,rechitsaspullMF);
2627  PullvsTrackangleTIB->Fill(rechitsastrackangle,rechitsaspullMF);
2628  PullvsTrackanglebetaTIB->Fill(rechitsastrackanglebeta,rechitsaspullMF);*/
2629  }
2630  meNstpSasTIB[ilay]->Fill(clusizsas);
2631  meAdcSasTIB[ilay]->Fill(cluchgsas);
2632  mePosxSasTIB[ilay]->Fill(rechitsasx);
2642  if (rechitsascategory == 1) {
2646  }
2647  if (rechitsascategory == 2) {
2650  }
2651  if (rechitsascategory == 3) {
2654  }
2655  if (rechitsascategory == 4) {
2658  }
2665  }
2666  }
2667 
2668  if (detid.subdetId() == int(StripSubdetector::TOB)){
2669  TOBDetId tobid(myid);
2670  int Tobisrechitrphi = isrechitrphi;
2671  int Tobisrechitsas = isrechitsas;
2672  int ilay = tobid.layer() - 1; //for histogram filling
2673  if(Tobisrechitrphi!=0){
2674  if (rechitrphithickness > CutThickness)
2675  {
2676  /*PullvsTrackwidthTOB->Fill(rechitrphitrackwidth,rechitrphipullMF);
2677  PullvsClusterwidthTOB->Fill(clusizrphi,rechitrphipullMF);
2678  PullvsExpectedwidthTOB->Fill(rechitrphiexpectedwidth,rechitrphipullMF);
2679  PullvsTrackangleTOB->Fill(rechitrphitrackangle,rechitrphipullMF);
2680  PullvsTrackanglebetaTOB->Fill(rechitrphitrackanglebeta,rechitrphipullMF);*/
2681  }
2682  //cout<<"TOB:rechitrphitrackwidth,rechitrphipullMF = "<<rechitrphitrackwidth<<" "<<rechitrphipullMF<<endl;
2683  meNstpRphiTOB[ilay]->Fill(clusizrphi);
2684  meAdcRphiTOB[ilay]->Fill(cluchgrphi);
2685  mePosxRphiTOB[ilay]->Fill(rechitrphix);
2695 
2696  if (clusizrphi == 1) {
2699  }
2700  if (clusizrphi == 2) {
2703  }
2704  if (clusizrphi == 3) {
2707  }
2708  if (clusizrphi == 4) {
2711  }
2712 
2713 
2714  if (rechitrphicategory == 1) {
2718  }
2719  if (rechitrphicategory == 2) {
2722  }
2723  if (rechitrphicategory == 3) {
2726  }
2727  if (rechitrphicategory == 4) {
2730  }
2737  }
2738  if(Tobisrechitsas!=0){
2739  if (rechitsasthickness > CutThickness)
2740  {/*
2741  PullvsTrackwidthTOB->Fill(rechitsastrackwidth,rechitsaspullMF);
2742  PullvsClusterwidthTOB->Fill(clusizsas,rechitsaspullMF);
2743  PullvsExpectedwidthTOB->Fill(rechitsasexpectedwidth,rechitsaspullMF);
2744  PullvsTrackangleTOB->Fill(rechitsastrackangle,rechitsaspullMF);
2745  PullvsTrackanglebetaTOB->Fill(rechitsastrackanglebeta,rechitsaspullMF);
2746  */
2747  }
2748  meNstpSasTOB[ilay]->Fill(clusizsas);
2749  meAdcSasTOB[ilay]->Fill(cluchgsas);
2750  mePosxSasTOB[ilay]->Fill(rechitsasx);
2760  if (rechitsascategory == 1) {
2764  }
2765  if (rechitsascategory == 2) {
2768  }
2769  if (rechitsascategory == 3) {
2772  }
2773  if (rechitsascategory == 4) {
2776  }
2783  }
2784  }
2785 
2786  if (detid.subdetId() == int(StripSubdetector::TID)){
2787  TIDDetId tidid(myid);
2788  int Tidisrechitrphi = isrechitrphi;
2789  int Tidisrechitsas = isrechitsas;
2790  int ilay = tidid.ring() - 1; //for histogram filling
2791  if(Tidisrechitrphi!=0){
2792  if (rechitrphithickness > CutThickness)
2793  {
2794  /*PullvsTrackwidthTID->Fill(rechitrphitrackwidth,rechitrphipullMF);
2795  PullvsClusterwidthTID->Fill(clusizrphi,rechitrphipullMF);
2796  PullvsExpectedwidthTID->Fill(rechitrphiexpectedwidth,rechitrphipullMF);
2797  PullvsTrackangleTID->Fill(rechitrphitrackangle,rechitrphipullMF);
2798  PullvsTrackanglebetaTID->Fill(rechitrphitrackanglebeta,rechitrphipullMF);*/
2799  }
2800  //cout<<"TID:rechitrphitrackwidth,rechitrphipullMF = "<<rechitrphitrackwidth<<" "<<rechitrphipullMF<<endl;
2801  meNstpRphiTID[ilay]->Fill(clusizrphi);
2802  meAdcRphiTID[ilay]->Fill(cluchgrphi);
2803  mePosxRphiTID[ilay]->Fill(rechitrphix);
2813  if (rechitrphicategory == 1) {
2817  }
2818  if (rechitrphicategory == 2) {
2821  }
2822  if (rechitrphicategory == 3) {
2825  }
2826  if (rechitrphicategory == 4) {
2829  }
2836  }
2837  if(Tidisrechitsas!=0){
2838  if (rechitsasthickness > CutThickness)
2839  {
2840  /*PullvsTrackwidthTID->Fill(rechitsastrackwidth,rechitsaspullMF);
2841  PullvsClusterwidthTID->Fill(clusizsas,rechitsaspullMF);
2842  PullvsExpectedwidthTID->Fill(rechitsasexpectedwidth,rechitsaspullMF);
2843  PullvsTrackangleTID->Fill(rechitsastrackangle,rechitsaspullMF);
2844  PullvsTrackanglebetaTID->Fill(rechitsastrackanglebeta,rechitsaspullMF);*/
2845  }
2846  meNstpSasTID[ilay]->Fill(clusizsas);
2847  meAdcSasTID[ilay]->Fill(cluchgsas);
2848  mePosxSasTID[ilay]->Fill(rechitsasx);
2858  if (rechitsascategory == 1) {
2862  }
2863  if (rechitsascategory == 2) {
2866  }
2867  if (rechitsascategory == 3) {
2870  }
2871  if (rechitsascategory == 4) {
2874  }
2881  }
2882  }
2883 
2884  if (detid.subdetId() == int(StripSubdetector::TEC)){
2885  TECDetId tecid(myid);
2886  int Tecisrechitrphi = isrechitrphi;
2887  int Tecisrechitsas = isrechitsas;
2888  int ilay = tecid.ring() - 1; //for histogram filling
2889  if(Tecisrechitrphi!=0){
2890  if (rechitrphithickness > CutThickness)
2891  {
2892  /*PullvsTrackwidthTEC->Fill(rechitrphitrackwidth,rechitrphipullMF);
2893  PullvsClusterwidthTEC->Fill(clusizrphi,rechitrphipullMF);
2894  PullvsExpectedwidthTEC->Fill(rechitrphiexpectedwidth,rechitrphipullMF);
2895  PullvsTrackangleTEC->Fill(rechitrphitrackangle,rechitrphipullMF);
2896  PullvsTrackanglebetaTEC->Fill(rechitrphitrackanglebeta,rechitrphipullMF);*/
2897  }
2898  //cout<<"TEC:rechitrphitrackwidth,rechitrphipullMF = "<<rechitrphitrackwidth<<" "<<rechitrphipullMF<<endl;
2899  meNstpRphiTEC[ilay]->Fill(clusizrphi);
2900  meAdcRphiTEC[ilay]->Fill(cluchgrphi);
2901  mePosxRphiTEC[ilay]->Fill(rechitrphix);
2911  if (rechitrphicategory == 1) {
2915  }
2916  if (rechitrphicategory == 2) {
2919  }
2920  if (rechitrphicategory == 3) {
2923  }
2924  if (rechitrphicategory == 4) {
2927  }
2934  }
2935  if(Tecisrechitsas!=0){
2936  if (rechitsasthickness > CutThickness)
2937  {
2938  /*PullvsTrackwidthTEC->Fill(rechitsastrackwidth,rechitsaspullMF);
2939  PullvsClusterwidthTEC->Fill(clusizsas,rechitsaspullMF);
2940  PullvsExpectedwidthTEC->Fill(rechitsasexpectedwidth,rechitsaspullMF);
2941  PullvsTrackangleTEC->Fill(rechitsastrackangle,rechitsaspullMF);
2942  PullvsTrackanglebetaTEC->Fill(rechitsastrackanglebeta,rechitsaspullMF);*/
2943  }
2944  meNstpSasTEC[ilay]->Fill(clusizsas);
2945  meAdcSasTEC[ilay]->Fill(cluchgsas);
2946  mePosxSasTEC[ilay]->Fill(rechitsasx);
2956  if (rechitsascategory == 1) {
2960  }
2961  if (rechitsascategory == 2) {
2964  }
2965  if (rechitsascategory == 3) {
2968  }
2969  if (rechitsascategory == 4) {
2972  }
2979  }
2980 
2981  }
2982 
2983  } //simplehits
2984  //cout<<"DebugLine301"<<endl;
2985 
2986  }
2987  //cout<<"DebugLine302"<<endl;
2988 
2989  }
2990  //cout<<"DebugLine303"<<endl;
2991 
2992 }
2993 
2994 
2995 
2996  //needed by to do the residual for matched hits
2997 std::pair<LocalPoint,LocalVector> SiStripTrackingRecHitsValid::projectHit( const PSimHit& hit, const StripGeomDetUnit* stripDet, const BoundPlane& plane)
2998 {
2999  // const StripGeomDetUnit* stripDet = dynamic_cast<const StripGeomDetUnit*>(hit.det());
3000  //if (stripDet == 0) throw MeasurementDetException("HitMatcher hit is not on StripGeomDetUnit");
3001 
3002  const StripTopology& topol = stripDet->specificTopology();
3003  GlobalPoint globalpos= stripDet->surface().toGlobal(hit.localPosition());
3004  LocalPoint localHit = plane.toLocal(globalpos);
3005  //track direction
3006  LocalVector locdir=hit.localDirection();
3007  //rotate track in new frame
3008 
3009  GlobalVector globaldir= stripDet->surface().toGlobal(locdir);
3010  LocalVector dir=plane.toLocal(globaldir);
3011  float scale = -localHit.z() / dir.z();
3012 
3013  LocalPoint projectedPos = localHit + scale*dir;
3014 
3015  // std::cout << "projectedPos " << projectedPos << std::endl;
3016 
3017  float selfAngle = topol.stripAngle( topol.strip( hit.localPosition()));
3018 
3019  LocalVector stripDir( sin(selfAngle), cos(selfAngle), 0); // vector along strip in hit frame
3020 
3021  LocalVector localStripDir( plane.toLocal(stripDet->surface().toGlobal( stripDir)));
3022 
3023  return std::pair<LocalPoint,LocalVector>( projectedPos, localStripDir);
3024 }
ClusterRef cluster() const
MonitorElement * mePullTrackwidthProfileCategory1SasTEC[5]
MonitorElement * meErrxMFTrackwidthProfileRphiTEC[7]
MonitorElement * mePullTrackwidthProfileSasTOB[2]
const double Pi
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:78
MonitorElement * mePullTrackwidthProfileCategory2RphiTID[3]
MonitorElement * mePullTrackwidthProfileRphiTID[3]
T getParameter(std::string const &) const
SiStripTrackingRecHitsValid(const edm::ParameterSet &conf)
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
MonitorElement * meErrxMFTrackwidthProfileCategory2RphiTIB[4]
float xx() const
Definition: LocalError.h:24
MonitorElement * mePullTrackwidthProfileCategory3SasTIB[4]
MonitorElement * meErrxMFClusterwidthProfileCategory1RphiTIB[4]
MonitorElement * mePullTrackwidthProfileCategory4RphiTEC[7]
MonitorElement * mePullTrackwidthProfileCategory2SasTID[2]
MonitorElement * meResMFTrackwidthProfileWclus4RphiTOB[6]
MonitorElement * meErrxMFTrackwidthProfileCategory3SasTOB[2]
unsigned int layer() const
layer id
Definition: TOBDetId.h:39
MonitorElement * meErrxMFClusterwidthProfileCategory1SasTID[2]
MonitorElement * mePullTrackwidthProfileRphiTEC[7]
virtual float stripAngle(float strip) const =0
const GeomDetUnit * monoDet() const
Definition: GluedGeomDet.h:20
MonitorElement * meErrxMFTrackwidthProfileCategory4RphiTIB[4]
MonitorElement * meErrxMFTrackwidthProfileCategory1SasTID[2]
MonitorElement * mePullTrackwidthProfileCategory1RphiTOB[6]
LocalVector localDirection() const
MonitorElement * meErrxMFTrackwidthProfileCategory2SasTID[2]
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:47
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE")
Definition: DQMStore.cc:2113
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
MonitorElement * mePullTrackangleProfileSasTEC[5]
LocalVector drift(const StripGeomDetUnit *, const MagneticField &, const SiStripLorentzAngle &)
Definition: ShallowTools.cc:39
tuple magfield
Definition: HLT_ES_cff.py:2311
MonitorElement * meErrxMFTrackwidthProfileCategory4SasTIB[4]
MonitorElement * mePullTrackangleProfileRphiTEC[7]
MonitorElement * meErrxMFTrackwidthProfileWclus4RphiTOB[6]
MonitorElement * mePullTrackwidthProfileCategory1RphiTEC[7]
MonitorElement * mePullTrackwidthProfileCategory4SasTEC[5]
T y() const
Definition: PV3DBase.h:62
MonitorElement * mePullTrackwidthProfileCategory2SasTEC[5]
#define abs(x)
Definition: mlp_lapack.h:159
MonitorElement * meErrxMFTrackwidthProfileCategory4SasTOB[2]
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:62
MonitorElement * meErrxMFTrackwidthProfileWclus4RphiTIB[4]
MonitorElement * meErrxMFTrackwidthProfileWclus3RphiTOB[6]
MonitorElement * meResMFTrackwidthProfileWclus4RphiTIB[4]
MonitorElement * mePullTrackangleProfileRphiTID[3]
virtual const StripTopology & specificTopology() const
Returns a reference to the strip proxy topology.
MonitorElement * meErrxMFTrackwidthProfileCategory3RphiTEC[7]
MonitorElement * meErrxMFTrackwidthProfileCategory1SasTIB[4]
MonitorElement * meResMFTrackwidthProfileWclus3RphiTIB[4]
MonitorElement * mePullTrackwidthProfileCategory4RphiTOB[6]
MonitorElement * meErrxMFTrackwidthProfileCategory1SasTOB[2]
MonitorElement * meErrxMFTrackwidthProfileWclus1RphiTOB[6]
virtual float strip(const LocalPoint &) const =0
void Fill(long long x)
MonitorElement * mePullTrackwidthProfileCategory3RphiTID[3]
MonitorElement * meResMFTrackwidthProfileWclus3RphiTOB[6]
virtual float thickness() const =0
MonitorElement * meResMFTrackwidthProfileWclus2RphiTOB[6]
MonitorElement * mePullTrackwidthProfileCategory4RphiTIB[4]
MonitorElement * mePullTrackwidthProfileCategory4RphiTID[3]
MonitorElement * meErrxMFClusterwidthProfileCategory1RphiTEC[7]
MonitorElement * meErrxMFClusterwidthProfileCategory1SasTEC[7]
MonitorElement * meErrxMFTrackwidthProfileCategory3RphiTOB[6]
virtual float localPitch(const LocalPoint &) const =0
float xy() const
Definition: LocalError.h:25
MonitorElement * mePullTrackwidthProfileCategory1SasTOB[2]
virtual LocalError localPositionError() const
MonitorElement * meErrxMFTrackwidthProfileRphiTOB[6]
MonitorElement * mePullTrackwidthProfileCategory4SasTID[2]
virtual MeasurementError measurementError(const LocalPoint &, const LocalError &) const =0
MonitorElement * meErrxMFTrackwidthProfileCategory3SasTEC[7]
MonitorElement * meErrxMFTrackwidthProfileSasTIB[4]
float yy() const
Definition: LocalError.h:26
Local3DPoint localPosition() const
Definition: PSimHit.h:44
MonitorElement * mePullTrackwidthProfileCategory1RphiTIB[4]
T sqrt(T t)
Definition: SSEVec.h:46
LocalPoint toLocal(const GlobalPoint &gp) const
MonitorElement * mePullTrackwidthProfileCategory2SasTIB[4]
MonitorElement * mePullTrackangleProfileSasTIB[4]
MonitorElement * mePullTrackwidthProfileCategory2RphiTOB[6]
T z() const
Definition: PV3DBase.h:63
MonitorElement * mePullTrackwidthProfileCategory1SasTID[2]
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
MonitorElement * mePullTrackwidthProfileCategory3RphiTEC[7]
MonitorElement * mePullTrackangleProfileSasTID[2]
virtual const Topology & topology() const
Returns a reference to the strip proxy topology.
unsigned int ring() const
ring id
Definition: TIDDetId.h:55
MonitorElement * meErrxMFTrackwidthProfileCategory4RphiTEC[7]
float uu() const
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
MonitorElement * mePullTrackwidthProfileCategory3RphiTOB[6]
MonitorElement * meErrxMFTrackwidthProfileSasTOB[2]
ClusterRef cluster() const
virtual MeasurementPoint measurementPosition(const LocalPoint &) const =0
MonitorElement * meErrxMFTrackwidthProfileWclus2RphiTIB[4]
MonitorElement * meErrxMFTrackwidthProfileCategory4SasTEC[7]
virtual void analyze(const edm::Event &e, const edm::EventSetup &c)
MonitorElement * mePullTrackwidthProfileCategory2RphiTIB[4]
MonitorElement * mePullTrackwidthProfileRphiTOB[6]
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:39
virtual const GeomDet * idToDet(DetId) const
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
MonitorElement * mePullTrackwidthProfileCategory4SasTOB[2]
MonitorElement * mePullTrackangleProfileRphiTIB[4]
DQMStore * dbe_
std::pair< LocalPoint, LocalVector > projectHit(const PSimHit &hit, const StripGeomDetUnit *stripDet, const BoundPlane &plane)
MonitorElement * mePullTrackwidthProfileCategory2RphiTEC[7]
MonitorElement * meErrxMFTrackwidthProfileCategory1SasTEC[7]
LocalVector localDirection() const
Obsolete. Same as momentumAtEntry().unit(), for backward compatibility.
Definition: PSimHit.h:52
MonitorElement * meResMFTrackwidthProfileWclus2RphiTIB[4]
MonitorElement * mePullTrackwidthProfileCategory1RphiTID[3]
Definition: DetId.h:20
unsigned int stereo() const
stereo
const Bounds & bounds() const
Definition: BoundSurface.h:89
MonitorElement * meErrxMFTrackwidthProfileWclus1RphiTIB[4]
MonitorElement * meErrxMFTrackwidthProfileWclus3RphiTIB[4]
virtual LocalPoint localPosition() const
SiStripRecHit2D stereoHit() const
MonitorElement * meResMFTrackwidthProfileWclus1RphiTIB[4]
MonitorElement * mePullTrackwidthProfileCategory4SasTIB[4]
MonitorElement * meErrxMFTrackwidthProfileCategory3RphiTID[3]
virtual LocalError localPositionError() const =0
MonitorElement * mePullTrackwidthProfileCategory3SasTID[2]
MonitorElement * meErrxMFTrackwidthProfileRphiTIB[4]
MonitorElement * meErrxMFTrackwidthProfileSasTEC[7]
MonitorElement * meErrxMFClusterwidthProfileCategory1SasTIB[4]
MonitorElement * mePullTrackwidthProfileCategory3RphiTIB[4]
MonitorElement * meResMFTrackwidthProfileWclus1RphiTOB[6]
MonitorElement * meErrxMFTrackwidthProfileCategory2SasTOB[2]
const T & get() const
Definition: EventSetup.h:55
MonitorElement * meErrxMFTrackwidthProfileCategory2SasTEC[7]
MonitorElement * mePullTrackwidthProfileSasTID[2]
MonitorElement * meErrxMFTrackwidthProfileCategory4RphiTOB[6]
MonitorElement * meErrxMFTrackwidthProfileWclus2RphiTOB[6]
MonitorElement * meErrxMFTrackwidthProfileCategory3RphiTIB[4]
MonitorElement * mePullTrackwidthProfileCategory1SasTIB[4]
MonitorElement * meErrxMFTrackwidthProfileSasTID[2]
MonitorElement * mePullTrackwidthProfileSasTEC[5]
unsigned int layer() const
layer id
Definition: TIBDetId.h:41
SiStripRecHit2D monoHit() const
virtual const GeomDetUnit * idToDetUnit(DetId) const
Return the pointer to the GeomDetUnit corresponding to a given DetId.
MonitorElement * mePullTrackwidthProfileSasTIB[4]
const BoundPlane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:35
MonitorElement * meErrxMFTrackwidthProfileCategory2RphiTOB[6]
MonitorElement * meErrxMFTrackwidthProfileCategory3SasTIB[4]
MonitorElement * meErrxMFTrackwidthProfileRphiTID[3]
static int position[264][3]
Definition: ReadPGInfo.cc:509
MonitorElement * meErrxMFClusterwidthProfileCategory1RphiTOB[6]
MonitorElement * meErrxMFTrackwidthProfileCategory1RphiTIB[4]
unsigned int ring() const
ring id
Definition: TECDetId.h:71
MonitorElement * mePullTrackwidthProfileCategory3SasTOB[2]
std::vector< PSimHit > associateHit(const TrackingRecHit &thit)
MonitorElement * meErrxMFTrackwidthProfileCategory1RphiTEC[7]
MonitorElement * meErrxMFTrackwidthProfileCategory2RphiTEC[7]
MonitorElement * meErrxMFTrackwidthProfileCategory1RphiTOB[6]
MonitorElement * meErrxMFTrackwidthProfileCategory4SasTID[2]
DetId geographicalId() const
dbl *** dir
Definition: mlp_gen.cc:35
MonitorElement * meErrxMFClusterwidthProfileCategory1RphiTID[3]
x
Definition: VDTMath.h:216
MonitorElement * mePullTrackwidthProfileCategory2SasTOB[2]
T x() const
Definition: PV2DBase.h:44
T x() const
Definition: PV3DBase.h:61
virtual LocalPoint localPosition() const =0
MonitorElement * mePullTrackangleProfileSasTOB[2]
MonitorElement * meErrxMFTrackwidthProfileCategory1RphiTID[3]
MonitorElement * meErrxMFTrackwidthProfileCategory3SasTID[2]
MonitorElement * mePullTrackangleProfileRphiTOB[6]
MonitorElement * meErrxMFTrackwidthProfileCategory2RphiTID[3]
const GeomDetUnit * stereoDet() const
Definition: GluedGeomDet.h:21
MonitorElement * mePullTrackwidthProfileCategory3SasTEC[5]
MonitorElement * meErrxMFTrackwidthProfileCategory2SasTIB[4]
MonitorElement * meErrxMFClusterwidthProfileCategory1SasTOB[2]
MonitorElement * mePullTrackwidthProfileRphiTIB[4]
MonitorElement * meErrxMFTrackwidthProfileCategory4RphiTID[3]