Changeset 2728
- Timestamp:
- 12/20/03 13:46:17 (21 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 30 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r2727 r2728 5 5 -*-*- END OF LINE -*-*- 6 6 7 2003/12/20: Thomas Bretz 8 9 * Makefile: 10 - added an option to statically link the programs (for 11 debugging) 12 13 * merpp.cc, readdaq.cc, readraw.cc: 14 - small changes to the command line options 15 (the aim is a generalization) 16 17 * manalysis/MCalibrate.[h,cc]: 18 - removed leading '//' from class description 19 - removed usage of MGeomCam (it is obsolete here) 20 - small changes to make the output fit the 'standard' 21 - take the number of pixels from the containers, added a 22 consistency check 23 - added many small comment about future development 24 - added some const-qualifiers 25 - removed the 'unused/empty' pixels. They are obsolete and not 26 wanted at all. 27 - changed pixid to pixidx 28 29 * manalysis/MCalibrationPix.h: 30 - sorted member functions 31 - added some const qualifiers 32 - added many small comment about future development 33 34 * manalysis/MExtractSignal.cc: 35 - removed arguments from constructor 36 - added corresponding member functions 37 + the convetion is to have only vital arguments in the 38 construtor and member functions to change the default 39 - removed obsolete PostProcess 40 41 * manalysis/MExtractedSignalCam.h, manalysis/MExtractedSignalPix.h: 42 - added corresponding member functions 43 44 * mbase/MArgs.[h,cc]: 45 - added some comments 46 - added options/arguments to Print 47 - added GetNumOptions 48 - added GetNumEntries 49 - added HasOnly 50 - added HasOnlyAndRemove 51 52 * mbase/MEvtLoop.[h,cc]: 53 - removed leading '//' from class description 54 - replaced INT_MAX by kMaxUInt 55 - changed meaning of eventloop argument: 56 now 0 means all-events instead of -1 57 - forward tlist-name from Eventloop to PreProcess 58 59 * mbase/MTime.[h,cc]: 60 - added UpdMagicTime 61 62 * mfilter/MFEventSelector2.cc: 63 - replaced INT_MAX by kMaxUInt 64 65 * mmain/MEventDisplay.[h,cc]: 66 - make use of MEvtLoop::GetTaskList() 67 - removed GetReader 68 69 * mmontecarlo/MMcEnergyEst.cc: 70 - removed leading '//' from class description 71 72 * mranforest/MRanTree.cc: 73 - removed leading '//' from class description 74 - replaced 1e20 by FLT_MAX 75 76 * mraw/MRawEvtHeader.[h,cc], mraw/MRawFileRead.cc, 77 mraw/MRawRead.[h,cc], mraw/MRawRunHeader.cc, 78 mraw/MRawSocketRead.cc: 79 - added decoding of time from event header - UNTESTED! 80 81 * mreport/MReportRun.h: 82 - set class verseion to 0 -- not ment for writing at the 83 moment 84 85 86 7 87 2003/12/19: Markus Gaug, Michele Doro 8 88 9 * manalysis/MExtractSignal.[h,cc] 10 * manalysis/MCalibrate.[h,cc] 11 * manalysis/MCalibrationCalc.[h,cc] 12 * manalysis/MCalibrationPix.[h,cc] 89 * manalysis/MExtractSignal.[h,cc], manalysis/MCalibrate.[h,cc], 90 manalysis/MCalibrationCalc.[h,cc], manalysis/MCalibrationPix.[h,cc]: 13 91 - Treatment of the conversion factors between HI Gain and Lo Gain 14 92 is now done in the MCalibrationPix. -
trunk/MagicSoft/Mars/Makefile
r2704 r2728 21 21 22 22 #PROGRAMS = readraw merpp mars test mona status 23 PROGRAMS = read raw readdaqmerpp star status mars mona23 PROGRAMS = readdaq readraw merpp star status mars mona 24 24 SOLIB = libmars.so 25 25 CINT = M … … 63 63 MRPROPERS = $(SUBDIRS:=.mrproper) 64 64 CLEANERS = $(SUBDIRS:=.clean) 65 LIBS = $(SOLIB) 65 66 66 67 #------------------------------------------------------------------------------ … … 72 73 SRCS = $(SRCFILES) 73 74 HEADERS = $(SRCFILES:.cc=.h) 74 OBJS = $(SRCFILES:.cc=.o) 75 OBJS = $(SRCFILES:.cc=.o) MCint.o 75 76 76 77 ############################################################ 78 all: rmlib $(SOLIB) $(PROGRAMS) 79 @echo " Done. " 80 @echo " " 77 81 78 all: rmlib $(PROGRAMS) $(SOLIB) 82 static: LIBS=$(SUBDIRS:=/*.o) $(OBJS) 83 static: rmlib $(LIBRARIES) $(PROGRAMS) 79 84 @echo " Done. " 80 85 @echo " " … … 83 88 include Makefile.depend 84 89 90 # 85 91 # Use $(CXX) -v ... for a more verbose output 86 92 # 87 # 88 #$(MARS_LIB) 89 $(SOLIB): $(LIBRARIES) $(OBJS) $(HEADERS) MCint.o 93 # ROOTGLIBS must be there - why? How can I link the libraries? 94 $(SOLIB): $(LIBRARIES) $(OBJS) $(HEADERS) 90 95 @echo " Linking $(SOLIB) ..." 91 $(CXX) $(DYNLIB) $(CXXFLAGS) $(OBJS) MCint.o $(SUBDIRS:=/*.o) $(ROOTGLIBS) -o $@ 96 $(CXX) $(CXXFLAGS) $(DYNLIB) $(OBJS) $(SUBDIRS:=/*.o) $(ROOTGLIBS) -o $@ 97 # $(CXX) $(CXXFLAGS) $(DYNLIB) $(OBJS) -Wl,--export-dynamic -Llib $(LIBRARIES:%.a=-l%) -o $@ 92 98 93 $(PROGRAMS): $( SOLIB) $(PROGRAMS:=.o)99 $(PROGRAMS): $(LIBS) $(PROGRAMS:=.o) 94 100 @echo " Linking $@ ..." 95 $(CXX) $(CXXFLAGS) $(ROOTGLIBS) $(SOLIB) $@.o $(MARS_LIB) -o $@ 96 97 # 98 # We could link mars.so instead of all libraries. This would need 99 # some MBs less space on the HD. But this means, that the Shared 100 # Library Path in your system must be set properly to be able to start 101 # 'mars' 102 # 103 #$(PROGRAMS): $(LIBRARIES) $(OBJS) $(HEADERS) $(SOLIB) MCint.o $(PROGRAMS:=.o) 104 # @echo " Linking $@ ..." 105 # $(CXX) $(CXXFLAGS) $@.o $(OBJS) lib/$(SOLIB) MCint.o $(ROOTGLIBS) -o $@ 106 107 # 108 # For later use 109 # 110 #$(PROGRAMS): $(LIBRARIES) $(OBJS) $(HEADERS) MCint.o $(PROGRAMS:=.o) 111 # @echo " Linking $@ ..." 112 # $(CXX) $(CXXFLAGS) $@.o $(OBJS) $(MARS_LIB) -L/usr/X11R6/lib -lX11 -lXpm MCint.o $(ROOTGLIBS) -o $@ 113 # 114 #$(SOLIB): $(LIBRARIES) $(OBJS) $(HEADERS) MCint.o 115 # @echo " Linking $(SOLIB) ..." 116 # $(CXX) -shared $(CXXFLAGS) $(SUBDIRS:=/*.o) $(ROOTGLIBS) -o $@ 117 # mv mars.so lib 101 $(CXX) $(CXXFLAGS) $(ROOTGLIBS) $(LIBS) $@.o $(MARS_LIB) -o $@ 118 102 119 103 $(LIBRARIES): 120 104 @echo " Creating lib$@:" 121 105 (cd $*; make; cd ..; mv $*/$@ lib/lib$@) 122 # (cd $(@:lib/lib%.a=%); make; cd ..; mv $(@:lib/lib%.a=%)/$(@:lib/lib%=%) $@)123 106 124 107 $(MRPROPERS): -
trunk/MagicSoft/Mars/manalysis/MCalibrate.cc
r2726 r2728 24 24 25 25 ////////////////////////////////////////////////////////////////////////////// 26 // // 27 // MCalibrate // 28 // // 29 // This task takes the integrated charge from MExtractedSignal and apply // 30 // the calibration constants from MCalibraitionCam to the charge. Then // 31 // stores number of photons obtained in MCerPhotEvt. // 32 // // 33 // Input Containers: // 34 // // 35 // MGeomCam // 36 // MExtractedSingal // 37 // MCalibrationCam // 38 // // 39 // Output Containers: // 40 // // 41 // MCerPhotEvt // 42 // // 26 // 27 // MCalibrate 28 // 29 // This task takes the integrated charge from MExtractedSignal and apply 30 // the calibration constants from MCalibraitionCam to the charge. Then 31 // stores number of photons obtained in MCerPhotEvt. 32 // 33 // Input Containers: 34 // MExtractedSingal 35 // MCalibrationCam 36 // 37 // Output Containers: 38 // MCerPhotEvt 39 // 43 40 ////////////////////////////////////////////////////////////////////////////// 44 45 41 #include "MCalibrate.h" 46 42 #include "MCalibrationConfig.h" … … 74 70 MCalibrate::MCalibrate(const char *name, const char *title) 75 71 { 76 77 72 fName = name ? name : "MCalibrate"; 78 73 fTitle = title ? title : "Task to calculate the number of photons in one event"; 79 80 74 } 81 75 … … 94 88 Int_t MCalibrate::PreProcess(MParList *pList) 95 89 { 96 97 fGeomCam = (MGeomCam*)pList->FindObject("MGeomCam");98 if (!fGeomCam)99 {100 *fLog << err << dbginf << "MGeomCam not found ... aborting." << endl;101 return kFALSE;102 }103 104 90 fSignals = (MExtractedSignalCam*)pList->FindObject("MExtractedSignalCam"); 105 91 if (!fSignals) 106 107 *fLog << err << dbginf <<"MExtractedSignalCam not found ... aborting" << endl;92 { 93 *fLog << err << "MExtractedSignalCam not found ... aborting" << endl; 108 94 return kFALSE; 109 95 } 110 96 111 97 fCalibrations = (MCalibrationCam*)pList->FindObject("MCalibrationCam"); 112 98 if (!fCalibrations) 113 114 *fLog << err << dbginf << "MCalibrationCam not found ... aborting." << endl;99 { 100 *fLog << err << "MCalibrationCam not found ... aborting." << endl; 115 101 return kFALSE; 116 102 } 117 103 118 104 fCerPhotEvt = (MCerPhotEvt*)pList->FindCreateObj("MCerPhotEvt"); 119 105 if (!fCerPhotEvt) 120 {121 *fLog << err << dbginf << "Cannot create MCerPhotEvt ... aborting" << endl;122 106 return kFALSE; 123 }124 107 125 108 return kTRUE; 126 109 } 127 128 110 129 111 // -------------------------------------------------------------------------- … … 132 114 Int_t MCalibrate::Process() 133 115 { 134 UInt_t imaxnumpix = fGeomCam->GetNumPixels(); 116 if (fCalibrations->GetNumPixels() != (UInt_t)fSignals->GetSize()) 117 { 118 // FIXME: MExtractedSignal must be of variable size - 119 // like MCerPhotEvt - because we must be able 120 // to reduce size by zero supression 121 // For the moment this check could be done in ReInit... 122 *fLog << err << "MExtractedSignal and MCalibrationCam have different sizes... abort." << endl; 123 return kFALSE; 124 } 125 126 const UInt_t imaxnumpix = fSignals->GetSize(); 135 127 136 for (UInt_t pixid = 0; pixid < imaxnumpix; pixid++)128 for (UInt_t pixidx=0; pixidx<imaxnumpix; pixidx++) 137 129 { 138 MCalibrationPix &pix = (*fCalibrations)[pixid];130 const MCalibrationPix &pix = (*fCalibrations)[pixidx]; 139 131 132 if (!pix.IsBlindPixelMethodValid()) 133 continue; 140 134 141 if (pix.IsBlindPixelMethodValid()) 142 { 143 MExtractedSignalPix &sig = (*fSignals)[pixid]; 135 MExtractedSignalPix &sig = (*fSignals)[pixidx]; 144 136 145 146 137 Float_t signal; 138 Float_t signalErr = 0.; 147 139 148 if (sig.IsLoGainUsed()) 149 { 150 signal = sig.GetExtractedSignalLoGain()*pix.GetConversionHiLo(); 151 signalErr = signal*pix.GetConversionHiLoError(); 152 } 153 else 154 { 155 signal = sig.GetExtractedSignalHiGain(); 156 } 157 158 // Float_t calibrationConvertionFactor = pix.GetMeanConversionFFactorMethod(); 159 Float_t calibrationConversionFactor = pix.GetMeanConversionBlindPixelMethod(); 160 Float_t calibrationConversionFactorError = pix.GetErrorConversionBlindPixelMethod(); 140 if (sig.IsLoGainUsed()) 141 { 142 signal = sig.GetExtractedSignalLoGain()*pix.GetConversionHiLo(); 143 signalErr = signal*pix.GetConversionHiLoError(); 144 } 145 else 146 { 147 signal = sig.GetExtractedSignalHiGain(); 148 } 161 149 162 Float_t nphot = signal*calibrationConversionFactor; 163 Float_t nphotErr = signal*calibrationConversionFactorError 164 *signal*calibrationConversionFactorError; 165 nphotErr += signalErr*calibrationConversionFactor 166 *signalErr*calibrationConversionFactor; 150 // Float_t calibrationConvertionFactor = pix.GetMeanConversionFFactorMethod(); 151 const Float_t calibrationConversionFactor = pix.GetMeanConversionBlindPixelMethod(); 152 const Float_t calibrationConversionFactorError = pix.GetErrorConversionBlindPixelMethod(); 167 153 168 nphotErr = TMath::Sqrt(nphotErr); 154 const Float_t nphot = signal*calibrationConversionFactor; 155 Float_t nphotErr = signal*calibrationConversionFactorError 156 *signal*calibrationConversionFactorError; 157 nphotErr += signalErr*calibrationConversionFactor 158 *signalErr*calibrationConversionFactor; 169 159 170 fCerPhotEvt->AddPixel(pixid, nphot, nphotErr); 171 } 172 else 173 { 174 fCerPhotEvt->AddPixel(pixid, 0., 0.); 175 (*fCerPhotEvt)[pixid].SetPixelUnused(); 176 } 160 nphotErr = TMath::Sqrt(nphotErr); 161 162 fCerPhotEvt->AddPixel(pixidx, nphot, nphotErr); 177 163 } 178 164 … … 182 168 return kTRUE; 183 169 } 184 -
trunk/MagicSoft/Mars/manalysis/MCalibrate.h
r2725 r2728 25 25 class MCalibrate : public MTask 26 26 { 27 28 MGeomCam *fGeomCam; // Geometry of the camera 27 private: 29 28 MCalibrationCam *fCalibrations; // Calibration constants 30 29 MExtractedSignalCam *fSignals; // Integrated charge in FADCs counts … … 40 39 MCalibrate(const char *name=NULL, const char *title=NULL); 41 40 42 void SetConversionHiLo(Float_t conv) 41 void SetConversionHiLo(Float_t conv) { fConversionHiLo = conv; } 43 42 44 43 ClassDef(MCalibrate, 0) // Task to calculate cerenkov photons using calibration constants -
trunk/MagicSoft/Mars/manalysis/MCalibrationPix.h
r2725 r2728 68 68 void Clear(Option_t *o=""); 69 69 70 Float_t GetCharge() const { return fCharge; } 71 Float_t GetRSigmaSquare() const { return fRSigmaSquare; } 70 // Getter 71 Bool_t IsFitValid() const { return fFitValid; } 72 Bool_t IsFitted() const { return fFitted; } 73 Bool_t IsBlindPixelMethodValid() const { return fBlindPixelMethodValid; } 74 Bool_t IsFFactorMethodValid() const { return fFFactorMethodValid; } 75 Bool_t IsPINDiodeMethodValid() const { return fPINDiodeMethodValid; } 76 77 Float_t GetCharge() const { return fCharge; } 78 Float_t GetRSigmaSquare() const { return fRSigmaSquare; } 72 79 73 Float_t GetErrCharge() const{ return fErrCharge; }74 Float_t GetChargeProb() const{ return fChargeProb; }80 Float_t GetErrCharge() const { return fErrCharge; } 81 Float_t GetChargeProb() const { return fChargeProb; } 75 82 76 Float_t GetSigmaCharge() const { return fSigmaCharge; } 77 Float_t GetErrSigmaCharge() const { return fErrSigmaCharge; } 78 Float_t GetTime() const { return fTime; } 79 Float_t GetSigmaTime() const { return fSigmaTime; } 80 Float_t GetTimeChiSquare() const { return fTimeChiSquare; } 81 82 Float_t GetPed() const { return fPed; } 83 Float_t GetPedRms() const { return fPedRms; } 83 Float_t GetSigmaCharge() const { return fSigmaCharge; } 84 Float_t GetErrSigmaCharge() const { return fErrSigmaCharge; } 85 Float_t GetTime() const { return fTime; } 86 Float_t GetSigmaTime() const { return fSigmaTime; } 87 Float_t GetTimeChiSquare() const { return fTimeChiSquare; } 84 88 89 Float_t GetConversionHiLo() const { return fConversionHiLo; } 90 Float_t GetConversionHiLoError() const { return fConversionHiLoError; } 91 92 Float_t GetMeanConversionBlindPixelMethod() const { return fConversionBlindPixelMethod ; } 93 Float_t GetErrorConversionBlindPixelMethod() const { return fConversionErrorBlindPixelMethod ; } 94 Float_t GetSigmaConversionBlindPixelMethod() const { return fConversionSigmaBlindPixelMethod ; } 95 96 Float_t GetMeanConversionFFactorMethod() const { return fConversionFFactorMethod ; } 97 Float_t GetErrorConversionFFactorMethod() const { return fConversionErrorFFactorMethod ; } 98 Float_t GetSigmaConversionFFactorMethod() const { return fConversionSigmaFFactorMethod ; } 99 100 Float_t GetPheFFactorMethod() const { return fPheFFactorMethod; } 101 Float_t GetPheFFactorMethodError() const { return fPheFFactorMethodError; } 102 103 Float_t GetMeanConversionPINDiodeMethod() const { return fConversionPINDiodeMethod ; } 104 Float_t GetErrorConversionPINDiodeMethod() const { return fConversionErrorPINDiodeMethod ; } 105 Float_t GetSigmaConversionPINDiodeMethod() const { return fConversionSigmaPINDiodeMethod ; } 106 107 // FIXME: Remove this from stored data members 108 Float_t GetPed() const { return fPed; } 109 Float_t GetPedRms() const { return fPedRms; } 110 111 // Setter 85 112 void SetPedestal(Float_t ped, Float_t pedrms); 86 void SetHiGainSaturation() { fHiGainSaturation = kTRUE; fHist->SetUseLoGain(); }113 void SetHiGainSaturation() { fHiGainSaturation = kTRUE; fHist->SetUseLoGain(); } 87 114 88 void ApplyLoGainConversion(); 115 void SetConversionHiLo(Float_t c) { fConversionHiLo = c; } 116 void SetConversionHiLoError(Float_t e) { fConversionHiLoError = e; } 89 117 90 void SetConversionHiLo(Float_t c) { fConversionHiLo = c; } 91 void SetConversionHiLoError(Float_t e) { fConversionHiLoError = e; } 92 93 Float_t GetConversionHiLo() { return fConversionHiLo; } 94 Float_t GetConversionHiLoError() { return fConversionHiLoError; } 95 96 void SetConversionFFactorMethod(Float_t c, Float_t err, Float_t sig) 97 { 98 fConversionFFactorMethod = c; 99 fConversionErrorFFactorMethod = err; 100 fConversionSigmaFFactorMethod = sig; 101 } 102 void SetConversionBlindPixelMethod(Float_t c, Float_t err, Float_t sig) 103 { 104 fConversionBlindPixelMethod = c; 105 fConversionErrorBlindPixelMethod = err; 106 fConversionSigmaBlindPixelMethod = sig; 107 } 118 void SetConversionFFactorMethod(Float_t c, Float_t err, Float_t sig) 119 { 120 fConversionFFactorMethod = c; 121 fConversionErrorFFactorMethod = err; 122 fConversionSigmaFFactorMethod = sig; 123 } 124 void SetConversionBlindPixelMethod(Float_t c, Float_t err, Float_t sig) 125 { 126 fConversionBlindPixelMethod = c; 127 fConversionErrorBlindPixelMethod = err; 128 fConversionSigmaBlindPixelMethod = sig; 129 } 108 130 109 131 void SetConversionPINDiodeMethod(Float_t c, Float_t err, Float_t sig) 110 {111 112 fConversionErrorPINDiodeMethod = err; 113 fConversionSigmaPINDiodeMethod = sig; 114 132 { 133 fConversionPINDiodeMethod = c ; 134 fConversionErrorPINDiodeMethod = err; 135 fConversionSigmaPINDiodeMethod = sig; 136 } 115 137 116 Float_t GetMeanConversionBlindPixelMethod() const { return fConversionBlindPixelMethod ; } 117 Float_t GetErrorConversionBlindPixelMethod() const { return fConversionErrorBlindPixelMethod ; } 118 Float_t GetSigmaConversionBlindPixelMethod() const { return fConversionSigmaBlindPixelMethod ; } 138 void SetFitValid() { fFitValid = kTRUE; } 139 void SetFitted() { fFitted = kTRUE; } 140 void SetBlindPixelMethodValid(Bool_t b=kTRUE) { fBlindPixelMethodValid = b; } 141 void SetFFactorMethodValid(Bool_t b=kTRUE) { fFFactorMethodValid = b; } 142 void SetPINDiodeMethodValid(Bool_t b=kTRUE) { fPINDiodeMethodValid = b; } 119 143 120 Float_t GetMeanConversionFFactorMethod() const { return fConversionFFactorMethod ; } 121 Float_t GetErrorConversionFFactorMethod() const { return fConversionErrorFFactorMethod ; } 122 Float_t GetSigmaConversionFFactorMethod() const { return fConversionSigmaFFactorMethod ; } 123 124 Float_t GetPheFFactorMethod() const { return fPheFFactorMethod; } 125 Float_t GetPheFFactorMethodError() const { return fPheFFactorMethodError; } 126 127 Float_t GetMeanConversionPINDiodeMethod() const { return fConversionPINDiodeMethod ; } 128 Float_t GetErrorConversionPINDiodeMethod() const { return fConversionErrorPINDiodeMethod ; } 129 Float_t GetSigmaConversionPINDiodeMethod() const { return fConversionSigmaPINDiodeMethod ; } 144 // Unknown 145 void ApplyLoGainConversion(); 130 146 131 147 void SetChargesInGraph(Float_t qhi,Float_t qlo) { fHist->SetPointInGraph(qhi,qlo); } … … 139 155 Bool_t FillRChargevsTimeLoGain(Float_t rq, Int_t t) { return fHist->FillChargevsNLoGain(rq,t); } 140 156 141 Bool_t IsFitValid() { return fFitValid; } 142 Bool_t IsFitted() { return fFitted; } 143 Bool_t IsBlindPixelMethodValid() { return fBlindPixelMethodValid; } 144 Bool_t IsFFactorMethodValid() { return fFFactorMethodValid; } 145 Bool_t IsPINDiodeMethodValid() { return fPINDiodeMethodValid; } 146 147 void SetFitValid() { fFitValid = kTRUE; } 148 void SetFitted() { fFitted = kTRUE; } 149 void SetBlindPixelMethodValid(Bool_t b=kTRUE) { fBlindPixelMethodValid = b; } 150 void SetFFactorMethodValid(Bool_t b=kTRUE) { fFFactorMethodValid = b; } 151 void SetPINDiodeMethodValid(Bool_t b=kTRUE) { fPINDiodeMethodValid = b; } 152 157 // FIXME: Not necessary -> pixidx (not id anyhow!) == index in array! 158 // Only needed n histograms which have to move to an MH-class anyhow! 153 159 Int_t GetPixId() const { return fPixId; } 154 160 void DefinePixId(Int_t i); -
trunk/MagicSoft/Mars/manalysis/MExtractSignal.cc
r2725 r2728 56 56 // Default constructor. 57 57 // 58 MExtractSignal::MExtractSignal( const Byte_t first, const Byte_t last, const Byte_t logainshift,58 MExtractSignal::MExtractSignal(/*const Byte_t first, const Byte_t last, const Byte_t logainshift,*/ 59 59 const char *name, const char *title) 60 : fNumHiGainSamples(last-first+1), fNumLoGainSamples(last-first+1),60 : /*fNumHiGainSamples(last-first+1), fNumLoGainSamples(last-first+1),*/ 61 61 fSaturationLimit(254) 62 62 { … … 67 67 AddToBranchList("MRawEvtData.*"); 68 68 69 SetRange(); 70 /* 71 fFirst = first; 72 fLoGainFirst = first+logainshift; 73 74 fSqrtHiGainSamples = TMath::Sqrt((Float_t)fNumHiGainSamples); 75 fSqrtLoGainSamples = TMath::Sqrt((Float_t)fNumLoGainSamples); 76 */ 77 } 78 79 void MExtractSignal::SetRange(Byte_t first, Byte_t last, Byte_t logainshift) 80 { 81 fNumHiGainSamples = last-first+1; 82 fNumLoGainSamples = last-first+1; 83 69 84 fFirst = first; 70 85 fLoGainFirst = first+logainshift; 71 86 72 fSqrtHiGainSamples = TMath::Sqrt((Float_t)fNumHiGainSamples); 73 fSqrtLoGainSamples = TMath::Sqrt((Float_t)fNumLoGainSamples); 87 fSqrtHiGainSamples = TMath::Sqrt((Float_t)fNumHiGainSamples); 88 fSqrtLoGainSamples = TMath::Sqrt((Float_t)fNumLoGainSamples); 74 89 } 75 90 … … 87 102 Int_t MExtractSignal::PreProcess(MParList *pList) 88 103 { 89 90 104 fRawEvt = (MRawEvtData*)pList->FindObject("MRawEvtData"); 91 105 if (!fRawEvt) 92 106 { 93 *fLog << dbginf<< "MRawEvtData not found... aborting." << endl;107 *fLog << err << "MRawEvtData not found... aborting." << endl; 94 108 return kFALSE; 95 109 } … … 103 117 if (!fPedestals) 104 118 { 105 *fLog << err << dbginf << "Cannot find MPedestalCam... aborting" << endl;119 *fLog << err << "MPedestalCam not found... aborting" << endl; 106 120 return kFALSE; 107 121 } … … 118 132 Bool_t MExtractSignal::ReInit(MParList *pList ) 119 133 { 120 121 122 134 MGeomCam *cam = (MGeomCam*)pList->FindObject(AddSerialNumber("MGeomCam")); 123 135 if (!cam) … … 127 139 } 128 140 141 // FIXME: This solution may change in the future, MExtractedSignal 142 // must be similar to MCerPhotEvt not to MPedestalCam 143 // (Have to think about the mean size of both solutions) 129 144 fSignals->InitSize(cam->GetNumPixels()); 130 145 131 132 fSignals->SetNumUsedFADCSlices(fNumHiGainSamples,fFirst,fFirst+fNumHiGainSamples-1, 133 fNumLoGainSamples,fFirst,fFirst+fNumLoGainSamples-1); 146 fSignals->SetNumUsedFADCSlices(fNumHiGainSamples, fFirst, fFirst+fNumHiGainSamples-1, 147 fNumLoGainSamples, fFirst, fFirst+fNumLoGainSamples-1); 134 148 135 149 return kTRUE; … … 144 158 Int_t MExtractSignal::Process() 145 159 { 146 147 160 MRawEvtPixelIter pixel(fRawEvt); 148 161 fSignals->Clear(); 149 162 150 163 while (pixel.Next()) 151 { 152 164 { 153 165 UShort_t satHi = 0; 154 166 UShort_t satLo = 0; … … 219 231 ); 220 232 221 pix.SetGainSaturation((satHi),satHi,satLo); 222 233 pix.SetGainSaturation(satHi, satHi, satLo); 234 235 // FIXME: Arrival time has to be stored in MArrivalTime! 223 236 if (satHi) 224 237 pix.SetArrivalTimes((Float_t)(midlo+fFirst),0.,0.); … … 233 246 return kTRUE; 234 247 } 235 236 Int_t MExtractSignal::PostProcess()237 {238 239 return kTRUE;240 241 } -
trunk/MagicSoft/Mars/manalysis/MExtractedSignalCam.h
r2699 r2728 7 7 8 8 class TClonesArray; 9 10 class MGeomCam;11 9 class MExtractedSignalPix; 12 10 … … 16 14 TClonesArray *fArray; // FIXME: Change TClonesArray away from a pointer? 17 15 16 // FIXME: Is it necessary to store this information for each event? 18 17 Byte_t fNumUsedHiGainFADCSlices; 19 18 Byte_t fNumUsedLoGainFADCSlices; … … 24 23 Byte_t fLastUsedSliceHiGain; 25 24 Byte_t fLastUsedSliceLoGain; 26 27 25 28 26 public: … … 47 45 48 46 void SetNumUsedFADCSlices(Byte_t numh, Byte_t firsth, Byte_t lasth, 49 Byte_t numl, Byte_t firstl, Byte_t lastl) 50 { 51 fNumUsedHiGainFADCSlices = numh; 52 fFirstUsedSliceHiGain = firsth; 53 fLastUsedSliceHiGain = lasth; 54 fNumUsedLoGainFADCSlices = numl; 55 fFirstUsedSliceLoGain = firstl; 56 fLastUsedSliceLoGain = lastl; 57 } 47 Byte_t numl, Byte_t firstl, Byte_t lastl) 48 { 49 // FIXME: Calculate the number of used slices from first/last 50 // to make sure, that the stored values are always 51 // consistent! 52 fNumUsedHiGainFADCSlices = numh; 53 fFirstUsedSliceHiGain = firsth; 54 fLastUsedSliceHiGain = lasth; 55 fNumUsedLoGainFADCSlices = numl; 56 fFirstUsedSliceLoGain = firstl; 57 fLastUsedSliceLoGain = lastl; 58 } 58 59 59 60 MExtractedSignalPix &operator[](Int_t i); -
trunk/MagicSoft/Mars/manalysis/MExtractedSignalPix.h
r2706 r2728 9 9 { 10 10 private: 11 11 // FIXME: We can only store ONE signal. Everything else takes 12 // too much storage space - will change in the future. 12 13 Float_t fExtractedSignalHiGain; // mean value of the extracted signal 13 14 Float_t fExtractedSignalHiGainError; // error of the mean value of the extracted signal 14 15 Float_t fExtractedSignalLoGain; // mean value of the extracted signal 15 16 Float_t fExtractedSignalLoGainError; // error of the mean value of the extracted signal 17 16 18 Bool_t fIsLoGainUsed; 17 19 Byte_t fNumHiGainSaturated; 18 20 Byte_t fNumLoGainSaturated; 19 21 22 // FIXME: Will be removed. Must be stored in MArrivalTime 20 23 Float_t fMeanArrivalTime; 21 24 Float_t fWidthArrivalTime; -
trunk/MagicSoft/Mars/mbase/MArgs.cc
r2529 r2728 30 30 // This is a helper class for executables to parse command line arguments 31 31 // 32 // Arguments beginning with a trailing '-' are called 'options'. 33 // Arguments without a trailing '-' are considered 'arguments' 34 // 32 35 ////////////////////////////////////////////////////////////////////////////// 33 36 #include "MArgs.h" … … 82 85 // -------------------------------------------------------------------------- 83 86 // 84 // Print all arguments parsed. 87 // Print everything parsed. 88 // Using 'options' as option only 'options' are printed. 89 // Using 'arguments' as option only 'arguments' are printed. 85 90 // 86 91 void MArgs::Print(const Option_t *o) const 87 92 { 88 93 gLog << all << underline << fName << ":" << endl; 94 95 const TString str(o); 96 97 if (!str.CompareTo("options", TString::kIgnoreCase)) 98 { 99 TIter Next(fArgv); 100 TString *s = NULL; 101 while ((s=dynamic_cast<TString*>(Next()))) 102 if (s->BeginsWith("-")) 103 gLog << *s << endl; 104 return; 105 } 106 107 if (!str.CompareTo("arguments", TString::kIgnoreCase)) 108 { 109 TIter Next(fArgv); 110 TString *s = NULL; 111 while ((s=dynamic_cast<TString*>(Next()))) 112 if (!s->BeginsWith("-")) 113 gLog << *s << endl; 114 return; 115 } 116 89 117 fArgv->Print(); 90 118 } … … 246 274 // -------------------------------------------------------------------------- 247 275 // 276 // return the number of arguments with a trainling '-' 277 // 278 Int_t MArgs::GetNumOptions() const 279 { 280 Int_t num = 0; 281 282 TIter Next(fArgv); 283 TString *s = NULL; 284 while ((s=dynamic_cast<TString*>(Next()))) 285 if (s->BeginsWith("-")) 286 num++; 287 288 return num; 289 } 290 291 // -------------------------------------------------------------------------- 292 // 293 // return the total number of entries 294 // 295 Int_t MArgs::GetNumEntries() const 296 { 297 return fArgv->GetSize(); 298 } 299 300 // -------------------------------------------------------------------------- 301 // 248 302 // Checks whether an argument beginning with 'n' is existing, eg: 249 303 // executable -value5 … … 259 313 while ((s=dynamic_cast<TString*>(Next()))) 260 314 if (s->BeginsWith(name)) 315 return kTRUE; 316 return kFALSE; 317 } 318 319 // -------------------------------------------------------------------------- 320 // 321 // Checks whether an argument beginning with 'n' is existing, eg: 322 // executable -value5 323 // HasOption("-value") will return false 324 // executable -value 325 // HasOption("-value") will return true 326 // 327 Bool_t MArgs::HasOnly(const TString n) const 328 { 329 const TString name = n.Strip(TString::kBoth); 330 331 TIter Next(fArgv); 332 TString *s = NULL; 333 while ((s=dynamic_cast<TString*>(Next()))) 334 if (*s==name) 261 335 return kTRUE; 262 336 return kFALSE; … … 284 358 return kFALSE; 285 359 } 360 361 // -------------------------------------------------------------------------- 362 // 363 // Checks whether an argument beginning with 'n' is exists and a 364 // corresponding option is available, eg. 365 // executable -value5 366 // HasOption("-value") will return false 367 // but: 368 // executable -value 369 // HasOption("-value") will return true 370 // 371 // The argument is removed from the internal list. 372 // 373 Bool_t MArgs::HasOnlyAndRemove(const TString n) 374 { 375 const TString name = n.Strip(TString::kBoth); 376 377 TIter Next(fArgv); 378 TString *s = NULL; 379 while ((s=dynamic_cast<TString*>(Next()))) 380 if (*s==name) 381 { 382 delete fArgv->Remove(dynamic_cast<TObject*>(s)); 383 return kTRUE; 384 } 385 386 return kFALSE; 387 } -
trunk/MagicSoft/Mars/mbase/MArgs.h
r2529 r2728 47 47 TString GetStringAndRemove(const TString name); 48 48 49 Bool_t Has(const TString name) const; 50 Bool_t HasOption(const TString name) const; 49 Bool_t Has(const TString name) const; 50 Bool_t HasOnly(const TString name) const; 51 Bool_t HasOption(const TString name) const; 52 Bool_t HasOnlyAndRemove(const TString name); 51 53 52 TString GetArgumentStr(Int_t i) const; 53 Int_t GetArgumentInt(Int_t i) const; 54 Float_t GetArgumentFloat(Int_t i) const; 55 Int_t GetNumArguments() const; 54 TString GetArgumentStr(Int_t i) const; 55 Int_t GetArgumentInt(Int_t i) const; 56 Float_t GetArgumentFloat(Int_t i) const; 57 Int_t GetNumArguments() const; 58 Int_t GetNumOptions() const; 59 Int_t GetNumEntries() const; 56 60 57 61 ClassDef(MArgs, 0) //Class to parse command line arguments -
trunk/MagicSoft/Mars/mbase/MEvtLoop.cc
r2490 r2728 25 25 26 26 ////////////////////////////////////////////////////////////////////////////// 27 // //28 // MEvtLoop //29 // //30 // This class is the core of each event processing. //31 // First you must set the parameter list to use. The parameter list //32 // must contain the task list (MTaskList) to use. The name of the task //33 // list can be specified if you call Eventloop. The standard name is //34 // "MTaskList". The name you specify must match the name of the MTaskList //35 // object. //36 // //37 // If you call Eventloop() first all PreProcess functions - with the //38 // parameter list as an argument - of the tasks in the task list are //39 // executed. If one of them returns kFALSE then the execution is stopped. //40 // If the preprocessing was ok, The Process function of the tasks are //41 // executed as long as one function returns kSTOP. Only the tasks which //42 // are marked as "All" or with a string which matches the MInputStreamID //43 // of MTaskList are executed. If one tasks returns kCONTINUE the pending //44 // tasks in the list are skipped and the execution in continued with //45 // the first one in the list. //46 // Afterwards the PostProcess functions are executed. //47 // //48 // If you want to display the progress in a gui you can use SetProgressBar //49 // and a TGProgressBar or a MProgressBar. If you set a MStatusDisplay //50 // using SetDisplay, the Progress bar from this display is used. //51 // //52 // You can create a macro from a completely setup eventloop by: //53 // evtloop.MakeMacro("mymacro.C"); //54 // //55 // You will always need to check the macro, it will not run, but it //56 // should have al important information. //57 // //58 // //59 // You can also write all this information to a root file: //60 // TFile file("myfile.root"); //61 // evtloop.Write("MyEvtloopKey"); //62 // //63 // You can afterwards read the information from an open file by: //64 // evtloop.Read("MyEvtloopKey"); //65 // //66 // To lookup the information write it to a file using MakeMacro //67 // //27 // 28 // MEvtLoop 29 // 30 // This class is the core of each event processing. 31 // First you must set the parameter list to use. The parameter list 32 // must contain the task list (MTaskList) to use. The name of the task 33 // list can be specified if you call Eventloop. The standard name is 34 // "MTaskList". The name you specify must match the name of the MTaskList 35 // object. 36 // 37 // If you call Eventloop() first all PreProcess functions - with the 38 // parameter list as an argument - of the tasks in the task list are 39 // executed. If one of them returns kFALSE then the execution is stopped. 40 // If the preprocessing was ok, The Process function of the tasks are 41 // executed as long as one function returns kSTOP. Only the tasks which 42 // are marked as "All" or with a string which matches the MInputStreamID 43 // of MTaskList are executed. If one tasks returns kCONTINUE the pending 44 // tasks in the list are skipped and the execution in continued with 45 // the first one in the list. 46 // Afterwards the PostProcess functions are executed. 47 // 48 // If you want to display the progress in a gui you can use SetProgressBar 49 // and a TGProgressBar or a MProgressBar. If you set a MStatusDisplay 50 // using SetDisplay, the Progress bar from this display is used. 51 // 52 // You can create a macro from a completely setup eventloop by: 53 // evtloop.MakeMacro("mymacro.C"); 54 // 55 // You will always need to check the macro, it will not run, but it 56 // should have al important information. 57 // 58 // 59 // You can also write all this information to a root file: 60 // TFile file("myfile.root"); 61 // evtloop.Write("MyEvtloopKey"); 62 // 63 // You can afterwards read the information from an open file by: 64 // evtloop.Read("MyEvtloopKey"); 65 // 66 // To lookup the information write it to a file using MakeMacro 67 // 68 68 ////////////////////////////////////////////////////////////////////////////// 69 69 #include "MEvtLoop.h" … … 393 393 // for developers or use in special jobs only! 394 394 // 395 Int_t MEvtLoop::Process( Int_t maxcnt)395 Int_t MEvtLoop::Process(UInt_t maxcnt) 396 396 { 397 397 if (!fTaskList) … … 404 404 *fLog << all <<"Eventloop running ("; 405 405 406 if (maxcnt <0)406 if (maxcnt==0) 407 407 *fLog << "all"; 408 408 else … … 411 411 *fLog << " events)..." << flush; 412 412 413 Int_t entries = INT_MAX;413 UInt_t entries = kMaxUInt; 414 414 fNumEvents = 0; 415 415 … … 420 420 421 421 #ifdef __MARS__ 422 // limits.h423 422 MRead *read = (MRead*)fTaskList->FindObject("MRead"); 424 423 if (read && read->GetEntries()>0) … … 429 428 fNumEvents = TMath::Min(maxcnt, entries); 430 429 else 431 if (entries!= INT_MAX)430 if (entries!=kMaxUInt) 432 431 fNumEvents = entries; 433 432 } … … 439 438 } 440 439 441 Int_t dummy = maxcnt<0 ? 0 : maxcnt;442 443 440 // 444 441 // start a stopwatch … … 449 446 // 450 447 // This is the MAIN EVENTLOOP which processes the data 451 // if maxcnt <0 the number of processed events is counted448 // if maxcnt==0 the number of processed events is counted 452 449 // else only maxcnt events are processed 453 450 // 454 Int_t numcnts = 0; 451 UInt_t numcnts = 0; 452 UInt_t dummy = maxcnt; 455 453 456 454 Int_t rc = kTRUE; 457 if (maxcnt <0)455 if (maxcnt==0) 458 456 // process first and increment if sucessfull 459 457 while ((rc=fTaskList->Process())==kTRUE) … … 529 527 // See class description above. Returns kTRUE if PreProcessing, 530 528 // Processing and PostProcessing was successfull, otherwise kFALSE. 531 // 532 Bool_t MEvtLoop::Eventloop(Int_t maxcnt, const char *tlist) 529 // maxcnt==0 means: all events 530 // tlist is the name of the task-list to be used. Be carefull, this 531 // feature is not finally implemented - it will only work if no 532 // task will access the tasklist. 533 // 534 Bool_t MEvtLoop::Eventloop(UInt_t maxcnt, const char *tlist) 533 535 { 534 536 TDatime d; 535 537 *fLog << inf << underline << "Eventloop: " << fName << " started at " << d.AsString() << endl; 536 538 537 Bool_t rc = PreProcess( );539 Bool_t rc = PreProcess(tlist); 538 540 539 541 // -
trunk/MagicSoft/Mars/mbase/MEvtLoop.h
r2490 r2728 63 63 64 64 Bool_t PreProcess(const char *tlist="MTaskList"); 65 Int_t Process( Int_t maxcnt);65 Int_t Process(UInt_t maxcnt); 66 66 Bool_t PostProcess() const; 67 67 68 Bool_t Eventloop( Int_t maxcnt=-1, const char *tlist="MTaskList");68 Bool_t Eventloop(UInt_t maxcnt=0, const char *tlist="MTaskList"); 69 69 70 70 void MakeMacro(const char *filename="evtloop.C"); -
trunk/MagicSoft/Mars/mbase/MTime.cc
r2678 r2728 27 27 // MTime 28 28 // 29 // A generalized MARS time stamp 29 // A generalized MARS time stamp. 30 30 // 31 31 // WARNING: Be carefull changing this class. It is also used in the 32 32 // MAGIC drive software cosy! 33 // 34 // Remarke: If you encounter strange behaviour, check the casting. 35 // Note, that on Linux machines ULong_t and UInt_t is the same. 33 36 // 34 37 // Version 1: … … 206 209 207 210 fMjd = mjd+1; 211 } 212 213 // -------------------------------------------------------------------------- 214 // 215 // Update the magic time. Make sure, that the MJD is set correctly. 216 // It must be the MJD of the corresponding night. You can set it 217 // by Set(2003, 12, 24); 218 // 219 // It is highly important, that the time correspoding to the night is 220 // between 13:00:00.0 (day of dawning) and 12:59:59.999 (day of sunrise) 221 // 222 Bool_t MTime::UpdMagicTime(Byte_t h, Byte_t m, Byte_t s, UShort_t ms) 223 { 224 if (h>23 || m>59 || s>59 || ms>999) 225 return kFALSE; 226 227 const ULong_t tm = ((((h*60+m)*60)+s)*1000)+ms; 228 229 fTime = (Long_t)(tm < kHour*13 ? tm : tm-kDay); // day of sunrise? 230 //fNanoSec = ns; 231 232 return kTRUE; 233 208 234 } 209 235 -
trunk/MagicSoft/Mars/mbase/MTime.h
r2636 r2728 26 26 class MTime : public MParContainer 27 27 { 28 p rivate:28 public: 29 29 static const UInt_t kHour; // [ms] one hour 30 30 static const UInt_t kDay; // [ms] one day 31 31 32 private: 32 33 UInt_t fMjd; // [d] Day in the century (Day of sun rise) 33 34 TTime fTime; // [ms] Time of Day (-11h<=x<13h) … … 74 75 75 76 Bool_t Set(UInt_t mjd, ULong_t ms, UInt_t ns=0); 76 Bool_t Set(UShort_t y, Byte_t m, Byte_t d, Byte_t h , Byte_t min, Byte_t s, UShort_t ms, UInt_t ns=0);77 Bool_t Set(UShort_t y, Byte_t m, Byte_t d, Byte_t h=13, Byte_t min=0, Byte_t s=0, UShort_t ms=0, UInt_t ns=0); 77 78 void Set(const struct timeval &tv); 78 79 void SetCT1Time(UInt_t mjd, UInt_t t1, UInt_t t0); 80 Bool_t UpdMagicTime(Byte_t h, Byte_t m, Byte_t s, UShort_t ms); 79 81 void SetMjd(Double_t m); 80 82 Double_t GetMjd() const; -
trunk/MagicSoft/Mars/merpp.cc
r2711 r2728 66 66 gLog << " inputfile.txt: Magic DC currents file." << endl; 67 67 gLog << " ouputfile.root: Merpped root file." << endl; 68 gLog << " - a0: Do not use Ansii codes." << endl;69 gLog << " - u1: Update file." << endl;70 gLog << " - cn: Compression level n=1..9 [default=2]" << endl;71 gLog << " - vn: Verbosity level n [default=2]" << endl;68 gLog << " -c#: Compression level #=1..9 [default=2]" << endl; 69 gLog << " -v#: Verbosity level # [default=2]" << endl; 70 gLog << " -u, --update: Update file" << endl; 71 gLog << " -a, --no-colors: Do not use Ansii color codes" << endl; 72 72 gLog << " --start=yyyy-mm-dd/hh:mm:ss.mmm: Start event time for merpping report files" << endl; 73 73 gLog << " --stop=yyyy-mm-dd/hh:mm:ss.mmm: Stop event time for merpping report files" << endl; 74 74 gLog << " --run=#: Only merpp data corresponding to this run number" << endl; 75 gLog << " -? /-h:This help" << endl << endl;75 gLog << " -?, -h, --help: This help" << endl << endl; 76 76 gLog << " REMARK: At the moment you can process a .raw _or_ a .rep file, only!" << endl << endl; 77 77 } … … 99 99 MArgs arg(argc, argv); 100 100 101 if (arg.HasO ption("-?") || arg.HasOption("-h"))101 if (arg.HasOnly("-?") || arg.HasOnly("-h") || arg.HasOnly("--help")) 102 102 { 103 103 Usage(); … … 105 105 } 106 106 107 if (arg.HasO ption("-a") && arg.GetIntAndRemove("-a")==0)107 if (arg.HasOnlyAndRemove("--no-colors") || arg.HasOnlyAndRemove("-a")) 108 108 gLog.SetNoColors(); 109 109 110 110 const Int_t kComprlvl = arg.HasOption("-c") ? arg.GetIntAndRemove("-c") : 1; 111 Bool_t kUpdate = arg.HasO ption("-u") && arg.GetIntAndRemove("-u")==1;111 Bool_t kUpdate = arg.HasOnlyAndRemove("--update") || arg.HasOnlyAndRemove("-u"); 112 112 113 113 gLog.SetDebugLevel(arg.HasOption("-v") ? arg.GetIntAndRemove("-v") : 2); -
trunk/MagicSoft/Mars/mfilter/MFEventSelector2.cc
r2693 r2728 94 94 ///////////////////////////////////////////////////////////////////////////// 95 95 #include "MFEventSelector2.h" 96 97 #include <limits.h> // INT_MAX98 96 99 97 #include <TRandom.h> // gRandom … … 190 188 Bool_t MFEventSelector2::ReadDistribution(MRead &read) 191 189 { 192 if (read.GetEntries() > INT_MAX) // FIXME: LONG_MAX ???193 { 194 *fLog << err << " INT_MAXexceeded." << endl;190 if (read.GetEntries() > kMaxUInt) // FIXME: LONG_MAX ??? 191 { 192 *fLog << err << "kIntMax exceeded." << endl; 195 193 return kFALSE; 196 194 } -
trunk/MagicSoft/Mars/mmain/MEventDisplay.cc
r2659 r2728 128 128 // -------------------------------------------------------------------------- 129 129 // 130 // Return reading task131 //132 MReadTree *MEventDisplay::GetReader() const133 {134 MParList *plist = (MParList*)fEvtLoop->GetParList();135 MTaskList *tlist = (MTaskList*)plist->FindObject("MTaskList");136 MReadTree *reader = (MReadTree*)tlist->FindObject("MRead");137 return reader;138 }139 140 // --------------------------------------------------------------------------141 //142 130 // Setup Task and parameter list for hillas calculation, 143 131 // preprocess tasks and read in first event (process) … … 389 377 void MEventDisplay::ReadinEvent(Int_t dir) 390 378 { 391 MParList *plist = (MParList*) fEvtLoop->GetParList();392 M GeomCam *geom = (MGeomCam*) plist->FindObject("MGeomCam");393 M TaskList *tlist = (MTaskList*)plist->FindObject("MTaskList");394 MRawEvtData *raw = (MRawEvtData*)plist->FindObject("MRawEvtData");379 MParList *plist = (MParList*) fEvtLoop->GetParList(); 380 MTaskList *tlist = (MTaskList*) fEvtLoop->GetTaskList(); 381 MGeomCam *geom = (MGeomCam*) plist->FindObject("MGeomCam"); 382 MRawEvtData *raw = (MRawEvtData*)plist->FindObject("MRawEvtData"); 395 383 if (!raw) 396 384 return; … … 399 387 // Read first event. 400 388 // 401 MReadTree *reader = GetReader();389 MReadTree *reader = (MReadTree*)fEvtLoop->FindTask("MRead"); 402 390 403 391 const Int_t num = reader->GetNumEntry(); … … 472 460 ReadinEvent(); 473 461 474 TGString *txt = new TGString(Form("of %d", GetReader()->GetEntries())); 462 MReadTree *reader = (MReadTree*)fEvtLoop->FindTask("MRead"); 463 TGString *txt = new TGString(Form("of %d", reader->GetEntries())); 475 464 fNumOfEvts->SetText(txt); 476 465 … … 540 529 { 541 530 TGTextEntry *entry = (TGTextEntry*)fList->FindWidget(kEvtNumber); 542 if (GetReader()->SetEventNum(atoi(entry->GetText())-1)) 531 MReadTree *reader = (MReadTree*)fEvtLoop->FindTask("MRead"); 532 if (reader->SetEventNum(atoi(entry->GetText())-1)) 543 533 ReadinEvent(); 544 534 } -
trunk/MagicSoft/Mars/mmain/MEventDisplay.h
r2559 r2728 43 43 void ReadinEvent(Int_t dir=0); 44 44 45 MReadTree *GetReader() const;46 47 45 Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2); 48 46 -
trunk/MagicSoft/Mars/mmontecarlo/MMcEnergyEst.cc
r2357 r2728 26 26 27 27 ///////////////////////////////////////////////////////////////////////////// 28 // // 29 // MMcEnergyEst // 30 // // 31 // Class for otimizing the parameters of the energy estimator // 32 // // 33 // FIXME: the class must be made more flexible, allowing for different // 34 // parametrizations to be used. Also a new class is needed, a container // 35 // for the parameters of the energy estimator. // 36 // FIXME: the starting values of the parameters are now fixed. // 37 // // 38 // // 28 // 29 // MMcEnergyEst 30 // 31 // Class for otimizing the parameters of the energy estimator 32 // 33 // FIXME: the class must be made more flexible, allowing for different 34 // parametrizations to be used. Also a new class is needed, a container 35 // for the parameters of the energy estimator. 36 // FIXME: the starting values of the parameters are now fixed. 37 // 39 38 ///////////////////////////////////////////////////////////////////////////// 40 39 #include "MMcEnergyEst.h" -
trunk/MagicSoft/Mars/mranforest/MRanTree.cc
r2307 r2728 24 24 25 25 ///////////////////////////////////////////////////////////////////////////// 26 // // 27 // MRanTree // 28 // // 29 // ParameterContainer for Tree structure // 30 // // 31 // // 26 // 27 // MRanTree 28 // 29 // ParameterContainer for Tree structure 30 // 32 31 ///////////////////////////////////////////////////////////////////////////// 33 32 #include "MRanTree.h" … … 159 158 Double_t pno=0; 160 159 Double_t pdo=0; 161 for (Int_t j=0; j<2;j++)160 for (Int_t j=0; j<2; j++) 162 161 { 163 162 pno+=tclasspop[j]*tclasspop[j]; … … 171 170 // (Gini-index as criterium crit) 172 171 173 Double_t critmax=- 1.0e20; // FIXME: Replace by a constant from limits.h172 Double_t critmax=-FLT_MAX; 174 173 175 174 // random split selection, number of trials = fNumTry 176 for (Int_t mt=0;mt<fNumTry;mt++)175 for (Int_t mt=0; mt<fNumTry; mt++) 177 176 { 178 177 const Int_t mvar=Int_t(gRandom->Rndm()*mdim); -
trunk/MagicSoft/Mars/mraw/MRawEvtHeader.cc
r2580 r2728 236 236 } 237 237 238 Bool_t MRawEvtHeader::DecodeTime(UInt_t abstime[2]) const 239 { 240 // BADC|1032 --> DCBA|3210 (Byte swap - exchange MSB and LSB) 241 abstime[0] = (abstime[0]<<16) | (abstime[0]>>16); 242 abstime[1] = (abstime[1]<<16) | (abstime[1]>>16); 243 244 const Byte_t h = (abstime[0]>>18 & 0x30)*10 + (abstime[0]>>14 & 0x0f); 245 const Byte_t m = (abstime[0]>>11 & 0x70)*10 + (abstime[0]>> 7 & 0x0f); 246 const Byte_t s = (abstime[0]>> 4 & 0x70)*10 + (abstime[0]>> 0 & 0x0f); 247 const Int_t ms = 248 ((abstime[1]>>16)&0xf)*1000 + 249 ((abstime[1]>> 8)&0xf)* 100 + 250 ((abstime[1]>> 4)&0xf)* 10 + 251 ((abstime[1]>> 0)&0xf)* 1; 252 253 // hms =3210 --> h=2:4 m=3:4 s=3:4 254 // subsec=DCBA --> subsec? 255 *fLog << dbg << dec; 256 *fLog << (int)(abstime[0]>>18 & 0x30); // h 257 *fLog << (int)(abstime[0]>>14 & 0x0f); // h 258 *fLog << ":"; 259 *fLog << (int)(abstime[0]>>11 & 0x70); // m 260 *fLog << (int)(abstime[0]>> 7 & 0x0f); // m 261 *fLog << ":"; 262 *fLog << (int)(abstime[0]>> 4 & 0x70); // s 263 *fLog << (int)(abstime[0]>> 0 & 0x0f); // s 264 *fLog << " "; 265 *fLog << (int)(abstime[1]>>16 & 0xf) << "."; 266 *fLog << (int)(abstime[1]>> 8 & 0xf) << "."; 267 *fLog << (int)(abstime[1]>> 4 & 0xf) << "."; 268 *fLog << (int)(abstime[1]>> 0 & 0xf); 269 *fLog << endl; 270 271 // Update the time stamp with the current event time. 272 // Make sure, that the time stamp was initialized correctly 273 // with the start-date/time of the run (after reading the run header) 274 // 275 // Here the nanosec precision is ignored... (FIXME!) 276 return fTime->UpdMagicTime(h, m, s, ms); 277 } 278 238 279 // -------------------------------------------------------------------------- 239 280 // … … 241 282 // return FALSE if there is now header anymore, else TRUE 242 283 // 284 // Updates the time stamp with the current event time. 285 // Make sure, that the time stamp was initialized correctly 286 // with the start-date/time of the run (after reading the run header) 287 // 288 // Remark: This 'feature' disallows single runs of more than 11h! 289 // 243 290 int MRawEvtHeader::ReadEvt(istream &fin) 244 291 { 245 292 fin.read((char*)&fDAQEvtNumber, 4); // Total=4 246 293 247 UInt_t abstime[2]; 294 UInt_t abstime[2]; // BADC|1032 248 295 fin.read((char*)abstime, 8); // Total=12 249 250 // 251 // store the time of the event in the corresponding container 252 // 253 /* 254 const Double_t mhz = 9.375; // [1e6 ticks/s] 255 const Double_t t = (Double_t)abstime[0]/mhz; // [ns] 256 const UShort_t ns = (UShort_t)fmod(t*1e-3, 1e9); 257 const Byte_t s = (Byte_t)fmod(t/1e12, 60); 258 const Byte_t m = (Byte_t)fmod(t/60e12, 60); 259 const Byte_t h = (Byte_t)(t/3600e12); 260 fTime->SetTime(h, m, s, ns); 261 */ 296 if (!DecodeTime(abstime)) 297 { 298 *fLog << err << "ERROR - Event time in event header invalid... abort." << endl; 299 return kFALSE; 300 } 262 301 263 302 Byte_t dummy[4]; -
trunk/MagicSoft/Mars/mraw/MRawEvtHeader.h
r2173 r2728 44 44 MArrayB *fPixLoGainOn; //! Array which tell you which pixels have lo gain on 45 45 46 Bool_t DecodeTime(UInt_t abstime[2]) const; 47 46 48 public: 47 48 49 MRawEvtHeader(const char *name=NULL, const char *title=NULL); 49 50 ~MRawEvtHeader(); -
trunk/MagicSoft/Mars/mraw/MRawFileRead.cc
r2675 r2728 151 151 fRawRunHeader->Print(); 152 152 153 return fRawRunHeader->GetMagicNumber()==kMagicNumber; 153 if (fRawRunHeader->GetMagicNumber()!=kMagicNumber) 154 return kFALSE; 155 156 *fRawEvtTime = fRawRunHeader->GetRunStart(); 157 158 return kTRUE; 154 159 } 155 160 -
trunk/MagicSoft/Mars/mraw/MRawRead.cc
r2675 r2728 125 125 } 126 126 127 // -------------------------------------------------------------------------- 128 // 129 // This is a workaround for the oldest runs (run-number<3490) 130 // for which no time stamp was available. 131 // For this runs a fake time stamp is created 132 // 133 // Be carefull: This is NOT thread safe! 134 // 135 void MRawRead::CreateFakeTime() const 136 { 137 static Double_t tm = 0; // Range of roughly 8min 138 const UInt_t ct = (*fRawCrateArray)[0]->GetFADCClockTick(); 139 140 tm = ct<tm ? fmod(tm, (UInt_t)(-1))+(UInt_t)(-1)+ct : ct; 141 142 const Double_t mhz = 9.375; // [1e6 ticks/s] 143 const Double_t t = tm/mhz; // [us] 144 const UInt_t ns = (UInt_t)fmod(t*1e3, 1e6); 145 const UShort_t ms = (UShort_t)fmod(t/1e3, 1e3); 146 const Byte_t s = (Byte_t)fmod(t/1e6, 60); 147 148 // Create an artificial time stamp! 149 UInt_t m = (Byte_t)fmod(t/60e6, 60); 150 //const Byte_t h = (Byte_t)(t/3600e6); 151 m += fRawRunHeader->GetRunNumber()*10; 152 m %= 360; // 6h 153 154 fRawEvtTime->Set(fRawRunHeader->GetRunStart().Year(), 155 fRawRunHeader->GetRunStart().Month(), 156 fRawRunHeader->GetRunStart().Day(), 157 m/60, m%60, s, ms, ns); 158 } 159 160 // -------------------------------------------------------------------------- 161 // 162 // Read a single event from the stream 163 // 127 164 Bool_t MRawRead::ReadEvent(istream &fin) 128 165 { … … 169 206 } 170 207 171 { 172 // FIXME This is a stupid workaround for the missing time stamp! 173 // Might be used depending on the run number in the future 174 static Double_t tm = 0; // Range of roughly 8min 175 const UInt_t ct = (*fRawCrateArray)[0]->GetFADCClockTick(); 176 177 tm = ct<tm ? fmod(tm, (UInt_t)(-1))+(UInt_t)(-1)+ct : ct; 178 179 const Double_t mhz = 9.375; // [1e6 ticks/s] 180 const Double_t t = tm/mhz; // [us] 181 const UInt_t ns = (UInt_t)fmod(t*1e3, 1e6); 182 const UShort_t ms = (UShort_t)fmod(t/1e3, 1e3); 183 const Byte_t s = (Byte_t)fmod(t/1e6, 60); 184 185 // Create an artificial time stamp! 186 UInt_t m = (Byte_t)fmod(t/60e6, 60); 187 //const Byte_t h = (Byte_t)(t/3600e6); 188 m += fRawRunHeader->GetRunNumber()*10; 189 m %= 360; // 6h 190 191 fRawEvtTime->Set(fRawRunHeader->GetRunStart().Year(), 192 fRawRunHeader->GetRunStart().Month(), 193 fRawRunHeader->GetRunStart().Day(), 194 m/60, m%60, s, ms, ns); 195 } 208 // This is a workaround for the oldest runs (run-number<3490) 209 // for which no time stamp was available. 210 // For this runs a fake time stamp is created 211 if (fRawRunHeader->GetRunNumber()<3490) 212 CreateFakeTime(); 213 214 // FIXME: For all other runs we should enhance the precision 215 // of the time-stamp by using the FADCClockTick 216 196 217 return kTRUE; 197 218 } -
trunk/MagicSoft/Mars/mraw/MRawRead.h
r2677 r2728 22 22 MTime *fRawEvtTime; // raw evt time information container to fill from file 23 23 24 void CreateFakeTime() const; 25 24 26 Bool_t ReadEvent(istream &fin); 25 27 Int_t PreProcess(MParList *pList); -
trunk/MagicSoft/Mars/mraw/MRawRunHeader.cc
r2645 r2728 29 29 // Root storage container for the RUN HEADER information 30 30 // 31 // 32 // 33 // Version 2: 34 // ---------- 31 // Format Version 2: 32 // ----------------- 33 // - removed mjd from data 34 // - added start time 35 // - added stop time 36 // 37 // Class Version 2: 38 // ---------------- 35 39 // - removed fMJD, fYear, fMonth, fDay 36 40 // - added fRunStart 37 41 // - added fRunStop 38 42 // 39 // Version 1:40 // ---------- 43 // Class Version 1: 44 // ---------------- 41 45 // - first implementation 42 46 // … … 212 216 for (int i=0; i<GetNumPixel(); i++) 213 217 *fLog << setfill('0') << setw(3) << (*fPixAssignment)[i] << " "; 214 *fLog << hex << endl;215 218 216 219 *fLog << endl; -
trunk/MagicSoft/Mars/mraw/MRawSocketRead.cc
r2675 r2728 252 252 } 253 253 254 *fRawEvtTime = fRawRunHeader->GetRunStart(); 255 254 256 if (!ReadEvent(*fIn)) 255 257 return kFALSE; -
trunk/MagicSoft/Mars/mreport/MReportRun.h
r2708 r2728 22 22 Int_t GetRunNumber() const { return fRunNumber; } 23 23 24 ClassDef(MReportRun, 1) // Class for RUN-REPORT information24 ClassDef(MReportRun, 0) // Class for RUN-REPORT information 25 25 }; 26 26 -
trunk/MagicSoft/Mars/readdaq.cc
r2607 r2728 55 55 gLog << " -d1: print data in decimal values" << endl; 56 56 gLog << " -c1: print MRawCrateArray data" << endl; 57 gLog << " -? /-h: This help" << endl << endl;57 gLog << " -?, -h, --help: This help" << endl << endl; 58 58 } 59 59 … … 67 67 MArgs arg(argc, argv); 68 68 69 if (arg.HasO ption("-?") || arg.HasOption("-h"))69 if (arg.HasOnly("-?") || arg.HasOnly("-h") || arg.HasOnly("--help")) 70 70 { 71 71 Usage(); -
trunk/MagicSoft/Mars/readraw.cc
r2580 r2728 54 54 gLog << " readraw [-h] [-?] [-vn] [-dec] [-a0] inputfile[.root]" << endl << endl; 55 55 gLog << " input file: Magic DAQ binary file." << endl; 56 gLog << " -a0: Do not use Ansii codes." << endl;57 56 gLog << " -vn: Verbosity level n [default=2]" << endl; 58 gLog << " -d1: print data in decimal values" << endl; 59 gLog << " -?/-h: This help" << endl << endl; 57 gLog << " -d, --dec: print data in decimal values" << endl; 58 gLog << " -a, --no-colors: Do not use Ansii color codes" << endl; 59 gLog << " -?,-h,--help: This help" << endl << endl; 60 60 } 61 61 … … 73 73 StartUpMessage(); 74 74 75 //76 75 // Evaluate arguments 77 //78 76 MArgs arg(argc, argv); 79 77 80 if (arg.HasOption("-?") || arg.HasOption("-h")) 78 // check for the right usage of the program 79 if (arg.HasOption("-?") || arg.HasOption("-h") || arg.HasOption("--help") || 80 arg.GetNumArguments()!=1) 81 81 { 82 82 Usage(); … … 84 84 } 85 85 86 // 87 // Set verbosity to highest level. 88 // 86 // Set verbosity 89 87 gLog.SetDebugLevel(arg.HasOption("-v") ? arg.GetIntAndRemove("-v") : 2); 90 88 91 if (arg.HasOption("-a") && arg.GetIntAndRemove("-a")==0) 89 // Set color usage 90 if (arg.HasOnlyAndRemove("--no-colors") || arg.HasOnlyAndRemove("-a")) 92 91 gLog.SetNoColors(); 93 92 94 const bool kDecimal = arg.HasOption("-d") && arg.GetIntAndRemove("-d")==1; 95 96 // 97 // check for the right usage of the program 98 // 99 if (arg.GetNumArguments()!=1) 100 { 101 Usage(); 102 return -1; 93 // Set usage of decimal values 94 const bool kDecimal = arg.HasOnlyAndRemove("-d") || arg.HasOnlyAndRemove("--dec"); 95 96 // 97 // check for unidentified options 98 // 99 if (arg.GetNumOptions()>0) 100 { 101 gLog << warn << "WARNING - unknown commandline options..." << endl; 102 arg.Print("options"); 103 gLog << endl; 103 104 } 104 105 … … 128 129 // open the file 129 130 // 130 gLog << " Open the file '" << kNamein << "'" << endl;131 gLog << inf << " Open the file '" << kNamein << "'" << endl; 131 132 TFile input(kNamein, "READ"); 132 133 … … 137 138 TTree *runtree = (TTree*)input.Get("RunHeaders"); 138 139 if (!runtree) 139 gLog << " WARNING: This file has NOTree 'RunHeaders'" << endl << endl;140 gLog << warn << " WARNING - This file has no Tree 'RunHeaders'" << endl << endl; 140 141 else 141 142 { … … 151 152 // open the DataTree and read in 152 153 // 153 gLog << " Check the Tree 'Events'" << endl ;154 gLog << inf << " Check the Tree 'Events'" << endl ; 154 155 TTree *evttree = (TTree*)input.Get("Events") ; 155 156 if (!evttree) 156 157 { 157 gLog << "Tree 'Events' not found in file... exit!" << endl;158 gLog << err << "Tree 'Events' not found in file... exit!" << endl; 158 159 return -1; 159 160 } … … 184 185 const Int_t nent = (Int_t)evttree->GetEntries(); 185 186 186 gLog << endl;187 187 gLog << " Entries in Tree Data: " << dec << nent << endl; 188 188 gLog << endl; … … 190 190 for (Int_t i = 0; i<nent; i++) 191 191 { 192 gLog << "Entry: " << i << endl;192 gLog << all << "Entry: " << i << endl; 193 193 194 194 //
Note:
See TracChangeset
for help on using the changeset viewer.