+++ /dev/null
-/**************************************************************************
- * 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$ */
-
-///////////////////////////////////////////////////////////////////////////////
-// Class AliPHOSCalibHistoProducer accumulating histograms
-// with amplitudes per PHOS channel
-// It is intended to run at DAQ computers (LDC, GDC, HLT or MOOD)
-// and it fills the histograms with amplitudes per channel.
-// Usage example see in PHOS/macros/Shuttle/AliPHOSCalibHistoProducer.C
-//
-// Author: Boris Polichtchouk, 4 October 2006
-///////////////////////////////////////////////////////////////////////////////
-
-#include "AliLog.h"
-#include "AliPHOSCalibHistoProducer.h"
-#include "TH1.h"
-#include "TH2F.h"
-#include "TFile.h"
-#include "AliPHOSRawDecoder.h"
-#include "AliRawReader.h"
-
-ClassImp(AliPHOSCalibHistoProducer)
-
-//-----------------------------------------------------------------------------
-AliPHOSCalibHistoProducer::AliPHOSCalibHistoProducer() :
- fRawDecoder(0),fHistoFile(0),fUpdatingRate(100),
- fEvents(0),fNbins(100),fXlow(0.),fXup(1000.)
-{
- // Constructor: initializes data members
- // Checks existence of histograms which might have been left
- // from the previous runs to continues their filling
-
- fHistoFile = new TFile("calibHisto.root","update");
-
- for(Int_t module=0; module<5; module++) {
- for(Int_t column=0; column<56; column++) {
- for(Int_t row=0; row<64; row++) {
- char hname[128];
- sprintf(hname,"mod%dcol%drow%d",module,column,row);
- TH1F* hist = (TH1F*)fHistoFile->Get(hname);
- if(hist)
- fAmpHisto[module][column][row]=hist;
- else
- fAmpHisto[module][column][row] = 0;
- }
- }
- }
-}
-
-//-----------------------------------------------------------------------------
-AliPHOSCalibHistoProducer::AliPHOSCalibHistoProducer(Int_t nbinsx, Double_t xlow, Double_t xup) :
- fRawDecoder(0),fHistoFile(0),fUpdatingRate(100),
- fEvents(0),fNbins(nbinsx),fXlow(xlow),fXup(xup)
-{
- // Constructor: initializes data members.
- // Checks existence of histograms which might have been left
- // from the previous runs to continues their filling.
- // In addition sets number of bins, low and upper limits common for all histograms.
-
- fHistoFile = new TFile("calibHisto.root","update");
-
- for(Int_t module=0; module<5; module++) {
- for(Int_t column=0; column<56; column++) {
- for(Int_t row=0; row<64; row++) {
- char hname[128];
- sprintf(hname,"mod%dcol%drow%d",module,column,row);
- TH1F* hist = (TH1F*)fHistoFile->Get(hname);
- if(hist)
- fAmpHisto[module][column][row]=hist;
- else
- fAmpHisto[module][column][row] = 0;
- }
- }
- }
-}
-
-//-----------------------------------------------------------------------------
-AliPHOSCalibHistoProducer::~AliPHOSCalibHistoProducer()
-{
- // Destructor
-
- UpdateHistoFile();
- if(fHistoFile) delete fHistoFile;
-
-}
-
-//-----------------------------------------------------------------------------
-AliPHOSCalibHistoProducer::AliPHOSCalibHistoProducer(const AliPHOSCalibHistoProducer &histoproducer) :
- TObject(histoproducer),fRawDecoder(histoproducer.fRawDecoder),fHistoFile(histoproducer.fHistoFile),
- fUpdatingRate(histoproducer.fUpdatingRate),
- fEvents(histoproducer.fEvents),fNbins(histoproducer.fNbins),fXlow(histoproducer.fXlow),fXup(histoproducer.fXup)
-{
- //Copy constructor.
-
- for(Int_t module=0; module<5; module++) {
- for(Int_t column=0; column<56; column++) {
- for(Int_t row=0; row<64; row++) {
- char hname[128];
- sprintf(hname,"mod%dcol%drow%d",module,column,row);
- TH1F* hist = (TH1F*)histoproducer.fHistoFile->Get(hname);
- if(hist)
- fAmpHisto[module][column][row]= new TH1F(*hist);
- else
- fAmpHisto[module][column][row]=0;
- }
- }
- }
-}
-
-//-----------------------------------------------------------------------------
-AliPHOSCalibHistoProducer& AliPHOSCalibHistoProducer::operator=
-(const AliPHOSCalibHistoProducer &histoproducer)
-{
- //Assignment operator.
-
- if(this != &histoproducer) {
-
- fRawDecoder = histoproducer.fRawDecoder;
- fHistoFile = histoproducer.fHistoFile;
- fUpdatingRate = histoproducer.fUpdatingRate;
- fEvents = histoproducer.fEvents;
- fEvents = histoproducer.fEvents;
- fNbins = histoproducer.fNbins;
- fXlow = histoproducer.fXlow;
- fXup = histoproducer.fXup;
-
- for(Int_t module=0; module<5; module++) {
- for(Int_t column=0; column<56; column++) {
- for(Int_t row=0; row<64; row++) {
- if(fAmpHisto[module][column][row]){
- delete fAmpHisto[module][column][row];
- fAmpHisto[module][column][row] = histoproducer.fAmpHisto[module][column][row];
- }
- else
- fAmpHisto[module][column][row] = histoproducer.fAmpHisto[module][column][row];
- }
- }
- }
-
-
- }
-
- return *this;
-}
-//-----------------------------------------------------------------------------
-void AliPHOSCalibHistoProducer::Run()
-{
- // Reads raw data of current event and fills amplitude histograms
- // The histograms are written to file every fUpdatingRate events
-
- if(!fRawDecoder) AliFatal("Raw decoder not set!");
-
- Double_t energy;
- Int_t mod,col,row;
-
- while(fRawDecoder->NextDigit()) {
-
- if(fRawDecoder->IsLowGain()) continue;
-
- energy = fRawDecoder->GetEnergy();
-
- mod = fRawDecoder->GetModule()-1;
- col = fRawDecoder->GetColumn()-1;
- row = fRawDecoder->GetRow()-1;
-
- if(fAmpHisto[mod][col][row]) {
- fAmpHisto[mod][col][row]->Fill(energy);
- }
- else {
- char hname[128];
- sprintf(hname,"mod%dcol%drow%d",mod,col,row);
- fAmpHisto[mod][col][row] = new TH1F(hname,hname,fNbins,fXlow,fXup);
- fAmpHisto[mod][col][row]->Fill(energy);
- }
- }
- // update histograms in local file every 100th event
- if(fEvents != 0 && fEvents%fUpdatingRate == 0) {
- AliInfo(Form("Updating histo file, event %d, run %d\n",
- fEvents,fRawDecoder->GetRawReader()->GetRunNumber()));
- UpdateHistoFile();
- }
-
- // UpdateHistoFile();
- // AliInfo(Form("%d events of run %d processed.",iEvent,runNum));
-
- fEvents++;
-
-}
-
-//-----------------------------------------------------------------------------
-void AliPHOSCalibHistoProducer::UpdateHistoFile()
-{
- // Write histograms to file
-
- if(!fHistoFile) return;
- if(!fHistoFile->IsOpen()) return;
-
- TH1F* hist=0;
- char hname[128];
- char htitle[128];
-
- for(Int_t module=0; module<5; module++) {
- sprintf(hname,"hMeanE%d",module);
- sprintf(htitle,"Mean energies in module %d",module);
- TH2F hMeanE(hname,htitle,56,0.,56.,64,0.,64);
-
- for(Int_t column=0; column<56; column++) {
- for(Int_t row=0; row<64; row++) {
- hist = fAmpHisto[module][column][row];
- if(hist) hist->Write(hist->GetName(),TObject::kWriteDelete);
- if(hist) hMeanE.SetBinContent(column,row,hist->GetMean());
- }
- }
- hMeanE.Write(hMeanE.GetName(),TObject::kWriteDelete);
- }
-
-}
+++ /dev/null
-#ifndef ALIPHOSCALIBHISTOPRODUCER_H
-#define ALIPHOSCALIBHISTOPRODUCER_H
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice */
-
-/* $Id$ */
-
-///////////////////////////////////////////////////////////////////////////////
-// Class AliPHOSCalibHistoProducer accumulating histograms
-// with amplitudes per PHOS channel
-///////////////////////////////////////////////////////////////////////////////
-
-#include "TObject.h"
-
-class TH1F;
-class TFile;
-class AliPHOSRawDecoder;
-
-class AliPHOSCalibHistoProducer : public TObject {
-public:
-
- AliPHOSCalibHistoProducer();
- AliPHOSCalibHistoProducer(Int_t nbinsx, Double_t xlow, Double_t xup);
- AliPHOSCalibHistoProducer(const AliPHOSCalibHistoProducer &histoproducer);
- AliPHOSCalibHistoProducer& operator= (const AliPHOSCalibHistoProducer &histoproducer);
- virtual ~AliPHOSCalibHistoProducer();
-
- void Run();
- void UpdateHistoFile();
- void SetUpdatingRate(Int_t rate) {fUpdatingRate = rate;}
- void SetRawDecoder(AliPHOSRawDecoder* decoder) { fRawDecoder = decoder; }
-
-protected:
-
- TH1F* fAmpHisto[5][56][64]; // amplitudes in [module][column][row].
- AliPHOSRawDecoder* fRawDecoder; // raw data decoder.
- TFile* fHistoFile; // root file to store histograms in
- Int_t fUpdatingRate; // update rate
- Int_t fEvents;
- Int_t fNbins; // Number of bins in histograms.
- Double_t fXlow; // Low X in histograms.
- Double_t fXup; // High X in histograms.
-
- ClassDef(AliPHOSCalibHistoProducer,2)
-
-};
-
-#endif
+++ /dev/null
-/**************************************************************************
- * 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$ */
-
-/*
- Produces the data needed to calculate the quality assurance.
- All data must be mergeable objects.
- Y. Schutz CERN July 2007
-*/
-
-// --- ROOT system ---
-#include <TClonesArray.h>
-#include <TFile.h>
-#include <TH1F.h>
-#include <TH1I.h>
-#include <TH2F.h>
-
-// --- Standard library ---
-
-// --- AliRoot header files ---
-#include "AliESDCaloCluster.h"
-#include "AliESDEvent.h"
-#include "AliLog.h"
-#include "AliPHOSDigit.h"
-#include "AliPHOSHit.h"
-#include "AliPHOSQADataMaker.h"
-#include "AliQAChecker.h"
-#include "AliPHOSCpvRecPoint.h"
-#include "AliPHOSEmcRecPoint.h"
-#include "AliPHOSRecParticle.h"
-#include "AliPHOSTrackSegment.h"
-#include "AliPHOSRawDecoder.h"
-#include "AliPHOSReconstructor.h"
-#include "AliPHOSRecoParam.h"
-
-ClassImp(AliPHOSQADataMaker)
-
-//____________________________________________________________________________
- AliPHOSQADataMaker::AliPHOSQADataMaker() :
- AliQADataMaker(AliQA::GetDetName(AliQA::kPHOS), "PHOS Quality Assurance Data Maker")
-{
- // ctor
-}
-
-//____________________________________________________________________________
-AliPHOSQADataMaker::AliPHOSQADataMaker(const AliPHOSQADataMaker& qadm) :
- AliQADataMaker()
-{
- //copy ctor
- SetName((const char*)qadm.GetName()) ;
- SetTitle((const char*)qadm.GetTitle());
-}
-
-//__________________________________________________________________
-AliPHOSQADataMaker& AliPHOSQADataMaker::operator = (const AliPHOSQADataMaker& qadm )
-{
- // Equal operator.
- this->~AliPHOSQADataMaker();
- new(this) AliPHOSQADataMaker(qadm);
- return *this;
-}
-
-//____________________________________________________________________________
-void AliPHOSQADataMaker::EndOfDetectorCycle(AliQA::TASKINDEX task, TObjArray * list)
-{
- //Detector specific actions at end of cycle
- // do the QA checking
- AliQAChecker::Instance()->Run(AliQA::kPHOS, task, list) ;
-}
-
-//____________________________________________________________________________
-void AliPHOSQADataMaker::InitESDs()
-{
- //create ESDs histograms in ESDs subdir
-
- TH1F * h0 = new TH1F("hPhosESDs", "ESDs energy distribution in PHOS", 100, 0., 100.) ;
- h0->Sumw2() ;
- Add2ESDsList(h0, 0) ;
- TH1I * h1 = new TH1I("hPhosESDsMul", "ESDs multiplicity distribution in PHOS", 100, 0., 100) ;
- h1->Sumw2() ;
- Add2ESDsList(h1, 1) ;
-}
-
-//____________________________________________________________________________
-void AliPHOSQADataMaker::InitHits()
-{
- // create Hits histograms in Hits subdir
- TH1F * h0 = new TH1F("hPhosHits", "Hits energy distribution in PHOS", 100, 0., 100.) ;
- h0->Sumw2() ;
- Add2HitsList(h0, 0) ;
- TH1I * h1 = new TH1I("hPhosHitsMul", "Hits multiplicity distribution in PHOS", 500, 0., 10000) ;
- h1->Sumw2() ;
- Add2HitsList(h1, 1) ;
-}
-
-//____________________________________________________________________________
-void AliPHOSQADataMaker::InitDigits()
-{
- // create Digits histograms in Digits subdir
- TH1I * h0 = new TH1I("hPhosDigits", "Digits amplitude distribution in PHOS", 500, 0, 5000) ;
- h0->Sumw2() ;
- Add2DigitsList(h0, 0) ;
- TH1I * h1 = new TH1I("hPhosDigitsMul", "Digits multiplicity distribution in PHOS", 500, 0, 1000) ;
- h1->Sumw2() ;
- Add2DigitsList(h1, 1) ;
-}
-
-//____________________________________________________________________________
-//void AliPHOSQADataMaker::InitRecParticles()
-//{
-// // create Reconstructed particles histograms in RecParticles subdir
-// fhRecParticles = new TH1F("hPhosRecParticles", "RecParticles energy distribution in PHOS", 100, 0., 100.) ;
-// fhRecParticles->Sumw2() ;
-// fhRecParticlesMul = new TH1I("hPhosRecParticlesMul", "RecParticles multiplicity distribution in PHOS", 100, 0, 100) ;
-// fhRecParticlesMul->Sumw2() ;
-//}
-
-//____________________________________________________________________________
-void AliPHOSQADataMaker::InitRecPoints()
-{
- // create Reconstructed Points histograms in RecPoints subdir
- TH1F * h0 = new TH1F("hEmcPhosRecPoints", "EMCA RecPoints energy distribution in PHOS", 100, 0., 100.) ;
- h0->Sumw2() ;
- Add2RecPointsList(h0, 0) ;
- TH1I * h1 = new TH1I("hEmcPhosRecPointsMul", "EMCA RecPoints multiplicity distribution in PHOS", 100, 0, 100) ;
- h1->Sumw2() ;
- Add2RecPointsList(h1, 1) ;
-
- TH1F * h2 = new TH1F("hCpvPhosRecPoints", "CPV RecPoints energy distribution in PHOS", 100, 0., 100.) ;
- h2->Sumw2() ;
- Add2RecPointsList(h2, 2) ;
- TH1I * h3 = new TH1I("hCpvPhosRecPointsMul", "CPV RecPoints multiplicity distribution in PHOS", 100, 0, 100) ;
- h3->Sumw2() ;
- Add2RecPointsList(h3, 3) ;
-}
-
-//____________________________________________________________________________
-void AliPHOSQADataMaker::InitRaws()
-{
- // create Raws histograms in Raws subdir
- const Int_t modMax = 5 ;
- TH2I * h0[modMax*2] ;
- char name[32] ;
- char title[32] ;
- for (Int_t mod = 0; mod < modMax; mod++) {
- sprintf(title, "Low Gain Rows x Columns for PHOS module %d", mod) ;
- sprintf(name, "hLowPHOSxyMod%d", mod) ;
- h0[mod] = new TH2I(name, title, 64, 1, 65, 56, 1, 57) ;
- Add2RawsList(h0[mod], mod) ;
- sprintf(title, "High Gain Rows x Columns for PHOS module %d", mod) ;
- sprintf(name, "hHighPHOSxyMod%d", mod) ;
- h0[mod+modMax] = new TH2I(name, title, 64, 1, 65, 56, 1, 57) ;
- Add2RawsList(h0[mod+modMax], mod+modMax) ;
- }
- TH1I * h10 = new TH1I("hLowPhosModules", "Low Gain Hits in EMCA PHOS modules", 6, 0, 6) ;
- h10->Sumw2() ;
- Add2RawsList(h10, 10) ;
- TH1I * h11 = new TH1I("hHighPhosModules", "High Gain Hits in EMCA PHOS modules", 6, 0, 6) ;
- h11->Sumw2() ;
- Add2RawsList(h11, 11) ;
- TH1F * h12 = new TH1F("hLowPhosRawtime", "Low Gain Time of raw hits in PHOS", 100, 0, 100.) ;
- h12->Sumw2() ;
- Add2RawsList(h12, 12) ;
- TH1F * h13 = new TH1F("hHighPhosRawtime", "High Gain Time of raw hits in PHOS", 100, 0, 100.) ;
- h13->Sumw2() ;
- Add2RawsList(h13, 13) ;
- TH1F * h14 = new TH1F("hLowPhosRawEnergy", "Low Gain Energy of raw hits in PHOS", 100, 0., 100.) ;
- h14->Sumw2() ;
- Add2RawsList(h14, 14) ;
- TH1F * h15 = new TH1F("hHighPhosRawEnergy", "High Gain Energy of raw hits in PHOS", 100, 0., 100.) ;
- h15->Sumw2() ;
- Add2RawsList(h15, 15) ;
-
-}
-
-//____________________________________________________________________________
-void AliPHOSQADataMaker::InitSDigits()
-{
- // create SDigits histograms in SDigits subdir
- TH1F * h0 = new TH1F("hPhosSDigits", "SDigits energy distribution in PHOS", 100, 0., 100.) ;
- h0->Sumw2() ;
- Add2SDigitsList(h0, 0) ;
- TH1I * h1 = new TH1I("hPhosSDigitsMul", "SDigits multiplicity distribution in PHOS", 500, 0, 10000) ;
- h1->Sumw2() ;
- Add2SDigitsList(h1, 1) ;
-}
-
-//____________________________________________________________________________
-//void AliPHOSQADataMaker::InitTrackSegments()
-//{
-// // create Track Segments histograms in TrackSegments subdir
-// fhTrackSegments = new TH1F("hPhosTrackSegments", "TrackSegments EMC-CPV distance in PHOS", 500, 0., 5000.) ;
-// fhTrackSegments->Sumw2() ;
-// fhTrackSegmentsMul = new TH1I("hPhosTrackSegmentsMul", "TrackSegments multiplicity distribution in PHOS", 100, 0, 100) ;
-// fhTrackSegmentsMul->Sumw2() ;
-//}
-
-//____________________________________________________________________________
-void AliPHOSQADataMaker::MakeESDs(AliESDEvent * esd)
-{
- // make QA data from ESDs
-
- Int_t count = 0 ;
- for ( Int_t index = 0; index < esd->GetNumberOfCaloClusters() ; index++ ) {
- AliESDCaloCluster * clu = esd->GetCaloCluster(index) ;
- if ( clu->IsPHOS() ) {
- GetESDsData(0)->Fill(clu->E()) ;
- count++ ;
- }
- }
- GetESDsData(1)->Fill(count) ;
-}
-
-//____________________________________________________________________________
-void AliPHOSQADataMaker::MakeHits(TClonesArray * hits)
-{
- //make QA data from Hits
-
- GetHitsData(1)->Fill(hits->GetEntriesFast()) ;
- TIter next(hits) ;
- AliPHOSHit * hit ;
- while ( (hit = dynamic_cast<AliPHOSHit *>(next())) ) {
- GetHitsData(0)->Fill( hit->GetEnergy()) ;
- }
-}
-
-//____________________________________________________________________________
-void AliPHOSQADataMaker::MakeHits(TTree * hitTree)
-{
- // make QA data from Hit Tree
-
- TClonesArray * hits = new TClonesArray("AliPHOSHit", 1000);
-
- TBranch * branch = hitTree->GetBranch("PHOS") ;
- if ( ! branch ) {
- AliWarning("PHOS branch in Hit Tree not found") ;
- } else {
- TClonesArray * tmp = new TClonesArray("AliPHOSHit", 1000) ;
- branch->SetAddress(&tmp) ;
- Int_t index = 0 ;
- for (Int_t ientry = 0 ; ientry < branch->GetEntries() ; ientry++) {
- branch->GetEntry(ientry) ;
- for (Int_t ihit = 0 ; ihit < tmp->GetEntries() ; ihit++) {
- AliPHOSHit * hit = dynamic_cast<AliPHOSHit *> (tmp->At(ihit)) ;
- new((*hits)[index]) AliPHOSHit(*hit) ;
- index++ ;
- }
- }
- tmp->Delete() ;
- delete tmp ;
- MakeHits(hits) ;
- }
-}
-
-//____________________________________________________________________________
-void AliPHOSQADataMaker::MakeDigits(TClonesArray * digits)
-{
- // makes data from Digits
-
- GetDigitsData(1)->Fill(digits->GetEntriesFast()) ;
- TIter next(digits) ;
- AliPHOSDigit * digit ;
- while ( (digit = dynamic_cast<AliPHOSDigit *>(next())) ) {
- GetDigitsData(0)->Fill( digit->GetEnergy()) ;
- }
-}
-
-//____________________________________________________________________________
-void AliPHOSQADataMaker::MakeDigits(TTree * digitTree)
-{
- // makes data from Digit Tree
- TClonesArray * digits = new TClonesArray("AliPHOSDigit", 1000) ;
-
- TBranch * branch = digitTree->GetBranch("PHOS") ;
- if ( ! branch ) {
- AliWarning("PHOS branch in Digit Tree not found") ;
- } else {
- branch->SetAddress(&digits) ;
- branch->GetEntry(0) ;
- MakeDigits(digits) ;
- }
-}
-
-//____________________________________________________________________________
-// void AliPHOSQADataMaker::MakeRecParticles(TTree * recpar)
-// {
-// // makes data from RecParticles
-
-// TClonesArray * recparticles = dynamic_cast<TClonesArray*>(fData) ;
-// fhRecParticlesMul->Fill(recparticles->GetEntriesFast()) ;
-// TIter next(recparticles) ;
-// AliPHOSRecParticle * recparticle ;
-// while ( (recparticle = dynamic_cast<AliPHOSRecParticle *>(next())) ) {
-// fhRecParticles->Fill( recparticle->Energy()) ;
-// }
-// }
-
-//____________________________________________________________________________
-void AliPHOSQADataMaker::MakeRaws(AliRawReader* rawReader)
-{
- const Int_t modMax = 5 ;
- rawReader->Reset() ;
- AliPHOSRawDecoder decoder(rawReader);
- decoder.SubtractPedestals(AliPHOSReconstructor::GetRecoParam()->EMCSubtractPedestals());
- Int_t count = 0 ;
- while (decoder.NextDigit()) {
- Int_t module = decoder.GetModule() ;
- Int_t row = decoder.GetRow() ;
- Int_t col = decoder.GetColumn() ;
- Double_t time = decoder.GetTime() ;
- Double_t energy = decoder.GetEnergy() ;
- Bool_t lowGain = decoder.IsLowGain();
- if (lowGain) {
- GetRawsData(module)->Fill(row, col) ;
- GetRawsData(10)->Fill(module) ;
- GetRawsData(12)->Fill(time) ;
- GetRawsData(14)->Fill(energy) ;
- } else {
- GetRawsData(module+modMax)->Fill(row, col) ;
- GetRawsData(11)->Fill(module) ;
- GetRawsData(13)->Fill(time) ;
- GetRawsData(15)->Fill(energy) ;
- }
- //AliInfo(Form(" %d %d %d %d %f %f\n", count, module, row, col, time, energy)) ;
- count++ ;
- }
-}
-
-//____________________________________________________________________________
-void AliPHOSQADataMaker::MakeRecPoints(TTree * clustersTree)
-{
- {
- // makes data from RecPoints
- TBranch *emcbranch = clustersTree->GetBranch("PHOSEmcRP");
- if (!emcbranch) {
- AliError("can't get the branch with the PHOS EMC clusters !");
- return;
- }
- TObjArray * emcrecpoints = new TObjArray(100) ;
- emcbranch->SetAddress(&emcrecpoints);
- emcbranch->GetEntry(0);
-
- GetRecPointsData(1)->Fill(emcrecpoints->GetEntriesFast()) ;
- TIter next(emcrecpoints) ;
- AliPHOSEmcRecPoint * rp ;
- while ( (rp = dynamic_cast<AliPHOSEmcRecPoint *>(next())) ) {
- GetRecPointsData(0)->Fill( rp->GetEnergy()) ;
- }
- emcrecpoints->Delete();
- delete emcrecpoints;
- }
- {
- TBranch *cpvbranch = clustersTree->GetBranch("PHOSCpvRP");
- if (!cpvbranch) {
- AliError("can't get the branch with the PHOS CPV clusters !");
- return;
- }
- TObjArray *cpvrecpoints = new TObjArray(100) ;
- cpvbranch->SetAddress(&cpvrecpoints);
- cpvbranch->GetEntry(0);
-
- GetRecPointsData(1)->Fill(cpvrecpoints->GetEntriesFast()) ;
- TIter next(cpvrecpoints) ;
- AliPHOSCpvRecPoint * rp ;
- while ( (rp = dynamic_cast<AliPHOSCpvRecPoint *>(next())) ) {
- GetRecPointsData(0)->Fill( rp->GetEnergy()) ;
- }
- cpvrecpoints->Delete();
- delete cpvrecpoints;
- }
-}
-
-//____________________________________________________________________________
-void AliPHOSQADataMaker::MakeSDigits(TClonesArray * sdigits)
-{
- // makes data from SDigits
-
- GetSDigitsData(1)->Fill(sdigits->GetEntriesFast()) ;
- TIter next(sdigits) ;
- AliPHOSDigit * sdigit ;
- while ( (sdigit = dynamic_cast<AliPHOSDigit *>(next())) ) {
- GetSDigitsData(0)->Fill( sdigit->GetEnergy()) ;
- }
-}
-
-//____________________________________________________________________________
-void AliPHOSQADataMaker::MakeSDigits(TTree * sdigitTree)
-{
- // makes data from SDigit Tree
- TClonesArray * sdigits = new TClonesArray("AliPHOSDigit", 1000) ;
-
- TBranch * branch = sdigitTree->GetBranch("PHOS") ;
- if ( ! branch ) {
- AliWarning("PHOS branch in SDigit Tree not found") ;
- } else {
- branch->SetAddress(&sdigits) ;
- branch->GetEntry(0) ;
- MakeSDigits(sdigits) ;
- }
-}
-
-//____________________________________________________________________________
-// void AliPHOSQADataMaker::MakeTrackSegments(TTree * ts)
-// {
-// // makes data from TrackSegments
-
-// TClonesArray * tracksegments = dynamic_cast<TClonesArray*>(fData) ;
-
-// fhTrackSegmentsMul->Fill(tracksegments->GetEntriesFast()) ;
-// TIter next(tracksegments) ;
-// AliPHOSTrackSegment * ts ;
-// while ( (ts = dynamic_cast<AliPHOSTrackSegment *>(next())) ) {
-// fhTrackSegments->Fill( ts->GetCpvDistance()) ;
-// }
-// }
-
-//____________________________________________________________________________
-void AliPHOSQADataMaker::StartOfDetectorCycle()
-{
- //Detector specific actions at start of cycle
-
-}
+++ /dev/null
-#ifndef ALIPHOSQADATAMAKER_H
-#define ALIPHOSQADATAMAKER_H
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice */
-
-
-/* $Id$ */
-
-/*
- Produces the data needed to calculate the quality assurance.
- All data must be mergeable objects.
- Y. Schutz CERN July 2007
-*/
-
-
-// --- ROOT system ---
-class TH1F ;
-class TH1I ;
-class TObjArray ;
-
-// --- Standard library ---
-
-// --- AliRoot header files ---
-#include "AliQADataMaker.h"
-
-class AliPHOSQADataMaker: public AliQADataMaker {
-
-public:
- AliPHOSQADataMaker() ; // ctor
- AliPHOSQADataMaker(const AliPHOSQADataMaker& qadm) ;
- AliPHOSQADataMaker& operator = (const AliPHOSQADataMaker& qadm) ;
- virtual ~AliPHOSQADataMaker() {;} // dtor
-
-private:
- virtual void EndOfDetectorCycle(AliQA::TASKINDEX, TObjArray * list) ;
- virtual void InitHits() ;
- virtual void InitESDs() ;
- virtual void InitDigits() ;
- //virtual void InitRecParticles() ;
- virtual void InitRecPoints() ;
- virtual void InitRaws() ;
- //virtual void InitTrackSegments() ;
- virtual void InitSDigits() ;
- virtual void MakeESDs(AliESDEvent * esd) ;
- virtual void MakeHits(TClonesArray * hits) ;
- virtual void MakeHits(TTree * hitTree) ;
- virtual void MakeDigits(TClonesArray * digits) ;
- virtual void MakeDigits(TTree * digitTree) ;
- // virtual void MakeRecParticles(TTree * recpar) ;
- virtual void MakeRecPoints(TTree * recpoTree) ;
- virtual void MakeRaws(AliRawReader* rawReader) ;
- virtual void MakeSDigits(TClonesArray * sigits) ;
- virtual void MakeSDigits(TTree * sigitTree) ;
- //virtual void MakeTrackSegments(TTree *ts ) ;
- virtual void StartOfDetectorCycle() ;
-
- ClassDef(AliPHOSQADataMaker,1) // description
-
-};
-
-#endif // AliPHOSQADataMaker_H
+++ /dev/null
-/**************************************************************************
- * Copyright(c) 2007, 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 decodes the stream of ALTRO samples to extract
-// the PHOS "digits" of current event.
-//
-// Typical use case:
-// AliRawReader* rf = new AliRawReaderDate("2006run2211.raw");
-// AliPHOSRawDecoder dc(rf);
-// while (rf->NextEvent()) {
-// dc.SubtractPedestals(kTRUE);
-// while ( dc.NextDigit() ) {
-// Int_t module = dc.GetModule();
-// Int_t column = dc.GetColumn();
-// Int_t row = dc.GetRow();
-// Double_t amplitude = dc.GetEnergy();
-// Double_t time = dc.GetTime();
-// Bool_t IsLowGain = dc.IsLowGain();
-// ..........
-// }
-// }
-
-// Author: Boris Polichtchouk
-
-// --- ROOT system ---
-#include "TArrayI.h"
-#include "TMath.h"
-
-// --- AliRoot header files ---
-#include "AliPHOSRawDecoder.h"
-#include "AliRawReader.h"
-#include "AliPHOSCalibData.h"
-#include "AliLog.h"
-
-ClassImp(AliPHOSRawDecoder)
-
-//-----------------------------------------------------------------------------
-AliPHOSRawDecoder::AliPHOSRawDecoder():
- TObject(),
- fRawReader(0),
- fCaloStream(0),
- fPedSubtract(kFALSE),
- fEnergy(-111),
- fTime(-111),
- fQuality(0.),
- fPedestalRMS(0.),
- fAmpOffset(0),
- fAmpThreshold(0),
- fModule(-1),
- fColumn(-1),
- fRow(-1),
- fNewModule(-1),
- fNewColumn(-1),
- fNewRow(-1),
- fNewAmp(0),
- fNewTime(0),
- fLowGainFlag(kFALSE),
- fNewLowGainFlag(kFALSE),
- fOverflow(kFALSE),
- fSamples(0),
- fTimes(0),
- fCalibData(0)
-{
- //Default constructor.
-}
-
-//-----------------------------------------------------------------------------
-AliPHOSRawDecoder::AliPHOSRawDecoder(AliRawReader* rawReader, AliAltroMapping **mapping):
- TObject(),
- fRawReader(0),
- fCaloStream(0),
- fPedSubtract(kFALSE),
- fEnergy(-111),
- fTime(-111),
- fQuality(0.),
- fPedestalRMS(0.),
- fAmpOffset(0),
- fAmpThreshold(0),
- fModule(-1),
- fColumn(-1),
- fRow(-1),
- fNewModule(-1),
- fNewColumn(-1),
- fNewRow(-1),
- fNewAmp(0),
- fNewTime(0),
- fLowGainFlag(kFALSE),
- fNewLowGainFlag(kFALSE),
- fOverflow(kFALSE),
- fSamples(0),
- fTimes(0),
- fCalibData(0)
-{
- //Construct a decoder object.
- //Is is user responsibility to provide next raw event
- //using AliRawReader::NextEvent().
-
- fRawReader = rawReader;
- fCaloStream = new AliCaloRawStream(rawReader,"PHOS",mapping);
- fSamples = new TArrayI(100);
- fTimes = new TArrayI(100);
-}
-
-//-----------------------------------------------------------------------------
-AliPHOSRawDecoder::~AliPHOSRawDecoder()
-{
- //Destructor.
-
- if(fCaloStream){ delete fCaloStream; fCaloStream=0;}
- if(fSamples){ delete fSamples; fSamples=0 ;}
- if(fTimes){ delete fTimes; fTimes=0 ;}
-}
-
-//-----------------------------------------------------------------------------
-AliPHOSRawDecoder::AliPHOSRawDecoder(const AliPHOSRawDecoder &phosDecoder ):
- TObject(),
- fRawReader(phosDecoder.fRawReader),
- fCaloStream(phosDecoder.fCaloStream),
- fPedSubtract(phosDecoder.fPedSubtract),
- fEnergy(phosDecoder.fEnergy),
- fTime(phosDecoder.fTime),
- fQuality(phosDecoder.fQuality),
- fPedestalRMS(phosDecoder.fPedestalRMS),
- fAmpOffset(phosDecoder.fAmpOffset),
- fAmpThreshold(phosDecoder.fAmpThreshold),
- fModule(phosDecoder.fModule),
- fColumn(phosDecoder.fColumn),
- fRow(phosDecoder.fRow),
- fNewModule(phosDecoder.fNewModule),
- fNewColumn(phosDecoder.fNewColumn),
- fNewRow(phosDecoder.fNewRow),
- fNewAmp(phosDecoder.fNewAmp),
- fNewTime(phosDecoder.fNewTime),
- fLowGainFlag(phosDecoder.fLowGainFlag),
- fNewLowGainFlag(phosDecoder.fNewLowGainFlag),
- fOverflow(phosDecoder.fOverflow),
- fSamples(phosDecoder.fSamples),
- fTimes(phosDecoder.fTimes),
- fCalibData(phosDecoder.fCalibData)
-{
- //Copy constructor.
-}
-
-//-----------------------------------------------------------------------------
-AliPHOSRawDecoder& AliPHOSRawDecoder::operator = (const AliPHOSRawDecoder &phosDecode)
-{
- //Assignment operator.
-
- if(this != &phosDecode) {
- fRawReader = phosDecode.fRawReader;
-
- if(fCaloStream) delete fCaloStream;
- fCaloStream = phosDecode.fCaloStream;
-
- fEnergy = phosDecode.fEnergy;
- fTime = phosDecode.fTime;
- fQuality = phosDecode.fQuality ;
- fPedestalRMS = phosDecode.fPedestalRMS ;
- fAmpOffset = phosDecode.fAmpOffset ;
- fModule = phosDecode.fModule;
- fColumn = phosDecode.fColumn;
- fRow = phosDecode.fRow;
- fNewModule = phosDecode.fNewModule;
- fNewColumn = phosDecode.fNewColumn;
- fNewRow = phosDecode.fNewRow;
- fNewAmp = phosDecode.fNewAmp ;
- fNewTime= phosDecode.fNewTime ;
- fLowGainFlag = phosDecode.fLowGainFlag;
- fNewLowGainFlag = phosDecode.fNewLowGainFlag;
- fOverflow = phosDecode.fOverflow ;
-
- if(fSamples) delete fSamples;
- fSamples = phosDecode.fSamples;
-
- if(fTimes) delete fTimes;
- fTimes = phosDecode.fTimes;
- fCalibData = phosDecode.fCalibData;
- }
-
- return *this;
-}
-
-//-----------------------------------------------------------------------------
-
-Bool_t AliPHOSRawDecoder::NextDigit()
-{
- //Extract an energy deposited in the crystal,
- //crystal' position (module,column,row),
- //time and gain (high or low).
-
- AliCaloRawStream* in = fCaloStream;
-
- fEnergy = -111;
- Float_t pedMean = 0;
- Float_t pedRMS = 0;
- Int_t nPed = 0;
- Float_t baseLine = 1.0;
- const Int_t kPreSamples = 10;
-
- while ( in->Next() ) {
- // Evaluate previous sample
- if(in->IsNewHWAddress() && fEnergy!=-111){ //Do not return at first sample
-
- //First remember new sample
- fNewLowGainFlag = in->IsLowGain();
- fNewModule = in->GetModule()+1;
- fNewRow = in->GetRow() +1;
- fNewColumn = in->GetColumn()+1;
- fNewAmp = in->GetSignal() ;
- fNewTime=in->GetTime() ;
- // We take the energy as a maximum amplitude
- // and the pedestal from the 0th point (30 Aug 2006).
- // Time is not evaluated
- // Take it as a first time bin multiplied by the sample tick time
-
- if(fPedSubtract) {
- if (nPed > 0){
- fPedestalRMS=(pedRMS-pedMean*pedMean/nPed)/nPed ;
- if(fPedestalRMS > 0.)
- fPedestalRMS = TMath::Sqrt(fPedestalRMS) ;
- fEnergy -= (Double_t)(pedMean/nPed); // pedestal subtraction
- }
- else
- return kFALSE;
- }
- else{
- //take pedestals from DB
- Double_t pedestal = (Double_t) fAmpOffset ;
- if(fCalibData){
- Float_t truePed = fCalibData->GetADCpedestalEmc(fModule, fColumn, fRow) ;
- Int_t altroSettings = fCalibData->GetAltroOffsetEmc(fModule, fColumn, fRow) ;
- pedestal += truePed - altroSettings ;
- }
- else{
- printf("AliPHOSRawDecoder::NextDigit() Can not read data from OCDB \n") ;
- }
- fEnergy-=pedestal ;
- }
- if (fEnergy < baseLine) fEnergy = 0;
-
- return kTRUE;
- }
-
- fLowGainFlag = in->IsLowGain();
- fTime = 1;
- fModule = in->GetModule()+1;
- fRow = in->GetRow() +1;
- fColumn = in->GetColumn()+1;
-
- if(fLowGainFlag==fNewLowGainFlag && fModule==fNewModule &&
- fRow==fNewRow && fColumn==fNewColumn ){
- if(fNewAmp>fEnergy) fEnergy = (Double_t)fNewAmp ;
- fNewModule=-1 ; //copyed, do not copy more
- }
-
- //Calculate pedestal if necessary
- if(fPedSubtract && (in->GetTime() < kPreSamples)) {
- pedMean += in->GetSignal();
- pedRMS+=in->GetSignal()*in->GetSignal() ;
- nPed++;
- }
- if((Double_t)in->GetSignal() > fEnergy)
- fEnergy = (Double_t)in->GetSignal();
-
- } // in.Next()
-
- return kFALSE;
-}
+++ /dev/null
-#ifndef ALIPHOSRAWDECODER_H
-#define ALIPHOSRAWDECODER_H
-/* Copyright(c) 2007, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice */
-
-/* $Id$ */
-
-// This class extracts the PHOS "digits" of current event
-// (amplitude,time, position,gain) from the raw stream
-// provided by AliRawReader. See cxx source for use case.
-
-#include "AliCaloRawStream.h"
-
-class TArrayI;
-class AliRawReader;
-class AliPHOSCalibData ;
-
-class AliPHOSRawDecoder : public TObject
-{
-
-public:
-
- AliPHOSRawDecoder();
- AliPHOSRawDecoder(AliRawReader* rawReader, AliAltroMapping **mapping = NULL);
- AliPHOSRawDecoder(const AliPHOSRawDecoder& rawDecoder);
- AliPHOSRawDecoder& operator = (const AliPHOSRawDecoder& rawDecoder);
- virtual ~AliPHOSRawDecoder();
-
- virtual Bool_t NextDigit();
-
- void SubtractPedestals(Bool_t subtract) {fPedSubtract=subtract;}
- void SetAmpOffset(Int_t extPed=5){fAmpOffset=extPed ;}
- void SetAmpThreshold(Int_t thr=5){fAmpThreshold=thr ;}
-
- Double_t GetEnergy() const { return fEnergy; }
- Double_t GetTime() const { return fTime; }
- Double_t GetSampleQuality() const {return fQuality ;}
- Double_t GetPedestalRMS() const {return fPedestalRMS ;}
- Int_t GetModule() const { return fModule; }
- Int_t GetColumn() const { return fColumn; }
- Int_t GetRow() const { return fRow; }
- Bool_t IsLowGain() const { return fLowGainFlag; }
- Bool_t IsOverflow() const { return fOverflow ;}
-
- const AliRawReader* GetRawReader() const { return fRawReader; }
- void SetCalibData(AliPHOSCalibData * cdata){ fCalibData=cdata ;}
-
-protected:
-
- AliRawReader* fRawReader; // raw data reader
- AliCaloRawStream* fCaloStream; // PHOS/EMCAL raw data stream
- Bool_t fPedSubtract; // pedestals subtraction (kTRUE="yes")
-
-
- Double_t fEnergy; // "digit" energy
- Double_t fTime; // "digit" time
- Double_t fQuality ; //Sample quality
- Double_t fPedestalRMS; //calciulated RMS of pedestal (non-ZS runs)
- Int_t fAmpOffset ; //Pedestal offset from ALTRO chips
- Int_t fAmpThreshold ; //Zero Suppression threshold from ALTRO chips
- Int_t fModule; // PHOS module number (1-5)
- Int_t fColumn; // column in the module
- Int_t fRow; // row
- Int_t fNewModule; // PHOS module number (1-5) of keeped sample
- Int_t fNewColumn; // column in the module of keeped sample
- Int_t fNewRow; // row of keeped sample
- Int_t fNewAmp ; //Keeped amp
- Int_t fNewTime ; //Time of keeped sample
- Bool_t fLowGainFlag; //True if sample read from Low Gain
- Bool_t fNewLowGainFlag; // fLowGainFlag of keeped sample
- Bool_t fOverflow ; //Wether there was overflow
- TArrayI* fSamples; // array of samples
- TArrayI* fTimes ; // array of times corresponding to samples
- AliPHOSCalibData * fCalibData ; //! Calibration database if avalable
-
-
- ClassDef(AliPHOSRawDecoder,4)
-};
-
-#endif
+++ /dev/null
-/**************************************************************************
- * Copyright(c) 2007, 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 decodes the stream of ALTRO samples to extract
-// the PHOS "digits" of current event. Uses fitting procedure
-// to separate reasonable samples
-//
-// Typical use case:
-// AliRawReader* rf = new AliRawReaderDate("2006run2211.raw");
-// AliPHOSRawDecoder dc(rf);
-// while (rf->NextEvent()) {
-// dc.SubtractPedestals(kTRUE);
-// while ( dc.NextDigit() ) {
-// Int_t module = dc.GetModule();
-// Int_t column = dc.GetColumn();
-// Int_t row = dc.GetRow();
-// Double_t amplitude = dc.GetEnergy();
-// Double_t time = dc.GetTime();
-// Bool_t IsLowGain = dc.IsLowGain();
-// ..........
-// }
-// }
-
-// Author: Dmitri Peressounko
-
-// --- ROOT system ---
-#include "TList.h"
-#include "TMath.h"
-#include "TMinuit.h"
-#include "TCanvas.h"
-#include "TH1.h"
-#include "TH2.h"
-#include "TF1.h"
-#include "TROOT.h"
-
-// --- AliRoot header files ---
-#include "AliPHOSCalibData.h"
-#include "AliPHOSRawDecoderv1.h"
-#include "AliPHOSPulseGenerator.h"
-
-ClassImp(AliPHOSRawDecoderv1)
-
-//-----------------------------------------------------------------------------
- AliPHOSRawDecoderv1::AliPHOSRawDecoderv1():AliPHOSRawDecoder(),
- fSampleParamsLow(0x0),fSampleParamsHigh(0x0),fToFit(0x0)
-{
- //Default constructor.
-}
-
-//-----------------------------------------------------------------------------
-AliPHOSRawDecoderv1::AliPHOSRawDecoderv1(AliRawReader* rawReader, AliAltroMapping **mapping):
- AliPHOSRawDecoder(rawReader,mapping),
- fSampleParamsLow(0x0),fSampleParamsHigh(0x0),fToFit(0x0)
-{
- //Construct a decoder object.
- //Is is user responsibility to provide next raw event
- //using AliRawReader::NextEvent().
-
- if(!gMinuit)
- gMinuit = new TMinuit(100);
- fSampleParamsHigh =new TArrayD(7) ;
- fSampleParamsHigh->AddAt(2.174,0) ;
- fSampleParamsHigh->AddAt(0.106,1) ;
- fSampleParamsHigh->AddAt(0.173,2) ;
- fSampleParamsHigh->AddAt(0.06106,3) ;
- //last two parameters are pedestal and overflow
- fSampleParamsLow=new TArrayD(7) ;
- fSampleParamsLow->AddAt(2.456,0) ;
- fSampleParamsLow->AddAt(0.137,1) ;
- fSampleParamsLow->AddAt(2.276,2) ;
- fSampleParamsLow->AddAt(0.08246,3) ;
- fToFit = new TList() ;
-}
-
-//-----------------------------------------------------------------------------
-AliPHOSRawDecoderv1::~AliPHOSRawDecoderv1()
-{
- //Destructor.
- if(fSampleParamsLow){
- delete fSampleParamsLow ;
- fSampleParamsLow=0 ;
- }
- if(fSampleParamsHigh){
- delete fSampleParamsHigh ;
- fSampleParamsHigh=0;
- }
- if(fToFit){
- delete fToFit ;
- fToFit=0 ;
- }
-}
-
-//-----------------------------------------------------------------------------
-AliPHOSRawDecoderv1::AliPHOSRawDecoderv1(const AliPHOSRawDecoderv1 &phosDecoder ):
- AliPHOSRawDecoder(phosDecoder),
- fSampleParamsLow(0x0),fSampleParamsHigh(0x0),fToFit(0x0)
-{
- //Copy constructor.
- fToFit = new TList() ;
- fSampleParamsLow =new TArrayD(*(phosDecoder.fSampleParamsLow)) ;
- fSampleParamsHigh=new TArrayD(*(phosDecoder.fSampleParamsHigh)) ;
-}
-
-//-----------------------------------------------------------------------------
-AliPHOSRawDecoderv1& AliPHOSRawDecoderv1::operator = (const AliPHOSRawDecoderv1 &phosDecoder)
-{
- //Assignment operator.
-
- // if(this != &phosDecoder) {
- // }
- fToFit = new TList() ;
- if(fSampleParamsLow){
- fSampleParamsLow = phosDecoder.fSampleParamsLow ;
- fSampleParamsHigh= phosDecoder.fSampleParamsHigh ;
- }
- else{
- fSampleParamsLow =new TArrayD(*(phosDecoder.fSampleParamsLow)) ;
- fSampleParamsHigh=new TArrayD(*(phosDecoder.fSampleParamsHigh)) ;
- }
- return *this;
-}
-
-//-----------------------------------------------------------------------------
-Bool_t AliPHOSRawDecoderv1::NextDigit()
-{
- //Extract an energy deposited in the crystal,
- //crystal' position (module,column,row),
- //time and gain (high or low).
- //First collects sample, then evaluates it and if it has
- //reasonable shape, fits it with Gamma2 function and extracts
- //energy and time.
-
-//Debug=====================
-// TCanvas * c = 0; //(TCanvas*)gROOT->FindObjectAny("CSample") ;
-// if(!c)
-// c = new TCanvas("CSample","CSample") ;
-//
-// TH1D * h = 0 ; //(TH1D*)gROOT->FindObjectAny("hSample") ;
-// if(!h)
-// h=new TH1D("hSample","",200,0.,200.) ;
-//
-// TF1 * fff = 0 ; //(TF1*)gROOT->FindObjectAny("fff") ;
-// if(!fff)
-// fff = new TF1("fff","[0]+[1]*((abs(x-[2]))^[3]*exp(-(x-[2])*[4])+[5]*(x-[2])*(x-[2])*exp(-(x-[2])*[6]))",0.,1000.) ;
-//End debug===========
-
- AliCaloRawStream* in = fCaloStream;
-
- Int_t iBin = fSamples->GetSize() ;
- Int_t tLength = 0;
- fEnergy = -111;
- Float_t pedMean = 0;
- Float_t pedRMS = 0;
- Int_t nPed = 0;
- Float_t baseLine = 1.0;
- const Float_t nPreSamples = 10;
- fQuality= 999. ;
- const Float_t sampleMaxHG=102.332 ; //maximal height of HG sample with given parameterization
- const Float_t sampleMaxLG=277.196 ; //maximal height of HG sample with given parameterization
- const Float_t maxEtoFit=5 ; //fit only samples above this energy, accept all samples (with good aRMS) below it
- fSamples->Reset();
- fTimes ->Reset();
-
- while ( in->Next() ) {
-
- if(!tLength) {
- tLength = in->GetTimeLength();
- if(tLength!=fSamples->GetSize()) {
- delete fSamples ;
- delete fTimes ;
- fSamples = new TArrayI(tLength);
- fTimes = new TArrayI(tLength);
- iBin= fSamples->GetSize() ;
- }
- else{
- fSamples->Reset() ;
- }
- }
-
- // Fit the full sample
- if((in->IsNewHWAddress() && iBin != fSamples->GetSize()) //new HW address
- ||(iBin<=0)) { //or new signal in same address
-
- //First remember new sample
- fNewLowGainFlag = in->IsLowGain();
- fNewModule = in->GetModule()+1;
- fNewRow = in->GetRow() +1;
- fNewColumn = in->GetColumn()+1;
- fNewAmp = in->GetSignal() ;
- fNewTime = in->GetTime() ;
-
- //now handle already collected
- Double_t pedestal =0. ;
- fPedestalRMS=0. ;
- if(fPedSubtract){
- if (nPed > 0){
- pedestal = (Double_t)(pedMean/nPed);
- fPedestalRMS=pedRMS/nPed-pedestal*pedestal ;
- if(fPedestalRMS>0.) fPedestalRMS=TMath::Sqrt(fPedestalRMS) ;
- }
- else
- return kFALSE;
- }
- else{
- //take pedestals from DB
- pedestal = fAmpThreshold ;
- if(fCalibData){
- Float_t truePed = fCalibData->GetADCpedestalEmc(fModule, fColumn, fRow) ;
- Int_t altroSettings = fCalibData->GetAltroOffsetEmc(fModule, fColumn, fRow) ;
- pedestal += truePed - altroSettings ;
- }
- else{
-// printf("AliPHOSRawDecoderv1::NextDigit(): Can not read data from OCDB \n") ;
- }
- }
-
- //calculate time and energy
- Int_t maxBin=0 ;
- Int_t maxAmp=0 ;
- Double_t aMean=0. ;
- Double_t aRMS=0. ;
- Double_t wts=0 ;
- Int_t tStart = 0 ;
- for(Int_t i=iBin; i<fSamples->GetSize(); i++){
- if(fSamples->At(i)>pedestal){
- Double_t de=fSamples->At(i)-pedestal ;
- if(de>1.){
- aMean+=de*i ;
- aRMS+=de*i*i ;
- wts+=de;
- }
- if(de>2 && tStart==0)
- tStart=i ;
- if(maxAmp<fSamples->At(i)){
- maxBin=i ;
- maxAmp=fSamples->At(i) ;
- }
- }
- }
- if(maxBin==fSamples->GetSize()-1){//bad "rising" sample
- fEnergy=0. ;
- fTime=-999.;
- fQuality= 999. ;
- return kTRUE ;
- }
- fEnergy=Double_t(maxAmp)-pedestal ;
- fOverflow =0 ; //look for plato on the top of sample
- if(fEnergy>500 && //this is not fluctuation of soft sample
- maxBin<fSamples->GetSize()-1 && fSamples->At(maxBin+1)==maxAmp){ //and there is a plato
- fOverflow = kTRUE ;
- }
-
- if(wts>0){
- aMean/=wts;
- aRMS=aRMS/wts-aMean*aMean;
- }
-
- //do not take too small energies
- if(fEnergy < baseLine)
- fEnergy = 0;
-
- //do not test quality of too soft samples
- if(fEnergy<maxEtoFit){
- fTime=fTimes->At(tStart);
- if(aRMS<2.) //sigle peak
- fQuality=999. ;
- else
- fQuality= 0. ;
- return kTRUE ;
- }
-
-
-//Debug:=====Draw sample
-//if(fEnergy>pedestal+10.){
-//if(fLowGainFlag && fEnergy>2){
-// if(!c)
-// if(!fLowGainFlag && fRow==32 && fColumn==18){
-// TCanvas *c = new TCanvas("CSample","CSample") ;
-// c->cd() ;
-// h->Draw() ;
-// c->Update() ;
-// printf("fEnergy=%f, aRMS=%f \n",fEnergy,aRMS) ;
-//getchar() ;
-//}
-//======================
-
- //IF sample has reasonable mean and RMS, try to fit it with gamma2
-
- gMinuit->mncler(); // Reset Minuit's list of paramters
- gMinuit->SetPrintLevel(-1) ; // No Printout
- gMinuit->SetFCN(AliPHOSRawDecoderv1::UnfoldingChiSquare) ;
- // To set the address of the minimization function
-
- fToFit->Clear("nodelete") ;
- Double_t b,bmin,bmax ;
- if(fLowGainFlag){
- fSampleParamsLow->AddAt(pedestal,4) ;
- if(fOverflow)
- fSampleParamsLow->AddAt(double(maxAmp),5) ;
- else
- fSampleParamsLow->AddAt(double(1023),5) ;
- fSampleParamsLow->AddAt(double(iBin),6) ;
- fToFit->AddFirst((TObject*)fSampleParamsLow) ;
- b=fSampleParamsLow->At(2) ;
- bmin=0.5 ;
- bmax=10. ;
- }
- else{
- fSampleParamsHigh->AddAt(pedestal,4) ;
- if(fOverflow)
- fSampleParamsHigh->AddAt(double(maxAmp),5) ;
- else
- fSampleParamsHigh->AddAt(double(1023),5);
- fSampleParamsHigh->AddAt(double(iBin),6);
- fToFit->AddFirst((TObject*)fSampleParamsHigh) ;
- b=fSampleParamsHigh->At(2) ;
- bmin=0.05 ;
- bmax=0.4 ;
- }
- fToFit->AddLast((TObject*)fSamples) ;
- fToFit->AddLast((TObject*)fTimes) ;
-
- gMinuit->SetObjectFit((TObject*)fToFit) ; // To tranfer pointer to UnfoldingChiSquare
- Int_t ierflg ;
- gMinuit->mnparm(0, "t0", 1.*tStart, 0.01, -500., 500., ierflg) ;
- if(ierflg != 0){
-// AliWarning(Form("Unable to set initial value for fit procedure : t0=%e\n",1.*tStart) ) ;
- fEnergy=0. ;
- fTime=-999. ;
- fQuality=999 ;
- return kTRUE ; //will scan further
- }
- Double_t amp0;
- if(fLowGainFlag)
- amp0=fEnergy/sampleMaxLG;
- else
- amp0=fEnergy/sampleMaxHG;
-
- gMinuit->mnparm(1, "Energy", amp0 , 0.01*amp0, 0, 0, ierflg) ;
- if(ierflg != 0){
-// AliWarning(Form("Unable to set initial value for fit procedure : E=%e\n", amp0)) ;
- fEnergy=0. ;
- fTime=-999. ;
- fQuality=999 ;
- return kTRUE ; //will scan further
- }
-
- gMinuit->mnparm(2, "p2", b, 0.01*b, bmin, bmax, ierflg) ;
- if(ierflg != 0){
-// AliWarning(Form("Unable to set initial value for fit procedure : E=%e\n", amp0)) ;
- fEnergy=0. ;
- fTime=-999. ;
- fQuality=999 ;
- return kTRUE ; //will scan further
- }
-
-
- Double_t p0 = 0.0001 ; // "Tolerance" Evaluation stops when EDM = 0.0001*p0 ; The number of function call slightly
- // depends on it.
- Double_t p1 = 1.0 ;
- Double_t p2 = 0.0 ;
- gMinuit->mnexcm("SET STR", &p2, 0, ierflg) ; // force TMinuit to reduce function calls
- gMinuit->mnexcm("SET GRA", &p1, 1, ierflg) ; // force TMinuit to use my gradient
- // gMinuit->SetMaxIterations(100);
- gMinuit->mnexcm("SET NOW", &p2 , 0, ierflg) ; // No Warnings
-
- gMinuit->mnexcm("MIGRAD", &p0, 0, ierflg) ; // minimize
-
- Double_t err,t0err ;
- Double_t t0,efit ;
- gMinuit->GetParameter(0,t0, t0err) ;
- gMinuit->GetParameter(1,efit, err) ;
-
- Double_t bfit, berr ;
- gMinuit->GetParameter(2,bfit,berr) ;
-
- //Calculate total energy
- //this isparameterization of depetendence of pulse height on parameter b
- if(fLowGainFlag)
- efit*=99.54910 + 78.65038*bfit ;
- else
- efit*=80.33109+128.6433*bfit ;
-
- if(efit<0. || efit > 10000.){
-//set energy to previously found max
-// fEnergy=0 ; //bad sample
- fTime=-999.;
- fQuality=999 ;
- return kTRUE;
- }
-
- //evaluate fit quality
- Double_t fmin,fedm,errdef ;
- Int_t npari,nparx,istat;
- gMinuit->mnstat(fmin,fedm,errdef,npari,nparx,istat) ;
- fQuality=fmin/(fSamples->GetSize()-iBin) ;
- //compare quality with some parameterization
- if(fLowGainFlag){
- fQuality/=2.+0.002*fEnergy ;
- }
- else{
- fQuality/=0.75+0.0025*fEnergy ;
- }
-
-//Debug================
-// Double_t n,alpha,beta ;
-// Double_t en ;
-// if(fLowGainFlag){
-// n=fSampleParamsLow->At(0) ;
-// alpha=fSampleParamsLow->At(1) ;
-// beta=fSampleParamsLow->At(3) ;
-// en=efit/(99.54910 + 78.65038*bfit) ;
-// }
-// else{
-// n=fSampleParamsHigh->At(0) ;
-// alpha=fSampleParamsHigh->At(1) ;
-// beta=fSampleParamsHigh->At(3) ;
-// en=efit/(80.33109+128.6433*bfit) ;
-// }
-//
-//// if( fQuality > 1 && fEnergy > 20. && !fOverflow){
-//// if(!fLowGainFlag && fRow==32 && fColumn==18){
-//{
-// printf("Col=%d, row=%d, qual=%f, E=%f, t0=%f, b=%f\n",fColumn,fRow,fQuality,efit,t0,bfit) ;
-// printf(" Energy = %f \n",fEnergy) ;
-// TCanvas * c = new TCanvas("samp") ;
-// c->cd() ;
-// h->Draw() ;
-// if(fLowGainFlag){
-// fff->SetParameters(pedestal,en,t0,n,alpha,bfit,beta) ;
-// }
-// else{
-// fff->SetParameters(pedestal,en,t0,n,alpha,bfit,beta) ;
-// }
-////// for(Int_t i=1;i<=h->GetNbinsX(); i++){
-//// Double_t x=h->GetBinCenter(i) ;
-//// h->SetBinContent(i,h->GetBinContent(i)-fff->Eval(x)) ;
-//// }
-//// h->SetMinimum(-15.) ;
-//// h->SetMaximum(15.) ;
-// h->Draw() ;
-// fff->Draw("same") ;
-// c->Update();
-// getchar() ;
-// }
-//====================
-
- fEnergy=efit ;
- fTime=t0-4.024*bfit ; //-10.402*bfit+4.669*bfit*bfit ; //Correction for 70 samples
-// fTime=t0+2.8*bfit ; //-10.402*bfit+4.669*bfit*bfit ; //Correction for 50 samples
-// fQuality = bfit ;
- return kTRUE;
- }
-
- fLowGainFlag = in->IsLowGain();
- fModule = in->GetModule()+1;
- fRow = in->GetRow() +1;
- fColumn = in->GetColumn()+1;
-
- //add previouly taken if coincides
- if(fLowGainFlag==fNewLowGainFlag && fModule==fNewModule &&
- fRow==fNewRow && fColumn==fNewColumn){
- iBin--;
- if(fPedSubtract && fNewTime < nPreSamples) {
- pedMean += in->GetSignal();
- pedRMS += in->GetSignal()*in->GetSignal() ;
- nPed++;
- }
- fSamples->AddAt(fNewAmp,iBin);
- fTimes->AddAt(fNewTime,iBin);
-
- //Mark that we already take it
- fNewModule=-1 ;
- }
-
- // Fill array with samples
- iBin--;
- if(fPedSubtract && (in->GetTime() < nPreSamples)) {
- pedMean += in->GetSignal();
- pedRMS += in->GetSignal()*in->GetSignal() ;
- nPed++;
- }
- fSamples->AddAt(in->GetSignal()-fAmpOffset,iBin);
- fTimes->AddAt(in->GetTime(),iBin);
-
-//Debug==============
-// h->SetBinContent(in->GetTime(),in->GetSignal()) ;
-//EndDebug==============
-
- } // in.Next()
-
- return kFALSE;
-}
-//_____________________________________________________________________________
-void AliPHOSRawDecoderv1::UnfoldingChiSquare(Int_t & /*nPar*/, Double_t * Grad, Double_t & fret, Double_t * x, Int_t iflag)
-{
- // Number of parameters, Gradient, Chi squared, parameters, what to do
-
- TList * toFit= (TList*)gMinuit->GetObjectFit() ;
- TArrayD * params=(TArrayD*)toFit->At(0) ;
- TArrayI * samples = (TArrayI*)toFit->At(1) ;
- TArrayI * times = (TArrayI*)toFit->At(2) ;
-
- fret = 0. ;
- if(iflag == 2)
- for(Int_t iparam = 0 ; iparam < 3 ; iparam++)
- Grad[iparam] = 0 ; // Will evaluate gradient
-
- Double_t t0=x[0] ;
- Double_t en=x[1] ;
- Double_t b=x[2] ;
- Double_t n=params->At(0) ;
- Double_t alpha=params->At(1) ;
- Double_t beta=params->At(3) ;
- Double_t ped=params->At(4) ;
-
- Double_t overflow=params->At(5) ;
- Int_t iBin = (Int_t) params->At(6) ;
- Int_t nSamples=TMath::Min(iBin+70,samples->GetSize()) ; //Here we set number of points to fit (70)
- // iBin - first non-zero sample
- Int_t tStep=times->At(iBin+1)-times->At(iBin) ;
- Double_t ddt=times->At(iBin)-t0-tStep ;
- Double_t exp1=TMath::Exp(-alpha*ddt) ;
- Double_t exp2=TMath::Exp(-beta*ddt) ;
- Double_t dexp1=TMath::Exp(-alpha*tStep) ;
- Double_t dexp2=TMath::Exp(-beta*tStep) ;
- for(Int_t i = iBin; i<nSamples ; i++) {
- Double_t dt=double(times->At(i))-t0 ;
- Double_t fsample = double(samples->At(i)) ;
- if(fsample>=overflow)
- continue ;
- Double_t diff ;
- exp1*=dexp1 ;
- exp2*=dexp2 ;
- if(dt<=0.){
- diff=fsample - ped ;
- fret += diff*diff ;
- continue ;
- }
- Double_t dtn=TMath::Power(dt,n) ;
- Double_t dtnE=dtn*exp1 ;
- Double_t dt2E=dt*dt*exp2 ;
- Double_t fit=ped+en*(dtnE + b*dt2E) ;
-// if(fit>=overflow){
-// diff=fsample-overflow ;
-// fret += diff*diff ;
-// //zero gradient here
-// }
-// else{
- diff = fsample - fit ;
- fret += diff*diff ;
- if(iflag == 2){ // calculate gradient
- Grad[0] += en*diff*(dtnE*(n/dt-alpha)+b*dt2E*(2./dt-beta)) ; //derivative over t0
- Grad[1] -= diff*(dtnE+b*dt2E) ;
- Grad[2] -= en*diff*dt2E ;
- }
-// }
- }
- if(iflag == 2)
- for(Int_t iparam = 0 ; iparam < 3 ; iparam++)
- Grad[iparam] *= 2. ;
-}
-//-----------------------------------------------------------------------------
-Double_t AliPHOSRawDecoderv1::Gamma2(Double_t dt,Double_t en,Double_t b,TArrayD * params){ //Function for fitting samples
- //parameters:
- //dt-time after start
- //en-amplutude
- //function parameters
-
- Double_t ped=params->At(4) ;
- if(dt<0.)
- return ped ; //pedestal
- else
- return ped+en*(TMath::Power(dt,params->At(0))*TMath::Exp(-dt*params->At(1))+b*dt*dt*TMath::Exp(-dt*params->At(3))) ;
-}
-
+++ /dev/null
-#ifndef ALIPHOSRAWDECODERV1_H
-#define ALIPHOSRAWDECODERV1_H
-/* Copyright(c) 2007, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice */
-
-/* $Id$ */
-
-// This class extracts the PHOS "digits" of current event
-// (amplitude,time, position,gain) from the raw stream
-// provided by AliRawReader. See cxx source for use case.
-
-#include "AliRawReader.h"
-#include "AliCaloRawStream.h"
-#include "AliPHOSRawDecoder.h"
-#include "TArrayD.h"
-class TList;
-
-class AliPHOSRawDecoderv1 : public AliPHOSRawDecoder {
-
-public:
-
- AliPHOSRawDecoderv1();
- AliPHOSRawDecoderv1(AliRawReader* rawReader, AliAltroMapping **mapping = NULL);
- AliPHOSRawDecoderv1(const AliPHOSRawDecoderv1& rawDecoder);
- AliPHOSRawDecoderv1& operator = (const AliPHOSRawDecoderv1& rawDecoder);
- virtual ~AliPHOSRawDecoderv1();
-
- virtual Bool_t NextDigit();
-
- static Double_t Gamma2(Double_t dt,Double_t en,Double_t b,TArrayD * fitparams) ; // Shape of correct sample
- //class member function (not object member function)
- static void UnfoldingChiSquare(Int_t & nPar, Double_t * Grad, Double_t & fret, Double_t * x, Int_t iflag) ;
- // Chi^2 of the fit. Should be static to be passed to MINUIT
- void SetLowGainParams(Int_t n, Double_t * params){fSampleParamsLow->Set(n,params) ;} //fixed parameters of fit function
- void SetHighGainParams(Int_t n,Double_t * params){fSampleParamsHigh->Set(n,params) ;} //fixed parameters of fit function
-
-private:
- TArrayD *fSampleParamsLow ; //Fixed params of sample parameterization for Low gain
- TArrayD *fSampleParamsHigh; //Fixed params of sample parameterization for High gain
- TList * fToFit ; //! container to transfer parameters and data to fit
-
- ClassDef(AliPHOSRawDecoderv1,1)
-};
-
-#endif
+++ /dev/null
-/**************************************************************************
- * Copyright(c) 2007, 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 decodes the stream of ALTRO samples to extract
-// the PHOS "digits" of current event. Uses fitting procedure
-// to separate reasonable samples
-//
-// Typical use case:
-// AliRawReader* rf = new AliRawReaderDate("2006run2211.raw");
-// AliPHOSRawDecoder dc(rf);
-// while (rf->NextEvent()) {
-// dc.SubtractPedestals(kTRUE);
-// while ( dc.NextDigit() ) {
-// Int_t module = dc.GetModule();
-// Int_t column = dc.GetColumn();
-// Int_t row = dc.GetRow();
-// Double_t amplitude = dc.GetEnergy();
-// Double_t time = dc.GetTime();
-// Bool_t IsLowGain = dc.IsLowGain();
-// ..........
-// }
-// }
-
-// Author: Dmitri Peressounko using idea of Y.Kucheryaev
-
-// --- ROOT system ---
-#include "TList.h"
-#include "TMath.h"
-#include "TMinuit.h"
-
-#include "TCanvas.h"
-#include "TH1.h"
-#include "TH2.h"
-#include "TF1.h"
-#include "TROOT.h"
-
-// --- AliRoot header files ---
-//#include "AliLog.h"
-#include "AliPHOSRawDecoderv2.h"
-#include "AliPHOSPulseGenerator.h"
-
-
-ClassImp(AliPHOSRawDecoderv2)
-
-//-----------------------------------------------------------------------------
- AliPHOSRawDecoderv2::AliPHOSRawDecoderv2():AliPHOSRawDecoder(),
-fNtimeSamples(25),fRMScut(11.)
-{
- //Default constructor.
- fLGpar[0]=0.971 ;
- fLGpar[1]=0.0465;
- fLGpar[2]=1.56 ;
- fHGpar[0]=0.941 ;
- fHGpar[1]=0.0436;
- fHGpar[2]=1.65 ;
-}
-
-//-----------------------------------------------------------------------------
-AliPHOSRawDecoderv2::AliPHOSRawDecoderv2(AliRawReader* rawReader, AliAltroMapping **mapping):
- AliPHOSRawDecoder(rawReader,mapping),
-fNtimeSamples(25),fRMScut(11.)
-{
- //Construct a decoder object.
- //Is is user responsibility to provide next raw event
- //using AliRawReader::NextEvent().
- fLGpar[0]=0.971 ;
- fLGpar[1]=0.0465;
- fLGpar[2]=1.56 ;
- fHGpar[0]=0.941 ;
- fHGpar[1]=0.0436;
- fHGpar[2]=1.65 ;
-}
-
-//-----------------------------------------------------------------------------
-AliPHOSRawDecoderv2::~AliPHOSRawDecoderv2()
-{
- //Destructor.
- //Nothing to delete
-}
-
-//-----------------------------------------------------------------------------
-AliPHOSRawDecoderv2::AliPHOSRawDecoderv2(const AliPHOSRawDecoderv2 &phosDecoder ):
- AliPHOSRawDecoder(phosDecoder),
-fNtimeSamples(25),fRMScut(11.)
-{
- //Copy constructor.
- fNtimeSamples=phosDecoder.fNtimeSamples ;
- for(Int_t i=0; i<3;i++){
- fLGpar[i]=phosDecoder.fLGpar[i] ;
- fHGpar[i]=phosDecoder.fHGpar[i] ;
- }
- fRMScut=phosDecoder.fRMScut ;
-}
-
-//-----------------------------------------------------------------------------
-AliPHOSRawDecoderv2& AliPHOSRawDecoderv2::operator = (const AliPHOSRawDecoderv2 &phosDecoder)
-{
- //Assignment operator.
-
- fNtimeSamples=phosDecoder.fNtimeSamples ;
- for(Int_t i=0; i<3;i++){
- fLGpar[i]=phosDecoder.fLGpar[i] ;
- fHGpar[i]=phosDecoder.fHGpar[i] ;
- }
- fRMScut=phosDecoder.fRMScut ;
- return *this;
-}
-
-//-----------------------------------------------------------------------------
-Bool_t AliPHOSRawDecoderv2::NextDigit()
-{
- //Extract an energy deposited in the crystal,
- //crystal' position (module,column,row),
- //time and gain (high or low).
- //First collects sample, then evaluates it and if it has
- //reasonable shape, fits it with Gamma2 function and extracts
- //energy and time.
-
- TCanvas * cs = (TCanvas*)gROOT->FindObjectAny("CSample") ;
- if(!cs)
- cs = new TCanvas("CSample","CSample") ;
-
- TH1D * h = (TH1D*)gROOT->FindObjectAny("hSample") ;
- if(!h)
- h=new TH1D("hSample","",200,0.,200.) ;
-
-
- AliCaloRawStream* in = fCaloStream;
-
- Int_t iBin = fSamples->GetSize();
- fEnergy = 0;
- Double_t pedMean = 0;
- Double_t pedRMS = 0;
- Int_t nPed = 0;
- Double_t baseLine = 1.0;
- const Int_t nPreSamples = 10;
- fQuality = 0. ;
-
- while ( in->Next() ) {
-
- // Fit the full sample
- if(in->IsNewHWAddress() && iBin!=fSamples->GetSize()) {
-
- Double_t pedestal =0. ;
- if(fPedSubtract){
- if (nPed > 0)
- pedestal = (Double_t)(pedMean/nPed);
- else
- return kFALSE;
- }
- for(Int_t i=0; i<fSamples->GetSize(); i++){
- h->SetBinContent(i+1,fSamples->At(i)) ;
- }
-
- //calculate time and energy
- Int_t maxBin=0 ;
- Int_t maxAmp=0 ;
- for(Int_t i=iBin; i<fSamples->GetSize(); i++){
- if(maxAmp<fSamples->At(i)){
- maxBin=i ;
- maxAmp=fSamples->At(i) ;
- }
- }
- if(maxBin==fSamples->GetSize()-1){//bad sample
- fEnergy=0. ;
- fTime=-999.;
- return kTRUE ;
- }
- fEnergy=Double_t(maxAmp)-pedestal ;
- fOverflow =0 ; //look for plato on the top of sample
- if(fEnergy>500 && //this is not fluctuation of soft sample
- maxBin<fSamples->GetSize()-1 && fSamples->At(maxBin+1)==maxAmp){ //and there is a plato
- fOverflow = kTRUE ;
- }
-
-// if(fEnergy>500.){
-// if(fRow==54 && fColumn==24){
-// printf("fE=%f, ped=%f, row=%d, col=%d \n",fEnergy,pedestal,fRow,fColumn) ;
-// if(fOverflow)printf(" Overflow \n") ;
-// else printf("iBin=%d, maxBin=%d, maxAmp=%d,Amp(+1)=%d,Amp(-1)=%d \n",iBin,maxBin,maxAmp,fSamples->At(maxBin+1),fSamples->At(maxBin-1)) ;
-// cs->cd() ;
-// h->Draw() ;
-// cs->Update() ;
-// getchar() ;
-// }
-
- if(fOverflow)
- return kTRUE ; //do not calculate energy and time for overflowed channels
-
- if(fEnergy<baseLine){ //do not evaluate time, drop this sample
- fEnergy=0. ;
- fTime=-999.;
- return kTRUE ;
- }
-
- //else calculate time
- fTime=0. ;
- Double_t tRMS = 0. ;
- Double_t tW = 0. ;
- Int_t cnts=0 ;
- Double_t a,b,c ;
- if(fLowGainFlag){
- a=fLGpar[0] ;
- b=fLGpar[1] ;
- c=fLGpar[2] ;
- }
- else{
- a=fHGpar[0] ;
- b=fHGpar[1] ;
- c=fHGpar[2] ;
- }
-
- for(Int_t i=iBin+1; i<fSamples->GetSize()&& cnts<fNtimeSamples; i++){
- if(fSamples->At(i)<pedestal)
- continue ;
-//Presently we do not use channels with overflow
-// if(fOverflow && (fSamples->At(i)==maxAmp ||fSamples->At(i-1)==maxAmp)) //can not calculate time in overflow bin
-// continue ;
- if(fTimes->At(i)-fTimes->At(i-1)!=1) //do not use samples with non-consequtive points
- continue ;
- Double_t de=fSamples->At(i)-pedestal ;
- Double_t av = de+fSamples->At(i-1)-pedestal ;
- if(av<=0.) //this is fluctuation around pedestal, scip
- continue ;
- Double_t ds = fSamples->At(i)-fSamples->At(i-1) ;
- Double_t ti = ds/av ; // calculate log. derivative
- ti=a/(ti+b)-c*ti ; // and compare with parameterization
- ti=Double_t(fTimes->At(i))-ti ;
- Double_t wi = TMath::Abs(ds) ;
- fTime+=ti*wi ;
- tW+=wi;
- tRMS+=ti*ti*wi ;
- cnts++ ;
- }
-
- if(tW>0.){
- fTime/=tW ;
- fQuality = tRMS/tW-fTime*fTime ;
- //Normalize quality
-//printf("t0=%f, RMS=%f, cut=%f \n",fTime,tRMS,fRMScut) ;
-// if(tRMS>=fRMScut){ //bad sample
-// fTime=-999. ;
-// fEnergy=0. ;
-// }
- }
- else{
- fTime=-999. ;
- fQuality=999. ;
- }
-
- Bool_t isBad = 0 ;
- for(Int_t i=iBin+1; i<fSamples->GetSize()-1&&!isBad; i++){
- if(fSamples->At(i)>fSamples->At(i-1)+5 && fSamples->At(i)>fSamples->At(i+1)+5) { //single jump
- isBad=1 ;
- }
- }
- if(pedestal<10.)
- isBad=1 ;
-
- pedRMS=pedRMS/nPed-pedestal*pedestal ;
- if(pedRMS>0.1)
- isBad=1 ;
-
- for(Int_t i=iBin+1; i<fSamples->GetSize()-1&&!isBad; i++){
- if(fSamples->At(i)<pedestal-1)
- isBad=1 ;
- }
-
- //two maxima
-
-
- if(fEnergy>10. && !isBad ){
- printf("fE=%f, ped=%f, fQuality=%f, pedRMS=%f \n",fEnergy,pedestal,fQuality,pedRMS) ;
- if(fOverflow)printf(" Overflow \n") ;
- if(isBad)printf("bad") ;
-// else printf("iBin=%d, maxBin=%d, maxAmp=%d,Amp(+1)=%d,Amp(-1)=%d \n",iBin,maxBin,maxAmp,fSamples->At(maxBin+1),fSamples->At(maxBin-1)) ;
- cs->cd() ;
- h->Draw() ;
- cs->Update() ;
- getchar() ;
- }
-
-
- return kTRUE ; //will scan further
- }
-
- fLowGainFlag = in->IsLowGain();
- fModule = in->GetModule()+1;
- fRow = in->GetRow() +1;
- fColumn = in->GetColumn()+1;
-
-
- // Fill array with samples
- iBin--;
- if(fPedSubtract && (in->GetTime() < nPreSamples)) {
- pedMean += in->GetSignal();
- pedRMS += in->GetSignal()*in->GetSignal();
- nPed++;
- }
- fSamples->AddAt(in->GetSignal(),iBin);
- fTimes->AddAt(in->GetTime(),iBin);
- } // in.Next()
-
- return kFALSE;
-}
+++ /dev/null
-#ifndef ALIPHOSRAWDECODERV2_H
-#define ALIPHOSRAWDECODERV2_H
-/* Copyright(c) 2007, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice */
-
-/* $Id$ */
-
-// This class extracts the PHOS "digits" of current event
-// (amplitude,time, position,gain) from the raw stream
-// provided by AliRawReader. See cxx source for use case.
-
-#include "AliRawReader.h"
-#include "AliCaloRawStream.h"
-#include "AliPHOSRawDecoder.h"
-#include "TArrayD.h"
-class TList;
-
-class AliPHOSRawDecoderv2 : public AliPHOSRawDecoder {
-
-public:
-
- AliPHOSRawDecoderv2();
- AliPHOSRawDecoderv2(AliRawReader* rawReader, AliAltroMapping **mapping = NULL);
- AliPHOSRawDecoderv2(const AliPHOSRawDecoderv2& rawDecoder);
- AliPHOSRawDecoderv2& operator = (const AliPHOSRawDecoderv2& rawDecoder);
- virtual ~AliPHOSRawDecoderv2();
-
- virtual Bool_t NextDigit();
-
- void SetNTimeSamples(Short_t n=25){fNtimeSamples=n ;}
- void SetLowGainTParams(Double_t *pars){ for(Int_t i=0;i<3;i++) fLGpar[i]=pars[i] ; }
- void SetHighGainTParams(Double_t *pars){ for(Int_t i=0;i<3;i++) fHGpar[i]=pars[i] ; }
- void SetRMScut(Double_t cut=2.){fRMScut = cut ;}
-private:
- Short_t fNtimeSamples ; //Number of samples (after start) used to extract time
- Double_t fLGpar[3] ; //parameters for shape parameterization
- Double_t fHGpar[3] ; //parameters for shape parameterization
- Double_t fRMScut ; //cut to estmate goodness of sample
-
- ClassDef(AliPHOSRawDecoderv2,1)
-};
-
-#endif
+++ /dev/null
-#ifdef __CINT__
-
-#pragma link off all globals;
-#pragma link off all classes;
-#pragma link off all functions;
-
-#pragma link C++ class AliPHOSCalibHistoProducer+;
-#pragma link C++ class AliPHOSPreprocessor+;
-#pragma link C++ class AliPHOSDA1+;
-#pragma link C++ class AliPHOSDA2+;
-#pragma link C++ class AliPHOSCpvDA1+;
-#pragma link C++ class AliPHOSCpvPreprocessor+;
-#pragma link C++ class AliPHOSRcuDA1+;
-
-#endif
+++ /dev/null
-#-*- Mode: Makefile -*-
-
-SRCS = AliPHOSCalibHistoProducer.cxx \
- AliPHOSPreprocessor.cxx \
- AliPHOSRcuDA1.cxx \
- AliPHOSDA1.cxx \
- AliPHOSDA2.cxx \
- AliPHOSCpvDA1.cxx \
- AliPHOSCpvPreprocessor.cxx
-
-HDRS:= $(SRCS:.cxx=.h)
-
-DHDR= PHOSshuttleLinkDef.h
-
-EINCLUDE:=RAW
-
-ifeq (win32gcc,$(ALICE_TARGET))
-PACKSOFLAGS:= $(SOFLAGS) -L$(ALICE_ROOT)/lib/tgt_$(ALICE_TARGET) \
- -lPHOSbase -lSTEER -lCDB -lSTEERBase
-endif