-
Notifications
You must be signed in to change notification settings - Fork 0
/
instructions.htm
431 lines (411 loc) · 17.3 KB
/
instructions.htm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
<html>
<head>
<title>Track Splitting Instructions</title>
</head>
<body>
<h1>Introduction</h1>
<p>The track splitting validation is a validation tool that
splits cosmic tracks in half and separately reconstructs three tracks:
the original track and the two
halves. This makes it possible to determine differences between the two
tracks in various parameters, which may detect misalignments that would
not be as obvious
from other types of validations.</p>
<p>The validation is run through the All-In-One validation tool.
The validation produces a ROOT file containing a tree, which can then
be used to make different
plots.</p>
<h1>Quick Start</h1>
<h2>Run the validation</h2>
<p>Run the validation using the All-In-One tool. The track
splitting validation's parameters are the same as several other
validations, like offline or Z->μμ
Here is a sample ini file:</p>
<p><code>
[general] <br>
jobmode = lxBatch,-q cmscaf1nh <br>
datadir =
/afs/cern.ch/cms/CAF/CMSALCA/ALCA_TRACKERALIGN/data/commonValidation/results/$USER/
<br>
logdir =
/afs/cern.ch/cms/CAF/CMSALCA/ALCA_TRACKERALIGN/data/commonValidation/results/$USER/
<br>
<br>
[alignment:prompt] <br>
globaltag = GR_P_V32::All <br>
color = 1 <br>
style = 1 <br>
<br>
[alignment:rereco] <br>
globaltag = GR_R_53_V20::All <br>
color = 2 <br>
style = 2 <br>
<br>
[split:2012B] <br>
maxevents = -1 <br>
dataset = /Cosmics/Run2012B-TkAlCosmics0T-v1/ALCARECO <br>
trackcollection = ALCARECOTkAlCosmicsCTF0T <br>
<br>
[validation] <br>
split 2012B: prompt <br>
split 2012B: rereco <br>
</code></p>
<p>The most important parameters are the dataset and the global tag. The dataset can be copied from the spreadsheets in pages like <a
href=https://twiki.cern.ch/twiki/bin/viewauth/CMS/TrackerAlignment2012>here</a> or <a
href=https://twiki.cern.ch/twiki/bin/viewauth/CMS/TrackerAlignment2011>here</a>. The global tag is usually listed for the 2012 data, but not for
the 2011.</p>
<p>Run the validation using:</p>
<p><code>validateAlignments.py -c myfile.ini -N
validationname</code></p>
<p>The -N option is important because otherwise the validation
name is alignmentValidation_yymmdd_hhmmss, making it difficult to
identify the directories later.
The results of the validation will be stored in three places:
</p>
<ol>
<li>The scripts and cfgs used to run the validation are in
(directory where validateAlignments.py was run)/validationname</li>
<li>The logfiles are in logdir/validationname</li>
<li>The root files are on eos, in
/store/caf/user/$USER/AlignmentValidation/validationname</li>
</ol>
<h2>Make plots</h2>
<p>Copy the file makeThesePlots.C into a convenient directory.
Edit it and fill in the blanks, which are indicated by 5 dashes:
</p>
<ul>
<li>Directory of track splitting code</li>
<li>Number of files</li>
<li>Validation name, split name, alignment name - for each root
file to be included in the plots. The validation name is indicated by
including "-N name"
after validateAlignments.py, and the split and alignment names are in
the section headers of the ini file.</li>
<li>Name1, name2 - these are the names to be used in the legend.</li>
<li>Directory to save plots</li>
</ul>
Then open root in batch mode, and compile and execute the code:
<p><code>root -l -b <br>
.x makeThesePlots.C+<br>
</code></p>
<p>This will create 313 plots in the directory specified. The plots will each be saved as png, eps, and root, so that they
can be used for various purposes.</p>
<p>It is possible to run makeThesePlots.C even before the validation is finished. It will check every minute to see whether all the files exist, and start making
plots when they do. It will wait up to 24 hours, which should be more than adequate in almost every case.</p>
<p>There are also two other versions of <code>makeThesePlots()</code>,
so that you can make specific plots rather than all of them.</p>
<code>makeThesePlots(Tstring xvar,TString yvar)</code>
allows you to specify which variables to make the plots with.
The choices for <code>xvar</code> are:<br>
<ul>
<li>"pt"</li>
<li>"eta"</li>
<li>"phi"</li>
<li>"dz"</li>
<li>"dxy"</li>
<li>"theta"</li>
<li>"qoverpt"</li>
<li>"runNumber"</li>
<li>"nHits"</li>
<li>"" - make a histogram of the y variable</li>
<li>"all" - make plots with any x variable</li>
</ul>
The choices for <code>yvar</code> are:<br>
<ul>
<li>"ptrel" - Δp<sub>T</sub>/(p<sub>T</sub>)<sub>org</sub></li>
<li>"pt" - Δp<sub>T</sub></li>
<li>"eta"</li>
<li>"phi"</li>
<li>"dz"</li>
<li>"dxy"</li>
<li>"theta"</li>
<li>"qoverpt"</li>
<li>"" - make a histogram of the x variable</li>
<li>"all" - make plots with any y variable</li>
</ul>
makeThesePlots("all","all") is equivalent to makeThesePlots().
At the other extreme, makeThesePlots("","") will do nothing,
since there is no variable to use in the plots.<br>
<br>
The third version gives you even more complete control over what plots
to make using a matrix of bools. The format of the matrix is:<br>
<table style="text-align: left; width: 100%;" border="1"
cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="background-color: rgb(255, 102, 102);">x
variable</td>
<td style="background-color: rgb(51, 102, 255);">y
variable</td>
<td style="background-color: rgb(51, 102, 255);">ptrel</td>
<td style="background-color: rgb(51, 102, 255);">pt</td>
<td style="background-color: rgb(51, 102, 255);">eta</td>
<td style="background-color: rgb(51, 102, 255);">phi</td>
<td style="background-color: rgb(51, 102, 255);">dz</td>
<td style="background-color: rgb(51, 102, 255);">dxy</td>
<td style="background-color: rgb(51, 102, 255);">theta</td>
<td style="background-color: rgb(51, 102, 255);">qoverpt</td>
<td style="background-color: rgb(51, 102, 255);">(histogram)</td>
</tr>
<tr>
<td colspan="2" rowspan="1"
style="background-color: rgb(255, 102, 102);">pt</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
</tr>
<tr>
<td colspan="2" rowspan="1"
style="background-color: rgb(255, 102, 102);">eta</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
</tr>
<tr>
<td colspan="2" rowspan="1"
style="background-color: rgb(255, 102, 102);">phi</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
</tr>
<tr>
<td colspan="2" rowspan="1"
style="background-color: rgb(255, 102, 102);">dz</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
</tr>
<tr>
<td colspan="2" rowspan="1"
style="background-color: rgb(255, 102, 102);">dxy</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td style = "background-color: rgb(102, 255, 102);">true</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
</tr>
<tr>
<td colspan="2" rowspan="1"
style="background-color: rgb(255, 102, 102);">theta</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
</tr>
<tr>
<td colspan="2" rowspan="1"
style="background-color: rgb(255, 102, 102);">qoverpt</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
</tr>
<tr>
<td colspan="2" rowspan="1"
style="background-color: rgb(255, 102, 102);">runNumber</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
</tr>
<tr>
<td colspan="2" rowspan="1"
style="background-color: rgb(255, 102, 102);">nHits</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
</tr>
<tr>
<td colspan="2" rowspan="1"
style="background-color: rgb(255, 102, 102);">(histogram)</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td style = "background-color: rgb(102, 255, 102);">true</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td>false</td>
<td style = "background-color: rgb(255,0,255);">false</td>
</tr>
</tbody>
</table>
<ul>
</ul>
<p>The matrix above, for example would be created by: <br>
<code>bool matrix[10][9]; <br>
for (int x = 0; x < 10; x++) <br>
for (int y = 0; y < 9;
y++) <br>
matrix[x][y]
= false; <br>
matrix[4][3] = true; <br>
matrix[9][3] = true;<br>
</code>
and would make plots of dxy<sub>org</sub>-Δφ and histograms of Δφ.
This would be a total of 6 plots: the regular and pull histograms of Δφ, and their mean and width as a function of dxy<sub>org</sub>.
</p>
<p>The cell indicated in pink has no effect, since there are no plots that have no x or y variable.</p>
<p>The easiest way to view the plots is on a webpage with 4 plots
per line. A convenient webpage script, with filters specifically
designed for the track
splitting plots, is available at <code>/afs/cern.ch/user/h/hroskes/public/trackSplitting/indexforplots.php</code></p>
<p>Some example plots can be found <a
href="https://hroskes.web.cern.ch/hroskes/2011plots/1321/">here</a>.</p>
<h1>More specific plots</h1>
<p>It is also possible to use trackSplitPlot directly to make individual plots, saved with any name. However, it requires slightly more input.</p>
<code>TCanvas *trackSplitPlot(Int_t nFiles,TString *files,TString *names,TString xvar,TString yvar, <br>
Bool_t relative = false,Bool_t resolution = false,Bool_t pull = false, <br>
TString saveas = "")</code>
<table style="text-align: left; width: 100%;" border="1" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td>Parameter</td>
<td>Explanation</td>
<td>Other Information</td>
<tr>
<td>nFiles</td>
<td>The number of files used in the plots. The files should have been produced by CosmicSplitterValidation.cc</td>
<td>If nFiles <= 0, then a scatterplot will be made using the first file in files, unless xvar or yvar = "", in which case nFiles <= 0 is the same as
nFiles = 1</td>
</tr>
<tr>
<td>files</td>
<td>The filenames of the data files (produced by the validation)</td>
<td></td>
</tr>
<tr>
<td>names</td>
<td>Labels for the files, which are used in the legend</td>
<td></td>
</tr>
<tr>
<td>xvar</td>
<td>The x variable (chosen from the list above)</td>
<td>Use xvar = "" to instead make a histogram of Δyvar</td>
</tr>
<tr>
<td>yvar</td>
<td>The y variable (chosen from the list above)</td>
<td>Use yvar = "" to instead make a histogram of xvar<sub>org</sub>. If xvar = yvar = "", nothing will happen.</td>
</tr>
<tr>
<td>relative</td>
<td>If this is true, Δyvar/yvar<sub>org</sub> is used as the y variable, instead of just Δyvar.</td>
<td>This is most useful for yvar = "pt", because for most of the other variables, the zero of yvar<sub>org</sub> is arbitrary. If yvar = "", this has no
effect.</td>
</tr>
<tr>
<td>resolution</td>
<td>If this is true, it will plot the RMS of Δyvar as a function of xvar<sub>org</sub>.</td>
<td>This has no effect if xvar or yvar = "", or if nFiles <= 0.</td>
</tr>
<tr>
<td>pull</td>
<td>If this is true, it will use Δyvar/δ(Δyvar) as the y variable, instead of just Δyvar.</td>
<td>This has no effect if xvar = "". If relative and pull are both true, relative is applied first, and so the y variable comes out to be
Δy/y<sub>org</sub>/δ(Δy/y<sub>org</sub>). However, if Δy/y<sub>org</sub><<1 (as it should be), this simplifies to be almost
exactly the same as pull without relative, and the plots are essentially identical.</td>
</tr>
<tr>
<td>saveas</td>
<td>Filename to save the resulting plot</td>
<td>If the filename ends with .pngepsroot, the plot will be saved three times, as .png, .eps, and .root. For example, if saveas="plots/plot.pngepsroot", it
will save it as plots/plot.png, plots/plot.eps, and plots/plot.root.
</tbody>
</table>
<h1>Misalignments</h1>
<p>The track splitting tool can be used to discover systematic misalignments in geometries.</p>
<h2>Creating misaligned geometries</h2>
<p>The first step is to look at Monte Carlo data with the particular misalignment you are looking at. Instructions on how to produce systematic misalignments can
be found <a href="https://twiki.cern.ch/twiki/bin/viewauth/CMS/SWGuideTkAlignmentHowto#Systematic_Misalignment">here</a>, and a description of the different
misalignments is <a href="https://twiki.cern.ch/twiki/bin/viewauth/CMS/SystematicMisalignmentsofTracker">here</a>.
<p>To use this misaligned geometry in the validation, add these lines into your ini file:</p>
<code>condition TrackerAlignmentRcd sqlite_file:-----file produced by testProduceSystematicMisalignment_cfg.py-----.db, Alignments <br>
condition TrackerAlignmentErrorRcd sqlite_file:-----file produced by testProduceSystematicMisalignment_cfg.py-----.db, AlignmentErrors</code>
<h2>Misalignment plots</h2>
<p>The easiest way to make misalignment plots is to use makeThesePlots.C. In each of the three functions there, when it calls
<code>makePlots(nFiles,files,names,"",0,plotsdirectory...)</code>, the fourth and fifth arguments are used for misalignments. Replace "" with the name of the
misalignment you want to measure (for example, "sagitta" or "elliptical"). If you are analyzing real data, leave 0 in place. However, if you are using
misaligned Monte Carlo and know the magnitude of the misalignments, replace 0 with values and add this line near the top of makeThesePlots.C:</p>
<code>Double_t values[nFiles] = { ... }</code>
<p>Similar to names, values gives the magnitude of the misalignment for each file in files. List these values inside the array. They should be the same numbers
you used in testProduceSystematicMisalignment_cfg.py to make the misalignment.</p>
<p>There will now be up to three new types of plots made:</p>
<ul>
<li>If you put values in, additional plots will be created called profile.[misalignment name].Delta_[yvar] and resolution.[misalignment name].Delta_[yvar].
They show the mean and width of Δyvar as a function of the misalignment.</li>
<li>If you put the misalignment name in, depending on what it is, you may get plots in a subdirectory called fits that have certain plots fitted to a function
that can be used to estimate the magnitude of the misalignment. In the legend, you will see the equation that was fit, as well as the parameter value and
error for each file. These functions, and which plots they are relevant for are defined towards the bottom of misalignmentDependence.C; you can add more
there.</li>
<li>If you put both the misalignment name and the values, you will also get plots that show this parameter's value as a function of the misalignment magnitude,
which can be used to determine the misalignment magnitude in real data that has been fit.</li>
</ul>
<p>More information can be found in the comments at the top of misalignmentDependence.C.</p>
<h1>Run number</h1>
<p>If there seems to be something wrong with certain runs, you can limit the data used to make plots to those runs. Global variables called minrun and maxrun are
defined at the top of axislimits.C. By default, they are -1, meaning no limit. You can add lines to makeThesePlots.C to modify these variables in order to only
look at certain runs.</p>
<p>Additionally, you can use runNumberZoomed.C:</p>
<code>
void runNumberZoomed(Int_t nFiles,TString *files,TString *names,TString yvar, <br>
Bool_t relative = false,Bool_t resolution = false,Bool_t pull = false, <br>
Int_t firstRun = -1,Int_t lastRun = -1,TString saveas = "")
</code>
<p>Most of the parameters are as described earlier. firstrun and lastrun are the first and last runs to use. The advantage of this function is that it zooms in
so that each bin refers to exactly one run. The lower and upper edges of the x axis may not be firstRun and lastRun, because there may not be events in every
run.</p>