X-Git-Url: http://git.uio.no/git/?p=u%2Fmrichter%2FAliRoot.git;a=blobdiff_plain;f=EMCAL%2FAliEMCALCalibHistoProducer.cxx;h=58c02b5fadf304010f6b70d9f916732e98d6a8ee;hp=cb14edda6a36f96ec6ce7a68be32675e332190e5;hb=cd6a8858e8c77f3c92327a0cb9bb9b8089313c0f;hpb=9a090ccd393c8347c8512e632ce54eeceed8ac1f diff --git a/EMCAL/AliEMCALCalibHistoProducer.cxx b/EMCAL/AliEMCALCalibHistoProducer.cxx index cb14edda6a3..58c02b5fadf 100644 --- a/EMCAL/AliEMCALCalibHistoProducer.cxx +++ b/EMCAL/AliEMCALCalibHistoProducer.cxx @@ -40,7 +40,7 @@ #include "AliLog.h" #include "AliRawReader.h" -#include "AliCaloRawStream.h" +#include "AliCaloRawStreamV3.h" #include "AliEMCALCalibHistoProducer.h" ClassImp(AliEMCALCalibHistoProducer) @@ -147,14 +147,15 @@ void AliEMCALCalibHistoProducer::Init() // Checks existence of histograms which might have been left // from the previous runs to continue their filling fHistoFile = new TFile(fHistoFileName,"update"); - char hname[128]; + const Int_t buffersize = 128; + char hname[buffersize]; Int_t nRow = fNCellsPhi ; for(Int_t supermodule=0; supermoduleGet(hname); if(prof) fAmpProf[supermodule]=prof; @@ -163,10 +164,10 @@ void AliEMCALCalibHistoProducer::Init() if(supermodule > 10) nRow = fNCellsPhiHalfSM ; //Supermodules 11 and 12 are half supermodules for(Int_t column=0; columnGet(hname); - if(hist) - fAmpHisto[supermodule][column][row]=hist; + snprintf(hname,buffersize,"mod%dcol%drow%d",supermodule,column,row); + TH1F* hist = (TH1F*)fHistoFile->Get(hname); + if(hist) + fAmpHisto[supermodule][column][row]=hist; } } } @@ -183,55 +184,65 @@ void AliEMCALCalibHistoProducer::Run() // TH1F* gHighGain = 0; // TH1F* gLowGain = 0; - Int_t iBin = 0; + const Int_t buffersize=128; + char hname[buffersize]; Int_t iEvent = 0; Int_t runNum = 0; Int_t nProfFreq = 1000; //Number of events with which a bin of the TProfile if filled Int_t nEvtBins = 1000; //Total number of the profile survey bins. - AliCaloRawStream in(fRawReader,"EMCAL"); + AliCaloRawStreamV3 in(fRawReader,"EMCAL"); // Read raw data event by event while (fRawReader->NextEvent()) { runNum = fRawReader->GetRunNumber(); - Float_t energy = 0; - while ( in.Next() ) { - if(fSMInstalled[in.GetModule()]==kFALSE) continue; - - if (in.GetSignal() > energy) { - energy = (Double_t) in.GetSignal(); - } + while (in.NextDDL()) { + while (in.NextChannel()) { - iBin++; + if(fSMInstalled[in.GetModule()]==kFALSE) continue; - if(iBin==in.GetTimeLength()) { - iBin=0; - + // loop over samples + int nsamples = 0; + Int_t maxSample = 0; + while (in.NextBunch()) { + const UShort_t *sig = in.GetSignals(); + nsamples += in.GetBunchLength(); + for (Int_t i = 0; i < in.GetBunchLength(); i++) { + if (sig[i] > maxSample) maxSample = sig[i]; + } + } // bunches + + if (nsamples > 0) { // this check is needed for when we have zero-supp. on, but not sparse readout + + // indices Int_t mod = in.GetModule(); Int_t col = in.GetColumn(); Int_t row = in.GetRow(); Int_t evtbin = iEvent/nProfFreq; - char hname[128]; - + Bool_t HighGainFlag = in.IsHighGain(); + //Check if histogram/profile already exist, if not create it. if(!fAmpHisto[mod][col][row]) { - sprintf(hname,"mod%dcol%drow%d",mod,col,row); + snprintf(hname,buffersize,"mod%dcol%drow%d",mod,col,row); fAmpHisto[mod][col][row] = new TH1F(hname,hname,1024,-0.5,1023.); } if(!fAmpProf[mod]) { - sprintf(hname,"mod%d",mod); + snprintf(hname,buffersize,"mod%d",mod); fAmpProf[mod] = new TProfile(hname,hname,nEvtBins,0.,nEvtBins); } + //Fill histogram/profile - Bool_t lowGainFlag = in.IsLowGain(); - if(!lowGainFlag) { - fAmpHisto[mod][col][row]->Fill(energy); - fAmpProf[mod]->Fill(evtbin, energy); + if(HighGainFlag) { + fAmpHisto[mod][col][row]->Fill(maxSample); + fAmpProf[mod]->Fill(evtbin, maxSample); } - } - } + + } // nsamples>0 check, some data found for this channel; not only trailer/header + + } // channels + } // DDL's // update histograms in local file every 100th event if(iEvent%fUpdatingRate == 0) {