Index: trunk/Mars/mjobs/MJSimulation.cc
===================================================================
--- trunk/Mars/mjobs/MJSimulation.cc	(revision 14858)
+++ trunk/Mars/mjobs/MJSimulation.cc	(revision 14864)
@@ -129,5 +129,5 @@
 MJSimulation::MJSimulation(const char *name, const char *title)
     : fForceMode(kFALSE), fCamera(kTRUE), fForceTrigger(kFALSE),
-    fOperationMode(kModeData), fRunNumber(-1)
+    fWriteFitsFile(kFALSE), fOperationMode(kModeData), fRunNumber(-1)
 {
     fName  = name  ? name  : "MJSimulation";
@@ -544,5 +544,4 @@
     MWriteRootFile write4a( 2, rule4, fOverwrite?"RECREATE":"NEW", "Star file");
     MWriteRootFile write4b( 2, rule4, fOverwrite?"RECREATE":"NEW", "Star file");
-    MWriteFitsFile write3a( 2, rule3, fOverwrite?"RECREATE":"NEW", "Camera file");
     MWriteRootFile write3b( 2, rule3, fOverwrite?"RECREATE":"NEW", "Camera file");
     MWriteRootFile write2a( 2, rule2, fOverwrite?"RECREATE":"NEW", "Signal file");
@@ -551,63 +550,68 @@
     MWriteRootFile write1b( 2, rule1, fOverwrite?"RECREATE":"NEW", "Reflector file");
 
-    write3a.VetoColumn("MParameterD.fVal");
-    write3a.VetoColumn("MCorsikaEvtHeader.fEvtNumber");
-    write3a.VetoColumn("MCorsikaEvtHeader.fNumReuse");
-    write3a.VetoColumn("MCorsikaEvtHeader.fTotalEnergy");
-    write3a.VetoColumn("MCorsikaEvtHeader.fStartAltitude");
-    write3a.VetoColumn("MCorsikaEvtHeader.fFirstTargetNum");
-    write3a.VetoColumn("MCorsikaEvtHeader.fFirstInteractionHeight");
-    write3a.VetoColumn("MCorsikaEvtHeader.fMomentumX");
-    write3a.VetoColumn("MCorsikaEvtHeader.fMomentumY");
-    write3a.VetoColumn("MCorsikaEvtHeader.fMomentumZ");
-    write3a.VetoColumn("MCorsikaEvtHeader.fAz");
-    write3a.VetoColumn("MCorsikaEvtHeader.fWeightedNumPhotons");
-    write3a.VetoColumn("MCorsikaEvtHeader.fZd");
-    write3a.VetoColumn("MCorsikaEvtHeader.fAd");
-    write3a.VetoColumn("MCorsikaEvtHeader.fX");
-    write3a.VetoColumn("MCorsikaEvtHeader.fY");
-    write3a.VetoColumn("MCorsikaEvtHeader.fWeightNumPhotons");
-    write3a.VetoColumn("MMcEvt.fEvtNumber");
-    write3a.VetoColumn("MMcEvt.fThick0");
-    write3a.VetoColumn("MMcEvt.fFirstTarget");
-    write3a.VetoColumn("MMcEvt.fZFirstInteraction");
-    write3a.VetoColumn("MMcEvt.fCoreD");
-    write3a.VetoColumn("MMcEvt.fCoreX");
-    write3a.VetoColumn("MMcEvt.fCoreY");
-    write3a.VetoColumn("MMcEvt.fTimeFirst");
-    write3a.VetoColumn("MMcEvt.fTimeLast");
-    write3a.VetoColumn("MMcEvt.fLongiNmax");
-    write3a.VetoColumn("MMcEvt.fLongit0");
-    write3a.VetoColumn("MMcEvt.fLongitmax");
-    write3a.VetoColumn("MMcEvt.fLongia");
-    write3a.VetoColumn("MMcEvt.fLongib");
-    write3a.VetoColumn("MMcEvt.fLongic");
-    write3a.VetoColumn("MMcEvt.fLongichi2");
-    write3a.VetoColumn("MMcEvt.fPhotIni");
-    write3a.VetoColumn("MMcEvt.fPassPhotAtm");
-    write3a.VetoColumn("MMcEvt.fPassPhotRef");
-    write3a.VetoColumn("MMcEvt.fPassPhotCone");
-    write3a.VetoColumn("MMcEvt.fPhotElfromShower");
-    write3a.VetoColumn("MMcEvt.fPhotElinCamera");
-    write3a.VetoColumn("MMcEvt.fElecCphFraction");
-    write3a.VetoColumn("MMcEvt.fMuonCphFraction");
-    write3a.VetoColumn("MMcEvt.fOtherCphFraction");
-    write3a.VetoColumn("MMcEvt.fFadcTimeJitter");
-    write3a.VetoColumn("MMcEvt.fEventReuse");
-    write3a.VetoColumn("MRawEvtData.fHiGainPixId");
-//    write3a.VetoColumn("MRawEvtData.fHiGainFadcSamples");
-    write3a.VetoColumn("MRawEvtData.fLoGainPixId");
-    write3a.VetoColumn("MRawEvtData.fLoGainFadcSamples");
-    write3a.VetoColumn("MRawEvtData.fABFlags");
-    write3a.VetoColumn("MRawEvtData.fStartCells");
-    write3a.VetoColumn("MRawEvtData.fNumBytesPerSample");
-    write3a.VetoColumn("MRawEvtData.fIsSigned");
-//    write3a.VetoColumn("MRawEvtHeader.fDAQEvtNumber"); //EventNum ?
-    write3a.VetoColumn("MRawEvtHeader.fNumTrigLvl1");
-    write3a.VetoColumn("MRawEvtHeader.fNumTrigLvl2");
-    write3a.VetoColumn("MRawEvtHeader.fTrigPattern");
-    write3a.VetoColumn("MRawEvtHeader.fNumLoGainOn");
-
-    write3a.SetBytesPerSample("Data", 2);
+    MWriteFitsFile write3af( 2, rule3, fOverwrite?"RECREATE":"NEW", "Camera file");
+    MWriteRootFile write3ar( 2, rule3, fOverwrite?"RECREATE":"NEW", "Camera file");
+
+    MTask &write3a = fWriteFitsFile ? static_cast<MTask&>(write3af) : static_cast<MTask&>(write3ar);
+
+    write3af.VetoColumn("MParameterD.fVal");
+    write3af.VetoColumn("MCorsikaEvtHeader.fEvtNumber");
+    write3af.VetoColumn("MCorsikaEvtHeader.fNumReuse");
+    write3af.VetoColumn("MCorsikaEvtHeader.fTotalEnergy");
+    write3af.VetoColumn("MCorsikaEvtHeader.fStartAltitude");
+    write3af.VetoColumn("MCorsikaEvtHeader.fFirstTargetNum");
+    write3af.VetoColumn("MCorsikaEvtHeader.fFirstInteractionHeight");
+    write3af.VetoColumn("MCorsikaEvtHeader.fMomentumX");
+    write3af.VetoColumn("MCorsikaEvtHeader.fMomentumY");
+    write3af.VetoColumn("MCorsikaEvtHeader.fMomentumZ");
+    write3af.VetoColumn("MCorsikaEvtHeader.fAz");
+    write3af.VetoColumn("MCorsikaEvtHeader.fWeightedNumPhotons");
+    write3af.VetoColumn("MCorsikaEvtHeader.fZd");
+    write3af.VetoColumn("MCorsikaEvtHeader.fAd");
+    write3af.VetoColumn("MCorsikaEvtHeader.fX");
+    write3af.VetoColumn("MCorsikaEvtHeader.fY");
+    write3af.VetoColumn("MCorsikaEvtHeader.fWeightNumPhotons");
+    write3af.VetoColumn("MMcEvt.fEvtNumber");
+    write3af.VetoColumn("MMcEvt.fThick0");
+    write3af.VetoColumn("MMcEvt.fFirstTarget");
+    write3af.VetoColumn("MMcEvt.fZFirstInteraction");
+    write3af.VetoColumn("MMcEvt.fCoreD");
+    write3af.VetoColumn("MMcEvt.fCoreX");
+    write3af.VetoColumn("MMcEvt.fCoreY");
+    write3af.VetoColumn("MMcEvt.fTimeFirst");
+    write3af.VetoColumn("MMcEvt.fTimeLast");
+    write3af.VetoColumn("MMcEvt.fLongiNmax");
+    write3af.VetoColumn("MMcEvt.fLongit0");
+    write3af.VetoColumn("MMcEvt.fLongitmax");
+    write3af.VetoColumn("MMcEvt.fLongia");
+    write3af.VetoColumn("MMcEvt.fLongib");
+    write3af.VetoColumn("MMcEvt.fLongic");
+    write3af.VetoColumn("MMcEvt.fLongichi2");
+    write3af.VetoColumn("MMcEvt.fPhotIni");
+    write3af.VetoColumn("MMcEvt.fPassPhotAtm");
+    write3af.VetoColumn("MMcEvt.fPassPhotRef");
+    write3af.VetoColumn("MMcEvt.fPassPhotCone");
+    write3af.VetoColumn("MMcEvt.fPhotElfromShower");
+    write3af.VetoColumn("MMcEvt.fPhotElinCamera");
+    write3af.VetoColumn("MMcEvt.fElecCphFraction");
+    write3af.VetoColumn("MMcEvt.fMuonCphFraction");
+    write3af.VetoColumn("MMcEvt.fOtherCphFraction");
+    write3af.VetoColumn("MMcEvt.fFadcTimeJitter");
+    write3af.VetoColumn("MMcEvt.fEventReuse");
+
+    write3af.VetoColumn("MRawEvtData.fHiGainPixId");
+    write3af.VetoColumn("MRawEvtData.fLoGainPixId");
+    write3af.VetoColumn("MRawEvtData.fLoGainFadcSamples");
+    write3af.VetoColumn("MRawEvtData.fABFlags");
+    write3af.VetoColumn("MRawEvtData.fStartCells");
+    write3af.VetoColumn("MRawEvtData.fNumBytesPerSample");
+    write3af.VetoColumn("MRawEvtData.fIsSigned");
+    write3af.VetoColumn("MRawEvtHeader.fDAQEvtNumber"); //EventNum ?
+    write3af.VetoColumn("MRawEvtHeader.fNumTrigLvl1");
+    write3af.VetoColumn("MRawEvtHeader.fNumTrigLvl2");
+    write3af.VetoColumn("MRawEvtHeader.fTrigPattern");
+    write3af.VetoColumn("MRawEvtHeader.fNumLoGainOn");
+
+    write3af.SetBytesPerSample("Data", 2);
 
     write1a.SetName("WriteRefData");
@@ -622,5 +626,6 @@
     SetupCommonFileStructure(write1a);
     SetupCommonFileStructure(write2a);
-    SetupCommonFileStructure(write3a);
+    SetupCommonFileStructure(write3ar);
+    SetupCommonFileStructure(write3af);
     SetupCommonFileStructure(write4a);
 
@@ -633,7 +638,11 @@
 
     // D: Dedicated file structure
-    write3a.AddContainer("ElectronicNoise",  "RunHeaders");
-    write3a.AddContainer("IntendedPulsePos", "RunHeaders");
-    write3a.AddContainer("MRawEvtData",      "Events");
+    write3af.AddContainer("ElectronicNoise",  "RunHeaders");
+    write3af.AddContainer("IntendedPulsePos", "RunHeaders");
+    write3af.AddContainer("MRawEvtData",      "Events");
+
+    write3ar.AddContainer("ElectronicNoise",  "RunHeaders");
+    write3ar.AddContainer("IntendedPulsePos", "RunHeaders");
+    write3ar.AddContainer("MRawEvtData",      "Events");
     // It doesn't make much sene to write this information
     // to the file because the units are internal units not
Index: trunk/Mars/mjobs/MJSimulation.h
===================================================================
--- trunk/Mars/mjobs/MJSimulation.h	(revision 14858)
+++ trunk/Mars/mjobs/MJSimulation.h	(revision 14864)
@@ -23,4 +23,5 @@
     Bool_t fCamera;         // Switch on/off camera (for fast reflector processing)
     Bool_t fForceTrigger;   // Force the use of the trigger "electronics"
+    Bool_t fWriteFitsFile;
 
     Int_t  fOperationMode;  // Operation mode (data, ped, cal, pointrun)
@@ -38,6 +39,6 @@
 
     void SetForceMode(Bool_t force=kTRUE) { fForceMode = force; }
-
     void SetMode(Int_t mode) { fOperationMode = mode; }
+    void SetWriteFitsFile(Bool_t fits) { fWriteFitsFile = fits; }
 
     void SetRunNumber(Int_t n=-1) { fRunNumber = n%100000000; }
