Changeset 1891 for trunk/MagicSoft/Mars/mfileio/MCT1ReadPreProc.cc
- Timestamp:
- 04/03/03 10:28:31 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mfileio/MCT1ReadPreProc.cc
r1888 r1891 784 784 return kFALSE; 785 785 786 fBinningT = (MBinning*)pList->FindObject("BinningTheta"); 787 if (!fBinningT) 788 { 789 *fLog << err << dbginf << "BinningTheta not found ... aborting." << endl; 790 return kFALSE; 791 } 792 786 793 fNumFilterEvts = 0; 787 794 fNumEvents = 0; … … 796 803 // -------------------------------------------------------------------------- 797 804 // 798 // Smear Theta uniformly in a bin of Theta; result is stored in ThetaSmeared 799 // 800 // 801 Bool_t MCT1ReadPreProc::SmearTheta(MParList *plist, Float_t *Theta, 802 Float_t *ThetaSmeared) 803 { 804 // both Theta and ThetaSmeared are in [radians] 805 // the edges are in [degrees] 806 807 const MBinning *binstheta = (MBinning*)plist->FindObject("BinningTheta"); 808 if (!binstheta) 809 { 810 *fLog << err << dbginf << "BinningTheta not found ... aborting." << endl; 811 return kFALSE; 812 } 813 814 Int_t nedges = binstheta->GetNumEdges(); 815 Double_t *edges = (Double_t*)binstheta->GetEdges(); 816 817 Int_t bin = -1; 818 *ThetaSmeared = *Theta; 819 820 Float_t Thetadeg = (*Theta) * 180.0/TMath::Pi(); 821 Float_t ThetaSmeareddeg; 822 823 // search Theta bin 824 Int_t i; 825 for (i=1; i<nedges; i++) 826 { 827 if (Thetadeg >= *(edges+i) ) continue; 828 if (Thetadeg < *(edges+i-1)) break; 829 bin = i; 830 break; 831 } 832 833 Float_t low=0.0; 834 Float_t up =0.0; 835 836 // smear Theta within the Theta bin 837 ThetaSmeareddeg = -1.0; 838 if (bin != -1) 839 { 840 low = *(edges+bin-1); 841 up = *(edges+bin); 842 843 Double_t ran = ran3.Rndm(1); 844 ThetaSmeareddeg = (low + ran * (up-low)); 845 } 846 *ThetaSmeared = ThetaSmeareddeg * TMath::Pi()/180.0; 847 848 //*fLog << "SmearTheta : Thetadeg, ThetaSmeareddeg, low, up, bin = " 849 // << Thetadeg 850 // << ", " << ThetaSmeareddeg << ", " << low << ", " << up << ", " 851 // << bin << endl; 852 853 return kTRUE; 805 // Smear Theta uniformly in a bin of Theta 806 // 807 Float_t MCT1ReadPreProc::SmearTheta(Float_t theta) 808 { 809 // both Theta and ThetaSmeared are in [radians] 810 // the edges are in [degrees] 811 const Int_t bin = fBinningT->FindLoEdge(theta * 180.0/TMath::Pi()); 812 if (bin == -1) 813 return theta; 814 815 // smear Theta within the Theta bin 816 const Double_t low = fBinningT->GetEdges()[bin]; 817 const Double_t up = fBinningT->GetEdges()[bin+1]; 818 819 return (low + gRandom->Rndm(1) * (up-low)) * TMath::Pi()/180; 854 820 } 855 821 … … 942 908 943 909 // smear Theta in its Theta bin 944 Float_t ThetaOrig = TMath::Pi()*(0.5-1./180*event.ialt_arcs/3600); // [radians] 945 Float_t ThetaSmeared; // [radians] 946 SmearTheta(fParList, &ThetaOrig, &ThetaSmeared); 947 fThetaOrig->SetVal(ThetaOrig); 910 Float_t theta = TMath::Pi()*(0.5-1./180*event.ialt_arcs/3600); 911 fThetaOrig->SetVal(theta); 948 912 949 913 // store hour angle 950 914 fHourAngle->SetVal(event.fhourangle); 951 952 //*fLog << "MCt1ReadPreProc::ProcessEvent; fhourangle = "953 // << event.fhourangle << endl;954 915 955 916 fMcEvt->Fill(event.isecs_since_midday, //0, /*fEvtNum*/ … … 969 930 fIsMcFile ? event.imcimpact_m*100 : 0, 970 931 TMath::Pi()/180*event.iaz_arcs/3600, // azimuth (arcseconds) 971 ThetaSmeared,972 932 SmearTheta(theta), 933 0, /* fTFirst */ 973 934 0, /* fTLast */ 974 935 0, /* fL_Nmax */
Note:
See TracChangeset
for help on using the changeset viewer.