26 TFile* dedxInput =
new TFile(m_filename);
27 TTree* track = (TTree*)dedxInput->Get(
"track");
42 const int maxhits = 100;
44 double dedxhit[maxhits];
46 track->SetBranchAddress(
"mean", &mean);
47 track->SetBranchAddress(
"dedx", &dedxpub);
48 track->SetBranchAddress(
"dedxsat", &dedx);
49 track->SetBranchAddress(
"dedxerr", &dedxerr);
50 track->SetBranchAddress(
"pF", &p);
51 track->SetBranchAddress(
"costh", &costh);
52 track->SetBranchAddress(
"numGoodLayerHits", &
nhits);
53 track->SetBranchAddress(
"wire", wire);
54 track->SetBranchAddress(
"dedxhit", dedxhit);
57 TTree* newtrack = track->CloneTree(0);
63 for(
unsigned int i = 0; i < track->GetEntries(); ++i ){
67 std::cout <<
"No good hits on this track...";
76 for (
int j = 0; j <
nhits; ++j) {
82 std::cout <<
"MEANS = " << dedx <<
"\t";
84 std::cout << dedx << std::endl << std::endl;
169 double dedx[],
int size)
const
173 std::vector<double> sortedDedx;
174 for(
int i = 0; i < size; ++i )
175 sortedDedx.push_back(dedx[i]);
176 std::sort(sortedDedx.begin(), sortedDedx.end());
178 double truncatedMeanTmp = 0.0;
179 double meanTmp = 0.0;
180 double sum_of_squares = 0.0;
181 int numValuesTrunc = 0;
182 const int numDedx = sortedDedx.size();
183 const int lowEdgeTrunc = int(numDedx * m_removeLowest);
184 const int highEdgeTrunc = int(numDedx * (1 - m_removeHighest));
185 for (
int i = 0; i < numDedx; i++) {
186 std::cout << sortedDedx[i] <<
"+\t";
187 meanTmp += sortedDedx[i];
188 if (i >= lowEdgeTrunc and i < highEdgeTrunc) {
189 truncatedMeanTmp += sortedDedx[i];
190 sum_of_squares += sortedDedx[i] * sortedDedx[i];
194 std::cout << std::endl;
199 if (numValuesTrunc != 0) {
200 truncatedMeanTmp /= numValuesTrunc;
202 truncatedMeanTmp = meanTmp;
206 truncatedMean = truncatedMeanTmp;
208 if (numValuesTrunc > 1) {
209 truncatedMeanErr = sqrt(sum_of_squares /
double(numValuesTrunc) - truncatedMeanTmp * truncatedMeanTmp) / double(numValuesTrunc - 1);
211 truncatedMeanErr = 0;
217 std::vector<double> dedx,
int size)
const
221 std::vector<double> sortedDedx = dedx;
222 std::sort(sortedDedx.begin(), sortedDedx.end());
224 double truncatedMeanTmp = 0.0;
225 double meanTmp = 0.0;
226 double sum_of_squares = 0.0;
227 int numValuesTrunc = 0;
228 const int numDedx = sortedDedx.size();
229 const int lowEdgeTrunc = int(numDedx * m_removeLowest);
230 const int highEdgeTrunc = int(numDedx * (1 - m_removeHighest));
231 for (
int i = 0; i < numDedx; i++) {
232 std::cout << sortedDedx[i] <<
"+\t";
233 meanTmp += sortedDedx[i];
234 if (i >= lowEdgeTrunc and i < highEdgeTrunc) {
235 truncatedMeanTmp += sortedDedx[i];
236 sum_of_squares += sortedDedx[i] * sortedDedx[i];
240 std::cout << std::endl;
245 if (numValuesTrunc != 0) {
246 truncatedMeanTmp /= numValuesTrunc;
248 truncatedMeanTmp = meanTmp;
252 truncatedMean = truncatedMeanTmp;
254 if (numValuesTrunc > 1) {
255 truncatedMeanErr = sqrt(sum_of_squares /
double(numValuesTrunc) - truncatedMeanTmp * truncatedMeanTmp) / double(numValuesTrunc - 1);
257 truncatedMeanErr = 0;
double I2D(double cosTheta, double I, double alpha, double gamma, double delta, double power, double ratio) const
double D2I(double cosTheta, double D, double alpha, double gamma, double delta, double power, double ratio) const