Changeset 1888 for trunk/MagicSoft/Mars/mfileio
- Timestamp:
- 04/02/03 09:03:22 (22 years ago)
- Location:
- trunk/MagicSoft/Mars/mfileio
- Files:
-
- 3 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 -
trunk/MagicSoft/Mars/mfileio/MCT1ReadPreProc.h
r1880 r1888 9 9 #include "MRead.h" 10 10 #endif 11 12 #include <TRandom3.h> 11 13 12 14 class TList; … … 22 24 class MTaskList; 23 25 class MParList; 26 class MParameterD; 24 27 25 28 struct outputpars; … … 42 45 MRawRunHeader *fRawRunHeader; // raw run header 43 46 MParList *fParList; // parameter list 47 MParameterD *fHourAngle; // hour angle [deg] 48 MParameterD *fThetaOrig; // original zenith angle [rad] 44 49 45 50 Bool_t fIsMcFile; // Flag whether current run is a MC run … … 53 58 TArrayF fPedRMS; 54 59 60 TRandom3 ran3; 55 61 56 62 Bool_t OpenNextFile(); … … 77 83 ~MCT1ReadPreProc(); 78 84 79 Int_t AddFile(const char *fname, Int_t dummy=-1);85 void AddFile(const char *fname); 80 86 81 87 UInt_t GetEntries() { return fEntries; } 88 89 Bool_t SmearTheta(MParList *plist, Float_t *theta, Float_t *thetasmeared); 82 90 83 91 ClassDef(MCT1ReadPreProc, 0) // Reads the CT1 preproc data file … … 86 94 #endif 87 95 96 97 -
trunk/MagicSoft/Mars/mfileio/Makefile
r1600 r1888 20 20 # @endcode 21 21 22 INCLUDES = -I. -I../mbase -I../mraw -I../mmc -I../mdata -I../manalysis -I../mgeom 22 INCLUDES = -I. -I../mbase -I../mraw -I../mmc -I../mdata -I../manalysis -I../mgeom -I../mhist 23 23 24 24 # @code
Note:
See TracChangeset
for help on using the changeset viewer.