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