Changeset 9308 for trunk/MagicSoft/Mars/msimcamera
- Timestamp:
- 02/09/09 11:30:54 (16 years ago)
- Location:
- trunk/MagicSoft/Mars/msimcamera
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/msimcamera/MSimGeomCam.cc
r9274 r9308 170 170 } 171 171 172 const Float_t freq = fHeader->GetFreqSampling()/1000.; 173 174 // We add an additional sample at the end to support a possible shift 175 // of the start time of the first event by 0 to 1 sample. 176 const Int_t ns = fHeader->GetNumSamplesHiGain()+1; 177 172 178 const Float_t first = cnt>0 ? fEvt->GetFirst()->GetTime() : 0; 173 const Float_t last = cnt>0 ? fEvt->GetLast()->GetTime() : -1;179 const Float_t last = cnt>0 ? fEvt->GetLast()->GetTime() : ns*freq; 174 180 175 181 // Length (ns), Pulse position (Units ns) 176 const Float_t ns = fHeader->GetFreqSampling()/1000.*fHeader->GetNumSamplesHiGain(); 177 const Float_t pp = fPulsePos->GetVal(); 178 const Float_t pw = fPulse->GetPulseWidth(); 179 180 fStat->SetTime(first-pp-pw, last+(ns-pp)+pw); 182 const Float_t pp = fPulsePos->GetVal(); 183 const Float_t pw = fPulse->GetPulseWidth(); 184 185 fStat->SetTime(first-pp-pw, last-pp+pw + ns*freq); 181 186 fStat->SetMaxIndex(fGeom->GetNumPixels()-1); 182 187 fStat->SetReadyToSave(); -
trunk/MagicSoft/Mars/msimcamera/MSimReadout.cc
r9274 r9308 73 73 // 74 74 MSimReadout::MSimReadout(const char* name, const char *title) 75 : fRunHeader(0), f Camera(0), fPulsePos(0), fTrigger(0), fData(0)75 : fRunHeader(0), fEvtHeader(0), fCamera(0), fPulsePos(0), fTrigger(0), fData(0) 76 76 { 77 77 fName = name ? name : "MSimReadout"; … … 113 113 return kFALSE; 114 114 } 115 116 fEvtHeader = (MRawEvtHeader*)pList->FindCreateObj("MRawEvtHeader"); 117 if (!fEvtHeader) 118 return kFALSE; 115 119 116 120 fData = (MRawEvtData*)pList->FindCreateObj("MRawEvtData"); … … 244 248 fData->SetReadyToSave(); 245 249 250 // Set the trigger/daq event number 251 fEvtHeader->SetDAQEvtNumber(GetNumExecutions()); 252 fEvtHeader->SetReadyToSave(); 253 246 254 // FIMXE: This will never be stored correctly :( 247 255 fRunHeader->SetNumEvents(fRunHeader->GetNumEvents()+1); -
trunk/MagicSoft/Mars/msimcamera/MSimReadout.h
r9270 r9308 10 10 class MRawEvtData; 11 11 class MRawRunHeader; 12 class MRawEvtHeader; 12 13 class MAnalogChannels; 13 14 … … 16 17 private: 17 18 MRawRunHeader *fRunHeader; //! Digitization window and frequency 19 MRawEvtHeader *fEvtHeader; //! Event header which is filled with the event number 18 20 MAnalogChannels *fCamera; //! Analog channes to be read out 19 21 MParameterD *fPulsePos; //! Intended pulse position -
trunk/MagicSoft/Mars/msimcamera/MSimTrigger.cc
r9278 r9308 36 36 // is calculated using a threshold and optional a fixed digital signal length. 37 37 // 38 // The signal length of the digital signal emitted by the discriminator 39 // can either be bound to the time the signal is above the threshold 40 // defined by fDiscriminatorThreshold if fDigitalSignalLength<0 or set to a 41 // fixed length (fDigitalSignalLength>0). 42 // 38 43 // With a second look-up table fCoincidenceMap the analog channels are 39 // checked for coincidences. The earliest coincide is then stored as 44 // checked for coincidences. The coincidense must at least be of the length 45 // defined by fCoincidenceTime. The earliest coincide is then stored as 40 46 // trigger position. 47 // 48 // 49 // For MAGIC1: 50 // - fDigitalSignalLength between 6ns and 12ns 51 // - fCoincidenceTime between 0.25ns to 1ns 41 52 // 42 53 // … … 69 80 #include "MDigitalSignal.h" 70 81 82 #include "MTriggerPattern.h" 83 71 84 ClassImp(MSimTrigger); 72 85 … … 79 92 MSimTrigger::MSimTrigger(const char *name, const char *title) 80 93 : fCamera(0), fPulsePos(0), fTrigger(0), fRunHeader(0), fEvtHeader(0), 81 fDiscriminatorThreshold(-1) 94 fDiscriminatorThreshold(-1), fDigitalSignalLength(8), fCoincidenceTime(0.5) 82 95 { 83 96 fName = name ? name : "MSimTrigger"; … … 189 202 fTrigger->SetVal(-1); 190 203 191 // FIXME: Set from somewhere else? (see also MSimCalibrationSignal)192 fEvtHeader->SetDAQEvtNumber(GetNumExecutions());193 fEvtHeader->SetReadyToSave();194 195 204 // ================== Simulate channel bundling ==================== 196 205 … … 204 213 for (UInt_t j=0; j<row.GetSize(); j++) 205 214 { 215 // FIXME: Simulate clipping 206 216 const UInt_t idx = row[j]; 207 217 patches[i].AddSignal((*fCamera)[idx]); … … 216 226 ttls.SetOwner(); 217 227 218 // MAGIC: Constant length of signals between 6ns and 12ns219 const Double_t siglen = 8; // Signal length (-1: As long as Signal-above-Threshold)220 221 228 for (UInt_t i=0; i<npatch; i++) 222 ttls.AddAt(patches[i].Discriminate(fDiscriminatorThreshold, siglen), i);229 ttls.AddAt(patches[i].Discriminate(fDiscriminatorThreshold, fDigitalSignalLength), i); 223 230 224 231 // FIXME: Write TTLs! … … 235 242 const Float_t max = fCamera->GetValidRangeMax()-(nsamp-pulspos); 236 243 237 // Define gate time (minimum coincidence time)238 const Double_t gate = 1; // MAGIC: minimum coincidence time 0.25ns to 1ns,239 240 244 // Create an array for the individual triggers 241 245 TObjArray triggers; … … 258 262 { 259 263 TObjArray *res = CalcCoincidence(*arr, *static_cast<TObjArray*>(ttls[idx[k]]), 260 gate);264 fCoincidenceTime); 261 265 262 266 // Delete the original array and keep the new one … … 303 307 { 304 308 if (rmlo>0 || rmhi>0) 305 *fLog << all<< rmlo << "/" << rmhi << " trigger out of valid range. No trigger raised." << endl;309 *fLog << inf2 << rmlo << "/" << rmhi << " trigger out of valid range. No trigger raised." << endl; 306 310 return kTRUE; 307 311 } … … 315 319 // FIXME: Jitter! (Own class?) 316 320 fTrigger->SetVal(static_cast<MDigitalSignal*>(triggers[0])->GetStart()); 321 fTrigger->SetReadyToSave(); 322 323 // Flag this event as triggered by the lvl1 trigger (FIXME?) 324 fEvtHeader->SetTriggerPattern((UInt_t)~(MTriggerPattern::kTriggerLvl1 | (MTriggerPattern::kTriggerLvl1<<8))); 325 fEvtHeader->SetReadyToSave(); 317 326 318 327 // inf2? 319 *fLog << all;328 *fLog << inf; 320 329 *fLog << cnt << " triggers left in " << triggers.GetEntriesFast() << " patches (" << rmlo << "/" << rmhi << " trigger out of valid range), T=" << fTrigger->GetVal(); 321 330 *fLog << endl; … … 329 338 // FileNameCoincidenceMap: coincidence.txt 330 339 // DiscriminatorTheshold: 3.5 340 // DigitalSignalLength: 8 341 // CoincidenceTime: 0.5 331 342 // 332 343 Int_t MSimTrigger::ReadEnv(const TEnv &env, TString prefix, Bool_t print) … … 351 362 } 352 363 364 if (IsEnvDefined(env, prefix, "DigitalSignalLength", print)) 365 { 366 rc = kTRUE; 367 fDigitalSignalLength = GetEnvValue(env, prefix, "DigitalSignalLength", fDigitalSignalLength); 368 } 369 370 if (IsEnvDefined(env, prefix, "CoincidenceTime", print)) 371 { 372 rc = kTRUE; 373 fCoincidenceTime = GetEnvValue(env, prefix, "CoincidenceTime", fCoincidenceTime); 374 } 375 353 376 return rc; 354 377 } -
trunk/MagicSoft/Mars/msimcamera/MSimTrigger.h
r9261 r9308 32 32 33 33 Float_t fDiscriminatorThreshold; // Discriminator threshold 34 Float_t fDigitalSignalLength; // Length of the output of the discriminator 35 Float_t fCoincidenceTime; // Minimum coincidence time (gate) 34 36 35 37 // MSimTrigger … … 50 52 51 53 void SetDiscriminatorThreshold(Float_t th) { fDiscriminatorThreshold=th; } 54 void SetDigitalSignalLength(Float_t ln) { fDigitalSignalLength=ln; } 55 void SetCoincidenceTime(Float_t tm) { fCoincidenceTime=tm; } 52 56 53 57 ClassDef(MSimTrigger, 0) // Task to simulate trigger electronics -
trunk/MagicSoft/Mars/msimcamera/Makefile
r9256 r9308 20 20 # 21 21 INCLUDES = -I. -I../mbase -I../mgeom -I../msim -I../msignal -I../mcorsika \ 22 -I../mmc -I../mgui -I../mcalib -I../mraw -I../mfileio -I../melectronics 22 -I../mmc -I../mgui -I../mcalib -I../mraw -I../mfileio -I../melectronics \ 23 -I../mtrigger 23 24 24 25 SRCFILES = MSimPSF.cc \
Note:
See TracChangeset
for help on using the changeset viewer.