Changeset 7194
- Timestamp:
- 07/15/05 13:25:57 (19 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 2 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r7193 r7194 20 20 21 21 -*-*- END OF LINE -*-*- 22 2005/07/16 Thomas Bretz 23 24 * macros/dohtml.C: 25 - some updates to the macro section 26 27 * mcalib/MCalibrationCam.h: 28 - added new member function GetPulserColorStr to convert 29 pulser color into string 30 31 * mcalib/MCalibrationPattern.h: 32 - added new member function GetPulserColorStr to return 33 pulser color a string 34 35 * mcalib/MCalibrationPatternDecode.cc: 36 - fixed a typo in a comment 37 38 * mhflux/MHThetaSq.cc: 39 - set default number of bins to 75 40 41 * msignal/MExtractTimeAndChargeDigitalFilter.[h,cc]: 42 - updated support for automatic weights. All cases should now 43 be handled as accurate as possible. 44 45 * msignal/MC_calibration_weights_UV46.dat, 46 msignal/MC_cosmics_weights46.dat: 47 - new files 48 49 50 22 51 2005/07/14 Thomas Bretz 23 52 -
trunk/MagicSoft/Mars/NEWS
r7193 r7194 48 48 - fgLoGainBlackoutLimit: 3.5 49 49 - fgLoGainPickupLimit: 3.5 50 51 - callisto: The handling of automatic weights for the digital filter 52 has been improved. There are now new calibration weights special 53 for Monte Carlo calibrations. 50 54 51 55 - callisto: use a new criterium to exclude bad pixels: If the high-gain -
trunk/MagicSoft/Mars/macros/dohtml.C
r5694 r7194 101 101 html.SetSourceDir("macros"); 102 102 html.Convert("merpp.C", "MARS - Merging and Preprocessing"); 103 html.Convert(" readraw.C", "MARS - How To Read A Raw");103 html.Convert("tutorials/readraw.C", "MARS - How To Read A Raw"); 104 104 html.Convert("rootlogon.C", "MARS - rootlogon.C"); 105 html.Convert("readCT1.C", "MARS - Read and display CT1 Events");105 //html.Convert("readCT1.C", "MARS - Read and display CT1 Events"); 106 106 html.Convert("readMagic.C", "MARS - Read and display Magic Events"); 107 html.Convert("CT1Hillas.C", "MARS - Calculate CT1 Hillas");107 //html.Convert("CT1Hillas.C", "MARS - Calculate CT1 Hillas"); 108 108 html.Convert("MagicHillas.C", "MARS - Calculate Magic Hillas"); 109 html.Convert("collarea.C", "MARS - Calculate Collection Area from a MC root file");109 //? html.Convert("collarea.C", "MARS - Calculate Collection Area from a MC root file"); 110 110 html.Convert("threshold.C", "MARS - Calculate Energy Threshold from a MC root file"); 111 111 html.Convert("trigrate.C", "MARS - Calculate Trigger Rate from a MC root file"); 112 112 html.Convert("star.C", "MARS - (St)andard (A)nalysis and (R)econstruction"); 113 html.Convert("starplot.C", "MARS - Plot parameters from file created with star.C"); 113 html.Convert("tutorials/starplot.C", "MARS - Plot parameters from file created with star.C"); 114 html.Convert("tutorials/readrfl.C", "MARS - Example of reading reflector output with Mars"); 114 115 html.Convert("comprob.C", "MARS - Calculation of composite probabilities for G/H-Seperation"); 115 116 html.Convert("multidimdist.C", "MARS - Calculation of multidimensional distances for G/H-Seperation"); 116 117 html.Convert("multidimdist2.C", "MARS - Calculation of multidimensional distances for G/H-Seperation"); 117 html.Convert("estimate.C", "MARS - Shows results from the energy estimation"); 118 html.Convert("estfit.C", "MARS - Fits the coefficients of the energy estimator MEnergyEstParam"); 119 html.Convert("plot.C", "MARS - Plots 1D mars histogram"); 120 html.Convert("plot2.C", "MARS - Plots a 2D mars histogram"); 121 html.Convert("starplot.C", "MARS - Plots data from a STAR-file into a mars histogram"); 122 html.Convert("testenv.C", "MARS - Example to use TEnv and Mars Eventloops"); 118 // html.Convert("estimate.C", "MARS - Shows results from the energy estimation"); 119 // html.Convert("estfit.C", "MARS - Fits the coefficients of the energy estimator MEnergyEstParam"); 120 html.Convert("tutorials/plot.C", "MARS - Plots 1D mars histogram"); 121 html.Convert("tutorials/plot2.C", "MARS - Plots a 2D mars histogram"); 122 html.Convert("tutorials/testenv.C", "MARS - Example to use TEnv and Mars Eventloops"); 123 123 html.Convert("triglvl2.C", "MARS - Example to use MMcTriggerLvl2 class, using filters and creating histograms"); 124 html.Convert("status.C", "MARS - Example to use the online display"); 125 html.Convert("calibration.C", "MARS - Example to use the calibration"); 126 html.Convert("pedvsevent.C", "MARS - Example to use MPedCalcPedRun"); 127 html.Convert("pedphotcalc.C", "MARS - Example to use MPedPhotCalc"); 128 html.Convert("sectorvstime.C", "MARS - Example how to plot mean value of a camera sector versus time"); 129 html.Convert("calibration.C", "MARS - Example how to use the calibrationa camera "); 130 html.Convert("bootcampstandardanalysis.C", "MARS - Example of the status of the standard analysis at the bootcamp"); 124 //html.Convert("status.C", "MARS - Example to use the online display"); 125 //html.Convert("calibration.C", "MARS - Example to use the calibration"); 126 html.Convert("tutorials/pedvsevent.C", "MARS - Example to use MPedCalcPedRun"); 127 //html.Convert("pedphotcalc.C", "MARS - Example to use MPedPhotCalc"); 128 html.Convert("tutorials/derotatedc.C", "MARS - Example of plotting derotated dc currents"); 129 html.Convert("tutorials/evtrate.C", "MARS - Example how to plot the event rate"); 130 html.Convert("tutorials/pixvsevent.C", "MARS - Example how to plot pixel value versus event number/time"); 131 html.Convert("tutorials/sectorvstime.C", "MARS - Example how to plot mean value of a camera sector versus time"); 132 html.Convert("tutorials/pedestalvstime.C", "MARS - Example how to plot pedestal/rms versus time"); 133 html.Convert("tutorials/pixfirerate.C", "MARS - Example how to plot the firerate of a pixel (times above threshold)"); 134 html.Convert("tutorials/pixsatrate.C", "MARS - Example how to plot the saturation rate of a pixel"); 135 //html.Convert("calibration.C", "MARS - Example how to use the calibrationa camera "); 136 //html.Convert("bootcampstandardanalysis.C", "MARS - Example of the status of the standard analysis at the bootcamp"); 131 137 html.Convert("readIPR.C", "MARS - Example to read and display the IPRs from a (merpped) report file"); 132 html.Convert(" extendcam.C", "MARS - Example of using MGeomCamExtend and MHexagonalFTCalc");133 html.Convert(" hft.C", "MARS - Example of using MHexagonalFTCalc");138 html.Convert("tutorials/extendcam.C", "MARS - Example of using MGeomCamExtend and MHexagonalFTCalc"); 139 html.Convert("tutorials/hft.C", "MARS - Example of using MHexagonalFTCalc"); 134 140 } -
trunk/MagicSoft/Mars/mcalib/MCalibrationCam.h
r6963 r7194 94 94 const MCalibrationPix &operator[] ( UInt_t i ) const; 95 95 96 static TString GetPulserColorStr(PulserColor_t col) { 97 TString str; 98 switch (col) 99 { 100 case kCT1: str += "CT1"; break; 101 case kGREEN: str += "Green"; break; 102 case kBLUE: str += "Blue"; break; 103 case kUV: str += "UV"; break; 104 case kNONE: str += "None"; break; 105 default: str += "Unknown"; break; 106 } 107 str += " ("; 108 str += (int)col; 109 str += ")"; 110 return str; 111 } 112 96 113 // Inits 97 114 void Init ( const MGeomCam &geom ); -
trunk/MagicSoft/Mars/mcalib/MCalibrationPattern.h
r6013 r7194 54 54 55 55 const MCalibrationCam::PulserColor_t GetPulserColor() const { return fPulserColor; } 56 TString GetPulserColorStr() const { return MCalibrationCam::GetPulserColorStr(fPulserColor); } 56 57 57 58 void SetPulserColor ( const MCalibrationCam::PulserColor_t col) { fPulserColor = col; } -
trunk/MagicSoft/Mars/mcalib/MCalibrationPatternDecode.cc
r6056 r7194 99 99 Int_t MCalibrationPatternDecode::Process() 100 100 { 101 // No setting necessary because MCalibrationPattern:: reset() has101 // No setting necessary because MCalibrationPattern::Reset() has 102 102 // been called just before 103 103 if (fRunHeader->GetFormatVersion()<5) -
trunk/MagicSoft/Mars/mhflux/MHThetaSq.cc
r7178 r7194 62 62 // 63 63 MHThetaSq::MHThetaSq(const char *name, const char *title) 64 : MHAlpha(name, title), fThetaSq(0), fNumBinsSignal(3), fNumBinsTotal( 45)64 : MHAlpha(name, title), fThetaSq(0), fNumBinsSignal(3), fNumBinsTotal(75) 65 65 { 66 66 // -
trunk/MagicSoft/Mars/msignal/MExtractTimeAndChargeDigitalFilter.cc
r7134 r7194 70 70 #include "MRawRunHeader.h" 71 71 #include "MCalibrationPattern.h" 72 #include "MExtractedSignalCam.h" 72 73 73 74 #include "MPedestalPix.h" … … 142 143 if (fWindowSizeHiGain > availhirange) 143 144 { 144 // Please simplify this!145 *fLog << warn << GetDescriptor()146 << Form("%s%2i%s%2i%s%2i%s",": Hi Gain window size: ",fWindowSizeHiGain,147 " is bigger than available range: [",(int)fHiGainFirst,",",(int)fHiGainLast,"]") << endl; 145 *fLog << warn << GetDescriptor() << ": Hi Gain window size: " << Form("%2i",fWindowSizeHiGain); 146 *fLog << " is bigger than available range: [" << Form("%2i", (int)fHiGainFirst); 147 *fLog << "," << Form("%21", (int)fHiGainLast) << "]" << endl; 148 148 149 fHiGainLast = fHiGainFirst + fWindowSizeHiGain; 149 *fLog << warn << GetDescriptor() 150 150 151 *fLog << warn << GetDescriptor() << ": Will set the upper range to: " << (int)fHiGainLast << endl; 151 152 } 152 153 … … 163 164 if (fWindowSizeLoGain > availlorange) 164 165 { 165 // Please simplify this!166 *fLog << warn << GetDescriptor()167 << Form("%s%2i%s%2i%s%2i%s",": Lo Gain window size: ",fWindowSizeLoGain,168 " is bigger than available range: [",(int)fLoGainFirst,",",(int)fLoGainLast,"]") << endl; 169 fLoGainLast = fLoGainFirst + fWindowSizeLoGain;170 *fLog << warn << GetDescriptor() 171 << ": Will set the upper range to: " << (int)fLoGainLast << endl;166 *fLog << warn << GetDescriptor() << ": Lo Gain window size: " << Form("%2i",fWindowSizeLoGain); 167 *fLog << " is bigger than available range: [" << Form("%2i", (int)fLoGainFirst); 168 *fLog << "," << Form("%21", (int)fLoGainLast) << "]" << endl; 169 170 fLoGainLast = fLoGainFirst + fWindowSizeLoGain; 171 172 *fLog << warn << GetDescriptor() << ": Will set the upper range to: " << (int)fLoGainLast << endl; 172 173 } 173 174 … … 205 206 // -------------------------------------------------------------------------- 206 207 // 207 // InitArrays 208 // 209 // Gets called in the ReInit() and initialized the arrays 210 // 211 Bool_t MExtractTimeAndChargeDigitalFilter::InitArrays() 212 { 213 if (!fRunHeader) 208 // The weights are determined using GetAutimaticWeights(). 209 // 210 // kFALSE is returned if it returned an error. 211 // kTRUE is returned if no new weights were set. 212 // 213 // If new weights are set 214 // fTimeShiftHiGain 215 // fTimeShiftLoGain 216 // fNumHiGainSamples 217 // fNumLoGainSamples 218 // fSqrtHiGainSamples 219 // fSqrtLoGainSamples 220 // and 221 // fSignals->SetUsedFADCSlices(...) 222 // is updated accordingly. 223 // 224 Bool_t MExtractTimeAndChargeDigitalFilter::GetWeights() 225 { 226 switch (GetAutomaticWeights()) 227 { 228 case kERROR: // An error occured 214 229 return kFALSE; 215 216 const Int_t rangehi = (Int_t)(fHiGainLast - fHiGainFirst + 1 + fHiLoLast); 217 const Int_t rangelo = (Int_t)(fLoGainLast - fLoGainFirst + 1); 218 219 fHiGainSignal.Set(rangehi); 220 fLoGainSignal.Set(rangelo); 221 222 // Try to get automatic weights 223 if (!ReadAutomaticWeightsFile()) 224 return kFALSE; 225 226 // If still no weights set try conservative way 227 if (fNameWeightsFileSet.IsNull()) 228 if (!ReadWeightsFile(fNameWeightsFile)) 229 return kFALSE; 230 231 fTimeShiftHiGain = (Float_t)fHiGainFirst + 0.5 + 1./fBinningResolutionHiGain; 230 case kFALSE: // No new weights set 231 return kTRUE; 232 } 233 234 // New weights set 235 fTimeShiftHiGain = 0.5 + 1./fBinningResolutionHiGain + fHiGainFirst; 232 236 fTimeShiftLoGain = 0.5 + 1./fBinningResolutionLoGain; 237 233 238 // 234 239 // We need here the effective number of samples which is about 2.5 in the case of a window … … 240 245 fSqrtLoGainSamples = TMath::Sqrt(fNumLoGainSamples); 241 246 247 // From MExtractTimeAndCharge::ReInit 248 if (fSignals) 249 fSignals->SetUsedFADCSlices(fHiGainFirst, fHiGainLast+fHiLoLast, fNumHiGainSamples, 250 fLoGainFirst, fLoGainLast, fNumLoGainSamples); 242 251 return kTRUE; 252 } 253 254 // -------------------------------------------------------------------------- 255 // 256 // InitArrays 257 // 258 // Gets called in the ReInit() and initialized the arrays 259 // 260 Bool_t MExtractTimeAndChargeDigitalFilter::InitArrays() 261 { 262 if (!fRunHeader) 263 return kFALSE; 264 265 const Int_t rangehi = (Int_t)(fHiGainLast - fHiGainFirst + 1 + fHiLoLast); 266 const Int_t rangelo = (Int_t)(fLoGainLast - fLoGainFirst + 1); 267 268 fHiGainSignal.Set(rangehi); 269 fLoGainSignal.Set(rangelo); 270 271 return GetWeights(); 272 } 273 274 // -------------------------------------------------------------------------- 275 // 276 // Check if reading a new weights file is necessary because the calibration 277 // pattern has changed. (Cannot be done in ReInit, because at this time 278 // the calibration pattern is not available. 279 // Then process the event. 280 // 281 Int_t MExtractTimeAndChargeDigitalFilter::Process() 282 { 283 // Change Weights if the calibration patter changes 284 if (!GetWeights()) 285 return kERROR; 286 287 // Process event 288 return MExtractTimeAndCharge::Process(); 243 289 } 244 290 … … 643 689 //---------------------------------------------------------------------------- 644 690 // 691 // If automatic weights are requested, no default weights (name.IsNull()) 692 // are requested, fRunHeader is available and fRunHeader->IsMonteCarloRun() 693 // is true prepend "MC_" in from of the name. 694 // 695 // return poth+name; 696 // 697 TString MExtractTimeAndChargeDigitalFilter::CompileWeightFileName(TString path, const TString &name) const 698 { 699 if (fAutomaticWeights && !name.IsNull() && fRunHeader && fRunHeader->IsMonteCarloRun()) 700 path += "MC_"; 701 702 path += name; 703 704 return path; 705 } 706 707 //---------------------------------------------------------------------------- 708 // 645 709 // Read a pre-defined weights file into the class. 646 710 // This is mandatory for the extraction … … 648 712 // If filenname is empty, then all weights will be set to 1. 649 713 // 650 Bool_t MExtractTimeAndChargeDigitalFilter::ReadWeightsFile(TString filename) 651 { 652 653 // This is a fix for TEnv files edited with windows editors 654 filename.ReplaceAll("\015", ""); 655 656 fAmpWeightsHiGain .Set(fBinningResolutionHiGain*fWindowSizeHiGain); 657 fAmpWeightsLoGain .Set(fBinningResolutionLoGain*fWindowSizeLoGain); 658 fTimeWeightsHiGain.Set(fBinningResolutionHiGain*fWindowSizeHiGain); 659 fTimeWeightsLoGain.Set(fBinningResolutionLoGain*fWindowSizeLoGain); 660 661 if (fNameWeightsFile.IsNull() || fNameWeightsFile=="-") 662 { 714 // Returns: 715 // kTRUE: new weights set 716 // kFALSE: no weights set 717 // kERROR: error 718 // 719 Int_t MExtractTimeAndChargeDigitalFilter::ReadWeightsFile(TString filename, TString path) 720 { 721 if (filename.IsNull()) 722 { 723 fAmpWeightsHiGain .Set(fBinningResolutionHiGain*fWindowSizeHiGain); 724 fAmpWeightsLoGain .Set(fBinningResolutionLoGain*fWindowSizeLoGain); 725 fTimeWeightsHiGain.Set(fBinningResolutionHiGain*fWindowSizeHiGain); 726 fTimeWeightsLoGain.Set(fBinningResolutionLoGain*fWindowSizeLoGain); 727 663 728 fAmpWeightsHiGain.Reset(1); 664 729 fTimeWeightsHiGain.Reset(1); 665 730 fAmpWeightsLoGain.Reset(1); 666 731 fTimeWeightsLoGain.Reset(1); 667 fNameWeightsFileSet = "-";668 732 return kTRUE; 669 733 } 670 734 735 // Add "MC_" in front of the filename if necessary 736 filename = CompileWeightFileName(path, filename); 737 671 738 //filename = MJob::ExpandPath(filename); 672 739 673 740 if (fNameWeightsFileSet==filename) 674 return k TRUE;741 return kFALSE; // No file read 675 742 676 743 ifstream fin(filename.Data()); … … 679 746 *fLog << err << GetDescriptor() << ": ERROR - Cannot open file " << filename << ": "; 680 747 *fLog << strerror(errno) << endl; 681 return k FALSE;682 } 683 684 *fLog << all << "DigitalFilter: Reading weights in " << filename << "..." << flush;748 return kERROR; 749 } 750 751 *fLog << all << GetDescriptor() << ": Reading weights in " << filename << "..." << flush; 685 752 686 753 Int_t len = 0; … … 705 772 { 706 773 *fLog << err << "ERROR - 'High Gain Weights' found twice in line #" << line << "." << endl; 707 return k FALSE;774 return kERROR; 708 775 } 709 776 … … 712 779 *fLog << err << "ERROR - Wrong number of arguments in line #" << line << ":" << endl; 713 780 *fLog << str << endl; 714 return k FALSE;781 return kERROR; 715 782 } 716 783 … … 727 794 { 728 795 *fLog << err << "ERROR - 'Lo Gain Weights' found twice in line #" << line << "." << endl; 729 return k FALSE;796 return kERROR; 730 797 } 731 798 … … 734 801 *fLog << err << "ERROR - Wrong number of arguments in line #" << line << ":" << endl; 735 802 *fLog << str << endl; 736 return k FALSE;803 return kERROR; 737 804 } 738 805 … … 758 825 *fLog << err << "ERROR - Wrong number of arguments in line #" << line << ":" << endl; 759 826 *fLog << str << endl; 760 return k FALSE;827 return kERROR; 761 828 } 762 829 … … 770 837 if (cnt != len) 771 838 { 772 *fLog << err << " Size mismatch in weights file " << filename << endl;773 return k FALSE;839 *fLog << err << "ERROR - Size mismatch in weights file " << filename << endl; 840 return kERROR; 774 841 } 775 842 776 843 if (!hi) 777 844 { 778 *fLog << err << " No correct header found in weights file " << filename << endl;779 return k FALSE;845 *fLog << err << "ERROR - No correct header found in weights file " << filename << endl; 846 return kERROR; 780 847 } 781 848 … … 824 891 //---------------------------------------------------------------------------- 825 892 // 826 // If automatic weight disabled or run type is pedestal no action is taken 827 // and kTRUE is returned. 828 // 829 // Otherwise: 830 // - If runtype is kRTData and filename starts with "MC_weights" "MC" is 831 // replaced by "cosmics" 832 // - If runtype is kRTMonteCarlo and filename starts with "cosmics_weights" 833 // "cosmics" is replaced by "MC" 834 // - If name filename begins with "calibration_weights_" for blue and green 835 // "UV" is replaced by "blue" 836 // - If name filename begins with "calibration_weights_" for UV and CT1 837 // "blue" is replaced by "UV" 838 // 839 // The replacements are done in this order. If no match is found no 840 // replacement is done. Afterwards ReadWeightsFile for the resulting 841 // path-/filename is called. 842 // 843 Bool_t MExtractTimeAndChargeDigitalFilter::ReadAutomaticWeightsFile() 844 { 845 if (!fAutomaticWeights || fRunHeader->GetRunType()==MRawRunHeader::kRTPedestal) 846 return kTRUE; 847 848 if (fNameWeightsFile.IsNull()) 849 { 850 *fLog << err << "ERROR - Cannot get automatic weights without default filename." << endl; 851 return kFALSE; 852 } 853 854 *fLog << dbg << endl; 855 *fLog << underline << GetDescriptor() << endl; 856 *fLog << " Trying to get automatic weight for " << fNameWeightsFile << endl; 857 893 // The default (+ prepending possible "MC_") is read for: 894 // 895 // - RunType: Pedestal (independant of fAutomaticWeights) 896 // - fAutomaticWeights disabled 897 // 898 // if fAutomaticWeights enabled: 899 // - fNameWeightsFile.IsNull() 900 // - !fCalibPattern 901 // - fCalibPattern->GetPulserColor()==MCalibrationCam::kNONE 902 // 903 // If automatic weights are enabled, the case above didn't take place and 904 // fNameWeightsFile starts with "calibration_weights_" 905 // - the color (blue, UV) is replaced by the appropriate one 906 // taken from the calibration pattern 907 // 908 // In most cases a debug output is printed. Further output about the color 909 // determination can be switched on with debug level > 5; 910 // 911 // Returns: 912 // kFALSE: No new weights set 913 // kTRUE: New weights set 914 // kERROR: Error 915 // 916 Int_t MExtractTimeAndChargeDigitalFilter::GetAutomaticWeights() 917 { 858 918 const Ssiz_t pos = fNameWeightsFile.Last('/')+1; 859 919 const Ssiz_t len = fNameWeightsFile.Length(); 860 920 921 // Split file name in path and name 861 922 TString path = fNameWeightsFile(0, pos>=0?pos:len); 862 923 TString name = fNameWeightsFile(pos>=0?pos:0, len); 863 924 864 if (name.BeginsWith("cosmics_weights") && fRunHeader->GetRunType()==MRawRunHeader::kRTMonteCarlo) 865 { 866 name.Remove(0, 7); 867 name.Prepend("MC"); 868 *fLog << "Run type: Monte Carlo data" << endl; 869 } 870 if (name.BeginsWith("MC_weights") && fRunHeader->GetRunType()==MRawRunHeader::kRTData) 871 { 872 name.Remove(0, 2); 873 name.Prepend("cosmics"); 874 *fLog << "Run type: Cosmics data" << endl; 925 // Remove trailing "MC_" for automatic weights 926 if (fAutomaticWeights && name.BeginsWith("MC_")) 927 name.Remove(0, 3); 928 929 // In case of a pedetsal run no calibration pattern can be available 930 // the default weights are always used. 931 if (fRunHeader->GetRunType()==MRawRunHeader::kRTPedestal) 932 { 933 *fLog << dbg << "Pedestal file... using default weights: " << fNameWeightsFile << endl; 934 return ReadWeightsFile(name, path); 935 } 936 937 // If automatic weights are switched off use default weights 938 if (!fAutomaticWeights) 939 { 940 *fLog << dbg << "Automatic weights switched off... using default weights: " << fNameWeightsFile << endl; 941 return ReadWeightsFile(name, path); 942 } 943 944 // If automatic weights are switched on but no filename is given raise error 945 if (fNameWeightsFile.IsNull()) 946 { 947 *fLog << err << "ERROR - Cannot get automatic weights without default filename." << endl; 948 return kERROR; 949 } 950 951 // If this is no pedestal run, automatic weights are requested and a 952 // filename for the weights file is given pedestal-extraction from 953 // cosmics data is assumed. 954 if (!fCalibPattern) 955 { 956 *fLog << dbg << "No decoded calibration pattern available... using default weights: " << fNameWeightsFile << endl; 957 return ReadWeightsFile(name, path); 958 } 959 960 const Bool_t debug = gLog.GetDebugLevel()>5; 961 962 // If no calibration pattern is available do not change the 963 // current weighs or current weights file name. 964 if (fCalibPattern->GetPulserColor()==MCalibrationCam::kNONE) 965 { 966 // If we are extracting data and the calibration pattern is kNONE 967 // we assume that it is a data file without interleaved events 968 // and calibration pattern information available. 969 if ((fRunHeader->GetRunType()!=MRawRunHeader::kRTData && !fRunHeader->IsMonteCarloRun()) || debug) 970 *fLog << dbg << "No calibration color set so far... guessing default: " << fNameWeightsFile << endl; 971 972 return ReadWeightsFile(name, path); 973 } 974 975 if (debug) 976 { 977 *fLog << dbg << endl; 978 *fLog << underline << GetDescriptor() << endl; 979 *fLog << " Trying to get automatic weight for " << fNameWeightsFile << endl; 980 *fLog << " Run type: "; 875 981 } 876 982 877 983 if (name.BeginsWith("calibration_weights_") && fCalibPattern) 878 984 { 879 *fLog << " Run type: Calibration with color " << (int)fCalibPattern->GetPulserColor() << ", setting "; 985 if (debug) 986 *fLog << " Calibration with color " << fCalibPattern->GetPulserColorStr() << ", setting "; 880 987 switch (fCalibPattern->GetPulserColor()) 881 988 { 882 989 case MCalibrationCam::kBLUE: // 2 883 990 case MCalibrationCam::kGREEN: // 1 884 *fLog << "blue/green" << endl; 991 if (debug) 992 *fLog << "blue/green, "; 885 993 name.ReplaceAll("UV", "blue"); 886 994 break; … … 888 996 case MCalibrationCam::kUV: // 3 889 997 case MCalibrationCam::kCT1: // 0 890 *fLog << "UV/CT1" << endl; 998 if (debug) 999 *fLog << "UV/CT1, "; 891 1000 name.ReplaceAll("blue", "UV"); 892 1001 break; 893 1002 case MCalibrationCam::kNONE: 894 *fLog << "None" << endl;895 1003 break; 896 default: // kNONE=4 897 *fLog << "???" << endl; 898 } 899 } 900 901 path += name; 902 903 return ReadWeightsFile(path); 1004 default: // kNone + etc 1005 *fLog << err << "ERROR - Cannot get automatic weights for " << fCalibPattern->GetPulserColorStr() << endl; 1006 return kERROR; 1007 } 1008 } 1009 1010 return ReadWeightsFile(name, path); 904 1011 } 905 1012 -
trunk/MagicSoft/Mars/msignal/MExtractTimeAndChargeDigitalFilter.h
r7099 r7194 69 69 // MExtractTimeAndChargeDigitalFilter 70 70 void CalcBinningResArrays(); 71 Bool_t ReadAutomaticWeightsFile(); 71 Int_t GetAutomaticWeights(); 72 Bool_t GetWeights(); 73 Int_t ReadWeightsFile(TString filename, TString path=""); 74 TString CompileWeightFileName(TString path, const TString &name) const; 72 75 73 76 // MExtractTimeAndCharge … … 76 79 // MTask 77 80 Int_t PreProcess(MParList *pList); 81 Int_t Process(); 78 82 79 83 protected: … … 85 89 ~MExtractTimeAndChargeDigitalFilter() { } 86 90 87 Bool_t ReadWeightsFile(TString filename);88 89 91 Bool_t WriteWeightsFile(TString filename, 90 92 TH1F *shapehi, TH2F *autocorrhi, … … 92 94 93 95 94 void SetNameWeightsFile(TString s="") { fNameWeightsFile = s; fNameWeightsFileSet=""; } 96 void SetNameWeightsFile(TString s="") { s.ReplaceAll("\015", ""); // This is a fix for TEnv files edited with windows editors 97 fNameWeightsFile = s; fNameWeightsFileSet=""; } 95 98 void EnableAutomaticWeights(Bool_t b=kTRUE) { fAutomaticWeights = b; } 96 99
Note:
See TracChangeset
for help on using the changeset viewer.