[G14_run] Bug in rootbeer.
Franz Klein
fklein at jlab.org
Wed Apr 9 17:38:26 EDT 2014
Dao,
thanks for pointing out the missing initialization of fError (in
src/TDST.cxx).
I added this statement in /home/clasg14/rootbeer2.1/src and recompiled
rootbeer and the dstmakers used for pass1/v1.
Those who used the tarball in /home/clasg14/rootbeer2.1.1.tar.gz, this
was already corrected (some time ago);
others might reinstall their own rootbeer or correct the line in
src/TDST.cxx.
The observed problems with skimmed DSTs from pass1/v1 cooking are not
due to this bug. I reran dstmaker_n2pi over the files Irene sent me last
night and got no zombie. There are more zombies in other skims (I will
see to that shortly using a script to recreate the skims, of course it
would be better if I can reproduce the crash in an interactive session ...).
If there is no objection, I'd like to continue the cooking this weekend.
Greetings,
Franz
On 04/09/2014 12:19 PM, daoh at andrew.cmu.edu wrote:
> Dear collaborators,
>
> If you are using rootbeer for analysis, your code probably has a small
> bug. The bug causes your code to terminate because it thinks the current
> DST root file is a zombie file. The problem lies inside a very innocent
> lines of code:
>
>
> if((rootbeer=createBeerObject(inFile))==NULL) return; // create rootbeer
> object, should use continue, not return.
>
> if you go to src/RootBeerUtil.cxx (this folder inside rootbeer), you would
> see the how the createBeerObject function defined.
> If you see the followings, then we have the same version:
>
>
> //************************* createBeerObject()
> ********************************
> TRootBeer *createBeerObject(char *bankFileName){
> Int_t error=0;
>
> //work out whether it's a bos file or a root file and create the
> //appropriate object
> if((strstr(bankFileName,".root"))!=NULL){
> rootbeer = new TDST(bankFileName,bankAddress,nBankTypes); //<--problem
> is here
> }
> else{
> rootbeer = new TBos(bankFileName,bankAddress,nBankTypes);
> }
> error=rootbeer->GetError(); //<--problem is here
> if(error){
> delete rootbeer;
> return NULL;
> }
> else return rootbeer;
> }
>
>
> The variable error is used as a flag to indicate whether the current root
> file is Zombile or not.
> Open the file TDST.cxx (the same directory), you would see that
> rootbeer->GetError() returns fError. For some reasons, fError can have a
> non zero value, even though the file is NOT zombie. The problem is that
> the fError needs to be initialized before it can be used (the below
> function is a constructor). So just add this line fError=0; //-->ADDING
> THIS LINE to the function below.
>
> TDST::TDST(const char *bosFile, void* addresses, int total)
> {
> // Create one TDST object and open the 1st data file
>
> fError=0; //-->ADDING THIS LINE
> fBankAddr = (struct addressBanks_t*)addresses; //all info about
> bank variables
> fBankTotal = total; //total no of
> defined banks
> fDSTfile = new TFile(bosFile); //open DST input file
> if(fDSTfile->IsZombie()){ //if failed return
> error
> fprintf(stderr,"Zombie file? \n");
> fError=1;
> return;
> }
> fBankTree = (TTree*)gDirectory->Get("bankTree"); //get the tree
> if(fBankTree==NULL){
> fprintf(stderr,"failed to open banktree \n");
> return;
> }
> fBigBuff = new char[100000]; //create a 100k buffer to hold the
> event
> fDataStartAddr = fBigBuff; //init the data pointer
> fDataAddr = fBigBuff; //ditto
> fServedBankNo=0; //init the no of banks being handled
> fEntry=0;
> fMaxEntry=(int)fBankTree->GetEntries(); //get the no of events in the
> DST file
> for(int n=0;n<fBankTotal;n++){ //init the status of all banks to
> zero
> fBankStatus[n]=0;
> }
> }
>
>
>
> If you still have same problems, then the root file is truely a zombie!
> But it is a good practice to initialize variables before using them. Btw,
> you need to reinstall rootbeer.
>
> Sincerely,
> Dao Ho
>
> _______________________________________________
> G14_run mailing list
> G14_run at jlab.org
> https://mailman.jlab.org/mailman/listinfo/g14_run
--
===============================================================
Franz J. Klein, Associate Professor
CUA, Department of Physics
Washington, DC 20064
office: Hannan Hall 206 phone: 202-319-6190
or: Jefferson Lab,CC F-243 phone: 757-269-6672
---------------------------------------------------------------
More information about the G14_run
mailing list