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 #include <memory>
2 #include <string>
3 #include <iostream>
4 #include <TMath.h>
6 
8 
13 
18 
21 
29 
30 using namespace std;
31 using namespace edm;
32 
33 // ROOT
34 #include "TROOT.h"
35 #include "TFile.h"
36 #include "TTree.h"
37 #include "TBranch.h"
38 #include "TH1.h"
39 #include "TH2.h"
40 class TFile;
41 
42 //Constructor
44  dbe_(edm::Service<DQMStore>().operator->()),
45  conf_(ps),
46  m_cacheID_(0)
47  // trajectoryInput_( ps.getParameter<edm::InputTag>("trajectoryInput") )
48 {
49  topFolderName_ = conf_.getParameter<std::string>("TopFolderName");
50 
51  runStandalone = conf_.getParameter<bool>("runStandalone");
52 
53  outputMEsInRootFile = conf_.getParameter<bool>("OutputMEsInRootFile");
54 
56 
57  trajectoryInputToken_ = consumes<std::vector<Trajectory> >( conf_.getParameter<edm::InputTag>("trajectoryInput") );
58 
59  edm::ParameterSet ParametersResolx_LF = conf_.getParameter<edm::ParameterSet>("TH1Resolx_LF");
60  layerswitchResolx_LF = ParametersResolx_LF.getParameter<bool>("layerswitchon");
61 
62  edm::ParameterSet ParametersResolx_MF = conf_.getParameter<edm::ParameterSet>("TH1Resolx_MF");
63  layerswitchResolx_MF = ParametersResolx_MF.getParameter<bool>("layerswitchon");
64 
65  edm::ParameterSet ParametersRes_LF = conf_.getParameter<edm::ParameterSet>("TH1Res_LF");
66  layerswitchRes_LF = ParametersRes_LF.getParameter<bool>("layerswitchon");
67 
68  edm::ParameterSet ParametersRes_MF = conf_.getParameter<edm::ParameterSet>("TH1Res_MF");
69  layerswitchRes_MF = ParametersRes_MF.getParameter<bool>("layerswitchon");
70 
71  edm::ParameterSet ParametersPull_LF = conf_.getParameter<edm::ParameterSet>("TH1Pull_LF");
72  layerswitchPull_LF = ParametersPull_LF.getParameter<bool>("layerswitchon");
73 
74  edm::ParameterSet ParametersPull_MF = conf_.getParameter<edm::ParameterSet>("TH1Pull_MF");
75  layerswitchPull_MF = ParametersPull_MF.getParameter<bool>("layerswitchon");
76 
77  edm::ParameterSet ParametersCategory = conf_.getParameter<edm::ParameterSet>("TH1Category");
78  layerswitchCategory = ParametersCategory.getParameter<bool>("layerswitchon");
79 
80  edm::ParameterSet ParametersTrackwidth = conf_.getParameter<edm::ParameterSet>("TH1Trackwidth");
81  layerswitchTrackwidth = ParametersTrackwidth.getParameter<bool>("layerswitchon");
82 
83  edm::ParameterSet ParametersExpectedwidth = conf_.getParameter<edm::ParameterSet>("TH1Expectedwidth");
84  layerswitchExpectedwidth = ParametersExpectedwidth.getParameter<bool>("layerswitchon");
85 
86  edm::ParameterSet ParametersClusterwidth = conf_.getParameter<edm::ParameterSet>("TH1Clusterwidth");
87  layerswitchClusterwidth = ParametersClusterwidth.getParameter<bool>("layerswitchon");
88 
89  edm::ParameterSet ParametersTrackanglealpha = conf_.getParameter<edm::ParameterSet>("TH1Trackanglealpha");
90  layerswitchTrackanglealpha = ParametersTrackanglealpha.getParameter<bool>("layerswitchon");
91 
92  edm::ParameterSet ParametersTrackanglebeta = conf_.getParameter<edm::ParameterSet>("TH1Trackanglebeta");
93  layerswitchTrackanglebeta = ParametersTrackanglebeta.getParameter<bool>("layerswitchon");
94 
95  edm::ParameterSet ParametersResolxMFTrackwidthProfile_WClus1 = conf_.getParameter<edm::ParameterSet>("TProfResolxMFTrackwidthProfile_WClus1");
96  layerswitchResolxMFTrackwidthProfile_WClus1 = ParametersResolxMFTrackwidthProfile_WClus1.getParameter<bool>("layerswitchon");
97 
98  edm::ParameterSet ParametersResolxMFTrackwidthProfile_WClus2 = conf_.getParameter<edm::ParameterSet>("TProfResolxMFTrackwidthProfile_WClus2");
99  layerswitchResolxMFTrackwidthProfile_WClus2 = ParametersResolxMFTrackwidthProfile_WClus2.getParameter<bool>("layerswitchon");
100 
101  edm::ParameterSet ParametersResolxMFTrackwidthProfile_WClus3 = conf_.getParameter<edm::ParameterSet>("TProfResolxMFTrackwidthProfile_WClus3");
102  layerswitchResolxMFTrackwidthProfile_WClus3 = ParametersResolxMFTrackwidthProfile_WClus3.getParameter<bool>("layerswitchon");
103 
104  edm::ParameterSet ParametersResolxMFTrackwidthProfile_WClus4 = conf_.getParameter<edm::ParameterSet>("TProfResolxMFTrackwidthProfile_WClus4");
105  layerswitchResolxMFTrackwidthProfile_WClus4 = ParametersResolxMFTrackwidthProfile_WClus4.getParameter<bool>("layerswitchon");
106 
107  edm::ParameterSet ParametersResMFTrackwidthProfile_WClus1 = conf_.getParameter<edm::ParameterSet>("TProfResMFTrackwidthProfile_WClus1");
108  layerswitchResMFTrackwidthProfile_WClus1 = ParametersResMFTrackwidthProfile_WClus1.getParameter<bool>("layerswitchon");
109 
110  edm::ParameterSet ParametersResMFTrackwidthProfile_WClus2 = conf_.getParameter<edm::ParameterSet>("TProfResMFTrackwidthProfile_WClus2");
111  layerswitchResMFTrackwidthProfile_WClus2 = ParametersResMFTrackwidthProfile_WClus2.getParameter<bool>("layerswitchon");
112 
113  edm::ParameterSet ParametersResMFTrackwidthProfile_WClus21 = conf_.getParameter<edm::ParameterSet>("TProfResMFTrackwidthProfile_WClus21");
114  layerswitchResMFTrackwidthProfile_WClus21 = ParametersResMFTrackwidthProfile_WClus21.getParameter<bool>("layerswitchon");
115 
116  edm::ParameterSet ParametersResMFTrackwidthProfile_WClus22 = conf_.getParameter<edm::ParameterSet>("TProfResMFTrackwidthProfile_WClus22");
117  layerswitchResMFTrackwidthProfile_WClus22 = ParametersResMFTrackwidthProfile_WClus22.getParameter<bool>("layerswitchon");
118 
119  edm::ParameterSet ParametersResMFTrackwidthProfile_WClus23 = conf_.getParameter<edm::ParameterSet>("TProfResMFTrackwidthProfile_WClus23");
120  layerswitchResMFTrackwidthProfile_WClus23 = ParametersResMFTrackwidthProfile_WClus23.getParameter<bool>("layerswitchon");
121 
122  edm::ParameterSet ParametersResMFTrackwidthProfile_WClus3 = conf_.getParameter<edm::ParameterSet>("TProfResMFTrackwidthProfile_WClus3");
123  layerswitchResMFTrackwidthProfile_WClus3 = ParametersResMFTrackwidthProfile_WClus3.getParameter<bool>("layerswitchon");
124 
125  edm::ParameterSet ParametersResMFTrackwidthProfile_WClus4 = conf_.getParameter<edm::ParameterSet>("TProfResMFTrackwidthProfile_WClus4");
126  layerswitchResMFTrackwidthProfile_WClus4 = ParametersResMFTrackwidthProfile_WClus4.getParameter<bool>("layerswitchon");
127 
128  edm::ParameterSet ParametersResolxMFTrackwidthProfile = conf_.getParameter<edm::ParameterSet>("TProfResolxMFTrackwidthProfile");
129  layerswitchResolxMFTrackwidthProfile = ParametersResolxMFTrackwidthProfile.getParameter<bool>("layerswitchon");
130 
131  edm::ParameterSet ParametersResolxMFTrackwidthProfile_Category1 = conf_.getParameter<edm::ParameterSet>("TProfResolxMFTrackwidthProfile_Category1");
132  layerswitchResolxMFTrackwidthProfile_Category1 = ParametersResolxMFTrackwidthProfile_Category1.getParameter<bool>("layerswitchon");
133 
134  edm::ParameterSet ParametersResolxMFTrackwidthProfile_Category2 = conf_.getParameter<edm::ParameterSet>("TProfResolxMFTrackwidthProfile_Category2");
135  layerswitchResolxMFTrackwidthProfile_Category2 = ParametersResolxMFTrackwidthProfile_Category2.getParameter<bool>("layerswitchon");
136 
137  edm::ParameterSet ParametersResolxMFTrackwidthProfile_Category3 = conf_.getParameter<edm::ParameterSet>("TProfResolxMFTrackwidthProfile_Category3");
138  layerswitchResolxMFTrackwidthProfile_Category3 = ParametersResolxMFTrackwidthProfile_Category3.getParameter<bool>("layerswitchon");
139 
140  edm::ParameterSet ParametersResolxMFTrackwidthProfile_Category4 = conf_.getParameter<edm::ParameterSet>("TProfResolxMFTrackwidthProfile_Category4");
141  layerswitchResolxMFTrackwidthProfile_Category4 = ParametersResolxMFTrackwidthProfile_Category4.getParameter<bool>("layerswitchon");
142 
143  edm::ParameterSet ParametersResolxMFClusterwidthProfile_Category1 = conf_.getParameter<edm::ParameterSet>("TProfResolxMFClusterwidthProfile_Category1");
144  layerswitchResolxMFClusterwidthProfile_Category1 = ParametersResolxMFClusterwidthProfile_Category1.getParameter<bool>("layerswitchon");
145 
146  edm::ParameterSet ParametersResolxMFAngleProfile = conf_.getParameter<edm::ParameterSet>("TProfResolxMFAngleProfile");
147  layerswitchResolxMFAngleProfile = ParametersResolxMFAngleProfile.getParameter<bool>("layerswitchon");
148 
149  edm::ParameterSet ParametersWclusRphi = conf_.getParameter<edm::ParameterSet>("TH1WclusRphi");
150  layerswitchWclusRphi = ParametersWclusRphi.getParameter<bool>("layerswitchon");
151 
152  edm::ParameterSet ParametersAdcRphi = conf_.getParameter<edm::ParameterSet>("TH1AdcRphi");
153  layerswitchAdcRphi = ParametersAdcRphi.getParameter<bool>("layerswitchon");
154 
155  edm::ParameterSet ParametersResolxLFRphi = conf_.getParameter<edm::ParameterSet>("TH1ResolxLFRphi");
156  layerswitchResolxLFRphi = ParametersResolxLFRphi.getParameter<bool>("layerswitchon");
157 
158  edm::ParameterSet ParametersResolxMFRphi = conf_.getParameter<edm::ParameterSet>("TH1ResolxMFRphi");
159  layerswitchResolxMFRphi = ParametersResolxMFRphi.getParameter<bool>("layerswitchon");
160 
161  edm::ParameterSet ParametersResolxMFRphiwclus1 = conf_.getParameter<edm::ParameterSet>("TH1ResolxMFRphiwclus1");
162  layerswitchResolxMFRphiwclus1 = ParametersResolxMFRphiwclus1.getParameter<bool>("layerswitchon");
163 
164  edm::ParameterSet ParametersResolxMFRphiwclus2 = conf_.getParameter<edm::ParameterSet>("TH1ResolxMFRphiwclus2");
165  layerswitchResolxMFRphiwclus2 = ParametersResolxMFRphiwclus2.getParameter<bool>("layerswitchon");
166 
167  edm::ParameterSet ParametersResolxMFRphiwclus3 = conf_.getParameter<edm::ParameterSet>("TH1ResolxMFRphiwclus3");
168  layerswitchResolxMFRphiwclus3 = ParametersResolxMFRphiwclus3.getParameter<bool>("layerswitchon");
169 
170  edm::ParameterSet ParametersResolxMFRphiwclus4 = conf_.getParameter<edm::ParameterSet>("TH1ResolxMFRphiwclus4");
171  layerswitchResolxMFRphiwclus4 = ParametersResolxMFRphiwclus4.getParameter<bool>("layerswitchon");
172 
173  edm::ParameterSet ParametersResLFRphi = conf_.getParameter<edm::ParameterSet>("TH1ResLFRphi");
174  layerswitchResLFRphi = ParametersResLFRphi.getParameter<bool>("layerswitchon");
175 
176  edm::ParameterSet ParametersResMFRphi = conf_.getParameter<edm::ParameterSet>("TH1ResMFRphi");
177  layerswitchResMFRphi = ParametersResMFRphi.getParameter<bool>("layerswitchon");
178 
179  edm::ParameterSet ParametersResMFRphiwclus1 = conf_.getParameter<edm::ParameterSet>("TH1ResMFRphiwclus1");
180  layerswitchResMFRphiwclus1 = ParametersResMFRphiwclus1.getParameter<bool>("layerswitchon");
181 
182  edm::ParameterSet ParametersResMFRphiwclus2 = conf_.getParameter<edm::ParameterSet>("TH1ResMFRphiwclus2");
183  layerswitchResMFRphiwclus2 = ParametersResMFRphiwclus2.getParameter<bool>("layerswitchon");
184 
185  edm::ParameterSet ParametersResMFRphiwclus3 = conf_.getParameter<edm::ParameterSet>("TH1ResMFRphiwclus3");
186  layerswitchResMFRphiwclus3 = ParametersResMFRphiwclus3.getParameter<bool>("layerswitchon");
187 
188  edm::ParameterSet ParametersResMFRphiwclus4 = conf_.getParameter<edm::ParameterSet>("TH1ResMFRphiwclus4");
189  layerswitchResMFRphiwclus4 = ParametersResMFRphiwclus4.getParameter<bool>("layerswitchon");
190 
191  edm::ParameterSet ParametersPullLFRphi = conf_.getParameter<edm::ParameterSet>("TH1PullLFRphi");
192  layerswitchPullLFRphi = ParametersPullLFRphi.getParameter<bool>("layerswitchon");
193 
194  edm::ParameterSet ParametersPullMFRphi = conf_.getParameter<edm::ParameterSet>("TH1PullMFRphi");
195  layerswitchPullMFRphi = ParametersPullMFRphi.getParameter<bool>("layerswitchon");
196 
197  edm::ParameterSet ParametersPullMFRphiwclus1 = conf_.getParameter<edm::ParameterSet>("TH1PullMFRphiwclus1");
198  layerswitchPullMFRphiwclus1 = ParametersPullMFRphiwclus1.getParameter<bool>("layerswitchon");
199 
200  edm::ParameterSet ParametersPullMFRphiwclus2 = conf_.getParameter<edm::ParameterSet>("TH1PullMFRphiwclus2");
201  layerswitchPullMFRphiwclus2 = ParametersPullMFRphiwclus2.getParameter<bool>("layerswitchon");
202 
203  edm::ParameterSet ParametersPullMFRphiwclus3 = conf_.getParameter<edm::ParameterSet>("TH1PullMFRphiwclus3");
204  layerswitchPullMFRphiwclus3 = ParametersPullMFRphiwclus3.getParameter<bool>("layerswitchon");
205 
206  edm::ParameterSet ParametersPullMFRphiwclus4 = conf_.getParameter<edm::ParameterSet>("TH1PullMFRphiwclus4");
207  layerswitchPullMFRphiwclus4 = ParametersPullMFRphiwclus4.getParameter<bool>("layerswitchon");
208 
209  edm::ParameterSet ParametersTrackangleRphi = conf_.getParameter<edm::ParameterSet>("TH1TrackangleRphi");
210  layerswitchTrackangleRphi = ParametersTrackangleRphi.getParameter<bool>("layerswitchon");
211 
212  edm::ParameterSet ParametersTrackanglebetaRphi = conf_.getParameter<edm::ParameterSet>("TH1TrackanglebetaRphi");
213  layerswitchTrackanglebetaRphi = ParametersTrackanglebetaRphi.getParameter<bool>("layerswitchon");
214 
215  edm::ParameterSet ParametersTrackangle2Rphi = conf_.getParameter<edm::ParameterSet>("TH1Trackangle2Rphi");
216  layerswitchTrackangle2Rphi = ParametersTrackangle2Rphi.getParameter<bool>("layerswitchon");
217 
218  edm::ParameterSet ParametersPullTrackangleProfileRphi = conf_.getParameter<edm::ParameterSet>("TProfPullTrackangleProfileRphi");
219  layerswitchPullTrackangleProfileRphi = ParametersPullTrackangleProfileRphi.getParameter<bool>("layerswitchon");
220 
221  edm::ParameterSet ParametersPullTrackangle2DRphi = conf_.getParameter<edm::ParameterSet>("TH1PullTrackangle2DRphi");
222  layerswitchPullTrackangle2DRphi = ParametersPullTrackangle2DRphi.getParameter<bool>("layerswitchon");
223 
224  edm::ParameterSet ParametersTrackwidthRphi = conf_.getParameter<edm::ParameterSet>("TH1TrackwidthRphi");
225  layerswitchTrackwidthRphi = ParametersTrackwidthRphi.getParameter<bool>("layerswitchon");
226 
227  edm::ParameterSet ParametersExpectedwidthRphi = conf_.getParameter<edm::ParameterSet>("TH1ExpectedwidthRphi");
228  layerswitchExpectedwidthRphi = ParametersExpectedwidthRphi.getParameter<bool>("layerswitchon");
229 
230  edm::ParameterSet ParametersClusterwidthRphi = conf_.getParameter<edm::ParameterSet>("TH1ClusterwidthRphi");
231  layerswitchClusterwidthRphi = ParametersClusterwidthRphi.getParameter<bool>("layerswitchon");
232 
233  edm::ParameterSet ParametersCategoryRphi = conf_.getParameter<edm::ParameterSet>("TH1CategoryRphi");
234  layerswitchCategoryRphi = ParametersCategoryRphi.getParameter<bool>("layerswitchon");
235 
236  edm::ParameterSet ParametersPullTrackwidthProfileRphi = conf_.getParameter<edm::ParameterSet>("TProfPullTrackwidthProfileRphi");
237  layerswitchPullTrackwidthProfileRphi = ParametersPullTrackwidthProfileRphi.getParameter<bool>("layerswitchon");
238 
239  edm::ParameterSet ParametersPullTrackwidthProfileRphiwclus1 = conf_.getParameter<edm::ParameterSet>("TProfPullTrackwidthProfileRphiwclus1");
240  layerswitchPullTrackwidthProfileRphiwclus1 = ParametersPullTrackwidthProfileRphiwclus1.getParameter<bool>("layerswitchon");
241 
242  edm::ParameterSet ParametersPullTrackwidthProfileRphiwclus2 = conf_.getParameter<edm::ParameterSet>("TProfPullTrackwidthProfileRphiwclus2");
243  layerswitchPullTrackwidthProfileRphiwclus2 = ParametersPullTrackwidthProfileRphiwclus2.getParameter<bool>("layerswitchon");
244 
245  edm::ParameterSet ParametersPullTrackwidthProfileRphiwclus3 = conf_.getParameter<edm::ParameterSet>("TProfPullTrackwidthProfileRphiwclus3");
246  layerswitchPullTrackwidthProfileRphiwclus3 = ParametersPullTrackwidthProfileRphiwclus3.getParameter<bool>("layerswitchon");
247 
248  edm::ParameterSet ParametersPullTrackwidthProfileRphiwclus4 = conf_.getParameter<edm::ParameterSet>("TProfPullTrackwidthProfileRphiwclus4");
249  layerswitchPullTrackwidthProfileRphiwclus4 = ParametersPullTrackwidthProfileRphiwclus4.getParameter<bool>("layerswitchon");
250 
251  edm::ParameterSet ParametersPullTrackwidthProfileCategory1Rphi = conf_.getParameter<edm::ParameterSet>("TProfPullTrackwidthProfileCategory1Rphi");
252  layerswitchPullTrackwidthProfileCategory1Rphi = ParametersPullTrackwidthProfileCategory1Rphi.getParameter<bool>("layerswitchon");
253 
254  edm::ParameterSet ParametersPullTrackwidthProfileCategory2Rphi = conf_.getParameter<edm::ParameterSet>("TProfPullTrackwidthProfileCategory2Rphi");
255  layerswitchPullTrackwidthProfileCategory2Rphi = ParametersPullTrackwidthProfileCategory2Rphi.getParameter<bool>("layerswitchon");
256 
257  edm::ParameterSet ParametersPullTrackwidthProfileCategory3Rphi = conf_.getParameter<edm::ParameterSet>("TProfPullTrackwidthProfileCategory3Rphi");
258  layerswitchPullTrackwidthProfileCategory3Rphi = ParametersPullTrackwidthProfileCategory3Rphi.getParameter<bool>("layerswitchon");
259 
260  edm::ParameterSet ParametersPullTrackwidthProfileCategory4Rphi = conf_.getParameter<edm::ParameterSet>("TProfPullTrackwidthProfileCategory4Rphi");
261  layerswitchPullTrackwidthProfileCategory4Rphi = ParametersPullTrackwidthProfileCategory4Rphi.getParameter<bool>("layerswitchon");
262 
263  edm::ParameterSet ParametersResolxMFTrackwidthProfileRphi = conf_.getParameter<edm::ParameterSet>("TProfResolxMFTrackwidthProfileRphi");
264  layerswitchResolxMFTrackwidthProfileRphi = ParametersResolxMFTrackwidthProfileRphi.getParameter<bool>("layerswitchon");
265 
266  edm::ParameterSet ParametersResolxMFTrackwidthProfileWclus1Rphi = conf_.getParameter<edm::ParameterSet>("TProfResolxMFTrackwidthProfileWclus1Rphi");
267  layerswitchResolxMFTrackwidthProfileWclus1Rphi = ParametersResolxMFTrackwidthProfileWclus1Rphi.getParameter<bool>("layerswitchon");
268 
269  edm::ParameterSet ParametersResolxMFTrackwidthProfileWclus2Rphi = conf_.getParameter<edm::ParameterSet>("TProfResolxMFTrackwidthProfileWclus2Rphi");
270  layerswitchResolxMFTrackwidthProfileWclus2Rphi = ParametersResolxMFTrackwidthProfileWclus2Rphi.getParameter<bool>("layerswitchon");
271 
272  edm::ParameterSet ParametersResolxMFTrackwidthProfileWclus3Rphi = conf_.getParameter<edm::ParameterSet>("TProfResolxMFTrackwidthProfileWclus3Rphi");
273  layerswitchResolxMFTrackwidthProfileWclus3Rphi = ParametersResolxMFTrackwidthProfileWclus3Rphi.getParameter<bool>("layerswitchon");
274 
275  edm::ParameterSet ParametersResolxMFTrackwidthProfileWclus4Rphi = conf_.getParameter<edm::ParameterSet>("TProfResolxMFTrackwidthProfileWclus4Rphi");
276  layerswitchResolxMFTrackwidthProfileWclus4Rphi = ParametersResolxMFTrackwidthProfileWclus4Rphi.getParameter<bool>("layerswitchon");
277 
278  edm::ParameterSet ParametersResMFTrackwidthProfileWclus1Rphi = conf_.getParameter<edm::ParameterSet>("TProfResMFTrackwidthProfileWclus1Rphi");
279  layerswitchResMFTrackwidthProfileWclus1Rphi = ParametersResMFTrackwidthProfileWclus1Rphi.getParameter<bool>("layerswitchon");
280 
281  edm::ParameterSet ParametersResMFTrackwidthProfileWclus2Rphi = conf_.getParameter<edm::ParameterSet>("TProfResMFTrackwidthProfileWclus2Rphi");
282  layerswitchResMFTrackwidthProfileWclus2Rphi = ParametersResMFTrackwidthProfileWclus2Rphi.getParameter<bool>("layerswitchon");
283 
284  edm::ParameterSet ParametersResMFTrackwidthProfileWclus3Rphi = conf_.getParameter<edm::ParameterSet>("TProfResMFTrackwidthProfileWclus3Rphi");
285  layerswitchResMFTrackwidthProfileWclus3Rphi = ParametersResMFTrackwidthProfileWclus3Rphi.getParameter<bool>("layerswitchon");
286 
287  edm::ParameterSet ParametersResMFTrackwidthProfileWclus4Rphi = conf_.getParameter<edm::ParameterSet>("TProfResMFTrackwidthProfileWclus4Rphi");
288  layerswitchResMFTrackwidthProfileWclus4Rphi = ParametersResMFTrackwidthProfileWclus4Rphi.getParameter<bool>("layerswitchon");
289 
290  edm::ParameterSet ParametersResolxMFTrackwidthProfileCategory1Rphi = conf_.getParameter<edm::ParameterSet>("TProfResolxMFTrackwidthProfileCategory1Rphi");
291  layerswitchResolxMFTrackwidthProfileCategory1Rphi = ParametersResolxMFTrackwidthProfileCategory1Rphi.getParameter<bool>("layerswitchon");
292 
293  edm::ParameterSet ParametersResolxMFTrackwidthProfileCategory2Rphi = conf_.getParameter<edm::ParameterSet>("TProfResolxMFTrackwidthProfileCategory2Rphi");
294  layerswitchResolxMFTrackwidthProfileCategory2Rphi = ParametersResolxMFTrackwidthProfileCategory2Rphi.getParameter<bool>("layerswitchon");
295 
296  edm::ParameterSet ParametersResolxMFTrackwidthProfileCategory3Rphi = conf_.getParameter<edm::ParameterSet>("TProfResolxMFTrackwidthProfileCategory3Rphi");
297  layerswitchResolxMFTrackwidthProfileCategory3Rphi = ParametersResolxMFTrackwidthProfileCategory3Rphi.getParameter<bool>("layerswitchon");
298 
299  edm::ParameterSet ParametersResolxMFTrackwidthProfileCategory4Rphi = conf_.getParameter<edm::ParameterSet>("TProfResolxMFTrackwidthProfileCategory4Rphi");
300  layerswitchResolxMFTrackwidthProfileCategory4Rphi = ParametersResolxMFTrackwidthProfileCategory4Rphi.getParameter<bool>("layerswitchon");
301 
302  edm::ParameterSet ParametersResolxMFAngleProfileRphi = conf_.getParameter<edm::ParameterSet>("TProfResolxMFAngleProfileRphi");
303  layerswitchResolxMFAngleProfileRphi = ParametersResolxMFAngleProfileRphi.getParameter<bool>("layerswitchon");
304 
305  edm::ParameterSet ParametersResolxMFClusterwidthProfileCategory1Rphi = conf_.getParameter<edm::ParameterSet>("TProfResolxMFClusterwidthProfileCategory1Rphi");
306  layerswitchResolxMFClusterwidthProfileCategory1Rphi = ParametersResolxMFClusterwidthProfileCategory1Rphi.getParameter<bool>("layerswitchon");
307 
308  edm::ParameterSet ParametersrapidityResProfilewclus1 = conf_.getParameter<edm::ParameterSet>("TProfrapidityResProfilewclus1");
309  layerswitchrapidityResProfilewclus1 = ParametersrapidityResProfilewclus1.getParameter<bool>("layerswitchon");
310 
311  edm::ParameterSet ParametersrapidityResProfilewclus2 = conf_.getParameter<edm::ParameterSet>("TProfrapidityResProfilewclus2");
312  layerswitchrapidityResProfilewclus2 = ParametersrapidityResProfilewclus2.getParameter<bool>("layerswitchon");
313 
314  edm::ParameterSet ParametersrapidityResProfilewclus3 = conf_.getParameter<edm::ParameterSet>("TProfrapidityResProfilewclus3");
315  layerswitchrapidityResProfilewclus3 = ParametersrapidityResProfilewclus3.getParameter<bool>("layerswitchon");
316 
317  edm::ParameterSet ParametersrapidityResProfilewclus4 = conf_.getParameter<edm::ParameterSet>("TProfrapidityResProfilewclus4");
318  layerswitchrapidityResProfilewclus4 = ParametersrapidityResProfilewclus4.getParameter<bool>("layerswitchon");
319 
320  edm::ParameterSet ParametersWclusSas = conf_.getParameter<edm::ParameterSet>("TH1WclusSas");
321  layerswitchWclusSas = ParametersWclusSas.getParameter<bool>("layerswitchon");
322 
323  edm::ParameterSet ParametersAdcSas = conf_.getParameter<edm::ParameterSet>("TH1AdcSas");
324  layerswitchAdcSas = ParametersAdcSas.getParameter<bool>("layerswitchon");
325 
326  edm::ParameterSet ParametersResolxLFSas = conf_.getParameter<edm::ParameterSet>("TH1ResolxLFSas");
327  layerswitchResolxLFSas = ParametersResolxLFSas.getParameter<bool>("layerswitchon");
328 
329  edm::ParameterSet ParametersResolxMFSas = conf_.getParameter<edm::ParameterSet>("TH1ResolxMFSas");
330  layerswitchResolxMFSas = ParametersResolxMFSas.getParameter<bool>("layerswitchon");
331 
332  edm::ParameterSet ParametersResLFSas = conf_.getParameter<edm::ParameterSet>("TH1ResLFSas");
333  layerswitchResLFSas = ParametersResLFSas.getParameter<bool>("layerswitchon");
334 
335  edm::ParameterSet ParametersResMFSas = conf_.getParameter<edm::ParameterSet>("TH1ResMFSas");
336  layerswitchResMFSas = ParametersResMFSas.getParameter<bool>("layerswitchon");
337 
338  edm::ParameterSet ParametersPullLFSas = conf_.getParameter<edm::ParameterSet>("TH1PullLFSas");
339  layerswitchPullLFSas = ParametersPullLFSas.getParameter<bool>("layerswitchon");
340 
341  edm::ParameterSet ParametersPullMFSas = conf_.getParameter<edm::ParameterSet>("TH1PullMFSas");
342  layerswitchPullMFSas = ParametersPullMFSas.getParameter<bool>("layerswitchon");
343 
344  edm::ParameterSet ParametersTrackangleSas = conf_.getParameter<edm::ParameterSet>("TH1TrackangleSas");
345  layerswitchTrackangleSas = ParametersTrackangleSas.getParameter<bool>("layerswitchon");
346 
347  edm::ParameterSet ParametersTrackanglebetaSas = conf_.getParameter<edm::ParameterSet>("TH1TrackanglebetaSas");
348  layerswitchTrackanglebetaSas = ParametersTrackanglebetaSas.getParameter<bool>("layerswitchon");
349 
350  edm::ParameterSet ParametersPullTrackangleProfileSas = conf_.getParameter<edm::ParameterSet>("TProfPullTrackangleProfileSas");
351  layerswitchPullTrackangleProfileSas = ParametersPullTrackangleProfileSas.getParameter<bool>("layerswitchon");
352 
353  edm::ParameterSet ParametersTrackwidthSas = conf_.getParameter<edm::ParameterSet>("TH1TrackwidthSas");
354  layerswitchTrackwidthSas = ParametersTrackwidthSas.getParameter<bool>("layerswitchon");
355 
356  edm::ParameterSet ParametersExpectedwidthSas = conf_.getParameter<edm::ParameterSet>("TH1ExpectedwidthSas");
357  layerswitchExpectedwidthSas = ParametersExpectedwidthSas.getParameter<bool>("layerswitchon");
358 
359  edm::ParameterSet ParametersClusterwidthSas = conf_.getParameter<edm::ParameterSet>("TH1ClusterwidthSas");
360  layerswitchClusterwidthSas = ParametersClusterwidthSas.getParameter<bool>("layerswitchon");
361 
362  edm::ParameterSet ParametersCategorySas = conf_.getParameter<edm::ParameterSet>("TH1CategorySas");
363  layerswitchCategorySas = ParametersCategorySas.getParameter<bool>("layerswitchon");
364 
365  edm::ParameterSet ParametersPullTrackwidthProfileSas = conf_.getParameter<edm::ParameterSet>("TProfPullTrackwidthProfileSas");
366  layerswitchPullTrackwidthProfileSas = ParametersPullTrackwidthProfileSas.getParameter<bool>("layerswitchon");
367 
368  edm::ParameterSet ParametersPullTrackwidthProfileCategory1Sas = conf_.getParameter<edm::ParameterSet>("TProfPullTrackwidthProfileCategory1Sas");
369  layerswitchPullTrackwidthProfileCategory1Sas = ParametersPullTrackwidthProfileCategory1Sas.getParameter<bool>("layerswitchon");
370 
371  edm::ParameterSet ParametersPullTrackwidthProfileCategory2Sas = conf_.getParameter<edm::ParameterSet>("TProfPullTrackwidthProfileCategory2Sas");
372  layerswitchPullTrackwidthProfileCategory2Sas = ParametersPullTrackwidthProfileCategory2Sas.getParameter<bool>("layerswitchon");
373 
374  edm::ParameterSet ParametersPullTrackwidthProfileCategory3Sas = conf_.getParameter<edm::ParameterSet>("TProfPullTrackwidthProfileCategory3Sas");
375  layerswitchPullTrackwidthProfileCategory3Sas = ParametersPullTrackwidthProfileCategory3Sas.getParameter<bool>("layerswitchon");
376 
377  edm::ParameterSet ParametersPullTrackwidthProfileCategory4Sas = conf_.getParameter<edm::ParameterSet>("TProfPullTrackwidthProfileCategory4Sas");
378  layerswitchPullTrackwidthProfileCategory4Sas = ParametersPullTrackwidthProfileCategory4Sas.getParameter<bool>("layerswitchon");
379 
380  edm::ParameterSet ParametersResolxMFTrackwidthProfileSas = conf_.getParameter<edm::ParameterSet>("TProfResolxMFTrackwidthProfileSas");
381  layerswitchResolxMFTrackwidthProfileSas = ParametersResolxMFTrackwidthProfileSas.getParameter<bool>("layerswitchon");
382 
383  edm::ParameterSet ParametersResolxMFTrackwidthProfileCategory1Sas = conf_.getParameter<edm::ParameterSet>("TProfResolxMFTrackwidthProfileCategory1Sas");
384  layerswitchResolxMFTrackwidthProfileCategory1Sas = ParametersResolxMFTrackwidthProfileCategory1Sas.getParameter<bool>("layerswitchon");
385 
386  edm::ParameterSet ParametersResolxMFTrackwidthProfileCategory2Sas = conf_.getParameter<edm::ParameterSet>("TProfResolxMFTrackwidthProfileCategory2Sas");
387  layerswitchResolxMFTrackwidthProfileCategory2Sas = ParametersResolxMFTrackwidthProfileCategory2Sas.getParameter<bool>("layerswitchon");
388 
389  edm::ParameterSet ParametersResolxMFTrackwidthProfileCategory3Sas = conf_.getParameter<edm::ParameterSet>("TProfResolxMFTrackwidthProfileCategory3Sas");
390  layerswitchResolxMFTrackwidthProfileCategory3Sas = ParametersResolxMFTrackwidthProfileCategory3Sas.getParameter<bool>("layerswitchon");
391 
392  edm::ParameterSet ParametersResolxMFTrackwidthProfileCategory4Sas = conf_.getParameter<edm::ParameterSet>("TProfResolxMFTrackwidthProfileCategory4Sas");
393  layerswitchResolxMFTrackwidthProfileCategory4Sas = ParametersResolxMFTrackwidthProfileCategory4Sas.getParameter<bool>("layerswitchon");
394 
395  edm::ParameterSet ParametersResolxMFAngleProfileSas = conf_.getParameter<edm::ParameterSet>("TProfResolxMFAngleProfileSas");
396  layerswitchResolxMFAngleProfileSas = ParametersResolxMFAngleProfileSas.getParameter<bool>("layerswitchon");
397 
398  edm::ParameterSet ParametersResolxMFClusterwidthProfileCategory1Sas = conf_.getParameter<edm::ParameterSet>("TProfResolxMFClusterwidthProfileCategory1Sas");
399  layerswitchResolxMFClusterwidthProfileCategory1Sas = ParametersResolxMFClusterwidthProfileCategory1Sas.getParameter<bool>("layerswitchon");
400 
401  edm::ParameterSet ParametersPosxMatched = conf_.getParameter<edm::ParameterSet>("TH1PosxMatched");
402  layerswitchPosxMatched = ParametersPosxMatched.getParameter<bool>("layerswitchon");
403 
404  edm::ParameterSet ParametersPosyMatched = conf_.getParameter<edm::ParameterSet>("TH1PosyMatched");
405  layerswitchPosyMatched = ParametersPosyMatched.getParameter<bool>("layerswitchon");
406 
407  edm::ParameterSet ParametersResolxMatched = conf_.getParameter<edm::ParameterSet>("TH1ResolxMatched");
408  layerswitchResolxMatched = ParametersResolxMatched.getParameter<bool>("layerswitchon");
409 
410  edm::ParameterSet ParametersResolyMatched = conf_.getParameter<edm::ParameterSet>("TH1ResolyMatched");
411  layerswitchResolyMatched = ParametersResolyMatched.getParameter<bool>("layerswitchon");
412 
413  edm::ParameterSet ParametersResxMatched = conf_.getParameter<edm::ParameterSet>("TH1ResxMatched");
414  layerswitchResxMatched = ParametersResxMatched.getParameter<bool>("layerswitchon");
415 
416  edm::ParameterSet ParametersResyMatched = conf_.getParameter<edm::ParameterSet>("TH1ResyMatched");
417  layerswitchResyMatched = ParametersResyMatched.getParameter<bool>("layerswitchon");
418 
419  edm::ParameterSet ParametersPullxMatched = conf_.getParameter<edm::ParameterSet>("TH1PullxMatched");
420  layerswitchPullxMatched = ParametersPullxMatched.getParameter<bool>("layerswitchon");
421 
422  edm::ParameterSet ParametersPullyMatched = conf_.getParameter<edm::ParameterSet>("TH1PullyMatched");
423  layerswitchPullyMatched = ParametersPullyMatched.getParameter<bool>("layerswitchon");
424 
425 }
426 
427 //Destructor
429 }
430 //--------------------------------------------------------------------------------------------
432 
433  unsigned long long cacheID = es.get<SiStripDetCablingRcd>().cacheIdentifier();
434  if (m_cacheID_ != cacheID) {
435  m_cacheID_ = cacheID;
436  edm::LogInfo("SiStripRecHitsValid") <<"SiStripRecHitsValid::beginRun: "
437  << " Creating MEs for new Cabling ";
438 
439  createMEs(ibooker,es);
440  }
441 }
442 
443 
445 
446 }
447 
449 
450  //Only in standalone mode save local root file
452 
453 }
454 
455 // Functions that gets called by framework every event
457 {
458 
459  LogInfo("EventInfo") << " Run = " << e.id().run() << " Event = " << e.id().event();
460  //cout << " Run = " << e.id().run() << " Event = " << e.id().event() << endl;
461 
462  int isrechitrphi = 0;
463  int isrechitsas = 0;
464  int isrechitmatched = 0;
465 
466  DetId detid;
467  uint32_t myid;
468 
469  TrackerHitAssociator associate(e, conf_);
470  PSimHit closest;
471 
472  //Retrieve tracker topology from geometry
473  edm::ESHandle<TrackerTopology> tTopoHandle;
474  es.get<IdealGeometryRecord>().get(tTopoHandle);
475  const TrackerTopology* const tTopo = tTopoHandle.product();
476 
478  es.get < TrackerDigiGeometryRecord > ().get(pDD);
479  const TrackerGeometry & tracker(*pDD);
480 
481  const TrackerGeometry *tracker2;
483  es.get < TrackerDigiGeometryRecord > ().get(estracker);
484  tracker2 = &(*estracker);
485 
487  es.get < IdealMagneticFieldRecord > ().get(magfield);
488 
489  const MagneticField & magfield_(*magfield);
490  magfield2_ = &magfield_;
491 
493  es.get < TkStripCPERecord > ().get("SimpleStripCPE", stripcpe);
494 
495  // Mangano's
496 
497  edm::Handle < std::vector<Trajectory> > trajCollectionHandle;
498  e.getByToken(trajectoryInputToken_, trajCollectionHandle);
499 
500  edm::LogVerbatim("TrajectoryAnalyzer") << "trajColl->size(): " << trajCollectionHandle->size();
501 
502  for (vector < Trajectory >::const_iterator it = trajCollectionHandle->begin(); it != trajCollectionHandle->end(); it++) {
503 
504  edm::LogVerbatim("TrajectoryAnalyzer") << "this traj has " << it->foundHits() << " valid hits" << " , " << "isValid: " << it->isValid();
505 
506  vector < TrajectoryMeasurement > tmColl = it->measurements();
507  for (vector < TrajectoryMeasurement >::const_iterator itTraj = tmColl.begin(); itTraj != tmColl.end(); itTraj++) {
508  if (!itTraj->updatedState().isValid()) continue;
509 
510  rechitrphi.clear();
511  rechitstereo.clear();
512  rechitmatched.clear();
513 
514  //edm::LogVerbatim("TrajectoryAnalyzer") << "tm number: " <<
515  // (itTraj - tmColl.begin()) + 1<< " , " << "tm.backwardState.pt: " <<
516  // itTraj->backwardPredictedState().globalMomentum().perp() << " , " <<
517  // "tm.forwardState.pt: " << itTraj->forwardPredictedState().globalMomentum().perp() <<
518  // " , " << "tm.updatedState.pt: " << itTraj->updatedState().globalMomentum().perp() <<
519  // " , " << "tm.globalPos.perp: " << itTraj->updatedState().globalPosition().perp();
520 
521  if (itTraj->updatedState().globalMomentum().perp() < 0.5) continue;
522 
523  TrajectoryStateOnSurface tsos = itTraj->updatedState();
524 
525  DetId detid2 = itTraj->recHit()->geographicalId();
526 
527  const TransientTrackingRecHit::ConstRecHitPointer thit2 = itTraj->recHit();
528  const SiStripMatchedRecHit2D *matchedhit = dynamic_cast < const SiStripMatchedRecHit2D * >((*thit2).hit());
529  const SiStripRecHit2D *hit2d = dynamic_cast < const SiStripRecHit2D * >((*thit2).hit());
530  const SiStripRecHit1D *hit1d = dynamic_cast < const SiStripRecHit1D * >((*thit2).hit());
531  //if(matchedhit) cout<<"manganomatchedhit"<<endl;
532  //if(hit) cout<<"manganosimplehit"<<endl;
533  //if (hit && matchedhit) cout<<"manganosimpleandmatchedhit"<<endl;
534  const TrackingRecHit *thit = (*thit2).hit();
535 
536  detid = (thit)->geographicalId();
537  myid = ((thit)->geographicalId()).rawId();
538  //Here due to the fact that the SiStripHistoId::getSubdetid complains when
539  //a subdet of 1 or 2 appears we add an if statement.
540  if(detid.subdetId()==1 ||detid.subdetId()==2 ){
541  continue;
542  }
543  SiStripHistoId hidmanager;
544  std::string label = hidmanager.getSubdetid(myid,tTopo,true);
545  // std::cout<< "label " << label << " and id " << detid.subdetId() << std::endl;
546 
547  StripSubdetector StripSubdet = (StripSubdetector) detid;
548  //Variable to define the case we are dealing with
549  std::string matchedmonorstereo;
550 
551  isrechitmatched = 0;
552 
553  if (matchedhit) {
554 
555  isrechitmatched = 1;
556  const GluedGeomDet *gluedDet = (const GluedGeomDet *) tracker.idToDet(matchedhit->geographicalId());
557  //Analysis
558  matchedmonorstereo = "matched";
559  rechitanalysis_matched(tsos, thit2, gluedDet, associate, stripcpe, matchedmonorstereo );
560  // rechitmatched.push_back(rechitpro);
561 
562  }
563 
564  std::map<std::string, StereoAndMatchedMEs>::iterator iStereoAndMatchedME = StereoAndMatchedMEsMap.find(label);
565 
566  //Filling Histograms for Matched hits
567 
568  if (isrechitmatched) {
569 
570  if(iStereoAndMatchedME != StereoAndMatchedMEsMap.end()){
571  fillME(iStereoAndMatchedME->second.mePosxMatched,rechitpro.x);
572  fillME(iStereoAndMatchedME->second.mePosyMatched,rechitpro.y);
573  fillME(iStereoAndMatchedME->second.meResolxMatched,sqrt(rechitpro.resolxx));
574  fillME(iStereoAndMatchedME->second.meResolyMatched,sqrt(rechitpro.resolyy));
575  fillME(iStereoAndMatchedME->second.meResxMatched,rechitpro.resx);
576  fillME(iStereoAndMatchedME->second.meResyMatched,rechitpro.resy);
577  fillME(iStereoAndMatchedME->second.mePullxMatched,rechitpro.pullx);
578  fillME(iStereoAndMatchedME->second.mePullyMatched,rechitpro.pully);
579  }
580 
581  }
582 
583  //Reset Variables here for the current event
584  isrechitrphi = 0;
585  isrechitsas = 0;
586 
588  // simple hits from matched hits
590 
591  if (tsos.globalDirection().transverse() != 0) {
593  } else {
594  track_rapidity = -999.0;
595  }
596 
597  GluedGeomDet *gdet;
598  const SiStripRecHit2D *monohit;
599 
600  if (matchedhit) {
601  auto hm = matchedhit->monoHit();
602  monohit = &hm;
603  // const GeomDetUnit * monodet=gdet->monoDet();
604  gdet = (GluedGeomDet *) tracker2->idToDet(matchedhit->geographicalId());
605 
606  if (monohit) {
607 
608  isrechitrphi = 1;
609 
610  //Analysis
611  matchedmonorstereo = "monoHit";
612  rechitanalysis_matched(tsos, thit2, gdet, associate, stripcpe, matchedmonorstereo );
613 
614  }
615 
616  auto s = matchedhit->stereoHit();
617  const SiStripRecHit2D *stereohit = &s;
618 
619  if (stereohit) {
620 
621  isrechitsas = 1;
622 
623  //Analysis
624  matchedmonorstereo = "stereoHit";
625  rechitanalysis_matched(tsos, thit2, gdet, associate, stripcpe, matchedmonorstereo );
626  }
627  }
628 
629  if (hit1d) {
630  // simple hits are mono or stereo
631  // cout<<"simple hit"<<endl;
632  if (StripSubdet.stereo() == 0) {
633  isrechitrphi = 1;
634  // cout<<"simple hit mono"<<endl;
635 
636  const GeomDetUnit *det = tracker.idToDetUnit(detid2);
637  const StripGeomDetUnit *stripdet = (const StripGeomDetUnit *) (det);
638 
639  //Analysis for hit1d mono
640  rechitanalysis(tsos, thit2, stripdet, stripcpe, associate, true);
641 
642  }
643 
644  if (StripSubdet.stereo() == 1) {
645 
646  //cout<<"simple hit stereo"<<endl;
647  isrechitsas = 1;
648 
649  const GeomDetUnit *det = tracker.idToDetUnit(detid2);
650  const StripGeomDetUnit *stripdet = (const StripGeomDetUnit *) (det);
651 
652  //Analysis for hit1d stereo
653  rechitanalysis(tsos, thit2, stripdet, stripcpe, associate, true);
654 
655  }
656  }
657 
658 
659  if (hit2d) {
660  // simple hits are mono or stereo
661  // cout<<"simple hit"<<endl;
662  if (StripSubdet.stereo() == 0) {
663  isrechitrphi = 1;
664  // cout<<"simple hit mono"<<endl;
665 
666  const GeomDetUnit *det = tracker.idToDetUnit(detid2);
667  const StripGeomDetUnit *stripdet = (const StripGeomDetUnit *) (det);
668 
669  //Analysis for hit2d mono
670  rechitanalysis(tsos, thit2, stripdet, stripcpe, associate, false);
671 
672  }
673 
674  if (StripSubdet.stereo() == 1) {
675 
676  //cout<<"simple hit stereo"<<endl;
677  isrechitsas = 1;
678 
679  const GeomDetUnit *det = tracker.idToDetUnit(detid2);
680  const StripGeomDetUnit *stripdet = (const StripGeomDetUnit *) (det);
681 
682  //Analysis for hit2d stereo
683  rechitanalysis(tsos, thit2, stripdet, stripcpe, associate, false);
684 
685  }
686  }
687 
688  //Filling Histograms for simple hits
689  //cout<<"isrechitrphi,isrechitsas = "<<isrechitrphi<<","<<isrechitsas<<endl;
690 
691  std::map<std::string, LayerMEs>::iterator iLayerME = LayerMEsMap.find(label);
692 
693  if (isrechitrphi > 0 || isrechitsas > 0) {
694 
695 
696 
697  if (isrechitrphi > 0) {
698 
705 
708 
709  if (rechitpro.clusiz == 1) {
712  }
713  if (rechitpro.clusiz == 2) {
719  }
720  if (rechitpro.clusiz == 3) {
723  }
724  if (rechitpro.clusiz == 4) {
727  }
728 
729  if (rechitpro.category == 1) {
732  }
733  if (rechitpro.category == 2) {
735  }
736  if (rechitpro.category == 3) {
738  }
739  if (rechitpro.category == 4) {
741  }
742 
749 
750  }
751 
752  if (isrechitsas > 0) {
753 
760 
763 
764  if (rechitpro.clusiz == 1) {
767  }
768 
769  if (rechitpro.clusiz == 2) {
772  }
773  if (rechitpro.clusiz == 3) {
776  }
777  if (rechitpro.clusiz == 4) {
780  }
781  if (rechitpro.category == 1) {
784  }
785  if (rechitpro.category == 2) {
787  }
788  if (rechitpro.category == 3) {
790  }
791  if (rechitpro.category == 4) {
793  }
794 
801 
802  }
803 
804 
805 
806  if(iLayerME != LayerMEsMap.end()){
807 
808  if (isrechitrphi > 0) {
809 
810  fillME(iLayerME->second.meWclusRphi,rechitpro.clusiz);
811  fillME(iLayerME->second.meAdcRphi,rechitpro.cluchg);
812  fillME(iLayerME->second.meResolxLFRphi,sqrt(rechitpro.resolxx));
813  fillME(iLayerME->second.meResolxMFRphi,sqrt(rechitpro.resolxxMF));
814 
815  if( (min(rechitpro.clusiz, 4) - 1) == 1 ){fillME(iLayerME->second.meResolxMFRphiwclus1,sqrt(rechitpro.resolxxMF));}
816  if( (min(rechitpro.clusiz, 4) - 1) == 2 ){fillME(iLayerME->second.meResolxMFRphiwclus2,sqrt(rechitpro.resolxxMF));}
817  if( (min(rechitpro.clusiz, 4) - 1) == 3 ){fillME(iLayerME->second.meResolxMFRphiwclus3,sqrt(rechitpro.resolxxMF));}
818  if( (min(rechitpro.clusiz, 4) - 1) == 4 ){fillME(iLayerME->second.meResolxMFRphiwclus4,sqrt(rechitpro.resolxxMF));}
819 
820  fillME(iLayerME->second.meResLFRphi,rechitpro.resx);
821  fillME(iLayerME->second.meResMFRphi,rechitpro.resxMF);
822 
823  if( (min(rechitpro.clusiz, 4) - 1) == 1 ){fillME(iLayerME->second.merapidityResProfilewclus1,track_rapidity, fabs(rechitpro.resxMF));}
824  if( (min(rechitpro.clusiz, 4) - 1) == 2 ){fillME(iLayerME->second.merapidityResProfilewclus2,track_rapidity, fabs(rechitpro.resxMF));}
825  if( (min(rechitpro.clusiz, 4) - 1) == 3 ){fillME(iLayerME->second.merapidityResProfilewclus3,track_rapidity, fabs(rechitpro.resxMF));}
826  if( (min(rechitpro.clusiz, 4) - 1) == 4 ){fillME(iLayerME->second.merapidityResProfilewclus4,track_rapidity, fabs(rechitpro.resxMF));}
827 
828  if( (min(rechitpro.clusiz, 4) - 1) == 1 ){fillME(iLayerME->second.meResMFRphiwclus1,rechitpro.resxMF);}
829  if( (min(rechitpro.clusiz, 4) - 1) == 2 ){fillME(iLayerME->second.meResMFRphiwclus2,rechitpro.resxMF);}
830  if( (min(rechitpro.clusiz, 4) - 1) == 3 ){fillME(iLayerME->second.meResMFRphiwclus3,rechitpro.resxMF);}
831  if( (min(rechitpro.clusiz, 4) - 1) == 4 ){fillME(iLayerME->second.meResMFRphiwclus4,rechitpro.resxMF);}
832 
833  fillME(iLayerME->second.mePullLFRphi,rechitpro.pullx);
834  fillME(iLayerME->second.mePullMFRphi,rechitpro.pullxMF);
835 
836  if( (min(rechitpro.clusiz, 4) - 1) == 1 ){fillME(iLayerME->second.mePullMFRphiwclus1,rechitpro.pullxMF);}
837  if( (min(rechitpro.clusiz, 4) - 1) == 2 ){fillME(iLayerME->second.mePullMFRphiwclus2,rechitpro.pullxMF);}
838  if( (min(rechitpro.clusiz, 4) - 1) == 3 ){fillME(iLayerME->second.mePullMFRphiwclus3,rechitpro.pullxMF);}
839  if( (min(rechitpro.clusiz, 4) - 1) == 4 ){fillME(iLayerME->second.mePullMFRphiwclus4,rechitpro.pullxMF);}
840 
841 
842  fillME(iLayerME->second.meTrackangleRphi,rechitpro.trackangle);
843  fillME(iLayerME->second.mePullTrackangleProfileRphi,rechitpro.trackangle,fabs(rechitpro.pullxMF));
844 
845  if( (min(rechitpro.clusiz, 4) - 1) == 1 ){fillME(iLayerME->second.mePullTrackwidthProfileRphiwclus1,rechitpro.trackwidth, fabs(rechitpro.pullxMF));}
846  if( (min(rechitpro.clusiz, 4) - 1) == 2 ){fillME(iLayerME->second.mePullTrackwidthProfileRphiwclus2,rechitpro.trackwidth, fabs(rechitpro.pullxMF));}
847  if( (min(rechitpro.clusiz, 4) - 1) == 3 ){fillME(iLayerME->second.mePullTrackwidthProfileRphiwclus3,rechitpro.trackwidth, fabs(rechitpro.pullxMF));}
848  if( (min(rechitpro.clusiz, 4) - 1) == 4 ){fillME(iLayerME->second.mePullTrackwidthProfileRphiwclus4,rechitpro.trackwidth, fabs(rechitpro.pullxMF));}
849 
850 
851  if (rechitpro.clusiz == 1) {
852  fillME(iLayerME->second.meResolxMFTrackwidthProfileWclus1Rphi,rechitpro.trackwidth,sqrt(rechitpro.resolxxMF));
853  fillME(iLayerME->second.meResMFTrackwidthProfileWclus1Rphi,rechitpro.trackwidth,fabs(rechitpro.resxMF));
854  }
855  if (rechitpro.clusiz == 2) {
856  fillME(iLayerME->second.meResolxMFTrackwidthProfileWclus2Rphi,rechitpro.trackwidth,sqrt(rechitpro.resolxxMF));
857  fillME(iLayerME->second.meResMFTrackwidthProfileWclus2Rphi,rechitpro.trackwidth,fabs(rechitpro.resxMF));
858  }
859  if (rechitpro.clusiz == 3) {
860  fillME(iLayerME->second.meResolxMFTrackwidthProfileWclus3Rphi,rechitpro.trackwidth,sqrt(rechitpro.resolxxMF));
861  fillME(iLayerME->second.meResMFTrackwidthProfileWclus3Rphi,rechitpro.trackwidth,fabs(rechitpro.resxMF));
862  }
863  if (rechitpro.clusiz == 4) {
864  fillME(iLayerME->second.meResolxMFTrackwidthProfileWclus4Rphi,rechitpro.trackwidth,sqrt(rechitpro.resolxxMF));
865  fillME(iLayerME->second.meResMFTrackwidthProfileWclus4Rphi,rechitpro.trackwidth,fabs(rechitpro.resxMF));
866  }
867 
868 
869  if (rechitpro.category == 1) {
870  fillME(iLayerME->second.mePullTrackwidthProfileCategory1Rphi,rechitpro.trackwidth,fabs(rechitpro.pullxMF));
871  fillME(iLayerME->second.meResolxMFTrackwidthProfileCategory1Rphi,rechitpro.trackwidth,sqrt(rechitpro.resolxxMF));
872  fillME(iLayerME->second.meResolxMFClusterwidthProfileCategory1Rphi,rechitpro.clusiz,sqrt(rechitpro.resolxxMF));
873  }
874  if (rechitpro.category == 2) {
875  fillME(iLayerME->second.mePullTrackwidthProfileCategory2Rphi,rechitpro.trackwidth,fabs(rechitpro.pullxMF));
876  fillME(iLayerME->second.meResolxMFTrackwidthProfileCategory2Rphi,rechitpro.trackwidth,sqrt(rechitpro.resolxxMF));
877  }
878  if (rechitpro.category == 3) {
879  fillME(iLayerME->second.mePullTrackwidthProfileCategory3Rphi,rechitpro.trackwidth,fabs(rechitpro.pullxMF));
880  fillME(iLayerME->second.meResolxMFTrackwidthProfileCategory3Rphi,rechitpro.trackwidth,sqrt(rechitpro.resolxxMF));
881  }
882  if (rechitpro.category == 4) {
883  fillME(iLayerME->second.mePullTrackwidthProfileCategory4Rphi,rechitpro.trackwidth,fabs(rechitpro.pullxMF));
884  fillME(iLayerME->second.meResolxMFTrackwidthProfileCategory4Rphi,rechitpro.trackwidth,sqrt(rechitpro.resolxxMF));
885  }
886 
887  fillME(iLayerME->second.meTrackwidthRphi,rechitpro.trackwidth);
888  fillME(iLayerME->second.meExpectedwidthRphi,rechitpro.expectedwidth);
889  fillME(iLayerME->second.meClusterwidthRphi,rechitpro.clusiz);
890  fillME(iLayerME->second.meCategoryRphi,rechitpro.category);
891  fillME(iLayerME->second.meResolxMFTrackwidthProfileRphi,rechitpro.trackwidth,sqrt(rechitpro.resolxxMF));
892  fillME(iLayerME->second.meResolxMFAngleProfileRphi,rechitpro.trackangle,sqrt(rechitpro.resolxxMF));
893  }
894 
895  }
896 
897  if(iStereoAndMatchedME != StereoAndMatchedMEsMap.end()){
898 
899  if (isrechitsas > 0) {
900 
901  fillME(iStereoAndMatchedME->second.meWclusSas,rechitpro.clusiz);
902  fillME(iStereoAndMatchedME->second.meAdcSas,rechitpro.cluchg);
903  fillME(iStereoAndMatchedME->second.meResolxLFSas,sqrt(rechitpro.resolxx));
904  fillME(iStereoAndMatchedME->second.meResLFSas,rechitpro.resx);
905  fillME(iStereoAndMatchedME->second.mePullLFSas,rechitpro.pullx);
906  fillME(iStereoAndMatchedME->second.meResolxMFSas,sqrt(rechitpro.resolxxMF));
907  fillME(iStereoAndMatchedME->second.meResMFSas,rechitpro.resxMF);
908  fillME(iStereoAndMatchedME->second.mePullMFSas,rechitpro.pullxMF);
909  fillME(iStereoAndMatchedME->second.meTrackangleSas,rechitpro.trackangle);
910  fillME(iStereoAndMatchedME->second.mePullTrackangleProfileSas,rechitpro.trackangle, rechitpro.pullxMF);
911  fillME(iStereoAndMatchedME->second.mePullTrackwidthProfileSas,rechitpro.trackwidth, rechitpro.pullxMF);
912  if (rechitpro.category == 1) {
913  fillME(iStereoAndMatchedME->second.mePullTrackwidthProfileCategory1Sas,rechitpro.trackwidth,rechitpro.pullxMF);
914  fillME(iStereoAndMatchedME->second.meResolxMFTrackwidthProfileCategory1Sas,rechitpro.trackwidth,sqrt(rechitpro.resolxxMF));
915  fillME(iStereoAndMatchedME->second.meResolxMFClusterwidthProfileCategory1Sas,rechitpro.clusiz,sqrt(rechitpro.resolxxMF));
916  }
917  if (rechitpro.category == 2) {
918  fillME(iStereoAndMatchedME->second.mePullTrackwidthProfileCategory2Sas,rechitpro.trackwidth,rechitpro.pullxMF);
919  fillME(iStereoAndMatchedME->second.meResolxMFTrackwidthProfileCategory2Sas,rechitpro.trackwidth,sqrt(rechitpro.resolxxMF));
920  }
921  if (rechitpro.category == 3) {
922  fillME(iStereoAndMatchedME->second.mePullTrackwidthProfileCategory3Sas,rechitpro.trackwidth,rechitpro.pullxMF);
923  fillME(iStereoAndMatchedME->second.meResolxMFTrackwidthProfileCategory3Sas,rechitpro.trackwidth,sqrt(rechitpro.resolxxMF));
924  }
925  if (rechitpro.category == 4) {
926  fillME(iStereoAndMatchedME->second.mePullTrackwidthProfileCategory4Sas,rechitpro.trackwidth,rechitpro.pullxMF);
927  fillME(iStereoAndMatchedME->second.meResolxMFTrackwidthProfileCategory4Sas,rechitpro.trackwidth,sqrt(rechitpro.resolxxMF));
928  }
929  fillME(iStereoAndMatchedME->second.meTrackwidthSas,rechitpro.trackwidth);
930  fillME(iStereoAndMatchedME->second.meExpectedwidthSas,rechitpro.expectedwidth);
931  fillME(iStereoAndMatchedME->second.meClusterwidthSas,rechitpro.clusiz);
932  fillME(iStereoAndMatchedME->second.meCategorySas,rechitpro.category);
933  fillME(iStereoAndMatchedME->second.meResolxMFTrackwidthProfileSas,rechitpro.trackwidth,sqrt(rechitpro.resolxxMF));
934  fillME(iStereoAndMatchedME->second.meResolxMFAngleProfileSas,rechitpro.trackangle, rechitpro.resolxxMF);
935  }
936 
937  }
938 
939 
940  } //simplehits
941  //cout<<"DebugLine301"<<endl;
942 
943  }
944  //cout<<"DebugLine302"<<endl;
945 
946  }
947  //cout<<"DebugLine303"<<endl;
948 
949 }
950 
951 
952 
953 //needed by to do the residual for matched hits
954 std::pair < LocalPoint, LocalVector > SiStripTrackingRecHitsValid::projectHit(const PSimHit & hit,
955  const StripGeomDetUnit
956  * stripDet,
957  const BoundPlane &
958  plane)
959 {
960  // const StripGeomDetUnit* stripDet = dynamic_cast<const StripGeomDetUnit*>(hit.det());
961  //if (stripDet == 0) throw MeasurementDetException("HitMatcher hit is not on StripGeomDetUnit");
962 
963  const StripTopology & topol = stripDet->specificTopology();
964  GlobalPoint globalpos = stripDet->surface().toGlobal(hit.localPosition());
965  LocalPoint localHit = plane.toLocal(globalpos);
966  //track direction
967  LocalVector locdir = hit.localDirection();
968  //rotate track in new frame
969 
970  GlobalVector globaldir = stripDet->surface().toGlobal(locdir);
971  LocalVector dir = plane.toLocal(globaldir);
972  float scale = -localHit.z() / dir.z();
973 
974  LocalPoint projectedPos = localHit + scale * dir;
975 
976  // std::cout << "projectedPos " << projectedPos << std::endl;
977 
978  float selfAngle = topol.stripAngle(topol.strip(hit.localPosition()));
979 
980  LocalVector stripDir(sin(selfAngle), cos(selfAngle), 0); // vector along strip in hit frame
981 
982  LocalVector localStripDir(plane.toLocal(stripDet->surface().toGlobal(stripDir)));
983 
984  return std::pair < LocalPoint, LocalVector > (projectedPos, localStripDir);
985 }
986 //--------------------------------------------------------------------------------------------
988 
989  rechitpro.x = -999999.; rechitpro.y = -999999.; rechitpro.z = -999999.; rechitpro.resolxx = -999999.; rechitpro.resolxy = -999999.; rechitpro.resolyy = -999999.;
990  rechitpro.resolxxMF = -999999.; rechitpro.phi = -999999.;rechitpro.resx = -999999.; rechitpro.resy = -999999.; rechitpro.resxMF = -999999.;
991  rechitpro.pullx = -999999.; rechitpro.pully = -999999.; rechitpro.pullxMF = -999999.; rechitpro.trackangle = -999999.; rechitpro.trackanglebeta = -999999.;
992  rechitpro.trackangle2 = -999999.; rechitpro.trackwidth = -999999.; rechitpro.expectedwidth = -999999.; rechitpro.category = -999999.; rechitpro.thickness = -999999.;
993  rechitpro.clusiz = -999999.; rechitpro.cluchg = -999999.;
994 
995  const GeomDetUnit *monodet = gluedDet->monoDet();
996  const GeomDetUnit *stereodet = gluedDet->stereoDet();
997  //We initialized it to monoHit case because it complains that it may be uninitialized
998  //and it will change value in the stereoHit case. The matched case do not use this
999  const StripGeomDetUnit *stripdet = (const StripGeomDetUnit *) (monodet) ;
1000 
1001  const SiStripMatchedRecHit2D *matchedhit = dynamic_cast < const SiStripMatchedRecHit2D * >((*thit).hit());
1002  const SiStripRecHit2D *monohit;
1003  const SiStripRecHit2D *stereohit;
1004 
1005  if (matchedmonorstereo == "monoHit"){
1006  auto hm = matchedhit->monoHit();
1007  monohit = &hm;
1008  stripdet = (const StripGeomDetUnit *) (monodet);
1009  }
1010  if (matchedmonorstereo == "stereoHit"){
1011  auto s = matchedhit->stereoHit();
1012  stereohit = &s;
1013  stripdet = (const StripGeomDetUnit *) (stereodet);
1014  }
1015  //if(matchedhit) cout<<"manganomatchedhit"<<endl;
1016  //if(hit) cout<<"manganosimplehit"<<endl;
1017  //if (hit && matchedhit) cout<<"manganosimpleandmatchedhit"<<endl;
1018  const StripTopology & topol = (const StripTopology &) stripdet->topology();
1019  const TrackingRecHit *rechit = (*thit).hit();
1020 
1022  LocalError error;
1023  MeasurementPoint Mposition;
1024  MeasurementError Merror;
1025 
1026  if (matchedmonorstereo == "matched"){
1027  position=rechit->localPosition();
1028  error=rechit->localPositionError();
1029  }
1030  if(matchedmonorstereo == "monoHit"){
1031  position = monohit->localPosition();
1032  error = monohit->localPositionError();
1033  Mposition = topol.measurementPosition(position);
1034  Merror = topol.measurementError(position, error);
1035  }
1036  if (matchedmonorstereo == "stereoHit"){
1037  position = stereohit->localPosition();
1038  error = stereohit->localPositionError();
1039  Mposition = topol.measurementPosition(position);
1040  Merror = topol.measurementError(position, error);
1041  }
1042 
1043  LocalVector trackdirection = tsos.localDirection();
1044 
1045  GlobalVector gtrkdir = gluedDet->toGlobal(trackdirection);
1046  LocalVector monotkdir = monodet->toLocal(gtrkdir);
1047  LocalVector stereotkdir = stereodet->toLocal(gtrkdir);
1048 
1049  if(matchedmonorstereo == "monoHit"){
1050  if (monotkdir.z() != 0) {
1051  rechitpro.trackangle = atan(monotkdir.x() / monotkdir.z()) * TMath::RadToDeg();
1052  rechitpro.trackanglebeta = atan(monotkdir.y() / monotkdir.z()) * TMath::RadToDeg();
1053  }
1054  }
1055  if (matchedmonorstereo == "stereoHit"){
1056  if (stereotkdir.z() != 0) {
1057  rechitpro.trackangle = atan(stereotkdir.x() / stereotkdir.z()) * TMath::RadToDeg();
1058  rechitpro.trackanglebeta = atan(stereotkdir.y() / stereotkdir.z()) * TMath::RadToDeg();
1059  }
1060  }
1061 
1062  LocalVector drift = stripcpe->driftDirection(stripdet);
1063  rechitpro.thickness = stripdet->surface().bounds().thickness();
1064  float pitch = topol.localPitch(position);
1065  float tanalpha = tan(rechitpro.trackangle * TMath::DegToRad());
1066  float tanalphaL = drift.x() / drift.z();
1067  rechitpro.trackwidth = fabs((rechitpro.thickness / pitch) * tanalpha - (rechitpro.thickness / pitch) * tanalphaL);
1068  float SLorentz = 0.5 * (rechitpro.thickness / pitch) * tanalphaL;
1069  int Sp = int (position.x() / pitch + SLorentz + 0.5 * rechitpro.trackwidth);
1070  int Sm = int (position.x() / pitch + SLorentz - 0.5 * rechitpro.trackwidth);
1071  rechitpro.expectedwidth = 1 + Sp - Sm;
1072 
1074  if(matchedmonorstereo == "monoHit"){clust = monohit->cluster();}
1075  if(matchedmonorstereo == "stereoHit"){clust = stereohit->cluster();}
1076 
1077  int clusiz=0;
1078  int totcharge=0;
1079  clusiz = clust->amplitudes().size();
1080  const auto & amplitudes=clust->amplitudes();
1081  for(size_t ia=0; ia<amplitudes.size();ia++){
1082  totcharge+=amplitudes[ia];
1083  }
1084 
1085  rechitpro.x = position.x();
1086  rechitpro.y = position.y();
1087  rechitpro.z = position.z();
1088  rechitpro.resolxx = error.xx();
1089  rechitpro.resolxy = error.xy();
1090  rechitpro.resolyy = error.yy();
1091  rechitpro.resolxxMF = Merror.uu();
1092  rechitpro.clusiz = clusiz;
1093  rechitpro.cluchg = totcharge;
1094 
1095  unsigned int iopt;
1097  iopt = 1;
1098  } else if (rechitpro.expectedwidth == 1) {
1099  iopt = 2;
1100  } else if (rechitpro.clusiz <= rechitpro.expectedwidth) {
1101  iopt = 3;
1102  } else {
1103  iopt = 4;
1104  }
1105  rechitpro.category = iopt;
1106 
1107  if(matchedmonorstereo == "matched"){matched.clear();matched = associate.associateHit(*matchedhit);}
1108  if(matchedmonorstereo == "monoHit"){matched.clear();matched = associate.associateHit(*monohit);}
1109  if(matchedmonorstereo == "stereoHit"){matched.clear();matched = associate.associateHit(*stereohit);}
1110 
1111  double mindist = 999999;
1112  double dist = 999999;
1113  double distx = 999999;
1114  double disty = 999999;
1115  std::pair<LocalPoint,LocalVector> closestPair;
1116  PSimHit closest;
1117 
1118  if(!matched.empty()){
1119 
1120  const StripGeomDetUnit* partnerstripdet =(StripGeomDetUnit*) gluedDet->stereoDet();
1121  std::pair<LocalPoint,LocalVector> hitPair;
1122 
1123  for(vector<PSimHit>::const_iterator m=matched.begin(); m<matched.end(); m++){
1124  //project simhit;
1125  if(matchedmonorstereo == "matched"){
1126  hitPair= projectHit((*m),partnerstripdet,gluedDet->surface());
1127  distx = fabs(rechitpro.x - hitPair.first.x());
1128  disty = fabs(rechitpro.y - hitPair.first.y());
1129  dist = sqrt(distx*distx+disty*disty);
1130  }
1131  if(matchedmonorstereo == "monoHit"){dist = abs((monohit)->localPosition().x() - (*m).localPosition().x());}
1132  if(matchedmonorstereo == "stereoHit"){dist = abs((stereohit)->localPosition().x() - (*m).localPosition().x());}
1133 
1134  // std::cout << " Simhit position x = " << hitPair.first.x()
1135  // << " y = " << hitPair.first.y() << " dist = " << dist << std::endl;
1136  if(dist<mindist){
1137  mindist = dist;
1138  closestPair = hitPair;
1139  closest = (*m);
1140  }
1141  }
1142 
1143  if(matchedmonorstereo == "matched"){
1144  rechitpro.resx = rechitpro.x - closestPair.first.x();
1145  rechitpro.resy = rechitpro.y - closestPair.first.y();
1146  rechitpro.pullx = ((rechit)->localPosition().x() - (closestPair.first.x())) / sqrt(error.xx());
1147  rechitpro.pully = ((rechit)->localPosition().y() - (closestPair.first.y())) / sqrt(error.yy());
1148  }
1149 
1150  if( (matchedmonorstereo == "monoHit") || (matchedmonorstereo == "stereoHit") ){
1151  rechitpro.resx = rechitpro.x - closest.localPosition().x();
1152  rechitpro.resxMF = Mposition.x() - (topol.measurementPosition(closest.localPosition())).x();
1153  rechitpro.pullx = (rechit->localPosition().x() - (closest).localPosition().x()) / sqrt(error.xx());
1154  rechitpro.pullxMF = (rechitpro.resxMF)/sqrt(Merror.uu());
1155  }
1156 
1157  }
1158 }
1159 //--------------------------------------------------------------------------------------------
1161 
1162  rechitpro.x = -999999.; rechitpro.y = -999999.; rechitpro.z = -999999.; rechitpro.resolxx = -999999.; rechitpro.resolxy = -999999.; rechitpro.resolyy = -999999.;
1163  rechitpro.resolxxMF = -999999.; rechitpro.phi = -999999.;rechitpro.resx = -999999.; rechitpro.resy = -999999.; rechitpro.resxMF = -999999.;
1164  rechitpro.pullx = -999999.; rechitpro.pully = -999999.; rechitpro.pullxMF = -999999.; rechitpro.trackangle = -999999.; rechitpro.trackanglebeta = -999999.;
1165  rechitpro.trackangle2 = -999999.; rechitpro.trackwidth = -999999.; rechitpro.expectedwidth = -999999.; rechitpro.category = -999999.; rechitpro.thickness = -999999.;
1166  rechitpro.clusiz = -999999.; rechitpro.cluchg = -999999.;
1167 
1168  //If simplehit1or2D is true we are dealing with hit1d, false is for hit2d
1169  const SiStripRecHit2D *hit2d = dynamic_cast < const SiStripRecHit2D * >((*thit).hit());;
1170  const SiStripRecHit1D *hit1d = dynamic_cast < const SiStripRecHit1D * >((*thit).hit());;
1171 
1172  const StripTopology & topol = (const StripTopology &) stripdet->topology();
1173  const TrackingRecHit *rechit = (*thit).hit();
1174 
1175  LocalPoint position = rechit->localPosition();
1176  LocalError error = rechit->localPositionError();
1177  MeasurementPoint Mposition = topol.measurementPosition(position);
1178  MeasurementError Merror = topol.measurementError(position,error);
1179 
1180  LocalVector trackdirection = tsos.localDirection();
1181  rechitpro.trackangle = atan(trackdirection.x() / trackdirection.z()) * TMath::RadToDeg();
1182  rechitpro.trackanglebeta = atan(trackdirection.y() / trackdirection.z()) * TMath::RadToDeg();
1183 
1184  LocalVector drift = stripcpe->driftDirection(stripdet);
1185  rechitpro.thickness = stripdet->surface().bounds().thickness();
1186  float pitch = topol.localPitch(position);
1187  float tanalpha = tan(rechitpro.trackangle * TMath::DegToRad());
1188  float tanalphaL = drift.x() / drift.z();
1189  rechitpro.trackwidth = fabs((rechitpro.thickness / pitch) * tanalpha - (rechitpro.thickness / pitch) * tanalphaL);
1190  float SLorentz = 0.5 * (rechitpro.thickness / pitch) * tanalphaL;
1191  int Sp = int (position.x() / pitch + SLorentz + 0.5 * rechitpro.trackwidth);
1192  int Sm = int (position.x() / pitch + SLorentz - 0.5 * rechitpro.trackwidth);
1193  rechitpro.expectedwidth = 1 + Sp - Sm;
1194 
1197  int clusiz=0;
1198  int totcharge=0;
1199 
1200  if(!simplehit1or2D){
1201  clust2d = hit2d->cluster();
1202  clusiz = clust2d->amplitudes().size();
1203  const auto & amplitudes2d = clust2d->amplitudes();
1204  for(size_t ia=0; ia<amplitudes2d.size();ia++){
1205  totcharge+=amplitudes2d[ia];
1206  }
1207  } else {
1208  clust1d = hit1d->cluster();
1209  clusiz = clust1d->amplitudes().size();
1210  const auto & amplitudes1d = clust1d->amplitudes();
1211  for(size_t ia=0; ia<amplitudes1d.size();ia++){
1212  totcharge+=amplitudes1d[ia];
1213  }
1214  }
1215 
1216  rechitpro.x = position.x();
1217  rechitpro.y = position.y();
1218  rechitpro.z = position.z();
1219  rechitpro.resolxx = error.xx();
1220  rechitpro.resolxy = error.xy();
1221  rechitpro.resolyy = error.yy();
1222  rechitpro.resolxxMF = Merror.uu();
1223  rechitpro.clusiz = clusiz;
1224  rechitpro.cluchg = totcharge;
1225 
1226  unsigned int iopt;
1228  iopt = 1;
1229  } else if (rechitpro.expectedwidth == 1) {
1230  iopt = 2;
1231  } else if (rechitpro.clusiz <= rechitpro.expectedwidth) {
1232  iopt = 3;
1233  } else {
1234  iopt = 4;
1235  }
1236  rechitpro.category = iopt;
1237 
1238 
1239  matched.clear();
1240  if(!simplehit1or2D){
1241  matched = associate.associateHit(*hit2d);
1242  } else {
1243  matched = associate.associateHit(*hit1d);
1244  }
1245 
1246  double mindist = 999999;
1247  double dist = 999999;
1248  PSimHit closest;
1249 
1250  if(!matched.empty()){
1251 
1252  for(vector<PSimHit>::const_iterator m=matched.begin(); m<matched.end(); m++){
1253  if(!simplehit1or2D){
1254  dist = abs((hit2d)->localPosition().x() - (*m).localPosition().x());
1255  } else {
1256  dist = abs((hit1d)->localPosition().x() - (*m).localPosition().x());
1257  }
1258 
1259  if(dist<mindist){
1260  mindist = dist;
1261  closest = (*m);
1262  }
1263  }
1264  rechitpro.resx = rechitpro.x - closest.localPosition().x();
1265  rechitpro.resxMF = Mposition.x() - (topol.measurementPosition(closest.localPosition())).x();
1266  rechitpro.pullx = (rechit->localPosition().x() - (closest).localPosition().x()) / sqrt(error.xx());
1267  rechitpro.pullxMF = (rechitpro.resxMF)/sqrt(Merror.uu());
1268 
1269  }
1270 
1271 }
1272 //--------------------------------------------------------------------------------------------
1274 
1275  //Retrieve tracker topology from geometry
1276  edm::ESHandle<TrackerTopology> tTopoHandle;
1277  es.get<IdealGeometryRecord>().get(tTopoHandle);
1278  const TrackerTopology* const tTopo = tTopoHandle.product();
1279 
1280  // take from eventSetup the SiStripDetCabling object - here will use SiStripDetControl later on
1282 
1283  // get list of active detectors from SiStripDetCabling
1284  std::vector<uint32_t> activeDets;
1285  SiStripDetCabling_->addActiveDetectorsRawIds(activeDets);
1286 
1287  SiStripSubStructure substructure;
1288 
1289  SiStripFolderOrganizer folder_organizer;
1290  // folder_organizer.setSiStripFolderName(topFolderName_);
1291  std::string curfold = topFolderName_;
1292  folder_organizer.setSiStripFolderName(curfold);
1293  folder_organizer.setSiStripFolder();
1294 
1295  // std::cout << "curfold " << curfold << std::endl;
1296 
1297  createSimpleHitsMEs(ibooker);
1298 
1299  // loop over detectors and book MEs
1300  edm::LogInfo("SiStripTrackingRecHitsValid|SiStripTrackingRecHitsValid")<<"nr. of activeDets: "<<activeDets.size();
1301  for(std::vector<uint32_t>::iterator detid_iterator = activeDets.begin(); detid_iterator!=activeDets.end(); detid_iterator++){
1302  uint32_t detid = (*detid_iterator);
1303  // remove any eventual zero elements - there should be none, but just in case
1304  if(detid == 0) {
1305  activeDets.erase(detid_iterator);
1306  continue;
1307  }
1308 
1309  // Create Layer Level MEs
1310  std::pair<std::string,int32_t> det_layer_pair = folder_organizer.GetSubDetAndLayer(detid,tTopo,true);
1311  SiStripHistoId hidmanager;
1312  std::string label = hidmanager.getSubdetid(detid,tTopo,true);
1313  // std::cout << "label " << label << endl;
1314 
1315  std::map<std::string, LayerMEs>::iterator iLayerME = LayerMEsMap.find(label);
1316  if(iLayerME==LayerMEsMap.end()) {
1317 
1318  // get detids for the layer
1319  // Keep in mind that when we are on the TID or TEC we deal with rings not wheel
1320  int32_t lnumber = det_layer_pair.second;
1321  std::vector<uint32_t> layerDetIds;
1322  if (det_layer_pair.first == "TIB") {
1323  substructure.getTIBDetectors(activeDets,layerDetIds,lnumber,0,0,0);
1324  } else if (det_layer_pair.first == "TOB") {
1325  substructure.getTOBDetectors(activeDets,layerDetIds,lnumber,0,0);
1326  } else if (det_layer_pair.first == "TID" && lnumber > 0) {
1327  substructure.getTIDDetectors(activeDets,layerDetIds,2,0,abs(lnumber),0);
1328  } else if (det_layer_pair.first == "TID" && lnumber < 0) {
1329  substructure.getTIDDetectors(activeDets,layerDetIds,1,0,abs(lnumber),0);
1330  } else if (det_layer_pair.first == "TEC" && lnumber > 0) {
1331  substructure.getTECDetectors(activeDets,layerDetIds,2,0,0,0,abs(lnumber),0);
1332  } else if (det_layer_pair.first == "TEC" && lnumber < 0) {
1333  substructure.getTECDetectors(activeDets,layerDetIds,1,0,0,0,abs(lnumber),0);
1334  }
1335  LayerDetMap[label] = layerDetIds;
1336 
1337  // book Layer MEs
1338  folder_organizer.setLayerFolder(detid,tTopo,det_layer_pair.second,true);
1339  // std::stringstream ss;
1340  // folder_organizer.getLayerFolderName(ss, detid, tTopo, true);
1341  // std::cout << "Folder Name " << ss.str().c_str() << std::endl;
1342  // folder_organizer.setLayerFolder(detid,det_layer_pair.second,true);
1343  createLayerMEs(ibooker,label);
1344  }
1345  //Create StereoAndMatchedMEs
1346  std::map<std::string, StereoAndMatchedMEs>::iterator iStereoAndMatchedME = StereoAndMatchedMEsMap.find(label);
1347  if(iStereoAndMatchedME==StereoAndMatchedMEsMap.end()) {
1348 
1349  // get detids for the stereo and matched layer. We are going to need a bool for these layers
1350  bool isStereo = false;
1351  // Keep in mind that when we are on the TID or TEC we deal with rings not wheel
1352  int32_t stereolnumber = det_layer_pair.second;
1353  std::vector<uint32_t> stereoandmatchedDetIds;
1354  if ( (det_layer_pair.first == "TIB") && (tTopo->tibIsStereo(detid)== 1) ) {
1355  substructure.getTIBDetectors(activeDets,stereoandmatchedDetIds,stereolnumber,0,0,0);
1356  isStereo = true;
1357  } else if ( (det_layer_pair.first == "TOB") && (tTopo->tobIsStereo(detid)== 1) ) {
1358  substructure.getTOBDetectors(activeDets,stereoandmatchedDetIds,stereolnumber,0,0);
1359  isStereo = true;
1360  } else if ( (det_layer_pair.first == "TID") && (stereolnumber > 0) && (tTopo->tidIsStereo(detid)== 1) ) {
1361  substructure.getTIDDetectors(activeDets,stereoandmatchedDetIds,2,0,abs(stereolnumber),1);
1362  isStereo = true;
1363  } else if ( (det_layer_pair.first == "TID") && (stereolnumber < 0) && (tTopo->tidIsStereo(detid)== 1) ) {
1364  substructure.getTIDDetectors(activeDets,stereoandmatchedDetIds,1,0,abs(stereolnumber),1);
1365  isStereo = true;
1366  } else if ( (det_layer_pair.first == "TEC") && (stereolnumber > 0) && (tTopo->tecIsStereo(detid)== 1) ) {
1367  substructure.getTECDetectors(activeDets,stereoandmatchedDetIds,2,0,0,0,abs(stereolnumber),1);
1368  isStereo = true;
1369  } else if ( (det_layer_pair.first == "TEC") && (stereolnumber < 0) && (tTopo->tecIsStereo(detid)== 1) ) {
1370  substructure.getTECDetectors(activeDets,stereoandmatchedDetIds,1,0,0,0,abs(stereolnumber),1);
1371  isStereo = true;
1372  }
1373  StereoAndMatchedDetMap[label] = stereoandmatchedDetIds;
1374 
1375  // book StereoAndMatched MEs
1376  if(isStereo){
1377  folder_organizer.setLayerFolder(detid,tTopo,det_layer_pair.second,true);
1378  // std::stringstream ss1;
1379  // folder_organizer.getLayerFolderName(ss1, detid, tTopo, true);
1380  // std::cout << "Folder Name stereo " << ss1.str().c_str() << std::endl;
1381  //Create the Monitor Elements only when we have a stereo module
1382  createStereoAndMatchedMEs(ibooker,label);
1383  }
1384  }
1385 
1386 
1387  }//end of loop over detectors
1388 }
1389 //------------------------------------------------------------------------------------------
1391 {
1404 
1409 
1419  simplehitsMEs.meResLF = 0;
1420  simplehitsMEs.mePullLF = 0;
1422  simplehitsMEs.meResMF = 0;
1423  simplehitsMEs.mePullMF = 0;
1424 
1425 
1426  if(layerswitchResolx_LF) {
1427  simplehitsMEs.meResolxLF = bookME1D(ibooker,"TH1Resolx_LF", "TH1Resolx_LF" ,"RecHit resol(x) coord. (local frame)");
1428  simplehitsMEs.meResolxLF->setAxisTitle("resol(x) RecHit coord. (local frame)");
1429  }
1430  if(layerswitchResolx_MF) {
1431  simplehitsMEs.meResolxMF = bookME1D(ibooker,"TH1Resolx_MF", "TH1Resolx_MF" ,"RecHit resol(x) coord. (measurement frame)");
1432  simplehitsMEs.meResolxMF->setAxisTitle("resol(x) RecHit coord. (measurement frame)");
1433  }
1434  if(layerswitchRes_LF) {
1435  simplehitsMEs.meResLF = bookME1D(ibooker,"TH1Res_LF", "TH1Res_LF" ,"Residual of the hit x coordinate (local frame)");
1436  simplehitsMEs.meResLF->setAxisTitle("Hit Res(x) (local frame)");
1437  }
1438  if(layerswitchRes_MF) {
1439  simplehitsMEs.meResMF = bookME1D(ibooker,"TH1Res_MF", "TH1Res_MF" ,"Residual of the hit x coordinate (measurement frame)");
1440  simplehitsMEs.meResMF->setAxisTitle("Hit Res(x) (measurement frame)");
1441  }
1442  if(layerswitchPull_LF) {
1443  simplehitsMEs.mePullLF = bookME1D(ibooker,"TH1Pull_LF", "TH1Pull_LF" ,"Pull distribution (local frame)");
1444  simplehitsMEs.mePullLF->setAxisTitle("Pull distribution (local frame)");
1445  }
1446  if(layerswitchPull_MF) {
1447  simplehitsMEs.mePullMF = bookME1D(ibooker,"TH1Pull_MF", "TH1Pull_MF" ,"Pull distribution (measurement frame)");
1448  simplehitsMEs.mePullMF->setAxisTitle("Pull distribution (measurement frame)");
1449  }
1450  if(layerswitchCategory) {
1451  simplehitsMEs.meCategory = bookME1D(ibooker,"TH1Category", "TH1Category" ,"Category");
1452  simplehitsMEs.meCategory->setAxisTitle("Category");
1453  }
1454  if(layerswitchTrackwidth) {
1455  simplehitsMEs.meTrackwidth = bookME1D(ibooker,"TH1Trackwidth", "TH1Trackwidth" ,"Track width");
1456  simplehitsMEs.meTrackwidth->setAxisTitle("Track width");
1457  }
1459  simplehitsMEs.meExpectedwidth = bookME1D(ibooker,"TH1Expectedwidth", "TH1Expectedwidth" ,"Expected width");
1460  simplehitsMEs.meExpectedwidth->setAxisTitle("Expected width");
1461  }
1463  simplehitsMEs.meClusterwidth = bookME1D(ibooker,"TH1Clusterwidth", "TH1Clusterwidth" ,"Cluster width");
1464  simplehitsMEs.meClusterwidth->setAxisTitle("Cluster width");
1465  }
1467  simplehitsMEs.meTrackanglealpha = bookME1D(ibooker,"TH1Trackanglealpha", "TH1Trackanglealpha" ,"Track angle alpha");
1468  simplehitsMEs.meTrackanglealpha->setAxisTitle("Track angle alpha");
1469  }
1471  simplehitsMEs.meTrackanglebeta = bookME1D(ibooker,"TH1Trackanglebeta", "TH1Trackanglebeta" ,"Track angle beta");
1472  simplehitsMEs.meTrackanglebeta->setAxisTitle("Track angle beta");
1473  }
1475  simplehitsMEs.meResolxMFTrackwidthProfileWClus1 = bookMEProfile(ibooker,"TProfResolxMFTrackwidthProfile_WClus1","TProfResolxMFTrackwidthProfile_WClus1","Profile of Resolution in MF vs track width for w=1");
1477  simplehitsMEs.meResolxMFTrackwidthProfileWClus1->setAxisTitle("Resolution (measurement frame) w=1",2);
1478  }
1480  simplehitsMEs.meResolxMFTrackwidthProfileWClus2 = bookMEProfile(ibooker,"TProfResolxMFTrackwidthProfile_WClus2","TProfResolxMFTrackwidthProfile_WClus2","Profile of Resolution in MF vs track width for w=2");
1482  simplehitsMEs.meResolxMFTrackwidthProfileWClus2->setAxisTitle("Resolution (measurement frame) w=2",2);
1483 
1484  }
1486  simplehitsMEs.meResolxMFTrackwidthProfileWClus3 = bookMEProfile(ibooker,"TProfResolxMFTrackwidthProfile_WClus3","TProfResolxMFTrackwidthProfile_WClus3","Profile of Resolution in MF vs track width for w=3");
1488  simplehitsMEs.meResolxMFTrackwidthProfileWClus3->setAxisTitle("Resolution (measurement frame) w=3",2);
1489  }
1491  simplehitsMEs.meResolxMFTrackwidthProfileWClus4 = bookMEProfile(ibooker,"TProfResolxMFTrackwidthProfile_WClus4","TProfResolxMFTrackwidthProfile_WClus4","Profile of Resolution in MF vs track width for w=4");
1493  simplehitsMEs.meResolxMFTrackwidthProfileWClus4->setAxisTitle("Resolution (measurement frame) w=3",2);
1494  }
1496  simplehitsMEs.meResMFTrackwidthProfileWClus1 = bookMEProfile(ibooker,"TProfResMFTrackwidthProfile_WClus1","TProfResMFTrackwidthProfile_WClus1","Profile of Residuals(x) in MF vs track width for w=1");
1498  simplehitsMEs.meResMFTrackwidthProfileWClus1->setAxisTitle("Residuals(x) (measurement frame) w=1",2);
1499  }
1501  simplehitsMEs.meResMFTrackwidthProfileWClus2 = bookMEProfile(ibooker,"TProfResMFTrackwidthProfile_WClus2","TProfResMFTrackwidthProfile_WClus2","Profile of Residuals(x) in MF vs track width for w=2");
1503  simplehitsMEs.meResMFTrackwidthProfileWClus2->setAxisTitle("Residuals(x) (measurement frame) w=2",2);
1504  }
1506  simplehitsMEs.meResMFTrackwidthProfileWClus21 = bookMEProfile(ibooker,"TProfResMFTrackwidthProfile_WClus21","TProfResMFTrackwidthProfile_WClus21","Profile of Residuals(x) in MF vs track width for w=2");
1508  simplehitsMEs.meResMFTrackwidthProfileWClus21->setAxisTitle("Residuals(x) (measurement frame) w=2",2);
1509  }
1511  simplehitsMEs.meResMFTrackwidthProfileWClus22 = bookMEProfile(ibooker,"TProfResMFTrackwidthProfile_WClus22","TProfResMFTrackwidthProfile_WClus22","Profile of Residuals(x) in MF vs track width for w=2");
1513  simplehitsMEs.meResMFTrackwidthProfileWClus22->setAxisTitle("Residuals(x) (measurement frame) w=2",2);
1514 
1515  }
1517  simplehitsMEs.meResMFTrackwidthProfileWClus23 = bookMEProfile(ibooker,"TProfResMFTrackwidthProfile_WClus23","TProfResMFTrackwidthProfile_WClus23","Profile of Residuals(x) in MF vs track width for w=2");
1519  simplehitsMEs.meResMFTrackwidthProfileWClus23->setAxisTitle("Residuals(x) (measurement frame) w=2",2);
1520  }
1522  simplehitsMEs.meResMFTrackwidthProfileWClus3 = bookMEProfile(ibooker,"TProfResMFTrackwidthProfile_WClus3","TProfResMFTrackwidthProfile_WClus3","Profile of Residuals(x) in MF vs track width for w=3");
1524  simplehitsMEs.meResMFTrackwidthProfileWClus3->setAxisTitle("Residuals(x) (measurement frame) w=3",2);
1525  }
1527  simplehitsMEs.meResMFTrackwidthProfileWClus4 = bookMEProfile(ibooker,"TProfResMFTrackwidthProfile_WClus4","TProfResMFTrackwidthProfile_WClus4","Profile of Residuals(x) in MF vs track width for w=4");
1529  simplehitsMEs.meResMFTrackwidthProfileWClus4->setAxisTitle("Residuals(x) (measurement frame) w=4",2);
1530  }
1532  simplehitsMEs.meResolxMFTrackwidthProfile = bookMEProfile(ibooker,"TProfResolxMFTrackwidthProfile","TProfResolxMFTrackwidthProfile","Profile of Resolution in MF vs track width");
1534  simplehitsMEs.meResolxMFTrackwidthProfile->setAxisTitle("Resolution (measurement frame)",2);
1535  }
1537  simplehitsMEs.meResolxMFTrackwidthProfileCategory1 = bookMEProfile(ibooker,"TProfResolxMFTrackwidthProfile_Category1","TProfResolxMFTrackwidthProfile_Category1","Profile of Resolution in MF vs track width (Category 1)");
1539  simplehitsMEs.meResolxMFTrackwidthProfileCategory1->setAxisTitle("Resolution (measurement frame) Category 1",2);
1540  }
1542  simplehitsMEs.meResolxMFTrackwidthProfileCategory2 = bookMEProfile(ibooker,"TProfResolxMFTrackwidthProfile_Category2","TProfResolxMFTrackwidthProfile_Category2","Profile of Resolution in MF vs track width (Category 2)");
1544  simplehitsMEs.meResolxMFTrackwidthProfileCategory2->setAxisTitle("Resolution (measurement frame) Category 2",2);
1545  }
1547  simplehitsMEs.meResolxMFTrackwidthProfileCategory3 = bookMEProfile(ibooker,"TProfResolxMFTrackwidthProfile_Category3","TProfResolxMFTrackwidthProfile_Category3","Profile of Resolution in MF vs track width (Category 3)");
1549  simplehitsMEs.meResolxMFTrackwidthProfileCategory3->setAxisTitle("Resolution (measurement frame) Category 3",2);
1550  }
1552  simplehitsMEs.meResolxMFTrackwidthProfileCategory4 = bookMEProfile(ibooker,"TProfResolxMFTrackwidthProfile_Category4","TProfResolxMFTrackwidthProfile_Category4","Profile of Resolution in MF vs track width (Category 4)");
1554  simplehitsMEs.meResolxMFTrackwidthProfileCategory4->setAxisTitle("Resolution (measurement frame) Category 4",2);
1555  }
1557  simplehitsMEs.meResolxMFClusterwidthProfileCategory1 = bookMEProfile(ibooker,"TProfResolxMFClusterwidthProfile_Category1","TProfResolxMFClusterwidthProfile_Category1","Profile of Resolution in MF vs cluster width (Category 1)");
1559  simplehitsMEs.meResolxMFClusterwidthProfileCategory1->setAxisTitle("Resolution (measurement frame) Category 1",2);
1560  }
1562  simplehitsMEs.meResolxMFAngleProfile = bookMEProfile(ibooker,"TProfResolxMFAngleProfile","TProfResolxMFAngleProfile","Profile of Resolution in MF vs Track angle alpha");
1563  simplehitsMEs.meResolxMFAngleProfile->setAxisTitle("Track angle alpha",1);
1564  simplehitsMEs.meResolxMFAngleProfile->setAxisTitle("Resolution (measurement frame)",2);
1565  }
1566 
1567 
1568 }
1569 //------------------------------------------------------------------------------------------
1571 {
1572  SiStripHistoId hidmanager;
1573  LayerMEs layerMEs;
1574 
1575  layerMEs.meWclusRphi = 0;
1576  layerMEs.meAdcRphi = 0;
1577  layerMEs.meResolxLFRphi = 0;
1578  layerMEs.meResolxMFRphi = 0;
1579  layerMEs.meResolxMFRphiwclus1 = 0;
1580  layerMEs.meResolxMFRphiwclus2 = 0;
1581  layerMEs.meResolxMFRphiwclus3 = 0;
1582  layerMEs.meResolxMFRphiwclus4 = 0;
1583  layerMEs.meResLFRphi = 0;
1584  layerMEs.meResMFRphi = 0;
1585  layerMEs.meResMFRphiwclus1 = 0;
1586  layerMEs.meResMFRphiwclus2 = 0;
1587  layerMEs.meResMFRphiwclus3 = 0;
1588  layerMEs.meResMFRphiwclus4 = 0;
1589  layerMEs.mePullLFRphi = 0;
1590  layerMEs.mePullMFRphi = 0;
1591  layerMEs.mePullMFRphiwclus1 = 0;
1592  layerMEs.mePullMFRphiwclus2 = 0;
1593  layerMEs.mePullMFRphiwclus3 = 0;
1594  layerMEs.mePullMFRphiwclus4 = 0;
1595  layerMEs.meTrackangleRphi = 0;
1596  layerMEs.meTrackanglebetaRphi = 0;
1597  layerMEs.meTrackangle2Rphi = 0;
1598  layerMEs.mePullTrackangleProfileRphi = 0;
1599  layerMEs.mePullTrackangle2DRphi = 0;
1600  layerMEs.meTrackwidthRphi = 0;
1601  layerMEs.meExpectedwidthRphi = 0;
1602  layerMEs.meClusterwidthRphi = 0;
1603  layerMEs.meCategoryRphi = 0;
1604  layerMEs.mePullTrackwidthProfileRphi = 0;
1605  layerMEs.mePullTrackwidthProfileRphiwclus1 = 0;
1606  layerMEs.mePullTrackwidthProfileRphiwclus2 = 0;
1607  layerMEs.mePullTrackwidthProfileRphiwclus3 = 0;
1608  layerMEs.mePullTrackwidthProfileRphiwclus4 = 0;
1613  layerMEs.meResolxMFTrackwidthProfileRphi = 0;
1614 
1623 
1629  layerMEs.meResolxMFAngleProfileRphi = 0;
1630  layerMEs.merapidityResProfilewclus1 = 0;
1631  layerMEs.merapidityResProfilewclus2 = 0;
1632  layerMEs.merapidityResProfilewclus3 = 0;
1633  layerMEs.merapidityResProfilewclus4 = 0;
1634 
1635 
1636  //WclusRphi
1637  if(layerswitchWclusRphi) {
1638  layerMEs.meWclusRphi = bookME1D(ibooker,"TH1WclusRphi", hidmanager.createHistoLayer("Wclus_rphi","layer",label,"").c_str() ,"Cluster Width - Number of strips that belong to the RecHit cluster");
1639  layerMEs.meWclusRphi->setAxisTitle(("Cluster Width [nr strips] in "+ label).c_str());
1640  }
1641  //AdcRphi
1642  if(layerswitchAdcRphi) {
1643  layerMEs.meAdcRphi = bookME1D(ibooker,"TH1AdcRphi", hidmanager.createHistoLayer("Adc_rphi","layer",label,"").c_str() ,"RecHit Cluster Charge");
1644  layerMEs.meAdcRphi->setAxisTitle(("cluster charge [ADC] in " + label).c_str());
1645  }
1646  //ResolxLFRphi
1648  layerMEs.meResolxLFRphi = bookME1D(ibooker,"TH1ResolxLFRphi", hidmanager.createHistoLayer("Resolx_LF_rphi","layer",label,"").c_str() ,"RecHit resol(x) coord."); //<resolor>~20micron
1649  layerMEs.meResolxLFRphi->setAxisTitle(("resol(x) RecHit coord. (local frame) in " + label).c_str());
1650  }
1651  //ResolxMFRphi
1653  layerMEs.meResolxMFRphi = bookME1D(ibooker,"TH1ResolxMFRphi", hidmanager.createHistoLayer("Resolx_MF_rphi","layer",label,"").c_str() ,"RecHit resol(x) coord."); //<resolor>~20micron
1654  layerMEs.meResolxMFRphi->setAxisTitle(("resol(x) RecHit coord. (measurement frame) in " + label).c_str());
1655  }
1656  //ResolxMFRphiwclus1
1658  layerMEs.meResolxMFRphiwclus1 = bookME1D(ibooker,"TH1ResolxMFRphiwclus1", hidmanager.createHistoLayer("Resolx_MF_wclus1_rphi","layer",label,"").c_str() ,"RecHit resol(x) coord. w=1 "); //<resolor>~20micron
1659  layerMEs.meResolxMFRphiwclus1->setAxisTitle(("resol(x) RecHit coord. (measurement frame) for w=1 in " + label).c_str());
1660  }
1661  //ResolxMFRphiwclus2
1663  layerMEs.meResolxMFRphiwclus2 = bookME1D(ibooker,"TH1ResolxMFRphiwclus2", hidmanager.createHistoLayer("Resolx_MF_wclus2_rphi","layer",label,"").c_str() ,"RecHit resol(x) coord. w=2 "); //<resolor>~20micron
1664  layerMEs.meResolxMFRphiwclus2->setAxisTitle(("resol(x) RecHit coord. (measurement frame) for w=2 in " + label).c_str());
1665  }
1666  //ResolxMFRphiwclus3
1668  layerMEs.meResolxMFRphiwclus3 = bookME1D(ibooker,"TH1ResolxMFRphiwclus3", hidmanager.createHistoLayer("Resolx_MF_wclus3_rphi","layer",label,"").c_str() ,"RecHit resol(x) coord. w=3 "); //<resolor>~20micron
1669  layerMEs.meResolxMFRphiwclus3->setAxisTitle(("resol(x) RecHit coord. (measurement frame) for w=3 in " + label).c_str());
1670  }
1671  //ResolxMFRphiwclus4
1673  layerMEs.meResolxMFRphiwclus4 = bookME1D(ibooker,"TH1ResolxMFRphiwclus4", hidmanager.createHistoLayer("Resolx_MF_wclus4_rphi","layer",label,"").c_str() ,"RecHit resol(x) coord. w=4 "); //<resolor>~20micron
1674  layerMEs.meResolxMFRphiwclus4->setAxisTitle(("resol(x) RecHit coord. (measurement frame) for w=4 in " + label).c_str());
1675  }
1676  //ResLFRphi
1677  if(layerswitchResLFRphi) {
1678  layerMEs.meResLFRphi = bookME1D(ibooker,"TH1ResLFRphi", hidmanager.createHistoLayer("Res_LF_rphi","layer",label,"").c_str() ,"Residual of the hit x coordinate");
1679  layerMEs.meResLFRphi->setAxisTitle(("Hit Residuals(x) (local frame) in " + label).c_str());
1680  }
1681  //ResMFRphi
1682  if(layerswitchResMFRphi) {
1683  layerMEs.meResMFRphi = bookME1D(ibooker,"TH1ResMFRphi",hidmanager.createHistoLayer("Res_MF_Rphi","layer",label,"").c_str() ,"Residual of the hit x coordinate");
1684  layerMEs.meResMFRphi->setAxisTitle(("Hit Residuals(x) (measurement frame) in "+ label).c_str());
1685  }
1686  //ResMFRphiwclus1
1688  layerMEs.meResMFRphiwclus1 = bookME1D(ibooker,"TH1ResMFRphiwclus1",hidmanager.createHistoLayer("Res_MF_wclus1_Rphi","layer",label,"").c_str() ,"Residual of the hit x coordinate w=1");
1689  layerMEs.meResMFRphiwclus1->setAxisTitle(("Hit Residuals(x) (measurement frame) for w=1 in "+ label).c_str());
1690  }
1691  //ResMFRphiwclus2
1693  layerMEs.meResMFRphiwclus2 = bookME1D(ibooker,"TH1ResMFRphiwclus2",hidmanager.createHistoLayer("Res_MF_wclus2_Rphi","layer",label,"").c_str() ,"Residual of the hit x coordinate w=2");
1694  layerMEs.meResMFRphiwclus2->setAxisTitle(("Hit Residuals(x) (measurement frame) for w=2 in "+ label).c_str());
1695  }
1696  //ResMFRphiwclus3
1698  layerMEs.meResMFRphiwclus3 = bookME1D(ibooker,"TH1ResMFRphiwclus3",hidmanager.createHistoLayer("Res_MF_wclus3_Rphi","layer",label,"").c_str() ,"Residual of the hit x coordinate w=3");
1699  layerMEs.meResMFRphiwclus3->setAxisTitle(("Hit Residuals(x) (measurement frame) for w=3 in "+ label).c_str());
1700  }
1701  //ResMFRphiwclus4
1703  layerMEs.meResMFRphiwclus4 = bookME1D(ibooker,"TH1ResMFRphiwclus4",hidmanager.createHistoLayer("Res_MF_wclus4_Rphi","layer",label,"").c_str() ,"Residual of the hit x coordinate w=4");
1704  layerMEs.meResMFRphiwclus4->setAxisTitle(("Hit Residuals(x) (measurement frame) for w=4 in "+ label).c_str());
1705  }
1706  //PullLFRphi
1707  if(layerswitchPullLFRphi) {
1708  layerMEs.mePullLFRphi = bookME1D(ibooker,"TH1PullLFRphi", hidmanager.createHistoLayer("Pull_LF_rphi","layer",label,"").c_str() ,"Pull distribution");
1709  layerMEs.mePullLFRphi->setAxisTitle(("Pull distribution (local frame) in " + label).c_str());
1710  }
1711  //PullMFRphi
1712  if(layerswitchPullMFRphi) {
1713  layerMEs.mePullMFRphi = bookME1D(ibooker,"TH1PullMFRphi", hidmanager.createHistoLayer("Pull_MF_rphi","layer",label,"").c_str() ,"Pull distribution");
1714  layerMEs.mePullMFRphi->setAxisTitle(("Pull distribution (measurement frame) in " + label).c_str());
1715  }
1716  //PullMFRphiwclus1
1718  layerMEs.mePullMFRphiwclus1 = bookME1D(ibooker,"TH1PullMFRphiwclus1", hidmanager.createHistoLayer("Pull_MF_wclus1_rphi","layer",label,"").c_str() ,"Pull distribution w=1");
1719  layerMEs.mePullMFRphiwclus1->setAxisTitle(("Pull distribution (measurement frame) for w=1 in " + label).c_str());
1720  }
1721  //PullMFRphiwclus2
1723  layerMEs.mePullMFRphiwclus2 = bookME1D(ibooker,"TH1PullMFRphiwclus2", hidmanager.createHistoLayer("Pull_MF_wclus2_rphi","layer",label,"").c_str() ,"Pull distribution w=2");
1724  layerMEs.mePullMFRphiwclus2->setAxisTitle(("Pull distribution (measurement frame) for w=2 in " + label).c_str());
1725  }
1726  //PullMFRphiwclus3
1728  layerMEs.mePullMFRphiwclus3 = bookME1D(ibooker,"TH1PullMFRphiwclus3", hidmanager.createHistoLayer("Pull_MF_wclus3_rphi","layer",label,"").c_str() ,"Pull distribution w=3");
1729  layerMEs.mePullMFRphiwclus3->setAxisTitle(("Pull distribution (measurement frame) for w=3 in " + label).c_str());
1730  }
1731  //PullMFRphiwclus4
1733  layerMEs.mePullMFRphiwclus4 = bookME1D(ibooker,"TH1PullMFRphiwclus4", hidmanager.createHistoLayer("Pull_MF_wclus4_rphi","layer",label,"").c_str() ,"Pull distribution w=4");
1734  layerMEs.mePullMFRphiwclus4->setAxisTitle(("Pull distribution (measurement frame) for w=4 in " + label).c_str());
1735  }
1736 
1738  layerMEs.meTrackangleRphi = bookME1D(ibooker,"TH1TrackangleRphi",hidmanager.createHistoLayer("Track_angle_Rphi","layer",label,"").c_str() ,"Track angle alpha");
1739  layerMEs.meTrackangleRphi->setAxisTitle(("Track angle in "+ label).c_str());
1740  }
1742  layerMEs.meTrackanglebetaRphi = bookME1D(ibooker,"TH1TrackanglebetaRphi",hidmanager.createHistoLayer("Track_angle_beta_Rphi","layer",label,"").c_str() ,"Track angle beta");
1743  layerMEs.meTrackanglebetaRphi->setAxisTitle((""+ label).c_str());
1744  }
1746  layerMEs.meTrackangle2Rphi = bookME1D(ibooker,"TH1Trackangle2Rphi",hidmanager.createHistoLayer("Track_angle2_Rphi","layer",label,"").c_str() ,"");
1747  layerMEs.meTrackangle2Rphi->setAxisTitle((""+ label).c_str());
1748  }
1750  layerMEs.mePullTrackangleProfileRphi = bookMEProfile(ibooker,"TProfPullTrackangleProfileRphi",hidmanager.createHistoLayer("Pull_Trackangle_Profile_Rphi","layer",label,"").c_str() ,"Profile of Pull in MF vs track angle alpha");
1751  layerMEs.mePullTrackangleProfileRphi->setAxisTitle(("Track angle alpha in "+ label).c_str(),1);
1752  layerMEs.mePullTrackangleProfileRphi->setAxisTitle(("Pull (MF) in "+ label).c_str(),2);
1753  }
1755  layerMEs.mePullTrackangle2DRphi = bookME1D(ibooker,"TH1PullTrackangle2DRphi",hidmanager.createHistoLayer("Pull_Trackangle_2D_Rphi","layer",label,"").c_str() ,"");
1756  layerMEs.mePullTrackangle2DRphi->setAxisTitle((""+ label).c_str());
1757  }
1759  layerMEs.meTrackwidthRphi = bookME1D(ibooker,"TH1TrackwidthRphi",hidmanager.createHistoLayer("Track_width_Rphi","layer",label,"").c_str() ,"Track width");
1760  layerMEs.meTrackwidthRphi->setAxisTitle(("Track width in "+ label).c_str());
1761  }
1763  layerMEs.meExpectedwidthRphi = bookME1D(ibooker,"TH1ExpectedwidthRphi",hidmanager.createHistoLayer("Expected_width_Rphi","layer",label,"").c_str() ,"Expected width");
1764  layerMEs.meExpectedwidthRphi->setAxisTitle(("Expected width in "+ label).c_str());
1765  }
1767  layerMEs.meClusterwidthRphi = bookME1D(ibooker,"TH1ClusterwidthRphi",hidmanager.createHistoLayer("Cluster_width_Rphi","layer",label,"").c_str() ,"Cluster width");
1768  layerMEs.meClusterwidthRphi->setAxisTitle(("Cluster width in "+ label).c_str());
1769  }
1771  layerMEs.meCategoryRphi = bookME1D(ibooker,"TH1CategoryRphi",hidmanager.createHistoLayer("Category_Rphi","layer",label,"").c_str() ,"Category");
1772  layerMEs.meCategoryRphi->setAxisTitle(("Category in "+ label).c_str());
1773  }
1775  layerMEs.mePullTrackwidthProfileRphi = bookMEProfile(ibooker,"TProfPullTrackwidthProfileRphi",hidmanager.createHistoLayer("Pull_Track_width_Profile_Rphi","layer",label,"").c_str() ,"Profile of Pull in MF vs track width");
1776  layerMEs.mePullTrackwidthProfileRphi->setAxisTitle(("track width in "+ label).c_str(),1);
1777  layerMEs.mePullTrackwidthProfileRphi->setAxisTitle(("Pull (MF) in "+ label).c_str(),2);
1778  }
1780  layerMEs.mePullTrackwidthProfileRphiwclus1 = bookMEProfile(ibooker,"TProfPullTrackwidthProfileRphiwclus1",hidmanager.createHistoLayer("Pull_Track_width_Profile_Rphi_wclus1","layer",label,"").c_str() ,"Profile of Pull in MF vs track width for w=1");
1781  layerMEs.mePullTrackwidthProfileRphiwclus1->setAxisTitle(("track width for w=1 in "+ label).c_str(),1);
1782  layerMEs.mePullTrackwidthProfileRphiwclus1->setAxisTitle(("Pull (MF) for w=1 in "+ label).c_str(),2);
1783  }
1785  layerMEs.mePullTrackwidthProfileRphiwclus2 = bookMEProfile(ibooker,"TProfPullTrackwidthProfileRphiwclus2",hidmanager.createHistoLayer("Pull_Track_width_Profile_Rphi_wclus2","layer",label,"").c_str() ,"Profile of Pull in MF vs track width for w=2");
1786  layerMEs.mePullTrackwidthProfileRphiwclus2->setAxisTitle(("track width for w=2 in "+ label).c_str(),1);
1787  layerMEs.mePullTrackwidthProfileRphiwclus2->setAxisTitle(("Pull (MF) for w=2 in "+ label).c_str(),2);
1788 
1789  }
1791  layerMEs.mePullTrackwidthProfileRphiwclus3 = bookMEProfile(ibooker,"TProfPullTrackwidthProfileRphiwclus3",hidmanager.createHistoLayer("Pull_Track_width_Profile_Rphi_wclus3","layer",label,"").c_str() ,"Profile of Pull in MF vs track width for w=3");
1792  layerMEs.mePullTrackwidthProfileRphiwclus3->setAxisTitle(("track width for w=3 in "+ label).c_str(),1);
1793  layerMEs.mePullTrackwidthProfileRphiwclus3->setAxisTitle(("Pull (MF) for w=3 in "+ label).c_str(),2);
1794  }
1796  layerMEs.mePullTrackwidthProfileRphiwclus4 = bookMEProfile(ibooker,"TProfPullTrackwidthProfileRphiwclus4",hidmanager.createHistoLayer("Pull_Track_width_Profile_Rphi_wclus4","layer",label,"").c_str() ,"Profile of Pull in MF vs track width for w=4");
1797  layerMEs.mePullTrackwidthProfileRphiwclus4->setAxisTitle(("track width for w=4 in "+ label).c_str(),1);
1798  layerMEs.mePullTrackwidthProfileRphiwclus4->setAxisTitle(("Pull (MF) for w=4 in "+ label).c_str(),2);
1799 
1800  }
1802  layerMEs.mePullTrackwidthProfileCategory1Rphi = bookMEProfile(ibooker,"TProfPullTrackwidthProfileCategory1Rphi",hidmanager.createHistoLayer("Pull_Track_width_Profile_Category1_Rphi","layer",label,"").c_str() ,"Profile of Pull in MF vs track width for Category 1");
1803  layerMEs.mePullTrackwidthProfileCategory1Rphi->setAxisTitle(("track width for Category 1 in "+ label).c_str(),1);
1804  layerMEs.mePullTrackwidthProfileCategory1Rphi->setAxisTitle(("Pull (MF) for Category 1 in "+ label).c_str(),2);
1805  }
1807  layerMEs.mePullTrackwidthProfileCategory2Rphi = bookMEProfile(ibooker,"TProfPullTrackwidthProfileCategory2Rphi",hidmanager.createHistoLayer("Pull_Track_width_Profile_Category2_Rphi","layer",label,"").c_str() ,"Profile of Pull in MF vs track width for Category 2");
1808  layerMEs.mePullTrackwidthProfileCategory2Rphi->setAxisTitle(("track width for Category 2 in "+ label).c_str(),1);
1809  layerMEs.mePullTrackwidthProfileCategory2Rphi->setAxisTitle(("Pull (MF) for Category 2 in "+ label).c_str(),2);
1810  }
1812  layerMEs.mePullTrackwidthProfileCategory3Rphi = bookMEProfile(ibooker,"TProfPullTrackwidthProfileCategory3Rphi",hidmanager.createHistoLayer("Pull_Track_width_Profile_Category3_Rphi","layer",label,"").c_str() ,"Profile of Pull in MF vs track width for Category 3");
1813  layerMEs.mePullTrackwidthProfileCategory3Rphi->setAxisTitle(("track width for Category 3 in "+ label).c_str(),1);
1814  layerMEs.mePullTrackwidthProfileCategory3Rphi->setAxisTitle(("Pull (MF) for Category 3 in "+ label).c_str(),2);
1815  }
1817  layerMEs.mePullTrackwidthProfileCategory4Rphi = bookMEProfile(ibooker,"TProfPullTrackwidthProfileCategory4Rphi",hidmanager.createHistoLayer("Pull_Track_width_Profile_Category4_Rphi","layer",label,"").c_str() ,"Profile of Pull in MF vs track width for Category 4");
1818  layerMEs.mePullTrackwidthProfileCategory4Rphi->setAxisTitle(("track width for Category 4 in "+ label).c_str(),1);
1819  layerMEs.mePullTrackwidthProfileCategory4Rphi->setAxisTitle(("Pull (MF) for Category 4 in "+ label).c_str(),2);
1820  }
1822  layerMEs.meResolxMFTrackwidthProfileRphi = bookMEProfile(ibooker,"TProfResolxMFTrackwidthProfileRphi",hidmanager.createHistoLayer("ResolxMF_Track_width_Profile_Rphi","layer",label,"").c_str() ,"Profile of Resolution in MF vs track width");
1823  layerMEs.meResolxMFTrackwidthProfileRphi->setAxisTitle(("track width in "+ label).c_str(),1);
1824  layerMEs.meResolxMFTrackwidthProfileRphi->setAxisTitle(("Resolution in MF in "+ label).c_str(),2);
1825  }
1826 
1828  layerMEs.meResolxMFTrackwidthProfileWclus1Rphi = bookMEProfile(ibooker,"TProfResolxMFTrackwidthProfileWclus1Rphi",hidmanager.createHistoLayer("ResolxMF_Track_width_Profile_Wclus1_Rphi","layer",label,"").c_str() ,"Profile of Resolution in MF vs track width for w=1");
1829  layerMEs.meResolxMFTrackwidthProfileWclus1Rphi->setAxisTitle(("track width for w=1 in "+ label).c_str(),1);
1830  layerMEs.meResolxMFTrackwidthProfileWclus1Rphi->setAxisTitle(("Resolution in MF for w=1 in "+ label).c_str(),2);
1831  }
1833  layerMEs.meResolxMFTrackwidthProfileWclus2Rphi = bookMEProfile(ibooker,"TProfResolxMFTrackwidthProfileWclus2Rphi",hidmanager.createHistoLayer("ResolxMF_Track_width_Profile_Wclus2_Rphi","layer",label,"").c_str() ,"Profile of Resolution in MF vs track width for w=2");
1834  layerMEs.meResolxMFTrackwidthProfileWclus2Rphi->setAxisTitle(("track width for w=2 in "+ label).c_str(),1);
1835  layerMEs.meResolxMFTrackwidthProfileWclus2Rphi->setAxisTitle(("Resolution in MF for w=2 in "+ label).c_str(),2);
1836  }
1838  layerMEs.meResolxMFTrackwidthProfileWclus3Rphi = bookMEProfile(ibooker,"TProfResolxMFTrackwidthProfileWclus3Rphi",hidmanager.createHistoLayer("ResolxMF_Track_width_Profile_Wclus3_Rphi","layer",label,"").c_str() ,"Profile of Resolution in MF vs track width for w=3");
1839  layerMEs.meResolxMFTrackwidthProfileWclus3Rphi->setAxisTitle(("track width for w=3 in "+ label).c_str(),1);
1840  layerMEs.meResolxMFTrackwidthProfileWclus3Rphi->setAxisTitle(("Resolution in MF for w=3 in "+ label).c_str(),2);
1841  }
1843  layerMEs.meResolxMFTrackwidthProfileWclus4Rphi = bookMEProfile(ibooker,"TProfResolxMFTrackwidthProfileWclus4Rphi",hidmanager.createHistoLayer("ResolxMF_Track_width_Profile_Wclus4_Rphi","layer",label,"").c_str() ,"Profile of Resolution in MF vs track width for w=4");
1844  layerMEs.meResolxMFTrackwidthProfileWclus4Rphi->setAxisTitle(("track width for w=4 in "+ label).c_str(),1);
1845  layerMEs.meResolxMFTrackwidthProfileWclus4Rphi->setAxisTitle(("Resolution in MF for w=4 in "+ label).c_str(),2);
1846  }
1848  layerMEs.meResMFTrackwidthProfileWclus1Rphi = bookMEProfile(ibooker,"TProfResMFTrackwidthProfileWclus1Rphi",hidmanager.createHistoLayer("ResMF_Track_width_Profile_Wclus1_Rphi","layer",label,"").c_str() ,"Profile of Residuals(x) in MF vs track width for w=1");
1849  layerMEs.meResMFTrackwidthProfileWclus1Rphi->setAxisTitle(("track width for w=1 in "+ label).c_str(),1);
1850  layerMEs.meResMFTrackwidthProfileWclus1Rphi->setAxisTitle(("Residuals(x) in MF for w=1 in "+ label).c_str(),2);
1851  }
1853  layerMEs.meResMFTrackwidthProfileWclus2Rphi = bookMEProfile(ibooker,"TProfResMFTrackwidthProfileWclus2Rphi",hidmanager.createHistoLayer("ResMF_Track_width_Profile_Wclus2_Rphi","layer",label,"").c_str() ,"Profile of Residuals(x) in MF vs track width for w=2");
1854  layerMEs.meResMFTrackwidthProfileWclus2Rphi->setAxisTitle(("track width for w=2 in "+ label).c_str(),1);
1855  layerMEs.meResMFTrackwidthProfileWclus2Rphi->setAxisTitle(("Residuals(x) in MF for w=2 in "+ label).c_str(),2);
1856  }
1858  layerMEs.meResMFTrackwidthProfileWclus3Rphi = bookMEProfile(ibooker,"TProfResMFTrackwidthProfileWclus3Rphi",hidmanager.createHistoLayer("ResMF_Track_width_Profile_Wclus3_Rphi","layer",label,"").c_str() ,"Profile of Residuals(x) in MF vs track width for w=3");
1859  layerMEs.meResMFTrackwidthProfileWclus3Rphi->setAxisTitle(("track width for w=3 in "+ label).c_str(),1);
1860  layerMEs.meResMFTrackwidthProfileWclus3Rphi->setAxisTitle(("Residuals(x) in MF for w=3 in "+ label).c_str(),2);
1861  }
1863  layerMEs.meResMFTrackwidthProfileWclus4Rphi = bookMEProfile(ibooker,"TProfResMFTrackwidthProfileWclus4Rphi",hidmanager.createHistoLayer("ResMF_Track_width_Profile_Wclus4_Rphi","layer",label,"").c_str() ,"Profile of Residuals(x) in MF vs track width for w=4");
1864  layerMEs.meResMFTrackwidthProfileWclus4Rphi->setAxisTitle(("track width for w=4 in "+ label).c_str(),1);
1865  layerMEs.meResMFTrackwidthProfileWclus4Rphi->setAxisTitle(("Residuals(x) in MF for w=4 in "+ label).c_str(),2);
1866  }
1867 
1869  layerMEs.meResolxMFTrackwidthProfileCategory1Rphi = bookMEProfile(ibooker,"TProfResolxMFTrackwidthProfileCategory1Rphi",hidmanager.createHistoLayer("ResolxMF_Track_width_Profile_Category1_Rphi","layer",label,"").c_str() ,"Profile of Resolution in MF vs track width for Category 1");
1870  layerMEs.meResolxMFTrackwidthProfileCategory1Rphi->setAxisTitle(("track width for Category 1 in "+ label).c_str(),1);
1871  layerMEs.meResolxMFTrackwidthProfileCategory1Rphi->setAxisTitle(("Resolution in MF for Category 1 in "+ label).c_str(),2);
1872  }
1874  layerMEs.meResolxMFTrackwidthProfileCategory2Rphi = bookMEProfile(ibooker,"TProfResolxMFTrackwidthProfileCategory2Rphi",hidmanager.createHistoLayer("ResolxMF_Track_width_Profile_Category2_Rphi","layer",label,"").c_str() ,"Profile of Resolution in MF vs track width for Category 2");
1875  layerMEs.meResolxMFTrackwidthProfileCategory2Rphi->setAxisTitle(("track width for Category 2 in "+ label).c_str(),1);
1876  layerMEs.meResolxMFTrackwidthProfileCategory2Rphi->setAxisTitle(("Resolution in MF for Category 2 in "+ label).c_str(),2);
1877  }
1879  layerMEs.meResolxMFTrackwidthProfileCategory3Rphi = bookMEProfile(ibooker,"TProfResolxMFTrackwidthProfileCategory3Rphi",hidmanager.createHistoLayer("ResolxMF_Track_width_Profile_Category3_Rphi","layer",label,"").c_str() ,"Profile of Resolution in MF vs track width for Category 3");
1880  layerMEs.meResolxMFTrackwidthProfileCategory3Rphi->setAxisTitle(("track width for Category 3 in "+ label).c_str(),1);
1881  layerMEs.meResolxMFTrackwidthProfileCategory3Rphi->setAxisTitle(("Resolution in MF for Category 3 in "+ label).c_str(),2);
1882  }
1884  layerMEs.meResolxMFTrackwidthProfileCategory4Rphi = bookMEProfile(ibooker,"TProfResolxMFTrackwidthProfileCategory4Rphi",hidmanager.createHistoLayer("ResolxMF_Track_width_Profile_Category3_Rphi","layer",label,"").c_str() ,"Profile of Resolution in MF vs track width for Category 4");
1885  layerMEs.meResolxMFTrackwidthProfileCategory3Rphi->setAxisTitle(("track width for Category 4 in "+ label).c_str(),1);
1886  layerMEs.meResolxMFTrackwidthProfileCategory3Rphi->setAxisTitle(("Resolution in MF for Category 4 in "+ label).c_str(),2);
1887  }
1889  layerMEs.meResolxMFClusterwidthProfileCategory1Rphi = bookMEProfile(ibooker,"TProfResolxMFClusterwidthProfileCategory1Rphi",hidmanager.createHistoLayer("ResolxMF_Cluster_width_Profile_Category1_Rphi","layer",label,"").c_str() ,"Profile of Resolution in MF vs cluster width for Category 1");
1890  layerMEs.meResolxMFClusterwidthProfileCategory1Rphi->setAxisTitle(("cluster width for Category 1 in "+ label).c_str(),1);
1891  layerMEs.meResolxMFClusterwidthProfileCategory1Rphi->setAxisTitle(("Resolution in MF for Category 1 in "+ label).c_str(),2);
1892  }
1894  layerMEs.meResolxMFAngleProfileRphi = bookMEProfile(ibooker,"TProfResolxMFAngleProfileRphi",hidmanager.createHistoLayer("ResolxMF_Angle_Profile_Rphi","layer",label,"").c_str() ,"Profile of Resolution in MF vs track angle alpha");
1895  layerMEs.meResolxMFAngleProfileRphi->setAxisTitle(("track angle alpha in "+ label).c_str(),1);
1896  layerMEs.meResolxMFAngleProfileRphi->setAxisTitle(("Resolution in MF in "+ label).c_str(),2);
1897  }
1899  layerMEs.merapidityResProfilewclus1 = bookMEProfile(ibooker,"TProfrapidityResProfilewclus1",hidmanager.createHistoLayer("rapidity_Res_Profile_wclus1","layer",label,"").c_str() ,"Profile of rapidity vs Res for w=1");
1900  layerMEs.merapidityResProfilewclus1->setAxisTitle(("Res for w=1 in "+ label).c_str(),1);
1901  layerMEs.merapidityResProfilewclus1->setAxisTitle(("rapidity for w=1 in "+ label).c_str(),2);
1902  }
1904  layerMEs.merapidityResProfilewclus2 = bookMEProfile(ibooker,"TProfrapidityResProfilewclus2",hidmanager.createHistoLayer("rapidity_Res_Profile_wclus2","layer",label,"").c_str() ,"Profile of rapidity vs Res for w=2");
1905  layerMEs.merapidityResProfilewclus2->setAxisTitle(("Res for w=2 in "+ label).c_str(),1);
1906  layerMEs.merapidityResProfilewclus2->setAxisTitle(("rapidity for w=2 in "+ label).c_str(),2);
1907  }
1909  layerMEs.merapidityResProfilewclus3 = bookMEProfile(ibooker,"TProfrapidityResProfilewclus3",hidmanager.createHistoLayer("rapidity_Res_Profile_wclus3","layer",label,"").c_str() ,"Profile of rapidity vs Res for w=3");
1910  layerMEs.merapidityResProfilewclus3->setAxisTitle(("Res for w=3 in "+ label).c_str(),1);
1911  layerMEs.merapidityResProfilewclus3->setAxisTitle(("rapidity for w=3 in "+ label).c_str(),2);
1912  }
1914  layerMEs.merapidityResProfilewclus4 = bookMEProfile(ibooker,"TProfrapidityResProfilewclus4",hidmanager.createHistoLayer("rapidity_Res_Profile_wclus4","layer",label,"").c_str() ,"Profile of rapidity vs Res for w=4");
1915  layerMEs.merapidityResProfilewclus4->setAxisTitle(("Res for w=4 in "+ label).c_str(),1);
1916  layerMEs.merapidityResProfilewclus4->setAxisTitle(("rapidity for w=4 in "+ label).c_str(),2);
1917  }
1918 
1919 
1920  LayerMEsMap[label]=layerMEs;
1921 
1922 }
1923 //------------------------------------------------------------------------------------------
1925 {
1926  SiStripHistoId hidmanager;
1927  StereoAndMatchedMEs stereoandmatchedMEs;
1928 
1929  stereoandmatchedMEs.meWclusSas = 0;
1930  stereoandmatchedMEs.meAdcSas = 0;
1931  stereoandmatchedMEs.meResolxLFSas = 0;
1932  stereoandmatchedMEs.meResolxMFSas = 0;
1933  stereoandmatchedMEs.meResLFSas = 0;
1934  stereoandmatchedMEs.meResMFSas = 0;
1935  stereoandmatchedMEs.mePullLFSas = 0;
1936  stereoandmatchedMEs.mePullMFSas = 0;
1937  stereoandmatchedMEs.meTrackangleSas = 0;
1938  stereoandmatchedMEs.meTrackanglebetaSas = 0;
1939  stereoandmatchedMEs.mePullTrackangleProfileSas = 0;
1940  stereoandmatchedMEs.meTrackwidthSas = 0;
1941  stereoandmatchedMEs.meExpectedwidthSas = 0;
1942  stereoandmatchedMEs.meClusterwidthSas = 0;
1943  stereoandmatchedMEs.meCategorySas = 0;
1944  stereoandmatchedMEs.mePullTrackwidthProfileSas = 0;
1945  stereoandmatchedMEs.mePullTrackwidthProfileCategory1Sas = 0;
1946  stereoandmatchedMEs.mePullTrackwidthProfileCategory2Sas = 0;
1947  stereoandmatchedMEs.mePullTrackwidthProfileCategory3Sas = 0;
1948  stereoandmatchedMEs.mePullTrackwidthProfileCategory4Sas = 0;
1949  stereoandmatchedMEs.meResolxMFTrackwidthProfileSas = 0;
1950  stereoandmatchedMEs.meResolxMFTrackwidthProfileCategory1Sas = 0;
1951  stereoandmatchedMEs.meResolxMFTrackwidthProfileCategory2Sas = 0;
1952  stereoandmatchedMEs.meResolxMFTrackwidthProfileCategory3Sas = 0;
1953  stereoandmatchedMEs.meResolxMFTrackwidthProfileCategory4Sas = 0;
1954  stereoandmatchedMEs.meResolxMFClusterwidthProfileCategory1Sas = 0;
1955  stereoandmatchedMEs.meResolxMFAngleProfileSas = 0;
1956 
1957  stereoandmatchedMEs.mePosxMatched = 0;
1958  stereoandmatchedMEs.mePosyMatched = 0;
1959  stereoandmatchedMEs.meResolxMatched = 0;
1960  stereoandmatchedMEs.meResolyMatched = 0;
1961  stereoandmatchedMEs.meResxMatched = 0;
1962  stereoandmatchedMEs.meResyMatched = 0;
1963  stereoandmatchedMEs.mePullxMatched = 0;
1964  stereoandmatchedMEs.mePullyMatched = 0;
1965 
1966  //WclusSas
1967  if(layerswitchWclusSas) {
1968  stereoandmatchedMEs.meWclusSas = bookME1D(ibooker,"TH1WclusSas", hidmanager.createHistoLayer("Wclus_sas","layer",label,"").c_str() ,"Cluster Width - Number of strips that belong to the RecHit cluster");
1969  stereoandmatchedMEs.meWclusSas->setAxisTitle(("Cluster Width [nr strips] (stereo) in "+ label).c_str());
1970  }
1971  //AdcSas
1972  if(layerswitchAdcSas) {
1973  stereoandmatchedMEs.meAdcSas = bookME1D(ibooker,"TH1AdcSas", hidmanager.createHistoLayer("Adc_sas","layer",label,"").c_str() ,"RecHit Cluster Charge");
1974  stereoandmatchedMEs.meAdcSas->setAxisTitle(("cluster charge [ADC] (stereo) in " + label).c_str());
1975  }
1976  //ResolxLFSas
1978  stereoandmatchedMEs.meResolxLFSas = bookME1D(ibooker,"TH1ResolxLFSas", hidmanager.createHistoLayer("Resolx_LF_sas","layer",label,"").c_str() ,"RecHit resol(x) coord.");
1979  stereoandmatchedMEs.meResolxLFSas->setAxisTitle(("resol(x) RecHit coord. (local frame) (stereo) in " + label).c_str());
1980  }
1981  //ResolxMFSas
1983  stereoandmatchedMEs.meResolxMFSas = bookME1D(ibooker,"TH1ResolxMFSas", hidmanager.createHistoLayer("Resolx_MF_sas","layer",label,"").c_str() ,"RecHit resol(x) coord.");
1984  stereoandmatchedMEs.meResolxMFSas->setAxisTitle(("resol(x) RecHit coord. (measurement frame) (stereo) in " + label).c_str());
1985  }
1986  //ResLFSas
1987  if(layerswitchResLFSas) {
1988  stereoandmatchedMEs.meResLFSas = bookME1D(ibooker,"TH1ResLFSas", hidmanager.createHistoLayer("Res_LF_sas","layer",label,"").c_str() ,"Residual of the hit x coordinate");
1989  stereoandmatchedMEs.meResLFSas->setAxisTitle(("Hit Residuals(x) (local frame) (stereo) in " + label).c_str());
1990  }
1991  //ResMFSas
1992  if(layerswitchResMFSas) {
1993  stereoandmatchedMEs.meResMFSas = bookME1D(ibooker,"TH1ResMFSas", hidmanager.createHistoLayer("Res_MF_sas","layer",label,"").c_str() ,"Residual of the hit x coordinate");
1994  stereoandmatchedMEs.meResMFSas->setAxisTitle(("Hit Residuals(x) (stereo) in " + label).c_str());
1995  }
1996  //PullLFSas
1997  if(layerswitchPullLFSas) {
1998  stereoandmatchedMEs.mePullLFSas = bookME1D(ibooker,"TH1PullLFSas", hidmanager.createHistoLayer("Pull_LF_sas","layer",label,"").c_str() ,"Pull distribution");
1999  stereoandmatchedMEs.mePullLFSas->setAxisTitle(("Pull distribution (local frame) (stereo) in " + label).c_str());
2000  }
2001  //PullMFSas
2002  if(layerswitchPullMFSas) {
2003  stereoandmatchedMEs.mePullMFSas = bookME1D(ibooker,"TH1PullMFSas", hidmanager.createHistoLayer("Pull_MF_sas","layer",label,"").c_str() ,"Pull distribution");
2004  stereoandmatchedMEs.mePullMFSas->setAxisTitle(("Pull distribution (measurement frame) (stereo) in " + label).c_str());
2005  }
2006 
2008  stereoandmatchedMEs.meTrackangleSas = bookME1D(ibooker,"TH1TrackangleSas",hidmanager.createHistoLayer("Track_angle_Sas","layer",label,"").c_str() ,"Track angle");
2009  stereoandmatchedMEs.meTrackangleSas->setAxisTitle(("Track angle (stereo) in " + label).c_str());
2010  }
2012  stereoandmatchedMEs.meTrackanglebetaSas = bookME1D(ibooker,"TH1TrackanglebetaSas",hidmanager.createHistoLayer("Track_angle_beta_Sas","layer",label,"").c_str() ,"Track angle beta");
2013  stereoandmatchedMEs.meTrackanglebetaSas->setAxisTitle(("Track angle beta (stereo) in " + label).c_str());
2014  }
2016  stereoandmatchedMEs.mePullTrackangleProfileSas = bookMEProfile(ibooker,"TProfPullTrackangleProfileSas",hidmanager.createHistoLayer("Pull_Track_angle_Profile_Sas","layer",label,"").c_str() ,"Profile of Pull in MF vs track angle (stereo)");
2017  stereoandmatchedMEs.mePullTrackangleProfileSas->setAxisTitle(("track angle (stereo) in " + label).c_str(),1);
2018  stereoandmatchedMEs.mePullTrackangleProfileSas->setAxisTitle(("Pull in MF (stereo) in " + label).c_str(),2);
2019  }
2021  stereoandmatchedMEs.meTrackwidthSas = bookME1D(ibooker,"TH1TrackwidthSas",hidmanager.createHistoLayer("Track_width_Sas","layer",label,"").c_str() ,"Track width");
2022  stereoandmatchedMEs.meTrackwidthSas->setAxisTitle(("Track width (stereo) in " + label).c_str());
2023  }
2025  stereoandmatchedMEs.meExpectedwidthSas = bookME1D(ibooker,"TH1ExpectedwidthSas",hidmanager.createHistoLayer("Expected_width_Sas","layer",label,"").c_str() ,"Expected width");
2026  stereoandmatchedMEs.meExpectedwidthSas->setAxisTitle(("Expected width (stereo) in " + label).c_str());
2027  }
2029  stereoandmatchedMEs.meClusterwidthSas = bookME1D(ibooker,"TH1ClusterwidthSas",hidmanager.createHistoLayer("Cluster_width_Sas","layer",label,"").c_str() ,"Cluster width");
2030  stereoandmatchedMEs.meClusterwidthSas->setAxisTitle(("Cluster width (stereo) in " + label).c_str());
2031  }
2033  stereoandmatchedMEs.meCategorySas = bookME1D(ibooker,"TH1CategorySas",hidmanager.createHistoLayer("Category_Sas","layer",label,"").c_str() ,"Category");
2034  stereoandmatchedMEs.meCategorySas->setAxisTitle(("Category (stereo) in " + label).c_str());
2035  }
2037  stereoandmatchedMEs.mePullTrackwidthProfileSas = bookMEProfile(ibooker,"TProfPullTrackwidthProfileSas",hidmanager.createHistoLayer("Pull_Track_width_Profile_Sas","layer",label,"").c_str() ,"Profile of Pull in MF vs track width (stereo)");
2038  stereoandmatchedMEs.mePullTrackwidthProfileSas->setAxisTitle(("track width (stereo) in " + label).c_str(),1);
2039  stereoandmatchedMEs.mePullTrackwidthProfileSas->setAxisTitle(("Pull in MF (stereo) in " + label).c_str(),2);
2040  }
2042  stereoandmatchedMEs.mePullTrackwidthProfileCategory1Sas = bookMEProfile(ibooker,"TProfPullTrackwidthProfileCategory1Sas",hidmanager.createHistoLayer("Pull_Track_width_Profile_Category1_Sas","layer",label,"").c_str() ,"Profile of Pull in MF vs track width (Category 1) (stereo)");
2043  stereoandmatchedMEs.mePullTrackwidthProfileCategory1Sas->setAxisTitle(("track width (Category 1) (stereo) in " + label).c_str(),1);
2044  stereoandmatchedMEs.mePullTrackwidthProfileCategory1Sas->setAxisTitle(("Pull in MF (Category 1) (stereo) in " + label).c_str(),2);
2045  }
2047  stereoandmatchedMEs.mePullTrackwidthProfileCategory2Sas = bookMEProfile(ibooker,"TProfPullTrackwidthProfileCategory2Sas",hidmanager.createHistoLayer("Pull_Track_width_Profile_Category2_Sas","layer",label,"").c_str() ,"Profile of Pull in MF vs track width (Category 2) (stereo)");
2048  stereoandmatchedMEs.mePullTrackwidthProfileCategory2Sas->setAxisTitle(("track width (Category 2) (stereo) in " + label).c_str(),1);
2049  stereoandmatchedMEs.mePullTrackwidthProfileCategory2Sas->setAxisTitle(("Pull in MF (Category 2) (stereo) in " + label).c_str(),2);
2050  }
2052  stereoandmatchedMEs.mePullTrackwidthProfileCategory3Sas = bookMEProfile(ibooker,"TProfPullTrackwidthProfileCategory3Sas",hidmanager.createHistoLayer("Pull_Track_width_Profile_Category3_Sas","layer",label,"").c_str() ,"Profile of Pull in MF vs track width (Category 3) (stereo)");
2053  stereoandmatchedMEs.mePullTrackwidthProfileCategory3Sas->setAxisTitle(("track width (Category 3) (stereo) in " + label).c_str(),1);
2054  stereoandmatchedMEs.mePullTrackwidthProfileCategory3Sas->setAxisTitle(("Pull in MF (Category 3) (stereo) in " + label).c_str(),2);
2055  }
2057  stereoandmatchedMEs.mePullTrackwidthProfileCategory4Sas = bookMEProfile(ibooker,"TProfPullTrackwidthProfileCategory4Sas",hidmanager.createHistoLayer("Pull_Track_width_Profile_Category4_Sas","layer",label,"").c_str() ,"Profile of Pull in MF vs track width (Category 4) (stereo)");
2058  stereoandmatchedMEs.mePullTrackwidthProfileCategory4Sas->setAxisTitle(("track width (Category 4) (stereo) in " + label).c_str(),1);
2059  stereoandmatchedMEs.mePullTrackwidthProfileCategory4Sas->setAxisTitle(("Pull in MF (Category 4) (stereo) in " + label).c_str(),2);
2060  }
2062  stereoandmatchedMEs.meResolxMFTrackwidthProfileSas = bookMEProfile(ibooker,"TProfResolxMFTrackwidthProfileSas",hidmanager.createHistoLayer("ResolxMF_Track_width_Profile_Sas","layer",label,"").c_str() ,"Profile of Resolution in MF vs track width (stereo)");
2063  stereoandmatchedMEs.meResolxMFTrackwidthProfileSas->setAxisTitle(("track width (stereo) in " + label).c_str(),1);
2064  stereoandmatchedMEs.meResolxMFTrackwidthProfileSas->setAxisTitle(("Resolution in MF (stereo) in " + label).c_str(),2);
2065  }
2067  stereoandmatchedMEs.meResolxMFTrackwidthProfileCategory1Sas = bookMEProfile(ibooker,"TProfResolxMFTrackwidthProfileCategory1Sas",hidmanager.createHistoLayer("ResolxMF_Track_width_Profile_Category1_Sas","layer",label,"").c_str() ,"Profile of Resolution in MF vs track width (Category 1) (stereo)");
2068  stereoandmatchedMEs.meResolxMFTrackwidthProfileCategory1Sas->setAxisTitle((" track width (Category 1) (stereo) in " + label).c_str(),1);
2069  stereoandmatchedMEs.meResolxMFTrackwidthProfileCategory1Sas->setAxisTitle((" Resolution in MF (Category 1) (stereo) in " + label).c_str(),2);
2070  }
2072  stereoandmatchedMEs.meResolxMFTrackwidthProfileCategory2Sas = bookMEProfile(ibooker,"TProfResolxMFTrackwidthProfileCategory2Sas",hidmanager.createHistoLayer("ResolxMF_Track_width_Profile_Category2_Sas","layer",label,"").c_str() ,"Profile of Resolution in MF vs track width (Category 2) (stereo)");
2073  stereoandmatchedMEs.meResolxMFTrackwidthProfileCategory2Sas->setAxisTitle((" track width (Category 2) (stereo) in " + label).c_str(),1);
2074  stereoandmatchedMEs.meResolxMFTrackwidthProfileCategory2Sas->setAxisTitle((" Resolution in MF (Category 2) (stereo) in " + label).c_str(),2);
2075  }
2077  stereoandmatchedMEs.meResolxMFTrackwidthProfileCategory3Sas = bookMEProfile(ibooker,"TProfResolxMFTrackwidthProfileCategory3Sas",hidmanager.createHistoLayer("ResolxMF_Track_width_Profile_Category3_Sas","layer",label,"").c_str() ,"Profile of Resolution in MF vs track width (Category 3) (stereo)");
2078  stereoandmatchedMEs.meResolxMFTrackwidthProfileCategory3Sas->setAxisTitle((" track width (Category 3) (stereo) in " + label).c_str(),1);
2079  stereoandmatchedMEs.meResolxMFTrackwidthProfileCategory3Sas->setAxisTitle((" Resolution in MF (Category 3) (stereo) in " + label).c_str(),2);
2080  }
2082  stereoandmatchedMEs.meResolxMFTrackwidthProfileCategory4Sas = bookMEProfile(ibooker,"TProfResolxMFTrackwidthProfileCategory4Sas",hidmanager.createHistoLayer("ResolxMF_Track_width_Profile_Category4_Sas","layer",label,"").c_str() ,"Profile of Resolution in MF vs track width (Category 4) (stereo)");
2083  stereoandmatchedMEs.meResolxMFTrackwidthProfileCategory4Sas->setAxisTitle((" track width (Category 4) (stereo) in " + label).c_str(),1);
2084  stereoandmatchedMEs.meResolxMFTrackwidthProfileCategory4Sas->setAxisTitle((" Resolution in MF (Category 4) (stereo) in " + label).c_str(),2);
2085  }
2087  stereoandmatchedMEs.meResolxMFClusterwidthProfileCategory1Sas = bookMEProfile(ibooker,"TProfResolxMFClusterwidthProfileCategory1Sas",hidmanager.createHistoLayer("ResolxMF_Cluster_width_Profile_Category1_Sas","layer",label,"").c_str() ,"Profile of Resolution in MF vs cluster width (Category 1) (stereo)");
2088  stereoandmatchedMEs.meResolxMFClusterwidthProfileCategory1Sas->setAxisTitle(("cluster width (Category 1) (stereo) in " + label).c_str(),1);
2089  stereoandmatchedMEs.meResolxMFClusterwidthProfileCategory1Sas->setAxisTitle((" Resolution in MF (Category 1) (stereo) in " + label).c_str(),2);
2090  }
2092  stereoandmatchedMEs.meResolxMFAngleProfileSas = bookMEProfile(ibooker,"TProfResolxMFAngleProfileSas",hidmanager.createHistoLayer("ResolxMF_Angle_Profile_Sas","layer",label,"").c_str() ,"Profile of Resolution in MF vs track angle (stereo)");
2093  stereoandmatchedMEs.meResolxMFAngleProfileSas->setAxisTitle(("track angle (stereo) in " + label).c_str(),1);
2094  stereoandmatchedMEs.meResolxMFAngleProfileSas->setAxisTitle(("Resolution in MF (stereo) in " + label).c_str(),2);
2095  }
2096  //PosxMatched
2098  stereoandmatchedMEs.mePosxMatched = bookME1D(ibooker,"TH1PosxMatched", hidmanager.createHistoLayer("Posx_matched","layer",label,"").c_str() ,"RecHit x coord.");
2099  stereoandmatchedMEs.mePosxMatched->setAxisTitle(("x coord. matched RecHit (local frame) in " + label).c_str());
2100  }
2101  //PosyMatched
2103  stereoandmatchedMEs.mePosyMatched = bookME1D(ibooker,"TH1PosyMatched", hidmanager.createHistoLayer("Posy_matched","layer",label,"").c_str() ,"RecHit y coord.");
2104  stereoandmatchedMEs.mePosyMatched->setAxisTitle(("y coord. matched RecHit (local frame) in " + label).c_str());
2105  }
2106  //ResolxMatched
2108  stereoandmatchedMEs.meResolxMatched = bookME1D(ibooker,"TH1ResolxMatched", hidmanager.createHistoLayer("Resolx_matched","layer",label,"").c_str() ,"RecHit resol(x) coord.");
2109  stereoandmatchedMEs.meResolxMatched->setAxisTitle(("resol(x) coord. matched RecHit (local frame) in " + label).c_str());
2110  }
2111  //ResolyMatched
2113  stereoandmatchedMEs.meResolyMatched = bookME1D(ibooker,"TH1ResolyMatched", hidmanager.createHistoLayer("Resoly_matched","layer",label,"").c_str() ,"RecHit resol(y) coord.");
2114  stereoandmatchedMEs.meResolyMatched->setAxisTitle(("resol(y) coord. matched RecHit (local frame) in " + label).c_str());
2115  }
2116  //ResxMatched
2118  stereoandmatchedMEs.meResxMatched = bookME1D(ibooker,"TH1ResxMatched", hidmanager.createHistoLayer("Resx_matched","layer",label,"").c_str() ,"Residual of the hit x coord.");
2119  stereoandmatchedMEs.meResxMatched->setAxisTitle(("Residuals(x) in matched RecHit in " + label).c_str());
2120  }
2121  //ResyMatched
2123  stereoandmatchedMEs.meResyMatched = bookME1D(ibooker,"TH1ResyMatched", hidmanager.createHistoLayer("Resy_matched","layer",label,"").c_str() ,"Residual of the hit x coord.");
2124  stereoandmatchedMEs.meResyMatched->setAxisTitle(("Res(y) in matched RecHit in " + label).c_str());
2125  }
2126 
2127  StereoAndMatchedMEsMap[label]=stereoandmatchedMEs;
2128 
2129 }
2130 //------------------------------------------------------------------------------------------
2131 MonitorElement* SiStripTrackingRecHitsValid::bookME1D(DQMStore::IBooker & ibooker,const char* ParameterSetLabel, const char* HistoName, const char* HistoTitle)
2132 {
2133  Parameters = conf_.getParameter<edm::ParameterSet>(ParameterSetLabel);
2134  return ibooker.book1D(HistoName,HistoTitle,
2135  Parameters.getParameter<int32_t>("Nbinx"),
2136  Parameters.getParameter<double>("xmin"),
2137  Parameters.getParameter<double>("xmax")
2138  );
2139 }
2140 //------------------------------------------------------------------------------------------
2141 MonitorElement* SiStripTrackingRecHitsValid::bookMEProfile(DQMStore::IBooker & ibooker,const char* ParameterSetLabel, const char* HistoName, const char* HistoTitle)
2142 {
2143  Parameters = conf_.getParameter<edm::ParameterSet>(ParameterSetLabel);
2144  //The number of channels in Y is disregarded in a profile plot.
2145  return ibooker.bookProfile(HistoName,HistoTitle,
2146  Parameters.getParameter<int32_t>("Nbinx"),
2147  Parameters.getParameter<double>("xmin"),
2148  Parameters.getParameter<double>("xmax"),
2149  Parameters.getParameter<double>("ymin"),
2150  Parameters.getParameter<double>("ymax"),
2151  ""
2152  );
2153 }
2154 
2155 // DEFINE_FWK_MODULE(SiStripTrackingRecHitsValid);
RunNumber_t run() const
Definition: EventID.h:39
ClusterRef cluster() const
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:114
T getParameter(std::string const &) const
SiStripTrackingRecHitsValid(const edm::ParameterSet &conf)
EventNumber_t event() const
Definition: EventID.h:41
virtual const TrackerGeomDet * idToDetUnit(DetId) const
Return the pointer to the GeomDetUnit corresponding to a given DetId.
edm::ESHandle< SiStripDetCabling > SiStripDetCabling_
float xx() const
Definition: LocalError.h:24
void rechitanalysis(TrajectoryStateOnSurface tsos, const TransientTrackingRecHit::ConstRecHitPointer thit, const StripGeomDetUnit *stripdet, edm::ESHandle< StripClusterParameterEstimator > stripcpe, TrackerHitAssociator &associate, bool simplehit1or2D)
void setSiStripFolderName(std::string name)
virtual float stripAngle(float strip) const =0
const GeomDetUnit * monoDet() const
Definition: GluedGeomDet.h:20
std::map< std::string, StereoAndMatchedMEs > StereoAndMatchedMEsMap
bool tobIsStereo(const DetId &id) const
MonitorElement * bookME1D(DQMStore::IBooker &ibooker, const char *ParameterSetLabel, const char *HistoName, const char *HistoTitle)
MonitorElement * bookProfile(Args &&...args)
Definition: DQMStore.h:157
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:449
void fillME(MonitorElement *ME, float value1)
LocalVector localDirection() const
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:52
std::vector< RecHitProperties > rechitstereo
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
edm::EDGetTokenT< std::vector< Trajectory > > trajectoryInputToken_
LocalVector drift(const StripGeomDetUnit *, const MagneticField &, const SiStripLorentzAngle &)
Definition: ShallowTools.cc:39
tuple magfield
Definition: HLT_ES_cff.py:2311
void rechitanalysis_matched(TrajectoryStateOnSurface tsos, const TransientTrackingRecHit::ConstRecHitPointer thit, const GluedGeomDet *gluedDet, TrackerHitAssociator &associate, edm::ESHandle< StripClusterParameterEstimator > stripcpe, std::string matchedmonorstereo)
T y() const
Definition: PV3DBase.h:63
std::map< std::string, LayerMEs > LayerMEsMap
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:67
std::pair< std::string, int32_t > GetSubDetAndLayer(const uint32_t &detid, const TrackerTopology *tTopo, bool ring_flag=0)
const Bounds & bounds() const
Definition: Surface.h:128
void createLayerMEs(DQMStore::IBooker &ibooker, std::string label)
virtual const StripTopology & specificTopology() const
Returns a reference to the strip proxy topology.
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:40
bool tidIsStereo(const DetId &id) const
virtual float strip(const LocalPoint &) const =0
T transverse() const
Definition: PV3DBase.h:73
virtual float thickness() const =0
bool tecIsStereo(const DetId &id) const
virtual float localPitch(const LocalPoint &) const =0
virtual LocalError localPositionError() const
float xy() const
Definition: LocalError.h:25
void createSimpleHitsMEs(DQMStore::IBooker &ibooker)
virtual MeasurementError measurementError(const LocalPoint &, const LocalError &) const =0
std::vector< RecHitProperties > rechitmatched
void getTOBDetectors(const std::vector< uint32_t > &inputDetRawIds, std::vector< uint32_t > &tobDetRawIds, uint32_t layer=0, uint32_t bkw_frw=0, uint32_t rod=0) const
float yy() const
Definition: LocalError.h:26
Local3DPoint localPosition() const
Definition: PSimHit.h:44
std::shared_ptr< TrackingRecHit const > ConstRecHitPointer
T sqrt(T t)
Definition: SSEVec.h:48
T z() const
Definition: PV3DBase.h:64
void bookHistograms(DQMStore::IBooker &ibooker, const edm::Run &run, const edm::EventSetup &es)
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
float uu() const
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
virtual const Topology & topology() const override
Returns a reference to the strip proxy topology.
std::vector< RecHitProperties > rechitrphi
ClusterRef cluster() const
virtual MeasurementPoint measurementPosition(const LocalPoint &) const =0
T min(T a, T b)
Definition: MathUtil.h:58
virtual void analyze(const edm::Event &e, const edm::EventSetup &c)
std::string getSubdetid(uint32_t id, const TrackerTopology *tTopo, bool flag_ring)
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
void createMEs(DQMStore::IBooker &ibooker, const edm::EventSetup &es)
DQMStore * dbe_
std::pair< LocalPoint, LocalVector > projectHit(const PSimHit &hit, const StripGeomDetUnit *stripDet, const BoundPlane &plane)
MonitorElement * bookMEProfile(DQMStore::IBooker &ibooker, const char *ParameterSetLabel, const char *HistoName, const char *HistoTitle)
LocalVector localDirection() const
Obsolete. Same as momentumAtEntry().unit(), for backward compatibility.
Definition: PSimHit.h:52
Definition: DetId.h:18
unsigned int stereo() const
stereo
virtual TrackingRecHit const * hit() const
void setLayerFolder(uint32_t rawdetid, const TrackerTopology *tTopo, int32_t layer=0, bool ring_flag=0)
SiStripRecHit2D stereoHit() const
virtual LocalError localPositionError() const =0
const T & get() const
Definition: EventSetup.h:55
bool tibIsStereo(const DetId &id) const
T const * product() const
Definition: ESHandle.h:86
void createStereoAndMatchedMEs(DQMStore::IBooker &ibooker, std::string label)
std::string HistoName
void getTECDetectors(const std::vector< uint32_t > &inputDetRawIds, std::vector< uint32_t > &tecDetRawIds, uint32_t side=0, uint32_t wheel=0, uint32_t petal_bkw_frw=0, uint32_t petal=0, uint32_t ring=0, uint32_t ster=0) const
SiStripRecHit2D monoHit() const
T eta() const
Definition: PV3DBase.h:76
edm::EventID id() const
Definition: EventBase.h:60
static int position[264][3]
Definition: ReadPGInfo.cc:509
void getTIBDetectors(const std::vector< uint32_t > &inputDetRawIds, std::vector< uint32_t > &tibDetRawIds, uint32_t layer=0, uint32_t bkw_frw=0, uint32_t int_ext=0, uint32_t string=0) const
std::vector< PSimHit > associateHit(const TrackingRecHit &thit) const
std::map< std::string, std::vector< uint32_t > > StereoAndMatchedDetMap
void getTIDDetectors(const std::vector< uint32_t > &inputDetRawIds, std::vector< uint32_t > &tidDetRawIds, uint32_t side=0, uint32_t wheel=0, uint32_t ring=0, uint32_t ster=0) const
DetId geographicalId() const
dbl *** dir
Definition: mlp_gen.cc:35
Definition: DDAxes.h:10
std::string createHistoLayer(std::string description, std::string id_type, std::string path, std::string flag)
std::map< std::string, std::vector< uint32_t > > LayerDetMap
T x() const
Definition: PV2DBase.h:45
T x() const
Definition: PV3DBase.h:62
virtual LocalPoint localPosition() const =0
virtual LocalPoint localPosition() const
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
const GeomDetUnit * stereoDet() const
Definition: GluedGeomDet.h:21
Definition: Run.h:41
GlobalVector globalDirection() const
void beginJob(const edm::EventSetup &es)
virtual const TrackerGeomDet * idToDet(DetId) const