// Given user-measured offsets, this
// computes and prints the exact offsets
// (the coordinates of the irradiated zones)
{
          TCut goodtr("goodtr","trackx@.GetEntries()==1 && tracky@.GetEntries()==1 && trackx[0].chi2<10 && tracky[0].chi2<10 && residualx[0]<10 && residualy[0]<10");

// Uncomment the desired zone
// where to compute offsets	
	  TCut Aeff("Aeff","dist(GetX(bgch.ch),GetY(bgch.ch),trackx[0]->q - 263,tracky[0]->q + 13.5)<30");
//	  TCut Beff("Beff","dist(GetX(bgch.ch),GetY(bgch.ch),trackx[0]->q - 323,tracky[0]->q - 26.5)<30");
//	  TCut Ceff("Ceff","dist(GetX(bgch.ch),GetY(bgch.ch),trackx[0]->q - 383,tracky[0]->q - 26.5)<30");
//	  TCut Deff("Deff","dist(GetX(bgch.ch),GetY(bgch.ch),trackx[0]->q - 383,tracky[0]->q + 13.5)<30");
//	  TCut Eeff("Eeff","dist(GetX(bgch.ch),GetY(bgch.ch),trackx[0]->q - 383,tracky[0]->q + 53.5)<30");
//	  TCut Feff("Feff","dist(GetX(bgch.ch),GetY(bgch.ch),trackx[0]->q - 383,tracky[0]->q + 93.5)<30");
//	  TCut Geff("Geff","dist(GetX(bgch.ch),GetY(bgch.ch),trackx[0]->q - 503,tracky[0]->q - 26.5)<30");
//	  TCut Heff("Heff","dist(GetX(bgch.ch),GetY(bgch.ch),trackx[0]->q - 503,tracky[0]->q + 13.5)<30");
//	  TCut Ieff("Ieff","dist(GetX(bgch.ch),GetY(bgch.ch),trackx[0]->q - 503,tracky[0]->q + 93.5)<30");
//	  TCut Leff("Leff","dist(GetX(bgch.ch),GetY(bgch.ch),trackx[0]->q - 683,tracky[0]->q - 13.5)<30");
//	  TCut Meff("Meff","dist(GetX(bgch.ch),GetY(bgch.ch),trackx[0]->q - 683,tracky[0]->q + 113.5)<30");
//	  TCut Neff("Neff","dist(GetX(bgch.ch),GetY(bgch.ch),trackx[0]->q - 683,tracky[0]->q + 213.5)<30");
//	  TCut Oeff("Oeff","dist(GetX(bgch.ch),GetY(bgch.ch),trackx[0]->q - 503,tracky[0]->q + 53.5)<30");
//	  TCut Peff("Peff","dist(GetX(bgch.ch),GetY(bgch.ch),trackx[0]->q - 715,tracky[0]->q + 53.5)<30");

// Replace "Aeff" with the uncommented TCut
	  rd51tb->Draw("GetY(bgch.ch)",goodtr && Aeff);
	  double bgY = htemp->GetMean();
	  rd51tb->Draw("tracky[0].q",goodtr && Aeff);
	  double trkY = htemp->GetMean();
	  double offsety = bgY - trkY;
	  rd51tb->Draw("GetX(bgch.ch)",goodtr && Aeff);
	  double bgX = htemp->GetMean();
	  rd51tb->Draw("trackx[0].q",goodtr && Aeff);
	  double trkX = htemp->GetMean();
	  double offsetx = bgX - trkX;
	  std::cout << "offsetX; offsetY" << std::endl << offsetx << "; " << offsety << std::endl;
}
