I wish to put together several ROOT files in a TChain. But, for some of these files, I wish not to include all the entries, especially the firsts ones.
For example, this is a part of my code which create the TChain. I wish that the 10.000 first entries of the ROOT file “run0004” not to be included in the TChain. How can I do that ?
Thanks,
Xavier
[code]TTree *mychain;
TTree *Analysed_Data;
TChain *allrun = new TChain(“Analysed_Data”);
I don’t believe there is any way in root to automate this (but I’m not a root developer so …). I see two options:
You skim all files individually removing the bad events (this is what I’d suggest) and chain the new files together.
You try to design something that tells you “Oh, I don’t want this entry.” This method is dangerous and hard to implement externally. If there is some flag in the event that says “not this event”, then this is easy.
I was expected some analogies with histograms drawing or tree scanning, where you can just specify the number of events and the number of the first entry desired.
The first option you suggest is the best one : I have a time-dependant correction and it takes some time to be efficient, so the beginning of my files are not enough corrected. Trying to predict from when it is ok is too hazardous
Well, I tried to clone only my ROOT file when the entry number > event_cut. But I do not understand how “Event” works and my ROOT installation seems not to know this class. With the following code, I get this error message :
root [0] .x skim_run.C(295,100)
Treating run 295
File in : /lhome/lderkx/code/analyse/current/run0295.root
File out : /lhome/lderkx/code/analyse/current/run0295skim.root
Error: Symbol Event is not defined in current scope skim_run.C:39:
Warning: Automatic variable Event*event is allocated skim_run.C:39:
(const int)0
*** Interpreter error recovered ***
Any idea ?
[code]int skim_run(int file_number, int event_cut)
{
cout << " Treating run " << file_number<< endl;