21 |
|
|
22 |
|
void MySimEvent::LoadEvent(FILE* pFile, stChunk* ParentChunk) |
23 |
|
{ |
24 |
+ |
/* |
25 |
|
unsigned short temp; |
26 |
|
fread(&temp,1,2,pFile); |
27 |
|
fseek(pFile,-2,SEEK_CUR); |
28 |
< |
// printf("Parent = %i --> Current ChunkId = %i to read = %i\n",ParentChunk->type,temp,0); |
29 |
< |
|
28 |
> |
printf("Parent = %i --> Current ChunkId = %i to read = %i\n",ParentChunk->type,temp,0); |
29 |
> |
*/ |
30 |
|
stChunk* CurrentChunk = new stChunk; |
31 |
|
ReadChunk(pFile, CurrentChunk); |
32 |
|
|
46 |
|
} |
47 |
|
break; |
48 |
|
|
49 |
< |
case C_SIM_TRACKHIT: // PSimHit |
50 |
< |
MyPSimHit temp_SimHit; |
51 |
< |
CurrentChunk->read += fread(&temp_SimHit,sizeof(MyPSimHit),1,pFile) * sizeof(MyPSimHit); |
52 |
< |
MyPSimHitCollection.push_back(temp_SimHit); |
53 |
< |
break; |
49 |
> |
case C_SIM_TRACKHIT:{ // PSimHit |
50 |
> |
while(CurrentChunk->read<CurrentChunk->size){ |
51 |
> |
MyPSimHit* temp_SimHit = new MyPSimHit; |
52 |
> |
CurrentChunk->read += fread(temp_SimHit,sizeof(MyPSimHit),1,pFile) * sizeof(MyPSimHit); |
53 |
> |
MyPSimHitCollection.push_back(temp_SimHit); |
54 |
> |
} |
55 |
> |
}break; |
56 |
|
|
57 |
< |
case C_SIM_CALOHIT: // PCaloHit |
58 |
< |
MyPCaloHit temp_CaloHit; |
59 |
< |
CurrentChunk->read += fread(&temp_CaloHit,sizeof(MyPCaloHit),1,pFile) * sizeof(MyPCaloHit); |
60 |
< |
MyPCaloHitCollection.push_back(temp_CaloHit); |
61 |
< |
break; |
57 |
> |
case C_SIM_CALOHIT:{ // PCaloHit |
58 |
> |
while(CurrentChunk->read<CurrentChunk->size){ |
59 |
> |
MyPCaloHit* temp_PSimCaloHit = new MyPCaloHit; |
60 |
> |
CurrentChunk->read += fread(temp_PSimCaloHit,sizeof(MyPCaloHit),1,pFile) * sizeof(MyPCaloHit); |
61 |
> |
MyPCaloHitCollection.push_back(temp_PSimCaloHit); |
62 |
> |
} |
63 |
> |
}break; |
64 |
|
|
65 |
< |
case C_SIM_VERTEX: // SimVertex |
66 |
< |
MySimVertex temp_SimVertex; |
67 |
< |
CurrentChunk->read += fread(&temp_SimVertex,sizeof(MySimVertex),1,pFile) * sizeof(MySimVertex); |
68 |
< |
MySimVertexCollection.push_back(temp_SimVertex); |
69 |
< |
break; |
65 |
> |
case C_SIM_VERTEX:{ // SimVertex |
66 |
> |
while(CurrentChunk->read<CurrentChunk->size){ |
67 |
> |
MySimVertex* temp_SimVertex = new MySimVertex; |
68 |
> |
CurrentChunk->read += fread(temp_SimVertex,sizeof(MySimVertex),1,pFile) * sizeof(MySimVertex); |
69 |
> |
MySimVertexCollection.push_back(temp_SimVertex); |
70 |
> |
} |
71 |
> |
}break; |
72 |
|
|
73 |
< |
case C_SIM_TRACK: // SimTrack |
74 |
< |
MySimTrack temp_SimTrack; |
75 |
< |
CurrentChunk->read += fread(&temp_SimTrack,sizeof(MySimTrack),1,pFile) * sizeof(MySimTrack); |
76 |
< |
MySimTrackCollection.push_back(temp_SimTrack); |
77 |
< |
break; |
73 |
> |
case C_SIM_TRACK:{ // SimTrack |
74 |
> |
while(CurrentChunk->read<CurrentChunk->size){ |
75 |
> |
MySimTrack* temp_SimTrack = new MySimTrack; |
76 |
> |
CurrentChunk->read += fread(temp_SimTrack,sizeof(MySimTrack),1,pFile) * sizeof(MySimTrack); |
77 |
> |
MySimTrackCollection.push_back(temp_SimTrack); |
78 |
> |
} |
79 |
> |
}break; |
80 |
|
|
81 |
|
|
82 |
|
|
87 |
|
} |
88 |
|
break; |
89 |
|
|
90 |
< |
case C_RECO_TRACK: // RecoTrack |
91 |
< |
MyRecoTrackCollection.push_back(*(new MyRecoTrack)); |
90 |
> |
case C_RECO_TRACK:{ // RecoTrack |
91 |
> |
MyRecoTrackCollection.push_back(new MyRecoTrack); |
92 |
|
while(CurrentChunk->read<CurrentChunk->size){ |
93 |
|
LoadEvent(pFile,CurrentChunk); |
94 |
|
} |
95 |
< |
break; |
95 |
> |
}break; |
96 |
> |
|
97 |
> |
case C_RECO_TRACKHIT:{ // RecHits |
98 |
> |
while(CurrentChunk->read<CurrentChunk->size){ |
99 |
> |
MyRecoHit* temp_RecoHit = new MyRecoHit; |
100 |
> |
CurrentChunk->read += fread(temp_RecoHit,sizeof(MyRecoHit),1,pFile) * sizeof(MyRecoHit); |
101 |
> |
MyRecoTrackCollection[MyRecoTrackCollection.size()-1]->Hits.push_back(temp_RecoHit); |
102 |
> |
} |
103 |
> |
}break; |
104 |
|
|
105 |
< |
case C_RECO_TRACKHITS: // RecHits |
106 |
< |
MyRecoHit temp_RecoHit; |
107 |
< |
CurrentChunk->read += fread(&temp_RecoHit,sizeof(MyRecoHit),1,pFile) * sizeof(MyRecoHit); |
108 |
< |
MyRecoTrackCollection[MyRecoTrackCollection.size()-1].Hits.push_back(temp_RecoHit); |
109 |
< |
break; |
105 |
> |
case C_RECO_TRACKINFO:{ // TrackInfo |
106 |
> |
MyRecoTrackInfo* temp_Info = new MyRecoTrackInfo; |
107 |
> |
CurrentChunk->read += fread(temp_Info,sizeof(MyRecoTrackInfo),1,pFile) * sizeof(MyRecoTrackInfo); |
108 |
> |
MyRecoTrackCollection[MyRecoTrackCollection.size()-1]->Info = temp_Info; |
109 |
> |
}break; |
110 |
|
|
111 |
+ |
case C_RECO_ECALHIT:{ // ECAL Hits |
112 |
+ |
while(CurrentChunk->read<CurrentChunk->size){ |
113 |
+ |
MyCaloHit* temp_EcalHit = new MyCaloHit; |
114 |
+ |
CurrentChunk->read += fread(temp_EcalHit,sizeof(MyCaloHit),1,pFile) * sizeof(MyCaloHit); |
115 |
+ |
MyEcalCaloHitCollection.push_back(temp_EcalHit); |
116 |
+ |
} |
117 |
+ |
}break; |
118 |
+ |
|
119 |
+ |
case C_RECO_HCALHIT:{ // HCAL Hits |
120 |
+ |
while(CurrentChunk->read<CurrentChunk->size){ |
121 |
+ |
MyCaloHit* temp_HcalHit = new MyCaloHit; |
122 |
+ |
CurrentChunk->read += fread(temp_HcalHit,sizeof(MyCaloHit),1,pFile) * sizeof(MyCaloHit); |
123 |
+ |
MyHcalCaloHitCollection.push_back(temp_HcalHit); |
124 |
+ |
} |
125 |
+ |
}break; |
126 |
+ |
|
127 |
+ |
case C_RECO_MUONSEG:{ // Muon Segments |
128 |
+ |
while(CurrentChunk->read<CurrentChunk->size){ |
129 |
+ |
MyMuonSegment* temp_MuonSeg = new MyMuonSegment; |
130 |
+ |
CurrentChunk->read += fread(temp_MuonSeg,sizeof(MyMuonSegment),1,pFile) * sizeof(MyMuonSegment); |
131 |
+ |
MyMuonSegmentCollection.push_back(temp_MuonSeg); |
132 |
+ |
} |
133 |
+ |
}break; |
134 |
+ |
|
135 |
+ |
|
136 |
+ |
case C_RECO_MUONHIT:{ // Muon Hits |
137 |
+ |
while(CurrentChunk->read<CurrentChunk->size){ |
138 |
+ |
MyMuonHit* temp_MuonHit = new MyMuonHit; |
139 |
+ |
CurrentChunk->read += fread(temp_MuonHit,sizeof(MyMuonHit),1,pFile) * sizeof(MyMuonHit); |
140 |
+ |
MyMuonHitCollection.push_back(temp_MuonHit); |
141 |
+ |
} |
142 |
+ |
}break; |
143 |
|
|
144 |
|
|
145 |
|
////////////////////////UNKOWN CHUNK //////////////////////// |
161 |
|
{ |
162 |
|
unsigned int i; |
163 |
|
stChunkToSave* CurrentChunk; |
164 |
+ |
void* data_buffer; |
165 |
|
|
166 |
|
switch(ParentChunk->type) |
167 |
|
{ |
185 |
|
break; |
186 |
|
|
187 |
|
case C_SIM: // SimData |
188 |
< |
for(i=0;i<MyPSimHitCollection.size();i++){ |
188 |
> |
if(MyPSimHitCollection.size()>0){ |
189 |
|
CurrentChunk = new stChunkToSave; |
190 |
|
CurrentChunk->type = C_SIM_TRACKHIT; |
191 |
< |
CurrentChunk->size = 6+sizeof(MyPSimHit); |
192 |
< |
CurrentChunk->data = (char*)&MyPSimHitCollection[i]; |
191 |
> |
CurrentChunk->size = 6 + sizeof(MyPSimHit)*MyPSimHitCollection.size(); |
192 |
> |
data_buffer = new void*[CurrentChunk->size-6]; |
193 |
> |
CurrentChunk->data = data_buffer; |
194 |
> |
for(i=0;i<MyPSimHitCollection.size();i++){ |
195 |
> |
memcpy( data_buffer, MyPSimHitCollection[i], sizeof(MyPSimHit) ); |
196 |
> |
data_buffer = (void*)((unsigned long)data_buffer + sizeof(MyPSimHit)); |
197 |
> |
} |
198 |
|
ParentChunk->daughters.push_back(CurrentChunk); |
199 |
< |
} |
200 |
< |
for(i=0;i<MyPCaloHitCollection.size();i++){ |
199 |
> |
} |
200 |
> |
|
201 |
> |
if(MyPCaloHitCollection.size()>0){ |
202 |
|
CurrentChunk = new stChunkToSave; |
203 |
|
CurrentChunk->type = C_SIM_CALOHIT; |
204 |
< |
CurrentChunk->size = 6+sizeof(MyPCaloHit); |
205 |
< |
CurrentChunk->data = (char*)&MyPCaloHitCollection[i]; |
204 |
> |
CurrentChunk->size = 6 + sizeof(MyPCaloHit)*MyPCaloHitCollection.size(); |
205 |
> |
data_buffer = new void*[CurrentChunk->size-6]; |
206 |
> |
CurrentChunk->data = data_buffer; |
207 |
> |
for(i=0;i<MyPCaloHitCollection.size();i++){ |
208 |
> |
memcpy( data_buffer, MyPCaloHitCollection[i], sizeof(MyPCaloHit) ); |
209 |
> |
data_buffer = (void*)((unsigned long)data_buffer + sizeof(MyPCaloHit)); |
210 |
> |
} |
211 |
|
ParentChunk->daughters.push_back(CurrentChunk); |
212 |
|
} |
213 |
< |
for(i=0;i<MySimVertexCollection.size();i++){ |
213 |
> |
|
214 |
> |
if(MySimVertexCollection.size()>0){ |
215 |
|
CurrentChunk = new stChunkToSave; |
216 |
|
CurrentChunk->type = C_SIM_VERTEX; |
217 |
< |
CurrentChunk->size = 6+sizeof(MySimVertex); |
218 |
< |
CurrentChunk->data = (char*)&MySimVertexCollection[i]; |
217 |
> |
CurrentChunk->size = 6 + sizeof(MySimVertex)*MySimVertexCollection.size(); |
218 |
> |
data_buffer = new void*[CurrentChunk->size-6]; |
219 |
> |
CurrentChunk->data = data_buffer; |
220 |
> |
for(i=0;i<MySimVertexCollection.size();i++){ |
221 |
> |
memcpy( data_buffer, MySimVertexCollection[i], sizeof(MySimVertex) ); |
222 |
> |
data_buffer = (void*)((unsigned long)data_buffer + sizeof(MySimVertex)); |
223 |
> |
} |
224 |
|
ParentChunk->daughters.push_back(CurrentChunk); |
225 |
|
} |
226 |
< |
for(i=0;i<MySimTrackCollection.size();i++){ |
226 |
> |
|
227 |
> |
if(MySimTrackCollection.size()>0){ |
228 |
|
CurrentChunk = new stChunkToSave; |
229 |
|
CurrentChunk->type = C_SIM_TRACK; |
230 |
< |
CurrentChunk->size = 6+sizeof(MySimTrack); |
231 |
< |
CurrentChunk->data = (char*)&MySimTrackCollection[i]; |
230 |
> |
CurrentChunk->size = 6 + sizeof(MySimTrack)*MySimTrackCollection.size(); |
231 |
> |
data_buffer = new void*[CurrentChunk->size-6]; |
232 |
> |
CurrentChunk->data = data_buffer; |
233 |
> |
for(i=0;i<MySimTrackCollection.size();i++){ |
234 |
> |
memcpy( data_buffer, MySimTrackCollection[i], sizeof(MySimTrack) ); |
235 |
> |
data_buffer = (void*)((unsigned long)data_buffer + sizeof(MySimTrack)); |
236 |
> |
} |
237 |
|
ParentChunk->daughters.push_back(CurrentChunk); |
238 |
< |
} |
238 |
> |
} |
239 |
|
break; |
240 |
|
|
168 |
– |
|
241 |
|
case C_RECO: // RecoData |
242 |
|
for(i=0;i<MyRecoTrackCollection.size();i++){ |
243 |
|
CurrentChunk = new stChunkToSave; |
244 |
|
CurrentChunk->type = C_RECO_TRACK; |
245 |
|
CurrentChunk->size = 6; |
246 |
< |
CurrentChunk->buffer = &MyRecoTrackCollection[i]; |
246 |
> |
CurrentChunk->buffer = MyRecoTrackCollection[i]; |
247 |
|
ParentChunk->daughters.push_back(CurrentChunk); |
248 |
|
} |
177 |
– |
break; |
249 |
|
|
250 |
+ |
|
251 |
+ |
if(MyEcalCaloHitCollection.size()>0){ |
252 |
+ |
CurrentChunk = new stChunkToSave; |
253 |
+ |
CurrentChunk->type = C_RECO_ECALHIT; |
254 |
+ |
CurrentChunk->size = 6 + sizeof(MyCaloHit)*MyEcalCaloHitCollection.size(); |
255 |
+ |
data_buffer = new void*[CurrentChunk->size-6]; |
256 |
+ |
CurrentChunk->data = data_buffer; |
257 |
+ |
for(i=0;i<MyEcalCaloHitCollection.size();i++){ |
258 |
+ |
memcpy( data_buffer, MyEcalCaloHitCollection[i], sizeof(MyCaloHit) ); |
259 |
+ |
data_buffer = (void*)((unsigned long)data_buffer + sizeof(MyCaloHit)); |
260 |
+ |
} |
261 |
+ |
ParentChunk->daughters.push_back(CurrentChunk); |
262 |
+ |
} |
263 |
+ |
|
264 |
+ |
if(MyHcalCaloHitCollection.size()>0){ |
265 |
+ |
CurrentChunk = new stChunkToSave; |
266 |
+ |
CurrentChunk->type = C_RECO_HCALHIT; |
267 |
+ |
CurrentChunk->size = 6 + sizeof(MyCaloHit)*MyHcalCaloHitCollection.size(); |
268 |
+ |
data_buffer = new void*[CurrentChunk->size-6]; |
269 |
+ |
CurrentChunk->data = data_buffer; |
270 |
+ |
for(i=0;i<MyHcalCaloHitCollection.size();i++){ |
271 |
+ |
memcpy( data_buffer, MyHcalCaloHitCollection[i], sizeof(MyCaloHit) ); |
272 |
+ |
data_buffer = (void*)((unsigned long)data_buffer + sizeof(MyCaloHit)); |
273 |
+ |
} |
274 |
+ |
ParentChunk->daughters.push_back(CurrentChunk); |
275 |
+ |
} |
276 |
|
|
277 |
< |
case C_RECO_TRACK: // RecoTrack |
181 |
< |
for(i=0;i<((MyRecoTrack*)ParentChunk->buffer)->Hits.size();i++){ |
277 |
> |
if(MyMuonSegmentCollection.size()>0){ |
278 |
|
CurrentChunk = new stChunkToSave; |
279 |
< |
CurrentChunk->type = C_RECO_TRACKHITS; |
280 |
< |
CurrentChunk->size = 6+sizeof(MyRecoHit); |
281 |
< |
CurrentChunk->data = (char*)&((MyRecoTrack*)ParentChunk->buffer)->Hits[i]; |
279 |
> |
CurrentChunk->type = C_RECO_MUONSEG; |
280 |
> |
CurrentChunk->size = 6 + sizeof(MyMuonSegment)*MyMuonSegmentCollection.size(); |
281 |
> |
data_buffer = new void*[CurrentChunk->size-6]; |
282 |
> |
CurrentChunk->data = data_buffer; |
283 |
> |
for(i=0;i<MyMuonSegmentCollection.size();i++){ |
284 |
> |
memcpy( data_buffer, MyMuonSegmentCollection[i], sizeof(MyMuonSegment) ); |
285 |
> |
data_buffer = (void*)((unsigned long)data_buffer + sizeof(MyMuonSegment)); |
286 |
> |
} |
287 |
> |
ParentChunk->daughters.push_back(CurrentChunk); |
288 |
> |
} |
289 |
> |
|
290 |
> |
if(MyMuonHitCollection.size()>0){ |
291 |
> |
CurrentChunk = new stChunkToSave; |
292 |
> |
CurrentChunk->type = C_RECO_MUONHIT; |
293 |
> |
CurrentChunk->size = 6 + sizeof(MyMuonHit)*MyMuonHitCollection.size(); |
294 |
> |
data_buffer = new void*[CurrentChunk->size-6]; |
295 |
> |
CurrentChunk->data = data_buffer; |
296 |
> |
for(i=0;i<MyMuonHitCollection.size();i++){ |
297 |
> |
memcpy( data_buffer, MyMuonHitCollection[i], sizeof(MyMuonHit) ); |
298 |
> |
data_buffer = (void*)((unsigned long)data_buffer + sizeof(MyMuonHit)); |
299 |
> |
} |
300 |
|
ParentChunk->daughters.push_back(CurrentChunk); |
301 |
|
} |
302 |
|
break; |
303 |
|
|
304 |
+ |
|
305 |
+ |
case C_RECO_TRACK: // RecoTrack |
306 |
+ |
if(((MyRecoTrack*)ParentChunk->buffer)->Hits.size()>0){ |
307 |
+ |
CurrentChunk = new stChunkToSave; |
308 |
+ |
CurrentChunk->type = C_RECO_TRACKHIT; |
309 |
+ |
CurrentChunk->size = 6 + sizeof(MyRecoHit)*((MyRecoTrack*)ParentChunk->buffer)->Hits.size(); |
310 |
+ |
data_buffer = new void*[CurrentChunk->size-6]; |
311 |
+ |
CurrentChunk->data = data_buffer; |
312 |
+ |
for(i=0;i<((MyRecoTrack*)ParentChunk->buffer)->Hits.size();i++){ |
313 |
+ |
memcpy( data_buffer, ((MyRecoTrack*)ParentChunk->buffer)->Hits[i], sizeof(MyRecoHit) ); |
314 |
+ |
data_buffer = (void*)((unsigned long)data_buffer + sizeof(MyRecoHit)); |
315 |
+ |
} |
316 |
+ |
ParentChunk->daughters.push_back(CurrentChunk); |
317 |
+ |
|
318 |
+ |
if(((MyRecoTrack*)ParentChunk->buffer)->Info!=NULL){ |
319 |
+ |
CurrentChunk = new stChunkToSave; |
320 |
+ |
CurrentChunk->type = C_RECO_TRACKINFO; |
321 |
+ |
CurrentChunk->size = 6 + sizeof(MyRecoTrackInfo); |
322 |
+ |
data_buffer = new void*[CurrentChunk->size-6]; |
323 |
+ |
CurrentChunk->data = data_buffer; |
324 |
+ |
memcpy( data_buffer, ((MyRecoTrack*)ParentChunk->buffer)->Info, sizeof(MyRecoTrackInfo) ); |
325 |
+ |
ParentChunk->daughters.push_back(CurrentChunk); |
326 |
+ |
} |
327 |
+ |
} |
328 |
+ |
break; |
329 |
+ |
|
330 |
|
default: |
331 |
|
break; |
332 |
|
} |
333 |
|
|
334 |
< |
|
334 |
> |
|
335 |
|
for(unsigned int i=0; i<ParentChunk->daughters.size();i++) |
336 |
|
{ |
337 |
|
if( !(ParentChunk->type == C_PRIMARY && i!=ParentChunk->daughters.size()-1)) |
391 |
|
temp5.Hits.push_back(tmp); |
392 |
|
} |
393 |
|
temp_Event->MyRecoTrackCollection.push_back(temp5); |
394 |
+ |
|
395 |
+ |
MyCaloHit temp6; |
396 |
+ |
temp6.t = (float)(rand()%200-100); |
397 |
+ |
temp6.E = (float)(rand()%200-100); |
398 |
+ |
temp6.DetId = 10; |
399 |
+ |
temp_Event->MyEcalCaloHitCollection.push_back(temp6); |
400 |
+ |
|
401 |
+ |
MyCaloHit temp7; |
402 |
+ |
temp7.t = (float)(rand()%200-100); |
403 |
+ |
temp7.E = (float)(rand()%200-100); |
404 |
+ |
temp7.DetId = 20; |
405 |
+ |
temp_Event->MyHcalCaloHitCollection.push_back(temp7); |
406 |
|
} |
407 |
|
Events.push_back(temp_Event); |
408 |
|
} |
415 |
|
|
416 |
|
} |
417 |
|
|
418 |
< |
void MySimEvents::Load(char* path) |
418 |
> |
void MySimEvents::Load(const char* path) |
419 |
|
{ |
420 |
|
FILE* f = fopen(path,"rb" ); |
421 |
|
if(f==NULL){ |
422 |
|
printf("The file %s can not be open !\n",path); |
423 |
< |
return; |
423 |
> |
exit(0); |
424 |
|
} |
425 |
|
|
426 |
|
stChunk* PrimaryChunk = new stChunk; |
484 |
|
fprintf(g," Hit : %6.2f\t%6.2f\t%6.2f\t%8i\t%8i\n",hit.x,hit.y,hit.z,hit.Charge,hit.DetId); |
485 |
|
} |
486 |
|
} |
487 |
+ |
|
488 |
+ |
for(j=0;j<Events[i]->MyEcalCaloHitCollection.size();j++) |
489 |
+ |
{ |
490 |
+ |
MyCaloHit calohit = Events[i]->MyEcalCaloHitCollection[j]; |
491 |
+ |
fprintf(g,"CaloHit\t%6.2f\t%6.2f\t%i\n",calohit.E,calohit.t,calohit.DetId); |
492 |
+ |
} |
493 |
+ |
|
494 |
+ |
for(j=0;j<Events[i]->MyHcalCaloHitCollection.size();j++) |
495 |
+ |
{ |
496 |
+ |
MyCaloHit calohit = Events[i]->MyHcalCaloHitCollection[j]; |
497 |
+ |
fprintf(g,"CaloHit\t%6.2f\t%6.2f\t%i\n",calohit.E,calohit.t,calohit.DetId); |
498 |
+ |
} |
499 |
|
} |
500 |
|
fclose(g); |
501 |
|
*/ |
503 |
|
} |
504 |
|
|
505 |
|
|
506 |
< |
void MySimEvents::Save(char* path) |
506 |
> |
void MySimEvents::Save(const char* path) |
507 |
|
{ |
508 |
|
stChunkToSave* Primary_chunk = new stChunkToSave; |
509 |
|
|
510 |
|
Primary_chunk->type = C_PRIMARY; |
511 |
|
Primary_chunk->size = 6; |
512 |
< |
|
512 |
> |
|
513 |
|
for(unsigned int i=0;i<Events.size();i++){ |
514 |
|
Events[i]->SaveEvent(Primary_chunk); |
515 |
|
} |
517 |
|
Primary_chunk->size = 6; |
518 |
|
for(unsigned int i=0;i<Primary_chunk->daughters.size();i++){ |
519 |
|
Primary_chunk->size += Primary_chunk->daughters[i]->size; |
520 |
< |
} |
520 |
> |
} |
521 |
|
/* |
522 |
|
printf("%i (%i)\n",Primary_chunk->type,Primary_chunk->size); |
523 |
|
for(unsigned int i=0;i<Primary_chunk->daughters.size();i++){ |
538 |
|
} |
539 |
|
*/ |
540 |
|
|
541 |
< |
FILE* pFile = fopen(path,"wb" ); |
541 |
> |
FILE* pFile = fopen(path,"wb" ); |
542 |
|
WriteChunk(pFile, Primary_chunk); |
543 |
< |
fclose(pFile); |
543 |
> |
fclose(pFile); |
544 |
|
} |
545 |
|
|
546 |
|
|
550 |
|
Current_Event++; |
551 |
|
|
552 |
|
} |
553 |
+ |
|
554 |
+ |
void MySimEvents::GoToEvent(unsigned int i) |
555 |
+ |
{ |
556 |
+ |
if(i<Events.size()) Current_Event=i; |
557 |
+ |
} |
558 |
+ |
|
559 |
|
void MySimEvents::PreviousEvent() |
560 |
|
{ |
561 |
|
if(Current_Event-1>=0) |