eEmMultiplicity.cxx 2.79 KB
Newer Older
1
/*
2
  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3
4
*/
/*********************************
5
 * eEmMultiplicity.cpp
6
7
8
9
10
11
12
13
14
15
16
 * Created by Carlos Moreno on 05/06/20.
 *
 * @brief algorithm that computes the multiplicity for a specified list and ET threshold
 * line 1: 0 or 1, line 1 and 2 : 2 or more, uses 2 bits
 *
 * @param NumberLeading MinET

**********************************/

#include <cmath>

17
#include "L1TopoAlgorithms/eEmMultiplicity.h"
18
19
20
21
#include "L1TopoCommon/Exception.h"
#include "L1TopoInterfaces/Count.h"

#include "L1TopoEvent/TOBArray.h"
22
#include "L1TopoEvent/eEmTOBArray.h"
23
24
#include "L1TopoEvent/GenericTOB.h"

25
REGISTER_ALG_TCS(eEmMultiplicity)
26
27
28
29

using namespace std;


30
TCS::eEmMultiplicity::eEmMultiplicity(const std::string & name) : CountingAlg(name)
31
32
33
34
35
36
37
{
   
   
   setNumberOutputBits(12); //To-Do: Make this flexible to addapt to the menu. Each counting requires more than one bit

}

38
TCS::eEmMultiplicity::~eEmMultiplicity(){}
39
40
41


TCS::StatusCode
42
TCS::eEmMultiplicity::initialize() { 
43
44
45
46

  m_threshold = getThreshold();

  // book histograms
47
  std::string hname_accept = "heEmMultiplicity_accept_"+m_threshold->name();
48
  bookHist(m_histAccept, hname_accept, "eta vs pT", 150, -100, 100, 30, 0., 20.);
49

50
  hname_accept = "heEmMultiplicity_accept_counts_"+m_threshold->name();
51
  bookHist(m_histAccept, hname_accept, "Counts", 15, 0., 10. );
52
53
54
55
56
57
58

  return StatusCode::SUCCESS;
     
}


TCS::StatusCode
59
TCS::eEmMultiplicity::processBitCorrect( const TCS::InputTOBArray & input,
60
61
62
					 Count & count)

{
63
   return process(input, count);
64
65
66
}

TCS::StatusCode
67
TCS::eEmMultiplicity::process( const TCS::InputTOBArray & input,
68
69
70
71
72
73
74
			       Count & count )
{

  // Grab the threshold and cast it into the right type
  auto eEMThr = dynamic_cast<const TrigConf::L1Threshold_eEM &>(*m_threshold);

  // Grab inputs
75
  const eEmTOBArray & eems = dynamic_cast<const eEmTOBArray&>(input);
76

77
  int counting = 0; 
78
79
  
  // loop over input TOBs
80
81
82
  for(eEmTOBArray::const_iterator eem = eems.begin();
      eem != eems.end();
      ++eem ) {
83
    
84
    const GenericTOB gtob(**eem);
85

86
87
88
89
90
91
92
    // Dividing by 4 standing for converting eta from 0.025 to 0.1 granularity as it is defined in the menu as 0.1 gran.
    bool passed = gtob.Et() >= eEMThr.thrValueCounts(gtob.eta()/4);

    if ( !isocut(TrigConf::Selection::wpToString(eEMThr.reta()), gtob.Reta()) ) {continue;}
    if ( !isocut(TrigConf::Selection::wpToString(eEMThr.rhad()), gtob.Rhad()) ) {continue;}
    if ( !isocut(TrigConf::Selection::wpToString(eEMThr.wstot()), gtob.Wstot()) ) {continue;}

93
94
    if (passed) {
      counting++; 
95
      fillHist2D( m_histAccept[0], gtob.eta(), gtob.EtDouble() );
96
97
98
99
100
101
102
103
104
105
106
107
    }

  }

  fillHist1D( m_histAccept[1], counting);
  
  // Pass counting to TCS::Count object - output bits are composed there
  count.setSizeCount(counting);
  
  return TCS::StatusCode::SUCCESS;

}