2 #include "TPCdEdxDataCorrection.hxx" 3 #include "HighlandAnalysisUtils.hxx" 4 #include "VersioningUtils.hxx" 11 if (versionUtils::prod6_corrections)
12 sprintf(filename,
"%s/data/TPCdEdxCorrection_p6B.dat", getenv(
"HIGHLANDCORRECTIONSROOT"));
14 sprintf(filename,
"%s/data/TPCdEdxCorrection_p5F.dat", getenv(
"HIGHLANDCORRECTIONSROOT"));
17 std::cout <<
" CT correction data " << filename << std::endl;
18 FILE *pFile = fopen(filename,
"r");
21 printf(
"Cannot open file.\n");
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];
38 itr = corrTPC1.begin();
43 double TPCdEdxDataCorrection::GetCorrection(
int run,
int subrun,
unsigned long det) {
46 comb = std::make_pair(run, subrun);
48 for (; itr != corrTPC1.end(); itr++) {
49 if (comb.first * 1000 + comb.second >= itr->first.first * 1000 + itr->first.second) {
52 if (comb.first * 1000 + comb.second < itr->first.first * 1000 + itr->first.second) {
54 comb0 = std::make_pair(itr->first.first, itr->first.second);
57 return corrTPC1[comb0];
59 return corrTPC2[comb0];
61 return corrTPC3[comb0];
68 if (itr == corrTPC1.begin())
72 std::cout <<
"combination not found!!!!!" << run <<
" " << subrun << std::endl;
73 itr = corrTPC1.begin();
75 return GetCorrection(run, subrun, det);
91 for (
unsigned int i = 0; i < spill.
Bunches.size(); i++) {
95 for (Int_t j = 0; j < nTPC; j++) {
96 for (
int k = 0; k < allTpcTracks[j]->
nTPCSegments; k++) {
116 tpcTrack->
Pullmu = pulls[0];
117 tpcTrack->
Pullp = pulls[2];
118 tpcTrack->
Pullpi = pulls[3];
Float_t Pullmu
Muon pull of the segment: (dEdxMeas-dEdxexpMuon)/dEdxSigmaMuon.
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.
All corrections should be registered with the CorrectionManager.
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.
static SubDetId::SubDetEnum GetSubdetectorEnum(unsigned long BitField)
Get the single subdetector that this track is from.
Representation of a TPC segment of a global track.
void Apply(AnaSpillC &spill)
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.