From: slindal Date: Fri, 16 Apr 2010 12:11:07 +0000 (+0000) Subject: Created more advanced histo drawing for PHOS in alihlteve X-Git-Url: http://git.uio.no/git/?a=commitdiff_plain;ds=sidebyside;h=e77bc5e0bcefc9c07aa60068468c6fee087a6444;p=u%2Fmrichter%2FAliRoot.git Created more advanced histo drawing for PHOS in alihlteve --- diff --git a/HLT/EVE/AliHLTEveCalo.cxx b/HLT/EVE/AliHLTEveCalo.cxx index 21917c3b469..56e52160bfd 100644 --- a/HLT/EVE/AliHLTEveCalo.cxx +++ b/HLT/EVE/AliHLTEveCalo.cxx @@ -32,6 +32,10 @@ #include "AliHLTCaloClusterReader.h" #include "TEveTrans.h" #include "TString.h" +#include "TH2F.h" +#include "TH1F.h" + + ClassImp(AliHLTEveCalo); @@ -43,6 +47,11 @@ AliHLTEveCalo::AliHLTEveCalo(Int_t nm, TString name) : fName(name) { // Constructor. + for(int i = 0; i < 9; i++) { + fPadTitles[i] = ""; + } + + } AliHLTEveCalo::~AliHLTEveCalo() @@ -62,6 +71,8 @@ void AliHLTEveCalo::ProcessBlock(AliHLTHOMERBlockDesc * block) { //See header file for documentation if ( block->GetDataType().CompareTo("ROOTHIST") == 0 ) { + + cout <<"calo histo!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"<< endl; ProcessHistogram(block); } else { @@ -162,3 +173,122 @@ void AliHLTEveCalo::ResetElements(){ } } } + +Int_t AliHLTEveCalo::GetPadNumber(TString name) { + + + cout << "GetPadNumber name " << name << endl; + + for(int i = 0; i < 9; i++) { + if (!fPadTitles[i].CompareTo(name)){ + return i+1; + } + else if (!fPadTitles[i].CompareTo("")) { + cout <<"in empty title"<GetClassName().CompareTo("TObjArray")) { + TIter next((TObjArray*)(block->GetTObject())); + TObject *object; + + while (( object = (TObject*) next())) { + + Int_t iPad = GetPadNumber((static_cast(object))->GetName()); + canvas->cd(iPad); + + //Check if histo is 2D histo + TH2F* histo = dynamic_cast(object); + if(histo){ + + TString name = histo->GetName(); + if(name.Contains("ClusterEnergy")) { + cout << "BALLE CE"<< endl; + + Int_t lb = histo->FindLastBinAbove(0,1); + Int_t fb = histo->FindFirstBinAbove(0,1); + + if(lb > -1) { + histo->SetAxisRange(0, histo->GetXaxis()->GetBinUpEdge(histo->FindLastBinAbove(0, 1) + 3), "X"); + histo->SetAxisRange(0, histo->GetYaxis()->GetBinUpEdge(histo->FindLastBinAbove(0, 2) + 3), "Y"); + } + } + + else if (name.Contains("MatchDistance")) { + cout << "BALLE MD"<< endl; + Float_t min = histo->GetXaxis()->GetBinLowEdge( histo->FindFirstBinAbove(0, 1) -3 ); + Float_t max = histo->GetXaxis()->GetBinUpEdge( histo->FindLastBinAbove(0, 1) + 3); + min = TMath::Abs(min); + if(min > max) + max = min; + histo->SetAxisRange(-max, max, "X"); + + min = histo->GetYaxis()->GetBinLowEdge( histo->FindFirstBinAbove(0, 2) -3 ); + max = histo->GetYaxis()->GetBinUpEdge( histo->FindLastBinAbove(0, 2) + 3 ); + min = TMath::Abs(min); + if(min > max) + max = min; + histo->SetAxisRange(-max, max, "Y"); + } + + histo->Draw("COLZ"); + } + + + //Must be 1D histo + else { + TH1F* histo = dynamic_cast(object); + if (histo) { + + TString name = histo->GetName(); + + //canvas->cd(++cdCount); + + if(name.Contains("Energy")) { + histo->SetAxisRange(0, histo->GetXaxis()->GetBinUpEdge(histo->FindLastBinAbove(0, 1) + 3), "X"); + } + + else if(name.Contains("InvMass")) { + histo->SetAxisRange(histo->GetXaxis()->GetBinLowEdge(histo->FindLastBinAbove(0, 1) - 3), histo->GetXaxis()->GetBinUpEdge(histo->FindLastBinAbove(0, 1) + 3), "X"); + } + + histo->Draw(); + } else { + cout <<"AliHLTEveCaloBase::AddHistogramsTocCanvas: Histogram neither TH1F nor TH2F"<GetClassName().CompareTo("TH1F")) { + + TH1F* histo = reinterpret_cast(block->GetTObject()); + ++cdCount; + canvas->cd(cdCount); + histo->Draw(); + + } + + else if ( ! block->GetClassName().CompareTo("TH2F")) { + TH2F *histo = reinterpret_cast(block->GetTObject()); + if (histo) { + ++cdCount; + canvas->cd(cdCount); + histo->Draw("COLZ"); + } + } + + canvas->cd(); +} + diff --git a/HLT/EVE/AliHLTEveCalo.h b/HLT/EVE/AliHLTEveCalo.h index b9c118a6c44..19fa28351e4 100644 --- a/HLT/EVE/AliHLTEveCalo.h +++ b/HLT/EVE/AliHLTEveCalo.h @@ -56,9 +56,12 @@ protected : /** Process histogram block */ void ProcessHistogram(AliHLTHOMERBlockDesc * block ); - - + /** Process and draw histograms */ + void AddHistogramsToCanvas(AliHLTHOMERBlockDesc * block, TCanvas * canvas, Int_t &cdCount ); + + Int_t GetPadNumber(TString name); + TEveBoxSet * fBoxSet; //Boxset for clusters and digist TEveElementList * fElementList; //Element list to contain the clusters @@ -66,6 +69,7 @@ protected : const Int_t fNModules; //Number of modules in calorimeter + private: /** default constructor prohibited */ @@ -77,6 +81,8 @@ private: TString fName; //PHOS or EMCAL + TString fPadTitles[9]; + ClassDef(AliHLTEveCalo, 0); };