<commit_before>/**************************************************************************
 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
 *                                                                        *
 * Author: The ALICE Off-line Project.                                    *
 * Contributors are mentioned in the code where appropriate.              *
 *                                                                        *
 * Permission to use, copy, modify and distribute this software and its   *
 * documentation strictly for non-commercial purposes is hereby granted   *
 * without fee, provided that the above copyright notice appears in all   *
 * copies and that both the copyright notice and this permission notice   *
 * appear in the supporting documentation. The authors make no claims     *
 * about the suitability of this software for any purpose. It is          *
 * provided "as is" without express or implied warranty.                  *
 **************************************************************************/

/* $Id:  */

//____________________________________________________________________
//                                                                          
// T0 - T0. 
//
// This class is a singleton that handles various parameters of
// the T0 detectors.  
// Eventually, this class will use the Conditions DB to get the
// various parameters, which code can then request from here.
//                                                       
#include "AliLog.h"		  
#include "AliT0Parameters.h"	  
#include "AliT0CalibData.h"   
#include "AliT0LookUpValue.h"
#include <AliCDBManager.h>        
#include <AliCDBEntry.h>          
#include <AliCDBStorage.h>  
#include <TMath.h>
#include <TSystem.h>
#include <Riostream.h>
#include <TGeoManager.h>
#include <TGeoPhysicalNode.h>

AliT0CalibData* AliT0Parameters::fgCalibData = 0;
AliT0CalibData* AliT0Parameters::fgLookUp = 0;
AliT0CalibData* AliT0Parameters::fgSlewCorr =0;
//====================================================================
ClassImp(AliT0Parameters)
#if 0
  ; // This is here to keep Emacs for indenting the next line
#endif

//____________________________________________________________________
AliT0Parameters* AliT0Parameters::fgInstance = 0;
//____________________________________________________________________
AliT0Parameters* 
AliT0Parameters::Instance() 
{
  // Get static instance 
  if (!fgInstance) {
    fgInstance = new AliT0Parameters;
    fgInstance->Init();
  }
  return fgInstance;
}

//____________________________________________________________________
AliT0Parameters::AliT0Parameters()
  :fIsInit(kFALSE),
   fPh2Mip(0),fmV2Mip(0),
   fChannelWidth(0),fmV2Channel(0),
   fQTmin(0),fQTmax(0),
   fSlewingLED(),fSlewingRec(),
   fPMTeff(),
   fTimeDelayDA(0),fTimeDelayCFD(0),fTimeDelayTVD(0),fMeanT0(499),
   fCalibentry(), fLookUpentry(),fSlewCorr(),
   fLookUp(0), fNumberOfTRMs(0)

{
  // Default constructor 

  for (Int_t ipmt=0; ipmt<24; ipmt++)
    {
      SetSlewingLED(ipmt);
      SetSlewingRec(ipmt);
      SetWalk(ipmt);
      SetPh2Mip();      
      SetmV2Mip();      
      SetChannelWidth();
      SetmV2channel();
      SetQTmin();
      SetQTmax();
      SetPMTeff(ipmt);

   }
  SetTimeDelayTVD();
  SetZposition();
  SetNumberOfTRMs(2);
  
}

//__________________________________________________________________
void
AliT0Parameters::Init()
{
  // Initialize the parameters manager.  We need to get stuff from the
  // CDB here. 
 
   if (fIsInit) return;

  AliCDBStorage *stor =AliCDBManager::Instance()->GetStorage("local://$ALICE_ROOT");
  //time equalizing
  AliCDBEntry* fCalibentry  = stor->Get("T0/Calib/TimeDelay",0);
  if (fCalibentry)
   fgCalibData  = (AliT0CalibData*)fCalibentry->GetObject();
  else 
    AliError(" ALARM !!!! No time delays in CDB "); 
 //slewing correction
  AliCDBEntry* fSlewCorr  = stor->Get("T0/Calib/Slewing_Walk",0);
  if (fSlewCorr){
    fgSlewCorr  = (AliT0CalibData*)fSlewCorr->GetObject();
  }
  fLookUpentry  = stor->Get("T0/Calib/LookUp_Table",0);
  if (fLookUpentry){
    fgLookUp  = (AliT0CalibData*)fLookUpentry->GetObject();
  }
  else {
  const char * filename = gSystem->ExpandPathName("$ALICE_ROOT/T0/lookUpTable.txt");
  ifstream inFile(filename);
  fgLookUp->ReadAsciiLookup(filename);
  }

  fIsInit = kTRUE;
}


//__________________________________________________________________
Float_t
AliT0Parameters::GetTimeDelayDA(Int_t ipmt) 
{<commit_msg>Use the storage provided by the AliCDBManager. Set the initialization flag to kFALSE in case of unsuccessful attemt: this permits another try later<commit_after>/**************************************************************************
 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
 *                                                                        *
 * Author: The ALICE Off-line Project.                                    *
 * Contributors are mentioned in the code where appropriate.              *
 *                                                                        *
 * Permission to use, copy, modify and distribute this software and its   *
 * documentation strictly for non-commercial purposes is hereby granted   *
 * without fee, provided that the above copyright notice appears in all   *
 * copies and that both the copyright notice and this permission notice   *
 * appear in the supporting documentation. The authors make no claims     *
 * about the suitability of this software for any purpose. It is          *
 * provided "as is" without express or implied warranty.                  *
 **************************************************************************/

/* $Id:  */

//____________________________________________________________________
//                                                                          
// T0 - T0. 
//
// This class is a singleton that handles various parameters of
// the T0 detectors.  
// Eventually, this class will use the Conditions DB to get the
// various parameters, which code can then request from here.
//                                                       
#include "AliLog.h"		  
#include "AliT0Parameters.h"	  
#include "AliT0CalibData.h"   
#include "AliT0LookUpValue.h"
#include <AliCDBManager.h>        
#include <AliCDBEntry.h>          
#include <AliCDBStorage.h>  
#include <TMath.h>
#include <TSystem.h>
#include <Riostream.h>
#include <TGeoManager.h>
#include <TGeoPhysicalNode.h>

AliT0CalibData* AliT0Parameters::fgCalibData = 0;
AliT0CalibData* AliT0Parameters::fgLookUp = 0;
AliT0CalibData* AliT0Parameters::fgSlewCorr =0;
//====================================================================
ClassImp(AliT0Parameters)
#if 0
  ; // This is here to keep Emacs for indenting the next line
#endif

//____________________________________________________________________
AliT0Parameters* AliT0Parameters::fgInstance = 0;
//____________________________________________________________________
AliT0Parameters* 
AliT0Parameters::Instance() 
{
  // Get static instance 
  if (!fgInstance) {
    fgInstance = new AliT0Parameters;
    fgInstance->Init();
  }
  return fgInstance;
}

//____________________________________________________________________
AliT0Parameters::AliT0Parameters()
  :fIsInit(kFALSE),
   fPh2Mip(0),fmV2Mip(0),
   fChannelWidth(0),fmV2Channel(0),
   fQTmin(0),fQTmax(0),
   fSlewingLED(),fSlewingRec(),
   fPMTeff(),
   fTimeDelayDA(0),fTimeDelayCFD(0),fTimeDelayTVD(0),fMeanT0(499),
   fCalibentry(), fLookUpentry(),fSlewCorr(),
   fLookUp(0), fNumberOfTRMs(0)

{
  // Default constructor 

  for (Int_t ipmt=0; ipmt<24; ipmt++)
    {
      SetSlewingLED(ipmt);
      SetSlewingRec(ipmt);
      SetWalk(ipmt);
      SetPh2Mip();      
      SetmV2Mip();      
      SetChannelWidth();
      SetmV2channel();
      SetQTmin();
      SetQTmax();
      SetPMTeff(ipmt);

   }
  SetTimeDelayTVD();
  SetZposition();
  SetNumberOfTRMs(2);
  
}

//__________________________________________________________________
void
AliT0Parameters::Init()
{
  // Initialize the parameters manager.  We need to get stuff from the
  // CDB here. 
 
   if (fIsInit) return;

  AliCDBManager *stor =AliCDBManager::Instance();
  //time equalizing
  AliCDBEntry* fCalibentry  = stor->Get("T0/Calib/TimeDelay");
  if (fCalibentry)
   fgCalibData  = (AliT0CalibData*)fCalibentry->GetObject();
  else {
    AliError(" ALARM !!!! No time delays in CDB "); 
    fIsInit = kFALSE;
    return;
  }
 //slewing correction
  AliCDBEntry* fSlewCorr  = stor->Get("T0/Calib/Slewing_Walk");
  if (fSlewCorr){
    fgSlewCorr  = (AliT0CalibData*)fSlewCorr->GetObject();
  }
  fLookUpentry  = stor->Get("T0/Calib/LookUp_Table");
  if (fLookUpentry){
    fgLookUp  = (AliT0CalibData*)fLookUpentry->GetObject();
  }
  else {
  const char * filename = gSystem->ExpandPathName("$ALICE_ROOT/T0/lookUpTable.txt");
  ifstream inFile(filename);
  fgLookUp->ReadAsciiLookup(filename);
  }

  fIsInit = kTRUE;
}


//__________________________________________________________________
Float_t
AliT0Parameters::GetTimeDelayDA(Int_t ipmt) 
{
{'fraction_non_alphanumeric': 0.14470227670753064, 'fraction_numerical': 0.014995621716287216, 'mean_word_length': 3.1157657657657656, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 38, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 24, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5793569', 'n_tokens_mistral': 2728, 'n_tokens_neox': 2588, 'n_words': 607}