Changeset 1540 for trunk/MagicSoft/Mars/manalysis
- Timestamp:
- 10/15/02 17:02:46 (22 years ago)
- Location:
- trunk/MagicSoft/Mars/manalysis
- Files:
-
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/manalysis/MCerPhotEvt.cc
r1438 r1540 34 34 35 35 #include "MGeomCam.h" 36 #include "MGeomPix.h"37 36 38 37 ClassImp(MCerPhotEvt); … … 159 158 return -5.; 160 159 161 const Float_t A0 = geom ? (*geom)[0].GetA() : 0;162 163 160 Float_t minval = (*this)[0].GetNumPhotons(); 164 161 … … 170 167 171 168 if (geom) 172 testval *= A0/(*geom)[pix.GetPixId()].GetA();169 testval *= geom->GetPixRatio(pix.GetPixId()); 173 170 174 171 if (testval < minval) … … 190 187 return 50.; 191 188 192 const Float_t A0 = geom ? (*geom)[0].GetA() : 0;193 189 Float_t maxval = (*this)[0].GetNumPhotons(); 194 190 … … 200 196 201 197 if (geom) 202 testval *= A0/(*geom)[pix.GetPixId()].GetA();198 testval *= geom->GetPixRatio(pix.GetPixId()); 203 199 204 200 if (testval > maxval) … … 208 204 } 209 205 206 // -------------------------------------------------------------------------- 207 // 208 // get the minimum ratio of photons/error 209 // 210 Float_t MCerPhotEvt::GetRatioMin() const 211 { 212 if (fNumPixels <= 0) 213 return -5.; 214 215 Float_t minval = (*this)[0].GetNumPhotons()/(*this)[0].GetErrorPhot(); 216 217 for (UInt_t i=1; i<fNumPixels; i++) 218 { 219 const MCerPhotPix &pix = (*this)[i]; 220 221 Float_t testval = pix.GetNumPhotons()/pix.GetErrorPhot(); 222 if (testval < minval) 223 minval = testval; 224 } 225 226 return minval; 227 } 228 229 // -------------------------------------------------------------------------- 230 // 231 // get the maximum ratio of photons/error 232 // 233 Float_t MCerPhotEvt::GetRatioMax() const 234 { 235 if (fNumPixels <= 0) 236 return -5.; 237 238 Float_t maxval = (*this)[0].GetNumPhotons()/(*this)[0].GetErrorPhot(); 239 240 for (UInt_t i=1; i<fNumPixels; i++) 241 { 242 const MCerPhotPix &pix = (*this)[i]; 243 244 Float_t testval = pix.GetNumPhotons()/pix.GetErrorPhot(); 245 if (testval > maxval) 246 maxval = testval; 247 } 248 249 return maxval; 250 } 251 252 // -------------------------------------------------------------------------- 253 // 254 // get the minimum of error 255 // If you specify a geometry the number of photons is weighted with the 256 // area of the pixel 257 // 258 Float_t MCerPhotEvt::GetErrorPhotMin(const MGeomCam *geom) const 259 { 260 if (fNumPixels <= 0) 261 return 50.; 262 263 Float_t minval = (*this)[0].GetErrorPhot(); 264 265 for (UInt_t i=1; i<fNumPixels; i++) 266 { 267 const MCerPhotPix &pix = (*this)[i]; 268 269 Float_t testval = pix.GetErrorPhot(); 270 271 if (geom) 272 testval *= geom->GetPixRatio(pix.GetPixId()); 273 274 if (testval < minval) 275 minval = testval; 276 } 277 return minval; 278 } 279 280 // -------------------------------------------------------------------------- 281 // 282 // get the maximum ratio of photons/error 283 // If you specify a geometry the number of photons is weighted with the 284 // area of the pixel 285 // 286 Float_t MCerPhotEvt::GetErrorPhotMax(const MGeomCam *geom) const 287 { 288 if (fNumPixels <= 0) 289 return 50.; 290 291 Float_t maxval = (*this)[0].GetErrorPhot(); 292 293 for (UInt_t i=1; i<fNumPixels; i++) 294 { 295 const MCerPhotPix &pix = (*this)[i]; 296 297 Float_t testval = pix.GetErrorPhot(); 298 299 if (geom) 300 testval *= geom->GetPixRatio(pix.GetPixId()); 301 302 if (testval > maxval) 303 maxval = testval; 304 } 305 return maxval; 306 } 307 -
trunk/MagicSoft/Mars/manalysis/MCerPhotEvt.h
r1268 r1540 38 38 Float_t GetNumPhotonsMax(const MGeomCam *geom=NULL) const; 39 39 40 Float_t GetRatioMin() const; 41 Float_t GetRatioMax() const; 42 43 Float_t GetErrorPhotMin(const MGeomCam *geom=NULL) const; 44 Float_t GetErrorPhotMax(const MGeomCam *geom=NULL) const; 45 40 46 MCerPhotPix &operator[](int i) { return *(MCerPhotPix*)(fPixels->UncheckedAt(i)); } 41 47 MCerPhotPix &operator[](int i) const { return *(MCerPhotPix*)(fPixels->UncheckedAt(i)); } -
trunk/MagicSoft/Mars/manalysis/MHillas.cc
r1528 r1540 220 220 // In case you don't call Calc from within an eventloop make sure, that 221 221 // you call the Reset member function before. 222 // 223 Bool_t MHillas::Calc(const MGeomCam &geom, const MCerPhotEvt &evt) 222 // Returns: 223 // 0 no error 224 // 1 number of pixels < 3 225 // 2 size==0 226 // 3 number of used pixel < 3 227 // 4 CorrXY == 0 228 // 229 Int_t MHillas::Calc(const MGeomCam &geom, const MCerPhotEvt &evt) 224 230 { 225 231 const UInt_t npixevt = evt.GetNumPixels(); … … 228 234 // sanity check 229 235 // 230 if (npixevt < = 2)231 { 232 *fLog << warn << "MHillas::Calc: Event has less than twopixels... skipped." << endl;233 return kFALSE;236 if (npixevt < 3) 237 { 238 //*fLog << warn << "MHillas::Calc: Event has less than three pixels... skipped." << endl; 239 return 1; 234 240 } 235 241 … … 280 286 { 281 287 //*fLog << inf << GetDescriptor() << ": Event has zero cerenkov photons... skipped." << endl; 282 return kFALSE;288 return 2; 283 289 } 284 290 … … 286 292 { 287 293 //*fLog << inf << GetDescriptor() << ": Event has less than 3 used pixels... skipped." << endl; 288 return kFALSE;294 return 3; 289 295 } 290 296 … … 334 340 if (corrxy==0) 335 341 { 336 *fLog << inf << GetDescriptor() << ": Event has CorrXY==0... skipped." << endl;337 return kFALSE;342 //*fLog << inf << GetDescriptor() << ": Event has CorrXY==0... skipped." << endl; 343 return 4; 338 344 } 339 345 … … 375 381 SetReadyToSave(); 376 382 377 return kTRUE;383 return 0; 378 384 } 379 385 -
trunk/MagicSoft/Mars/manalysis/MHillas.h
r1524 r1540 45 45 void Reset(); 46 46 47 virtual Bool_t Calc(const MGeomCam &geom, const MCerPhotEvt &pix);47 virtual Int_t Calc(const MGeomCam &geom, const MCerPhotEvt &pix); 48 48 49 49 virtual void Print(Option_t *opt=NULL) const; -
trunk/MagicSoft/Mars/manalysis/MHillasCalc.cc
r1211 r1540 88 88 return kFALSE; 89 89 90 memset(fErrors, 0, sizeof(fErrors)); 91 90 92 return kTRUE; 91 93 } … … 100 102 Bool_t MHillasCalc::Process() 101 103 { 102 return fHillas->Calc(*fGeomCam, *fCerPhotEvt) ? kTRUE : kCONTINUE; 104 const Int_t rc = fHillas->Calc(*fGeomCam, *fCerPhotEvt); 105 if (rc<0 || rc>4) 106 { 107 *fLog << err << dbginf << "MHillas::Calc returned unknown error code!" << endl; 108 return kFALSE; 109 } 110 fErrors[rc]++; 111 112 return rc==0 ? kTRUE : kCONTINUE; 103 113 } 104 114 115 // -------------------------------------------------------------------------- 116 // 117 // Prints some statistics about the hillas calculation. The percentage 118 // is calculated with respect to the number of executions of this task. 119 // 120 Bool_t MHillasCalc::PostProcess() 121 { 122 if (GetNumExecutions()==0) 123 return kTRUE; 124 125 *fLog << inf << endl; 126 *fLog << GetDescriptor() << " execution statistics:" << endl; 127 *fLog << " " << setw(7) << fErrors[1] << " (" << setw(3) << (int)(fErrors[1]*100/GetNumExecutions()) << "%) Evts skipped due to: Event has less than 3 pixels" << endl; 128 *fLog << " " << setw(7) << fErrors[2] << " (" << setw(3) << (int)(fErrors[2]*100/GetNumExecutions()) << "%) Evts skipped due to: Calculated Size == 0" << endl; 129 *fLog << " " << setw(7) << fErrors[3] << " (" << setw(3) << (int)(fErrors[3]*100/GetNumExecutions()) << "%) Evts skipped due to: Number of used pixels < 3" << endl; 130 *fLog << " " << setw(7) << fErrors[4] << " (" << setw(3) << (int)(fErrors[4]*100/GetNumExecutions()) << "%) Evts skipped due to: CorrXY==0" << endl; 131 *fLog << " " << fErrors[0] << " (" << (int)(fErrors[0]*100/GetNumExecutions()) << "%) Evts survived Hillas calculation!" << endl; 132 *fLog << endl; 133 134 return kTRUE; 135 } -
trunk/MagicSoft/Mars/manalysis/MHillasCalc.h
r1203 r1540 24 24 MHillas *fHillas; // ouput container to store result 25 25 26 TString fHilName; 27 public: 28 MHillasCalc(const char *hil="MHillas", const char *name=NULL, const char *title=NULL); 26 TString fHilName; 27 Int_t fErrors[5]; 29 28 30 29 Bool_t PreProcess(MParList *pList); 31 30 Bool_t Process(); 31 Bool_t PostProcess(); 32 33 public: 34 MHillasCalc(const char *hil="MHillas", const char *name=NULL, const char *title=NULL); 32 35 33 36 ClassDef(MHillasCalc, 0) // Task to calculate Hillas parameters -
trunk/MagicSoft/Mars/manalysis/MHillasExt.cc
r1524 r1540 111 111 // and the cerenkov photon event 112 112 // 113 Bool_t MHillasExt::Calc(const MGeomCam &geom, const MCerPhotEvt &evt) 114 { 115 if (!MHillas::Calc(geom, evt)) 116 return kFALSE; 113 Int_t MHillasExt::Calc(const MGeomCam &geom, const MCerPhotEvt &evt) 114 { 115 const Int_t rc = MHillas::Calc(geom, evt); 116 if (rc>0) 117 return rc; 117 118 118 119 // … … 237 238 SetReadyToSave(); 238 239 239 return kTRUE;240 return 0; 240 241 } 241 242 -
trunk/MagicSoft/Mars/manalysis/MHillasExt.h
r1524 r1540 30 30 Float_t GetM3Trans() const { return fM3Trans; } 31 31 32 Bool_t Calc(const MGeomCam &geom, const MCerPhotEvt &pix);32 Int_t Calc(const MGeomCam &geom, const MCerPhotEvt &pix); 33 33 34 34 void Print(Option_t *opt=NULL) const; -
trunk/MagicSoft/Mars/manalysis/MHillasSrc.cc
r1524 r1540 113 113 if (dist==0) 114 114 { 115 *fLog << warn << GetDescriptor() << ": Event has Dist==0... skipped." << endl;115 //*fLog << warn << GetDescriptor() << ": Event has Dist==0... skipped." << endl; 116 116 return kFALSE; 117 117 } -
trunk/MagicSoft/Mars/manalysis/MHillasSrcCalc.cc
r1487 r1540 91 91 fHillasSrc->SetSrcPos(fSrcPos); 92 92 93 fErrors = 0; 94 93 95 return kTRUE; 94 96 } … … 98 100 Bool_t MHillasSrcCalc::Process() 99 101 { 100 return fHillasSrc->Calc(fHillas) ? kTRUE : kCONTINUE; 102 103 if (!fHillasSrc->Calc(fHillas)) 104 { 105 fErrors++; 106 return kCONTINUE; 107 108 } 109 return kTRUE; 101 110 } 102 111 112 // -------------------------------------------------------------------------- 113 // 114 // Prints some statistics about the hillas calculation. The percentage 115 // is calculated with respect to the number of executions of this task. 116 // 117 Bool_t MHillasSrcCalc::PostProcess() 118 { 119 if (GetNumExecutions()==0) 120 return kTRUE; 121 122 *fLog << inf << endl; 123 *fLog << GetDescriptor() << " execution statistics:" << endl; 124 *fLog << " " << fErrors << " (" << (int)(fErrors*100/GetNumExecutions()) << "%) Evts skipped due to: Dist==0" << endl; 125 *fLog << endl; 126 127 return kTRUE; 128 } 103 129 104 130 // -------------------------------------------------------------------------- -
trunk/MagicSoft/Mars/manalysis/MHillasSrcCalc.h
r1487 r1540 20 20 TString fHillasName; 21 21 22 Int_t fErrors; 23 22 24 void StreamPrimitive(ofstream &out) const; 25 26 Bool_t PreProcess(MParList *plist); 27 Bool_t Process(); 28 Bool_t PostProcess(); 23 29 24 30 public: … … 26 32 const char *name=NULL, const char *title=NULL); 27 33 28 Bool_t PreProcess(MParList *plist);29 Bool_t Process();30 31 34 ClassDef(MHillasSrcCalc, 1) // task to calculate the source position depandant hillas parameters 32 35 }; -
trunk/MagicSoft/Mars/manalysis/MImgCleanStd.cc
r1503 r1540 159 159 // check if pixel is in use, if not goto next pixel in list 160 160 // 161 #if 0 161 162 if (!pix.IsPixelUsed()) 162 163 continue; 164 #endif 163 165 164 166 // … … 168 170 169 171 // 170 // count number of next neighbors of this pixel which 171 // state is 'used' 172 // check for 'used' neighbors this pixel which 172 173 // 173 174 const MGeomPix &gpix = (*fCam)[id]; 174 175 const Int_t nnmax = gpix.GetNumNeighbors(); 175 176 177 #if 0 176 178 Bool_t cnt = kFALSE; 177 179 for (Int_t j=0; j<nnmax; j++) … … 179 181 const Int_t id2 = gpix.GetNeighbor(j); 180 182 181 if ( !ispixused[id2])183 if (id2>max || !ispixused[id2]) 182 184 continue; 183 185 … … 187 189 if (cnt) 188 190 continue; 191 #else 192 Int_t cnt = 0; 193 for (Int_t j=0; j<nnmax; j++) 194 { 195 const Int_t id2 = gpix.GetNeighbor(j); 196 197 if (id2>max || !ispixused[id2]) 198 continue; 199 200 if (cnt++>nnmax-4) 201 break; 202 } 203 if (cnt==nnmax-2 && nnmax>=4) 204 { 205 pix.SetPixelUsed(); 206 continue; 207 } 208 if (cnt>0) 209 continue; 210 #endif 189 211 190 212 // … … 238 260 const Float_t noise = pix.GetErrorPhot(); 239 261 240 if (entry <= fCleanLvl2 * noise 262 if (entry <= fCleanLvl2 * noise) 241 263 continue; 242 264 -
trunk/MagicSoft/Mars/manalysis/MImgCleanStd.h
r1477 r1540 36 36 void Print(Option_t *o="") const; 37 37 38 Float_t GetCleanLvl1() const { return fCleanLvl1; } 39 Float_t GetCleanLvl2() const { return fCleanLvl2; } 40 38 41 Bool_t ProcessMessage(Int_t msg, Int_t submsg, Long_t param1, Long_t param2); 39 42 -
trunk/MagicSoft/Mars/manalysis/MMcPedestalCopy.cc
r1173 r1540 46 46 #include "MLogManip.h" 47 47 48 #include "MPedestalPix.h" 48 49 #include "MPedestalCam.h" 50 49 51 #include "MRawRunHeader.h" 50 52 #include "MMcFadcHeader.hxx" … … 113 115 // -------------------------------------------------------------------------- 114 116 // 115 // Check for the runtype. (not yet: If the check fails the eventloop is 116 // stopped.) 117 // Check for the runtype. 117 118 // Initialize the size of MPedestalCam to the number of pixels from 118 119 // MMcFadcHeader. -
trunk/MagicSoft/Mars/manalysis/MMcPedestalNSBAdd.cc
r1186 r1540 26 26 // // 27 27 // MMcPedestalNSBAdd // 28 // ----------------- // 28 29 // // 29 30 // This Task adds the contribution of the diffuse NSB to the FADC // 30 31 // pedestals. We assume that NSB introduces larger fluctuation but does // 31 32 // not change the mean value. // 32 // To be precise we add quadratically to the rms that is already in//33 // MPedestalCam the NSB contribution.//33 // To be precise we add quadratically to the rms, which is already in // 34 // MPedestalCam, the NSB contribution. // 34 35 // The number of photons from the diffuse NSB follows a poisson // 35 36 // distribution with expected mean value X, then its standard deviation // … … 50 51 // // 51 52 ///////////////////////////////////////////////////////////////////////////// 52 53 53 #include "MMcPedestalNSBAdd.h" 54 54 … … 58 58 #include "MLogManip.h" 59 59 60 #include "MGeomCam.h" 61 #include "MGeomPix.h" 62 63 #include "MPedestalPix.h" 60 64 #include "MPedestalCam.h" 65 61 66 #include "MRawRunHeader.h" 62 67 #include "MMcRunHeader.hxx" 63 68 #include "MMcFadcHeader.hxx" 64 #include "MGeomCam.h"65 #include "MGeomPix.h"66 69 67 70 ClassImp(MMcPedestalNSBAdd); -
trunk/MagicSoft/Mars/manalysis/MPedestalCam.cc
r1155 r1540 31 31 ///////////////////////////////////////////////////////////////////////////// 32 32 #include "MPedestalCam.h" 33 #include "MPedestalPix.h" 34 35 #include <TClonesArray.h> 33 36 34 37 #include "MLog.h" 38 #include "MLogManip.h" 39 40 #include "MGeomCam.h" 41 35 42 36 43 ClassImp(MPedestalCam); … … 62 69 // -------------------------------------------------------------------------- 63 70 // 71 // Set the size of the camera 72 // 73 inline void MPedestalCam::InitSize(const UInt_t i) 74 { 75 fArray->ExpandCreate(i); 76 } 77 78 // -------------------------------------------------------------------------- 79 // 80 // Get the size of the MPedestalCam 81 // 82 inline Int_t MPedestalCam::GetSize() const 83 { 84 return fArray->GetEntries(); 85 } 86 87 // -------------------------------------------------------------------------- 88 // 89 // Get i-th pixel (pixel number) 90 // 91 inline MPedestalPix &MPedestalCam::operator[](Int_t i) 92 { 93 return *(MPedestalPix*)fArray->UncheckedAt(i); 94 } 95 96 // -------------------------------------------------------------------------- 97 // 98 // Get i-th pixel (pixel number) 99 // 100 inline MPedestalPix &MPedestalCam::operator[](Int_t i) const 101 { 102 return *(MPedestalPix*)fArray->UncheckedAt(i); 103 } 104 105 // -------------------------------------------------------------------------- 106 // 64 107 // Check if position i is inside bounds 65 108 // … … 69 112 } 70 113 114 void MPedestalCam::Clear(Option_t *o) 115 { 116 fArray->ForEach(TObject, Clear)(); 117 } 71 118 119 void MPedestalCam::Print(Option_t *o="") const 120 { 121 *fLog << all << GetDescriptor() << ":" << endl; 122 int id = 0; 123 124 TIter Next(fArray); 125 MPedestalPix *pix; 126 while ((pix=(MPedestalPix*)Next())) 127 { 128 id++; 129 130 if (!pix->IsValid()) 131 continue; 132 133 *fLog << id-1 << ": "; 134 *fLog << pix->GetMean() << " " << pix->GetSigma() << " "; 135 *fLog << pix->GetMeanRms() << " " << pix->GetSigmaRms() << endl; 136 } 137 } 138 139 Float_t MPedestalCam::GetMeanMin(const MGeomCam *geom) const 140 { 141 if (fArray->GetEntries() <= 0) 142 return 50.; 143 144 Float_t minval = (*this)[0].GetMean(); 145 146 for (Int_t i=1; i<fArray->GetEntries(); i++) 147 { 148 const MPedestalPix &pix = (*this)[i]; 149 150 Float_t testval = pix.GetMean(); 151 152 if (geom) 153 testval *= geom->GetPixRatio(i); 154 155 if (testval < minval) 156 minval = testval; 157 } 158 return minval; 159 } 160 161 Float_t MPedestalCam::GetMeanMax(const MGeomCam *geom) const 162 { 163 if (fArray->GetEntries() <= 0) 164 return 50.; 165 166 Float_t maxval = (*this)[0].GetMean(); 167 168 for (Int_t i=1; i<fArray->GetEntries(); i++) 169 { 170 const MPedestalPix &pix = (*this)[i]; 171 172 Float_t testval = pix.GetMean(); 173 174 if (geom) 175 testval *= geom->GetPixRatio(i); 176 177 if (testval > maxval) 178 maxval = testval; 179 } 180 return maxval; 181 } -
trunk/MagicSoft/Mars/manalysis/MPedestalCam.h
r1268 r1540 6 6 #endif 7 7 8 #ifndef MARS_MPedestalPix 9 #include "MPedestalPix.h" 10 #endif 8 class TClonesArray; 11 9 12 #ifndef ROOT_TClonesArray 13 #include <TClonesArray.h> 14 #endif 10 class MGeomCam; 11 class MPedestalPix; 15 12 16 13 class MPedestalCam : public MParContainer … … 23 20 ~MPedestalCam(); 24 21 25 void InitSize(const UInt_t i) { fArray->ExpandCreate(i); }22 void Clear(Option_t *o=""); 26 23 27 MPedestalPix &operator[](Int_t i) { return *(MPedestalPix*)fArray->UncheckedAt(i); } 28 MPedestalPix &operator[](Int_t i) const { return *(MPedestalPix*)fArray->UncheckedAt(i); } 24 void InitSize(const UInt_t i); 25 Int_t GetSize() const; 26 27 MPedestalPix &operator[](Int_t i); 28 MPedestalPix &operator[](Int_t i) const; 29 30 Float_t GetMeanMin(const MGeomCam *cam) const; 31 Float_t GetMeanMax(const MGeomCam *cam) const; 29 32 30 33 Bool_t CheckBounds(Int_t i); 34 35 void Print(Option_t *o="") const; 31 36 32 37 ClassDef(MPedestalCam, 1) // Storage Container for all pedestal information of the camera -
trunk/MagicSoft/Mars/manalysis/MPedestalPix.cc
r1081 r1540 38 38 39 39 MPedestalPix::MPedestalPix() 40 : fMean(0.0), fSigma(0.0), fMeanRms(0.0), fSigmaRms(0.0)41 40 { 41 Clear(); 42 42 } 43 43 44 // ------------------------------------------------------------------------ 45 // 46 // Invalidate values 47 // 48 void MPedestalPix::Clear(Option_t *o) 49 { 50 fMean = -1; 51 fSigma = -1; 52 fMeanRms = -1; 53 fSigmaRms = -1; 54 } 55 -
trunk/MagicSoft/Mars/manalysis/MPedestalPix.h
r1014 r1540 17 17 MPedestalPix(); 18 18 19 void Clear(Option_t *o=""); 20 19 21 Float_t GetMean() const { return fMean; } 20 22 Float_t GetSigma() const { return fSigma; } … … 30 32 void SetPedestalRms(Float_t m, Float_t s) { fMeanRms = m; fSigmaRms = s; } 31 33 34 Bool_t IsValid() const { return fMean>=0||fSigma>=0||fMeanRms>=0||fSigmaRms>=0; } 35 32 36 ClassDef(MPedestalPix, 1) // Storage Container for Pedestal information of one pixel 33 37 };
Note:
See TracChangeset
for help on using the changeset viewer.