IDA> NTUPLE command parameter-list.
With the NTUPLE command you can make row-wise ntuples and fixed and variable column-wise ntuples. For full details on these ntuple concepts see the CERN HBOOK manual.
BANK CWATEST CONTEXT = TEST MAXID = 1 INTEGER NTOT REAL ENERGY REAL IP(3) ENDBANK
Here is the IDA code to make a five element column-wise ntuple consisting of an integer*4, NTOT, for the number of final state particles, a real*4, ENERGY, for the total energy of final state particles in the event and a fixed array, IP(3), of three real*4 for the x,y and z IP position of the event.
OPEN READ GENERATE CMDPROC NTUPLCMD PROCESSOR MCL74 CWATEST = _CWATEST(ADD) ! tell IDA about the template. NTUPLE EZcw "$scr:[grb]" CWATEST ! define the cw-ntuple based on ! CWATEST and write it to directory ! $scr:[grb]. DEF EVANAL CALL MCL74 J = 0 CWATEST%(ENERGY) = 0 BANKLOOP MCPART IF ^BTEST(MCPART%(ORIGIN),P%(MCPART,DECAYED)) & - ^BTEST(MCPART%(ORIGIN),P%(MCPART,PREFRAG)) J = J + 1 CWATEST%(ENERGY) = CWATEST%(ENERGY) + MCPART%(E) ENDIF ENDLOOP CWATEST%(NTOT) = J DO I = 1 TO 3 CWATEST%(IP(I)) = _MCHEAD%(IP(I)) ENDDO NTUPLE EZfill ! fill the ntuple from the bank. ENDDEF GO 200 NTUPLE EZend ! write the ntuple to disk at ! $scr:[grb]cwatest.rzdat.
The typical application for a variable ntuple would be properties of particles in an event where what varies is the number of particles per event. An example template definition would be
BANK CWVTEST CONTEXT = TEST MAXID = 1 INTEGER NPARTS REAL PX(300) REAL PY(300) REAL PZ(300) REAL E(300) ENDBANK
The first item in the bank is an integer element, NPARTS, which is the variable. All the other elements are arrays of the same fixed size which is the maximum value the variable element, NPARTS, can take. In this example, NPARTS is the number of final state particles per event and we are assuming that the largest value it will ever reach is no more than 300.
For each event in the event loop NPARTS will be set to the number of final state particles particles and the first NPARTS members of each array will be filled with values for each final state particle in the event. When the bank is read out every event into the ntuple only the first NPARTS elements in each array are kept thus producing a variable length ntuple. Sample code would be:
OPEN READ GENERATE CMDPROC NTUPLCMD PROCESSOR MCL74 CWVTEST = _CWVTEST(ADD) NTUPLE EZcwV "$scr:[grb]" CWVTEST ! NOTE: the NTUPLE command is EZCWV. DEF EVANAL CALL MCL74 J = 0 BANKLOOP MCPART IF ^BTEST(MCPART%(ORIGIN),P%(MCPART,DECAYED)) & - ^BTEST(MCPART%(ORIGIN),P%(MCPART,PREFRAG)) J = J + 1 CWVTEST%(E(J)) = MCPART%(E) CWVTEST%(PX(J)) = MCPART%(P(1)) CWVTEST%(PY(J)) = MCPART%(P(2)) CWVTEST%(PZ(J)) = MCPART%(P(3)) ENDIF ENDLOOP CWVTEST%(NPARTS) = J NTUPLE EZfill ENDDEF GO 200 NTUPLE EZend
The error message INCONAR means you are attempting to create a variable column-wise ntuple and not all of your arrays are of the same length.
If you get the error NOKEY it probably means you have not given enough parameters to the last NTUPLE command.
You may get the error message that you have run out of free contexts. This is probably because you have made several syntax errors in issuing NTUPLE commands or some other IDA command processor commands. The system eats up a limited resource when this happens and you need to start a new IDA session.
Note that the command sequences and arguments for creating row_wise ntuples using the Hxxx type of NTUPLE commands is somewhat different than that for column-wise ntuples. This is a reflection of the differences in the underlying calls to HBOOK for the two types of ntuples. To fully understand the meaning of the Hxxx type commands one should consult the HBOOK manual. The command names used by NTUPLE are virtually identical to those of HBOOK and the reader should have no trouble making the correlations.
! !!! Row-wise examples !! !! The template BANK RWTEST CONTEXT = TEST MAXID = 1 REAL ENERGY REAL NPARTS REAL IPX REAL IPY REAL IPZ ENDBANK !! !! EZrw example !! CMDPROC NTUPLCMD OPEN READ GENERATE RWTEST = _RWTEST(ADD) NTUPLE EZrw "$scr:[grb]" rwtest PROCESSOR MCL74 DEF EVANAL CALL MCL74 RWTEST%(NPARTS) = _MCHEAD%(NTOT) RWTEST%(IPX) = _MCHEAD%(IP(1)) RWTEST%(IPY) = _MCHEAD%(IP(2)) RWTEST%(IPZ) = _MCHEAD%(IP(3)) RWTEST%(ENERGY) = 0 BANKLOOP MCPART RWTEST%(ENERGY) = RWTEST%(ENERGY) + MCPART%(E) ENDLOOP NTUPLE EZfill ENDDEF GO 500 NTUPLE EZend !! !! Full syntax RW example !! CMDPROC NTUPLCMD OPEN READ GENERATE RWTEST = _RWTEST(ADD) NTUPLE Hlimit 500000 NTUPLE Hropen RWSAMPLE "$SCR:[GRB]MYRW.RZDAT" NQX 1024 NTUPLE Hbookn 10 "Event stuff" RWSAMPLE 1000 RWTEST PROCESSOR MCL74 DEF EVANAL CALL MCL74 RWTEST%(NPARTS) = _MCHEAD%(NTOT) RWTEST%(IPX) = _MCHEAD%(IP(1)) RWTEST%(IPY) = _MCHEAD%(IP(2)) RWTEST%(IPZ) = _MCHEAD%(IP(3)) RWTEST%(ENERGY) = 0 BANKLOOP MCPART RWTEST%(ENERGY) = RWTEST%(ENERGY) + MCPART%(E) ENDLOOP NTUPLE Hfn 10 ENDDEF GO 500 NTUPLE Hrout 10 NTUPLE Hrend RWSAMPLE !! !! !! Column-wise template !! BANK CWATEST CONTEXT = TEST MAXID = 1 REAL ENERGY INTEGER NPARTS REAL IP(3) ENDBANK !! !! EZcw example !! OPEN READ GENERATE CWATEST = _CWATEST(ADD) CMDPROC NTUPLCMD NTUPLE EZcw "$scr:[grb]" cwatest PROCESSOR MCL74 DEF EVANAL CALL MCL74 CWATEST%(NPARTS) = _MCHEAD%(NTOT) DO I = 1 TO 3 CWATEST%(IP(I)) = _MCHEAD%(IP(I)) ENDDO CWATEST%(ENERGY) = 0 BANKLOOP MCPART CWATEST%(ENERGY) = CWATEST%(ENERGY) + MCPART%(E) ENDLOOP NTUPLE EZfill ENDDEF GO 200 NTUPLE EZend !! !! !! Column-wise with full HBOOK syntax !! OPEN READ GENERATE CWATEST = _CWATEST(ADD) CMDPROC NTUPLCMD NTUPLE Hlimit 500000 NTUPLE Hropen CWASAMPL "$SCR:[GRB]MYCWA.RZDAT" NQX 1024 NTUPLE Hbnt 20 "Event Array Stuff" NTUPLE Hbname 20 CWATEST PROCESSOR MCL74 DEF EVANAL CALL MCL74 CWATEST%(NPARTS) = _MCHEAD%(NTOT) DO I = 1 TO 3 CWATEST%(IP(I)) = _MCHEAD%(IP(I)) ENDDO CWATEST%(ENERGY) = 0 BANKLOOP MCPART CWATEST%(ENERGY) = CWATEST%(ENERGY) + MCPART%(E) ENDLOOP NTUPLE HfnT 20 ENDDEF GO 200 NTUPLE Hrout 20 NTUPLE Hrend CWASAMPL !! !! !! Column-wise example with variable block and full syntax !! !! The template !! BANK CWVTEST CONTEXT = TEST MAXID = 1 INTEGER NPARTS REAL PX(300) REAL PY(300) REAL PZ(300) REAL E(300) ENDBANK !! !! The code !! OPEN READ GENERATE CWVTEST = _CWVTEST(ADD) CMDPROC NTUPLCMD NTUPLE Hlimit 500000 NTUPLE Hropen CWVSAMPL "$SCR:[GRB]MYCWV.RZDAT" NQX 1024 NTUPLE Hbnt 40 "Event CWV Stuff" NTUPLE HbnameV 40 CWVTEST PROCESSOR MCL74 DEF EVANAL CALL MCL74 CWVTEST%(NPARTS) = _MCHEAD%(NTOT) J = 0 BANKLOOP MCPART J = J + 1 CWVTEST%(E(J)) = MCPART%(E) CWVTEST%(PX(J)) = MCPART%(P(1)) CWVTEST%(PY(J)) = MCPART%(P(2)) CWVTEST%(PZ(J)) = MCPART%(P(3)) ENDLOOP NTUPLE HfnT 40 ENDDEF GO 200 NTUPLE Hrout 40 NTUPLE Hrend CWVSAMPL