| 200 |
|
|
| 201 |
tsorted=0; |
tsorted=0; |
| 202 |
timage=0; |
timage=0; |
| 203 |
|
|
| 204 |
|
howtosort = "+CAL+TOF"; |
| 205 |
|
//howtosort = "+TOF"; |
| 206 |
|
sortthr = 100.; |
| 207 |
|
|
| 208 |
}; |
}; |
| 209 |
/** |
/** |
| 304 |
|
|
| 305 |
if(h0_obj) h0_obj->Clear(); |
if(h0_obj) h0_obj->Clear(); |
| 306 |
// if(trk0_obj) trk0_obj->Clear(); |
// if(trk0_obj) trk0_obj->Clear(); |
|
if(calo0_obj) calo0_obj->Clear(); |
|
| 307 |
if(trk1_obj) trk1_obj->Clear(); |
if(trk1_obj) trk1_obj->Clear(); |
| 308 |
if(trk2_obj) trk2_obj->Clear(); |
if(trk2_obj) trk2_obj->Clear(); |
| 309 |
if(trkh_obj) trkh_obj->Clear(); |
if(trkh_obj) trkh_obj->Clear(); |
| 310 |
|
if(calo0_obj) calo0_obj->Clear(); |
| 311 |
if(calo1_obj)calo1_obj->Clear(); |
if(calo1_obj)calo1_obj->Clear(); |
| 312 |
if(calo2_obj)calo2_obj->Clear(); |
if(calo2_obj)calo2_obj->Clear(); |
| 313 |
if(tof_obj) tof_obj->Clear(); |
if(tof_obj) tof_obj->Clear(); |
| 403 |
// |
// |
| 404 |
}; |
}; |
| 405 |
|
|
| 406 |
|
Bool_t PamLevel2::IsGood(){ |
| 407 |
|
Bool_t goodev=true; |
| 408 |
|
// if(trk2_obj && trk2_obj->UnpackError() != 0 ) goodev = false; |
| 409 |
|
if(calo2_obj && calo2_obj->good != 1) goodev = false; |
| 410 |
|
if(tof_obj && tof_obj->unpackError != 0) goodev = false; |
| 411 |
|
if(trig_obj && trig_obj->unpackError != 0) goodev = false; |
| 412 |
|
if(s4_obj && s4_obj->unpackError != 0) goodev = false; |
| 413 |
|
if(nd_obj && nd_obj->unpackError != 0) goodev = false; |
| 414 |
|
if(ac_obj && ac_obj->unpackError != 255) goodev = false; |
| 415 |
|
// if(orb_obj) |
| 416 |
|
return goodev; |
| 417 |
|
}; |
| 418 |
|
|
| 419 |
//-------------------------------------- |
//-------------------------------------- |
| 420 |
// |
// |
| 609 |
} |
} |
| 610 |
//-------------------------------------- |
//-------------------------------------- |
| 611 |
// |
// |
| 612 |
|
|
| 613 |
|
/** |
| 614 |
|
* Sort physical (tracker) tracks and stores them in the TRefArray (of TrkTrack objects) which pointer is PamLevel2::sorted_tracks. Left here as backward compatibility method. |
| 615 |
|
**/ |
| 616 |
|
void PamLevel2::SortTracks(TString how){ |
| 617 |
|
printf(" WARNING! obsolete, use SortTracks() and SetSortingMethod(TString) instead! \n Setting sorting method to %s \n",how.Data()); |
| 618 |
|
howtosort = how; |
| 619 |
|
SortTracks(); |
| 620 |
|
}; |
| 621 |
|
|
| 622 |
// |
// |
| 623 |
//-------------------------------------- |
//-------------------------------------- |
| 624 |
/** |
/** |
| 632 |
* |
* |
| 633 |
* The total number of physical tracks is always given by GetNTracks() and the it-th physical track can be retrieved by means of the methods GetTrack(int it) and GetTrack(int it, TString how). |
* The total number of physical tracks is always given by GetNTracks() and the it-th physical track can be retrieved by means of the methods GetTrack(int it) and GetTrack(int it, TString how). |
| 634 |
*/ |
*/ |
| 635 |
void PamLevel2::SortTracks(TString how){ |
void PamLevel2::SortTracks(){ |
| 636 |
|
TString how = howtosort; |
| 637 |
|
|
| 638 |
// cout <<" PamLevel2::SortTracks(TString how) "<<endl; |
// cout <<" PamLevel2::SortTracks(TString how) "<<endl; |
| 639 |
if( !trk2_obj ){ |
if( !trk2_obj ){ |
| 640 |
cout << "void PamLevel2::SortTracks(TString how): TrkLevel2 not loaded !!!"; |
cout << "void PamLevel2::SortTracks(): TrkLevel2 not loaded !!!"; |
| 641 |
return; |
return; |
| 642 |
}; |
}; |
| 643 |
// cout << "call SortTracs() "<<endl; |
// cout << "call SortTracs() "<<endl; |
| 644 |
//Save current Object count |
//Save current Object count |
| 645 |
Int_t ObjectNumber = TProcessID::GetObjectCount(); |
Int_t ObjectNumber = TProcessID::GetObjectCount(); |
| 646 |
|
|
| 647 |
// cout << "ObjectNumber "<<ObjectNumber <<endl; |
// cout << "ObjectNumber "<<ObjectNumber <<endl; |
| 648 |
|
|
| 649 |
// if(!sorted_tracks)sorted_tracks = new TRefArray(); |
// if(!sorted_tracks)sorted_tracks = new TRefArray(); |
| 650 |
// sorted_tracks->Clear(); |
// sorted_tracks->Clear(); |
| 651 |
// sorted_tracks.Clear(); |
// sorted_tracks.Clear(); |
| 652 |
|
|
| 653 |
if(!tsorted)tsorted = new TClonesArray("PamTrack",trk2_obj->GetNTracks()); |
if(!tsorted)tsorted = new TClonesArray("PamTrack",trk2_obj->GetNTracks()); |
| 654 |
tsorted->Delete(); |
tsorted->Delete(); |
| 655 |
TClonesArray &ttsorted = *tsorted; |
TClonesArray &ttsorted = *tsorted; |
| 656 |
if(!timage)timage = new TClonesArray("PamTrack",trk2_obj->GetNTracks()); |
if(!timage)timage = new TClonesArray("PamTrack",trk2_obj->GetNTracks()); |
| 657 |
timage->Delete(); |
timage->Delete(); |
| 658 |
TClonesArray &ttimage = *timage; |
TClonesArray &ttimage = *timage; |
| 659 |
|
|
| 660 |
|
|
| 661 |
// loop over the tracks sorted by the tracker |
// loop over the tracks sorted by the tracker |
| 662 |
Bool_t use_TRK = how.Contains("TRK", TString::kIgnoreCase); |
Bool_t use_TRK = how.Contains("TRK", TString::kIgnoreCase); |
| 663 |
Bool_t use_CAL = how.Contains("CAL", TString::kIgnoreCase); |
Bool_t use_CAL = how.Contains("CAL", TString::kIgnoreCase); |
| 664 |
Bool_t use_TOF = how.Contains("TOF", TString::kIgnoreCase); |
Bool_t use_TOF = how.Contains("TOF", TString::kIgnoreCase); |
| 665 |
|
|
| 666 |
if( !CAL2 && use_CAL) use_CAL = false; |
if( !CAL2 && use_CAL) use_CAL = false; |
| 667 |
if( !TOF && use_TOF) use_TOF = false; |
if( !TOF && use_TOF) use_TOF = false; |
| 668 |
|
|
| 669 |
if( !TRK2 ){ |
if( !TRK2 ){ |
| 670 |
// cout << "SortTracks() : without tracker does not work!!! (not yet)" << endl; |
// cout << "SortTracks() : without tracker does not work!!! (not yet)" << endl; |
| 671 |
return; |
return; |
| 672 |
}; |
}; |
| 673 |
|
|
| 674 |
// cout << "use_CAL "<<use_CAL<<" use_TOF "<<use_TOF<<" use_TRK "<<use_TRK <<endl; |
// cout << "use_CAL "<<use_CAL<<" use_TOF "<<use_TOF<<" use_TRK "<<use_TRK <<endl; |
| 675 |
|
|
| 676 |
for(Int_t i=0; i < trk2_obj->TrkLevel2::GetNTracks(); i++){ |
for(Int_t i=0; i < trk2_obj->TrkLevel2::GetNTracks(); i++){ |
| 677 |
|
|
| 678 |
TrkTrack *ts = 0; |
TrkTrack *ts = 0; |
| 679 |
CaloTrkVar *cs = 0; |
CaloTrkVar *cs = 0; |
| 680 |
ToFTrkVar *os = 0; |
ToFTrkVar *os = 0; |
| 681 |
|
|
| 682 |
// get tracker tracks |
// get tracker tracks |
| 683 |
TrkTrack *tp = trk2_obj->TrkLevel2::GetTrack(i); //tracker |
TrkTrack *tp = trk2_obj->TrkLevel2::GetTrack(i); //tracker |
| 684 |
CaloTrkVar *cp = GetCaloStoredTrack(tp->GetSeqNo()); |
CaloTrkVar *cp = GetCaloStoredTrack(tp->GetSeqNo()); |
| 685 |
ToFTrkVar *op = GetToFStoredTrack(tp->GetSeqNo()); |
ToFTrkVar *op = GetToFStoredTrack(tp->GetSeqNo()); |
| 686 |
|
|
| 687 |
TrkTrack *ti = 0; //tracker (image) |
TrkTrack *ti = 0; //tracker (image) |
| 688 |
CaloTrkVar *ci = 0; |
CaloTrkVar *ci = 0; |
| 689 |
ToFTrkVar *oi = 0; |
ToFTrkVar *oi = 0; |
| 690 |
// cout << "trk track n. "<<i << " "<<hex<< tp <<dec<< endl; |
// cout << "trk track n. "<<i << " "<<hex<< tp <<dec<< endl; |
| 691 |
// if track has an image, check image selection |
// if track has an image, check image selection |
| 692 |
if(tp->HasImage()){ |
if(tp->HasImage()){ |
| 693 |
|
|
| 694 |
ti = trk2_obj->TrkLevel2::GetTrackImage(i); //tracker (image) |
ti = trk2_obj->TrkLevel2::GetTrackImage(i); //tracker (image) |
| 695 |
ci = GetCaloStoredTrack(ti->GetSeqNo()); |
ci = GetCaloStoredTrack(ti->GetSeqNo()); |
| 696 |
oi = GetToFStoredTrack(ti->GetSeqNo()); |
oi = GetToFStoredTrack(ti->GetSeqNo()); |
| 697 |
|
|
| 698 |
// cout << "its image "<<i << " "<<hex<< ti <<dec<< endl; |
// cout << "its image "<<i << " "<<hex<< ti <<dec<< endl; |
| 699 |
|
|
| 700 |
//assign starting scores |
//assign starting scores |
| 701 |
Int_t tp_score = 0; //main track sorted by the tracker |
Int_t tp_score = 0; //main track sorted by the tracker |
| 702 |
Int_t ti_score = 0; //image track |
Int_t ti_score = 0; //image track |
| 703 |
|
|
| 704 |
// ------------------------ |
// ------------------------ |
| 705 |
// calorimeter check |
// calorimeter check |
| 706 |
// ------------------------ |
// ------------------------ |
| 707 |
// check the Y spatial residual on the first calorimeter plane |
// check the Y spatial residual on the first calorimeter plane |
| 708 |
// (cut on calorimeter variables from Emiliano) |
// (cut on calorimeter variables from Emiliano) |
| 709 |
if( use_CAL && !calo2_obj ){ |
if( use_CAL && !calo2_obj ){ |
| 710 |
cout << "void PamLevel2::SortTracks(TString how): how= "<<how<<" but CaloLevel2 not loaded !!!"; |
cout << "void PamLevel2::SortTracks(): howtosort= "<<how<<" but CaloLevel2 not loaded !!!"; |
| 711 |
return; |
return; |
| 712 |
}; |
}; |
| 713 |
if( |
if( |
| 714 |
use_CAL && |
use_CAL && |
| 715 |
calo2_obj->npcfit[1] > 15 && //no. of fit planes on Y view |
calo2_obj->npcfit[1] > 5 && //no. of fit planes on Y view |
| 716 |
calo2_obj->varcfit[1] < 1000. && //fit variance on Y view |
calo2_obj->varcfit[1] < 1000. && //fit variance on Y view |
| 717 |
cp && ci && |
cp && ci && |
| 718 |
true){ |
true){ |
| 719 |
|
|
| 720 |
|
|
| 721 |
Float_t resy_p = cp->tbar[0][1] - calo2_obj->cbar[0][1]; if(resy_p < 0)resy_p= - resy_p; |
Float_t resy_p = cp->tbar[0][1] - calo2_obj->cbar[0][1]; if(resy_p < 0)resy_p= - resy_p; |
| 722 |
Float_t resy_i = ci->tbar[0][1] - calo2_obj->cbar[0][1]; if(resy_i < 0)resy_i= - resy_i; |
Float_t resy_i = ci->tbar[0][1] - calo2_obj->cbar[0][1]; if(resy_i < 0)resy_i= - resy_i; |
| 723 |
|
|
| 724 |
if(resy_p <= resy_i) tp_score++; |
if(resy_p <= resy_i) tp_score++; |
| 725 |
else ti_score++; |
else ti_score++; |
| 726 |
|
|
| 727 |
|
// cout << "CALO "<<tp_score<<ti_score<<endl; |
| 728 |
|
|
| 729 |
// cout << "CALO "<<tp_score<<ti_score<<endl; |
}; |
| 730 |
|
// ------------------------ |
| 731 |
|
// TOF check |
| 732 |
|
// ------------------------ |
| 733 |
|
// check the number of hit pmts along the track |
| 734 |
|
// on S12 S21 and S32, where paddles are parallel to Y axis |
| 735 |
|
if( use_TOF && !tof_obj ){ |
| 736 |
|
cout << "void PamLevel2::SortTracks(): howtosort= "<<how<<" but ToFLevel2 not loaded !!!"; |
| 737 |
|
return; |
| 738 |
|
}; |
| 739 |
|
if( use_TOF && op && oi ){ |
| 740 |
|
|
| 741 |
|
// |
| 742 |
|
Float_t sen = 0.; |
| 743 |
|
for (Int_t ih=0; ih < op->npmtadc; ih++){ |
| 744 |
|
Int_t pl = tof_obj->GetPlaneIndex( (op->pmtadc).At(ih) ); |
| 745 |
|
if ( pl == 2 || pl == 3 || pl == 4 || pl == 5 ) sen += (op->dedx).At(ih); |
| 746 |
|
}; |
| 747 |
|
for (Int_t ih=0; ih < oi->npmtadc; ih++){ |
| 748 |
|
Int_t pl = tof_obj->GetPlaneIndex( (oi->pmtadc).At(ih) ); |
| 749 |
|
if ( pl == 2 || pl == 3 || pl == 4 || pl == 5 ) sen += (oi->dedx).At(ih); |
| 750 |
|
}; |
| 751 |
|
// |
| 752 |
|
if ( sen >= sortthr ){ |
| 753 |
|
//printf(" IS A NUCLEUS! en = %f \n",sen); |
| 754 |
|
// |
| 755 |
|
// is a nucleus use a different algorithm |
| 756 |
|
// |
| 757 |
|
Int_t nz = 6; Float_t zin[6]; // << define TOF z-coordinates |
| 758 |
|
for(Int_t ip=0; ip<nz; ip++) |
| 759 |
|
zin[ip] = tof_obj->ToFLevel2::GetZTOF(tof_obj->ToFLevel2::GetToFPlaneID(ip)); // << read ToF plane z-coordinates |
| 760 |
|
Trajectory *tr = new Trajectory(nz,zin); |
| 761 |
|
// |
| 762 |
|
Int_t nphit_p =0; |
| 763 |
|
Int_t nphit_i =0; |
| 764 |
|
Float_t enhit_p = 0.; |
| 765 |
|
Float_t enhit_i = 0.; |
| 766 |
|
// |
| 767 |
|
for (Int_t ih=0; ih < op->npmtadc; ih++){ |
| 768 |
|
Int_t pl = tof_obj->GetPlaneIndex( (op->pmtadc).At(ih) ); |
| 769 |
|
if(pl == 1 || pl == 2 || pl == 5){ |
| 770 |
|
nphit_p++; |
| 771 |
|
enhit_p += (op->dedx).At(ih); |
| 772 |
|
}; |
| 773 |
|
}; |
| 774 |
|
// |
| 775 |
|
tp->DoTrack2(tr); |
| 776 |
|
// |
| 777 |
|
if ( fabs(tr->y[0]-oi->ytofpos[0]) < 2. ){ |
| 778 |
|
for (Int_t ih=0; ih < op->npmtadc; ih++){ |
| 779 |
|
Int_t pl = tof_obj->GetPlaneIndex( (op->pmtadc).At(ih) ); |
| 780 |
|
if(pl == 0){ |
| 781 |
|
nphit_p++; |
| 782 |
|
enhit_p += (op->dedx).At(ih); |
| 783 |
|
}; |
| 784 |
|
}; |
| 785 |
|
}; |
| 786 |
|
if ( fabs(tr->y[3]-oi->ytofpos[1]) < 2. ){ |
| 787 |
|
for (Int_t ih=0; ih < op->npmtadc; ih++){ |
| 788 |
|
Int_t pl = tof_obj->GetPlaneIndex( (op->pmtadc).At(ih) ); |
| 789 |
|
if(pl == 3){ |
| 790 |
|
nphit_p++; |
| 791 |
|
enhit_p += (op->dedx).At(ih); |
| 792 |
|
}; |
| 793 |
|
}; |
| 794 |
|
}; |
| 795 |
|
if ( fabs(tr->y[4]-oi->ytofpos[2]) < 2. ){ |
| 796 |
|
for (Int_t ih=0; ih < op->npmtadc; ih++){ |
| 797 |
|
Int_t pl = tof_obj->GetPlaneIndex( (op->pmtadc).At(ih) ); |
| 798 |
|
if(pl == 4){ |
| 799 |
|
nphit_p++; |
| 800 |
|
enhit_p += (op->dedx).At(ih); |
| 801 |
|
}; |
| 802 |
|
}; |
| 803 |
|
}; |
| 804 |
|
|
| 805 |
|
for (Int_t ih=0; ih < oi->npmtadc; ih++){ |
| 806 |
|
Int_t pl = tof_obj->GetPlaneIndex( (oi->pmtadc).At(ih) ); |
| 807 |
|
if(pl == 1 || pl == 2 || pl == 5){ |
| 808 |
|
nphit_i++; |
| 809 |
|
enhit_i += (op->dedx).At(ih); |
| 810 |
|
}; |
| 811 |
|
}; |
| 812 |
|
// |
| 813 |
|
ti->DoTrack2(tr); |
| 814 |
|
// |
| 815 |
|
if ( fabs(tr->y[0]-oi->ytofpos[0]) < 2. ){ |
| 816 |
|
for (Int_t ih=0; ih < oi->npmtadc; ih++){ |
| 817 |
|
Int_t pl = tof_obj->GetPlaneIndex( (oi->pmtadc).At(ih) ); |
| 818 |
|
if(pl == 0){ |
| 819 |
|
nphit_i++; |
| 820 |
|
enhit_i += (op->dedx).At(ih); |
| 821 |
|
}; |
| 822 |
|
}; |
| 823 |
|
}; |
| 824 |
|
if ( fabs(tr->y[3]-oi->ytofpos[1]) < 2. ){ |
| 825 |
|
for (Int_t ih=0; ih < oi->npmtadc; ih++){ |
| 826 |
|
Int_t pl = tof_obj->GetPlaneIndex( (oi->pmtadc).At(ih) ); |
| 827 |
|
if(pl == 3){ |
| 828 |
|
nphit_i++; |
| 829 |
|
enhit_i += (op->dedx).At(ih); |
| 830 |
|
}; |
| 831 |
}; |
}; |
| 832 |
// ------------------------ |
}; |
| 833 |
// TOF check |
if ( fabs(tr->y[4]-oi->ytofpos[2]) < 2. ){ |
| 834 |
// ------------------------ |
for (Int_t ih=0; ih < oi->npmtadc; ih++){ |
| 835 |
// check the number of hit pmts along the track |
Int_t pl = tof_obj->GetPlaneIndex( (oi->pmtadc).At(ih) ); |
| 836 |
// on S12 S21 and S32, where paddles are parallel to Y axis |
if(pl == 4){ |
| 837 |
if( use_TOF && !tof_obj ){ |
nphit_i++; |
| 838 |
cout << "void PamLevel2::SortTracks(TString how): how= "<<how<<" but ToFLevel2 not loaded !!!"; |
enhit_i += (op->dedx).At(ih); |
| 839 |
return; |
}; |
| 840 |
}; |
}; |
| 841 |
if( use_TOF && op && oi ){ |
}; |
| 842 |
|
|
| 843 |
|
|
| 844 |
Int_t nphit_p =0; |
if( |
| 845 |
Int_t nphit_i =0; |
use_TOF && |
| 846 |
|
(nphit_p+nphit_i) !=0 && |
| 847 |
|
true){ |
| 848 |
|
|
| 849 |
|
// printf(" seqno %i nphit_p %i nphit_i %i enhit_p %f enhit_i %f \n",trk2_obj->TrkLevel2::GetSeqNo(i),nphit_p,nphit_i,enhit_p,enhit_i); |
| 850 |
|
// printf(" score p %i score i %i \n",tp_score,ti_score); |
| 851 |
|
// if( enhit_p > enhit_i ) tp_score++; |
| 852 |
|
// if( nphit_p >= nphit_i && enhit_p > enhit_i ) tp_score++; |
| 853 |
|
if ( nphit_p > nphit_i ) tp_score++; |
| 854 |
|
if ( nphit_p < nphit_i ) ti_score++; |
| 855 |
|
if ( nphit_p == nphit_i ){ |
| 856 |
|
if ( enhit_p > enhit_i ) tp_score++; |
| 857 |
|
else ti_score++; |
| 858 |
|
}; |
| 859 |
|
// printf(" dopo score p %i score i %i \n",tp_score,ti_score); |
| 860 |
|
}; |
| 861 |
|
delete tr; |
| 862 |
|
// |
| 863 |
|
} else { |
| 864 |
|
// |
| 865 |
|
// NOT a NUCLEUS |
| 866 |
|
// |
| 867 |
|
//printf(" NOT a NUCLEUS! en = %f \n",sen); |
| 868 |
|
|
| 869 |
|
Int_t nphit_p =0; |
| 870 |
|
Int_t nphit_i =0; |
| 871 |
|
|
| 872 |
|
|
| 873 |
/* cout << "track: npmtadc "<< op->npmtadc << endl; |
/* cout << "track: npmtadc "<< op->npmtadc << endl; |
| 874 |
cout << "track: npmttdc "<< op->npmttdc << endl; |
cout << "track: npmttdc "<< op->npmttdc << endl; |
| 875 |
cout << "image: npmtadc "<< oi->npmtadc << endl; |
cout << "image: npmtadc "<< oi->npmtadc << endl; |
| 876 |
cout << "image: npmttdc "<< oi->npmttdc << endl;*/ |
cout << "image: npmttdc "<< oi->npmttdc << endl;*/ |
| 877 |
|
|
| 878 |
for (Int_t ih=0; ih < op->npmtadc; ih++){ |
for (Int_t ih=0; ih < op->npmtadc; ih++){ |
| 879 |
Int_t pl = tof_obj->GetPlaneIndex( (op->pmtadc).At(ih) ); |
Int_t pl = tof_obj->GetPlaneIndex( (op->pmtadc).At(ih) ); |
| 880 |
if(pl == 1 || pl == 2 || pl == 5)nphit_p++; |
if(pl == 1 || pl == 2 || pl == 5)nphit_p++; |
| 881 |
}; |
}; |
| 882 |
|
|
| 883 |
for (Int_t ih=0; ih < oi->npmtadc; ih++){ |
for (Int_t ih=0; ih < oi->npmtadc; ih++){ |
| 884 |
Int_t pl = tof_obj->GetPlaneIndex( (oi->pmtadc).At(ih) ); |
Int_t pl = tof_obj->GetPlaneIndex( (oi->pmtadc).At(ih) ); |
| 885 |
if(pl == 1 || pl == 2 || pl == 5)nphit_i++; |
if(pl == 1 || pl == 2 || pl == 5)nphit_i++; |
| 886 |
}; |
}; |
| 887 |
|
|
| 888 |
if( |
if( |
| 889 |
use_TOF && |
use_TOF && |
| 890 |
(nphit_p+nphit_i) !=0 && |
(nphit_p+nphit_i) !=0 && |
| 891 |
true){ |
true){ |
| 892 |
|
|
| 893 |
if( nphit_p >= nphit_i) tp_score++; |
if( nphit_p >= nphit_i) tp_score++; |
| 894 |
else ti_score++; |
else ti_score++; |
| 895 |
}; |
}; |
| 896 |
// cout << "TOF "<<tp_score<<ti_score<<endl; |
}; |
| 897 |
}; |
// cout << "TOF "<<tp_score<<ti_score<<endl; |
| 898 |
if(tp_score == ti_score) use_TRK = true; |
}; |
| 899 |
// ------------------------ |
if(tp_score == ti_score) use_TRK = true; |
| 900 |
// tracker check |
// ------------------------ |
| 901 |
// ------------------------ |
// tracker check |
| 902 |
// chi**2 difference is not always large enough to distinguish among |
// ------------------------ |
| 903 |
// the real track and its image. |
// chi**2 difference is not always large enough to distinguish among |
| 904 |
// Tracker check will be applied always when calorimeter and tof information is ambiguous. |
// the real track and its image. |
| 905 |
if(use_TRK){ |
// Tracker check will be applied always when calorimeter and tof information is ambiguous. |
| 906 |
if( tp->chi2 > 0 && tp->chi2 < ti->chi2 ) tp_score++ ; |
if(use_TRK){ |
| 907 |
else if( ti->chi2 > 0 && ti->chi2 < tp->chi2 ) ti_score++ ; |
if( tp->chi2 > 0 && tp->chi2 < ti->chi2 ) tp_score++ ; |
| 908 |
// cout << "TRK "<<tp_score<<ti_score<<endl; |
else if( ti->chi2 > 0 && ti->chi2 < tp->chi2 ) ti_score++ ; |
| 909 |
}; |
// cout << "TRK "<<tp_score<<ti_score<<endl; |
| 910 |
|
}; |
| 911 |
|
|
| 912 |
// ------------------------ |
// ------------------------ |
| 913 |
// the winner is.... |
// the winner is.... |
| 914 |
// ------------------------ |
// ------------------------ |
| 915 |
if (tp_score > ti_score) { |
if (tp_score > ti_score) { |
| 916 |
// ts = tp;//the track sorted by the tracker!! |
// ts = tp;//the track sorted by the tracker!! |
| 917 |
// cs = cp; |
// cs = cp; |
| 918 |
// os = op; |
// os = op; |
| 919 |
}else if (tp_score < ti_score) { |
// cout << "It's primary!" << endl; |
| 920 |
ts = ti;//its image!! |
|
| 921 |
cs = ci; |
}else if (tp_score < ti_score) { |
| 922 |
os = oi; |
|
| 923 |
|
// cout << "It's image!" << endl; |
| 924 |
ti = tp;//its image!! |
|
| 925 |
ci = cp; |
ts = ti;//its image!! |
| 926 |
oi = op; |
cs = ci; |
| 927 |
|
os = oi; |
| 928 |
tp = ts;//its image!! |
|
| 929 |
cp = cs; |
ti = tp;//its image!! |
| 930 |
op = os; |
ci = cp; |
| 931 |
|
oi = op; |
| 932 |
|
|
| 933 |
|
tp = ts;//its image!! |
| 934 |
|
cp = cs; |
| 935 |
|
op = os; |
| 936 |
|
|
| 937 |
|
|
| 938 |
}else { |
}else { |
| 939 |
// ts = tp; |
// ts = tp; |
| 940 |
// cs = cp; |
// cs = cp; |
| 941 |
// os = op; |
// os = op; |
| 942 |
// cout << "Warning - track image ambiguity not solved" << endl; |
// cout << "Warning - track image ambiguity not solved" << endl; |
| 943 |
// cout << ts->GetNtot() << " "<< ts->chi2 << " " << npcfit[1] << " "<< nphit_p << endl; |
// cout << ts->GetNtot() << " "<< ts->chi2 << " " << npcfit[1] << " "<< nphit_p << endl; |
| 944 |
}; |
}; |
| 945 |
|
|
| 946 |
}else{ |
}else{ |
| 947 |
// ts = tp; |
// ts = tp; |
| 948 |
// cs = cp; |
// cs = cp; |
| 949 |
// os = op; |
// os = op; |
| 950 |
}; |
}; |
| 951 |
|
|
| 952 |
// cout <<" SortTracks() "<<i<<" -- "<<ts<<endl; |
// cout <<" SortTracks() "<<i<<" -- "<<ts<<endl; |
| 953 |
// sorted_tracks->Add(ts);//save the track in the sorted array |
// sorted_tracks->Add(ts);//save the track in the sorted array |
| 954 |
// sorted_tracks.Add(ts);//save the track in the sorted array |
// sorted_tracks.Add(ts);//save the track in the sorted array |
| 955 |
// sorted_tracks.Add(tp);//save the track in the sorted array |
// sorted_tracks.Add(tp);//save the track in the sorted array |
| 956 |
// cout << "SortTracks:: sorted_tracks->Add(it) "<<i<<" "<<ts<<endl; |
// cout << "SortTracks:: sorted_tracks->Add(it) "<<i<<" "<<ts<<endl; |
| 957 |
// cout<<"o "<<tp<<endl; |
// cout<<"o "<<tp<<endl; |
| 958 |
// cout<<"o "<<cp<<endl; |
// cout<<"o "<<cp<<endl; |
| 959 |
// cout<<"o "<<op<<endl; |
// cout<<"o "<<op<<endl; |
| 960 |
new(ttsorted[i]) PamTrack(tp,cp,op); |
new(ttsorted[i]) PamTrack(tp,cp,op); |
| 961 |
new(ttimage[i]) PamTrack(ti,ci,oi); |
new(ttimage[i]) PamTrack(ti,ci,oi); |
| 962 |
}; |
}; |
| 963 |
|
|
| 964 |
if( tsorted->GetEntries() != trk2_obj->GetNTracks() ){ |
if( tsorted->GetEntries() != trk2_obj->GetNTracks() ){ |
| 965 |
cout << "void PamLevel2::SortTracks(TString how): tsorted->GetEntries() "<<tsorted->GetEntries()<<" != trk2_obj->GetNTracks() = "<<trk2_obj->GetNTracks() <<endl; |
cout << "void PamLevel2::SortTracks(): tsorted->GetEntries() "<<tsorted->GetEntries()<<" != trk2_obj->GetNTracks() = "<<trk2_obj->GetNTracks() <<endl; |
| 966 |
tsorted->Delete(); tsorted=0; |
tsorted->Delete(); tsorted=0; |
| 967 |
timage->Delete(); timage=0; |
timage->Delete(); timage=0; |
| 968 |
} |
} |
| 969 |
|
|
| 970 |
//Restore Object count |
//Restore Object count |
| 971 |
//To save space in the table keeping track of all referenced objects |
//To save space in the table keeping track of all referenced objects |
| 972 |
//We reset the object count to what it was at the beginning of the event. |
//We reset the object count to what it was at the beginning of the event. |
| 973 |
TProcessID::SetObjectCount(ObjectNumber); |
TProcessID::SetObjectCount(ObjectNumber); |
| 974 |
|
|
| 975 |
}; |
}; |
| 976 |
//-------------------------------------- |
//-------------------------------------- |
| 994 |
TClonesArray *PamLevel2::GetTracks(){ |
TClonesArray *PamLevel2::GetTracks(){ |
| 995 |
|
|
| 996 |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
| 997 |
SortTracks("+CAL+TOF"); |
SortTracks(); |
| 998 |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
| 999 |
|
|
| 1000 |
return tsorted; |
return tsorted; |
| 1013 |
|
|
| 1014 |
// if(!trk2_obj) return 0; |
// if(!trk2_obj) return 0; |
| 1015 |
|
|
| 1016 |
// // *-*-*-*-*-*-*-*-*-*-*-*-* |
// // *-*-*-*+-*-*-*-*-*-*-*-*-* |
| 1017 |
// SortTracks("+CAL+TOF"); |
// SortTracks("+CAL+TOF"); |
| 1018 |
// // *-*-*-*-*-*-*-*-*-*-*-*-* |
// // *-*-*-*-*-*-*-*-*-*-*-*-* |
| 1019 |
// // if(!sorted_tracks)return 0; |
// // if(!sorted_tracks)return 0; |
| 1032 |
|
|
| 1033 |
// cout << "PamLevel2::GetTrack(int it) "<<endl; |
// cout << "PamLevel2::GetTrack(int it) "<<endl; |
| 1034 |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
| 1035 |
SortTracks("+CAL+TOF"); |
SortTracks(); |
| 1036 |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
| 1037 |
if(!tsorted)return 0; |
if(!tsorted)return 0; |
| 1038 |
if(!tsorted->GetEntries())return 0; |
if(!tsorted->GetEntries())return 0; |
| 1089 |
|
|
| 1090 |
|
|
| 1091 |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
| 1092 |
SortTracks("+CAL+TOF"); |
SortTracks(); |
| 1093 |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
// *-*-*-*-*-*-*-*-*-*-*-*-* |
| 1094 |
if(!timage)return 0; |
if(!timage)return 0; |
| 1095 |
if(!timage->GetEntries())return 0; |
if(!timage->GetEntries())return 0; |
| 1999 |
// ----------------------------------------------------------------------- |
// ----------------------------------------------------------------------- |
| 2000 |
if ( irun < 0 ){ |
if ( irun < 0 ){ |
| 2001 |
irun = 0LL; |
irun = 0LL; |
| 2002 |
|
irunentry = 0; |
| 2003 |
|
prevshift = 0; |
| 2004 |
run_tree->GetEntry(irun); |
run_tree->GetEntry(irun); |
| 2005 |
}; |
}; |
| 2006 |
// |
// |
| 2007 |
bool fromfirst = true; // first loop over runs |
bool fromfirst = true; // first loop over runs |
| 2008 |
|
|
| 2009 |
|
// Bool_t hasfrag = false; |
| 2010 |
|
// if( GetRunInfo()->ID_RUN_FRAG!=0 && GetRunInfo()->ID_RUN_FRAG != GetRunInfo()->ID)hasfrag=true; |
| 2011 |
|
// ULong64_t fragid = GetRunInfo()->ID_RUN_FRAG; |
| 2012 |
|
|
| 2013 |
// ------------------------------------------------------ |
// ------------------------------------------------------ |
| 2014 |
// loop over runs to find the one that contains the event |
// loop over runs to find the one that contains the event |
| 2015 |
// ------------------------------------------------------ |
// ------------------------------------------------------ |
| 2016 |
while ( !(GetOrbitalInfo()->absTime >= GetRunInfo()->RUNHEADER_TIME && // check on absolute time (s) |
while ( |
| 2017 |
GetOrbitalInfo()->absTime <= GetRunInfo()->RUNTRAILER_TIME) && |
( |
| 2018 |
!(GetOrbitalInfo()->OBT >= GetRunInfo()->RUNHEADER_OBT && // additional check on OBT (ms) |
( |
| 2019 |
GetOrbitalInfo()->OBT <= GetRunInfo()->RUNTRAILER_OBT) && |
!(GetOrbitalInfo()->absTime >= GetRunInfo()->RUNHEADER_TIME && // check on absolute time (s) |
| 2020 |
irun < run_tree->GetEntries() ){ |
GetOrbitalInfo()->absTime <= GetRunInfo()->RUNTRAILER_TIME) && |
| 2021 |
|
!(GetOrbitalInfo()->OBT >= GetRunInfo()->RUNHEADER_OBT && // additional check on OBT (ms) |
| 2022 |
|
GetOrbitalInfo()->OBT <= GetRunInfo()->RUNTRAILER_OBT) |
| 2023 |
|
) |
| 2024 |
|
|| GetRunInfo()->NEVENTS==0 |
| 2025 |
|
|| !(irunentry < GetRunInfo()->NEVENTS-1-prevshift) |
| 2026 |
|
) |
| 2027 |
|
&& irun < run_tree->GetEntries() ){ |
| 2028 |
|
|
| 2029 |
irun++; |
irun++; |
| 2030 |
// ------------------------------------ |
// ------------------------------------ |
| 2031 |
// if the end of run tree is reached... |
// if the end of run tree is reached... |
| 2051 |
// save the index of the first entry of the run, relative to pam_tree, |
// save the index of the first entry of the run, relative to pam_tree, |
| 2052 |
// and read a new run |
// and read a new run |
| 2053 |
// ------------------------------------------------------------------- |
// ------------------------------------------------------------------- |
| 2054 |
if(irun>0)runfirstentry += (GetRunInfo()->NEVENTS); |
if(irun>0)runfirstentry += (GetRunInfo()->NEVENTS)-prevshift; |
| 2055 |
|
irunentry = 0; |
| 2056 |
|
prevshift = 0; |
| 2057 |
run_tree->GetEntry(irun); |
run_tree->GetEntry(irun); |
| 2058 |
if(GetRunInfo()->RUNHEADER_OBT>=GetRunInfo()->RUNTRAILER_OBT ){ |
if(GetRunInfo()->RUNHEADER_OBT>GetRunInfo()->RUNTRAILER_OBT ){ |
| 2059 |
cout << "Bool_t PamLevel2::UpdateRunInfo(Long64_t iev) -- WARNING -- irun "<<irun<<" has RUNHEADER_OBT>=RUNTRAILER_OBT " <<endl; |
cout << "Bool_t PamLevel2::UpdateRunInfo(Long64_t iev) -- WARNING -- irun "<<irun<<" has RUNHEADER_OBT>=RUNTRAILER_OBT " <<endl; |
| 2060 |
cout << " (NB!! in this case some events are assigned to a wrong run)"<<endl; |
cout << " (NB!! in this case some events are assigned to a wrong run)"<<endl; |
| 2061 |
} |
} |
| 2062 |
|
// if(hasfrag && fragid != GetRunInfo()->ID){ |
| 2063 |
|
// cout << "... where is the next fragment ??"<<endl; |
| 2064 |
|
// } |
| 2065 |
}; |
}; |
| 2066 |
|
|
| 2067 |
|
|
| 2068 |
// -------------------------------------- |
// -------------------------------------- |
| 2069 |
// if there was no need to update the run |
// if there was no need to update the run |
| 2070 |
// ---> exit with FALSE |
// ---> exit with FALSE |
| 2076 |
// ---> exit with TRUE |
// ---> exit with TRUE |
| 2077 |
// -------------------------------------- |
// -------------------------------------- |
| 2078 |
cout << endl << " ))))) UPDATE RUN INFO ((((( @iev "<<iev<<" run "<<GetRunInfo()->ID<<" irun "<<irun<<endl; |
cout << endl << " ))))) UPDATE RUN INFO ((((( @iev "<<iev<<" run "<<GetRunInfo()->ID<<" irun "<<irun<<endl; |
| 2079 |
prevshift = 0; |
// ---------------------------------------------------- |
| 2080 |
|
// then check if the run has a fragment |
| 2081 |
|
// in this case we have to switch to the next fragment |
| 2082 |
|
// when the end of the first fragment is reached |
| 2083 |
|
// ---------------------------------------------------- |
| 2084 |
|
if( |
| 2085 |
|
GetRunInfo()->ID_RUN_FRAG != 0 && |
| 2086 |
|
// GetRunInfo()->ID_RUN_FRAG != GetRunInfo()->ID && |
| 2087 |
|
true ){ |
| 2088 |
|
cout << "* fragment *"<<endl; |
| 2089 |
|
} |
| 2090 |
|
|
| 2091 |
return(true); |
return(true); |
| 2092 |
}; |
}; |
| 2093 |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- |
| 2736 |
*/ |
*/ |
| 2737 |
void PamLevel2::CreateCloneTrees(TFile *ofile){ |
void PamLevel2::CreateCloneTrees(TFile *ofile){ |
| 2738 |
|
|
| 2739 |
|
|
| 2740 |
|
// if the pointer is null, create a default file |
| 2741 |
|
|
| 2742 |
|
if(!ofile){ |
| 2743 |
|
cout << "void PamLevel2::CreateCloneTrees(TFile*) -- WARNING -- Creating file: clone-tree.root "<<endl; |
| 2744 |
|
ofile = new TFile("clone-tree.root","recreate"); |
| 2745 |
|
} |
| 2746 |
|
|
| 2747 |
ofile->cd(); |
ofile->cd(); |
| 2748 |
|
|
| 2749 |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl; |
cout << "+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+" <<endl; |
| 2913 |
//Int_t PamLevel2::GetEntry(Int_t iee){ |
//Int_t PamLevel2::GetEntry(Int_t iee){ |
| 2914 |
Int_t PamLevel2::GetEntry(Long64_t iee){ |
Int_t PamLevel2::GetEntry(Long64_t iee){ |
| 2915 |
|
|
| 2916 |
|
// cout << "-------------------------------------"<<endl; |
| 2917 |
|
// cout << "Int_t PamLevel2::GetEntry("<<iee<<")"<<endl; |
| 2918 |
|
|
| 2919 |
if(!pam_tree){ |
if(!pam_tree){ |
| 2920 |
cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- level2 trees not loaded"<<endl; |
cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- level2 trees not loaded"<<endl; |
| 2921 |
return 0; |
return 0; |
| 2961 |
|
|
| 2962 |
// cout << "PamLevel2::GetEntry("<<iee<<") "<<irun<<" "<<runfirstentry<<" "<<irunentry<<endl; |
// cout << "PamLevel2::GetEntry("<<iee<<") "<<irun<<" "<<runfirstentry<<" "<<irunentry<<endl; |
| 2963 |
|
|
| 2964 |
// cout << " irunentry "<<irunentry << endl; |
// cout << "irunentry "<<irunentry << endl; |
| 2965 |
|
// cout << "runfirstentry "<<runfirstentry << endl; |
| 2966 |
|
// cout << "nevents "<<GetRunInfo()->NEVENTS<< endl; |
| 2967 |
|
|
| 2968 |
|
// if( TRK0 || CAL0 || TOF0 ){ |
| 2969 |
|
// if( !GetYodaEntry( ) ){ |
| 2970 |
|
// cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- error reading level0 tree"<<endl; |
| 2971 |
|
// return 0; |
| 2972 |
|
// } |
| 2973 |
|
// } |
| 2974 |
|
|
| 2975 |
|
|
|
if( TRK0 || CAL0 || TOF0 ){ |
|
|
if( !GetYodaEntry( ) ){ |
|
|
cout << " Int_t PamLevel2::GetEntry(Int_t) -- ERROR -- error reading level0 tree"<<endl; |
|
|
return 0; |
|
|
} |
|
|
} |
|
| 2976 |
return 1; |
return 1; |
| 2977 |
|
|
| 2978 |
} |
} |
| 2979 |
|
|
| 2980 |
|
TrkLevel0 *PamLevel2::GetTrkLevel0(){ |
| 2981 |
|
if( !TRK0 )return NULL; |
| 2982 |
|
if( !GetYodaEntry( ) ){ |
| 2983 |
|
cout << " Int_t PamLevel2::GetTrkLevel0() -- ERROR -- error reading level0 tree"<<endl; |
| 2984 |
|
return 0; |
| 2985 |
|
} |
| 2986 |
|
return trk0_obj; |
| 2987 |
|
}; |
| 2988 |
|
CaloLevel0 *PamLevel2::GetCaloLevel0(){ |
| 2989 |
|
if( !CAL0 )return NULL; |
| 2990 |
|
if( !GetYodaEntry( ) ){ |
| 2991 |
|
cout << " Int_t PamLevel2::GetCaloLevel0() -- ERROR -- error reading level0 tree"<<endl; |
| 2992 |
|
return 0; |
| 2993 |
|
} |
| 2994 |
|
return calo0_obj; |
| 2995 |
|
}; |
| 2996 |
|
|
| 2997 |
|
|
| 2998 |
/** |
/** |
| 2999 |
* Method to retrieve the level0 tree (YODA tree) that contains the current event. |
* Method to retrieve the level0 tree (YODA tree) that contains the current event. |
| 3000 |
* Given the run ID (...), if needed it query the DB and load the proper file. |
* Given the run ID (...), if needed it query the DB and load the proper file. |
| 3014 |
return NULL; |
return NULL; |
| 3015 |
} |
} |
| 3016 |
Int_t irootnew = run_obj->ID_ROOT_L0; |
Int_t irootnew = run_obj->ID_ROOT_L0; |
| 3017 |
// cout << "iroot "<<iroot<<endl; |
// cout << "iroot "<<iroot<<endl; |
| 3018 |
// cout << "irootnew "<<irootnew<<endl; |
// cout << "irootnew "<<irootnew<<endl; |
| 3019 |
|
|
| 3020 |
//=================================== |
//=================================== |
| 3021 |
// load the level0 file |
// load the level0 file |
| 3072 |
}; |
}; |
| 3073 |
l0_tree->SetBranchAddress("Tracker" ,trk0_obj->GetPointerToTrackerEvent()); |
l0_tree->SetBranchAddress("Tracker" ,trk0_obj->GetPointerToTrackerEvent()); |
| 3074 |
} |
} |
| 3075 |
//--------------------------------------------------- |
//-------------------------------------------------- |
| 3076 |
// CALORIMETER: |
// CALORIMETER: |
| 3077 |
if(CAL0){ |
if(CAL0){ |
| 3078 |
if(!calo0_obj){ |
if(!calo0_obj){ |
| 3161 |
Int_t answer = 0; |
Int_t answer = 0; |
| 3162 |
Int_t shift =0; |
Int_t shift =0; |
| 3163 |
// printf(" siamo qui %i %i \n",shift,prevshift); |
// printf(" siamo qui %i %i \n",shift,prevshift); |
| 3164 |
Int_t maxshift = 100; |
Int_t maxshift = 10; |
| 3165 |
do{ |
do{ |
| 3166 |
if(shift>0){ |
if(shift>0){ |
| 3167 |
cout << " PKTNUM L2 --- "<< GetOrbitalInfo()->pkt_num << " --- L0 --- "<< GetEventHeader()->GetPscuHeader()->GetCounter()<<endl; |
cout << " PKTNUM L2 --- "<< GetOrbitalInfo()->pkt_num << " --- L0 --- "<< GetEventHeader()->GetPscuHeader()->GetCounter()<<endl; |
| 3190 |
|
|
| 3191 |
}while( ( GetOrbitalInfo()->OBT != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetOrbitalTime()) || GetOrbitalInfo()->pkt_num != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetCounter())) && (quellagiusta+(Long64_t)shift) < GetYodaTree()->GetEntries() && shift < maxshift); |
}while( ( GetOrbitalInfo()->OBT != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetOrbitalTime()) || GetOrbitalInfo()->pkt_num != (UInt_t)(GetEventHeader()->GetPscuHeader()->GetCounter())) && (quellagiusta+(Long64_t)shift) < GetYodaTree()->GetEntries() && shift < maxshift); |
| 3192 |
|
|
| 3193 |
if ( (quellagiusta+(Long64_t)shift) == GetYodaTree()->GetEntries() || shift == maxshift ) { |
if ( (quellagiusta+(Long64_t)shift+(Long64_t)prevshift) > GetYodaTree()->GetEntries() || shift == maxshift ) { |
| 3194 |
cout << " Big trouble here, no such event in Level0 data! " <<endl; |
cout << " Big trouble here, no such event in Level0 data! " <<endl; |
| 3195 |
return 0; |
return 0; |
| 3196 |
} |
} |
| 3201 |
return answer; |
return answer; |
| 3202 |
|
|
| 3203 |
} |
} |
| 3204 |
|
/** |
| 3205 |
|
* \Brief Set DB connection |
| 3206 |
|
*/ |
| 3207 |
|
Bool_t PamLevel2::SetDBConnection(){ |
| 3208 |
|
|
| 3209 |
|
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl; |
| 3210 |
|
cout<<"Connecting to DB"<<endl; |
| 3211 |
|
cout<<"HOST "<<host<<endl; |
| 3212 |
|
cout<<"USER "<<user<<endl; |
| 3213 |
|
cout<<"PSW "<<psw<<endl; |
| 3214 |
|
dbc = TSQLServer::Connect(host.Data(),user.Data(),psw.Data()); |
| 3215 |
|
if( !dbc )return false; |
| 3216 |
|
if( !dbc->IsConnected() )return false; |
| 3217 |
|
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl; |
| 3218 |
|
return true; |
| 3219 |
|
|
| 3220 |
|
} |