Changeset 9319 for trunk/MagicSoft
- Timestamp:
- 02/11/09 17:51:43 (16 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r9318 r9319 154 154 - added debug output 155 155 156 * msimcamera/MSimCamera.[h,cc]: 157 - outsourced the pedestal and gain numbers into ReInit 158 - use an MPedestalCam for Electronic Noise and Gain 159 - allow to switch ob whether the gain is applied to the 160 electronic noise or not 161 - SetPhotElfromShower 162 163 * msim/Makefile. msim/SimLinkDef.h: 164 - added MSimMMCS 165 166 * msim/MSimMMCS.[h,cc]: 167 - added 168 169 * msimcamera/Makefile: 170 - added -I../mpedestal 156 171 157 172 -
trunk/MagicSoft/Mars/mjobs/MJSimulation.cc
r9317 r9319 78 78 #include "MWriteRootFile.h" 79 79 80 #include "MSimMMCS.h" 80 81 #include "MSimAbsorption.h" 81 82 #include "MSimReflector.h" -
trunk/MagicSoft/Mars/msim/Makefile
r9243 r9319 20 20 # 21 21 INCLUDES = -I. -I../mbase -I../mmc -I../mgeom -I../mgui -I../mcorsika \ 22 -I../mpointing -I../msimreflector -I../mhbase 22 -I../mpointing -I../msimreflector -I../mhbase -I../mraw 23 23 24 24 SRCFILES = MPhotonData.cc \ 25 25 MPhotonEvent.cc \ 26 26 MHPhotonEvent.cc \ 27 MSimMMCS.cc \ 27 28 MSimAbsorption.cc \ 28 29 MSimPointingPos.cc -
trunk/MagicSoft/Mars/msim/SimLinkDef.h
r9232 r9319 15 15 #pragma link C++ class MSimAbsorption+; 16 16 17 #pragma link C++ class MSimMMCS+; 18 17 19 #endif -
trunk/MagicSoft/Mars/msimcamera/MSimCamera.cc
r9290 r9319 56 56 #include "MPhotonData.h" 57 57 58 #include "MPedestalCam.h" 59 #include "MPedestalPix.h" 60 58 61 #include "MAnalogSignal.h" 59 62 #include "MAnalogChannels.h" 60 63 64 #include "MMcEvt.hxx" // To be replaced by a CheObs class 61 65 #include "MRawRunHeader.h" 62 66 … … 70 74 // 71 75 MSimCamera::MSimCamera(const char* name, const char *title) 72 : fEvt(0), fStat(0), fRunHeader(0), fCamera(0), fSpline(0)//, fPulsePos(0) 76 : fEvt(0), fStat(0), fRunHeader(0), fElectronicNoise(0), fGain(0), 77 fCamera(0), fMcEvt(0), fSpline(0), fBaselineGain(kFALSE) 73 78 { 74 79 fName = name ? name : "MSimCamera"; … … 83 88 Int_t MSimCamera::PreProcess(MParList *pList) 84 89 { 90 fMcEvt = (MMcEvt*)pList->FindCreateObj("MMcEvt"); 91 if (!fMcEvt) 92 return kFALSE; 93 85 94 fCamera = (MAnalogChannels*)pList->FindCreateObj("MAnalogChannels"); 86 95 if (!fCamera) … … 115 124 } 116 125 */ 126 127 // Create it here to make sure that MGeomApply will set the correct size 128 fElectronicNoise = (MPedestalCam*)pList->FindCreateObj("MPedestalCam", "ElectronicNoise"); 129 if (!fElectronicNoise) 130 return kFALSE; 131 132 fGain = (MPedestalCam*)pList->FindCreateObj("MPedestalCam", "Gain"); 133 if (!fGain) 134 return kFALSE; 135 117 136 MPulseShape *pulse = (MPulseShape*)pList->FindObject("MPulseShape"); 118 137 if (!pulse) … … 122 141 } 123 142 124 *fLog << warn << "FIXME - SCALE WITH THE SAMPLING FREQUENCY." << endl; 143 if (fRunHeader->GetFreqSampling()!=1000) 144 { 145 *fLog << err << "ERROR - Sampling frequencies others than 1GHz are not yet supported." << endl; 146 *fLog << warn << "FIXME - SCALE MPulsShape WITH THE SAMPLING FREQUENCY." << endl; 147 return kFALSE; 148 } 125 149 126 150 fSpline = pulse->GetSpline(); … … 131 155 } 132 156 157 // ---------------- Information output ---------------------- 158 159 if (fBaselineGain) 160 *fLog << inf << "Gain is also applied to the electronic noise." << endl; 161 162 return kTRUE; 163 } 164 165 // -------------------------------------------------------------------------- 166 // 167 // FIXME: For now this is a workaround to set a baseline and the 168 // electronic (guassian noise) 169 // 170 Bool_t MSimCamera::ReInit(MParList *plist) 171 { 172 for (int i=0; i<fElectronicNoise->GetSize(); i++) 173 { 174 MPedestalPix &ped = (*fElectronicNoise)[i]; 175 ped.SetPedestal(15*256); // Baseline at 15 like in MAGIC 176 ped.SetPedestalRms(1.5*256);//2.0); // 1.5 bit noise for a gain of 64 177 ped.SetPedestalABoffset(0); 178 ped.SetNumEvents(0); 179 180 // 256 scale from 8bit to 16bit 181 // 8 signal height of one phe 182 MPedestalPix &gain = (*fGain)[i]; 183 gain.SetPedestal(8*256); 184 gain.SetPedestalRms(0); 185 gain.SetPedestalABoffset(0); 186 gain.SetNumEvents(0); 187 } 133 188 return kTRUE; 134 189 } … … 144 199 const Double_t freq = fRunHeader->GetFreqSampling()/1000.; 145 200 201 // FIXME: Should we use a higher sampling here? 202 146 203 const Double_t start = fStat->GetTimeFirst()*freq; 147 204 const Double_t end = fStat->GetTimeLast() *freq; 148 205 149 206 const UInt_t nlen = TMath::CeilNint(end-start); 150 151 // FIXME: Jitter the start point of digitization by one sample [0;1]152 // FIXME: TAKE PULSE WIDTH out of the calculation and start at TimeFirst153 207 154 208 // Get number of pixels/channels … … 165 219 for (UInt_t i=0; i<npix; i++) 166 220 { 221 const MPedestalPix &pix = (*fElectronicNoise)[i]; 222 223 const Double_t val = pix.GetPedestal(); 224 const Double_t rms = pix.GetPedestalRms(); 225 226 if (!fBaselineGain) 227 { 228 (*fCamera)[i].AddGaussianNoise(rms, val); 229 continue; 230 } 231 // Sorry, the name "pedestal" is misleading here 232 // FIXME: Simulate gain fluctuations 233 const Double_t gain = (*fGain)[i].GetPedestal(); 234 167 235 // FIXME: We might add the base line here already. 168 (*fCamera)[i].AddGaussianNoise(22.5/64); 236 // FIXME: How stable is the offset? 237 // FIXME: Should we write a container AppliedGain for MSImTrigger? 238 (*fCamera)[i].AddGaussianNoise(rms*gain, val*gain); 169 239 } 170 240 … … 181 251 // Or maybe per channel and run? 182 252 253 Double_t tot = 0; 254 183 255 // Simulate pulses 184 256 for (Int_t i=0; i<num; i++) … … 191 263 // FIXME: Time jitter? 192 264 // FIXME: Add additional routing here? 265 // FIMXE: How stable is the gain? 266 267 if (ph.GetPrimary()!=MMcEvt::kNightSky) 268 tot += ph.GetWeight(); 269 270 // Sorry, the name "pedestal" is misleading here 271 // FIXME: Simulate gain fluctuations 272 const Double_t gain = (*fGain)[idx].GetPedestal(); 193 273 194 274 // === FIXME === FIXME === FIXME === Frequency!!!! 195 (*fCamera)[idx].AddPulse(*fSpline, t, ph.GetWeight()); 196 } 275 (*fCamera)[idx].AddPulse(*fSpline, t, ph.GetWeight()*gain); 276 } 277 278 fMcEvt->SetPhotElfromShower(TMath::Nint(tot)); 197 279 198 280 return kTRUE; 199 281 } 200 201 /*202 MSimCameraFiles::Process()203 {204 // fCorsikaHeader->GetEvtNumber() --> fMcEvt->SetEvtNumber()205 // fCorsikaHeader->GetTotalEnergy() --> fMcEvt->SetEnergy()206 // fCorsikaHeader->GetParticleID() --> fMcEvt->SetParticleID()207 // fCorsikaHeader->GetImpact() --> fMcEvt->SetImpact()208 // fCorsikaHeader->GetTheta() --> fMcEvt->SetTheta()209 // fCorsikaHeader->GetPhi() --> fMcEvt->SetPhi()210 // fPointingPos->GetTheta() --> fMcEvt->SetTelescopeTheta()211 // fPointingPos->GetPhi() --> fMcEvt->SetTelescopePhi()212 // fStats->GetTimeFirst() --> fMcEvt->SetTimeFirst()213 // fStats->GetTimeLast() --> fMcEvt->SetTimeLast()214 // fMcEvt->SetReuse()215 // MMcCorsikaRunHeader: fSlopeSpec, fELowLim, fEUppLim;216 217 fMcEvt->Fill(*fCorsikaHeader, *fPointingPos, *fStats);218 219 return kTRUE;220 }221 */222 -
trunk/MagicSoft/Mars/msimcamera/MSimCamera.h
r9274 r9319 6 6 #endif 7 7 8 class MMcEvt; 8 9 class MParList; 9 10 class MPhotonEvent; … … 11 12 class MRawRunHeader; 12 13 class MAnalogChannels; 14 class MPedestalCam; 13 15 14 16 class MSpline3; … … 17 19 { 18 20 private: 19 MPhotonEvent *fEvt; //! Event stroing the photons 20 MPhotonStatistics *fStat; //! Valid time range of the phootn event 21 MRawRunHeader *fRunHeader; //! Sampling frequency 21 MPhotonEvent *fEvt; //! Event stroing the photons 22 MPhotonStatistics *fStat; //! Valid time range of the phootn event 23 MRawRunHeader *fRunHeader; //! Sampling frequency 24 MPedestalCam *fElectronicNoise; //! Electronic noise (baseline and rms) 25 MPedestalCam *fGain; //! Electronic noise (baseline and rms) 22 26 23 MAnalogChannels *fCamera; //! Output of the analog signals 27 MAnalogChannels *fCamera; //! Output of the analog signals 28 MMcEvt *fMcEvt; //! For information stored in MMcEvt 24 29 25 MSpline3 *fSpline; 30 MSpline3 *fSpline; // Pusle Shape 31 32 Bool_t fBaselineGain; // Should the gain be applied to baseline and electronic noise? 26 33 27 34 // MTask 28 Int_t PreProcess(MParList *pList); 29 Int_t Process(); 35 Int_t PreProcess(MParList *pList); 36 Bool_t ReInit(MParList *pList); 37 Int_t Process(); 30 38 31 39 public: -
trunk/MagicSoft/Mars/msimcamera/Makefile
r9308 r9319 21 21 INCLUDES = -I. -I../mbase -I../mgeom -I../msim -I../msignal -I../mcorsika \ 22 22 -I../mmc -I../mgui -I../mcalib -I../mraw -I../mfileio -I../melectronics \ 23 -I../mtrigger 23 -I../mtrigger -I../mpedestal 24 24 25 25 SRCFILES = MSimPSF.cc \
Note:
See TracChangeset
for help on using the changeset viewer.