[Brahms-dev-l] tof2 adc gap calibration

From: Hironori Ito <hito@rcf.rhic.bnl.gov>
Date: Thu Sep 09 2004 - 19:17:05 EDT
Hey.  How were we committing TOF AdcGap calibration?  Eun-Joo just asked 
me to commit some AdcGap calibration to our database after she failed to 
do so.  Since I am "nice" (and it did sound very easy), I just tried it 
for run 9500.  It looked like it did except that all entries in our 
database were "-1111" for Run 9500 (adc gap things).   Now, this did not 
really look good since we don't want to have corrupt database.  After 
looking at BRAT code and committing "-1111" values in our database 
several times (I should have comment out BrDbCommitModule for testing), 
I found out the cause of this problem.  It is in 
BrTofAdcGapCalModule::Finish() method.  Here is the problematic (???) code.


  // if load ascii mode
  if (fLoadAscii || !fFillHistoOnly)     <---------?????  Should this be 
    if (fLoadAscii)
    return;

  // if commit mode
  if (fCommitAscii) {
    ReadAscii();
    return;
  }


This means that if you just want to commit (without filling histogram) 
values from ascii file, it just never gets to ReadAscii() method, which 
is required.  So, this is my question.  How have you ever committing 
these values?  Anyhow, since I am not TOF expert here, I will stop 
contaminating our TOF2 adc calibration and let our expert to fix this.  
(This means that currently our database value for run 9500 is "-1111" 
for adc gaps.  )

Hiro


attached mail follows:


Dear Hiro,

Somehow I couldn't put TFW2.gap files to CalibDB.
I don't know why. Since TFW2.gap has bad numbers,
I couldn't do any adc calibration and after that.
Would you put TFW2.gap from run 9500 to 11291?
I attached CommitAdcGap.C script.
And please let me know when you are done.
I tried it a hour, and am asking your help.

Thanks...

Eun-Joo

******************************************
*  Calibration for Tof detector TFW2
*  ADC Gap stuff 
*     Used events from run ??? 
******************************************
*
* slat  |  top Gap width  |  top Gap start  |  bot Gap width  |  bot Gap start  
* ---------------------

1    2232    3828    2072    3788
2    -1111    -1111    -1111    -1111
3    2424    3788    2144    3748
4    2376    3780    2120    3732
5    2168    3940    1960    3788
6    2400    3900    2192    3748
7    2288    3916    1952    3748
8    -1111    -1111    -1111    -1111
9    2072    3900    2032    3828
10    2216    3940    1992    3748
11    2464    3908    2368    3724
12    2328    3916    2152    3708
13    2296    3900    2176    3700
14    2248    3852    2064    3820
15    2520    3820    2264    3812
16    2448    3820    2136    3788
17    2384    3804    2104    3764
18    2136    3876    1944    3772
19    2552    3860    2160    3756
20    2272    3852    2160    3748
21    2280    3844    2040    3724
22    2304    3844    2080    3764
23    2576    3812    2208    3740
24    2416    3812    2088    3724
25    2368    3788    2088    3716
26    2264    3940    2112    3820
27    2320    3908    2272    3812
28    -1111    -1111    -1111    -1111
29    2296    3892    2096    3772
30    1648    3972    1744    3908
31    1552    3988    1688    3908
32    1576    3956    1672    3892
33    1472    4036    1480    3972
34    1600    4004    1624    3948
35    1544    4004    1640    3940
36    1632    3980    1424    3924
37    1520    3972    1472    3948
38    1632    3948    1624    3924
39    1680    3940    1640    3916
40    1600    3924    1568    3900
41    -1111    -1111    -1111    -1111
//__________________________________________________________________
//
// $Id: CommitAdcGain.C,v 1.4 2003/06/11 18:52:21 videbaek Exp $
// $Author: videbaek $
// $Date: 2003/06/11 18:52:21 $
//
//__________________________________________________________________

#ifndef __CINT__
CommitAdcGain() 
#endif 
{
#include <iostream>

  //__________________________________________________________________
  //
  // "Greetings carbon-based spicies ..."
  // 
  cout << "*-----------------------------------------------*" << endl
       << "*      Calibration of TOF detector ADC gains    *" << endl
       << "*-----------------------------------------------*" << endl;
  
  //__________________________________________________________________
  //
  // Command line options
  // 

  BrAppOptionManager* optionManager = BrAppOptionManager::Instance();

  BrAppStringOption* dbuserOption = 
    new BrAppStringOption('U', "maindb-user", "Mysql user name", "query");
  BrAppStringOption* maindbOption =
    new BrAppStringOption('M', "maindb-host", "Mysql database server", "brahms-db0.rcf.bnl.gov");
  BrAppStringOption* parametersOption = 
    new BrAppStringOption('p', "parameters", "Parameters file name", "DetectorParameters.txt");
  BrAppIntOption* irunOption = 
    new BrAppIntOption('r', "initial-run", "Initial run number", 0);
  BrAppIntOption* frunOption = 
    new BrAppIntOption('f', "final-run", "Final run number", 0);
  BrAppIntOption* verboseOption =
    new BrAppIntOption('v', "verbose", "Verbosity", 0);
  BrAppIntOption* debugOption =
    new BrAppIntOption('d', "debug", "Debug level", 0);
  BrAppStringOption* tofOption = 
    new BrAppStringOption('t', "tof", "Tof (TOF1, TOF2 or TOFW)", "TOFW");
  BrAppStringOption* commentOption = 
    new BrAppStringOption('\0', "tof-comment", "Comments on TOF delay calibration", "");
  BrAppStringOption* fileOption = 
    new BrAppStringOption('i', "infile", "Delay calibration file", "TOF.del");

  if (!optionManager->ProcessCommandLine()) {
    Warning("CommitAdcGain", "Bad command line, try --help option");
    return;
  }
  
  //________________________________________________________________
  //
  // Database section
  //
  BrMainDb* mainDb = BrMainDb::Instance();
  mainDb->SetUserName(dbuserOption->GetValue());
  mainDb->SetHostName(maindbOption->GetValue()); 
  mainDb->SetDbName("BrahmsMain");

  // Un comment if you need access to database 
  if (!mainDb->Connect())
    return;   
  if (!mainDb->ConnectToRun("query"))
    return;
  if (!mainDb->ConnectToCalib("insert"))
    return;
  
  // run info 
  BrRunInfoManager* runMan = BrRunInfoManager::Instance();
  runMan->SetDebugLevel(debugOption->GetValue());
  runMan->Register(irunOption->GetValue());
  if (frunOption->GetValue() > irunOption->GetValue())
    runMan->Register(frunOption->GetValue());
  
  // parameter elements
  BrCalibrationManager* parMan = BrCalibrationManager::Instance();
  parMan->SetDebugLevel(debugOption->GetValue());
  
  
  //__________________________________________________________________
  // 
  // Parameter and geometry managers
  // 
  // A detector parameter manager. Should probably replaced by an
  // interface to a database.

  BrParameterDbManager *pardb = BrParameterDbManager::Instance();
  pardb->SetDbParameterFileName(parametersOption->GetValue());
  pardb->SetDebugLevel(debugOption->GetValue());
    
  //__________________________________________________________________
  //
  // The main module 
  // 
    
  BrMainModule* mainModule = 
    new BrMainModule("CommitAdcGain", "Tof calibration commit", 
		     "Djamel Ouerdane", 0, 1, 0);
  mainModule->SetMaxRuns(1);
  mainModule->SetMaxEvents(0);
  
  
  // db update module
  BrDbUpdateModule* dbUpMod = new BrDbUpdateModule("DBUP", "DB Update");
  mainModule->AddModule(dbUpMod);
  
  //--------------------
  // calibration modules
  //--------------------
  
 // TOF
  if (commentOption->GetValue()[0] != '\0') {
    BrTofAdcGapCalModule* tof = 
      new BrTofAdcGapCalModule(tofOption->GetValue(), tofOption->GetValue());
    tof->SetCommitAscii(kTRUE);
    tof->SetComment(commentOption->GetValue());
    tof->SetCalibFile(fileOption->GetValue());
    mainModule->AddModule(tof);
  }



 // ---- DB modules commit

  BrDbCommitModule* dbCoMod = new BrDbCommitModule("DBCO", "DB Commit");
  dbCoMod->SetInitialRun(irunOption->GetValue());// for start time af revision
  dbCoMod->SetFinalRun(irunOption->GetValue());    // for end time of revision

  if (frunOption->GetValue() > irunOption->GetValue()) 
    dbCoMod->SetFinalRun(frunOption->GetValue());
  
  mainModule->AddModule(dbCoMod);


  //__________________________________________________________________
  //
  // Debug and verbosity 
  //

  
  mainModule->SetVerbose(verboseOption->GetValue());
  mainModule->SetDebugLevel(debugOption->GetValue());
  
  cout << "End of setup" << endl;
  
}

//____________________________________________________________________
//
// $Log: CommitAdcGap.C,v $
// Revision 1.4  2003/06/11 18:52:21  videbaek
//  Change all occurences of rcas0005 to brahms-db0
//
// Revision 1.3  2003/04/11 20:46:41  videbaek
// add the user query to connects
//
// Revision 1.2  2002/04/08 20:13:17  ouerdane
// updated all scripts and added new options to enable or disable a detector, set a comment at commit time and the ascii file as well
//
//


_______________________________________________
Brahms-dev-l mailing list
Brahms-dev-l@lists.bnl.gov
http://lists.bnl.gov/mailman/listinfo/brahms-dev-l
Received on Thu Sep 9 19:17:35 2004

This archive was generated by hypermail 2.1.8 : Thu Sep 09 2004 - 19:17:52 EDT