1 |
pam-fi |
1.1 |
/* |
2 |
|
|
* ReprocessTrackAction.cpp |
3 |
|
|
* |
4 |
|
|
* Created on: 23/dic/2009 |
5 |
|
|
* Author: C. De Santis, N. Mori |
6 |
|
|
*/ |
7 |
|
|
|
8 |
|
|
#include "ReprocessTrackAction.h" |
9 |
|
|
|
10 |
|
|
void ReprocessTrackAction::OnGood(PamLevel2 *event) { |
11 |
|
|
|
12 |
|
|
_allEvents++; |
13 |
|
|
|
14 |
|
|
TrkLevel1 *L1; |
15 |
|
|
if (_newTrkL1) |
16 |
|
|
if (_externalFlag) |
17 |
|
|
if (!(*_externalFlag)) |
18 |
|
|
return; |
19 |
|
|
else |
20 |
|
|
L1 = *_newTrkL1; // External L1 plus flag=true |
21 |
|
|
else |
22 |
|
|
L1 = *_newTrkL1; // External L1 plus no external flag |
23 |
|
|
else { |
24 |
|
|
L1 = (TrkLevel1*) event->GetPointerTo("TrkLevel1"); // Internal L1 |
25 |
|
|
TrkLevel0 *L0 = event->GetTrkLevel0(); |
26 |
|
|
if (!L0) { |
27 |
|
|
cout << "Missing TrkLevel0 event " << endl; |
28 |
|
|
return; |
29 |
|
|
} |
30 |
|
|
L0->ProcessEvent();// re-processing level0->level1 |
31 |
|
|
L1 = event->GetTrkLevel1(); |
32 |
|
|
L1->Clear(); |
33 |
|
|
L1->SetFromLevel1Struct(); |
34 |
|
|
} |
35 |
|
|
|
36 |
pam-fi |
1.3 |
if (_reprocL2) { |
37 |
|
|
// See if the event has a track before reprocessing |
38 |
|
|
TrkLevel2 *trkl2 = event->GetTrkLevel2(); |
39 |
|
|
bool hadTrack = false; |
40 |
|
|
if (trkl2->GetTrkLevel2()->GetNTracks() > 0) |
41 |
|
|
hadTrack = true; |
42 |
pam-fi |
1.1 |
|
43 |
pam-fi |
1.3 |
// Reprocess |
44 |
|
|
_reprocessed++; |
45 |
|
|
L1->ProcessEvent();// re-processing level1->level2 |
46 |
pam-fi |
1.1 |
|
47 |
pam-fi |
1.3 |
trkl2 = event->GetTrkLevel2(); |
48 |
|
|
trkl2->Clear(); |
49 |
|
|
trkl2->SetFromLevel2Struct(); |
50 |
pam-fi |
1.1 |
|
51 |
pam-fi |
1.3 |
// See if we gained or lost a track; |
52 |
|
|
if (trkl2->GetNTracks() > 0) { |
53 |
|
|
if (!hadTrack) { |
54 |
|
|
_recoveredTracks++; |
55 |
|
|
} |
56 |
|
|
} |
57 |
|
|
else if (hadTrack) { |
58 |
|
|
_lostTracks++; |
59 |
pam-fi |
1.1 |
} |
60 |
|
|
} |
61 |
|
|
} |