1 |
konec |
1.1 |
#include "UserCode/L1RpcTriggerAnalysis/interface/AnaMenu.h"
|
2 |
|
|
#include "TObjArray.h"
|
3 |
|
|
#include "TH1D.h"
|
4 |
|
|
#include "TH2D.h"
|
5 |
|
|
#include "TGraphErrors.h"
|
6 |
|
|
#include "UserCode/L1RpcTriggerAnalysis/interface/MuonObj.h"
|
7 |
|
|
#include "UserCode/L1RpcTriggerAnalysis/interface/EventObj.h"
|
8 |
konec |
1.2 |
#include "UserCode/L1RpcTriggerAnalysis/interface/Utilities.h"
|
9 |
|
|
#include "UserCode/L1RpcTriggerAnalysis/interface/TriggerMenuResultObj.h"
|
10 |
konec |
1.1 |
#include <sstream>
|
11 |
|
|
#include <iostream>
|
12 |
konec |
1.2 |
#include <cmath>
|
13 |
konec |
1.1 |
|
14 |
|
|
namespace {
|
15 |
konec |
1.2 |
TH1D *hMuonPt_MEN, *hMuonEta_MEN, *hMuonPhi_MEN;
|
16 |
konec |
1.1 |
}
|
17 |
|
|
|
18 |
|
|
|
19 |
|
|
bool AnaMenu::filter( const EventObj* ev, const MuonObj* muon,
|
20 |
konec |
1.2 |
const TriggerMenuResultObj *bitsL1,
|
21 |
|
|
const TriggerMenuResultObj *bitsHLT)
|
22 |
|
|
|
23 |
konec |
1.1 |
{
|
24 |
konec |
1.2 |
if (bitsL1->names.size() != 0) namesL1=bitsL1->names;
|
25 |
|
|
if (bitsHLT->names.size() != 0) namesHLT=bitsHLT->names;
|
26 |
|
|
const std::vector<unsigned int> & algosL1 = bitsL1->firedAlgos;
|
27 |
|
|
const std::vector<unsigned int> & algosHLT = bitsHLT->firedAlgos;
|
28 |
|
|
|
29 |
|
|
|
30 |
konec |
1.1 |
typedef std::vector<unsigned int>::const_iterator CIT;
|
31 |
|
|
|
32 |
|
|
// static int count = 0;
|
33 |
|
|
// std::cout <<"----------"<<std::endl;
|
34 |
|
|
bool hasNoL1Mu= false;
|
35 |
|
|
for (CIT it=algosL1.begin(); it != algosL1.end(); ++it) {
|
36 |
|
|
std::string nameAlgo = namesL1[*it];
|
37 |
|
|
// std::cout <<nameAlgo << std::endl;
|
38 |
|
|
if (theAlgosL1.find(nameAlgo) == theAlgosL1.end()) theAlgosL1[nameAlgo]=0;
|
39 |
|
|
bool isMu = ( nameAlgo.find("Mu") != std::string::npos);
|
40 |
|
|
if (!isMu) hasNoL1Mu = true;
|
41 |
|
|
}
|
42 |
|
|
// if (hasNoL1Mu) std::cout <<" HAS NO L1 MUON!: " <<++count<< std::endl;
|
43 |
|
|
|
44 |
|
|
bool hasNoHLTMu= false;
|
45 |
|
|
for (CIT it=algosHLT.begin(); it != algosHLT.end(); ++it) {
|
46 |
|
|
std::string nameAlgo = namesHLT[*it];
|
47 |
|
|
// std::cout <<nameAlgo << std::endl;
|
48 |
|
|
if (theAlgosHLT.find(nameAlgo) == theAlgosHLT.end()) theAlgosHLT[nameAlgo]=0;
|
49 |
|
|
if (nameAlgo.find("Physic") != std::string::npos) continue;
|
50 |
|
|
bool isMu = ( (nameAlgo.find("Mu") != std::string::npos) && (nameAlgo.find("Multi") == std::string::npos) );
|
51 |
|
|
if (!isMu) hasNoHLTMu = true;
|
52 |
|
|
}
|
53 |
|
|
// if (hasNoHLTMu) std::cout <<" HAS NO HLT MUON!" << std::endl;
|
54 |
|
|
|
55 |
konec |
1.2 |
//if (hasNoL1Mu && hasNoHLTMu) {
|
56 |
|
|
if (!hasNoL1Mu && !hasNoHLTMu) {
|
57 |
konec |
1.1 |
for (CIT it=algosL1.begin(); it != algosL1.end(); ++it) theAlgosL1[ namesL1[*it] ]++;
|
58 |
|
|
for (CIT it=algosHLT.begin(); it != algosHLT.end(); ++it) theAlgosHLT[ namesHLT[*it] ]++;
|
59 |
konec |
1.2 |
if (hMuonPt_MEN) hMuonPt_MEN->Fill(muon->pt());
|
60 |
|
|
if (hMuonEta_MEN) hMuonEta_MEN->Fill(muon->eta());
|
61 |
|
|
if (hMuonPhi_MEN) hMuonPhi_MEN->Fill(muon->phi());
|
62 |
konec |
1.1 |
return true;
|
63 |
|
|
}
|
64 |
|
|
|
65 |
|
|
return false;
|
66 |
|
|
}
|
67 |
|
|
|
68 |
|
|
void AnaMenu::resume(TObjArray& histos)
|
69 |
|
|
{
|
70 |
|
|
unsigned int sizeL1 = theAlgosL1.size();
|
71 |
|
|
unsigned int sizeHLT = theAlgosHLT.size();
|
72 |
|
|
TH1D *hMenuAlgosL1 = new TH1D( "hMenuAlgosL1", "hMenuAlgosL1", sizeL1, 1., 1.+sizeL1); histos.Add(hMenuAlgosL1);
|
73 |
|
|
TH1D *hMenuAlgosHLT = new TH1D("hMenuAlgosHLT","hMenuAlgosHLT",sizeHLT, 1., 1.+sizeHLT); histos.Add(hMenuAlgosHLT);
|
74 |
|
|
unsigned int ibin = 0;
|
75 |
|
|
typedef std::map< std::string, unsigned int>::const_iterator CIM;
|
76 |
|
|
for (CIM it=theAlgosL1.begin(); it != theAlgosL1.end(); ++it) {
|
77 |
|
|
ibin++;
|
78 |
|
|
hMenuAlgosL1->GetXaxis()->SetBinLabel(ibin, (*it).first.c_str());
|
79 |
|
|
hMenuAlgosL1->SetBinContent(ibin, (*it).second);
|
80 |
konec |
1.2 |
// std::cout <<" BIN "<<ibin<<" LABEL: "<<(*it).first.c_str()<<" ENTRIES:"<<(*it).second<<std::endl;
|
81 |
konec |
1.1 |
}
|
82 |
|
|
ibin = 0;
|
83 |
|
|
for (CIM it=theAlgosHLT.begin(); it != theAlgosHLT.end(); ++it) {
|
84 |
|
|
ibin++;
|
85 |
|
|
hMenuAlgosHLT->GetXaxis()->SetBinLabel(ibin, (*it).first.c_str());
|
86 |
|
|
hMenuAlgosHLT->SetBinContent(ibin, (*it).second);
|
87 |
konec |
1.2 |
// std::cout <<" BIN "<<ibin<<" LABEL: "<<(*it).first.c_str()<<" ENTRIES:"<<(*it).second<<std::endl;
|
88 |
konec |
1.1 |
}
|
89 |
|
|
}
|
90 |
|
|
|
91 |
|
|
|
92 |
|
|
void AnaMenu::init(TObjArray& histos)
|
93 |
|
|
{
|
94 |
konec |
1.2 |
hMuonPt_MEN = new TH1D("hMuonPt_MEN","All global muons Pt;Glb.muon p_{T} [GeV];Muons / bin",L1PtScale::nPtBins,L1PtScale::ptBins); histos.Add(hMuonPt_MEN);
|
95 |
|
|
hMuonEta_MEN = new TH1D("hMuonEta_MEN","All global muons Eta;Glb.muon #eta;Muons / bin",96, -2.4, 2.4); histos.Add(hMuonEta_MEN);
|
96 |
|
|
hMuonPhi_MEN = new TH1D("hMuonPhi_MEN","All global muons Phi;Glb.muon #phi [rad];Muons / bin",90,-M_PI,M_PI); histos.Add(hMuonPhi_MEN);
|
97 |
konec |
1.1 |
}
|