00001 #include "ArchRawScanResult.h"
00002 #include <TFile.h>
00003 #include <TKey.h>
00004 #include <TDirectory.h>
00005 #include <TSystem.h>
00006 #include <TNamed.h>
00007 #include <TObject.h>
00008 #include <TObjArray.h>
00009 #include <TString.h>
00010 #include <TObjString.h>
00011 #include <TBuffer.h>
00012 #include <TVector.h>
00013 #include <TVectorD.h>
00014 #include <TH1.h>
00015 #include <TH2.h>
00016 #include <TCanvas.h>
00017 #include <TROOT.h>
00018 #include <is/isinfo.h>
00019 #include <iostream>
00020 #include <vector>
00021
00022
00023
00024
00025
00026
00027
00028
00029 ArchRawScanResult::ArchRawScanResult(): ArchScanResult() {
00030
00031
00032
00033
00034
00035 }
00036
00037
00038 ArchRawScanResult::ArchRawScanResult(const RawScanResult& raw): ArchScanResult(raw) {
00039
00040
00041
00042
00043
00044
00045
00046 RawData_link0 = &raw.getScanData(0);
00047 RawData_link1 = &raw.getScanData(1);
00048
00049
00050
00051
00052
00053
00054 }
00055
00056
00057
00058
00059
00060
00061 ArchRawScanResult::~ArchRawScanResult() {
00062
00063
00064
00065
00066
00067 }
00068
00069
00070
00071
00072 void ArchRawScanResult::SetRawScan(RawScanResult & raw) {
00073
00074
00075 SetScan(raw);
00076 RawData_link0 = &raw.getScanData(0);
00077 RawData_link1 = &raw.getScanData(1);
00078
00079
00080
00081
00082
00083
00084 }
00085
00086
00087
00088 void ArchRawScanResult::SaveRawScan() {
00089
00090
00091
00092 string TH2Dlink0 = names->getTH2Dlink0();
00093 string TH2Dlink1 = names->getTH2Dlink1();
00094 string ScanPointsID = names->getScanPointsID() ;
00095 string vpointsID = names->getvpointsID();
00096 string vNEventsID = names->getvNEventsID();
00097 string vNErrorEventsID = names->getvNErrorEventsID();
00098 string filename = names->getfilename();
00099
00100 string variable = names->getVariable();
00101 string moduleID = names->getModuleID();
00102 string testType = names->getTestType();
00103 string runID = names->getRunID();
00104 string scanID = names->getScanID();
00105 string RODID = names->getRODID();
00106 string DCSID = names->getDCSID();
00107 string RawID = names->getRawID();
00108 string FitID = names->getFitID();
00109 string ModuleConfigID = names->getModuleConfigID();
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129 TFile *storage_file = new TFile(filename.c_str(),"update");
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142 TDirectory *this_run = (TDirectory*) gDirectory->Get(runID.c_str());
00143
00144
00145 if (!this_run) {
00146 cout<<"This NEW run "<< runID <<" doesn't exist"<<endl;
00147 this_run = storage_file->mkdir(runID.c_str());
00148
00149 }
00150
00151 this_run->cd();
00152
00153
00154
00155 TObject* pers_runnumber = gDirectory->FindObjectAny(runID.c_str());
00156 if (!pers_runnumber) {
00157 double frunNumber = runNumber;
00158 TVector run(1,1,frunNumber, "END");
00159 run.Write(runID.c_str());
00160 }
00161
00162
00163
00164
00165 TDirectory* this_module = (TDirectory*) gDirectory->Get(moduleID.c_str());
00166
00167 if (!this_module) {
00168
00169 this_module =gDirectory ->mkdir(moduleID.c_str());
00170 }
00171
00172
00173
00174
00175
00176
00177 this_module->cd();
00178 TDirectory* this_testType = (TDirectory*) gDirectory->Get(testType.c_str());
00179
00180
00181 if (!this_testType) {
00182
00183 this_testType = gDirectory->mkdir(testType.c_str());
00184 }
00185
00186
00187
00188
00189 this_testType->cd();
00190 TDirectory* this_variable = (TDirectory*) gDirectory->Get(variable.c_str());
00191
00192
00193
00194 if (!this_variable) {
00195
00196 this_variable = gDirectory->mkdir(variable.c_str());
00197 }
00198
00199
00200
00201
00202
00203
00204 this_variable->cd();
00205 TDirectory* this_scan = (TDirectory*) gDirectory->Get(scanID.c_str());
00206
00207
00208 if (!this_scan) {
00209
00210 this_scan =gDirectory ->mkdir(scanID.c_str());
00211 }
00212
00213
00214
00215 this_scan->cd();
00216 TObject* pers_scannumber = gDirectory->FindObjectAny(scanID.c_str());
00217 if (!pers_scannumber) {
00218 double fscanNumber = scanNumber;
00219 TVector vscan(1,1,fscanNumber,"END");
00220 vscan.Write(scanID.c_str());
00221 }
00222
00223
00224
00225 TObject* pers_ModuleConfig = gDirectory->FindObjectAny(ModuleConfigID.c_str());
00226 if (!pers_ModuleConfig) {
00227
00228 TObjString ModuleConfigTObjString = getModuleConfigTObjString();
00229
00230
00231 ModuleConfigTObjString.Write(ModuleConfigID.c_str());
00232
00233 }
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252 gpoints->Write(ScanPointsID.c_str());
00253
00254
00255
00256
00258
00259
00260
00261
00262 vpoints->Write(vpointsID.c_str());
00263
00264
00265
00266
00267 vNEvents->Write(vNEventsID.c_str());
00268
00269
00270
00271 vNErrorEvents->Write(vNErrorEventsID.c_str());
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299 this_scan->cd();
00300 TDirectory* this_ROD = (TDirectory*) this_scan->Get(RODID.c_str());
00301
00302
00303 if (!this_ROD) {
00304
00305 this_ROD = this_scan->mkdir(RODID.c_str());
00306 }
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328 this_ROD->cd();
00329 TDirectory* this_raw = (TDirectory*) this_ROD->Get(RawID.c_str());
00330
00331
00332 if (!this_raw) {
00333
00334 this_raw = this_ROD->mkdir(RawID.c_str());
00335 }
00336
00337
00338
00339
00340
00341 this_raw->cd();
00342
00343
00344
00345 RawData_link0->Write(TH2Dlink0.c_str());
00346 RawData_link1->Write(TH2Dlink1.c_str());
00347
00348
00349
00350
00351
00352 storage_file->Close();
00353 delete storage_file;
00354
00355
00356 }
00357
00358
00359
00360
00361 void ArchRawScanResult::SaveRawScan(RawScanResult & s) {
00362
00363 ArchRawScanResult tmp_receiver(s);
00364 tmp_receiver.SaveRawScan();
00365
00366 }
00367
00368
00369
00370
00371 bool ArchRawScanResult::RawScanIsPersisted() {
00372
00373
00374
00375
00376 string TH2Dlink0 = names->getTH2Dlink0();
00377 string TH2Dlink1 = names->getTH2Dlink1();
00378 string ScanPointsID = names->getScanPointsID() ;
00379 string vpointsID = names->getvpointsID();
00380 string vNEventsID = names->getvNEventsID();
00381 string vNErrorEventsID = names->getvNErrorEventsID();
00382 string filename = names->getfilename();
00383
00384 string variable = names->getVariable();
00385 string moduleID = names->getModuleID();
00386 string testType = names->getTestType();
00387 string runID = names->getRunID();
00388 string scanID = names->getScanID();
00389 string RODID = names->getRODID();
00390 string DCSID = names->getDCSID();
00391 string RawID = names->getRawID();
00392 string FitID = names->getFitID();
00393 string thresholdID = names->getThresholdID();
00394
00395
00396
00397 TFile *inspect_file = new TFile(filename.c_str(),"read");
00398 if (inspect_file->IsZombie() == true) {
00399 cout << "The RawScanResult has NOT been saved in any file"<<endl;
00400 return 1;
00401 }
00402
00403
00404 gDirectory->cd(runID.c_str());
00405 TDirectory* inspect_dir = (TDirectory*) gDirectory->Get(moduleID.c_str());
00406 if (!inspect_dir) {
00407 cout<<"The RawScanResult has NOT been saved"<<endl;
00408 return 1;
00409 }
00410 gDirectory->cd(moduleID.c_str());
00411
00412
00413 gDirectory->cd(testType.c_str());
00414
00415
00416 gDirectory->cd(variable.c_str());
00417 inspect_dir = (TDirectory*) gDirectory->Get(scanID.c_str());
00418 if (!inspect_dir) {
00419 cout<<"The RawScanResult has NOT been saved"<<endl;
00420 return 1;
00421 }
00422 gDirectory->cd(scanID.c_str());
00423
00424
00425
00426
00427
00428
00429
00430
00431
00432
00433
00434 TObject* pers_RawTH1 = gDirectory->FindObjectAny(ScanPointsID.c_str());
00435 if (!pers_RawTH1) {
00436 cout << "The RawScanResult has NOT been saved"<<endl;
00437 return 1;
00438 }
00439
00440
00441
00442 TObject* pers_points = gDirectory->FindObjectAny(vpointsID.c_str());
00443 if (!pers_points) {
00444 cout << "The RawScanResult has NOT been saved...ScanPoints"<<endl;
00445 return 1;
00446 }
00447 TObject* pers_Nevents = gDirectory->FindObjectAny(vNEventsID.c_str());
00448 if (!pers_Nevents) {
00449 cout << "The RawScanResult has NOT been saved...ScanPoints"<<endl;
00450 return 1;
00451 }
00452 TObject* pers_vNErrorEvents = gDirectory->FindObjectAny(vNErrorEventsID.c_str());
00453 if (!pers_vNErrorEvents) {
00454 cout << "The RawScanResult has NOT been saved...ScanPoints"<<endl;
00455 return 1;
00456 }
00457
00458 gDirectory->cd(RODID.c_str());
00459 gDirectory->cd(RawID.c_str());
00460
00461 cout << "Looking for persisted histograms in Raw Data" << endl;
00462
00463
00464
00465
00466 TObject* pers_RawTH2link0 = gDirectory->FindObjectAny(TH2Dlink0.c_str());
00467 if (!pers_RawTH2link0) {
00468 cout << "The RawScanResult has NOT been saved"<<endl;
00469 return 1;
00470 }
00471
00472 TObject* pers_RawTH2link1 = gDirectory->FindObjectAny(TH2Dlink1.c_str());
00473 if (!pers_RawTH2link1) {
00474 cout << "The RawScanResult has NOT been saved"<<endl;
00475 return 1;
00476 }
00477
00478 inspect_file->Close();
00479 delete inspect_file;
00480
00481 cout << "RawScanResult has been PERSISTED" << endl;
00482 return 0;
00483
00484
00485 }
00486
00487
00488
00489
00490
00491
00492 bool ArchRawScanResult::RawScanIsPersisted(long scanNumber, long runNumber, string moduleName, const ConfigurationVariable& variable, unsigned int cycle) {
00493
00494
00495
00496 ArchScanNames *new_names= new ArchScanNames(runNumber,moduleName,scanNumber, variable, cycle );
00497
00498 string TH2Dlink0 = new_names->getTH2Dlink0();
00499 string TH2Dlink1 = new_names->getTH2Dlink1();
00500 string ScanPointsID = new_names->getScanPointsID() ;
00501 string vpointsID = new_names->getvpointsID();
00502 string vNEventsID = new_names->getvNEventsID();
00503 string vNErrorEventsID = new_names->getvNErrorEventsID();
00504 string filename = new_names->getfilename();
00505
00506 string sVariable = new_names->getVariable();
00507 string moduleID = new_names->getModuleID();
00508 string testType = new_names->getTestType();
00509 string runID = new_names->getRunID();
00510 string scanID = new_names->getScanID();
00511 string RODID = new_names->getRODID();
00512 string DCSID = new_names->getDCSID();
00513 string RawID = new_names->getRawID();
00514 string FitID = new_names->getFitID();
00515 string thresholdID = new_names->getThresholdID();
00516
00517
00518
00519
00520
00521
00522
00523
00524 TFile *inspect_file = new TFile(filename.c_str(),"read");
00525 if (inspect_file->IsZombie() == true) {
00526 cout << "The RawScanResult has NOT been saved in any file"<<endl;
00527 return 1;
00528 }
00529
00530
00531 gDirectory->cd(runID.c_str());
00532 TDirectory* inspect_dir = (TDirectory*) gDirectory->Get(moduleID.c_str());
00533 if (!inspect_dir) {
00534 cout<<"The RawScanResult has NOT been saved...moduleID"<<endl;
00535 return 1;
00536 }
00537 gDirectory->cd(moduleID.c_str());
00538
00539
00540 TDirectory* testType_dir = (TDirectory*) gDirectory->Get(testType.c_str());
00541 if (!testType_dir) {
00542 cout<<"The RawScanResult has NOT been saved...testType"<<endl;
00543 return 1;
00544 }
00545 gDirectory->cd(testType.c_str());
00546
00547
00548 TDirectory* pers_variable = (TDirectory*) gDirectory->Get(sVariable.c_str());
00549 if (!pers_variable) {
00550 cout<<"The RawScanResult has NOT been saved...variable"<<endl;
00551 return 1;
00552 }
00553 gDirectory->cd(sVariable.c_str());
00554
00555
00556 inspect_dir = (TDirectory*) gDirectory->Get(scanID.c_str());
00557 if (!inspect_dir) {
00558 cout<<"The RawScanResult has NOT been saved...scanID"<<endl;
00559 return 1;
00560 }
00561 gDirectory->cd(scanID.c_str());
00562
00563
00564
00565
00566
00567
00568
00569
00570
00571
00572 TObject* pers_RawTH1 = gDirectory->FindObjectAny(ScanPointsID.c_str());
00573 if (!pers_RawTH1) {
00574 cout << "The RawScanResult has NOT been saved...ScanPointsID"<<endl;
00575 return 1;
00576 }
00577
00578
00579 TObject* pers_points = gDirectory->FindObjectAny(vpointsID.c_str());
00580 if (!pers_points) {
00581 cout << "The RawScanResult has NOT been saved...ScanPoints"<<endl;
00582 return 1;
00583 }
00584 TObject* pers_Nevents = gDirectory->FindObjectAny(vNEventsID.c_str());
00585 if (!pers_Nevents) {
00586 cout << "The RawScanResult has NOT been saved...ScanPoints"<<endl;
00587 return 1;
00588 }
00589 TObject* pers_vNErrorEvents = gDirectory->FindObjectAny(vNErrorEventsID.c_str());
00590 if (!pers_vNErrorEvents) {
00591 cout << "The RawScanResult has NOT been saved...ScanPoints"<<endl;
00592 return 1;
00593 }
00594
00595
00596 gDirectory->cd(RODID.c_str());
00597 gDirectory->cd(RawID.c_str());
00598
00599 cout << "Looking for persisted histograms in Raw Data" << endl;
00600
00601
00602
00603
00604 TObject* pers_RawTH2link0 = gDirectory->FindObjectAny(TH2Dlink0.c_str());
00605 if (!pers_RawTH2link0) {
00606 cout << "The RawScanResult has NOT been saved...TH2Dlink0"<<endl;
00607 return 1;
00608 }
00609
00610 TObject* pers_RawTH2link1 = gDirectory->FindObjectAny(TH2Dlink1.c_str());
00611 if (!pers_RawTH2link1) {
00612 cout << "The RawScanResult has NOT been saved...TH2Dlink1"<<endl;
00613 return 1;
00614 }
00615
00616
00617 cout << "RawScanResult has been PERSISTED" << endl;
00618 return 0;
00619
00620
00621 }
00622
00623
00624
00625
00626
00627
00628
00629
00630 bool ArchRawScanResult::RawScanIsPersisted(RawScanResult& rawdata) {
00631
00632 ArchRawScanResult temp_dir(rawdata);
00633 return temp_dir.RawScanIsPersisted();
00634
00635 }
00636
00637
00638
00639
00640 RawScanResult* ArchRawScanResult::CreateRawScanResult() {
00641
00642
00643 string Pers_Modulename;
00644
00645 if ( RawScanIsPersisted() == 0 )
00646 {
00647
00648 cout << "...creating new RawScanResult obj from persistency" << endl;
00649
00650 int dot = Archheader->getModuleName().find('.');
00651 string Pers_ModuleID = Archheader->getModuleName().substr(0, dot).c_str();
00652 Pers_Modulename = Pers_ModuleID + ".Persisted";
00653
00654
00655
00656 } else {
00657
00658 cout << "WARNING: the RawScanResult has NOT been persisted!!" <<endl;
00659
00660 int dot = Archheader->getModuleName().find('.');
00661 string Pers_ModuleID = Archheader->getModuleName().substr(0, dot).c_str();
00662 Pers_Modulename = Pers_ModuleID + ".Unpersisted";
00663
00664
00665 }
00666
00667
00668 ScanHeader s(scanNumber, runNumber, Pers_Modulename , *Archvariable);
00669 RawScanResult* r = new RawScanResult(s, *ArchmoduleConfig, *Archpoints, *RawData_link0, *RawData_link1 );
00670 cout<< r->getHeader().getModuleName()<<endl;
00671 return r;
00672
00673
00674 }
00675
00676
00677
00678
00679
00680 RawScanResult* ArchRawScanResult::CreateRawScanResult(RawScanResult& raw) {
00681
00682 ArchRawScanResult tmp_createRaw(raw);
00683 return tmp_createRaw.CreateRawScanResult();
00684
00685 }
00686
00687
00688
00689
00690
00691
00692 RawScanResult* ArchRawScanResult::CreateRawScanResult(long scanNumber, long runNumber, string moduleName, const ConfigurationVariable& variable, unsigned int cycle) {
00693
00694
00695 string Pers_Modulename;
00696 ModuleConfiguration m;
00697
00698 TH2D* new_RawData_link0 = NULL;
00699 TH2D* new_RawData_link1 = NULL;
00700
00701
00702 ArchScanNames *new_names= new ArchScanNames(runNumber,moduleName,scanNumber, variable );
00703
00704 string TH2Dlink0 = new_names->getTH2Dlink0();
00705 string TH2Dlink1 = new_names->getTH2Dlink1();
00706 string ScanPointsID = new_names->getScanPointsID() ;
00707 string vpointsID = new_names->getvpointsID();
00708 string vNEventsID = new_names->getvNEventsID();
00709 string vNErrorEventsID = new_names->getvNErrorEventsID();
00710 string filename = new_names->getfilename();
00711
00712 string sVariable = new_names->getVariable();
00713 string moduleID = new_names->getModuleID();
00714 string testType = new_names->getTestType();
00715 string runID = new_names->getRunID();
00716 string scanID = new_names->getScanID();
00717 string RODID = new_names->getRODID();
00718 string DCSID = new_names->getDCSID();
00719 string RawID = new_names->getRawID();
00720 string FitID = new_names->getFitID();
00721 string thresholdID = new_names->getThresholdID();
00722
00723
00724
00725
00726 if ( RawScanIsPersisted(scanNumber, runNumber, moduleName, variable) == 0 )
00727 {
00728
00729 cout << "...creating new RawScanResult obj from persistency" << endl;
00730
00731
00732 int dot = moduleName.find('.');
00733 string Pers_ModuleID = moduleName.substr(0, dot).c_str();
00734 Pers_Modulename = Pers_ModuleID + ".Persisted";
00735
00736
00737
00738 } else {
00739
00740 cout << "WARNING: the RawScanResult has NOT been persisted!!" <<endl;
00741
00742 int dot = moduleName.find('.');
00743 string Pers_ModuleID = moduleName.substr(0, dot).c_str();
00744 Pers_Modulename = Pers_ModuleID + ".Unpersisted";
00745 RawScanResult* r = NULL;
00746 return r;
00747
00748 }
00749
00750
00751
00752
00753
00754
00755
00756 TFile *inspect_file = new TFile(filename.c_str(),"read");
00757 if (inspect_file->IsZombie() == true) {
00758 cout << "Problem in opening the file"<<endl;
00759
00760 }
00761
00762
00763 gDirectory->cd(runID.c_str());
00764 gDirectory->cd(moduleID.c_str());
00765 gDirectory->cd(testType.c_str());
00766 gDirectory->cd(sVariable.c_str());
00767 gDirectory->cd(scanID.c_str());
00768
00769
00770
00771
00772
00773
00774
00775
00776
00777
00778 TObject* pers_vscanpoints = gDirectory->FindObjectAny(vpointsID.c_str());
00779 TVector* vpers_vscanpoints = dynamic_cast<TVector*>(pers_vscanpoints);
00780
00781
00782
00783 float *temp_vpers_vscanpoints = NULL;
00784 temp_vpers_vscanpoints = vpers_vscanpoints->GetElements();
00785
00786 TObject* pers_vNEvents = gDirectory->FindObjectAny(vNEventsID.c_str());
00787 TVector* vpers_vNEvents = dynamic_cast<TVector*>(pers_vNEvents);
00788
00789 int NoElements = vpers_vNEvents->GetNoElements();
00790
00792 unsigned int temp_vpers_vNEvents[NoElements];
00793 unsigned int truncated_vpers_vNEvents;
00794 for (int i=0; i<NoElements; ++i) {
00795 truncated_vpers_vNEvents = int(*vpers_vNEvents->GetElements());
00796
00797 temp_vpers_vNEvents[i] = truncated_vpers_vNEvents;
00798 }
00799
00800
00801 TObject* pers_vNErrorEvents = gDirectory->FindObjectAny(vNErrorEventsID.c_str());
00802 TVector* vpers_vNErrorEvents = dynamic_cast<TVector*>(pers_vNErrorEvents);
00804 unsigned int temp_vpers_vNErrorEvents[NoElements];
00805 unsigned int truncated_vpers_vNErrorEvents;
00806 for (int i=0; i<NoElements; ++i) {
00807 truncated_vpers_vNErrorEvents = int(*vpers_vNErrorEvents->GetElements());
00808 temp_vpers_vNErrorEvents[i] = truncated_vpers_vNErrorEvents;
00809 }
00810
00811
00812 ScanPoints *pts = new ScanPoints( NoElements, temp_vpers_vscanpoints ,temp_vpers_vNEvents ,temp_vpers_vNErrorEvents );
00813
00814
00815
00816
00817
00818 gDirectory->cd(RODID.c_str());
00819 gDirectory->cd(RawID.c_str());
00820
00821
00822
00823 TObject* pers_RawTH2link0 = gDirectory->FindObjectAny(TH2Dlink0.c_str());
00824
00825 new_RawData_link0 = dynamic_cast<TH2D*>(pers_RawTH2link0);
00826
00827
00828 TObject* pers_RawTH2link1 = gDirectory->FindObjectAny(TH2Dlink1.c_str());
00829
00830 new_RawData_link1 = dynamic_cast<TH2D*>(pers_RawTH2link1);
00831
00832
00833
00834
00835
00836
00837 ScanHeader s(scanNumber, runNumber, Pers_Modulename , variable);
00838 RawScanResult* r = new RawScanResult(s, m, *pts, *new_RawData_link0, *new_RawData_link1 );
00839 cout<< r->getHeader().getModuleName()<<endl;
00840 return r;
00841
00842
00843 }
00844
00845
00846
00847
00848
00849
00850 void ArchRawScanResult::SaveRawComment() {
00851
00852
00853
00854 string filename = names->getfilename();
00855 string runID = names->getRunID();
00856 string moduleID = names->getModuleID();
00857 string testType = names->getTestType();
00858 string variable = names->getVariable();
00859 string scanID = names->getScanID();
00860 string RODID = names->getRODID();
00861 string RawID = names->getRawID();
00862
00863 TFile *file = new TFile(filename.c_str(),"update");
00864 if (file->IsZombie() == true) {
00865 cout << "The ScanResult has NOT been saved in any file"<<endl;
00866 return ;
00867 }
00868
00869 TDirectory *this_run = (TDirectory*) gDirectory->Get(runID.c_str());
00870 if (!this_run) {
00871
00872 this_run = file->mkdir(runID.c_str());
00873
00874 }
00875 this_run->cd();
00876
00877
00878
00879 TDirectory* this_module = (TDirectory*) gDirectory->Get(moduleID.c_str());
00880 if (!this_module) {
00881
00882 this_module =gDirectory ->mkdir(moduleID.c_str());
00883 }
00884 this_module->cd();
00885
00886
00887
00888 TDirectory* this_testType = (TDirectory*) gDirectory->Get(testType.c_str());
00889 if (!this_testType) {
00890
00891 this_testType = gDirectory->mkdir(testType.c_str());
00892 }
00893 this_testType->cd();
00894
00895
00896
00897 TDirectory* this_variable = (TDirectory*) gDirectory->Get(variable.c_str());
00898 if (!this_variable) {
00899
00900 this_variable = gDirectory->mkdir(variable.c_str());
00901 }
00902 this_variable->cd();
00903
00904
00905 TDirectory* this_scan = (TDirectory*) gDirectory->Get(scanID.c_str());
00906 if (!this_scan) {
00907
00908 this_scan =gDirectory ->mkdir(scanID.c_str());
00909 }
00910 this_scan->cd();
00911
00912
00913 TDirectory* this_ROD = (TDirectory*) this_scan->Get(RODID.c_str());
00914 if (!this_ROD) {
00915
00916 this_ROD = this_scan->mkdir(RODID.c_str());
00917 }
00918 this_ROD->cd();
00919
00920
00921 TDirectory* this_raw = (TDirectory*) this_ROD->Get(RawID.c_str());
00922 if (!this_raw) {
00923
00924 this_raw = this_ROD->mkdir(RawID.c_str());
00925 }
00926 this_raw->cd();
00927
00928
00929
00930
00931 ifstream in;
00932 in.open(names->getTxtCommentRawName().c_str());
00933
00934 int commentN;
00935 int sz = 1000;
00936 char buf[sz];
00937
00938
00939 int nlines = 0;
00940 while (1) {
00941 in >> commentN;
00942 in.get(buf, sz);
00943 if (!in.good()) break;
00944
00945 TObjString Comment(buf);
00946
00947 TObject* pers_TxtCommentN = gDirectory->FindObjectAny(names->getRawTxtComment(commentN).c_str());
00948 if (!pers_TxtCommentN) {
00949
00950 Comment.Write(names->getRawTxtComment(commentN).c_str());
00951 }
00952 nlines++;
00953 }
00954
00955
00956
00957 in.close();
00958 file->Close();
00959
00960 }
00961