CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_7/src/DQMOffline/RecoB/src/HistoShifter.cc

Go to the documentation of this file.
00001 #include "DQMOffline/RecoB/interface/HistoShifter.h"
00002 
00003 #include "TH1F.h"
00004 
00005 bool HistoShifter::insertAndShift(TH1F* in, const float& value){
00006   const int& nBins = in->GetNbinsX();
00007   
00008   for (int i=2; i<nBins; ++i){
00009     in->SetBinContent(i-1,in->GetBinContent(i));
00010     in->SetBinError(i-1,in->GetBinError(i));
00011   }
00012   in->SetBinContent(nBins,value);
00013     
00014   return true;
00015 }
00016 
00017 bool HistoShifter::insertAndShift(TH1F* in, const float& value, const float& error){
00018   const bool& ok = insertAndShift(in, value);
00019   in->SetBinError(in->GetNbinsX(),error);
00020   return ok;
00021 }