<commit_before>// $Id$
// Category: geometry
//
// Author: <NAME>
//
// Class AliDetSwitchVector
// ---------------------------
// See the class description in the header file.

#include "AliDetSwitchVector.h"
#include "AliDetSwitch.h"
#include "AliGlobals.h"
#include "AliFiles.h"

//_____________________________________________________________________________
AliDetSwitchVector::AliDetSwitchVector()
  : fMessenger(this)
{
//
}

//_____________________________________________________________________________
AliDetSwitchVector::AliDetSwitchVector(const AliDetSwitchVector& right)
  : fMessenger(this)
{
//
  AliGlobals::Exception("AliDetSwitchVector is protected from copying.");  
}

//_____________________________________________________________________________
AliDetSwitchVector::~AliDetSwitchVector() {
//   
  // destroy det switch vector
  DetSwitchIterator it;
  for (it = fDetSwitchVector.begin(); it != fDetSwitchVector.end(); it++)
    delete *it; 
}

// operators

//_____________________________________________________________________________
AliDetSwitchVector& 
AliDetSwitchVector::operator=(const AliDetSwitchVector& right)
{
  // check assignement to self
  if (this == &right) return *this;
  
  AliGlobals::Exception("AliDetSwitchVector is protected from assigning.");  

  return *this;  
}    
          
// protected methods

//_____________________________________________________________________________
AliDetSwitch* 
AliDetSwitchVector::GetDetSwitch(const G4String& moduleName) const
{
// Returns the detector switch with given detector name.
// ---

  DetSwitchConstIterator it;
  for (it = fDetSwitchVector.begin(); it != fDetSwitchVector.end(); it++)
    if ((*it)->GetDetName() == moduleName) return *it; 

  G4String text = "AliDetSwitchVector::GetDetSwitch:\n";
  text = text + "Wrong detector name for " + moduleName;   
  AliGlobals::Exception(text);
  return 0;  
} 

// public methods

//_____________________________________________________________________________
void AliDetSwitchVector::Add(AliDetSwitch* detSwitch)
{
// Adds detSwitch to the detSwitch vector.
// ---

  fDetSwitchVector.push_back(detSwitch);
  fMessenger.SetCandidates();
}  
  
//_____________________________________________________________________________
void AliDetSwitchVector::SwitchDetOn(const G4String& moduleNameVer)
{ 
// Switchs on module specified by name and version.
// ---

  DetSwitchIterator it;

  if (moduleNameVer == "ALL") {
    for (it = fDetSwitchVector.begin(); it != fDetSwitchVector.end(); it++)
      (*it)->SwitchOnDefault(); 
  }
  else if (moduleNameVer == "NONE") {
    for (it = fDetSwitchVector.begin(); it != fDetSwitchVector.end(); it++)
      (*it)->SwitchOff(); 
  }
  else {
    // get version number
    G4int len = moduleNameVer.length();
    G4String moduleName = moduleNameVer.substr(0, len-1);
    G4String version = moduleNameVer.substr(len-1, 1);
    G4int iVersion = AliGlobals::StringToInt(version);
<commit_msg>updated to mods in the messenger class<commit_after>// $Id$
// Category: geometry
//
// Author: <NAME>
//
// Class AliDetSwitchVector
// ---------------------------
// See the class description in the header file.

#include "AliDetSwitchVector.h"
#include "AliDetSwitch.h"
#include "AliGlobals.h"
#include "AliFiles.h"

//_____________________________________________________________________________
AliDetSwitchVector::AliDetSwitchVector()
  : fMessenger(this)
{
//
}

//_____________________________________________________________________________
AliDetSwitchVector::AliDetSwitchVector(const AliDetSwitchVector& right)
  : fMessenger(this)
{
//
  AliGlobals::Exception("AliDetSwitchVector is protected from copying.");  
}

//_____________________________________________________________________________
AliDetSwitchVector::~AliDetSwitchVector() {
//   
  // destroy det switch vector
  DetSwitchIterator it;
  for (it = fDetSwitchVector.begin(); it != fDetSwitchVector.end(); it++)
    delete *it; 
}

// operators

//_____________________________________________________________________________
AliDetSwitchVector& 
AliDetSwitchVector::operator=(const AliDetSwitchVector& right)
{
  // check assignement to self
  if (this == &right) return *this;
  
  AliGlobals::Exception("AliDetSwitchVector is protected from assigning.");  

  return *this;  
}    
          
// protected methods

//_____________________________________________________________________________
AliDetSwitch* 
AliDetSwitchVector::GetDetSwitch(const G4String& moduleName) const
{
// Returns the detector switch with given detector name.
// ---

  DetSwitchConstIterator it;
  for (it = fDetSwitchVector.begin(); it != fDetSwitchVector.end(); it++)
    if ((*it)->GetDetName() == moduleName) return *it; 

  G4String text = "AliDetSwitchVector::GetDetSwitch:\n";
  text = text + "Wrong detector name for " + moduleName;   
  AliGlobals::Exception(text);
  return 0;  
} 

// public methods

//_____________________________________________________________________________
void AliDetSwitchVector::Add(AliDetSwitch* detSwitch)
{
// Adds detSwitch to the detSwitch vector.
// ---

  fDetSwitchVector.push_back(detSwitch);
  fMessenger.Update();
}  
  
//_____________________________________________________________________________
void AliDetSwitchVector::SwitchDetOn(const G4String& moduleNameVer)
{ 
// Switchs on module specified by name and version.
// ---

  DetSwitchIterator it;

  if (moduleNameVer == "ALL") {
    for (it = fDetSwitchVector.begin(); it != fDetSwitchVector.end(); it++)
      (*it)->SwitchOnDefault(); 
  }
  else if (moduleNameVer == "NONE") {
    for (it = fDetSwitchVector.begin(); it != fDetSwitchVector.end(); it++)
      (*it)->SwitchOff(); 
  }
  else {
    // get version number
    G4int len = moduleNameVer.length();
    G4String moduleName = moduleNameVer.substr(0, len-1);
    G4String version = moduleNameVer.substr(len-1, 1);
    G4int iVersion = AliGlobals::StringToInt(version);

{'fraction_non_alphanumeric': 0.1239946380697051, 'fraction_numerical': 0.004021447721179625, 'mean_word_length': 4.562907735321528, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7566330', 'n_tokens_mistral': 1610, 'n_tokens_neox': 1575, 'n_words': 362}