Changeset 1715
- Timestamp:
- 01/19/03 14:52:29 (22 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 2 added
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r1714 r1715 46 46 * mhist/MHStarMap.cc: 47 47 - added a warning output 48 49 * mmontecarlo/MMcCollectionAreaCalc.cc: 50 - added a check for impact=NaN (some MC Files have this) 48 51 49 52 -
trunk/MagicSoft/Mars/manalysis/MCerPhotCalc.cc
r1552 r1715 16 16 ! 17 17 ! 18 ! Author(s): Abelardo Moralejo 7/2002 (moralejo@pd.infn.it) 19 ! 20 ! Copyright: MAGIC Software Development, 2002 18 ! Author(s): Abelardo Moralejo 7/2002 <mailto:moralejo@pd.infn.it> 19 ! Author(s): Thomas Bretz 2002 <mailto:tbretz@astro.uni-wuerzburg.de> 20 ! 21 ! Copyright: MAGIC Software Development, 2002-2003 21 22 ! 22 23 ! … … 24 25 25 26 ////////////////////////////////////////////////////////////////////////////// 26 // //27 // MCerPhotCalc //28 // //29 // This is a task which calculates the number of photons from the FADC //30 // time slices. It weights the each slice according to the numbers in //31 // the array fWeight (default: all slices added up with weight 1). 32 // //33 // Input Containers: //34 // MRawRunHeader, MRawEvtData, MPedestalCam //35 // //36 // Output Containers: //37 // MCerPhotEvt //38 // //27 // 28 // MCerPhotCalc 29 // 30 // This is a task which calculates the number of photons from the FADC 31 // time slices. It weights the each slice according to the numbers in 32 // the array fWeight (default: all slices added up with weight 1). 33 // 34 // Input Containers: 35 // MRawRunHeader, MRawEvtData, MPedestalCam 36 // 37 // Output Containers: 38 // MCerPhotEvt 39 // 39 40 ////////////////////////////////////////////////////////////////////////////// 40 41 41 #include "MCerPhotCalc.h" 42 42 … … 103 103 fPedestals = (MPedestalCam*)pList->FindCreateObj("MPedestalCam"); 104 104 if (!fPedestals) 105 { 106 *fLog << dbginf << "MPedestalCam not found... aborting." << endl; 107 return kFALSE; 108 } 105 return kFALSE; 109 106 110 107 fCerPhotEvt = (MCerPhotEvt*)pList->FindCreateObj("MCerPhotEvt"); … … 115 112 fSumQuadWeights = 0.; 116 113 for (Int_t i = 0; i < fWeight.GetSize(); i++) 117 fSumQuadWeights += fWeight[i]*fWeight[i];114 fSumQuadWeights += fWeight[i]*fWeight[i]; 118 115 119 116 fSumQuadWeights = sqrt(fSumQuadWeights); … … 171 168 MRawEvtPixelIter pixel(fRawEvt); 172 169 173 TArrayF BinSignal(fWeight.GetSize());170 TArrayF binsignal(fWeight.GetSize()); 174 171 175 172 while (pixel.Next()) 176 177 173 { 174 const UInt_t pixid = pixel.GetPixelId(); 178 175 const MPedestalPix &ped = (*fPedestals)[pixid]; 179 176 … … 187 184 } 188 185 189 // Mean pedestal: 190 Double_t mean = fEnableFix ? ped.GetMean()-0.5 : ped.GetMean(); 191 192 Byte_t *ptr = pixel.GetHiGainSamples(); 193 194 Float_t nphot = 0.; 195 Float_t nphoterr = 0.; 196 197 // Calculate pixel signal unless it has all FADC slices empty: 198 199 if (pixel.GetSumHiGainSamples()>0) 200 { 201 for(Int_t i = 0; i<fWeight.GetSize(); i++) 202 { 203 BinSignal[i] = (Float_t) ptr[i] - mean; 204 nphot += BinSignal[i] * fWeight[i]; 205 } 206 nphoterr = ped.GetSigma()* fSumQuadWeights; 207 } 186 // 187 // Mean pedestal: 188 // 189 const Double_t mean = fEnableFix ? ped.GetMean()-0.5 : ped.GetMean(); 190 191 // 192 // Calculate pixel signal unless it has all FADC slices empty: 193 // 194 const Byte_t *ptr = pixel.GetHiGainSamples(); 195 196 Float_t nphot = 0; 197 Float_t nphoterr = 0; 198 199 if (pixel.GetSumHiGainSamples()>0) 200 { 201 for (Int_t i=0; i<fWeight.GetSize(); i++) 202 { 203 binsignal[i] = ptr[i] - mean; 204 nphot += binsignal[i] * fWeight[i]; 205 } 206 nphoterr = ped.GetSigma() * fSumQuadWeights; 207 } 208 208 209 209 fCerPhotEvt->AddPixel(pixid, nphot, nphoterr); 210 210 211 211 // FIXME! Handling of Lo Gains is missing! 212 212 } 213 213 214 214 fCerPhotEvt->SetReadyToSave(); … … 217 217 } 218 218 219 // -------------------------------------------------------------------------- 219 220 // 220 221 // Set default values for the number of slices and weights: 221 222 // 222 223 223 void MCerPhotCalc::SetDefaultWeights() 224 224 { 225 const Float_t dummy[15] = {1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,}; 226 227 fWeight.Set(15,dummy); 228 return; 229 } 230 231 232 233 225 const Float_t dummy[15] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; 226 fWeight.Set(15, dummy); 227 } -
trunk/MagicSoft/Mars/manalysis/MCerPhotCalc.h
r1546 r1715 10 10 // // 11 11 ///////////////////////////////////////////////////////////////////////////// 12 #ifndef ROOT_TArrayF 13 #include <TArrayF.h> 14 #endif 12 15 13 16 #ifndef MARS_MTask … … 15 18 #endif 16 19 17 #include <TArrayF.h>18 19 20 class MRawEvtData; 20 21 class MPedestalCam; 21 22 class MCerPhotEvt; 22 23 class MRawRunHeader; 23 class TArrayF;24 24 25 25 class MCerPhotCalc : public MTask … … 44 44 Bool_t ReInit(MParList *pList); 45 45 46 void SetWeights(TArrayF w) {fWeight.Set(w.GetSize(),w.GetArray());} 46 // FIXME: The array size should be checked! 47 void SetWeights(const TArrayF &w) { fWeight = w; } 47 48 48 49 ClassDef(MCerPhotCalc, 0) // Task to calculate cerenkov photons from raw data -
trunk/MagicSoft/Mars/manalysis/MCerPhotEvt.cc
r1574 r1715 158 158 return -5.; 159 159 160 const UInt_t n = geom->GetNumPixels(); 161 160 162 Float_t minval = (*this)[0].GetNumPhotons(); 161 163 … … 164 166 const MCerPhotPix &pix = (*this)[i]; 165 167 168 const UInt_t id = pix.GetPixId(); 169 if (id>=n) 170 continue; 171 166 172 Float_t testval = pix.GetNumPhotons(); 167 173 168 174 if (geom) 169 testval *= geom->GetPixRatio( pix.GetPixId());175 testval *= geom->GetPixRatio(id); 170 176 171 177 if (testval < minval) … … 187 193 return 50.; 188 194 195 const UInt_t n = geom->GetNumPixels(); 196 189 197 Float_t maxval = (*this)[0].GetNumPhotons(); 190 198 … … 193 201 const MCerPhotPix &pix = (*this)[i]; 194 202 203 const UInt_t id = pix.GetPixId(); 204 if (id>=n) 205 continue; 206 195 207 Float_t testval = pix.GetNumPhotons(); 196 197 208 if (geom) 198 testval *= geom->GetPixRatio( pix.GetPixId());209 testval *= geom->GetPixRatio(id); 199 210 200 211 if (testval > maxval) … … 322 333 return NULL; 323 334 } 335 336 /* 337 // -------------------------------------------------------------------------- 338 // 339 // Use this function to sum photons in events together. 340 // 341 Bool_t MCerPhotEvt::AddEvent(const MCerPhotEvt &evt) 342 { 343 if (evt.fNumPixels<=0) 344 { 345 *fLog << "Warning - Event to be added has no pixels." << endl; 346 return kFALSE; 347 } 348 if (fNumPixels<=0) 349 { 350 *fLog << "Warning - Event to add pixels to has no pixels." << endl; 351 return kFALSE; 352 } 353 354 for (UInt_t i=0; i<evt.fNumPixels; i++) 355 { 356 const UInt_t id = evt[i].GetPixId(); 357 358 MCerPhotPix *pix2 = GetPixById(id); 359 if (!pix2) 360 { 361 *fLog << "Error - Pixel#" << dec << id << " does not exist in this event!" << endl; 362 return kFALSE; 363 } 364 365 pix2->AddNumPhotons(evt[i].GetNumPhotons()); 366 } 367 return kTRUE; 368 } 369 */ -
trunk/MagicSoft/Mars/manalysis/MCerPhotEvt.h
r1574 r1715 30 30 } 31 31 32 //Bool_t AddEvent(const MCerPhotEvt &evt); 32 33 33 34 Bool_t IsPixelExisting(Int_t id) const; -
trunk/MagicSoft/Mars/manalysis/MCerPhotPix.h
r1503 r1715 41 41 void Set(Float_t np, Float_t ep) { fPhot = np; fErrPhot = ep; } 42 42 43 void AddNumPhotons(Float_t f) { fPhot += f; } 44 43 45 void Print(Option_t *opt = NULL) const; 44 46 -
trunk/MagicSoft/Mars/mbase/MContinue.cc
r1600 r1715 24 24 25 25 ///////////////////////////////////////////////////////////////////////////// 26 // // 27 // MContinue // 28 // // 29 // Does nothing than return kCONTINUE in the Process-function // 30 // (use with filters) // 31 // // 26 // 27 // MContinue 28 // 29 // Does nothing than return kCONTINUE in the Process-function 30 // (use with filters). For more details see the description of the 31 // constructors. 32 // 32 33 ///////////////////////////////////////////////////////////////////////////// 33 34 #include "MContinue.h" 34 35 36 #include "MLog.h" 37 #include "MLogManip.h" 38 39 #include "MF.h" 40 #include "MParList.h" 41 #include "MTaskList.h" 42 35 43 ClassImp(MContinue); 36 44 37 MContinue::MContinue(const char *name, const char *title) 45 // -------------------------------------------------------------------------- 46 // 47 // Use this constructor if a rule (see MF for more details) shell be used. 48 // MContinue will create a MF object and use it as a filter for the 49 // instance. The MF-Task is added to the tasklist in front of the MContinue 50 // instance and also automatically deleted, eg. 51 // MContinue cont("MHillas.fSize<20"); 52 // tasklist.AddToList(&cont); 53 // would skip all events which fullfill "MHillas.fSize<20" from this point 54 // in the tasklist. 55 // 56 MContinue::MContinue(const TString rule, const char *name, const char *title) 38 57 { 39 58 fName = name ? name : "MContinue"; 40 59 fTitle = title ? title : "Task returning kCONTINUE"; 60 61 if (rule.IsNull()) 62 return; 63 64 SetBit(kIsOwner); 65 66 MTask::SetFilter(new MF(rule, TString("MF(")+fName+")")); 41 67 } 42 68 69 // -------------------------------------------------------------------------- 70 // 71 // Use this if you have a filter. Would be the same as if you would call: 72 // MContinue cont; 73 // cont.SetFilter(f); 74 // 43 75 MContinue::MContinue(MFilter *f, const char *name, const char *title) 44 76 { … … 48 80 SetFilter(f); 49 81 } 82 83 // -------------------------------------------------------------------------- 84 // 85 // Delete the filter if it was created automatically 86 // 87 MContinue::~MContinue() 88 { 89 if (TestBit(kIsOwner)) 90 delete GetFilter(); 91 } 92 93 // -------------------------------------------------------------------------- 94 // 95 // In case the filter was created automatically, PreProcess tries to find 96 // the tasklist MTaskList, adds the filter before this instance to the 97 // tasklist and preprocesses the filter. 98 // 99 Bool_t MContinue::PreProcess(MParList *list) 100 { 101 if (!TestBit(kIsOwner)) 102 return kTRUE; 103 104 MTaskList *tlist = (MTaskList*)list->FindObject("MTaskList"); 105 if (!tlist) 106 { 107 *fLog << err << dbginf << "ERROR - Tasklist 'MTaskList' not found... abort." << endl; 108 return kFALSE; 109 } 110 111 if (!GetFilter()) 112 { 113 *fLog << err << dbginf << "Unknown fatal Error! (fFilter=NULL?!?)" << endl; 114 return kFALSE; 115 } 116 117 if (!tlist->AddToListBefore(GetFilter(), this)) 118 { 119 *fLog << err << dbginf << "ERROR - Adding filter before MContinue... abort." << endl; 120 return kFALSE; 121 } 122 123 return GetFilter()->CallPreProcess(list); 124 } 125 -
trunk/MagicSoft/Mars/mbase/MContinue.h
r1538 r1715 20 20 { 21 21 private: 22 Bool_t PreProcess(MParList *list); 22 23 Bool_t Process() { return kCONTINUE; } 23 24 25 enum { kIsOwner = BIT(14) }; 26 24 27 public: 25 MContinue(const char *name=NULL, const char *title=NULL);28 MContinue(const TString rule="", const char *name=NULL, const char *title=NULL); 26 29 MContinue(MFilter *f, const char *name=NULL, const char *title=NULL); 30 ~MContinue(); 31 32 void SetFilter(MFilter *filter) { if (!TestBit(kIsOwner)) MTask::SetFilter(filter); } 27 33 28 34 ClassDef(MContinue, 1) //Task returning kCONTINUE -
trunk/MagicSoft/Mars/mbase/Makefile
r1540 r1715 20 20 # @endcode 21 21 22 INCLUDES = -I. -I../mraw -I../MRawFormat -I../mmc -I../mfileio -I../mmain 22 INCLUDES = -I. -I../mraw -I../MRawFormat -I../mmc -I../mfileio -I../mmain -I../mfilter 23 23 24 24 # @code -
trunk/MagicSoft/Mars/mfileio/MCT1ReadPreProc.cc
r1668 r1715 701 701 702 702 fNumFilterEvts = 0; 703 fNumEvents = 0; 703 704 fNumRuns = 0; 704 705 -
trunk/MagicSoft/Mars/mgeom/MGeomCam.cc
r1544 r1715 117 117 Float_t MGeomCam::GetPixRatio(Int_t i) const 118 118 { 119 return (*this)[0].GetA()/(*this)[i].GetA();119 return i<fNumPixels ? (*this)[0].GetA()/(*this)[i].GetA() : 0; 120 120 } 121 121 -
trunk/MagicSoft/Mars/mgui/MCamDisplay.cc
r1670 r1715 42 42 #include <TStyle.h> 43 43 #include <TCanvas.h> 44 #include <TButton.h>44 //#include <TButton.h> 45 45 #include <TClonesArray.h> 46 46 … … 167 167 } 168 168 169 inline void MCamDisplay::SetPixColor(const MCerPhotPix &pix, const Int_t i, Float_t min, Float_t max) 170 { 169 inline void MCamDisplay::SetPixColor(const MCerPhotPix &pix, const UInt_t i, Float_t min, Float_t max) 170 { 171 if (i>=fNumPixels) 172 return; 173 171 174 // 172 175 // Fixme: Use absolute value per mm^2. Needs another scaling algorithm. … … 178 181 } 179 182 180 inline void MCamDisplay::SetPixColorPedestal(const MPedestalPix &pix, const Int_t i, Float_t min, Float_t max) 181 { 183 inline void MCamDisplay::SetPixColorPedestal(const MPedestalPix &pix, const UInt_t i, Float_t min, Float_t max) 184 { 185 if (i>=fNumPixels) 186 return; 187 182 188 // 183 189 // Fixme: Use absolute value per mm^2. Needs another scaling algorithm. … … 189 195 } 190 196 191 inline void MCamDisplay::SetPixColorError(const MCerPhotPix &pix, const Int_t i, Float_t min, Float_t max) 192 { 197 inline void MCamDisplay::SetPixColorError(const MCerPhotPix &pix, const UInt_t i, Float_t min, Float_t max) 198 { 199 if (i>=fNumPixels) 200 return; 201 193 202 // 194 203 // Fixme: Use absolute value per mm^2. Needs another scaling algorithm. … … 378 387 } 379 388 389 void MCamDisplay::SetPrettyPalette() 390 { 391 SetPalette(1, 0); 392 } 393 394 void MCamDisplay::SetDeepBlueSeaPalette() 395 { 396 SetPalette(51, 0); 397 } 398 399 void MCamDisplay::SetInvDeepBlueSeaPalette() 400 { 401 SetPalette(52, 0); 402 } 403 380 404 // ------------------------------------------------------------------------ 381 405 // … … 418 442 Paint(); 419 443 420 // 421 // Create and draw the buttons which allows changing the 422 // color palette of the display 423 // 424 TButton *but; 425 char txt[100]; 426 sprintf(txt, "((MCamDisplay*)0x%lx)->SetPalette(1,0);", this); 427 but = new TButton("Pretty", txt, 0.01, 0.95, 0.15, 0.99); 428 but->Draw(); 429 sprintf(txt, "((MCamDisplay*)0x%lx)->SetPalette(51,0);", this); 430 but = new TButton("Deap Sea", txt, 0.16, 0.95, 0.30, 0.99); 431 but->Draw(); 432 sprintf(txt, "((MCamDisplay*)0x%lx)->SetPalette(52,0);", this); 433 but = new TButton("Blue Inv", txt, 0.31, 0.95, 0.45, 0.99); 434 but->Draw(); 444 /* 445 // 446 // Create and draw the buttons which allows changing the 447 // color palette of the display 448 // 449 TButton *but; 450 char txt[100]; 451 sprintf(txt, "((MCamDisplay*)0x%lx)->SetPalette(1,0);", this); 452 but = new TButton("Pretty", txt, 0.01, 0.95, 0.15, 0.99); 453 but->Draw(); 454 sprintf(txt, "((MCamDisplay*)0x%lx)->SetPalette(51,0);", this); 455 but = new TButton("Deap Sea", txt, 0.16, 0.95, 0.30, 0.99); 456 but->Draw(); 457 sprintf(txt, "((MCamDisplay*)0x%lx)->SetPalette(52,0);", this); 458 but = new TButton("Blue Inv", txt, 0.31, 0.95, 0.45, 0.99); 459 but->Draw(); 460 */ 435 461 436 462 // … … 441 467 { 442 468 #if ROOT_VERSION_CODE > ROOT_VERSION(3,01,06) 443 (*this)[i].SetBit( kNoContextMenu|kCannotPick);469 (*this)[i].SetBit(/*kNoContextMenu|*/kCannotPick); 444 470 #endif 445 471 (*this)[i].SetFillColor(22); … … 470 496 box->SetFillColor(22); 471 497 #if ROOT_VERSION_CODE > ROOT_VERSION(3,01,06) 472 box->SetBit( kNoContextMenu|kCannotPick);498 box->SetBit(/*kNoContextMenu|*/kCannotPick); 473 499 #endif 474 500 box->Draw(); … … 478 504 txt->SetY(H*((i+0.5)*h - 1.)); 479 505 #if ROOT_VERSION_CODE > ROOT_VERSION(3,01,06) 480 txt->SetBit( kNoContextMenu|kCannotPick);506 txt->SetBit(/*kNoContextMenu|*/kCannotPick); 481 507 #endif 482 508 txt->Draw(); -
trunk/MagicSoft/Mars/mgui/MCamDisplay.h
r1544 r1715 54 54 MHexagon &operator[](int i) { return *((MHexagon*)fPixels->At(i)); } 55 55 56 void SetPixColor(const MCerPhotPix &pix, const Int_t i, Float_t min, Float_t max);56 void SetPixColor(const MCerPhotPix &pix, const UInt_t i, Float_t min, Float_t max); 57 57 void SetPixColorRatio(const MCerPhotPix &pix, Float_t min, Float_t max); 58 58 void SetPixColorLevel(const MCerPhotPix &pix, Float_t lvl1, Float_t lvl2); 59 void SetPixColorError(const MCerPhotPix &pix, const Int_t i, Float_t min, Float_t max);60 void SetPixColorPedestal(const MPedestalPix &pix, const Int_t i, Float_t min, Float_t max);59 void SetPixColorError(const MCerPhotPix &pix, const UInt_t i, Float_t min, Float_t max); 60 void SetPixColorPedestal(const MPedestalPix &pix, const UInt_t i, Float_t min, Float_t max); 61 61 Int_t GetColor(Float_t val, Float_t min, Float_t max); 62 62 … … 86 86 void SetPalette(Int_t ncolors, Int_t *colors); 87 87 88 void SetPrettyPalette(); // *MENU* 89 void SetDeepBlueSeaPalette(); // *MENU* 90 void SetInvDeepBlueSeaPalette(); // *MENU* 91 88 92 ClassDef(MCamDisplay, 0) // Displays the magic camera 89 93 }; -
trunk/MagicSoft/Mars/mhist/HistLinkDef.h
r1683 r1715 17 17 #pragma link C++ class MHFadcCam+; 18 18 #pragma link C++ class MHFadcPix+; 19 20 #pragma link C++ class MHCerPhotEvt+; 19 21 20 22 #pragma link C++ class MHHillas+; … … 48 50 #pragma link C++ class MHMcEnergyImpact+; 49 51 #pragma link C++ class MHMcCollectionArea+; 50 # 52 #pragma link C++ class MHMcEnergyMigration+; 51 53 52 54 #endif -
trunk/MagicSoft/Mars/mhist/MFillH.cc
r1668 r1715 400 400 if (fParContainerName.IsNull()) 401 401 { 402 fParContainer = pList;402 fParContainer = NULL; 403 403 return kTRUE; 404 404 } 405 405 406 406 fParContainer = (MParContainer*)pList->FindObject(fParContainerName); 407 407 408 if (fParContainer) 408 409 return kTRUE; -
trunk/MagicSoft/Mars/mhist/MHHillasExt.cc
r1574 r1715 179 179 const MHillasSrc *src = (MHillasSrc*)par; 180 180 181 const Double_t scale = src ? TMath::Sign(fUseMmScale?1:fMm2Deg, src->GetCosDeltaAlpha()) : 1;181 const Double_t scale = TMath::Sign(fUseMmScale?1:fMm2Deg, src ? src->GetCosDeltaAlpha() : 1); 182 182 183 183 fHConc.Fill(fHillasExt->GetConc()); -
trunk/MagicSoft/Mars/mhist/MHStarMap.cc
r1540 r1715 68 68 fTitle = title ? title : "Container for a Star Map" ; 69 69 70 *fLog << warn << "WARNING - Using MHStarMap doesn't take care of the Source Position!" << endl; 71 70 72 // 71 73 // loop over all Pixels and create two histograms -
trunk/MagicSoft/Mars/mhist/Makefile
r1683 r1715 34 34 MHArray.cc \ 35 35 MH3.cc \ 36 MHCerPhotEvt.cc \ 36 37 MHMatrix.cc \ 37 38 MHFadcPix.cc \ … … 82 83 83 84 # @endcode 84 85 86 87 88 89 90 91 92 93 -
trunk/MagicSoft/Mars/mmontecarlo/MMcCollectionAreaCalc.cc
r1646 r1715 130 130 Bool_t MMcCollectionAreaCalc::Process() 131 131 { 132 // *fLog << all << fMcEvt << " " << (int)fAllEvtsTriggered << " " << fCollArea << endl; 133 const Float_t energy = fMcEvt->GetEnergy(); 134 const Float_t impact = fMcEvt->GetImpact()/100.; 132 const Double_t energy = fMcEvt->GetEnergy(); 133 const Double_t impact = fMcEvt->GetImpact()/100.; 134 135 // 136 // This happens for camera files created with Camera 0.5 137 // 138 if (TMath::IsNaN(impact)) 139 { 140 *fLog << err << dbginf << "ERROR - Impact=NaN (Not a number)... abort." << endl; 141 return kERROR; 142 } 135 143 136 144 if (!fAllEvtsTriggered)
Note:
See TracChangeset
for help on using the changeset viewer.