Re: [ROOT] Using TMapFile with a batch producer

From: Otto Schaile (Otto.Schaile@Physik.uni-muenchen.de)
Date: Wed May 10 2000 - 14:06:43 MEST


Hi Alberto,

I guess you got a problem with address space, your Batch producer is
likely
to be smaller the the root.exe

Please consult TMapFile::SetMapAdress

Cheers
Otto

Alberto Baldisseri wrote:
> 
> Hi rooters,
>     I am trying to use the TMapFile class to do a monitoring. I have a
> producer task (batch)
> that read the events from the DAQ and store some histograms in a
> TMapFile. I would like
> to access those histograms with an interactive root session. When I try
> to open the TMapFile
> from the root session I get a segmentation fault :
> 
> TMapFile* mfile = TMapFile::Create("hsimple.map")
>  *** Break *** segmentation violation
> 
>     I code a simple producer as hprod.C but running in batch as follows
> :
> 
> //
> // Batch producer
> //
> #include <TROOT.h>
> #include <TH1.h>
> #include <TH2.h>
> #include <TProfile.h>
> #include <TMapFile.h>
> #include <TRandom.h>
> 
> int  main(int argc, char *argv[])
> 
> {
>   TROOT myroot("myroot","ALICE DAQ events");
>   TMapFile* mfile = TMapFile::Create("hsimple.map","RECREATE", 100000,
>          "Demo memory mapped file with histograms");
> 
>   TH1F* hpx    = new TH1F("hpx","This is the px distribution",100,-4,4);
> 
>   TH2F* hpxpy  = new TH2F("hpxpy","py vs px",40,-4,4,40,-4,4);
>   TProfile* hprof  = new TProfile("hprof","Profile of pz versus
> px",100,-4,4,0,20);
> 
>    // Set a fill color for the TH1F
>   hpx->SetFillColor(48);
> 
>   // Print status of mapped file
>   mfile->Print();
> 
>   // Endless loop filling histograms with random numbers
>   Float_t px, py, pz;
>   int ii = 0;
>   while (1) {
>     //    gRandom->Rannor(px,py);
>     pz = px*px + py*py;
>     hpx->Fill(px);
>     hpxpy->Fill(px,py);
>     hprof->Fill(px,pz);
>     if (!(ii % 10)) {
>       mfile->Update();       // updates all objects in shared memory
>       if (!ii) mfile->ls();  // print contents of mapped file after
>     }                         // first update
>     ii++;
>   }
> }
> 
>     The interactive examples in the tutorials (hprod.C and hcons.C)
> works fine, so
> what is the difference with the batch ? Perhaps I miss someting ? I try
> this with
> root versions 2.23.09 and 2.24.04 on Linux RH6.2. This example have
> worked last
> year with root version 2.22.
> 
> Anybody have an idea ?
> 
> Regards,
> 
> Alberto
> 
> --
> +-------------------------------+------------------------------------+
> | Alberto BALDISSERI            | Tel : (33-1) 69 08 93 33           |
> | DAPNIA/SPhN, Bat 703 pièce 42 | Fax : (33-1) 69 08 75 84           |
> | CEA Saclay                    | E-mail : a.baldisseri@cea.fr       |
> | F 91191 Gif-sur-Yvette cedex  |                                    |
> +-------------------------------+------------------------------------+

-- 
Dr. Otto Schaile            Sektion Physik, LMU Muenchen
Phone: +49 89 289 14070     Am Coulombwall 1, D-85748 Garching, Germany
GSM:   +49 171 4312031
FAX:   +49 89 289 14072     EMail: Otto.Schaile@Physik.Uni-Muenchen.DE



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:24 MET