All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
AngularCorrection_dEdxProcessor.cc
Go to the documentation of this file.
2 
3 #define _USE_MATH_DEFINES
4 #include <cmath>
5 #include <math.h>
6 
7 using namespace lcio;
8 using namespace marlin;
9 
11 
13  : Processor("AngularCorrection_dEdxProcessor") {
14 
15  // Processor description
16  _description = "Correct_AngularCorrection_dEdxProcessor: Makes a hard angular-based correction of dEdx for all the Tracks in the event. ATTENTION: this processor rewrites the MarlinTrk Collection and it is to be used only for simulations produced with ILCSoft from v02 to v02-02-01" ;
17 
18  registerInputCollection(LCIO::TRACK,
19  "LDCTrackCollection",
20  "LDC track collection name",
22  std::string("MarlinTrkTracks"));
23 
24  std::vector<float> _newpar = { 0.970205,
25  0.0007506,
26  4.41781e-8,
27  5.8222e-8};
28 
29  // ***************************************
30  // Fit of NormLamdaFullAll_1 (dEdxAnalyser) using single particle samples recosntructed with v02-02-01
31  // 2021/04
32  // (including the default previous angular correction)
33  //Minimizer is Linear
34  //Chi2 = 807.398
35  //NDf = 27
36  //p0 = 0.970205 +/- 0.000127468
37  //p1 = 0.00075065 +/- 1.55853e-05
38  //p2 = 4.41781e-08 +/- 5.09662e-07
39  //p3 = 5.8222e-08 +/- 4.71913e-09
40  //
41  registerProcessorParameter( "AngularCorrectionParameters",
42  "parameter for new angular correction dedx= uncorrected_dedx / f, with f= pol3(lambda)",
43  _par,
44  _newpar);
45 
46 
47 
48 }
49 
51  streamlog_out(DEBUG) << " init called " << std::endl ;
52  // it's usually a good idea to
53  printParameters();
54 
55 }
56 
58 }
59 
61 
62  //fill values
63  _LDCCol = evt->getCollection( _LDCTrackCollection ) ;
64  int nTrkCand = _LDCCol->getNumberOfElements();
65 
66  for (int iTRK=0;iTRK<nTrkCand;++iTRK) {
67 
68  TrackImpl * trkCand = (TrackImpl*) _LDCCol->getElementAt( iTRK );
69 
70  float dedx=trkCand->getdEdx();
71  float dedx_error=trkCand->getdEdxError();
72  float trklambda = trkCand->getTanLambda();
73 
74  float lambda = fabs(atan(trklambda)*180./M_PI);
75  double f3 = 1 / (_par[0] + _par[1] * lambda + _par[2] * pow(lambda,2) + _par[3] * pow(lambda,3) );
76 
77  double new_dedx = dedx*f3;
78 
79  streamlog_out(DEBUG) << "Original dEdx: " <<dedx <<" Error: "<<dedx_error <<std::endl;
80  streamlog_out(DEBUG) << "NeW dEdx: " <<new_dedx <<" Error: "<<dedx_error <<std::endl;
81 
82  //fill values
83  trkCand->setdEdx(new_dedx);
84  trkCand->setdEdxError(dedx_error);
85  }
86 }
87 
89 }
90 
92 }
93 
AngularCorrection_dEdxProcessor This processor calculates an extra correction to be applied to the ...
virtual void processRunHeader(LCRunHeader *run)
AngularCorrection_dEdxProcessor aAngularCorrection_dEdxProcessor