Changeset 17148 for trunk/Mars/msimcamera
- Timestamp:
- 09/09/13 12:39:18 (11 years ago)
- Location:
- trunk/Mars
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Mars
-
Property svn:mergeinfo
set to
/branches/Mars_MC merged eligible
-
Property svn:mergeinfo
set to
-
trunk/Mars/msimcamera/MSimCamera.cc
r10167 r17148 43 43 #include <TF1.h> 44 44 #include <TRandom.h> 45 #include <TRandom3.h> 45 46 46 47 #include "MLog.h" … … 63 64 #include "MMcEvt.hxx" // To be replaced by a CheObs class 64 65 #include "MRawRunHeader.h" 66 67 #include "math.h" 65 68 66 69 ClassImp(MSimCamera); … … 75 78 : fEvt(0), fStat(0), fRunHeader(0), fElectronicNoise(0), fGain(0), 76 79 fCamera(0), fMcEvt(0), fSpline(0), fBaselineGain(kFALSE), 77 fDefaultOffset(-1), fDefaultNoise(-1), fDefaultGain(-1) 80 fDefaultOffset(-1), fDefaultNoise(-1), fDefaultGain(-1), fACFudgeFactor(0), 81 fACTimeConstant(0) 78 82 79 83 { … … 135 139 return kFALSE; 136 140 141 fAccidentalPhotons = (MPedestalCam*)pList->FindObject("AccidentalPhotonRates","MPedestalCam"); 142 if(!fAccidentalPhotons) 143 { 144 *fLog << err << "AccidentalPhotonRates [MPedestalCam] not found... aborting." << endl; 145 return kFALSE; 146 } 147 137 148 MParSpline *pulse = (MParSpline*)pList->FindObject("PulseShape", "MParSpline"); 138 149 if (!pulse) … … 142 153 } 143 154 144 if (fRunHeader->GetFreqSampling()!=1000)145 {146 *fLog << err << "ERROR - Sampling frequencies others than 1GHz are not yet supported." << endl;147 *fLog << warn << "FIXME - SCALE MPulsShape WITH THE SAMPLING FREQUENCY." << endl;148 return kFALSE;149 }155 // if (fRunHeader->GetFreqSampling()!=1000) 156 // { 157 // *fLog << err << "ERROR - Sampling frequencies others than 1GHz are not yet supported." << endl; 158 // *fLog << warn << "FIXME - SCALE MPulsShape WITH THE SAMPLING FREQUENCY." << endl; 159 // return kFALSE; 160 // } 150 161 151 162 fSpline = pulse->GetSpline(); … … 238 249 const Double_t rms = pix.GetPedestalRms(); 239 250 251 // FTemme: Implementation of AC-coupling: 252 // to calculate the value of the accoupling per slice I use the 253 // following equation: 254 // accouplingPerSlice = accidentalPhotonRate * (1 + crossTalkProb) 255 // * areaOfOnePulse / samplingRate; 256 // Therefore I need the following variables 257 Double_t accidentalPhotonRate = 0; // [MHz] 258 Float_t crossTalkProb = 0; // [1] 259 Double_t areaOfOnePulse = 0; // [ADC-Counts * s] 260 Double_t samplingRate = 0; // [slices * MHz] 261 262 // The accidental photon rate is stored in GHz, so we have to multiply 263 // with 1E3 to get MHz: 264 MPedestalPix &accPhoPix = (*fAccidentalPhotons)[i]; 265 accidentalPhotonRate = accPhoPix.GetPedestal() * 1E3; 266 Double_t currentAccidentalPhotonRate = accidentalPhotonRate; 267 268 if(fACTimeConstant!=0) 269 { 270 Double_t accidentalPhotons = fACTimeConstant * accidentalPhotonRate; 271 Double_t sigmaAccidentalPhotons = sqrt(accidentalPhotons); 272 273 TRandom3 *random = new TRandom3(0); 274 Double_t gaus = random->Gaus(accidentalPhotons,sigmaAccidentalPhotons); 275 currentAccidentalPhotonRate = gaus / fACTimeConstant; 276 } 277 278 // I don't know how to get the variable fCrosstalkProb from 279 // the class APD (see MAvalanchePhotoDiode.h), because there is no 280 // getter for the APD array(fAPDs) in MSimAPD. 281 // So I set the crossTalkProb hardcoded to the value 0.15, which is 282 // equal to the value of the apd of type 4 283 crossTalkProb = 0.15; 284 285 // To get the area of one Pulse, I only need to calculate the Integral 286 // of the Pulse Shape, which is stored in fSpline. Because the spline is 287 // normalized to a maximal amplitude of 1.0, I had to multiply it with 288 // the Default gain: 289 areaOfOnePulse = fSpline->Integral() * fDefaultGain; 290 291 // The sampling rate I get from the RunHeader: 292 samplingRate = fRunHeader->GetFreqSampling(); 293 294 Double_t accouplingPerSlice = currentAccidentalPhotonRate 295 * (1 + crossTalkProb + fACFudgeFactor) 296 * areaOfOnePulse / samplingRate; 297 298 // The accoupling is substracted from the timeline by decreasing the 299 // mean of the gaussian noise which is added 300 240 301 if (!fBaselineGain) 241 302 { 242 (*fCamera)[i].AddGaussianNoise(rms, val );303 (*fCamera)[i].AddGaussianNoise(rms, val - accouplingPerSlice); 243 304 continue; 244 305 } … … 250 311 // FIXME: How stable is the offset? 251 312 // FIXME: Should we write a container AppliedGain for MSImTrigger? 252 (*fCamera)[i].AddGaussianNoise(rms*gain, val*gain); 313 314 (*fCamera)[i].AddGaussianNoise(rms*gain, (val - accouplingPerSlice)*gain); 253 315 } 254 316 … … 323 385 fDefaultGain = GetEnvValue(env, prefix, "DefaultGain", fDefaultGain); 324 386 } 387 if (IsEnvDefined(env, prefix, "fACFudgeFactor", print)) 388 { 389 rc = kTRUE; 390 fACFudgeFactor = GetEnvValue(env, prefix, "fACFudgeFactor", fACFudgeFactor); 391 } 392 if (IsEnvDefined(env, prefix, "fACTimeConstant", print)) 393 { 394 rc = kTRUE; 395 fACTimeConstant = GetEnvValue(env, prefix, "fACTimeConstant", fACTimeConstant); 396 } 325 397 326 398 return rc; -
trunk/Mars/msimcamera/MSimCamera.h
r9625 r17148 24 24 MPedestalCam *fElectronicNoise; //! Electronic noise (baseline and rms) 25 25 MPedestalCam *fGain; //! Electronic noise (baseline and rms) 26 MPedestalCam *fAccidentalPhotons;//! Accidental photon rates 26 27 27 28 MAnalogChannels *fCamera; //! Output of the analog signals 28 29 MMcEvt *fMcEvt; //! For information stored in MMcEvt 29 30 30 const MSpline3 *fSpline; // Pulse Shape 31 const MSpline3 *fSpline; // Pulse Shape 31 32 32 33 Bool_t fBaselineGain; // Should the gain be applied to baseline and electronic noise? … … 35 36 Double_t fDefaultNoise; // Default noise (RMS) added to all samples 36 37 Double_t fDefaultGain; // Default gain (multiplication factor to the given/used pulse shape) 38 39 Double_t fACFudgeFactor; 40 41 Double_t fACTimeConstant; 37 42 38 43 // MParContainer -
trunk/Mars/msimcamera/MSimReadout.cc
r9422 r17148 145 145 fData->InitRead(fRunHeader); 146 146 fData->ResetPixels(); 147 fData->InitStartCells(); 147 148 fData->SetIndices(); 148 149 … … 202 203 203 204 // Check if the whole requested signal can be digitized 204 if (trig+nslices> =nsamp)205 if (trig+nslices>nsamp) 205 206 { 206 207 *fLog << err << "ERROR - Trigger position beyond valid analog signal range." << endl;
Note:
See TracChangeset
for help on using the changeset viewer.