#include <../TPC/AliTPCclusterMI.h>
#include <../TPC/AliTPCseed.h>
-#include <TH2F.h>
#include <TFile.h>
#include <TTree.h>
#include <TCanvas.h>
-#include <TProfile.h>
+
+#include "TPC/AliTPCClusterHistograms.h"
ClassImp(AliROCESDAnalysisSelector)
AliROCESDAnalysisSelector::AliROCESDAnalysisSelector() :
AliSelector(),
fESDfriend(0),
- fhQmaxVsRow(0)
+ fClusterHistograms(0)
{
//
// Constructor. Initialization of pointers
//
// Destructor
//
+
+ if (fClusterHistograms) {
+ delete fClusterHistograms;
+ fClusterHistograms = 0;
+ }
+
}
void AliROCESDAnalysisSelector::SlaveBegin(TTree* tree)
//
AliSelector::SlaveBegin(tree);
-
- fhQmaxVsRow = new TH2F("QmaxVsRow", "Qmax vs. pad row;Pad row;Qmax", 91, -0.5, 90, 201, -0.5, 200.5);
+
+ fClusterHistograms = new AliTPCClusterHistograms("test","test");
+
}
void AliROCESDAnalysisSelector::Init(TTree *tree)
if (cluster->GetDetector() != 5)
continue;
- fhQmaxVsRow->Fill(cluster->GetRow(), cluster->GetMax());
+ fClusterHistograms->FillCluster(cluster);
}
}
{
//
- fOutput->Add(fhQmaxVsRow);
+ fOutput->Add(fClusterHistograms);
}
void AliROCESDAnalysisSelector::Terminate()
{
//
-
- fhQmaxVsRow = dynamic_cast<TH2F*> (fOutput->FindObject("QmaxVsRow"));
- if (!fhQmaxVsRow)
- return;
-
- new TCanvas;
- fhQmaxVsRow->DrawCopy("COLZ");
-
- new TCanvas;
- TProfile* profile = fhQmaxVsRow->ProfileX("fhQmaxVsRowProfile");
- profile->DrawCopy();
TFile* file = TFile::Open("rocESD.root", "RECREATE");
- fhQmaxVsRow->Write();
- profile->Write();
+
+ fClusterHistograms->SaveHistograms();
file->Close();
}
--- /dev/null
+/* $Id$ */
+
+
+#include <TFile.h>
+#include <TCanvas.h>
+#include <TH2F.h>
+#include <TProfile2D.h>
+
+#include <../TPC/AliTPCclusterMI.h>
+
+#include <AliLog.h>
+
+#include "AliTPCClusterHistograms.h"
+
+//____________________________________________________________________
+ClassImp(AliTPCClusterHistograms)
+
+//____________________________________________________________________
+AliTPCClusterHistograms::AliTPCClusterHistograms()
+ : TNamed(),
+ fhQmaxVsRow(0),
+ fhQtotVsRow(0),
+ fhSigmaYVsRow(0),
+ fhSigmaZVsRow(0),
+ fhQmaxProfileYVsRow(0),
+ fhQtotProfileYVsRow(0),
+ fhSigmaYProfileYVsRow(0),
+ fhSigmaZProfileYVsRow(0)
+{
+ // default constructor
+}
+
+//____________________________________________________________________
+AliTPCClusterHistograms::AliTPCClusterHistograms(const Char_t* name, const Char_t* title)
+ : TNamed(name, title),
+ fhQmaxVsRow(0),
+ fhQtotVsRow(0),
+ fhSigmaYVsRow(0),
+ fhSigmaZVsRow(0),
+ fhQmaxProfileYVsRow(0),
+ fhQtotProfileYVsRow(0),
+ fhSigmaYProfileYVsRow(0),
+ fhSigmaZProfileYVsRow(0)
+{
+ // constructor initializing tnamed
+
+ fhQmaxVsRow = new TH2F("QmaxVsPadRow", "Qmax vs. pad row;Pad row;Qmax", 91, -0.5, 90.5, 301, -0.5, 300.5);
+ fhQtotVsRow = new TH2F("QtotVsPadRow", "Qtot vs. pad row;Pad row;Qtot", 91, -0.5, 90.5, 100, 0, 1000);
+
+ fhSigmaYVsRow = new TH2F("SigmaYVsPadRow", "Sigma Y vs. pad row;Pad row;#sigma_{Y}", 91, -0.5, 90.5, 100, 0, 0.5);
+ fhSigmaZVsRow = new TH2F("SigmaZVsPadRow", "Sigma Z vs. pad row;Pad row;#sigma_{Z}", 91, -0.5, 90.5, 100, 0, 0.5);
+
+ fhQmaxProfileYVsRow = new TProfile2D("QmaxMeanYVsPadRow","Mean Qmax, y vs pad row;Pad row;y",91,-0.5,90.5,100,-30,30);
+ fhQtotProfileYVsRow = new TProfile2D("QtotMeanYVsPadRow","Mean Qtot, y vs pad row;Pad row;y",91,-0.5,90.5,100,-30,30);
+ fhSigmaYProfileYVsRow = new TProfile2D("SigmaYMeanYVsPadRow","Mean Sigma y, x vs pad row;Pad row;y",91,-0.5,90.5,100,-30,30);
+ fhSigmaZProfileYVsRow = new TProfile2D("SigmaZMeanYVsPadRow","Mean Sigma y, x vs pad row;Pad row;y",91,-0.5,90.5,100,-30,30);
+
+}
+
+//____________________________________________________________________
+AliTPCClusterHistograms::AliTPCClusterHistograms(const AliTPCClusterHistograms& c) : TNamed(c)
+{
+ // copy constructor
+ ((AliTPCClusterHistograms &)c).Copy(*this);
+}
+
+//____________________________________________________________________
+AliTPCClusterHistograms::~AliTPCClusterHistograms()
+{
+ //
+ // destructor
+ //
+
+ if (fhQmaxVsRow) {
+ delete fhQmaxVsRow;
+ fhQmaxVsRow = 0;
+ }
+ if (fhQtotVsRow) {
+ delete fhQtotVsRow;
+ fhQtotVsRow = 0;
+ }
+ if (fhSigmaYVsRow) {
+ delete fhSigmaYVsRow;
+ fhSigmaYVsRow = 0;
+ }
+ if (fhSigmaZVsRow) {
+ delete fhSigmaZVsRow;
+ fhSigmaZVsRow = 0;
+ }
+ if (fhQmaxProfileYVsRow) {
+ delete fhQmaxProfileYVsRow;
+ fhQmaxProfileYVsRow = 0;
+ }
+ if (fhQtotProfileYVsRow) {
+ delete fhQtotProfileYVsRow;
+ fhQtotProfileYVsRow = 0;
+ }
+ if (fhSigmaYProfileYVsRow) {
+ delete fhSigmaYProfileYVsRow;
+ fhSigmaYProfileYVsRow = 0;
+ }
+ if (fhSigmaZProfileYVsRow) {
+ delete fhSigmaZProfileYVsRow;
+ fhSigmaZProfileYVsRow = 0;
+ }
+
+}
+
+//____________________________________________________________________
+AliTPCClusterHistograms &AliTPCClusterHistograms::operator=(const AliTPCClusterHistograms &c)
+{
+ // assigment operator
+
+ if (this != &c)
+ ((AliTPCClusterHistograms &) c).Copy(*this);
+
+ return *this;
+}
+
+
+//____________________________________________________________________
+Long64_t AliTPCClusterHistograms::Merge(TCollection* list)
+{
+ // Merge a list of AliTPCClusterHistograms objects with this (needed for
+ // PROOF).
+ // Returns the number of merged objects (including this).
+
+ if (!list)
+ return 0;
+
+ if (list->IsEmpty())
+ return 1;
+
+ TIterator* iter = list->MakeIterator();
+ TObject* obj;
+
+ // collections of measured and generated histograms
+ TList* collectionQmaxVsRow = new TList;
+ TList* collectionQtotVsRow = new TList;
+ TList* collectionSigmaYVsRow = new TList;
+ TList* collectionSigmaZVsRow = new TList;
+
+ TList* collectionQmaxProfileYVsRow = new TList;
+ TList* collectionQtotProfileYVsRow = new TList;
+ TList* collectionSigmaYProfileYVsRow = new TList;
+ TList* collectionSigmaZProfileYVsRow = new TList;
+
+ Int_t count = 0;
+ while ((obj = iter->Next())) {
+
+ AliTPCClusterHistograms* entry = dynamic_cast<AliTPCClusterHistograms*> (obj);
+ if (entry == 0)
+ continue;
+
+
+ collectionQmaxVsRow ->Add(entry->fhQmaxVsRow );
+ collectionQtotVsRow ->Add(entry->fhQtotVsRow );
+ collectionSigmaYVsRow ->Add(entry->fhSigmaYVsRow );
+ collectionSigmaZVsRow ->Add(entry->fhSigmaZVsRow );
+
+ collectionQmaxProfileYVsRow ->Add(entry->fhQmaxProfileYVsRow );
+ collectionQtotProfileYVsRow ->Add(entry->fhQtotProfileYVsRow );
+ collectionSigmaYProfileYVsRow->Add(entry->fhSigmaYProfileYVsRow);
+ collectionSigmaZProfileYVsRow->Add(entry->fhSigmaZProfileYVsRow);
+
+ count++;
+ }
+
+ fhQmaxVsRow ->Merge(collectionQmaxVsRow );
+ fhQtotVsRow ->Merge(collectionQtotVsRow );
+ fhSigmaYVsRow ->Merge(collectionSigmaYVsRow );
+ fhSigmaZVsRow ->Merge(collectionSigmaZVsRow );
+
+ fhQmaxProfileYVsRow ->Merge(collectionQmaxProfileYVsRow );
+ fhQtotProfileYVsRow ->Merge(collectionQtotProfileYVsRow );
+ fhSigmaYProfileYVsRow->Merge(collectionSigmaYProfileYVsRow);
+ fhSigmaZProfileYVsRow->Merge(collectionSigmaZProfileYVsRow);
+
+ delete collectionQmaxVsRow;
+ delete collectionQtotVsRow;
+ delete collectionSigmaYVsRow;
+ delete collectionSigmaZVsRow;
+
+ delete collectionQmaxProfileYVsRow;
+ delete collectionQtotProfileYVsRow;
+ delete collectionSigmaYProfileYVsRow;
+ delete collectionSigmaZProfileYVsRow;
+
+ return count+1;
+}
+
+//____________________________________________________________________
+void AliTPCClusterHistograms::FillCluster(AliTPCclusterMI* cluster) {
+ //
+ //
+ //
+
+ Int_t padRow = cluster->GetRow();
+ Float_t qMax = cluster->GetMax();
+ Float_t qTot = cluster->GetQ();
+ Float_t sigmaY = cluster->GetSigmaY2();
+ Float_t sigmaZ = cluster->GetSigmaZ2();
+ Float_t y = cluster->GetY();
+
+ fhQmaxVsRow ->Fill(padRow, qMax);
+ fhQtotVsRow ->Fill(padRow, qTot);
+
+ fhSigmaYVsRow ->Fill(padRow, sigmaY);
+ fhSigmaZVsRow ->Fill(padRow, sigmaZ);
+
+ fhQmaxProfileYVsRow ->Fill(padRow, y, qMax);
+ fhQtotProfileYVsRow ->Fill(padRow, y, qTot);
+ fhSigmaYProfileYVsRow ->Fill(padRow, y, sigmaY);
+ fhSigmaZProfileYVsRow ->Fill(padRow, y, sigmaZ);
+}
+
+
+//____________________________________________________________________
+void AliTPCClusterHistograms::SaveHistograms()
+{
+ //
+ // saves the histograms
+ //
+
+ gDirectory->mkdir(fName.Data());
+ gDirectory->cd(fName.Data());
+
+ fhQmaxVsRow ->Write();
+ fhQtotVsRow ->Write();
+
+ fhSigmaYVsRow ->Write();
+ fhSigmaZVsRow ->Write();
+
+ fhQmaxProfileYVsRow ->Write();
+ fhQtotProfileYVsRow ->Write();
+ fhSigmaYProfileYVsRow ->Write();
+ fhSigmaZProfileYVsRow ->Write();
+
+ gDirectory->cd("../");
+
+}
+