| 146 |
// |
// |
| 147 |
TFile *l0File = 0; |
TFile *l0File = 0; |
| 148 |
TTree *l0tr = 0; |
TTree *l0tr = 0; |
| 149 |
TTree *l0trm = 0; |
// TTree *l0trm = 0; |
| 150 |
|
TChain *ch = 0; |
| 151 |
// EM: open also header branch |
// EM: open also header branch |
| 152 |
TBranch *l0head = 0; |
TBranch *l0head = 0; |
| 153 |
pamela::EventHeader *eh = 0; |
pamela::EventHeader *eh = 0; |
| 570 |
ULong_t DeltaOBT = TimeSync - ObtSync; |
ULong_t DeltaOBT = TimeSync - ObtSync; |
| 571 |
|
|
| 572 |
if ( debug ) printf(" 2 TimeSync %lu ObtSync %lu DeltaOBT %lu\n",(ULong_t)(dbtime->GetTimesync()/1000),(ULong_t)dbtime->GetObt0(),TimeSync-ObtSync); |
if ( debug ) printf(" 2 TimeSync %lu ObtSync %lu DeltaOBT %lu\n",(ULong_t)(dbtime->GetTimesync()/1000),(ULong_t)dbtime->GetObt0(),TimeSync-ObtSync); |
| 573 |
|
// |
| 574 |
l0trm = (TTree*)l0File->Get("Mcmd"); |
// Read MCMDs from up to 11 files, 5 before and 5 after the present one in order to have some kind of inclination information |
| 575 |
neventsm = l0trm->GetEntries(); |
// |
| 576 |
|
ch = new TChain("Mcmd","Mcmd"); |
| 577 |
|
// |
| 578 |
|
// look in the DB to find the closest files to this run |
| 579 |
|
// |
| 580 |
|
TSQLResult *pResult = 0; |
| 581 |
|
TSQLRow *Row = 0; |
| 582 |
|
stringstream myquery; |
| 583 |
|
UInt_t l0fid[10]; |
| 584 |
|
Int_t i = 0; |
| 585 |
|
memset(l0fid,0,10*sizeof(Int_t)); |
| 586 |
|
// |
| 587 |
|
myquery.str(""); |
| 588 |
|
myquery << "select ID_ROOT_L0 from GL_RUN where RUNHEADER_TIME<=" << runinfo->RUNHEADER_TIME << " group by ID_ROOT_L0 order by RUNHEADER_TIME desc limit 5;"; |
| 589 |
|
// |
| 590 |
|
pResult = dbc->Query(myquery.str().c_str()); |
| 591 |
|
// |
| 592 |
|
i = 9; |
| 593 |
|
if( pResult ){ |
| 594 |
|
// |
| 595 |
|
Row = pResult->Next(); |
| 596 |
|
// |
| 597 |
|
while ( Row ){ |
| 598 |
|
// |
| 599 |
|
// store infos and exit |
| 600 |
|
// |
| 601 |
|
l0fid[i] = (UInt_t)atoll(Row->GetField(0)); |
| 602 |
|
i--; |
| 603 |
|
Row = pResult->Next(); |
| 604 |
|
// |
| 605 |
|
}; |
| 606 |
|
pResult->Delete(); |
| 607 |
|
}; |
| 608 |
|
// |
| 609 |
|
myquery.str(""); |
| 610 |
|
myquery << "select ID_ROOT_L0 from GL_RUN where RUNHEADER_TIME>" << runinfo->RUNHEADER_TIME << " group by ID_ROOT_L0 order by RUNHEADER_TIME asc limit 5;"; |
| 611 |
|
// |
| 612 |
|
pResult = dbc->Query(myquery.str().c_str()); |
| 613 |
|
// |
| 614 |
|
i = 0; |
| 615 |
|
if( pResult ){ |
| 616 |
|
// |
| 617 |
|
Row = pResult->Next(); |
| 618 |
|
// |
| 619 |
|
while ( Row ){ |
| 620 |
|
// |
| 621 |
|
// store infos and exit |
| 622 |
|
// |
| 623 |
|
l0fid[i] = (UInt_t)atoll(Row->GetField(0)); |
| 624 |
|
i++; |
| 625 |
|
Row = pResult->Next(); |
| 626 |
|
// |
| 627 |
|
}; |
| 628 |
|
pResult->Delete(); |
| 629 |
|
}; |
| 630 |
|
// |
| 631 |
|
i = 0; |
| 632 |
|
UInt_t previd = 0; |
| 633 |
|
while ( i < 10 ){ |
| 634 |
|
if ( l0fid[i] && previd != l0fid[i] ){ |
| 635 |
|
previd = l0fid[i]; |
| 636 |
|
myquery.str(""); |
| 637 |
|
myquery << "select PATH,NAME from GL_ROOT where ID=" << l0fid[i] << " ;"; |
| 638 |
|
// |
| 639 |
|
pResult = dbc->Query(myquery.str().c_str()); |
| 640 |
|
// |
| 641 |
|
if( pResult ){ |
| 642 |
|
// |
| 643 |
|
Row = pResult->Next(); |
| 644 |
|
// |
| 645 |
|
if ( debug ) printf(" Using inclination informations from file: %s \n",(((TString)gSystem->ExpandPathName(Row->GetField(0)))+"/"+(TString)Row->GetField(1)).Data()); |
| 646 |
|
ch->Add(((TString)gSystem->ExpandPathName(Row->GetField(0)))+"/"+(TString)Row->GetField(1)); |
| 647 |
|
// |
| 648 |
|
pResult->Delete(); |
| 649 |
|
}; |
| 650 |
|
}; |
| 651 |
|
i++; |
| 652 |
|
}; |
| 653 |
|
// |
| 654 |
|
// l0trm = (TTree*)l0File->Get("Mcmd"); |
| 655 |
|
// ch->ls(); |
| 656 |
|
ch->SetBranchAddress("Mcmd",&mcmdev); |
| 657 |
|
// printf(" entries %llu \n", ch->GetEntries()); |
| 658 |
|
// l0trm = ch->GetTree(); |
| 659 |
|
// neventsm = l0trm->GetEntries(); |
| 660 |
|
neventsm = ch->GetEntries(); |
| 661 |
|
if ( debug ) printf(" entries %u \n", neventsm); |
| 662 |
// neventsm = 0; |
// neventsm = 0; |
| 663 |
// |
// |
| 664 |
if (neventsm == 0){ |
if (neventsm == 0){ |
| 669 |
} |
} |
| 670 |
// |
// |
| 671 |
|
|
| 672 |
l0trm->SetBranchAddress("Mcmd", &mcmdev); |
// l0trm->SetBranchAddress("Mcmd", &mcmdev); |
| 673 |
// l0trm->SetBranchAddress("Header", &eh); |
// l0trm->SetBranchAddress("Header", &eh); |
| 674 |
// |
// |
| 675 |
// |
// |
| 800 |
upperqtime = atime; |
upperqtime = atime; |
| 801 |
lowerqtime = runinfo->RUNHEADER_TIME; |
lowerqtime = runinfo->RUNHEADER_TIME; |
| 802 |
for ( ik = 0; ik < neventsm; ik++){ |
for ( ik = 0; ik < neventsm; ik++){ |
| 803 |
l0trm->GetEntry(ik); |
// l0trm->GetEntry(ik); |
| 804 |
|
ch->GetEntry(ik); |
| 805 |
tmpSize = mcmdev->Records->GetEntries(); |
tmpSize = mcmdev->Records->GetEntries(); |
| 806 |
numrec = tmpSize; |
numrec = tmpSize; |
| 807 |
for (Int_t j3 = 0;j3<tmpSize;j3++){ |
for (Int_t j3 = 0;j3<tmpSize;j3++){ |
| 808 |
if ( debug ) printf(" eh eh eh \n"); |
if ( debug ) printf(" ik %i j3 %i eh eh eh \n",ik,j3); |
| 809 |
mcmdrc = (pamela::McmdRecord*)mcmdev->Records->At(j3); |
mcmdrc = (pamela::McmdRecord*)mcmdev->Records->At(j3); |
| 810 |
if ((int)mcmdrc->ID1 == 226){ |
if ((int)mcmdrc->ID1 == 226){ |
| 811 |
L_QQ_Q_l_upper->fill(mcmdrc->McmdData); |
L_QQ_Q_l_upper->fill(mcmdrc->McmdData); |
| 895 |
if (mcreen == numrec){ |
if (mcreen == numrec){ |
| 896 |
mctren++; |
mctren++; |
| 897 |
mcreen = 0; |
mcreen = 0; |
| 898 |
l0trm->GetEntry(mctren); |
// l0trm->GetEntry(mctren); |
| 899 |
|
ch->GetEntry(mctren); |
| 900 |
numrec = mcmdev->Records->GetEntries(); |
numrec = mcmdev->Records->GetEntries(); |
| 901 |
} |
} |
| 902 |
CopyQ(L_QQ_Q_l_lower,L_QQ_Q_l_upper); |
CopyQ(L_QQ_Q_l_lower,L_QQ_Q_l_upper); |
| 1136 |
// |
// |
| 1137 |
t_orb->cutoff = 59.3/(pow(orbitalinfo->L,2)*pow((1+sqrt(1-pow(orbitalinfo->L,-3/2)*cos(omega))),2)); |
t_orb->cutoff = 59.3/(pow(orbitalinfo->L,2)*pow((1+sqrt(1-pow(orbitalinfo->L,-3/2)*cos(omega))),2)); |
| 1138 |
// |
// |
| 1139 |
|
if ( t_orb->pitch != t_orb->pitch ) t_orb->pitch = -1000.; |
| 1140 |
|
if ( t_orb->cutoff != t_orb->cutoff ) t_orb->cutoff = -1000.; |
| 1141 |
|
// |
| 1142 |
if ( debug ) printf(" orbitalinfo->cutoffsvl %f vitaly %f \n",orbitalinfo->cutoffsvl,t_orb->cutoff); |
if ( debug ) printf(" orbitalinfo->cutoffsvl %f vitaly %f \n",orbitalinfo->cutoffsvl,t_orb->cutoff); |
| 1143 |
// |
// |
| 1144 |
new(tor[nn]) OrbitalInfoTrkVar(*t_orb); |
new(tor[nn]) OrbitalInfoTrkVar(*t_orb); |