1 |
samvel |
1.1 |
/**
|
2 |
|
|
* PtRelSelector
|
3 |
|
|
* s8
|
4 |
|
|
*
|
5 |
|
|
* Created by Samvel Khalatian on Feb 3, 2011
|
6 |
|
|
* Copyright 2010, All rights reserved
|
7 |
|
|
*/
|
8 |
|
|
|
9 |
|
|
#include <TLorentzVector.h>
|
10 |
|
|
|
11 |
|
|
#include "IO/interface/Event.h"
|
12 |
|
|
#include "S8Tree/interface/S8Jet.h"
|
13 |
|
|
#include "S8Tree/interface/S8Lepton.h"
|
14 |
|
|
#include "Selector/interface/PtRelSelector.h"
|
15 |
|
|
|
16 |
|
|
using s8::Event;
|
17 |
|
|
using s8::PtRelSelector;
|
18 |
|
|
|
19 |
|
|
PtRelSelector::PtRelSelector() throw():
|
20 |
|
|
_min_muon_pt(0)
|
21 |
|
|
|
22 |
|
|
{
|
23 |
|
|
_modified_event = new Event();
|
24 |
|
|
_modified_muons = new Leptons();
|
25 |
|
|
}
|
26 |
|
|
|
27 |
|
|
PtRelSelector::~PtRelSelector() throw()
|
28 |
|
|
{
|
29 |
|
|
delete _modified_muons;
|
30 |
|
|
delete _modified_event;
|
31 |
|
|
}
|
32 |
|
|
|
33 |
|
|
void PtRelSelector::treeDidLoad(const TriggerCenter *)
|
34 |
|
|
{
|
35 |
|
|
}
|
36 |
|
|
|
37 |
|
|
const Event *PtRelSelector::operator()(const Event *event)
|
38 |
|
|
{
|
39 |
|
|
// Event should contain one muon with pT above XXX GeV/c
|
40 |
|
|
//
|
41 |
|
|
_modified_muons->clear();
|
42 |
|
|
for(Leptons::const_iterator muon = event->muons()->begin();
|
43 |
|
|
event->muons()->end() != muon;
|
44 |
|
|
++muon)
|
45 |
|
|
{
|
46 |
|
|
if (_min_muon_pt > (*muon)->p4()->Pt())
|
47 |
|
|
continue;
|
48 |
|
|
|
49 |
|
|
_modified_muons->push_back(*muon);
|
50 |
|
|
}
|
51 |
|
|
|
52 |
|
|
if (1 != _modified_muons->size())
|
53 |
|
|
return 0;
|
54 |
|
|
|
55 |
|
|
if (2 != event->jets()->size())
|
56 |
|
|
return 0;
|
57 |
|
|
|
58 |
|
|
// Event has passed the selection. Copying is cheap b/c only pointers
|
59 |
|
|
// to collections are copied.
|
60 |
|
|
//
|
61 |
|
|
*_modified_event = *event;
|
62 |
|
|
|
63 |
|
|
// Substitute muons and jets
|
64 |
|
|
//
|
65 |
|
|
_modified_event->setMuons(_modified_muons);
|
66 |
|
|
|
67 |
|
|
return _modified_event;
|
68 |
|
|
}
|
69 |
|
|
|
70 |
|
|
void PtRelSelector::optionMuonPtIsSet(const double &value)
|
71 |
|
|
{
|
72 |
|
|
_min_muon_pt = value;
|
73 |
|
|
}
|