| 400 |
upperobt = OBT(obtlast); |
upperobt = OBT(obtlast); |
| 401 |
upperentry = nevent-1; |
upperentry = nevent-1; |
| 402 |
// |
// |
| 403 |
if ( IsDebug() ) printf(" First entries are: OBT %i pkt_num %i \n",obtfirst,pktfirst); |
if ( IsDebug() ) printf(" First entries are: OBT %u pkt_num %u \n",obtfirst,pktfirst); |
| 404 |
// |
// |
| 405 |
if ( IsDebug() ) printf(" Last entries are: OBT %lld pkt_num %lld entry %i\n",upperobt,upperpkt,upperentry); |
if ( IsDebug() ) printf(" Last entries are: OBT %lld pkt_num %lld entry %i\n",upperobt,upperpkt,upperentry); |
| 406 |
// |
// |
| 407 |
if ( (PKT(pktlast) < PKT(pktfirst) && OBT(obtlast) > OBT(obtfirst)) || (PKT(pktlast) > PKT(pktfirst) && OBT(obtlast) < OBT(obtfirst)) ) return(1); |
if ( (PKT(pktlast) < PKT(pktfirst) && OBT(obtlast) > OBT(obtfirst)) || (PKT(pktlast) > PKT(pktfirst) && OBT(obtlast) < OBT(obtfirst)) ) return(32); |
| 408 |
// |
// |
| 409 |
if ( !nevent ) return(2); |
if ( !nevent ) return(64); |
| 410 |
// |
// |
| 411 |
if ( nevent < 2 ) return(4); |
if ( nevent < 2 ) return(128); |
| 412 |
if ( nevent < jump ) jump = 1; |
if ( nevent < jump ) jump = 1; |
| 413 |
// if ( nevent < jump ) jump = int(nevent/10); |
// if ( nevent < jump ) jump = int(nevent/10); |
| 414 |
// if ( !jump ) jump = 1; |
// if ( !jump ) jump = 1; |
| 867 |
return((Long64_t)pkt_num+16777215LL); |
return((Long64_t)pkt_num+16777215LL); |
| 868 |
}; |
}; |
| 869 |
// |
// |
| 870 |
if ( pkt_num > ppktfirst*2 && pkt_num > (16777214/2) ){ |
if ( pkt_num > ((Long64_t)ppktfirst*2) && pkt_num > (16777214/2) ){ |
| 871 |
if ( IsDebug() ) printf(" rise down pktnum %lld \n",(Long64_t)pkt_num-16777215LL); |
if ( IsDebug() ) printf(" rise down pktnum %lld \n",(Long64_t)pkt_num-16777215LL); |
| 872 |
return((Long64_t)pkt_num-16777215LL); |
return((Long64_t)pkt_num-16777215LL); |
| 873 |
}; |
}; |
| 882 |
*/ |
*/ |
| 883 |
Long64_t PamelaDBOperations::OBT(UInt_t obt){ |
Long64_t PamelaDBOperations::OBT(UInt_t obt){ |
| 884 |
// |
// |
| 885 |
if ( IsDebug() ) printf(" obt conversion: ob is %u obtfirst is %u (numeric_limits<UInt_t>::max()/2) is %u \n",obt,pobtfirst,(UInt_t)(numeric_limits<UInt_t>::max()/2)); |
if ( IsDebug() ) printf(" obt conversion: obt is %u obtfirst is %u (numeric_limits<UInt_t>::max()/2) is %u \n",obt,pobtfirst,(UInt_t)(numeric_limits<UInt_t>::max()/2)); |
| 886 |
// |
// |
| 887 |
if ( obt < (pobtfirst/2) && pobtfirst > (numeric_limits<UInt_t>::max()/2) ){ |
if ( obt < (pobtfirst/2) && pobtfirst > (numeric_limits<UInt_t>::max()/2) ){ |
| 888 |
if ( IsDebug() ) printf(" rise up obt %lld \n",(obt+numeric_limits<UInt_t>::max())); |
if ( IsDebug() ) printf(" rise up obt %lld \n",(Long64_t)(obt+numeric_limits<UInt_t>::max())); |
| 889 |
return((Long64_t)(obt+numeric_limits<UInt_t>::max())); |
return((Long64_t)(obt+numeric_limits<UInt_t>::max())); |
| 890 |
}; |
}; |
| 891 |
// |
// |
| 892 |
if ( obt > (pobtfirst*2) && obt > (numeric_limits<UInt_t>::max()/2) ){ |
if ( obt > ((Long64_t)pobtfirst*2) && obt > (numeric_limits<UInt_t>::max()/2) ){ |
| 893 |
|
if ( IsDebug() ) printf(" pobtfirst*2 %lld \n",((Long64_t)pobtfirst*2)); |
| 894 |
if ( IsDebug() ) printf(" rise down pktnum %lld \n", (Long64_t)obt-(Long64_t)numeric_limits<UInt_t>::max()); |
if ( IsDebug() ) printf(" rise down pktnum %lld \n", (Long64_t)obt-(Long64_t)numeric_limits<UInt_t>::max()); |
| 895 |
return((Long64_t)obt-(Long64_t)numeric_limits<UInt_t>::max()); |
return((Long64_t)obt-(Long64_t)numeric_limits<UInt_t>::max()); |
| 896 |
}; |
}; |
| 1035 |
TSQLResult *result = 0; |
TSQLResult *result = 0; |
| 1036 |
TSQLRow *row = 0; |
TSQLRow *row = 0; |
| 1037 |
UInt_t t0 = 0; |
UInt_t t0 = 0; |
| 1038 |
|
Int_t signal = 0; |
| 1039 |
|
// |
| 1040 |
|
signal = this->SetUpperLimits(); |
| 1041 |
// |
// |
| 1042 |
stringstream oss; |
stringstream oss; |
| 1043 |
// |
// |
| 1090 |
}; |
}; |
| 1091 |
// |
// |
| 1092 |
TTree *T = 0; |
TTree *T = 0; |
|
Int_t signal = 0; |
|
| 1093 |
// |
// |
| 1094 |
UInt_t nevent = 0; |
UInt_t nevent = 0; |
| 1095 |
UInt_t recEntries = 0; |
UInt_t recEntries = 0; |
| 1498 |
stringstream oss; |
stringstream oss; |
| 1499 |
oss.str(""); |
oss.str(""); |
| 1500 |
// |
// |
| 1501 |
signal = this->SetUpperLimits(); |
// signal = this->SetUpperLimits(); |
| 1502 |
// |
// |
| 1503 |
// loop on runheader and runtrailer events |
// loop on runheader and runtrailer events |
| 1504 |
// |
// |
| 2872 |
fromtime = this->GetAbsTime(ph->GetOrbitalTime()); |
fromtime = this->GetAbsTime(ph->GetOrbitalTime()); |
| 2873 |
if ( this->PKT(pkt) >= this->PKT(pktfirst) && this->OBT(obt) >= this->OBT(obtfirst) ){ |
if ( this->PKT(pkt) >= this->PKT(pktfirst) && this->OBT(obt) >= this->OBT(obtfirst) ){ |
| 2874 |
// |
// |
| 2875 |
if ( IsDebug() ) printf(" Calo calibration for section %i at time %i obt %i pkt %i \n",section,fromtime,obt,pkt); |
if ( IsDebug() ) printf(" Calo calibration for section %i at time %u obt %u pkt %u \n",section,fromtime,obt,pkt); |
| 2876 |
// |
// |
| 2877 |
// check if the calibration has already been inserted |
// check if the calibration has already been inserted |
| 2878 |
// |
// |
| 2979 |
// |
// |
| 2980 |
} else { |
} else { |
| 2981 |
// |
// |
| 2982 |
if ( IsDebug() ) printf(" Repeated calo calibration for section %i at time %i obt %i pkt %i \n",section,fromtime,obt,pkt); |
if ( IsDebug() ) printf(" Repeated calo calibration for section %i at time %u obt %u pkt %u \n",section,fromtime,obt,pkt); |
| 2983 |
// |
// |
| 2984 |
}; |
}; |
| 2985 |
// |
// |
| 3197 |
// |
// |
| 3198 |
if ( this->PKT(pkt1) >= this->PKT(pktfirst) && this->OBT(obt1) >= this->OBT(obtfirst) ){ |
if ( this->PKT(pkt1) >= this->PKT(pktfirst) && this->OBT(obt1) >= this->OBT(obtfirst) ){ |
| 3199 |
// |
// |
| 3200 |
if ( IsDebug() ) printf(" Trk calibration1 at time %i obt %i pkt %i \n",fromtime,obt1,pkt1); |
if ( IsDebug() ) printf(" Trk calibration1 at time %u obt %u pkt %u \n",fromtime,obt1,pkt1); |
| 3201 |
// |
// |
| 3202 |
valid = ValidateTrkCalib( caltrk1, eh1 ); |
valid = ValidateTrkCalib( caltrk1, eh1 ); |
| 3203 |
if ( IsDebug() ) cout << " pkt1 validation --> "<<valid<<endl; |
if ( IsDebug() ) cout << " pkt1 validation --> "<<valid<<endl; |
| 3240 |
// |
// |
| 3241 |
}; |
}; |
| 3242 |
// |
// |
| 3243 |
if ( IsDebug() ) printf(" Found trk calibration2 at obt %i pkt %i t2 is %i \n",obt2,pkt2,t2); |
if ( IsDebug() ) printf(" Found trk calibration2 at obt %u pkt %u t2 is %u \n",obt2,pkt2,t2); |
| 3244 |
// |
// |
| 3245 |
// The calibration is good |
// The calibration is good |
| 3246 |
// |
// |
| 3247 |
if ( this->PKT(pkt2) == this->PKT(pkt1)+1 ){ |
if ( this->PKT(pkt2) == this->PKT(pkt1)+1 ){ |
| 3248 |
// |
// |
| 3249 |
if ( IsDebug() ) printf(" The trk calibration2 at obt %i pkt %i t2 is %i is good \n",obt2,pkt2,t2); |
if ( IsDebug() ) printf(" The trk calibration2 at obt %u pkt %u t2 is %u is good \n",obt2,pkt2,t2); |
| 3250 |
// |
// |
| 3251 |
UInt_t valid2 = ValidateTrkCalib( caltrk2, eh2 ); |
UInt_t valid2 = ValidateTrkCalib( caltrk2, eh2 ); |
| 3252 |
if ( IsDebug() ) cout << " pkt2 validation --> "<<valid2<<endl; |
if ( IsDebug() ) cout << " pkt2 validation --> "<<valid2<<endl; |
| 3260 |
// |
// |
| 3261 |
if ( t2 != pret2+1 ){ |
if ( t2 != pret2+1 ){ |
| 3262 |
// |
// |
| 3263 |
if ( IsDebug() ) printf(" Missing the trk calibration1! Next one at obt %i pkt %i t2 is %i pret2 is %i \n",obt2,pkt2,t2,pret2); |
if ( IsDebug() ) printf(" Missing the trk calibration1! Next one at obt %u pkt %u t2 is %u pret2 is %u \n",obt2,pkt2,t2,pret2); |
| 3264 |
// |
// |
| 3265 |
while ( t2 > pret2+1 ){ |
while ( t2 > pret2+1 ){ |
| 3266 |
// |
// |
| 3289 |
// |
// |
| 3290 |
// Check for missing calibtrk2 |
// Check for missing calibtrk2 |
| 3291 |
// |
// |
| 3292 |
if ( IsDebug() ) printf(" Missing the trk calibration2! Next one at obt %i pkt %i t2 is %i\n",obt2,pkt2,t2); |
if ( IsDebug() ) printf(" Missing the trk calibration2! Next one at obt %u pkt %u t2 is %u\n",obt2,pkt2,t2); |
| 3293 |
t2 = pret2; |
t2 = pret2; |
| 3294 |
// |
// |
| 3295 |
// handle missing calib2 |
// handle missing calib2 |
| 3303 |
// |
// |
| 3304 |
} else { |
} else { |
| 3305 |
// |
// |
| 3306 |
if ( IsDebug() ) printf(" Repetead trk calibration1 at time %i obt %i pkt %i \n",fromtime,obt1,pkt1); |
if ( IsDebug() ) printf(" Repetead trk calibration1 at time %u obt %u pkt %u \n",fromtime,obt1,pkt1); |
| 3307 |
// |
// |
| 3308 |
}; |
}; |
| 3309 |
// |
// |
| 3328 |
valid = 0; |
valid = 0; |
| 3329 |
if ( this->PKT(pkt2) > this->PKT(pktfirst) || this->OBT(obt2) > this->OBT(obtfirst) ){ |
if ( this->PKT(pkt2) > this->PKT(pktfirst) || this->OBT(obt2) > this->OBT(obtfirst) ){ |
| 3330 |
// |
// |
| 3331 |
if ( IsDebug() ) printf(" Missing the trk calibration1! Next one at obt %i pkt %i t2 is %i\n",obt2,pkt2,t2); |
if ( IsDebug() ) printf(" Missing the trk calibration1! Next one at obt %u pkt %u t2 is %u\n",obt2,pkt2,t2); |
| 3332 |
// |
// |
| 3333 |
this->HandleTRK_CALIB(false,true); |
this->HandleTRK_CALIB(false,true); |
| 3334 |
// |
// |
| 3382 |
fromtime = this->GetAbsTime(ph->GetOrbitalTime()); |
fromtime = this->GetAbsTime(ph->GetOrbitalTime()); |
| 3383 |
if ( this->PKT(pkt) >= this->PKT(pktfirst) && this->OBT(obt) >= this->OBT(obtfirst) ){ |
if ( this->PKT(pkt) >= this->PKT(pktfirst) && this->OBT(obt) >= this->OBT(obtfirst) ){ |
| 3384 |
// |
// |
| 3385 |
if ( IsDebug() ) printf(" S4 calibration at time %i obt %i pkt %i \n",fromtime,obt,pkt); |
if ( IsDebug() ) printf(" S4 calibration at time %u obt %u pkt %u \n",fromtime,obt,pkt); |
| 3386 |
// |
// |
| 3387 |
// check if the calibration has already been inserted |
// check if the calibration has already been inserted |
| 3388 |
// |
// |
| 3484 |
// |
// |
| 3485 |
} else { |
} else { |
| 3486 |
// |
// |
| 3487 |
if ( IsDebug() ) printf(" Repetead S4 calibration at time %i obt %i pkt %i \n",fromtime,obt,pkt); |
if ( IsDebug() ) printf(" Repeated S4 calibration at time %u obt %u pkt %u \n",fromtime,obt,pkt); |
| 3488 |
// |
// |
| 3489 |
}; |
}; |
| 3490 |
// |
// |