Commit 352ab4d324b1244578165849869255b78730c0c3

Authored by Michael Mayer
1 parent b6c5a749

Added support of 'edispcube' parameter to all ctools

cscripts/cslightcrv.py
@@ -104,7 +104,9 @@ class cslightcrv(ctools.cscript): @@ -104,7 +104,9 @@ class cslightcrv(ctools.cscript):
104 pars.append(gammalib.GApplicationPar("srcname","s","a","Crab","","","Source name")) 104 pars.append(gammalib.GApplicationPar("srcname","s","a","Crab","","","Source name"))
105 pars.append(gammalib.GApplicationPar("expcube","f","a","NONE","","","Input exposure cube file (only needed for stacked analysis)")) 105 pars.append(gammalib.GApplicationPar("expcube","f","a","NONE","","","Input exposure cube file (only needed for stacked analysis)"))
106 pars.append(gammalib.GApplicationPar("psfcube","f","a","NONE","","","Input PSF cube file (only needed for stacked analysis)")) 106 pars.append(gammalib.GApplicationPar("psfcube","f","a","NONE","","","Input PSF cube file (only needed for stacked analysis)"))
  107 + pars.append(gammalib.GApplicationPar("edispcube","f","a","NONE","","","Input energy dispersion cube file (only needed for stacked analysis)"))
107 pars.append(gammalib.GApplicationPar("bkgcube","s","a","NONE","","","Input background cube file (only needed for stacked analysis)")) 108 pars.append(gammalib.GApplicationPar("bkgcube","s","a","NONE","","","Input background cube file (only needed for stacked analysis)"))
  109 + pars.append(gammalib.GApplicationPar("edisp","b","h","no","","","Apply energy dispersion?"))
108 pars.append(gammalib.GApplicationPar("caldb","s","a","prod2","","","Calibration database")) 110 pars.append(gammalib.GApplicationPar("caldb","s","a","prod2","","","Calibration database"))
109 pars.append(gammalib.GApplicationPar("irf","s","a","South_0.5h","","","Instrument response function")) 111 pars.append(gammalib.GApplicationPar("irf","s","a","South_0.5h","","","Instrument response function"))
110 pars.append(gammalib.GApplicationPar("outfile","f","a","lightcurve.fits","","","Output light curve file")) 112 pars.append(gammalib.GApplicationPar("outfile","f","a","lightcurve.fits","","","Output light curve file"))
@@ -190,6 +192,9 @@ class cslightcrv(ctools.cscript): @@ -190,6 +192,9 @@ class cslightcrv(ctools.cscript):
190 # Get source name 192 # Get source name
191 self.m_srcname = self["srcname"].string() 193 self.m_srcname = self["srcname"].string()
192 194
  195 + # Get energy dispersion flag
  196 + self.m_edisp = self["edisp"].boolean()
  197 +
193 # Get time boundaries 198 # Get time boundaries
194 self.create_tbounds() 199 self.create_tbounds()
195 200
@@ -472,12 +477,35 @@ class cslightcrv(ctools.cscript): @@ -472,12 +477,35 @@ class cslightcrv(ctools.cscript):
472 477
473 # Set new binned observation 478 # Set new binned observation
474 obs = bin.obs() 479 obs = bin.obs()
475 - 480 +
  481 + # Get new models
  482 + models = bkgcube.models()
  483 +
476 # Set precomputed binned response 484 # Set precomputed binned response
477 obs[0].response(expcube.expcube(), psfcube.psfcube(), bkgcube.bkgcube()) 485 obs[0].response(expcube.expcube(), psfcube.psfcube(), bkgcube.bkgcube())
478 486
479 - # Get new models  
480 - models = bkgcube.models() 487 +# # Check if we need to include energy dispersion
  488 +# if self.m_edisp:
  489 +#
  490 +# # Create edisp cube
  491 +# edispcube = ctools.ctedispcube(select.obs())
  492 +# edispcube["incube"] = "NONE"
  493 +# edispcube["usepnt"] = False
  494 +# edispcube["ebinalg"] = "LOG"
  495 +# edispcube["xref"] = self.m_xref
  496 +# edispcube["yref"] = self.m_yref
  497 +# edispcube["binsz"] = self.m_binsz
  498 +# edispcube["nxpix"] = self.m_nxpix
  499 +# edispcube["nypix"] = self.m_nypix
  500 +# edispcube["enumbins"] = self.m_ebins
  501 +# edispcube["emin"] = self.m_emin
  502 +# edispcube["emax"] = self.m_emax
  503 +# edispcube["coordsys"] = self.m_coordsys
  504 +# edispcube["proj"] = self.m_proj
  505 +# edispcube.run()
  506 +#
  507 +# # Set precomputed binned response including energy dispersion
  508 +# obs[0].response(expcube.expcube(), psfcube.psfcube(), edispcube.edispcube(), bkgcube.bkgcube())
481 509
482 # Fix background models if required 510 # Fix background models if required
483 if self.m_fix_bkg: 511 if self.m_fix_bkg:
@@ -495,6 +523,7 @@ class cslightcrv(ctools.cscript): @@ -495,6 +523,7 @@ class cslightcrv(ctools.cscript):
495 523
496 # Likelihood 524 # Likelihood
497 like = ctools.ctlike(obs) 525 like = ctools.ctlike(obs)
  526 + like["edisp"] = self.m_edisp
498 like.run() 527 like.run()
499 528
500 # Skip bin if no event was present 529 # Skip bin if no event was present
cscripts/cspull.py
@@ -52,6 +52,7 @@ class cspull(ctools.cscript): @@ -52,6 +52,7 @@ class cspull(ctools.cscript):
52 self.m_exposure = None 52 self.m_exposure = None
53 self.m_psfcube = None 53 self.m_psfcube = None
54 self.m_bckcube = None 54 self.m_bckcube = None
  55 + self.m_edispcube = None
55 self.m_stackmodels = None 56 self.m_stackmodels = None
56 self.m_coordsys = "CEL" 57 self.m_coordsys = "CEL"
57 self.m_proj = "TAN" 58 self.m_proj = "TAN"
@@ -246,6 +247,30 @@ class cspull(ctools.cscript): @@ -246,6 +247,30 @@ class cspull(ctools.cscript):
246 psfcube["proj"] = self.m_proj 247 psfcube["proj"] = self.m_proj
247 psfcube.run() 248 psfcube.run()
248 249
  250 + if self.m_edisp:
  251 +
  252 + # Get stacked Edisp
  253 + edispcube = ctools.ctpsfcube(self.obs)
  254 + edispcube["incube"] = "NONE"
  255 + edispcube["usepnt"] = True
  256 + edispcube["ebinalg"] = "LOG"
  257 + edispcube["binsz"] = self.m_binsz*10.0
  258 + edispcube["nxpix"] = self.m_npix/10
  259 + edispcube["nypix"] = self.m_npix/10
  260 + edispcube["enumbins"] = self.m_enumbins
  261 + edispcube["emin"] = self["emin"].real()
  262 + edispcube["emax"] = self["emax"].real()
  263 + edispcube["coordsys"] = self.m_coordsys
  264 + edispcube["proj"] = self.m_proj
  265 + edispcube.run()
  266 +
  267 + # Store result
  268 + self.m_edispcube = edispcube.edispcube().copy()
  269 +
  270 + # Logging
  271 + if self.logTerse():
  272 + self.log("Computed Edisp cube\n")
  273 +
249 # Notify Psf computation 274 # Notify Psf computation
250 if self.logTerse(): 275 if self.logTerse():
251 self.log("Computed Psf cube\n") 276 self.log("Computed Psf cube\n")
@@ -391,7 +416,10 @@ class cspull(ctools.cscript): @@ -391,7 +416,10 @@ class cspull(ctools.cscript):
391 416
392 # If stacked, add stacked responses and model 417 # If stacked, add stacked responses and model
393 if self.obs.size() > 1 and self.m_enumbins > 0: 418 if self.obs.size() > 1 and self.m_enumbins > 0:
394 - obs[0].response(self.m_exposure, self.m_psfcube, self.m_bckcube) 419 + if self.m_edisp:
  420 + obs[0].response(self.m_exposure, self.m_psfcube, self.m_edispcube, self.m_bckcube)
  421 + else:
  422 + obs[0].response(self.m_exposure, self.m_psfcube, self.m_bckcube)
395 obs.models(self.m_stackmodels) 423 obs.models(self.m_stackmodels)
396 424
397 # Determine number of events in simulation 425 # Determine number of events in simulation
cscripts/csresmap.py
@@ -108,6 +108,7 @@ class csresmap(ctools.cscript): @@ -108,6 +108,7 @@ class csresmap(ctools.cscript):
108 pars.append(gammalib.GApplicationPar("modcube","f","a","NONE","","","Input model cube file (generated with ctmodel)")) 108 pars.append(gammalib.GApplicationPar("modcube","f","a","NONE","","","Input model cube file (generated with ctmodel)"))
109 pars.append(gammalib.GApplicationPar("expcube","f","a","NONE","","","Input exposure cube file (only needed for stacked analysis)")) 109 pars.append(gammalib.GApplicationPar("expcube","f","a","NONE","","","Input exposure cube file (only needed for stacked analysis)"))
110 pars.append(gammalib.GApplicationPar("psfcube","f","a","NONE","","","Input PSF cube file (only needed for stacked analysis)")) 110 pars.append(gammalib.GApplicationPar("psfcube","f","a","NONE","","","Input PSF cube file (only needed for stacked analysis)"))
  111 + pars.append(gammalib.GApplicationPar("edispcube","f","a","NONE","","","Input energy dispersion cube file (only needed for stacked analysis)"))
111 pars.append(gammalib.GApplicationPar("bkgcube","f","a","NONE","","","Input background cube file (only needed for stacked analysis)")) 112 pars.append(gammalib.GApplicationPar("bkgcube","f","a","NONE","","","Input background cube file (only needed for stacked analysis)"))
112 pars.append(gammalib.GApplicationPar("inmodel","f","a","$CTOOLS/share/models/crab.xml","","","Input model XML file")) 113 pars.append(gammalib.GApplicationPar("inmodel","f","a","$CTOOLS/share/models/crab.xml","","","Input model XML file"))
113 pars.append(gammalib.GApplicationPar("caldb","s","a","prod2","","","Calibration database")) 114 pars.append(gammalib.GApplicationPar("caldb","s","a","prod2","","","Calibration database"))
cscripts/csspec.py
@@ -105,6 +105,7 @@ class csspec(ctools.cscript): @@ -105,6 +105,7 @@ class csspec(ctools.cscript):
105 pars.append(gammalib.GApplicationPar("srcname","s","a","Crab","","","Source name")) 105 pars.append(gammalib.GApplicationPar("srcname","s","a","Crab","","","Source name"))
106 pars.append(gammalib.GApplicationPar("expcube","f","a","NONE","","","Input exposure cube file (only needed for stacked analysis)")) 106 pars.append(gammalib.GApplicationPar("expcube","f","a","NONE","","","Input exposure cube file (only needed for stacked analysis)"))
107 pars.append(gammalib.GApplicationPar("psfcube","f","a","NONE","","","Input PSF cube file (only needed for stacked analysis)")) 107 pars.append(gammalib.GApplicationPar("psfcube","f","a","NONE","","","Input PSF cube file (only needed for stacked analysis)"))
  108 + pars.append(gammalib.GApplicationPar("edispcube","f","a","NONE","","","Input energy dispersion cube file (only needed for stacked analysis)"))
108 pars.append(gammalib.GApplicationPar("bkgcube","f","a","NONE","","","Input background cube file (only needed for stacked analysis)")) 109 pars.append(gammalib.GApplicationPar("bkgcube","f","a","NONE","","","Input background cube file (only needed for stacked analysis)"))
109 pars.append(gammalib.GApplicationPar("caldb","s","a","prod2","","","Calibration database")) 110 pars.append(gammalib.GApplicationPar("caldb","s","a","prod2","","","Calibration database"))
110 pars.append(gammalib.GApplicationPar("irf","s","a","South_0.5h","","","Instrument response function")) 111 pars.append(gammalib.GApplicationPar("irf","s","a","South_0.5h","","","Instrument response function"))
cscripts/cstsdist.py
@@ -99,6 +99,7 @@ class cstsdist(ctools.cscript): @@ -99,6 +99,7 @@ class cstsdist(ctools.cscript):
99 pars.append(gammalib.GApplicationPar("srcname","s","a","Crab","","","Source name")) 99 pars.append(gammalib.GApplicationPar("srcname","s","a","Crab","","","Source name"))
100 pars.append(gammalib.GApplicationPar("expcube","s","a","NONE","","","Input exposure cube file (only needed for stacked analysis)")) 100 pars.append(gammalib.GApplicationPar("expcube","s","a","NONE","","","Input exposure cube file (only needed for stacked analysis)"))
101 pars.append(gammalib.GApplicationPar("psfcube","s","a","NONE","","","Input PSF cube file (only needed for stacked analysis)")) 101 pars.append(gammalib.GApplicationPar("psfcube","s","a","NONE","","","Input PSF cube file (only needed for stacked analysis)"))
  102 + pars.append(gammalib.GApplicationPar("edispcube","f","a","NONE","","","Input energy dispersion cube file (only needed for stacked analysis)"))
102 pars.append(gammalib.GApplicationPar("bkgcube","s","a","NONE","","","Input background cube file (only needed for stacked analysis)")) 103 pars.append(gammalib.GApplicationPar("bkgcube","s","a","NONE","","","Input background cube file (only needed for stacked analysis)"))
103 pars.append(gammalib.GApplicationPar("caldb","s","a","prod2","","","Calibration database")) 104 pars.append(gammalib.GApplicationPar("caldb","s","a","prod2","","","Calibration database"))
104 pars.append(gammalib.GApplicationPar("irf","s","a","South_0.5h","","","Instrument response function")) 105 pars.append(gammalib.GApplicationPar("irf","s","a","South_0.5h","","","Instrument response function"))
src/ctbutterfly/ctbutterfly.par
@@ -22,6 +22,7 @@ inmodel, f, a, "$CTOOLS/share/models/crab.xml",,, "Input model XML file" @@ -22,6 +22,7 @@ inmodel, f, a, "$CTOOLS/share/models/crab.xml",,, "Input model XML file"
22 srcname, s, a, "Crab",,,"Source of interest" 22 srcname, s, a, "Crab",,,"Source of interest"
23 expcube, f, a, "NONE",,, "Input exposure cube file (only needed for stacked analysis)" 23 expcube, f, a, "NONE",,, "Input exposure cube file (only needed for stacked analysis)"
24 psfcube, f, a, "NONE",,, "Input PSF cube file (only needed for stacked analysis)" 24 psfcube, f, a, "NONE",,, "Input PSF cube file (only needed for stacked analysis)"
  25 +edispcube, f, a, "NONE",,, "Input energy dispersion cube file (only needed for stacked analysis)"
25 bkgcube, f, a, "NONE",,, "Input background cube file (only needed for stacked analysis)" 26 bkgcube, f, a, "NONE",,, "Input background cube file (only needed for stacked analysis)"
26 caldb, s, a, "prod2",,, "Calibration database" 27 caldb, s, a, "prod2",,, "Calibration database"
27 irf, s, a, "South_0.5h",,, "Instrument response function" 28 irf, s, a, "South_0.5h",,, "Instrument response function"
src/ctedispcube/ctedispcube.cpp
@@ -216,18 +216,6 @@ void ctedispcube::run(void) @@ -216,18 +216,6 @@ void ctedispcube::run(void)
216 log << std::endl; 216 log << std::endl;
217 } 217 }
218 218
219 - // Set energy dispersion flag for all CTA observations and save old  
220 - // values in save_edisp vector  
221 -// std::vector<bool> save_edisp;  
222 -// save_edisp.assign(m_obs.size(), false);  
223 -// for (int i = 0; i < m_obs.size(); ++i) {  
224 -// GCTAObservation* obs = dynamic_cast<GCTAObservation*>(m_obs[i]);  
225 -// if (obs != NULL) {  
226 -// save_edisp[i] = obs->response()->apply_edisp();  
227 -// obs->response()->apply_edisp(m_apply_edisp);  
228 -// }  
229 -// }  
230 -  
231 // Write observation(s) into logger 219 // Write observation(s) into logger
232 if (logTerse()) { 220 if (logTerse()) {
233 log << std::endl; 221 log << std::endl;
@@ -246,31 +234,23 @@ void ctedispcube::run(void) @@ -246,31 +234,23 @@ void ctedispcube::run(void)
246 log.header1("Generate EDISP cube"); 234 log.header1("Generate EDISP cube");
247 } 235 }
248 236
249 - // Fill EDISP 237 + // Fill Edisp
250 m_edispcube.fill(m_obs, &log); 238 m_edispcube.fill(m_obs, &log);
251 239
252 - // Restore energy dispersion flag for all CTA observations  
253 -// for (int i = 0; i < m_obs.size(); ++i) {  
254 -// GCTAObservation* obs = dynamic_cast<GCTAObservation*>(m_obs[i]);  
255 -// if (obs != NULL) {  
256 -// obs->response()->apply_edisp(save_edisp[i]);  
257 -// }  
258 -// }  
259 -  
260 // Return 240 // Return
261 return; 241 return;
262 } 242 }
263 243
264 244
265 /***********************************************************************//** 245 /***********************************************************************//**
266 - * @brief Save EDISP cube 246 + * @brief Save Edisp cube
267 ***************************************************************************/ 247 ***************************************************************************/
268 void ctedispcube::save(void) 248 void ctedispcube::save(void)
269 { 249 {
270 // Write header 250 // Write header
271 if (logTerse()) { 251 if (logTerse()) {
272 log << std::endl; 252 log << std::endl;
273 - log.header1("Save EDISP cube"); 253 + log.header1("Save Edisp cube");
274 } 254 }
275 255
276 // Get output filename 256 // Get output filename
@@ -281,7 +261,7 @@ void ctedispcube::save(void) @@ -281,7 +261,7 @@ void ctedispcube::save(void)
281 261
282 // Log filename 262 // Log filename
283 if (logTerse()) { 263 if (logTerse()) {
284 - log << "Save EDISP cube into file \""+m_outcube+"\"."; 264 + log << "Save Edisp cube into file \""+m_outcube+"\".";
285 log << std::endl; 265 log << std::endl;
286 } 266 }
287 267
@@ -308,7 +288,6 @@ void ctedispcube::init_members(void) @@ -308,7 +288,6 @@ void ctedispcube::init_members(void)
308 { 288 {
309 // Initialise members 289 // Initialise members
310 m_outcube.clear(); 290 m_outcube.clear();
311 -// m_apply_edisp = false;  
312 291
313 // Initialise protected members 292 // Initialise protected members
314 m_obs.clear(); 293 m_obs.clear();
@@ -328,7 +307,6 @@ void ctedispcube::copy_members(const ctedispcube&amp; app) @@ -328,7 +307,6 @@ void ctedispcube::copy_members(const ctedispcube&amp; app)
328 { 307 {
329 // Copy attributes 308 // Copy attributes
330 m_outcube = app.m_outcube; 309 m_outcube = app.m_outcube;
331 -// m_apply_edisp = app.m_apply_edisp;  
332 310
333 // Copy protected members 311 // Copy protected members
334 m_obs = app.m_obs; 312 m_obs = app.m_obs;
@@ -396,14 +374,11 @@ void ctedispcube::get_parameters(void) @@ -396,14 +374,11 @@ void ctedispcube::get_parameters(void)
396 // Load event cube from filename 374 // Load event cube from filename
397 GCTAEventCube cube(incube); 375 GCTAEventCube cube(incube);
398 376
399 - // Define edisp cube 377 + // Define Edisp cube
400 m_edispcube = GCTACubeEdisp(cube, mmax, migrabins); 378 m_edispcube = GCTACubeEdisp(cube, mmax, migrabins);
401 379
402 } // endelse: cube loaded from file 380 } // endelse: cube loaded from file
403 381
404 - // Read energy dispersion flag  
405 -// m_apply_edisp = (*this)["edisp"].boolean();  
406 -  
407 // Read output filename (if needed) 382 // Read output filename (if needed)
408 if (read_ahead()) { 383 if (read_ahead()) {
409 m_outcube = (*this)["outcube"].filename(); 384 m_outcube = (*this)["outcube"].filename();
src/ctedispcube/ctedispcube.hpp
@@ -69,12 +69,11 @@ protected: @@ -69,12 +69,11 @@ protected:
69 void get_parameters(void); 69 void get_parameters(void);
70 70
71 // User parameters 71 // User parameters
72 - GFilename m_outcube; //!< Output EDISP cube file name  
73 - bool m_apply_edisp; //!< Apply energy dispersion? 72 + GFilename m_outcube; //!< Output Edisp cube file name
74 73
75 // Protected members 74 // Protected members
76 GObservations m_obs; //!< Observation container 75 GObservations m_obs; //!< Observation container
77 - GCTACubeEdisp m_edispcube; //!< EDISP cube 76 + GCTACubeEdisp m_edispcube; //!< Edisp cube
78 }; 77 };
79 78
80 79
src/ctedispcube/ctedispcube.par
@@ -21,8 +21,7 @@ inobs, f, a, &quot;NONE&quot;,,, &quot;Input event list or observation definition XML file&quot; @@ -21,8 +21,7 @@ inobs, f, a, &quot;NONE&quot;,,, &quot;Input event list or observation definition XML file&quot;
21 incube, f, a, "NONE",,, "Input counts cube file to extract PSF cube definition" 21 incube, f, a, "NONE",,, "Input counts cube file to extract PSF cube definition"
22 caldb, s, a, "prod2",,, "Calibration database" 22 caldb, s, a, "prod2",,, "Calibration database"
23 irf, s, a, "South_0.5h",,, "Instrument response function" 23 irf, s, a, "South_0.5h",,, "Instrument response function"
24 -edisp, b, h, no,,, "Apply energy dispersion?"  
25 -outcube, f, a, "psfcube.fits",,, "Output PSF cube file" 24 +outcube, f, a, "edispcube.fits",,, "Output PSF cube file"
26 25
27 # 26 #
28 # Energy binning parameters 27 # Energy binning parameters
@@ -58,4 +57,4 @@ chatter, i, h, 2,0,4, &quot;Chattiness of output&quot; @@ -58,4 +57,4 @@ chatter, i, h, 2,0,4, &quot;Chattiness of output&quot;
58 clobber, b, h, yes,,, "Overwrite existing output files with new output files?" 57 clobber, b, h, yes,,, "Overwrite existing output files with new output files?"
59 debug, b, h, no,,, "Debugging mode activated" 58 debug, b, h, no,,, "Debugging mode activated"
60 mode, s, h, "ql",,, "Mode of automatic parameters" 59 mode, s, h, "ql",,, "Mode of automatic parameters"
61 -logfile, f, h, "ctpsfcube.log",,, "Log filename" 60 +logfile, f, h, "ctedispcube.log",,, "Log filename"
src/cterror/cterror.par
@@ -23,6 +23,7 @@ inmodel, f, a, &quot;$CTOOLS/share/models/crab.xml&quot;,,, &quot;Input model XML file&quot; @@ -23,6 +23,7 @@ inmodel, f, a, &quot;$CTOOLS/share/models/crab.xml&quot;,,, &quot;Input model XML file&quot;
23 srcname, s, a, "Crab",,, "Source of interest" 23 srcname, s, a, "Crab",,, "Source of interest"
24 expcube, f, a, "NONE",,, "Input exposure cube file (only needed for stacked analysis)" 24 expcube, f, a, "NONE",,, "Input exposure cube file (only needed for stacked analysis)"
25 psfcube, f, a, "NONE",,, "Input PSF cube file (only needed for stacked analysis)" 25 psfcube, f, a, "NONE",,, "Input PSF cube file (only needed for stacked analysis)"
  26 +edispcube,f, a, "NONE",,, "Input energy dispersion cube file (only needed for stacked analysis)"
26 bkgcube, f, a, "NONE",,, "Input background cube file (only needed for stacked analysis)" 27 bkgcube, f, a, "NONE",,, "Input background cube file (only needed for stacked analysis)"
27 caldb, s, a, "prod2",,, "Calibration database" 28 caldb, s, a, "prod2",,, "Calibration database"
28 irf, s, a, "South_0.5h",,, "Instrument response function" 29 irf, s, a, "South_0.5h",,, "Instrument response function"
src/ctexpcube/ctexpcube.cpp
@@ -217,18 +217,6 @@ void ctexpcube::run(void) @@ -217,18 +217,6 @@ void ctexpcube::run(void)
217 log << std::endl; 217 log << std::endl;
218 } 218 }
219 219
220 - // Set energy dispersion flag for all CTA observations and save old  
221 - // values in save_edisp vector  
222 - std::vector<bool> save_edisp;  
223 - save_edisp.assign(m_obs.size(), false);  
224 - for (int i = 0; i < m_obs.size(); ++i) {  
225 - GCTAObservation* obs = dynamic_cast<GCTAObservation*>(m_obs[i]);  
226 - if (obs != NULL) {  
227 - save_edisp[i] = obs->response()->apply_edisp();  
228 - obs->response()->apply_edisp(m_apply_edisp);  
229 - }  
230 - }  
231 -  
232 // Write observation(s) into logger 220 // Write observation(s) into logger
233 if (logTerse()) { 221 if (logTerse()) {
234 log << std::endl; 222 log << std::endl;
@@ -250,14 +238,6 @@ void ctexpcube::run(void) @@ -250,14 +238,6 @@ void ctexpcube::run(void)
250 // Fill exposure 238 // Fill exposure
251 m_expcube.fill(m_obs, &log); 239 m_expcube.fill(m_obs, &log);
252 240
253 - // Restore energy dispersion flag for all CTA observations  
254 - for (int i = 0; i < m_obs.size(); ++i) {  
255 - GCTAObservation* obs = dynamic_cast<GCTAObservation*>(m_obs[i]);  
256 - if (obs != NULL) {  
257 - obs->response()->apply_edisp(save_edisp[i]);  
258 - }  
259 - }  
260 -  
261 // Optionally publish exposure cube 241 // Optionally publish exposure cube
262 if (m_publish) { 242 if (m_publish) {
263 publish(); 243 publish();
@@ -348,7 +328,6 @@ void ctexpcube::init_members(void) @@ -348,7 +328,6 @@ void ctexpcube::init_members(void)
348 { 328 {
349 // Initialise members 329 // Initialise members
350 m_outcube.clear(); 330 m_outcube.clear();
351 - m_apply_edisp = false;  
352 m_publish = false; 331 m_publish = false;
353 332
354 // Initialise protected members 333 // Initialise protected members
@@ -369,7 +348,6 @@ void ctexpcube::copy_members(const ctexpcube&amp; app) @@ -369,7 +348,6 @@ void ctexpcube::copy_members(const ctexpcube&amp; app)
369 { 348 {
370 // Copy attributes 349 // Copy attributes
371 m_outcube = app.m_outcube; 350 m_outcube = app.m_outcube;
372 - m_apply_edisp = app.m_apply_edisp;  
373 m_publish = app.m_publish; 351 m_publish = app.m_publish;
374 352
375 // Copy protected members 353 // Copy protected members
@@ -414,9 +392,6 @@ void ctexpcube::get_parameters(void) @@ -414,9 +392,6 @@ void ctexpcube::get_parameters(void)
414 392
415 } // endif: there was no observation in the container 393 } // endif: there was no observation in the container
416 394
417 - // Read energy dispersion flag  
418 - m_apply_edisp = (*this)["edisp"].boolean();  
419 -  
420 // Get the incube filename 395 // Get the incube filename
421 std::string incube = (*this)["incube"].filename(); 396 std::string incube = (*this)["incube"].filename();
422 397
src/ctexpcube/ctexpcube.hpp
@@ -71,7 +71,6 @@ protected: @@ -71,7 +71,6 @@ protected:
71 71
72 // User parameters 72 // User parameters
73 GFilename m_outcube; //!< Output exposure cube file 73 GFilename m_outcube; //!< Output exposure cube file
74 - bool m_apply_edisp; //!< Apply energy dispersion?  
75 bool m_publish; //!< Publish exposure cube? 74 bool m_publish; //!< Publish exposure cube?
76 75
77 // Protected members 76 // Protected members
src/ctexpcube/ctexpcube.par
@@ -21,7 +21,6 @@ inobs, f, a, &quot;NONE&quot;,,, &quot;Input event list or observation definition XML file&quot; @@ -21,7 +21,6 @@ inobs, f, a, &quot;NONE&quot;,,, &quot;Input event list or observation definition XML file&quot;
21 incube, f, a, "NONE",,, "Input counts cube file to extract exposure cube definition" 21 incube, f, a, "NONE",,, "Input counts cube file to extract exposure cube definition"
22 caldb, s, a, "prod2",,, "Calibration database" 22 caldb, s, a, "prod2",,, "Calibration database"
23 irf, s, a, "South_0.5h",,, "Instrument response function" 23 irf, s, a, "South_0.5h",,, "Instrument response function"
24 -edisp, b, h, no,,, "Apply energy dispersion?"  
25 outcube, f, a, "expcube.fits",,, "Output exposure cube file" 24 outcube, f, a, "expcube.fits",,, "Output exposure cube file"
26 25
27 # 26 #
src/ctlike/ctlike.par
@@ -21,6 +21,7 @@ inobs, f, a, &quot;events.fits&quot;,,, &quot;Input event list, counts cube or observ @@ -21,6 +21,7 @@ inobs, f, a, &quot;events.fits&quot;,,, &quot;Input event list, counts cube or observ
21 inmodel, f, a, "$CTOOLS/share/models/crab.xml",,, "Input model XML file" 21 inmodel, f, a, "$CTOOLS/share/models/crab.xml",,, "Input model XML file"
22 expcube, f, a, "NONE",,, "Input exposure cube file (only needed for stacked analysis)" 22 expcube, f, a, "NONE",,, "Input exposure cube file (only needed for stacked analysis)"
23 psfcube, f, a, "NONE",,, "Input PSF cube file (only needed for stacked analysis)" 23 psfcube, f, a, "NONE",,, "Input PSF cube file (only needed for stacked analysis)"
  24 +edispcube, f, a, "NONE",,, "Input energy dispersion cube file (only needed for stacked analysis)"
24 bkgcube, f, a, "NONE",,, "Input background cube file (only needed for stacked analysis)" 25 bkgcube, f, a, "NONE",,, "Input background cube file (only needed for stacked analysis)"
25 caldb, s, a, "prod2",,, "Calibration database" 26 caldb, s, a, "prod2",,, "Calibration database"
26 irf, s, a, "South_0.5h",,, "Instrument response function" 27 irf, s, a, "South_0.5h",,, "Instrument response function"
src/ctmodel/ctmodel.par
@@ -22,6 +22,7 @@ incube, f, a, &quot;NONE&quot;,,, &quot;Input counts cube file to extract model cube definiti @@ -22,6 +22,7 @@ incube, f, a, &quot;NONE&quot;,,, &quot;Input counts cube file to extract model cube definiti
22 inmodel, f, a, "$CTOOLS/share/models/crab.xml",,, "Input model XML file" 22 inmodel, f, a, "$CTOOLS/share/models/crab.xml",,, "Input model XML file"
23 expcube, f, a, "NONE",,, "Input exposure cube file (only needed for stacked analysis)" 23 expcube, f, a, "NONE",,, "Input exposure cube file (only needed for stacked analysis)"
24 psfcube, f, a, "NONE",,, "Input PSF cube file (only needed for stacked analysis)" 24 psfcube, f, a, "NONE",,, "Input PSF cube file (only needed for stacked analysis)"
  25 +edispcube,f, a, "NONE",,, "Input energy dispersion cube file (only needed for stacked analysis)"
25 bkgcube, f, a, "NONE",,, "Input background cube file (only needed for stacked analysis)" 26 bkgcube, f, a, "NONE",,, "Input background cube file (only needed for stacked analysis)"
26 caldb, s, a, "prod2",,, "Calibration database" 27 caldb, s, a, "prod2",,, "Calibration database"
27 irf, s, a, "South_0.5h",,, "Instrument response function" 28 irf, s, a, "South_0.5h",,, "Instrument response function"
src/ctpsfcube/ctpsfcube.cpp
@@ -216,18 +216,6 @@ void ctpsfcube::run(void) @@ -216,18 +216,6 @@ void ctpsfcube::run(void)
216 log << std::endl; 216 log << std::endl;
217 } 217 }
218 218
219 - // Set energy dispersion flag for all CTA observations and save old  
220 - // values in save_edisp vector  
221 - std::vector<bool> save_edisp;  
222 - save_edisp.assign(m_obs.size(), false);  
223 - for (int i = 0; i < m_obs.size(); ++i) {  
224 - GCTAObservation* obs = dynamic_cast<GCTAObservation*>(m_obs[i]);  
225 - if (obs != NULL) {  
226 - save_edisp[i] = obs->response()->apply_edisp();  
227 - obs->response()->apply_edisp(m_apply_edisp);  
228 - }  
229 - }  
230 -  
231 // Write observation(s) into logger 219 // Write observation(s) into logger
232 if (logTerse()) { 220 if (logTerse()) {
233 log << std::endl; 221 log << std::endl;
@@ -249,14 +237,6 @@ void ctpsfcube::run(void) @@ -249,14 +237,6 @@ void ctpsfcube::run(void)
249 // Fill PSF 237 // Fill PSF
250 m_psfcube.fill(m_obs, &log); 238 m_psfcube.fill(m_obs, &log);
251 239
252 - // Restore energy dispersion flag for all CTA observations  
253 - for (int i = 0; i < m_obs.size(); ++i) {  
254 - GCTAObservation* obs = dynamic_cast<GCTAObservation*>(m_obs[i]);  
255 - if (obs != NULL) {  
256 - obs->response()->apply_edisp(save_edisp[i]);  
257 - }  
258 - }  
259 -  
260 // Return 240 // Return
261 return; 241 return;
262 } 242 }
@@ -308,7 +288,6 @@ void ctpsfcube::init_members(void) @@ -308,7 +288,6 @@ void ctpsfcube::init_members(void)
308 { 288 {
309 // Initialise members 289 // Initialise members
310 m_outcube.clear(); 290 m_outcube.clear();
311 - m_apply_edisp = false;  
312 291
313 // Initialise protected members 292 // Initialise protected members
314 m_obs.clear(); 293 m_obs.clear();
@@ -328,7 +307,6 @@ void ctpsfcube::copy_members(const ctpsfcube&amp; app) @@ -328,7 +307,6 @@ void ctpsfcube::copy_members(const ctpsfcube&amp; app)
328 { 307 {
329 // Copy attributes 308 // Copy attributes
330 m_outcube = app.m_outcube; 309 m_outcube = app.m_outcube;
331 - m_apply_edisp = app.m_apply_edisp;  
332 310
333 // Copy protected members 311 // Copy protected members
334 m_obs = app.m_obs; 312 m_obs = app.m_obs;
@@ -401,9 +379,6 @@ void ctpsfcube::get_parameters(void) @@ -401,9 +379,6 @@ void ctpsfcube::get_parameters(void)
401 379
402 } // endelse: cube loaded from file 380 } // endelse: cube loaded from file
403 381
404 - // Read energy dispersion flag  
405 - m_apply_edisp = (*this)["edisp"].boolean();  
406 -  
407 // Read output filename (if needed) 382 // Read output filename (if needed)
408 if (read_ahead()) { 383 if (read_ahead()) {
409 m_outcube = (*this)["outcube"].filename(); 384 m_outcube = (*this)["outcube"].filename();
src/ctpsfcube/ctpsfcube.hpp
@@ -70,7 +70,6 @@ protected: @@ -70,7 +70,6 @@ protected:
70 70
71 // User parameters 71 // User parameters
72 GFilename m_outcube; //!< Output PSF cube file name 72 GFilename m_outcube; //!< Output PSF cube file name
73 - bool m_apply_edisp; //!< Apply energy dispersion?  
74 73
75 // Protected members 74 // Protected members
76 GObservations m_obs; //!< Observation container 75 GObservations m_obs; //!< Observation container
src/ctpsfcube/ctpsfcube.par
@@ -21,7 +21,6 @@ inobs, f, a, &quot;NONE&quot;,,, &quot;Input event list or observation definition XML file&quot; @@ -21,7 +21,6 @@ inobs, f, a, &quot;NONE&quot;,,, &quot;Input event list or observation definition XML file&quot;
21 incube, f, a, "NONE",,, "Input counts cube file to extract PSF cube definition" 21 incube, f, a, "NONE",,, "Input counts cube file to extract PSF cube definition"
22 caldb, s, a, "prod2",,, "Calibration database" 22 caldb, s, a, "prod2",,, "Calibration database"
23 irf, s, a, "South_0.5h",,, "Instrument response function" 23 irf, s, a, "South_0.5h",,, "Instrument response function"
24 -edisp, b, h, no,,, "Apply energy dispersion?"  
25 outcube, f, a, "psfcube.fits",,, "Output PSF cube file" 24 outcube, f, a, "psfcube.fits",,, "Output PSF cube file"
26 25
27 # 26 #
src/cttsmap/cttsmap.par
@@ -17,35 +17,36 @@ @@ -17,35 +17,36 @@
17 # 17 #
18 # General parameters 18 # General parameters
19 #=================== 19 #===================
20 -inobs, f, a, "events.fits",,, "Input event list, counts cube or observation definition XML file"  
21 -inmodel, f, a, "$CTOOLS/share/models/crab.xml",,, "Input model XML file"  
22 -srcname, s, a, "Crab",,, "Test source name"  
23 -expcube, f, a, "NONE",,, "Input exposure cube file (only needed for stacked analysis)"  
24 -psfcube, f, a, "NONE",,, "Input PSF cube file (only needed for stacked analysis)"  
25 -bkgcube, f, a, "NONE",,, "Input background cube file (only needed for stacked analysis)"  
26 -caldb, s, a, "prod2",,, "Calibration database"  
27 -irf, s, a, "South_0.5h",,, "Instrument response function"  
28 -edisp, b, h, no,,, "Apply energy dispersion?"  
29 -outmap, f, a, "tsmap.fits",,, "Output Test Statistic map file" 20 +inobs, f, a, "events.fits",,, "Input event list, counts cube or observation definition XML file"
  21 +inmodel, f, a, "$CTOOLS/share/models/crab.xml",,, "Input model XML file"
  22 +srcname, s, a, "Crab",,, "Test source name"
  23 +expcube, f, a, "NONE",,, "Input exposure cube file (only needed for stacked analysis)"
  24 +psfcube, f, a, "NONE",,, "Input PSF cube file (only needed for stacked analysis)"
  25 +edispcube, f, a, "NONE",,, "Input energy dispersion cube file (only needed for stacked analysis)"
  26 +bkgcube, f, a, "NONE",,, "Input background cube file (only needed for stacked analysis)"
  27 +caldb, s, a, "prod2",,, "Calibration database"
  28 +irf, s, a, "South_0.5h",,, "Instrument response function"
  29 +edisp, b, h, no,,, "Apply energy dispersion?"
  30 +outmap, f, a, "tsmap.fits",,, "Output Test Statistic map file"
30 31
31 # 32 #
32 # Spatial binning parameters 33 # Spatial binning parameters
33 #=========================== 34 #===========================
34 -usepnt, b, h, no,,, "Use pointing instead of xref/yref parameters?"  
35 -nxpix, i, a, 200,,, "Size of the X axis in pixels"  
36 -nypix, i, a, 200,,, "Size of the Y axis in pixels"  
37 -binsz, r, a, 0.02,,, "Image scale (in degrees/pixel)"  
38 -coordsys, s, a, "CEL", CEL|GAL,,"Coordinate system (CEL - celestial, GAL - galactic)"  
39 -xref, r, a, 83.63,0,360, "First coordinate of image center in degrees (RA or galactic l)"  
40 -yref, r, a, 22.01,-90,90, "Second coordinate of image center in degrees (DEC or galactic b)"  
41 -proj, s, a, "CAR", AIT|AZP|CAR|MER|MOL|STG|TAN,, "Projection method" 35 +usepnt, b, h, no,,, "Use pointing instead of xref/yref parameters?"
  36 +nxpix, i, a, 200,,, "Size of the X axis in pixels"
  37 +nypix, i, a, 200,,, "Size of the Y axis in pixels"
  38 +binsz, r, a, 0.02,,, "Image scale (in degrees/pixel)"
  39 +coordsys, s, a, "CEL", CEL|GAL,,"Coordinate system (CEL - celestial, GAL - galactic)"
  40 +xref, r, a, 83.63,0,360, "First coordinate of image center in degrees (RA or galactic l)"
  41 +yref, r, a, 22.01,-90,90, "Second coordinate of image center in degrees (DEC or galactic b)"
  42 +proj, s, a, "CAR", AIT|AZP|CAR|MER|MOL|STG|TAN,, "Projection method"
42 43
43 # 44 #
44 # Parameters for splitting and speed purpose 45 # Parameters for splitting and speed purpose
45 #=========================== 46 #===========================
46 -binmin, i, h, -1,,, "First bin to compute"  
47 -binmax, i, h, -1,,, "Last bin to compute"  
48 -logL0, r, h, 0.0,,, "LogLikelihood value of null hypothesis" 47 +binmin, i, h, -1,,, "First bin to compute"
  48 +binmax, i, h, -1,,, "Last bin to compute"
  49 +logL0, r, h, 0.0,,, "LogLikelihood value of null hypothesis"
49 50
50 # 51 #
51 # Standard parameters 52 # Standard parameters
src/ctulimit/ctulimit.par
@@ -22,6 +22,7 @@ inmodel, f, a, &quot;$CTOOLS/share/models/crab.xml&quot;,,, &quot;Input model XML file&quot; @@ -22,6 +22,7 @@ inmodel, f, a, &quot;$CTOOLS/share/models/crab.xml&quot;,,, &quot;Input model XML file&quot;
22 srcname, s, a, "Crab",,, "Source of interest" 22 srcname, s, a, "Crab",,, "Source of interest"
23 expcube, f, a, "NONE",,, "Input exposure cube file (only needed for stacked analysis)" 23 expcube, f, a, "NONE",,, "Input exposure cube file (only needed for stacked analysis)"
24 psfcube, f, a, "NONE",,, "Input PSF cube file (only needed for stacked analysis)" 24 psfcube, f, a, "NONE",,, "Input PSF cube file (only needed for stacked analysis)"
  25 +edispcube,f, a, "NONE",,, "Input energy dispersion cube file (only needed for stacked analysis)"
25 bkgcube, f, a, "NONE",,, "Input background cube file (only needed for stacked analysis)" 26 bkgcube, f, a, "NONE",,, "Input background cube file (only needed for stacked analysis)"
26 caldb, s, a, "prod2",,, "Calibration database" 27 caldb, s, a, "prod2",,, "Calibration database"
27 irf, s, a, "South_0.5h",,, "Instrument response function" 28 irf, s, a, "South_0.5h",,, "Instrument response function"
src/support/ctool.cpp
@@ -862,11 +862,12 @@ void ctool::set_obs_response(GCTAObservation* obs) @@ -862,11 +862,12 @@ void ctool::set_obs_response(GCTAObservation* obs)
862 // If the observation contains a counts cube, then first check whether 862 // If the observation contains a counts cube, then first check whether
863 // the expcube and psfcube parameters exist and are not NONE 863 // the expcube and psfcube parameters exist and are not NONE
864 if (dynamic_cast<const GCTAEventCube*>(obs->events()) != NULL) { 864 if (dynamic_cast<const GCTAEventCube*>(obs->events()) != NULL) {
865 - if (has_par("expcube") && has_par("psfcube") && has_par("bkgcube")) { 865 + if (has_par("expcube") && has_par("psfcube") && has_par("bkgcube") && has_par("edispcube")) {
866 866
867 // Get filenames 867 // Get filenames
868 std::string expcube = (*this)["expcube"].filename(); 868 std::string expcube = (*this)["expcube"].filename();
869 std::string psfcube = (*this)["psfcube"].filename(); 869 std::string psfcube = (*this)["psfcube"].filename();
  870 + std::string edispcube = (*this)["edispcube"].filename();
870 std::string bkgcube = (*this)["bkgcube"].filename(); 871 std::string bkgcube = (*this)["bkgcube"].filename();
871 872
872 // Extract response information if available 873 // Extract response information if available
@@ -880,8 +881,15 @@ void ctool::set_obs_response(GCTAObservation* obs) @@ -880,8 +881,15 @@ void ctool::set_obs_response(GCTAObservation* obs)
880 GCTACubePsf psf(psfcube); 881 GCTACubePsf psf(psfcube);
881 GCTACubeBackground background(bkgcube); 882 GCTACubeBackground background(bkgcube);
882 883
883 - // Set reponse  
884 - obs->response(exposure, psf, background); 884 + // Optionally load Edisp cube
  885 + if (edispcube != "NONE" && (gammalib::strip_whitespace(edispcube) != "")) {
  886 + GCTACubeEdisp edisp(edispcube);
  887 + obs->response(exposure, psf, edisp, background);
  888 + }
  889 + else {
  890 + // Set reponse
  891 + obs->response(exposure, psf, background);
  892 + }
885 893
886 // Signal response availability 894 // Signal response availability
887 has_response = true; 895 has_response = true;
test/test_cscripts.sh.in
@@ -405,6 +405,7 @@ fi @@ -405,6 +405,7 @@ fi
405 inobs="data/crab_cntmap_small.fits.gz" \ 405 inobs="data/crab_cntmap_small.fits.gz" \
406 expcube="data/crab_expcube.fits.gz" \ 406 expcube="data/crab_expcube.fits.gz" \
407 psfcube="data/crab_psfcube.fits.gz" \ 407 psfcube="data/crab_psfcube.fits.gz" \
  408 + edispcube="data/crab_edispcube.fits.gz" \
408 bkgcube="data/crab_bkgcube.fits.gz" \ 409 bkgcube="data/crab_bkgcube.fits.gz" \
409 inmodel="data/crab_bkgcube.xml" \ 410 inmodel="data/crab_bkgcube.xml" \
410 ebinalg="LOG" \ 411 ebinalg="LOG" \
test/test_ctools.sh
@@ -293,8 +293,8 @@ $ctedispcube inobs=&quot;data/crab_events.fits&quot; \ @@ -293,8 +293,8 @@ $ctedispcube inobs=&quot;data/crab_events.fits&quot; \
293 xref=83.63 \ 293 xref=83.63 \
294 yref=22.01 \ 294 yref=22.01 \
295 proj="CAR" \ 295 proj="CAR" \
296 - mmax=10.0 \  
297 - migrabins=100 296 + mmax=3.0 \
  297 + migrabins=10
298 $ECHO -n "." 298 $ECHO -n "."
299 if [ -s "edispcube1.fits" ] 299 if [ -s "edispcube1.fits" ]
300 then 300 then
@@ -310,8 +310,8 @@ $ctedispcube inobs=&quot;events.fits&quot; \ @@ -310,8 +310,8 @@ $ctedispcube inobs=&quot;events.fits&quot; \
310 outcube="edispcube2.fits" \ 310 outcube="edispcube2.fits" \
311 caldb="irf" \ 311 caldb="irf" \
312 irf="cta_dummy_irf" \ 312 irf="cta_dummy_irf" \
313 - mmax=10.0 \  
314 - migrabins=5 313 + mmax=3.0 \
  314 + migrabins=3
315 $ECHO -n "." 315 $ECHO -n "."
316 if [ -s "edispcube2.fits" ] 316 if [ -s "edispcube2.fits" ]
317 then 317 then
@@ -401,6 +401,7 @@ $ctmodel inobs=&quot;cntmap1.fits&quot; \ @@ -401,6 +401,7 @@ $ctmodel inobs=&quot;cntmap1.fits&quot; \
401 expcube="NONE" \ 401 expcube="NONE" \
402 psfcube="NONE" \ 402 psfcube="NONE" \
403 bkgcube="NONE" \ 403 bkgcube="NONE" \
  404 + edispcube="NONE" \
404 caldb="irf" \ 405 caldb="irf" \
405 irf="cta_dummy_irf" \ 406 irf="cta_dummy_irf" \
406 inmodel="data/crab.xml" 407 inmodel="data/crab.xml"
@@ -420,6 +421,7 @@ $ctmodel inobs=&quot;cntmap2.fits&quot; \ @@ -420,6 +421,7 @@ $ctmodel inobs=&quot;cntmap2.fits&quot; \
420 outcube="modmap2.fits" \ 421 outcube="modmap2.fits" \
421 expcube="expcube2.fits" \ 422 expcube="expcube2.fits" \
422 psfcube="psfcube2.fits" \ 423 psfcube="psfcube2.fits" \
  424 + edispcube="edispcube2.fits" \
423 bkgcube="bkgcube2.fits" \ 425 bkgcube="bkgcube2.fits" \
424 caldb="irf" \ 426 caldb="irf" \
425 irf="cta_dummy_irf" \ 427 irf="cta_dummy_irf" \
@@ -440,6 +442,7 @@ $ctmodel inobs=&quot;NONE&quot; \ @@ -440,6 +442,7 @@ $ctmodel inobs=&quot;NONE&quot; \
440 outcube="modmap3.fits" \ 442 outcube="modmap3.fits" \
441 expcube="NONE" \ 443 expcube="NONE" \
442 psfcube="NONE" \ 444 psfcube="NONE" \
  445 + edispcube="NONE" \
443 bkgcube="NONE" \ 446 bkgcube="NONE" \
444 caldb="irf" \ 447 caldb="irf" \
445 irf="cta_dummy_irf" \ 448 irf="cta_dummy_irf" \
@@ -505,6 +508,7 @@ $ctlike inobs=&quot;cntmap1.fits&quot; \ @@ -505,6 +508,7 @@ $ctlike inobs=&quot;cntmap1.fits&quot; \
505 outmodel="results_binned.xml" \ 508 outmodel="results_binned.xml" \
506 expcube="NONE" \ 509 expcube="NONE" \
507 psfcube="NONE" \ 510 psfcube="NONE" \
  511 + edispcube="NONE" \
508 bkgcube="NONE" \ 512 bkgcube="NONE" \
509 caldb="irf" \ 513 caldb="irf" \
510 irf="cta_dummy_irf" 514 irf="cta_dummy_irf"
@@ -539,6 +543,7 @@ $ctlike inobs=&quot;cntmap2.fits&quot; \ @@ -539,6 +543,7 @@ $ctlike inobs=&quot;cntmap2.fits&quot; \
539 outmodel="results_binned_cube_background.xml" \ 543 outmodel="results_binned_cube_background.xml" \
540 expcube="expcube2.fits" \ 544 expcube="expcube2.fits" \
541 psfcube="psfcube2.fits" \ 545 psfcube="psfcube2.fits" \
  546 + edispcube="NONE" \
542 bkgcube="bkgcube2.fits" \ 547 bkgcube="bkgcube2.fits" \
543 caldb="irf" \ 548 caldb="irf" \
544 irf="cta_dummy_irf" 549 irf="cta_dummy_irf"
@@ -550,9 +555,32 @@ else @@ -550,9 +555,32 @@ else
550 $ECHO " results_binned_cube_background.xml file is not found" 555 $ECHO " results_binned_cube_background.xml file is not found"
551 exit 1 556 exit 1
552 fi 557 fi
  558 +
  559 +
  560 +#
  561 +# Run 4
  562 +$ctlike inobs="cntmap2.fits" \
  563 + inmodel="bkgcube2.xml" \
  564 + outmodel="results_binned_cube_background_edisp.xml" \
  565 + expcube="expcube2.fits" \
  566 + psfcube="psfcube2.fits" \
  567 + edispcube="edispcube2.fits" \
  568 + bkgcube="bkgcube2.fits" \
  569 + edisp="yes"
  570 + caldb="irf" \
  571 + irf="cta_dummy_irf"
  572 +$ECHO -n "."
  573 +if [ -s "results_binned_cube_background_edisp.xml" ]
  574 +then
  575 + $ECHO -n "."
  576 +else
  577 + $ECHO " results_binned_cube_background_edisp.xml file is not found"
  578 + exit 1
  579 +fi
553 $ECHO " ok" 580 $ECHO " ok"
554 581
555 582
  583 +
556 # 584 #
557 # Test cttsmap 585 # Test cttsmap
558 # ============ 586 # ============