--- chewbacca/YodaProfiler/src/PamelaDBOperations.cpp 2008/11/04 09:44:49 1.5 +++ chewbacca/YodaProfiler/src/PamelaDBOperations.cpp 2008/11/04 15:48:27 1.8 @@ -661,7 +661,7 @@ //UInt_t tjump = 100; while ( tjump > 0 ){ pktlast = numeric_limits::max(); - while ( pktlast > chpktmax && (Int_t)(nevent-1-it) >= 0 ){ + while ( PKT(pktlast) > PKT(chpktmax) && (Int_t)(nevent-1-it) >= 0 ){ if ( (Int_t)(nevent-1-it) >= 0 ){ T->GetEntry(nevent-1-it); ph = eh->GetPscuHeader(); @@ -669,7 +669,7 @@ } else { pktlast = chpktmax + 1; }; - if ( (!(it%1000) || abs((int)pktlast - (int)chpktmax)<1000 ) && debug ) printf(" look for up %i %i %i nevent %u (nevent-1-it) %i \n",it,pktlast,chpktmax,nevent,(Int_t)(nevent-1-it)); + if ( (!(it%1000) || abs((int)(PKT(pktlast) - PKT(chpktmax)))<1000 ) && debug ) printf(" look for up %i %i %i nevent %u (nevent-1-it) %i \n",it,pktlast,chpktmax,nevent,(Int_t)(nevent-1-it)); it += tjump; }; if ( tjump > 1 ) it -= 2*tjump; @@ -694,7 +694,7 @@ //tjump = 100; while ( tjump > 0 ){ pktlast = 0; - while ( pktlast < chpktmin && it < (Int_t)nevent ){ + while ( PKT(pktlast) < PKT(chpktmin) && it < (Int_t)nevent ){ if ( it < (Int_t)nevent ){ T->GetEntry(it); ph = eh->GetPscuHeader(); @@ -1938,7 +1938,7 @@ glroot.PATH = "$PAM_L0"; }; }; - // glroot.NAME = GetRootFile(); + glroot.NAME = GetRootFile(); if ( insertPamelaRootFile(&glroot) )return 1; @@ -4892,20 +4892,22 @@ // }; // + + if( !(MISSING_pkt1&MISSING_pkt2) ){ + this->HandleTRK_CALIB(!MISSING_pkt1,!MISSING_pkt2); + ncalib++; + if( MISSING_pkt1||MISSING_pkt2||!valid )try_to_recover=true; + } + + } else { - // + // if ( IsDebug() ) printf(" Trk calibration1 at time %u obt %u pkt %u OUTSIDE the considered time interval \n",fromtime,obt1,pkt1); // if ( PEDANTIC ) throw -79; // }; // - if( !(MISSING_pkt1&MISSING_pkt2) ){ - this->HandleTRK_CALIB(!MISSING_pkt1,!MISSING_pkt2); - ncalib++; - if( MISSING_pkt1||MISSING_pkt2||!valid )try_to_recover=true; - } - }; //end loop on pkt1 @@ -5130,7 +5132,8 @@ // ------------------------------------------------------ // ... retrieve the calibration packets. // ------------------------------------------------------ - TFile *file = new TFile((TString)gSystem->ExpandPathName(path)+"/"+name); // EM, path could be symbolic and we must expand it + if ( IsDebug() ) printf(" file is %s/%s \n",((TString)gSystem->ExpandPathName(path.Data())).Data(),name.Data()); + TFile *file = new TFile(((TString)gSystem->ExpandPathName(path.Data()))+"/"+name); // EM, path could be symbolic and we must expand it if(!file)throw -100; if(file->IsZombie())throw -100; // @@ -7092,120 +7095,6 @@ } -// UInt_t PamelaDBOperations::ValidateTrkCalib( CalibTrk1Event* caltrk, EventHeader *eh ){ - -// if(!caltrk || !eh) return 0; - -// Int_t vorder[]={5,5,3,3,4,4,2,2,1,1,0,0}; -// UInt_t timeaftercalib=120000; //2000; -// // ---------- -// // Check CRCs -// // ---------- -// for(Int_t ipkt=0; ipkt<6; ipkt++){ -// if( caltrk->crc_hcal[ipkt] )return 0; // :-( -// for(Int_t ilad=0; ilad<3; ilad++)if( caltrk->crc_cal[ipkt][ilad] )return 0; // :-( -// } -// // ----------------------- -// // Check missing packets: -// // ----------------------- -// // Readout order: -// // ------------------ -// // DSP packet board -// // ------------------ -// // 12 0 1 -// // 10 1 1 -// // 8 2 1 -// // 4 3 1 -// // 6 4 1 -// // 2 5 1 -// // ------------------ -// // 11 0 2 -// // 9 1 2 -// // 7 2 2 -// // 3 3 2 -// // 5 4 2 -// // 1 5 2 -// // ------------------ -// // ------------------------------------------------- -// // Check if it is first or second calibration packet -// // ------------------------------------------------- -// UInt_t build=0; -// TString classname = caltrk->GetName(); -// UInt_t base=0; -// UInt_t mask=0; -// if(classname.Contains("CalibTrk1Event")){ -// base=12; -// mask=0x03F000; -// } -// if(classname.Contains("CalibTrk2Event")){ -// base=18; -// mask=0xFC0000; -// } -// // ------------------------------------------------- -// // Count number of packets and set build variable -// // ------------------------------------------------- -// Int_t npkts=0; -// for(Int_t ipkt=0; ipkt<6; ipkt++){ -// if(caltrk->DSPnumber[ipkt]>0 && caltrk->DSPnumber[ipkt]<=12){ -// npkts++; -// build = build | ( 1<<(base+vorder[caltrk->DSPnumber[ipkt]-1]) ); -// } -// } -// // if( npkts==6 )return 1; // :-) - -// // cout << classname << " "<GetPscuHeader()->GetOrbitalTime()<GetCounter(); -// Int_t irun = cod->Get(pctp->RunHeader); -// TTree *rh=(TTree*)file->Get("RunHeader"); -// if ( !rh || rh->IsZombie() ) throw -17; -// if( rh->GetEntries() == irun ){ -// if ( IsDebug() ) cout << "ValidateTrkCalib: (MISSING VIEW) no runs after calib (1) -- cannot validate :-( "<SetBranchAddress("RunHeader", &run); -// rh->SetBranchAddress("Header", &hrun); -// rh->GetEntry(irun); -// // cout << classname << " "<GetPscuHeader()->GetOrbitalTime() << " Run " << hrun->GetPscuHeader()->GetOrbitalTime() <GetPscuHeader()->GetOrbitalTime()) < OBT(eh->GetPscuHeader()->GetOrbitalTime())){ -// if ( IsDebug() ) cout << "ValidateTrkCalib: (MISSING VIEW) no runs after calib (2) -- cannot validate :-( "<RM_ACQ_AFTER_CALIB ){ -// if ( IsDebug() ) cout << "ValidateTrkCalib: (MISSING VIEW) RM_ACQ_AFTER_CALIB=0 -- cannot validate :-( "<GetPscuHeader()->GetOrbitalTime()) - OBT(eh->GetPscuHeader()->GetOrbitalTime()); -// if( dtime > timeaftercalib ){ -// if ( IsDebug() ) cout << "ValidateTrkCalib: (MISSING VIEW) run after calib too far ( "<ACQ_BUILD_INFO & mask) != build ){ -// if ( IsDebug() ) cout << "ValidateTrkCalib: (MISSING VIEW) ACQ_BUILD_INFO= >>> "<ACQ_BUILD_INFO&mask) << " != "<< build << dec<