Changeset 9306 for trunk/MagicSoft/Mars/msimcamera
- Timestamp:
- 02/09/09 11:19:57 (16 years ago)
- Location:
- trunk/MagicSoft/Mars/msimcamera
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/msimcamera/MSimCalibrationSignal.cc
r9272 r9306 61 61 62 62 #include "MGeomCam.h" 63 #include "MPulseShape.h" 64 #include "MTriggerPattern.h" 63 65 64 66 #include "MRawRunHeader.h" … … 77 79 // 78 80 MSimCalibrationSignal::MSimCalibrationSignal(const char* name, const char *title) 79 : fParList(0), fGeom(0), fPulsePos(0), fTrigger(0), fRunHeader(0), fEvtHeader(0), 80 fEvt(0), fStat(0), fNumEntries(1000) 81 : fParList(0), fGeom(0), fPulse(0), fPulsePos(0), fTrigger(0), 82 fRunHeader(0), fEvtHeader(0), fEvt(0), fStat(0), 83 fNumEvents(1000), fNumPhotons(5), fTimeJitter(1) 81 84 { 82 85 fName = name ? name : "MRead";//"MSimCalibrationSignal"; … … 130 133 } 131 134 135 fPulse = (MPulseShape*)pList->FindObject("MPulseShape"); 136 if (!fPulse) 137 { 138 *fLog << err << "MPulsShape not found... aborting." << endl; 139 return kFALSE; 140 } 141 142 *fLog << all << "Number of Events: " << fNumEvents << endl; 143 132 144 // 133 145 // Search for MTaskList … … 167 179 Int_t MSimCalibrationSignal::Process() 168 180 { 169 if (GetNumExecutions()>fNumE ntries)181 if (GetNumExecutions()>fNumEvents) 170 182 return kFALSE; 171 183 … … 178 190 for (UInt_t idx=0; idx<fGeom->GetNumPixels(); idx++) 179 191 { 180 // FIXME: Where to get this number from?181 for ( int i=0; i<5; i++)192 // FIXME: How does the distribution look like? Poissonian? 193 for (UInt_t i=0; i<fNumPhotons; i++) 182 194 { 183 195 MPhotonData &ph = fEvt->Add(cnt++); 184 196 185 const Float_t tm = gRandom->Gaus(0, 1); 197 // FIMXE: Is this the correct distribution 198 const Float_t tm = gRandom->Gaus(0, fTimeJitter); 186 199 187 200 ph.SetPrimary(MMcEvtBasic::kArtificial); … … 201 214 const Double_t freq = fRunHeader->GetFreqSampling()/1000.; 202 215 216 // We add an additional sample at the end to support a possible shift 217 // of the start time of the first event by 0 to 1 sample. 218 const Int_t ns = fRunHeader->GetNumSamplesHiGain()+1; 219 203 220 // Length (ns), Pulse position (Units ns) 204 const Float_t ns = fRunHeader->GetNumSamplesHiGain()*freq;205 221 const Float_t pp = fPulsePos->GetVal(); 222 const Float_t pw = fPulse->GetPulseWidth(); 206 223 207 224 const Float_t first = cnt>0 ? fEvt->GetFirst()->GetTime() : 0; 208 const Float_t last = cnt>0 ? fEvt->GetLast()->GetTime() : ns ;209 210 fStat->SetTime(first-pp , last+(ns-pp));225 const Float_t last = cnt>0 ? fEvt->GetLast()->GetTime() : ns*freq; 226 227 fStat->SetTime(first-pp-pw, last-pp+pw + ns*freq); 211 228 fStat->SetMaxIndex(fGeom->GetNumPixels()-1); 212 229 fStat->SetReadyToSave(); … … 214 231 // FIXME: Jitter! (Own class?) 215 232 fTrigger->SetVal(pp*freq); 216 217 // FIXME: Set from somewhere else? (see also MSimTrigger) 218 fEvtHeader->SetDAQEvtNumber(GetNumExecutions()); 233 fTrigger->SetReadyToSave(); 234 235 // Set trigger pattern according to the trigger type 236 const UInt_t p = fRunHeader->IsCalibrationRun() ? MTriggerPattern::kCalibration : MTriggerPattern::kPedestal; 237 fEvtHeader->SetTriggerPattern(~(p | (p<<8))); 219 238 fEvtHeader->SetReadyToSave(); 220 239 221 240 return kTRUE; 222 223 } 241 } 242 243 // -------------------------------------------------------------------------- 244 // 245 // Read the parameters from the resource file. 246 // 247 // NumEvents: 1000 248 // NumPhotons: 5 249 // TimeJitter: 1 250 // 251 Int_t MSimCalibrationSignal::ReadEnv(const TEnv &env, TString prefix, Bool_t print) 252 { 253 Bool_t rc = kFALSE; 254 if (IsEnvDefined(env, prefix, "NumEvents", print)) 255 { 256 rc = kTRUE; 257 fNumEvents = GetEnvValue(env, prefix, "NumEvents", (Int_t)fNumEvents); 258 } 259 260 if (IsEnvDefined(env, prefix, "NumPhotons", print)) 261 { 262 rc = kTRUE; 263 fNumPhotons = GetEnvValue(env, prefix, "NumPhotons", (Int_t)fNumPhotons); 264 } 265 266 if (IsEnvDefined(env, prefix, "TimeJitter", print)) 267 { 268 rc = kTRUE; 269 fTimeJitter = GetEnvValue(env, prefix, "TimeJitter", fTimeJitter); 270 } 271 272 return rc; 273 } -
trunk/MagicSoft/Mars/msimcamera/MSimCalibrationSignal.h
r9272 r9306 8 8 class MGeomCam; 9 9 class MParList; 10 class MPulseShape; 10 11 class MPhotonEvent; 11 12 class MPhotonStatistics; … … 19 20 MParList *fParList; //! Store pointer to MParList for initializing ReInit 20 21 MGeomCam *fGeom; //! Camera geometry to know the number of expected pixels 22 MPulseShape *fPulse; //! Pulse Shape to get pulse width from 21 23 MParameterD *fPulsePos; //! Expected position at which the pulse should be 22 24 MParameterD *fTrigger; //! Position in analog channels at which the triggersignal is raised 23 25 MRawRunHeader *fRunHeader; //! Digitization window and frequency 24 26 25 MRawEvtHeader *fEvtHeader; //! Event header which is filled 27 MRawEvtHeader *fEvtHeader; //! Event header which is filled by the trigger pattern 26 28 MPhotonEvent *fEvt; //! Photon event into which the new photons are stored 27 29 MPhotonStatistics *fStat; //! Photon statistic which is filled … … 29 31 TString fNameGeomCam; // Name of the camera geometry 30 32 31 UInt_t fNumEntries; // Number of events to produce 33 UInt_t fNumEvents; // Number of events to produce 34 UInt_t fNumPhotons; // Average number of photons to produce 35 Float_t fTimeJitter; // Time jitter (sigma) 36 37 // MParContainer 38 Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print=kFALSE); 32 39 33 40 // MTask … … 44 51 void SetNameGeomCam(const char *name="MGeomCam") { fNameGeomCam = name; } 45 52 46 UInt_t GetEntries() { return fNumE ntries; }53 UInt_t GetEntries() { return fNumEvents; } 47 54 TString GetFullFileName() const { return "cer000000"; } 48 55 //virtual Bool_t Rewind();
Note:
See TracChangeset
for help on using the changeset viewer.