| 9 |
// ROOT headers |
// ROOT headers |
| 10 |
// |
// |
| 11 |
//#include <TCanvas.h> |
//#include <TCanvas.h> |
| 12 |
//#include <TH2F.h> //for test only. Vitaly. |
#include <TH2F.h> //for test only. Vitaly. |
| 13 |
|
#include <TVector3.h> |
| 14 |
//#include <TF1.h> |
//#include <TF1.h> |
| 15 |
|
|
| 16 |
#include <TTree.h> |
#include <TTree.h> |
| 66 |
stringstream myquery; |
stringstream myquery; |
| 67 |
myquery.str(""); |
myquery.str(""); |
| 68 |
myquery << "SET time_zone='+0:00'"; |
myquery << "SET time_zone='+0:00'"; |
| 69 |
dbc->Query(myquery.str().c_str()); |
delete dbc->Query(myquery.str().c_str()); |
| 70 |
// |
// |
| 71 |
TString processFolder = Form("OrbitalInfoFolder_%u",run); |
TString processFolder = Form("OrbitalInfoFolder_%u",run); |
| 72 |
// |
// |
| 122 |
TTree *OrbitalInfotrclone = 0; |
TTree *OrbitalInfotrclone = 0; |
| 123 |
Bool_t reproc = false; |
Bool_t reproc = false; |
| 124 |
Bool_t reprocall = false; |
Bool_t reprocall = false; |
| 125 |
|
Bool_t igrfloaded = false; |
| 126 |
UInt_t nobefrun = 0; |
UInt_t nobefrun = 0; |
| 127 |
UInt_t noaftrun = 0; |
UInt_t noaftrun = 0; |
| 128 |
UInt_t numbofrun = 0; |
UInt_t numbofrun = 0; |
| 130 |
TString fname; |
TString fname; |
| 131 |
UInt_t totfileentries = 0; |
UInt_t totfileentries = 0; |
| 132 |
UInt_t idRun = 0; |
UInt_t idRun = 0; |
| 133 |
|
UInt_t anni5 = 60 * 60 * 24 * 365 * 5 ;//1576800 |
| 134 |
// |
// |
| 135 |
// My variables. Vitaly. |
// My variables. Vitaly. |
| 136 |
// |
// |
| 183 |
// |
// |
| 184 |
// IGRF stuff |
// IGRF stuff |
| 185 |
// |
// |
| 186 |
Float_t dimo = 0.0; // dipole moment (computed from dat files) |
Double_t dimo = 0.0; // dipole moment (computed from dat files) // EM GCC 4.7 |
| 187 |
Float_t bnorth, beast, bdown, babs; |
Float_t bnorth, beast, bdown, babs; |
| 188 |
Float_t xl; // L value |
Float_t xl; // L value |
| 189 |
Float_t icode; // code value for L accuracy (see fortran code) |
Float_t icode; // code value for L accuracy (see fortran code) |
| 226 |
// |
// |
| 227 |
//Quaternions classes |
//Quaternions classes |
| 228 |
// |
// |
| 229 |
Quaternions *L_QQ_Q_l_lower = new Quaternions(); |
Quaternions *L_QQ_Q_l_lower = 0; |
| 230 |
InclinationInfo *RYPang_lower = new InclinationInfo(); |
InclinationInfo *RYPang_lower = 0; |
| 231 |
Quaternions *L_QQ_Q_l_upper = new Quaternions(); |
Quaternions *L_QQ_Q_l_upper = 0; |
| 232 |
InclinationInfo *RYPang_upper = new InclinationInfo(); |
InclinationInfo *RYPang_upper = 0; |
| 233 |
|
|
| 234 |
cEci eCi; |
cEci eCi; |
| 235 |
|
|
| 236 |
// Initialize fortran routines!!! |
// Initialize fortran routines!!! |
| 237 |
|
Int_t ltp1 = 0; |
| 238 |
Int_t ltp2 = 0; |
Int_t ltp2 = 0; |
| 239 |
Int_t ltp3 = 0; |
Int_t ltp3 = 0; |
| 240 |
Int_t uno = 1; |
// Int_t uno = 1; |
| 241 |
const char *niente = " "; |
// const char *niente = " "; |
| 242 |
GL_PARAM *glparam = new GL_PARAM(); |
GL_PARAM *glparam = new GL_PARAM(); |
| 243 |
GL_PARAM *glparam2 = new GL_PARAM(); |
GL_PARAM *glparam2 = new GL_PARAM(); |
| 244 |
|
GL_PARAM *glparam3 = new GL_PARAM(); |
| 245 |
|
|
| 246 |
// |
// |
| 247 |
// Orientation variables. Vitaly |
// Orientation variables. Vitaly |
| 249 |
UInt_t evfrom = 0; |
UInt_t evfrom = 0; |
| 250 |
UInt_t jumped = 0; |
UInt_t jumped = 0; |
| 251 |
Int_t itr = -1; |
Int_t itr = -1; |
| 252 |
Double_t A1; |
// Double_t A1; |
| 253 |
Double_t A2; |
// Double_t A2; |
| 254 |
Double_t A3; |
// Double_t A3; |
| 255 |
Double_t Px = 0; |
Double_t Px = 0; |
| 256 |
Double_t Py = 0; |
Double_t Py = 0; |
| 257 |
Double_t Pz = 0; |
Double_t Pz = 0; |
| 275 |
if ( parerror<0 ) { |
if ( parerror<0 ) { |
| 276 |
code = parerror; |
code = parerror; |
| 277 |
goto closeandexit; |
goto closeandexit; |
| 278 |
}; |
} |
| 279 |
while(!in.eof()){ |
while(!in.eof()){ |
| 280 |
recqtime.resize(recqtime.size()+1); |
recqtime.resize(recqtime.size()+1); |
| 281 |
Int_t sizee = recqtime.size(); |
Int_t sizee = recqtime.size(); |
| 292 |
} |
} |
| 293 |
if ( verbose ) cout<<"We have read recovered data"<<endl; |
if ( verbose ) cout<<"We have read recovered data"<<endl; |
| 294 |
|
|
| 295 |
|
// IGRF stuff moved inside run loop! |
| 296 |
|
|
|
parerror=glparam->Query_GL_PARAM(1,301,dbc); // parameters stored in DB in GL_PRAM table |
|
|
if ( parerror<0 ) { |
|
|
code = parerror; |
|
|
goto closeandexit; |
|
|
}; |
|
|
ltp2 = (Int_t)(glparam->PATH+glparam->NAME).Length(); |
|
|
if ( verbose ) printf(" Reading Earth's Magnetic Field parameter file: %s \n",(glparam->PATH+glparam->NAME).Data()); |
|
|
// |
|
|
parerror=glparam2->Query_GL_PARAM(1,302,dbc); // parameters stored in DB in GL_PRAM table |
|
|
if ( parerror<0 ) { |
|
|
code = parerror; |
|
|
goto closeandexit; |
|
|
}; |
|
|
ltp3 = (Int_t)(glparam2->PATH+glparam2->NAME).Length(); |
|
|
if ( verbose ) printf(" Reading Earth's Magnetic Field parameter file: %s \n",(glparam2->PATH+glparam2->NAME).Data()); |
|
|
// |
|
|
initize_((char *)niente,&uno,(char *)(glparam->PATH+glparam->NAME).Data(),<p2,(char *)(glparam2->PATH+glparam2->NAME).Data(),<p3); |
|
|
// |
|
|
// End IGRF stuff// |
|
|
// |
|
| 297 |
for (Int_t ip=0;ip<nz;ip++){ |
for (Int_t ip=0;ip<nz;ip++){ |
| 298 |
zin[ip] = tof->GetZTOF(tof->GetToFPlaneID(ip)); |
zin[ip] = tof->GetZTOF(tof->GetToFPlaneID(ip)); |
| 299 |
}; |
}; |
| 399 |
// |
// |
| 400 |
reprocall = true; |
reprocall = true; |
| 401 |
// |
// |
| 402 |
if (verbose) printf("\n OrbitalInfo - WARNING: Reprocessing all runs\n"); |
if (verbose) printf("\n OrbitalInfo - WARNING: Reprocessing all runs\n Deleting old tree...\n"); |
| 403 |
// |
// |
| 404 |
} else { |
} else { |
| 405 |
// |
// |
| 417 |
tempOrbitalInfo = OrbitalInfotrclone->CloneTree(-1,"fast"); |
tempOrbitalInfo = OrbitalInfotrclone->CloneTree(-1,"fast"); |
| 418 |
tempOrbitalInfo->SetName("OrbitalInfo-old"); |
tempOrbitalInfo->SetName("OrbitalInfo-old"); |
| 419 |
tempfile->Write(); |
tempfile->Write(); |
| 420 |
|
tempOrbitalInfo->Delete(); |
| 421 |
tempfile->Close(); |
tempfile->Close(); |
| 422 |
} |
} |
| 423 |
// |
// |
| 424 |
// Delete the old tree from old file and memory |
// Delete the old tree from old file and memory |
| 425 |
// |
// |
| 426 |
|
OrbitalInfotrclone->Clear(); |
| 427 |
OrbitalInfotrclone->Delete("all"); |
OrbitalInfotrclone->Delete("all"); |
| 428 |
// |
// |
| 429 |
if (verbose) printf(" ...done!\n"); |
if (verbose) printf(" ...done!\n"); |
| 469 |
// |
// |
| 470 |
}; |
}; |
| 471 |
if (verbose) printf(" Finished successful copying!\n"); |
if (verbose) printf(" Finished successful copying!\n"); |
| 472 |
}; |
}; |
| 473 |
}; |
}; |
| 474 |
// |
// |
| 475 |
// |
// |
| 480 |
// Loop over the run to be processed |
// Loop over the run to be processed |
| 481 |
// |
// |
| 482 |
for (UInt_t irun=0; irun < numbofrun; irun++){ |
for (UInt_t irun=0; irun < numbofrun; irun++){ |
| 483 |
|
|
| 484 |
|
L_QQ_Q_l_lower = new Quaternions(); |
| 485 |
|
RYPang_lower = new InclinationInfo(); |
| 486 |
|
L_QQ_Q_l_upper = new Quaternions(); |
| 487 |
|
RYPang_upper = new InclinationInfo(); |
| 488 |
|
|
| 489 |
// |
// |
| 490 |
// retrieve the first run ID to be processed using the RunInfo list |
// retrieve the first run ID to be processed using the RunInfo list |
| 491 |
// |
// |
| 548 |
// |
// |
| 549 |
// if ( !totevent ) goto closeandexit; |
// if ( !totevent ) goto closeandexit; |
| 550 |
// Open Level0 file |
// Open Level0 file |
| 551 |
|
if ( l0File ) l0File->Close(); |
| 552 |
l0File = new TFile(fname.Data()); |
l0File = new TFile(fname.Data()); |
| 553 |
if ( !l0File ) { |
if ( !l0File ) { |
| 554 |
if ( debug ) printf(" OrbitalInfo - ERROR: problems opening Level0 file\n"); |
if ( debug ) printf(" OrbitalInfo - ERROR: problems opening Level0 file\n"); |
| 587 |
code = -12; |
code = -12; |
| 588 |
goto closeandexit; |
goto closeandexit; |
| 589 |
}; |
}; |
| 590 |
|
|
| 591 |
|
// |
| 592 |
|
// open IGRF files and do it only once if we are processing a full level2 file |
| 593 |
|
// |
| 594 |
|
if ( reprocall && !igrfloaded ){ |
| 595 |
|
|
| 596 |
|
if ( l0head->GetEntry(runinfo->EV_FROM) > 0 ){ |
| 597 |
|
igrfloaded = true; |
| 598 |
|
// |
| 599 |
|
// absolute time of first event of the run (it should not matter a lot) |
| 600 |
|
// |
| 601 |
|
ph = eh->GetPscuHeader(); |
| 602 |
|
atime = dbtime->DBabsTime(ph->GetOrbitalTime()); |
| 603 |
|
|
| 604 |
|
parerror=glparam->Query_GL_PARAM(atime-anni5,301,dbc); // parameters stored in DB in GL_PRAM table |
| 605 |
|
if ( parerror<0 ) { |
| 606 |
|
code = parerror; |
| 607 |
|
goto closeandexit; |
| 608 |
|
} |
| 609 |
|
ltp1 = (Int_t)(glparam->PATH+glparam->NAME).Length(); |
| 610 |
|
if ( verbose ) printf(" Reading Earth's Magnetic Field parameter file: %s \n",(glparam->PATH+glparam->NAME).Data()); |
| 611 |
|
// |
| 612 |
|
parerror=glparam2->Query_GL_PARAM(atime,301,dbc); // parameters stored in DB in GL_PRAM table |
| 613 |
|
if ( parerror<0 ) { |
| 614 |
|
code = parerror; |
| 615 |
|
goto closeandexit; |
| 616 |
|
} |
| 617 |
|
ltp2 = (Int_t)(glparam2->PATH+glparam2->NAME).Length(); |
| 618 |
|
if ( verbose ) printf(" Reading Earth's Magnetic Field parameter file: %s \n",(glparam2->PATH+glparam2->NAME).Data()); |
| 619 |
|
// |
| 620 |
|
parerror=glparam3->Query_GL_PARAM(atime,302,dbc); // parameters stored in DB in GL_PRAM table |
| 621 |
|
if ( parerror<0 ) { |
| 622 |
|
code = parerror; |
| 623 |
|
goto closeandexit; |
| 624 |
|
} |
| 625 |
|
ltp3 = (Int_t)(glparam3->PATH+glparam3->NAME).Length(); |
| 626 |
|
if ( verbose ) printf(" Reading Earth's Magnetic Field parameter file: %s \n",(glparam3->PATH+glparam3->NAME).Data()); |
| 627 |
|
// |
| 628 |
|
initize_((char *)(glparam->PATH+glparam->NAME).Data(),<p1,(char *)(glparam2->PATH+glparam2->NAME).Data(),<p2,(char *)(glparam3->PATH+glparam3->NAME).Data(),<p3); |
| 629 |
|
// |
| 630 |
|
} |
| 631 |
|
} |
| 632 |
|
// |
| 633 |
|
// End IGRF stuff// |
| 634 |
|
// |
| 635 |
|
|
| 636 |
// |
// |
| 637 |
// TTree *tp = (TTree*)l0File->Get("RunHeader"); |
// TTree *tp = (TTree*)l0File->Get("RunHeader"); |
| 638 |
// tp->SetBranchAddress("Header", &eH); |
// tp->SetBranchAddress("Header", &eH); |
| 755 |
|
|
| 756 |
// UInt_t mctren = 0; |
// UInt_t mctren = 0; |
| 757 |
// UInt_t mcreen = 0; |
// UInt_t mcreen = 0; |
| 758 |
UInt_t numrec = 0; |
// UInt_t numrec = 0; |
| 759 |
// |
// |
| 760 |
Double_t upperqtime = 0; |
// Double_t upperqtime = 0; |
| 761 |
Double_t lowerqtime = 0; |
Double_t lowerqtime = 0; |
| 762 |
|
|
| 763 |
// Double_t incli = 0; |
// Double_t incli = 0; |
| 764 |
// oi = 0; |
// oi = 0; |
| 765 |
// UInt_t ooi = 0; |
// UInt_t ooi = 0; |
| 766 |
// |
// |
| 767 |
// init quaternions information from mcmd-packets |
// init quaternions information from mcmd-packets |
| 768 |
// |
// |
| 769 |
Bool_t isf = true; |
Bool_t isf = true; |
| 770 |
// Int_t fgh = 0; |
// Int_t fgh = 0; |
| 771 |
|
|
| 772 |
vector<Float_t> q0; |
vector<Float_t> q0; |
| 773 |
vector<Float_t> q1; |
vector<Float_t> q1; |
| 891 |
+ (hour*3600.+min*60.+(float)sec)/(24.*3600.*365.); |
+ (hour*3600.+min*60.+(float)sec)/(24.*3600.*365.); |
| 892 |
// |
// |
| 893 |
if ( debug ) printf(" %i compute magnetic dipole moment get dipole moment for year\n",procev); |
if ( debug ) printf(" %i compute magnetic dipole moment get dipole moment for year\n",procev); |
| 894 |
|
if ( debug ) printf(" %i jyear %f dimo %f \n",procev,jyear,dimo); |
| 895 |
feldcof_(&jyear, &dimo); // get dipole moment for year |
feldcof_(&jyear, &dimo); // get dipole moment for year |
| 896 |
if ( debug ) printf(" %i compute magnetic dipole moment end\n",procev); |
if ( debug ) printf(" %i compute magnetic dipole moment end\n",procev); |
| 897 |
} else { |
} else { |
| 912 |
// First event |
// First event |
| 913 |
// |
// |
| 914 |
isf = false; |
isf = false; |
| 915 |
upperqtime = atime; |
// upperqtime = atime; |
| 916 |
lowerqtime = runinfo->RUNHEADER_TIME; |
lowerqtime = runinfo->RUNHEADER_TIME; |
| 917 |
for ( ik = 0; ik < neventsm; ik++){ //number of macrocommad packets |
for ( ik = 0; ik < neventsm; ik++){ //number of macrocommad packets |
| 918 |
if ( ch->GetEntry(ik) <= 0 ) throw -36; |
if ( ch->GetEntry(ik) <= 0 ) throw -36; |
| 919 |
tmpSize = mcmdev->Records->GetEntries(); |
tmpSize = mcmdev->Records->GetEntries(); |
| 920 |
numrec = tmpSize; |
// numrec = tmpSize; |
| 921 |
for (Int_t j3 = 0;j3<tmpSize;j3++){ //number of subpackets |
for (Int_t j3 = 0;j3<tmpSize;j3++){ //number of subpackets |
| 922 |
if ( debug ) printf(" ik %i j3 %i eh eh eh \n",ik,j3); |
if ( debug ) printf(" ik %i j3 %i eh eh eh \n",ik,j3); |
| 923 |
mcmdrc = (pamela::McmdRecord*)mcmdev->Records->At(j3); |
mcmdrc = (pamela::McmdRecord*)mcmdev->Records->At(j3); |
| 928 |
for (UInt_t ui = 0; ui < 6; ui++){ |
for (UInt_t ui = 0; ui < 6; ui++){ |
| 929 |
if (ui>0){ |
if (ui>0){ |
| 930 |
if (L_QQ_Q_l_upper->time[ui]>L_QQ_Q_l_upper->time[0]){ |
if (L_QQ_Q_l_upper->time[ui]>L_QQ_Q_l_upper->time[0]){ |
| 931 |
if ( debug ) printf(" here1 %i \n",ui); |
if ( debug ) printf(" here1 %i \n",ui); |
| 932 |
Double_t u_time = dbtime->DBabsTime((UInt_t)(L_QQ_Q_l_upper->time[ui]*1000-DeltaOBT*1000)); |
Double_t u_time = dbtime->DBabsTime((UInt_t)(L_QQ_Q_l_upper->time[ui]*1000-DeltaOBT*1000)); |
| 933 |
Int_t recSize = recqtime.size(); |
Int_t recSize = recqtime.size(); |
| 934 |
|
if(lowerqtime > recqtime[recSize-1]){ |
| 935 |
|
Int_t sizeqmcmd = qtime.size(); |
| 936 |
|
inclresize(qtime,q0,q1,q2,q3,qmode,qRoll,qPitch,qYaw); |
| 937 |
|
qtime[sizeqmcmd]=u_time; |
| 938 |
|
q0[sizeqmcmd]=L_QQ_Q_l_upper->quat[ui][0]; |
| 939 |
|
q1[sizeqmcmd]=L_QQ_Q_l_upper->quat[ui][1]; |
| 940 |
|
q2[sizeqmcmd]=L_QQ_Q_l_upper->quat[ui][2]; |
| 941 |
|
q3[sizeqmcmd]=L_QQ_Q_l_upper->quat[ui][3]; |
| 942 |
|
qmode[sizeqmcmd]=holeq(lowerqtime,qtime[sizeqmcmd],L_QQ_Q_l_lower,L_QQ_Q_l_upper,ui); |
| 943 |
|
lowerqtime = u_time; |
| 944 |
|
orbits.getPosition((double) (u_time - gltle->GetFromTime())/60., &eCi); |
| 945 |
|
RYPang_upper->TransAngle(eCi.getPos().m_x,eCi.getPos().m_y,eCi.getPos().m_z,eCi.getVel().m_x,eCi.getVel().m_y,eCi.getVel().m_z,L_QQ_Q_l_upper->quat[ui][0],L_QQ_Q_l_upper->quat[ui][1],L_QQ_Q_l_upper->quat[ui][2],L_QQ_Q_l_upper->quat[ui][3]); |
| 946 |
|
qRoll[sizeqmcmd]=RYPang_upper->Kren; |
| 947 |
|
qYaw[sizeqmcmd]=RYPang_upper->Ryskanie; |
| 948 |
|
qPitch[sizeqmcmd]=RYPang_upper->Tangazh; |
| 949 |
|
} |
| 950 |
for(Int_t mu = nt;mu<recSize;mu++){ |
for(Int_t mu = nt;mu<recSize;mu++){ |
| 951 |
if(recqtime[mu]>lowerqtime && recqtime[mu]<u_time){ |
if(recqtime[mu]>lowerqtime && recqtime[mu]<u_time){ |
| 952 |
nt=mu; |
nt=mu; |
| 984 |
} |
} |
| 985 |
} |
} |
| 986 |
}else{ |
}else{ |
| 987 |
if ( debug ) printf(" here2 %i \n",ui); |
if ( debug ) printf(" here2 %i \n",ui); |
| 988 |
Double_t u_time = dbtime->DBabsTime((UInt_t)(L_QQ_Q_l_upper->time[0]*1000-DeltaOBT*1000)); |
Double_t u_time = dbtime->DBabsTime((UInt_t)(L_QQ_Q_l_upper->time[0]*1000-DeltaOBT*1000)); |
| 989 |
if(lowerqtime>u_time)nt=0; |
if(lowerqtime>u_time)nt=0; |
| 990 |
Int_t recSize = recqtime.size(); |
Int_t recSize = recqtime.size(); |
| 991 |
|
if(lowerqtime > recqtime[recSize-1]){ |
| 992 |
|
Int_t sizeqmcmd = qtime.size(); |
| 993 |
|
inclresize(qtime,q0,q1,q2,q3,qmode,qRoll,qPitch,qYaw); |
| 994 |
|
qtime[sizeqmcmd]=u_time; |
| 995 |
|
q0[sizeqmcmd]=L_QQ_Q_l_upper->quat[0][0]; |
| 996 |
|
q1[sizeqmcmd]=L_QQ_Q_l_upper->quat[0][1]; |
| 997 |
|
q2[sizeqmcmd]=L_QQ_Q_l_upper->quat[0][2]; |
| 998 |
|
q3[sizeqmcmd]=L_QQ_Q_l_upper->quat[0][3]; |
| 999 |
|
qmode[sizeqmcmd]=holeq(lowerqtime,qtime[sizeqmcmd],L_QQ_Q_l_lower,L_QQ_Q_l_upper,ui); |
| 1000 |
|
lowerqtime = u_time; |
| 1001 |
|
orbits.getPosition((double) (u_time - gltle->GetFromTime())/60., &eCi); |
| 1002 |
|
RYPang_upper->TransAngle(eCi.getPos().m_x,eCi.getPos().m_y,eCi.getPos().m_z,eCi.getVel().m_x,eCi.getVel().m_y,eCi.getVel().m_z,L_QQ_Q_l_upper->quat[0][0],L_QQ_Q_l_upper->quat[0][1],L_QQ_Q_l_upper->quat[0][2],L_QQ_Q_l_upper->quat[0][3]); |
| 1003 |
|
qRoll[sizeqmcmd]=RYPang_upper->Kren; |
| 1004 |
|
qYaw[sizeqmcmd]=RYPang_upper->Ryskanie; |
| 1005 |
|
qPitch[sizeqmcmd]=RYPang_upper->Tangazh; |
| 1006 |
|
} |
| 1007 |
for(Int_t mu = nt;mu<recSize;mu++){ |
for(Int_t mu = nt;mu<recSize;mu++){ |
| 1008 |
if(recqtime[mu]>lowerqtime && recqtime[mu]<u_time){ |
if(recqtime[mu]>lowerqtime && recqtime[mu]<u_time){ |
| 1009 |
nt=mu; |
nt=mu; |
| 1049 |
} |
} |
| 1050 |
|
|
| 1051 |
if(qtime.size()==0){ |
if(qtime.size()==0){ |
| 1052 |
for(UInt_t my=0;my<recqtime.size();my++){ |
for(UInt_t my=0;my<recqtime.size();my++){ |
| 1053 |
Int_t sizeqmcmd = qtime.size(); |
Int_t sizeqmcmd = qtime.size(); |
| 1054 |
inclresize(qtime,q0,q1,q2,q3,qmode,qRoll,qPitch,qYaw); |
inclresize(qtime,q0,q1,q2,q3,qmode,qRoll,qPitch,qYaw); |
| 1055 |
qtime[sizeqmcmd]=recqtime[my]; |
qtime[sizeqmcmd]=recqtime[my]; |
| 1056 |
q0[sizeqmcmd]=recq0[my]; |
q0[sizeqmcmd]=recq0[my]; |
| 1057 |
q1[sizeqmcmd]=recq1[my]; |
q1[sizeqmcmd]=recq1[my]; |
| 1058 |
q2[sizeqmcmd]=recq2[my]; |
q2[sizeqmcmd]=recq2[my]; |
| 1059 |
q3[sizeqmcmd]=recq3[my]; |
q3[sizeqmcmd]=recq3[my]; |
| 1060 |
qmode[sizeqmcmd]=-10; |
qmode[sizeqmcmd]=-10; |
| 1061 |
orbits.getPosition((double) (qtime[sizeqmcmd] - gltle->GetFromTime())/60., &eCi); |
orbits.getPosition((double) (qtime[sizeqmcmd] - gltle->GetFromTime())/60., &eCi); |
| 1062 |
RYPang_upper->TransAngle(eCi.getPos().m_x,eCi.getPos().m_y,eCi.getPos().m_z,eCi.getVel().m_x,eCi.getVel().m_y,eCi.getVel().m_z,recq0[my],recq1[my],recq2[my],recq3[my]); |
RYPang_upper->TransAngle(eCi.getPos().m_x,eCi.getPos().m_y,eCi.getPos().m_z,eCi.getVel().m_x,eCi.getVel().m_y,eCi.getVel().m_z,recq0[my],recq1[my],recq2[my],recq3[my]); |
| 1063 |
qRoll[sizeqmcmd]=RYPang_upper->Kren; |
qRoll[sizeqmcmd]=RYPang_upper->Kren; |
| 1064 |
qYaw[sizeqmcmd]=RYPang_upper->Ryskanie; |
qYaw[sizeqmcmd]=RYPang_upper->Ryskanie; |
| 1065 |
qPitch[sizeqmcmd]=RYPang_upper->Tangazh; |
qPitch[sizeqmcmd]=RYPang_upper->Tangazh; |
| 1066 |
} |
} |
| 1067 |
} |
} |
| 1068 |
|
|
| 1069 |
if ( debug ) printf(" fuffi \n"); |
if ( debug ) printf(" fuffi \n"); |
| 1070 |
sineparam(q0sine,qtime,q0,qRoll,qPitch,0.60); |
|
|
sineparam(q1sine,qtime,q1,qRoll,qPitch,0.82); |
|
|
sineparam(q2sine,qtime,q2,qRoll,qPitch,0.82); |
|
|
sineparam(q3sine,qtime,q3,qRoll,qPitch,0.60); |
|
|
sineparam(Yawsine,qtime,qYaw,qRoll,qPitch,4); |
|
| 1071 |
if ( debug ) printf(" puffi \n"); |
if ( debug ) printf(" puffi \n"); |
| 1072 |
Double_t tmin = 9999999999.; |
Double_t tmin = 9999999999.; |
| 1073 |
Double_t tmax = 0.; |
Double_t tmax = 0.; |
| 1077 |
} |
} |
| 1078 |
if ( debug ) printf(" gnfuffi \n"); |
if ( debug ) printf(" gnfuffi \n"); |
| 1079 |
|
|
|
//q0testing->SetName("q0testing"); |
|
|
//q1testing->SetName("q1testing"); |
|
|
//q2testing->SetName("q2testing"); |
|
|
//q3testing->SetName("q3testing"); |
|
|
|
|
|
// Int_t ss=10.*(tmax-tmin); |
|
|
//q0testing->SetBins(ss,tmin,tmax,1000,-1.,1.); |
|
|
//Pitchtesting->SetBins(ss,tmin,tmax,1000,-40.,40.); |
|
|
|
|
|
// for(Int_t tre = 0;tre<qtime.size();tre++){ |
|
|
//cout<<"q0["<<tre<<" = "<<q0[tre]<<endl; |
|
|
//q0testing->Fill(qtime[tre],q0[tre]); |
|
|
//q1testing->Fill(qtime[tre],q1[tre]); |
|
|
//Pitchtesting->Fill(qtime[tre],qPitch[tre],100); |
|
|
//if(qmode[tre] == -10)Pitchtesting->Fill(qtime[tre],10,100); |
|
|
//q2testing->Fill(qtime[tre],q2[tre],100); |
|
|
//q3testing->Fill(qtime[tre],q3[tre],100); |
|
|
// } |
|
|
|
|
|
//for(Int_t tre=0;tre<q0sine.size();tre++)cout<<q1sine[tre].A<<"*sin("<<q1sine[tre].b<<"x+"<<q1sine[tre].c<<")\t time start: "<<q1sine[tre].startPoint<<"\ttime end: "<<q1sine[tre].finishPoint<<endl; |
|
|
//for(Int_t tre=0;tre<q0sine.size();tre++)cout<<q1sine[tre].A<<"*sin("<<q1sine[tre].b<<"x+"<<q1sine[tre].c<<")\t time start: "<<q0sine[tre].startPoint<<"\ttime end: "<<q0sine[tre].finishPoint<<endl; |
|
| 1080 |
} // if we processed first event |
} // if we processed first event |
| 1081 |
|
|
| 1082 |
|
|
| 1083 |
//Filling Inclination information |
//Filling Inclination information |
| 1084 |
Double_t incli = 0; |
Double_t incli = 0; |
| 1085 |
if ( qtime.size() > 1 ){ |
if ( qtime.size() > 1 ){ |
| 1086 |
for(UInt_t mu = must;mu<qtime.size()-1;mu++){ |
for(UInt_t mu = must;mu<qtime.size()-1;mu++){ |
| 1087 |
if ( debug ) printf(" ??grfuffi %i sixe %i must %i \n",mu,qtime.size()-1,must); |
if ( debug ) printf(" ??grfuffi %i sixe %i must %i \n",mu,qtime.size()-1,must); |
| 1088 |
if(qtime[mu+1]>qtime[mu]){ |
if(qtime[mu+1]>qtime[mu]){ |
| 1089 |
if ( debug ) printf(" grfuffi2 %i \n",mu); |
if ( debug ) printf(" grfuffi2 %i \n",mu); |
| 1090 |
if(atime<=qtime[mu+1] && atime>=qtime[mu]){ |
if(atime<=qtime[mu+1] && atime>=qtime[mu]){ |
| 1091 |
must = mu; |
must = mu; |
| 1092 |
incli = (qPitch[mu+1]-qPitch[mu])/(qtime[mu+1]-qtime[mu]); |
if ( debug ) printf(" grfuffi3 %i \n",mu); |
| 1093 |
orbitalinfo->theta = incli*atime+qPitch[mu+1]-incli*qtime[mu+1]; |
incli = (qPitch[mu+1]-qPitch[mu])/(qtime[mu+1]-qtime[mu]); |
| 1094 |
incli = (qRoll[mu+1]-qRoll[mu])/(qtime[mu+1]-qtime[mu]); |
orbitalinfo->theta = incli*atime+qPitch[mu+1]-incli*qtime[mu+1]; |
| 1095 |
orbitalinfo->etha = incli*atime+qRoll[mu+1]-incli*qtime[mu+1]; |
incli = (qRoll[mu+1]-qRoll[mu])/(qtime[mu+1]-qtime[mu]); |
| 1096 |
incli = (qYaw[mu+1]-qYaw[mu])/(qtime[mu+1]-qtime[mu]); |
orbitalinfo->etha = incli*atime+qRoll[mu+1]-incli*qtime[mu+1]; |
| 1097 |
orbitalinfo->phi = incli*atime+qYaw[mu+1]-incli*qtime[mu+1]; |
incli = (qYaw[mu+1]-qYaw[mu])/(qtime[mu+1]-qtime[mu]); |
| 1098 |
|
orbitalinfo->phi = incli*atime+qYaw[mu+1]-incli*qtime[mu+1]; |
| 1099 |
incli = (q0[mu+1]-q0[mu])/(qtime[mu+1]-qtime[mu]); |
|
| 1100 |
orbitalinfo->q0t = incli*atime+q0[mu+1]-incli*qtime[mu+1]; |
incli = (q0[mu+1]-q0[mu])/(qtime[mu+1]-qtime[mu]); |
| 1101 |
incli = (q1[mu+1]-q1[mu])/(qtime[mu+1]-qtime[mu]); |
orbitalinfo->q0 = incli*atime+q0[mu+1]-incli*qtime[mu+1]; |
| 1102 |
orbitalinfo->q1t = incli*atime+q1[mu+1]-incli*qtime[mu+1]; |
incli = (q1[mu+1]-q1[mu])/(qtime[mu+1]-qtime[mu]); |
| 1103 |
incli = (q2[mu+1]-q2[mu])/(qtime[mu+1]-qtime[mu]); |
orbitalinfo->q1 = incli*atime+q1[mu+1]-incli*qtime[mu+1]; |
| 1104 |
orbitalinfo->q2t = incli*atime+q2[mu+1]-incli*qtime[mu+1]; |
incli = (q2[mu+1]-q2[mu])/(qtime[mu+1]-qtime[mu]); |
| 1105 |
incli = (q3[mu+1]-q3[mu])/(qtime[mu+1]-qtime[mu]); |
orbitalinfo->q2 = incli*atime+q2[mu+1]-incli*qtime[mu+1]; |
| 1106 |
orbitalinfo->q3t = incli*atime+q3[mu+1]-incli*qtime[mu+1]; |
incli = (q3[mu+1]-q3[mu])/(qtime[mu+1]-qtime[mu]); |
| 1107 |
|
orbitalinfo->q3 = incli*atime+q3[mu+1]-incli*qtime[mu+1]; |
| 1108 |
orbitalinfo->TimeGap = qtime[mu+1]-qtime[mu]; |
|
| 1109 |
orbitalinfo->mode = qmode[mu+1]; |
orbitalinfo->TimeGap = qtime[mu+1]-qtime[mu]; |
| 1110 |
if(qmode[mu+1]==-10) orbitalinfo->R10r = true;else orbitalinfo->R10r = false; |
orbitalinfo->mode = qmode[mu+1]; |
| 1111 |
if(qmode[mu+1]==-10 || qmode[mu+1]==0 || qmode[mu+1]==1 || qmode[mu+1]==3 || qmode[mu+1]==4 || qmode[mu+1]==6){ |
//if(qmode[mu+1]==-10) orbitalinfo->R10r = true;else orbitalinfo->R10r = false; |
| 1112 |
|
//reserved for next versions Vitaly. |
| 1113 |
|
/*if(qmode[mu+1]==-10 || qmode[mu+1]==0 || qmode[mu+1]==1 || qmode[mu+1]==3 || qmode[mu+1]==4 || qmode[mu+1]==6){ |
| 1114 |
//linear interpolation |
//linear interpolation |
| 1115 |
incli = (q0[mu+1]-q0[mu])/(qtime[mu+1]-qtime[mu]); |
incli = (q0[mu+1]-q0[mu])/(qtime[mu+1]-qtime[mu]); |
| 1116 |
orbitalinfo->q0 = incli*atime+q0[mu+1]-incli*qtime[mu+1]; |
orbitalinfo->q0 = incli*atime+q0[mu+1]-incli*qtime[mu+1]; |
| 1120 |
orbitalinfo->q2 = incli*atime+q2[mu+1]-incli*qtime[mu+1]; |
orbitalinfo->q2 = incli*atime+q2[mu+1]-incli*qtime[mu+1]; |
| 1121 |
incli = (q3[mu+1]-q3[mu])/(qtime[mu+1]-qtime[mu]); |
incli = (q3[mu+1]-q3[mu])/(qtime[mu+1]-qtime[mu]); |
| 1122 |
orbitalinfo->q3 = incli*atime+q3[mu+1]-incli*qtime[mu+1]; |
orbitalinfo->q3 = incli*atime+q3[mu+1]-incli*qtime[mu+1]; |
| 1123 |
}else{ |
}else{ |
| 1124 |
//sine interpolation |
//sine interpolation |
| 1125 |
for(UInt_t mt=0;mt<q0sine.size();mt++){ |
for(UInt_t mt=0;mt<q0sine.size();mt++){ |
| 1126 |
if(atime<=q0sine[mt].finishPoint && atime>=q0sine[mt].startPoint){ |
if(atime<=q0sine[mt].finishPoint && atime>=q0sine[mt].startPoint){ |
| 1127 |
if(!q0sine[mt].NeedFit)orbitalinfo->q0=q0sine[mt].A*sin(q0sine[mt].b*atime+q0sine[mt].c);else{ |
if(!q0sine[mt].NeedFit)orbitalinfo->q0=q0sine[mt].A*sin(q0sine[mt].b*atime+q0sine[mt].c);else{ |
| 1128 |
incli = (q0[mu+1]-q0[mu])/(qtime[mu+1]-qtime[mu]); |
incli = (q0[mu+1]-q0[mu])/(qtime[mu+1]-qtime[mu]); |
| 1129 |
orbitalinfo->q0 = incli*atime+q0[mu+1]-incli*qtime[mu+1]; |
orbitalinfo->q0 = incli*atime+q0[mu+1]-incli*qtime[mu+1]; |
| 1130 |
} |
} |
| 1131 |
} |
} |
| 1132 |
if(atime<=q1sine[mt].finishPoint && atime>=q1sine[mt].startPoint){ |
if(atime<=q1sine[mt].finishPoint && atime>=q1sine[mt].startPoint){ |
| 1133 |
if(!q1sine[mt].NeedFit)orbitalinfo->q1=q1sine[mt].A*sin(q1sine[mt].b*atime+q1sine[mt].c);else{ |
if(!q1sine[mt].NeedFit)orbitalinfo->q1=q1sine[mt].A*sin(q1sine[mt].b*atime+q1sine[mt].c);else{ |
| 1134 |
incli = (q1[mu+1]-q1[mu])/(qtime[mu+1]-qtime[mu]); |
incli = (q1[mu+1]-q1[mu])/(qtime[mu+1]-qtime[mu]); |
| 1135 |
orbitalinfo->q1 = incli*atime+q1[mu+1]-incli*qtime[mu+1]; |
orbitalinfo->q1 = incli*atime+q1[mu+1]-incli*qtime[mu+1]; |
| 1136 |
} |
} |
| 1137 |
} |
} |
| 1138 |
if(atime<=q2sine[mt].finishPoint && atime>=q2sine[mt].startPoint){ |
if(atime<=q2sine[mt].finishPoint && atime>=q2sine[mt].startPoint){ |
| 1139 |
if(!q2sine[mt].NeedFit)orbitalinfo->q2=q0sine[mt].A*sin(q2sine[mt].b*atime+q2sine[mt].c);else{ |
if(!q2sine[mt].NeedFit)orbitalinfo->q2=q0sine[mt].A*sin(q2sine[mt].b*atime+q2sine[mt].c);else{ |
| 1140 |
incli = (q2[mu+1]-q2[mu])/(qtime[mu+1]-qtime[mu]); |
incli = (q2[mu+1]-q2[mu])/(qtime[mu+1]-qtime[mu]); |
| 1141 |
orbitalinfo->q2 = incli*atime+q2[mu+1]-incli*qtime[mu+1]; |
orbitalinfo->q2 = incli*atime+q2[mu+1]-incli*qtime[mu+1]; |
| 1142 |
} |
} |
| 1143 |
} |
} |
| 1144 |
if(atime<=q3sine[mt].finishPoint && atime>=q3sine[mt].startPoint){ |
if(atime<=q3sine[mt].finishPoint && atime>=q3sine[mt].startPoint){ |
| 1145 |
if(!q3sine[mt].NeedFit)orbitalinfo->q3=q0sine[mt].A*sin(q3sine[mt].b*atime+q3sine[mt].c);else{ |
if(!q3sine[mt].NeedFit)orbitalinfo->q3=q0sine[mt].A*sin(q3sine[mt].b*atime+q3sine[mt].c);else{ |
| 1146 |
incli = (q3[mu+1]-q3[mu])/(qtime[mu+1]-qtime[mu]); |
incli = (q3[mu+1]-q3[mu])/(qtime[mu+1]-qtime[mu]); |
| 1147 |
orbitalinfo->q3 = incli*atime+q3[mu+1]-incli*qtime[mu+1]; |
orbitalinfo->q3 = incli*atime+q3[mu+1]-incli*qtime[mu+1]; |
| 1148 |
} |
} |
| 1149 |
} |
} |
| 1150 |
if(atime<=Yawsine[mt].finishPoint && atime>=Yawsine[mt].startPoint){ |
if(atime<=Yawsine[mt].finishPoint && atime>=Yawsine[mt].startPoint){ |
| 1151 |
if(!Yawsine[mt].NeedFit)orbitalinfo->phi=Yawsine[mt].A*sin(Yawsine[mt].b*atime+Yawsine[mt].c);else{ |
if(!Yawsine[mt].NeedFit)orbitalinfo->phi=Yawsine[mt].A*sin(Yawsine[mt].b*atime+Yawsine[mt].c);else{ |
| 1152 |
incli = (qYaw[mu+1]-qYaw[mu])/(qtime[mu+1]-qtime[mu]); |
incli = (qYaw[mu+1]-qYaw[mu])/(qtime[mu+1]-qtime[mu]); |
| 1153 |
orbitalinfo->phi = incli*atime+qYaw[mu+1]-incli*qtime[mu+1]; |
orbitalinfo->phi = incli*atime+qYaw[mu+1]-incli*qtime[mu+1]; |
| 1154 |
} |
} |
| 1155 |
} |
} |
| 1156 |
} |
} |
| 1157 |
} |
}*/ |
| 1158 |
//q0testing->Fill(atime,orbitalinfo->q0,100); |
//q0testing->Fill(atime,orbitalinfo->q0,100); |
| 1159 |
//q1testing->Fill(atime,orbitalinfo->q1,100); |
//q1testing->Fill(atime,orbitalinfo->q1,100); |
| 1160 |
//Pitchtesting->Fill(atime,orbitalinfo->etha); |
//Pitchtesting->Fill(atime,orbitalinfo->etha); |
| 1161 |
//q2testing->Fill(atime,orbitalinfo->q2); |
//q2testing->Fill(atime,orbitalinfo->q2); |
| 1162 |
//q3testing->Fill(atime,orbitalinfo->q3); |
//q3testing->Fill(atime,orbitalinfo->q3); |
| 1163 |
break; |
if ( debug ) printf(" grfuffi4 %i \n",mu); |
| 1164 |
} |
break; |
| 1165 |
} |
} |
| 1166 |
} |
} |
| 1167 |
|
} |
| 1168 |
} |
} |
| 1169 |
|
if ( debug ) printf(" grfuffi5 \n"); |
| 1170 |
// |
// |
| 1171 |
// ops no inclination information |
// ops no inclination information |
| 1172 |
// |
// |
| 1173 |
|
|
| 1174 |
if ( orbitalinfo->q0< -999 || orbitalinfo->q1 < -999 || orbitalinfo->q2 < -999 || orbitalinfo->q3 < -999 || orbitalinfo->q0 != orbitalinfo->q0 || orbitalinfo->q1 != orbitalinfo->q1 || orbitalinfo->q2 != orbitalinfo->q2 || orbitalinfo->q3 != orbitalinfo->q3 ){ |
if ( orbitalinfo->q0< -999 || orbitalinfo->q1 < -999 || orbitalinfo->q2 < -999 || orbitalinfo->q3 < -999 || orbitalinfo->q0 != orbitalinfo->q0 || orbitalinfo->q1 != orbitalinfo->q1 || orbitalinfo->q2 != orbitalinfo->q2 || orbitalinfo->q3 != orbitalinfo->q3 ){ |
| 1175 |
orbitalinfo->mode = 10; |
orbitalinfo->mode = 10; |
| 1176 |
orbitalinfo->q0 = -1000.; |
orbitalinfo->q0 = -1000.; |
| 1180 |
orbitalinfo->etha = -1000.; |
orbitalinfo->etha = -1000.; |
| 1181 |
orbitalinfo->phi = -1000.; |
orbitalinfo->phi = -1000.; |
| 1182 |
orbitalinfo->theta = -1000.; |
orbitalinfo->theta = -1000.; |
| 1183 |
}; |
if ( debug ) printf(" grfuffi6 \n"); |
| 1184 |
|
} |
| 1185 |
// |
// |
| 1186 |
|
if ( debug ) printf(" filling \n"); |
| 1187 |
// ######################################################################################################################### |
// ######################################################################################################################### |
| 1188 |
// |
// |
| 1189 |
// fill orbital positions |
// fill orbital positions |
| 1194 |
lon = (coo.m_Lon > M_PI) ? rad2deg(coo.m_Lon - 2*M_PI) : rad2deg(coo.m_Lon); |
lon = (coo.m_Lon > M_PI) ? rad2deg(coo.m_Lon - 2*M_PI) : rad2deg(coo.m_Lon); |
| 1195 |
lat = rad2deg(coo.m_Lat); |
lat = rad2deg(coo.m_Lat); |
| 1196 |
alt = coo.m_Alt; |
alt = coo.m_Alt; |
| 1197 |
|
if ( debug ) printf(" coord done \n"); |
| 1198 |
// |
// |
| 1199 |
if( lon<180 && lon>-180 && lat<90 && lat>-90 && alt>0 ){ |
if( lon<180 && lon>-180 && lat<90 && lat>-90 && alt>0 ){ |
| 1200 |
// |
// |
| 1204 |
// |
// |
| 1205 |
// compute mag field components and L shell. |
// compute mag field components and L shell. |
| 1206 |
// |
// |
| 1207 |
|
if ( debug ) printf(" call igrf feldg \n"); |
| 1208 |
feldg_(&lat, &lon, &alt, &bnorth, &beast, &bdown, &babs); |
feldg_(&lat, &lon, &alt, &bnorth, &beast, &bdown, &babs); |
| 1209 |
|
if ( debug ) printf(" call igrf shellg \n"); |
| 1210 |
shellg_(&lat, &lon, &alt, &dimo, &xl, &icode, &bab1); |
shellg_(&lat, &lon, &alt, &dimo, &xl, &icode, &bab1); |
| 1211 |
|
if ( debug ) printf(" call igrf findb \n"); |
| 1212 |
findb0_(&stps, &bdel, &value, &bequ, &rr0); |
findb0_(&stps, &bdel, &value, &bequ, &rr0); |
| 1213 |
// |
// |
| 1214 |
|
if ( debug ) printf(" done igrf \n"); |
| 1215 |
orbitalinfo->Bnorth = bnorth; |
orbitalinfo->Bnorth = bnorth; |
| 1216 |
orbitalinfo->Beast = beast; |
orbitalinfo->Beast = beast; |
| 1217 |
orbitalinfo->Bdown = bdown; |
orbitalinfo->Bdown = bdown; |
| 1218 |
orbitalinfo->Babs = babs; |
orbitalinfo->Babs = babs; |
| 1219 |
|
orbitalinfo->M = dimo; |
| 1220 |
orbitalinfo->BB0 = babs/bequ; |
orbitalinfo->BB0 = babs/bequ; |
| 1221 |
orbitalinfo->L = xl; |
orbitalinfo->L = xl; |
| 1222 |
// Set Stormer vertical cutoff using L shell. |
// Set Stormer vertical cutoff using L shell. |
| 1223 |
orbitalinfo->cutoffsvl = 14.9/(xl*xl); |
orbitalinfo->cutoffsvl = 14.295 / (xl*xl); // |
| 1224 |
|
/* |
| 1225 |
|
---------- Forwarded message ---------- |
| 1226 |
|
Date: Wed, 09 May 2012 12:16:47 +0200 |
| 1227 |
|
From: Alessandro Bruno <alessandro.bruno@ba.infn.it> |
| 1228 |
|
To: Mirko Boezio <mirko.boezio@ts.infn.it> |
| 1229 |
|
Cc: Francesco S. Cafagna <Francesco.Cafagna@ba.infn.it> |
| 1230 |
|
Subject: Störmer vertical cutoff |
| 1231 |
|
|
| 1232 |
|
Ciao Mirko, |
| 1233 |
|
volevo segnalarti che il valore dello Störmer vertical cutoff nel Level2 č |
| 1234 |
|
sovrastimato di circa il 4%. |
| 1235 |
|
Dopo un'approfondita analisi con l'IGRF-05 abbiamo ricavano un valore pari |
| 1236 |
|
a: 14.295 / L^2 anzichč 14.9 / L^2, valore obsoleto in quanto riferito agli |
| 1237 |
|
anni '50. |
| 1238 |
|
*/ |
| 1239 |
|
//14.9/(xl*xl); |
| 1240 |
|
orbitalinfo->igrf_icode = icode; |
| 1241 |
// |
// |
| 1242 |
}; |
} |
| 1243 |
// |
// |
| 1244 |
if ( debug ) printf(" pitch angle \n"); |
if ( debug ) printf(" pitch angle \n"); |
| 1245 |
// |
// |
| 1246 |
// pitch angles |
// pitch angles |
| 1247 |
// |
// |
| 1248 |
if ( orbitalinfo->mode != 10 && orbitalinfo->mode != 5 && orbitalinfo->mode !=7 && orbitalinfo->mode != 9 ){ |
//if ( orbitalinfo->mode != 10 && orbitalinfo->mode != 5 && orbitalinfo->mode !=7 && orbitalinfo->mode != 9 ){ |
| 1249 |
|
if( orbitalinfo->TimeGap>0 && orbitalinfo->TimeGap<2000000){ |
| 1250 |
// |
// |
| 1251 |
Float_t Bx = -orbitalinfo->Bdown; //don't need for PamExp ExpOnly for all geography areas |
if ( debug ) printf(" timegap %f \n",orbitalinfo->TimeGap); |
| 1252 |
Float_t By = orbitalinfo->Beast; //don't need for PamExp ExpOnly for all geography areas |
Float_t Bx = -orbitalinfo->Bdown; |
| 1253 |
Float_t Bz = orbitalinfo->Bnorth; //don't need for PamExp ExpOnly for all geography areas |
Float_t By = orbitalinfo->Beast; |
| 1254 |
|
Float_t Bz = orbitalinfo->Bnorth; |
| 1255 |
// |
// |
| 1256 |
TMatrixD Fij = PO->ECItoGreenwich(PO->QuatoECI(orbitalinfo->q0,orbitalinfo->q1,orbitalinfo->q2,orbitalinfo->q3),orbitalinfo->absTime); |
TMatrixD Fij = PO->ECItoGreenwich(PO->QuatoECI(orbitalinfo->q0,orbitalinfo->q1,orbitalinfo->q2,orbitalinfo->q3),orbitalinfo->absTime); |
| 1257 |
|
TMatrixD Gij = PO->ColPermutation(Fij); |
| 1258 |
TMatrixD Dij = PO->GreenwichtoGEO(orbitalinfo->lat,orbitalinfo->lon,Fij); |
TMatrixD Dij = PO->GreenwichtoGEO(orbitalinfo->lat,orbitalinfo->lon,Fij); |
| 1259 |
TMatrixD Iij = PO->ColPermutation(Dij); |
TMatrixD Iij = PO->ColPermutation(Dij); |
| 1260 |
// |
// |
| 1261 |
orbitalinfo->Iij.ResizeTo(Iij); |
orbitalinfo->Iij.ResizeTo(Iij); |
| 1262 |
orbitalinfo->Iij = Iij; |
orbitalinfo->Iij = Iij; |
| 1263 |
// |
// |
| 1264 |
A1 = Iij(0,2); |
// A1 = Iij(0,2); |
| 1265 |
A2 = Iij(1,2); |
// A2 = Iij(1,2); |
| 1266 |
A3 = Iij(2,2); |
// A3 = Iij(2,2); |
| 1267 |
// |
// |
| 1268 |
// orbitalinfo->pamzenitangle = (Float_t)PO->GetPitchAngle(1,0,0,A1,A2,A3); // Angle between zenit and Pamela's main axiz |
// orbitalinfo->pamzenitangle = (Float_t)PO->GetPitchAngle(1,0,0,A1,A2,A3); // Angle between zenit and Pamela's main axiz |
| 1269 |
// orbitalinfo->pamBangle = (Float_t)PO->GetPitchAngle(A1,A2,A3,Bx,By,Bz); // Angle between Pamela's main axiz and B |
// orbitalinfo->pamBangle = (Float_t)PO->GetPitchAngle(A1,A2,A3,Bx,By,Bz); // Angle between Pamela's main axiz and B |
| 1270 |
// |
// |
| 1271 |
|
if ( debug ) printf(" matrixes done \n"); |
| 1272 |
if ( !standalone && tof->ntrk() > 0 ){ |
if ( !standalone && tof->ntrk() > 0 ){ |
| 1273 |
|
if ( debug ) printf(" !standalone \n"); |
| 1274 |
// |
// |
| 1275 |
Int_t nn = 0; |
Int_t nn = 0; |
| 1276 |
for(Int_t nt=0; nt < tof->ntrk(); nt++){ |
for(Int_t nt=0; nt < tof->ntrk(); nt++){ |
| 1299 |
t_orb->Eij.ResizeTo(Eij); |
t_orb->Eij.ResizeTo(Eij); |
| 1300 |
t_orb->Eij = Eij; |
t_orb->Eij = Eij; |
| 1301 |
// |
// |
| 1302 |
TMatrixD Sij = PO->PamelatoGEO(Fij,Px,Py,Pz); |
TMatrixD Sij = PO->PamelatoGEO(Gij,Px,Py,Pz); |
| 1303 |
t_orb->Sij.ResizeTo(Sij); |
t_orb->Sij.ResizeTo(Sij); |
| 1304 |
t_orb->Sij = Sij; |
t_orb->Sij = Sij; |
| 1305 |
// |
// |
| 1324 |
// |
// |
| 1325 |
}; |
}; |
| 1326 |
} else { |
} else { |
| 1327 |
if ( debug ) printf(" mmm... mode %u standalone %i ntrk %i \n",orbitalinfo->mode,standalone,tof->ntrk()); |
if ( debug ) printf(" mmm... mode %u standalone \n",orbitalinfo->mode); |
| 1328 |
}; |
} |
| 1329 |
// |
// |
| 1330 |
} else { |
} else { |
| 1331 |
if ( !standalone && tof->ntrk() > 0 ){ |
if ( !standalone && tof->ntrk() > 0 ){ |
| 1384 |
c1->SaveAs("9.Rollhyst.png"); |
c1->SaveAs("9.Rollhyst.png"); |
| 1385 |
delete c1;*/ |
delete c1;*/ |
| 1386 |
|
|
| 1387 |
|
if ( verbose ) printf(" Clear before new run \n"); |
| 1388 |
delete dbtime; |
delete dbtime; |
| 1389 |
if ( L_QQ_Q_l_upper ) delete L_QQ_Q_l_upper; |
|
| 1390 |
|
if ( mcmdrc ) mcmdrc->Clear(); |
| 1391 |
|
mcmdrc = 0; |
| 1392 |
|
|
| 1393 |
|
if ( verbose ) printf(" Clear before new run1 \n"); |
| 1394 |
if ( L_QQ_Q_l_lower ) delete L_QQ_Q_l_lower; |
if ( L_QQ_Q_l_lower ) delete L_QQ_Q_l_lower; |
| 1395 |
|
if ( verbose ) printf(" Clear before new run2 \n"); |
| 1396 |
|
if ( L_QQ_Q_l_upper ) delete L_QQ_Q_l_upper; |
| 1397 |
|
if ( verbose ) printf(" Clear before new run3 \n"); |
| 1398 |
if ( RYPang_upper ) delete RYPang_upper; |
if ( RYPang_upper ) delete RYPang_upper; |
| 1399 |
|
if ( verbose ) printf(" Clear before new run4 \n"); |
| 1400 |
if ( RYPang_lower ) delete RYPang_lower; |
if ( RYPang_lower ) delete RYPang_lower; |
| 1401 |
|
|
| 1402 |
|
if ( l0tr ) l0tr->Delete(); |
| 1403 |
|
|
| 1404 |
|
if ( verbose ) printf(" End run \n"); |
| 1405 |
|
|
| 1406 |
}; // process all the runs |
}; // process all the runs |
| 1407 |
|
|
| 1408 |
if (verbose) printf("\n Finished processing data \n"); |
if (verbose) printf("\n Finished processing data \n"); |
| 1436 |
}; |
}; |
| 1437 |
if (verbose) printf(" Finished successful copying!\n"); |
if (verbose) printf(" Finished successful copying!\n"); |
| 1438 |
}; |
}; |
| 1439 |
|
//if ( OrbitalInfotrclone ) OrbitalInfotrclone->Clear(); |
| 1440 |
|
//if ( OrbitalInfotrclone ) OrbitalInfotrclone->Delete(); |
| 1441 |
}; |
}; |
| 1442 |
// |
// |
| 1443 |
// Close files, delete old tree(s), write and close level2 file |
// Close files, delete old tree(s), write and close level2 file |
| 1444 |
// |
// |
| 1445 |
if ( l0File ) l0File->Close(); |
if ( l0File ) l0File->Close(); |
|
if ( tempfile ) tempfile->Close(); |
|
| 1446 |
if ( myfold ) gSystem->Unlink(tempname.str().c_str()); |
if ( myfold ) gSystem->Unlink(tempname.str().c_str()); |
| 1447 |
// |
// |
|
if ( runinfo ) runinfo->Close(); |
|
| 1448 |
if ( OrbitalInfotr ) OrbitalInfotr->SetName("OrbitalInfo"); |
if ( OrbitalInfotr ) OrbitalInfotr->SetName("OrbitalInfo"); |
|
if ( tof ) tof->Delete(); |
|
|
if ( ttof ) ttof->Delete(); |
|
| 1449 |
// |
// |
| 1450 |
if ( file ){ |
if ( file ){ |
| 1451 |
file->cd(); |
file->cd(); |
| 1452 |
file->Write(); |
if ( OrbitalInfotr ) OrbitalInfotr->Write("OrbitalInfo", TObject::kOverwrite); // 10 RED bug fixed |
| 1453 |
}; |
}; |
| 1454 |
// |
// |
| 1455 |
|
if (verbose) printf("\n Exiting...\n"); |
| 1456 |
|
|
| 1457 |
if ( myfold ) gSystem->Unlink(OrbitalInfofolder.str().c_str()); |
if ( myfold ) gSystem->Unlink(OrbitalInfofolder.str().c_str()); |
| 1458 |
// |
// |
| 1459 |
// the end |
// the end |
| 1462 |
dbc->Close(); |
dbc->Close(); |
| 1463 |
delete dbc; |
delete dbc; |
| 1464 |
}; |
}; |
|
if (verbose) printf("\n Exiting...\n"); |
|
|
if(OrbitalInfotr)OrbitalInfotr->Delete(); |
|
| 1465 |
// |
// |
| 1466 |
|
if (verbose) printf("\n Exiting...\n"); |
| 1467 |
|
if ( tempfile ) tempfile->Close(); |
| 1468 |
|
|
| 1469 |
if ( PO ) delete PO; |
if ( PO ) delete PO; |
| 1470 |
if ( orbitalinfo ) delete orbitalinfo; |
if ( gltle ) delete gltle; |
| 1471 |
if ( orbitalinfoclone ) delete orbitalinfoclone; |
if ( glparam ) delete glparam; |
| 1472 |
|
if ( glparam2 ) delete glparam2; |
| 1473 |
|
if ( glparam3 ) delete glparam3; |
| 1474 |
|
if (verbose) printf("\n Exiting3...\n"); |
| 1475 |
if ( glroot ) delete glroot; |
if ( glroot ) delete glroot; |
| 1476 |
|
if (verbose) printf("\n Exiting4...\n"); |
| 1477 |
|
if ( runinfo ) runinfo->Close(); |
| 1478 |
if ( runinfo ) delete runinfo; |
if ( runinfo ) delete runinfo; |
| 1479 |
|
|
| 1480 |
|
if ( debug ){ |
| 1481 |
|
cout << "1 0x" << OrbitalInfotr << endl; |
| 1482 |
|
cout << "2 0x" << OrbitalInfotrclone << endl; |
| 1483 |
|
cout << "3 0x" << l0tr << endl; |
| 1484 |
|
cout << "4 0x" << tempOrbitalInfo << endl; |
| 1485 |
|
cout << "5 0x" << ttof << endl; |
| 1486 |
|
} |
| 1487 |
|
// |
| 1488 |
|
if ( debug ) file->ls(); |
| 1489 |
// |
// |
| 1490 |
if(code < 0) throw code; |
if(code < 0) throw code; |
| 1491 |
return(code); |
return(code); |
| 1533 |
Bool_t R10l = false; // Sign of R10 mode in lower quaternions array |
Bool_t R10l = false; // Sign of R10 mode in lower quaternions array |
| 1534 |
Bool_t R10u = false; // Sign of R10 mode in upper quaternions array |
Bool_t R10u = false; // Sign of R10 mode in upper quaternions array |
| 1535 |
Bool_t insm = false; // Sign that we inside quaternions array |
Bool_t insm = false; // Sign that we inside quaternions array |
| 1536 |
Bool_t mxtml = false; // Sign of mixt mode in lower quaternions array |
// Bool_t mxtml = false; // Sign of mixt mode in lower quaternions array |
| 1537 |
Bool_t mxtmu = false; // Sign of mixt mode in upper quaternions array |
// Bool_t mxtmu = false; // Sign of mixt mode in upper quaternions array |
| 1538 |
Bool_t npasm = false; // Sign of normall pass between R10 and non R10 or between non R10 and R10 |
Bool_t npasm = false; // Sign of normall pass between R10 and non R10 or between non R10 and R10 |
| 1539 |
UInt_t NCQl = 6; // Number of correct quaternions in lower array |
UInt_t NCQl = 6; // Number of correct quaternions in lower array |
| 1540 |
UInt_t NCQu = 6; // Number of correct quaternions in upper array |
// UInt_t NCQu = 6; // Number of correct quaternions in upper array |
| 1541 |
if (f>0){ |
if (f>0){ |
| 1542 |
insm = true; |
insm = true; |
| 1543 |
if(Qupper->time[f]-Qupper->time[f-1]==30) R10u = false; |
if(Qupper->time[f]-Qupper->time[f-1]==30) R10u = false; |
| 1549 |
if((Qlower->time[5]-Qlower->time[0]==150)&&(Qlower->time[1]-Qlower->time[0]==30)) R10l = false; |
if((Qlower->time[5]-Qlower->time[0]==150)&&(Qlower->time[1]-Qlower->time[0]==30)) R10l = false; |
| 1550 |
if((Qupper->time[5]-Qupper->time[0]==150)&&(Qupper->time[1]-Qupper->time[0]==30)) R10u = false; |
if((Qupper->time[5]-Qupper->time[0]==150)&&(Qupper->time[1]-Qupper->time[0]==30)) R10u = false; |
| 1551 |
if((Qlower->time[5]-Qlower->time[0]<2)&&(Qlower->time[1]-Qlower->time[0]==30)){ |
if((Qlower->time[5]-Qlower->time[0]<2)&&(Qlower->time[1]-Qlower->time[0]==30)){ |
| 1552 |
mxtml = true; |
// mxtml = true; |
| 1553 |
for(UInt_t i = 1; i < 6; i++){ |
for(UInt_t i = 1; i < 6; i++){ |
| 1554 |
if(Qlower->time[i]-Qlower->time[0]==30*i) NCQl=i; |
if(Qlower->time[i]-Qlower->time[0]==30*i) NCQl=i; |
| 1555 |
} |
} |
| 1556 |
} |
} |
| 1557 |
if((Qupper->time[5]-Qupper->time[0]<2)&&(Qupper->time[1]-Qupper->time[0]==30)){ |
// if((Qupper->time[5]-Qupper->time[0]<2)&&(Qupper->time[1]-Qupper->time[0]==30)){ |
| 1558 |
mxtmu = true; |
// mxtmu = true; |
| 1559 |
for(UInt_t i = 1; i < 6; i++){ |
// for(UInt_t i = 1; i < 6; i++){ |
| 1560 |
if(Qupper->time[i]-Qupper->time[0]==30*i) NCQu=i; |
// if(Qupper->time[i]-Qupper->time[0]==30*i) NCQu=i; |
| 1561 |
} |
// } |
| 1562 |
} |
// } |
| 1563 |
} |
} |
| 1564 |
|
|
| 1565 |
if(((upper-lower==1.5)||(upper-lower==3.)||(upper-lower==30.)||(upper-lower==31.5)||(upper-lower==33.)||(upper-lower==181.5)||(upper-lower==210.)||(upper-lower==211.5))&&!insm) npasm = true; |
if(((upper-lower==1.5)||(upper-lower==3.)||(upper-lower==30.)||(upper-lower==31.5)||(upper-lower==33.)||(upper-lower==181.5)||(upper-lower==210.)||(upper-lower==211.5))&&!insm) npasm = true; |