64
64
// * Test 26 : Handling output via file ......................... OK * * //
65
65
// * Test 27 : Simple: selector by object ....................... OK * * //
66
66
// * Test 28 : H1 dataset: selector by object ................... OK * * //
67
+ // * Test 29 : Chain with TTree in subdirs ...................... OK * * //
67
68
// * * All registered tests have been passed :-) * * //
68
69
// * ****************************************************************** * //
69
70
// * * //
133
134
134
135
#include " proof/getProof.C"
135
136
136
- #define PT_NUMTEST 28
137
+ #define PT_NUMTEST 29
137
138
138
139
static const char *urldef = " proof://localhost:40000" ;
139
140
static TString gtutdir;
@@ -249,7 +250,7 @@ int main(int argc,const char *argv[])
249
250
printf (" in case of error.\n " );
250
251
printf (" -k,-keeplog keep all logfiles, including the ones from the PROOF nodes (in one single file)\n " );
251
252
printf (" The paths are printed on the screen.\n " );
252
- printf (" -catlog prints all the logfiles (also the ones from PROOF nodes) on stdout; useful for" );
253
+ printf (" -catlog prints all the logfiles (also the ones from PROOF nodes) on stdout; useful for\n " );
253
254
printf (" presenting a single aggregated output for automatic tests. If specified in\n " );
254
255
printf (" conjunction with -cleanlog it will only print the logfiles in case of errors\n " );
255
256
printf (" -dyn run the test in dynamicStartup mode\n " );
@@ -619,7 +620,8 @@ Double_t ProofTest::gRefReal[PT_NUMTEST] = {
619
620
0.259239 , // #25: TTree friends, same file
620
621
6.868858 , // #26: Simple generation: merge-via-file
621
622
6.362017 , // #27: Simple random number generation by TSelector object
622
- 5.519631 // #28: H1: by-object processing
623
+ 5.519631 , // #28: H1: by-object processing
624
+ 7.452465 // #29: Chain with TTree in subdirs
623
625
};
624
626
625
627
//
@@ -750,6 +752,7 @@ Int_t PT_EventRange(void *, RunTimes &);
750
752
Int_t PT_POFNtuple (void *, RunTimes &);
751
753
Int_t PT_POFDataset (void *, RunTimes &);
752
754
Int_t PT_Friends (void *, RunTimes &);
755
+ Int_t PT_TreeSubDirs (void *, RunTimes &);
753
756
Int_t PT_SimpleByObj (void *, RunTimes &);
754
757
Int_t PT_H1ChainByObj (void *, RunTimes &);
755
758
Int_t PT_AssertTutorialDir (const char *tutdir);
@@ -1066,6 +1069,8 @@ int stressProof(const char *url, const char *tests, Int_t nwrks,
1066
1069
testList->Add (new ProofTest (" Simple: selector by object" , 27 , &PT_SimpleByObj, 0 , " 1" , " ProofSimple" , kTRUE ));
1067
1070
// H1 analysis over HTTP by TSeletor object
1068
1071
testList->Add (new ProofTest (" H1 chain: selector by object" , 28 , &PT_H1ChainByObj, 0 , " 1" , " h1analysis" , kTRUE ));
1072
+ // Test TPacketizerFile and TTree friends in separate files
1073
+ testList->Add (new ProofTest (" Chain with TTree in subdirs" , 29 , &PT_TreeSubDirs, 0 , " 1" , " ProofFriends,ProofAux" , kTRUE ));
1069
1074
// The selectors
1070
1075
if (PT_AssertTutorialDir (gTutDir ) != 0 ) {
1071
1076
printf (" * Some of the tutorial files are missing! Stop\n " );
@@ -2107,7 +2112,7 @@ Int_t PT_CheckDataset(TQueryResult *qr, Long64_t nevt)
2107
2112
}
2108
2113
2109
2114
// _____________________________________________________________________________
2110
- Int_t PT_CheckFriends (TQueryResult *qr, Long64_t nevt)
2115
+ Int_t PT_CheckFriends (TQueryResult *qr, Long64_t nevt, bool withfriends )
2111
2116
{
2112
2117
// Check the result of the ProofFriends analysis
2113
2118
@@ -2134,14 +2139,15 @@ Int_t PT_CheckFriends(TQueryResult *qr, Long64_t nevt)
2134
2139
2135
2140
TString emsg;
2136
2141
// Check the histogram entries and mean values
2142
+ Int_t nchk = (withfriends) ? 4 : 2 ;
2137
2143
Int_t rchs = 0 ;
2138
2144
const char *hnam[4 ] = { " histo1" , " histo2" , " histo3" , " histo4" };
2139
2145
const char *hcls[4 ] = { " TH2F" , " TH1F" , " TH1F" , " TH2F" };
2140
2146
Float_t hent[4 ] = { 1 ., .227 , .0260 , .0260 };
2141
2147
TObject *o = 0 ;
2142
2148
Double_t ent = -1 ;
2143
2149
Double_t prec = 1 . / TMath::Sqrt (nevt);
2144
- for (Int_t i = 0 ; i < 4 ; i++) {
2150
+ for (Int_t i = 0 ; i < nchk ; i++) {
2145
2151
if (!(o = out->FindObject (hnam[i]))) {
2146
2152
emsg.Form (" object '%s' not found" , hnam[i]);
2147
2153
rchs = -1 ;
@@ -4268,7 +4274,127 @@ Int_t PT_Friends(void *sf, RunTimes &tt)
4268
4274
4269
4275
// Check the results
4270
4276
PutPoint ();
4271
- return PT_CheckFriends (gProof ->GetQueryResult (), nevt * nwrk);
4277
+ return PT_CheckFriends (gProof ->GetQueryResult (), nevt * nwrk, 1 );
4278
+ }
4279
+
4280
+ // _____________________________________________________________________________
4281
+ Int_t PT_TreeSubDirs (void *sf, RunTimes &tt)
4282
+ {
4283
+ // Test processing of TTree in subdirectories
4284
+
4285
+ // Checking arguments
4286
+ PutPoint ();
4287
+ if (!gProof ) {
4288
+ printf (" \n >>> Test failure: no PROOF session found\n " );
4289
+ return -1 ;
4290
+ }
4291
+
4292
+ // Not supported in dynamic mode
4293
+ if (gDynamicStartup ) {
4294
+ return 1 ;
4295
+ }
4296
+ PutPoint ();
4297
+
4298
+ // File generation: we use TPacketizerFile in here to create two files per node
4299
+ TList *wrks = gProof ->GetListOfSlaveInfos ();
4300
+ if (!wrks) {
4301
+ printf (" \n >>> Test failure: could not get the list of information about the workers\n " );
4302
+ return -1 ;
4303
+ }
4304
+
4305
+ // Create the map
4306
+ TString fntree;
4307
+ TMap *files = new TMap;
4308
+ files->SetName (" PROOF_FilesToProcess" );
4309
+ TIter nxwi (wrks);
4310
+ TSlaveInfo *wi = 0 ;
4311
+ while ((wi = (TSlaveInfo *) nxwi ())) {
4312
+ fntree.Form (" tree_%s.root" , wi->GetOrdinal ());
4313
+ THashList *wrklist = (THashList *) files->GetValue (wi->GetName ());
4314
+ if (!wrklist) {
4315
+ wrklist = new THashList;
4316
+ wrklist->SetName (wi->GetName ());
4317
+ files->Add (new TObjString (wi->GetName ()), wrklist);
4318
+ }
4319
+ wrklist->Add (new TObjString (fntree));
4320
+ }
4321
+ Int_t nwrk = wrks->GetSize ();
4322
+
4323
+ // Generate the files
4324
+ gProof ->AddInput (files);
4325
+ gProof ->SetParameter (" ProofAux_Action" , " GenerateTrees:dir1/dir2/dir3" );
4326
+
4327
+ // File generation: define the number of events per worker
4328
+ Long64_t nevt = 1000 ;
4329
+ gProof ->SetParameter (" ProofAux_NEvents" , (Long64_t)nevt);
4330
+ // Special Packetizer
4331
+ gProof ->SetParameter (" PROOF_Packetizer" , " TPacketizerFile" );
4332
+ // Now process
4333
+ gProof ->Process (gAuxSel .Data (), 1 );
4334
+ // Remove the packetizer specifications
4335
+ gProof ->DeleteParameters (" PROOF_Packetizer" );
4336
+
4337
+ // Check that we got some output
4338
+ if (!gProof ->GetOutputList ()) {
4339
+ printf (" \n >>> Test failure: output list not found!\n " );
4340
+ return -1 ;
4341
+ }
4342
+
4343
+ // Create the TChain objects
4344
+ TChain *dset = new TChain (" dir1/dir2/dir3/Tmain" );
4345
+ // Fill them with the information found in the output list
4346
+ Bool_t foundMain = kFALSE ;
4347
+ TIter nxo (gProof ->GetOutputList ());
4348
+ TObject *o = 0 ;
4349
+ TObjString *os = 0 ;
4350
+ while ((o = nxo ())) {
4351
+ TList *l = dynamic_cast <TList *> (o);
4352
+ if (l && !strncmp (l->GetName (), " MainList-" , 9 )) {
4353
+ foundMain = kTRUE ;
4354
+ TIter nxf (l);
4355
+ while ((os = (TObjString *) nxf ()))
4356
+ dset->Add (os->GetName ());
4357
+ }
4358
+ }
4359
+ dset->SetProof ();
4360
+
4361
+ // If we did not found the main or the friend meta info we fail
4362
+ if (!foundMain) {
4363
+ printf (" \n >>> Test failure: 'main' meta info missing!\n " );
4364
+ return -1 ;
4365
+ }
4366
+
4367
+ // We do not plot the ntuple (we are in batch mode)
4368
+ gProof ->SetParameter (" PROOF_DONT_PLOT" , " yes" );
4369
+
4370
+ // We do use friends
4371
+ gProof ->SetParameter (" PROOF_NO_FRIENDS" , " yes" );
4372
+
4373
+ // Clear the list of query results
4374
+ if (gProof ->GetQueryResults ()) gProof ->GetQueryResults ()->Clear ();
4375
+
4376
+ // Process
4377
+ PutPoint ();
4378
+ { SwitchProgressGuard spg;
4379
+ gTimer .Start ();
4380
+ dset->Process (gFriendsSel .Data ());
4381
+ gTimer .Stop ();
4382
+ }
4383
+
4384
+ // Remove any setting
4385
+ gProof ->DeleteParameters (" PROOF_DONT_PLOT" );
4386
+ gProof ->GetInputList ()->Remove (files);
4387
+ files->SetOwner (kTRUE );
4388
+ SafeDelete (files);
4389
+ // Clear the files created by this run
4390
+ gProof ->ClearData (TProof::kUnregistered | TProof::kForceClear );
4391
+
4392
+ // The runtimes
4393
+ PT_GetLastProofTimes (tt);
4394
+
4395
+ // Check the results
4396
+ PutPoint ();
4397
+ return PT_CheckFriends (gProof ->GetQueryResult (), nevt * nwrk, 0 );
4272
4398
}
4273
4399
4274
4400
// _____________________________________________________________________________
0 commit comments