/************************************************************************** * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * * * * Author: The ALICE Off-line Project. * * Contributors are mentioned in the code where appropriate. * * * * Permission to use, copy, modify and distribute this software and its * * documentation strictly for non-commercial purposes is hereby granted * * without fee, provided that the above copyright notice appears in all * * copies and that both the copyright notice and this permission notice * * appear in the supporting documentation. The authors make no claims * * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ /* $Id$ */ // This class contains a number of histograms for diagnostics of a TPC // read out chamber from the raw data // // TODO: // // // #include #include #include #include #include #include #include #include #include "AliLog.h" #include "AliTPCRawHistograms.h" #include "AliTPCRawStream.h" //____________________________________________________________________ ClassImp(AliTPCRawHistograms) //____________________________________________________________________ AliTPCRawHistograms::AliTPCRawHistograms() : TNamed(), fTimeStart(0), fTimeStop(0), fhDigits(0), fhSignal(0), fDigitTree(0) { // default constructor } //____________________________________________________________________ AliTPCRawHistograms::AliTPCRawHistograms(Int_t detector, const Char_t* /* comment */, Int_t timeStart, Int_t timeStop) : TNamed(), fTimeStart(timeStart), fTimeStop(timeStop), fhDigits(0), fhSignal(new TH1F("fhSignal", "fhSignal", 200, 0, 2000)), fDigitTree(new TNtuple("fDigitTree", "fDigitTree", "row:pad:time:signal")) { // constructor // make name and title if (detector < 0 || detector >= 72) { AliDebug(AliLog::kError, Form("Detector %d does not exist", detector)); return; } Int_t sector = detector%18; TString side; TString inout; if (detector<18 || ( detector>=36 && detector<54)) side.Form("A"); else side.Form("B"); if (detector<36) inout.Form("IROC"); else inout.Form("OROC"); TString name; name.Form("sector_%s%d_%s", side.Data(), sector, inout.Data()); SetName(name); SetTitle(Form("%s (detector %d)",name.Data(), detector)); Float_t yRange = 45; Int_t nPadRows = 96; if (TString(name).Contains("IROC")) { yRange = 25; nPadRows = 63; } // do not add this hists to the directory Bool_t oldStatus = TH1::AddDirectoryStatus(); TH1::AddDirectory(kFALSE); fhDigits = new TH3F("fhDigits", Form("signal distribution;row;pad;time", name.Data()), nPadRows, -0.5, -0.5 + nPadRows, 150, -0.5, 149.5, 100, 0, 1200); TH1::AddDirectory(oldStatus); } //____________________________________________________________________ AliTPCRawHistograms::AliTPCRawHistograms(const AliTPCRawHistograms& c) : TNamed(c), fTimeStart(0), fTimeStop(0), fhDigits(0), fhSignal(0), fDigitTree(0) { // copy constructor ((AliTPCRawHistograms &)c).Copy(*this); } //____________________________________________________________________ AliTPCRawHistograms::~AliTPCRawHistograms() { // // destructor // } //____________________________________________________________________ AliTPCRawHistograms &AliTPCRawHistograms::operator=(const AliTPCRawHistograms &c) { // assigment operator if (this != &c) ((AliTPCRawHistograms &) c).Copy(*this); return *this; } //____________________________________________________________________ Long64_t AliTPCRawHistograms::Merge(TCollection* list) { // Merge a list of AliTPCRawHistograms 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; Int_t count = 0; /* // 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; TList* collectionQmaxProfileZVsRow = new TList; TList* collectionQtotProfileZVsRow = new TList; TList* collectionSigmaYProfileZVsRow = new TList; TList* collectionSigmaZProfileZVsRow = new TList; TList* collectionQtotVsTime = new TList; TList* collectionQmaxVsTime = new TList; while ((obj = iter->Next())) { AliTPCRawHistograms* entry = dynamic_cast (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); collectionQmaxProfileZVsRow ->Add(entry->fhQmaxProfileZVsRow ); collectionQtotProfileZVsRow ->Add(entry->fhQtotProfileZVsRow ); collectionSigmaYProfileZVsRow->Add(entry->fhSigmaYProfileZVsRow); collectionSigmaZProfileZVsRow->Add(entry->fhSigmaZProfileZVsRow); collectionQtotVsTime->Add(entry->fhQtotVsTime); collectionQmaxVsTime->Add(entry->fhQmaxVsTime); 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); fhQmaxProfileZVsRow ->Merge(collectionQmaxProfileZVsRow ); fhQtotProfileZVsRow ->Merge(collectionQtotProfileZVsRow ); fhSigmaYProfileZVsRow->Merge(collectionSigmaYProfileZVsRow); fhSigmaZProfileZVsRow->Merge(collectionSigmaZProfileZVsRow); fhQtotVsTime->Merge(collectionQtotVsTime); fhQmaxVsTime->Merge(collectionQmaxVsTime); delete collectionQmaxVsRow; delete collectionQtotVsRow; delete collectionSigmaYVsRow; delete collectionSigmaZVsRow; delete collectionQmaxProfileYVsRow; delete collectionQtotProfileYVsRow; delete collectionSigmaYProfileYVsRow; delete collectionSigmaZProfileYVsRow; delete collectionQmaxProfileZVsRow; delete collectionQtotProfileZVsRow; delete collectionSigmaYProfileZVsRow; delete collectionSigmaZProfileZVsRow; delete collectionQtotVsTime; delete collectionQmaxVsTime;*/ return count+1; } //____________________________________________________________________ void AliTPCRawHistograms::FillDigit(AliTPCRawStream* rawStream, Int_t /*time*/) { // // Fills the different histograms with the information from a raw digit // Int_t signal = rawStream->GetSignal(); Int_t row = rawStream->GetRow(); Int_t pad = rawStream->GetPad(); Int_t timeBin = rawStream->GetTime(); if (signal > 120) fhDigits->Fill(row, pad, timeBin, signal); fhSignal->Fill(signal); fDigitTree->Fill(row, pad, timeBin, signal); } //____________________________________________________________________ void AliTPCRawHistograms::SaveHistograms() { // // saves the histograms // gDirectory->mkdir(fName.Data()); gDirectory->cd(fName.Data()); fhDigits ->Write(); fhSignal ->Write(); fDigitTree->Write(); gDirectory->cd("../"); } //____________________________________________________________________ TCanvas* AliTPCRawHistograms::DrawHistograms(const Char_t* /*opt*/) { // // Draws some histograms and save the canvas as eps and gif file. // TCanvas* c = new TCanvas(Form("plots_%s",fName.Data()), fName.Data(), 1200, 1000); gStyle->SetOptStat(0); gStyle->SetOptFit(0); gStyle->SetPadLeftMargin(0.05); c->Divide(3,3); c->Draw(); c->cd(1); // this is not really a nice way to do it... c->GetPad(1)->Delete(); TLatex* name = new TLatex(0.1,0.8,fName.Data()); name->SetTextSize(0.02); name->DrawClone(); c->cd(2); fhDigits->Draw(); c->cd(3); fhSignal->Draw(); return c; }