From 223dda261edb0d24da614961d91f186a6a27d677 Mon Sep 17 00:00:00 2001 From: masera Date: Fri, 19 Oct 2007 17:40:32 +0000 Subject: [PATCH] Coding conventions --- ITS/AliITSChannelDaSSD.cxx | 76 ++++++++++++++++-------- ITS/AliITSChannelDaSSD.h | 32 ++++++---- ITS/AliITSHandleDaSSD.cxx | 118 +++++++++++++++++++++++++------------ ITS/AliITSHandleDaSSD.h | 26 ++++---- ITS/AliITSModuleDaSSD.cxx | 84 ++++++++++++++++---------- ITS/AliITSModuleDaSSD.h | 31 ++++++---- ITS/ITSSSDPEDda.cxx | 11 ++-- 7 files changed, 244 insertions(+), 134 deletions(-) diff --git a/ITS/AliITSChannelDaSSD.cxx b/ITS/AliITSChannelDaSSD.cxx index 33c8278c6ad..dbc691039e7 100644 --- a/ITS/AliITSChannelDaSSD.cxx +++ b/ITS/AliITSChannelDaSSD.cxx @@ -1,4 +1,29 @@ - +/************************************************************************** + * Copyright(c) 2007-2009, 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 provides storage container ITS SSD channel callibration data +/// used by DA. +/// +/////////////////////////////////////////////////////////////////////////////// + + +#include #include "AliITSChannelDaSSD.h" ClassImp(AliITSChannelDaSSD) @@ -15,6 +40,7 @@ AliITSChannelDaSSD::AliITSChannelDaSSD() : fNoise(fgkUndefinedValue), fZsThresholdFactor(0.0f) { +// Default costructor } @@ -26,6 +52,7 @@ AliITSChannelDaSSD::AliITSChannelDaSSD(const UShort_t stripID) : fNoise(fgkUndefinedValue), fZsThresholdFactor(0.0f) { +// Costructor, initialize channal id } @@ -37,20 +64,18 @@ AliITSChannelDaSSD::AliITSChannelDaSSD(const UShort_t stripID, const Long_t even fNoise(fgkUndefinedValue), fZsThresholdFactor(0.0f) { +// Costructor, initialize channal id and allocate array for events data if (stripID > fgkMaxStripId) Warning("AliITSChannelDaSSD", "Wrong StripID: %i", stripID); - try - { - fSignal = new Short_t [eventsnumber]; - fEventsNumber = eventsnumber; - memset(fSignal, fgkDefaultSignal, (eventsnumber * sizeof(Short_t))); + fSignal = new (nothrow) Short_t[eventsnumber]; + if (fSignal) { + fEventsNumber = eventsnumber; + memset(fSignal, fgkDefaultSignal, (eventsnumber * sizeof(Short_t))); + } else { + Error("AliITSChannelDaSSD", "Error allocating memory for %i Short_t objects!", eventsnumber); + fSignal = NULL; + fEventsNumber = 0; } - catch (bad_alloc&) - { - cout << "Error allocating memory for " << (long) eventsnumber << " Short_t objects in AliITSChannelDaSSD constructor!" << endl; - fSignal = NULL; - fEventsNumber = 0; - } } @@ -80,6 +105,7 @@ AliITSChannelDaSSD& AliITSChannelDaSSD::operator = (const AliITSChannelDaSSD& st AliITSChannelDaSSD::~AliITSChannelDaSSD() { +// Destructor if (fSignal) { delete [] fSignal; @@ -89,26 +115,26 @@ AliITSChannelDaSSD::~AliITSChannelDaSSD() Bool_t AliITSChannelDaSSD::SetEvenetsNumber(const Long_t eventsnumber) { - try - { - fSignal = new Short_t[eventsnumber]; - fEventsNumber = eventsnumber; - memset(fSignal, fgkDefaultSignal, (eventsnumber * sizeof(Short_t))); - return kTRUE; +// Allocate array for events data + if (fSignal) {delete [] fSignal; fSignal = NULL; } + fSignal = new (nothrow) Short_t[eventsnumber]; + if (fSignal) { + fEventsNumber = eventsnumber; + memset(fSignal, fgkDefaultSignal, (eventsnumber * sizeof(Short_t))); + return kTRUE; + } else { + Error("AliITSChannelDaSSD", "Error allocating memory for %i Short_t objects!", eventsnumber); + fSignal = NULL; + fEventsNumber = 0; + return kFALSE; } - catch (bad_alloc&) - { - cout << "Error allocating memory for " << (long) eventsnumber << " Short_t objects!" << endl; - fSignal = NULL; - fEventsNumber = 0; - return kFALSE; - } } Bool_t AliITSChannelDaSSD::SetSignal(const Long_t eventnumber, const Short_t signal) { +// put signal value to array if (eventnumber < fEventsNumber && fSignal) { fSignal[eventnumber] = signal; diff --git a/ITS/AliITSChannelDaSSD.h b/ITS/AliITSChannelDaSSD.h index d40dd9848a5..c6e7a5bf019 100644 --- a/ITS/AliITSChannelDaSSD.h +++ b/ITS/AliITSChannelDaSSD.h @@ -1,11 +1,22 @@ #ifndef ALIITSCHANNELDASSD_H #define ALIITSCHANNELDASSD_H +/* Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ +/* */ +/* $Id$ */ + +/////////////////////////////////////////////////////////////////////////////// +/// +/// This class provides storage container ITS SSD channel callibration data +/// used by DA. +/// +/////////////////////////////////////////////////////////////////////////////// -#include #include "TMath.h" #include "TObject.h" + class AliITSChannelDaSSD : public TObject { public : AliITSChannelDaSSD(); @@ -45,21 +56,20 @@ class AliITSChannelDaSSD : public TObject { static Float_t GetUndefinedValue() { return fgkUndefinedValue; } protected : - - static const UShort_t fgkMinStripId = 0; - static const UShort_t fgkMaxStripId = 1535; + static const UShort_t fgkMinStripId = 0; // minimum strip id + static const UShort_t fgkMaxStripId = 1535; // maximum strip id - static const Short_t fgkSignalOverflow = 2047; - static const Short_t fgkSignalUnderflow = 2048; - static const UShort_t fgkDefaultSignal = 0x7F; - static const Float_t fgkUndefinedValue; - + static const Short_t fgkSignalOverflow = 2047; // ADC overflow value + static const Short_t fgkSignalUnderflow = 2048; // ADC underflow value + static const UShort_t fgkDefaultSignal = 0x7F; // initialization value for fNoise, fPedestal, fSignal[i] + static const Float_t fgkUndefinedValue; // constant value which indicates that fNoise, fPedestal is undefined + UShort_t fStripId; // channel = strip number within SSD module 0-1535 Long_t fEventsNumber; // number of events for fSignal memory allocation Short_t *fSignal; //! - Float_t fPedestal; - Float_t fNoise; + Float_t fPedestal; // pedestal + Float_t fNoise; // noise Float_t fZsThresholdFactor; // factor for zero suppression threshold diff --git a/ITS/AliITSHandleDaSSD.cxx b/ITS/AliITSHandleDaSSD.cxx index fa3fd90cec8..6d742606e78 100644 --- a/ITS/AliITSHandleDaSSD.cxx +++ b/ITS/AliITSHandleDaSSD.cxx @@ -1,6 +1,39 @@ - -#include +/************************************************************************** + * Copyright(c) 2007-2009, 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 provides ITS SSD data handling +/// used by DA. +/// +/////////////////////////////////////////////////////////////////////////////// + +#include #include "AliITSHandleDaSSD.h" +#include +#include +#include +#include "event.h" +#include "TFile.h" +#include "TObjArray.h" +#include "AliITSNoiseSSD.h" +#include "AliRawReaderDate.h" + +#include "AliITSChannelDaSSD.h" ClassImp(AliITSHandleDaSSD) @@ -14,6 +47,7 @@ AliITSHandleDaSSD::AliITSHandleDaSSD() : fLdcId(0), fRunId(0) { +// Default constructor } @@ -23,20 +57,18 @@ AliITSHandleDaSSD::AliITSHandleDaSSD(const Int_t numberofmodules) : fLdcId(0), fRunId(0) { +// Constructor allocates memory for AliITSModuleDaSSD objects if (numberofmodules > fgkNumberOfSSDModules) cout << "ALICE ITS SSD contains " << fgkNumberOfSSDModules << "modules!"<< endl; - try - { - fModules = new AliITSModuleDaSSD* [numberofmodules]; - fNumberOfModules = numberofmodules; - for (Int_t i = 0; i < numberofmodules; i++) fModules[i] = NULL; - } - catch (bad_alloc&) - { - Error("AliITSHandleDaSSD", "Error allocating memory for %i AliITSModulesDaSSD objects!", numberofmodules); + fModules = new (nothrow) AliITSModuleDaSSD* [numberofmodules]; + if (fModules) { + fNumberOfModules = numberofmodules; + memset(fModules, 0, sizeof(AliITSModuleDaSSD*) * numberofmodules); + } else { + Error("AliITSHandleDaSSD", "Error allocating memory for %i AliITSModulesDaSSD* objects!", numberofmodules); fNumberOfModules = 0; fModules = NULL; - } + } } @@ -63,7 +95,8 @@ AliITSHandleDaSSD& AliITSHandleDaSSD::operator = (const AliITSHandleDaSSD& ssdad AliITSHandleDaSSD::~AliITSHandleDaSSD() -{ +{ +// Default destructor if (fModules) { for (Int_t i = 0; i < fNumberOfModules; i++) @@ -78,6 +111,7 @@ AliITSHandleDaSSD::~AliITSHandleDaSSD() AliITSModuleDaSSD* AliITSHandleDaSSD::GetModule (const UChar_t ddlID, const UChar_t ad, const UChar_t adc) const { +// Retrieve AliITSModuleDaSSD object from the array if (!fModules) return NULL; for (Int_t i = 0; i < fNumberOfModules; i++) { if (fModules[i]) { @@ -92,10 +126,9 @@ AliITSModuleDaSSD* AliITSHandleDaSSD::GetModule (const UChar_t ddlID, const UCha -/*************************** Used for test only ******************************/ - AliITSChannelDaSSD* AliITSHandleDaSSD::GetStrip (const UChar_t ddlID, const UChar_t ad, const UChar_t adc, const UShort_t stripID) const { +// Retrieve AliITSChannalDaSSD object from the array for (Int_t modind = 0; modind < fNumberOfModules; modind++) { if ( (fModules[modind]->GetDdlId() == ddlID) && (fModules[modind]->GetAD() == ad) @@ -112,6 +145,7 @@ AliITSChannelDaSSD* AliITSHandleDaSSD::GetStrip (const UChar_t ddlID, const UCha Bool_t AliITSHandleDaSSD::SetModule(AliITSModuleDaSSD *const module, const Int_t index) { +// Assign array element with AliITSModuleDaSSD object if ((index < fNumberOfModules) && (index >= 0)) { if (fModules[index]) delete fModules[index]; @@ -124,27 +158,27 @@ Bool_t AliITSHandleDaSSD::SetModule(AliITSModuleDaSSD *const module, const Int_t Bool_t AliITSHandleDaSSD::SetNumberOfModules (const Int_t numberofmodules) { - if (numberofmodules > fgkNumberOfSSDModules) - Warning("AliITSHandleDaSSD", "The number of modules you use exceeds the maximum %i for ALICE ITS SSD", fgkNumberOfSSDModules); - try - { - fModules = new AliITSModuleDaSSD* [numberofmodules]; - fNumberOfModules = numberofmodules; - for (Int_t i = 0; i < fNumberOfModules; i++) fModules[i] = NULL; - return kTRUE; - } - catch (bad_alloc&) - { - Error("AliITSHandleDaSSD", "Error allocating memory for %i AliITSModuleDaSSD objects!", numberofmodules); +// Allocates memory for AliITSModuleDaSSD objects + if (numberofmodules > fgkNumberOfSSDModules) + Warning("AliITSHandleDaSSD", "The number of modules %i you use exceeds the maximum %i for ALICE ITS SSD", numberofmodules, fgkNumberOfSSDModules); + if (fModules) { delete [] fModules; fModules = NULL; } + fModules = new (nothrow) AliITSModuleDaSSD* [numberofmodules]; + if (fModules) { + fNumberOfModules = numberofmodules; + memset(fModules, 0, sizeof(AliITSModuleDaSSD*) * numberofmodules); + return kTRUE; + } else { + Error("AliITSHandleDaSSD", "Error allocating memory for %i AliITSModulesDaSSD* objects!", numberofmodules); fNumberOfModules = 0; fModules = NULL; - } + } return kFALSE; } Bool_t AliITSHandleDaSSD::ReadCalibrationDataFile (const char* fileName, const Long_t eventsnumber) { +// Reads raw data from file AliRawReaderDate *rawreaderdate = new AliRawReaderDate(fileName, 0); AliITSModuleDaSSD *module; AliITSChannelDaSSD *strip; @@ -156,8 +190,9 @@ Bool_t AliITSHandleDaSSD::ReadCalibrationDataFile (const char* fileName, const L Error("AliITSHandleDaSSD", "Error ReadCalibrationDataFile: no structure was allocated for data"); return kFALSE; } - rawreaderdate->SelectEvents(PHYSICS_EVENT); + rawreaderdate->SelectEvents(-1); while (rawreaderdate->NextEvent()) { + if ((rawreaderdate->GetType() != PHYSICS_EVENT) && (rawreaderdate->GetType() != CALIBRATION_EVENT)) continue; fLdcId = rawreaderdate->GetLDCId(); fRunId = rawreaderdate->GetRunNumber(); modind = 0; @@ -202,17 +237,16 @@ Bool_t AliITSHandleDaSSD::ReadCalibrationDataFile (const char* fileName, const L Bool_t AliITSHandleDaSSD::RelocateModules() -{ +{ +// Relocate memory for AliITSModuleDaSSD object array Int_t nm = 0; - AliITSModuleDaSSD **marray; + AliITSModuleDaSSD **marray = NULL; for (Int_t modind = 0; modind < fNumberOfModules; modind++) if (fModules[modind]) nm += 1; if (nm == fNumberOfModules) return kTRUE; - try { - marray = new AliITSModuleDaSSD* [nm]; - } - catch (bad_alloc&) { - Error("AliITSHandleDaSSD", "Error relocating memory for %i AliITSModuleDaSSD objects!", nm); + marray = new (nothrow) AliITSModuleDaSSD* [nm]; + if (!marray) { + Error("AliITSHandleDaSSD", "Error relocating memory for %i AliITSModuleDaSSD* objects!", nm); return kFALSE; } nm = 0; @@ -227,6 +261,7 @@ Bool_t AliITSHandleDaSSD::RelocateModules() Bool_t AliITSHandleDaSSD::CalculatePedestal() { +// Calculates Pedestal Float_t pedestal; Short_t *signal; AliITSChannelDaSSD *strip; @@ -262,6 +297,7 @@ Bool_t AliITSHandleDaSSD::CalculatePedestal() Bool_t AliITSHandleDaSSD::CalculateNoise() { +// Calculates Noise AliITSChannelDaSSD *strip; Short_t *signal; Float_t noise; @@ -299,6 +335,7 @@ Bool_t AliITSHandleDaSSD::CalculateNoise() Bool_t AliITSHandleDaSSD::CalculateCM(const Int_t modind, const Int_t stripind, Float_t* const cm) { +// Calculates CM AliITSChannelDaSSD *strip = NULL; Short_t *signal; Long_t ovstr, evn, n; @@ -327,6 +364,7 @@ Bool_t AliITSHandleDaSSD::CalculateCM(const Int_t modind, const Int_t stripind, Bool_t AliITSHandleDaSSD::CalculateNoiseCM() { +// Calculates Noise with CM correction Short_t *signal; AliITSChannelDaSSD *strip = NULL; Float_t noise, *cm = NULL; @@ -377,7 +415,8 @@ Bool_t AliITSHandleDaSSD::CalculateNoiseCM() TObjArray* AliITSHandleDaSSD::GetCalibrationSSDLDC() const -{ +{ +// Fill in the array for OCDB TObjArray *ldcc; if (!fModules) return NULL; ldcc = new TObjArray(fNumberOfModules, 0); @@ -386,7 +425,7 @@ TObjArray* AliITSHandleDaSSD::GetCalibrationSSDLDC() const delete ldcc; return NULL; } - ldcc->AddAt(fModules[i]->GetCalibrationSSDModule(), i); + ldcc->AddAt(dynamic_cast(fModules[i]->GetCalibrationSSDModule()), i); } ldcc->Compress(); return ldcc; @@ -395,6 +434,7 @@ TObjArray* AliITSHandleDaSSD::GetCalibrationSSDLDC() const Bool_t AliITSHandleDaSSD::SaveCalibrationSSDLDC(string& dafname) const { +// Save Calibration data locally ostringstream dadatafilename; TObjArray *ldcc; if (!fModules) return kFALSE; @@ -404,7 +444,7 @@ Bool_t AliITSHandleDaSSD::SaveCalibrationSSDLDC(string& dafname) const delete ldcc; return kFALSE; } - ldcc->AddAt(fModules[i]->GetCalibrationSSDModule(), i); + ldcc->AddAt(dynamic_cast(fModules[i]->GetCalibrationSSDModule()), i); } ldcc->Compress(); dadatafilename << dafname << "/ITSSSDda_" << fLdcId << "_" << fRunId << ".root"; diff --git a/ITS/AliITSHandleDaSSD.h b/ITS/AliITSHandleDaSSD.h index 085408684d4..e6d6de11c20 100644 --- a/ITS/AliITSHandleDaSSD.h +++ b/ITS/AliITSHandleDaSSD.h @@ -1,20 +1,22 @@ #ifndef ALIITSHANDLEDASSD_H #define ALIITSHANDLEDASSD_H -#include -#include -#include -#include "TObject.h" -#include "TFile.h" -#include "TObjArray.h" -#include "AliRawReaderDate.h" +/* Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ +/* */ +/* $Id$ */ -#include "AliITSChannelDaSSD.h" +#include "TObject.h" #include "AliITSModuleDaSSD.h" -#ifndef PHYSICS_EVENT -#define PHYSICS_EVENT 7 -#endif +/////////////////////////////////////////////////////////////////////////////// +/// +/// This class provides ITS SSD data handling +/// used by DA. +/// +/////////////////////////////////////////////////////////////////////////////// + +class TObjArray; class AliITSHandleDaSSD : public TObject { public : @@ -46,7 +48,7 @@ class AliITSHandleDaSSD : public TObject { static Int_t GetNumberOfSSDModulesConst() { return fgkNumberOfSSDModules; } protected : - static const Int_t fgkNumberOfSSDModules = 1698; + static const Int_t fgkNumberOfSSDModules = 1698; // Number of SSD modules in ITS Int_t fNumberOfModules; // number of AliITSModuleDaSSD to allocate AliITSModuleDaSSD **fModules; //[fNumberOfModules] array of all SSD 1698 Modules (2608128 strips) diff --git a/ITS/AliITSModuleDaSSD.cxx b/ITS/AliITSModuleDaSSD.cxx index e8c10e80d13..d59874edd1e 100644 --- a/ITS/AliITSModuleDaSSD.cxx +++ b/ITS/AliITSModuleDaSSD.cxx @@ -1,5 +1,28 @@ - - +/************************************************************************** + * Copyright(c) 2007-2009, 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 provides storage container ITS SSD module callibration data +/// used by DA. +/// +/////////////////////////////////////////////////////////////////////////////// + +#include "AliITSNoiseSSD.h" #include "AliITSModuleDaSSD.h" ClassImp(AliITSModuleDaSSD) @@ -17,6 +40,7 @@ AliITSModuleDaSSD::AliITSModuleDaSSD() : fStrips(NULL), fEventsNumber(0) { +// Default constructor } @@ -31,6 +55,7 @@ AliITSModuleDaSSD::AliITSModuleDaSSD(const UChar_t ddlID, const UChar_t ad, cons fStrips(NULL), fEventsNumber(0) { +// Constructor, set module id data } @@ -46,18 +71,18 @@ AliITSModuleDaSSD::AliITSModuleDaSSD(const Int_t numberofstrips) : fStrips(NULL), fEventsNumber(0) { +// Constructor, allocates memory for AliITSChannelDaSSD* if (numberofstrips != fgkStripsPerModule) - Warning("AliITSModuleDaSSD", "ALICE ITS SSD Module contains %d strips", fgkStripsPerModule); - try { - fStrips = new AliITSChannelDaSSD* [numberofstrips]; + Warning("AliITSModuleDaSSD", "ALICE ITS SSD Module contains %i strips", fgkStripsPerModule); + fStrips = new (nothrow) AliITSChannelDaSSD* [numberofstrips]; + if (fStrips) { fNumberOfStrips = numberofstrips; for (Int_t i = 0; i < numberofstrips; i++) fStrips[i]= NULL; - } - catch (bad_alloc&) { - Error("AliITSModuleDaSSD", "Error allocating memory for %d AliITSChannelDaSSD objects!", numberofstrips); + } else { + Error("AliITSModuleDaSSD", "Error allocating memory for %i AliITSChannelDaSSD* objects!", numberofstrips); fNumberOfStrips = 0; fStrips = NULL; - } + } } @@ -72,29 +97,21 @@ AliITSModuleDaSSD::AliITSModuleDaSSD(const Int_t numberofstrips, const Long_t ev fStrips(NULL), fEventsNumber(0) { +// Constructor, allocates memory for AliITSChannelDaSSD* and events data if (numberofstrips != fgkStripsPerModule) - Warning("AliITSModuleDaSSD", "ALICE ITS SSD Module contains %d strips", fgkStripsPerModule); - try { - fStrips = new AliITSChannelDaSSD* [numberofstrips]; + Warning("AliITSModuleDaSSD", "ALICE ITS SSD Module contains %i strips", fgkStripsPerModule); + fStrips = new (nothrow) AliITSChannelDaSSD* [numberofstrips]; + if (fStrips) { fNumberOfStrips = numberofstrips; - } - catch (bad_alloc&) { - Error("AliITSModuleDaSSD", "Error allocating memory for %d AliITSChannelDaSSD objects!", numberofstrips); + memset(fStrips, 0, numberofstrips * sizeof(AliITSChannelDaSSD*)); + for (Int_t i = 0; i < fNumberOfStrips; i++) { + fStrips[i] = new AliITSChannelDaSSD(i, eventsnumber); + if (!fStrips[i]) Error("AliITSModuleDaSSD", "Error allocating memory for AliITSChannelDaSSD %i-th object", i); + } + } else { + Error("AliITSModuleDaSSD", "Error allocating memory for %i AliITSChannelDaSSD* objects!", numberofstrips); fNumberOfStrips = 0; fStrips = NULL; - } - if (fStrips) { - Int_t i; - try { - for (i = 0; i < fNumberOfStrips; i++) fStrips[i] = new AliITSChannelDaSSD(i, eventsnumber); - } - catch (bad_alloc&) { - Error("AliITSModuleDaSSD", "Error allocating memory for %d-th AliITSChannelDaSSD objects!", i); - for (Int_t j = 0; j < i; j++) delete fStrips[j]; - delete [] fStrips; - fNumberOfStrips = 0; - fStrips = NULL; - } } } @@ -112,7 +129,7 @@ AliITSModuleDaSSD::AliITSModuleDaSSD(const AliITSModuleDaSSD& module) : fStrips(module.fStrips), fEventsNumber(module.fEventsNumber) { - // copy constructor +// copy constructor Fatal("AliITSModuleDaSSD", "copy constructor not implemented"); } @@ -131,12 +148,12 @@ AliITSModuleDaSSD& AliITSModuleDaSSD::operator = (const AliITSModuleDaSSD& modul AliITSModuleDaSSD::~AliITSModuleDaSSD() { +// Destructor if (fStrips) { for (Long_t i = 0; i < fNumberOfStrips; i++) { if (fStrips[i]) delete fStrips[i]; -// if (!(i % 100)) cout << "Deleted fStrips[i], i = " << i << endl; } delete [] fStrips; } @@ -146,6 +163,7 @@ AliITSModuleDaSSD::~AliITSModuleDaSSD() Bool_t AliITSModuleDaSSD::SetModuleIdData (const UChar_t ddlID, const UChar_t ad, const UChar_t adc, const UShort_t moduleID) { +// SetModuleIdData if (ad > fgkMaxAdNumber) { Warning("AliITSModuleDaSSD", "Wrong AD number: %i", ad); return kFALSE; @@ -165,6 +183,7 @@ Bool_t AliITSModuleDaSSD::SetModuleIdData (const UChar_t ddlID, const UChar_t ad void AliITSModuleDaSSD::SetModuleFEEId (const UChar_t ddlID, const UChar_t ad, const UChar_t adc) { +// Set id data of FEE connected to the Module fDdlId = ddlID; fAd = ad; fAdc = adc; @@ -173,6 +192,7 @@ void AliITSModuleDaSSD::SetModuleFEEId (const UChar_t ddlID, const UChar_t ad, c void AliITSModuleDaSSD::SetModuleRorcId (const Int_t equipid, const Int_t equiptype) { +// Set data to access FEROM registres via DDL fEquipId = equipid; fEquipType = equiptype; } @@ -180,6 +200,7 @@ void AliITSModuleDaSSD::SetModuleRorcId (const Int_t equipid, const Int_t equipt Bool_t AliITSModuleDaSSD::SetEventsNumber(const Long_t eventsnumber) { +// Allocate the memory for the enents data Int_t i; if (!fStrips) return kFALSE; try { @@ -189,7 +210,7 @@ Bool_t AliITSModuleDaSSD::SetEventsNumber(const Long_t eventsnumber) } } catch (bad_alloc&) { - Error("AliITSModuleDaSSD", "Error allocating memory for %d-th AliITSChannelDaSSD objects!", i); + Error("AliITSModuleDaSSD", "Error allocating memory for %i-th AliITSChannelDaSSD objects!", i); for (Int_t j = 0; j < i; j++) delete fStrips[j]; delete [] fStrips; fNumberOfStrips = 0; @@ -203,6 +224,7 @@ Bool_t AliITSModuleDaSSD::SetEventsNumber(const Long_t eventsnumber) AliITSNoiseSSD* AliITSModuleDaSSD::GetCalibrationSSDModule() const { +// Creates the AliITSNoiseSSD objects with callibration data AliITSNoiseSSD *mc; if (!fStrips) return NULL; mc = new AliITSNoiseSSD(); diff --git a/ITS/AliITSModuleDaSSD.h b/ITS/AliITSModuleDaSSD.h index 7e8bda2e02f..85b65ef48fc 100644 --- a/ITS/AliITSModuleDaSSD.h +++ b/ITS/AliITSModuleDaSSD.h @@ -2,12 +2,22 @@ #define ALIITSMODULEDASSD_H -#include -#include "TObject.h" -#include "AliITSNoiseSSD.h" +/* Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ +/* */ +/* $Id$ */ +/////////////////////////////////////////////////////////////////////////////// +/// +/// This class provides storage container ITS SSD module callibration data +/// used by DA. +/// +/////////////////////////////////////////////////////////////////////////////// +#include "TObject.h" #include "AliITSChannelDaSSD.h" +class AliITSNoiseSSD; + class AliITSModuleDaSSD : public TObject { public : AliITSModuleDaSSD(); @@ -26,7 +36,6 @@ class AliITSModuleDaSSD : public TObject { Int_t GetModuleRorcEquipType() const { return fEquipType; } Int_t GetNumberOfStrips() const { return fNumberOfStrips; } Long_t GetEventsNumber() const { return fEventsNumber; } -// AliITSChannelDaSSD* GetStrip() const { return fStrips; } AliITSChannelDaSSD* GetStrip(const Int_t stripnumber) const { return (fStrips) ? fStrips[stripnumber] : NULL; } @@ -45,20 +54,20 @@ class AliITSModuleDaSSD : public TObject { static Int_t GetStripsPerChip() { return fgkStripsPerChip; } protected : - static const Int_t fgkStripsPerModule = 1536; - static const Int_t fgkPNStripsPerModule = 768; - static const Int_t fgkStripsPerChip = 128; - static const UChar_t fgkMaxAdNumber = 9; - static const UChar_t fgkMaxAdcNumber = 13; + static const Int_t fgkStripsPerModule = 1536; // Number of strips per SSD module + static const Int_t fgkPNStripsPerModule = 768; // Number of N/P strips per SSD module + static const Int_t fgkStripsPerChip = 128; // Number of strips per chip HAL25 + static const UChar_t fgkMaxAdNumber = 9; // MAx SSD FEROM AD number + static const UChar_t fgkMaxAdcNumber = 13; // MAx SSD FEROM ADC number Int_t fEquipId; // required to access to rorc - Int_t fEquipType; + Int_t fEquipType; // fEquipType, required to access to rorc 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 UShort_t fModuleId; // Module number 0-1697 - Int_t fNumberOfStrips; + Int_t fNumberOfStrips; // Number of AliITSChannelDaSSD* allocated AliITSChannelDaSSD **fStrips; //[fNumberOfStrips] Array of *AliITSChannelDaSSD Long_t fEventsNumber; // number of events for fsignal memory allocation diff --git a/ITS/ITSSSDPEDda.cxx b/ITS/ITSSSDPEDda.cxx index 35c1e700a0f..bab87ad4783 100644 --- a/ITS/ITSSSDPEDda.cxx +++ b/ITS/ITSSSDPEDda.cxx @@ -1,10 +1,11 @@ -#include +#include #include #include #include "TFile.h" #include "daqDA.h" -//#include "AliITSChannelDaSSD.h" +#include "event.h" +#include "AliRawReaderDate.h" #include "AliITSHandleDaSSD.h" using namespace std; @@ -102,9 +103,9 @@ Bool_t GetRunSettings (const char *datafilename, Long_t &eventsnumber, Long_t &s cout << "GetRunSettings : Error new DARawReader(datafilename, 0);" << endl; return kFALSE; } - rawreaderdate->SelectEvents(PHYSICS_EVENT); - while (rawreaderdate->NextEvent()) - { + rawreaderdate->SelectEvents(-1); + while (rawreaderdate->NextEvent()) { + if ((rawreaderdate->GetType() != PHYSICS_EVENT) && (rawreaderdate->GetType() != CALIBRATION_EVENT)) continue; physeventind += 1; datasize = 0; strn = 0; -- 2.43.0