BRAT 2.4.5
Class index
Full class index
brahmlib
BRAHMS
ROOT page
//
// $Id: BrDetectorParamsBB.cxx,v 1.1.1.1 2001/06/21 14:55:00 hagel Exp $
#include <iostream.h>

#include "BrDetectorParamsBB.h"

ClassImp(BrDetectorParamsBB)


////////////////////////////////////////////////////////////
//
// BrDetectorParamsBB is a BRAHMS data class providing storage and 
// access function for BB specific digitization parameters.
// This allows modification of the BrDetectorParams content by the 
// user.
//
////////////////////////////////////////////////////////////

  BrDetectorParamsBB::BrDetectorParamsBB()
{
// Constructor. Set counter and list data members to zero.
// Don't use this constructor unless you have to and know
// what you are doing
// Use BrDetectorParams(Char_t, Char_t ) instead
}

//_________________________________________________________________________
 BrDetectorParamsBB::BrDetectorParamsBB(Char_t *name, Char_t *title) :
  BrDetectorParamsBase(name, title)

{
	// Standard constructor. 
	// the name should be that of the associated detector e.g. "H1"
SetDefaultParams();

}
//_________________________________________________________________________
 BrDetectorParamsBB::BrDetectorParamsBB(Char_t *name, Char_t *title,Char_t *filename) :
  BrDetectorParamsBase(name, title)

{
	// Standard constructor. 
	// the name should be that of the associated detector e.g. "H1"
SetDefaultParams();
ReadASCIIFile(filename);

}
//_________________________________________________________________________
  BrDetectorParamsBB::~BrDetectorParamsBB()
{
  // Default destructor
  //
}

//_________________________________________________________________________
 void BrDetectorParamsBB::SetDefaultParams()
{
  // Set a set of reasonable default parameters.
  // Number of tubes etc are ok with present design. 
  // This is mainly to ensure that the private members are
  // initialized with values that do not give rise to any
  // problems in the methods which uses these parameters;
  //
  fAdcGain     = 1.;      // Pe-> ADC conv = 1.0
  fSigmaTime   =.050;     // 50 psec
  fSigmaAdc    = 1.;      // dAdc/Adc == 100% of PE statistics
  fTdcConv     = 0.025;   // 25 pico seconds per channel (Philips 7681)
  fTdcOffset   = 10;      // channel number for t0
  fAdcOffset   =  0;      // Pedestal channel number
  fNoTubesLeft = 44;      // Number of Left hand tubes.
  fNoTubesRight= 35;      // Number of Right hand tubes.
  fNpePercm    = 180.0;    // Number of PE per unit path length
  fSignalSpeed = 0.050;   // 50 psec/cm <==> 1 nsec==20cm.
  fUVTLength   =  4.0;    // 
  fThetaAtt    =  0.25;   // Attenuation in NPE vs theta particle
  fThetaCut    =  1.8;    // Cutoff angle for attenuation.
  fQEBigTube   = 0.25;
  fQESmallTube  = 0.25;
  fEmissionGainBigTube   = 4;
  fEmissionGainSmallTube = 4;

}

//_________________________________________________________________________
 void BrDetectorParamsBB::ListParameters() const
{
  printf("**BB Parameter Listing; The Detector name is %sn",GetName());
  cout << "Simulation Parameters " << endl;
  cout << " ADC relative Gain  " << fAdcGain << " Channels per PEn";
  cout << " ADC resolution     " << fSigmaAdc << " (factor)n";
  cout << " ADC Offset         " << fAdcOffset << " ( channels)n";
  cout << " TDC conversion     " << fTdcConv*1000. << " (psec per channel)n";
  cout << " sigma (TDC)        " << fSigmaTime*1000.    << " (psec)n";
  cout << " TDC Offset         " << fTdcOffset << " ( channels)n";
  cout << " PE per cm          " << fNpePercm << "n";
  cout << " Theta cut          " << fThetaCut << "n";
  cout << " Theta attenuation  " << fThetaAtt << "n";
  cout << " Emission Gain (Big)" << fEmissionGainBigTube << "n";
  cout << " Emission Gain (Sma)" << fEmissionGainSmallTube << "n";


  cout << "Detector Parameters n";  
  cout << " No tubes left  = " << fNoTubesLeft << "n";
  cout << " No tubes right = " << fNoTubesRight << "n";
  cout << " UVT length     = " << fUVTLength << "n";
  cout << endl;

 }
//________________________________________________________________
 void BrDetectorParamsBB::SetASCIIParameters(Char_t *line) {
  //Interpret a line for DC params.  Form is ParamName:value.  Eg 
  //Eg fTwopar:.20 or fEff:  0.95
  Char_t ParamName[80];

  // Find first non-blank character in the line (in case user didn't
  // start in column 1  What if it does not find i..
  Int_t i;
  for(i=0; i < (Int_t)strlen(line);i++) {
    if(strncmp(&line[i]," ",1)) 
      break;
  }
  //Copy that to ParamName
  strcpy(ParamName,&line[i]);
  
  Char_t *iloc = strchr(ParamName,':');
  Char_t *value_loc = iloc+1;
  if(iloc) {
    iloc[0] = 0;    //blank out the semicolon
    Char_t *ilocc = strchr(ParamName,' ');
    if(ilocc) ilocc[0] = 0;   //blank out space at end if it exists
    if(!strcasecmp(ParamName,"fNoTubesLeft")) {
      sscanf(value_loc,"%d",&fNoTubesLeft);
    }
    else if(!strcasecmp(ParamName,"fNoTubesRight")) {
      sscanf(value_loc,"%d",&fNoTubesRight);
    }
    else if(!strcasecmp(ParamName,"fAdcGain")) {
      sscanf(value_loc,"%f",&fAdcGain);
    }
    else if(!strcasecmp(ParamName,"fSigmaTime")) {
      sscanf(value_loc,"%f",&fSigmaTime);
    }
    else if(!strcasecmp(ParamName,"fSigmaAdc")) {
      sscanf(value_loc,"%f",&fSigmaAdc);
    }
    else if(!strcasecmp(ParamName,"fTdcConv")) {
      sscanf(value_loc,"%f",&fTdcConv);
    }
    else if(!strcasecmp(ParamName,"fTdcOffset")) {
      sscanf(value_loc,"%f",&fTdcOffset);
    }
    else if(!strcasecmp(ParamName,"fAdcOffset")) {
      sscanf(value_loc,"%f",&fAdcOffset);
    }
    else if(!strcasecmp(ParamName,"fUVTLength")) {
      sscanf(value_loc,"%f",&fUVTLength);
    }
    else if(!strcasecmp(ParamName,"fNpePercm")) {
      sscanf(value_loc,"%f",&fNpePercm);
    }
    else if(!strcasecmp(ParamName,"fSignalSpeed")) {
      sscanf(value_loc,"%f",&fSignalSpeed);
    }
    else if(!strcasecmp(ParamName,"fThetaAtt")) {
      sscanf(value_loc,"%f",&fThetaAtt);
    }
    else if(!strcasecmp(ParamName,"fThetaCut")) {
      sscanf(value_loc,"%f",&fThetaCut);
    }
    else {
      cout<<"Error: "<<ParamName<<" is not one of the parameters"<<endl;
      return;
    }
    return;      //this is a normal return
  }
  else {
    cout<<"Error, : missing to delineate name from value"<<endl;
    cout<<"The string is "<<line<<endl;
    cout<<"No value set!!!"<<endl;
    return;
   }
}


//_______________________________________________________________________
 int BrDetectorParamsBB::ConvertGeantModuleNo(Bool_t Right, Int_t submodule){
  //
  // Convert the Geant Module numbers as defined in GBRAHMS into the Module 
  // Number as defined and used by the analysis code. The information can be
  // found on the Beam Beam Counter web pages and in the archived drawer.
  // Both submodule as well as the returned value will be counted from 1..Ntubes
  // in either the left or the right array.
  //
  int RightModules[] = {32, 31, 33, 34, 35,
                         3, 2, 1, 4, 5,
                         7, 6, 8, 9,
                         10, 11,
                         13, 12, 14, 15,
                         17, 16, 18, 19,
                         30, 25, 20, 29, 28, 27, 26, 24, 23, 22, 21};
  int LeftModules[] = { 37, 38, 39, 40, 41, 42, 43, 44,
                         1, 2, 3, 4, 5, 6, 7, 8,
                         9, 10, 11, 12, 13, 14, 15, 16,17,18,19,20,21,22,23,24,
                         25,26,27,28,
                         29,30,31,32,33,34,35,36};
  if(Right){
    if(submodule < 1 || submodule > fNoTubesRight){
      cerr << "Submodule out of Range " << submodule<< endl;
      return 0;
    }
    return RightModules[submodule-1];
  }
  else
    {
      if(submodule < 1 || submodule > fNoTubesLeft){
      cerr << "Submodule out of Range " << submodule<< endl;
      return 0;
    }
    return LeftModules[submodule-1];
  }

}

 Bool_t BrDetectorParamsBB::IsModuleBigTube(Bool_t Right, Int_t module){
  //
  //
  if(Right)
    if(module > 31) return kTRUE; 
    else if(module > 36) return kTRUE; 
  return kFALSE;
  
}
/////////////////////////////////////////////////////////////////////////
//
// $Log: BrDetectorParamsBB.cxx,v $
// Revision 1.1.1.1  2001/06/21 14:55:00  hagel
// Initial revision of brat2
//
// Revision 1.14  2000/09/26 20:12:25  videbaek
// Change default Adcoffset to 0
//
// Revision 1.13  2000/09/17 21:23:46  videbaek
// Add additional printout from Bb params
//
// Revision 1.12  2000/09/14 19:30:48  videbaek
// Added parameters for better tube resolution estimate.
// Fixed erros in module counting.
// Moved to single loop over tubes rather than one.
//
// Revision 1.11  2000/03/21 21:21:45  cholm
// Several changes: A few hacks where needed to compile on Digital Unix, noticably in my - Christian Holm - classes for the DB and Exceptions. Proberly still need to do something to some of Konstantins stuff. 
// Also, I removed a lot of warnings fromt the compiler, by teddying up the code. 
// Several places, old C-style indecies in for loops were assumed. 
// Corrected. Unused variables have been commented out.
//
// Revision 1.10  1999/11/30 22:21:17  videbaek
// Added method to convert geant module no to real life module no of
// beam beam counters.
//
// Revision 1.9  1999/03/07 00:00:43  hagel
//
// Revision 1.8  1998/12/08 17:36:43  videbaek
// Changed #tubes in left arry to proper default value of
// 44.
//
// Revision 1.7  1998/08/28 20:03:12  videbaek
// Output UVT length in list
//
// Revision 1.6  1998/08/25 16:35:43  videbaek
// Changed parameteer description
// Improved and expanded version of ListParameters()
//
// Revision 1.5  1998/08/21 13:33:53  videbaek
// improvements to algorithm. Consider theta
//
// Revision 1.4  1998/08/04 20:24:25  videbaek
// Changed detector parameters
//
// Revision 1.3  1998/07/31 19:32:14  videbaek
// Working version of BB digitize
//
// Revision 1.2  1998/07/27 16:27:02  videbaek
// Stat on modifiing BB - not complete
//
//


This page automatically generated by script docBrat by Christian Holm

Copyright ; 2002 BRAHMS Collaboration <brahmlib@rcf.rhic.bnl.gov>
Last Update on by

Validate HTML
Validate CSS