HighLAND
Public Member Functions | List of all members
TPCdEdxDataCorrection Class Reference

#include <TPCdEdxDataCorrection.hxx>

Inheritance diagram for TPCdEdxDataCorrection:
CorrectionBase

Public Member Functions

 TPCdEdxDataCorrection ()
 
void Apply (AnaSpillC &spill)
 
- Public Member Functions inherited from CorrectionBase
 CorrectionBase (const CorrectionBase &corr)
 Copy constructor.
 
virtual ~CorrectionBase ()
 Everyone should have a destructor.
 
virtual const char * GetName () const
 Return the name of this correction. This overrides the TObject::GetName() interface.
 
const std::string & Name () const
 Return the name of this correction.
 
void SetName (const std::string &name)
 Set the name of this correction.
 
void Enable ()
 Enable the correction.
 
void Disable ()
 Disable the correction.
 
bool IsEnabled () const
 Is the correction enabled.
 
void SetAppliedInInput (bool ap)
 Set the correction as applied in the input file.
 
bool IsAppliedInInput () const
 Is the correction already applied in the input file ?
 
Int_t GetIndex () const
 Return the index of this correction.
 
void SetIndex (Int_t index)
 Set the index of this correction.
 
 ClassDef (CorrectionBase, 2)
 

Additional Inherited Members

- Protected Attributes inherited from CorrectionBase
std::string _name
 The name of this correction.
 
bool _enabled
 Is the correction enabled?
 
bool _appliedInInput
 Is the correction already applied in the input file ?
 
Int_t _index
 The index of the correction.
 

Detailed Description

This class defines a correction that affects the measured dE/dx of an AnaTpcSegment. This in turn affects the computed pulls (how electron-like a track is, for example).

This correction is applied to data, and is based on the run/subrun of this spill.

The corrections are defined in the baseAnalysis/data/TPCdEdxCorrection.dat. The format of this file is

run subrun corr_tpc1 err_tpc1 corr_tpc2 err_tpc2 corr_tpc3 err_tpc3

where corr_tpcN is the CT correction to apply to TPC N, and err_tpcN is the error on that correction.

Definition at line 21 of file TPCdEdxDataCorrection.hxx.

Constructor & Destructor Documentation

§ TPCdEdxDataCorrection()

TPCdEdxDataCorrection::TPCdEdxDataCorrection ( )

Constructor, which reads the corrections from the text file, and fills the member variables with the details.

Definition at line 7 of file TPCdEdxDataCorrection.cxx.

8 //********************************************************************
9 
10  char filename[300];
11  if (versionUtils::prod6_corrections)
12  sprintf(filename, "%s/data/TPCdEdxCorrection_p6B.dat", getenv("HIGHLANDCORRECTIONSROOT"));
13  else
14  sprintf(filename, "%s/data/TPCdEdxCorrection_p5F.dat", getenv("HIGHLANDCORRECTIONSROOT"));
15 
16 
17  std::cout << " CT correction data " << filename << std::endl;
18  FILE *pFile = fopen(filename, "r");
19 
20  if (pFile == NULL) {
21  printf("Cannot open file.\n");
22  exit(1);
23  }
24 
25  int run;
26  int subrun;
27 
28  float c[3]; // CT_expected -CT_measured
29  float ec[3]; // error on CT_expected - CT_measured
30 
31  while (fscanf(pFile, "%d%d%f%f%f%f%f%f", &run, &subrun, &c[0], &ec[0], &c[1], &ec[1], &c[2], &ec[2]) == 8) {
32  comb = std::make_pair(run, subrun);
33  corrTPC1[comb] = c[0];
34  corrTPC2[comb] = c[1];
35  corrTPC3[comb] = c[2];
36  }
37 
38  itr = corrTPC1.begin();
39  fclose(pFile);
40 }
All corrections should be registered with the CorrectionManager.

Member Function Documentation

§ Apply()

void TPCdEdxDataCorrection::Apply ( AnaSpillC spill)
virtual

Apply the dE/dx correction to all the AnaTpcSegment members of all tracks in the spill. See TPCdEdxDataCorrection class documentation for details.

Reimplemented from CorrectionBase.

Definition at line 80 of file TPCdEdxDataCorrection.cxx.

80  {
81 //********************************************************************
82 
83  AnaSpill& spill = *static_cast<AnaSpill*>(&spillBB);
84 
85  // No correction for MC
86  if (spill.GetIsMC())
87  return;
88 
89  Int_t subrun = spill.EventInfo->SubRun;
90 
91  for (unsigned int i = 0; i < spill.Bunches.size(); i++) {
92  AnaBunch* bunch = static_cast<AnaBunch*>(spill.Bunches[i]);
93  AnaTrackB* allTpcTracks[100];
94  int nTPC = anaUtils::GetAllTracksUsingDet(*bunch,SubDetId::kTPC, allTpcTracks);
95  for (Int_t j = 0; j < nTPC; j++) {
96  for (int k = 0; k < allTpcTracks[j]->nTPCSegments; k++) {
97  // The raw TPC track
98  AnaTPCParticleB* original = static_cast<const AnaTrackB*>(allTpcTracks[j]->Original)->TPCSegments[k];
99 
100  // The corrected TPC track
101  AnaTPCParticle* tpcTrack = static_cast<AnaTPCParticle*>(allTpcTracks[j]->TPCSegments[k]);
102 
103  // Get the raw CT
104  double CT0 = original->dEdxMeas;
105 
106  // Apply the correction
107  if (CT0 != 999999) {
108  // Apply correction only if the CT is a valid number.
109  tpcTrack->dEdxMeas = CT0 / GetCorrection(spill.EventInfo->Run, subrun, tpcTrack->Detector);
110 
111  //recompute TPC pulls
112  Float_t pulls[4];
113  anaUtils::ComputeTPCPull(*tpcTrack, pulls);
114 
115  tpcTrack->Pullele = pulls[1];
116  tpcTrack->Pullmu = pulls[0];
117  tpcTrack->Pullp = pulls[2];
118  tpcTrack->Pullpi = pulls[3];
119 
120  //for the kaon need to recompute explicitely
121  tpcTrack->Pullk = ((tpcTrack->dEdxMeas - tpcTrack->dEdxexpKaon) / tpcTrack->dEdxSigmaKaon);
122  }
123  }
124  }
125  }
126 }
Float_t Pullmu
Muon pull of the segment: (dEdxMeas-dEdxexpMuon)/dEdxSigmaMuon.
unsigned long Detector
Float_t Pullpi
Pion pull of the segment: (dEdxMeas-dEdxexpPion)/dEdxSigmaPion.
std::vector< AnaBunchC * > Bunches
The reconstructed objects, split into timing bunches.
AnaTPCParticleB * TPCSegments[NMAXTPCS]
The TPC segments that contributed to this global track.
AnaEventInfoB * EventInfo
Run, sunrun, event, time stamp, etc.
Int_t SubRun
The subrun number.
int nTPCSegments
How many TPC tracks are associated with this track.
const AnaParticleB * Original
Float_t dEdxSigmaKaon
Expected error on the dE/dx measurement, for the proton hypothesis.
bool GetIsMC() const
Return whether this spill is from Monte Carlo or not.
Float_t dEdxMeas
dE/dx as measured by the TPC.
Representation of a global track.
Float_t ComputeTPCPull(const AnaTPCParticleB &track, const std::string &particle)
Function to recompute the pull for a TPC track segment.
Representation of a TPC segment of a global track.
Float_t Pullk
Kaon pull of the segment: (dEdxMeas-dEdxexpPion)/dEdxSigmaKaon.
Float_t Pullp
Proton pull of the segment: (dEdxMeas-dEdxexpProton)/dEdxSigmaProton.
Float_t Pullele
Electron pull of the segment: (dEdxMeas-dEdxexpEle)/dEdxSigmaEle.
Representation of a TPC segment of a global track.
int GetAllTracksUsingDet(const AnaBunchB &bunch, SubDetId::SubDetEnum det, AnaTrackB *selTracks[])
Float_t dEdxexpKaon
Expected dE/dx for a proton, based on the reconstructed momentum.
Int_t Run
The ND280 run number.

The documentation for this class was generated from the following files: