169 |
}; |
}; |
170 |
|
|
171 |
/** |
/** |
172 |
|
* Set the pedantic flag |
173 |
|
* |
174 |
|
*/ |
175 |
|
void PamelaDBOperations::SetPedantic(Bool_t dbg){ |
176 |
|
PEDANTIC = dbg; |
177 |
|
}; |
178 |
|
|
179 |
|
/** |
180 |
* Set the nofrag flag |
* Set the nofrag flag |
181 |
* |
* |
182 |
*/ |
*/ |
390 |
if ( result == NULL ) throw -4; |
if ( result == NULL ) throw -4; |
391 |
row = result->Next(); |
row = result->Next(); |
392 |
if ( !row ) return(false); |
if ( !row ) return(false); |
|
delete result; |
|
393 |
id = (UInt_t)atoll(row->GetField(0)); |
id = (UInt_t)atoll(row->GetField(0)); |
394 |
|
delete result; |
395 |
return(true); |
return(true); |
396 |
} |
} |
397 |
|
|
498 |
if ( (PKT(pktlast) < PKT(pktfirst) && OBT(obtlast) < OBT(obtfirst)) || (labs(PKT(pktlast)-PKT(pktfirst))<deltapkt && labs(OBT(obtlast)-OBT(obtfirst))<deltaobt) && nevent > deltapkt ){ |
if ( (PKT(pktlast) < PKT(pktfirst) && OBT(obtlast) < OBT(obtfirst)) || (labs(PKT(pktlast)-PKT(pktfirst))<deltapkt && labs(OBT(obtlast)-OBT(obtfirst))<deltaobt) && nevent > deltapkt ){ |
499 |
// |
// |
500 |
if ( IsDebug() ) printf(" starting jump %i \n",jump); |
if ( IsDebug() ) printf(" starting jump %i \n",jump); |
501 |
|
if ( PEDANTIC ) throw -66; |
502 |
// go back |
// go back |
503 |
zomp = nevent - 2; |
zomp = nevent - 2; |
504 |
// |
// |
638 |
// if ( IsDebug() ) printf(" k %i rhev before %i ph %u upperp %u oh %u uppero %u \n",k,rhev,pkth,spkth,obth,sobth); |
// if ( IsDebug() ) printf(" k %i rhev before %i ph %u upperp %u oh %u uppero %u \n",k,rhev,pkth,spkth,obth,sobth); |
639 |
// |
// |
640 |
if ( pkth < spkth && obth < sobth ){ |
if ( pkth < spkth && obth < sobth ){ |
641 |
|
if ( PEDANTIC ) throw -66; |
642 |
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); |
643 |
// |
// |
644 |
rhev = k-1; |
rhev = k-1; |
698 |
// if ( IsDebug() ) printf(" k %i rtev beforev %i pt %i upperp %i ot %llu uppero %llu \n",k,rtev,pktt,spktt,obtt,sobtt); |
// if ( IsDebug() ) printf(" k %i rtev beforev %i pt %i upperp %i ot %llu uppero %llu \n",k,rtev,pktt,spktt,obtt,sobtt); |
699 |
// |
// |
700 |
if ( pktt < spktt && obtt < sobtt ){ |
if ( pktt < spktt && obtt < sobtt ){ |
701 |
|
if ( PEDANTIC ) throw -66; |
702 |
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); |
703 |
// |
// |
704 |
rtev = k-1; |
rtev = k-1; |
970 |
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)); |
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)); |
971 |
// |
// |
972 |
if ( obt < (pobtfirst/2) && pobtfirst > (numeric_limits<UInt_t>::max()/2) ){ |
if ( obt < (pobtfirst/2) && pobtfirst > (numeric_limits<UInt_t>::max()/2) ){ |
973 |
if ( IsDebug() ) printf(" rise up obt %lld \n",(Long64_t)(obt+numeric_limits<UInt_t>::max())); |
if ( IsDebug() ) printf(" rise up obt %lld \n",(Long64_t)obt+(Long64_t)numeric_limits<UInt_t>::max()); |
974 |
return((Long64_t)(obt+numeric_limits<UInt_t>::max())); |
return((Long64_t)obt+(Long64_t)numeric_limits<UInt_t>::max()); |
975 |
}; |
}; |
976 |
// |
// |
977 |
if ( obt > ((Long64_t)pobtfirst*2) && obt > (numeric_limits<UInt_t>::max()/2) ){ |
if ( obt > ((Long64_t)pobtfirst*2) && obt > (numeric_limits<UInt_t>::max()/2) ){ |
1174 |
tsync = (UInt_t)atoll(row->GetField(2)); |
tsync = (UInt_t)atoll(row->GetField(2)); |
1175 |
obt0 = (UInt_t)atoll(row->GetField(1)); |
obt0 = (UInt_t)atoll(row->GetField(1)); |
1176 |
// |
// |
1177 |
|
if ( PEDANTIC ) throw -67; |
1178 |
return(1); |
return(1); |
1179 |
}; |
}; |
1180 |
// |
// |
1344 |
// |
// |
1345 |
if ( !existsts && obt0 ){ // insert timesync by hand |
if ( !existsts && obt0 ){ // insert timesync by hand |
1346 |
// |
// |
1347 |
|
if ( PEDANTIC ) throw -68; |
1348 |
if ( IsDebug() ) printf(" No incl mcmd \n"); |
if ( IsDebug() ) printf(" No incl mcmd \n"); |
1349 |
signal = 30; |
signal = 30; |
1350 |
// |
// |
2051 |
// |
// |
2052 |
} else { |
} else { |
2053 |
if ( IsDebug() ) printf(" The run is already present in the fragment table \n"); |
if ( IsDebug() ) printf(" The run is already present in the fragment table \n"); |
2054 |
|
if ( PEDANTIC ) throw -69; |
2055 |
return; |
return; |
2056 |
}; |
}; |
2057 |
// |
// |
2202 |
bpkt = PKT(ph->GetCounter()); |
bpkt = PKT(ph->GetCounter()); |
2203 |
bobt = OBT(ph->GetOrbitalTime()); |
bobt = OBT(ph->GetOrbitalTime()); |
2204 |
firstev++; |
firstev++; |
2205 |
|
if ( PEDANTIC ) throw -71; |
2206 |
}; |
}; |
2207 |
if ( IsDebug() ) printf(" Check overlapping events done: %u %u %llu %llu firstev is %i\n",apkt,bpkt,aobt,bobt,firstev); |
if ( IsDebug() ) printf(" Check overlapping events done: %u %u %llu %llu firstev is %i\n",apkt,bpkt,aobt,bobt,firstev); |
2208 |
// |
// |
2400 |
apkt = PKT(ph->GetCounter()); |
apkt = PKT(ph->GetCounter()); |
2401 |
aobt = OBT(ph->GetOrbitalTime()); |
aobt = OBT(ph->GetOrbitalTime()); |
2402 |
lastev--; |
lastev--; |
2403 |
|
if ( PEDANTIC ) throw -72; |
2404 |
}; |
}; |
2405 |
if ( IsDebug() ) printf(" Check overlapping events done: %u %u %llu %llu lastev is %i\n",apkt,bpkt,aobt,bobt,lastev); |
if ( IsDebug() ) printf(" Check overlapping events done: %u %u %llu %llu lastev is %i\n",apkt,bpkt,aobt,bobt,lastev); |
2406 |
// |
// |
2487 |
// |
// |
2488 |
if ( row ){ |
if ( row ){ |
2489 |
if ( IsDebug() ) printf(" The run is already present in the GL_RUN table \n"); |
if ( IsDebug() ) printf(" The run is already present in the GL_RUN table \n"); |
2490 |
|
if ( PEDANTIC ) throw -70; |
2491 |
} else { |
} else { |
2492 |
if ( NoFrag() ){ |
if ( NoFrag() ){ |
2493 |
glrun->SetID_RUN_FRAG(glrun->GetID()); |
glrun->SetID_RUN_FRAG(glrun->GetID()); |
3031 |
if ( row ){ |
if ( row ){ |
3032 |
// |
// |
3033 |
if ( IsDebug() ) printf(" Calo calibration already inserted in the DB\n"); |
if ( IsDebug() ) printf(" Calo calibration already inserted in the DB\n"); |
3034 |
|
if ( PEDANTIC ) throw -73; |
3035 |
// |
// |
3036 |
} else { |
} else { |
3037 |
// |
// |
3119 |
} else { |
} else { |
3120 |
// |
// |
3121 |
if ( IsDebug() ) printf(" Repeated calo calibration for section %i at time %u obt %u pkt %u \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); |
3122 |
|
if ( PEDANTIC ) throw -74; |
3123 |
// |
// |
3124 |
}; |
}; |
3125 |
// |
// |
3208 |
if ( row ){ |
if ( row ){ |
3209 |
// |
// |
3210 |
if ( IsDebug() ) printf(" Calo pulse1 calibration already inserted in the DB\n"); |
if ( IsDebug() ) printf(" Calo pulse1 calibration already inserted in the DB\n"); |
3211 |
|
if ( PEDANTIC ) throw -75; |
3212 |
// |
// |
3213 |
} else { |
} else { |
3214 |
// |
// |
3299 |
} else { |
} else { |
3300 |
// |
// |
3301 |
if ( IsDebug() ) printf(" Repeated pulse1 calo calibration for section %i at time %u obt %u pkt %u \n",section,fromtime,obt,pkt); |
if ( IsDebug() ) printf(" Repeated pulse1 calo calibration for section %i at time %u obt %u pkt %u \n",section,fromtime,obt,pkt); |
3302 |
|
if ( PEDANTIC ) throw -76; |
3303 |
// |
// |
3304 |
}; |
}; |
3305 |
// |
// |
3364 |
if ( row ){ |
if ( row ){ |
3365 |
// |
// |
3366 |
if ( IsDebug() ) printf(" Calo pulse2 calibration already inserted in the DB\n"); |
if ( IsDebug() ) printf(" Calo pulse2 calibration already inserted in the DB\n"); |
3367 |
|
if ( PEDANTIC ) throw -77; |
3368 |
// |
// |
3369 |
} else { |
} else { |
3370 |
// |
// |
3498 |
} else { |
} else { |
3499 |
// |
// |
3500 |
if ( IsDebug() ) printf(" Repeated pulse2 calo calibration for section %i at time %u obt %u pkt %u \n",section,fromtime,obt,pkt); |
if ( IsDebug() ) printf(" Repeated pulse2 calo calibration for section %i at time %u obt %u pkt %u \n",section,fromtime,obt,pkt); |
3501 |
|
if ( PEDANTIC ) throw -78; |
3502 |
// |
// |
3503 |
}; |
}; |
3504 |
// |
// |
3559 |
if ( row ){ |
if ( row ){ |
3560 |
// |
// |
3561 |
if ( IsDebug() ) printf(" Trk calibration already inserted in the DB\n"); |
if ( IsDebug() ) printf(" Trk calibration already inserted in the DB\n"); |
3562 |
|
if ( PEDANTIC ) throw -80; |
3563 |
// |
// |
3564 |
} else { |
} else { |
3565 |
// |
// |
3825 |
} else { |
} else { |
3826 |
// |
// |
3827 |
if ( IsDebug() ) printf(" Repetead trk calibration1 at time %u obt %u pkt %u \n",fromtime,obt1,pkt1); |
if ( IsDebug() ) printf(" Repetead trk calibration1 at time %u obt %u pkt %u \n",fromtime,obt1,pkt1); |
3828 |
|
if ( PEDANTIC ) throw -79; |
3829 |
// |
// |
3830 |
}; |
}; |
3831 |
// |
// |
3924 |
if ( row ){ |
if ( row ){ |
3925 |
// |
// |
3926 |
if ( IsDebug() ) printf(" S4 calibration already inserted in the DB\n"); |
if ( IsDebug() ) printf(" S4 calibration already inserted in the DB\n"); |
3927 |
|
if ( PEDANTIC ) throw -81; |
3928 |
// |
// |
3929 |
} else { |
} else { |
3930 |
// |
// |
4008 |
} else { |
} else { |
4009 |
// |
// |
4010 |
if ( IsDebug() ) printf(" Repeated S4 calibration at time %u obt %u pkt %u \n",fromtime,obt,pkt); |
if ( IsDebug() ) printf(" Repeated S4 calibration at time %u obt %u pkt %u \n",fromtime,obt,pkt); |
4011 |
|
if ( PEDANTIC ) throw -82; |
4012 |
// |
// |
4013 |
}; |
}; |
4014 |
// |
// |
4145 |
// |
// |
4146 |
} else { |
} else { |
4147 |
if ( IsDebug() ) printf(" The already exist in the GL_RUN table! \n"); |
if ( IsDebug() ) printf(" The already exist in the GL_RUN table! \n"); |
4148 |
|
if ( PEDANTIC ) throw -83; |
4149 |
}; |
}; |
4150 |
if ( IsDebug() ) printf(" Delete run %s from the GL_RUN_FRAGMENTS table \n",row->GetField(0)); |
if ( IsDebug() ) printf(" Delete run %s from the GL_RUN_FRAGMENTS table \n",row->GetField(0)); |
4151 |
// |
// |
5223 |
* |
* |
5224 |
**/ |
**/ |
5225 |
UInt_t PamelaDBOperations::Check(){ |
UInt_t PamelaDBOperations::Check(){ |
5226 |
|
return(this->Check(0,0)); |
5227 |
|
} |
5228 |
|
|
5229 |
|
UInt_t PamelaDBOperations::Check(UInt_t from, UInt_t to){ |
5230 |
|
// |
5231 |
|
if ( IsDebug() ) printf(" from %u to %u \n",from,to); |
5232 |
// |
// |
5233 |
UInt_t test = 0; |
UInt_t test = 0; |
5234 |
// |
// |
5267 |
thisrht = (UInt_t)atoll(row->GetField(2)); |
thisrht = (UInt_t)atoll(row->GetField(2)); |
5268 |
thisrtt = (UInt_t)atoll(row->GetField(3)); |
thisrtt = (UInt_t)atoll(row->GetField(3)); |
5269 |
// |
// |
5270 |
|
if ( from > 0 && nid <= from ) goto ss; |
5271 |
|
if ( to > 0 && nid >= to ) goto ss; |
5272 |
|
// |
5273 |
if ( (UInt_t)atoll(row->GetField(4)) > 1 ){ |
if ( (UInt_t)atoll(row->GetField(4)) > 1 ){ |
5274 |
// |
// |
5275 |
// |
// |
5300 |
printf(" CHECK n.4 RUNs %u and %u HAVE SAME RUNHEADER \n",thisid,(UInt_t)atoll(row3->GetField(0))); |
printf(" CHECK n.4 RUNs %u and %u HAVE SAME RUNHEADER \n",thisid,(UInt_t)atoll(row3->GetField(0))); |
5301 |
row3 = result3->Next(); |
row3 = result3->Next(); |
5302 |
}; |
}; |
5303 |
|
// delete result3; |
5304 |
|
|
5305 |
}; |
}; |
5306 |
// |
// |
5307 |
oss.str(""); |
oss.str(""); |
5321 |
printf(" CHECK n.5 RUNs %u and %u HAVE SAME RUNTRAILER \n",thisid,(UInt_t)atoll(row3->GetField(0))); |
printf(" CHECK n.5 RUNs %u and %u HAVE SAME RUNTRAILER \n",thisid,(UInt_t)atoll(row3->GetField(0))); |
5322 |
row3 = result3->Next(); |
row3 = result3->Next(); |
5323 |
}; |
}; |
5324 |
|
// delete result3; |
5325 |
}; |
}; |
5326 |
// |
// |
5327 |
oss.str(""); |
oss.str(""); |
5341 |
printf(" CHECK n.7 RUNs %u and %u HAVE SAME RUNTRAILER AND RUNHEADER (ARE THE SAME?) \n",thisid,(UInt_t)atoll(row3->GetField(0))); |
printf(" CHECK n.7 RUNs %u and %u HAVE SAME RUNTRAILER AND RUNHEADER (ARE THE SAME?) \n",thisid,(UInt_t)atoll(row3->GetField(0))); |
5342 |
row3 = result3->Next(); |
row3 = result3->Next(); |
5343 |
}; |
}; |
5344 |
|
// delete result3; |
5345 |
|
|
5346 |
}; |
}; |
5347 |
}; |
}; |
5348 |
// |
// |
5362 |
printf(" CHECK n.6 RUN %u CONTAINS RUN %u \n",thisid,(UInt_t)atoll(row3->GetField(0))); |
printf(" CHECK n.6 RUN %u CONTAINS RUN %u \n",thisid,(UInt_t)atoll(row3->GetField(0))); |
5363 |
row3 = result3->Next(); |
row3 = result3->Next(); |
5364 |
}; |
}; |
5365 |
|
// delete result3; |
5366 |
}; |
}; |
5367 |
// |
// |
5368 |
}; |
}; |
5388 |
thisf = (TString)row2->GetField(0); |
thisf = (TString)row2->GetField(0); |
5389 |
if ( IsDebug() ) printf(" ==> files %s and %s \n",prevf.Data(),thisf.Data()); |
if ( IsDebug() ) printf(" ==> files %s and %s \n",prevf.Data(),thisf.Data()); |
5390 |
test = 1; |
test = 1; |
5391 |
|
// delete result2; |
5392 |
}; |
}; |
5393 |
// |
// |
5394 |
if ( (thisrtt < prevrht) && (thisrht != prevrht) ){ |
if ( (thisrtt < prevrht) && (thisrht != prevrht) ){ |
5410 |
thisf = (TString)row2->GetField(0); |
thisf = (TString)row2->GetField(0); |
5411 |
if ( IsDebug() ) printf(" ==> files %s and %s \n",prevf.Data(),thisf.Data()); |
if ( IsDebug() ) printf(" ==> files %s and %s \n",prevf.Data(),thisf.Data()); |
5412 |
test = 1; |
test = 1; |
5413 |
|
// delete result2; |
5414 |
}; |
}; |
5415 |
// |
// |
5416 |
if ( (thisrht > thisrtt) && (thisrht != prevrht) ){ |
if ( (thisrht > thisrtt) && (thisrht != prevrht) ){ |
5432 |
thisf = (TString)row2->GetField(0); |
thisf = (TString)row2->GetField(0); |
5433 |
if ( IsDebug() ) printf(" ==> files %s and %s \n",prevf.Data(),thisf.Data()); |
if ( IsDebug() ) printf(" ==> files %s and %s \n",prevf.Data(),thisf.Data()); |
5434 |
test = 1; |
test = 1; |
5435 |
|
// delete result2; |
5436 |
}; |
}; |
5437 |
|
ss: |
5438 |
// |
// |
5439 |
prevrht = thisrht; |
prevrht = thisrht; |
5440 |
prevrtt = thisrtt; |
prevrtt = thisrtt; |
5441 |
previd = thisid; |
previd = thisid; |
5442 |
prevl0id = thisl0id; |
prevl0id = thisl0id; |
5443 |
row = result->Next(); |
row = result->Next(); |
5444 |
|
// if ( result2 ) delete result2; |
5445 |
|
// if ( result3 ) delete result3; |
5446 |
}; |
}; |
5447 |
// |
// |
5448 |
return(test); |
return(test); |