a
    zn„fÈ@ ã                   @  sò   d Z ddlmZ ddlmZ ddlZddlZddlZddl	Zddl
Zdd„ Zdd„ Zd	d
„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zd:dd„Zd;dd„Zdd„ Zd<d&d'„Zd=d.d/„Zd>d0d1„Zd?d2d3„Zd@d4d5„ZdAd6d7„ZdBd8d9„ZdS )Ca  
This module defines a series of rules for identifying Python objects that can be written
to ROOT files and preparing them for writing.

The :doc:`uproot.writing.identify.add_to_directory` function is the most general in that
it recognizes data that could be converted into a TTree or into a normal object. It also
adds the data to a :doc:`uproot.writing.writable.WritableDirectory`.

The :doc:`uproot.writing.identify.to_writable` function recognizes all static objects
(everything but TTrees) as a series of rules, returning a :doc:`uproot.model.Model`
but not adding it to any :doc:`uproot.writing.writable.WritableDirectory`.

The (many) other functions in this module construct writable :doc:`uproot.model.Model`
objects from Python builtins and other writable models.
é    )Úannotations)ÚMappingNc                 C  s´  d}t j | d¡rFddl}t| |jƒrFt j |¡| jƒrFt jj	 
| ¡} t j | d¡rpddl}t| |jƒrpd| i} t| tjƒr–| jjdur–t jj	 | ¡} t| tƒ�râtdd„ | D ƒƒ�râi }i }|  ¡ D �]\}	}
t j |
d¡�rddl}t|
|jƒ�rt jj	 
|
¡}
t|
tjƒ�r.|
jjdu�r.t jj	 |
¡}
t|
tƒ�røtd	d„ |
D ƒƒ�røi }i }|
 ¡ D ]†\}}zt j |¡}W n. t�y¤   td
t|
ƒ› d|	›�ƒd‚Y n0 |||< |j}|jdd… }|dk�rÚt ||f¡}|||< �q^|||	< |||	< qÆt j |
d¡�r|
||	< |
j||	< qÆzt j |
¡}
W nr t�yž   t j ¡ }z| |
¡}
W n. t�y‚   td
t|
ƒ› d|	›�ƒd‚Y n0 |
||	< | |
¡||	< Y qÆ0 |
||	< |
j}|
jdd… }|dk�rÔt ||f¡}|||	< qÆd}|�r | ||¡}| |¡ n°t| ƒ}|jD ]2}t|t ƒ�r4| !t jj"j#|Ž ¡ n
| !|¡ �q|j$|d�}t j% &||j'j%¡}t(|dƒ�rt|j)}n| *d¡�rŒ| +d¡}nd}|j, -|j'j.|j/|||t0|ƒ¡ dS )a.  
    Args:
        obj: Object to attempt to recognize as something that can be written to a
            ROOT file.
        name (str or None): Name to assign to the writable object.
        directory (:doc:`uproot.writing.writable.WritableDirectory`): Directory to
            add the object to, if successful.
        streamers (list of :doc:`uproot.streamers.Model_TStreamerInfo`, :doc:`uproot.writable._cascade.RawStreamerInfo`, or constructor arguments for the latter): Collects
            streamers to add to the output file so that all objects in it can be read
            in any version of ROOT.

    This function performs two tasks: it attempts to recognize ``obj`` as a writable
    object and, if successful, writes it to a ``directory``.

    It can recognize dynamic TTrees and static objects such as histograms. For only
    static objects, without the additional concern of writing the resulting object
    in a ``directory``, see :doc:`uproot.writing.identify.to_writable`.

    Raises ``TypeError`` if ``obj`` is not recognized as writable data.
    FÚpandasr   NÚawkwardÚ c                 s  s   | ]}t |tƒV  qd S ©N©Ú
isinstanceÚstr©Ú.0Úx© r   úZ/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/uproot/writing/identify.pyÚ	<genexpr>F   ó    z#add_to_directory.<locals>.<genexpr>c                 s  s   | ]}t |tƒV  qd S r   r   r   r   r   r   r   [   s   zunrecognizable array type z associated with é   r   T©ÚnameÚfTitle)1ÚuprootZ_utilZfrom_moduler   r	   Z	DataFrameZpandas_has_attr_is_numericÚindexÚwritingZ_cascadetreeZdataframe_to_dictr   ZArrayÚnumpyÚndarrayÚdtypeÚfieldsZrecarray_to_dictr   ÚallÚitemsZensure_numpyÚ	TypeErrorÚtypeÚshapeÚextrasZ	from_iterÚ	ExceptionZmktreeÚextendÚto_writableZclass_rawstreamersÚtupleÚappendZ_cascadeZRawStreamerInfoÚ	serializeÚcompressionÚcompressÚfileÚhasattrr   Z
has_memberÚmemberZ
_cascadingÚ
add_objectZsinkÚ	classnameÚlen)Úobjr   Ú	directoryZ	streamersZis_ttreer   r   ÚdataÚmetadataÚbranch_nameZbranch_arrayZdatumZ	metadatumÚkkÚvvZbranch_dtypeZbranch_shapeÚtreeÚwritableZrawstreamerZuncompressed_dataZcompressed_dataÚtitler   r   r   Úadd_to_directory   sØ    ÿþ ÿ
ÿ
þÿÿ

ÿÿþ

ÿ
ÿÿþ


ÿúr;   c           )        sT  t ˆttfƒ�r$dtˆƒ  kr*dk�r$n nöt ˆd tjƒ�r$t ˆd ttfƒ�r$dtˆd ƒ  krrdk�r$n n®t ˆd d tjƒ�r$t ˆd d tjƒ�r$tˆd ƒdksÈt ˆd d tjƒ�r$tdd„ ˆd D ƒƒ�r$tˆd jƒtˆd ƒk�r$ˆd gtˆd ƒ¢tˆdd… ƒ¢R ‰t ˆtj	j
ƒ�r<ˆ ¡ S tˆƒjdk�r†ddl}t ˆ|jƒ�rntj ˆ¡S td	tˆƒj› �ƒ‚�nÊt ˆtƒ�rštˆƒS tˆd
ƒ�rtˆdƒ�rtˆdƒ�rtˆdƒ�rtˆdƒ�rd‰ tˆƒjdk�stˆƒj d¡�stˆƒjdk�stˆƒj d¡�r&ddl‰ ˆjdk�rFˆjdk�rFtdƒ‚tˆjƒ}d|  k�rhdk�srn tdƒ‚tˆdtˆddƒƒ}|du �r”d}ztˆjdd�}ˆ du �s¼ˆjˆ jj k�rÈˆj!dd�nd}ˆjdd�}t"|j|jƒD ]\}}||d k�ræt‚�qæW �nè t�yð   ˆ ¡ }	|	j}
|	j# $d¡}|dk�r`tj%|
d d |d�}|	|dd…< n’|dk�r¢tj%|
d d |
d d f|d�}|	|dd…dd…f< nP|dk�ròtj%|
d d |
d d |
d d f|d�}|	|dd…dd…dd…f< ˆ du �sˆjˆ jj k�rˆ !¡ nd}	d}|	du�rì|	j}
|dk�rZtj%|
d d d d�}|	|dd…< n’|dk�rœtj%|
d d |
d d fd d�}|	|dd…dd…f< nP|dk�rìtj%|
d d |
d d |
d d fd d�}|	|dd…dd…dd…f< Y n(0 | &|j# $d¡¡}|du�r| &d ¡}|du�r4|j|jk�s4J ‚|j' (d¡}|du�rV|j' (d¡}| )¡ }‡ ‡fd!d"„t"ˆjg d#¢ƒD ƒ}t|ƒdk�rÞˆjdk�r˜tˆd$ƒ�r&d%ˆj* +¡ v �rÀˆj*d% }ntd&ˆ› �ƒ‚t,d|ˆjdd�ˆj-d ˆ )¡ d' ˆ )¡ d( dddd|ˆj.dd�t /g tj0¡|d d)�S t,d|ˆj1d j1d ˆ 2d*¡ˆ 2d+¡ˆ 2d,¡ˆ 2d-¡ˆ 2d.¡ˆ 2d/¡ˆ 2d0¡ˆ 2d%¡ˆ 2d1¡ˆ 2d2¡|d d)�S nBt3ˆjdd�ˆjd j4ƒ\}}}}t5d|||||||||d d3�
S �qPt|ƒdk�rbˆjdk�rt6d4ƒ‚n^t7ˆjdd�ˆjd j4ˆjd j4ƒ\}}}}}}}t8d||||||||||||d |d d5�S n¢t|ƒdk�rPˆjdk�r†t6d6ƒ‚n~t9ˆjdd�ˆjd j4ˆjd j4ˆjd j4ƒ\}}}}}}}}}}}t:d||||||||||||||||d |d |d d7�S �nHt ˆttfƒ�r>dtˆƒ  k�r4d8k�r>n �ntd9d„ ˆdd… D ƒƒ�r>t ˆd tjtfƒ�r>tˆd jƒt)d:d„ ˆdd… D ƒƒk�r>td;d„ ˆdd… D ƒƒ�r>t ˆd tƒ�rÚˆdd… ˆd  ‰}nd}tˆƒdk�	rÄˆ\}}tj;t|ƒd d d�}||dd…< d|d< d|d< | )¡ }t3||ƒ\}}}}t|ƒd }|d |d  }}t <|t =||t|ƒ|j#¡¡�	rŽtj>g d d�}n
| &d ¡}t5d|||||||dt?d<d||||d=�d3�
S tˆƒdk�r8ˆ\}}} | )¡ }t7||| ƒ\}}}}}}}tj%|jd d |jd d fd d�}||dd…dd…f< |j' (d¡}t|ƒd }!|d |d  }}t <|t =||t|ƒ|j#¡¡�
r’tj>g d d�}n
| &d ¡}t| ƒd }"| d | d  }#}$t <| t =|#|$t| ƒ| j#¡¡�
rêtj>g d d�} n
|  &d ¡} t8d||||||||||dt?d<d|!|||d=�t?d>d|"|#|$| d=�d5�S tˆƒd?k�rPˆ\}}} }%| )¡ }t9||| |%ƒ\}}}}}}}}}}}tj%|jd d |jd d |jd d fd d�}||dd…dd…dd…f< |j' (d¡}t|ƒd }!|d |d  }}t <|t =||t|ƒ|j#¡¡�r$tj>g d d�}n
| &d ¡}t| ƒd }"| d | d  }#}$t <| t =|#|$t| ƒ| j#¡¡�r|tj>g d d�} n
|  &d ¡} t|%ƒd }&|%d |%d  }'}(t <|%t =|'|(t|%ƒ|%j#¡¡�rÔtj>g d d�}%n
|% &d ¡}%t:d||||||||||||||dt?d<d|!|||d=�t?d>d|"|#|$| d=�t?d@d|&|'|(|%d=�d7�S ntdAtˆƒj ƒ‚dS )Baã  
    Converts arbitrary Python object ``obj`` to a writable :doc:`uproot.model.Model`
    if possible; raises ``TypeError`` otherwise.

    This function is a series of rules that defines what Python data can or cannot be
    written to ROOT files. For instance, a 2-tuple of NumPy arrays with the appropriate
    dimensions is recognized as a histogram, since NumPy's ``np.histogram`` function
    produces such objects.

    This series of rules is expected to grow with time.
    é   é   r   r   c                 s  s   | ]}t |jƒd kV  qdS ©r   N)r0   r!   r   r   r   r   r   Ï   r   zto_writable.<locals>.<genexpr>Nz	cppyy.gblz7only instances of TObject can be written to files, not ÚaxesÚkindÚvaluesÚ	variancesÚcountsÚboost_histogramzboost_histogram.Úhistzhist.ZCOUNTZMEANzNPlottableHistogram can only be converted to ROOT TH* if kind='COUNT' or 'MEAN'zcPlottableHistogram can only be converted to ROOT TH* if it has between 1 and 3 axes (TH1, TH2, TH3)r:   r   r   T)ÚflowFú>©r   éÿÿÿÿú>f8c                   sR   g | ]J\}}t |t|d tˆddƒƒt|ƒ|jd |jd t|ˆ ƒt|ˆ ƒd�‘qS )Úlabelr   r   r   rI   )ÚfNamer   ÚfNbinsÚfXminÚfXmaxÚfXbinsÚfLabels)Úto_TAxisÚgetattrr0   ÚedgesÚ_fXbins_maybe_regularÚ_fLabels_maybe_categorical)r   ÚaxisÚdefault_name©rD   r1   r   r   Ú
<listcomp>K  s   
÷ùzto_writable.<locals>.<listcomp>)ÚxaxisÚyaxisÚzaxisÚstorage_typeÚfSumw2zfSumw2 has not been set for Zsum_of_weightsZsum_of_weights_squared)rL   r   r3   ÚfEntriesÚfTsumwÚfTsumw2ÚfTsumwxÚfTsumwx2ÚfTsumwyÚfTsumwy2r_   ÚfBinEntriesÚ	fBinSumw2ÚfXaxisr`   ra   rb   rc   rd   re   rf   rg   rh   )
rL   r   r3   r`   ra   rb   rc   rd   r_   ri   zP2D PlottableHistogram with kind='MEAN' (i.e. 2D profile plots) not supported yet)rL   r   r3   r`   ra   rb   rc   rd   re   rf   ÚfTsumwxyr_   ri   ÚfYaxiszP3D PlottableHistogram with kind='MEAN' (i.e. 3D profile plots) not supported yet)rL   r   r3   r`   ra   rb   rc   rd   re   rf   rj   ÚfTsumwzÚfTsumwz2ÚfTsumwxzÚfTsumwyzr_   ri   rk   ÚfZaxisé   c                 s  s   | ]}t |tjƒV  qd S r   )r	   r   r   r   r   r   r   r   å  r   c                 s  s   | ]}t t|tjƒƒV  qd S r   )Úintr	   r   r   r   r   r   r   r   ç  r   c                 s  s(   | ] }t |tjƒrt|jƒd kV  qdS r>   )r	   r   r   r0   r!   r   r   r   r   r   è  r   r[   )rL   r   rM   rN   rO   rP   r\   é   r]   z4unrecognized type cannot be written to a ROOT file: )@r	   r&   Úlistr0   r   r   r   r!   r   ÚmodelÚModelr%   r    Ú
__module__ÚROOTÚTObjectZpyrootZ_PyROOTWritabler   Ú__name__r
   Úto_TObjStringr,   Ú
startswithrD   r@   Ú
ValueErrorr?   rS   rA   r^   ZstorageZWeightrB   Úzipr   ÚnewbyteorderZzerosÚastypeÚTZreshapeÚsumr4   ÚkeysÚto_TProfileÚsizerC   ZasarrayÚfloat64Ú_basesr-   Ú_root_stats_1drT   Úto_TH1xÚNotImplementedErrorÚ_root_stats_2dÚto_TH2xÚ_root_stats_3dÚto_TH3xÚemptyÚallcloseÚlinspaceÚarrayrR   ))r1   rx   Úndimr:   r3   r_   Zdata_noflowrF   ZnoflowÚtmpÚsÚdr`   r?   ra   rb   rc   rd   re   rf   rj   rl   rm   rn   ro   ÚentriesrT   Z	with_flowrM   rN   rO   ÚxedgesÚyedgesZfXaxis_fNbinsZfYaxis_fNbinsÚfYminÚfYmaxÚzedgesZfZaxis_fNbinsÚfZminÚfZmaxr   rY   r   r%   ¹   sŒ   ÿþþýüûûúùøø	÷
ö(ÿÿþýüûÿþýüÿ
ÿ
ÿþü

"
,ÿþü


"
, 




ö



òòÿö
ÿÿøòÿ



üôí
ÿþ
þýü&ûúÿ
úö
	
øÿÿ
ÿ
úúëô&þÿ
ÿ
ÿ
úúúß,ÿr%   c              	   C  sŽ   |d u rX| j }|d |d  }}t |t ||t|ƒ|j¡¡rLtjg dd�S | d¡S n2t| |j	j
ƒr„t| dd ƒd u r„tjg dd�S | j S d S )Nr   rI   rJ   rH   Z	transform)rT   r   r�   r‘   r0   r   r’   r€   r	   rW   ZRegularrS   )rW   rD   rT   rN   rO   r   r   r   rU   Á  s    ÿþrU   c              	   C  s¾   |d u rd S t | |jj|jjfƒs&d S dd„ | D ƒ}t | |jjƒr‚|D ]:}zt|ƒ W qF ty~   td|›d| ›�ƒd ‚Y qF0 qFtdd„ |D ƒƒ}t|ƒD ]\}}|d |jd j	d< qœ|S )	Nc                 S  s   g | ]}t |ƒ‘qS r   )r
   ©r   rK   r   r   r   rZ   Ü  r   z._fLabels_maybe_categorical.<locals>.<listcomp>z1IntCategory labels must be valid integers. Found z	 on axis c                 S  s   g | ]}t |ƒ‘qS r   )r{   rŸ   r   r   r   rZ   ç  r   r   r   z
@fUniqueID)
r	   rW   ZIntCategoryZStrCategoryrr   r}   Úto_THashListÚ	enumerater‡   Ú_members)rW   rD   ÚlabelsrK   Úir   r   r   rV   Ó  s*    ÿÿþ
rV   c                 C  sP   |d d… |dd …  d }|   ¡  }}| |   ¡ }| |d    ¡ }||||fS ©NrI   r   ç       @r<   )r‚   )r—   rT   Zcentersra   rb   rc   rd   r   r   r   rˆ   ï  s
    rˆ   c                 C  s¤   |d d… |dd …  d }|d d… |dd …  d }|   ¡  }}| j|   ¡ }| j|d    ¡ }| |   ¡ }	| |d    ¡ }
| | j|   ¡ }|||||	|
|fS r¥   )r‚   r�   )r—   r˜   r™   ÚxcentersÚycentersra   rb   rc   rd   re   rf   rj   r   r   r   r‹   ù  s    r‹   c                 C  s>  |d d… |dd …  d }|d d… |dd …  d }|d d… |dd …  d }|   ¡  }}t | d¡|   ¡ }	t | d¡|d    ¡ }
t | d¡|   ¡ }t | d¡|d    ¡ }| |   ¡ }| |d    ¡ }t t | d¡| d¡|   ¡ }t | | d¡|   ¡ }t | | d¡|   ¡ }|||	|
|||||||fS )NrI   r   r¦   )r   r<   r   r<   )r<   r   r   )r‚   r   Z	transpose)r—   r˜   r™   rœ   r§   r¨   Zzcentersra   rb   rc   rd   re   rf   rl   rm   rj   rn   ro   r   r   r   r�     s8    ÿÿõr�   c                 C  sF   t jj t| ƒ¡}d|_d|_d|_d|_i |_	g |_
d|_d|_|S )zŒ
    This function is for developers to create TString objects that can be
    written to ROOT files, to implement conversion routines.
    TN)r   ÚmodelsÚTStringÚModel_TStringr
   Ú_deeply_writableÚ_cursorÚ_fileÚ_parentr¢   r‡   Ú
_num_bytesÚ_instance_version)ÚstringZtstringr   r   r   Ú
to_TString%  s    r³   c                 C  sl   t jjj ¡ }t jj t| ƒ¡}d|_d|_	d|_
i |_|f|_t| ƒt| ƒdk rVdnd d |_d|_|S )z�
    This function is for developers to create TObjString objects that can be
    written to ROOT files, to implement conversion routines.
    TNéÿ   r   rq   é   )r   r©   ry   ÚModel_TObjectr�   Z
TObjStringZModel_TObjStringr
   r¬   r­   r¯   r¢   r‡   r0   r°   r±   )r²   ÚtobjectZ
tobjstringr   r   r   r{   6  s    "r{   r   c                 C  s–   t dd„ | D ƒƒstdƒ‚tjjj ¡ }tjjj ¡ }|j	 
|¡ ||jd< t| ƒ|_t|jƒ|jd< dgt|jƒ |_t dd„ |jD ƒƒr’d|_|S )	a&  
    Args:
        data (:doc:`uproot.model.Model`): Python iterable to convert into a TList.
        name (str): Name of the list (usually empty: ``""``).

    This function is for developers to create TList objects that can be
    written to ROOT files, to implement conversion routines.
    c                 s  s   | ]}t |tjjƒV  qd S r   ©r	   r   ru   rv   r   r   r   r   r   Q  r   zto_TList.<locals>.<genexpr>zFlist to convert to TList must only contain ROOT objects (uproot.Model)rL   ZfSizer   c                 s  s   | ]}|j V  qd S r   )r¬   r   r   r   r   r   _  r   T)r   r   r   r©   ry   r¶   r�   ÚTListÚModel_TListr‡   r'   r¢   rt   Ú_datar0   Ú_optionsr¬   )r3   r   r·   Útlistr   r   r   Úto_TListH  s    	ÿ

r¾   c                 C  sB   t dd„ | D ƒƒstdƒ‚t| |ƒ}tjjj ¡ }|j 	|¡ |S )a.  
    Args:
        data (:doc:`uproot.model.Model`): Python iterable to convert into a THashList.
        name (str): Name of the list (usually empty: ``""``).

    This function is for developers to create THashList objects that can be
    written to ROOT files, to implement conversion routines.
    c                 s  s   | ]}t |tjjƒV  qd S r   r¸   r   r   r   r   r   o  r   zto_THashList.<locals>.<genexpr>zJlist to convert to THashList must only contain ROOT objects (uproot.Model))
r   r   r¾   r   r©   Z	THashListZModel_THashListr�   r‡   r'   )r3   r   r½   Z	thashlistr   r   r   r    e  s    
ÿ
r    c                 C  sþ   | j dkrtdƒ‚t| jjtjƒr.tjj	j
}nœt| jjtjƒrJtjj	j}n€t| jjtjƒrftjj	j}ndt| jjtjƒr‚tjj	j}nHt| jjtjƒržtjj	j}n,t| jjtjƒrºtjj	j}ntd| j›�ƒ‚| ¡ }d|_t| ƒ|jd< |  | j d¡¡|_|S )aL  
    Args:
        data (numpy.ndarray): The array to convert to big-endian and wrap as
            TArrayC, TArrayS, TArrayI, TArrayL, TArrayF, or TArrayD, depending
            on its dtype.

    This function is for developers to create TArray objects that can be
    written to ROOT files, to implement conversion routines.
    r   z1data to convert to TArray must be one-dimensionalzOdata to convert to TArray must have signed integer or floating-point type, not TZfNrG   )r“   r}   Ú
issubclassr   r    r   Zint8r   r©   ÚTArrayÚModel_TArrayCZint16ÚModel_TArraySZint32ÚModel_TArrayIZint64ZModel_TArrayLZfloat32ÚModel_TArrayFr†   ÚModel_TArrayDr�   r¬   r0   r¢   r€   r   r»   )r3   ÚclsZtarrayr   r   r   Ú	to_TArray}  s,    


ÿrÇ   Féþ  r   é*   ç{®Gázt?çìQ¸…ë¡?ç¸…ëQ¸ž?ç      ð?c                 C  s¸  t jjj ¡ }t jjj ¡ }d|_|j 	|¡ | |j
d< ||j
d< t jjj ¡ }d|_||j
d< ||j
d< ||j
d< ||j
d< ||j
d< ||j
d	< ||j
d
< ||j
d< ||j
d< ||j
d< ||j
d< |du rÜtjg tjd�}t|t jjjƒrò|}nt|ƒ}t|
t jjjƒ�r|
}nt|
ƒ}t jjj ¡ }d|_|j 	|¡ |j 	|¡ ||j
d< ||j
d< ||j
d< ||j
d< ||j
d< ||j
d< ||j
d< |	|j
d< ||j
d< ||j
d< ||j
d< |S )a�  
    Args:
        fName (str): Internal name of axis, usually ``"xaxis"``, ``"yaxis"``, ``"zaxis"``.
        fTitle (str): Internal title of axis, usually empty: ``""``.
        fNbins (int): Number of bins. (https://root.cern.ch/doc/master/classTAxis.html)
        fXmin (float): Low edge of first bin.
        fXmax (float): Upper edge of last bin.
        fXbins (None or numpy.ndarray of numpy.float64 or :doc:`uproot.models.TArray.Model_TArrayD`): Bin
            edges array in X. None generates an empty array.
        fFirst (int): First bin to display. 1 if no range defined NOTE: in some cases a zero is returned (see TAxis::SetRange)
        fLast (int): Last bin to display. fNbins if no range defined NOTE: in some cases a zero is returned (see TAxis::SetRange)
        fBits2 (int): Second bit status word.
        fTimeDisplay (bool): On/off displaying time values instead of numerics.
        fTimeFormat (str or :doc:`uproot.models.TString.Model_TString`): Date&time format, ex: 09/12/99 12:34:00.
        fLabels (None or :doc:`uproot.models.THashList.Model_THashList`): List of labels.
        fModLabs (None or :doc:`uproot.models.TList.Model_TList`): List of modified labels.
        fNdivisions (int): Number of divisions(10000*n3 + 100*n2 + n1). (https://root.cern.ch/doc/master/classTAttAxis.html)
        fAxisColor (int): Color of the line axis.
        fLabelColor (int): Color of labels.
        fLabelFont (int): Font for labels.
        fLabelOffset (float): Offset of labels.
        fLabelSize (float): Size of labels.
        fTickLength (float): Length of tick marks.
        fTitleOffset (float): Offset of axis title.
        fTitleSize (float): Size of axis title.
        fTitleColor (int): Color of axis title.
        fTitleFont (int): Font for axis title.

    This function is for developers to create TAxis objects that can be
    written to ROOT files, to implement conversion routines.
    TrL   r   ÚfNdivisionsÚ
fAxisColorÚfLabelColorÚ
fLabelFontÚfLabelOffsetÚ
fLabelSizeÚfTickLengthÚfTitleOffsetÚ
fTitleSizeÚfTitleColorÚ
fTitleFontNrH   rM   rN   rO   rP   ÚfFirstÚfLastÚfBits2ÚfTimeDisplayÚfTimeFormatrQ   ÚfModLabs)r   r©   ry   r¶   r�   ÚTNamedÚModel_TNamedr¬   r‡   r'   r¢   ÚTAttZModel_TAttAxis_v4r   r’   r†   r	   rÀ   rÅ   rÇ   rª   r«   r³   ÚTHZModel_TAxis_v10)rL   r   rM   rN   rO   rP   rÙ   rÚ   rÛ   rÜ   rÝ   rQ   rÞ   rÎ   rÏ   rÐ   rÑ   rÒ   rÓ   rÔ   rÕ   rÖ   r×   rØ   r·   ÚtnamedZtattaxisZtarray_fXbinsZtstring_fTimeFormatZtaxisr   r   r   rR   ¢  sV    9























rR   éè  ç     \‘Àç        r<   éZ  éé  c!           .      C  s^  t jjj ¡ }!t jjj ¡ }"d|"_|"j 	|!¡ | |"j
d< ||"j
d< t jjj ¡ }#d|#_||#j
d< ||#j
d< ||#j
d< t jjj ¡ }$d|$_||$j
d< ||$j
d< t jjj ¡ }%d|%_||%j
d	< ||%j
d
< | |%j
d< t jjj ¡ }&|&j 	|"¡ |&j 	|#¡ |&j 	|$¡ |&j 	|%¡ |
du �r(tdddddd�}
|du �rDtdddddd�}|du �r^tjg tjd�}|du �rlg }|du �r†tjg tjd�}t|t jjjƒ�rž|}'nt|ƒ}'|du �rÆttjg tjd�ƒ}(n t|t jjjƒ�rÞ|}(nt|ƒ}(t|(t jjjƒ�s tdƒ‚t|t jjjƒ�r|})nt|ƒ})t|)t jjjƒ�s:tdƒ‚t|t jjjƒ�rR|}*nt|ƒ}*t|t jjjƒ�rr|}+nt |dd�}+|du �r�t!|'ƒn||&j
d< |	|&j
d< |
|&j
d< ||&j
d< ||&j
d< ||&j
d< ||&j
d< ||&j
d< ||&j
d < ||&j
d!< ||&j
d"< ||&j
d#< ||&j
d$< ||&j
d%< |)|&j
d&< |(|&j
d'< |*|&j
d(< |+|&j
d)< |du �rVt!|ƒn||&j
d*< ||&j
d+< ||&j
d,< ||&j
d-< d.|&_"|+j|&_t|'t jjj#ƒ�rªt jjj$},nˆt|'t jjj%ƒ�rÈt jjj&},njt|'t jjj'ƒ�ræt jjj(},nLt|'t jjj)ƒ�rt jjj*},n.t|'t jjjƒ�r"t jjj+},ntd/|'j,› �ƒ‚|, ¡ }-|-j 	|&¡ |-j 	|'¡ |&j|-_|-S )0a{  
    Args:
        fName (None or str): Temporary name, will be overwritten by the writing
            process because Uproot's write syntax is ``file[name] = histogram``.
        fTitle (str): Real title of the histogram.
        data (numpy.ndarray or :doc:`uproot.models.TArray.Model_TArray`): Bin contents
            with first bin as underflow, last bin as overflow. The dtype of this array
            determines the return type of this function (TH1C, TH1D, TH1F, TH1I, or TH1S).
        fEntries (float): Number of entries. (https://root.cern.ch/doc/master/classTH1.html)
        fTsumw (float): Total Sum of weights.
        fTsumw2 (float): Total Sum of squares of weights.
        fTsumwx (float): Total Sum of weight*X.
        fTsumwx2 (float): Total Sum of weight*X*X.
        fSumw2 (None or numpy.ndarray of numpy.float64 or :doc:`uproot.models.TArray.Model_TArrayD`): Array
            of sum of squares of weights. If None, a zero-length :doc:`uproot.models.TArray.Model_TArrayD`
            is created in its place.
        fXaxis (:doc:`uproot.models.TH.Model_TAxis_v10`): Use :doc:`uproot.writing.identify.to_TAxis`
            with ``fName="xaxis"`` and ``fTitle=""``.
        fYaxis (None or :doc:`uproot.models.TH.Model_TAxis_v10`): None generates a
            default for 1D histograms.
        fZaxis (None or :doc:`uproot.models.TH.Model_TAxis_v10`): None generates a
            default for 1D and 2D histograms.
        fNcells (None or int): Number of bins(1D), cells (2D) +U/Overflows. Computed
            from ``data`` if None.
        fBarOffset (int): (1000*offset) for bar charts or legos
        fBarWidth (int): (1000*width) for bar charts or legos
        fMaximum (float): Maximum value for plotting.
        fMinimum (float): Minimum value for plotting.
        fNormFactor (float): Normalization factor.
        fContour (None or numpy.ndarray of numpy.float64 or :doc:`uproot.models.TArray.Model_TArrayD`): Array
            to display contour levels. None generates an empty array.
        fOption (str or :doc:`uproot.models.TString.Model_TString`): Histogram options.
        fFunctions (None, list, or :doc:`uproot.models.TList.Model_TList`): ->Pointer to
            list of functions (fits and user). None generates an empty list.
        fBufferSize (None or int): fBuffer size. Computed from ``fBuffer`` if None.
        fBuffer (None or numpy.ndarray of numpy.float64): Buffer of entries accumulated
            before automatically choosing the binning. (Irrelevant for serialization?)
            None generates an empty array.
        fBinStatErrOpt (int): Option for bin statistical errors.
        fStatOverflows (int): Per object flag to use under/overflows in statistics.
        fLineColor (int): Line color. (https://root.cern.ch/doc/master/classTAttLine.html)
        fLineStyle (int): Line style.
        fLineWidth (int): Line width.
        fFillColor (int): Fill area color. (https://root.cern.ch/doc/master/classTAttFill.html)
        fFillStyle (int): Fill area style.
        fMarkerColor (int): Marker color. (https://root.cern.ch/doc/master/classTAttMarker.html)
        fMarkerStyle (int): Marker style.
        fMarkerSize (float): Marker size.

    This function is for developers to create TH1* objects that can be
    written to ROOT files, to implement conversion routines. The choice of
    TH1C, TH1D, TH1F, TH1I, or TH1S depends on the dtype of the ``data`` array.
    TrL   r   Ú
fLineColorÚ
fLineStyleÚ
fLineWidthÚ
fFillColorÚ
fFillStyleÚfMarkerColorÚfMarkerStyleÚfMarkerSizeNr\   r   r   ræ   rÍ   )rL   r   rM   rN   rO   r]   rH   z,fSumw2 must be an array of float64 (TArrayD)z.fContour must be an array of float64 (TArrayD)r   ÚfNcellsri   rk   rp   Ú
fBarOffsetÚ	fBarWidthr`   ra   rb   rc   rd   ÚfMaximumÚfMinimumÚfNormFactorÚfContourr_   ÚfOptionÚ
fFunctionsÚfBufferSizeÚfBufferÚfBinStatErrOptÚfStatOverflowsó    z!no TH1* subclasses correspond to )-r   r©   ry   r¶   r�   rß   rà   r¬   r‡   r'   r¢   rá   ZModel_TAttLine_v2ZModel_TAttFill_v2ZModel_TAttMarker_v2râ   ZModel_TH1_v8rR   r   r’   r†   r	   rÀ   ÚModel_TArrayrÇ   rÅ   r   rª   r«   r³   r¹   rº   r¾   r0   Z_speedbump1rÁ   ZModel_TH1C_v3rÂ   ZModel_TH1S_v3rÃ   ZModel_TH1I_v3rÄ   ZModel_TH1F_v3ÚModel_TH1D_v3r/   ).rL   r   r3   r`   ra   rb   rc   rd   r_   ri   rk   rp   rñ   rò   ró   rô   rõ   rö   r÷   rø   rù   rú   rû   rü   rý   ré   rê   rë   rì   rí   rî   rï   rð   r·   rã   ZtattlineZtattfillZ
tattmarkerÚth1Útarray_dataZtarray_fSumw2Ztarray_fContourZtstring_fOptionZtlist_fFunctionsrÆ   Úth1xr   r   r   r‰     sÀ    X



































r‰   c%           +   #   C  st  t | |||||||||||||||||||||||||||| |!|"|#|$d�!}%|%jd }&|%jd }'tjjj ¡ }(|(j |&¡ ||(jd< ||(jd< |	|(jd< |
|(jd< t	|'tjj
jƒr¼tjjj})n„t	|'tjj
jƒrØtjjj})nht	|'tjj
jƒrôtjjj})nLt	|'tjj
jƒ�rtjjj})n.t	|'tjj
jƒ�r0tjjj})ntd|'j› �ƒ‚|) ¡ }*|*j |(¡ |*j |'¡ |&j|(_|(j|*_|*S )	a½  
    Args:
        fName (None or str): Temporary name, will be overwritten by the writing
            process because Uproot's write syntax is ``file[name] = histogram``.
        fTitle (str): Real title of the histogram.
        data (numpy.ndarray or :doc:`uproot.models.TArray.Model_TArray`): Bin contents
            with first bin as underflow, last bin as overflow. The dtype of this array
            determines the return type of this function (TH2C, TH2D, TH2F, TH2I, or TH2S).
        fEntries (float): Number of entries. (https://root.cern.ch/doc/master/classTH1.html)
        fTsumw (float): Total Sum of weights.
        fTsumw2 (float): Total Sum of squares of weights.
        fTsumwx (float): Total Sum of weight*X.
        fTsumwx2 (float): Total Sum of weight*X*X.
        fTsumwy (float): Total Sum of weight*Y. (TH2 only: https://root.cern.ch/doc/master/classTH2.html)
        fTsumwy2 (float): Total Sum of weight*Y*Y. (TH2 only.)
        fTsumwxy (float): Total Sum of weight*X*Y. (TH2 only.)
        fSumw2 (None or numpy.ndarray of numpy.float64 or :doc:`uproot.models.TArray.Model_TArrayD`): Array
            of sum of squares of weights. If None, a zero-length :doc:`uproot.models.TArray.Model_TArrayD`
            is created in its place.
        fXaxis (:doc:`uproot.models.TH.Model_TAxis_v10`): Use :doc:`uproot.writing.identify.to_TAxis`
            with ``fName="xaxis"`` and ``fTitle=""``.
        fYaxis (:doc:`uproot.models.TH.Model_TAxis_v10`): Use :doc:`uproot.writing.identify.to_TAxis`
            with ``fName="yaxis"`` and ``fTitle=""``.
        fZaxis (None or :doc:`uproot.models.TH.Model_TAxis_v10`): None generates a
            default for 1D and 2D histograms.
        fScalefactor (float): Scale factor. (TH2 only.)
        fNcells (None or int): Number of bins(1D), cells (2D) +U/Overflows. Computed
            from ``data`` if None.
        fBarOffset (int): (1000*offset) for bar charts or legos
        fBarWidth (int): (1000*width) for bar charts or legos
        fMaximum (float): Maximum value for plotting.
        fMinimum (float): Minimum value for plotting.
        fNormFactor (float): Normalization factor.
        fContour (None or numpy.ndarray of numpy.float64 or :doc:`uproot.models.TArray.Model_TArrayD`): Array
            to display contour levels. None generates an empty array.
        fOption (str or :doc:`uproot.models.TString.Model_TString`): Histogram options.
        fFunctions (None, list, or :doc:`uproot.models.TList.Model_TList`): ->Pointer to
            list of functions (fits and user). None generates an empty list.
        fBufferSize (None or int): fBuffer size. Computed from ``fBuffer`` if None.
        fBuffer (None or numpy.ndarray of numpy.float64): Buffer of entries accumulated
            before automatically choosing the binning. (Irrelevant for serialization?)
            None generates an empty array.
        fBinStatErrOpt (int): Option for bin statistical errors.
        fStatOverflows (int): Per object flag to use under/overflows in statistics.
        fLineColor (int): Line color. (https://root.cern.ch/doc/master/classTAttLine.html)
        fLineStyle (int): Line style.
        fLineWidth (int): Line width.
        fFillColor (int): Fill area color. (https://root.cern.ch/doc/master/classTAttFill.html)
        fFillStyle (int): Fill area style.
        fMarkerColor (int): Marker color. (https://root.cern.ch/doc/master/classTAttMarker.html)
        fMarkerStyle (int): Marker style.
        fMarkerSize (float): Marker size.

    This function is for developers to create TH2* objects that can be
    written to ROOT files, to implement conversion routines. The choice of
    TH2C, TH2D, TH2F, TH2I, or TH2S depends on the dtype of the ``data`` array.
    ©!rL   r   r3   r`   ra   rb   rc   rd   r_   ri   rk   rp   rñ   rò   ró   rô   rõ   rö   r÷   rø   rù   rú   rû   rü   rý   ré   rê   rë   rì   rí   rî   rï   rð   r   r   ÚfScalefactorre   rf   rj   z!no TH2* subclasses correspond to )r‰   r‡   r   r©   râ   ZModel_TH2_v5r�   r'   r¢   r	   rÀ   rÁ   ZModel_TH2C_v4rÂ   ZModel_TH2S_v4rÃ   ZModel_TH2I_v4rÄ   ZModel_TH2F_v4rÅ   ÚModel_TH2D_v4r   r/   r¬   )+rL   r   r3   r`   ra   rb   rc   rd   re   rf   rj   r_   ri   rk   rp   r  rñ   rò   ró   rô   rõ   rö   r÷   rø   rù   rú   rû   rü   rý   ré   rê   rë   rì   rí   rî   rï   rð   r  r  r  Zth2rÆ   Úth2xr   r   r   rŒ   å  sx    `ß$





rŒ   c(           /   #   C  s¶  t | ||||||||||||||||||||||||| |!|"|#|$|%|&|'d�!}(|(jd })|(jd }*tjjj ¡ }+d|+_tjjj	 ¡ },|,j 
|)¡ |,j 
|+¡ ||,jd< |	|,jd< |
|,jd< ||,jd< ||,jd	< ||,jd
< ||,jd< t|*tjjjƒrútjjj}-nˆt|*tjjjƒ�rtjjj}-njt|*tjjjƒ�r6tjjj}-nLt|*tjjjƒ�rTtjjj}-n.t|*tjjjƒ�rrtjjj}-ntd|*j› �ƒ‚|- ¡ }.|.j 
|,¡ |.j 
|*¡ |)j|,_|,j|._|.S )a™  
    Args:
        fName (None or str): Temporary name, will be overwritten by the writing
            process because Uproot's write syntax is ``file[name] = histogram``.
        fTitle (str): Real title of the histogram.
        data (numpy.ndarray or :doc:`uproot.models.TArray.Model_TArray`): Bin contents
            with first bin as underflow, last bin as overflow. The dtype of this array
            determines the return type of this function (TH3C, TH3D, TH3F, TH3I, or TH3S).
        fEntries (float): Number of entries. (https://root.cern.ch/doc/master/classTH1.html)
        fTsumw (float): Total Sum of weights.
        fTsumw2 (float): Total Sum of squares of weights.
        fTsumwx (float): Total Sum of weight*X.
        fTsumwx2 (float): Total Sum of weight*X*X.
        fTsumwy (float): Total Sum of weight*Y. (TH3 only: https://root.cern.ch/doc/master/classTH3.html)
        fTsumwy2 (float): Total Sum of weight*Y*Y. (TH3 only.)
        fTsumwxy (float): Total Sum of weight*X*Y. (TH3 only.)
        fTsumwz (float): Total Sum of weight*Z. (TH3 only.)
        fTsumwz2 (float): Total Sum of weight*Z*Z. (TH3 only.)
        fTsumwxz (float): Total Sum of weight*X*Z. (TH3 only.)
        fTsumwyz (float): Total Sum of weight*Y*Z. (TH3 only.)
        fSumw2 (None or numpy.ndarray of numpy.float64 or :doc:`uproot.models.TArray.Model_TArrayD`): Array
            of sum of squares of weights. If None, a zero-length :doc:`uproot.models.TArray.Model_TArrayD`
            is created in its place.
        fXaxis (:doc:`uproot.models.TH.Model_TAxis_v10`): Use :doc:`uproot.writing.identify.to_TAxis`
            with ``fName="xaxis"`` and ``fTitle=""``.
        fYaxis (:doc:`uproot.models.TH.Model_TAxis_v10`): Use :doc:`uproot.writing.identify.to_TAxis`
            with ``fName="yaxis"`` and ``fTitle=""``.
        fZaxis (:doc:`uproot.models.TH.Model_TAxis_v10`): Use :doc:`uproot.writing.identify.to_TAxis`
            with ``fName="zaxis"`` and ``fTitle=""``.
        fNcells (None or int): Number of bins(1D), cells (2D) +U/Overflows. Computed
            from ``data`` if None.
        fBarOffset (int): (1000*offset) for bar charts or legos
        fBarWidth (int): (1000*width) for bar charts or legos
        fMaximum (float): Maximum value for plotting.
        fMinimum (float): Minimum value for plotting.
        fNormFactor (float): Normalization factor.
        fContour (None or numpy.ndarray of numpy.float64 or :doc:`uproot.models.TArray.Model_TArrayD`): Array
            to display contour levels. None generates an empty array.
        fOption (str or :doc:`uproot.models.TString.Model_TString`): Histogram options.
        fFunctions (None, list, or :doc:`uproot.models.TList.Model_TList`): ->Pointer to
            list of functions (fits and user). None generates an empty list.
        fBufferSize (None or int): fBuffer size. Computed from ``fBuffer`` if None.
        fBuffer (None or numpy.ndarray of numpy.float64): Buffer of entries accumulated
            before automatically choosing the binning. (Irrelevant for serialization?)
            None generates an empty array.
        fBinStatErrOpt (int): Option for bin statistical errors.
        fStatOverflows (int): Per object flag to use under/overflows in statistics.
        fLineColor (int): Line color. (https://root.cern.ch/doc/master/classTAttLine.html)
        fLineStyle (int): Line style.
        fLineWidth (int): Line width.
        fFillColor (int): Fill area color. (https://root.cern.ch/doc/master/classTAttFill.html)
        fFillStyle (int): Fill area style.
        fMarkerColor (int): Marker color. (https://root.cern.ch/doc/master/classTAttMarker.html)
        fMarkerStyle (int): Marker style.
        fMarkerSize (float): Marker size.

    This function is for developers to create TH3* objects that can be
    written to ROOT files, to implement conversion routines. The choice of
    TH3C, TH3D, TH3F, TH3I, or TH3S depends on the dtype of the ``data`` array.
    r  r   r   Tre   rf   rj   rl   rm   rn   ro   z!no TH3* subclasses correspond to )r‰   r‡   r   r©   rá   ZModel_TAtt3D_v1r�   r¬   râ   ZModel_TH3_v6r'   r¢   r	   rÀ   rÁ   ZModel_TH3C_v4rÂ   ZModel_TH3S_v4rÃ   ZModel_TH3I_v4rÄ   ZModel_TH3F_v4rÅ   ÚModel_TH3D_v4r   r/   )/rL   r   r3   r`   ra   rb   rc   rd   re   rf   rj   rl   rm   rn   ro   r_   ri   rk   rp   rñ   rò   ró   rô   rõ   rö   r÷   rø   rù   rú   rû   rü   rý   ré   rê   rë   rì   rí   rî   rï   rð   r  r  r  Ztatt3dZth3rÆ   Úth3xr   r   r   rŽ   Š  s„    fß$








rŽ   c(           ,   #   C  s:  t | ||||||||
||||||||||||||||| |!|"|#|$|%|&|'d�!}(t|(tjjjƒsbtdƒ‚t|tjjjƒrx|})nt	|ƒ})t|)tjjj
ƒs˜tdƒ‚t|tjjjƒr®|}*nt	|ƒ}*t|*tjjj
ƒsÎtdƒ‚tjjj ¡ }+|+j |(¡ |)|+jd< ||+jd< ||+jd< ||+jd< ||+jd	< |	|+jd
< |*|+jd< |(j|+_|+S )a½  
    Args:
        fName (None or str): Temporary name, will be overwritten by the writing
            process because Uproot's write syntax is ``file[name] = histogram``.
        fTitle (str): Real title of the histogram.
        data (numpy.ndarray of numpy.float64 or :doc:`uproot.models.TArray.Model_TArrayD`): Bin
            contents with first bin as underflow, last bin as overflow. The dtype of this array
            must be float64.
        fEntries (float): Number of entries. (https://root.cern.ch/doc/master/classTH1.html)
        fTsumw (float): Total Sum of weights.
        fTsumw2 (float): Total Sum of squares of weights.
        fTsumwx (float): Total Sum of weight*X.
        fTsumwx2 (float): Total Sum of weight*X*X.
        fTsumwy (float): Total Sum of weight*Y. (TProfile only: https://root.cern.ch/doc/master/classTProfile.html)
        fTsumwy2 (float): Total Sum of weight*Y*Y. (TProfile only.)
        fSumw2 (None or numpy.ndarray of numpy.float64 or :doc:`uproot.models.TArray.Model_TArrayD`): Array
            of sum of squares of weights. If None, a zero-length :doc:`uproot.models.TArray.Model_TArrayD`
            is created in its place.
        fBinEntries (numpy.ndarray of numpy.float64 or :doc:`uproot.models.TArray.Model_TArrayD`): Number
            of entries per bin. (TProfile only.)
        fBinSumw2 (numpy.ndarray of numpy.float64 or :doc:`uproot.models.TArray.Model_TArrayD`): Array
            of sum of squares of weights per bin. (TProfile only.)
        fXaxis (:doc:`uproot.models.TH.Model_TAxis_v10`): Use :doc:`uproot.writing.identify.to_TAxis`
            with ``fName="xaxis"`` and ``fTitle=""``.
        fYaxis (None or :doc:`uproot.models.TH.Model_TAxis_v10`): None generates a
            default for 1D histograms.
        fZaxis (None or :doc:`uproot.models.TH.Model_TAxis_v10`): None generates a
            default for 1D and 2D histograms.
        fYmin (float): Lower limit in Y (if set). (TProfile only.)
        fYmax (float): Upper limit in Y (if set). (TProfile only.)
        fErrorMode (int): Option to compute errors. (TProfile only.)
        fNcells (None or int): Number of bins(1D), cells (2D) +U/Overflows. Computed
            from ``data`` if None.
        fBarOffset (int): (1000*offset) for bar charts or legos
        fBarWidth (int): (1000*width) for bar charts or legos
        fMaximum (float): Maximum value for plotting.
        fMinimum (float): Minimum value for plotting.
        fNormFactor (float): Normalization factor.
        fContour (None or numpy.ndarray of numpy.float64 or :doc:`uproot.models.TArray.Model_TArrayD`): Array
            to display contour levels. None generates an empty array.
        fOption (str or :doc:`uproot.models.TString.Model_TString`): Histogram options.
        fFunctions (None, list, or :doc:`uproot.models.TList.Model_TList`): ->Pointer to
            list of functions (fits and user). None generates an empty list.
        fBufferSize (None or int): fBuffer size. Computed from ``fBuffer`` if None.
        fBuffer (None or numpy.ndarray of numpy.float64): Buffer of entries accumulated
            before automatically choosing the binning. (Irrelevant for serialization?)
            None generates an empty array.
        fBinStatErrOpt (int): Option for bin statistical errors.
        fStatOverflows (int): Per object flag to use under/overflows in statistics.
        fLineColor (int): Line color. (https://root.cern.ch/doc/master/classTAttLine.html)
        fLineStyle (int): Line style.
        fLineWidth (int): Line width.
        fFillColor (int): Fill area color. (https://root.cern.ch/doc/master/classTAttFill.html)
        fFillStyle (int): Fill area style.
        fMarkerColor (int): Marker color. (https://root.cern.ch/doc/master/classTAttMarker.html)
        fMarkerStyle (int): Marker style.
        fMarkerSize (float): Marker size.

    This function is for developers to create TProfile objects that can be
    written to ROOT files, to implement conversion routines.
    r  z/TProfile requires an array of float64 (TArrayD)ú1fBinEntries must be an array of float64 (TArrayD)ú/fBinSumw2 must be an array of float64 (TArrayD)rg   Ú
fErrorModerš   r›   re   rf   rh   )r‰   r	   r   r©   râ   r   r   rÀ   rÿ   rÇ   rÅ   ZModel_TProfile_v7r�   r‡   r'   r¢   r¬   ),rL   r   r3   r`   ra   rb   rc   rd   re   rf   r_   rg   rh   ri   rk   rp   rš   r›   r  rñ   rò   ró   rô   rõ   rö   r÷   rø   rù   rú   rû   rü   rý   ré   rê   rë   rì   rí   rî   rï   rð   r  Útarray_fBinEntriesÚtarray_fBinSumw2Ztprofiler   r   r   r„   <  st    gß#






r„   c,           0   '   C  sB  t | |||||||||	|
||||||||||||||| |!|"|#|$|%|&|'|(|)|*|+d�%},t|,tjjjƒsjtdƒ‚t|tjjjƒr€|}-nt	|ƒ}-t|-tjjj
ƒs tdƒ‚t|tjjjƒr¶|}.nt	|ƒ}.t|.tjjj
ƒsÖtdƒ‚tjjj ¡ }/|/j |,¡ |-|/jd< ||/jd< ||/jd< ||/jd< ||/jd	< ||/jd
< |.|/jd< |,j|/_|/S )aÿ  
    Args:
        fName (None or str): Temporary name, will be overwritten by the writing
            process because Uproot's write syntax is ``file[name] = histogram``.
        fTitle (str): Real title of the histogram.
        data (numpy.ndarray or :doc:`uproot.models.TArray.Model_TArray`): Bin contents
            with first bin as underflow, last bin as overflow. The dtype of this array
            must be float64.
        fEntries (float): Number of entries. (https://root.cern.ch/doc/master/classTH1.html)
        fTsumw (float): Total Sum of weights.
        fTsumw2 (float): Total Sum of squares of weights.
        fTsumwx (float): Total Sum of weight*X.
        fTsumwx2 (float): Total Sum of weight*X*X.
        fTsumwy (float): Total Sum of weight*Y. (TH2 only: https://root.cern.ch/doc/master/classTH2.html)
        fTsumwy2 (float): Total Sum of weight*Y*Y. (TH2 only.)
        fTsumwxy (float): Total Sum of weight*X*Y. (TH2 only.)
        fTsumwz (float): Total Sum of weight*Z. (TProfile2D only: https://root.cern.ch/doc/master/classTProfile2D.html)
        fTsumwz2 (float): Total Sum of weight*Z*Z. (TProfile2D only.)
        fSumw2 (None or numpy.ndarray of numpy.float64 or :doc:`uproot.models.TArray.Model_TArrayD`): Array
            of sum of squares of weights. If None, a zero-length :doc:`uproot.models.TArray.Model_TArrayD`
            is created in its place.
        fBinEntries (numpy.ndarray of numpy.float64 or :doc:`uproot.models.TArray.Model_TArrayD`): Number
            of entries per bin. (TProfile2D only.)
        fBinSumw2 (numpy.ndarray of numpy.float64 or :doc:`uproot.models.TArray.Model_TArrayD`): Array
            of sum of squares of weights per bin. (TProfile2D only.)
        fXaxis (:doc:`uproot.models.TH.Model_TAxis_v10`): Use :doc:`uproot.writing.identify.to_TAxis`
            with ``fName="xaxis"`` and ``fTitle=""``.
        fYaxis (:doc:`uproot.models.TH.Model_TAxis_v10`): Use :doc:`uproot.writing.identify.to_TAxis`
            with ``fName="yaxis"`` and ``fTitle=""``.
        fZaxis (None or :doc:`uproot.models.TH.Model_TAxis_v10`): None generates a
            default for 1D and 2D histograms.
        fScalefactor (float): Scale factor. (TH2 only.)
        fZmin (float): Lower limit in Z (if set). (TProfile2D only.)
        fZmax (float): Upper limit in Z (if set). (TProfile2D only.)
        fErrorMode (int): Option to compute errors. (TProfile2D only.)
        fNcells (None or int): Number of bins(1D), cells (2D) +U/Overflows. Computed
            from ``data`` if None.
        fBarOffset (int): (1000*offset) for bar charts or legos
        fBarWidth (int): (1000*width) for bar charts or legos
        fMaximum (float): Maximum value for plotting.
        fMinimum (float): Minimum value for plotting.
        fNormFactor (float): Normalization factor.
        fContour (None or numpy.ndarray of numpy.float64 or :doc:`uproot.models.TArray.Model_TArrayD`): Array
            to display contour levels. None generates an empty array.
        fOption (str or :doc:`uproot.models.TString.Model_TString`): Histogram options.
        fFunctions (None, list, or :doc:`uproot.models.TList.Model_TList`): ->Pointer to
            list of functions (fits and user). None generates an empty list.
        fBufferSize (None or int): fBuffer size. Computed from ``fBuffer`` if None.
        fBuffer (None or numpy.ndarray of numpy.float64): Buffer of entries accumulated
            before automatically choosing the binning. (Irrelevant for serialization?)
            None generates an empty array.
        fBinStatErrOpt (int): Option for bin statistical errors.
        fStatOverflows (int): Per object flag to use under/overflows in statistics.
        fLineColor (int): Line color. (https://root.cern.ch/doc/master/classTAttLine.html)
        fLineStyle (int): Line style.
        fLineWidth (int): Line width.
        fFillColor (int): Fill area color. (https://root.cern.ch/doc/master/classTAttFill.html)
        fFillStyle (int): Fill area style.
        fMarkerColor (int): Marker color. (https://root.cern.ch/doc/master/classTAttMarker.html)
        fMarkerStyle (int): Marker style.
        fMarkerSize (float): Marker size.

    This function is for developers to create TProfile2D objects that can be
    written to ROOT files, to implement conversion routines.
    )%rL   r   r3   r`   ra   rb   rc   rd   re   rf   rj   r_   ri   rk   rp   r  rñ   rò   ró   rô   rõ   rö   r÷   rø   rù   rú   rû   rü   rý   ré   rê   rë   rì   rí   rî   rï   rð   z1TProfile2D requires an array of float64 (TArrayD)r
  r  rg   r  r�   rž   rl   rm   rh   )rŒ   r	   r   r©   râ   r  r   rÀ   rÿ   rÇ   rÅ   ZModel_TProfile2D_v8r�   r‡   r'   r¢   r¬   )0rL   r   r3   r`   ra   rb   rc   rd   re   rf   rj   rl   rm   r_   rg   rh   ri   rk   rp   r  r�   rž   r  rñ   rò   ró   rô   rõ   rö   r÷   rø   rù   rú   rû   rü   rý   ré   rê   rë   rì   rí   rî   rï   rð   r  r  r  Z
tprofile2dr   r   r   Úto_TProfile2Dæ  s|    oÛ'






r  c/           3   *   C  sH  t | |||||||||	|
||||||||||||||| |!|"|#|$|%|&|'|(|)|*|+|,|-|.d�(}/t|/tjjjƒsptdƒ‚t|tjjjƒr†|}0nt	|ƒ}0t|0tjjj
ƒs¦tdƒ‚t|tjjjƒr¼|}1nt	|ƒ}1t|1tjjj
ƒsÜtdƒ‚tjjj ¡ }2|2j |/¡ |0|2jd< ||2jd< ||2jd< ||2jd< ||2jd	< ||2jd
< |1|2jd< |/j|2_|2S )aÛ  
    Args:
        fName (None or str): Temporary name, will be overwritten by the writing
            process because Uproot's write syntax is ``file[name] = histogram``.
        fTitle (str): Real title of the histogram.
        data (numpy.ndarray or :doc:`uproot.models.TArray.Model_TArray`): Bin contents
            with first bin as underflow, last bin as overflow. The dtype of this array
            must be float64.
        fEntries (float): Number of entries. (https://root.cern.ch/doc/master/classTH1.html)
        fTsumw (float): Total Sum of weights.
        fTsumw2 (float): Total Sum of squares of weights.
        fTsumwx (float): Total Sum of weight*X.
        fTsumwx2 (float): Total Sum of weight*X*X.
        fTsumwy (float): Total Sum of weight*Y. (TH3 only: https://root.cern.ch/doc/master/classTH3.html)
        fTsumwy2 (float): Total Sum of weight*Y*Y. (TH3 only.)
        fTsumwxy (float): Total Sum of weight*X*Y. (TH3 only.)
        fTsumwz (float): Total Sum of weight*Z. (TH3 only.)
        fTsumwz2 (float): Total Sum of weight*Z*Z. (TH3 only.)
        fTsumwxz (float): Total Sum of weight*X*Z. (TH3 only.)
        fTsumwyz (float): Total Sum of weight*Y*Z. (TH3 only.)
        fTsumwt (float): Total Sum of weight*T. (TProfile3D only: https://root.cern.ch/doc/master/classTProfile3D.html)
        fTsumwt2 (float): Total Sum of weight*T*T. (TProfile3D only.)
        fSumw2 (None or numpy.ndarray of numpy.float64 or :doc:`uproot.models.TArray.Model_TArrayD`): Array
            of sum of squares of weights. If None, a zero-length :doc:`uproot.models.TArray.Model_TArrayD`
            is created in its place.
        fBinEntries (numpy.ndarray of numpy.float64 or :doc:`uproot.models.TArray.Model_TArrayD`): Number
            of entries per bin. (TProfile3D only.)
        fBinSumw2 (numpy.ndarray of numpy.float64 or :doc:`uproot.models.TArray.Model_TArrayD`): Array
            of sum of squares of weights per bin. (TProfile3D only.)
        fXaxis (:doc:`uproot.models.TH.Model_TAxis_v10`): Use :doc:`uproot.writing.identify.to_TAxis`
            with ``fName="xaxis"`` and ``fTitle=""``.
        fYaxis (:doc:`uproot.models.TH.Model_TAxis_v10`): Use :doc:`uproot.writing.identify.to_TAxis`
            with ``fName="yaxis"`` and ``fTitle=""``.
        fZaxis (:doc:`uproot.models.TH.Model_TAxis_v10`): Use :doc:`uproot.writing.identify.to_TAxis`
            with ``fName="zaxis"`` and ``fTitle=""``.
        fTmin (float): Lower limit in T (if set). (TProfile3D only.)
        fTmax (float): Upper limit in T (if set). (TProfile3D only.)
        fErrorMode (int): Option to compute errors. (TProfile3D only.)
        fNcells (None or int): Number of bins(1D), cells (2D) +U/Overflows. Computed
            from ``data`` if None.
        fBarOffset (int): (1000*offset) for bar charts or legos
        fBarWidth (int): (1000*width) for bar charts or legos
        fMaximum (float): Maximum value for plotting.
        fMinimum (float): Minimum value for plotting.
        fNormFactor (float): Normalization factor.
        fContour (None or numpy.ndarray of numpy.float64 or :doc:`uproot.models.TArray.Model_TArrayD`): Array
            to display contour levels. None generates an empty array.
        fOption (str or :doc:`uproot.models.TString.Model_TString`): Histogram options.
        fFunctions (None, list, or :doc:`uproot.models.TList.Model_TList`): ->Pointer to
            list of functions (fits and user). None generates an empty list.
        fBufferSize (None or int): fBuffer size. Computed from ``fBuffer`` if None.
        fBuffer (None or numpy.ndarray of numpy.float64): Buffer of entries accumulated
            before automatically choosing the binning. (Irrelevant for serialization?)
            None generates an empty array.
        fBinStatErrOpt (int): Option for bin statistical errors.
        fStatOverflows (int): Per object flag to use under/overflows in statistics.
        fLineColor (int): Line color. (https://root.cern.ch/doc/master/classTAttLine.html)
        fLineStyle (int): Line style.
        fLineWidth (int): Line width.
        fFillColor (int): Fill area color. (https://root.cern.ch/doc/master/classTAttFill.html)
        fFillStyle (int): Fill area style.
        fMarkerColor (int): Marker color. (https://root.cern.ch/doc/master/classTAttMarker.html)
        fMarkerStyle (int): Marker style.
        fMarkerSize (float): Marker size.

    This function is for developers to create TProfile3D objects that can be
    written to ROOT files, to implement conversion routines.
    )(rL   r   r3   r`   ra   rb   rc   rd   re   rf   rj   rl   rm   rn   ro   r_   ri   rk   rp   rñ   rò   ró   rô   rõ   rö   r÷   rø   rù   rú   rû   rü   rý   ré   rê   rë   rì   rí   rî   rï   rð   z1TProfile3D requires an array of float64 (TArrayD)r
  r  rg   r  ÚfTminÚfTmaxÚfTsumwtÚfTsumwt2rh   )rŽ   r	   r   r©   râ   r  r   rÀ   rÿ   rÇ   rÅ   ZModel_TProfile3D_v8r�   r‡   r'   r¢   r¬   )3rL   r   r3   r`   ra   rb   rc   rd   re   rf   rj   rl   rm   rn   ro   r  r  r_   rg   rh   ri   rk   rp   r  r  r  rñ   rò   ró   rô   rõ   rö   r÷   rø   rù   rú   rû   rü   rý   ré   rê   rë   rì   rí   rî   rï   rð   r	  r  r  Z
tprofile3dr   r   r   Úto_TProfile3Dœ  s‚    uØ*






r  )r   )r   )Nr   r   r   Fr   NNrÈ   r   r   rÉ   rÊ   rË   rÌ   rÍ   rË   r   rÉ   )NNNr   rä   rå   rå   ræ   Nr   Nr   Nr   r<   rç   r   r   r   rè   r   r   rÍ   )NrÍ   Nr   rä   rå   rå   ræ   Nr   Nr   Nr   r<   rç   r   r   r   rè   r   r   rÍ   )Nr   rä   rå   rå   ræ   Nr   Nr   Nr   r<   rç   r   r   r   rè   r   r   rÍ   )NNræ   ræ   r   Nr   rä   rå   rå   ræ   Nr   Nr   Nr   r<   rç   r   r   r   rè   r   r   rÍ   )NrÍ   ræ   ræ   r   Nr   rä   rå   rå   ræ   Nr   Nr   Nr   r<   rç   r   r   r   rè   r   r   rÍ   )ræ   ræ   r   Nr   rä   rå   rå   ræ   Nr   Nr   Nr   r<   rç   r   r   r   rè   r   r   rÍ   )Ú__doc__Ú
__future__r   Úcollections.abcr   r   Zuproot.compressionr   Zuproot.extrasZuproot.pyrootZuproot.writing._cascadetreer;   r%   rU   rV   rˆ   r‹   r�   r³   r{   r¾   r    rÇ   rR   r‰   rŒ   rŽ   r„   r  r  r   r   r   r   Ú<module>   sŒ       
 

+                   è
z                       ß
 d                       Û
 :                     Ø
 B                          Ø
 >                          Ô
 O                        Ñ