<commit_before>// $Id$
//**************************************************************************
//* This file is property of and copyright by the ALICE HLT Project        * 
//* ALICE Experiment at CERN, All rights reserved.                         *
//*                                                                        *
//* Primary Authors: <NAME> <<EMAIL>>        *
//*                  for The ALICE HLT Project.                            *
//*                                                                        *
//* 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.                  *
//**************************************************************************

/// @file   AliHLTTriggerBarrelMultiplicity.cxx
/// @author <NAME>
/// @date   2009-06-30
/// @brief  HLT trigger component for charged particle multiplicity in
///         the central barrel.

// see header file for class documentation
// or
// refer to README to build package
// or
// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt

#include "AliHLTTriggerBarrelMultiplicity.h"
#include "AliESDEvent.h"
#include "AliHLTTriggerDecision.h"
#include "AliHLTDomainEntry.h"
#include "AliHLTGlobalBarrelTrack.h"

/** ROOT macro for the implementation of ROOT specific class methods */
ClassImp(AliHLTTriggerBarrelMultiplicity)

AliHLTTriggerBarrelMultiplicity::AliHLTTriggerBarrelMultiplicity()
  : AliHLTTrigger()
  , fPtMin(0.0)
  , fPtMax(0.0)
  , fMinTracks(1)
{
  // see header file for class documentation
  // or
  // refer to README to build package
  // or
  // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
}

const char* AliHLTTriggerBarrelMultiplicity::fgkOCDBEntry="HLT/ConfigHLT/BarrelMultiplicityTrigger";

AliHLTTriggerBarrelMultiplicity::~AliHLTTriggerBarrelMultiplicity()
{
  // see header file for class documentation
}

const char* AliHLTTriggerBarrelMultiplicity::GetTriggerName() const
{
  // see header file for class documentation
  return "BarrelMultiplicityTrigger";
}

AliHLTComponent* AliHLTTriggerBarrelMultiplicity::Spawn()
{
  // see header file for class documentation
  return new AliHLTTriggerBarrelMultiplicity;
}

int AliHLTTriggerBarrelMultiplicity::DoTrigger()
{
  // see header file for class documentation
  int iResult=0;
  int numberOfTracks=-1;

  // try the ESD as input
  const TObject* obj = GetFirstInputObject(kAliHLTAllDataTypes, "AliESDEvent");
  AliESDEvent* esd = dynamic_cast<AliESDEvent*>(const_cast<TObject*>(obj));
  TString description;
  TString ptcut;
  if (esd != NULL) {
    numberOfTracks=0;
    esd->GetStdContent();
    
    for (Int_t i = 0; i < esd->GetNumberOfTracks(); i++) {
      if (CheckCondition(esd->GetTrack(i))) numberOfTracks++;
    }
  }

  // try the AliHLTExternal track data as input
  if (iResult>=0 && numberOfTracks<0) {
    for (const AliHLTComponentBlockData* pBlock=GetFirstInputBlock(kAliHLTDataTypeTrack);
	 pBlock!=NULL; pBlock=GetNextInputBlock()) {
      vector<AliHLTGlobalBarrelTrack> tracks;
      if ((iResult=AliHLTGlobalBarrelTrack::ConvertTrackDataArray(reinterpret_cast<const AliHLTTracksData*>(pBlock->fPtr), pBlock->fSize, tracks))>0) {
	for (vector<AliHLTGlobalBarrelTrack>::iterator element=tracks.begin();
	     element!=tracks.end(); element++) {
	  if (CheckCondition(&(*element))) numberOfTracks++;
	}<commit_msg>bugfix: the number of tracks was missing one track in case of the input from HLT tracks. Counter correctly set to 0 if the first block of this data type is found<commit_after>// $Id$
//**************************************************************************
//* This file is property of and copyright by the ALICE HLT Project        * 
//* ALICE Experiment at CERN, All rights reserved.                         *
//*                                                                        *
//* Primary Authors: <NAME> <<EMAIL>>        *
//*                  for The ALICE HLT Project.                            *
//*                                                                        *
//* 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.                  *
//**************************************************************************

/// @file   AliHLTTriggerBarrelMultiplicity.cxx
/// @author <NAME>
/// @date   2009-06-30
/// @brief  HLT trigger component for charged particle multiplicity in
///         the central barrel.

// see header file for class documentation
// or
// refer to README to build package
// or
// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt

#include "AliHLTTriggerBarrelMultiplicity.h"
#include "AliESDEvent.h"
#include "AliHLTTriggerDecision.h"
#include "AliHLTDomainEntry.h"
#include "AliHLTGlobalBarrelTrack.h"

/** ROOT macro for the implementation of ROOT specific class methods */
ClassImp(AliHLTTriggerBarrelMultiplicity)

AliHLTTriggerBarrelMultiplicity::AliHLTTriggerBarrelMultiplicity()
  : AliHLTTrigger()
  , fPtMin(0.0)
  , fPtMax(0.0)
  , fMinTracks(1)
{
  // see header file for class documentation
  // or
  // refer to README to build package
  // or
  // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
}

const char* AliHLTTriggerBarrelMultiplicity::fgkOCDBEntry="HLT/ConfigHLT/BarrelMultiplicityTrigger";

AliHLTTriggerBarrelMultiplicity::~AliHLTTriggerBarrelMultiplicity()
{
  // see header file for class documentation
}

const char* AliHLTTriggerBarrelMultiplicity::GetTriggerName() const
{
  // see header file for class documentation
  return "BarrelMultiplicityTrigger";
}

AliHLTComponent* AliHLTTriggerBarrelMultiplicity::Spawn()
{
  // see header file for class documentation
  return new AliHLTTriggerBarrelMultiplicity;
}

int AliHLTTriggerBarrelMultiplicity::DoTrigger()
{
  // see header file for class documentation
  int iResult=0;
  int numberOfTracks=-1;

  // try the ESD as input
  const TObject* obj = GetFirstInputObject(kAliHLTAllDataTypes, "AliESDEvent");
  AliESDEvent* esd = dynamic_cast<AliESDEvent*>(const_cast<TObject*>(obj));
  TString description;
  TString ptcut;
  if (esd != NULL) {
    numberOfTracks=0;
    esd->GetStdContent();
    
    for (Int_t i = 0; i < esd->GetNumberOfTracks(); i++) {
      if (CheckCondition(esd->GetTrack(i))) numberOfTracks++;
    }
  }

  // try the AliHLTExternal track data as input
  if (iResult>=0 && numberOfTracks<0) {
    for (const AliHLTComponentBlockData* pBlock=GetFirstInputBlock(kAliHLTDataTypeTrack);
	 pBlock!=NULL; pBlock=GetNextInputBlock()) {
      if (numberOfTracks<0) numberOfTracks=0;
      vector<AliHLTGlobalBarrelTrack> tracks;
      if ((iResult=AliHLTGlobalBarrelTrack::ConvertTrackDataArray(reinterpret_cast<const AliHLTTracksData*>(pBlock->fPtr), pBlock->fSize, tracks))>0) {
	for (vector<AliHLTGlobalBarrelTrack>::iterator element=tracks.begin();
	     element!=tracks.end(); element++) {
	  if (CheckCondition(&(*element))) numberOfTracks++;
	}
{'fraction_non_alphanumeric': 0.1404392764857881, 'fraction_numerical': 0.005555555555555556, 'mean_word_length': 3.2767955801104973, 'pattern_counts': {'":': 0, '<': 26, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3813', 'n_tokens_mistral': 2254, 'n_tokens_neox': 2190, 'n_words': 602}