/[PAMELA software]/eventviewer/flight/src/FEVdetector.cpp
ViewVC logotype

Diff of /eventviewer/flight/src/FEVdetector.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.12 by mocchiut, Wed Feb 28 09:29:55 2007 UTC revision 1.31 by mocchiut, Fri Oct 2 12:51:01 2009 UTC
# Line 69  char* operator+( std::streampos&, char* Line 69  char* operator+( std::streampos&, char*
69  #include <FEVdetector.h>  #include <FEVdetector.h>
70  #include <FEventViewer.h>  #include <FEventViewer.h>
71  #include <feventvstruct.h>  #include <feventvstruct.h>
72    #include <color.h>
73  //  //
74  extern Bool_t existfile(TString);  extern Bool_t existfile(TString);
75  //  //
# Line 82  FEVdetector::FEVdetector(TString filenam Line 83  FEVdetector::FEVdetector(TString filenam
83    thefigure = &figure;    thefigure = &figure;
84    checkctrlword();    checkctrlword();
85    var.selex = false;    var.selex = false;
86      var.showall = false;
87    
88      var.showsi = false;
89      var.shownd = false;
90      var.shows4 = false;
91      var.showorb = false;
92      var.showtof = false;
93      var.showtrg = false;
94      var.showtrk = false;
95      var.showcal = false;
96      var.showrun = false;
97      var.showac = false;
98    }
99    
100    void FEVdetector::Reset(){
101      L2 = NULL;
102  }  }
103    
104  void FEVdetector::checkctrlword(){  void FEVdetector::checkctrlword(){
# Line 90  void FEVdetector::checkctrlword(){ Line 107  void FEVdetector::checkctrlword(){
107    var.AC = 0;    var.AC = 0;
108    var.RUN = 1;    var.RUN = 1;
109    var.TRK = 0;    var.TRK = 0;
110    var.ORB = 0;    var.ORB = 1;
111    var.TRG = 0;    var.TRG = 1;
112    var.CALO = 0;    var.CALO = 0;
113      var.CALOT = 0;
114    var.S4 = 0;    var.S4 = 0;
115    var.ND = 0;    var.ND = 0;
116    var.INFOS = 0;    var.INFOS = 0;
# Line 132  void FEVdetector::SetDDEC(TString de){ Line 150  void FEVdetector::SetDDEC(TString de){
150  };  };
151    
152  void FEVdetector::GetWindow(){  void FEVdetector::GetWindow(){
   otr->GetEntry(maxevent);  
153    //    //
154      if ( level.file == 2 ){
155        //    printf("0qui\n");
156        L2->GetEntry(minevent);
157      } else {
158        otr->GetEntry(minevent);
159      }
160    if ( level.file < 2 ){    if ( level.file < 2 ){
161      ph = eh->GetPscuHeader();      ph = eh->GetPscuHeader();
162      lastevno = (int)ph->Counter;      firstevno = (int)ph->Counter;
163    } else {    } else {
164      if ( var.ORB ){      if ( var.ORB ){
165        lastevno = L2->GetOrbitalInfo()->pkt_num;        firstevno = L2->GetOrbitalInfo()->pkt_num;
166      } else {      } else {
167        lastevno = 0;        firstevno = 0;
168      };      };
169    };    };
170    otr->GetEntry(minevent);    //
171      if ( level.file == 2 ){
172        //    printf("1qui\n");
173        L2->GetEntry(maxevent);
174      } else {
175        otr->GetEntry(maxevent);
176      }
177      //
178    if ( level.file < 2 ){    if ( level.file < 2 ){
179      ph = eh->GetPscuHeader();      ph = eh->GetPscuHeader();
180      firstevno = (int)ph->Counter;      lastevno = (int)ph->Counter;
181    } else {    } else {
182      if ( var.ORB ){      if ( var.ORB ){
183        firstevno = L2->GetOrbitalInfo()->pkt_num;        lastevno = L2->GetOrbitalInfo()->pkt_num;
184      } else {      } else {
185        firstevno = 0;        lastevno = 0;
186      };      };
187    };    };
188      //
189  }  }
190    
191  void FEVdetector::ClearVariables(){  void FEVdetector::ClearVariables(){
# Line 177  void FEVdetector::ClearVariables(){ Line 208  void FEVdetector::ClearVariables(){
208  }  }
209    
210  void FEVdetector::GetEntry(Int_t i){  void FEVdetector::GetEntry(Int_t i){
211    thisentry = i;    thisentry = i;  
212    otr->GetEntry(i);    if ( level.file == 2 ){
213  //   if ( level.file == 2 ){      //    L2->Clear();
214  //     ShowInfo("TrkLevel2");      //    printf("qui\n");
215  //     ShowInfo("ToFLevel2");      L2->GetEntry(i);
216  //     ShowInfo("CaloLevel2");      if ( var.showall ){
217  //   };        ShowInfo("RunInfo");
218    //  PrintData(otr,-1LL,44);        ShowInfo("SoftInfo");
219          ShowInfo("OrbitalInfo");
220          ShowInfo("TrigLevel2");
221          ShowInfo("ToFLevel2");
222          ShowInfo("TrkLevel2");
223          ShowInfo("AcLevel2");
224          ShowInfo("CaloLevel2");
225          ShowInfo("CaloLevel1");
226          ShowInfo("S4Level2");
227          ShowInfo("NDLevel2");
228        } else {
229          if ( var.showrun ) ShowInfo("RunInfo");
230          if ( var.showsi ) ShowInfo("SoftInfo");
231          if ( var.showorb ) ShowInfo("OrbitalInfo");
232          if ( var.showtrg ) ShowInfo("TrigLevel2");
233          if ( var.showtof ) ShowInfo("ToFLevel2");
234          if ( var.showtrk ) ShowInfo("TrkLevel2");
235          if ( var.showac ) ShowInfo("AcLevel2");
236          if ( var.showcal ) ShowInfo("CaloLevel2");
237          if ( var.showcal ) ShowInfo("CaloLevel1");
238          if ( var.shows4 ) ShowInfo("S4Level2");
239          if ( var.shownd ) ShowInfo("NDLevel2");
240        };
241      } else {
242        otr->GetEntry(i);
243        if ( var.showall ){
244          ShowInfo("Pscu");
245          ShowInfo("Trigger");
246          ShowInfo("Tof");
247          ShowInfo("Tracker");
248          ShowInfo("Anticounter");
249          ShowInfo("Calorimeter");
250          ShowInfo("S4");
251          ShowInfo("Neutron");
252        } else {
253          if ( var.showorb ) ShowInfo("Pscu");
254          if ( var.showtrg ) ShowInfo("Trigger");
255          if ( var.showtof ) ShowInfo("Tof");
256          if ( var.showtrk ) ShowInfo("Tracker");
257          if ( var.showac ) ShowInfo("Anticounter");
258          if ( var.showcal ) ShowInfo("Calorimeter");
259          if ( var.shows4 ) ShowInfo("S4");
260          if ( var.shownd ) ShowInfo("Neutron");
261        };
262      };
263  }  }
264    
265  void FEVdetector::SetEntry(Int_t i){  void FEVdetector::SetEntry(Int_t i){
# Line 305  void FEVdetector::ColorTRKMIP(Float_t mi Line 380  void FEVdetector::ColorTRKMIP(Float_t mi
380    };    };
381  }  }
382    
 void FEVdetector::PrintLeaves(TTree *otr, Int_t i, TBranchElement *tb, Int_t lenmax){  
   // -- Prints values of leaves.  
   
   //  tb->ValidateAddress();  
   printf("son qua \n");  
   
   //  if (otr->GetMakeClass()) {  
   if (!tb->GetAddress()) {  
       printf("esco \n");  
       return;  
     }  
     if (tb->GetType() == 3 || tb->GetType() == 4) {  
       // TClonesArray or STL container top-level branch.  
       printf("3 o 4 %-15s = %d\n", tb->GetName(), tb->GetNdata());  
       return;  
     } else if (tb->GetType() == 31 || tb->GetType() == 41) {  
       printf(" 31 o 41 \n");  
       // TClonesArray or STL container sub-branch.  
       Int_t n = TMath::Min(10, tb->GetNdata());  
       Int_t atype = 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).  
         atype = 20 + 11 ;  
       }  
       if (atype > 54) {  
         // FIXME: More logic required here (like in ReadLeaves)  
         printf(">54 %-15s = %d\n", tb->GetName(), tb->GetNdata());  
         return;  
       }  
       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();  
       }  
       if (tb->GetInfo()) {  
         //      n = 16;  
         //      tb->GetInfo()->PrintValue(tb->GetName(), tb->GetAddress(), atype, n, lenmax);  
         //tb->GetObject()->GetInfo()->PrintValue(tb->GetName(), tb->GetObject(), atype, n, lenmax);  
       }  
       return;  
     } else if (tb->GetType() <= 2) {  
       printf(" <=2 \n");  
       // Branch in split mode.  
       // FIXME: This should probably be < 60 instead.  
       if ((tb->GetStreamerType() > 40) && (tb->GetStreamerType() < 55)) {  
         Int_t atype = tb->GetStreamerType() - 20;  
         TBranchElement* counterElement = (TBranchElement*) tb->GetBranchCount();  
         Int_t n = (Int_t) counterElement->GetValue(0, 0);  
         if (tb->GetInfo()) {  
           tb->GetInfo()->PrintValue(tb->GetName(), tb->GetAddress(), atype, n, lenmax);  
         }  
       } else {  
         //      if (tb->GetInfo()) {  
         //        tb->GetInfo()->PrintValue(tb->GetName(), tb->GetObject(), tb->GetID(), -1, lenmax);  
         //             }  
         //          }  
         return;  
       }  
     } else if (tb->GetType() == 3) {  
       printf("3 %-15s = %d\n", tb->GetName(), tb->GetNdata());  
     } else if (tb->GetType() == 31) {  
       printf("31 %-15s = %d\n", tb->GetName(), tb->GetNdata());  
       //     TClonesArray* clones = (TClonesArray*) tb->GetObject();  
       //     if (tb->GetInfo()) {  
       //       tb->GetInfo()->PrintValueClones(tb->GetName(), clones, tb->GetID(), tb->GetOffset(), lenmax);  
       //       }  
     } else if (tb->GetType() == 41) {  
       printf("41 %-15s = %d\n", tb->GetName(), tb->GetNdata());  
       //       TVirtualCollectionProxy::TPushPop helper(((TBranchElement*) this)->GetCollectionProxy(), fObject);  
       //       if (GetInfo()) {  
       //          GetInfo()->PrintValueSTL(GetName(), ((TBranchElement*) this)->GetCollectionProxy(), fID, fOffset, lenmax);  
       //       }  
     } else {  
       printf("else %-15s = %d\n", tb->GetName(), tb->GetNdata());  
       //       if (GetInfo()) {  
       //          GetInfo()->PrintValue(GetName(), fObject, fID, -1, lenmax);  
       //       }  
     }  
   
     //  };  
   printf("esco qui\n");  
 };  
   
   
383  void FEVdetector::ShowInfo(TString detector){  void FEVdetector::ShowInfo(TString detector){
384    //    //
385    TBranch *b1 = 0;    TBranch *b1 = 0;
386    TBranch *b3 = 0;    //  TBranch *b3 = 0;
387    TObjArray *branch_array = 0;    TObjArray *branch_array = 0;
388    TObjArray *leaf_array = 0;                //  TObjArray *leaf_array = 0;                
389      //
390      if ( !strcmp(detector.Data(),"RunInfo") || !strcmp(detector.Data(),"SoftInfo") ){
391        if ( L2->GetRunTree() ) b1 = L2->GetRunTree()->FindBranch(detector.Data());
392      } else {
393        b1 = otr->FindBranch(detector.Data());
394      };
395      //
396      if ( !b1 ) return;
397      //
398      Int_t dlen = 10;
399      //
400      char o[200000];
401      char zz[200000];
402      char col[13];
403      char col2[13];
404    //    //
405    b1 = otr->FindBranch(detector.Data());    setcolor(col,RESET, GREEN, WHITE);
406    Int_t dlen = 44;    sprintf(o,"%s======> EVENT:%i\n",col, thisentry);
407      sprintf(zz,"======> EVENT:%i\n", thisentry);
408    //    //
409    printf("======> EVENT:%i\n", thisentry);    setcolor(col,RESET, RED, WHITE);
410      sprintf(o,"%s%sBranch %s\n",o,col,b1->GetName());
411      sprintf(zz,"%sBranch %s\n",zz,b1->GetName());
412      setcolor(col,RESET, BLACK, WHITE);
413      sprintf(o,"%s%s",o,col);
414    //    //
   printf("Branch %s\n",b1->GetName());  
415    branch_array = b1->GetListOfBranches();    branch_array = b1->GetListOfBranches();
416    //    //
417    Int_t j = 0;    Int_t j = 0;
# Line 419  void FEVdetector::ShowInfo(TString detec Line 423  void FEVdetector::ShowInfo(TString detec
423      Int_t atype = tb->GetStreamerType() - 20;      Int_t atype = tb->GetStreamerType() - 20;
424      Int_t len = (tb->GetInfo()->GetLengths())[tb->GetID()];      Int_t len = (tb->GetInfo()->GetLengths())[tb->GetID()];
425      Int_t length = min(len,dlen);      Int_t length = min(len,dlen);
426      //    printf("SubBranches : %s  type is %i tb getname %s\n",((TBranch*)branch_array->At(l))->GetName(),type,tb->GetName());      //
427        //        printf("Branches : type is %i type is %i tb getname %s  slen %i slength %i\n",atype,type,tb->GetName(),len,length);
428      switch (type){      switch (type){
429      case 0:      case 0:
430        //              //      
# Line 428  void FEVdetector::ShowInfo(TString detec Line 433  void FEVdetector::ShowInfo(TString detec
433        //        //
434        // NAME        // NAME
435        //        //
436        //      printf(" ATYPE IS %i \n",atype);        setcolor(col,RESET, BLUE, WHITE);
437        printf(" %-15s =",((TBranch*)branch_array->At(l))->GetName());        setcolor(col2,RESET, BLACK, WHITE);
438          sprintf(o,"%s%s %-15s%s =",o,col,((TBranch*)branch_array->At(l))->GetName(),col2);
439          sprintf(zz,"%s %-15s =",zz,((TBranch*)branch_array->At(l))->GetName());
440          //
441        j = 0;        j = 0;
442        //        //
443        // VALUES        // VALUES
444        //        //
445          //
446          // Integer
447          //
448        if ( atype == 3 || atype == -17 ){        if ( atype == 3 || atype == -17 ){
449          while ( j < length ){          while ( j < length ){
450            if ( j < length -1 ){            if ( j < length -1 ){
451              printf(" %llu ,",(ULong64_t)tb->GetValue(j,0));              sprintf(o,"%s %i ,",o,(Int_t)tb->GetValue(j,0));
452                sprintf(zz,"%s %i ,",zz,(Int_t)tb->GetValue(j,0));
453            } else {            } else {
454              printf(" %llu",(ULong64_t)tb->GetValue(j,0));              sprintf(o,"%s %i",o,(Int_t)tb->GetValue(j,0));
455                sprintf(zz,"%s %i",zz,(Int_t)tb->GetValue(j,0));
456            };            };
457            j++;            j++;
458          };          };
459        } else {        };
460          //
461          // Unsigned integer
462          //
463          if ( atype == -7 || atype == 13 || atype == -9 || atype == -8 || atype == 12 ){
464          while ( j < length ){          while ( j < length ){
465            if ( j < length -1 ){            if ( j < length -1 ){
466              printf(" %f ,",tb->GetValue(j,0));              sprintf(o,"%s %u ,",o,(UInt_t)tb->GetValue(j,0));
467                sprintf(zz,"%s %u ,",zz,(UInt_t)tb->GetValue(j,0));
468            } else {            } else {
469              printf(" %f",tb->GetValue(j,0));              sprintf(o,"%s %u",o,(UInt_t)tb->GetValue(j,0));
470                sprintf(zz,"%s %u",zz,(UInt_t)tb->GetValue(j,0));
471            };            };
472            j++;            j++;
473          };          };
474        };        };
       printf("\n");  
       break;  
     case 3:  
475        //        //
476        // IS A TCLONESARRAY        // Float
       //  
       printf(" %-15s = %d\n", tb->GetName(), tb->GetNdata());  
477        //        //
478        if ( tb->GetNdata() ){        if ( atype == -15 || atype == 5 ){
479                    while ( j < length ){
480          printf(" auiauiaui\n");            if ( j < length -1 ){
481          TClonesArray *cl = (TClonesArray*)tb->GetObject();              sprintf(o,"%s %f ,",o,tb->GetValue(j,0));
482          //              sprintf(zz,"%s %f ,",zz,tb->GetValue(j,0));
483          printf(" name %s\n",cl->GetName());            } else {
484          //              sprintf(o,"%s %f",o,tb->GetValue(j,0));
485          TClass *myc = cl->GetClass();              sprintf(zz,"%s %f",zz,tb->GetValue(j,0));
         //  
         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();  
486            };            };
487              j++;
488            ls++;          };
   
           //    };  
           
         for (Int_t ll=0; ll<cl->GetEntriesFast();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))<<thisoffset)));  
           
 //        char *point = 0;  
   
 //        myc->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;  
 //          };  
           };  
   
                 };  
489        };        };
490          //
491                  // Strings
492                  //
493          if ( atype == 45 ){
494            //      TBranchElement *p=(TBranchElement*)cl->At(ll);          //      TObjArray *cl = (TObjArray*)(tb->GetInfo()->GetOffsets())[tb->GetID()];//tb->GetValuePointer();
495            //    Int_t plen = (p->GetInfo()->GetLengths())[p->GetID()];          //      TString *stringa = (TString*)(*cl)[0];  
496            //    Int_t plen = -1;          //      TBranchElement *utb = (TBranchElement*)tb->GetBranchCount();
497            //    printf("SubBranches : %s  plen is %i \n",p->GetName(),plen);          //      TString** stringa = (TString*)(&tb->GetValuePointer());
498                      //TStreamerElement *tste = (TStreamerElement*)tb->GetInfo()->GetCurrentElement();
499              
500                      //      char *ladd;
501                      //      ladd = tb->GetValuePointer()
502            //    TLeafElement* leaf = (TLeafElement*)(p->UncheckedAt(0));          //      TString *stringa = (TString*)((tste->GetOffset()));
503            //    printf("xoxoxo leaf : %s  plen is %i \n",leaf->GetName(),leaf->GetLen());          //      TString& mstr = *stringa;
504                      //      printf(" la mia stringa %s \n",mstr.Data());
505            //    Int_t n = tb->GetNdata();          //      printf(" offset %i \n",(Int_t)utb->GetValue(0,0));
506            //    n = n * leaf->GetLenStatic();          //      int pointer = (tb->GetInfo()->GetOffsets())[tb->GetID()];
507            //    if (tb->GetInfo()) {          //      TString *stringa = (TString*)(tb->GetInfo()->GetOffsets())[tb->GetID()];
508            //    n = 16;  //      TString *stringa = (TString*)tb->GetAddress();
509            //      tb->GetInfo()->PrintValue(tb->GetName(), tb->GetAddress(), atype, n, 44);  //      printf(" address 0x%X \n",tb->GetAddress());
510            //tb->GetObject()->GetInfo()->PrintValue(tb->GetName(), tb->GetObject(), atype, n, lenmax);  //      printf(" pointer 0x%X \n",tb->GetValuePointer());
511            //    }  //      printf(" object  0x%X \n",tb->GetObject());
512              //      printf("stringa %s lung %i\n",stringa.Data(),stringa.Length());
513            //    TClonesArray* clones = (TClonesArray*) cl->At(ll);          //      TLeaf *striglia = tb->FindLeaf(tb->GetName());
514            //    if ( tb->GetInfo() ) {  //      if ( striglia ){
515            //      tb->GetInfo()->PrintValueClones(tb->GetName(), cl, tb->GetID(), tb->GetOffset(), 44);  //        char *pointer = (char *)striglia->GetValuePointer();
516            //    };  //        TString *pr= (TString*)pointer;
517              //        printf("ciao %s \n",pr->Data());
518            //    b3 = (TBranch*)cl->At(l);  //      };
519            //    leaf_array = b3->GetListOfLeaves();          sprintf(o,"%s TString - not implemented yet -",o);
520            //    for(Int_t l=0;l<(leaf_array->GetLast());l++){          sprintf(zz,"%s TString - not implemented yet -",zz);
521            //      printf("Leaf : %s\n",((TLeaf*)leaf_array->At(l))->GetName());        };
522                    //
523                    // TArray
524            //      //      TBranch *bcl = (TBranch*)leaf_array->At(l);        //
525            //      //bcl = b1->GetListOfLeaves();        if ( atype == 42 ){
526            //      //for(Int_t l=0;l<(leaf_array->GetLast()+1);l++){          //
527            //        //    printf(" value: %f \n",otr->GetLeaf(((TLeaf*)leaf_array->At(l))->GetName())->GetValue(0));      //      TObjArray *cl = (TObjArray*)tb->GetObject();
           //        //    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; ln<cl->GetEntriesFast() ;ln++){  
528  //      //  //      //
529            //      TClass *myc = cl->IsA();
530  //      //  //      //
531  //       //      };  //      printf("qui \n");
532    //      //
533  //      TBranchElement *tb2 = (TBranchElement*)cl->UncheckedAt(ln);  //      // determine offset to fetch data
534  //      Int_t type2 = tb2->GetType();  //      //
535  //      Int_t atype2 = tb2->GetStreamerType() - 20;  //      int thisoffset = 0;
536  //      Int_t len2 = (tb2->GetInfo()->GetLengths())[tb2->GetID()];  //      TRealData *rd = myc->GetRealData(tb->GetName());
537  //      Int_t length2 = min(len2,dlen);  //      if ( rd ){
538  //      printf("SubSubBranches : %s  type is %i \n",tb2->GetName(),type2);  //        thisoffset = rd->GetThisOffset();
539    //      };
540  //      switch (type2){  //      Int_t niente = 0;
541  //      case 0:  //      TStreamerElement *tste = tb->GetInfo()->GetStreamerElement(rd->GetName(),niente);
542  //        //        //      printf(" typename %s \n",tste->GetTypeName());
543  //        // IS A VARIABLE  //      //
544    //      // TArrayI
545    //      //
546    //      if ( !strcmp(tste->GetTypeName(),"TArrayI") ){
547  //        //  //        //
548    //        printf("qua \n");
549    //        char *pointer = (char*)cl->At(0);
550    //        //      char *pu = thisoffset + pointer;
551    //        int pu = (int)tste->GetTObjectOffset();
552    //        TArrayI arr = (TArrayI)*pu;
553    //        //      TArrayI arr = (TArrayI)(thisoffset);
554    //        //TArrayI *arr = (TArrayI*)pu;
555    //        //TArraI arr = (TArrayI)
556    //        Int_t jj=0;
557    //        j=0;
558    //        printf("quii \n");
559    //        Int_t arlen = min(arr.GetSize(),dlen);
560  //        //  //        //
561  //        // NAME  //        printf("que \n");
562    //        setcolor(col,RESET, BLUE, WHITE);
563    //        setcolor(col2,RESET, BLACK, WHITE);
564    //        sprintf(o,"%s%s %s[%i]%s = ",o,col,tb->GetName(),arr.GetSize(),col2);
565  //        //  //        //
566  //        printf(" ATYPE IS %i \n",atype2);  //        //      while ( j < tb->GetNdata() ){
 //        printf(" %-15s =",tb2->GetName());  
 //        j = 0;  
567  //        //  //        //
568  //        // VALUES  //        printf("quo \n");
569    //        //        pointer = (char*)cl->UncheckedAt(j);
570    //        //        pu = pointer + thisoffset;
571    //        //        arr = (TArrayI*)(thisoffset);
572  //        //  //        //
573  //        if ( atype2 == 3 || atype2 == -17 ){  //        while ( jj < arlen ){
574  //          while ( j < length2 ){  //          if ( jj < arlen-1 ){
575  //            if ( j < length2 -1 ){  //            sprintf(o,"%s %i ,",o,arr.At(jj));
576  //              printf(" %llu ,",(ULong64_t)tb2->GetValue(j,0));  //          } else {
577  //            } else {  //            sprintf(o,"%s %i",o,arr.At(jj));
 //              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++;  
578  //          };  //          };
579    //          jj++;
580  //        };  //        };
581  //        printf("\n");  //          //      if ( j < tb->GetNdata() -1 ) sprintf(o,"%s ,",o);
582  //        break;  //          //      j++;
583    //          //    };
584  //      };  //      };
 //      //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;  
585  //      //  //      //
586  //      // VALUES  //      // TArrayF
587  //      //  //      //
588  //      if ( atype == 3 || atype == -17 ){  //      if ( !strcmp(tste->GetTypeName(),"TArrayF") ){
589  //        while ( j < length ){  //        //
590  //          if ( j < length -1 ){  //        char *pointer = (char*)cl->UncheckedAt(0);
591  //            printf(" %llu ,",(ULong64_t)tb->GetValue(j,0));  //        char *pu = pointer + thisoffset;
592  //          } else {  //        TArrayF *arr = (TArrayF*)(pu);
593  //            printf(" %llu",(ULong64_t)tb->GetValue(j,0));  //        Int_t jj=0;
594  //          };  //        Int_t arlen = min(arr->GetSize(),dlen);
595  //          j++;  //        //
596  //        };  //        setcolor(col,RESET, BLUE, WHITE);
597  //      } else {  //        setcolor(col2,RESET, BLACK, WHITE);
598  //        while ( j < length ){  //        sprintf(o,"%s%s %s[%i]%s = ",o,col,tb->GetName(),arr->GetSize(),col2);
599  //          if ( j < length -1 ){  //        //
600  //            printf(" %f ,",tb->GetValue(j,0));  //        while ( j < tb->GetNdata() ){
601  //          } else {  //          //
602  //            printf(" %f",tb->GetValue(j,0));  //          pointer = (char*)cl->UncheckedAt(j);
603    //          pu = pointer + thisoffset;
604    //          arr = (TArrayF*)(pu);
605    //          //
606    //          while ( jj < arlen ){
607    //            if ( jj < arlen-1 ){
608    //              sprintf(o,"%s %f ,",o,arr->At(jj));
609    //            } else {
610    //              sprintf(o,"%s %f",o,arr->At(jj));
611    //            };
612    //            jj++;
613  //          };  //          };
614    //          if ( j < tb->GetNdata() -1 ) sprintf(o,"%s ,",o);
615  //          j++;  //          j++;
616  //        };  //        };
617  //      };  //      };
618  //      printf("\n");  //      sprintf(o,"%s\n",o);
619            //      
620            sprintf(o,"%s TArray - not implemented yet -",o);
621            sprintf(zz,"%s TArray - not implemented yet -",zz);
622            //
623          };
624          //
625          sprintf(o,"%s\n",o);
626          sprintf(zz,"%s\n",zz);
627          break;
628        case 3:
629          //
630          // IS A TCLONESARRAY
631          //
632          setcolor(col,RESET, BLUE, WHITE);
633          setcolor(col2,RESET, BLACK, WHITE);
634          sprintf(o,"%s%s %-15s%s = %d\n",o,col,tb->GetName(), col2, tb->GetNdata());
635          sprintf(zz,"%s %-15s = %d\n",zz,tb->GetName(), tb->GetNdata());
636    
637          //
638          if ( tb->GetNdata() ){
639            //
640            TClonesArray *cl = (TClonesArray*)tb->GetObject();
641            //
642            TClass *myc = cl->GetClass();
643            //
644            TList *lme = myc->GetListOfDataMembers();
645            TIter next(lme);
646            TBranchElement *tb2 = 0;
647            //
648            while ( (tb2 = (TBranchElement*)next()) ){
649              //
650              const char *name = tb2->GetName();
651              TBranch *foglia = tb->FindBranch(name);
652              if ( foglia ){
653                //
654                TBranchElement *stb = (TBranchElement*)tb->FindBranch(name);
655                Int_t stype = stb->GetType();
656                Int_t satype = stb->GetStreamerType() - 20;
657                Int_t slen = (stb->GetInfo()->GetLengths())[stb->GetID()];
658                Int_t slength = min(slen,dlen);
659                //      printf("SubBranches : atype is %i type is %i tb getname %s  slen %i slength %i\n",satype,stype,stb->GetName(),slen,slength);
660                switch (stype){
661                case 31:
662                  //      
663                  // IS A VARIABLE
664                  //
665                  //
666                  // NAME
667                  //
668                  j = 0;
669                  //
670                  // VALUES
671                  //
672                  if ( satype == 41 || satype == 44){
673                    //
674                    // skip TRef
675                    //
676                    break;
677                  };
678                  //
679                  // Integer
680                  //
681                  if ( satype == -17 || satype == -9 ){
682                    //
683                    setcolor(col,RESET, BLUE, WHITE);
684                    setcolor(col2,RESET, BLACK, WHITE);
685                    sprintf(o,"%s%s %-15s%s = ",o,col,foglia->GetName(),col2);
686                    sprintf(zz,"%s %-15s = ",zz,foglia->GetName());
687                    while ( j < cl->GetEntriesFast() ){
688                      if ( j < cl->GetEntriesFast() -1 ){
689                        sprintf(o,"%s %i ,",o,(Int_t)stb->GetValue(j,slength));
690                        sprintf(zz,"%s %i ,",zz,(Int_t)stb->GetValue(j,slength));
691                      } else {
692                        sprintf(o,"%s %i",o,(Int_t)stb->GetValue(j,slength));
693                        sprintf(zz,"%s %i",zz,(Int_t)stb->GetValue(j,slength));
694                      };
695                      j++;
696                    };
697                  };
698                  //
699                  // Float
700                  //
701                  if ( satype == -15 ){
702                    //
703                    setcolor(col,RESET, BLUE, WHITE);
704                    setcolor(col2,RESET, BLACK, WHITE);
705                    sprintf(o,"%s%s %-15s%s = ",o,col,foglia->GetName(),col2);
706                    sprintf(zz,"%s %-15s = ",zz,foglia->GetName());
707                    while ( j < cl->GetEntriesFast() ){
708                      if ( j < cl->GetEntriesFast() -1 ){
709                        sprintf(o,"%s %f ,",o,stb->GetValue(j,slength));
710                        sprintf(zz,"%s %f ,",zz,stb->GetValue(j,slength));
711                      } else {
712                        sprintf(o,"%s %f",o,stb->GetValue(j,slength));
713                        sprintf(zz,"%s %f",zz,stb->GetValue(j,slength));
714                      };
715                      j++;
716                    };
717                  };
718                  //
719                  // Array of float
720                  //
721                  if ( satype == 5 ){
722                    //
723                    setcolor(col,RESET, BLUE, WHITE);
724                    setcolor(col2,RESET, BLACK, WHITE);
725                    sprintf(o,"%s%s %-15s%s = ",o,col,foglia->GetName(),col2);
726                    sprintf(zz,"%s %-15s = ",zz,foglia->GetName());
727                    Bool_t bold = true;
728                    while ( j < tb->GetNdata() ){
729                      if ( bold ){
730                        setcolor(col,RESET, BLACK, WHITE);
731                        sprintf(o,"%s%s",o,col);
732                      } else {
733                        setcolor(col,BOLD, BLACK, WHITE);
734                        sprintf(o,"%s%s",o,col);                
735                      };
736                      Int_t jj = 0;          
737                      while ( jj < slength ){                  
738                        if ( jj < slength-1 ){
739                          sprintf(o,"%s %f ,",o,stb->GetValue(j,jj,true));
740                          sprintf(zz,"%s %f ,",zz,stb->GetValue(j,jj,true));
741                        } else {
742                          sprintf(o,"%s %f",o,stb->GetValue(j,jj,true));
743                          sprintf(zz,"%s %f",zz,stb->GetValue(j,jj,true));
744                        };
745                        jj++;
746                      };
747                      if ( j < tb->GetNdata() -1 ) sprintf(o,"%s ,",o);
748                      if ( j < tb->GetNdata() -1 ) sprintf(zz,"%s ,",zz);
749                      if ( !bold ){
750                        bold = true;
751                      } else {
752                        bold = false;
753                      };
754                      j++;
755                    };
756                    if ( bold ){
757                      setcolor(col,RESET, BLACK, WHITE);
758                      sprintf(o,"%s%s",o,col);
759                    };
760                  };
761                  //
762                  // Array of integers
763                  //
764                  if ( satype == 3 ){
765                    //
766                    setcolor(col,RESET, BLUE, WHITE);
767                    setcolor(col2,RESET, BLACK, WHITE);
768                    sprintf(o,"%s%s %-15s%s = ",o,col,foglia->GetName(),col2);
769                    sprintf(zz,"%s %-15s = ",zz,foglia->GetName());
770                    while ( j < tb->GetNdata() ){
771                      Int_t jj = 0;
772                      while ( jj < slength ){
773                        if ( jj < slength-1 ){
774                          sprintf(o,"%s %i ,",o,(Int_t)stb->GetValue(j,jj,true));
775                          sprintf(zz,"%s %i ,",zz,(Int_t)stb->GetValue(j,jj,true));
776                        } else {
777                          sprintf(o,"%s %i",o,(Int_t)stb->GetValue(j,jj,true));
778                          sprintf(zz,"%s %i",zz,(Int_t)stb->GetValue(j,jj,true));
779                        };
780                        jj++;
781                      };
782                      if ( j < tb->GetNdata() -1 ) sprintf(o,"%s ,",o);
783                      if ( j < tb->GetNdata() -1 ) sprintf(zz,"%s ,",zz);
784                      j++;
785                    };
786                  };
787    
788                  //
789                  // TArray
790                  //
791                  if ( satype == 42 ){
792                    //
793                    // determine offset to fetch data
794                    //
795                    int thisoffset = 0;
796                    TRealData *rd = myc->GetRealData(foglia->GetName());
797                    if ( rd ){
798                      thisoffset = rd->GetThisOffset();
799                    };
800                    Int_t niente = 0;
801                    TStreamerElement *tste = stb->GetInfo()->GetStreamerElement(rd->GetName(),niente);
802                    //
803                    // TArrayI
804                    //
805                    if ( !strcmp(tste->GetTypeName(),"TArrayI") ){
806                      //
807                      char *pointer = (char*)cl->UncheckedAt(0);
808                      char *pu = pointer + thisoffset;
809                      TArrayI *arr = (TArrayI*)(pu);
810                      Int_t jj=0;
811                      Int_t arlen = min(arr->GetSize(),dlen);
812                      //
813                      setcolor(col,RESET, BLUE, WHITE);
814                      setcolor(col2,RESET, BLACK, WHITE);
815                      sprintf(o,"%s%s %s[%i]%s = ",o,col,foglia->GetName(),arr->GetSize(),col2);
816                      sprintf(zz,"%s %s[%i] = ",zz,foglia->GetName(),arr->GetSize());
817                      //
818                      while ( j < tb->GetNdata() ){
819                        //
820                        pointer = (char*)cl->UncheckedAt(j);
821                        pu = pointer + thisoffset;
822                        arr = (TArrayI*)(pu);
823                        //
824                        while ( jj < arlen ){
825                          if ( jj < arlen-1 ){
826                            sprintf(o,"%s %i ,",o,arr->At(jj));
827                            sprintf(zz,"%s %i ,",zz,arr->At(jj));
828                          } else {
829                            sprintf(o,"%s %i",o,arr->At(jj));
830                            sprintf(zz,"%s %i",zz,arr->At(jj));
831                          };
832                          jj++;
833                        };
834                        if ( j < tb->GetNdata() -1 ) sprintf(o,"%s ,",o);
835                        if ( j < tb->GetNdata() -1 ) sprintf(zz,"%s ,",zz);
836                        j++;
837                      };
838                    };
839                    //
840                    // TArrayF
841                    //
842                    if ( !strcmp(tste->GetTypeName(),"TArrayF") ){
843                      //
844                      char *pointer = (char*)cl->UncheckedAt(0);
845                      char *pu = pointer + thisoffset;
846                      TArrayF *arr = (TArrayF*)(pu);
847                      Int_t jj=0;
848                      Int_t arlen = min(arr->GetSize(),dlen);
849                      //
850                      setcolor(col,RESET, BLUE, WHITE);
851                      setcolor(col2,RESET, BLACK, WHITE);
852                      sprintf(o,"%s%s %s[%i]%s = ",o,col,foglia->GetName(),arr->GetSize(),col2);
853                      sprintf(zz,"%s %s[%i] = ",zz,foglia->GetName(),arr->GetSize());
854                      //
855                      while ( j < tb->GetNdata() ){
856                        //
857                        pointer = (char*)cl->UncheckedAt(j);
858                        pu = pointer + thisoffset;
859                        arr = (TArrayF*)(pu);
860                        //
861                        while ( jj < arlen ){
862                          if ( jj < arlen-1 ){
863                            sprintf(o,"%s %f ,",o,arr->At(jj));
864                            sprintf(zz,"%s %f ,",zz,arr->At(jj));
865                          } else {
866                            sprintf(o,"%s %f",o,arr->At(jj));
867                            sprintf(zz,"%s %f",zz,arr->At(jj));
868                          };
869                          jj++;
870                        };
871                        if ( j < tb->GetNdata() -1 ) sprintf(o,"%s ,",o);
872                        if ( j < tb->GetNdata() -1 ) sprintf(zz,"%s ,",zz);
873                        j++;
874                      };
875                    };
876                  };
877                  sprintf(o,"%s\n",o);
878                  sprintf(zz,"%s\n",zz);
879                  break;        
880                };
881              };
882            };
883          };
884        break;        break;
885      };      };
886    //    b3 = (TBranch*)branch_array->At(l);    };  
887    //    leaf_array = b1->GetListOfLeaves();    printf("%s\n",o);
888    //    for(Int_t l=0;l<(leaf_array->GetLast()+1);l++){    pamgui->DIALOG(4,zz);
   //      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));      
   //    };  
   //  };  
     
   };  
     
889  };  };
890    
891    
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
892  void FEVdetector::GetGeneralInfo(){  void FEVdetector::GetGeneralInfo(){
893    //    //
894    // Get Orbital Time information and header event number    // Get Orbital Time information and header event number
# Line 811  void FEVdetector::GetGeneralInfo(){ Line 898  void FEVdetector::GetGeneralInfo(){
898      headcold = headc;      headcold = headc;
899      headc = ph->Counter;      headc = ph->Counter;
900      var.headc = (int)ph->Counter;      var.headc = (int)ph->Counter;
901      OBT = ph->OrbitalTime;      OBT = (UInt_t)ph->OrbitalTime;
902      DOBT = OBT - OOBT;      DOBT = OBT - OOBT;
903      OOBT = OBT;      OOBT = OBT;
904      if ( thisentry == minevent || DOBT < 0 || (headc-headcold-1)!=0 ) DOBT = 0;      if ( thisentry == minevent || DOBT < 0 || (headc-headcold-1)!=0 ) DOBT = 0;
# Line 847  void FEVdetector::GetGeneralInfo(){ Line 934  void FEVdetector::GetGeneralInfo(){
934      trcs = (TString)trc.str().c_str();      trcs = (TString)trc.str().c_str();
935    } else {    } else {
936      headcold = headc;      headcold = headc;
937        if ( var.RUN ){
938          var.idrun = L2->GetRunInfo()->ID;
939          var.idroot = L2->GetRunInfo()->ID_ROOT_L0;
940          var.EVF = L2->GetRunInfo()->EV_FROM;
941        };
942      if ( var.ORB ){      if ( var.ORB ){
943        headc = L2->GetOrbitalInfo()->pkt_num;        headc = L2->GetOrbitalInfo()->pkt_num;
944        OBT = L2->GetOrbitalInfo()->OBT;        OBT = L2->GetOrbitalInfo()->OBT;
# Line 965  int FEVdetector::SelectEvent(){ Line 1057  int FEVdetector::SelectEvent(){
1057        //        //
1058        if ( level.file == 2 ){        if ( level.file == 2 ){
1059          cintcom.str("");          cintcom.str("");
1060          cintcom << "PamLevel2 *L2 = (PamLevel2*)0x" << hex;          cintcom << "PamLevel2 *L2 = (PamLevel2*)" << hex; //con const e l2 funziona
1061          cintcom << L2;          cintcom << L2;
1062          gROOT->ProcessLine(cintcom.str().c_str());          gROOT->ProcessLine(cintcom.str().c_str());
1063            //      printf(" comando: %s \n",cintcom.str().c_str());
1064        } else {        } else {
1065          cintcom.str("");          cintcom.str("");
1066          cintcom << "TTree *otr = (TTree*)0x" << hex;          cintcom << "TTree *otr = (TTree*)" << hex;
1067          cintcom << otr;          cintcom << otr;
1068          gROOT->ProcessLine(cintcom.str().c_str());          gROOT->ProcessLine(cintcom.str().c_str());
1069          //          //
1070          cintcom.str("");          cintcom.str("");
1071          cintcom << "struct Variables &var = (struct Variables &)0x" << hex;          cintcom << "struct Variables &var = (struct Variables &)" << hex;
1072          cintcom << &var;          cintcom << &var;
1073          gROOT->ProcessLine(cintcom.str().c_str());          gROOT->ProcessLine(cintcom.str().c_str());
1074        };        };
# Line 1000  int FEVdetector::SelectEvent(){ Line 1093  int FEVdetector::SelectEvent(){
1093    //    //
1094  }  }
1095    
1096  Int_t FEVdetector::Load(TTree &mainotr, TFile &mainfile){  TChain* FEVdetector::Load(TString file){
1097    //Int_t FEVdetector::Load(TChain &mainotr, TFile &mainfile){    //
1098    file = &mainfile;    //  file = &mainfile;
   otr = &mainotr;  
   L2 = new PamLevel2();  
1099    //    //
1100    if ( level.file == 2 ){    if ( level.file == 2 ){
1101      //    otr = L2->LoadPamTrees(file);      //
1102      printf(" %s \n",ddec.Data());      //    printf(" %s \n",ddec.Data());
1103      //    otr->Refresh();      if ( !L2 ){
1104      //    otr->Clear();        L2 = new PamLevel2("",file.Data(),ddec.Data());
1105      //    otr = new TTree();        otr = L2->GetPamTree();
1106      otr = L2->GetPamTree(file,ddec.Data());        //      printf(" l2 constructor\n");
1107          //      printf(" abst %u obt %u qtot %f \n",L2->GetOrbitalInfo()->absTime,L2->GetOrbitalInfo()->OBT,L2->GetCaloLevel2()->qtot);    
1108        } else {
1109          //
1110          //      printf(" l2 already exist \n");
1111          otr = L2->GetPamTree(gSystem->DirName(file.Data()),file.Data(),ddec.Data());
1112          L2->GetRunTree(gSystem->DirName(file.Data()),file.Data());
1113          //
1114        };
1115        //
1116      //      //
1117      if ( !otr ) return(0);      if ( !otr ) return(0);
     // ********************  
     // load magnetic field  
     // ********************  
     //    const char *pam_calib = pathtocalibration();  
     //  
     //    stringstream magfie;  
     //    magfie.str("");  
     //    magfie << "/localdisk/mocchiut/test/calib/trk-param/field_param-0/";  
     // magfie << pam_calib;  
     //magfie << "/trk-param/field_param-0/";  
1118      //      //
1119      //L2->GetTrkLevel2()->LoadField(magfie.str().c_str());      //    otr->CanDeleteRefs(true);
1120        //    if ( runtree ) runtree->CanDeleteRefs(true);
1121        //
1122    } else {    } else {
1123      //      //
1124      // load calorimeter ADC2MIP conversion file      // load calorimeter ADC2MIP conversion file
# Line 1067  Int_t FEVdetector::Load(TTree &mainotr, Line 1159  Int_t FEVdetector::Load(TTree &mainotr,
1159    };    };
1160    //    //
1161    //    //
1162    trigger = new pamela::trigger::TriggerEvent();    // Load level0 file if the case
   eh = new pamela::EventHeader();  
   ph = new pamela::PscuHeader();  
   //  oinfoL2 = new OrbitalInfo();  
   runinfo = new ItoRunInfo(file);  
   //  
   de = new pamela::calorimeter::CalorimeterEvent();  
   trk = new pamela::tracker::TrackerEvent();  
   ne = new pamela::neutron::NeutronEvent();  
   ace = new pamela::anticounter::AnticounterEvent();  
   s4 = new pamela::S4::S4Event();  
   tof = new pamela::tof::TofEvent();  
1163    //    //
1164    if ( level.file == 0 || level.file == -1 ){    if ( level.file == 0 || level.file == -1 ){
1165        //
1166        trigger = new pamela::trigger::TriggerEvent();
1167        eh = new pamela::EventHeader();
1168        ph = new pamela::PscuHeader();
1169        de = new pamela::calorimeter::CalorimeterEvent();
1170        trk = new pamela::tracker::TrackerEvent();
1171        ne = new pamela::neutron::NeutronEvent();
1172        ace = new pamela::anticounter::AnticounterEvent();
1173        s4 = new pamela::S4::S4Event();
1174        tof = new pamela::tof::TofEvent();
1175        //
1176        otr = new TChain("Physics");
1177        otr->Add(file.Data(),-1);
1178      otr->SetBranchAddress("Trigger", &trigger);      otr->SetBranchAddress("Trigger", &trigger);
1179      otr->SetBranchAddress("Header", &eh);      otr->SetBranchAddress("Header", &eh);
1180    };    };
   if ( level.file == 2 && var.RUN){  
     //    otr->AddFriend("OrbitalInfo", file);        
     //    otr->SetBranchAddress("OrbitalInfo", &oinfoL2);          
     runinfo->Read(0ULL);  
   };  
1181    //    //
1182    if ( var.TRK ) {    if ( var.TRK ) {
1183      if ( level.file == 0 || level.file == -1 ){      if ( level.file == 0 || level.file == -1 ){
# Line 1161  Int_t FEVdetector::Load(TTree &mainotr, Line 1250  Int_t FEVdetector::Load(TTree &mainotr,
1250      };      };
1251    };    };
1252    //    //
1253    //  printf("qua\n");    if ( !otr ){
1254    return(1);      return(0);
1255      };
1256      //
1257      return otr;
1258    //        //    
1259  }  }
1260    
# Line 1238  void FEVdetector::DisplayEvent(){ Line 1330  void FEVdetector::DisplayEvent(){
1330      text->DrawLatex(0.33,txthi,testo.str().c_str());      text->DrawLatex(0.33,txthi,testo.str().c_str());
1331      txthi -= 0.03;      txthi -= 0.03;
1332      testo2.str("");      testo2.str("");
1333      testo2 << "On Board Time: " << (int)OBT;      testo2 << "On Board Time: " << (unsigned int)OBT;
1334      if ( DOBT > 0 ) {                    if ( DOBT > 0 ) {              
1335        testo2 << " (delta: " << (int)DOBT;        testo2 << " (delta: " << (unsigned int)DOBT;
1336        testo2 << ")";        testo2 << ")";
1337      };      };
1338      testo2 << " [ms]";      testo2 << " [ms]";
# Line 1398  void FEVdetector::DisplayEvent(){ Line 1490  void FEVdetector::DisplayEvent(){
1490        text->DrawLatex(var.xxvc+0.17*var.sfx,var.yxvc-0.08*var.sfy,"CAS1");        text->DrawLatex(var.xxvc+0.17*var.sfx,var.yxvc-0.08*var.sfy,"CAS1");
1491        text->DrawLatex(var.xyvc-0.192*var.sfx,var.yyvc-0.08*var.sfy,"CAS4");        text->DrawLatex(var.xyvc-0.192*var.sfx,var.yyvc-0.08*var.sfy,"CAS4");
1492        text->DrawLatex(var.xyvc+0.17*var.sfx,var.yyvc-0.08*var.sfy,"CAS3");        text->DrawLatex(var.xyvc+0.17*var.sfx,var.yyvc-0.08*var.sfy,"CAS3");
1493        text->DrawLatex(var.xxvc-0.192*var.sfx,var.yxvc+0.48*var.sfy,"CARD2");        text->DrawLatex(var.xxvc-0.222*var.sfx,var.yxvc+0.48*var.sfy,"CARD2");
1494        text->DrawLatex(var.xxvc+0.155*var.sfx,var.yxvc+0.48*var.sfy,"CARD3");        text->DrawLatex(var.xxvc+0.185*var.sfx,var.yxvc+0.48*var.sfy,"CARD3");
1495        text->DrawLatex(var.xyvc-0.170*var.sfx,var.yyvc+0.48*var.sfy,"CARD1");        text->DrawLatex(var.xyvc-0.190*var.sfx,var.yyvc+0.48*var.sfy,"CARD1");
1496        text->DrawLatex(var.xyvc+0.13*var.sfx,var.yyvc+0.48*var.sfy,"CARD4");        text->DrawLatex(var.xyvc+0.16*var.sfx,var.yyvc+0.48*var.sfy,"CARD4");
1497        text->DrawLatex(var.xxvc-0.192*var.sfx,var.yxvc+0.39*var.sfy,"CAT3");        text->DrawLatex(var.xxvc-0.192*var.sfx,var.yxvc+0.39*var.sfy,"CAT3");
1498        text->DrawLatex(var.xxvc+0.155*var.sfx,var.yxvc+0.39*var.sfy,"CAT4");        text->DrawLatex(var.xxvc+0.155*var.sfx,var.yxvc+0.39*var.sfy,"CAT4");
1499        text->DrawLatex(var.xyvc-0.170*var.sfx,var.yyvc+0.39*var.sfy,"CAT2");        text->DrawLatex(var.xyvc-0.170*var.sfx,var.yyvc+0.39*var.sfy,"CAT2");
# Line 1529  void FEVdetector::DisplayEvent(){ Line 1621  void FEVdetector::DisplayEvent(){
1621    //    //
1622    // print infos on terminal    // print infos on terminal
1623    //    //
1624      //  if ( !var.selex ){
1625    printf(" File: %s \n",var.thefilename.Data());            printf(" File: %s \n",var.thefilename.Data());        
1626    if ( !s4pulser && !calotrig ){    if ( !s4pulser && !calotrig ){
1627      printf(" Pkt_num: %i  - Progressive number: %i \n",(int)headc,thisentry+1);      printf(" Pkt_num: %i  - Progressive number: %i \n",(int)headc,thisentry+1);
# Line 1539  void FEVdetector::DisplayEvent(){ Line 1632  void FEVdetector::DisplayEvent(){
1632    if ( calotrig ){    if ( calotrig ){
1633      printf(" Pkt_num: %i  - Progressive number: %i   - CALO trigger -\n",(int)headc,thisentry+1);      printf(" Pkt_num: %i  - Progressive number: %i   - CALO trigger -\n",(int)headc,thisentry+1);
1634    };    };
1635    printf(" On Board Time: %i (delta %i) [ms]\n",OBT,DOBT);    printf(" On Board Time: %u (delta %i) [ms]\n",OBT,DOBT);
1636    const char *trc2 = trcs;    const char *trc2 = trcs;
1637    printf(" TRIGGER: %s \n",trc2);          printf(" TRIGGER: %s \n",trc2);      
1638    printf(" AC: CARD hit = %i  CAT hit = %i  CAS hit = %i \n",var.hcard,var.hcat,var.hcas);          printf(" AC: CARD hit = %i  CAT hit = %i  CAS hit = %i \n",var.hcard,var.hcat,var.hcas);      
# Line 1551  void FEVdetector::DisplayEvent(){ Line 1644  void FEVdetector::DisplayEvent(){
1644    printf(" CALO: NSTRIP = %i  QTOT = %i [MIP]\n",var.nstrip,var.qtot);      printf(" CALO: NSTRIP = %i  QTOT = %i [MIP]\n",var.nstrip,var.qtot);  
1645    printf(" S4: %.2f [MIP]   TOF: beta = %.2f \n",var.s4sig,var.beta[4]);            printf(" S4: %.2f [MIP]   TOF: beta = %.2f \n",var.s4sig,var.beta[4]);        
1646    printf(" ND: Trigger: neutrons = %i - Background: upper = %i lower = %i \n",var.trup,var.bkup,var.bkbo);          printf(" ND: Trigger: neutrons = %i - Background: upper = %i lower = %i \n",var.trup,var.bkup,var.bkbo);      
1647      //  };
1648    //    //
1649  }  }
1650    
# Line 1858  void FEVdetector::ShowPalette(){ Line 1952  void FEVdetector::ShowPalette(){
1952  void FEVdetector::ShowTOF(){  void FEVdetector::ShowTOF(){
1953    //    //
1954    //    //
   //  
1955    if ( !var.TOF ) return;    if ( !var.TOF ) return;
1956    //    //
1957    Int_t tt = 0;    Int_t tt = 0;
1958      Int_t rj = 0;
1959    //    //
1960    // force level0, i.e. show patterntrig variable!    // force level0, i.e. show patterntrig variable!
1961    //    //
# Line 1891  void FEVdetector::ShowTOF(){ Line 1985  void FEVdetector::ShowTOF(){
1985      Float_t mt31[2][3];      Float_t mt31[2][3];
1986      Float_t mt32[2][3];      Float_t mt32[2][3];
1987      //      //
1988        memset(mt11,0,2*8*sizeof(Float_t));
1989        memset(mt12,0,2*6*sizeof(Float_t));
1990        memset(mt21,0,2*2*sizeof(Float_t));
1991        memset(mt22,0,2*2*sizeof(Float_t));
1992        memset(mt31,0,2*3*sizeof(Float_t));
1993        memset(mt32,0,2*3*sizeof(Float_t));
1994        //
1995      Int_t S3 = 0;      Int_t S3 = 0;
1996      Int_t S2 = 0;      Int_t S2 = 0;
1997      Int_t S12 = 0;      Int_t S12 = 0;
# Line 2055  void FEVdetector::ShowTOF(){ Line 2156  void FEVdetector::ShowTOF(){
2156      Float_t s12p = 0.055;      Float_t s12p = 0.055;
2157      ocolo = 10;      ocolo = 10;
2158      TPolyLine *ftof12ya[6];      TPolyLine *ftof12ya[6];
2159        rj=6;
2160      for ( Int_t j=0; j<6; j++){      for ( Int_t j=0; j<6; j++){
2161          rj--;
2162        Float_t xc1[4]={ (s12p*j),       s12p*(j),               s12p*(j+1),     (s12p*j)};        Float_t xc1[4]={ (s12p*j),       s12p*(j),               s12p*(j+1),     (s12p*j)};
2163        Float_t yc1[4]={      -ws13,     0.,  0., -ws13};        Float_t yc1[4]={      -ws13,     0.,  0., -ws13};
2164        Float_t xc[4];            Float_t xc[4];    
# Line 2071  void FEVdetector::ShowTOF(){ Line 2174  void FEVdetector::ShowTOF(){
2174        } else {        } else {
2175          colo = 1;          colo = 1;
2176        };        };
2177        ColorMIP(ms12a[j],colo);        ColorMIP(ms12a[rj],colo);
2178        //        //
2179        if ( colo != 10 ) ocolo = colo;        if ( colo != 10 ) ocolo = colo;
2180        if ( mt12[0][j] == 4095. ) colo = noadc;        if ( mt12[0][rj] == 4095. ) colo = noadc;
2181        //        //
2182        ftof12ya[j]->SetFillColor(colo);        ftof12ya[j]->SetFillColor(colo);
2183        ftof12ya[j]->SetLineWidth(1);        ftof12ya[j]->SetLineWidth(1);
# Line 2084  void FEVdetector::ShowTOF(){ Line 2187  void FEVdetector::ShowTOF(){
2187      // B      // B
2188      s12p = 0.055;      s12p = 0.055;
2189      TPolyLine *ftof12yb[6];      TPolyLine *ftof12yb[6];
2190        rj=6;
2191      for ( Int_t j=0; j<6; j++){      for ( Int_t j=0; j<6; j++){
2192          rj--;
2193        Float_t xc1[4]={ (s12p*j),       s12p*(j+1),               s12p*(j+1),     (s12p*j)};        Float_t xc1[4]={ (s12p*j),       s12p*(j+1),               s12p*(j+1),     (s12p*j)};
2194        Float_t yc1[4]={ -ws13,     -ws13,    0., -ws13};        Float_t yc1[4]={ -ws13,     -ws13,    0., -ws13};
2195        Float_t xc[4];            Float_t xc[4];    
# Line 2100  void FEVdetector::ShowTOF(){ Line 2205  void FEVdetector::ShowTOF(){
2205        } else {        } else {
2206          colo = 1;          colo = 1;
2207        };        };
2208        ColorMIP(ms12b[j],colo);        ColorMIP(ms12b[rj],colo);
2209        //        //
2210        if ( colo != 10 ) ocolo = colo;        if ( colo != 10 ) ocolo = colo;
2211        if ( mt12[1][j] == 4095. ) colo = noadc;        if ( mt12[1][rj] == 4095. ) colo = noadc;
2212        //        //
2213        ftof12yb[j]->SetFillColor(colo);        ftof12yb[j]->SetFillColor(colo);
2214        ftof12yb[j]->SetLineWidth(1);        ftof12yb[j]->SetLineWidth(1);
# Line 2137  void FEVdetector::ShowTOF(){ Line 2242  void FEVdetector::ShowTOF(){
2242      Float_t s21p = 0.075;      Float_t s21p = 0.075;
2243      ocolo = 10;      ocolo = 10;
2244      TPolyLine *ftof21ya[2];      TPolyLine *ftof21ya[2];
2245        rj=2;
2246      for ( Int_t j=0; j<2; j++){      for ( Int_t j=0; j<2; j++){
2247          rj--;
2248        Float_t xc1[4]={ s21p*(j-1),       s21p*(j-1),               s21p*j,     s21p*(j-1)};        Float_t xc1[4]={ s21p*(j-1),       s21p*(j-1),               s21p*j,     s21p*(j-1)};
2249        Float_t yc1[4]={ 0.,                ws2,     ws2,    0.};        Float_t yc1[4]={ 0.,                ws2,     ws2,    0.};
2250        Float_t xc[4];            Float_t xc[4];    
# Line 2153  void FEVdetector::ShowTOF(){ Line 2260  void FEVdetector::ShowTOF(){
2260        } else {        } else {
2261          colo = 1;          colo = 1;
2262        };        };
2263        ColorMIP(ms21a[j],colo);        ColorMIP(ms21a[rj],colo);
2264        //        //
2265        if ( colo != 10 ) ocolo = colo;        if ( colo != 10 ) ocolo = colo;
2266        if ( mt21[0][j] == 4095. ) colo = noadc;        if ( mt21[0][rj] == 4095. ) colo = noadc;
2267        //        //
2268        ftof21ya[j]->SetFillColor(colo);        ftof21ya[j]->SetFillColor(colo);
2269        ftof21ya[j]->SetLineWidth(1);        ftof21ya[j]->SetLineWidth(1);
# Line 2166  void FEVdetector::ShowTOF(){ Line 2273  void FEVdetector::ShowTOF(){
2273      // B      // B
2274      s21p = 0.075;      s21p = 0.075;
2275      TPolyLine *ftof21yb[2];      TPolyLine *ftof21yb[2];
2276        rj=2;
2277      for ( Int_t j=0; j<2; j++){      for ( Int_t j=0; j<2; j++){
2278          rj--;
2279        Float_t xc1[4]={ s21p*(j-1),       s21p*j,               s21p*j,     s21p*(j-1)};        Float_t xc1[4]={ s21p*(j-1),       s21p*j,               s21p*j,     s21p*(j-1)};
2280        Float_t yc1[4]={ 0.,         0.,                ws2,         0.};        Float_t yc1[4]={ 0.,         0.,                ws2,         0.};
2281        Float_t xc[4];            Float_t xc[4];    
# Line 2182  void FEVdetector::ShowTOF(){ Line 2291  void FEVdetector::ShowTOF(){
2291        } else {        } else {
2292          colo = 1;          colo = 1;
2293        };        };
2294        ColorMIP(ms21b[j],colo);        ColorMIP(ms21b[rj],colo);
2295        //        //
2296        if ( colo != 10 ) ocolo = colo;        if ( colo != 10 ) ocolo = colo;
2297        if ( mt21[1][j] == 4095. ) colo = noadc;        if ( mt21[1][rj] == 4095. ) colo = noadc;
2298        //        //
2299        ftof21yb[j]->SetFillColor(colo);        ftof21yb[j]->SetFillColor(colo);
2300        ftof21yb[j]->SetLineWidth(1);        ftof21yb[j]->SetLineWidth(1);
# Line 2300  void FEVdetector::ShowTOF(){ Line 2409  void FEVdetector::ShowTOF(){
2409      Float_t s31p = 0.060;      Float_t s31p = 0.060;
2410      ocolo = 10;      ocolo = 10;
2411      TPolyLine *ftof31xa[3];      TPolyLine *ftof31xa[3];
2412        rj=3;
2413      for ( Int_t j=0; j<3; j++){      for ( Int_t j=0; j<3; j++){
2414          rj--;
2415        Float_t xc1[4]={ (s31p*j),       (s31p*j),               s31p*(j+1),       (s31p*j)};        Float_t xc1[4]={ (s31p*j),       (s31p*j),               s31p*(j+1),       (s31p*j)};
2416        Float_t yc1[4]={ 0.,                       ws13,     ws13,    0.};        Float_t yc1[4]={ 0.,                       ws13,     ws13,    0.};
2417        Float_t xc[4];            Float_t xc[4];    
# Line 2316  void FEVdetector::ShowTOF(){ Line 2427  void FEVdetector::ShowTOF(){
2427        } else {        } else {
2428          colo = 1;          colo = 1;
2429        };        };
2430        ColorMIP(ms31a[j],colo);        ColorMIP(ms31a[rj],colo);
2431        //        //
2432        if ( colo != 10 ) ocolo = colo;        if ( colo != 10 ) ocolo = colo;
2433        if ( mt31[0][j] == 4095. ) colo = noadc;        if ( mt31[0][rj] == 4095. ) colo = noadc;
2434        //        //
2435        ftof31xa[j]->SetFillColor(colo);        ftof31xa[j]->SetFillColor(colo);
2436        ftof31xa[j]->SetLineWidth(1);        ftof31xa[j]->SetLineWidth(1);
# Line 2329  void FEVdetector::ShowTOF(){ Line 2440  void FEVdetector::ShowTOF(){
2440      // B      // B
2441      s31p = 0.060;      s31p = 0.060;
2442      TPolyLine *ftof31xb[3];      TPolyLine *ftof31xb[3];
2443        rj=3;
2444      for ( Int_t j=0; j<3; j++){      for ( Int_t j=0; j<3; j++){
2445          rj--;
2446        Float_t xc1[4]={ (s31p*j),       s31p*(j+1),               s31p*(j+1),     (s31p*j)};        Float_t xc1[4]={ (s31p*j),       s31p*(j+1),               s31p*(j+1),     (s31p*j)};
2447        Float_t yc1[4]={ 0.,                        0.,     ws13,    0.};        Float_t yc1[4]={ 0.,                        0.,     ws13,    0.};
2448        Float_t xc[4];            Float_t xc[4];    
# Line 2345  void FEVdetector::ShowTOF(){ Line 2458  void FEVdetector::ShowTOF(){
2458        } else {        } else {
2459          colo = 1;          colo = 1;
2460        };        };
2461        ColorMIP(ms31b[j],colo);        ColorMIP(ms31b[rj],colo);
2462        //        //
2463        if ( colo != 10 ) ocolo = colo;        if ( colo != 10 ) ocolo = colo;
2464        if ( mt31[1][j] == 4095. ) colo = noadc;        if ( mt31[1][rj] == 4095. ) colo = noadc;
2465        //        //
2466        ftof31xb[j]->SetFillColor(colo);        ftof31xb[j]->SetFillColor(colo);
2467        ftof31xb[j]->SetLineWidth(1);        ftof31xb[j]->SetLineWidth(1);
# Line 2380  void FEVdetector::ShowTOF(){ Line 2493  void FEVdetector::ShowTOF(){
2493      Float_t s32p = 0.050;      Float_t s32p = 0.050;
2494      ocolo = 10;      ocolo = 10;
2495      TPolyLine *ftof32ya[3];      TPolyLine *ftof32ya[3];
2496        rj=3;
2497      for ( Int_t j=0; j<3; j++){      for ( Int_t j=0; j<3; j++){
2498          rj--;
2499        Float_t xc1[4]={ (s32p*j),       (s32p*j),               s32p*(j+1),     (s32p*j)};        Float_t xc1[4]={ (s32p*j),       (s32p*j),               s32p*(j+1),     (s32p*j)};
2500        Float_t yc1[4]={     -ws13,     0.,    0., -ws13};        Float_t yc1[4]={     -ws13,     0.,    0., -ws13};
2501        Float_t xc[4];            Float_t xc[4];    
# Line 2396  void FEVdetector::ShowTOF(){ Line 2511  void FEVdetector::ShowTOF(){
2511        } else {        } else {
2512          colo = 1;          colo = 1;
2513        };        };
2514        ColorMIP(ms32a[j],colo);        ColorMIP(ms32a[rj],colo);
2515        //        //
2516        if ( colo != 10 ) ocolo = colo;        if ( colo != 10 ) ocolo = colo;
2517        if ( mt32[0][j] == 4095. ) colo = noadc;        if ( mt32[0][rj] == 4095. ) colo = noadc;
2518        //        //
2519        ftof32ya[j]->SetFillColor(colo);        ftof32ya[j]->SetFillColor(colo);
2520        ftof32ya[j]->SetLineWidth(1);        ftof32ya[j]->SetLineWidth(1);
# Line 2408  void FEVdetector::ShowTOF(){ Line 2523  void FEVdetector::ShowTOF(){
2523      };      };
2524      s32p = 0.050;      s32p = 0.050;
2525      TPolyLine *ftof32yb[3];      TPolyLine *ftof32yb[3];
2526        rj=3;
2527      for ( Int_t j=0; j<3; j++){      for ( Int_t j=0; j<3; j++){
2528          rj--;
2529        Float_t xc1[4]={ (s32p*j),       s32p*(j+1),               s32p*(j+1),     (s32p*j)};        Float_t xc1[4]={ (s32p*j),       s32p*(j+1),               s32p*(j+1),     (s32p*j)};
2530        Float_t yc1[4]={ -ws13,   -ws13,    0., -ws13};        Float_t yc1[4]={ -ws13,   -ws13,    0., -ws13};
2531        Float_t xc[4];            Float_t xc[4];    
# Line 2424  void FEVdetector::ShowTOF(){ Line 2541  void FEVdetector::ShowTOF(){
2541        } else {        } else {
2542          colo = 1;          colo = 1;
2543        };        };
2544        ColorMIP(ms32b[j],colo);        ColorMIP(ms32b[rj],colo);
2545        //        //
2546        if ( colo != 10 ) ocolo = colo;        if ( colo != 10 ) ocolo = colo;
2547        if ( mt32[1][j] == 4095. ) colo = noadc;        if ( mt32[1][rj] == 4095. ) colo = noadc;
2548        //        //
2549        ftof32yb[j]->SetFillColor(colo);        ftof32yb[j]->SetFillColor(colo);
2550        ftof32yb[j]->SetLineWidth(1);        ftof32yb[j]->SetLineWidth(1);
# Line 2658  void FEVdetector::ShowTOF(){ Line 2775  void FEVdetector::ShowTOF(){
2775    //    //
2776    //    //
2777    Bool_t repeat = true;    Bool_t repeat = true;
2778    Int_t numtr = 1;    //  Int_t numtr = 1;
2779      Int_t numtr = 0;
2780    Int_t repuntil = 0;    Int_t repuntil = 0;
2781      Int_t repuntiltr = 0;
2782    //      //  
2783    //    //
2784    var.tofraw = 0;    var.tofraw = 0;
2785    //    //
2786    if ( level.file == 2 ) repuntil = L2->GetToFLevel2()->ntrk();        if ( level.file == 2 ) repuntil = L2->GetToFLevel2()->ntrk();    
2787    //  printf("repuntil = %i \n",repuntil);    //  printf("repuntil = %i \n",repuntil);
2788    //repuntil = L2->GetNTracks();        if ( level.file == 2 ) repuntiltr = L2->GetTrkLevel2()->GetNTracks();    
2789      //  repuntiltr = L2->GetNTracks();    
2790    //    //
2791    while ( repeat ){    while ( repeat ){
2792      //    printf("B repuntil = %i \n",repuntil);      //    printf("B repuntil = %i \n",repuntil);
# Line 2675  void FEVdetector::ShowTOF(){ Line 2795  void FEVdetector::ShowTOF(){
2795        //        //
2796        //        //
2797        ToFTrkVar *ptt = 0;        ToFTrkVar *ptt = 0;
2798          PamTrack *ptrack = 0;
2799          Float_t adc[4][12];
2800          Float_t tdc[4][12];
2801          memset(adc,0,4*12*sizeof(Float_t));
2802          memset(tdc,0,4*12*sizeof(Float_t));
2803        //              //      
2804        //        //
2805          //      if ( repuntil == 0 || var.tofraw ){
2806        if ( repuntil == 1 || var.tofraw ){        if ( repuntil == 1 || var.tofraw ){
2807          numtr = 0;          numtr = 0;
2808          ptt = L2->GetToFLevel2()->GetToFTrkVar(0);          ptt = L2->GetToFLevel2()->GetToFTrkVar(0);
# Line 2684  void FEVdetector::ShowTOF(){ Line 2810  void FEVdetector::ShowTOF(){
2810        } else {        } else {
2811          //          //
2812          //          //
2813          if ( numtr >= repuntil-1 ) repeat = false;          if ( numtr >= (repuntiltr-1) ) repeat = false;
2814          //          //
2815          ptt = L2->GetToFLevel2()->GetToFTrkVar(numtr);          //printf(" numtr is %i \n",numtr);
2816            // ptt = L2->GetToFLevel2()->GetToFTrkVar(numtr);      
2817            ptrack = L2->GetTrack(numtr);
2818            ptt = ptrack->GetToFTrack();
2819        };        };
2820        //        //
2821        xp11[0] = 0.;        xp11[0] = 0.;
# Line 2700  void FEVdetector::ShowTOF(){ Line 2829  void FEVdetector::ShowTOF(){
2829        //        //
2830        ii = 2;        ii = 2;
2831        //        //
2832        Float_t adc[4][12];        Int_t myseq = ptt->trkseqno + 1;
       Float_t tdc[4][12];  
       L2->GetToFLevel2()->GetMatrix(numtr,adc,tdc);  
   
2833        //        //
2834        for ( Int_t i = 0; i<8; i++ ) {          L2->GetToFLevel2()->GetMatrix(myseq,adc,tdc);
2835          if ( adc[ch11a[i]][hb11a[i]] < 1000. ){        //
2836            ms11a[i] = adc[ch11a[i]][hb11a[i]];        //      printf(" qua \n");
2837          };              //
2838          if ( adc[ch11b[i]][hb11b[i]] < 1000. ){        //       for ( Int_t i = 0; i<8; i++ ) {  
2839            ms11b[i] = adc[ch11b[i]][hb11b[i]];        //        if ( adc[ch11a[i]][hb11a[i]] < 1000. ){
2840          };        //          ms11a[i] = adc[ch11a[i]][hb11a[i]];
2841          //      xp11[i] = 0.;        //        };      
2842        };        //        if ( adc[ch11b[i]][hb11b[i]] < 1000. ){
2843          //          ms11b[i] = adc[ch11b[i]][hb11b[i]];
2844          //        };
2845          //        xp11[i] = 0.;
2846          //    };
2847    
2848        Int_t nmtof = 0;        Int_t nmtof = 0;
2849        Float_t mtof = 0.;        Float_t mtof = 0.;
# Line 2830  void FEVdetector::ShowTOF(){ Line 2960  void FEVdetector::ShowTOF(){
2960        if ( level.file == -1 ){        if ( level.file == -1 ){
2961          ColorMIP(ms11a[j]+ms11b[j],colo);                ColorMIP(ms11a[j]+ms11b[j],colo);      
2962        } else {        } else {
2963          ColorTOFMIP(ms11a[j]+ms11b[j],colo);              ColorTOFMIP((ms11a[j]+ms11b[j])/2.,colo);      
2964        };        };
2965        //        //
2966        if ( colo != 10 ) ocolo = colo;        if ( colo != 10 ) ocolo = colo;
# Line 2860  void FEVdetector::ShowTOF(){ Line 2990  void FEVdetector::ShowTOF(){
2990      ftof11y->Draw();      ftof11y->Draw();
2991      TPolyLine *sftof11[8];      TPolyLine *sftof11[8];
2992      tt = 1;      tt = 1;
2993      if ( level.file == -1 ) tt = 8;      rj=1;
2994        if ( level.file == -1 ){
2995          tt = 8;
2996          rj = 8;
2997        };
2998      for ( Int_t j=0; j<tt; j++){      for ( Int_t j=0; j<tt; j++){
2999        if ( (mt11[0][j]<4095. || mt11[1][j]<4095.)){        rj--;
3000          if ( (mt11[0][rj]<4095. || mt11[1][rj]<4095.)){
3001          if ( ocolo == 10 ) ocolo = noadc;          if ( ocolo == 10 ) ocolo = noadc;
3002          Float_t lowp = (xp11[j]-E11[j])/100.;          Float_t lowp = -(xp11[rj]+E11[rj])/100.;
3003          Float_t higp = (xp11[j]+E11[j])/100.;          Float_t higp = -(xp11[rj]-E11[rj])/100.;
3004          if ( lowp < -0.164 ) lowp = -0.164;          if ( lowp < -0.164 ) lowp = -0.164;
3005          if ( higp > 0.164 ) higp = 0.164;          if ( higp > 0.164 ) higp = 0.164;
3006          if ( lowp < higp && ( level.file == -1 || (level.file == 2 && xp11[j] != 0.))){          if ( lowp < higp && ( level.file == -1 || (level.file == 2 && xp11[rj] != 0.))){
3007            Float_t nxc1[5]={ lowp, higp, higp, lowp, lowp};            Float_t nxc1[5]={ lowp, higp, higp, lowp, lowp};
3008            Float_t nyc1[5]={ 0.0015,         0.0015,                ws13-0.0015,    ws13-0.0015,    0.0015};            Float_t nyc1[5]={ 0.0015,         0.0015,                ws13-0.0015,    ws13-0.0015,    0.0015};
3009            Float_t nxc[5];                Float_t nxc[5];    
# Line 2893  void FEVdetector::ShowTOF(){ Line 3028  void FEVdetector::ShowTOF(){
3028      Float_t s12p = 0.055;      Float_t s12p = 0.055;
3029      ocolo = 10;      ocolo = 10;
3030      TPolyLine *ftof12y[6];      TPolyLine *ftof12y[6];
3031        rj = 6;
3032      for ( Int_t j=0; j<6; j++){      for ( Int_t j=0; j<6; j++){
3033          rj--;
3034        Float_t nxc1[5]={ (s12p*j),       (s12p*j),               s12p*(j+1), s12p*(j+1),    (s12p*j)};        Float_t nxc1[5]={ (s12p*j),       (s12p*j),               s12p*(j+1), s12p*(j+1),    (s12p*j)};
3035        Float_t nyc1[5]={      -ws13,     0.,  0., -ws13, -ws13};        Float_t nyc1[5]={      -ws13,     0.,  0., -ws13, -ws13};
3036        Float_t nxc[5];            Float_t nxc[5];    
# Line 2910  void FEVdetector::ShowTOF(){ Line 3047  void FEVdetector::ShowTOF(){
3047          colo = 1;          colo = 1;
3048        };        };
3049        if ( level.file == -1 ){        if ( level.file == -1 ){
3050          ColorMIP(ms12a[j]+ms12b[j],colo);          ColorMIP(ms12a[rj]+ms12b[rj],colo);
3051        } else {        } else {
3052          ColorTOFMIP(ms12a[j]+ms12b[j],colo);          ColorTOFMIP((ms12a[rj]+ms12b[rj])/2.,colo);
3053        };        };
3054        //        //
3055        if ( colo != 10 ) ocolo = colo;        if ( colo != 10 ) ocolo = colo;
# Line 2979  void FEVdetector::ShowTOF(){ Line 3116  void FEVdetector::ShowTOF(){
3116      Float_t s21p = 0.075;      Float_t s21p = 0.075;
3117      ocolo = 10;      ocolo = 10;
3118      TPolyLine *ftof21y[2];      TPolyLine *ftof21y[2];
3119        rj=2;
3120      for ( Int_t j=0; j<2; j++){      for ( Int_t j=0; j<2; j++){
3121          rj--;
3122        Float_t nxc1[5]={ s21p*(j-1),       s21p*(j-1),               s21p*j,s21p*j,     s21p*(j-1)};        Float_t nxc1[5]={ s21p*(j-1),       s21p*(j-1),               s21p*j,s21p*j,     s21p*(j-1)};
3123        Float_t nyc1[5]={ 0.,                ws2,     ws2,  0.,  0.};        Float_t nyc1[5]={ 0.,                ws2,     ws2,  0.,  0.};
3124        Float_t nxc[5];            Float_t nxc[5];    
# Line 2996  void FEVdetector::ShowTOF(){ Line 3135  void FEVdetector::ShowTOF(){
3135          colo = 1;          colo = 1;
3136        };        };
3137        if ( level.file == -1 ){        if ( level.file == -1 ){
3138          ColorMIP(ms21a[j]+ms21b[j],colo);          ColorMIP(ms21a[rj]+ms21b[rj],colo);
3139        } else {        } else {
3140          ColorTOFMIP(ms21a[j]+ms21b[j],colo);          ColorTOFMIP((ms21a[rj]+ms21b[rj])/2.,colo);
3141        };        };
3142        //        //
3143        if ( colo != 10 ) ocolo = colo;        if ( colo != 10 ) ocolo = colo;
# Line 3084  void FEVdetector::ShowTOF(){ Line 3223  void FEVdetector::ShowTOF(){
3223        if ( level.file == -1 ){        if ( level.file == -1 ){
3224          ColorMIP(ms22a[j]+ms22b[j],colo);          ColorMIP(ms22a[j]+ms22b[j],colo);
3225        } else {        } else {
3226          ColorTOFMIP(ms22a[j]+ms22b[j],colo);          ColorTOFMIP((ms22a[j]+ms22b[j])/2.,colo);
3227        };        };
3228        //        //
3229        if ( colo != 10 ) ocolo = colo;        if ( colo != 10 ) ocolo = colo;
# Line 3115  void FEVdetector::ShowTOF(){ Line 3254  void FEVdetector::ShowTOF(){
3254        ftof22y->Draw();        ftof22y->Draw();
3255        TPolyLine *sftof22[2];        TPolyLine *sftof22[2];
3256        tt = 1;        tt = 1;
3257        if ( level.file == -1 ) tt = 2;        rj = 1;
3258          if ( level.file == -1 ){
3259            tt = 2;
3260            rj = 2;
3261          };
3262        for (Int_t j=0; j<tt; j++){        for (Int_t j=0; j<tt; j++){
3263            rj--;
3264          //    for ( Int_t j=0; j<2; j++){          //    for ( Int_t j=0; j<2; j++){
3265          if ( (mt22[0][j]<4095. || mt22[1][j]<4095.) ){          if ( (mt22[0][rj]<4095. || mt22[1][rj]<4095.) ){
3266            if ( ocolo == 10 ) ocolo = noadc;            if ( ocolo == 10 ) ocolo = noadc;
3267            Float_t lowp = (xp22[j]-E22[j])/100.;            Float_t lowp = -(xp22[rj]+E22[rj])/100.;
3268            Float_t higp = (xp22[j]+E22[j])/100.;            Float_t higp = -(xp22[rj]-E22[rj])/100.;
3269            if ( lowp < -0.074 ) lowp = -0.074;            if ( lowp < -0.074 ) lowp = -0.074;
3270            if ( higp > 0.074 ) higp = 0.074;            if ( higp > 0.074 ) higp = 0.074;
3271            if ( lowp < higp && ( level.file == -1 || (level.file == 2 && xp22[j] != 0.))){            if ( lowp < higp && ( level.file == -1 || (level.file == 2 && xp22[rj] != 0.))){
3272              Float_t nxc1[5]={ lowp, higp, higp, lowp, lowp};              Float_t nxc1[5]={ lowp, higp, higp, lowp, lowp};
3273              Float_t nyc1[5]={ -0.0015,         -0.0015,                -ws2+0.0015,    -ws2+0.0015,    -0.0015};              Float_t nyc1[5]={ -0.0015,         -0.0015,                -ws2+0.0015,    -ws2+0.0015,    -0.0015};
3274              Float_t nxc[5];                  Float_t nxc[5];    
# Line 3144  void FEVdetector::ShowTOF(){ Line 3288  void FEVdetector::ShowTOF(){
3288        };        };
3289      };      };
3290      //      //
3291        //daquiinbasso
3292      //      //
3293      // S31  X-view      // S31  X-view
3294      //      //
# Line 3170  void FEVdetector::ShowTOF(){ Line 3314  void FEVdetector::ShowTOF(){
3314        if ( level.file == -1 ){        if ( level.file == -1 ){
3315          ColorMIP(ms31a[j]+ms31b[j],colo);          ColorMIP(ms31a[j]+ms31b[j],colo);
3316        } else {        } else {
3317          ColorTOFMIP(ms31a[j]+ms31b[j],colo);          ColorTOFMIP((ms31a[j]+ms31b[j])/2.,colo);
3318        };        };
3319        //        //
3320        if ( colo != 10 ) ocolo = colo;        if ( colo != 10 ) ocolo = colo;
# Line 3201  void FEVdetector::ShowTOF(){ Line 3345  void FEVdetector::ShowTOF(){
3345        ftof31y->Draw();        ftof31y->Draw();
3346        TPolyLine *sftof31[3];        TPolyLine *sftof31[3];
3347        tt = 1;        tt = 1;
3348        if ( level.file == -1 ) tt = 3;        rj = 1;
3349          if ( level.file == -1 ){
3350            tt = 3;
3351            rj = 3;
3352          };
3353        for (Int_t j=0; j<tt; j++){        for (Int_t j=0; j<tt; j++){
3354            rj--;
3355          //    for ( Int_t j=0; j<3; j++){          //    for ( Int_t j=0; j<3; j++){
3356          if ( (mt31[0][j]<4095. || mt31[1][j]<4095.)){          if ( (mt31[0][rj]<4095. || mt31[1][rj]<4095.)){
3357            if ( ocolo == 10 ) ocolo = noadc;            if ( ocolo == 10 ) ocolo = noadc;
3358            Float_t lowp = (xp31[j]-E31[j])/100.;            Float_t lowp = -(xp31[rj]+E31[rj])/100.;
3359            Float_t higp = (xp31[j]+E31[j])/100.;            Float_t higp = -(xp31[rj]-E31[rj])/100.;
3360            if ( lowp < -0.074 ) lowp = -0.074;            if ( lowp < -0.074 ) lowp = -0.074;
3361            if ( higp > 0.074 ) higp = 0.074;            if ( higp > 0.074 ) higp = 0.074;
3362            if ( lowp < higp && ( level.file == -1 || (level.file == 2 && xp31[j] != 0.))){            if ( lowp < higp && ( level.file == -1 || (level.file == 2 && xp31[rj] != 0.))){
3363              Float_t nxc1[5]={ lowp, higp, higp, lowp, lowp};              Float_t nxc1[5]={ lowp, higp, higp, lowp, lowp};
3364              Float_t nyc1[5]={ 0.0015,         0.0015,                ws13-0.0015,    ws13-0.0015,    0.0015};              Float_t nyc1[5]={ 0.0015,         0.0015,                ws13-0.0015,    ws13-0.0015,    0.0015};
3365              Float_t nxc[5];                  Float_t nxc[5];    
# Line 3237  void FEVdetector::ShowTOF(){ Line 3386  void FEVdetector::ShowTOF(){
3386      Float_t s32p = 0.050;      Float_t s32p = 0.050;
3387      ocolo = 10;      ocolo = 10;
3388      TPolyLine *ftof32y[3];      TPolyLine *ftof32y[3];
3389        rj = 3;
3390      for ( Int_t j=0; j<3; j++){      for ( Int_t j=0; j<3; j++){
3391          rj--;
3392        Float_t nxc1[5]={ (s32p*j),       (s32p*j),               s32p*(j+1),s32p*(j+1),     (s32p*j)};        Float_t nxc1[5]={ (s32p*j),       (s32p*j),               s32p*(j+1),s32p*(j+1),     (s32p*j)};
3393        Float_t nyc1[5]={     -ws13,     0.,    0., -ws13, -ws13};        Float_t nyc1[5]={     -ws13,     0.,    0., -ws13, -ws13};
3394        Float_t nxc[5];            Float_t nxc[5];    
# Line 3254  void FEVdetector::ShowTOF(){ Line 3405  void FEVdetector::ShowTOF(){
3405          colo = 1;          colo = 1;
3406        };        };
3407        if ( level.file == -1 ){        if ( level.file == -1 ){
3408          ColorMIP(ms32a[j]+ms32b[j],colo);          ColorMIP(ms32a[rj]+ms32b[rj],colo);
3409        } else {        } else {
3410          ColorTOFMIP(ms32a[j]+ms32b[j],colo);          ColorTOFMIP((ms32a[rj]+ms32b[rj])/2.,colo);
3411        };        };
3412        //        //
3413        if ( colo != 10 ) ocolo = colo;        if ( colo != 10 ) ocolo = colo;
# Line 4970  void FEVdetector::ShowTRK(Bool_t upd){ Line 5121  void FEVdetector::ShowTRK(Bool_t upd){
5121            for (Int_t m = 0; m<3; m++){            for (Int_t m = 0; m<3; m++){
5122              if ( trk->signcluster[l][m] != 0. ){              if ( trk->signcluster[l][m] != 0. ){
5123                if ( planeno == 10 ) {                if ( planeno == 10 ) {
                 x = 1024 - trk->addrcluster[l][m];  
               } else {  
5124                  x = trk->addrcluster[l][m];                  x = trk->addrcluster[l][m];
5125                  } else {
5126                    x = 1024 - trk->addrcluster[l][m];
5127                };                };
5128                linea = new TLine(14.+x,0.01,14.+x,0.3);                linea = new TLine(14.+x,0.01,14.+x,0.3);
5129                linea->SetLineWidth(2);                linea->SetLineWidth(2);
# Line 5042  void FEVdetector::ShowTRK(Bool_t upd){ Line 5193  void FEVdetector::ShowTRK(Bool_t upd){
5193          trkpad[planepad]->cd();          trkpad[planepad]->cd();
5194          trkpad[planepad]->Range(-7.05,0.,7.05,8.);          trkpad[planepad]->Range(-7.05,0.,7.05,8.);
5195          for (Int_t img=0; img<2; img++){          for (Int_t img=0; img<2; img++){
5196            x = singlet->coord[img];            x = -singlet->coord[img];
5197            Float_t xsig = singlet->sgnl;            Float_t xsig = singlet->sgnl;
5198            if ( xsig > 8. ) xsig = 8.;            if ( xsig > 8. ) xsig = 8.;
5199            //            //
# Line 5098  void FEVdetector::ShowTRK(Bool_t upd){ Line 5249  void FEVdetector::ShowTRK(Bool_t upd){
5249              trkpad[planepad]->Range(-8.1,0.,8.1,8.);              trkpad[planepad]->Range(-8.1,0.,8.1,8.);
5250              //              //
5251              x = track->xm[plane];              x = track->xm[plane];
5252              Float_t xsig = track->dedx_x[plane];              Float_t xsig = fabs(track->dedx_x[plane]);
5253              if ( track->xgood[plane] ){              if ( track->XGood(plane) ){
5254                //if ( x > -100 ){                //if ( x > -100 ){
5255                if ( xsig > 8. ) xsig = 8.;                if ( xsig > 8. ) xsig = 8.;
5256                if ( var.bw ){                if ( var.bw ){
# Line 5107  void FEVdetector::ShowTRK(Bool_t upd){ Line 5258  void FEVdetector::ShowTRK(Bool_t upd){
5258                } else {                } else {
5259                  sigcol2 = 1;                  sigcol2 = 1;
5260                };                };
5261                ColorTRKMIP(track->dedx_x[plane],sigcol2,0);                ColorTRKMIP(fabs(track->dedx_x[plane]),sigcol2,0);
5262                linea = new TLine(x,0.01,x,xsig);                linea = new TLine(x,0.01,x,xsig);
5263                linea->SetLineWidth(2);                linea->SetLineWidth(2);
5264                linea->SetLineColor(sigcol2);                linea->SetLineColor(sigcol2);
# Line 5127  void FEVdetector::ShowTRK(Bool_t upd){ Line 5278  void FEVdetector::ShowTRK(Bool_t upd){
5278              planepad = plane * 2;              planepad = plane * 2;
5279              trkpad[planepad]->cd();              trkpad[planepad]->cd();
5280              trkpad[planepad]->Range(-7.05,0.,7.05,8.);              trkpad[planepad]->Range(-7.05,0.,7.05,8.);
5281              x = track->ym[plane];              x = -track->ym[plane];
5282              xsig = track->dedx_y[plane];              xsig = fabs(track->dedx_y[plane]);
5283              if ( track->ygood[plane] ){              if ( track->YGood(plane) ){
5284                //            if ( x > -100 ){                //            if ( x > -100 ){
5285                if ( xsig > 8. ) xsig = 8.;                if ( xsig > 8. ) xsig = 8.;
5286                if ( var.bw ){                if ( var.bw ){
# Line 5137  void FEVdetector::ShowTRK(Bool_t upd){ Line 5288  void FEVdetector::ShowTRK(Bool_t upd){
5288                } else {                } else {
5289                  sigcol2 = 1;                  sigcol2 = 1;
5290                };                };
5291                ColorTRKMIP(track->dedx_y[plane],sigcol2,0);                ColorTRKMIP(fabs(track->dedx_y[plane]),sigcol2,0);
5292                linea = new TLine(x,0.01,x,xsig);                linea = new TLine(x,0.01,x,xsig);
5293                linea->SetLineWidth(2);                linea->SetLineWidth(2);
5294                linea->SetLineColor(sigcol2);                linea->SetLineColor(sigcol2);
# Line 5180  void FEVdetector::ShowTRK(Bool_t upd){ Line 5331  void FEVdetector::ShowTRK(Bool_t upd){
5331        // first of all plot crosses relatives to tracks        // first of all plot crosses relatives to tracks
5332        //        //
5333        if ( L2->GetTrkLevel2()->GetNTracks() > 0 ){        if ( L2->GetTrkLevel2()->GetNTracks() > 0 ){
5334    //      for (Int_t nt = 0; nt < L2->GetTrkLevel2()->GetNTracks(); nt++){
5335    //        TrkTrack *track = L2->GetTrkLevel2()->GetTrack(nt);  
5336          for (Int_t nt = 0; nt < L2->GetTrkLevel2()->GetNTracks(); nt++){          for (Int_t nt = 0; nt < L2->GetTrkLevel2()->GetNTracks(); nt++){
5337            TrkTrack *track = L2->GetTrkLevel2()->GetTrack(nt);              PamTrack *ptrack= L2->GetTrack(nt);
5338              TrkTrack *track = ptrack->GetTrkTrack();  
5339              //
5340            for (Int_t plane = 0; plane<6; plane++){            for (Int_t plane = 0; plane<6; plane++){
5341              //              //
5342              x = track->xm[plane];              x = track->xm[plane];
5343              Float_t y = track->ym[plane];              Float_t y = -track->ym[plane];
5344              Float_t xsig = track->dedx_x[plane];              Float_t xsig = fabs(track->dedx_x[plane]);
5345              Float_t ysig = track->dedx_y[plane];              Float_t ysig = fabs(track->dedx_y[plane]);
5346              //    if ( x > -100 && y > -100. ){              //    if ( x > -100 && y > -100. ){
5347              if ( track->xgood[plane] && track->ygood[plane] ){              if ( track->XGood(plane) && track->YGood(plane) ){
5348                if ( var.bw ){                if ( var.bw ){
5349                  sigcol1 = -1;                  sigcol1 = -1;
5350                  sigcol2 = -1;                  sigcol2 = -1;
# Line 5307  void FEVdetector::ShowTRK(Bool_t upd){ Line 5462  void FEVdetector::ShowTRK(Bool_t upd){
5462              for (Int_t sing = 0; sing < min(totsx,totsy); sing++){              for (Int_t sing = 0; sing < min(totsx,totsy); sing++){
5463                //                              //              
5464                x = arrax->At(orderx->At(sing));                x = arrax->At(orderx->At(sing));
5465                Float_t y1 = array1->At(ordery->At(sing));                Float_t y1 = -array1->At(ordery->At(sing));
5466                Float_t y2 = array2->At(ordery->At(sing));                Float_t y2 = -array2->At(ordery->At(sing));
5467                Float_t xsig = sigarrax->At(orderx->At(sing));                Float_t xsig = sigarrax->At(orderx->At(sing));
5468                Float_t ysig = sigarray->At(ordery->At(sing));                Float_t ysig = sigarray->At(ordery->At(sing));
5469                if ( x > -100 && y1 > -100. ){                if ( x > -100 && y1 > -100. ){
# Line 5401  void FEVdetector::ShowTRK(Bool_t upd){ Line 5556  void FEVdetector::ShowTRK(Bool_t upd){
5556                  for (Int_t m = 0; m<3; m++){                                          for (Int_t m = 0; m<3; m++){                        
5557                    if ( trk->signcluster[l][m] != 0. ){                    if ( trk->signcluster[l][m] != 0. ){
5558                      if ( planeno == 10 ) {                      if ( planeno == 10 ) {
                       x = 1024 - trk->addrcluster[l][m];  
                     } else {  
5559                        x = trk->addrcluster[l][m];                        x = trk->addrcluster[l][m];
5560                        } else {
5561                          x = 1024 - trk->addrcluster[l][m];
5562                      };                      };
5563                      x += 1024.;                                      x += 1024.;                
5564                      if ( trk->signcluster[l][m]> ysig  ){                      if ( trk->signcluster[l][m]> ysig  ){
5565                        ysig = trk->signcluster[l][m];                        ysig = trk->signcluster[l][m];
5566                        yh1[ncro] = x-1024.;                        yh1[ncro] = x - 1024.;
5567                        yh2[ncro] = x;                        yh2[ncro] = x;
5568                      };                      };
5569                    };                    };
# Line 5436  void FEVdetector::ShowTRK(Bool_t upd){ Line 5591  void FEVdetector::ShowTRK(Bool_t upd){
5591                    for (Int_t m = 0; m<3; m++){                    for (Int_t m = 0; m<3; m++){
5592                      if ( trk->signcluster[e][m] != 0. ){                      if ( trk->signcluster[e][m] != 0. ){
5593                        if ( planeno == 10 ) {                        if ( planeno == 10 ) {
                         x = 1024 - trk->addrcluster[e][m];  
                       } else {  
5594                          x = trk->addrcluster[e][m];                          x = trk->addrcluster[e][m];
5595                          } else {
5596                            x = 1024 - trk->addrcluster[e][m];
5597                        };                        };
5598                        x += 1024.;                                              x += 1024.;                      
5599                        if ( trk->signcluster[e][m]> ysig  ){                        if ( trk->signcluster[e][m]> ysig  ){
5600                          ysig = trk->signcluster[e][m];                          ysig = trk->signcluster[e][m];
5601                          yh1[ncro] = x-1024.;                          yh1[ncro] = x - 1024.;
5602                          yh2[ncro] = x;                          yh2[ncro] = x;
5603                        };                        };
5604                      };                      };
# Line 5495  void FEVdetector::ShowTRK(Bool_t upd){ Line 5650  void FEVdetector::ShowTRK(Bool_t upd){
5650    
5651  void FEVdetector::ShowTrack(){  void FEVdetector::ShowTrack(){
5652    //    //
5653      if ( level.file != 2 ) return;
5654    //    //
5655    //    //
5656    if ( var.CALO && false ){    //
5657      if ( var.CALO && var.CALOT ){
5658      if ( L2->GetCaloLevel2()->npcfit[0] > 0 && L2->GetCaloLevel2()->npcfit[1] > 0 ){      if ( L2->GetCaloLevel2()->npcfit[0] > 0 && L2->GetCaloLevel2()->npcfit[1] > 0 ){
5659        Float_t calx[22];        Float_t calx[22];
5660        Float_t caly[22];        Float_t caly[22];
# Line 5514  void FEVdetector::ShowTrack(){ Line 5671  void FEVdetector::ShowTrack(){
5671        };        };
5672        for (Int_t plane = 0; plane < 22; plane++){              for (Int_t plane = 0; plane < 22; plane++){      
5673          calx[plane] = (L2->GetCaloLevel2()->cbar[plane][0]/100.)*var.sfx + var.xxvc;;          calx[plane] = (L2->GetCaloLevel2()->cbar[plane][0]/100.)*var.sfx + var.xxvc;;
5674          caly[plane] = (L2->GetCaloLevel2()->cbar[plane][1]/100.)*var.sfx + var.xyvc;          caly[plane] = (-L2->GetCaloLevel2()->cbar[plane][1]/100.)*var.sfx + var.xyvc;
5675          //      calzx[plane] = zpiano[plane] -5.81*var.sfy/1000. + var.yxvc;          //      calzx[plane] = zpiano[plane] -5.81*var.sfy/1000. + var.yxvc;
5676          calzx[plane] = zpiano[plane] + var.yxvc;          calzx[plane] = zpiano[plane] + var.yxvc;
5677          calzy[plane] = zpiano[plane] + var.yyvc;          calzy[plane] = zpiano[plane] + var.yyvc;
# Line 5563  void FEVdetector::ShowTrack(){ Line 5720  void FEVdetector::ShowTrack(){
5720        //        //
5721        for (Int_t plane = 0; plane < 22; plane++){              for (Int_t plane = 0; plane < 22; plane++){      
5722          calx[plane] = (ctra->tbar[plane][0]/100.)*var.sfx + var.xxvc;;          calx[plane] = (ctra->tbar[plane][0]/100.)*var.sfx + var.xxvc;;
5723          caly[plane] = (ctra->tbar[plane][1]/100.)*var.sfx + var.xyvc;          caly[plane] = (-ctra->tbar[plane][1]/100.)*var.sfx + var.xyvc;
5724          //      calzx[plane] = zpiano[plane] -5.81*var.sfy/1000. + var.yxvc;          //      calzx[plane] = zpiano[plane] -5.81*var.sfy/1000. + var.yxvc;
5725          calzx[plane] = zpiano[plane] + var.yxvc;          calzx[plane] = zpiano[plane] + var.yxvc;
5726          calzy[plane] = zpiano[plane] + var.yyvc;          calzy[plane] = zpiano[plane] + var.yyvc;
# Line 5592  void FEVdetector::ShowTrack(){ Line 5749  void FEVdetector::ShowTrack(){
5749      };      };
5750    };    };
5751    //    //
5752    if ( !var.TRK || level.file != 2 ) return;    if ( !var.TRK ) return;
5753    //    //
5754    if ( L2->GetTrkLevel2()->GetNTracks() > 0 ){    if ( L2->GetTrkLevel2()->GetNTracks() > 0 ){
5755      for (Int_t nt = 0; nt < L2->GetTrkLevel2()->GetNTracks(); nt++){      for (Int_t nt = 0; nt < L2->GetTrkLevel2()->GetNTracks(); nt++){
5756    
5757        //      TrkTrack *track = L2->GetTrkLevel2()->GetTrack(nt);        //      TrkTrack *track = L2->GetTrkLevel2()->GetTrack(nt);
5758          //      printf("qui \n");
5759        PamTrack *ptrack = L2->GetTrack(nt);        PamTrack *ptrack = L2->GetTrack(nt);
5760        TrkTrack *track = ptrack->GetTrkTrack();        TrkTrack *track = ptrack->GetTrkTrack();
5761          //      printf("qua \n");
5762        Int_t npoint = 100;        Int_t npoint = 100;
5763        Float_t zin[100];        Float_t zin[100];
5764        Double_t xout[100];        Double_t xout[100];
# Line 5648  void FEVdetector::ShowTrack(){ Line 5807  void FEVdetector::ShowTrack(){
5807        //        //
5808        Trajectory *tr = new Trajectory(npoint,zin);                                      Trajectory *tr = new Trajectory(npoint,zin);                              
5809        //        //
5810        ifail = track->DoTrack2(tr);        //      ifail = track->DoTrack2(tr);
5811          ifail = track->DoTrack(tr);
5812        //        //
5813        if ( !ifail ){        if ( !ifail ){
5814          for ( Int_t e = 0; e < npoint ; e++) {          for ( Int_t e = 0; e < npoint ; e++) {
5815            tx[e] = ((float)tr->x[e]/100.)*var.sfx + var.xxvc;            tx[e] = ((float)tr->x[e]/100.)*var.sfx + var.xxvc;
5816            ty[e] = ((float)tr->y[e]/100.)*var.sfx + var.xyvc;            ty[e] = (-(float)tr->y[e]/100.)*var.sfx + var.xyvc;
5817            if ( e < 50 ) {            if ( e < 50 ) {
5818              ptx1[e] = ((float)tr->y[e]/100.)*var.sfx + var.xcat;              ptx1[e] = (-(float)tr->y[e]/100.)*var.sfx + var.xcat;
5819              pty1[e] = ((float)tr->x[e]/100.)*var.sfy + var.ycat;              pty1[e] = ((float)tr->x[e]/100.)*var.sfy + var.ycat;
5820            } else {            } else {
5821              ptx2[e-50] = ((float)tr->y[e]/100.)*var.sfx + var.xcat;              ptx2[e-50] = (-(float)tr->y[e]/100.)*var.sfx + var.xcat;
5822              pty2[e-50] = ((float)tr->x[e]/100.)*var.sfy + var.ycat;              pty2[e-50] = ((float)tr->x[e]/100.)*var.sfy + var.ycat;
5823            };            };
5824            if ( e > 84 ) {            if ( e > 84 ) {
5825              tx1[e-85] = ((float)tr->x[e]/100.)*var.nds4 + var.xxvc;              tx1[e-85] = ((float)tr->x[e]/100.)*var.nds4 + var.xxvc;
5826              ty1[e-85] = ((float)tr->y[e]/100.)*var.nds4 + var.xyvc;                  ty1[e-85] = (-(float)tr->y[e]/100.)*var.nds4 + var.xyvc;    
5827              tzx1[e-85] = (0.112)*var.sfy+((float)zin[e]/100.)*var.sfy + var.yxvc;              tzx1[e-85] = (0.112)*var.sfy+((float)zin[e]/100.)*var.sfy + var.yxvc;
5828              tzy1[e-85] = (0.112)*var.sfy+((float)zin[e]/100.)*var.sfy + var.yyvc;              tzy1[e-85] = (0.112)*var.sfy+((float)zin[e]/100.)*var.sfy + var.yyvc;
5829            };            };
# Line 5807  void FEVdetector::ShowCalo(Bool_t upd){ Line 5967  void FEVdetector::ShowCalo(Bool_t upd){
5967          Int_t se = 5;          Int_t se = 5;
5968          if ( !l && m%2 == 0 ) se = 3;          if ( !l && m%2 == 0 ) se = 3;
5969          if ( !l && m%2 != 0 ) se = 2;          if ( !l && m%2 != 0 ) se = 2;
5970          if (  l && m%2 == 0 ) se = 1;          if (  l && m%2 != 0 ) se = 1;
5971          if (  l && m%2 != 0 ) se = 0;          if (  l && m%2 == 0 ) se = 0;
5972          //          //
5973          // determine what kind of event we are going to analyze          // determine what kind of event we are going to analyze
5974          //          //
# Line 5903  void FEVdetector::ShowCalo(Bool_t upd){ Line 6063  void FEVdetector::ShowCalo(Bool_t upd){
6063                Xview->Draw("box same");                Xview->Draw("box same");
6064              };                                            };                              
6065              if ( l == 1 ) {                                      if ( l == 1 ) {                        
6066                Yview->Fill(n,21-m,1.);                Yview->Fill(95-n,21-m,1.);
6067                pd2->cd();                pd2->cd();
6068                Yview->Draw("box same");                Yview->Draw("box same");
6069              };              };
# Line 5923  void FEVdetector::ShowCalo(Bool_t upd){ Line 6083  void FEVdetector::ShowCalo(Bool_t upd){
6083      //      //
6084      // Define variables      // Define variables
6085      //      //
6086      Int_t etime = var.etime;      UInt_t etime = var.etime;
6087      Float_t estrip[2][22][96], ener, basel,sdexy[2][22][96],sdexyc[2][22][96];      Float_t estrip[2][22][96], ener, basel,sdexy[2][22][96],sdexyc[2][22][96];
6088      Int_t badstrip = 0;      Int_t badstrip = 0;
6089      qtot = 0.;      qtot = 0.;
# Line 5995  void FEVdetector::ShowCalo(Bool_t upd){ Line 6155  void FEVdetector::ShowCalo(Bool_t upd){
6155        if ( calib.ttime[s][b[s]+1] && calib.time[s][b[s]] ){        if ( calib.ttime[s][b[s]+1] && calib.time[s][b[s]] ){
6156          while ( etime > calib.time[s][b[s]] && calib.time[s][b[s]] != 0 ){                                        while ( etime > calib.time[s][b[s]] && calib.time[s][b[s]] != 0 ){                              
6157            printf(" CALORIMETER: \n" );            printf(" CALORIMETER: \n" );
6158            printf(" - Section %i, event at time %i while old calibration time limit at %i. Use new calibration at time %i -\n",s,etime,calib.time[s][b[s]],calib.ttime[s][b[s]+1]);            printf(" - Section %i, event at time %u while old calibration time limit at %u. Use new calibration at time %u -\n",s,(UInt_t)etime,(UInt_t)calib.time[s][b[s]],(UInt_t)calib.ttime[s][b[s]+1]);
6159            printf(" END CALORIMETER. \n\n" );            printf(" END CALORIMETER. \n\n" );
6160            b[s]++;            b[s]++;
6161            CaloPede(s);            CaloPede(s);
# Line 6015  void FEVdetector::ShowCalo(Bool_t upd){ Line 6175  void FEVdetector::ShowCalo(Bool_t upd){
6175          Int_t se = 5;          Int_t se = 5;
6176          if (l == 0 && m%2 == 0) se = 3;          if (l == 0 && m%2 == 0) se = 3;
6177          if (l == 0 && m%2 != 0) se = 2;          if (l == 0 && m%2 != 0) se = 2;
6178          if (l == 1 && m%2 == 0) se = 1;          if (l == 1 && m%2 != 0) se = 1;
6179          if (l == 1 && m%2 != 0) se = 0;                  if (l == 1 && m%2 == 0) se = 0;        
6180          //          //
6181          // determine what kind of event we are going to analyze          // determine what kind of event we are going to analyze
6182          //          //
# Line 6132  void FEVdetector::ShowCalo(Bool_t upd){ Line 6292  void FEVdetector::ShowCalo(Bool_t upd){
6292                    Xview->Draw("box same");                    Xview->Draw("box same");
6293                  };                                                    };                                  
6294                  if ( l == 1 ) {                                      if ( l == 1 ) {                    
6295                    Yview->Fill(n,21-m,1.);                    Yview->Fill(96-n,21-m,1.);
6296                    pd2->cd();                    pd2->cd();
6297                    Yview->Draw("box same");                    Yview->Draw("box same");
6298                  };                  };
# Line 6224  void FEVdetector::ShowCalo(Bool_t upd){ Line 6384  void FEVdetector::ShowCalo(Bool_t upd){
6384        Int_t l;        Int_t l;
6385        Int_t m;        Int_t m;
6386        Int_t n;        Int_t n;
6387        Float_t mip = L2->GetCaloLevel1()->DecodeEstrip(ii,l,m,n);        Bool_t satura = false;
6388          Float_t mip = L2->GetCaloLevel1()->DecodeEstrip(ii,l,m,n,satura);
6389        if ( var.bw ){        if ( var.bw ){
6390          colo = -1;          colo = -1;
6391        } else {        } else {
6392          colo = 1;          colo = 1;
6393        };        };      
6394        ColorMIP(mip,colo);        ColorMIP(mip,colo);
6395        if ( l == 0 ) {        if ( l == 0 ) {
6396          xvev.str("");          xvev.str("");
# Line 6238  void FEVdetector::ShowCalo(Bool_t upd){ Line 6399  void FEVdetector::ShowCalo(Bool_t upd){
6399          xvev << " " << l;          xvev << " " << l;
6400          gDirectory->Delete(xvev.str().c_str());          gDirectory->Delete(xvev.str().c_str());
6401          TH2F *Xview = new TH2F(xvev.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5);          TH2F *Xview = new TH2F(xvev.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5);
6402          Xview->SetFillColor(colo);          if ( satura ){
6403              Xview->SetFillColor(kBlack);
6404            } else {
6405              Xview->SetFillColor(colo);
6406            };
6407          Xview->Fill(n,21-m,1.);          Xview->Fill(n,21-m,1.);
6408          pd1->cd();                                            pd1->cd();                                  
6409          Xview->Draw("box same");          Xview->Draw("box same");
# Line 6250  void FEVdetector::ShowCalo(Bool_t upd){ Line 6415  void FEVdetector::ShowCalo(Bool_t upd){
6415          yvev << " " << l;          yvev << " " << l;
6416          gDirectory->Delete(yvev.str().c_str());          gDirectory->Delete(yvev.str().c_str());
6417          TH2F *Yview = new TH2F(yvev.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5);                            TH2F *Yview = new TH2F(yvev.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5);                  
6418          Yview->SetFillColor(colo);          if ( satura ){
6419          Yview->Fill(n,21-m,1.);            Yview->SetFillColor(kBlack);
6420            } else {
6421              Yview->SetFillColor(colo);
6422            };
6423            Yview->Fill(96-n,21-m,1.);
6424          pd2->cd();          pd2->cd();
6425          Yview->Draw("box same");          Yview->Draw("box same");
6426        };        };
# Line 6300  void FEVdetector::Calo1stcalib(){ Line 6469  void FEVdetector::Calo1stcalib(){
6469      for (Int_t d = 0; d<48; d++){      for (Int_t d = 0; d<48; d++){
6470        if ( calib.ttime[s][d] != 0 ) calibex++;        if ( calib.ttime[s][d] != 0 ) calibex++;
6471        if ( calib.time[s][0] != 0 ){        if ( calib.time[s][0] != 0 ){
6472          if ( d == 0 )  printf(" Section %i from time 0 to time %i use calibration at time %i \n",s,calib.time[s][d],calib.ttime[s][d]);          if ( d == 0 )  printf(" Section %i from time 0 to time %u use calibration at time %u \n",s,calib.time[s][d],calib.ttime[s][d]);
6473          if ( calib.time[s][d+1] != 0 ) {          if ( calib.time[s][d+1] != 0 ) {
6474            printf(" Section %i from time %i to time %i use calibration at time %i \n",s,calib.time[s][d],calib.time[s][d+1],calib.ttime[s][d+1]);            printf(" Section %i from time %u to time %u use calibration at time %u \n",s,calib.time[s][d],calib.time[s][d+1],calib.ttime[s][d+1]);
6475          } else {          } else {
6476            if ( !stop ){            if ( !stop ){
6477              printf(" Section %i from time %i use calibration at time %i \n",s,calib.time[s][d],calib.ttime[s][d+1]);                          printf(" Section %i from time %u use calibration at time %u \n",s,calib.time[s][d],calib.ttime[s][d+1]);            
6478              stop = 1;              stop = 1;
6479            };            };
6480          };          };
6481        } else {        } else {
6482          if ( calib.ttime[s][d] != 0 ) printf(" Section %i from time 0 use calibration at time %i \n",s,calib.ttime[s][d]);          if ( calib.ttime[s][d] != 0 ) printf(" Section %i from time 0 use calibration at time %u \n",s,calib.ttime[s][d]);
6483        };        };
6484      };      };
6485      printf("\n");            printf("\n");      
# Line 6375  int FEVdetector::OLDCaloFindCalibs(){ Line 6544  int FEVdetector::OLDCaloFindCalibs(){
6544        calib.ttime[s][inter] = 0;        calib.ttime[s][inter] = 0;
6545        if ( ce->cstwerr[s] != 0 && ce->cperror[s] == 0 ) {        if ( ce->cstwerr[s] != 0 && ce->cperror[s] == 0 ) {
6546          //calib.ttime[s][inter] = cph->GetOrbitalTime();          //calib.ttime[s][inter] = cph->GetOrbitalTime();
6547          calib.ttime[s][inter] = cph->OrbitalTime;          calib.ttime[s][inter] = (UInt_t)cph->OrbitalTime;
6548          inter++;          inter++;
6549        } else {        } else {
6550          if ( ce->cstwerr[s] != 0 && ce->cperror[s] != 0 ) {          if ( ce->cstwerr[s] != 0 && ce->cperror[s] != 0 ) {
# Line 6429  int FEVdetector::CaloPede(Int_t s){ Line 6598  int FEVdetector::CaloPede(Int_t s){
6598      tr->GetEntry(ci);      tr->GetEntry(ci);
6599      cph = ceh->GetPscuHeader();                      cph = ceh->GetPscuHeader();                
6600      //if ( atime == cph->GetOrbitalTime()){      //if ( atime == cph->GetOrbitalTime()){
6601      if ( atime == cph->OrbitalTime){      if ( atime == (UInt_t)cph->OrbitalTime){
6602        //      calib.iev = ce->iev;        //      calib.iev = ce->iev;
6603        if (ce->cstwerr[s] != 0 && ce->cperror[s] == 0 ) {        if (ce->cstwerr[s] != 0 && ce->cperror[s] == 0 ) {
6604          for ( Int_t d=0 ; d<11 ;d++  ){          for ( Int_t d=0 ; d<11 ;d++  ){

Legend:
Removed from v.1.12  
changed lines
  Added in v.1.31

  ViewVC Help
Powered by ViewVC 1.1.23