   How to define new volume shape:

      The user can define an arbitrary volume shape by specifying 
   it as 'new-x' where x is 1 to 15. (If not enough, it's easy
   to expand this up to 99 by changing the value of MAX_NEW_STRUC in
   ZepMaxdef.h.

     'new-1' etc just correspond to 'box', 'pipe' etc.  You can
    paraphrase 'new-1' etc by an arbitrary name provided that
    the name does not start with the the same one predefined in Epics,
    nor the one used as a sub-detector name. (case insensitive).
    For example, you may give 

      #paraphrase  'new-1' cap  

    in the configuraion file. Then, after this statatement
    you can use 'cap' instead of 'new-1' everywhere.  You can
    use

      #paraphrase  'new-1' skewbox
 
    or 

      #paraphrase  'new-1' skew_box

    etc, but not

      #paraphrase  'new-1' boxskew

    etc,   since 'box'  is a predefined name.	

    As an example of how to create such a volume shape
   'new-1' is already included Epics. The 'new-1' is to represent
    a shape like a cap; it is a shell like structure (see
    a separate figure).  You have to create few routines and
    modify epNewVolume.f in UserHook for that.

      Among them, most tough task is to create the one to give the distance
    to the boundary of the volume from a given point with a given direction.  
    (If the logic is clear, program coding will  need only 30 min or so
     though).
      
       You can see an example in ep_cap.f as follows.
    eprCap:  Interface to read configuration data for cap
    epbCap:  To find the distnace to the boundary (tough one)
    epsCap:  To judge that a given point is inside or outside of
             of the volume
    epenvlpCap: To give the orign and 3 edge lengths of a box
               which envelops the component (i.e.,cap).
    epthickCap: To give the z-direction thickness of the volume.

       Just a similar example is also seen in ep_ecyl.f for the elipic
    cylinder.

      After completing these routines, you have to modiy  epNewVolume.f
    to call each of these routines.

       This is very simple.  If you give 'new-1' etc in the configuration
    file, you must use the following type of statement:

        elseif(comp.struc .eq. 'new-1') then
	   call ...

    If you paraphrase 'new-1' etc, say, as 'skewbox', then you must use

	elseif(comp.struc .eq.  'skewbox') then
           call ...



      When paraphrasing a new volume shape, you need not use 'new-1',
    'new-2' etc consecutively.   You may use
 
        #paraphrase  new-10 skewbox

     without using new-1 to new-9.


      As mentioned earlier, it will sometimes take long time to test
     your logic for finding the length to the boundary of a volume 
     from a given point with a given direction. (Even for a cylinder,
     you need rather a  complicated coding although it may look
     easy at first sight.)

       To ease the work, you can use testCnf2.f in the Util directory.
     (testCnf1.f is for testing only the format of a configuration 
      file).  The program tests all new routines including epNewVolume.
     For the test, we generate random  points uniformly within a 
     volume bit larger than the world size of the given detector
     configuration.  You can use two different tests:

     A) The direction cosines are generated from the

         1) isotropic distribution 

	or

         2) parallel to the x, y,or z axis. 

         Then, get the  length from each of such points to the boundary of
      a specified volume, and compute the bounary (x, y, z) in the
      world coordinate.  These (x, y, z) are put in the standard 
      output.  You can plot (x, y, z)  on the screen and see what your
      program has done.  In the debuging mode, you may deifine DEBUG
      in epics/Zepdebug.h and use 'debug' integer variable for extra
      comunication between testCnf2 and your program in which you may
      give an appropriate value to 'debug' depending on the condition.
      In the debuging mode,  the condtion code from the epbNeW and the
      'debug' integer variable are also put in the standard output, thus
      enabling you to classify the (x, y, z) by these two additional
      parameters.  (If a volume is  partially contained by another volume,
      the relation is disregarded at this stage).

     B) Random points are generated as in the case of A), and
      eppos2cn is called to find the component number in which
      each of these point is contained.  Along with the points,
      the component number and condition code from eppos2cn  is
      put in the standard output.   
          condition code = 0 if the point is contained in
              some volume else 1
          component number > max number of components, if 
              condition code is 1.  
        
	In this test, you need a world box, if the outer
      most volume is not a box.  You may display the points
      and component numbers and see which point belongs which
      which component.  Partially contained volmues are  regarded
      correctly.
      
Usage:
   1) Give some data in testcnfig so that it includes new volume shape(s).
   2) Change testCnf2.mk so that it includes your new routine name
      which corresponds ep_cap.o. 
   3) make -f testCnf2.mk
   4) a.out >  output_file
   
     You will be asked to enter,
       *  test A (boundary test)  or B (inout test)
       *  number of points  to be generated
       *  isotropic angles or pallalel to x,y,z angles
       *  Component number

	The last two are relvant only to test A).



