Re: brief brat calibration tutorial

From: Flemming Videbaek (videbaek@sgs1.hirg.bnl.gov)
Date: Wed Aug 08 2001 - 20:40:19 EDT

  • Next message: Christian Holm Christensen: "A 'Heads Up' on storing BrMultRdo and BrTofRdo in TTree"

    Hi let me add a few words,
    
    a) Thesefirst two week period is a testing of the startup on rcas0005; if
    there are problems the DB (i.e calib, main and
    geometry) may be cleaned out and restrated. Hopefully this does not become
    necessary.
    b) In the list below I think that you also must use
    >   if (!mainDb->ConnectToCalib("query"))     // connect to the calibration
    >     return;                      // database
    
    Otherwise I trust the default is brahmlib (as least as of 10 days ago);
    
    You should also have the .bratdbrc in $HOME set properly for query  as a
    local knowledgeable person what the password - otherwise the description for
    Djam is a good intro (should be added to the Brat guide - yes pelase)
    
    Flemming
    
    
    >
    
    ------------------------------------------------------
    Flemming Videbaek
    Physics Department
    Brookhaven National Laboratory
    
    tlf: 631-344-4106
    fax 631-344-1334
    
    
    > On Wed, 8 Aug 2001, Peter H. L. Christiansen wrote:
    >
    > > I think this needs an official announcement with a few words for how to
    > > connect to the database for the stupid guys like me.
    > >
    >
    >
    > Peter et al,
    >
    > Here's a short description on how to get and use the DB parameters:
    >
    > In your bratmain config script, you should have this after the option
    > manager thing:
    >
    >
    >   BrMainDb* mainDb = BrMainDb::Instance();
    >   mainDb->SetUserName("query"); // DB user name for READING the DB only
    >   mainDb->SetHostName("rcas0005.rcf.bnl.gov");  // where the DB is
    >   mainDb->SetDbName("BrahmsMain");  // the main database
    >
    >   // Un comment if you need access to database
    >   if (!mainDb->Connect())       // connect to the main
    >     return;
    >
    >   if (!mainDb->ConnectToRun("query"))  // connect to the run DB (only
    >     return;                            // query is allowed for you)
    >
    >   if (!mainDb->ConnectToCalib())     // connect to the calibration
    >     return;                      // database
    >
    >
    >   // run info manager
    >
    >   BrRunInfoManager* runMan = BrRunInfoManager::Instance();
    >   runMan->SetDebugLevel(debugOption->GetValue());
    >   runMan->Register(runOption->GetValue());
    >
    > the register method is very important. If you are to scan a file where you
    > have a mixture of several runs, you have to register all runs in the right
    > order, this is very important! :
    >   runMan->Register(run1);
    >   runMan->Register(run2);
    >   runMan->Register(run3);
    > etc....
    >
    > Then just before your analysis modules, you have to write this:
    >      ~~~~~~~~~~~
    >
    >   // db update module
    >   BrDbUpdateModule* dbMod = new BrDbUpdateModule("DB", "DB Update");
    >   mainModule->AddModule(dbMod);
    >
    >
    > This module will update the run info and calibration parameter managers
    > depending on the run number. That's why this module should be before all
    > your analysis modules, so that all info is updated when you need it (and
    > not after when it's too late).
    >
    > That's it for the script. If you are prompted for the DB password as user
    > query, it means that you don't have the .bratdbrc file (in your home
    > directory) set correctly.
    > Ask Flemming to you show that since the info in that file is very
    confidential.
    >
    >
    > Now, if you want to use a calibration parameter in your analysis module,
    > you have to do it this way:
    >
    > In the init method, you should write something like that:
    >        ~~~~~~~~~~~
    >  BrParameterElementManager* calibMan =
    >      BrParameterElementManager::Instance();
    >
    >  fCalibration = (Br<some det>Calibration*)calibMan->
    >        Register("Br<some det>Calibration", "<det name>");
    >
    > here fCalibration is a private member of your module, its type is
    > Br<some det>Calibration*, e.g.: BrTofCalibration, BrChkvCalibration or
    > BrBbCalibration.
    >
    > Once, you have registered it, you have to specify which parameters you
    > want to use:
    >
    >  fCalibration->Use("<parameter name>");
    >
    > example:
    >   fTofCalibration->Use("topAdcGain");
    >   fTofCalibration->Use("deltaDelay");
    >
    > the parameter name is exactly the name used in the SQL database.
    > It is sometimes useful to know how to browse the SQL database by hand...
    >
    >
    > Ok, that's it for the Init method.
    > You might want to check if a revision exists (otherwise, you'll be in
    > trouble...) for the runs you're scanning:
    >
    > you can do it in the Begin method:
    >
    >   if (!fCalibration->RevisionExists("<parameter name>") {
    >     Fatal("Begin", "Couldn't find revision for <parameter name>. Giving
    up");
    >     return;
    >   }
    >
    >
    > Now, how to use the parameter:
    > In your Event method:
    >
    >   ...
    >   ...
    >   Float_t param = fCalibration->Get<parameter>(<tube no>);
    >   ...
    >   ...
    >
    > eg:
    >
    >  Float_t ped = fC1Calibration->GetPedestal(tube);
    >  Float_t adc = c1Dig->GetAdc(tube) - ped;
    >
    > (BTW Peter, Claus will commit tomorrow the change in the tube numbering :)
    >
    > That'all. If you have a problem using what I told you, then you can give
    in
    > working on Brahms rigth now :)
    >
    > Ciao
    > Djam
    >
    >
    >
    >
    



    This archive was generated by hypermail 2b30 : Wed Aug 08 2001 - 20:33:15 EDT