Problem with creating RooDataSet from TTree

Hello,

I’m trying to fit one variable in my TTree. The first step is to create RooDataSet. The problem is that when I use following code

	string zFile = "DY_muons.root";
	TFile inZ( zFile.c_str() );
	TTree * ztree = ( TTree * ) inZ.Get( "HZZ2l2nuAnalysis" );
	RooRealVar zpt("ZPT", "zpt", 0, 350, "GeV");
	
	RooDataSet zPtEvents("zPt", "Pt of Z", ztree, RooArgSet(zpt));

some of the entries are somehow “corrupted” in the sense that their value is changed to 0, where all should be above 25.

On other hand everything seems to work when I use something like that

	string zFile = "DY_muons.root";
	TFile inZ( zFile.c_str() );
	TTree * ztree = ( TTree * ) inZ.Get( "HZZ2l2nuAnalysis" );
	RooRealVar zpt("ZPT", "zpt", 0, 350, "GeV");

	RooDataSet zPtEvents("zPt", "Pt of Z", RooArgSet(zpt));
	Event ev(ztree);
	unsigned long nentries = ztree->GetEntries();
	for ( unsigned long i = 0; i < nentries; i++ ) {
		ztree->GetEntry( i );
		zpt = ev.getDoubleVariableValue("ZPT");
		zPtEvents.add(RooArgSet(zpt));
	}

where Event class helps to simple to retrieve values of different variables.

I’m fresh to RooFit and I’m not sure what I’m doing wrong.