- Timestamp:
- 02/13/09 17:46:02 (16 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r9330 r9332 18 18 19 19 -*-*- END OF LINE -*-*- 20 2009/02/13 Thomas Bretz 21 22 * mcorsika/MCorsikaEvtHeader.h: 23 - added some comments on the coordinate system 24 25 * ceres.rc: 26 - added some comments 27 - setup a psf for the dwarf mirror 28 29 * mcorsika/MCorsikaRunHeader.h: 30 - added some comments 31 32 * mjobs/MJSimulation.cc: 33 - added some histogram titles 34 - fixed the x, y coordinates of the impact histogram 35 - write "ElectronicNoise" 36 37 * mjobs/MJStar.cc: 38 - don't force writing of containers which are not filles by ceres 39 - updated rule to support files without date 40 41 * mpedestal/MPedestalPix.[h,cc]: 42 - added Print() function 43 44 * mraw/MRawFileRead.cc: 45 - added a comment 46 47 * msim/MPhotonData.h: 48 - added comments about coordinate system 49 50 * msimcamera/MSimGeomCam.cc: 51 - when looking for the pixels convert from ceres-coordinates 52 to GeomCam camera-coordinates 53 54 * msimreflector/MMirror.h: 55 - added Setter for SigmaPSF 56 57 * msimreflector/MMirrorDisk.cc, msimreflector/MMirrorHex.cc, 58 msimreflector/MMirrorSquare.cc: 59 - now start counting in ReadM with 0 60 61 * msimreflector/MReflector.[h,cc]: 62 - added some documentation 63 - added function to set psf of all mirrors 64 - added psf optional to input file 65 - remove already evaluated tokens from TObjArray 66 - added reading of a default psf from the input file 67 68 69 70 20 71 2009/02/12 Thomas Bretz 21 72 -
trunk/MagicSoft/Mars/ceres.rc
r9328 r9332 74 74 # ------------------------------------------------------------------------- 75 75 Reflector.Constructor: MReflector 76 77 # For the file definition see MReflector::ReadFile 78 76 79 #Reflector.FileName: mreflector/reflector-magic.def 80 # ~0.020° 81 #Reflector.SetSigmaPSF: 6.0 82 # ~0.025° 83 #Reflector.SetSigmaPSF: 7.5 84 77 85 Reflector.FileName: mreflector/reflector-dwarf.def 86 # ~0.02° 87 #Reflector.SetSigmaPSF: 1.8 88 # ~0.03° 89 Reflector.SetSigmaPSF: 2.6 90 78 91 79 92 # --- DWARF --- … … 86 99 #paraboloid_focal 488.87 87 100 101 # Hex cones maximum D=8mm 88 102 GeomCones.Constructor: MGeomCamDwarf(209.5, 7.5, 4.8887); 89 103 MGeomCam.Constructor: MGeomCamDwarf(209.5, 15, 4.8887); -
trunk/MagicSoft/Mars/mcorsika/MCorsikaRunHeader.h
r9313 r9332 33 33 Float_t fZdMin; // [rad] Zenith distance 34 34 Float_t fZdMax; // [rad] Zenith distance 35 Float_t fAzMin; // [rad] Azimuth (north=0; west=90)36 Float_t fAzMax; // [rad] Azimuth (north=0; west=90)35 Float_t fAzMin; // [rad] Azimuth (north=0; east=90) 36 Float_t fAzMax; // [rad] Azimuth (north=0; east=90) (north denotes the magnet north which is defined to be in the geografic north!) 37 37 38 38 Float_t fWavelengthMin; // [nm] Wavelength bandwidth lo edge -
trunk/MagicSoft/Mars/mjobs/MJSimulation.cc
r9328 r9332 184 184 hist.SetLog(kTRUE, kTRUE, kFALSE); 185 185 186 hist.AddHist(" MCorsikaEvtHeader.fX/100","MCorsikaEvtHeader.fY/100");186 hist.AddHist("-MCorsikaEvtHeader.fX/100","-MCorsikaEvtHeader.fY/100"); 187 187 hist.SetDrawOption("colz"); 188 188 hist.InitName("Impact;Impact;Impact"); … … 361 361 mhew.SetTitle("Time between first and last photon hitting a detector"); 362 362 363 MFillH fillh1(&mhn1, "", "Fill H1");363 MFillH fillh1(&mhn1, "", "FillCorsika"); 364 364 MFillH fillh2(&mhn2, "", "FillH2"); 365 365 MFillH fillh3(&mhn3, "", "FillH3"); 366 366 MFillH filltp(&mhtp, "", "FillTriggerPos"); 367 367 MFillH fillew(&mhew, "", "FillEvtWidth"); 368 fillh1.SetNameTab(" H1", "Distribution of Muons as simulated");369 fillh2.SetNameTab(" H2", "Distribution of Muons as available after all");370 fillh3.SetNameTab(" H3", "Distribution after trigger");371 filltp.SetNameTab("TrigPos", "TriggerPosition w.r.t the first photon");372 fillew.SetNameTab("EvtWidth", "Time between first and last photon hitting a detector");368 fillh1.SetNameTab("Corsika", "Distribution as simulated by Corsika"); 369 fillh2.SetNameTab("Detectable", "Distribution of events hit the detector"); 370 fillh3.SetNameTab("Triggered", "Distribution of triggered events"); 371 filltp.SetNameTab("TrigPos", "TriggerPosition w.r.t the first photon"); 372 fillew.SetNameTab("EvtWidth", "Time between first and last photon hitting a detector"); 373 373 374 374 MHPhotonEvent planeG(1); // Get from MaxImpact … … 457 457 write3a.AddContainer("MMcRunHeader", "RunHeaders"); 458 458 write3a.AddContainer("MMcCorsikaRunHeader", "RunHeaders", kFALSE); 459 write3a.AddContainer("ElectronicNoise", "RunHeaders", kFALSE); 459 460 write3a.AddContainer("MMcEvt", "Events", kFALSE); 460 461 … … 511 512 // ------------------------------------------------------------------- 512 513 514 // FIXME: Remove isolated pixels 513 515 MImgCleanStd clean(7, 4.5); 514 516 clean.SetMethod(MImgCleanStd::kAbsolute); … … 613 615 if (fCamera) 614 616 { 617 // FIXME: MHCollectionArea Trigger Area! 615 618 if (header.IsDataRun()) 616 619 tasks.AddToList(&fillh3); -
trunk/MagicSoft/Mars/mjobs/MJStar.cc
r9292 r9332 300 300 // Effective on-time need its own not to be skipped by (eg) image cleaning 301 301 // Muons needs its own to have a unique SetReadyToSave 302 const TString rule(Form("s/( [0-9]+(_M[12])?_[0-9.]+)_Y_(.*[.]root)$/%s\\/$1_I_$3/", Esc(fPathOut).Data()));302 const TString rule(Form("s/(([0-9]+_)?(M[12]_)?[0-9.]+)_Y_(.*[.]root)$/%s\\/$1_I_$4/", Esc(fPathOut).Data())); 303 303 MWriteRootFile write( 2, rule, fOverwrite?"RECREATE":"NEW", "Image parameters"); 304 304 MWriteRootFile writet(2, rule, fOverwrite?"RECREATE":"NEW", "Image parameters"); // EffectiveOnTime … … 333 333 // Monte Carlo Data 334 334 write.AddContainer("MMcEvt", "Events"); 335 write.AddContainer("MMcTrig", "Events" );335 write.AddContainer("MMcTrig", "Events", kFALSE); 336 336 // Monte Carlo Run Headers 337 337 write.AddContainer("MMcRunHeader", "RunHeaders"); 338 write.AddContainer("MMcTrigHeader", "RunHeaders" );339 write.AddContainer("MMcFadcHeader", "RunHeaders" );340 write.AddContainer("MMcConfigRunHeader", "RunHeaders" );338 write.AddContainer("MMcTrigHeader", "RunHeaders", kFALSE); 339 write.AddContainer("MMcFadcHeader", "RunHeaders", kFALSE); 340 write.AddContainer("MMcConfigRunHeader", "RunHeaders", kFALSE); 341 341 write.AddContainer("MMcCorsikaRunHeader", "RunHeaders"); 342 342 } … … 368 368 // Monte Carlo Data 369 369 writem.AddContainer("MMcEvt", "Muons"); 370 writem.AddContainer("MMcTrig", "Muons" );370 writem.AddContainer("MMcTrig", "Muons", kFALSE); 371 371 } 372 372 -
trunk/MagicSoft/Mars/mpedestal/MPedestalPix.cc
r8912 r9332 95 95 } 96 96 97 void MPedestalPix::Print(Option_t *) const 98 { 99 *fLog << all << "P=" << fPedestal; 100 if (fPedestalRms>=0) 101 *fLog << " RMS=" << fPedestalRms; 102 if (fPedestalABoffset>=0) 103 *fLog << " AB=" << fPedestalABoffset; 104 if (fNumEvents>0) 105 *fLog << " (N=" << fNumEvents << ")"; 106 *fLog << endl; 107 } 108 97 109 // ------------------------------------------------------------------------ 98 110 // -
trunk/MagicSoft/Mars/mpedestal/MPedestalPix.h
r8911 r9332 19 19 void Clear(Option_t *o=""); 20 20 void Copy(TObject &object) const; 21 void Print(Option_t *o="") const; 21 22 22 23 // Using histograms -
trunk/MagicSoft/Mars/mraw/MRawFileRead.cc
r9178 r9332 202 202 if (fDisplay) 203 203 { 204 // Show the new file name and the event number after which 205 // the new file has been opened 204 206 TString txt = GetFileName(); 205 207 txt += " @ "; -
trunk/MagicSoft/Mars/msim/MPhotonData.h
r9308 r9332 24 24 class MCorsikaRunHeader; 25 25 26 class MPhotonData : public TObject //MParContainer26 class MPhotonData : public TObject 27 27 { 28 28 private: 29 Float_t fPosX; // [cm] X (north) at observation level30 Float_t fPosY; // [cm] Y (west) at observation level29 Float_t fPosX; // [cm] "+west" "-east" (both at observation level) 30 Float_t fPosY; // [cm] "+south" "-north" (north denotes the magnet north which is defined to be in the geografic north!) 31 31 32 32 Float_t fCosU; // [cos x] U direction cosine to x-axis -
trunk/MagicSoft/Mars/msimcamera/MSimGeomCam.cc
r9308 r9332 148 148 { 149 149 // FIXME: Improve search algorithm (2D Binary search?) 150 if (!(*fGeom)[idx].IsInside(ph.GetPosX()*10, ph.GetPosY()*10)) 150 // Here we convert the photons from the ceres-coordinate 151 // system which is viewed from the camera to the mirror 152 // into the camera coordinates which are viewed from 153 // the mirror to the camera. 154 // (x on the right, y upwards, right-handed) 155 if (!(*fGeom)[idx].IsInside(-ph.GetPosX()*10, ph.GetPosY()*10)) 151 156 continue; 152 157 -
trunk/MagicSoft/Mars/msimreflector/MMirror.cc
r9312 r9332 126 126 psf /= 2; // The factor two because of the doubleing of the angle in the reflection 127 127 psf /= F; // Scale the Gauss to the size of the PSF 128 psf *= n.Z(); // Normalize the addon vector to the normal vector129 //psf *= n.Mag(); // Alternative! (Gaussian projected on the surface of a sphere)128 //psf *= n.Z(); // 129 psf *= n.Mag(); // This means that the PSF is measured in the focal distance 130 130 131 131 TVector3 dn(gx*psf, gy*psf, 0); // Instead of psf/F also atan(psf/F) might make sense … … 136 136 } 137 137 138 // -------------------------------------------------------------------------- 139 // 138 140 void MMirror::Print(Option_t *o) const 139 141 { … … 141 143 gLog << fNorm.X() << " " << fNorm.Y() << " " << fNorm.Z() << " "; 142 144 gLog << fFocalLength << " "; 145 if (fSigmaPSF>0) 146 gLog << fSigmaPSF << " "; 143 147 144 148 const TString n = ClassName(); -
trunk/MagicSoft/Mars/msimreflector/MMirror.h
r9312 r9332 36 36 TVector2 operator-(const MMirror &m) const;// { return TVector2(X()-m.X(), Y()-m.Y()); } 37 37 38 void SetSigmaPSF(Double_t psf) { fSigmaPSF = psf; } 39 void SetFocalLength(Double_t f) { fFocalLength = f; } 38 40 void SetPosition(const TVector3 &v) { fPos = v; } 39 41 void SetNorm(const TVector3 &n) { … … 54 56 const TVector3 &GetNorm() const { return fNorm; } 55 57 58 Double_t GetFocalLength() const { return fFocalLength; } 59 Double_t GetSigmaPSF() const { return fSigmaPSF; } 60 56 61 Double_t GetDist() const { return fPos.Perp(); } 57 62 … … 63 68 64 69 // ----- Basic function for parabolic mirror ----- 65 void SetFocalLength(Double_t f) { fFocalLength = f; }66 Double_t GetFocalLength() const { return fFocalLength; }67 68 70 Bool_t ExecuteReflection(MQuaternion &p, MQuaternion &u) const; 69 71 -
trunk/MagicSoft/Mars/msimreflector/MMirrorDisk.cc
r9322 r9332 144 144 Int_t MMirrorDisk::ReadM(const TObjArray &tok) 145 145 { 146 if (tok.Get Size()<9)146 if (tok.GetEntries()!=1) 147 147 return -1; 148 148 149 Double_t r = atof(tok[ 8]->GetName());149 Double_t r = atof(tok[0]->GetName()); 150 150 151 151 if (r<=0) -
trunk/MagicSoft/Mars/msimreflector/MMirrorHex.cc
r9324 r9332 163 163 Int_t MMirrorHex::ReadM(const TObjArray &tok) 164 164 { 165 if (tok.Get Size()<9)165 if (tok.GetEntries()!=1) 166 166 return -1; 167 167 168 const Double_t d = atof(tok[ 8]->GetName());168 const Double_t d = atof(tok[0]->GetName()); 169 169 170 170 if (d<=0) -
trunk/MagicSoft/Mars/msimreflector/MMirrorSquare.cc
r9322 r9332 160 160 Int_t MMirrorSquare::ReadM(const TObjArray &tok) 161 161 { 162 if (tok.Get Size()<9)162 if (tok.GetEntries()!=1) 163 163 return -1; 164 164 165 Double_t l = atof(tok[ 8]->GetName());165 Double_t l = atof(tok[0]->GetName()); 166 166 167 167 if (l<=0) -
trunk/MagicSoft/Mars/msimreflector/MReflector.cc
r9313 r9332 65 65 // -------------------------------------------------------------------------- 66 66 // 67 // Set the SigmaPSF of all mirrors currently stored. 68 // 69 void MReflector::SetSigmaPSF(Double_t psf) 70 { 71 fMirrors.ForEach(MMirror, SetSigmaPSF)(psf); 72 } 73 74 // -------------------------------------------------------------------------- 75 // 67 76 // Calculate the maximum radius of th ereflector. This is not meant as 68 77 // a precise number but as a rough estimate e.g. to bin a histogram. … … 118 127 // -------------------------------------------------------------------------- 119 128 // 129 // I/O helper for ReadFile to avoid calling "delete arr" before every return 130 // 131 MMirror *MReflector::EvalTokens(TObjArray &arr, Double_t defpsf) const 132 { 133 if (arr.GetEntries()<9) 134 { 135 *fLog << err << "ERROR - Not enough arguments..." << endl; 136 return 0; 137 } 138 139 const TVector3 pos(atof(arr[0]->GetName()), 140 atof(arr[1]->GetName()), 141 atof(arr[2]->GetName())); 142 143 const TVector3 norm(atof(arr[3]->GetName()), 144 atof(arr[4]->GetName()), 145 atof(arr[5]->GetName())); 146 147 const Double_t F = atof(arr[6]->GetName()); 148 149 const TString val = arr[7]->GetName(); 150 151 const Double_t psf = val.IsFloat() ? val.Atof() : -1; 152 153 const UInt_t n = val.IsFloat() ? 9 : 8; 154 155 TString type = arr[n-1]->GetName(); 156 type.Prepend("MMirror"); 157 158 for (UInt_t i=0; i<n; i++) 159 delete arr.RemoveAt(i); 160 arr.Compress(); 161 162 TString msg; 163 TClass *cls = MParContainer::GetClass(type); 164 if (!cls) 165 { 166 *fLog << err << "ERROR - Class " << type << " not in dictionary." << endl; 167 return 0; 168 } 169 170 if (!cls->InheritsFrom(MMirror::Class())) 171 { 172 *fLog << err << "ERROR - Cannot create new instance of class " << type << ": " << endl; 173 *fLog << "Class doesn't inherit from MMirror." << endl; 174 return 0; 175 } 176 177 MMirror *m = static_cast<MMirror*>(cls->New()); 178 if (!m) 179 { 180 *fLog << err << "ERROR - Cannot create new instance of class " << type << ": " << endl; 181 *fLog << " - Class has no default constructor." << endl; 182 *fLog << " - An abstract member functions of a base class is not overwritten." << endl; 183 return 0; 184 } 185 186 m->SetFocalLength(F); 187 m->SetPosition(pos); 188 m->SetNorm(norm); 189 m->SetSigmaPSF(psf>=0 ? psf : defpsf); 190 191 if (m->ReadM(arr)>=0) 192 return m; 193 194 *fLog << err << "ERROR - " << type << "::ReadM failed." << endl; 195 196 delete m; 197 return 0; 198 } 199 200 // -------------------------------------------------------------------------- 201 // 120 202 // Read a reflector setup from a file. This needs improvemtn. 121 // FIXME: Documentation missing! 122 // 123 Bool_t MReflector::ReadFile(TString fname) 203 // 204 // The file structur is like: 205 // 206 // x y z nx ny nz F [psf] Type ... 207 // 208 // x: x-coordinate of the mirror's center 209 // y: y-coordinate of the mirror's center 210 // z: z-coordinate of the mirror's center 211 // nx: x-component of the normal vecor in the mirror center 212 // ny: y-component of the normal vecor in the mirror center 213 // nz: z-component of the normal vecor in the mirror center 214 // F: Focal distance of a spherical mirror 215 // [psf]: This number is the psf given in the units of x,y,z and 216 // defined at the focal distance F. It can be used to overwrite 217 // the second argument given in ReadFile for individual mirrors. 218 // Type: A instance of a mirrot of the class Type MMirrorType is created 219 // (Type can be, for example, Hex for for MMirrorHex). 220 // ...: Additional arguments as defined in MMirrorType::ReadM 221 // 222 // 223 // Coordinate System: 224 // The coordinate system is local in the reflectors frame. 225 // It is defined viewing from the back side of the reflector 226 // towards the camera. (x "right", y "up", z from reflector to camera) 227 // Note, that it is left-handed! 228 // 229 Bool_t MReflector::ReadFile(TString fname, Double_t defpsf) 124 230 { 125 231 SetTitle(fname); … … 145 251 */ 146 252 253 Int_t cnt = 0; 254 147 255 while (1) 148 256 { … … 152 260 break; 153 261 262 // Count lines 263 cnt++; 264 265 // Skip comments 154 266 if (line.BeginsWith("#")) 155 {156 //cout << line << endl;157 267 continue; 158 } 159 268 269 // Remove leading and trailing whitespaces 160 270 line=line.Strip(TString::kBoth); 161 271 272 // Skip empty lines 162 273 if (line.IsNull()) 163 274 continue; 164 275 276 // Tokenize line 165 277 TObjArray *arr = line.Tokenize(' '); 166 278 167 if (arr->GetSize()<8) 279 // Evaluate tokens 280 MMirror *m = EvalTokens(*arr, defpsf); 281 282 // Delete now obsolete array 283 delete arr; 284 285 // Check if a new mirror could be created successfully 286 if (!m) 168 287 { 169 cout << "Skip3: " <<line << endl; 170 delete arr; 171 continue; 172 } 173 174 const TVector3 pos(atof((*arr)[0]->GetName()), 175 atof((*arr)[1]->GetName()), 176 atof((*arr)[2]->GetName())); 177 178 const TVector3 norm(atof((*arr)[3]->GetName()), 179 atof((*arr)[4]->GetName()), 180 atof((*arr)[5]->GetName())); 181 182 const Double_t F = atof((*arr)[6]->GetName()); 183 184 TString type = (*arr)[7]->GetName(); 185 type.Prepend("MMirror"); 186 187 TString msg; 188 TClass *cls = MParContainer::GetClass(type); 189 if (!cls) 190 { 191 *fLog << err << dbginf << "ERROR - Class " << type << " not in dictionary." << endl; 288 *fLog << err << "Error in line " << cnt << ": " << line << endl; 192 289 return kFALSE; 193 290 } 194 291 195 if (!cls->InheritsFrom(MMirror::Class())) 196 { 197 *fLog << err << dbginf << "Cannot create new instance of class " << type << ": " << endl; 198 *fLog << "Class doesn't inherit from MMirror." << endl; 199 return kFALSE; 200 } 201 202 MMirror *m = (MMirror*)cls->New(); 203 if (!m) 204 { 205 *fLog << err << dbginf << "Cannot create new instance of class " << type << ": " << endl; 206 *fLog << " - Class has no default constructor." << endl; 207 *fLog << " - An abstract member functions of a base class is not overwritten." << endl; 208 return kFALSE; 209 } 210 211 m->SetFocalLength(F); 212 m->SetPosition(pos); 213 m->SetNorm(norm); 214 215 Int_t n = m->ReadM(*arr); 216 if (n<=0) 217 { 218 *fLog << err << dbginf << "ERROR - ReadM failed." << endl; 219 return kFALSE; 220 } 221 292 // Add new mirror to array 222 293 fMirrors.Add(m); 223 224 //maxr = TMath::Max(maxr, TMath::Hypot(pos[i].X()+24.75, pos[i].Y()+24.75));225 //maxr = TMath::Max(maxr, TMath::Hypot(pos.X()+24.75, pos.Y()+24.75));226 227 delete arr;228 294 } 229 295 … … 285 351 // -------------------------------------------------------------------------- 286 352 // 353 // SigmaPSF: -1 287 354 // FileName: reflector.txt 288 355 // 356 // SigmaPSF can be used to set a default for the psf of the mirrors 357 // read from the file. Note, that this can be overwritten for individual 358 // mirrors in the file. 359 // 360 // For details on the file structure see MReflector::ReadFile 361 // 289 362 Int_t MReflector::ReadEnv(const TEnv &env, TString prefix, Bool_t print) 290 363 { 291 364 Bool_t rc = kFALSE; 365 366 Double_t psf = -1; 367 if (IsEnvDefined(env, prefix, "SetSigmaPSF", print)) 368 { 369 rc = kTRUE; 370 psf = GetEnvValue(env, prefix, "SetSigmaPSF", -1); 371 } 372 292 373 if (IsEnvDefined(env, prefix, "FileName", print)) 293 374 { 294 375 rc = kTRUE; 295 if (!ReadFile(GetEnvValue(env, prefix, "FileName", "") ))376 if (!ReadFile(GetEnvValue(env, prefix, "FileName", ""), psf)) 296 377 return kERROR; 297 378 } -
trunk/MagicSoft/Mars/msimreflector/MReflector.h
r9312 r9332 28 28 void InitMaxR(); 29 29 30 // Helper for I/O 31 MMirror *EvalTokens(TObjArray &arr, Double_t defpsf) const; 32 30 33 // MParContainer 31 34 Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print); … … 39 42 const MMirror *GetMirror(UInt_t idx) const { return idx>=GetNumMirrors()?0:*(GetFirstPtr()+idx); } 40 43 41 Bool_t ReadFile(TString fname );44 Bool_t ReadFile(TString fname, Double_t defpsf=-1); 42 45 43 46 Double_t GetMaxR() const { return fMaxR; } … … 46 49 47 50 Int_t ExecuteReflector(MQuaternion &p, MQuaternion &u) const; 51 52 void SetSigmaPSF(Double_t psf); 48 53 49 54 // TObject
Note:
See TracChangeset
for help on using the changeset viewer.