+}
+
+//_____________________________________________________
+void AliTRDTenderSupply::ApplyRunByRunCorrection(AliESDtrack *const track) {
+ //
+ // Equalize charge distribution by applying run-by-run correction (multiplicative)
+ //
+
+ TVectorD *corrfactor = dynamic_cast<TVectorD *>(fRunByRunCorrection->GetObject(fTender->GetRun()));
+ if(!corrfactor) AliDebug(2, "Couldn't derive gain correction factor from OADB");
+ else AliDebug(2, Form("Gain factor from OADB %f", (*corrfactor)[0]));
+ Double_t slice = 0;
+ for(Int_t ily = 0; ily < kNPlanes; ily++){
+ for(Int_t islice = 0; islice < track->GetNumberOfTRDslices(); islice++){
+ slice = track->GetTRDslice(ily, islice);
+ if(slice < 0.001) continue; // do not modify slices which are 0 or negative
+ slice *= (*corrfactor)[0];
+ track->SetTRDslice(slice, ily, islice);
+ }
+ }
+}
+
+//_____________________________________________________
+void AliTRDTenderSupply::MaskChambers(AliESDtrack *const track, const Int_t * const chamberID){
+ //
+ // Mask out chambers which are in the list of bad chambers
+ // Set chamber signal to 0 and reduce the number of tracklets used for PID
+ //
+ AliDebug(2, "Masking bad chambers for TRD track");
+ Int_t nTrackletsPID = 0, nslice = 0, nTracklets = track->GetTRDntracklets();
+ Bool_t badChamber = kFALSE;
+ //Int_t nbad = 0 ; // Number of bad chambers which contain also a signal
+ //Int_t nsliceBad = 0; // Number of slices in tracklet in a bad chamber
+ for(Int_t iplane = 0; iplane < kNPlanes; iplane++){
+ badChamber = kFALSE;
+ nslice = 0; //nsliceBad = 0;
+ if(IsBadChamber(chamberID[iplane])) badChamber = kTRUE;
+ for(Int_t islice = 0; islice < track->GetNumberOfTRDslices(); islice++){
+ if(badChamber){
+ //if(track->GetTRDslice(iplane, islice)) nsliceBad++;
+ track->SetTRDslice(-1, iplane, islice);
+ } else if(track->GetTRDslice(iplane, islice) > 0.001) nslice++;
+ }
+ //if(nsliceBad) nbad++;
+ if(nslice > 0) nTrackletsPID++;
+ }
+ //if(nbad) track->SetTRDncls(track->GetTRDncls() - 20 * nbad); // subtract mean number of clusters per tracklet for bad tracklets