Int_t isocount; //number of neighbours with 0 signal
Float_t d1[kDet][kMaxSMN][kMaxRow][kMaxCol];
- Bool_t streamout = kFALSE;
for(Int_t idet = 0; idet < kDet; idet++)
{
AliPMDRawStream rawStream(rawReader);
- for (Int_t iddl = 0; iddl < kDDL; iddl++)
- {
- rawReader->Select("PMD", iddl, iddl);
- streamout = rawStream.DdlData(iddl,&pmdddlcont);
-
+ Int_t iddl;
+
+ Int_t numberofDDLs = 0;
+
+ while ((iddl = rawStream.DdlData(&pmdddlcont)) >=0) {
+ numberofDDLs++;
+
Int_t ientries = pmdddlcont.GetEntries();
for (Int_t ient = 0; ient < ientries; ient++)
{
}
}
- return streamout;
+
+ if (numberofDDLs < kDDL)
+ return kFALSE;
+ return kTRUE;
+
}
// ------------------------------------------------------------------------ //
void AliPMDCalibGain::Analyse(TTree *gaintree)
#include "AliRawReader.h"
#include "AliPMDRawStream.h"
#include "AliPMDddldata.h"
-
+#include "AliBitPacking.h"
//header file
#include "AliPMDCalibPedestal.h"
fPedVal[i][j][k][l] = 0.;
fPedValSq[i][j][k][l] = 0.;
fPedCount[i][j][k][l] = 0.;
+ fPedChain[i][j][k][l] = 0;
}
}
}
fPedVal[i][j][k][l] = ped.fPedVal[i][j][k][l];
fPedValSq[i][j][k][l] = ped.fPedValSq[i][j][k][l];
fPedCount[i][j][k][l] = ped.fPedCount[i][j][k][l];
+ fPedChain[i][j][k][l] = ped.fPedChain[i][j][k][l];
}
}
}
const Int_t kDDL = AliDAQ::NumberOfDdls("PMD");
+ UInt_t busmcmch;
+ UInt_t pbus, mcm, chno;
+
AliPMDRawStream rawStream(rawReader);
TObjArray pmdddlcont;
- Bool_t streamout = kTRUE;
+ Int_t iddl = -1;
+ Int_t numberofDDLs = 0;
- for (Int_t iddl = 0; iddl < kDDL; iddl++)
- {
- rawReader->Select("PMD", iddl, iddl);
- //cout << reader.GetDataSize() << endl;
- streamout = rawStream.DdlData(iddl, &pmdddlcont);
- Int_t ientries = pmdddlcont.GetEntries();
- for (Int_t ient = 0; ient < ientries; ient++)
+ while ((iddl = rawStream.DdlData(&pmdddlcont)) >=0) {
+ numberofDDLs++;
+ Int_t ientries = pmdddlcont.GetEntries();
+ //printf("iddl = %d ientries = %d\n",iddl, ientries);
+ for (Int_t ient = 0; ient < ientries; ient++)
{
AliPMDddldata *pmdddl = (AliPMDddldata*)pmdddlcont.UncheckedAt(ient);
Int_t det = pmdddl->GetDetector();
Int_t smn = pmdddl->GetSMN();
- //Int_t mcm = pmdddl->GetMCM();
- //Int_t chno = pmdddl->GetChannel();
Int_t row = pmdddl->GetRow();
Int_t col = pmdddl->GetColumn();
Float_t sig = (Float_t) pmdddl->GetSignal();
+ pbus = (UInt_t) pmdddl->GetPatchBusId();
+ mcm = (UInt_t) pmdddl->GetMCM();
+ chno = (UInt_t) pmdddl->GetChannel();
+
+ busmcmch = 0;
+ AliBitPacking::PackWord(chno,busmcmch,0,7);
+ AliBitPacking::PackWord(mcm,busmcmch,8,15);
+ AliBitPacking::PackWord(pbus,busmcmch,16,23);
+
+
+ if (fPedChain[det][smn][row][col] == 0)
+ fPedChain[det][smn][row][col] = busmcmch;
+
fPedVal[det][smn][row][col] += sig;
fPedValSq[det][smn][row][col] += sig*sig;
fPedCount[det][smn][row][col]++;
}
pmdddlcont.Clear();
}
- return streamout;
+ if (numberofDDLs < kDDL)
+ return kFALSE;
+ return kTRUE;
}
//_____________________________________________________________________
//
// Calculate pedestal Mean and RMS
//
+
+ FILE *fpw0 = fopen("pedestal2304.ped","w");
+ FILE *fpw1 = fopen("pedestal2305.ped","w");
+ FILE *fpw2 = fopen("pedestal2306.ped","w");
+ FILE *fpw3 = fopen("pedestal2307.ped","w");
+ FILE *fpw4 = fopen("pedestal2308.ped","w");
+ FILE *fpw5 = fopen("pedestal2309.ped","w");
+
+ UInt_t busmcmch;
+ UInt_t pbus, mcm, chno;
+ Int_t ddlno;
Int_t det, sm, row, col;
Float_t mean, rms;
Float_t meansq, diff;
+
pedtree->Branch("det",&det,"det/I");
pedtree->Branch("sm",&sm,"sm/I");
pedtree->Branch("row",&row,"row/I");
{
for (int ism = 0; ism < kMaxSMN; ism++)
{
+ ConvertDDL(idet,ism,ddlno);
for (int irow = 0; irow < kMaxRow; irow++)
{
for (int icol = 0; icol < kMaxCol; icol++)
sm = ism;
row = irow;
col = icol;
+ mean = 0.;
+ rms = 0.;
+
if (fPedCount[idet][ism][irow][icol] > 0)
{
- mean = fPedVal[idet][ism][irow][icol]/fPedCount[idet][ism][irow][icol];
+ mean = fPedVal[idet][ism][irow][icol]/fPedCount[idet][ism][irow][icol];
- meansq = fPedValSq[idet][ism][irow][icol]/fPedCount[idet][ism][irow][icol];
+ meansq = fPedValSq[idet][ism][irow][icol]/fPedCount[idet][ism][irow][icol];
diff = meansq - mean*mean;
if (diff > 0.)
{
rms = 0.;
}
- }
+ pedtree->Fill();
+
+ busmcmch = fPedChain[idet][ism][irow][icol];
- pedtree->Fill();
+ chno = busmcmch & 0x00FF;
+ mcm = (busmcmch >> 8) & 0x00FF;
+ pbus = (busmcmch >> 16) & 0x00FF;
+
+ if (ddlno == 0)
+ {
+ fprintf(fpw0,"%d %d %d %f %f\n",
+ pbus, mcm, chno, mean, rms);
+ }
+ else if (ddlno == 1)
+ {
+ fprintf(fpw1,"%d %d %d %f %f\n",
+ pbus, mcm, chno, mean, rms);
+ }
+ else if (ddlno == 2)
+ {
+ fprintf(fpw2,"%d %d %d %f %f\n",
+ pbus, mcm, chno, mean, rms);
+ }
+ else if (ddlno == 3)
+ {
+ fprintf(fpw3,"%d %d %d %f %f\n",
+ pbus, mcm, chno, mean, rms);
+ }
+ else if (ddlno == 4)
+ {
+ fprintf(fpw4,"%d %d %d %f %f\n",
+ pbus, mcm, chno, mean, rms);
+ }
+ else if (ddlno == 5)
+ {
+ fprintf(fpw5,"%d %d %d %f %f\n",
+ pbus, mcm, chno, mean, rms);
+ }
+
+ }
+
}
}
}
}
+
+ fclose(fpw0);
+ fclose(fpw1);
+ fclose(fpw2);
+ fclose(fpw3);
+ fclose(fpw4);
+ fclose(fpw5);
}
-//_____________________________________________________________________
+
+
+// -------------------------------------------------------------------
+
+void AliPMDCalibPedestal::ConvertDDL(Int_t det, Int_t smn, Int_t &ddlno)
+{
+// Given the plane number and serial module number, ddlno is calculated
+
+ if (det == 0)
+ {
+ if (smn <= 5)
+ {
+ ddlno = 0;
+ }
+ else if (smn > 5 && smn <= 11)
+ {
+ ddlno = 1;
+ }
+ else if (smn > 11 && smn <= 17)
+ {
+ ddlno = 2;
+ }
+ else if (smn > 17 && smn <= 23)
+ {
+ ddlno = 3;
+ }
+ }
+ else if (det == 1)
+ {
+ if (smn <= 5 || (smn >= 18 && smn <=23))
+ {
+ ddlno = 4;
+ }
+ else if (smn >= 6 && smn <= 17)
+ {
+ ddlno = 5;
+ }
+ }
+
+}
+
Bool_t ProcessEvent(AliRawReader *rawReader);
void Analyse(TTree *pedtree);
+ void ConvertDDL(Int_t det, Int_t smn, Int_t &ddlno);
private:
Float_t fPedVal[kDet][kMaxSMN][kMaxRow][kMaxCol];
Float_t fPedValSq[kDet][kMaxSMN][kMaxRow][kMaxCol];
Float_t fPedCount[kDet][kMaxSMN][kMaxRow][kMaxCol];
+ UInt_t fPedChain[kDet][kMaxSMN][kMaxRow][kMaxCol];
- ClassDef(AliPMDCalibPedestal,3)
+ ClassDef(AliPMDCalibPedestal,4)
};
AliPMDCalibrator::~AliPMDCalibrator()
{
// destructor
- if(fHdetIso) delete fHdetIso ;
+ if(fHdetIso) delete fHdetIso ;
if(fHsmIso) delete fHsmIso ;
if(fHadcIso) delete fHadcIso ;
delete fCalibGain;
// Calculates the ADC of isolated cell
TObjArray pmdddlcont;
- const Int_t kDDL = AliDAQ::NumberOfDdls("PMD");
+
const Int_t kCellNeighbour = 6;
Int_t neibx[6] = {1,0,-1,-1,0,1};
while(reader.NextEvent())
{
// New PMD Reader is plugged in
- for (Int_t iddl = 0; iddl < kDDL; iddl++)
- {
- reader.Select("PMD", iddl, iddl);
- stream.DdlData(iddl,&pmdddlcont);
+ Int_t iddl = -1;
+ while ((iddl = stream.DdlData(&pmdddlcont)) >=0) {
+
+ //reader.Select("PMD", iddl, iddl);
+ //stream.DdlData(iddl,&pmdddlcont);
Int_t ientries = pmdddlcont.GetEntries();
for (Int_t ient = 0; ient < ientries; ient++)
{
// Destructor
if (fDigits)
{
- fDigits->Delete();
- delete fDigits;
- fDigits=0;
+ /*
+ fDigits->Delete();
+ delete fDigits;
+ fDigits=0;
+ */
+ fDigits->Clear();
}
if (fRecpoints)
{
- fRecpoints->Delete();
- delete fRecpoints;
- fRecpoints=0;
+ fRecpoints->Clear();
+ /*
+ fRecpoints->Delete();
+ delete fRecpoints;
+ fRecpoints=0;
+ */
}
if (fRechits)
{
- fRechits->Delete();
- delete fRechits;
- fRechits=0;
+ fRechits->Clear();
+ /*
+ fRechits->Delete();
+ delete fRechits;
+ fRechits=0;
+ */
}
}
// ------------------------------------------------------------------------- //
TBranch * branch2 = clustersTree->Branch("PMDRechit", &fRechits, bufsize);
- const Int_t kDDL = AliDAQ::NumberOfDdls("PMD");
const Int_t kRow = 48;
const Int_t kCol = 96;
Int_t idet = 0;
Int_t iSMN = 0;
+ Int_t indexDDL = -1;
+ AliPMDRawStream pmdinput(rawReader);
- for (Int_t indexDDL = 0; indexDDL < kDDL; indexDDL++)
- {
+ while ((indexDDL = pmdinput.DdlData(&pmdddlcont)) >=0)
+ {
if (indexDDL < 4)
{
iSMN = 6;
}
}
ResetCellADC();
- rawReader->Reset();
- AliPMDRawStream pmdinput(rawReader);
-
- rawReader->Select("PMD", indexDDL, indexDDL);
-
- pmdinput.DdlData(indexDDL,&pmdddlcont);
Int_t indexsmn = 0;
Int_t ientries = pmdddlcont.GetEntries();
}
for (Int_t i=0; i<iSMN; i++) delete [] precpvADC[i];
delete precpvADC;
+
} // DDL Loop
ResetCellADC();
TBranch *branch1 = fTreeR->Branch("PMDRecpoint", &fRecpoints, bufsize);
TBranch *branch2 = fTreeR->Branch("PMDRechit", &fRechits, bufsize);
- const Int_t kDDL = AliDAQ::NumberOfDdls("PMD");
const Int_t kRow = 48;
const Int_t kCol = 96;
Int_t idet = 0;
Int_t iSMN = 0;
-
- for (Int_t indexDDL = 0; indexDDL < kDDL; indexDDL++)
- {
+
+ AliPMDRawStream pmdinput(rawReader);
+ Int_t indexDDL = -1;
+
+ while ((indexDDL = pmdinput.DdlData(&pmdddlcont)) >=0) {
+
if (indexDDL < 4)
{
iSMN = 6;
}
}
ResetCellADC();
- rawReader->Reset();
- rawReader->Select("PMD", indexDDL, indexDDL);
- AliPMDRawStream pmdinput(rawReader);
- pmdinput.DdlData(indexDDL,&pmdddlcont);
Int_t indexsmn = 0;
Int_t ientries = pmdddlcont.GetEntries();
Int_t dspBlockARDL = 0;
Int_t dspBlockBRDL = 0;
+ Int_t remainder = 0;
+
for (Int_t i = 0; i < 5; i++)
{
if (dsp[ieven] > 0)
{
dspBlockARDL += dsp[ieven];
- Int_t remainder = dsp[ieven]%2;
+ remainder = dsp[ieven]%2;
if (remainder == 1)
{
dspBlockARDL++;
if (dsp[iodd] > 0)
{
dspBlockBRDL += dsp[iodd];
- Int_t remainder = dsp[ieven]%2;
+ remainder = dsp[iodd]%2;
if (remainder == 1)
{
- dspBlockARDL++;
+ dspBlockBRDL++;
}
}
}
-
+
// Start writing the DDL file
AliPMDBlockHeader blHeader;
UInt_t dspHeaderWord[10];
UInt_t patchBusHeaderWord[4];
Int_t iskip[5];
+ UInt_t ddlEndWord[2] = {0xDEADFACE, 0xDEADFACE};
+
+ Int_t bknJunk = 0;
for (Int_t iblock = 0; iblock < 2; iblock++)
{
dspHeaderWord[i] = 0;
}
- Int_t remainder = dspRDL%2;
+ remainder = dspRDL%2;
if (remainder == 1) dspRDL++;
dspHeaderWord[1] = dspRDL + kdspHLen;
dspHeaderWord[2] = dspRDL;
dspHeaderWord[3] = dspno;
if (remainder == 1) dspHeaderWord[8] = 1; // setting the padding word
+
+
outfile->WriteBuffer((char*)dspHeaderWord,kdspHLen*sizeof(UInt_t));
for (Int_t ibus = 0; ibus < 5; ibus++)
{
// Patch Bus Header
- // BKN - just added 1
+
Int_t busno = iskip[idsp] + ibus + 1;
Int_t patchbusRDL = contentsBus[busno];
outfile->WriteBuffer((char*)patchBusHeaderWord,4*sizeof(UInt_t));
+ bknJunk += patchbusRDL;
for (Int_t iword = 0; iword < patchbusRDL; iword++)
{
}
}
+ // Write two extra word at the end of each DDL file
+ outfile->WriteBuffer((char*)ddlEndWord,2*sizeof(UInt_t));
+
// Write real data header
// take the pointer to the beginning of the data header
// write the total number of words per ddl and bring the
{
TObjArray pmdddlcont;
+ TH2F *h2 = new TH2F("h2"," ",100,-100.,100.,100,-100.,100.);
+ Float_t xx, yy;
+ Int_t xpad, ypad;
+
+ AliPMDUtility cc;
+
for(Int_t ievt = 0; ievt < iEvent; ievt++)
{
AliRawReaderFile reader(ievt);
AliPMDRawStream stream(&reader);
- Int_t indexDDL = 0;
- for (Int_t iddl = 0; iddl < 6; iddl++)
+ Int_t iddl = -1;
+ while ((iddl = stream.DdlData(&pmdddlcont)) >=0)
{
-
- reader.Select("PMD", iddl, iddl);
- //cout << reader.GetDataSize() << endl;
- stream.DdlData(indexDDL,&pmdddlcont);
+ //cout << " inside the macro DDLNO = " << iddl << endl;
Int_t ientries = pmdddlcont.GetEntries();
for (Int_t ient = 0; ient < ientries; ient++)
{
Int_t row = pmdddl->GetRow();
Int_t col = pmdddl->GetColumn();
Int_t sig = pmdddl->GetSignal();
- cout<<sig<<endl;
-
+ //cout<<sig<<endl;
+ if(smn <12)
+ {
+ xpad = col;
+ ypad = row;
+ }
+ else if(smn >=12 && smn < 24)
+ {
+ xpad = row;
+ ypad = col;
+ }
+
+ if (det == 1)
+ {
+ // Draw only for PRE plane
+ cc.RectGeomCellPos(smn,xpad,ypad,xx,yy);
+
+ h2->Fill(xx,yy);
+ }
+
+
+
}
pmdddlcont.Clear();
}
}
-}
\ No newline at end of file
+
+ h2->Draw();
+}
//_____________________________________________________________________________
AliPMDRawStream::AliPMDRawStream(AliRawReader* rawReader) :
- fRawReader(rawReader)
+ fRawReader(rawReader),
+ fData(NULL),
+ fPosition(-1)
{
// create an object to read PMD raw digits
+ fRawReader->Reset();
fRawReader->Select("PMD");
}
//_____________________________________________________________________________
AliPMDRawStream::AliPMDRawStream(const AliPMDRawStream& stream) :
TObject(stream),
- fRawReader(NULL)
+ fRawReader(NULL),
+ fData(NULL),
+ fPosition(-1)
{
// copy constructor
//_____________________________________________________________________________
-Bool_t AliPMDRawStream::DdlData(Int_t indexDDL, TObjArray *pmdddlcont)
+Int_t AliPMDRawStream::DdlData(TObjArray *pmdddlcont)
{
// read the next raw digit
// returns kFALSE if there is no digit left
+
+
+ Int_t iddl = -1;
AliPMDddldata *pmdddldata;
- if (!fRawReader->ReadHeader()) return kFALSE;
- Int_t iddl = fRawReader->GetDDLID();
+ if (!fRawReader->ReadHeader()) return iddl;
+
+ iddl = fRawReader->GetDDLID();
Int_t dataSize = fRawReader->GetDataSize();
Int_t totaldataword = dataSize/4;
- if (dataSize <= 0) return kFALSE;
- if (indexDDL != iddl)
- {
- AliWarning("Mismatch in the DDL index");
- fRawReader->AddFatalErrorLog(kDDLIndexMismatch);
- return kFALSE;
- }
+ if (dataSize <= 0) return -1;
- UInt_t *buffer;
- buffer = new UInt_t[totaldataword];
UInt_t data;
- for (Int_t i = 0; i < totaldataword; i++)
- {
- fRawReader->ReadNextInt(data);
- buffer[i] = data;
- }
+
+ fRawReader->ReadNextData(fData);
+
+ fPosition = 0;
// --- Open the mapping file
ifstream infile;
infile.open(fileName.Data(), ios::in); // ascii file
+
if(!infile) {
AliError(Form("Could not read the mapping file for DDL No = %d",iddl));
fRawReader->AddFatalErrorLog(kNoMappingFile,Form("ddl=%d",iddl));
Int_t dspHeaderWord[10];
Int_t pbusHeaderWord[4];
- Int_t ilowLimit = 0;
- Int_t iuppLimit = 0;
- Int_t blRawDataLength = 0;
- Int_t iwordcount = 0;
-
+ Int_t ilowLimit = 0;
+ Int_t iuppLimit = 0;
+ Int_t blRawDataLength = 0;
+ Int_t dspRawDataLength = 0;
+ Int_t iwordddl = 2;
for (Int_t iblock = 0; iblock < 2; iblock++)
{
for (Int_t i = ilowLimit; i < iuppLimit; i++)
{
- blHeaderWord[i-ilowLimit] = (Int_t) buffer[i];
+ iwordddl++;
+
+ blHeaderWord[i-ilowLimit] = (Int_t) GetNextWord();
}
blockHeader.SetHeader(blHeaderWord);
-
blRawDataLength = blockHeader.GetRawDataLength();
+ if (iwordddl == totaldataword) continue;
+
+ Int_t iwordblk = 0;
+
for (Int_t idsp = 0; idsp < 5; idsp++)
{
+
+
ilowLimit = iuppLimit;
iuppLimit = ilowLimit + kdspHLen;
for (Int_t i = ilowLimit; i < iuppLimit; i++)
{
- iwordcount++;
- dspHeaderWord[i-ilowLimit] = (Int_t) buffer[i];
+ iwordddl++;
+ iwordblk++;
+ dspHeaderWord[i-ilowLimit] = (Int_t) GetNextWord();
}
dspHeader.SetHeader(dspHeaderWord);
+ dspRawDataLength = dspHeader.GetRawDataLength();
+
+ if (iwordddl == totaldataword) continue;
+
+ Int_t iworddsp = 0;
for (ibus = 0; ibus < 5; ibus++)
{
for (Int_t i = ilowLimit; i < iuppLimit; i++)
{
- iwordcount++;
- pbusHeaderWord[i-ilowLimit] = (Int_t) buffer[i];
+ iwordddl++;
+ iwordblk++;
+ iworddsp++;
+ pbusHeaderWord[i-ilowLimit] = (Int_t) GetNextWord();
}
+
pbusHeader.SetHeader(pbusHeaderWord);
Int_t rawdatalength = pbusHeader.GetRawDataLength();
Int_t pbusid = pbusHeader.GetPatchBusId();
Int_t imodule = moduleNo[pbusid];
+ if (iwordddl == totaldataword) continue;
for (Int_t iword = ilowLimit; iword < iuppLimit; iword++)
{
- iwordcount++;
- data = buffer[iword];
+ iwordddl++;
+ iwordblk++;
+ iworddsp++;
+ data = 0;
+ data = GetNextWord();
Int_t isig = data & 0x0FFF;
Int_t ich = (data >> 12) & 0x003F;
} // data word loop
- if (iwordcount == blRawDataLength) break;
+ if (iwordddl == totaldataword) break;
+
+ if (iworddsp == dspRawDataLength) break; // raw data
} // patch bus loop
- if (dspHeader.GetPaddingWord() == 1) iuppLimit++;
- if (iwordcount == blRawDataLength) break;
+ if (dspHeader.GetPaddingWord() == 1)
+ {
+ iuppLimit++;
+ iwordddl++;
+ iwordblk++;
+ iworddsp++;
+ data = GetNextWord();
+ }
+
+ if (iwordblk == blRawDataLength) break; // for raw data
} // end of DSP
- if (iwordcount == blRawDataLength) break;
} // end of BLOCK
- delete [] buffer;
+// delete [] buffer;
- return kTRUE;
+ return iddl;
}
//_____________________________________________________________________________
void AliPMDRawStream::GetRowCol(Int_t ddlno, Int_t smn, Int_t pbusid,
{
// decode: ddlno, patchbusid, mcmno, chno -> um, row, col
-
-
UInt_t iCh[64];
static const UInt_t kChDdl01[64] = { 9, 6, 5, 10, 1, 2, 0, 3,
col = icolnew;
}
//_____________________________________________________________________________
-Int_t AliPMDRawStream::ComputeParity(Int_t data)
+Int_t AliPMDRawStream::ComputeParity(UInt_t data)
{
// Calculate the parity bit
}
//_____________________________________________________________________________
+UInt_t AliPMDRawStream::GetNextWord()
+{
+ // Returns the next 32 bit word
+ // inside the raw data payload.
+
+ if (!fData || fPosition < 0) AliFatal("Raw data payload buffer is not yet initialized !");
+
+ UInt_t word = 0;
+ word |= fData[fPosition++];
+ word |= fData[fPosition++] << 8;
+ word |= fData[fPosition++] << 16;
+ word |= fData[fPosition++] << 24;
+
+ return word;
+}
+
AliPMDRawStream(AliRawReader* rawReader);
virtual ~AliPMDRawStream();
- Bool_t DdlData(Int_t indexDDL, TObjArray *pmdddlcont);
+ Int_t DdlData(TObjArray *pmdddlcont);
enum {kDDLOffset = 0xC00}; // offset for DDL numbers
void ConvertDDL2SMN(Int_t iddl, Int_t imodule,
Int_t &smn, Int_t &detector) const;
void TransformH2S(Int_t smn, Int_t &row, Int_t &col) const;
- int ComputeParity(Int_t data);
+ Int_t ComputeParity(UInt_t data1);
+ UInt_t GetNextWord();
AliRawReader* fRawReader; // object for reading the raw data
+ UChar_t* fData; // pointer to the data
+ Int_t fPosition;
-
- ClassDef(AliPMDRawStream, 4) // class for reading PMD raw digits
+ ClassDef(AliPMDRawStream, 5) // class for reading PMD raw digits
};
#endif
if (!fSDigits) fSDigits = new TClonesArray("AliPMDsdigit", 1000);
treeS->Branch("PMDSDigit", &fSDigits, bufsize);
- const Int_t kDDL = AliDAQ::NumberOfDdls("PMD");
+// const Int_t kDDL = AliDAQ::NumberOfDdls("PMD");
const Int_t kRow = 48;
const Int_t kCol = 96;
const Int_t kSMN = 48;
}
}
- for (Int_t indexDDL = 0; indexDDL < kDDL; indexDDL++)
- {
-
- rawReader->Reset();
- AliPMDRawStream pmdinput(rawReader);
- rawReader->Select("PMD", indexDDL, indexDDL);
-
- pmdinput.DdlData(indexDDL,&pmdddlcont);
-
+ AliPMDRawStream pmdinput(rawReader);
+ Int_t indexDDL = -1;
+ while ((indexDDL = pmdinput.DdlData(&pmdddlcont)) >=0)
+ {
Int_t ientries = pmdddlcont.GetEntries();
for (Int_t ient = 0; ient < ientries; ient++)
{
for ( indexsmn = 0; indexsmn < kSMN; indexsmn++)
{
- if (indexsmn <= 23)
+ if (indexsmn < 23)
{
idet = 0;
ismn = indexsmn;
}
else if (indexsmn > 23)
{
- idet = 1;
+ idet = 0;
ismn = indexsmn - 24;
}
for (Int_t irow = 0; irow < kRow; irow++)
if (!fDigits) fDigits = new TClonesArray("AliPMDdigit", 1000);
treeD->Branch("PMDDigit", &fDigits, bufsize);
- const Int_t kDDL = AliDAQ::NumberOfDdls("PMD");
+// const Int_t kDDL = AliDAQ::NumberOfDdls("PMD");
const Int_t kRow = 48;
const Int_t kCol = 96;
const Int_t kSMN = 48;
}
}
}
- for (Int_t indexDDL = 0; indexDDL < kDDL; indexDDL++)
- {
- rawReader->Reset();
- AliPMDRawStream pmdinput(rawReader);
- rawReader->Select("PMD", indexDDL, indexDDL);
-
- //pmdinput.DdlData(&pmdddlcont);
- pmdinput.DdlData(indexDDL,&pmdddlcont);
-
-
+
+ AliPMDRawStream pmdinput(rawReader);
+ Int_t indexDDL = -1;
+ while ((indexDDL = pmdinput.DdlData(&pmdddlcont)) >=0)
+ {
Int_t ientries = pmdddlcont.GetEntries();
for (Int_t ient = 0; ient < ientries; ient++)
{
// Add the digits here
for (indexsmn = 0; indexsmn < kSMN; indexsmn++)
{
- if (indexsmn <= 23)
+ if (indexsmn < 23)
{
ismn = indexsmn;
idet = 0;
{
// To be implemented, this is just for the test
- const Float_t kConstant = 9.0809;
- // const Float_t kErConstant = 1.6763;
- const Float_t kSlope = 128.348;
- // const Float_t kErSlope = 0.4703;
+ const Float_t kConstant = 7.181;
+ // const Float_t kErConstant = 0.6899;
+ const Float_t kSlope = 35.93;
+ // const Float_t kErSlope = 0.306;
- Float_t adc12bit = (Float_t) adc;
- edep = (1000.0/kSlope)*(adc12bit - kConstant);
+ Float_t adc10bit = (Float_t) adc/4;
+ edep = (1000.0/kSlope)*(adc10bit - kConstant);
}
-//------------------------------------------------------------------------- //
+// ------------------------------------------------------------------------- //
void AliPMDRawToSDigits::AddSDigit(Int_t trnumber, Int_t det, Int_t smnumber,
Int_t irow, Int_t icol, Float_t adc)
TTree *clustersTree) const
{
// reconstruct clusters from Raw Data
-
- AliPMDClusterFinder pmdClus;
- pmdClus.Digits2RecPoints(rawReader, clustersTree);
-
+ static AliPMDClusterFinder pmdClus;
+ pmdClus.Digits2RecPoints(rawReader, clustersTree);
}
// ------------------------------------------------------------------------ //
{
// reconstruct clusters from Raw Data
- AliPMDClusterFinder pmdClus;
+ static AliPMDClusterFinder pmdClus;
pmdClus.Digits2RecPoints(digitsTree, clustersTree);
}
void AliPMDReconstructor::FillESD(AliRawReader* /*rawReader*/,
TTree* clustersTree, AliESDEvent* esd) const
{
- AliPMDtracker pmdtracker;
- pmdtracker.LoadClusters(clustersTree);
- pmdtracker.Clusters2Tracks(esd);
+ static AliPMDtracker pmdtracker;
+ pmdtracker.LoadClusters(clustersTree);
+ pmdtracker.Clusters2Tracks(esd);
}
// ------------------------------------------------------------------------ //
void AliPMDReconstructor::FillESD(TTree * /*digitsTree*/,
TTree* clustersTree, AliESDEvent* esd) const
{
- AliPMDtracker pmdtracker;
- pmdtracker.LoadClusters(clustersTree);
- pmdtracker.Clusters2Tracks(esd);
+ static AliPMDtracker pmdtracker;
+ pmdtracker.LoadClusters(clustersTree);
+ pmdtracker.Clusters2Tracks(esd);
}
// To read PMD raw root data and fetch the adc value for each cell
-void AliPMDRootDataRead()
+void AliPMDRootDataRead(Int_t NEVT = 10)
{
TObjArray pmdddlcont;
-
- Int_t ievt = 2;
+
+ gBenchmark->Start("");
Bool_t junk;
+
+ Int_t xpad, ypad;
+ Float_t xx, yy;
+
+ AliPMDUtility cc;
+ TH2F *h2 = new TH2F("h2","Y vs. X",200,-100.,100.,200,-100.,100.);
+
+
+ for(Int_t ievt=3; ievt < NEVT; ievt++)
+ {
- AliRawReaderRoot reader("raw.root",ievt);
+ AliRawReaderRoot reader("08000033646024.10.root",ievt);
// reader.NextEvent();
cout<<" Processing Event No : "<<ievt<<endl;
/*
cout << "Data Size = " << reader.GetDataSize() << endl;
*/
+
AliPMDRawStream stream(&reader);
-
- Int_t indexDDL = 0;
-
- for (Int_t iddl = 0; iddl < 6; iddl++)
- {
- reader.Select("PMD", iddl, iddl);
- junk = stream.DdlData(iddl,&pmdddlcont);
-
+
+ Int_t iddl = -1;
+ while((iddl = stream.DdlData(&pmdddlcont)) >= 0)
+ {
Int_t ientries = pmdddlcont.GetEntries();
+
+ //cout << "iddl = " << iddl << " ientries = " << ientries << endl;
+
for (Int_t ient = 0; ient < ientries; ient++)
{
AliPMDddldata *pmdddl = (AliPMDddldata*)pmdddlcont.UncheckedAt(ient);
Int_t row = pmdddl->GetRow();
Int_t col = pmdddl->GetColumn();
Int_t sig = pmdddl->GetSignal();
+
+// cout << iddl<<" "<<row << " " << col << " " << sig << endl;
+
+
+ if(smn <12)
+ {
+ xpad = col;
+ ypad = row;
+ }
+ else if(smn >=12 && smn < 24)
+ {
+ xpad = row;
+ ypad = col;
+ }
+
+ if (det == 0)
+ {
+ cc.RectGeomCellPos(smn,xpad,ypad,xx,yy);
+ h2->Fill(xx,yy);
+ }
- //cout << iddl<<" "<<row << " " << col << " " << sig << endl;
}
+
pmdddlcont.Clear();
}
-}
\ No newline at end of file
+
+ }
+ h2->Draw();
+
+ gBenchmark->Show("");
+
+
+}
AliPMDtracker::AliPMDtracker():
fTreeR(0),
- fRecpoints(new TClonesArray("AliPMDrecpoint1", 1000)),
+ fRecpoints(new TClonesArray("AliPMDrecpoint1", 10)),
fPMDcontin(new TObjArray()),
fPMDcontout(new TObjArray()),
fPMDutil(new AliPMDUtility()),
// Destructor
if (fRecpoints)
{
+ fRecpoints->Clear();
+ /*
fRecpoints->Delete();
delete fRecpoints;
fRecpoints=0;
+ */
}
if (fPMDcontin)
{
+ fPMDcontin->Clear();
+ /*
fPMDcontin->Delete();
delete fPMDcontin;
fPMDcontin=0;
+ */
}
if (fPMDcontout)
- {
+ {
+ fPMDcontout->Clear();
+ /*
fPMDcontout->Delete();
delete fPMDcontout;
fPMDcontout=0;
+ */
}
delete fPMDutil;
}
/* exit when last event received, no need to wait for TERM signal */
if (eventT==END_OF_RUN) {
printf("EOR event detected\n");
- //calibped.Analyse(ped);
calibgain.Analyse(gain);
break;
/* write report */
fprintf(fp,"Run #%s, received %d physics events out of %d\n",getenv("DATE_RUN_NUMBER"),nevents_physics,nevents_total);
-/*
- TFile * pedRun = new TFile ("pmd_ped.root","RECREATE");
- ped->Write();
- pedRun->Close();
-*/
TFile * gainRun = new TFile ("pmd_calib.root","RECREATE");
gain->Write();
contact: basanta@phy.iitb.ac.in
Link:/afs/cern.ch/user/a/alicepmd/public/pedestaldata/run31270.raw
Run Type: STANDALONE
-DA Type: MON
+DA Type: LDC
Number of events needed: 1000
Input Files: data raw
Output Files: pmd_ped.root, to be exported to the DAQ FXS
-Trigger types used: PULSER
+Trigger types used: PHYSICS_EVENT
*/
extern "C" {
return -1;
}
-
/* define data source : this is argument 1 */
status=monitorSetDataSource( argv[1] );
printf("DA example case2 monitoring program started\n");
/* init some counters */
- int nevents_physics=0;
- int nevents_total=0;
+
struct eventHeaderStruct *event;
eventTypeType eventT;
case END_OF_RUN:
break;
- case PULSER:
+ case PHYSICS_EVENT:
printf(" event number = %i \n",iev);
+ //if (iev == 10) break;
AliRawReader *rawReader = new AliRawReaderDate((void*)event);
calibped.ProcessEvent(rawReader);
calibped.Analyse(ped);
break;
}
+
+ /*
+ if (iev == 10) {
+ printf("EOR event detected\n");
+ calibped.Analyse(ped);
+ break;
+ }
+ */
}
- TFile * pedRun = new TFile ("pmd_ped.root","RECREATE");
+ TFile * pedRun = new TFile ("PMD_PED.root","RECREATE");
ped->Write();
pedRun->Close();
- /* close result file */
- fclose(fp);
-
-
return status;
}