15 |
|
#include "MitAna/DataTree/interface/Names.h" |
16 |
|
#include "MitAna/TAM/interface/TAMVirtualLoader.h" |
17 |
|
#include "MitAna/TAM/interface/TAModule.h" |
18 |
< |
#include "MitAna/TAM/interface/TAMSelector.h" |
18 |
> |
#include "MitAna/TreeMod/interface/Selector.h" |
19 |
> |
#include "MitAna/TreeMod/interface/TreeLoader.h" |
20 |
> |
#include "MitAna/TreeMod/interface/AnaFwkMod.h" |
21 |
> |
#include "MitAna/TreeMod/interface/HLTFwkMod.h" |
22 |
> |
#include "MitAna/Catalog/interface/Catalog.h" |
23 |
> |
#include "MitAna/Catalog/interface/Dataset.h" |
24 |
|
|
25 |
|
ClassImp(mithep::Analysis) |
26 |
|
|
27 |
|
using namespace mithep; |
28 |
|
|
29 |
< |
//__________________________________________________________________________________________________ |
29 |
> |
//-------------------------------------------------------------------------------------------------- |
30 |
|
Analysis::Analysis(Bool_t useproof) : |
31 |
|
fUseProof(useproof), |
32 |
< |
fHierachy(kTRUE), |
32 |
> |
fUseHLT(kTRUE), |
33 |
> |
fHierarchy(kTRUE), |
34 |
> |
fDoProxy(kFALSE), |
35 |
> |
fDoObjTabClean(kTRUE), |
36 |
|
fState(kPristine), |
37 |
|
fNFriends(0), |
38 |
|
fList(new TList), |
39 |
|
fOutput(0), |
40 |
|
fPackages(new TList), |
41 |
|
fLoaders(new TList), |
42 |
< |
fSuperMod(0), |
42 |
> |
fSuperMods(new TList), |
43 |
|
fSelector(0), |
44 |
|
fChain(0), |
45 |
|
fSet(0), |
46 |
|
fDeleteList(new TList), |
47 |
< |
fTreeName(Names::gkMitTreeName), |
47 |
> |
fTreeName(Names::gkEvtTreeName), |
48 |
|
fCompLevel(2), |
49 |
|
fProof(0), |
50 |
< |
fDoNEvents(TChain::kBigNumber) |
50 |
> |
fDoNEvents(TChain::kBigNumber), |
51 |
> |
fCacheSize(134217728) |
52 |
|
{ |
53 |
|
// Default constructor. |
54 |
|
|
60 |
|
// nothing to be done since we do not use par files (yet?) |
61 |
|
} |
62 |
|
|
63 |
< |
//__________________________________________________________________________________________________ |
63 |
> |
//-------------------------------------------------------------------------------------------------- |
64 |
|
Analysis::~Analysis() |
65 |
|
{ |
66 |
|
// Destructor. |
69 |
|
Terminate(); |
70 |
|
|
71 |
|
delete fList; |
72 |
< |
delete fDeleteList; |
72 |
> |
delete fPackages; |
73 |
|
delete fLoaders; |
74 |
+ |
delete fDeleteList; |
75 |
|
delete fSelector; |
76 |
< |
delete fPackages; |
77 |
< |
fOutput = 0; // owned by TAM |
68 |
< |
fSuperMod = 0; // owned by user |
76 |
> |
delete fSuperMods; |
77 |
> |
fOutput = 0; // owned by TAM |
78 |
|
|
79 |
|
delete fProof; |
80 |
|
} |
81 |
|
|
82 |
< |
//__________________________________________________________________________________________________ |
82 |
> |
//-------------------------------------------------------------------------------------------------- |
83 |
> |
Bool_t Analysis::AddDataset(const Dataset *dataset) |
84 |
> |
{ |
85 |
> |
// Add a full dataset to the analysis. |
86 |
> |
|
87 |
> |
Bool_t status = true; |
88 |
> |
|
89 |
> |
for (UInt_t i=0; i<dataset->NFiles(); ++i) |
90 |
> |
status = (status && AddFile(dataset->FileUrl(i))); |
91 |
> |
|
92 |
> |
return status; |
93 |
> |
} |
94 |
> |
|
95 |
> |
//-------------------------------------------------------------------------------------------------- |
96 |
|
Bool_t Analysis::AddFile(const char *pname) |
97 |
|
{ |
98 |
< |
// Add file with given name to the list of files to be processed. |
99 |
< |
// Using the token "|", you can specify an arbritray number |
78 |
< |
// of paths to tree files that will be concatenated as friend |
79 |
< |
// trees. |
98 |
> |
// Add file with given name to the list of files to be processed. Using the token "|", you can |
99 |
> |
// specify an arbritray number of paths to tree files that will be concatenated as friend trees. |
100 |
|
|
101 |
|
if (fState != kPristine) { |
102 |
|
Error("AddFile", "Analysis already initialized"); |
104 |
|
} |
105 |
|
|
106 |
|
TString pnamestr(pname); |
107 |
+ |
if (pnamestr.IsNull()) |
108 |
+ |
return kFALSE; |
109 |
+ |
|
110 |
|
TString tok("|"); |
111 |
|
TObjArray *arr = pnamestr.Tokenize(tok); |
112 |
< |
TString msg; |
112 |
> |
if (!arr) |
113 |
> |
return kFALSE; |
114 |
|
|
115 |
< |
for(Int_t i=0; i<arr->GetEntries(); i++){ |
116 |
< |
|
115 |
> |
TString msg; |
116 |
> |
for (Int_t i=0; i<arr->GetEntries(); ++i) { |
117 |
> |
|
118 |
|
TObjString *dummy = dynamic_cast<TObjString*>(arr->At(i)); |
119 |
< |
if(!dummy) continue; |
119 |
> |
if (!dummy) |
120 |
> |
continue; |
121 |
|
|
122 |
|
AddFile(dummy->GetName(),i); |
123 |
< |
if(i==0) msg=dummy->GetName(); |
124 |
< |
else { |
125 |
< |
Info("AddFile", "Add file %s as friend to %s", |
126 |
< |
dummy->GetName(), msg.Data()); |
101 |
< |
} |
123 |
> |
if (i==0) |
124 |
> |
msg=dummy->GetName(); |
125 |
> |
else |
126 |
> |
Info("AddFile", "Add file %s as friend to %s", dummy->GetName(), msg.Data()); |
127 |
|
} |
128 |
|
delete arr; |
129 |
|
|
130 |
|
return kTRUE; |
131 |
|
} |
132 |
|
|
133 |
< |
//________________________________________________________________________ |
133 |
> |
//-------------------------------------------------------------------------------------------------- |
134 |
|
void Analysis::AddFile(const char *pname, Int_t eventlist) |
135 |
|
{ |
136 |
< |
// Add file name to the event list specified by eventlist. The lists |
137 |
< |
// are used to hold filenames of different types of events. In case |
138 |
< |
// you dont want friend trees, just give no eventlist argument (default 0). |
136 |
> |
// Add file name to the event list specified by eventlist. The lists are used to hold filenames of |
137 |
> |
// different types of events. In case you dont want friend trees, just give no eventlist argument |
138 |
> |
// (default 0). |
139 |
|
|
140 |
|
MitAssert("AddFile", pname != 0); |
141 |
|
|
153 |
|
l = new TList; |
154 |
|
l->SetOwner(); |
155 |
|
fList->Add(l); |
156 |
< |
fNFriends++; |
156 |
> |
++fNFriends; |
157 |
|
|
158 |
|
} else if (eventlist < 0 || eventlist > fNFriends) { |
159 |
|
Error("AddFile", "Specified list %d not in [0,%d]", eventlist, fNFriends); |
160 |
|
return; |
161 |
|
} |
162 |
|
|
163 |
< |
if(!IsValidName(pname)) return; |
163 |
> |
if (!IsValidName(pname)) return; |
164 |
|
|
165 |
|
l->Add(new TObjString(pname)); |
166 |
|
|
168 |
|
Info("AddFile", "Added %s to list of files.", pname); |
169 |
|
} |
170 |
|
|
171 |
< |
//__________________________________________________________________________________________________ |
171 |
> |
//-------------------------------------------------------------------------------------------------- |
172 |
|
void Analysis::AddFile(const TObject *oname, Int_t eventlist) |
173 |
|
{ |
174 |
< |
// Add file name to the event list specified by eventlist. The lists |
175 |
< |
// are used to hold filenames of different types of events. In case |
176 |
< |
// you dont want mixing, just give no eventlist argument (default 0). |
174 |
> |
// Add file name to the event list specified by eventlist. The lists are used to hold filenames of |
175 |
> |
// different types of events. In case you dont want mixing, just give no eventlist argument |
176 |
> |
// (default 0). |
177 |
|
|
178 |
|
MitAssert("AddFile", oname != 0); |
179 |
|
|
183 |
|
//________________________________________________________________________ |
184 |
|
Bool_t Analysis::AddFiles(const char *pname, Int_t nmax) |
185 |
|
{ |
186 |
< |
// Add files from text file with given name. If nmax>0, |
162 |
< |
// maximum nmax files will be added. |
186 |
> |
// Add files from text file with given name. If nmax>0, maximum nmax files will be added. |
187 |
|
|
188 |
|
MitAssert("AddFiles", pname != 0); |
189 |
|
|
209 |
|
} |
210 |
|
|
211 |
|
++fc; |
212 |
< |
if(nmax>0 && fc>=nmax) { |
212 |
> |
if (nmax>0 && fc>=nmax) { |
213 |
|
Info("AddFiles", "Maximal number (%d) of files added", nmax); |
214 |
|
break; |
215 |
|
} |
218 |
|
return kTRUE; |
219 |
|
} |
220 |
|
|
221 |
< |
//__________________________________________________________________________________________________ |
221 |
> |
//-------------------------------------------------------------------------------------------------- |
222 |
|
void Analysis::AddList(TList *list, Int_t eventlist) |
223 |
|
{ |
224 |
< |
// Add file name to the event list specified by eventlist. The lists |
225 |
< |
// are used to hold filenames of different types of events. In case |
226 |
< |
// you dont want mixing, just give no eventlist argument (default 0). |
224 |
> |
// Add file name to the event list specified by eventlist. The lists are used to hold filenames of |
225 |
> |
// different types of events. In case you dont want mixing, just give no eventlist argument |
226 |
> |
// (default 0). |
227 |
|
|
228 |
|
MitAssert("AddList", list != 0); |
229 |
|
|
232 |
|
AddFile(obj->GetName(), eventlist); |
233 |
|
} |
234 |
|
|
235 |
< |
//__________________________________________________________________________________________________ |
235 |
> |
//-------------------------------------------------------------------------------------------------- |
236 |
|
void Analysis::AddLoader(TAMVirtualLoader *l) |
237 |
|
{ |
238 |
|
// Add loader to the list of loaders. |
240 |
|
fLoaders->Add(l); |
241 |
|
} |
242 |
|
|
243 |
< |
//__________________________________________________________________________________________________ |
243 |
> |
//-------------------------------------------------------------------------------------------------- |
244 |
|
void Analysis::AddPackage(const char* name) |
245 |
|
{ |
246 |
|
// Add package to the list of uploaded packages. |
249 |
|
fPackages->Add(new TObjString(name)); |
250 |
|
} |
251 |
|
|
252 |
< |
//__________________________________________________________________________________________________ |
252 |
> |
//-------------------------------------------------------------------------------------------------- |
253 |
|
void Analysis::AddPackages(TList *list) |
254 |
|
{ |
255 |
|
// Add list of packages to the list of uploaded packages. |
262 |
|
} |
263 |
|
} |
264 |
|
|
265 |
< |
//__________________________________________________________________________________________________ |
265 |
> |
//-------------------------------------------------------------------------------------------------- |
266 |
> |
void Analysis::AddSuperModule(TAModule *mod) |
267 |
> |
{ |
268 |
> |
// Add a top-level module to list of top-level (super) modules. |
269 |
> |
|
270 |
> |
fSuperMods->Add(mod); |
271 |
> |
} |
272 |
> |
|
273 |
> |
//-------------------------------------------------------------------------------------------------- |
274 |
> |
void Analysis::FileInputFromEnv() |
275 |
> |
{ |
276 |
> |
// Attempt to get list of filesets/files from environment. |
277 |
> |
|
278 |
> |
TString catalog(gSystem->Getenv("MIT_CATALOG")); |
279 |
> |
TString book(gSystem->Getenv("MIT_BOOK")); |
280 |
> |
TString dataset(gSystem->Getenv("MIT_DATASET")); |
281 |
> |
TString filesets(gSystem->Getenv("MIT_FILESETS")); |
282 |
> |
TString files(gSystem->Getenv("MIT_FILES")); |
283 |
> |
|
284 |
> |
if ((catalog.IsNull() || book.IsNull() || dataset.IsNull()) && files.IsNull()) { |
285 |
> |
Warning("FileInputFromEnv", "Called to get file info from environment, but did not get" |
286 |
> |
" consistent set of variables:\n\tMIT_CATALOG=%s\n\tMIT_BOOK=%s\n\t" |
287 |
> |
"MIT_DATASET=%s\n\tMIT_FILESETS=%s\n\tMIT_FILES=%s\n", |
288 |
> |
catalog.Data(), book.Data(), dataset.Data(), filesets.Data(), files.Data()); |
289 |
> |
return; |
290 |
> |
} |
291 |
> |
|
292 |
> |
if (!files.IsNull()) { // add local files |
293 |
> |
Info("FileInputFromEnv", "Got from environment:\n" |
294 |
> |
"\n\tMIT_FILES=%s\n", files.Data()); |
295 |
> |
TString tok(";"); |
296 |
> |
TObjArray *arr = files.Tokenize(tok); |
297 |
> |
if (arr) { |
298 |
> |
for (Int_t i=0; i<arr->GetEntries(); ++i) { |
299 |
> |
TObjString *dummy = dynamic_cast<TObjString*>(arr->At(i)); |
300 |
> |
if (!dummy) continue; |
301 |
> |
AddFile(dummy->GetName(),0); |
302 |
> |
} |
303 |
> |
delete arr; |
304 |
> |
} |
305 |
> |
return; |
306 |
> |
} |
307 |
> |
|
308 |
> |
Info("FileInputFromEnv", "Got from environment:\n" |
309 |
> |
"\tMIT_CATALOG=%s\n\tMIT_BOOK=%s\n\tMIT_DATASET=%s\n\tMIT_FILESETS=%s\n", |
310 |
> |
catalog.Data(), book.Data(), dataset.Data(), filesets.Data()); |
311 |
> |
|
312 |
> |
Catalog cat(catalog); |
313 |
> |
if (filesets.IsNull()) { |
314 |
> |
Dataset *d = cat.FindDataset(book, dataset); |
315 |
> |
if (d) { |
316 |
> |
AddDataset(d); |
317 |
> |
delete d; |
318 |
> |
} |
319 |
> |
} else { |
320 |
> |
TString tok(";"); |
321 |
> |
TObjArray *arr = filesets.Tokenize(tok); |
322 |
> |
if (arr) { |
323 |
> |
for (Int_t i=0; i<arr->GetEntries(); ++i) { |
324 |
> |
TObjString *fileset = dynamic_cast<TObjString*>(arr->At(i)); |
325 |
> |
if (!fileset) continue; |
326 |
> |
Dataset *d = cat.FindDataset(book, dataset, fileset->String()); |
327 |
> |
if (!d) |
328 |
> |
continue; |
329 |
> |
AddDataset(d); |
330 |
> |
delete d; |
331 |
> |
} |
332 |
> |
delete arr; |
333 |
> |
} |
334 |
> |
} |
335 |
> |
} |
336 |
> |
|
337 |
> |
//-------------------------------------------------------------------------------------------------- |
338 |
|
Bool_t Analysis::Init() |
339 |
|
{ |
340 |
< |
// Setup the TDSet and TChain to be used for the analysis |
341 |
< |
// with or without PROOF. If more than one list of |
246 |
< |
// file names was given, friend trees are supported. |
340 |
> |
// Setup the TDSet and TChain to be used for the analysis with or without PROOF. If more than one |
341 |
> |
// list of file names was given, friend trees are supported. |
342 |
|
|
343 |
|
if (fState == kRun || fState == kInit) { |
344 |
|
Error("Init", "Init in state %d is not possible! Call Terminate() first.", |
346 |
|
return kFALSE; |
347 |
|
} |
348 |
|
|
349 |
+ |
// check if we should attempt to get filesets/filenames from environment |
350 |
+ |
if (fNFriends == 0) |
351 |
+ |
FileInputFromEnv(); |
352 |
+ |
|
353 |
|
if (fNFriends <= 0) { |
354 |
|
Error("Init", "List of friend lists is empty!"); |
355 |
|
return kFALSE; |
356 |
|
} |
357 |
|
|
358 |
< |
if (!fSuperMod) { |
358 |
> |
if (!fSuperMods->First()) { |
359 |
|
Error("Init", "Top-level TAM module is NULL!"); |
360 |
|
return kFALSE; |
361 |
|
} |
362 |
|
|
363 |
|
if (fUseProof) { // first init our PROOF session |
364 |
< |
if (!InitProof()) return kFALSE; |
364 |
> |
if (!InitProof()) |
365 |
> |
return kFALSE; |
366 |
|
} |
367 |
|
|
368 |
|
// we do this here instead in Terminate() so that |
372 |
|
|
373 |
|
fChain = new TChain(fTreeName); |
374 |
|
fSet = new TDSet("TTree",fTreeName); |
375 |
+ |
|
376 |
+ |
fChain->SetCacheSize(fCacheSize); |
377 |
|
|
378 |
< |
for(Int_t i=0; i<fNFriends; i++){ |
378 |
> |
for (Int_t i=0; i<fNFriends; ++i) { |
379 |
|
|
380 |
|
TList *l = dynamic_cast<TList*>(fList->At(i)); |
381 |
|
if (!l) { |
385 |
|
|
386 |
|
if (i == 0) { |
387 |
|
TIter next(l); |
388 |
< |
while ( TObjString *obj = dynamic_cast<TObjString*>(next()) ) { |
388 |
> |
while (TObjString *obj = dynamic_cast<TObjString*>(next())) { |
389 |
|
fChain->Add(obj->GetName()); |
390 |
|
fSet->Add(obj->GetName()); |
391 |
|
} |
413 |
|
|
414 |
|
} |
415 |
|
|
416 |
< |
// if we had our default TAM plugin we would create it here |
417 |
< |
// TreeLoader *bl = new TreeLoader; |
418 |
< |
// fLoaders->Add(bl); |
419 |
< |
// fDeleteList->Add(bl); |
416 |
> |
// create our customized loader plugin for TAM |
417 |
> |
TreeLoader *bl = new TreeLoader; |
418 |
> |
fLoaders->Add(bl); |
419 |
> |
fDeleteList->Add(bl); |
420 |
> |
|
421 |
> |
// create our ana framework module |
422 |
> |
AnaFwkMod *anamod = new AnaFwkMod; |
423 |
> |
fDeleteList->Add(anamod); |
424 |
> |
|
425 |
> |
// create our HLT framework module |
426 |
> |
HLTFwkMod *hltmod = 0; |
427 |
> |
if (fUseHLT) { |
428 |
> |
hltmod = new HLTFwkMod; |
429 |
> |
fDeleteList->Add(hltmod); |
430 |
> |
} |
431 |
|
|
432 |
|
if (fUseProof) { |
433 |
|
|
434 |
< |
fProof->AddInput(fSuperMod); |
434 |
> |
fProof->AddInput(anamod); |
435 |
> |
if (hltmod) |
436 |
> |
fProof->AddInput(hltmod); |
437 |
> |
|
438 |
> |
TIter iter(fSuperMods->MakeIterator()); |
439 |
> |
while (1) { |
440 |
> |
TAModule *next = dynamic_cast<TAModule*>(iter.Next()); |
441 |
> |
if (!next) break; |
442 |
> |
fProof->AddInput(next); |
443 |
> |
} |
444 |
> |
|
445 |
|
fLoaders->SetName("TAM_LOADERS"); |
446 |
|
fProof->AddInput(fLoaders); |
447 |
|
|
448 |
|
} else { |
449 |
|
|
450 |
|
// when not running Proof, we must make a selector |
451 |
< |
fSelector = new TAMSelector; |
452 |
< |
fSelector->AddInput(fSuperMod); |
451 |
> |
fSelector = new Selector; |
452 |
> |
fSelector->SetDoProxy(fDoProxy); |
453 |
> |
fSelector->SetDoObjTabClean(fDoObjTabClean); |
454 |
> |
|
455 |
> |
fSelector->AddInput(anamod); |
456 |
> |
|
457 |
> |
if (hltmod) |
458 |
> |
fSelector->AddInput(hltmod); |
459 |
> |
|
460 |
> |
TIter iter(fSuperMods->MakeIterator()); |
461 |
> |
while (1) { |
462 |
> |
TAModule *next = dynamic_cast<TAModule*>(iter.Next()); |
463 |
> |
if (!next) break; |
464 |
> |
fSelector->AddInput(next); |
465 |
> |
} |
466 |
> |
|
467 |
|
MDB(kAnalysis, 2) |
468 |
|
fSelector->SetVerbosity(1); |
469 |
|
|
470 |
|
// pass loaders to selector |
471 |
|
TIter next(fLoaders); |
472 |
< |
while ( TAMVirtualLoader *l = dynamic_cast<TAMVirtualLoader*>(next()) ) |
472 |
> |
while (TAMVirtualLoader *l = dynamic_cast<TAMVirtualLoader*>(next())) |
473 |
|
fSelector->AddLoader(l); |
474 |
|
} |
475 |
|
|
477 |
|
return kTRUE; |
478 |
|
} |
479 |
|
|
480 |
< |
//__________________________________________________________________________________________________ |
480 |
> |
//-------------------------------------------------------------------------------------------------- |
481 |
|
Bool_t Analysis::InitProof() |
482 |
|
{ |
483 |
|
// Initialize PROOF connection. |
484 |
|
|
485 |
< |
if(fProof && fProof->IsValid()) |
485 |
> |
if (fProof && fProof->IsValid()) |
486 |
|
return kTRUE; |
487 |
|
|
488 |
|
delete fProof; |
489 |
|
|
490 |
|
if (fMaster.Contains("rcf.bnl.gov")) { |
491 |
< |
for(Int_t i=0;i<5;i++) { |
491 |
> |
for (Int_t i=0; i<5; ++i) { |
492 |
|
Warning("InitProof", "*** DID YOU RUN PROOF_KINIT? %d (5) ***", i); |
493 |
|
gSystem->Sleep(1000); |
494 |
|
} |
518 |
|
return ret; |
519 |
|
} |
520 |
|
|
521 |
< |
//__________________________________________________________________________________________________ |
521 |
> |
//-------------------------------------------------------------------------------------------------- |
522 |
|
void Analysis::Run() |
523 |
|
{ |
524 |
|
// Run the analysis on the created file set. |
533 |
|
MDB(kAnalysis, 1) |
534 |
|
Info("Run", "Start processing with PROOF..."); |
535 |
|
|
536 |
< |
fSet->Process("TAMSelector","",fDoNEvents); |
536 |
> |
fSet->Process("Selector","",fDoNEvents); |
537 |
|
|
538 |
|
} else { |
539 |
|
|
549 |
|
fState = kRun; |
550 |
|
} |
551 |
|
|
552 |
< |
//__________________________________________________________________________________________________ |
552 |
> |
//-------------------------------------------------------------------------------------------------- |
553 |
|
Bool_t Analysis::Run(Bool_t browse) |
554 |
|
{ |
555 |
|
// Execute analysis and open TBrowser if requested. |
557 |
|
if (Init()) { |
558 |
|
Run(); |
559 |
|
Terminate(); |
560 |
< |
if(browse) { |
560 |
> |
if (browse) { |
561 |
|
new TBrowser; |
562 |
|
} |
563 |
|
return kTRUE; |
567 |
|
return kFALSE; |
568 |
|
} |
569 |
|
|
570 |
< |
//__________________________________________________________________________________________________ |
570 |
> |
//-------------------------------------------------------------------------------------------------- |
571 |
> |
void Analysis::SetSuperModule(TAModule *mod) |
572 |
> |
{ |
573 |
> |
// Set the first top-level module in the list of top-level (super) modules. |
574 |
> |
|
575 |
> |
fSuperMods->AddFirst(mod); |
576 |
> |
} |
577 |
> |
|
578 |
> |
//-------------------------------------------------------------------------------------------------- |
579 |
|
void Analysis::Terminate() |
580 |
|
{ |
581 |
|
// Terminate current analysis run. |
604 |
|
fOutput = fSelector->GetModOutput(); |
605 |
|
} |
606 |
|
|
607 |
+ |
|
608 |
+ |
|
609 |
|
if (fOutput && !fAnaOutput.IsNull()) { |
610 |
|
TDirectory::TContext context(0); // automatically restore gDirectory |
611 |
|
|
616 |
|
MDB(kAnalysis, 1) |
617 |
|
Info("Terminate", "Saving output to %s!", fAnaOutput.Data()); |
618 |
|
|
619 |
< |
if (fHierachy) |
620 |
< |
fOutput->Write(fOutput->GetName(),TObject::kSingleKey); |
619 |
> |
if (fHierarchy) |
620 |
> |
fOutput->Write(0,-99); |
621 |
|
else |
622 |
|
fOutput->Write(); |
476 |
– |
|
623 |
|
} |
624 |
|
} |
625 |
+ |
// set state to terminate |
626 |
+ |
fState = kTerminate; |
627 |
|
} |
628 |
|
|
629 |
|
delete fChain; |
630 |
|
delete fSet; |
631 |
|
fDeleteList->Delete(); |
484 |
– |
|
485 |
– |
fState = kTerminate; |
632 |
|
} |
633 |
|
|
634 |
< |
//__________________________________________________________________________________________________ |
634 |
> |
//-------------------------------------------------------------------------------------------------- |
635 |
|
Bool_t Analysis::UploadPackages(TList *packages) |
636 |
|
{ |
637 |
|
// Upload list of par files to the server. |
638 |
|
|
639 |
|
MitAssert("UploadPackages", packages != 0); |
640 |
|
|
641 |
< |
for(Int_t i=0; i < packages->GetEntries(); i++) { |
641 |
> |
for (Int_t i=0; i<packages->GetEntries(); ++i) { |
642 |
|
|
643 |
|
TObject* objstr = packages->At(i); |
644 |
< |
if (!objstr){ |
644 |
> |
if (!objstr) { |
645 |
|
Error("InitProof", "Problem at package number %d!", i); |
646 |
|
return kFALSE; |
647 |
|
} |
648 |
|
|
649 |
|
TString packname = objstr->GetName(); |
650 |
< |
Int_t en = 0; |
650 |
> |
Int_t en = 0; |
651 |
|
if (packname.EndsWith("+")) { |
652 |
|
en=1; |
653 |
|
packname.Resize(packname.Length()-1); |
654 |
|
} |
655 |
|
|
656 |
|
ifstream ftest(gSystem->ExpandPathName(packname.Data()),ios_base::binary); |
657 |
< |
if (!ftest.good()){ |
657 |
> |
if (!ftest.good()) { |
658 |
|
Error("InitProof", "Could not open %s for upload!", packname.Data()); |
659 |
|
return kFALSE; |
660 |
|
} |
661 |
|
|
662 |
< |
if(fProof->UploadPackage(packname)<0) { |
662 |
> |
if (fProof->UploadPackage(packname)<0) { |
663 |
|
Error("UploadPackage", "Upload for %s failed!", packname.Data()); |
664 |
|
return kFALSE; |
665 |
|
} |
666 |
|
|
667 |
|
if (en == 1) { |
668 |
|
Int_t pos=packname.Last('/')+1; |
669 |
< |
if (pos) packname.Remove(0,pos); |
670 |
< |
if(fProof->EnablePackage(packname)<0) { |
669 |
> |
if (pos) |
670 |
> |
packname.Remove(0,pos); |
671 |
> |
if (fProof->EnablePackage(packname)<0) { |
672 |
|
Error("UploadPackage", "Enabling for %s failed!", packname.Data()); |
673 |
|
return kFALSE; |
674 |
|
} |