<commit_before>// $Id$
// $MpId: testExistingPads2.C,v 1.3 2005/08/24 08:53:27 ivana Exp $
//
// Extended testExistingPads macro for testing which pad is seen as 
// "existing" by AliMpSector.
// The loop over pads is performed in two ways:
// 1) via sector area pad iterator
// 2) via indices

#include <iomanip>

void testExistingPads2(AliMpStationType station = kStation1,
                       AliMpPlaneType plane = kBendingPlane) 
{
  AliMpSectorReader r(station, plane);
  AliMpSector* sector = r.BuildSector();
  AliMpSectorSegmentation segmentation(sector);
  
  ofstream out1("testExistingPads2.ixiy.out", ios::out);
  ofstream out2("testExistingPads2.iter.out", ios::out);
  
  // First loop over indices
  cout << "Iterating via indices ..." << endl;
  Int_t counter1 = 0;
  if ( sector->GetDirection() == kX )
    for (Int_t i=1; i<segmentation.MaxPadIndexX()+1; i++) {
      for (Int_t j=1; j<segmentation.MaxPadIndexY()+1; j++) {
        AliMpIntPair indices(i,j);
        if ( segmentation.HasPad(indices) ) 
          out1 << std::setw(4) << ++counter1 << "  "
	       << segmentation.PadByIndices(indices) << endl;;
      }
    }

  if ( sector->GetDirection() == kY )
    for (Int_t j=1; j<segmentation.MaxPadIndexY()+1; j++) {
      for (Int_t i=1; i<segmentation.MaxPadIndexX()+1; i++) {
        AliMpIntPair indices(i,j);
        if ( segmentation.HasPad(indices) ) 
          out1 << std::setw(4) << ++counter1 << "  "
	       << segmentation.PadByIndices(indices) << endl;;
      }
    }
  
  // Second loop via pad area iterator
  cout << "Iterating via iterator ..." << endl;
  AliMpArea area(TVector2(600.,600.), TVector2(600.,600.) );
  AliMpVPadIterator* it = segmentation.CreateIterator(area);
  Int_t counter2 = 0;
  for (it->First(); ! it->IsDone(); it->Next()){
   
    out2 << std::setw(4) << ++counter2 << "  "
	 << it->CurrentItem() << endl;
  }  
}
<commit_msg>Updated for changing units mm->cm<commit_after>// $Id$
// $MpId: testExistingPads2.C,v 1.3 2005/08/24 08:53:27 ivana Exp $
//
// Extended testExistingPads macro for testing which pad is seen as 
// "existing" by AliMpSector.
// The loop over pads is performed in two ways:
// 1) via sector area pad iterator
// 2) via indices

#include <iomanip>

void testExistingPads2(AliMpStationType station = kStation1,
                       AliMpPlaneType plane = kBendingPlane) 
{
  AliMpSectorReader r(station, plane);
  AliMpSector* sector = r.BuildSector();
  AliMpSectorSegmentation segmentation(sector);
  
  ofstream out1("testExistingPads2.ixiy.out", ios::out);
  ofstream out2("testExistingPads2.iter.out", ios::out);
  
  // First loop over indices
  cout << "Iterating via indices ..." << endl;
  Int_t counter1 = 0;
  if ( sector->GetDirection() == kX )
    for (Int_t i=1; i<segmentation.MaxPadIndexX()+1; i++) {
      for (Int_t j=1; j<segmentation.MaxPadIndexY()+1; j++) {
        AliMpIntPair indices(i,j);
        if ( segmentation.HasPad(indices) ) 
          out1 << std::setw(4) << ++counter1 << "  "
	       << segmentation.PadByIndices(indices) << endl;;
      }
    }

  if ( sector->GetDirection() == kY )
    for (Int_t j=1; j<segmentation.MaxPadIndexY()+1; j++) {
      for (Int_t i=1; i<segmentation.MaxPadIndexX()+1; i++) {
        AliMpIntPair indices(i,j);
        if ( segmentation.HasPad(indices) ) 
          out1 << std::setw(4) << ++counter1 << "  "
	       << segmentation.PadByIndices(indices) << endl;;
      }
    }
  
  // Second loop via pad area iterator
  cout << "Iterating via iterator ..." << endl;
  AliMpArea area(TVector2(60.,60.), TVector2(60.,60.) );
  AliMpVPadIterator* it = segmentation.CreateIterator(area);
  Int_t counter2 = 0;
  for (it->First(); ! it->IsDone(); it->Next()){
   
    out2 << std::setw(4) << ++counter2 << "  "
	 << it->CurrentItem() << endl;
  }  
}

{'fraction_non_alphanumeric': 0.1609858416360776, 'fraction_numerical': 0.030414263240692185, 'mean_word_length': 3.075854700854701, 'pattern_counts': {'":': 0, '<': 89, '<?xml version=': 0, '>': 18, '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': '7135653', 'n_tokens_mistral': 1437, 'n_tokens_neox': 1362, 'n_words': 300}