/[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.3 by mocchiut, Tue Sep 5 10:48:58 2006 UTC revision 1.4 by mocchiut, Fri Sep 8 12:44:27 2006 UTC
# Line 223  Int_t PamelaDBOperations::SetUpperLimits Line 223  Int_t PamelaDBOperations::SetUpperLimits
223    ULong64_t upperobt2 = 0;    ULong64_t upperobt2 = 0;
224    UInt_t zomp = 0;    UInt_t zomp = 0;
225    UInt_t jump = 50000; // was 5000    UInt_t jump = 50000; // was 5000
226      EventCounter *code=0;
227      //
228      //   pcksList packetsNames;
229      //   pcksList::iterator Iter;
230      //   getPacketsNames(packetsNames);
231    //    //
232    pktfirst = 0;    pktfirst = 0;
233    obtfirst = 0;    obtfirst = 0;
# Line 240  Int_t PamelaDBOperations::SetUpperLimits Line 245  Int_t PamelaDBOperations::SetUpperLimits
245    pktfirst = ph->GetCounter();    pktfirst = ph->GetCounter();
246    obtfirst = ph->GetOrbitalTime();      obtfirst = ph->GetOrbitalTime();  
247    //    //
248      //   code = eh->GetCounter();
249      //   UInt_t en = 0;
250      //   for(Iter = packetsNames.begin(); Iter != packetsNames.end(); Iter++){
251      //     en = code->Get(GetPacketType(*Iter));
252      //     if ( en ) printf(" Packet type is %s, entries: %i \n",*Iter,en);
253      //};  
254      //
255    T->GetEntry(nevent-1);    T->GetEntry(nevent-1);
256    ph = eh->GetPscuHeader();    ph = eh->GetPscuHeader();
257    pktlast = ph->GetCounter();    pktlast = ph->GetCounter();
# Line 308  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;
   EventCounter *code=0;  
323    T->GetEntry(upperentry);    T->GetEntry(upperentry);
324    code = eh->GetCounter();    code = eh->GetCounter();
325    Int_t lasttrail = code->Get(pctp->RunTrailer);    Int_t lasttrail = code->Get(pctp->RunTrailer);
# Line 326  Int_t PamelaDBOperations::SetUpperLimits Line 337  Int_t PamelaDBOperations::SetUpperLimits
337    //    //
338    rhev = rh->GetEntries();    rhev = rh->GetEntries();
339    rtev = rt->GetEntries();    rtev = rt->GetEntries();
340      UInt_t sobtt = 0;
341      UInt_t sobth = 0;
342      UInt_t spktt = 0;
343      UInt_t spkth = 0;
344    UInt_t pktt = 0;    UInt_t pktt = 0;
345    ULong64_t obtt = 0;    ULong64_t obtt = 0;
346    UInt_t pkth = 0;    UInt_t pkth = 0;
# Line 338  Int_t PamelaDBOperations::SetUpperLimits Line 353  Int_t PamelaDBOperations::SetUpperLimits
353      obtt = OBT(pht->GetOrbitalTime());      obtt = OBT(pht->GetOrbitalTime());
354    };    };
355    //    //
   if ( IsDebug() ) printf(" rtev beforev %i  pt %i upperp %i ot %llu uppero %llu \n",rtev,pktt,upperpkt,obtt,upperobt);  
   if ( pktt > upperpkt && obtt > upperobt ){  
     if ( IsDebug() ) printf(" Upper limits extended to include last trailer: pt %i upperp %i ot %llu uppero %llu \n",pktt,upperpkt,obtt,upperobt);  
     upperpkt = pktt;  
     upperobt = obtt;  
     rtev = lasttrail+1;  
   } else {  
     rtev = lasttrail;  
   };  
   if ( IsDebug() ) printf(" rtev after %i  pt %i upperp %i ot %llu uppero %llu \n",rtev,pktt,upperpkt,obtt,upperobt);  
   //  
356    if ( lasthead < rhev ){    if ( lasthead < rhev ){
357      rh->GetEntry(lasthead);      rh->GetEntry(lasthead);
358      phh = ehh->GetPscuHeader();      phh = ehh->GetPscuHeader();
# Line 367  Int_t PamelaDBOperations::SetUpperLimits Line 371  Int_t PamelaDBOperations::SetUpperLimits
371    };    };
372    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);
373    //    //
374      if ( IsDebug() ) printf(" rtev beforev %i  pt %i upperp %i ot %llu uppero %llu \n",rtev,pktt,upperpkt,obtt,upperobt);
375      if ( pktt > upperpkt && obtt > upperobt ){
376        if ( IsDebug() ) printf(" Upper limits extended to include last trailer: pt %i upperp %i ot %llu uppero %llu \n",pktt,upperpkt,obtt,upperobt);
377        upperpkt = pktt;
378        upperobt = obtt;
379        rtev = lasttrail+1;
380      } else {
381        rtev = lasttrail;
382      };
383      if ( IsDebug() ) printf(" rtev after %i  pt %i upperp %i ot %llu uppero %llu \n",rtev,pktt,upperpkt,obtt,upperobt);
384      //  goto kikko;
385      //
386      //
387      // Check if runtrailer/runheader are within lower limits
388      //
389      //
390      pkth = 0;
391      obth = 0;
392      spkth = 0;
393      sobth = 0;
394      for (Int_t k=0; k<rhev; k++){
395        if ( k > 0 ){
396          spkth = pkth;
397          sobth = obth;
398        };
399        rh->GetEntry(k);
400        phh = ehh->GetPscuHeader();
401        pkth = PKT(phh->GetCounter());
402        obth = OBT(phh->GetOrbitalTime());
403        //
404        if ( pkth < spkth && obth < sobth ){
405          if ( IsDebug() ) printf(" rhev before %i ph %i upperp %i oh %llu uppero %llu \n",rhev,pkth,upperpkt,obth,upperobt);
406          if ( IsDebug() ) printf(" RH PROBLEMS determining the event repetition at the end of the file lasthead %i  \n",rhev);
407          //
408          rhev--;
409          rh->GetEntry(rhev);
410          pkth = spkth;
411          obth = sobth;
412          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;
415          code = ehh->GetCounter();
416          evbefh = code->Get(pctp->Physics);    
417          if ( evbefh >= 0 ){
418            T->GetEntry(evbefh);
419            ph = eh->GetPscuHeader();
420            t_pktlast = PKT(ph->GetCounter());
421            t_obtlast = OBT(ph->GetOrbitalTime());
422            if ( t_pktlast < spkth && t_obtlast < sobth ){ // jump
423              upperpkt = pkth;
424              upperobt = obth;
425              upperentry = evbefh-1;
426            } else {
427              while ( t_pktlast > spkth && t_obtlast > sobth && evbefh < nevent ){
428                evbefh++;  
429                T->GetEntry(evbefh);
430                ph = eh->GetPscuHeader();
431                t_pktlast = PKT(ph->GetCounter());
432                t_obtlast = OBT(ph->GetOrbitalTime());
433              };
434              T->GetEntry(evbefh-1);
435              ph = eh->GetPscuHeader();
436              upperpkt = PKT(ph->GetCounter());
437              upperobt = OBT(ph->GetOrbitalTime());
438              upperentry = evbefh-1;
439            };    
440          };
441          if ( IsDebug() ) printf(" rhev after %i ph %i upperp %i oh %llu uppero %llu \n",rhev,pkth,upperpkt,obth,upperobt);
442        };
443      };
444      //
445      //
446      //
447      pktt = 0;
448      obtt = 0;
449      spktt = 0;
450      sobtt = 0;
451      for (Int_t k=0; k<rtev; k++){
452        if ( k > 0 ){
453          spktt = pktt;
454          sobtt = obtt;
455        };
456        rt->GetEntry(k);
457        pht = eht->GetPscuHeader();
458        pktt = PKT(pht->GetCounter());
459        obtt = OBT(pht->GetOrbitalTime());
460        //
461        if ( pktt < spktt && obtt < sobtt ){
462          if ( IsDebug() ) printf(" rtev beforev %i  pt %i upperp %i ot %llu uppero %llu \n",rtev,pktt,upperpkt,obtt,upperobt);
463          if ( IsDebug() ) printf(" RT PROBLEMS determining the event repetition at the end of the file lasttrail %i \n",rtev);
464          //
465          rtev--;
466          rt->GetEntry(rtev);
467          pktt = spktt;
468          obtt = sobtt;
469          if ( IsDebug() ) printf(" lasttrail %i pt %i upperp %i ot %llu uppero %llu \n",rtev,pktt,upperpkt,obtt,upperobt);
470          //
471          UInt_t evbeft = 0;
472          code = eht->GetCounter();
473          evbeft = code->Get(pctp->Physics);    
474          if ( evbeft >= 0 ){
475            T->GetEntry(evbeft);
476            ph = eh->GetPscuHeader();
477            t_pktlast = PKT(ph->GetCounter());
478            t_obtlast = OBT(ph->GetOrbitalTime());
479            if ( t_pktlast < spktt && t_obtlast < sobtt ){ // jump
480              upperpkt = pktt;
481              upperobt = obtt;
482              upperentry = evbeft-1;
483            } else {
484              while ( t_pktlast > spktt && t_obtlast > sobtt && evbeft < nevent ){
485                evbeft++;  
486                T->GetEntry(evbeft);
487                ph = eh->GetPscuHeader();
488                t_pktlast = PKT(ph->GetCounter());
489                t_obtlast = OBT(ph->GetOrbitalTime());
490              };
491              T->GetEntry(evbeft-1);
492              ph = eh->GetPscuHeader();
493              upperpkt = PKT(ph->GetCounter());
494              upperobt = OBT(ph->GetOrbitalTime());
495              upperentry = evbeft-1;
496            };
497          };
498          if ( IsDebug() ) printf(" rtev after %i  pt %i upperp %i ot %llu uppero %llu \n",rtev,pktt,upperpkt,obtt,upperobt);
499          break;
500          //
501        };
502        //  
503      };
504      //
505      // kikko:
506      //
507    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);
508    //    //
509    return(0);    return(0);

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

  ViewVC Help
Powered by ViewVC 1.1.23