bug fixed
[u/mrichter/AliRoot.git] / MUON / AliMUONMchViewApplication.cxx
CommitLineData
bf4d93eb 1/**************************************************************************
2* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3* *
4* Author: The ALICE Off-line Project. *
5* Contributors are mentioned in the code where appropriate. *
6* *
7* Permission to use, copy, modify and distribute this software and its *
8* documentation strictly for non-commercial purposes is hereby granted *
9* without fee, provided that the above copyright notice appears in all *
10* copies and that both the copyright notice and this permission notice *
11* appear in the supporting documentation. The authors make no claims *
12* about the suitability of this software for any purpose. It is *
13* provided "as is" without express or implied warranty. *
14**************************************************************************/
15
16// $Id$
17
90037e4e 18#include "AliMUONMchViewApplication.h"
19
20#include "AliCDBManager.h"
21#include "AliCodeTimer.h"
22#include "AliLog.h"
fef32488 23#include "AliMUONChamberPainter.h"
24#include "AliMUONDEPainter.h"
8f0acce4 25#include "AliMUONPainterDataRegistry.h"
90037e4e 26#include "AliMUONPainterDataSourceFrame.h"
49419555 27#include "AliMUONPainterEnv.h"
90037e4e 28#include "AliMUONPainterHelper.h"
fcabdc0c 29#include "AliMUONPainterGroup.h"
90037e4e 30#include "AliMUONPainterMasterFrame.h"
fcabdc0c 31#include "AliMUONPainterMatrix.h"
90037e4e 32#include "AliMUONPainterRegistry.h"
49419555 33#include "AliMUONTrackerDataCompareDialog.h"
34#include "AliMUONTrackerDataWrapper.h"
90037e4e 35#include "AliMUONVTrackerData.h"
49419555 36#include "AliMUONVTrackerDataMaker.h"
90037e4e 37#include <Riostream.h>
38#include <TCanvas.h>
39#include <TEnv.h>
40#include <TFile.h>
41#include <TGClient.h>
42#include <TGFileDialog.h>
43#include <TGMenu.h>
44#include <TGTab.h>
49419555 45#include <TGTextView.h>
46#include <TGrid.h>
90037e4e 47#include <TKey.h>
48#include <TList.h>
49419555 49#include <TRegexp.h>
90037e4e 50#include <TString.h>
51#include <TSystem.h>
52
53/// \class AliMUONMchViewApplication
54///
55/// Main class for the mchview program
56///
57///\author Laurent Aphecetche, Subatech
58
59/// \cond CLASSIMP
60ClassImp(AliMUONMchViewApplication)
61/// \endcond CLASSIMP
62
63const Int_t AliMUONMchViewApplication::fgkFILESAVEAS(1);
64const Int_t AliMUONMchViewApplication::fgkFILEOPEN(2);
65const Int_t AliMUONMchViewApplication::fgkFILEEXIT(3);
10eb3d17 66const Int_t AliMUONMchViewApplication::fgkFILEPRINTAS(4);
49419555 67const Int_t AliMUONMchViewApplication::fgkABOUT(5);
68const Int_t AliMUONMchViewApplication::fgkCOMPAREDATA(6);
10eb3d17 69
70const char* AliMUONMchViewApplication::fgkFileTypes[] = {
71 "ROOT files", "*.root",
72 "All files", "*",
73 0, 0 };
90037e4e 74
75//______________________________________________________________________________
76AliMUONMchViewApplication::AliMUONMchViewApplication(const char* name,
77 int* argc, char** argv,
1ffbeb9d 78 UInt_t w, UInt_t h,
79 UInt_t ox, UInt_t oy)
90037e4e 80: TRint(name,argc,argv),
10eb3d17 81 fMainFrame(0x0),
fcabdc0c 82 fPainterMasterFrameList(new TList),
83 fTabs(0x0)
90037e4e 84{
85
86 /// ctor
1ffbeb9d 87 /// (w,h) is the size in pixel (if 0,0 it will be computed as 70%,90% of display size)
88 /// (ox,oy) is the offset from the top-left of the display
89
d2b2e698 90 if (!w || !h)
1ffbeb9d 91 {
92 w = (UInt_t)(gClient->GetDisplayWidth()*0.7);
93 h = (UInt_t)(gClient->GetDisplayHeight()*0.9);
94 }
90037e4e 95
96 fMainFrame = new TGMainFrame(gClient->GetRoot(),w,h);
fef32488 97
90037e4e 98 CreateMenuBar(w);
99
100 const Int_t kbs = 2;
101
102// h -= 60; // menubar
103
fcabdc0c 104 fTabs = new TGTab(fMainFrame,w,h);
105
106 TGCompositeFrame* t = fTabs->AddTab("Painter Master Frame");
107
108 fPainterMasterFrameList->SetOwner(kTRUE);
109
90037e4e 110
fcabdc0c 111 AliMUONPainterMasterFrame* pmf = new AliMUONPainterMasterFrame(t,t->GetWidth()-kbs*2,t->GetHeight()-kbs*2,
112 GenerateStartupMatrix());
90037e4e 113
fcabdc0c 114 fPainterMasterFrameList->Add(pmf);
90037e4e 115
fcabdc0c 116 t->AddFrame(pmf, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY,kbs,kbs,kbs,kbs));
90037e4e 117
fcabdc0c 118 t = fTabs->AddTab("Data Sources");
90037e4e 119
120 AliMUONPainterDataSourceFrame* dsf =
121 new AliMUONPainterDataSourceFrame(t,t->GetWidth()-kbs*2,t->GetHeight()-kbs*2);
122
123 t->AddFrame(dsf,new TGLayoutHints(kLHintsExpandX | kLHintsExpandY,kbs,kbs,kbs,kbs));
124
fcabdc0c 125 fMainFrame->AddFrame(fTabs,new TGLayoutHints(kLHintsExpandX | kLHintsExpandY,0,0,0,0));
90037e4e 126
127 fMainFrame->SetWindowName("mchview - Visualization of MUON Tracker detector");
128
129 fMainFrame->MapSubwindows();
130 fMainFrame->Resize();
10eb3d17 131
fcabdc0c 132 pmf->Update();
10eb3d17 133
90037e4e 134 fMainFrame->MapWindow();
135
136 fMainFrame->Connect("CloseWindow()","AliMUONMchViewApplication",this,"Terminate()");
1ffbeb9d 137
138 fMainFrame->MoveResize(ox,oy, w, h);
139 fMainFrame->SetWMPosition(ox, oy);
90037e4e 140 fMainFrame->SetWMSizeHints(w,h,w,h,0,0);
10eb3d17 141
142 cout << "***************************************************" << endl;
143 cout << " Welcome to mchview" << endl;
144 cout << " " << FullVersion() << endl;
145 cout << "***************************************************" << endl;
fef32488 146
147 // Trying to see if we're requested to draw something specific instead
148 // of the global view of all the chambers
149
150 AliMUONVPainter* painter(0x0);
151 TObjArray args;
152 args.SetOwner(kTRUE);
153
154 for ( int i = 1; i < argc[0]; ++i )
155 {
156 args.Add(new TObjString(argv[i]));
157 }
158
159 for ( Int_t i = 0; i <= args.GetLast(); ++i )
160 {
161 TString a(static_cast<TObjString*>(args.At(i))->String());
10eb3d17 162
fef32488 163 AliMUONAttPainter att;
164
165 att.SetPlane(kTRUE,kFALSE);
166 att.SetCathode(kFALSE,kFALSE);
167 att.SetViewPoint(kTRUE,kFALSE);
168
169 if ( a == "--de" )
170 {
171 Int_t detElemId = static_cast<TObjString*>(args.At(i+1))->String().Atoi();
172
173 painter = new AliMUONDEPainter(att,detElemId);
174
175 painter->SetOutlined("*",kFALSE);
176 painter->SetOutlined("BUSPATCH",kTRUE);
177
178 painter->SetLine(1,4,3);
179 ++i;
180 }
181
182 if ( a == "--chamber" )
183 {
184 Int_t chamberId = static_cast<TObjString*>(args.At(i+1))->String().Atoi();
185
186 painter = new AliMUONChamberPainter(att,chamberId-1);
187
188 painter->SetOutlined("*",kFALSE);
189 painter->SetOutlined("DE",kTRUE);
190
191 painter->SetLine(1,4,3);
192 ++i;
193 }
194
195 }
196
197 if ( painter )
198 {
fcabdc0c 199 pmf->ShiftClicked(painter,0x0);
fef32488 200
fcabdc0c 201 pmf->Update();
fef32488 202 }
203
90037e4e 204}
205
206//______________________________________________________________________________
207AliMUONMchViewApplication::~AliMUONMchViewApplication()
208{
209 /// dtor
fcabdc0c 210 delete fPainterMasterFrameList;
211}
212
213//_____________________________________________________________________________
214AliMUONPainterMatrix*
215AliMUONMchViewApplication::GenerateStartupMatrix()
216{
217 /// Kind of bootstrap method to trigger the generation of all contours
218
219 AliCodeTimerAuto("",0);
220
221 AliMUONAttPainter att;
222
223 att.SetViewPoint(kTRUE,kFALSE);
224 att.SetCathode(kFALSE,kFALSE);
225 att.SetPlane(kTRUE,kFALSE);
226
227 AliMUONPainterMatrix* matrix = new AliMUONPainterMatrix("Tracker",5,2);
228
229 for ( Int_t i = 0; i < 10; ++i )
230 {
231 AliMUONVPainter* painter = new AliMUONChamberPainter(att,i);
232
233 painter->SetResponder("Chamber");
234
235 painter->SetOutlined("*",kFALSE);
236
237 painter->SetOutlined("MANU",kTRUE);
238
239 for ( Int_t j = 0; j < 3; ++j )
240 {
241 painter->SetLine(j,1,4-j);
242 }
243
244 matrix->Adopt(painter);
245 }
246 AliMUONPainterRegistry::Instance()->Register(matrix);
247 return matrix;
90037e4e 248}
249
250//______________________________________________________________________________
251void
49419555 252AliMUONMchViewApplication::CompareData()
253{
254 /// Launch compare data dialog
255 TGTransientFrame* t = new AliMUONTrackerDataCompareDialog(gClient->GetRoot(),
256 gClient->GetRoot(),
257 400,400);
258
259 t->MapSubwindows();
260 t->Resize();
261 t->MapWindow();
262 t->CenterOnParent();
263
264 // set names
265
266 t->SetWindowName("mchview compare data tool");
267 t->SetIconName("mchview compare data tool");
268
fcabdc0c 269 t->MapRaised();
49419555 270}
271
272//______________________________________________________________________________
273void
90037e4e 274AliMUONMchViewApplication::CreateMenuBar(UInt_t w)
275{
276 /// Create the application menu bar
277
278 TGPopupMenu* file = new TGPopupMenu(gClient->GetRoot());
279
280 file->AddEntry("&Open...",fgkFILEOPEN);
281 file->AddEntry("&Save As...",fgkFILESAVEAS);
10eb3d17 282 file->AddEntry("&Print As...",fgkFILEPRINTAS);
90037e4e 283 file->AddEntry("&Exit",fgkFILEEXIT);
284
90037e4e 285 TGMenuBar* bar = new TGMenuBar(fMainFrame,w);
286
49419555 287 TGPopupMenu* tools = new TGPopupMenu(gClient->GetRoot());
288 tools->AddEntry("&Compare data",fgkCOMPAREDATA);
289
10eb3d17 290 TGPopupMenu* about = new TGPopupMenu(gClient->GetRoot());
49419555 291 about->AddEntry(FullVersion(),fgkABOUT);
10eb3d17 292
49419555 293 file->Connect("Activated(Int_t)","AliMUONMchViewApplication",this,"HandleMenu(Int_t)");
294 about->Connect("Activated(Int_t)","AliMUONMchViewApplication",this,"HandleMenu(Int_t)");
295 tools->Connect("Activated(Int_t)","AliMUONMchViewApplication",this,"HandleMenu(Int_t)");
296
90037e4e 297 bar->AddPopup("&File",file,new TGLayoutHints(kLHintsLeft|kLHintsTop));
49419555 298 bar->AddPopup("&Tools",tools,new TGLayoutHints(kLHintsLeft|kLHintsTop));
10eb3d17 299 bar->AddPopup("&About",about,new TGLayoutHints(kLHintsRight|kLHintsTop));
90037e4e 300
301 fMainFrame->AddFrame(bar,new TGLayoutHints(kLHintsLeft|kLHintsExpandX));
302
303 AliMUONPainterRegistry::Instance()->SetMenuBar(bar);
304}
305
306//______________________________________________________________________________
307void
308AliMUONMchViewApplication::HandleMenu(Int_t i)
309{
310 /// Handle the click of one menu item
311
312 switch (i)
313 {
314 case fgkFILEEXIT:
315 Terminate(1);
316 break;
317 case fgkFILEOPEN:
318 Open();
319 break;
320 case fgkFILESAVEAS:
321 Save();
322 break;
10eb3d17 323 case fgkFILEPRINTAS:
324 PrintAs();
325 break;
49419555 326 case fgkABOUT:
327 ReleaseNotes();
328 break;
329 case fgkCOMPAREDATA:
330 CompareData();
331 break;
90037e4e 332 default:
333 break;
334 }
335}
336
337//______________________________________________________________________________
338void
339AliMUONMchViewApplication::Open()
340{
341 /// Open file dialog
342
343 TGFileInfo fileInfo;
344
10eb3d17 345 fileInfo.fFileTypes = fgkFileTypes;
346
49419555 347 delete[] fileInfo.fIniDir;
348
349 AliMUONPainterEnv* env = AliMUONPainterHelper::Instance()->Env();
350
351 fileInfo.fIniDir = StrDup(env->String("LastOpenDir","."));
352
90037e4e 353 new TGFileDialog(gClient->GetRoot(),gClient->GetRoot(),
354 kFDOpen,&fileInfo);
49419555 355
356 env->Set("LastOpenDir",fileInfo.fIniDir);
357 env->Save();
358
90037e4e 359 Open(gSystem->ExpandPathName(Form("%s",fileInfo.fFilename)));
360}
361
362//______________________________________________________________________________
363void
364AliMUONMchViewApplication::Open(const char* filename)
365{
49419555 366 /// Open a given file containing saved VTrackerDataMaker objects
90037e4e 367
49419555 368 TString sfilename(gSystem->ExpandPathName(filename));
90037e4e 369
49419555 370 if ( sfilename.Contains(TRegexp("^alien")) )
371 {
372 // insure we've initialized the grid...
373 if (!gGrid)
374 {
375 TGrid::Connect("alien://");
376 }
377 }
378
379 TFile* f = TFile::Open(filename);
380
632a2059 381 ReadDir(*f);
382
383 delete f;
384}
385
386//______________________________________________________________________________
387void
388AliMUONMchViewApplication::ReadDir(TDirectory& dir)
389{
72dae9ff 390 /// Read the given directory and import VTrackerData objects found
391
632a2059 392 TList* keys = dir.GetListOfKeys();
90037e4e 393 TIter next(keys);
394
395 TKey* k;
396
397 while ( ( k = static_cast<TKey*>(next()) ) )
398 {
399 TObject* object = k->ReadObj();
49419555 400
632a2059 401 if ( object->InheritsFrom("TDirectory") )
402 {
403 TDirectory* d = static_cast<TDirectory*>(object);
404 ReadDir(*d);
405 continue;
406 }
407
49419555 408 if ( object->InheritsFrom("AliMUONVTrackerDataMaker") )
409 {
410 AliMUONVTrackerDataMaker* maker = dynamic_cast<AliMUONVTrackerDataMaker*>(object);
411 if ( maker )
412 {
8f0acce4 413 AliMUONPainterDataRegistry::Instance()->Register(maker);
49419555 414 }
415 }
90037e4e 416
417 if ( object->InheritsFrom("AliMUONVTrackerData") )
418 {
49419555 419 // this is for backward compatibility. Early versions of mchview
420 // wrote VTrackerData objects, and not VTrackerDataMaker ones.
421
422 AliMUONVTrackerData* data = dynamic_cast<AliMUONVTrackerData*>(object);
90037e4e 423 if ( data )
424 {
49419555 425 AliMUONVTrackerDataMaker* maker = new AliMUONTrackerDataWrapper(data);
8f0acce4 426 AliMUONPainterDataRegistry::Instance()->Register(maker);
90037e4e 427 }
428 }
429 }
49419555 430
90037e4e 431}
432
90037e4e 433//______________________________________________________________________________
434void
10eb3d17 435AliMUONMchViewApplication::PrintAs()
436{
437 /// Print as...
438
439 TGFileInfo fileInfo;
440
441 new TGFileDialog(gClient->GetRoot(),gClient->GetRoot(),
442 kFDSave,&fileInfo);
443
fcabdc0c 444 TIter next(fPainterMasterFrameList);
445 AliMUONPainterMasterFrame* pmf;
446 Bool_t first(kTRUE);
447
448 while ( ( pmf = static_cast<AliMUONPainterMasterFrame*>(next()) ) )
449 {
450 pmf->SaveAs(gSystem->ExpandPathName(Form("%s",fileInfo.fFilename)),
451 first ? "RECREATE" : "UPDATE");
452 first = kFALSE;
453 }
10eb3d17 454}
455
456//______________________________________________________________________________
457void
49419555 458AliMUONMchViewApplication::ReleaseNotes()
459{
460 /// Display release notes
461
462 UInt_t width = 600;
463 UInt_t height = 400;
464
465 TGTransientFrame* t = new TGTransientFrame(gClient->GetRoot(),gClient->GetRoot(),width,height);
466
467 TGTextView* rn = new TGTextView(t);
1ffbeb9d 468
a679753e 469 rn->AddLine("1.05");
470 rn->AddLine("");
471 rn->AddLine("Added the possibility to select an event range when reading raw data");
472 rn->AddLine("Usefull e.g. to look at a single suspect event...");
473 rn->AddLine("");
474
f5a46139 475 rn->AddLine("1.04");
476 rn->AddLine("");
477 rn->AddLine("Changed the default OCDB to 2010 version");
478 rn->AddLine("");
479
fcabdc0c 480 rn->AddLine("1.03");
481 rn->AddLine("");
482 rn->AddLine("Add Print buttons");
483 rn->AddLine("Add the automatic creation of often used canvases when using pedestal source");
484 // Internal reorganization to allow several independent tabs to be created to
485 // show different master frames (not used yet). Important for the moment
486 // is the ability to create a PainterMatrix and pass it to the PainterMasterFrame
487 rn->AddLine("");
488
ca913045 489 rn->AddLine("1.02");
490 rn->AddLine("");
491 rn->AddLine("Internal change (merging of AliMUONTrackerACFDataMaker and AliMUONTrackerOCDBDataMaker into AliMUONTrackerConditionDataMaker)");
492 rn->AddLine("Added --ocdb option");
493 rn->AddLine("Corrected the display of the configuration");
494 rn->AddLine("Corrected the interpretation of the switches for the HV display");
495 rn->AddLine("");
496
6c870207 497 rn->AddLine("1.01");
498 rn->AddLine("");
499 rn->AddLine("Added the configuration as a possible OCDB data source");
500 rn->AddLine("");
501
fef32488 502 rn->AddLine("1.00");
503 rn->AddLine("");
504 rn->AddLine("Added the Status and StatusMap as a possible OCDB data source");
505 rn->AddLine("");
506 rn->AddLine("Added one (computed) dimension to the Gains data source = 1/a1/0.2 (mV/fC)");
507 rn->AddLine("");
6c870207 508
fef32488 509 rn->AddLine("0.99a");
510 rn->AddLine("");
511 rn->AddLine("Added the --de and --chamber options");
512 rn->AddLine("");
513
dc9bb08e 514 rn->AddLine("0.99");
515 rn->AddLine("");
516 rn->AddLine("The chamberid in the label (top right of panel) is now starting at 1 as in common usage");
517 rn->AddLine("");
518
3f979838 519 rn->AddLine("0.98");
520 rn->AddLine("");
521 rn->AddLine("Added --asciimapping option");
522 rn->AddLine("");
523
66cdf5b3 524 rn->AddLine("0.97");
525 rn->AddLine("");
526 rn->AddLine("Adding calibration option with Emelec (aka injection) gain");
527 rn->AddLine("");
528
8f0acce4 529 rn->AddLine("0.96a");
530 rn->AddLine("");
531 rn->AddLine("Internal reorganization of the contour computations, that lead to improved performance. ");
532 rn->AddLine("Improved enough to be able to remove completely the usage of the padstore.root file with precomputed contours.");
533 rn->AddLine("");
534
b6f591ae 535 rn->AddLine("0.96");
536 rn->AddLine("");
537 rn->AddLine("New features");
538 rn->AddLine("");
539 rn->AddLine("- Can now read raw data from memory (using the mem://@gdc: syntax)");
540 rn->AddLine("- Raw data decoder now automatically skips buspatches with parity errors");
541 rn->AddLine("");
542
543 rn->AddLine("0.95");
1ffbeb9d 544 rn->AddLine("");
545 rn->AddLine("New features");
546 rn->AddLine("");
547 rn->AddLine("- Can now read and display HV values from OCDB");
548 rn->AddLine("- New program option --geometry to force geometry of the window");
549 rn->AddLine("- Added possibility, in painters' context menu, to include or exclude part of the detector");
550 rn->AddLine(" (which will be used later on to communicate with LC2 which parts should be read out or not)");
551 rn->AddLine("");
552 rn->AddLine("Improvement");
553 rn->AddLine("");
554 rn->AddLine("- When displaying Gains, the quality information is now decoded");
555 rn->AddLine("");
49419555 556
1286237e 557 rn->AddLine("0.94");
558 rn->AddLine("");
559 rn->AddLine("New features");
560 rn->AddLine("");
561 rn->AddLine("Can now read ASCII calibration files produced by the DA");
562 rn->AddLine("");
563
49419555 564 rn->AddLine("0.93");
565 rn->AddLine("");
566 rn->AddLine("New features");
567 rn->AddLine("");
568 rn->AddLine("- Adding a Lock button under the color slider to lock the range shown");
569 rn->AddLine(" when switching between views");
570 rn->AddLine("- Default display now shows bending plane (instead of cathode 0 before)");
571 rn->AddLine("- If pad is responder and there's some histo for that pad, ");
572 rn->AddLine(" clicking on it will display an histo");
573 rn->AddLine("- Right-click on a painter will now display several histogram options");
574 rn->AddLine(" (e.g. raw charge as before, but also simple distributions of mean");
575 rn->AddLine(" and sigma");
576 rn->AddLine("- In the Data Sources Tab, each data source can now be removed and saved");
577 rn->AddLine("- There's a new Tool menu which allow to produce a TrackerData from two others");
578 rn->AddLine(" in order to compare data.");
579 rn->AddLine(" - The --use option can now reference alien files");
580 rn->AddLine("");
581 rn->AddLine("Bug fixes");
582 rn->AddLine("");
583 rn->AddLine("- Can now read Capacitances from OCDB");
584
585 rn->Resize(width,height);
586
587 t->AddFrame(rn, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
588
589 t->MapSubwindows();
590 t->Resize();
591 t->MapWindow();
592 t->CenterOnParent();
593
594 // set names
595
596 t->SetWindowName("mchview release notes");
597 t->SetIconName("mchview release notes");
598
599// t->SetMWMHints(kMWMDecorAll | kMWMDecorResizeH | kMWMDecorMaximize |
600// kMWMDecorMinimize | kMWMDecorMenu,
601// kMWMFuncAll | kMWMFuncResize | kMWMFuncMaximize |
602// kMWMFuncMinimize,
603// kMWMInputModeless);
604
605 t->MapRaised();
606// gClient->WaitFor(t);
607}
608
609//______________________________________________________________________________
610void
90037e4e 611AliMUONMchViewApplication::Save()
612{
613 /// Open "Save VTrackerData objects to file" dialog
614
615 TGFileInfo fileInfo;
616
617 new TGFileDialog(gClient->GetRoot(),gClient->GetRoot(),
618 kFDSave,&fileInfo);
619
620 Save(gSystem->ExpandPathName(Form("%s",fileInfo.fFilename)));
621}
622
623//______________________________________________________________________________
624void
625AliMUONMchViewApplication::Save(const char* filename)
626{
49419555 627 /// Save VTrackerDataMaker objects into file of given name
90037e4e 628
8f0acce4 629 AliMUONPainterDataRegistry* reg = AliMUONPainterDataRegistry::Instance();
90037e4e 630
631 TFile f(filename,"RECREATE");
632
49419555 633 for ( Int_t i = 0; i < reg->NumberOfDataMakers(); ++i )
90037e4e 634 {
49419555 635 AliMUONVTrackerDataMaker* maker = reg->DataMaker(i);
636 maker->Write();
90037e4e 637 }
638
639 f.Close();
640}