Datareader home Runlist Pilot File Outputs Stage6 Template
The spectral analysis is performed with the GrISep package This section will not describe all the GrISep possibility but just the way to produce spectrum from datareader.
We will use 2 programs of the GrISep packages:
GrISep/vg_get_data which creates 4 data files (in "root" format) from the energy output files ofGrISU/Datareader/datareader,These 4 files are:
GrISU/Simulation/Detector/grisudetList of the reconstructed energy of the "ON" events (from experimental data, produced by datareader).GrISep/vg_spectrum which unfolds the spectrum of source using the above mentioned data files in ".root" format.
List of the reconstructed energy of the "OFF" events (from experimental data, produced by datareader).
List of the simulated and reconstructed energy of "ON" events (from Monte Carlo data, produced by spectrum_info).
List of the simulated energy of all the events simulated (from Monte Carlo data, produced by grisudet).
The 2 GrISep programs are controlled by a pilot file using the same convention as GrISU.
The default pilot files are spectrum.pilot and get_data.pilot.
To compile these program, launch "make" in the GrIsep directory:
Producing Energy Files
In the datareader pilot file, you need to add a * to the following line to produce the ON and OFF energy files:
* ENGFI 1 ./Crab
After you run datareader, it will produce 2 files named Crab_ON.els and Crab_OFF.els, which are the reconstructed energy of the ON and OFF events.
The energy file of all the simulated events is produced at time of simulation using grisudet. It is a ".eng" file.
To compile spectrum_info:
GrISU/Datareader> make spectrum
You need a runlist containing the path and names of the simulation files, similar to the runlist of datareader except you do not need the RA/dec and time cut information (or the program will not execute successfully).
You may use the same datareader pilot file you used to run Datareader. You can edit the ENGFI line to change the name of your simulation file
The command line to run spectrum_info:
GrISU> Datareader/spectrum_info -d datareader.pilot < simulation-runlist
When it's finished it'll print out on the screen where the simulation energy files is saved to, for example, Crab_simu.rcs
Converting energy files into root format
In GrISep directory, edit get_data.pilot with your favorite text editor.
Inside the get_data.pilot:
* NUMBTEL 4
This indicates the number of telescopes in your data. If you have 3 and 4 telescopes data in your dataset, you must treat them separately.
* GETDA filein utahfile ../Crab_on.els gamma
This indicates the input file, in this case it's the reconstructed energies of ON events from your data. Make sure the path name is correct.
* GETDA fileout rcstree ./Crab_on.root gamma
This is the output root file.
Don't worry about the rest
To run in command line:
Repeat for the other 3 files.
For the OFF file, simply replace "ON" with "OFF" in the pilot file
For the simulation reconstructed energy file from spectrum_info
* GETDA filein utahsimfile ../Crab_simu.rcs gamma
Notice the change in file type to utahsimfile.
* GETDA fileout rcstree ./Crab_simu.root gamma
For the simulation energy file from grisudet
* GETDA filein engfile ../Crab.eng eng
Notice the change in file type to engfile, and from gamma to eng.
* GETDA fileout engtree ./Crab_eng.root eng
Notice the change in tree type to engtree, and from gamma to eng.
Producing a spectrum from the root filesIn spectrum.pilot:
* NUMBTEL 4specfies number of telescopes * MAKESPEC filein rcstree ./Crab_simu.root gammaspecifies the location of the reconstructed energy file of the simulation. * MAKESPEC fileengin engtree ./Crab_eng.root engspecifies the location of the simulation energy file. * MAKESPEC filedataon rcstree ./Crab_on.root gammaspecifies the location of the reconstructed energy file of ON events. * MAKESPEC filedataoff rcstree ./Crab_off.root gammaspecifies the location of the reconstructed energy file of OFF events. * MAKESPEC multoff 0.142857specifies the constant beta.
For reflected regions analysis (7 reflected off regions), it's 1/7, which is 0.142857.
For ring background analysis, you can extract this constant in the summary file produced by datareader. On the line where it says OFF count, beta is the number ON background divided by OFF count.
For example: OFF count : 537 (ON background = 76.71)
beta is 76.71/537 = 0.142849.
* MAKESPEC mcarlo 450.0 2.5how the photons were simulated. * MAKESPEC data 54specifies the observing duration in minutes, deadtime needs to be taken into accout (~10% for 4 telescopes). * CFSPEC logebins -.85 0.3 8specifies the range and binning of the spectrum.
To run in command line:
The last plot flux is the spectrum.
A text file named flux_spectrum.tbl will also be created in GrISep. It contains the data points in the spectrum in the this format: Energy(TeV),Flux, Flux error bar.