* provided "as is" without express or implied warranty. *
**************************************************************************/
-/* $Id$ */
+/* $Id:$ */
///////////////////////////////////////////////////////////////////////////////
///
/// This class provides ITS SSD data handling
/// used by DA.
-///
+// Author: Oleksandr Borysov
+// Date: 14/02/2008
///////////////////////////////////////////////////////////////////////////////
#include <Riostream.h>
#include "TObjArray.h"
#include "AliLog.h"
#include "AliITSNoiseSSD.h"
+#include "AliITSPedestalSSD.h"
+#include "AliITSBadChannelsSSD.h"
#include "AliITSRawStreamSSD.h"
#include "AliRawReaderDate.h"
const Int_t AliITSHandleDaSSD::fgkNumberOfSSDModules = 1698; // Number of SSD modules in ITS
-const Int_t AliITSHandleDaSSD::fgkNumberOfSSDModulesPerDdl = 108; // Number of SSD modules in ITS
+const Int_t AliITSHandleDaSSD::fgkNumberOfSSDModulesPerDdl = 108; // Number of SSD modules in DDL
+const Int_t AliITSHandleDaSSD::fgkNumberOfSSDModulesPerSlot = 12; // Number of SSD modules in Slot
const Float_t AliITSHandleDaSSD::fgkPedestalThresholdFactor = 3.0; // Defalt value for fPedestalThresholdFactor
const Float_t AliITSHandleDaSSD::fgkCmThresholdFactor = 3.0; // Defalt value for fCmThresholdFactor
fModules(NULL),
fModIndProcessed(0),
fModIndRead(0),
+ fModIndex(NULL),
fNumberOfEvents(0),
fLdcId(0),
fRunId(0),
fModules(NULL),
fModIndProcessed(0),
fModIndRead(0),
+ fModIndex(NULL),
fNumberOfEvents(0),
fLdcId(0),
fRunId(0),
fModules(NULL),
fModIndProcessed(ssdadldc.fModIndProcessed),
fModIndRead(ssdadldc.fModIndRead),
+ fModIndex(NULL),
fNumberOfEvents(ssdadldc.fNumberOfEvents),
fLdcId(ssdadldc.fLdcId),
fRunId(ssdadldc.fRunId),
delete [] fModules;
fModules = NULL;
}
+ if (fModIndex) { delete [] fModIndex; fModIndex = NULL; }
if ((ssdadldc.fNumberOfModules > 0) && (ssdadldc.fModules)) {
fModules = new (nothrow) AliITSModuleDaSSD* [ssdadldc.fNumberOfModules];
if (fModules) {
}
delete [] fModules;
}
+ if (fModIndex) delete [] fModIndex;
}
for (Int_t i = 0; i < fNumberOfModules; i++) if (fModules[i]) delete fModules[i];
delete [] fModules;
fModules = NULL;
- }
+ }
+ if (fModIndex) { delete [] fModIndex; fModIndex = NULL; }
fRawDataFileName = NULL;
fModIndProcessed = fModIndRead = 0;
fNumberOfEvents = 0;
return kFALSE;
}
if (rawreaderdate->NextEvent()) {
- fLdcId = rawreaderdate->GetLDCId();
fRunId = rawreaderdate->GetRunNumber();
rawreaderdate->RewindEvents();
} else { MakeZombie(); return kFALSE; }
nofstripsev = 0;
nofeqipmentev = 0;
while (rawreaderdate->ReadNextData(data)) {
+ fLdcId = rawreaderdate->GetLDCId();
nofeqipmentev += 1;
datasize = rawreaderdate->GetDataSize();
eqbelsize = rawreaderdate->GetEquipmentElementSize();
{
fNumberOfEvents = physeventind;
fRawDataFileName = rdfname;
+ fModIndex = new (nothrow) Int_t [fgkNumberOfSSDModulesPerDdl * eqn];
+ if (fModIndex)
+ for (Int_t i = 0; i < fgkNumberOfSSDModulesPerDdl * eqn; i++) fModIndex[i] = -1;
+ else AliWarning(Form("AliITSHandleDaSSD: Error Init(%s): Index array for %i modules was not created",
+ rdfname, fgkNumberOfSSDModulesPerDdl * eqn));
if (SetNumberOfModules(fgkNumberOfSSDModules)) {
TString str = TString::Format("Max number of equipment: %i, max number of channels: %i\n", eqn, strn);
DumpInitData(str.Data());
rawreaderdate->SelectEvents(-1);
while (rawreaderdate->NextEvent()) {
if ((rawreaderdate->GetType() != PHYSICS_EVENT) && (rawreaderdate->GetType() != CALIBRATION_EVENT)) continue;
- fLdcId = rawreaderdate->GetLDCId();
fRunId = rawreaderdate->GetRunNumber();
modind = 0;
while (rawreaderdate->ReadNextData(databyte)) {
+ fLdcId = rawreaderdate->GetLDCId();
data = reinterpret_cast<long32*>(databyte);
Int_t equipid = rawreaderdate->GetEquipmentId(); // EquipmentID required to access to rorc
Int_t equiptype = rawreaderdate->GetEquipmentType(); //
AliITSModuleDaSSD *module;
AliITSChannelDaSSD *strip;
Long_t datasize, eventind = 0;
- Int_t nofstrips, eqbelsize;
+ Int_t nofstrips, eqbelsize, nofeqipmentev;
UShort_t modind;
long32 *data;
UChar_t *databyte;
modind = 0;
while (rawreaderdate->NextEvent()) {
if ((rawreaderdate->GetType() != PHYSICS_EVENT) && (rawreaderdate->GetType() != CALIBRATION_EVENT)) continue;
+ nofeqipmentev = 0;
while (rawreaderdate->ReadNextData(databyte)) {
data = reinterpret_cast<long32*>(databyte);
Int_t equipid = rawreaderdate->GetEquipmentId(); // EquipmentID required to access to rorc
Short_t signal = (Short_t)(data[strind] & 0x00000FFF);
signal = (signal > AliITSChannelDaSSD::GetUnderflowConst()) ? (signal - 2 * AliITSChannelDaSSD::GetUnderflowConst())
: signal;
- Int_t modpos = GetModuleIndex(ddlID, ad, adc);
+
+ Int_t indpos = (nofeqipmentev * fgkNumberOfSSDModulesPerDdl)
+ + ((ad - 1) * fgkNumberOfSSDModulesPerSlot) + (adc < 6 ? adc : (adc - 2));
+ Int_t modpos = fModIndex[indpos];
if (((modpos > 0) && (modpos < fModIndRead)) || ((modpos < 0) && (modind == modulesnumber))) continue;
if ((modpos < 0) && (modind < modulesnumber)) {
module = new AliITSModuleDaSSD(AliITSModuleDaSSD::GetStripsPerModuleConst());
modpos = fModIndRead + modind;
modind += 1;
fModules[modpos] = module;
+ fModIndex[indpos] = modpos;
}
if (!(strip = fModules[modpos]->GetStrip(stripID))) {
strip = new AliITSChannelDaSSD(stripID, fNumberOfEvents);
}
strip->SetSignal(eventind, signal);
}
+ nofeqipmentev += 1;
}
if (++eventind > fNumberOfEvents) break;
}
strip->SetNoiseCM(AliITSChannelDaSSD::GetUndefinedValue());
AliError(Form("SSDDAModule: Error CalculateNoiseWithoutCM(): there are no events data for module[%i] strip[%i]->GetSignal()",
module->GetModuleId(), strind));
- return kFALSE;
+ continue; //return kFALSE;
}
Int_t chipind = strind / AliITSModuleDaSSD::GetStripsPerChip();
Double_t nsum = 0.0L;
else noise = AliITSChannelDaSSD::GetUndefinedValue();
strip->SetNoiseCM(noise);
}
-return kTRUE;
+ return kTRUE;
}
delete ldcc;
return NULL;
}
- modcalibobj = dynamic_cast<TObject*>(fModules[i]->GetCalibrationSSDModule());
+ modcalibobj = dynamic_cast<TObject*>(fModules[i]->GetCalibrationNoise());
ldcc->AddAt(modcalibobj, i);
}
ldcc->Compress();
Bool_t AliITSHandleDaSSD::SaveCalibrationSSDLDC(Char_t*& dafname) const
{
// Save Calibration data locally
- TObjArray *ldcc;
- TObject *modcalibobj;
+ TObjArray *ldcn, *ldcp, *ldcbc;
+ TObject *modobjn, *modobjp, *modobjbc;
Char_t *tmpfname;
TString dadatafilename("");
if (!fModules) return kFALSE;
- ldcc = new TObjArray(fNumberOfModules, 0);
+ ldcn = new TObjArray(fNumberOfModules, 0);
+ ldcn->SetName("Noise");
+ ldcp = new TObjArray(fNumberOfModules, 0);
+ ldcp->SetName("Pedestal");
+ ldcbc = new TObjArray(fNumberOfModules, 0);
+ ldcbc->SetName("BadChannels");
for (Int_t i = 0; i < fNumberOfModules; i++) {
if (!fModules[i]) {
- delete ldcc;
+ delete ldcn;
return kFALSE;
}
- modcalibobj = dynamic_cast<TObject*>(fModules[i]->GetCalibrationSSDModule());
- ldcc->AddAt(modcalibobj, i);
+ modobjn = dynamic_cast<TObject*>(fModules[i]->GetCalibrationNoise());
+ modobjp = dynamic_cast<TObject*>(fModules[i]->GetCalibrationPedestal());
+ modobjbc = dynamic_cast<TObject*>(fModules[i]->GetCalibrationBadChannels());
+ ldcn->AddAt(modobjn, i);
+ ldcp->AddAt(modobjp, i);
+ ldcbc->AddAt(modobjbc, i);
}
- ldcc->Compress();
+ ldcn->Compress();
+ ldcp->Compress();
+ ldcbc->Compress();
if (dafname) dadatafilename.Form("%s/", dafname);
dadatafilename += TString::Format("ITSSSDda_%i_%i.root", fLdcId, fRunId);
tmpfname = new Char_t[dadatafilename.Length()+1];
TFile *fileRun = new TFile (dadatafilename.Data(),"RECREATE");
if (fileRun->IsZombie()) {
AliError(Form("AliITSHandleDaSSD: SaveCalibrationSSDLDC() error open file %s", dadatafilename.Data()));
- ldcc->Delete();
+ ldcn->Delete();
delete fileRun;
- delete ldcc;
+ delete ldcn;
+ delete ldcp;
+ delete ldcbc;
return kFALSE;
}
- fileRun->WriteTObject(ldcc);
+ fileRun->WriteTObject(ldcn);
+ fileRun->WriteTObject(ldcp);
+ fileRun->WriteTObject(ldcbc);
fileRun->Close();
- ldcc->Delete();
+ ldcn->Delete();
delete fileRun;
- delete ldcc;
+ delete ldcn;
+ delete ldcp;
+ delete ldcbc;
return kTRUE;
}
* provided "as is" without express or implied warranty. *
**************************************************************************/
-/* $Id$ */
+/* $Id:$ */
///////////////////////////////////////////////////////////////////////////////
///
///////////////////////////////////////////////////////////////////////////////
#include "AliITSNoiseSSD.h"
+#include "AliITSPedestalSSD.h"
+#include "AliITSBadChannelsSSD.h"
#include "AliITSModuleDaSSD.h"
#include "TString.h"
#include "AliLog.h"
//______________________________________________________________________________
-AliITSNoiseSSD* AliITSModuleDaSSD::GetCalibrationSSDModule() const
+AliITSNoiseSSD* AliITSModuleDaSSD::GetCalibrationNoise() const
{
// Creates the AliITSNoiseSSD objects with callibration data
AliITSNoiseSSD *mc;
}
return mc;
}
+
+
+
+//______________________________________________________________________________
+AliITSPedestalSSD* AliITSModuleDaSSD::GetCalibrationPedestal() const
+{
+// Creates the AliITSPedestalSSD objects with callibration data
+ AliITSPedestalSSD *mc;
+ Float_t ped;
+ if (!fStrips) return NULL;
+ mc = new AliITSPedestalSSD();
+ mc->SetMod(fModuleId);
+ mc->SetNPedestalP(fgkPNStripsPerModule);
+ mc->SetNPedestalN(fgkPNStripsPerModule);
+ for (Int_t i = 0; i < fNumberOfStrips; i++) {
+ if (!fStrips[i]) ped = AliITSChannelDaSSD::GetUndefinedValue();
+ else ped = fStrips[i]->GetPedestal();
+ if (i < fgkPNStripsPerModule)
+ mc->AddPedestalP(i, ped);
+ else mc->AddPedestalN((AliITSChannelDaSSD::GetMaxStripIdConst() - i), ped);
+ }
+ return mc;
+}
+
+
+
+//______________________________________________________________________________
+AliITSBadChannelsSSD* AliITSModuleDaSSD::GetCalibrationBadChannels() const
+{
+// Creates the AliITSBadChannelsSSD objects with callibration data
+ AliITSBadChannelsSSD *mc;
+ Int_t *chlist, nch = 0, nchn = 0, nchp = 0;
+ if (!fStrips) return NULL;
+ chlist = new Int_t [GetStripsPerModuleConst()];
+ for (Int_t i = 0; i < fNumberOfStrips; i++) {
+ if (!fStrips[i]) { chlist[nch++] = i; if (i < fgkPNStripsPerModule) nchp++; else nchn++; continue;}
+ if (fStrips[i]->GetNoiseCM() == AliITSChannelDaSSD::GetUndefinedValue())
+ { chlist[nch++] = i; if (i < fgkPNStripsPerModule) nchp++; else nchn++; }
+ }
+ mc = new AliITSBadChannelsSSD();
+ mc->SetMod(fModuleId);
+ if (!nch) return mc;
+ mc->SetNBadPChannelsList(nchp);
+ mc->SetNBadNChannelsList(nchn);
+ for (Int_t i = 0; i < nch; i++) {
+ if (chlist[i] < fgkPNStripsPerModule) mc->AddBadPChannel(chlist[i], i);
+ else mc->AddBadNChannel((AliITSChannelDaSSD::GetMaxStripIdConst() - chlist[i]), (i-nchp));
+ }
+ return mc;
+}
/* Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. *
* See cxx source for full Copyright notice */
/* */
-/* $Id$ */
+/* $Id:$ */
///////////////////////////////////////////////////////////////////////////////
///
-/// This class provides storage container ITS SSD module callibration data
+/// This class provides storage container ITS SSD module calibration data
/// used by DA.
///
///////////////////////////////////////////////////////////////////////////////
#include "AliITSChannelDaSSD.h"
class AliITSNoiseSSD;
+class AliITSPedestalSSD;
+class AliITSBadChannelsSSD;
class AliITSModuleDaSSD : public TObject {
public :
Int_t GetNumberOfChips() const { return fNumberOfChips; }
AliITSChannelDaSSD* GetStrip(const Int_t stripnumber) const
{ return (fStrips) ? fStrips[stripnumber] : NULL; }
- AliITSNoiseSSD* GetCalibrationSSDModule() const;
+ AliITSNoiseSSD* GetCalibrationNoise() const;
+ AliITSPedestalSSD* GetCalibrationPedestal() const;
+ AliITSBadChannelsSSD* GetCalibrationBadChannels() const;
Bool_t SetEventsNumber(const Long_t eventsnumber);
Bool_t SetNumberOfStrips(const Int_t numberofstrips);
Bool_t SetNumberOfChips(const Int_t nchips);
UChar_t fDdlId; // index of DDL, ITS SSD: 33-48
UChar_t fAd; // index of AD module 0-9
UChar_t fAdc; // index of ADC module 0-5, 8-13
- Short_t fModuleId; // Module number 0-1697
+ Short_t fModuleId; // Module number 500-2197
Int_t fNumberOfStrips; // Number of AliITSChannelDaSSD* allocated
AliITSChannelDaSSD **fStrips; //[fNumberOfStrips] Array of *AliITSChannelDaSSD