FileChopper Class Reference

#include <FileChopper.h>

List of all members.

Public Member Functions

 FileChopper ()
 FileChopper (const char *fname, Int_t sizeofchop=400)
 ~FileChopper ()
Int_t GetTotalPieces ()
Int_t GetSizeOfPiece (Int_t ii)

Private Attributes

TChain * chain
Int_t tot_entries
Int_t chop_size
Int_t pieces
Int_t remainder

Detailed Description

Definition at line 17 of file FileChopper.h.


Constructor & Destructor Documentation

FileChopper::FileChopper (  ) 

Definition at line 17 of file FileChopper.cxx.

References chain, chop_size, pieces, remainder, and tot_entries.

00017                         {
00018 
00019   tot_entries=0;
00020   chop_size=0;
00021   pieces=0;
00022   remainder=0;
00023 
00024   cout << "Caution! Emtpy constructor for FileChopper does not chop ANYTHING" << endl;
00025 
00026   chain = new TChain("NtpSt");
00027 
00028 }

FileChopper::FileChopper ( const char *  fname,
Int_t  sizeofchop = 400 
)

Definition at line 30 of file FileChopper.cxx.

References chain, chop_size, pieces, remainder, and tot_entries.

00030                                                            {
00031 
00032   chop_size=sizeofchop;
00033 
00034   chain = new TChain("NtpSt");
00035 
00036   Int_t filenum = chain->Add(fname);
00037   tot_entries = chain->GetEntries();
00038   remainder=tot_entries % chop_size;
00039   pieces= tot_entries/chop_size + (bool)remainder;
00040 
00041   cout << "======== FileChopper =================" << endl;
00042   cout << "Added " << filenum << " file(s) to the FileChopper" << endl;
00043   cout << "The file(s) has " << tot_entries << " entries in total" << endl;
00044   cout << "Will divide in " << pieces << " pieces" << endl;
00045 
00046 }

FileChopper::~FileChopper (  ) 

Definition at line 48 of file FileChopper.cxx.

References chain.

00048                          {
00049 
00050   delete chain;
00051 
00052 }


Member Function Documentation

Int_t FileChopper::GetSizeOfPiece ( Int_t  ii  ) 

Definition at line 61 of file FileChopper.cxx.

References chop_size, pieces, and remainder.

00061                                          {
00062 
00063   Int_t valuetoret=0;
00064 
00065   if(ii<pieces-1){
00066     valuetoret=chop_size;
00067   } else if(ii==pieces-1){
00068     if(remainder==0){
00069       valuetoret=chop_size;
00070     } else{
00071       valuetoret=remainder;
00072     }
00073   } 
00074 
00075   return valuetoret;
00076 
00077 }

Int_t FileChopper::GetTotalPieces (  ) 

Definition at line 55 of file FileChopper.cxx.

References pieces.

00055                                  {
00056 
00057   return pieces;
00058 
00059 }


Member Data Documentation

TChain* FileChopper::chain [private]

Definition at line 29 of file FileChopper.h.

Referenced by FileChopper(), and ~FileChopper().

Int_t FileChopper::chop_size [private]

Definition at line 31 of file FileChopper.h.

Referenced by FileChopper(), and GetSizeOfPiece().

Int_t FileChopper::pieces [private]

Definition at line 32 of file FileChopper.h.

Referenced by FileChopper(), GetSizeOfPiece(), and GetTotalPieces().

Int_t FileChopper::remainder [private]

Definition at line 33 of file FileChopper.h.

Referenced by FileChopper(), and GetSizeOfPiece().

Int_t FileChopper::tot_entries [private]

Definition at line 30 of file FileChopper.h.

Referenced by FileChopper().


The documentation for this class was generated from the following files:

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1