/[PAMELA software]/YodaProfiler/src/PamelaDBOperations.cpp
ViewVC logotype

Diff of /YodaProfiler/src/PamelaDBOperations.cpp

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

revision 1.5 by pam-fi, Fri Sep 8 14:42:48 2006 UTC revision 1.6 by mocchiut, Fri Sep 8 16:06:02 2006 UTC
# Line 320  Int_t PamelaDBOperations::SetUpperLimits Line 320  Int_t PamelaDBOperations::SetUpperLimits
320    // check if last runtrailer is within limits, if not extend limits (one should check for all packets but we need only runtrailer)    // check if last runtrailer is within limits, if not extend limits (one should check for all packets but we need only runtrailer)
321    //    //
322    PacketType *pctp=0;    PacketType *pctp=0;
   T->GetEntry(upperentry);  
   code = eh->GetCounter();  
   Int_t lasttrail = code->Get(pctp->RunTrailer);  
   Int_t lasthead = code->Get(pctp->RunHeader);  
323    TTree *rh=(TTree*)file->Get("RunHeader");    TTree *rh=(TTree*)file->Get("RunHeader");
324    if ( !rh || rh->IsZombie() ) throw -17;    if ( !rh || rh->IsZombie() ) throw -17;
325    TTree *rt=(TTree*)file->Get("RunTrailer");    TTree *rt=(TTree*)file->Get("RunTrailer");
# Line 346  Int_t PamelaDBOperations::SetUpperLimits Line 342  Int_t PamelaDBOperations::SetUpperLimits
342    UInt_t pkth = 0;    UInt_t pkth = 0;
343    ULong64_t obth = 0;    ULong64_t obth = 0;
344    //    //
345      T->GetEntry(upperentry);
346      code = eh->GetCounter();
347      Int_t lasttrail = code->Get(pctp->RunTrailer);
348      Int_t lasthead = code->Get(pctp->RunHeader);
349    if ( lasttrail < rtev ){    if ( lasttrail < rtev ){
350      rt->GetEntry(lasttrail);      rt->GetEntry(lasttrail);
351      pht = eht->GetPscuHeader();      pht = eht->GetPscuHeader();
# Line 356  Int_t PamelaDBOperations::SetUpperLimits Line 356  Int_t PamelaDBOperations::SetUpperLimits
356    if ( lasthead < rhev ){    if ( lasthead < rhev ){
357      rh->GetEntry(lasthead);      rh->GetEntry(lasthead);
358      phh = ehh->GetPscuHeader();      phh = ehh->GetPscuHeader();
359      pkth = PKT(pht->GetCounter());      pkth = PKT(phh->GetCounter());
360      obth = OBT(pht->GetOrbitalTime());      obth = OBT(phh->GetOrbitalTime());
361    };    };
362    //    //
363    if ( IsDebug() ) printf(" rhev before %i ph %i upperp %i oh %llu uppero %llu \n",rhev,pkth,upperpkt,obth,upperobt);    if ( IsDebug() ) printf(" rhev before %i ph %i upperp %i oh %llu uppero %llu \n",rhev,pkth,upperpkt,obth,upperobt);
# Line 401  Int_t PamelaDBOperations::SetUpperLimits Line 401  Int_t PamelaDBOperations::SetUpperLimits
401      pkth = PKT(phh->GetCounter());      pkth = PKT(phh->GetCounter());
402      obth = OBT(phh->GetOrbitalTime());      obth = OBT(phh->GetOrbitalTime());
403      //      //
404        if ( IsDebug() ) printf(" k %i rhev before %i ph %u upperp %u oh %u uppero %u \n",k,rhev,pkth,spkth,obth,sobth);
405        //
406      if ( pkth < spkth && obth < sobth ){      if ( pkth < spkth && obth < sobth ){
       if ( IsDebug() ) printf(" rhev before %i ph %i upperp %i oh %llu uppero %llu \n",rhev,pkth,upperpkt,obth,upperobt);  
407        if ( IsDebug() ) printf(" RH PROBLEMS determining the event repetition at the end of the file lasthead %i  \n",rhev);        if ( IsDebug() ) printf(" RH PROBLEMS determining the event repetition at the end of the file lasthead %i  \n",rhev);
408        //        //
409        rhev--;        rhev = k-1;
410        rh->GetEntry(rhev);        rh->GetEntry(rhev);
411        pkth = spkth;        pkth = spkth;
412        obth = sobth;        obth = sobth;
       if ( IsDebug() ) printf(" lasthead %i pt %i p1 %i ot %u o1 %u \n",rhev,pkth,spkth,obth,sobth);  
413        //        //
414        UInt_t evbefh = 0;        UInt_t evbefh = 0;
415        code = ehh->GetCounter();        code = ehh->GetCounter();
# Line 439  Int_t PamelaDBOperations::SetUpperLimits Line 439  Int_t PamelaDBOperations::SetUpperLimits
439          };              };    
440        };        };
441        if ( IsDebug() ) printf(" rhev after %i ph %i upperp %i oh %llu uppero %llu \n",rhev,pkth,upperpkt,obth,upperobt);        if ( IsDebug() ) printf(" rhev after %i ph %i upperp %i oh %llu uppero %llu \n",rhev,pkth,upperpkt,obth,upperobt);
442          goto kikko0;
443      };      };
444    };    };
445     kikko0:
446    //    //
447    //    //
448    //    //
# Line 458  Int_t PamelaDBOperations::SetUpperLimits Line 460  Int_t PamelaDBOperations::SetUpperLimits
460      pktt = PKT(pht->GetCounter());      pktt = PKT(pht->GetCounter());
461      obtt = OBT(pht->GetOrbitalTime());      obtt = OBT(pht->GetOrbitalTime());
462      //      //
463        if ( IsDebug() ) printf(" k %i rtev beforev %i  pt %i upperp %i ot %llu uppero %llu \n",k,rtev,pktt,spktt,obtt,sobtt);
464        //
465      if ( pktt < spktt && obtt < sobtt ){      if ( pktt < spktt && obtt < sobtt ){
       if ( IsDebug() ) printf(" rtev beforev %i  pt %i upperp %i ot %llu uppero %llu \n",rtev,pktt,upperpkt,obtt,upperobt);  
466        if ( IsDebug() ) printf(" RT PROBLEMS determining the event repetition at the end of the file lasttrail %i \n",rtev);        if ( IsDebug() ) printf(" RT PROBLEMS determining the event repetition at the end of the file lasttrail %i \n",rtev);
467        //        //
468        rtev--;        rtev = k-1;
469        rt->GetEntry(rtev);        rt->GetEntry(rtev);
470        pktt = spktt;        pktt = spktt;
471        obtt = sobtt;        obtt = sobtt;
# Line 496  Int_t PamelaDBOperations::SetUpperLimits Line 499  Int_t PamelaDBOperations::SetUpperLimits
499          };          };
500        };        };
501        if ( IsDebug() ) printf(" rtev after %i  pt %i upperp %i ot %llu uppero %llu \n",rtev,pktt,upperpkt,obtt,upperobt);        if ( IsDebug() ) printf(" rtev after %i  pt %i upperp %i ot %llu uppero %llu \n",rtev,pktt,upperpkt,obtt,upperobt);
502        break;        goto kikko;
503          //      break;
504        //        //
505      };      };
506      //        //  
507    };    };
508    //    //
509    // kikko:   kikko:
510      //
511      T->GetEntry(upperentry);
512      code = eh->GetCounter();
513      lasttrail = code->Get(pctp->RunTrailer);
514      lasthead = code->Get(pctp->RunHeader);
515      if ( lasttrail < rtev ){
516        rt->GetEntry(lasttrail);
517        pht = eht->GetPscuHeader();
518        pktt = PKT(pht->GetCounter());
519        obtt = OBT(pht->GetOrbitalTime());
520      };
521      //
522      if ( lasthead < rhev ){
523        rh->GetEntry(lasthead);
524        phh = ehh->GetPscuHeader();
525        pkth = PKT(phh->GetCounter());
526        obth = OBT(phh->GetOrbitalTime());
527      };
528      //
529      if ( IsDebug() ) printf(" rhev before %i ph %i upperp %i oh %llu uppero %llu \n",rhev,pkth,upperpkt,obth,upperobt);
530      if ( pkth > upperpkt && obth > upperobt ){
531        if ( IsDebug() ) printf(" Upper limits extended to include last header: ph %i upperp %i oh %llu uppero %llu \n",pkth,upperpkt,obth,upperobt);
532        upperpkt = pkth;
533        upperobt = obth;
534        rhev = lasthead+1;
535      } else {
536        rhev = lasthead;
537      };
538      if ( IsDebug() ) printf(" rhev after %i ph %i upperp %i oh %llu uppero %llu \n",rhev,pkth,upperpkt,obth,upperobt);
539      //
540      if ( IsDebug() ) printf(" rtev beforev %i  pt %i upperp %i ot %llu uppero %llu \n",rtev,pktt,upperpkt,obtt,upperobt);
541      if ( pktt > upperpkt && obtt > upperobt ){
542        if ( IsDebug() ) printf(" Upper limits extended to include last trailer: pt %i upperp %i ot %llu uppero %llu \n",pktt,upperpkt,obtt,upperobt);
543        upperpkt = pktt;
544        upperobt = obtt;
545        rtev = lasttrail+1;
546      } else {
547        rtev = lasttrail;
548      };
549      if ( IsDebug() ) printf(" rtev after %i  pt %i upperp %i ot %llu uppero %llu \n",rtev,pktt,upperpkt,obtt,upperobt);
550    //    //
551    if ( IsDebug() ) printf(" Upper limits are: OBT %llu pkt_num %i upper entry %i \n",upperobt,upperpkt,upperentry);    if ( IsDebug() ) printf(" Upper limits are: OBT %llu pkt_num %i upper entry %i \n",upperobt,upperpkt,upperentry);
552    //    //

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

  ViewVC Help
Powered by ViewVC 1.1.23