// Example for simulation of CBC signals in S6a-VSR2 detectors data

This is an example on how to run a cWB simulation for coalescing intermediate 
mass black holes (IMBHs) in real HLV S6a-VSR2 data. 
Useful information on the cWB IMBH search can be found here: 
http://www.virgo.lnl.infn.it/Wiki/index.php/IMBH
(standard LVC collaboration password)


1) Creating working environment [ATLAS]

   source /home/waveburst/SOFT/WAT/trunk/atlas_watenv.csh  
    ( users can source their own installation instead of the one under /home/waveburst )
   mkdir DIR_NAME
   cd DIR_NAME
   cwb_mkdir .  (to be done in DIR_NAME)
   mkdir DIR_NAME/plugins


2) Editing files needed for the analysis

   cd DIR_NAME/input
   add files with data quality GPS starts and stops of the considered data set and the 
   lists of detectors frame files (see example)

   cd DIR_NAME/config
   edit user_parameters.C with the cWB parameters for the analysis (see example)


     cWB parameters specifically set for the IMBH search on advanced detectors
 
     a) search = 'I'        this enables the elliptical constraint, which should 
                            be considered when targeting coalescing binaries as 
                            emitted signals are elliptically polarized
     b) bpp   = 0.0001      this parameter was set one order of magnitude smaller 
                            than what is usually done for the all-sky burst search
     c) fLow  = 32.         the low frequency of the search is set to 32 Hz
     d) fHigh = 512 .       the higher frequency is set to 512 as no IMBH binary 
                            is expected to emit at higher frequency 
                            (in the considered parameter space)
     f) int levelR  = 4     downsample level to restrict the investigated frequency 
                            band below 512 Hz
     g) int nfactor = 16    16 factors are used to rescale the amplitudes and, 
                            therefore, the distances, of the injected signals. 
                            Factors are chosen to ensure that injections are uniformly 
                            distributed in volume in shells covering distances from 
                            1.7 Mpc to ~ 1.2 Gpc (factor 1 correspond to distances 
                            between 100 and 150 Mpc, set in CWB_Plugin_TestClassCBC_Config.C)
     h) double factors[]    chosen factor values

     i) strcpy(channelNamesRaw[0],"L1:LDAS-STRAIN");  channel name for Livingston data
     j) strcpy(channelNamesRaw[1],"H1:LDAS-STRAIN");  channel name for Hanford data
     k) strcpy(channelNamesRaw[2],"V1:h_16384Hz");    channel name for Virgo data
     l) strcpy(frFiles[0],"input/S6A_L1.frames");     list of frame files with Livingston data
     m) strcpy(frFiles[1],"input/S6A_H1.frames");     list of frame files with Hanford data
     n) strcpy(frFiles[2],"input/VSR2_V1.frames");    list of frame files with Virgo data
     o) dqfile dqf[nDQF]={
                {"L1" ,"input/S6A_OFFLINE_L1SCIENCE.txt",         CWB_CAT0, 0., false,  false},
                {"L1" ,"input/S6A_OFFLINE_L1_DQCAT1SEGMENTS.txt", CWB_CAT1, 0., true,   false},
                {"L1" ,"input/S6A_OFFLINE_L1_DQCAT2SEGMENTS.txt", CWB_CAT2, 0., true,   false},
                {"L1" ,"input/S6A_OFFLINE_L1_DQCAT4SEGMENTS.txt", CWB_CAT1, 0., true,   false},
                {"H1" ,"input/S6A_OFFLINE_H1SCIENCE.txt",         CWB_CAT0, 0., false,  false},
                {"H1" ,"input/S6A_OFFLINE_H1_DQCAT1SEGMENTS.txt", CWB_CAT1, 0., true,   false},
                {"H1" ,"input/S6A_OFFLINE_H1_DQCAT2SEGMENTS.txt", CWB_CAT2, 0., true,   false},
                {"H1" ,"input/S6A_OFFLINE_H1_DQCAT4SEGMENTS.txt", CWB_CAT1, 0., true,   false},
                {"V1" ,"input/S6A_OFFLINE_V1SCIENCE.txt",         CWB_CAT0, 0., false,  false},
                {"V1" ,"input/S6A_OFFLINE_V1_DQCAT1SEGMENTS.txt", CWB_CAT1, 0., true,   false},
                {"V1" ,"input/S6A_OFFLINE_V1_DQCAT2SEGMENTS.txt", CWB_CAT2, 0., true,   false},
                {"V1" ,"input/S6A_OFFLINE_V1_DQCAT4SEGMENTS.txt", CWB_CAT1, 0., true,   false}
               }; 


   cd DIR_NAME/plugins
   edit CWB_Plugin_TestClassCBC.C   (see example)    
   edit CWB_Plugin_TestClassCBC_Config.C with the parameter space investigated 
        by the analysis and the distributions of the injections parameters  (see example)


          Options in CWB_Plugin_TestClassCBC_Config.C:
          
          a) --time-step         time unit containing one injection
          b) --time-interval     time interval to distribute the signal peak time at 
                                 different moments within the considered --time-step
          c) --l-distr           set the source location distribution
          d) --gps-start-time    GPS start
          e) --gps-end-time      GPS stop
          f) --d-distr           set the distance distribution of injections 
          g) --m-distr           set the mass distribution of injections 
          h) --i-distr           set the inclination distribution
          i) --f-lower           initial frequency of injected signals
          j) --min-mtotal        minimum total mass value (in solar masses)
          k) --max-mtotal        maximum total mass value (in solar masses)
          l) --min-mratio        minimum mass ratio 
          m) --max-mratio        maximum mass ratio
          n) --min-distance      minimum distance at which injections are located 
          o) --max-distance      maximum distance at which injections are located
          p) --waveform          injected waveform family
          q) --disable-spin      disables spinning injections  
                                 (--enable-spin if wanting spinning compact objects)
          r) --taper-injection   taper the inspiral template
          s) --seed              initial MonteCarlo seed

          If wanting spinning compact objects, replace q) with

          t) --enable-spin  
          u) --aligned           enforces the spins to be along the direction 
                                 of orbital angular momentum.
          v) --min-spin1         Set the minimum spin1 
          w) --max-spin1         Set the maximum spin1 
          x) --min-spin2         Set the minimum spin2 
          y) --max-spin2         Set the maximum spin2 

          and p) with a waveform family valid for spinning binaries 


3) Creation of files for jobs submission

   cwb_condor create (to be done in DIR_NAME)
   cd DIR_NAME/condor
   condor_submit_dag DIR_NAME.dag


4) Once jobs have been processed

   cwb_merge M0 (to be done in DIR_NAME)
