Strange Eror message from CMSSW after splitting a TTree

Dear ROOTers,
I have a root file, with 6 TTrees in it.This file has 2500 entries and I want to split this file to 5 files, containing the entries 0 —> 500, 500---->1000 etc.
In order to do this, I wrote the code I have attached.
So, many error messages came up to screen but because this file becomes from a RECO process and it is not an ntuple, many errors are produced whenever I am even trying to see it through TBrowser.
To be sure that the entries were copied, I opened the 5 files and I ploted some TLeafs through TBrowser and everything seem to be ok.
Then, these 5 files are the input for a job that runs under CMSSW. The result is this:

26-Nov-2013 11:27:47 EET  Initiating request to open file file:///mnt/storage/8TeV/FastSimulation/0900_300_090/CMGtuples/CMG_RECO_Coloron_Pythia6Z2star_8Jets_8TeV_GEN_0900_300_090_9_splitted_1500_2000.root
26-Nov-2013 11:27:53 EET  Successfully opened file file:///mnt/storage/8TeV/FastSimulation/0900_300_090/CMGtuples/CMG_RECO_Coloron_Pythia6Z2star_8Jets_8TeV_GEN_0900_300_090_9_splitted_1500_2000.root
cmsRun: /build/muz/53x/g462a/tmp/BUILDROOT/023ba9d64e5759f3b018d233d5d7f315/opt/cmssw/slc5_amd64_gcc462/cms/cmssw/CMSSW_5_3_7/src/IOPool/Input/src/RootFile.cc:239: edm::RootFile::RootFile(const string&, const edm::ProcessConfiguration&, const string&, boost::shared_ptr<edm::InputFile>, boost::shared_ptr<edm::EventSkipperByID>, bool, int, int, unsigned int, int, edm::InputSource::ProcessingMode, const RunNumber_t&, bool, const edm::GroupSelectorRules&, edm::InputType::InputType, boost::shared_ptr<edm::DuplicateChecker>, bool, const std::vector<boost::shared_ptr<edm::IndexIntoFile> >&, std::vector<boost::shared_ptr<edm::IndexIntoFile> >::size_type, std::vector<edm::Hash<2> >&, bool, bool): Assertion `fileFormatVersion().parameterSetsTree()' failed.
Aborted

Am I doing something wrong while I copy the subset of each TTree?

Thank you in advance!
splitfiles.c (2.85 KB)