Ntuple instruction
Ntuple creation in ENGINE
Ntuple is created under the directory e05115src/ENGINE. You can find some files about ntuple creation. For example, if you want to some analysis about KHODO, you may need to modify following files;
h_scin_ntuple_keep.f h_scin_ntuple_init.f h_scin_ntuple_shutdown.f
In these three files, "h_scin_ntuple_shutdown.f" is just doing closing procedure. So, user should modify "h_scin_ntuple_keep.f" and "h_scin_ntuple_init.f".
h_scin_ntuple_init.f
This file initialize the ntuple. In this file, user should modify following parts.
(For raw data ntuple) 111 if(h_debugnt(2).eq.1) then 112 *-- put contents here. 113 m= 0 114 m= m+1 115 h_scin_ntuple_tag(m)= 'grun' ! 1 116 m= m+1 117 h_scin_ntuple_tag(m)= 'gevent' ! 2 118 m= m+1 119 h_scin_ntuple_tag(m)= 'tothits' ! 3 total hits 120 m= m+1 121 h_scin_ntuple_tag(m)= 'la' ! 4 layer 122 m= m+1 123 h_scin_ntuple_tag(m)= 'co' ! 5 counter 124 m= m+1 125 h_scin_ntuple_tag(m)= 'adcpr' ! 6 raw adc+ 126 m= m+1 127 h_scin_ntuple_tag(m)= 'adcnr' ! 7 raw adc- 128 m= m+1 129 h_scin_ntuple_tag(m)= 'tdcpr' ! 8 raw tdc+ 130 m= m+1 131 h_scin_ntuple_tag(m)= 'tdcnr' ! 9 raw tdc-
(For decoded data ntuple) 156 if(h_debugnt(2).eq.2) then 157 *-- put contents here. 158 m= 0 159 m= m+1 160 h_scin_ntuple_tag(m)= 'grun' ! 1 161 m= m+1 162 h_scin_ntuple_tag(m)= 'gevent' ! 2 163 m= m+1 164 h_scin_ntuple_tag(m)= 'tothits' ! 3 total hits 165 m= m+1 166 h_scin_ntuple_tag(m)= 'la' ! 4 layer 167 m= m+1 168 h_scin_ntuple_tag(m)= 'co' ! 5 counter 169 m= m+1 170 h_scin_ntuple_tag(m)= 'adcpd' ! 6 dec adc+ 171 m= m+1 172 h_scin_ntuple_tag(m)= 'adcnd' ! 7 dec adc- 173 m= m+1 174 h_scin_ntuple_tag(m)= 'timep' ! 8 time+ 175 m= m+1 176 h_scin_ntuple_tag(m)= 'timen' ! 9 time- 177 m= m+1 178 h_scin_ntuple_tag(m)= 'time' ! 10 time
This part specifies the name of entry in Ntuple. You can name entries as you like.
Here, "h_debugnt(*)" is a flag specified by "e05115replay/PARAM/hdebug.param.0".
Now h_debugnt(2)=1 allow to create raw data ntuple and h_debugnt(2)=2 allow to create decoded data ntuple.
Also you can see the variable h_debugnt(1) in the file, this value is a flag to select Row Wise Ntuple (RWN) or Column Wise Ntuple (CWN). In this section, RWN is assumed to be used.
h_scin_ntuple_keep.f
This file put values into the corresponding Ntuple entry.
49 if(h_debugnt(2).eq.1) then 50 Do i=1,hscin_raw_tot_hits 51 m= 0 52 m= m+1 53 h_scin_ntuple_contents(m)= gen_run_number ! 1 54 m= m+1 55 h_scin_ntuple_contents(m)= gen_event_ID_number ! 2 56 m= m+1 57 h_scin_ntuple_contents(m)= hscin_raw_tot_hits ! 3 58 m= m+1 59 h_scin_ntuple_contents(m)= hscin_raw_layer_num(i) ! 4 60 m= m+1 61 h_scin_ntuple_contents(m)= hscin_raw_counter_num(i) ! 5 62 m= m+1 63 h_scin_ntuple_contents(m)= hscin_raw_adc_pos(i) ! 6 64 m= m+1 65 h_scin_ntuple_contents(m)= hscin_raw_adc_neg(i) ! 7 66 m= m+1 67 h_scin_ntuple_contents(m)= hscin_rawtdc_pos_sub_trig(i) ! 8 68 m= m+1 69 h_scin_ntuple_contents(m)= hscin_rawtdc_neg_sub_trig(i) ! 70 71 72 * Fill ntuple for this event 73 ABORT= .NOT.HEXIST(h_scin_ntuple_ID) 74 IF(ABORT) THEN 75 call G_build_note(':Ntuple ID#$ does not exist', 76 & '$',h_scin_ntuple_ID,' ',0.,' ',err) 77 call G_add_path(here,err) 78 ELSE 79 call HFN(h_scin_ntuple_ID,h_scin_ntuple_contents) 80 ENDIF 81 EndDo ! hscin_raw_tot_hits
User should specify the value filled into the Ntuple. You may not be able to find the correct value, in that case you have to look into header file or source code or ask someone.
In this case, Ntuple entries are filled by hscin_raw_tot_hits, not event# or tracking#. So, if you want to calculate TOF from these values, that is not straightforward. You may want to add if statement below the Ntuple filling part as following;
do i=1,hscin_raw_tot_hits la=hscin_raw_layer_num(i) co=hscin_raw_counter_num(i) if (la.eq.1) then adc1xp(co)=hscin_raw_adc_pos(i) adc1xn(co)=hscin_raw_adc_neg(i) adc1xp(co)=hscin_rawtdc_pos_sub_trig(i) adc1xn(co)=hscin_rawtdc_neg_sub_trig(i) else if (la.eq.2) then adc1yp(co)=hscin_raw_adc_pos(i) adc1yn(co)=hscin_raw_adc_neg(i) adc1yp(co)=hscin_rawtdc_pos_sub_trig(i) adc1yn(co)=hscin_rawtdc_neg_sub_trig(i) else if (la.eq.3) then adc2xp(co)=hscin_raw_adc_pos(i) adc2xn(co)=hscin_raw_adc_neg(i) adc2xp(co)=hscin_rawtdc_pos_sub_trig(i) adc2xn(co)=hscin_rawtdc_neg_sub_trig(i) endif (fill ntuple ...) enddo
You can do the same analysis using PAW or ROOT. But be careful that this statement will overwrite the variable if a counter has a multihit.