@@ -4,11 +4,11 @@ using namespace std;
44
55#if defined(__CINT__ ) && !defined(__MAKECINT__ )
66class loadFWLite {
7- public :
8- loadFWLite () {
9- gSystem -> Load ("libFWCoreFWLite" );
10- FWLiteEnabler ::enable ();
11- }
7+ public :
8+ loadFWLite () {
9+ gSystem -> Load ("libFWCoreFWLite" );
10+ FWLiteEnabler ::enable ();
11+ }
1212};
1313
1414static loadFWLite lfw ;
@@ -20,93 +20,93 @@ static loadFWLite lfw;
2020#include "DataFormats/TestObjects/interface/ThingCollection.h"
2121#endif
2222
23- void chainevent_looping_cint ()
24- {
25- vector < string > files ;
26- files .push_back ("empty_a.root" );
27- files .push_back ("good_a.root" );
28- files .push_back ("empty_a.root" );
29- files .push_back ("good_b.root" );
30- files .push_back ("empty_a.root" );
31- fwlite ::ChainEvent e (files );
23+ int chainevent_looping_cint () {
24+ vector < string > files ;
25+ files .push_back ("empty_a.root" );
26+ files .push_back ("good_a.root" );
27+ files .push_back ("empty_a.root" );
28+ files .push_back ("good_b.root" );
29+ files .push_back ("empty_a.root" );
30+ fwlite ::ChainEvent e (files );
31+
32+ int i = 0 ;
33+ int returnValue = 0 ;
34+ TFile * f = 0 ;
3235
33- int i = 0 ;
34- int returnValue = 0 ;
35- TFile * f = 0 ;
36+ for (; e .isValid (); ++ e , ++ i ) {
37+ if (e .getTFile () != f ) {
38+ f = e .getTFile ();
39+ cout << "New file " << f -> GetName () << endl ;
40+ }
3641
37- for ( ;e .isValid ();++ e ,++ i ) {
38- if (e .getTFile () != f ) {
39- f = e .getTFile ();
40- cout << "New file " << f -> GetName () << endl ;
42+ fwlite ::Handle < vector < edmtest ::Thing > > pThing ;
43+ //pThing.getByLabel(e,"Thing","","TEST"); //WORKS
44+ pThing .getByLabel (e , "Thing" );
45+
46+ for (i = 0 ; i != pThing .ref ().size (); ++ i ) {
47+ cout << pThing .ref ().at (i ).a << " " ;
48+ }
49+ cout << endl ;
4150 }
51+ if (i == 0 ) {
52+ cout << "First loop failed!" << endl ;
53+ returnValue = 1 ;
54+ }
55+ e .toBegin ();
4256
43- fwlite ::Handle < vector < edmtest ::Thing > > pThing ;
44- //pThing.getByLabel(e,"Thing","","TEST"); //WORKS
45- pThing .getByLabel (e ,"Thing" );
46-
47- for (i = 0 ; i != pThing .ref ().size ();++ i ) {
48- cout <<pThing .ref ().at (i ).a <<" " ;
57+ i = 0 ;
58+ for (; e ; ++ e , ++ i ) {
4959 }
50- cout << endl ;
51- }
52- if (i == 0 ) {
53- cout <<"First loop failed!" <<endl ;
54- returnValue = 1 ;
55- }
56- e .toBegin ();
5760
58- i = 0 ;
59- for ( ;e ;++ e ,++ i ) {
60- }
61+ if (i == 0 ) {
62+ cout << "Second loop failed!" << endl ;
63+ returnValue = 1 ;
64+ }
6165
62- if (i == 0 ) {
63- cout <<"Second loop failed!" <<endl ;
64- returnValue = 1 ;
65- }
66+ i = 0 ;
67+ for (e .toBegin (); !e .atEnd (); ++ e , ++ i ) {
68+ fwlite ::Handle < vector < edmtest ::Thing > > pThing ;
69+ //pThing.getByLabel(e,"Thing","","TEST"); //WORKS
70+ pThing .getByLabel (e , "Thing" );
6671
67- i = 0 ;
68- for (e .toBegin (); !e .atEnd ();++ e ,++ i ) {
69- fwlite ::Handle < vector < edmtest ::Thing > > pThing ;
70- //pThing.getByLabel(e,"Thing","","TEST"); //WORKS
71- pThing .getByLabel (e ,"Thing" );
72-
73- for (i = 0 ; i != pThing .ref ().size ();++ i ) {
74- cout <<pThing .ref ().at (i ).a <<" " ;
75- }
76- cout << endl ;
77- //DOES NOT WORK in CINT
78- //for(vector<edmtest::Thing>::const_iterator it = pThing.data()->begin(); it != pThing.data()->end();++it) {
79- // cout <<(*it).a<<endl;
80- //}
81- }
82- if (i == 0 ) {
83- cout <<"Third loop failed!" <<endl ;
84- returnValue = 1 ;
85- }
86- e .to (0 );
87- for (int j = 0 ; j < 20 ; ++ j ) {
88- int k = rand () % 10 ;
89- if (e .to (k )) {
90- edm ::EventID id = e .id ();
91- cout << "Entry " << k << " Run " << id .run () << " event " << id .event () << endl ;
92- } else {
93- cout <<"Entry " <<k <<" is not valid" <<endl ;
72+ for (i = 0 ; i != pThing .ref ().size (); ++ i ) {
73+ cout << pThing .ref ().at (i ).a << " " ;
74+ }
75+ cout << endl ;
76+ //DOES NOT WORK in CINT
77+ //for(vector<edmtest::Thing>::const_iterator it = pThing.data()->begin(); it != pThing.data()->end();++it) {
78+ // cout <<(*it).a<<endl;
79+ //}
80+ }
81+ if (i == 0 ) {
82+ cout << "Third loop failed!" << endl ;
83+ returnValue = 1 ;
84+ }
85+ e .to (0 );
86+ for (int j = 0 ; j < 20 ; ++ j ) {
87+ int k = rand () % 10 ;
88+ if (e .to (k )) {
89+ edm ::EventID id = e .id ();
90+ cout << "Entry " << k << " Run " << id .run () << " event " << id .event () << endl ;
91+ } else {
92+ cout << "Entry " << k << " is not valid" << endl ;
93+ }
9494 }
95- }
9695
9796 e .to (0 );
9897 long size = e .size ();
9998 edm ::EventID last ;
100- for (long l = 0 ; l < size ; ++ l ) {
99+ for (long l = 0 ; l < size ; ++ l ) {
101100 e .to (l );
102101 edm ::EventID id = e .id ();
103102 cout << "Entry " << l << " Run " << id .run () << " event " << id .event () << endl ;
104- if (last == id ) {
103+ if (last == id ) {
105104 returnValue = 1 ;
106- cout <<"duplicate event (" <<id .run ()<<"," <<id .event ()<<") seen at index " <<l <<" while testing 'to'" <<endl ;
105+ cout << "duplicate event (" << id .run () << "," << id .event () << ") seen at index " << l << " while testing 'to'"
106+ << endl ;
107107 break ;
108108 }
109109 }
110110
111- exit ( returnValue ) ;
111+ return returnValue ;
112112}
0 commit comments