Changeset 9347 for trunk/MagicSoft/Mars/msim
- Timestamp:
- 02/18/09 12:07:41 (16 years ago)
- Location:
- trunk/MagicSoft/Mars/msim
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/msim/MHPhotonEvent.cc
r9328 r9347 115 115 fHistWL.SetName("Spectrum"); 116 116 fHistWL.SetTitle("Wavelength distribution"); 117 fHistWL.SetXTitle("\\lamb a [nm]");117 fHistWL.SetXTitle("\\lambda [nm]"); 118 118 fHistWL.SetYTitle("Counts"); 119 119 fHistWL.SetDirectory(NULL); … … 124 124 fHistH.SetYTitle("Counts"); 125 125 fHistH.SetDirectory(NULL); 126 127 // FIXME: Get this information from the corsika run-header128 MBinning(70, 275, 625).Apply(fHistWL);129 MBinning(100, 0, 25).Apply(fHistH);130 126 } 131 127 … … 169 165 // -------------------------------------------------------------------------- 170 166 // 167 // Find good limits for a binning num x [-max;max] 168 // and apply it to fHistXY and fHistT. 169 // 170 void MHPhotonEvent::SetBinningXY(Int_t num, Double_t max) 171 { 172 Double_t min = -max; 173 174 MH::FindGoodLimits(num, num, min, max, kFALSE); 175 176 MBinning binsd, binsa, binsz; 177 binsd.SetEdges(num, min, max); 178 179 SetBinning(&fHistXY, &binsd, &binsd); 180 SetBinning(&fHistT, &binsd, &binsd); 181 } 182 183 // -------------------------------------------------------------------------- 184 // 171 185 // Search for MRflEvtData, MRflEvtHeader and MGeomCam 172 186 // … … 175 189 Double_t xmax = -1; 176 190 Int_t num = 100; 191 192 const Int_t f = fPermanentReset ? 2 : 1; 193 MBinning(100/f, 0, 25).Apply(fHistH); 194 MBinning(70, 275, 625).Apply(fHistWL); 177 195 178 196 switch (fType) … … 182 200 // case0: Take a value defined by the user 183 201 case 1: 184 { 185 MCorsikaRunHeader *h = (MCorsikaRunHeader*)pList->FindObject("MCorsikaRunHeader"); 186 if (!h) 187 { 188 *fLog << err << "MCorsikaRunHeader not found... aborting." << endl; 189 return kFALSE; 190 } 191 xmax = 25000;//h->GetImpactMax()*1.25; // Estimate scattering in the atmosphere 192 break; 193 } 202 xmax = 25000; 203 break; 194 204 case 2: 195 205 { … … 222 232 } 223 233 224 Double_t xmin = -xmax; 234 SetBinningXY(num, xmax); 235 236 return kTRUE; 237 } 238 239 // -------------------------------------------------------------------------- 240 // 241 // ReInit overwrites the binning of the Wavelength histogram 242 // by the wavlenegth band from MCorsikaRunHeader. 243 // The bin-width is 5nm (fPermanentReset==kTRUE) or 10nm (kFALSE). 244 // 245 Bool_t MHPhotonEvent::ReInit(MParList *pList) 246 { 247 MCorsikaRunHeader *h = (MCorsikaRunHeader*)pList->FindObject("MCorsikaRunHeader"); 248 if (!h) 249 { 250 *fLog << err << "MCorsikaRunHeader not found... aborting." << endl; 251 return kFALSE; 252 } 253 254 /* 255 // What is the size of the light pool onm the ground? 256 if (fType==1) 257 SetBinningXY(100, h->GetImpactMax()); 258 */ 259 260 const Int_t f = fPermanentReset ? 2 : 1; 261 262 Double_t xmin = h->GetWavelengthMin(); 263 Double_t xmax = h->GetWavelengthMax(); 264 Int_t num = TMath::CeilNint((xmax-xmin)/(5*f)); 225 265 226 266 MH::FindGoodLimits(num, num, xmin, xmax, kFALSE); 227 267 228 MBinning binsd, binsa, binsz; 229 binsd.SetEdges(num, xmin, xmax); 230 231 SetBinning(&fHistXY, &binsd, &binsd); 232 SetBinning(&fHistT, &binsd, &binsd); 268 MBinning(abs(num), xmin, xmax).Apply(fHistWL); 233 269 234 270 return kTRUE; … … 250 286 // Check if we want to use this class as a single event display 251 287 if (fPermanentReset && evt->GetNumPhotons()>0) 252 { 253 fHistXY.Reset(); 254 fHistUV.Reset(); 255 fHistT.Reset(); 256 } 288 Clear(); 257 289 258 290 // Get number of photons … … 365 397 fHistH.Draw(); 366 398 } 399 400 // -------------------------------------------------------------------------- 401 // 402 // PermanentReset: Off 403 // 404 Int_t MHPhotonEvent::ReadEnv(const TEnv &env, TString prefix, Bool_t print) 405 { 406 Bool_t rc = kFALSE; 407 if (IsEnvDefined(env, prefix, "PermanentReset", print)) 408 { 409 rc = kTRUE; 410 fPermanentReset = GetEnvValue(env, prefix, "PermanentReset", fPermanentReset); 411 } 412 413 return rc; 414 } -
trunk/MagicSoft/Mars/msim/MHPhotonEvent.h
r9308 r9347 28 28 Bool_t fPermanentReset; 29 29 30 // MHPhotonEvent 30 31 void Init(const char *name, const char *title); 32 void SetBinningXY(Int_t num, Double_t max); 31 33 34 // MParContainer 35 Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print); 36 37 // MH 32 38 Bool_t SetupFill(const MParList *pList); 39 Bool_t ReInit(MParList *pList); 33 40 Int_t Fill(const MParContainer *par, const Stat_t weight=1); 34 41 //Bool_t Finalize(); 35 42 36 43 public: 37 MHPhotonEvent(Double_t max =0, const char *name=0, const char *title=0);38 MHPhotonEvent(Int_t type ,const char *name=0, const char *title=0);44 MHPhotonEvent(Double_t max, const char *name=0, const char *title=0); 45 MHPhotonEvent(Int_t type=3, const char *name=0, const char *title=0); 39 46 47 void PermanentReset(Bool_t b=kTRUE) { fPermanentReset=b; } 48 49 // TObject 40 50 void Draw(Option_t *o=""); 41 51 void Paint(Option_t *o=""); 52 53 void Clear(Option_t *o="") 54 { 55 fHistXY.Reset(); 56 fHistUV.Reset(); 57 fHistT.Reset(); 58 fHistWL.Reset(); 59 fHistH.Reset(); 60 } 42 61 43 62 ClassDef(MHPhotonEvent, 2) // Histogram to display the information of MPhotonEvents -
trunk/MagicSoft/Mars/msim/MSimAbsorption.cc
r9328 r9347 296 296 { 297 297 // Get i-th photon from the list 298 MPhotonData &ph = (*fEvt)[i];298 const MPhotonData &ph = (*fEvt)[i]; 299 299 300 300 // Depending on fUseTheta get the incident angle of the wavelength
Note:
See TracChangeset
for help on using the changeset viewer.