Changeset 1888 for trunk/MagicSoft/Mars/mfileio/MCT1ReadPreProc.cc
- Timestamp:
- 04/02/03 09:03:22 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mfileio/MCT1ReadPreProc.cc
r1880 r1888 79 79 #include "MMcEvt.hxx" 80 80 #include "MMcTrig.hxx" 81 #include "MBinning.h" 82 83 #include "TRandom3.h" 84 #include "MParameters.h" 81 85 82 86 ClassImp(MCT1ReadPreProc); … … 119 123 // Add this file as the last entry in the chain 120 124 // 121 Int_t MCT1ReadPreProc::AddFile(const char *txt, Int_t)125 void MCT1ReadPreProc::AddFile(const char *txt) 122 126 { 123 127 const char *name = gSystem->ExpandPathName(txt); … … 129 133 { 130 134 *fLog << warn << "WARNING - Problem reading header... ignored." << endl; 131 return 0;135 return; 132 136 } 133 137 … … 136 140 { 137 141 *fLog << warn << "WARNING - File contains no data... ignored." << endl; 138 return 0;142 return; 139 143 } 140 144 … … 144 148 145 149 fFileNames->AddLast(new TNamed(txt, "")); 146 return 1;147 150 } 148 151 … … 703 706 704 707 // 708 // look for the HourAngle container in the plist 709 // 710 fHourAngle = (MParameterD*)pList->FindCreateObj("MParameterD","HourAngle"); 711 if (!fHourAngle) 712 return kFALSE; 713 fHourAngle->SetTitle("Store the CT1 hour angle [deg]"); 714 715 // 716 // look for the ThetaOrig container in the plist 717 // 718 fThetaOrig = (MParameterD*)pList->FindCreateObj("MParameterD","ThetaOrig"); 719 if (!fThetaOrig) 720 return kFALSE; 721 fThetaOrig->SetTitle("Store the original CT1 zenith angle [rad]"); 722 723 // 705 724 // look for the MCerPhotEvt class in the plist 706 725 // … … 772 791 773 792 return GetSelector() ? GetSelector()->CallPreProcess(pList) : kTRUE; 793 } 794 795 796 // -------------------------------------------------------------------------- 797 // 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; 774 854 } 775 855 … … 860 940 // int ipreproc_alt_arcs; // "should be" alt according to preproc (arcseconds) 861 941 // int ipreproc_az_arcs; // "should be" az according to preproc (arcseconds) 942 943 // 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); 948 949 // store hour angle 950 fHourAngle->SetVal(event.fhourangle); 951 952 //*fLog << "MCt1ReadPreProc::ProcessEvent; fhourangle = " 953 // << event.fhourangle << endl; 862 954 863 955 fMcEvt->Fill(event.isecs_since_midday, //0, /*fEvtNum*/ … … 877 969 fIsMcFile ? event.imcimpact_m*100 : 0, 878 970 TMath::Pi()/180*event.iaz_arcs/3600, // azimuth (arcseconds) 879 T Math::Pi()*(0.5-1./180*event.ialt_arcs/3600), // altitude (arcseconds)971 ThetaSmeared, 880 972 0, /* fTFirst */ 881 973 0, /* fTLast */ … … 895 987 0, /* elec */ 896 988 0, /* muon */ 897 event.fhourangle/* other */989 0 /* other */ 898 990 ); 899 991
Note:
See TracChangeset
for help on using the changeset viewer.