-
Notifications
You must be signed in to change notification settings - Fork 1
/
EventTypeCut.C
81 lines (64 loc) · 1.91 KB
/
EventTypeCut.C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
//////////////////////////////////////////////////////////////////////////////////////////////////////
///
/// Anthony Hillairet, April 2008
///
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Includes here
class EventTypeCut : public ModuleClass{
public :
EventTypeCut() {};
~EventTypeCut() {};
bool Init(EventClass &E, HistogramFactory &H, ConfigFile &Conf, log4cpp::Category *TmpLog) ;
bool Process(EventClass &E, HistogramFactory &H);
private :
log4cpp::Category *Log;
string Name;
vector<int> TypeList;
};
bool EventTypeCut::Init(EventClass &E, HistogramFactory &H, ConfigFile &Conf, log4cpp::Category *TmpLog)
{
Log = TmpLog;
Log->info( "Register Event Type Cut");
// -------- Name of the cut --------- //
Name = "Evt Type";
// --------- Special list of cut in this class for the global histograms --------- //
H.AddCut(Name);
if (not Conf.read<bool>("EventTypeCut/Do"))
{
Log->info( "Event Type Cut turned OFF");
return false ;
}
// --------- Histograms initialization --------- //
H.DefineTH1D( "EventTypeCut","EvtType_before", "Event Type before the cut;Event Type",36, -0.5,35.5);
H.DefineTH1D( "EventTypeCut","EvtType_after", "Event Type after the cut;Event Type",36, -0.5,35.5);
// --------- Parameters initialization --------- //
TypeList = StrToIntVect(Conf.read<string>("EventTypeCut/Types"));
return true;
}
bool EventTypeCut::Process(EventClass &E, HistogramFactory &H)
{
// ____ Event Type Cut ____ //
H.NbCandidateTracks(Name,E);
H.Fill("EvtType_before",E.type);
bool Type_OK = false;
for(vector<int>::iterator TR=TypeList.begin(); TR != TypeList.end(); TR++)
{
if( E.type == *TR)
{
Type_OK = true;
break;
}
if( E.type == (-1*(*TR)))
{
Type_OK = false;
break;
}
}
if( not Type_OK)
{
H.CutApplied(Name);
return false;
}
H.Fill("EvtType_after",E.type);
return true;
}