Changeset 9937 for trunk/Mars/msim
- Timestamp:
- 09/22/10 15:25:55 (14 years ago)
- Location:
- trunk/Mars/msim
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Mars/msim/MPhotonData.cc
r9820 r9937 16 16 ! 17 17 ! 18 ! Author(s): Thomas Bretz, 12/2000 <mailto:t bretz@astro.uni-wuerzburg.de>18 ! Author(s): Thomas Bretz, 12/2000 <mailto:thomas.bretz@epfl.ch> 19 19 ! Author(s): Qi Zhe, 06/2007 <mailto:qizhe@astro.uni-wuerzburg.de> 20 20 ! 21 ! Copyright: CheObs Software Development, 2000-20 0921 ! Copyright: CheObs Software Development, 2000-2010 22 22 ! 23 23 ! … … 34 34 // Version 1: 35 35 // ---------- 36 // - First implementation 36 // * First implementation 37 // 38 // Version 2: 39 // ---------- 40 // - fNumPhotons 37 41 // 38 42 ///////////////////////////////////////////////////////////////////////////// … … 57 61 MPhotonData::MPhotonData(/*const char *name, const char *title*/) 58 62 : fPosX(0), fPosY(0), fCosU(0), fCosV(0), fTime(0), fWavelength(0), 59 fNumPhotons(1),fProductionHeight(0), fPrimary(MMcEvtBasic::kUNDEFINED),63 /*fNumPhotons(1),*/ fProductionHeight(0), fPrimary(MMcEvtBasic::kUNDEFINED), 60 64 fTag(-1), fWeight(1) 61 65 { … … 82 86 MPhotonData &d = static_cast<MPhotonData&>(obj); 83 87 84 d.fNumPhotons = fNumPhotons;88 // d.fNumPhotons = fNumPhotons; 85 89 d.fPosX = fPosX; 86 90 d.fPosY = fPosY; … … 185 189 186 190 fPrimary = MMcEvtBasic::kUNDEFINED; 187 fNumPhotons = 1;191 // fNumPhotons = 1; 188 192 fTag = -1; 189 193 fWeight = 1; … … 201 205 // system intpo our own. 202 206 // 203 Int_t MPhotonData::FillCorsika(Float_t f[7] )207 Int_t MPhotonData::FillCorsika(Float_t f[7], Int_t i) 204 208 { 205 209 const UInt_t n = TMath::Nint(f[0]); 206 210 if (n==0) 211 // FIXME: Do we need to decode the rest anyway? 212 return kCONTINUE; 213 214 // Check reuse 215 const Int_t reuse = (n/1000)%100; // Force this to be 1! 216 if (reuse!=i) 207 217 return kCONTINUE; 208 218 … … 210 220 fWavelength = n%1000; 211 221 fPrimary = MMcEvtBasic::ParticleId_t(n/100000); 212 fNumPhotons = (n/1000)%100; // Force this to be 1!213 214 if (fNumPhotons!=1)215 {216 // FIXME: Could be done in MPhotonEvent::ReadCorsikaEvent217 gLog << err << "ERROR - MPhotonData::FillCorsika: fNumPhotons not 1, but " << fNumPhotons << endl;218 gLog << " This is not yet supported." << endl;219 return kERROR;220 }221 222 222 223 // x=north, y=west … … 254 255 Int_t MPhotonData::FillEventIO(Float_t f[8]) 255 256 { 257 if (TMath::Nint(f[6])!=1) 258 { 259 gLog << err << "ERROR - Bunch sizes != 1 are not supported." << endl; 260 return kFALSE; 261 } 262 256 263 fPosX = f[1]; // xpos relative to telescope [cm] 257 264 fPosY = -f[0]; // ypos relative to telescope [cm] … … 260 267 fTime = f[4]; // a relative arival time [ns] 261 268 fProductionHeight = f[5]; // altitude of emission [cm] 262 fNumPhotons = TMath::Nint(f[6]); // photons in this bunch269 // fNumPhotons = TMath::Nint(f[6]); // photons in this bunch 263 270 fWavelength = TMath::Nint(f[7]); // so far always zeor = unspec. [nm] 264 265 271 266 272 // Now reset all data members which are not in the stream … … 271 277 return kTRUE; 272 278 } 273 279 /* 274 280 // -------------------------------------------------------------------------- 275 281 // … … 299 305 return rc==kTRUE ? !fin.eof() : rc; 300 306 } 307 */ 301 308 302 309 // -------------------------------------------------------------------------- … … 308 315 { 309 316 gLog << inf << endl; 310 gLog << "Num Photons: " << fNumPhotons << " from " << MMcEvtBasic::GetParticleName(fPrimary) << endl; 317 // gLog << "Num Photons: " << fNumPhotons << " from " << MMcEvtBasic::GetParticleName(fPrimary) << endl; 318 gLog << "Origin: " << MMcEvtBasic::GetParticleName(fPrimary) << endl; 311 319 gLog << "Wavelength: " << fWavelength << "nm" << endl; 312 320 gLog << "Pos X/Y Cos U/V: " << fPosX << "/" << fPosY << " " << fCosU << "/" << fCosV << endl; -
trunk/Mars/msim/MPhotonData.h
r9616 r9937 37 37 38 38 Float_t fTime; // [ns] Time since first interaction or entrance into atmosphere 39 // 17M40 39 UShort_t fWavelength; // [nm] Wavelength 41 // 19M 42 UInt_t fNumPhotons; // Number of cherenkov photons ins bunch 40 // UInt_t fNumPhotons; // Number of cherenkov photons ins bunch 43 41 Float_t fProductionHeight; // [cm] Height of bunch production 44 42 MMcEvtBasic::ParticleId_t fPrimary; // Type of emitting particle 45 // 22M46 // gzip47 // 25M48 // raw49 // 32M50 43 51 44 Int_t fTag; //! A tag for external use … … 129 122 130 123 // I/O 131 Int_t ReadCorsikaEvt(istream &fin);132 Int_t ReadRflEvt(istream &fin);124 //Int_t ReadCorsikaEvt(istream &fin); 125 //Int_t ReadRflEvt(istream &fin); 133 126 134 Int_t FillCorsika(Float_t f[7] );127 Int_t FillCorsika(Float_t f[7], Int_t i); 135 128 Int_t FillEventIO(Float_t f[7]); 136 129 Int_t FillRfl(Float_t f[8]); 137 130 138 ClassDef(MPhotonData, 1) //Container to store a cherenkov photon bunch from a CORSUKA file131 ClassDef(MPhotonData, 2) //Container to store a cherenkov photon bunch from a CORSUKA file 139 132 }; 140 133 -
trunk/Mars/msim/MPhotonEvent.cc
r9616 r9937 449 449 } 450 450 451 Double_t MPhotonEvent::GetMeanX() const 452 { 453 const UInt_t n = GetNumPhotons(); 454 455 Double_t mean = 0; 456 for (UInt_t i=0; i<n; i++) 457 mean += operator[](i).GetPosX(); 458 459 return mean / n; 460 } 461 462 Double_t MPhotonEvent::GetMeanY() const 463 { 464 const UInt_t n = GetNumPhotons(); 465 466 Double_t mean = 0; 467 for (UInt_t i=0; i<n; i++) 468 mean += operator[](i).GetPosY(); 469 470 return mean / n; 471 } 472 451 473 // -------------------------------------------------------------------------- 452 474 // 453 475 // Read the Event section from the file 454 476 // 455 Int_t MPhotonEvent::ReadCorsikaEvt(MCorsikaFormat * fInFormat)477 Int_t MPhotonEvent::ReadCorsikaEvt(MCorsikaFormat *fInFormat, Int_t i) 456 478 { 457 479 Int_t n = 0; … … 509 531 { 510 532 511 const Int_t rc = Add(n).FillCorsika(buffer );533 const Int_t rc = Add(n).FillCorsika(buffer, i); 512 534 switch (rc) 513 535 { … … 577 599 } 578 600 579 Int_t MPhotonEvent::ReadCorsikaEvt(istream &fin )601 Int_t MPhotonEvent::ReadCorsikaEvt(istream &fin, Int_t i) 580 602 { 581 603 Int_t n = 0; … … 635 657 // Get/Add the n-th entry from the array and 636 658 // fill it with the current 7 floats 637 const Int_t rc = Add(n).FillCorsika(ptr );659 const Int_t rc = Add(n).FillCorsika(ptr, i); 638 660 ptr += 7; 639 661 … … 707 729 708 730 // -------------------------------------------------------------------------- 709 / /710 Int_t MPhotonEvent::ReadRflEvt(std::istream &fin )731 /* 732 Int_t MPhotonEvent::ReadRflEvt(std::istream &fin, Int_t i) 711 733 { 712 734 Int_t n = 0; … … 735 757 // Now we read a single cherenkov bunch 736 758 //const Int_t rc = static_cast<MPhotonData*>(o)->ReadRflEvt(fin); 737 const Int_t rc = Add(n).ReadRflEvt(fin );759 const Int_t rc = Add(n).ReadRflEvt(fin, i); 738 760 739 761 // Evaluate result from reading event … … 754 776 SetReadyToSave(); 755 777 756 // *fLog << all << "Number of photon bunches: " << fData.GetEntriesFast() << endl;778 // *fLog << all << "Number of photon bunches: " << fData.GetEntriesFast() << endl; 757 779 return kTRUE; 758 780 } 759 781 */ 760 782 // -------------------------------------------------------------------------- 761 783 // -
trunk/Mars/msim/MPhotonEvent.h
r9616 r9937 37 37 Double_t GetTimeMedianDev() const; 38 38 39 Double_t GetMeanX() const; 40 Double_t GetMeanY() const; 41 39 42 TClonesArray &GetArray() { return fData; } 40 43 const TClonesArray &GetArray() const { return fData; } … … 53 56 54 57 // I/O 55 Int_t ReadCorsikaEvt(MCorsikaFormat * fInFormat);56 Int_t ReadCorsikaEvt(istream &fin );57 Int_t ReadRflEvt(istream &fin);58 Int_t ReadCorsikaEvt(MCorsikaFormat *fInFormat, Int_t i); 59 Int_t ReadCorsikaEvt(istream &fin, Int_t i); 60 //Int_t ReadRflEvt(istream &fin, Int_t i); 58 61 59 62 // TObject -
trunk/Mars/msim/MSimMMCS.cc
r9595 r9937 131 131 132 132 // FIXME: Is there a way to write them as LAST entry in the file? 133 fMcRunHeader->SetNumSimulatedShowers(fRunHeader->GetNumEvents() );133 fMcRunHeader->SetNumSimulatedShowers(fRunHeader->GetNumEvents()*fRunHeader->GetNumReuse()); 134 134 fMcRunHeader->SetCorsikaVersion(TMath::Nint(fRunHeader->GetProgramVersion()*100)); 135 135 … … 211 211 212 212 fMcEvt->SetEvtNumber(fEvtHeader->GetEvtNumber()); 213 fMcEvt->SetEventReuse(fEvtHeader->GetNumReuse()); 213 214 fMcEvt->SetPhotElfromShower(0); 214 215
Note:
See TracChangeset
for help on using the changeset viewer.