| 1 |
/* |
| 2 |
* TofDedxVsBetaHistoAction.cpp |
| 3 |
* |
| 4 |
* Created on: 25-giu-2009 |
| 5 |
* Author: Nicola Mori |
| 6 |
*/ |
| 7 |
|
| 8 |
/*! @file TofDedxVsBetaHistoAction.cpp The TofDedxVsBetaHistoAction class implementation file. */ |
| 9 |
|
| 10 |
#include "TofDedxVsBetaHistoAction.h" |
| 11 |
|
| 12 |
TofDedxVsBetaHistoAction::TofDedxVsBetaHistoAction(const char *actionName, unsigned int layers, bool standAlone, |
| 13 |
TString outFileBase, TString mode, bool outRoot, bool outText, TString title) : |
| 14 |
Histo2DAction<Int_t> (actionName, title, outFileBase, mode, outRoot, outText), _layers(layers), _nLayers(0), |
| 15 |
_badEvents(0), _standAlone(standAlone) { |
| 16 |
|
| 17 |
if (title == "") { |
| 18 |
title = "TOF dE/dx ("; |
| 19 |
} |
| 20 |
if ((_layers & S11) == S11) { |
| 21 |
title += "S11"; |
| 22 |
_nLayers++; |
| 23 |
} |
| 24 |
if ((_layers & S12) == S12) { |
| 25 |
if (_nLayers > 0) |
| 26 |
title += ","; |
| 27 |
title += "S12"; |
| 28 |
_nLayers++; |
| 29 |
} |
| 30 |
if ((_layers & S21) == S21) { |
| 31 |
if (_nLayers > 0) |
| 32 |
title += ","; |
| 33 |
title += "S21"; |
| 34 |
_nLayers++; |
| 35 |
} |
| 36 |
if ((_layers & S22) == S22) { |
| 37 |
if (_nLayers > 0) |
| 38 |
title += ","; |
| 39 |
title += "S22"; |
| 40 |
_nLayers++; |
| 41 |
} |
| 42 |
if ((_layers & S31) == S31) { |
| 43 |
if (_nLayers > 0) |
| 44 |
title += ","; |
| 45 |
title += "S31"; |
| 46 |
_nLayers++; |
| 47 |
} |
| 48 |
if ((_layers & S32) == S32) { |
| 49 |
if (_nLayers > 0) |
| 50 |
title += ","; |
| 51 |
title += "S32"; |
| 52 |
_nLayers++; |
| 53 |
} |
| 54 |
title += ") Vs Beta"; |
| 55 |
|
| 56 |
cout << _layers << " " << _nLayers << endl; |
| 57 |
SetTitle(title); |
| 58 |
|
| 59 |
} |
| 60 |
|
| 61 |
void TofDedxVsBetaHistoAction::OnGood(PamLevel2 *event) { |
| 62 |
|
| 63 |
static float dEdx; |
| 64 |
static float dEdxLayer; |
| 65 |
static unsigned int badLayers; |
| 66 |
|
| 67 |
static int trkSeqNo; |
| 68 |
if (_standAlone) |
| 69 |
trkSeqNo = 0; |
| 70 |
else |
| 71 |
for (int i = 0; i < event->GetToFLevel2()->ntrk(); i++) { |
| 72 |
if (event->GetToFLevel2()->GetToFTrkVar(i)->trkseqno == event->GetTrack(0)->GetTrkTrack()->GetSeqNo()) |
| 73 |
trkSeqNo = i; |
| 74 |
} |
| 75 |
|
| 76 |
dEdx = 0.; |
| 77 |
badLayers = 0; |
| 78 |
if ((_layers & S11) == S11) { |
| 79 |
dEdxLayer = event->GetToFLevel2()->GetdEdx(trkSeqNo, 0, 100); |
| 80 |
if (dEdxLayer > 0. && dEdxLayer < 4090) |
| 81 |
dEdx += dEdxLayer; |
| 82 |
else |
| 83 |
badLayers++; |
| 84 |
} |
| 85 |
if ((_layers & S12) == S12) { |
| 86 |
dEdxLayer = event->GetToFLevel2()->GetdEdx(trkSeqNo, 1, 100); |
| 87 |
if (dEdxLayer > 0. && dEdxLayer < 4090) |
| 88 |
dEdx += dEdxLayer; |
| 89 |
else |
| 90 |
badLayers++; |
| 91 |
} |
| 92 |
if ((_layers & S21) == S21) { |
| 93 |
dEdxLayer = event->GetToFLevel2()->GetdEdx(trkSeqNo, 2, 100); |
| 94 |
if (dEdxLayer > 0. && dEdxLayer < 4090) |
| 95 |
dEdx += dEdxLayer; |
| 96 |
else |
| 97 |
badLayers++; |
| 98 |
} |
| 99 |
if ((_layers & S22) == S22) { |
| 100 |
dEdxLayer = event->GetToFLevel2()->GetdEdx(trkSeqNo, 3, 100); |
| 101 |
if (dEdxLayer > 0. && dEdxLayer < 4090) |
| 102 |
dEdx += dEdxLayer; |
| 103 |
else |
| 104 |
badLayers++; |
| 105 |
} |
| 106 |
if ((_layers & S31) == S31) { |
| 107 |
dEdxLayer = event->GetToFLevel2()->GetdEdx(trkSeqNo, 4, 100); |
| 108 |
if (dEdxLayer > 0. && dEdxLayer < 4090) |
| 109 |
dEdx += dEdxLayer; |
| 110 |
else |
| 111 |
badLayers++; |
| 112 |
} |
| 113 |
if ((_layers & S32) == S32) { |
| 114 |
dEdxLayer = event->GetToFLevel2()->GetdEdx(trkSeqNo, 5, 100); |
| 115 |
if (dEdxLayer > 0. && dEdxLayer < 4090) |
| 116 |
dEdx += dEdxLayer; |
| 117 |
else |
| 118 |
badLayers++; |
| 119 |
} |
| 120 |
if (badLayers == 0) { |
| 121 |
dEdx /= _nLayers; |
| 122 |
cout << _nLayers << " " << dEdx << endl; |
| 123 |
Fill(event->GetToFLevel2()->GetToFTrkVar(trkSeqNo)->beta[12], dEdx); |
| 124 |
} |
| 125 |
else |
| 126 |
_badEvents++; |
| 127 |
} |
| 128 |
|