Changeset 366 for trunk


Ignore:
Timestamp:
02/18/00 17:42:39 (25 years ago)
Author:
petry
Message:
This version includes drastic changes and belongs to camera.cxx 1.5.
It is not yet finished and not immediately useful because the
trigger simulation is not yet re-implemented. I had to take it
out together with some other stuff in order to tidy the whole
program up. This is not meant as an insult to anyone. I needed
to do this in order to be able to work on it.

This version has been put in the repository in order to be
able to share the further development with others.

If you need something working, wait or take an earlier one.
See file README.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Simulation/Detector/Camera/camera.h

    r318 r366  
    1919//=
    2020//= $RCSfile: camera.h,v $
    21 //= $Revision: 1.3 $
    22 //= $Author: harald $
    23 //= $Date: 1999-11-11 20:29:29 $
     21//= $Revision: 1.4 $
     22//= $Author: petry $
     23//= $Date: 2000-02-18 17:42:39 $
    2424//=
    2525//=//////////////////////////////////////////////////////////////////////
     
    6161#include "moments.h"
    6262
    63 #include "lagrange.h"
    64 
    6563#include "MCEventHeader.hxx"
    6664#include "MCCphoton.hxx"
     65#include "MTrigger.hxx"
    6766
    6867// command line options available
     
    9695//!@{
    9796
    98 #define SLICES            100
     97#define SLICES            19
    9998#define WIDTH_TIMESLICE   3.3
    10099 
     100#define NOTIME 999999999
     101
    101102#define SIN60   0.866025403784439
    102103#define COS60   0.500000000000000
     
    104105#define RandomNumber  drand48()
    105106
    106 #define PIX_ARRAY_SIDE       40
    107 #define PIX_ARRAY_HALF_SIDE  20
    108 #define PIXNUM               0
    109 #define PIXX                 1
    110 #define PIXY                 2
    111 
    112107#define iMAXNUMPIX  595 // total maximum possible number of pixels in the camera
    113108
    114 //@ the trigger threshold up to which the maximum passable threshold is tested
    115 #define iMAX_THRESHOLD_PHE   50
    116 
    117 //@ number of the 1st. pixel of a sector s in a ring r (central pixel: ring=0)
    118 #define FIRST_PIXEL(r,s)   ( ((r)>0) ? (3*(r)*((r)-1) + (r)*(s) + 1) : 0 )
    119 
    120 //@ number of the pixels include in a camera of r pixels
    121 #define NUMBER_PIXELS(r)   ( ((r)>0) ? FIRST_PIXEL((r)+1,0) : 1 )
     109#define iMAXNUMPHE 50000 // maximum total number of photoelectrons in one event
     110
     111#define iNUMNSBPRODCALLS 1  // in order to average over the QE simulation, call the
     112                            // phe production function for the NSB iNUMNSBPRODCALLS times
     113
     114#define iNUMWAVEBANDS 5  // number of wavebands for the NSB simulation
     115
     116#define WAVEBANDBOUND1 290. // iNUMWAVEBANDS+1 boundaries for waveband definitions (nm)
     117#define WAVEBANDBOUND2 310. // for the NSB generation
     118#define WAVEBANDBOUND3 400.
     119#define WAVEBANDBOUND4 500.
     120#define WAVEBANDBOUND5 600.
     121#define WAVEBANDBOUND6 800.
     122
     123#define EXTWAVEBAND1 3.715  // iNUMWAVEBANDS extinction values in magnitudes per airmass
     124#define EXTWAVEBAND2 0.642  // - these values were taken from D.L. King, Isaac Newton Group
     125#define EXTWAVEBAND3 0.209  // Tech Note No. 31, they are for a clear night at the ORM,
     126#define EXTWAVEBAND4 0.107  // La Palma. The values were averaged in the given wavebands
     127#define EXTWAVEBAND5 0.053
     128
     129#define SIMTIMEOFFSET_NS 5  // determines how many ns before the first and after the last
     130                            // shower photoelectron, there should be NSB photoelectrons
    122131
    123132//@ now we define the list CT_ITEM_LIST of possible items in the CT def. file
     
    225234  double dxpointcorr_deg; /* correction of the pixel coordinates; to be added to dxc[] to get correct value */
    226235  double dypointcorr_deg; /* correction of the pixel coordinates; to be added to dxc[] to get correct value */
    227   double di[iMAXNUMPIX]; /* i coordinate in JCs bi-axis hexagonal coordinate system */
    228   double dj[iMAXNUMPIX]; /* j coordinate in JCs bi-axis hexagonal coordinate system */
    229236 
     237};
     238
     239class Photoelectron{
     240 public:
     241  int iarrtime_ns; // arrival time taken from the corresponding photon
     242  int ipixnum;     // pixel in which the phe was evoked (starts at 0)
     243 
     244  Photoelectron(); // constructor (code in camera.cxx)
     245
    230246};
    231247
     
    268284                float l, float m, float n,
    269285                float x, float y, float z);
    270      
     286int check_reflector_file(FILE *infile);
     287float lin_interpol(float x1, float y1, float x2, float y2, float x);
     288int produce_phes( FILE *sp, // the input file
     289                  struct camera *cam, // the camera layout
     290                  float minwl_nm, // the minimum accepted wavelength
     291                  float maxwl_nm, // the maximum accepted wavelength
     292                  class Photoelectron phe[iMAXNUMPHE], // the generated phes
     293                  int *itotnphe, // total number of produced photoelectrons
     294                  float *nphe, // number of photoelectrons in each pixel
     295                  int *incph,    // total number of cph read
     296                  float *tmin_ns,   // minimum arrival time of all phes
     297                  float *tmax_ns    // maximum arrival time of all phes
     298                  );
     299
     300int produce_nsbrates( char *inname,
     301                      struct camera *cam,
     302                      class Photoelectron phe[iMAXNUMPHE],
     303                      float nsbrate[][iNUMWAVEBANDS]
     304                      );
     305
     306int produce_nsb_phes( float *atmin_ns,
     307                      float *atmax_ns,
     308                      float theta_rad,
     309                      struct camera *cam,
     310                      float nsbr_phepns[iMAXNUMPIX][iNUMWAVEBANDS],
     311                      float dnsb_phepns[iMAXNUMPIX],
     312                      float extinction[iNUMWAVEBANDS],
     313                      float fnpx[iMAXNUMPIX],
     314                      Photoelectron photo[iMAXNUMPHE],
     315                      int *inphe,
     316                      float base_mv[iMAXNUMPIX]);
     317
    271318//!@}
    272319
     
    278325/*
    279326 *$Log: not supported by cvs2svn $
     327 *Revision 1.3  1999/11/11 20:29:29  harald
     328 *Small changes to run the new version on a linux machine.
     329 *
    280330 *Revision 1.2  1999/11/10 07:42:41  harald
    281331 *Small change to read the right data files in.
     
    290340 *The "rootification" was done by Dirk Petry and Harald Kornmayer.
    291341 *
    292  *In the following you can see the README file of that version:
    293  *
    294  *==================================================
    295  *
    296  *Fri Oct 22  1999   D.P.
    297  *
    298  *The MAGIC Monte Carlo System
    299  *
    300  *Camera Simulation Programme
    301  *---------------------------
    302  *
    303  *1) Description
    304  *
    305  *This version is the result of the fusion of H.K.'s
    306  *root_camera which is described below (section 2)
    307  *and another version by D.P. which had a few additional
    308  *useful features.
    309  *
    310  *The version compiles under Linux with ROOT 2.22 installed
    311  *(variable ROOTSYS has to be set).
    312  *
    313  *Compile as before simply using "make" in the root_camera
    314  *directory.
    315  *
    316  *All features of H.K.'s root_camera were retained.
    317  *
    318  *Additional features of this version are:
    319  *
    320  *  a) HBOOK is no longer used and all references are removed.
    321  *
    322  *  b) Instead of HBOOK, the user is given now the possibility of
    323  *     having Diagnostic data in ROOT format as a complement
    324  *     to the ROOT Raw data.
    325  *
    326  *     This data is written to the file which is determined by
    327  *     the new input parameter "diag_file" in the camera parameter
    328  *     file.
    329  *
    330  *     All source code file belonging to this part have filenames
    331  *     starting with "MDiag".
    332  *
    333  *     The user can read the output file using the following commands
    334  *     in an interactive ROOT session:
    335  *
    336  *              root [0] .L MDiag.so
    337  *      root [1] new TFile("diag.root");
    338  *      root [2] new TTreeViewer("T");
    339  *     
    340  *     This brings up a viewer from which all variables of the
    341  *     TTree can be accessed and histogrammed. This example
    342  *     assumes that you have named the file "diag.root", that
    343  *     you are using ROOT version 2.22 or later and that you have
    344  *     the shared object library "MDiag.so" which is produced
    345  *     by the Makefile along with the executable "camera".
    346  *       
    347  * !   The contents of the so-called diag file is not yet fixed.
    348  * !   At the moment it is what J.C.G. used to put into the HBOOK
    349  * !   ntuple. In future versions the moments calculation can be
    350  * !   removed and the parameter list be modified correspondingly.
    351  *
    352  *  c) Now concatenated reflector files can be read. This is useful
    353  *     if you have run the reflector with different parameters but
    354  *     you want to continue the analysis with all reflector data
    355  *     going into ONE ROOT outputfile.
    356  *
    357  *     The previous camera version contained a bug which made reading
    358  *     of two or more concatenated reflector files impossible.
    359  *
    360  *  d) The reflector output format was changed. It is now version
    361  *     0.4 .
    362  *     The change solely consists in a shortening of the flag
    363  *     definition in the file
    364  *
    365  *           include-MC/MCCphoton.hxx 
    366  *
    367  * !   IF YOU WANT TO READ REFLECTOR FORMAT 0.3, you can easily
    368  * !   do so by recompiling camera with the previous version of
    369  * !   include-MC/MCCphoton.hxx.
    370  *
    371  *     The change was necessary for saving space and better
    372  *     debugging. From now on, this format can be frozen.
    373  *
    374  * !   For producing reflector output in the new format, you
    375  * !   of course have to recompile your reflector with the
    376  * !   new include-MC/MCCphoton.hxx .
    377  *
    378  *  e) A first version of the pixelization with the larger
    379  *     outer pixels is implemented. THIS IS NOT YET FULLY
    380  *     TESTED, but first rough tests show that it works
    381  *     at least to a good approximation.
    382  *
    383  *     The present version implements the camera outline
    384  *     with 18 "gap-pixels" and 595 pixels in total as
    385  *     shown in
    386  *
    387  *        http://sarastro.ifae.es/internal/home/hardware/camera/numbering.ps
    388  *
    389  *     This change involved
    390  *
    391  *      (i) The file pixels.dat is no longer needed. Instead
    392  *          the coordinates are generated by the program itself
    393  *          (takes maybe 1 second). In the file
    394  *
    395  *              pixel-coords.txt
    396  *
    397  *        in the same directory as this README, you find a list
    398  *          of the coordinates generated by this new routine. It
    399  *          has the format
    400  *
    401  *              number   i   j   x  y  size-factor
    402  *
    403  *          where i and j are J.C.G.'s so called biaxis hexagonal
    404  *          coordinates (for internal use) and x and y are the
    405  *          coordinates of the pixel centers in the standard camera
    406  *          coordinate system in units of centimeters. The value
    407  *          of "size-factor" determines the linear size of the pixel
    408  *          relative to the central pixels.
    409  *
    410  *        (ii) The magic.def file has two additional parameters
    411  *          which give the number of central pixels and the
    412  *          number of gap pixels
    413  *
    414  *        (iii) In camera.h and camera.cxx several changes were
    415  *          necessary, among them the introduction of several
    416  *          new functions
    417  *
    418  *     The newly suggested outline with asymmetric Winston cones
    419  *     will be implemented in a later version.
    420  *
    421  *  f) phe files can no longer be read since this contradicts
    422  *     our philosophy that the analysis should be done with other
    423  *     programs like e.g. EVITA and not with "camera" itself.
    424  *     This possibility was removed.
    425  *
    426  *  g) ROOT is no longer invoked with an interactive interface.
    427  *     In this way, camera can better be run as a batch program and
    428  *     it uses less memory.
    429  *
    430  *  h) small changes concerning the variable "t_chan" were necessary in
    431  *     order to avoid segmentation faults: The variable is used as an
    432  *     index and it went sometimes outside the limits when camera
    433  *     was reading proton data. This is because the reflector files
    434  *     don't contain the photons in a chronological order and also
    435  *     the timespread can be considerably longer that the foreseen
    436  *     digitisation timespan. Please see the source code of camera.cxx
    437  *     round about line 1090.
    438  *
    439  *  j) several unused variables were removed, a few warning messages
    440  *     occur when you compile camera.cxx but these can be ignored at
    441  *     the moment.
    442  *
    443  *In general the program is of course not finished. It still needs
    444  *debugging, proper trigger simulation, simulation of the asymmetric
    445  *version of the outer pixels, proper NSB simulation, adaption of
    446  *the diag "ntuple" contents to our need and others small improvements.
    447  *
    448  *In the directory rfl-files there is now a file in reflector format 0.4
    449  *containing a single event produced by the starfiled adder. It has
    450  *a duration of 30 ns and represents the region around the Crab Nebula.
    451  *Using the enclosed input parameter file, camera should process this
    452  *file without problems.
    453  *
    454  *2) The README for the previous version of root_camera
    455  *
    456  *README for a preliminary version of the
    457  *root_camera program.
    458  *
    459  *root_camera is based on the program "camera"of Jose Carlos
    460  *Gonzalez. It was changed in the way that only the pixelisation
    461  *and the distibution of the phe to the FADCs works in a
    462  *first version.
    463  *
    464  *Using the #undef command most possibilities of the orignal
    465  *program are switched of.
    466  *
    467  *The new parts are signed by
    468  *
    469  *- ROOT or __ROOT__
    470  *  nearly all  important codelines for ROOT output are enclosed
    471  *  in structures like
    472  *  #ifdef __ROOT__
    473  * 
    474  *    code
    475  *
    476  *  #endif __ROOT__
    477  *
    478  *  In same case the new lines are signed by a comment with the word
    479  *  ROOT in it.
    480  *
    481  *  For timing of the pulse some variable names are changed.
    482  *  (t0, t1, t  -->  t_ini, t_fin, t_1st, t_chan,...)
    483  *  Look also for this changes.
    484  *
    485  *  For the new root-file is also a change in readparm-files
    486  *
    487  *
    488  *- __DETAIL_TRIGGER__
    489  *
    490  *  This is for the implementation of the current work on trigger
    491  *  studies. Because the class MTrigger is not well documented it
    492  *  isn´t a part of this tar file. Only a dummy File exists.
    493  *
    494  *
    495  *
    496  *With all files in the archive, the root_camera program should run.
    497  *
    498  *A reflector file is in the directory rfl-files
    499  *
    500  *==================================================
    501  *
    502  *From now on, use CVS for development!!!!
    503  *
    504  *
    505  *
    506342 *Revision 1.3  1999/10/22 15:32:56  petry
    507343 *tidied-up version, really sent to H.K. and N.M., 22-10-99
Note: See TracChangeset for help on using the changeset viewer.