many small changes...
authorekman <ekman@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 30 May 2006 10:03:45 +0000 (10:03 +0000)
committerekman <ekman@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 30 May 2006 10:03:45 +0000 (10:03 +0000)
PWG0/CorrectionMatrix2D.cxx
PWG0/CorrectionMatrix2D.h

index 759248d..cf35d66 100644 (file)
@@ -78,6 +78,34 @@ CorrectionMatrix2D &CorrectionMatrix2D::operator=(const CorrectionMatrix2D &c)
 }
 
 //____________________________________________________________________
+TH1F* CorrectionMatrix2D::Get1DCorrection(Char_t* opt) {
+  //
+  // integrate the correction over one variable 
+  // 
+
+  TH1D* meas1D; 
+  TH1D* gene1D; 
+
+  if (strcmp(opt,"x")==0) {
+    meas1D = fhMeas->ProjectionX();
+    gene1D = fhGene->ProjectionX();      
+  }
+  if (strcmp(opt,"y")==0) {
+    meas1D = fhMeas->ProjectionY();
+    gene1D = fhGene->ProjectionY();      
+  }
+  gene1D->Sumw2();
+
+  gene1D->SetName(Form("corr_1D_%s",fName.Data()));
+  gene1D->SetTitle(Form("corr_1D_%s",fName.Data()));
+
+  gene1D->Divide(gene1D, meas1D, 1, 1, "B");
+  
+  return (TH1F*)gene1D;   
+}
+
+
+//____________________________________________________________________
 void
 CorrectionMatrix2D::Copy(TObject& c) const 
 {
@@ -255,7 +283,7 @@ CorrectionMatrix2D::SaveHistograms() {
   //
   // saves the histograms 
   //
-
+  
   gDirectory->mkdir(fName.Data());
   gDirectory->cd(fName.Data());
   
@@ -275,13 +303,14 @@ void CorrectionMatrix2D::DrawHistograms()
   // draws all the four histograms on one TCanvas
   //
 
-  TCanvas* canvas = new TCanvas("Correction", "Correction", 800, 800);
+  TCanvas* canvas = new TCanvas(Form("correction_%s",fName.Data()), 
+                               Form("correction_%s",fName.Data()), 800, 800);
   canvas->Divide(2, 2);
-
+  
   canvas->cd(1);
   if (fhMeas)
     fhMeas->Draw("COLZ");
-
+  
   canvas->cd(2);
   if (fhGene)
     fhGene->Draw("COLZ");
@@ -290,6 +319,8 @@ void CorrectionMatrix2D::DrawHistograms()
   if (fhCorr)
     fhCorr->Draw("COLZ");
 
+  canvas->cd(4);
+
   // add: draw here the stat. errors of the correction histogram
   
 }
index b17f45c..08f4c73 100644 (file)
@@ -43,6 +43,8 @@ public:
   TH2F* GetGeneratedHistogram() { return fhGene; }
   TH2F* GetMeasuredHistogram()  { return fhMeas; }
 
+  TH1F* Get1DCorrection(Char_t* opt="x");
+
   void SetGeneratedHistogram(TH2F* agene) { fhGene = agene; }
   void SetMeasuredHistogram(TH2F* ameas)  { fhMeas = ameas; }
 
@@ -61,7 +63,7 @@ public:
   Bool_t  LoadHistograms(Char_t* fileName, Char_t* dir);
   Bool_t  LoadCorrection(Char_t* fileName, Char_t* dir) {return LoadHistograms(fileName, dir);}
   
-  void    RemoveEdges(Float_t cut=2, Int_t nBinsVtx=0, Int_t nBinsEta=0);
+  void    RemoveEdges(Float_t cut=2, Int_t nBinsX=0, Int_t nBinsY=0);
   
   Float_t GetCorrection(Float_t ax, Float_t ay) {return fhCorr->GetBinContent(fhCorr->FindBin(ax,ay));}