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