Changeset 9239
- Timestamp:
- 01/22/09 19:07:37 (16 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 9 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r9238 r9239 36 36 * msimreflector/MSimReflector.cc: 37 37 - force sorting of the array 38 39 * msimcamera/MSimPSF.[h,cc], msimcamera/MSimGeomCam.[h,cc], 40 msimcamera/MSimExcessNoise.[h,cc], msimcamera/MSimSignalCam.[h,cc]: 41 - added 38 42 39 43 -
trunk/MagicSoft/Mars/NEWS
r9229 r9239 11 11 So it is recommended although not necessary to reset your sequences 12 12 in the database before further processing. 13 14 ;NEW 15 16 * A first implementation of a Monte Carlo simulation program 17 (ceres - Camera Electronics and REflector Simulation) has been 18 implemented. It can simulate a full telescope already including 19 a complete reflector simulation and a flexible trigger and readout 20 simulation. Currently, no perfect setup is implemented and 21 especially the output of the program (data structure) should 22 be considered alpha state. Also the user interface is not yet 23 ready. 13 24 14 25 ;general -
trunk/MagicSoft/Mars/mraw/MRawRunHeader.h
r9219 r9239 159 159 Bool_t IsValid() const { return fMagicNumber==0xc0c0 || fMagicNumber==0xc0c1; } 160 160 Bool_t IsMonteCarloRun() const { return fRunType>0x00ff; } 161 Bool_t IsDataRun() const { return (fRunType&0xff)==kRTData; } 162 Bool_t IsPedestalRun() const { return (fRunType&0xff)==kRTPedestal; } 163 Bool_t IsCalibrationRun() const { return (fRunType&0xff)==kRTCalibration; } 161 164 162 165 void Print(Option_t *t=NULL) const; -
trunk/MagicSoft/Mars/msim/MPhotonData.cc
r9232 r9239 216 216 gLog << "Weight: " << fWeight << endl; 217 217 } 218 219 /*220 #include <TH2.h>221 #include <TH3.h>222 223 // --------------------------------------------------------------------------224 //225 // Fill radial photon distance scaled by scale into 1D histogram.226 //227 void MPhotonData::FillRad(TH1 &hist, Float_t scale) const228 {229 hist.Fill(TMath::Hypot(fPosX, fPosY)*scale);230 }231 232 // --------------------------------------------------------------------------233 //234 // Fill radial photon distance scaled by scale versus x into 2D histogram.235 //236 void MPhotonData::FillRad(TH2 &hist, Double_t x, Float_t scale) const237 {238 hist.Fill(x, TMath::Hypot(fPosX, fPosY)*scale);239 }240 241 // --------------------------------------------------------------------------242 //243 // Fill photon position (x,y) scaled by scale into 2D histogram.244 // (Note north in the camera plane is -y, and east -x)245 //246 void MPhotonData::Fill(TH2 &hist, Float_t scale) const247 {248 hist.Fill(fPosY*scale, fPosX*scale);249 }250 251 // --------------------------------------------------------------------------252 //253 // Fill photon position (x,y) scaled by scale versus z into 3D histogram.254 // (Note north in the camera plane is -y, and east -x)255 //256 void MPhotonData::Fill(TH3 &hist, Double_t z, Float_t scale) const257 {258 hist.Fill(fPosY*scale, fPosX*scale);259 }260 261 */ -
trunk/MagicSoft/Mars/msim/MPhotonEvent.cc
r9232 r9239 57 57 // Here is an example (how to remove every second entry) 58 58 // 59 // --------------------------------------------------------------------- 60 // 59 61 // Int_t cnt = 0; 60 62 // … … 91 93 // MPhotonEvent->Shrink(cnt); 92 94 // 95 // --------------------------------------------------------------------- 96 // 97 // The flag for a sorted array is for speed reasons not in all conditions 98 // maintained automatically. Especially Add() doesn't reset it. 99 // 100 // So be sure that if you want to sort your array it is really sorted. 101 // 93 102 // 94 103 // Version 1: … … 127 136 } 128 137 138 /* 129 139 const char *MPhotonEvent::GetClassName() const 130 140 { 131 141 return static_cast<TObject*>(fData.GetClass())->GetName(); 132 142 } 143 */ 133 144 134 145 // -------------------------------------------------------------------------- … … 184 195 } 185 196 197 // -------------------------------------------------------------------------- 198 // 199 // Return a pointer to the first photon if available. 200 // 201 MPhotonData *MPhotonEvent::GetFirst() const 202 { 203 return static_cast<MPhotonData*>(fData.First()); 204 } 205 206 // -------------------------------------------------------------------------- 207 // 208 // Return a pointer to the last photon if available. 209 // 210 MPhotonData *MPhotonEvent::GetLast() const 211 { 212 return static_cast<MPhotonData*>(fData.Last()); 213 } 214 215 // -------------------------------------------------------------------------- 216 // 217 // Read the Event section from the file 218 // 186 219 Int_t MPhotonEvent::ReadCorsikaEvt(istream &fin) 187 220 { … … 234 267 235 268 Shrink(n); 269 fData.UnSort(); 236 270 237 271 SetReadyToSave(); … … 241 275 } 242 276 277 // -------------------------------------------------------------------------- 278 // 243 279 Int_t MPhotonEvent::ReadRflEvt(std::istream &fin) 244 280 { … … 291 327 } 292 328 329 // -------------------------------------------------------------------------- 330 // 331 // Print the array 332 // 293 333 void MPhotonEvent::Print(Option_t *) const 294 334 { 295 335 fData.Print(); 296 336 } 297 298 /*299 // --------------------------------------------------------------------------300 //301 // Fills all photon distances scaled with scale (default=1) into a TH1302 //303 void MPhotonEvent::FillRad(TH1 &hist, Float_t scale) const304 {305 MPhotonData *ph=NULL;306 307 TIter Next(&fData);308 while ((ph=(MPhotonData*)Next()))309 ph->FillRad(hist, scale);310 }311 312 // --------------------------------------------------------------------------313 //314 // Fills all photon distances scaled with scale (default=1) versus x315 // into a TH2316 //317 void MPhotonEvent::FillRad(TH2 &hist, Double_t x, Float_t scale) const318 {319 MPhotonData *ph=NULL;320 321 TIter Next(&fData);322 while ((ph=(MPhotonData*)Next()))323 ph->FillRad(hist, x, scale);324 }325 326 // --------------------------------------------------------------------------327 //328 // Fills all photons (x,y) scaled with scale (default=1) into a TH2.329 //330 void MPhotonEvent::Fill(TH2 &hist, Float_t scale) const331 {332 MPhotonData *ph=NULL;333 334 TIter Next(&fData);335 while ((ph=(MPhotonData*)Next()))336 ph->Fill(hist, scale);337 }338 339 // --------------------------------------------------------------------------340 //341 // Fills all photons (x,y) scaled with scale (default=1) versus z into a TH3342 //343 void MPhotonEvent::Fill(TH3 &hist, Double_t z, Float_t scale) const344 {345 MPhotonData *ph=NULL;346 347 TIter Next(&fData);348 while ((ph=(MPhotonData*)Next()))349 ph->Fill(hist, z, scale);350 }351 352 void MPhotonEvent::DrawPixelContent(Int_t num) const353 {354 }355 356 #include "MHexagon.h"357 #include "MGeomCam.h"358 #include <TMarker.h>359 360 // ------------------------------------------------------------------------361 //362 // Fill a reflector event. Sums all pixels in each pixel as the363 // pixel contents.364 //365 // WARNING: Due to the estimation in DistanceToPrimitive and the366 // calculation in pixels instead of x, y this is only a367 // rough estimate.368 //369 Bool_t MPhotonEvent::GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type) const370 {371 //372 // sum the photons content in each pixel373 //374 val = 0;375 376 MHexagon hex(cam[idx]);377 378 MPhotonData *ph=NULL;379 380 TIter Next(&fData);381 382 switch (type)383 {384 385 case 1: // time386 while ((ph=(MPhotonData*)Next()))387 if (hex.DistanceToPrimitive(ph->GetPosY(), ph->GetPosX())<=0)388 val += ph->GetTime();389 return val/fData.GetEntriesFast()>0;390 391 default: // signal392 while ((ph=(MPhotonData*)Next()))393 if (hex.DistanceToPrimitive(ph->GetPosY()*10, ph->GetPosX()*10)<=0)394 val += cam.GetPixRatio(idx);395 return val>0;396 }397 398 return kFALSE;399 400 }401 */402 337 403 338 // ------------------------------------------------------------------------ -
trunk/MagicSoft/Mars/msim/MPhotonEvent.h
r9232 r9239 5 5 #include "MParContainer.h" 6 6 #endif 7 /* 8 #ifndef MARS_MCamEvent 9 #include "MCamEvent.h" 10 #endif 11 */ 7 12 8 #ifndef ROOT_TClonesArray 13 9 #include <TClonesArray.h> 14 10 #endif 15 11 16 // gcc 3.217 //class ifstream;18 12 #include <iosfwd> 19 20 /*21 class TH1;22 class TH2;23 class TH3;24 */25 13 26 14 class MPhotonData; … … 71 59 Changed(); 72 60 } 61 62 void SetSorted() { fSorted = kTRUE; } 73 63 }; 74 64 75 class MPhotonEvent : public MParContainer //, public MCamEvent65 class MPhotonEvent : public MParContainer 76 66 { 77 67 private: … … 81 71 MPhotonEvent(const char *name=NULL, const char *title=NULL); 82 72 83 //void Clear(Option_t * = NULL); 84 void Print(Option_t * = NULL) const; 73 // TObjArray, FIXME: This could be improved if checking for IsSortable is omitted 74 void Sort(Bool_t force=kFALSE) { if (force) fData.UnSort(); fData.Sort(); } 75 Bool_t IsSorted() const { return fData.IsSorted(); } 85 76 86 const char *GetClassName() const; 77 78 // Getter/Setter 79 Int_t GetNumPhotons() const { return fData.GetEntriesFast(); } 87 80 88 81 TClonesArray &GetArray() { return fData; } 89 82 const TClonesArray &GetArray() const { return fData; } 90 void Remove(TObject *o) { fData.Remove(o); }91 83 92 84 MPhotonData &Add(Int_t n); 93 85 MPhotonData &Add(); 86 87 MPhotonData *GetFirst() const; 88 MPhotonData *GetLast() const; 94 89 95 90 MPhotonData &operator[](UInt_t idx); … … 106 101 // for (int i=fData.GetSize()-1; i>=n; i--) 107 102 // fData.RemoveAt(i); 108 static_cast<MyClonesArray&>(fData).FastRemove(n, fData.GetSize()-1); 103 const Bool_t sorted = fData.IsSorted(); 104 105 MyClonesArray &loc = static_cast<MyClonesArray&>(fData); 106 107 loc.FastRemove(n, fData.GetSize()-1); 108 109 // If it was sorted before it is also sorted now. 110 if (sorted) 111 loc.SetSorted(); 109 112 110 113 return fData.GetEntriesFast(); 111 114 } 112 /* 113 void Expand(Int_t n) 114 { 115 for (int i=fData.GetSize(); i<n; i++) 116 fData.New(i); 117 } 118 */ 115 116 // I/O 119 117 Int_t ReadCorsikaEvt(istream &fin); 120 118 Int_t ReadRflEvt(istream &fin); 121 119 122 Int_t GetNumPhotons() const { return fData.GetEntriesFast(); } 123 /* 124 void FillRad(TH1 &hist, Float_t scale=1) const; 125 void FillRad(TH2 &hist, Double_t x, Float_t scale=1) const; 126 void Fill(TH2 &hist, Float_t scale=1) const; 127 void Fill(TH3 &hist, Double_t z, Float_t scale=1) const; 128 */ 120 // TObject 129 121 void Paint(Option_t *o=""); 130 131 // Bool_t GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const; 132 // void DrawPixelContent(Int_t num) const; 133 134 void Sort() { fData.Sort(); } 122 void Print(Option_t * = NULL) const; 123 //void Clear(Option_t * = NULL); 135 124 136 125 ClassDef(MPhotonEvent, 1) //Container to store the raw Event Data -
trunk/MagicSoft/Mars/msimreflector/MSimReflector.cc
r9236 r9239 373 373 // This is to avoid time consuming calculation if there is no 374 374 // chance of a coincidence. 375 // FIXME: Inmprove search algorithm (2D Binary search?) 375 376 if (!mirror.CanHit(p)) 376 377 continue; … … 539 540 // Doesn't seem to be too time consuming. But we could also sort later! 540 541 // (after cones, inside the camera) 541 fEvt->Sort(); 542 543 // FIXME FIXME FIXME: Set maxindex, first and last time. 542 fEvt->Sort(kTRUE); 544 543 545 544 return kTRUE;
Note:
See TracChangeset
for help on using the changeset viewer.