FEDRA emulsion software from the OPERA Collaboration
tlg2couples.C File Reference
#include "Riostream.h"
#include "TFile.h"
#include "EdbPVRec.h"
#include <iostream>
Include dependency graph for tlg2couples.C:

Namespaces

namespace  File
 
namespace  File::Format
 
namespace  File::Info
 
namespace  File::Section
 
namespace  Header
 
namespace  Header::Center
 
namespace  Header::Extents
 
namespace  Header::Identifier
 
namespace  Header::Transform
 
namespace  MIPBaseTrack
 
namespace  MIPEmulsionTrack
 
namespace  TrackIndexEntry
 
namespace  View
 

Enumerations

enum  { File::Info::Track = 1 , File::Info::BaseTrack = 2 , File::Info::Field = 3 }
 
enum  { File::Section::Data = 0x20 , File::Section::Header = 0x40 }
 
enum  {
  File::Format::Old = 0x08 , File::Format::Old2 = 0x02 , File::Format::NoExtents = 0x01 , File::Format::Normal = 0x03 ,
  File::Format::NormalWithIndex = 0x04 , File::Format::NormalDouble_tWithIndex = 0x05 , File::Format::Detailed = 0x06 , File::Format::MultiSection = 0x07
}
 
enum  en_side {
  TOP , BOT , TOP , BOT ,
  TOP , BOT , TOP , BOT
}
 

Functions

void Add_MIPBaseTrack (int i, float project_dz=-105.)
 
void Add_MIPEmulsionTrack (en_side side, int i)
 
int main (int argc, char *argv[])
 
void print_Header ()
 
void print_MIPBaseTrack (int i)
 
void print_MIPEmulsionTrack (int s, int i)
 
void print_View (int side, int i)
 
void printrackIndexEntry (int s, int i)
 
TClonesArray segbot ("EdbSegP")
 
TClonesArray segtop ("EdbSegP")
 
void tlg2couples (const char *input_file, char *output_file=0, float project_dz=-105.)
 

Variables

TTree * couples
 
EdbSegCouplecp = 0
 
Int_t Pid1 =0
 
Int_t Pid2 =0
 
EdbSegPs = 0
 
EdbSegPs1 = 0
 
EdbSegPs2 = 0
 
Float_t Xv =0
 
Float_t Yv =0
 

Enumeration Type Documentation

◆ en_side

enum en_side
Enumerator
TOP 
BOT 
TOP 
BOT 
TOP 
BOT 
TOP 
BOT 
36{ TOP , BOT } ;
@ TOP
Definition: tlg2couples.C:36
@ BOT
Definition: tlg2couples.C:36

Function Documentation

◆ Add_MIPBaseTrack()

void Add_MIPBaseTrack ( int  i,
float  project_dz = -105. 
)
235{
236 using namespace MIPBaseTrack ;
237
238 EdbSegP* t = (EdbSegP*) segtop[ TopId ] ;
239
240 EdbSegP* b = (EdbSegP*) segbot[ BottomId ] ;
241
242 float x_ = X + SX*( project_dz ) ;
243 float y_ = Y + SY*( project_dz ) ;
244
245 float z_ = Z + project_dz ;
246
247 s = new EdbSegP( i , x_, y_, SX, SY, Count ) ;
248 s->SetChi2( Sigma ) ;
249 s->SetVolume( AreaSum ) ;
250 s->SetZ( z_ ) ;
251
252 s->SetAid ( -90 , -90 );
253 s->SetFlag( -90 );
254 s->SetDZ( b->Z() - t->Z() );
255 s->SetDZem( 0 ) ;
256
257 Pid1=1;
258 Pid2=2;
259 Xv=0;
260 Yv=0;
261 cp= new EdbSegCouple( TopId, BottomId );
262 cp->SetN1(1);
263 cp->SetN2(1);
264 cp->SetN1tot(1);
265 cp->SetN2tot(1);
266 cp->SetCHI2P( Sigma ) ;
267
268 s1 = new EdbSegP( *t );
269
270 s2 = new EdbSegP( *b );
271
272 couples->Fill();
273}
Definition: EdbSegCouple.h:17
void SetN1(int n1)
Definition: EdbSegCouple.h:43
void SetN2(int n2)
Definition: EdbSegCouple.h:44
void SetN1tot(int n)
Definition: EdbSegCouple.h:45
void SetN2tot(int n)
Definition: EdbSegCouple.h:46
void SetCHI2P(float chi2)
Definition: EdbSegCouple.h:48
Definition: EdbSegP.h:21
void SetVolume(float w)
Definition: EdbSegP.h:136
void SetDZem(float dz)
Definition: EdbSegP.h:127
Float_t Z() const
Definition: EdbSegP.h:153
void SetZ(float z)
Definition: EdbSegP.h:125
void SetChi2(float chi2)
Definition: EdbSegP.h:135
void SetDZ(float dz)
Definition: EdbSegP.h:126
void SetFlag(int flag)
Definition: EdbSegP.h:130
void SetAid(int a, int v, int side=0)
Definition: EdbSegP.h:138
TTree * t
Definition: check_shower.C:4
Float_t Xv
Definition: tlg2couples.C:27
TClonesArray segtop("EdbSegP")
EdbSegP * s1
Definition: tlg2couples.C:29
Float_t Yv
Definition: tlg2couples.C:27
TTree * couples
Definition: tlg2couples.C:25
Int_t Pid2
Definition: tlg2couples.C:26
EdbSegP * s
Definition: tlg2couples.C:31
TClonesArray segbot("EdbSegP")
EdbSegP * s2
Definition: tlg2couples.C:30
Int_t Pid1
Definition: tlg2couples.C:26
EdbSegCouple * cp
Definition: tlg2couples.C:28
Definition: tlg2couples.C:116
Int_t TopId
Definition: tlg2couples.C:127
UInt_t Count
Definition: tlg2couples.C:119
Double_t Y
Definition: tlg2couples.C:121
Double_t Z
Definition: tlg2couples.C:122
Double_t SX
Definition: tlg2couples.C:123
Double_t Sigma
Definition: tlg2couples.C:126
UInt_t AreaSum
Definition: tlg2couples.C:118
Double_t X
Definition: tlg2couples.C:120
Double_t SY
Definition: tlg2couples.C:124
Int_t BottomId
Definition: tlg2couples.C:128

◆ Add_MIPEmulsionTrack()

void Add_MIPEmulsionTrack ( en_side  side,
int  i 
)
203{
204 using namespace MIPEmulsionTrack ;
205
206 if ( side == TOP) {
207 new( segtop[i] ) EdbSegP( i , X, Y, SX, SY, Count ) ;
208 ((EdbSegP*) segtop[i])->SetZ( Z );
209 //((EdbSegP*) segtop[i])->SetZ( Header::Top_BottomZ );
210 ((EdbSegP*) segtop[i])->SetChi2( Sigma );
211 ((EdbSegP*) segtop[i])->SetVolume( AreaSum ) ;
212
213 ((EdbSegP*) segtop[i])->SetAid ( -91 , viewid );
214 ((EdbSegP*) segtop[i])->SetFlag( -91 );
215 ((EdbSegP*) segtop[i])->SetDZ( TopZ-BottomZ );
216 ((EdbSegP*) segtop[i])->SetDZem( 0 );
217 }
218
219 if ( side == BOT) {
220 new( segbot[i] ) EdbSegP( i , X, Y, SX, SY, Count ) ;
221 ((EdbSegP*) segbot[i])->SetZ( Z );
222 //(EdbSegP*) segtop[i])->SetZ( Header::Bottom_TopZ );
223 ((EdbSegP*) segbot[i])->SetChi2( Sigma );
224 ((EdbSegP*) segbot[i])->SetVolume( AreaSum ) ;
225
226 ((EdbSegP*) segbot[i])->SetAid ( -92 , viewid );
227 ((EdbSegP*) segbot[i])->SetFlag( -92 );
228 ((EdbSegP*) segbot[i])->SetDZ( TopZ-BottomZ );
229 ((EdbSegP*) segbot[i])->SetDZem( 0 );
230 }
231}
Definition: tlg2couples.C:98
Double_t BottomZ
Definition: tlg2couples.C:110
Int_t viewid
Definition: tlg2couples.C:112
Double_t TopZ
Definition: tlg2couples.C:109

◆ main()

int main ( int  argc,
char *  argv[] 
)
794{
795 if(argc==2)
796 tlg2couples( argv[1], 0, -105. );
797 else if(argc==3)
798 tlg2couples( argv[1], argv[2], -105. );
799 else if(argc==4) {
800 float project_dz ;
801 sscanf( argv[3], "%f", &project_dz );
802 tlg2couples( argv[1], argv[2], project_dz );
803 } else {
804 cout << "tlg2couples.exe <input_file> [output_file] [project_dz (default= -105.)]\n";
805 return 0 ;
806 }
807
808 return 1 ;
809}
void tlg2couples(const char *input_file, char *output_file=0, float project_dz=-105.)
Definition: tlg2couples.C:276

◆ print_Header()

void print_Header ( )
142{
143
144 using namespace Header ;
145 cout << "Header"<< endl;
146 cout << (Int_t) infotype << endl;
147 cout << headerformat << endl;
148
149 using namespace Header::Identifier;
150 cout << Part0 <<" "<< Part1 <<" "<< Part2 <<" "<< Part3 << endl;
151 using namespace Header::Center;
152 cout << X <<" "<< Y << endl;
153 using namespace Header::Extents ;
154 cout << MinX <<" "<< MaxX <<" "<< MinY <<" "<< MaxY << endl;
155 using namespace Header::Transform ;
156 cout << MXX <<" "<< MXY <<" "<< MYX <<" "<< MYY << endl;
157 cout << TX <<" "<< TY <<" "<< RX <<" "<< RY << endl;
158
159 using namespace Header;
160 cout << TopViewsLength <<" "<< BottomViewsLength << endl ;
161 cout << TopTracksLength <<" "<< BottomTracksLength <<" "<< TracksLength << endl;
162 cout << Top_TopZ <<" "<< Top_BottomZ <<" "<< Bottom_TopZ <<" "<< Bottom_BottomZ << endl;
163
164}
Definition: tlg2couples.C:76
Definition: tlg2couples.C:77
Double_t MaxX
Definition: tlg2couples.C:77
Double_t MinX
Definition: tlg2couples.C:77
Double_t MinY
Definition: tlg2couples.C:77
Double_t MaxY
Definition: tlg2couples.C:77
Definition: tlg2couples.C:75
Int_t Part1
Definition: tlg2couples.C:75
Int_t Part3
Definition: tlg2couples.C:75
Int_t Part0
Definition: tlg2couples.C:75
Int_t Part2
Definition: tlg2couples.C:75
Definition: tlg2couples.C:78
Double_t RX
Definition: tlg2couples.C:78
Double_t MYX
Definition: tlg2couples.C:78
Double_t TY
Definition: tlg2couples.C:78
Double_t MXX
Definition: tlg2couples.C:78
Double_t TX
Definition: tlg2couples.C:78
Double_t RY
Definition: tlg2couples.C:78
Double_t MYY
Definition: tlg2couples.C:78
Double_t MXY
Definition: tlg2couples.C:78
Definition: tlg2couples.C:65
Char_t infotype
Definition: tlg2couples.C:68
Double_t Bottom_TopZ
Definition: tlg2couples.C:73
Int_t BottomViewsLength
Definition: tlg2couples.C:81
UShort_t headerformat
Definition: tlg2couples.C:69
Int_t TopTracksLength
Definition: tlg2couples.C:83
Int_t TracksLength
Definition: tlg2couples.C:85
Double_t Top_TopZ
Definition: tlg2couples.C:71
Double_t Bottom_BottomZ
Definition: tlg2couples.C:74
Double_t Top_BottomZ
Definition: tlg2couples.C:72
Int_t BottomTracksLength
Definition: tlg2couples.C:84
Int_t TopViewsLength
Definition: tlg2couples.C:80

◆ print_MIPBaseTrack()

void print_MIPBaseTrack ( int  i)
184{
185 using namespace MIPBaseTrack ;
186 cout << "MIPBaseTrack " << i <<" "<< id <<" " ;
187 cout << AreaSum <<" "<< Count <<" "
188 << X <<" "<< Y <<" "<< Z <<" "
189 << SX <<" "<< SY <<" "<< SZ <<" "
190 << Sigma <<" "<< TopId <<" "<< BottomId << endl;
191} ;
Double_t SZ
Definition: tlg2couples.C:125

◆ print_MIPEmulsionTrack()

void print_MIPEmulsionTrack ( int  s,
int  i 
)
174{
175 using namespace MIPEmulsionTrack ;
176 cout << "MIPEmulsionTrack " << s <<" "<< i <<" " ;
177 cout << Field <<" "<< AreaSum <<" "<< Count <<" "
178 << X <<" "<< Y <<" "<< Z <<" "
179 << SX <<" "<< SY <<" "<< SZ <<" "
180 << Sigma <<" "<< TopZ <<" "<< BottomZ <<" "<< viewid << endl;
181} ;
UInt_t Field
Definition: tlg2couples.C:99

◆ print_View()

void print_View ( int  side,
int  i 
)
167{
168 using namespace View ;
169 //if (i<2 || i>848)
170 cout << "View " << side <<" "<< id <<" "<< topz <<" "<< bottomz <<" "<< px <<" "<< py << endl;
171} ;
Definition: tlg2couples.C:89

◆ printrackIndexEntry()

void printrackIndexEntry ( int  s,
int  i 
)
194{
195 using namespace TrackIndexEntry ;
196 cout << "TrackIndexEntry " << s <<" "<< i <<" "<< TrackIndexEntry::Fragment <<" "
198} ;
Definition: tlg2couples.C:132
Int_t View
Definition: tlg2couples.C:135
Int_t Fragment
Definition: tlg2couples.C:134
Int_t Track
Definition: tlg2couples.C:136

◆ segbot()

TClonesArray segbot ( "EdbSegP"  )

◆ segtop()

TClonesArray segtop ( "EdbSegP"  )

◆ tlg2couples()

void tlg2couples ( const char *  input_file,
char *  output_file = 0,
float  project_dz = -105. 
)
279{
280 if (!output_file) {
281 output_file = new char[256];
282 sprintf(output_file, "%s", input_file );
283 char* ext = strrchr(output_file,'.') ;
284 sprintf(ext,".cp.root\0");
285 }
286
287 // CREATING OUTPUT FILE
288 TFile *o = new TFile( output_file, "RECREATE");
289
290 couples = new TTree("couples","couples");
291
292 couples->Branch( "pid1" , &Pid1 , "pid1/I" ) ;
293 couples->Branch( "pid2" , &Pid2 , "pid2/I" ) ;
294 couples->Branch( "xv" , &Xv , "xv/F" ) ;
295 couples->Branch( "yv" , &Yv , "yv/F" ) ;
296
297 couples->Branch( "cp" , "EdbSegCouple" , &cp ,32000 ,99 ) ;
298 couples->Branch( "s1." , "EdbSegP" , &s1 ,32000 ,99 ) ;
299 couples->Branch( "s2." , "EdbSegP" , &s2 ,32000 ,99 ) ;
300 couples->Branch( "s." , "EdbSegP" , &s ,32000 ,99 ) ;
301
302
303 // CREATE TEMPORARY ARRAY to store top and Bottom
304
305 //base = new TClonesArray("EdbSegP", 100) ;
306 if ( segtop.GetEntriesFast() ) segtop.Delete() ;
307 if ( segbot.GetEntriesFast() ) segbot.Delete() ;
308
309 // create dummy variables to read unused field
310 Char_t dummych ;
311 UShort_t dummyus ;
312 UInt_t dummyui ;
313 Float_t dummyf ;
314 Double_t dummyd ;
315
316 // Initialize the transformation
325
326 // Read File
327 //fstream infile(input_file, ios::in | ios::binary);
328 fstream infile(input_file, ios::in | ios::binary);
329
330 using namespace Header;
331 infile.read( (Char_t*) &infotype , sizeof(Char_t) );
332 infile.read( (Char_t*) &headerformat , sizeof(UShort_t) );
333
334 if (infotype == ((Char_t) File::Info::Track | (Char_t)File::Section::Header))
335 switch (headerformat)
336 {
337 case (UShort_t) File::Format::MultiSection: break;
338 case (UShort_t) File::Format::Detailed : break;
339 case (UShort_t) File::Format::NormalDouble_tWithIndex : break;
340 case (UShort_t) File::Format::NormalWithIndex : break;
341 case (UShort_t) File::Format::Normal : break;
342 case (UShort_t) File::Format::NoExtents : break;
343 case (UShort_t) File::Format::Old : break;
344 case (UShort_t) File::Format::Old2 : break;
345
346 default: { cout << "Unknown format\n"; return ; }
347 };
348
350 {
351 infile.read( (Char_t*) &dummych , sizeof(Char_t) );
352 if (dummych != SectionTag)
353 {
354 cout << "The first section in a TLG file must contain tracks!" << endl;
355 return;
356 }
357 infile.read( (Char_t*) &dummyd , sizeof(Double_t) );
358 }
359
360 int i;
361
366
367 if (headerformat == (UShort_t) File::Format::Old)
368 {
369 infile.read( (Char_t*) &Identifier::Part3 , sizeof(Int_t) );
371 }
372 else
373 {
374 infile.read( (Char_t*) &Identifier::Part0 , sizeof(Int_t) );
375 infile.read( (Char_t*) &Identifier::Part1 , sizeof(Int_t) );
376 infile.read( (Char_t*) &Identifier::Part2 , sizeof(Int_t) );
377 infile.read( (Char_t*) &Identifier::Part3 , sizeof(Int_t) );
378 }
379
381 {
382 infile.read( (Char_t*) &Center::X , sizeof(Double_t) );
383 infile.read( (Char_t*) &Center::Y , sizeof(Double_t) );
384 infile.read( (Char_t*) &Extents::MinX , sizeof(Double_t) );
385 infile.read( (Char_t*) &Extents::MaxX , sizeof(Double_t) );
386 infile.read( (Char_t*) &Extents::MinX , sizeof(Double_t) );
387 infile.read( (Char_t*) &Extents::MaxY , sizeof(Double_t) );
388 infile.read( (Char_t*) &Transform::MXX , sizeof(Double_t) );
389 infile.read( (Char_t*) &Transform::MXY , sizeof(Double_t) );
390 infile.read( (Char_t*) &Transform::MYX , sizeof(Double_t) );
391 infile.read( (Char_t*) &Transform::MYY , sizeof(Double_t) );
392 infile.read( (Char_t*) &Transform::TX , sizeof(Double_t) );
393 infile.read( (Char_t*) &Transform::TY , sizeof(Double_t) );
394 infile.read( (Char_t*) &Transform::RX , sizeof(Double_t) );
395 infile.read( (Char_t*) &Transform::RY , sizeof(Double_t) );
396
397
398 infile.read( (Char_t*) &TopViewsLength , sizeof(Int_t) ); // n. of View
399 infile.read( (Char_t*) &BottomViewsLength , sizeof(Int_t) ); // n. of View
400 infile.read( (Char_t*) &Top_TopZ , sizeof(Double_t) ); // topext
401 infile.read( (Char_t*) &Top_BottomZ , sizeof(Double_t) ); // topInt_t
402 infile.read( (Char_t*) &Bottom_TopZ , sizeof(Double_t) ); // bottomInt_t
403 infile.read( (Char_t*) &Bottom_BottomZ , sizeof(Double_t) ); // bottomext
404
405 using namespace View ;
406 for (int s=0; s<2; s++ ) {
407 int nviews = ( s==0 ? TopViewsLength : BottomViewsLength );
408 for (int i=0; i<nviews; i++ ) {
409 infile.read( (Char_t*) &id , sizeof(Int_t) );
410 infile.read( (Char_t*) &px , sizeof(Double_t) );
411 infile.read( (Char_t*) &py , sizeof(Double_t) );
412 infile.read( (Char_t*) &topz , sizeof(Double_t) );
413 infile.read( (Char_t*) &bottomz , sizeof(Double_t) );
414 // print_View( s, i ) ;
415 }
416 }
417
418 infile.read( (Char_t*) &TopTracksLength , sizeof(Int_t) );
419 infile.read( (Char_t*) &BottomTracksLength , sizeof(Int_t) );
420 infile.read( (Char_t*) &TracksLength , sizeof(Int_t) );
421
422 print_Header();
423
424 using namespace MIPEmulsionTrack ;
425 for (int s=0; s<2; s++ ) {
426 en_side side = ( s==0? TOP : BOT ) ;
427 int ntracks = ( s==0 ? TopTracksLength : BottomTracksLength );
428 for (int i=0; i<ntracks; i++ ) {
429 // 84 bytes
430 infile.read( (Char_t*) &Field , sizeof(UInt_t) );
431 infile.read( (Char_t*) &AreaSum , sizeof(UInt_t) );
432 infile.read( (Char_t*) &Count , sizeof(UInt_t) );
433 infile.read( (Char_t*) &X , sizeof(Double_t) );
434 infile.read( (Char_t*) &Y , sizeof(Double_t) );
435 infile.read( (Char_t*) &Z , sizeof(Double_t) );
436 infile.read( (Char_t*) &SX , sizeof(Double_t) );
437 infile.read( (Char_t*) &SY , sizeof(Double_t) );
438 infile.read( (Char_t*) &SZ , sizeof(Double_t) );
439 infile.read( (Char_t*) &Sigma , sizeof(Double_t) );
440 infile.read( (Char_t*) &TopZ , sizeof(Double_t) );
441 infile.read( (Char_t*) &BottomZ , sizeof(Double_t) );
442 infile.read( (Char_t*) &viewid , sizeof(Int_t) );
443
444 // print_MIPEmulsionTrack( s, i ) ;
445 Add_MIPEmulsionTrack ( side, i ) ;
446 }
447 }
448
449 using namespace MIPBaseTrack ;
450 for (int i=0; i<TracksLength; i++ ) {
451 // .. bytes
452 infile.read( (Char_t*) &MIPBaseTrack::AreaSum , sizeof(UInt_t) );
453 infile.read( (Char_t*) &MIPBaseTrack::Count , sizeof(UInt_t) );
454 infile.read( (Char_t*) &MIPBaseTrack::X , sizeof(Double_t) );
455 infile.read( (Char_t*) &MIPBaseTrack::Y , sizeof(Double_t) );
456 infile.read( (Char_t*) &MIPBaseTrack::Z , sizeof(Double_t) );
457 infile.read( (Char_t*) &MIPBaseTrack::SX , sizeof(Double_t) );
458 infile.read( (Char_t*) &MIPBaseTrack::SY , sizeof(Double_t) );
459 infile.read( (Char_t*) &MIPBaseTrack::SZ , sizeof(Double_t) );
460 infile.read( (Char_t*) &MIPBaseTrack::Sigma , sizeof(Double_t) );
461 infile.read( (Char_t*) &MIPBaseTrack::TopId , sizeof(Int_t) );
462 infile.read( (Char_t*) &MIPBaseTrack::BottomId , sizeof(Int_t) );
463
464 // print_MIPBaseTrack( i ) ;
465 Add_MIPBaseTrack( i , project_dz) ;
466 }
467
468 using namespace TrackIndexEntry;
469 for (int s=0; s<2; s++ ) {
470 int ntracks = ( s==0 ? TopTracksLength : BottomTracksLength );
471 for (int i=0; i<ntracks; i++ )
472 {
473 infile.read( (Char_t*) &TrackIndexEntry::Fragment , sizeof(Int_t) );
474 infile.read( (Char_t*) &TrackIndexEntry::View , sizeof(Int_t) );
475 infile.read( (Char_t*) &TrackIndexEntry::Track , sizeof(Int_t) );
476
477 // printrackIndexEntry( s , i ) ;
478 }
479 }
480 }
482 {
483 using namespace Header;
484 infile.read( (Char_t*) &Center::X , sizeof(Double_t) );
485 infile.read( (Char_t*) &Center::Y , sizeof(Double_t) );
486 infile.read( (Char_t*) &Extents::MinX , sizeof(Double_t) );
487 infile.read( (Char_t*) &Extents::MaxX , sizeof(Double_t) );
488 infile.read( (Char_t*) &Extents::MinX , sizeof(Double_t) );
489 infile.read( (Char_t*) &Extents::MaxY , sizeof(Double_t) );
490 infile.read( (Char_t*) &dummyf , sizeof(Float_t) ); // for format compliance
491
492 // 16 bytes
493 infile.read( (Char_t*) &TopTracksLength , sizeof(Int_t) ); // n. of MIPIndexedEmulsionTrack
494 infile.read( (Char_t*) &BottomTracksLength , sizeof(Int_t) ); // n. of MIPIndexedEmulsionTrack
495 infile.read( (Char_t*) &TracksLength , sizeof(Int_t) ); // n. of MIPBaseTrack
496 infile.read( (Char_t*) &dummyui , sizeof(UInt_t) ); // count of fields
497
498 // 34 bytes
499 infile.read( (Char_t*) &Top_TopZ , sizeof(Double_t) ); // topext
500 infile.read( (Char_t*) &Top_BottomZ , sizeof(Double_t) ); // topInt_t
501 infile.read( (Char_t*) &Bottom_TopZ , sizeof(Double_t) ); // bottomInt_t
502 infile.read( (Char_t*) &Bottom_BottomZ , sizeof(Double_t) ); // bottomext
503 infile.read( (Char_t*) &dummych , sizeof(Char_t) ); // skip fields
504 infile.read( (Char_t*) &dummych , sizeof(Char_t) ); // skip fields
505
506 print_Header();
507
508 using namespace MIPEmulsionTrack ;
509 for (int s=0; s<2; s++ ) {
510 en_side side = ( s==0? TOP : BOT ) ;
511 int ntracks = ( s==0 ? TopTracksLength : BottomTracksLength );
512 for (int i=0; i<ntracks; i++ ) {
513 // 84 bytes
514 infile.read( (Char_t*) &Field , sizeof(UInt_t) );
515 infile.read( (Char_t*) &AreaSum , sizeof(UInt_t) );
516 infile.read( (Char_t*) &Count , sizeof(UInt_t) );
517 infile.read( (Char_t*) &X , sizeof(Double_t) );
518 infile.read( (Char_t*) &Y , sizeof(Double_t) );
519 infile.read( (Char_t*) &Z , sizeof(Double_t) );
520 infile.read( (Char_t*) &SX , sizeof(Double_t) );
521 infile.read( (Char_t*) &SY , sizeof(Double_t) );
522 infile.read( (Char_t*) &SZ , sizeof(Double_t) );
523 infile.read( (Char_t*) &Sigma , sizeof(Double_t) );
524 infile.read( (Char_t*) &TopZ , sizeof(Double_t) );
525 infile.read( (Char_t*) &BottomZ , sizeof(Double_t) );
526
527 //print_MIPEmulsionTrack( s, i ) ;
528 Add_MIPEmulsionTrack ( side , i );
529 }
530 }
531
532 using namespace MIPBaseTrack ;
533 for (int i=0; i<TracksLength; i++ ) {
534 // .. bytes
535 infile.read( (Char_t*) &MIPBaseTrack::AreaSum , sizeof(UInt_t) );
536 infile.read( (Char_t*) &MIPBaseTrack::Count , sizeof(UInt_t) );
537 infile.read( (Char_t*) &MIPBaseTrack::X , sizeof(Double_t) );
538 infile.read( (Char_t*) &MIPBaseTrack::Y , sizeof(Double_t) );
539 infile.read( (Char_t*) &MIPBaseTrack::Z , sizeof(Double_t) );
540 infile.read( (Char_t*) &MIPBaseTrack::SX , sizeof(Double_t) );
541 infile.read( (Char_t*) &MIPBaseTrack::SY , sizeof(Double_t) );
542 infile.read( (Char_t*) &MIPBaseTrack::SZ , sizeof(Double_t) );
543 infile.read( (Char_t*) &MIPBaseTrack::Sigma , sizeof(Double_t) );
544 if (headerformat == (UShort_t)File::Format::NoExtents) {
545 // Int_tercept errors and slope errors
546 for (int j=0; j<6; j++)
547 infile.read( (Char_t*) &dummyd , sizeof(Double_t) );
548 }
549 infile.read( (Char_t*) &MIPBaseTrack::TopId , sizeof(Int_t) );
550 infile.read( (Char_t*) &MIPBaseTrack::BottomId , sizeof(Int_t) );
551
552 //print_MIPBaseTrack( i ) ;
553 Add_MIPBaseTrack( i , project_dz ) ;
554 }
555
556 using namespace TrackIndexEntry ;
557 for (int s=0; s<2; s++ ) {
558 int ntracks = ( s==0 ? TopTracksLength : BottomTracksLength );
559 for (int i=0; i<ntracks; i++ )
560 {
561 infile.read( (Char_t*) &TrackIndexEntry::Fragment , sizeof(Int_t) );
562 infile.read( (Char_t*) &TrackIndexEntry::View , sizeof(Int_t) );
563 infile.read( (Char_t*) &TrackIndexEntry::Track , sizeof(Int_t) );
564
565 //printrackIndexEntry( s , i ) ;
566 }
567 }
568 }
569 else
570 {
571
572 /*
573 if (headerformat == (ushort)File.Format.Normal || headerformat == (ushort)File.Format.NormalWithIndex)
574 {
575 m_Extents.MinX = r.ReadSingle();
576 m_Extents.MaxX = r.ReadSingle();
577 m_Extents.MinY = r.ReadSingle();
578 m_Extents.MaxY = r.ReadSingle();
579 r.ReadSingle(); //skip a meaningless Float_t...
580 }
581 else
582 {
583 r.ReadSingle(); r.ReadSingle();
584 r.ReadSingle(); r.ReadSingle(); r.ReadSingle();
585 m_Extents.MinX = m_Extents.MaxX = m_Center.X;
586 m_Extents.MinY = m_Extents.MaxY = m_Center.Y;
587 }
588
589 View topview = new View();
590 View bottomview = new View();
591 MIPIndexedEmulsionTrack [] toptracks = new MIPIndexedEmulsionTrack[r.ReadUInt_t32()];
592 MIPIndexedEmulsionTrack [] bottomtracks = new MIPIndexedEmulsionTrack[r.ReadUInt_t32()];
593 m_Tracks = new MIPBaseTrack[r.ReadUInt_t32()];
594
595 i = r.ReadInt_t32(); // count of fields
596
597 Double_t topext, topInt_t, bottomInt_t, bottomext;
598 topext = r.ReadSingle();
599 topInt_t = r.ReadSingle();
600 bottomInt_t = r.ReadSingle();
601 bottomext = r.ReadSingle();
602
603 r.ReadBytes(2 * i); // skip fields
604
605 MIPIndexedEmulsionTrack [] tkarr = toptracks;
606 View vw = topview;
607 do
608 {
609 if (headerformat == (ushort)File.Format.Normal || headerformat == (ushort)File.Format.NormalWithIndex)
610 {
611 for (i = 0; i < tkarr.Length; i++)
612 {
613 MIPEmulsionTrackInfo info = new MIPEmulsionTrackInfo();
614 info.Field = r.ReadUInt_t32();
615 info.AreaSum = r.ReadUInt_t32();
616 info.Count = (ushort)r.ReadUInt_t32();
617 info.Int_tercept.X = r.ReadSingle();
618 info.Int_tercept.Y = r.ReadSingle();
619 info.Int_tercept.Z = r.ReadSingle();
620 info.Slope.X = r.ReadSingle();
621 info.Slope.Y = r.ReadSingle();
622 info.Slope.Z = r.ReadSingle();
623 info.Sigma = r.ReadSingle();
624 info.TopZ = r.ReadSingle();
625 info.BottomZ = r.ReadSingle();
626 tkarr[i] = new MIPIndexedEmulsionTrack(info, i, vw);
627 }
628 }
629 else
630 {
631 if (headerformat == (ushort)File.Format.NoExtents)
632 for (i = 0; i < tkarr.Length; i++)
633 {
634 MIPEmulsionTrackInfo info = new MIPEmulsionTrackInfo();
635 info.AreaSum = 0;
636 info.Field = r.ReadUInt_t32();
637 info.Count = (ushort)r.ReadUInt_t32();
638 info.Int_tercept.X = r.ReadSingle();
639 info.Int_tercept.Y = r.ReadSingle();
640 info.Int_tercept.Z = r.ReadSingle();
641 info.Slope.X = r.ReadSingle();
642 info.Slope.Y = r.ReadSingle();
643 info.Slope.Z = r.ReadSingle();
644 info.Sigma = r.ReadSingle();
645 info.TopZ = r.ReadSingle();
646 info.BottomZ = r.ReadSingle();
647 r.ReadSingle(); r.ReadSingle(); r.ReadSingle(); // Int_tercept errors
648 r.ReadSingle(); r.ReadSingle(); r.ReadSingle(); // slope errors
649 tkarr[i] = new MIPIndexedEmulsionTrack(info, i, vw);
650 }
651 else
652 for (i = 0; i < tkarr.Length; i++)
653 {
654 MIPEmulsionTrackInfo info = new MIPEmulsionTrackInfo();
655 info.AreaSum = 0;
656 info.Field = r.ReadUInt_t32();
657 info.Count = (ushort)r.ReadUInt_t32();
658 r.ReadSingle(); r.ReadSingle(); r.ReadSingle();
659 info.Int_tercept.X = r.ReadSingle();
660 info.Int_tercept.Y = r.ReadSingle();
661 info.Int_tercept.Z = r.ReadSingle();
662 info.Slope.X = r.ReadSingle();
663 info.Slope.Y = r.ReadSingle();
664 info.Slope.Z = r.ReadSingle();
665 info.Sigma = r.ReadSingle();
666 info.TopZ = r.ReadSingle();
667 info.BottomZ = r.ReadSingle();
668 tkarr[i] = new MIPIndexedEmulsionTrack(info, i, vw);
669 }
670 }
671 tkarr = (tkarr == toptracks) ? bottomtracks : null;
672 vw = (vw == topview) ? bottomview : null;
673 }
674 while (tkarr != null);
675
676 m_Top = new Side(topext, topInt_t);
677 m_Bottom = new Side(bottomInt_t, bottomext);
678 ((Side)m_Top).SetViews(new View[1] { topview });
679 ((Side)m_Bottom).SetViews(new View[1] { bottomview });
680 ((Side)m_Top).SetTracks(toptracks);
681 ((Side)m_Bottom).SetTracks(bottomtracks);
682 topview.m_Side = (Side)m_Top;
683 bottomview.m_Side = (Side)m_Bottom;
684 topview.m_Tracks = toptracks;
685 bottomview.m_Tracks = bottomtracks;
686 topview.m_Id = 0;
687 bottomview.m_Id = 0;
688 topview.m_Position.X = bottomview.m_Position.X = m_Center.X;
689 topview.m_Position.Y = bottomview.m_Position.Y = m_Center.Y;
690 topview.m_TopZ = m_Top.TopZ;
691 topview.m_BottomZ = m_Top.BottomZ;
692 bottomview.m_TopZ = m_Bottom.TopZ;
693 bottomview.m_BottomZ = m_Bottom.BottomZ;
694
695 if (headerformat == (ushort)File.Format.Normal || headerformat == (ushort)File.Format.NormalWithIndex)
696 {
697 for (i = 0; i < m_Tracks.Length; i++)
698 {
699 MIPEmulsionTrackInfo info = new MIPEmulsionTrackInfo();
700 info.AreaSum = (ushort)r.ReadUInt_t32();
701 info.Count = (ushort)r.ReadUInt_t32();
702 info.Int_tercept.X = r.ReadSingle();
703 info.Int_tercept.Y = r.ReadSingle();
704 info.Int_tercept.Z = r.ReadSingle();
705 info.Slope.X = r.ReadSingle();
706 info.Slope.Y = r.ReadSingle();
707 info.Slope.Z = r.ReadSingle();
708 info.Sigma = r.ReadSingle();
709 if (headerformat == (ushort)File.Format.NoExtents)
710 {
711 r.ReadSingle(); r.ReadSingle(); r.ReadSingle(); // Int_tercept errors
712 r.ReadSingle(); r.ReadSingle(); r.ReadSingle(); // slope errors
713 }
714 MIPIndexedEmulsionTrack toptk = (MIPIndexedEmulsionTrack)m_Top.m_Tracks[r.ReadUInt_t32()];
715 MIPIndexedEmulsionTrack bottomtk = (MIPIndexedEmulsionTrack)m_Bottom.m_Tracks[r.ReadUInt_t32()];
716 info.TopZ = MIPIndexedEmulsionTrack.GetInfo(toptk).TopZ;
717 info.BottomZ = MIPIndexedEmulsionTrack.GetInfo(bottomtk).BottomZ;
718 m_Tracks[i] = new MIPBaseTrack(info, toptk, bottomtk, i);
719 }
720 }
721 else
722 {
723 if (headerformat == (ushort)File.Format.NoExtents)
724 {
725 for (i = 0; i < m_Tracks.Length; i++)
726 {
727 MIPEmulsionTrackInfo info = new MIPEmulsionTrackInfo();
728 info.AreaSum = 0;
729 info.Count = (ushort)r.ReadUInt_t32();
730 info.Int_tercept.X = r.ReadSingle();
731 info.Int_tercept.Y = r.ReadSingle();
732 info.Int_tercept.Z = r.ReadSingle();
733 info.Slope.X = r.ReadSingle();
734 info.Slope.Y = r.ReadSingle();
735 info.Slope.Z = r.ReadSingle();
736 info.Sigma = r.ReadSingle();
737 r.ReadSingle(); r.ReadSingle(); r.ReadSingle(); // Int_tercept errors
738 r.ReadSingle(); r.ReadSingle(); r.ReadSingle(); // slope errors
739 MIPIndexedEmulsionTrack toptk = (MIPIndexedEmulsionTrack)m_Top.m_Tracks[r.ReadUInt_t32()];
740 MIPIndexedEmulsionTrack bottomtk = (MIPIndexedEmulsionTrack)m_Bottom.m_Tracks[r.ReadUInt_t32()];
741 info.TopZ = MIPIndexedEmulsionTrack.GetInfo(toptk).TopZ;
742 info.BottomZ = MIPIndexedEmulsionTrack.GetInfo(bottomtk).BottomZ;
743 m_Tracks[i] = new MIPBaseTrack(info, toptk, bottomtk, i);
744 }
745 }
746 else
747 {
748 for (i = 0; i < m_Tracks.Length; i++)
749 {
750 MIPEmulsionTrackInfo info = new MIPEmulsionTrackInfo();
751 info.Count = (ushort)r.ReadUInt_t32();
752 info.Int_tercept.X = r.ReadSingle();
753 info.Int_tercept.Y = r.ReadSingle();
754 info.Int_tercept.Z = r.ReadSingle();
755 info.Slope.X = r.ReadSingle();
756 info.Slope.Y = r.ReadSingle();
757 info.Slope.Z = r.ReadSingle();
758 info.Sigma = r.ReadSingle();
759 MIPIndexedEmulsionTrack toptk = (MIPIndexedEmulsionTrack)m_Top.m_Tracks[r.ReadUInt_t32()];
760 MIPIndexedEmulsionTrack bottomtk = (MIPIndexedEmulsionTrack)m_Bottom.m_Tracks[r.ReadUInt_t32()];
761 info.AreaSum = MIPIndexedEmulsionTrack.GetInfo(toptk).AreaSum + MIPIndexedEmulsionTrack.GetInfo(bottomtk).AreaSum;
762 info.TopZ = MIPIndexedEmulsionTrack.GetInfo(toptk).TopZ;
763 info.BottomZ = MIPIndexedEmulsionTrack.GetInfo(bottomtk).BottomZ;
764 m_Tracks[i] = new MIPBaseTrack(info, toptk, bottomtk, i);
765 }
766 }
767 }
768 if (headerformat == (ushort)File.Format.NormalWithIndex)
769 {
770 tkarr = (MIPIndexedEmulsionTrack [])m_Top.m_Tracks;
771 while (true)
772 {
773 for (i = 0; i < tkarr.Length; i++)
774 {
775 tkarr[i].m_OriginalRawData.Fragment = r.ReadInt_t32();
776 tkarr[i].m_OriginalRawData.View = r.ReadInt_t32();
777 tkarr[i].m_OriginalRawData.Track = r.ReadInt_t32();
778 }
779 if (tkarr == (MIPIndexedEmulsionTrack [])m_Top.m_Tracks) tkarr = (MIPIndexedEmulsionTrack [])m_Bottom.m_Tracks; else break;
780 }
781 }
782 */
783 }
784
785 infile.close() ;
786
787 o->Write();
788 o->Close();
789
790}
AcqOdyssey * o
Definition: hwinit.C:2
return
Definition: energy.C:49
void Add_MIPBaseTrack(int i, float project_dz=-105.)
Definition: tlg2couples.C:234
void print_Header()
Definition: tlg2couples.C:141
void Add_MIPEmulsionTrack(en_side side, int i)
Definition: tlg2couples.C:202
en_side
Definition: tlg2couples.C:36
Float_t dummyf
Definition: merge_Energy_SytematicSources_Electron.C:9
@ NormalWithIndex
Definition: tlg2couples.C:58
@ NormalDouble_tWithIndex
Definition: tlg2couples.C:59
@ NoExtents
Definition: tlg2couples.C:56
@ Old
Definition: tlg2couples.C:54
@ Detailed
Definition: tlg2couples.C:60
@ Old2
Definition: tlg2couples.C:55
@ Normal
Definition: tlg2couples.C:57
@ MultiSection
Definition: tlg2couples.C:61
@ Track
Definition: tlg2couples.C:52
@ Header
Definition: tlg2couples.C:53
const Char_t SectionTag
Definition: tlg2couples.C:66
UInt_t id
Definition: tlg2couples.C:117

Variable Documentation

◆ couples

TTree* couples

◆ cp

EdbSegCouple* cp = 0

◆ Pid1

Int_t Pid1 =0

◆ Pid2

Int_t Pid2 =0

◆ s

EdbSegP* s = 0

◆ s1

EdbSegP* s1 = 0

◆ s2

EdbSegP* s2 = 0

◆ Xv

Float_t Xv =0

◆ Yv

Float_t Yv =0