X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=PHOS%2FAliPHOSGetter.cxx;h=5ac90f3e29deddfac0ca026832032443d1639db7;hb=140ba4b4d50b19c9068a90bdd7fb4d3019cde90f;hp=1d7b0daa10ace7f88beb6d0aadbc0808b18d9270;hpb=f5eaa8510b0876ca543549bb07dd851c9afb201d;p=u%2Fmrichter%2FAliRoot.git diff --git a/PHOS/AliPHOSGetter.cxx b/PHOS/AliPHOSGetter.cxx index 1d7b0daa10a..5ac90f3e29d 100644 --- a/PHOS/AliPHOSGetter.cxx +++ b/PHOS/AliPHOSGetter.cxx @@ -60,14 +60,16 @@ #include "AliPHOSBeamTestEvent.h" #include "AliPHOSGetter.h" #include "AliPHOSLoader.h" +#include "AliPHOSPulseGenerator.h" #include "AliRunLoader.h" #include "AliStack.h" -#include "AliPHOSRawStream.h" +#include "AliPHOSRawDecoder.h" #include "AliRawReaderFile.h" #include "AliLog.h" #include "AliCDBLocal.h" #include "AliCDBStorage.h" #include "AliCDBManager.h" +#include "AliPHOSRawDigiProducer.h" ClassImp(AliPHOSGetter) @@ -78,8 +80,35 @@ Int_t AliPHOSGetter::fgDebug = 0; // TFile * AliPHOSGetter::fgFile = 0 ; +AliPHOSGetter::AliPHOSGetter() : + fBTE(0), + fLoadingStatus(), + fNPrimaries(0), + fPrimaries(0), + fESDFile(0), + fESDFileName(), + fESD(0), + fESDTree(0), + fRawDigits(kFALSE), + fcdb(0) +{ + // ctor: this is a singleton, the ctor should never be called but cint needs it as public + Fatal("ctor", "AliPHOSGetter is a singleton default ctor not callable") ; +} + + //____________________________________________________________________________ -AliPHOSGetter::AliPHOSGetter(const char* headerFile, const char* version, Option_t * openingOption) +AliPHOSGetter::AliPHOSGetter(const char* headerFile, const char* version, Option_t * openingOption) : + fBTE(0), + fLoadingStatus(), + fNPrimaries(0), + fPrimaries(0), + fESDFile(0), + fESDFileName(), + fESD(0), + fESDTree(0), + fRawDigits(kFALSE), + fcdb(0) { // ctor only called by Instance() @@ -117,6 +146,40 @@ AliPHOSGetter::AliPHOSGetter(const char* headerFile, const char* version, Option } +AliPHOSGetter::AliPHOSGetter(const AliPHOSGetter & obj) : + TObject(obj), + fBTE(0), + fLoadingStatus(), + fNPrimaries(0), + fPrimaries(0), + fESDFile(0), + fESDFileName(), + fESD(0), + fESDTree(0), + fRawDigits(kFALSE), + fcdb(0) +{ + // cpy ctor requested by Coding Convention + Fatal("cpy ctor", "not implemented") ; +} + +//____________________________________________________________________________ +AliPHOSGetter::AliPHOSGetter(Int_t /*i*/) : + fBTE(0), + fLoadingStatus(), + fNPrimaries(0), + fPrimaries(0), + fESDFile(0), + fESDFileName(), + fESD(0), + fESDTree(0), + fRawDigits(kFALSE), + fcdb(0) +{ + // special constructor for onflight +} + + //____________________________________________________________________________ AliPHOSGetter::~AliPHOSGetter() { @@ -341,13 +404,9 @@ void AliPHOSGetter::Event(AliRawReader *rawReader, const char* opt, Bool_t isOld // Reads the raw event from rawReader // isOldRCUFormat defines whenever to assume // the old RCU format or not - - AliRunLoader * rl = AliRunLoader::GetRunLoader(PhosLoader()->GetTitle()); if( strstr(opt,"W") ){ - rawReader->NextEvent(); - Int_t iEvent = rl->GetEventNumber(); - rl->GetEvent(iEvent); + rawReader->NextEvent(); ReadRaw(rawReader,isOldRCUFormat) ; } @@ -407,7 +466,7 @@ AliPHOSGetter * AliPHOSGetter::Instance(const char* alirunFileName, const char* } } else { - AliRunLoader * rl = AliRunLoader::GetRunLoader(fgPhosLoader->GetTitle()) ; + rl = AliRunLoader::GetRunLoader(fgPhosLoader->GetTitle()) ; if ( strstr(version, AliConfig::GetDefaultEventFolderName()) ) // false in case of merging delete rl ; fgObjGetter = new AliPHOSGetter(alirunFileName, version, openingOption) ; @@ -493,6 +552,13 @@ AliPHOSGeometry * AliPHOSGetter::PHOSGeometry() const AliPHOSGeometry * rv = 0 ; if (PHOS() ) rv = PHOS()->GetGeometry() ; + else { + rv = AliPHOSGeometry::GetInstance(); + if (!rv) { + AliError("Could not find PHOS geometry! Loading the default one !"); + rv = AliPHOSGeometry::GetInstance("IHEP",""); + } + } return rv ; } @@ -574,12 +640,15 @@ void AliPHOSGetter::FitRaw(Bool_t lowGainFlag, TGraph * gLowGain, TGraph * gHigh time = 0. ; energy = 0. ; + // Create a shaper pulse object which contains all the shaper parameters + AliPHOSPulseGenerator pulse; + if (lowGainFlag) { timezero1 = timezero2 = signalmax = timemax = 0. ; - signalF->FixParameter(0, PHOS()->GetRawFormatLowCharge()) ; - signalF->FixParameter(1, PHOS()->GetRawFormatLowGain()) ; + signalF->FixParameter(0, pulse.GetRawFormatLowCharge()) ; + signalF->FixParameter(1, pulse.GetRawFormatLowGain()) ; Int_t index ; - for (index = 0; index < PHOS()->GetRawFormatTimeBins(); index++) { + for (index = 0; index < pulse.GetRawFormatTimeBins(); index++) { gLowGain->GetPoint(index, time, signal) ; if (signal > kNoiseThreshold && timezero1 == 0.) timezero1 = time ; @@ -590,21 +659,22 @@ void AliPHOSGetter::FitRaw(Bool_t lowGainFlag, TGraph * gLowGain, TGraph * gHigh timemax = time ; } } - signalmax /= PHOS()->RawResponseFunctionMax(PHOS()->GetRawFormatLowCharge(), - PHOS()->GetRawFormatLowGain()) ; - if ( timezero1 + PHOS()->GetRawFormatTimePeak() < PHOS()->GetRawFormatTimeMax() * 0.4 ) { // else its noise + signalmax /= + pulse.RawResponseFunctionMax(pulse.GetRawFormatLowCharge(), + pulse.GetRawFormatLowGain()) ; + if ( timezero1 + pulse.GetRawFormatTimePeak() < pulse.GetRawFormatTimeMax() * 0.4 ) { // else its noise signalF->SetParameter(2, signalmax) ; signalF->SetParameter(3, timezero1) ; gLowGain->Fit(signalF, "QRO", "", 0., timezero2); //, "QRON") ; energy = signalF->GetParameter(2) ; - time = signalF->GetMaximumX() - PHOS()->GetRawFormatTimePeak() - PHOS()->GetRawFormatTimeTrigger() ; + time = signalF->GetMaximumX() - pulse.GetRawFormatTimePeak() - pulse.GetRawFormatTimeTrigger() ; } } else { timezero1 = timezero2 = signalmax = timemax = 0. ; - signalF->FixParameter(0, PHOS()->GetRawFormatHighCharge()) ; - signalF->FixParameter(1, PHOS()->GetRawFormatHighGain()) ; + signalF->FixParameter(0, pulse.GetRawFormatHighCharge()) ; + signalF->FixParameter(1, pulse.GetRawFormatHighGain()) ; Int_t index ; - for (index = 0; index < PHOS()->GetRawFormatTimeBins(); index++) { + for (index = 0; index < pulse.GetRawFormatTimeBins(); index++) { gHighGain->GetPoint(index, time, signal) ; if (signal > kNoiseThreshold && timezero1 == 0.) timezero1 = time ; @@ -615,14 +685,14 @@ void AliPHOSGetter::FitRaw(Bool_t lowGainFlag, TGraph * gLowGain, TGraph * gHigh timemax = time ; } } - signalmax /= PHOS()->RawResponseFunctionMax(PHOS()->GetRawFormatHighCharge(), - PHOS()->GetRawFormatHighGain()) ;; - if ( timezero1 + PHOS()->GetRawFormatTimePeak() < PHOS()->GetRawFormatTimeMax() * 0.4 ) { // else its noise + signalmax /= pulse.RawResponseFunctionMax(pulse.GetRawFormatHighCharge(), + pulse.GetRawFormatHighGain()) ;; + if ( timezero1 + pulse.GetRawFormatTimePeak() < pulse.GetRawFormatTimeMax() * 0.4 ) { // else its noise signalF->SetParameter(2, signalmax) ; signalF->SetParameter(3, timezero1) ; gHighGain->Fit(signalF, "QRO", "", 0., timezero2) ; energy = signalF->GetParameter(2) ; - time = signalF->GetMaximumX() - PHOS()->GetRawFormatTimePeak() - PHOS()->GetRawFormatTimeTrigger() ; + time = signalF->GetMaximumX() - pulse.GetRawFormatTimePeak() - pulse.GetRawFormatTimeTrigger() ; } } if (time == 0) energy = 0 ; @@ -665,87 +735,42 @@ Int_t AliPHOSGetter::ReadRaw(AliRawReader *rawReader,Bool_t isOldRCUFormat) // reads the raw format data, converts it into digits format and store digits in Digits() // container. // isOldRCUFormat = kTRUE in case of the old RCU - // format used in the raw data readout - - AliPHOSRawStream in(rawReader); - in.SetOldRCUFormat(isOldRCUFormat); + // format used in the raw data readout. + // Reimplemented by Boris Polichtchouk (Jul 2006) + // to make it working with the Jul-Aug 2006 beam test data. - Bool_t first = kTRUE ; - - TF1 * signalF = new TF1("signal", AliPHOS::RawResponseFunction, 0, PHOS()->GetRawFormatTimeMax(), 4); - signalF->SetParNames("Charge", "Gain", "Amplitude", "TimeZero") ; + //Create raw decoder. - Int_t relId[4], id =0; - Bool_t lowGainFlag = kFALSE ; + AliPHOSRawDecoder dc(rawReader); + dc.SetOldRCUFormat(isOldRCUFormat); + dc.SubtractPedestals(kTRUE); TClonesArray * digits = Digits() ; - digits->Clear() ; - Int_t idigit = 0 ; - Int_t amp = 0 ; - Double_t energy = 0. ; - Double_t time = 0. ; - - TGraph * gLowGain = new TGraph(PHOS()->GetRawFormatTimeBins()) ; - TGraph * gHighGain= new TGraph(PHOS()->GetRawFormatTimeBins()) ; - gLowGain ->SetTitle("Low gain channel"); - gHighGain->SetTitle("High gain channel"); - - while ( in.Next() ) { // PHOS entries loop - if ( (in.IsNewRow() || in.IsNewColumn() || in.IsNewModule()) ) { - if (!first) { - FitRaw(lowGainFlag, gLowGain, gHighGain, signalF, energy, time) ; - amp = (Int_t)energy; - if (energy > 0) { - new((*digits)[idigit]) AliPHOSDigit( -1, id, (Float_t)energy, time) ; - idigit++ ; - } - Int_t index ; - for (index = 0; index < PHOS()->GetRawFormatTimeBins(); index++) { - gLowGain ->SetPoint(index, - index * PHOS()->GetRawFormatTimeMax() / - PHOS()->GetRawFormatTimeBins(), 0) ; - gHighGain->SetPoint(index, - index * PHOS()->GetRawFormatTimeMax() / - PHOS()->GetRawFormatTimeBins(), 0) ; - } - } - first = kFALSE ; - relId[0] = in.GetModule() ; - if ( relId[0] >= PHOS()->GetRawFormatLowGainOffset() ) { - relId[0] -= PHOS()->GetRawFormatLowGainOffset() ; - lowGainFlag = kTRUE ; - } else - lowGainFlag = kFALSE ; - relId[1] = 0 ; - relId[2] = in.GetRow() ; - relId[3] = in.GetColumn() ; - PHOSGeometry()->RelToAbsNumbering(relId, id) ; + AliPHOSRawDigiProducer pr; + pr.MakeDigits(digits,&dc); + + //!!!!for debug!!! + Int_t modMax=-111; + Int_t colMax=-111; + Int_t rowMax=-111; + Float_t eMax=-333; + //!!!for debug!!! + + Int_t relId[4]; + for(Int_t iDigit=0; iDigitGetEntries(); iDigit++) { + AliPHOSDigit* digit = (AliPHOSDigit*)digits->At(iDigit); + if(digit->GetEnergy()>eMax) { + PHOSGeometry()->AbsToRelNumbering(digit->GetId(),relId); + eMax=digit->GetEnergy(); + modMax=relId[0]; + rowMax=relId[2]; + colMax=relId[3]; } - if (lowGainFlag) - gLowGain->SetPoint(in.GetTime(), - in.GetTime()* PHOS()->GetRawFormatTimeMax() / - PHOS()->GetRawFormatTimeBins(), - in.GetSignal()) ; - else - gHighGain->SetPoint(in.GetTime(), - in.GetTime() * PHOS()->GetRawFormatTimeMax() / - PHOS()->GetRawFormatTimeBins(), - in.GetSignal() ) ; - - } // PHOS entries loop - - FitRaw(lowGainFlag, gLowGain, gHighGain, signalF, energy, time) ; - amp = (Int_t)energy; - if (energy > 0 ) { - new((*digits)[idigit]) AliPHOSDigit( -1, id, (Float_t)energy, time) ; - idigit++ ; } - digits->Sort() ; - delete signalF ; - delete gLowGain; - delete gHighGain ; - + AliDebug(1,Form("Digit with max. energy: modMax %d colMax %d rowMax %d eMax %f\n\n", + modMax,colMax,rowMax,eMax)); + return digits->GetEntriesFast() ; }