Changeset 698 for trunk/MagicSoft/Mars/manalysis
- Timestamp:
- 03/22/01 12:24:47 (24 years ago)
- Location:
- trunk/MagicSoft/Mars/manalysis
- Files:
-
- 6 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/manalysis/AnalysisLinkDef.h
r695 r698 7 7 #pragma link C++ class MCerPhotPix; 8 8 #pragma link C++ class MCerPhotEvt; 9 #pragma link C++ class MCerPhotCalc; 10 11 #pragma link C++ class MImgCleanStd; 9 12 10 13 #pragma link C++ class MCT1ReadAscii; … … 13 16 #pragma link C++ class MPedestalPix; 14 17 #pragma link C++ class MPedestalCam; 18 #pragma link C++ class MMcPedestalCopy; 15 19 16 20 #pragma link C++ class MHillas; -
trunk/MagicSoft/Mars/manalysis/MCT1Pedestals.cc
r654 r698 34 34 // skip the next 4 values 35 35 // 36 fin >> dummyF; 37 fin >> dummyF; 38 fin >> dummyF; 39 fin >> dummyF; 36 fin >> dummyF; 37 fin >> dummyF; 38 fin >> dummyF; 39 fin >> dummyF; 40 40 41 41 // -
trunk/MagicSoft/Mars/manalysis/MCT1ReadAscii.cc
r656 r698 10 10 11 11 #include "MLog.h" 12 #include "MLogManip.h" 13 12 14 #include "MParList.h" 13 15 #include "MCerPhotEvt.h" … … 41 43 if (!(*fIn)) 42 44 { 43 *fLog << "Error: MCT1ReadAscii::PreProcess:Cannot open file." << endl;45 *fLog << dbginf << "Cannot open file." << endl; 44 46 return kFALSE; 45 47 } … … 48 50 // look for the MCerPhotEvt class in the plist 49 51 // 50 fNphot = (MCerPhotEvt*)pList->Find Object("MCerPhotEvt");52 fNphot = (MCerPhotEvt*)pList->FindCreateObj("MCerPhotEvt"); 51 53 if (!fNphot) 52 { 53 *fLog << "MRawCT1Ascii::PreProcess - WARNING: MCerPhotEvt not found... creating." << endl; 54 fNphot = new MCerPhotEvt; 55 pList->AddToList(fNphot); 56 } 54 return kFALSE; 57 55 58 56 // 59 57 // look for the pedestal class in the plist 60 58 // 61 fPedest = (MCT1Pedestals*)pList->Find Object("MCT1Pedestals");59 fPedest = (MCT1Pedestals*)pList->FindCreateObj("MCT1Pedestals"); 62 60 if (!fPedest) 63 { 64 *fLog << "MRawCT1Ascii::PreProcess - WARNING: MCT1Pedestals not found... creating." << endl; 65 fPedest = new MCT1Pedestals; 66 pList->AddToList(fPedest); 67 } 61 return kFALSE; 68 62 69 63 return kTRUE; … … 73 67 { 74 68 // 69 // FIXME. This function should switch between reading pedestals and 70 // reading event data by the 'switch entry'. 71 // After reading it should set the InputStreamID correctly. 72 // ( should use MPedestalCam ) 73 // 74 75 // 75 76 // read in a dummy number (event number) 76 77 // … … 78 79 *fIn >> dummyI; 79 80 81 // 82 // check if we are done 83 // 80 84 if (fIn->eof()) 81 {82 *fLog << "MRawCT1Ascii::Process - Error: EOF reached." << endl;83 85 return kFALSE; 84 }85 86 86 87 // … … 94 95 // five unsused numbers 95 96 // 96 *fIn >> dummyI; 97 *fIn >> dummyI; 98 *fIn >> dummyI; 99 *fIn >> dummyI; 97 *fIn >> dummyI; // ener 98 *fIn >> dummyI; // zenang 99 *fIn >> dummyI; // sec1 100 *fIn >> dummyI; // sec2 100 101 101 102 // … … 110 111 for (Int_t i = 0; i<127; i++ ) 111 112 { 112 Float_t dummyF;113 Float_t nphot; 113 114 114 *fIn >> dummyF;115 *fIn >> nphot; 115 116 116 if ( dummyF> 0.0)117 fNphot->AddPixel(i, dummyF, (*fPedest)[i]);117 if (nphot > 0.0) 118 fNphot->AddPixel(i, nphot, (*fPedest)[i]); 118 119 } 119 120 -
trunk/MagicSoft/Mars/manalysis/MCT1ReadAscii.h
r653 r698 26 26 Bool_t PostProcess(); 27 27 28 ClassDef(MCT1ReadAscii, 1) // Reads the CT1 data file28 ClassDef(MCT1ReadAscii, 0) // Reads the CT1 data file 29 29 }; 30 30 -
trunk/MagicSoft/Mars/manalysis/MCerPhotEvt.cc
r695 r698 47 47 } 48 48 49 Int_t MCerPhotEvt::GetNumPixels()50 {51 return fNumPixels;52 }53 54 49 void MCerPhotEvt::AddPixel(Int_t id, Float_t nph, Float_t err) 55 50 { … … 58 53 // of valid pixels in the list by one 59 54 // 60 (*fPixels)[fNumPixels++] = new MCerPhotPix( id, nph, err); 55 56 // TClonesArray -> 'operator new with placement' should be used 57 new ((*fPixels)[fNumPixels++]) MCerPhotPix( id, nph, err); 61 58 } 62 59 … … 83 80 } 84 81 82 /* 85 83 void MCerPhotEvt::CleanLevel1() 86 84 { … … 228 226 } 229 227 } 230 228 */ 231 229 232 230 Bool_t MCerPhotEvt::IsPixelExisting(Int_t id) … … 293 291 294 292 Float_t testval; 295 for ( Int_t i=1 ; i<fNumPixels; i++ )293 for (UInt_t i=1 ; i<fNumPixels; i++ ) 296 294 { 297 295 testval = (*this)[i].GetNumPhotons(); … … 315 313 316 314 Float_t testval; 317 for ( Int_t i=1; i<fNumPixels; i++)315 for (UInt_t i=1; i<fNumPixels; i++) 318 316 { 319 317 testval = (*this)[i].GetNumPhotons(); -
trunk/MagicSoft/Mars/manalysis/MCerPhotEvt.h
r695 r698 6 6 #endif 7 7 #ifndef ROOT_TClonesArray 8 #include "TClonesArray.h"8 #include <TClonesArray.h> 9 9 #endif 10 10 #ifndef MPARCONTAINER_H … … 21 21 private: 22 22 23 Int_t fNumPixels;23 UInt_t fNumPixels; 24 24 TClonesArray *fPixels; 25 25 … … 27 27 28 28 public: 29 MCerPhotEvt(const char *name=NULL, const char *title=NULL) ; 29 MCerPhotEvt(const char *name=NULL, const char *title=NULL) ; 30 ~MCerPhotEvt() { delete fPixels; } 30 31 31 32 void Draw(Option_t* option = "" ) ; 32 33 33 Int_t GetNumPixels() ;34 UInt_t GetNumPixels() const { return fNumPixels; } 34 35 35 36 void AddPixel(Int_t id, Float_t nph, Float_t err ); … … 39 40 void Print(Option_t *opt=NULL) ; 40 41 41 void CleanLevel1() ;42 void CleanLevel2() ;43 void CleanLevel3() ;42 // void CleanLevel1() ; 43 // void CleanLevel2() ; 44 // void CleanLevel3() ; 44 45 45 Bool_t IsPixelExisting( Int_t id ) 46 Bool_t IsPixelUsed ( Int_t id ) 47 Bool_t IsPixelCore ( Int_t id ) 46 Bool_t IsPixelExisting( Int_t id ); 47 Bool_t IsPixelUsed ( Int_t id ); 48 Bool_t IsPixelCore ( Int_t id ); 48 49 49 50 Float_t GetNumPhotonsMin(); -
trunk/MagicSoft/Mars/manalysis/MHillas.cc
r695 r698 79 79 // calculate mean valu of pixels 80 80 // 81 float xav =0; 82 float yav =0; 83 float spix=0; 81 float xmean =0; 82 float ymean =0; 83 84 fSize = 0; 84 85 85 86 for (UInt_t i=0; i<nevt; i++) … … 94 95 const float nphot = pix.GetNumPhotons(); 95 96 96 spix+= nphot;97 x av += nphot * gpix.GetX();98 y av += nphot * gpix.GetY();97 fSize += nphot; 98 xmean += nphot * gpix.GetX(); // [mm] 99 ymean += nphot * gpix.GetY(); // [mm] 99 100 } 100 101 101 x av /= spix;102 y av /= spix;102 xmean /= fSize; // [mm] 103 ymean /= fSize; // [mm] 103 104 104 105 // 105 106 // calculate sdev 106 107 // 107 float dis11=0;108 float dis12=0;109 float dis22=0;108 float sigmaxx=0; 109 float sigmaxy=0; 110 float sigmayy=0; 110 111 111 112 for (UInt_t i=0; i<nevt; i++) … … 118 119 const MGeomPix &gpix = geom[pix.GetPixId()]; 119 120 120 const float dx = gpix.GetX() - x av;121 const float dy = gpix.GetY() - y av;121 const float dx = gpix.GetX() - xmean; 122 const float dy = gpix.GetY() - ymean; 122 123 123 124 const float nphot = pix.GetNumPhotons(); 124 125 125 dis11 += nphot * dx*dx;126 dis12 += nphot * dx*dy;127 dis22 += nphot * dy*dy;126 sigmaxx += nphot * dx*dx; // [mm^2] 127 sigmaxy += nphot * dx*dy; // [mm^2] 128 sigmayy += nphot * dy*dy; // [mm^2] 128 129 } 129 130 … … 131 132 // check for orientation 132 133 // 133 const float theta = atan( dis12/(dis11-dis22)*2)/2;134 const float theta = atan(sigmaxy/(sigmaxx-sigmayy)*2)/2; 134 135 135 float c = cos(theta); 136 float s = sin(theta); 136 float c = cos(theta); // [1] 137 float s = sin(theta); // [1] 137 138 138 const float direction = c*x av+s*yav;139 const float direction = c*xmean + s*ymean; 139 140 140 141 if (direction<0) … … 144 145 } 145 146 146 float rot1 = 2.0*c*s*dis12 + c*c*dis11 + s*s*dis22;147 float rot2 = -2.0*c*s*dis12 + s*s*dis11 + c*c*dis22;147 float axis1 = 2.0*c*s*sigmaxy + c*c*sigmaxx + s*s*sigmayy; // [mm^2] 148 float axis2 = -2.0*c*s*sigmaxy + s*s*sigmaxx + c*c*sigmayy; // [mm^2] 148 149 149 rot1 /= spix;150 rot2 /= spix;150 axis1 /= fSize; // [mm^2] 151 axis2 /= fSize; // [mm^2] 151 152 152 153 // 153 154 // check for numerical negatives 154 155 // 155 if ( rot1 < 0) rot1=0;156 if ( rot2 < 0) rot2=0;156 if (axis1 < 0) axis1=0; 157 if (axis2 < 0) axis2=0; 157 158 158 159 // 159 160 // check the rotation of the axis 160 161 // 161 const int rotation = rot1<rot2;162 const int rotation = axis1<axis2; 162 163 163 fLength = rotation ? sqrt( rot2) : sqrt(rot1);164 fWidth = rotation ? sqrt( rot1) : sqrt(rot2);164 fLength = rotation ? sqrt(axis2) : sqrt(axis1); // [mm] 165 fWidth = rotation ? sqrt(axis1) : sqrt(axis2); // [mm] 165 166 166 fAlpha = 180/kPI*atan((-x av*s+yav*c)/direction);167 fAlpha = 180/kPI*atan((-xmean*s+ymean*c)/direction); // [deg] 167 168 168 fDist = sqrt(x av*xav + yav*yav);169 fDist = sqrt(xmean*xmean + ymean*ymean); // [mm] 169 170 170 fTheta = atan(y av/xav);171 if (x av<0) fTheta += kPI;171 fTheta = atan(ymean/xmean); // [rad] 172 if (xmean<0) fTheta += kPI; // [deg] 172 173 } -
trunk/MagicSoft/Mars/manalysis/MHillas.h
r695 r698 34 34 void Clear(Option_t *opt=NULL); 35 35 36 Float_t GetAlpha() const { return fAlpha; } 37 Float_t GetWidth() const { return fWidth; } 38 Float_t GetLength() const { return fLength; } 39 Float_t GetDist() const { return fDist; } 40 36 41 ClassDef(MHillas, 1) // Storage Container for Hillas Parameter 37 42 }; -
trunk/MagicSoft/Mars/manalysis/MPedestalCam.cc
r695 r698 18 18 19 19 fArray = new TClonesArray("MPedestalPix", 577); 20 21 // 22 // TClonesArray: The 'new operator with placement' must be used 23 // 24 for (int i=0; i<577; i++) 25 new ((*fArray)[i]) MPedestalPix; 20 26 } 21 27 -
trunk/MagicSoft/Mars/manalysis/MPedestalCam.h
r695 r698 23 23 ~MPedestalCam(); 24 24 25 void InitSize(const UInt_t i) { fArray->ExpandCreateFast(i); } 26 25 27 MPedestalPix &operator[](Int_t i) { return *(MPedestalPix*)fArray->At(i); } 26 28 -
trunk/MagicSoft/Mars/manalysis/MPedestalPix.h
r695 r698 17 17 MPedestalPix(); 18 18 19 Float_t GetMean() { return fMean; }20 Float_t GetSigma() { return fSigma; }21 Float_t GetMeanRms() { return fMeanRms; }22 Float_t GetSigmaRms() { return fSigmaRms; }19 Float_t GetMean() const { return fMean; } 20 Float_t GetSigma() const { return fSigma; } 21 Float_t GetMeanRms() const { return fMeanRms; } 22 Float_t GetSigmaRms() const { return fSigmaRms; } 23 23 24 24 void SetMean(Float_t f) { fMean = f; } … … 27 27 void SetSigmaRms(Float_t f) { fSigmaRms = f; } 28 28 29 void SetPedestal(Float_t m, Float_t s) { fMean = m; fSigma = s; } 30 void SetPedestalRms(Float_t m, Float_t s) { fMeanRms = m; fSigmaRms = s; } 31 29 32 ClassDef(MPedestalPix, 1) // Storage Container for Pedestal information of one pixel 30 33 }; -
trunk/MagicSoft/Mars/manalysis/Makefile
r695 r698 22 22 # connect the include files defined in the config.mk file 23 23 # 24 INCLUDES = -I. -I../mbase -I../mgui 24 INCLUDES = -I. -I../mbase -I../mgui -I../mmc -I../mraw 25 25 26 26 #------------------------------------------------------------------------------ … … 32 32 MPedestalCam.cc \ 33 33 MPedestalPix.cc \ 34 MMcPedestalCopy.cc \ 35 MImgCleanStd.cc \ 34 36 MHillas.cc \ 35 37 MHillasCalc.cc \ 38 MCerPhotCalc.cc \ 36 39 MCerPhotEvt.cc \ 37 40 MCerPhotPix.cc
Note:
See TracChangeset
for help on using the changeset viewer.