46 |
#include <TEllipse.h> |
#include <TEllipse.h> |
47 |
#include <TArrow.h> |
#include <TArrow.h> |
48 |
#include <TStyle.h> |
#include <TStyle.h> |
49 |
|
#include <TStreamerElement.h> |
50 |
|
#include <TRealData.h> |
51 |
// |
// |
52 |
#include <PamelaRun.h> |
#include <PamelaRun.h> |
53 |
#include <physics/calorimeter/CalorimeterEvent.h> |
#include <physics/calorimeter/CalorimeterEvent.h> |
88 |
var.SHOWDEC = 0; |
var.SHOWDEC = 0; |
89 |
var.TOF = 0; |
var.TOF = 0; |
90 |
var.AC = 0; |
var.AC = 0; |
91 |
|
var.RUN = 1; |
92 |
var.TRK = 0; |
var.TRK = 0; |
93 |
|
var.ORB = 0; |
94 |
|
var.TRG = 0; |
95 |
var.CALO = 0; |
var.CALO = 0; |
96 |
var.S4 = 0; |
var.S4 = 0; |
97 |
var.ND = 0; |
var.ND = 0; |
127 |
}; |
}; |
128 |
} |
} |
129 |
|
|
130 |
|
void FEVdetector::SetDDEC(TString de){ |
131 |
|
ddec=de; |
132 |
|
}; |
133 |
|
|
134 |
void FEVdetector::GetWindow(){ |
void FEVdetector::GetWindow(){ |
135 |
otr->GetEntry(maxevent); |
otr->GetEntry(maxevent); |
136 |
|
// |
137 |
if ( level.file < 2 ){ |
if ( level.file < 2 ){ |
138 |
ph = eh->GetPscuHeader(); |
ph = eh->GetPscuHeader(); |
139 |
lastevno = (int)ph->Counter; |
lastevno = (int)ph->Counter; |
140 |
} else { |
} else { |
141 |
lastevno = L2->GetOrbitalInfo()->pkt_num; // to be changed as soon as we will have pkt_counter in the level2 file! |
if ( var.ORB ){ |
142 |
|
lastevno = L2->GetOrbitalInfo()->pkt_num; |
143 |
|
} else { |
144 |
|
lastevno = 0; |
145 |
|
}; |
146 |
}; |
}; |
147 |
otr->GetEntry(minevent); |
otr->GetEntry(minevent); |
148 |
if ( level.file < 2 ){ |
if ( level.file < 2 ){ |
149 |
ph = eh->GetPscuHeader(); |
ph = eh->GetPscuHeader(); |
150 |
firstevno = (int)ph->Counter; |
firstevno = (int)ph->Counter; |
151 |
} else { |
} else { |
152 |
firstevno = L2->GetOrbitalInfo()->pkt_num; // to be changed as soon as we will have pkt_counter in the level2 file! |
if ( var.ORB ){ |
153 |
|
firstevno = L2->GetOrbitalInfo()->pkt_num; |
154 |
|
} else { |
155 |
|
firstevno = 0; |
156 |
|
}; |
157 |
}; |
}; |
158 |
} |
} |
159 |
|
|
179 |
void FEVdetector::GetEntry(Int_t i){ |
void FEVdetector::GetEntry(Int_t i){ |
180 |
thisentry = i; |
thisentry = i; |
181 |
otr->GetEntry(i); |
otr->GetEntry(i); |
182 |
|
// if ( level.file == 2 ){ |
183 |
|
// ShowInfo("TrkLevel2"); |
184 |
|
// ShowInfo("ToFLevel2"); |
185 |
|
// ShowInfo("CaloLevel2"); |
186 |
|
// }; |
187 |
|
// PrintData(otr,-1LL,44); |
188 |
} |
} |
189 |
|
|
190 |
void FEVdetector::SetEntry(Int_t i){ |
void FEVdetector::SetEntry(Int_t i){ |
305 |
}; |
}; |
306 |
} |
} |
307 |
|
|
308 |
|
void FEVdetector::PrintLeaves(TTree *otr, Int_t i, TBranchElement *tb, Int_t lenmax){ |
309 |
|
// -- Prints values of leaves. |
310 |
|
|
311 |
|
// tb->ValidateAddress(); |
312 |
|
printf("son qua \n"); |
313 |
|
|
314 |
|
// if (otr->GetMakeClass()) { |
315 |
|
if (!tb->GetAddress()) { |
316 |
|
printf("esco \n"); |
317 |
|
return; |
318 |
|
} |
319 |
|
if (tb->GetType() == 3 || tb->GetType() == 4) { |
320 |
|
// TClonesArray or STL container top-level branch. |
321 |
|
printf("3 o 4 %-15s = %d\n", tb->GetName(), tb->GetNdata()); |
322 |
|
return; |
323 |
|
} else if (tb->GetType() == 31 || tb->GetType() == 41) { |
324 |
|
printf(" 31 o 41 \n"); |
325 |
|
// TClonesArray or STL container sub-branch. |
326 |
|
Int_t n = TMath::Min(10, tb->GetNdata()); |
327 |
|
Int_t atype = tb->GetStreamerType() + 20; |
328 |
|
if (tb->GetStreamerType() == 1) { |
329 |
|
// TVirtualStreamerInfo::kOffsetL + TVirtualStreamerInfo::kChar is |
330 |
|
// printed as a string and could print weird characters. |
331 |
|
// So we print an unsigned char instead (not perfect, but better). |
332 |
|
atype = 20 + 11 ; |
333 |
|
} |
334 |
|
if (atype > 54) { |
335 |
|
// FIXME: More logic required here (like in ReadLeaves) |
336 |
|
printf(">54 %-15s = %d\n", tb->GetName(), tb->GetNdata()); |
337 |
|
return; |
338 |
|
} |
339 |
|
if (tb->GetStreamerType() > 20) { |
340 |
|
atype -= 20; |
341 |
|
// TObjArray *prova= otr->GetListOfLeaves(); |
342 |
|
// // TObjArray* leaf2 = (TObjArray*) prova->UncheckedAt(i); |
343 |
|
// //TLeaf* leaf = (TLeaf*)(otr->GetLeaf(tb->GetName())); |
344 |
|
// // TLeafElement* leaf = (TLeafElement*)((TLeaf*)(otr->GetListOfLeaves()->UncheckedAt(i))->GetBranch()->UncheckedAt(0)); |
345 |
|
// TLeafElement* leaf = (TLeafElement*)(prova->UncheckedAt(0)); |
346 |
|
// n = n * leaf->GetLenStatic(); |
347 |
|
} |
348 |
|
if (tb->GetInfo()) { |
349 |
|
// n = 16; |
350 |
|
// tb->GetInfo()->PrintValue(tb->GetName(), tb->GetAddress(), atype, n, lenmax); |
351 |
|
//tb->GetObject()->GetInfo()->PrintValue(tb->GetName(), tb->GetObject(), atype, n, lenmax); |
352 |
|
} |
353 |
|
return; |
354 |
|
} else if (tb->GetType() <= 2) { |
355 |
|
printf(" <=2 \n"); |
356 |
|
// Branch in split mode. |
357 |
|
// FIXME: This should probably be < 60 instead. |
358 |
|
if ((tb->GetStreamerType() > 40) && (tb->GetStreamerType() < 55)) { |
359 |
|
Int_t atype = tb->GetStreamerType() - 20; |
360 |
|
TBranchElement* counterElement = (TBranchElement*) tb->GetBranchCount(); |
361 |
|
Int_t n = (Int_t) counterElement->GetValue(0, 0); |
362 |
|
if (tb->GetInfo()) { |
363 |
|
tb->GetInfo()->PrintValue(tb->GetName(), tb->GetAddress(), atype, n, lenmax); |
364 |
|
} |
365 |
|
} else { |
366 |
|
// if (tb->GetInfo()) { |
367 |
|
// tb->GetInfo()->PrintValue(tb->GetName(), tb->GetObject(), tb->GetID(), -1, lenmax); |
368 |
|
// } |
369 |
|
// } |
370 |
|
return; |
371 |
|
} |
372 |
|
} else if (tb->GetType() == 3) { |
373 |
|
printf("3 %-15s = %d\n", tb->GetName(), tb->GetNdata()); |
374 |
|
} else if (tb->GetType() == 31) { |
375 |
|
printf("31 %-15s = %d\n", tb->GetName(), tb->GetNdata()); |
376 |
|
// TClonesArray* clones = (TClonesArray*) tb->GetObject(); |
377 |
|
// if (tb->GetInfo()) { |
378 |
|
// tb->GetInfo()->PrintValueClones(tb->GetName(), clones, tb->GetID(), tb->GetOffset(), lenmax); |
379 |
|
// } |
380 |
|
} else if (tb->GetType() == 41) { |
381 |
|
printf("41 %-15s = %d\n", tb->GetName(), tb->GetNdata()); |
382 |
|
// TVirtualCollectionProxy::TPushPop helper(((TBranchElement*) this)->GetCollectionProxy(), fObject); |
383 |
|
// if (GetInfo()) { |
384 |
|
// GetInfo()->PrintValueSTL(GetName(), ((TBranchElement*) this)->GetCollectionProxy(), fID, fOffset, lenmax); |
385 |
|
// } |
386 |
|
} else { |
387 |
|
printf("else %-15s = %d\n", tb->GetName(), tb->GetNdata()); |
388 |
|
// if (GetInfo()) { |
389 |
|
// GetInfo()->PrintValue(GetName(), fObject, fID, -1, lenmax); |
390 |
|
// } |
391 |
|
} |
392 |
|
|
393 |
|
// }; |
394 |
|
printf("esco qui\n"); |
395 |
|
}; |
396 |
|
|
397 |
|
|
398 |
|
void FEVdetector::ShowInfo(TString detector){ |
399 |
|
// |
400 |
|
TBranch *b1 = 0; |
401 |
|
TBranch *b3 = 0; |
402 |
|
TObjArray *branch_array = 0; |
403 |
|
TObjArray *leaf_array = 0; |
404 |
|
// |
405 |
|
b1 = otr->FindBranch(detector.Data()); |
406 |
|
Int_t dlen = 44; |
407 |
|
// |
408 |
|
printf("======> EVENT:%i\n", thisentry); |
409 |
|
// |
410 |
|
printf("Branch %s\n",b1->GetName()); |
411 |
|
branch_array = b1->GetListOfBranches(); |
412 |
|
// |
413 |
|
Int_t j = 0; |
414 |
|
// |
415 |
|
for(Int_t l=0;l<(branch_array->GetLast()+1);l++){ |
416 |
|
// |
417 |
|
TBranchElement *tb = (TBranchElement*)branch_array->At(l); |
418 |
|
Int_t type = tb->GetType(); |
419 |
|
Int_t atype = tb->GetStreamerType() - 20; |
420 |
|
Int_t len = (tb->GetInfo()->GetLengths())[tb->GetID()]; |
421 |
|
Int_t length = min(len,dlen); |
422 |
|
// printf("SubBranches : %s type is %i tb getname %s\n",((TBranch*)branch_array->At(l))->GetName(),type,tb->GetName()); |
423 |
|
switch (type){ |
424 |
|
case 0: |
425 |
|
// |
426 |
|
// IS A VARIABLE |
427 |
|
// |
428 |
|
// |
429 |
|
// NAME |
430 |
|
// |
431 |
|
// printf(" ATYPE IS %i \n",atype); |
432 |
|
printf(" %-15s =",((TBranch*)branch_array->At(l))->GetName()); |
433 |
|
j = 0; |
434 |
|
// |
435 |
|
// VALUES |
436 |
|
// |
437 |
|
if ( atype == 3 || atype == -17 ){ |
438 |
|
while ( j < length ){ |
439 |
|
if ( j < length -1 ){ |
440 |
|
printf(" %llu ,",(ULong64_t)tb->GetValue(j,0)); |
441 |
|
} else { |
442 |
|
printf(" %llu",(ULong64_t)tb->GetValue(j,0)); |
443 |
|
}; |
444 |
|
j++; |
445 |
|
}; |
446 |
|
} else { |
447 |
|
while ( j < length ){ |
448 |
|
if ( j < length -1 ){ |
449 |
|
printf(" %f ,",tb->GetValue(j,0)); |
450 |
|
} else { |
451 |
|
printf(" %f",tb->GetValue(j,0)); |
452 |
|
}; |
453 |
|
j++; |
454 |
|
}; |
455 |
|
}; |
456 |
|
printf("\n"); |
457 |
|
break; |
458 |
|
case 3: |
459 |
|
// |
460 |
|
// IS A TCLONESARRAY |
461 |
|
// |
462 |
|
printf(" %-15s = %d\n", tb->GetName(), tb->GetNdata()); |
463 |
|
// |
464 |
|
if ( tb->GetNdata() ){ |
465 |
|
|
466 |
|
printf(" auiauiaui\n"); |
467 |
|
TClonesArray *cl = (TClonesArray*)tb->GetObject(); |
468 |
|
// |
469 |
|
printf(" name %s\n",cl->GetName()); |
470 |
|
// |
471 |
|
TClass *myc = cl->GetClass(); |
472 |
|
// |
473 |
|
TList *lme = myc->GetListOfDataMembers(); |
474 |
|
TIter next(lme); |
475 |
|
Int_t ls=0; |
476 |
|
TBranchElement *tb2 = 0; |
477 |
|
printf("la classe %s contiene:\n",myc->GetName()); |
478 |
|
while ( (tb2 = (TBranchElement*)next()) ){ |
479 |
|
// |
480 |
|
printf(" Memeber %i is %s \n",ls,tb2->GetName()); |
481 |
|
|
482 |
|
Int_t thisoffset = 0; |
483 |
|
TRealData *rd = myc->GetRealData(tb2->GetName()); |
484 |
|
if ( rd ){ |
485 |
|
printf(" rd name %s offset %i \n",rd->GetName(),rd->GetThisOffset()); |
486 |
|
thisoffset = rd->GetThisOffset(); |
487 |
|
}; |
488 |
|
|
489 |
|
ls++; |
490 |
|
|
491 |
|
// }; |
492 |
|
|
493 |
|
for (Int_t ll=0; ll<cl->GetEntriesFast();ll++){ |
494 |
|
// |
495 |
|
printf(" Entry %i 0x%X\n",ll,cl->At(ll)); |
496 |
|
|
497 |
|
// tb->GetInfo()->PrintValue(rd->GetName(), (char*)cl->At(ll)+thisoffset, 0, ls, 44); |
498 |
|
|
499 |
|
// printf(" value1 = %i \n",&((*cl->At(ll))<<thisoffset))); |
500 |
|
|
501 |
|
// char *point = 0; |
502 |
|
|
503 |
|
// myc->BuildRealData(point); |
504 |
|
|
505 |
|
// point = (char*)cl->At(ll); |
506 |
|
|
507 |
|
|
508 |
|
|
509 |
|
|
510 |
|
|
511 |
|
// printf(" uncheck 0x%X \n",cl->UncheckedAt(ll)); |
512 |
|
|
513 |
|
|
514 |
|
|
515 |
|
// TLeafElement* leaf = (TLeafElement*)(cl->UncheckedAt(ll)); |
516 |
|
// Int_t n = n * leaf->GetLenStatic(); |
517 |
|
// Int_t n = leaf->GetLenStatic(); |
518 |
|
//printf(" len static is %i name %s\n",n,leaf->GetName()); |
519 |
|
// TLeaf *foglia = tb2->FindLeaf(tb2->GetName()); |
520 |
|
|
521 |
|
// printf(" foglia lunga %i 0x%X \n",foglia->GetLen(),foglia); |
522 |
|
|
523 |
|
// |
524 |
|
// char *pointer = (char*)cl->UnchekedAt(ll); |
525 |
|
// char *ladd = pointer + offset; |
526 |
|
// Int_t *count = (Int_t*)(pointer+((tb2->GetMethods())[ls])); |
527 |
|
|
528 |
|
|
529 |
|
|
530 |
|
// printf(" lunghezza del clone secondo getentriesfast %i \n",cl->GetEntriesFast()); |
531 |
|
// tb->GetInfo()->PrintValueClones(tb->GetName(), cl, tb->GetID(), tb->GetOffset(), length); |
532 |
|
// tb->GetInfo()->PrintValueClones(tb2->GetName(),cl,ls,tb->GetOffset(),44); |
533 |
|
// TStreamerElement *aElement = (TStreamerElement *)tb2->GetElement()// Int_t type2 = tb2->GetType(); |
534 |
|
// Int_t atype2 = tb2->GetStreamerType() - 20; |
535 |
|
// printf(" subsubsubleaves : %s type is %i \n",tb2->GetName(),type2); |
536 |
|
// Int_t len2 = (tb2->GetInfo()->GetLengths())[tb2->GetID()]; |
537 |
|
// Int_t length2 = min(len2,dlen); |
538 |
|
// switch (type2){ |
539 |
|
// case 0: |
540 |
|
// // |
541 |
|
// // IS A VARIABLE |
542 |
|
// // |
543 |
|
// // |
544 |
|
// // NAME |
545 |
|
// // |
546 |
|
// printf(" ATYPE IS %i \n",atype2); |
547 |
|
// printf(" %-15s =",tb2->GetName()); |
548 |
|
// j = 0; |
549 |
|
// // |
550 |
|
// // VALUES |
551 |
|
// // |
552 |
|
// if ( atype2 == 3 || atype2 == -17 ){ |
553 |
|
// while ( j < length2 ){ |
554 |
|
// if ( j < length2 -1 ){ |
555 |
|
// printf(" %llu ,",(ULong64_t)tb2->GetValue(j,0)); |
556 |
|
// } else { |
557 |
|
// printf(" %llu",(ULong64_t)tb2->GetValue(j,0)); |
558 |
|
// }; |
559 |
|
// j++; |
560 |
|
// }; |
561 |
|
// } else { |
562 |
|
// while ( j < length2 ){ |
563 |
|
// if ( j < length2 -1 ){ |
564 |
|
// printf(" %f ,",tb2->GetValue(j,0)); |
565 |
|
// } else { |
566 |
|
// printf(" %f",tb2->GetValue(j,0)); |
567 |
|
// }; |
568 |
|
// j++; |
569 |
|
// }; |
570 |
|
// }; |
571 |
|
// printf("\n"); |
572 |
|
// break; |
573 |
|
// }; |
574 |
|
}; |
575 |
|
|
576 |
|
}; |
577 |
|
}; |
578 |
|
|
579 |
|
|
580 |
|
|
581 |
|
|
582 |
|
// TBranchElement *p=(TBranchElement*)cl->At(ll); |
583 |
|
// Int_t plen = (p->GetInfo()->GetLengths())[p->GetID()]; |
584 |
|
// Int_t plen = -1; |
585 |
|
// printf("SubBranches : %s plen is %i \n",p->GetName(),plen); |
586 |
|
|
587 |
|
|
588 |
|
|
589 |
|
|
590 |
|
// TLeafElement* leaf = (TLeafElement*)(p->UncheckedAt(0)); |
591 |
|
// printf("xoxoxo leaf : %s plen is %i \n",leaf->GetName(),leaf->GetLen()); |
592 |
|
|
593 |
|
// Int_t n = tb->GetNdata(); |
594 |
|
// n = n * leaf->GetLenStatic(); |
595 |
|
// if (tb->GetInfo()) { |
596 |
|
// n = 16; |
597 |
|
// tb->GetInfo()->PrintValue(tb->GetName(), tb->GetAddress(), atype, n, 44); |
598 |
|
//tb->GetObject()->GetInfo()->PrintValue(tb->GetName(), tb->GetObject(), atype, n, lenmax); |
599 |
|
// } |
600 |
|
|
601 |
|
// TClonesArray* clones = (TClonesArray*) cl->At(ll); |
602 |
|
// if ( tb->GetInfo() ) { |
603 |
|
// tb->GetInfo()->PrintValueClones(tb->GetName(), cl, tb->GetID(), tb->GetOffset(), 44); |
604 |
|
// }; |
605 |
|
|
606 |
|
// b3 = (TBranch*)cl->At(l); |
607 |
|
// leaf_array = b3->GetListOfLeaves(); |
608 |
|
// for(Int_t l=0;l<(leaf_array->GetLast());l++){ |
609 |
|
// printf("Leaf : %s\n",((TLeaf*)leaf_array->At(l))->GetName()); |
610 |
|
|
611 |
|
|
612 |
|
// // TBranch *bcl = (TBranch*)leaf_array->At(l); |
613 |
|
// //bcl = b1->GetListOfLeaves(); |
614 |
|
// //for(Int_t l=0;l<(leaf_array->GetLast()+1);l++){ |
615 |
|
// // printf(" value: %f \n",otr->GetLeaf(((TLeaf*)leaf_array->At(l))->GetName())->GetValue(0)); |
616 |
|
// // printf(" value: %f \n",otr->GetLeaf(((TLeaf*)(branch_array->At(l))->GetName()))->GetValue(0)); |
617 |
|
// //}; |
618 |
|
// }; |
619 |
|
|
620 |
|
|
621 |
|
|
622 |
|
|
623 |
|
|
624 |
|
|
625 |
|
// // Int_t n = TMath::Min(10, tb->GetNdata()); |
626 |
|
// Int_t n = tb->GetNdata(); |
627 |
|
// Int_t atype2 = tb->GetStreamerType() + 20; |
628 |
|
|
629 |
|
// if (tb->GetStreamerType() == 1) { |
630 |
|
// // TVirtualStreamerInfo::kOffsetL + TVirtualStreamerInfo::kChar is |
631 |
|
// // printed as a string and could print weird characters. |
632 |
|
// // So we print an unsigned char instead (not perfect, but better). |
633 |
|
// atype2 = 20 + 11 ; |
634 |
|
// printf("qui\n"); |
635 |
|
// } |
636 |
|
// if (atype2 > 54) { |
637 |
|
// // FIXME: More logic required here (like in ReadLeaves) |
638 |
|
// printf(">54 %-15s = %d\n", tb->GetName(), tb->GetNdata()); |
639 |
|
|
640 |
|
// } else { |
641 |
|
// if (tb->GetStreamerType() > 20) { |
642 |
|
// atype2 -= 20; |
643 |
|
// // TObjArray *prova= otr->GetListOfLeaves(); |
644 |
|
// // TObjArray* leaf2 = (TObjArray*) prova->UncheckedAt(i); |
645 |
|
// //TLeaf* leaf = (TLeaf*)(otr->GetLeaf(tb->GetName())); |
646 |
|
// // TLeafElement* leaf = (TLeafElement*)((TLeaf*)(otr->GetListOfLeaves()->UncheckedAt(i))->GetBranch()->UncheckedAt(0)); |
647 |
|
// TLeafElement* leaf = (TLeafElement*)(cl->UncheckedAt(0)); |
648 |
|
// n = n * leaf->GetLenStatic(); |
649 |
|
// } |
650 |
|
// if (tb->GetInfo()) { |
651 |
|
// // n = 16; |
652 |
|
// tb->GetInfo()->PrintValue(tb->GetName(), tb->GetAddress(), atype2, n, 44); |
653 |
|
// //tb->GetObject()->GetInfo()->PrintValue(tb->GetName(), tb->GetObject(), atype, n, lenmax); |
654 |
|
// } |
655 |
|
// }; |
656 |
|
|
657 |
|
|
658 |
|
|
659 |
|
|
660 |
|
|
661 |
|
|
662 |
|
|
663 |
|
// //cl->First(); |
664 |
|
|
665 |
|
// b3 = (TBranch*)c1->First(); |
666 |
|
// leaf_array = cl->GetListOfLeaves(); |
667 |
|
// for(Int_t l=0;l<(leaf_array->GetLast()+1);l++){ |
668 |
|
// printf("Leaf : %s\n",((TLeaf*)leaf_array->At(l))->GetName()); |
669 |
|
// }; |
670 |
|
// // for (Int_t ln=0; ln<cl->GetEntriesFast() ;ln++){ |
671 |
|
// // |
672 |
|
|
673 |
|
// // |
674 |
|
// // }; |
675 |
|
|
676 |
|
// TBranchElement *tb2 = (TBranchElement*)cl->UncheckedAt(ln); |
677 |
|
// Int_t type2 = tb2->GetType(); |
678 |
|
// Int_t atype2 = tb2->GetStreamerType() - 20; |
679 |
|
// Int_t len2 = (tb2->GetInfo()->GetLengths())[tb2->GetID()]; |
680 |
|
// Int_t length2 = min(len2,dlen); |
681 |
|
// printf("SubSubBranches : %s type is %i \n",tb2->GetName(),type2); |
682 |
|
|
683 |
|
// switch (type2){ |
684 |
|
// case 0: |
685 |
|
// // |
686 |
|
// // IS A VARIABLE |
687 |
|
// // |
688 |
|
// // |
689 |
|
// // NAME |
690 |
|
// // |
691 |
|
// printf(" ATYPE IS %i \n",atype2); |
692 |
|
// printf(" %-15s =",tb2->GetName()); |
693 |
|
// j = 0; |
694 |
|
// // |
695 |
|
// // VALUES |
696 |
|
// // |
697 |
|
// if ( atype2 == 3 || atype2 == -17 ){ |
698 |
|
// while ( j < length2 ){ |
699 |
|
// if ( j < length2 -1 ){ |
700 |
|
// printf(" %llu ,",(ULong64_t)tb2->GetValue(j,0)); |
701 |
|
// } else { |
702 |
|
// printf(" %llu",(ULong64_t)tb2->GetValue(j,0)); |
703 |
|
// }; |
704 |
|
// j++; |
705 |
|
// }; |
706 |
|
// } else { |
707 |
|
// while ( j < length2 ){ |
708 |
|
// if ( j < length2 -1 ){ |
709 |
|
// printf(" %f ,",tb2->GetValue(j,0)); |
710 |
|
// } else { |
711 |
|
// printf(" %f",tb2->GetValue(j,0)); |
712 |
|
// }; |
713 |
|
// j++; |
714 |
|
// }; |
715 |
|
// }; |
716 |
|
// printf("\n"); |
717 |
|
// break; |
718 |
|
// }; |
719 |
|
// //printf(" Element %i name %s\n",ln,cl->GetName()); |
720 |
|
// }; |
721 |
|
|
722 |
|
// TBranchElement *tb = (TBranchElement*)branch_array->At(l); |
723 |
|
// Int_t type = tb->GetType(); |
724 |
|
// printf("SubBranches : %s type is %i tb getname %s\n",((TBranch*)branch_array->At(l))->GetName(),type,tb->GetName()); |
725 |
|
// switch (type){ |
726 |
|
// case 0: |
727 |
|
// // |
728 |
|
// // IS A VARIABLE |
729 |
|
// // |
730 |
|
// Int_t atype = tb->GetStreamerType() - 20; |
731 |
|
// Int_t len = (tb->GetInfo()->GetLengths())[tb->GetID()]; |
732 |
|
// Int_t length = min(len,dlen); |
733 |
|
// // |
734 |
|
// // NAME |
735 |
|
// // |
736 |
|
// printf(" ATYPE IS %i \n",atype); |
737 |
|
// printf(" %-15s =",((TBranch*)branch_array->At(l))->GetName()); |
738 |
|
// j = 0; |
739 |
|
// // |
740 |
|
// // VALUES |
741 |
|
// // |
742 |
|
// if ( atype == 3 || atype == -17 ){ |
743 |
|
// while ( j < length ){ |
744 |
|
// if ( j < length -1 ){ |
745 |
|
// printf(" %llu ,",(ULong64_t)tb->GetValue(j,0)); |
746 |
|
// } else { |
747 |
|
// printf(" %llu",(ULong64_t)tb->GetValue(j,0)); |
748 |
|
// }; |
749 |
|
// j++; |
750 |
|
// }; |
751 |
|
// } else { |
752 |
|
// while ( j < length ){ |
753 |
|
// if ( j < length -1 ){ |
754 |
|
// printf(" %f ,",tb->GetValue(j,0)); |
755 |
|
// } else { |
756 |
|
// printf(" %f",tb->GetValue(j,0)); |
757 |
|
// }; |
758 |
|
// j++; |
759 |
|
// }; |
760 |
|
// }; |
761 |
|
// printf("\n"); |
762 |
|
|
763 |
|
|
764 |
|
break; |
765 |
|
}; |
766 |
|
// b3 = (TBranch*)branch_array->At(l); |
767 |
|
// leaf_array = b1->GetListOfLeaves(); |
768 |
|
// for(Int_t l=0;l<(leaf_array->GetLast()+1);l++){ |
769 |
|
// printf("Leaf : %s\n",((TLeaf*)leaf_array->At(l))->GetName()); |
770 |
|
// printf(" value: %f \n",otr->GetLeaf(((TLeaf*)leaf_array->At(l))->GetName())->GetValue(0)); |
771 |
|
// printf(" value: %f \n",otr->GetLeaf(((TLeaf*)(branch_array->At(l))->GetName()))->GetValue(0)); |
772 |
|
// }; |
773 |
|
// }; |
774 |
|
|
775 |
|
}; |
776 |
|
|
777 |
|
}; |
778 |
|
|
779 |
|
|
780 |
|
|
781 |
|
|
782 |
|
|
783 |
|
|
784 |
|
|
785 |
|
|
786 |
|
|
787 |
|
|
788 |
|
|
789 |
|
|
790 |
|
|
791 |
|
|
792 |
|
|
793 |
|
|
794 |
|
|
795 |
|
|
796 |
|
|
797 |
|
|
798 |
|
|
799 |
|
|
800 |
|
|
801 |
|
|
802 |
|
|
803 |
|
|
804 |
|
|
805 |
void FEVdetector::GetGeneralInfo(){ |
void FEVdetector::GetGeneralInfo(){ |
806 |
// |
// |
807 |
// Get Orbital Time information and header event number |
// Get Orbital Time information and header event number |
847 |
trcs = (TString)trc.str().c_str(); |
trcs = (TString)trc.str().c_str(); |
848 |
} else { |
} else { |
849 |
headcold = headc; |
headcold = headc; |
850 |
headc = L2->GetOrbitalInfo()->pkt_num; // to be changed as soon as we will have obt in the level2 file! |
if ( var.ORB ){ |
851 |
OBT = L2->GetOrbitalInfo()->OBT; // to be changed as soon as we will have obt in the level2 file! |
headc = L2->GetOrbitalInfo()->pkt_num; |
852 |
DOBT = OBT - OOBT; |
OBT = L2->GetOrbitalInfo()->OBT; |
853 |
OOBT = OBT; |
DOBT = OBT - OOBT; |
854 |
if ( thisentry == minevent || DOBT < 0 || (headc-headcold-1)!=0 ) DOBT = 0; |
OOBT = OBT; |
855 |
var.etime = OBT; |
if ( thisentry == minevent || DOBT < 0 || (headc-headcold-1)!=0 ) DOBT = 0; |
856 |
|
var.etime = OBT; |
857 |
|
} else { |
858 |
|
var.etime = 0; |
859 |
|
}; |
860 |
// |
// |
861 |
// who gave the trigger? |
// who gave the trigger? |
862 |
// |
// |
863 |
calotrig = 0; |
Int_t trigconf = 0; |
864 |
if ( L2->GetTrigLevel2()->patterntrig[0] ) calotrig = 1; |
if ( var.TRG ){ |
865 |
toftrig = 0; |
calotrig = 0; |
866 |
if ( L2->GetTrigLevel2()->patterntrig[2] || L2->GetTrigLevel2()->patterntrig[3] || L2->GetTrigLevel2()->patterntrig[4] || L2->GetTrigLevel2()->patterntrig[5] ) toftrig = 1; |
if ( L2->GetTrigLevel2()->patterntrig[0] ) calotrig = 1; |
867 |
s4pulser = 0; |
toftrig = 0; |
868 |
if ( L2->GetTrigLevel2()->patterntrig[1] & (1<<0) ) s4pulser = 1; |
if ( L2->GetTrigLevel2()->patterntrig[2] || L2->GetTrigLevel2()->patterntrig[3] || L2->GetTrigLevel2()->patterntrig[4] || L2->GetTrigLevel2()->patterntrig[5] ) toftrig = 1; |
869 |
// |
s4pulser = 0; |
870 |
// TOF and calorimeter when giving a trigger will always set this flag since the time window of the signal is greater than 100 ns. |
if ( L2->GetTrigLevel2()->patterntrig[1] & (1<<0) ) s4pulser = 1; |
871 |
// S4 sometimes could not set the flag even if the trigger is given. This is a workaround to fix this "bug": |
// |
872 |
// |
// TOF and calorimeter when giving a trigger will always set this flag since the time window of the signal is greater than 100 ns. |
873 |
if ( !calotrig && !toftrig ) s4pulser = 1; |
// S4 sometimes could not set the flag even if the trigger is given. This is a workaround to fix this "bug": |
874 |
// |
// |
875 |
Int_t trigconf = L2->GetTrigLevel2()->trigconf; |
if ( !calotrig && !toftrig ) s4pulser = 1; |
876 |
|
// |
877 |
|
trigconf = L2->GetTrigLevel2()->trigconf; |
878 |
|
} else { |
879 |
|
trigconf = 0; |
880 |
|
} |
881 |
stringstream trc; |
stringstream trc; |
882 |
trc.str(""); |
trc.str(""); |
883 |
if ( trigconf & (1<<0) ) trc << "TOF1"; |
if ( trigconf & (1<<0) ) trc << "TOF1"; |
986 |
// |
// |
987 |
if ( level.file == -1 ) isOK = gApplication->ProcessLine("filter((TTree *)otr,-1,(Variables &)var);"); |
if ( level.file == -1 ) isOK = gApplication->ProcessLine("filter((TTree *)otr,-1,(Variables &)var);"); |
988 |
// |
// |
989 |
if ( level.file == 2 ) isOK = gApplication->ProcessLine("filter((PamLevel2 *)L2,2);"); |
// if ( level.file == 2 ) isOK = gApplication->ProcessLine("filter((PamLevel2 *)L2,2);"); |
990 |
|
if ( level.file == 2 ) isOK = gApplication->ProcessLine("filter();"); |
991 |
// |
// |
992 |
// progress bar in text window |
// progress bar in text window |
993 |
// |
// |
1000 |
// |
// |
1001 |
} |
} |
1002 |
|
|
1003 |
void FEVdetector::Load(TTree &mainotr, TFile &mainfile){ |
Int_t FEVdetector::Load(TTree &mainotr, TFile &mainfile){ |
1004 |
|
//Int_t FEVdetector::Load(TChain &mainotr, TFile &mainfile){ |
1005 |
file = &mainfile; |
file = &mainfile; |
1006 |
otr = &mainotr; |
otr = &mainotr; |
1007 |
L2 = new PamLevel2(); |
L2 = new PamLevel2(); |
1008 |
// |
// |
1009 |
if ( level.file == 2 ){ |
if ( level.file == 2 ){ |
1010 |
// otr = L2->LoadPamTrees(file); |
// otr = L2->LoadPamTrees(file); |
1011 |
otr = L2->GetPamTree(file,"+ALL +CAL1 -TRKh -TRK1"); |
printf(" %s \n",ddec.Data()); |
1012 |
|
// otr->Refresh(); |
1013 |
|
// otr->Clear(); |
1014 |
|
// otr = new TTree(); |
1015 |
|
otr = L2->GetPamTree(file,ddec.Data()); |
1016 |
|
// |
1017 |
|
if ( !otr ) return(0); |
1018 |
// ******************** |
// ******************** |
1019 |
// load magnetic field |
// load magnetic field |
1020 |
// ******************** |
// ******************** |
1021 |
const char *pam_calib = pathtocalibration(); |
// const char *pam_calib = pathtocalibration(); |
1022 |
// |
// |
1023 |
stringstream magfie; |
// stringstream magfie; |
1024 |
magfie.str(""); |
// magfie.str(""); |
1025 |
// magfie << "/localdisk/mocchiut/test/calib/trk-param/field_param-0/"; |
// magfie << "/localdisk/mocchiut/test/calib/trk-param/field_param-0/"; |
1026 |
magfie << pam_calib; |
// magfie << pam_calib; |
1027 |
magfie << "/trk-param/field_param-0/"; |
//magfie << "/trk-param/field_param-0/"; |
1028 |
// |
// |
1029 |
L2->GetTrkLevel2()->LoadField(magfie.str().c_str()); |
//L2->GetTrkLevel2()->LoadField(magfie.str().c_str()); |
1030 |
} else { |
} else { |
1031 |
// |
// |
1032 |
// load calorimeter ADC2MIP conversion file |
// load calorimeter ADC2MIP conversion file |
1066 |
// |
// |
1067 |
}; |
}; |
1068 |
// |
// |
|
|
|
1069 |
// |
// |
1070 |
trigger = new pamela::trigger::TriggerEvent(); |
trigger = new pamela::trigger::TriggerEvent(); |
1071 |
eh = new pamela::EventHeader(); |
eh = new pamela::EventHeader(); |
1084 |
otr->SetBranchAddress("Trigger", &trigger); |
otr->SetBranchAddress("Trigger", &trigger); |
1085 |
otr->SetBranchAddress("Header", &eh); |
otr->SetBranchAddress("Header", &eh); |
1086 |
}; |
}; |
1087 |
if ( level.file == 2 ){ |
if ( level.file == 2 && var.RUN){ |
1088 |
// otr->AddFriend("OrbitalInfo", file); |
// otr->AddFriend("OrbitalInfo", file); |
1089 |
// otr->SetBranchAddress("OrbitalInfo", &oinfoL2); |
// otr->SetBranchAddress("OrbitalInfo", &oinfoL2); |
1090 |
runinfo->Read(0ULL); |
runinfo->Read(0ULL); |
1160 |
printf("Show the Time of Flight detector, LEVEL2 data \n"); |
printf("Show the Time of Flight detector, LEVEL2 data \n"); |
1161 |
}; |
}; |
1162 |
}; |
}; |
1163 |
|
// |
1164 |
|
// printf("qua\n"); |
1165 |
|
return(1); |
1166 |
// |
// |
1167 |
} |
} |
1168 |
|
|
2564 |
ms11b[i] = 0.; |
ms11b[i] = 0.; |
2565 |
} else { |
} else { |
2566 |
ms11b[i] = 1.; |
ms11b[i] = 1.; |
2567 |
}; }; |
}; |
2568 |
|
}; |
2569 |
for ( Int_t i = 0; i<6; i++ ) { |
for ( Int_t i = 0; i<6; i++ ) { |
2570 |
mt12[0][i] = tof->tdc[ch12a[i]][hb12a[i]]; |
mt12[0][i] = tof->tdc[ch12a[i]][hb12a[i]]; |
2571 |
mt12[1][i] = tof->tdc[ch12b[i]][hb12b[i]]; |
mt12[1][i] = tof->tdc[ch12b[i]][hb12b[i]]; |
2664 |
// |
// |
2665 |
var.tofraw = 0; |
var.tofraw = 0; |
2666 |
// |
// |
2667 |
repuntil = L2->GetToFLevel2()->ntrk(); |
if ( level.file == 2 ) repuntil = L2->GetToFLevel2()->ntrk(); |
2668 |
// printf("repuntil = %i \n",repuntil); |
// printf("repuntil = %i \n",repuntil); |
2669 |
//repuntil = L2->GetNTracks(); |
//repuntil = L2->GetNTracks(); |
2670 |
// |
// |
4223 |
pcasp4b->Draw("f"); |
pcasp4b->Draw("f"); |
4224 |
pcasp4b->Draw(); |
pcasp4b->Draw(); |
4225 |
}; |
}; |
4226 |
Float_t alfa = 1.2020334; |
// Float_t alfax = 1.2020334; |
4227 |
|
Float_t alfax = 1.22157778; |
4228 |
|
Float_t alfay = 1.27393111; |
4229 |
Float_t lcrd = 0.1815/2.; |
Float_t lcrd = 0.1815/2.; |
4230 |
Float_t wcrd = 0.008; |
Float_t wcrd = 0.008; |
4231 |
if ( true ){ |
if ( true ){ |
4436 |
// |
// |
4437 |
// Float_t cardcx = 0.143168*var.sfx; |
// Float_t cardcx = 0.143168*var.sfx; |
4438 |
//Float_t cardcy = 0.1475*var.sfy; |
//Float_t cardcy = 0.1475*var.sfy; |
4439 |
Float_t cardcx = 0.153168*var.sfx; |
// |
4440 |
Float_t cardcy = 0.1575*var.sfy; |
// Float_t cardcx = 0.153168*var.sfx; |
4441 |
Float_t acrdx[4] = {-lcrd*cos(alfa), lcrd*cos(alfa), -lcrd*cos(alfa)+wcrd*sin(alfa), -lcrd*cos(alfa)}; |
// |
4442 |
Float_t acrdy[4] = {-lcrd*sin(alfa), lcrd*sin(alfa), -lcrd*sin(alfa)-wcrd*cos(alfa), -lcrd*sin(alfa)}; |
Float_t cardcx = (0.19123*(1.-lcrd*cos(alfax)))*var.sfx; |
4443 |
Float_t bcrdx[4] = { lcrd*cos(alfa), lcrd*cos(alfa)+wcrd*sin(alfa), -lcrd*cos(alfa)+wcrd*sin(alfa), lcrd*cos(alfa)}; |
// Float_t cardcy = 0.1575*var.sfy; |
4444 |
Float_t bcrdy[4] = { lcrd*sin(alfa), lcrd*sin(alfa)-wcrd*cos(alfa), -lcrd*sin(alfa)-wcrd*cos(alfa), lcrd*sin(alfa)}; |
Float_t cardcy = (0.179212*(1.-lcrd*sin(alfax)))*var.sfy; |
4445 |
|
Float_t acrdx[4] = {-lcrd*cos(alfax), lcrd*cos(alfax), -lcrd*cos(alfax)+wcrd*sin(alfax), -lcrd*cos(alfax)}; |
4446 |
|
Float_t acrdy[4] = {-lcrd*sin(alfax), lcrd*sin(alfax), -lcrd*sin(alfax)-wcrd*cos(alfax), -lcrd*sin(alfax)}; |
4447 |
|
Float_t bcrdx[4] = { lcrd*cos(alfax), lcrd*cos(alfax)+wcrd*sin(alfax), -lcrd*cos(alfax)+wcrd*sin(alfax), lcrd*cos(alfax)}; |
4448 |
|
Float_t bcrdy[4] = { lcrd*sin(alfax), lcrd*sin(alfax)-wcrd*cos(alfax), -lcrd*sin(alfax)-wcrd*cos(alfax), lcrd*sin(alfax)}; |
4449 |
|
|
4450 |
// |
// |
4451 |
// CARD3 X/ Y |
// CARD3 X/ Y |
4505 |
}; |
}; |
4506 |
|
|
4507 |
if ( true ){ |
if ( true ){ |
4508 |
Float_t acrdx[4] = {-lcrd*cos(alfa), lcrd*cos(alfa), -lcrd*cos(alfa)+wcrd*sin(alfa), -lcrd*cos(alfa)}; |
Float_t acrdx[4] = {-lcrd*cos(alfay), lcrd*cos(alfay), -lcrd*cos(alfay)+wcrd*sin(alfay), -lcrd*cos(alfay)}; |
4509 |
Float_t acrdy[4] = {-lcrd*sin(alfa), lcrd*sin(alfa), -lcrd*sin(alfa)-wcrd*cos(alfa), -lcrd*sin(alfa)}; |
Float_t acrdy[4] = {-lcrd*sin(alfay), lcrd*sin(alfay), -lcrd*sin(alfay)-wcrd*cos(alfay), -lcrd*sin(alfay)}; |
4510 |
Float_t bcrdx[4] = { lcrd*cos(alfa), lcrd*cos(alfa)+wcrd*sin(alfa), -lcrd*cos(alfa)+wcrd*sin(alfa), lcrd*cos(alfa)}; |
Float_t bcrdx[4] = { lcrd*cos(alfay), lcrd*cos(alfay)+wcrd*sin(alfay), -lcrd*cos(alfay)+wcrd*sin(alfay), lcrd*cos(alfay)}; |
4511 |
Float_t bcrdy[4] = { lcrd*sin(alfa), lcrd*sin(alfa)-wcrd*cos(alfa), -lcrd*sin(alfa)-wcrd*cos(alfa), lcrd*sin(alfa)}; |
Float_t bcrdy[4] = { lcrd*sin(alfay), lcrd*sin(alfay)-wcrd*cos(alfay), -lcrd*sin(alfay)-wcrd*cos(alfay), lcrd*sin(alfay)}; |
4512 |
// |
// |
4513 |
// CARD - Y-view |
// CARD - Y-view |
4514 |
// |
// |
4515 |
Float_t cardcx = 0.12*var.sfx; |
// Float_t cardcx = 0.12*var.sfx; |
4516 |
Float_t cardcy = 0.1475*var.sfy; |
Float_t cardcx = (0.16014*(1.-lcrd*cos(alfay)))*var.sfx; |
4517 |
|
// Float_t cardcy = 0.178818*var.sfy; |
4518 |
|
Float_t cardcy = (0.178818*(1.-lcrd*sin(alfay)))*var.sfy; |
4519 |
|
// Float_t cardcy = 0.1475*var.sfy; |
4520 |
// |
// |
4521 |
// CARD4 X Y/ |
// CARD4 X Y/ |
4522 |
// |
// |
5082 |
// |
// |
5083 |
if ( L2->GetTrkLevel2()->GetNTracks() > 0 ){ |
if ( L2->GetTrkLevel2()->GetNTracks() > 0 ){ |
5084 |
for (Int_t nt = 0; nt < L2->GetTrkLevel2()->GetNTracks(); nt++){ |
for (Int_t nt = 0; nt < L2->GetTrkLevel2()->GetNTracks(); nt++){ |
5085 |
TrkTrack *track = L2->GetTrkLevel2()->GetTrack(nt); |
PamTrack *ptrack= L2->GetTrack(nt); |
5086 |
|
TrkTrack *track = ptrack->GetTrkTrack(); |
5087 |
if ( nt == 0 ){ |
if ( nt == 0 ){ |
5088 |
var.rig = 0.; |
var.rig = 0.; |
5089 |
if ( track->al[4] != 0. ) var.rig = 1./track->al[4]; |
if ( track->al[4] != 0. ) var.rig = 1./track->al[4]; |
5596 |
// |
// |
5597 |
if ( L2->GetTrkLevel2()->GetNTracks() > 0 ){ |
if ( L2->GetTrkLevel2()->GetNTracks() > 0 ){ |
5598 |
for (Int_t nt = 0; nt < L2->GetTrkLevel2()->GetNTracks(); nt++){ |
for (Int_t nt = 0; nt < L2->GetTrkLevel2()->GetNTracks(); nt++){ |
5599 |
TrkTrack *track = L2->GetTrkLevel2()->GetTrack(nt); |
|
5600 |
|
// TrkTrack *track = L2->GetTrkLevel2()->GetTrack(nt); |
5601 |
|
PamTrack *ptrack = L2->GetTrack(nt); |
5602 |
|
TrkTrack *track = ptrack->GetTrkTrack(); |
5603 |
Int_t npoint = 100; |
Int_t npoint = 100; |
5604 |
Float_t zin[100]; |
Float_t zin[100]; |
5605 |
Double_t xout[100]; |
Double_t xout[100]; |