--- eventviewer/flight/src/FEVdetector.cpp 2007/02/26 17:30:32 1.11 +++ eventviewer/flight/src/FEVdetector.cpp 2007/02/28 09:29:55 1.12 @@ -46,6 +46,8 @@ #include #include #include +#include +#include // #include #include @@ -177,6 +179,11 @@ void FEVdetector::GetEntry(Int_t i){ thisentry = i; otr->GetEntry(i); +// if ( level.file == 2 ){ +// ShowInfo("TrkLevel2"); +// ShowInfo("ToFLevel2"); +// ShowInfo("CaloLevel2"); +// }; // PrintData(otr,-1LL,44); } @@ -305,7 +312,7 @@ printf("son qua \n"); // if (otr->GetMakeClass()) { - if (!tb->GetAddress()) { + if (!tb->GetAddress()) { printf("esco \n"); return; } @@ -331,16 +338,16 @@ } if (tb->GetStreamerType() > 20) { atype -= 20; - TObjArray *prova= otr->GetListOfLeaves(); - // TObjArray* leaf2 = (TObjArray*) prova->UncheckedAt(i); - //TLeaf* leaf = (TLeaf*)(otr->GetLeaf(tb->GetName())); - // TLeafElement* leaf = (TLeafElement*)((TLeaf*)(otr->GetListOfLeaves()->UncheckedAt(i))->GetBranch()->UncheckedAt(0)); - TLeafElement* leaf = (TLeafElement*)(prova->UncheckedAt(0)); - n = n * leaf->GetLenStatic(); +// TObjArray *prova= otr->GetListOfLeaves(); +// // TObjArray* leaf2 = (TObjArray*) prova->UncheckedAt(i); +// //TLeaf* leaf = (TLeaf*)(otr->GetLeaf(tb->GetName())); +// // TLeafElement* leaf = (TLeafElement*)((TLeaf*)(otr->GetListOfLeaves()->UncheckedAt(i))->GetBranch()->UncheckedAt(0)); +// TLeafElement* leaf = (TLeafElement*)(prova->UncheckedAt(0)); +// n = n * leaf->GetLenStatic(); } if (tb->GetInfo()) { // n = 16; - tb->GetInfo()->PrintValue(tb->GetName(), tb->GetAddress(), atype, n, lenmax); + // tb->GetInfo()->PrintValue(tb->GetName(), tb->GetAddress(), atype, n, lenmax); //tb->GetObject()->GetInfo()->PrintValue(tb->GetName(), tb->GetObject(), atype, n, lenmax); } return; @@ -387,70 +394,414 @@ printf("esco qui\n"); }; -void FEVdetector::PrintData(TTree *tree, Long64_t entry=-1LL,Int_t lenmax=44){ - // -- Print values of all active leaves for entry. + +void FEVdetector::ShowInfo(TString detector){ // - // if entry==-1, print current entry (default) - // if a leaf is an array, a maximum of lenmax elements is printed. + TBranch *b1 = 0; + TBranch *b3 = 0; + TObjArray *branch_array = 0; + TObjArray *leaf_array = 0; + // + b1 = otr->FindBranch(detector.Data()); + Int_t dlen = 44; // - if (entry != -1) { - tree->GetEntry(entry); - } - // printf("======> EVENT:%lld\n", thisentry); printf("======> EVENT:%i\n", thisentry); - TObjArray* leaves = tree->GetListOfLeaves(); // - Int_t nleaves = leaves->GetEntriesFast(); - Int_t ltype; - for (Int_t i = 0; i < nleaves; i++) { - TLeaf* leaf = (TLeaf*) leaves->UncheckedAt(i); - TBranch* branch = leaf->GetBranch(); - // if (branch->TestBit(kDoNotProcess)) { - // continue; - // } - Int_t len = leaf->GetLen(); - if (len <= 0) { - continue; - } - len = TMath::Min(len, lenmax); - if (leaf->IsA() == TLeafElement::Class()) { - // Double_t value = leaf->GetValue(lenmax); - //printf(" ioqui %f \n",value); - // ((TBranchElement*)leaf->GetBranch())->PrintValue(i); - this->PrintLeaves(otr,i,((TBranchElement*)leaf->GetBranch()), lenmax); - //leaf->PrintValue(lenmax); - continue; - } - if (branch->GetListOfBranches()->GetEntriesFast() > 0) { - continue; - } - ltype = 10; - if (leaf->IsA() == TLeafF::Class()) { - ltype = 5; - } - if (leaf->IsA() == TLeafD::Class()) { - ltype = 5; - } - if (leaf->IsA() == TLeafC::Class()) { - len = 1; - ltype = 5; - }; - printf(" %-15s = ", leaf->GetName()); - for (Int_t l = 0; l < len; l++) { - Double_t value = leaf->GetValue(l); - printf(" ioqui %f \n",value); - // leaf->PrintValue(l); - if (l == (len - 1)) { - printf("\n"); - continue; - } - printf(", "); - if ((l % ltype) == 0) { - printf("\n "); - } - } - } + // + printf("Branch %s\n",b1->GetName()); + branch_array = b1->GetListOfBranches(); + // + Int_t j = 0; + // + for(Int_t l=0;l<(branch_array->GetLast()+1);l++){ + // + TBranchElement *tb = (TBranchElement*)branch_array->At(l); + Int_t type = tb->GetType(); + Int_t atype = tb->GetStreamerType() - 20; + Int_t len = (tb->GetInfo()->GetLengths())[tb->GetID()]; + Int_t length = min(len,dlen); + // printf("SubBranches : %s type is %i tb getname %s\n",((TBranch*)branch_array->At(l))->GetName(),type,tb->GetName()); + switch (type){ + case 0: + // + // IS A VARIABLE + // + // + // NAME + // + // printf(" ATYPE IS %i \n",atype); + printf(" %-15s =",((TBranch*)branch_array->At(l))->GetName()); + j = 0; + // + // VALUES + // + if ( atype == 3 || atype == -17 ){ + while ( j < length ){ + if ( j < length -1 ){ + printf(" %llu ,",(ULong64_t)tb->GetValue(j,0)); + } else { + printf(" %llu",(ULong64_t)tb->GetValue(j,0)); + }; + j++; + }; + } else { + while ( j < length ){ + if ( j < length -1 ){ + printf(" %f ,",tb->GetValue(j,0)); + } else { + printf(" %f",tb->GetValue(j,0)); + }; + j++; + }; + }; + printf("\n"); + break; + case 3: + // + // IS A TCLONESARRAY + // + printf(" %-15s = %d\n", tb->GetName(), tb->GetNdata()); + // + if ( tb->GetNdata() ){ + + printf(" auiauiaui\n"); + TClonesArray *cl = (TClonesArray*)tb->GetObject(); + // + printf(" name %s\n",cl->GetName()); + // + TClass *myc = cl->GetClass(); + // + TList *lme = myc->GetListOfDataMembers(); + TIter next(lme); + Int_t ls=0; + TBranchElement *tb2 = 0; + printf("la classe %s contiene:\n",myc->GetName()); + while ( (tb2 = (TBranchElement*)next()) ){ + // + printf(" Memeber %i is %s \n",ls,tb2->GetName()); + + Int_t thisoffset = 0; + TRealData *rd = myc->GetRealData(tb2->GetName()); + if ( rd ){ + printf(" rd name %s offset %i \n",rd->GetName(),rd->GetThisOffset()); + thisoffset = rd->GetThisOffset(); + }; + + ls++; + + // }; + + for (Int_t ll=0; llGetEntriesFast();ll++){ + // + printf(" Entry %i 0x%X\n",ll,cl->At(ll)); + + // tb->GetInfo()->PrintValue(rd->GetName(), (char*)cl->At(ll)+thisoffset, 0, ls, 44); + + // printf(" value1 = %i \n",&((*cl->At(ll))<BuildRealData(point); + +// point = (char*)cl->At(ll); + + + + + + // printf(" uncheck 0x%X \n",cl->UncheckedAt(ll)); + + + + // TLeafElement* leaf = (TLeafElement*)(cl->UncheckedAt(ll)); + // Int_t n = n * leaf->GetLenStatic(); + // Int_t n = leaf->GetLenStatic(); + //printf(" len static is %i name %s\n",n,leaf->GetName()); + // TLeaf *foglia = tb2->FindLeaf(tb2->GetName()); + + // printf(" foglia lunga %i 0x%X \n",foglia->GetLen(),foglia); + + // + // char *pointer = (char*)cl->UnchekedAt(ll); + // char *ladd = pointer + offset; + // Int_t *count = (Int_t*)(pointer+((tb2->GetMethods())[ls])); + + + + // printf(" lunghezza del clone secondo getentriesfast %i \n",cl->GetEntriesFast()); + // tb->GetInfo()->PrintValueClones(tb->GetName(), cl, tb->GetID(), tb->GetOffset(), length); + // tb->GetInfo()->PrintValueClones(tb2->GetName(),cl,ls,tb->GetOffset(),44); + // TStreamerElement *aElement = (TStreamerElement *)tb2->GetElement()// Int_t type2 = tb2->GetType(); +// Int_t atype2 = tb2->GetStreamerType() - 20; +// printf(" subsubsubleaves : %s type is %i \n",tb2->GetName(),type2); +// Int_t len2 = (tb2->GetInfo()->GetLengths())[tb2->GetID()]; +// Int_t length2 = min(len2,dlen); +// switch (type2){ +// case 0: +// // +// // IS A VARIABLE +// // +// // +// // NAME +// // +// printf(" ATYPE IS %i \n",atype2); +// printf(" %-15s =",tb2->GetName()); +// j = 0; +// // +// // VALUES +// // +// if ( atype2 == 3 || atype2 == -17 ){ +// while ( j < length2 ){ +// if ( j < length2 -1 ){ +// printf(" %llu ,",(ULong64_t)tb2->GetValue(j,0)); +// } else { +// printf(" %llu",(ULong64_t)tb2->GetValue(j,0)); +// }; +// j++; +// }; +// } else { +// while ( j < length2 ){ +// if ( j < length2 -1 ){ +// printf(" %f ,",tb2->GetValue(j,0)); +// } else { +// printf(" %f",tb2->GetValue(j,0)); +// }; +// j++; +// }; +// }; +// printf("\n"); +// break; +// }; + }; + + }; + }; + + + + + // TBranchElement *p=(TBranchElement*)cl->At(ll); + // Int_t plen = (p->GetInfo()->GetLengths())[p->GetID()]; + // Int_t plen = -1; + // printf("SubBranches : %s plen is %i \n",p->GetName(),plen); + + + + + // TLeafElement* leaf = (TLeafElement*)(p->UncheckedAt(0)); + // printf("xoxoxo leaf : %s plen is %i \n",leaf->GetName(),leaf->GetLen()); + + // Int_t n = tb->GetNdata(); + // n = n * leaf->GetLenStatic(); + // if (tb->GetInfo()) { + // n = 16; + // tb->GetInfo()->PrintValue(tb->GetName(), tb->GetAddress(), atype, n, 44); + //tb->GetObject()->GetInfo()->PrintValue(tb->GetName(), tb->GetObject(), atype, n, lenmax); + // } + + // TClonesArray* clones = (TClonesArray*) cl->At(ll); + // if ( tb->GetInfo() ) { + // tb->GetInfo()->PrintValueClones(tb->GetName(), cl, tb->GetID(), tb->GetOffset(), 44); + // }; + + // b3 = (TBranch*)cl->At(l); + // leaf_array = b3->GetListOfLeaves(); + // for(Int_t l=0;l<(leaf_array->GetLast());l++){ + // printf("Leaf : %s\n",((TLeaf*)leaf_array->At(l))->GetName()); + + + // // TBranch *bcl = (TBranch*)leaf_array->At(l); + // //bcl = b1->GetListOfLeaves(); + // //for(Int_t l=0;l<(leaf_array->GetLast()+1);l++){ + // // printf(" value: %f \n",otr->GetLeaf(((TLeaf*)leaf_array->At(l))->GetName())->GetValue(0)); + // // printf(" value: %f \n",otr->GetLeaf(((TLeaf*)(branch_array->At(l))->GetName()))->GetValue(0)); + // //}; + // }; + + + + + + +// // Int_t n = TMath::Min(10, tb->GetNdata()); +// Int_t n = tb->GetNdata(); +// Int_t atype2 = tb->GetStreamerType() + 20; + +// if (tb->GetStreamerType() == 1) { +// // TVirtualStreamerInfo::kOffsetL + TVirtualStreamerInfo::kChar is +// // printed as a string and could print weird characters. +// // So we print an unsigned char instead (not perfect, but better). +// atype2 = 20 + 11 ; +// printf("qui\n"); +// } +// if (atype2 > 54) { +// // FIXME: More logic required here (like in ReadLeaves) +// printf(">54 %-15s = %d\n", tb->GetName(), tb->GetNdata()); + +// } else { +// if (tb->GetStreamerType() > 20) { +// atype2 -= 20; +// // TObjArray *prova= otr->GetListOfLeaves(); +// // TObjArray* leaf2 = (TObjArray*) prova->UncheckedAt(i); +// //TLeaf* leaf = (TLeaf*)(otr->GetLeaf(tb->GetName())); +// // TLeafElement* leaf = (TLeafElement*)((TLeaf*)(otr->GetListOfLeaves()->UncheckedAt(i))->GetBranch()->UncheckedAt(0)); +// TLeafElement* leaf = (TLeafElement*)(cl->UncheckedAt(0)); +// n = n * leaf->GetLenStatic(); +// } +// if (tb->GetInfo()) { +// // n = 16; +// tb->GetInfo()->PrintValue(tb->GetName(), tb->GetAddress(), atype2, n, 44); +// //tb->GetObject()->GetInfo()->PrintValue(tb->GetName(), tb->GetObject(), atype, n, lenmax); +// } +// }; + + + + + + + +// //cl->First(); + +// b3 = (TBranch*)c1->First(); +// leaf_array = cl->GetListOfLeaves(); +// for(Int_t l=0;l<(leaf_array->GetLast()+1);l++){ +// printf("Leaf : %s\n",((TLeaf*)leaf_array->At(l))->GetName()); +// }; +// // for (Int_t ln=0; lnGetEntriesFast() ;ln++){ +// // + +// // +// // }; + +// TBranchElement *tb2 = (TBranchElement*)cl->UncheckedAt(ln); +// Int_t type2 = tb2->GetType(); +// Int_t atype2 = tb2->GetStreamerType() - 20; +// Int_t len2 = (tb2->GetInfo()->GetLengths())[tb2->GetID()]; +// Int_t length2 = min(len2,dlen); +// printf("SubSubBranches : %s type is %i \n",tb2->GetName(),type2); + +// switch (type2){ +// case 0: +// // +// // IS A VARIABLE +// // +// // +// // NAME +// // +// printf(" ATYPE IS %i \n",atype2); +// printf(" %-15s =",tb2->GetName()); +// j = 0; +// // +// // VALUES +// // +// if ( atype2 == 3 || atype2 == -17 ){ +// while ( j < length2 ){ +// if ( j < length2 -1 ){ +// printf(" %llu ,",(ULong64_t)tb2->GetValue(j,0)); +// } else { +// printf(" %llu",(ULong64_t)tb2->GetValue(j,0)); +// }; +// j++; +// }; +// } else { +// while ( j < length2 ){ +// if ( j < length2 -1 ){ +// printf(" %f ,",tb2->GetValue(j,0)); +// } else { +// printf(" %f",tb2->GetValue(j,0)); +// }; +// j++; +// }; +// }; +// printf("\n"); +// break; +// }; +// //printf(" Element %i name %s\n",ln,cl->GetName()); +// }; + +// TBranchElement *tb = (TBranchElement*)branch_array->At(l); +// Int_t type = tb->GetType(); +// printf("SubBranches : %s type is %i tb getname %s\n",((TBranch*)branch_array->At(l))->GetName(),type,tb->GetName()); +// switch (type){ +// case 0: +// // +// // IS A VARIABLE +// // +// Int_t atype = tb->GetStreamerType() - 20; +// Int_t len = (tb->GetInfo()->GetLengths())[tb->GetID()]; +// Int_t length = min(len,dlen); +// // +// // NAME +// // +// printf(" ATYPE IS %i \n",atype); +// printf(" %-15s =",((TBranch*)branch_array->At(l))->GetName()); +// j = 0; +// // +// // VALUES +// // +// if ( atype == 3 || atype == -17 ){ +// while ( j < length ){ +// if ( j < length -1 ){ +// printf(" %llu ,",(ULong64_t)tb->GetValue(j,0)); +// } else { +// printf(" %llu",(ULong64_t)tb->GetValue(j,0)); +// }; +// j++; +// }; +// } else { +// while ( j < length ){ +// if ( j < length -1 ){ +// printf(" %f ,",tb->GetValue(j,0)); +// } else { +// printf(" %f",tb->GetValue(j,0)); +// }; +// j++; +// }; +// }; +// printf("\n"); + + + break; + }; + // b3 = (TBranch*)branch_array->At(l); + // leaf_array = b1->GetListOfLeaves(); + // for(Int_t l=0;l<(leaf_array->GetLast()+1);l++){ + // printf("Leaf : %s\n",((TLeaf*)leaf_array->At(l))->GetName()); + // printf(" value: %f \n",otr->GetLeaf(((TLeaf*)leaf_array->At(l))->GetName())->GetValue(0)); + // printf(" value: %f \n",otr->GetLeaf(((TLeaf*)(branch_array->At(l))->GetName()))->GetValue(0)); + // }; + // }; + + }; + }; + + + + + + + + + + + + + + + + + + + + + + + + + + void FEVdetector::GetGeneralInfo(){ // // Get Orbital Time information and header event number