ITSSPDSCANda: The old algorithm (ITSSPDda) updated and with new name.
AliITSCalibrationSPD: Split OCDB entries into SPDDead and SPDNoisy.
Both will use this class.
AliITSOnlineCalibrationSPD: Use online coordinates instead of offline.
AliITSOnlineCalibrationSPDhandler: Reorganization of noisy and dead pixel data.
AliITSPreprocessorSPD: Added code for the new online algorithms.
AliITSRawStreamSPD: Fixed SPD geometry required changes in the online to
offline coordinate conversions. Added static functions to make the conversions
easier and kept in one place only.
(H. Tydesjo)
//
// Modified by D. Elia, G.E. Bruno, H. Tydesjo
// March-April 2006
-// Last mod: H. Tydesjo January 2007
+// Last mod: H. Tydesjo Oct 2007
// September 2007: CouplingRowDefault = 0.055 (was 0.047)
//
///////////////////////////////////////////////////////////////////////////
fCouplCol(fgkCouplColDefault),
fCouplRow(fgkCouplRowDefault),
fBiasVoltage(fgkBiasVoltageDefault),
-fNrDead(0),
-fDeadChannels(0),
-fNrNoisy(0),
-fNoisyChannels(0){
+fNrBad(0),
+fBadChannels(0){
// constructor
SetThresholds(fgkThreshDefault,fgkSigmaDefault);
SetNoiseParam(0.,0.);
SetDataType("simulated");
}
-//_________________________________________________________________________
-
-void AliITSCalibrationSPD::AddDead(UInt_t col, UInt_t row) {
- //
- // Add a dead channel to fDeadChannel array
- //
- fDeadChannels.Set(fNrDead*2+2);
- fDeadChannels.AddAt(col,fNrDead*2);
- fDeadChannels.AddAt(row,fNrDead*2+1);
- fNrDead++;
-}
-//_________________________________________________________________________
-Int_t AliITSCalibrationSPD::GetDeadColAt(UInt_t index) {
- //
- // Returns column of index-th dead channel
- //
- if (index<fNrDead) {
- return fDeadChannels.At(index*2);
- }
- return -1;
-}
-//_________________________________________________________________________
-Int_t AliITSCalibrationSPD::GetDeadRowAt(UInt_t index) {
- //
- // Returns row of index-th dead channel
- //
- if (index<fNrDead) {
- return fDeadChannels.At(index*2+1);
- }
- return -1;
-}
-//_________________________________________________________________________
-Bool_t AliITSCalibrationSPD::IsPixelDead(Int_t col, Int_t row) const {
- //
- // Check if pixel (col,row) is dead
- //
- for (UInt_t i=0; i<fNrDead; i++) {
- if (fDeadChannels.At(i*2)==col && fDeadChannels.At(i*2+1)==row) {
- return true;
- }
- }
- return false;
-}
//____________________________________________________________________________
-void AliITSCalibrationSPD::AddNoisy(UInt_t col, UInt_t row) {
+void AliITSCalibrationSPD::AddBad(UInt_t col, UInt_t row) {
//
- // add noisy pixel
+ // add bad pixel
//
- fDeadChannels.Set(fNrNoisy*2+2);
- fNoisyChannels.AddAt(col,fNrNoisy*2);
- fNoisyChannels.AddAt(row,fNrNoisy*2+1);
- fNrNoisy++;
+ fBadChannels.Set(fNrBad*2+2);
+ fBadChannels.AddAt(col,fNrBad*2);
+ fBadChannels.AddAt(row,fNrBad*2+1);
+ fNrBad++;
}
//____________________________________________________________________________
-Int_t AliITSCalibrationSPD::GetNoisyColAt(UInt_t index) {
+Int_t AliITSCalibrationSPD::GetBadColAt(UInt_t index) {
//
- // Get column of index-th noisy pixel
+ // Get column of index-th bad pixel
//
- if (index<fNrNoisy) {
- return fNoisyChannels.At(index*2);
+ if (index<fNrBad) {
+ return fBadChannels.At(index*2);
}
return -1;
}
//____________________________________________________________________________
-Int_t AliITSCalibrationSPD::GetNoisyRowAt(UInt_t index) {
+Int_t AliITSCalibrationSPD::GetBadRowAt(UInt_t index) {
//
- // Get row of index-th noisy pixel
+ // Get row of index-th bad pixel
//
- if (index<fNrNoisy) {
- return fNoisyChannels.At(index*2+1);
+ if (index<fNrBad) {
+ return fBadChannels.At(index*2+1);
}
return -1;
}
//____________________________________________________________________________
-Bool_t AliITSCalibrationSPD::IsPixelNoisy(Int_t col, Int_t row) const {
+Bool_t AliITSCalibrationSPD::IsPixelBad(Int_t col, Int_t row) const {
//
- // Check if pixel (col,row) is noisy
+ // Check if pixel (col,row) is bad
//
- for (UInt_t i=0; i<fNrNoisy; i++) {
- if (fNoisyChannels.At(i*2)==col && fNoisyChannels.At(i*2+1)==row) {
+ for (UInt_t i=0; i<fNrBad; i++) {
+ if (fBadChannels.At(i*2)==col && fBadChannels.At(i*2+1)==row) {
return true;
}
}
virtual void SetSigmaDiffusionAsymmetry(Double_t ecc) {((AliITSresponseSPD*)fResponse)->SetSigmaDiffusionAsymmetry(ecc);}
virtual void GetSigmaDiffusionAsymmetry(Double_t &ecc) const {((AliITSresponseSPD*)fResponse)->GetSigmaDiffusionAsymmetry(ecc);}
- void AddDead(UInt_t col, UInt_t row);
- Int_t GetNrDead() const {return fNrDead;}
- Int_t GetDeadColAt(UInt_t index); //returns -1 if out of bounds
- Int_t GetDeadRowAt(UInt_t index); //returns -1 if out of bounds
- void ClearDead() {fDeadChannels.Reset(); fNrDead=0;}
- Bool_t IsPixelDead(Int_t col, Int_t row) const ;
+ void AddBad(UInt_t col, UInt_t row);
+ Int_t GetNrBad() const {return fNrBad;}
+ Int_t GetBadColAt(UInt_t index); //returns -1 if out of bounds
+ Int_t GetBadRowAt(UInt_t index); //returns -1 if out of bounds
+ void ClearBad() {fBadChannels.Reset(); fNrBad=0;}
+ Bool_t IsPixelBad(Int_t col, Int_t row) const ;
- void AddNoisy(UInt_t col, UInt_t row);
- Int_t GetNrNoisy() const {return fNrNoisy;}
- Int_t GetNoisyColAt(UInt_t index); //returns -1 if out of bounds
- Int_t GetNoisyRowAt(UInt_t index); //returns -1 if out of bounds
- void ClearNoisy() {fNoisyChannels.Reset(); fNrNoisy=0;}
- Bool_t IsPixelNoisy(Int_t col, Int_t row) const ;
-
- void SetDeadList(TArrayI deadlist) {fDeadChannels=deadlist;}
- void SetNoisyList(TArrayI noisylist) {fNoisyChannels=noisylist;}
- void SetNrDead(UInt_t nr) {fNrDead=nr;}
- void SetNrNoisy(UInt_t nr) {fNrNoisy=nr;}
+ void SetBadList(TArrayI badlist) {fBadChannels=badlist;}
+ void SetNrBad(UInt_t nr) {fNrBad=nr;}
protected:
// static const Double_t fgkDiffCoeffDefault; //default for fDiffCoeff
Double_t fCouplCol; // Coupling parameter along the cols
Double_t fCouplRow; // Coupling parameter along the rows
Double_t fBiasVoltage; // Bias Voltage for the SPD (used to compute DistanceOverVoltage)
- UInt_t fNrDead; // Nr of dead pixels
- TArrayI fDeadChannels; // Array with dead channels info (col0,row0,col1...rowN) N = fNrDead
- UInt_t fNrNoisy; // Nr of noisy pixels
- TArrayI fNoisyChannels; // Array with noisy channels info (col0,row0,col1...rowN) N = fNrNoisy
+ UInt_t fNrBad; // Nr of bad pixels
+ TArrayI fBadChannels; // Array with bad channels info (col0,row0,col1...rowN) N = fNrBad
- ClassDef(AliITSCalibrationSPD,4) // SPD response
+ ClassDef(AliITSCalibrationSPD,5) // SPD response
};
#endif
fCalibration->Clear();
}
- AliCDBEntry *entrySPD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSPD");
+ AliCDBEntry *entrySPD = AliCDBManager::Instance()->Get("ITS/Calib/SPDDead");
AliCDBEntry *entrySDD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSDD");
// AliCDBEntry *entrySSD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSSD");
AliCDBManager::Instance()->SetCacheFlag(isCacheActive);
- AliCDBEntry *entrySPD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSPD", run);
+ AliCDBEntry *entrySPD = AliCDBManager::Instance()->Get("ITS/Calib/SPDDead", run);
AliCDBEntry *entrySDD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSDD", run);
AliCDBEntry *mapASDD = AliCDBManager::Instance()->Get("ITS/Calib/MapsAnodeSDD",run);
AliCDBEntry *mapTSDD = AliCDBManager::Instance()->Get("ITS/Calib/MapsTimeSDD",run);
AliError("AliITSCalibration classes are not defined - nothing done");
return;
}
- AliCDBId idRespSPD("ITS/Calib/CalibSPD",firstRun, lastRun);
+ AliCDBId idRespSPD("ITS/Calib/SPDDead",firstRun, lastRun);
AliCDBId idRespSDD("ITS/Calib/CalibSDD",firstRun, lastRun);
AliCDBId idRespSSD("ITS/Calib/CalibSSD",firstRun, lastRun);
void AliITSIntMap::InitFastAccess(){
// initializes the fast access array
+ if (fFastAccess) return;
ClearFastAccess();
if (fNrEntries>0) {
fFastAccessArray = new AliITSIntMapNode*[fNrEntries];
void AliITSIntMap::InitFastAccessSerialize(){
// initializes the fast access array
+ if (fFastAccessSerialize) return;
ClearFastAccess();
if (fNrEntries>0) {
fFastAccessArray = new AliITSIntMapNode*[fNrEntries];
void PrintEntries() const;
void Balance();
void PrepareSerialize() {InitFastAccessSerialize();}
+ void PrepareSerializeOrdered() {InitFastAccess();}
UInt_t GetTreeHeight() const;
private:
UInt_t fNrEntries; // nr of entries in map
AliITSIntMapNode* fRoot; // link to first node of tree
- Bool_t fFastAccess; // is the array below initialized (key ordered)?
+ Bool_t fFastAccess; // is fast access array initialized (key ordered)?
Bool_t fFastAccessSerialize;// is fast access array initialized (tree ordered)?
AliITSIntMapNode** fFastAccessArray; // array of pointers to nodes
UInt_t fDummyIndex; // dummy index used when traversing tree
ClassImp(AliITSOnlineCalibrationSPD)
AliITSOnlineCalibrationSPD::AliITSOnlineCalibrationSPD():
-fModuleNr(0),
-fNrDead(0),
-fDeadChannels(0),
-fNrNoisy(0),
-fNoisyChannels(0)
+fEqNr(0),
+fNrBad(0),
+fBadChannels(0)
{}
-//_________________________________________________________________________
-void AliITSOnlineCalibrationSPD::AddDead(UInt_t col, UInt_t row) {
- //
- // Add a dead channel to fDeadChannel array
- //
- fDeadChannels.Set(fNrDead*2+2);
- fDeadChannels.AddAt(col,fNrDead*2);
- fDeadChannels.AddAt(row,fNrDead*2+1);
- fNrDead++;
-}
-//_________________________________________________________________________
-Int_t AliITSOnlineCalibrationSPD::GetDeadColAt(UInt_t index) const {
- //
- // Returns column of index-th dead channel
- //
- if (index<fNrDead) {
- return fDeadChannels.At(index*2);
- }
- return -1;
-}
-//_________________________________________________________________________
-Int_t AliITSOnlineCalibrationSPD::GetDeadRowAt(UInt_t index) const {
- //
- // Returns row of index-th dead channel
- //
- if (index<fNrDead) {
- return fDeadChannels.At(index*2+1);
- }
- return -1;
-}
-//_________________________________________________________________________
-Bool_t AliITSOnlineCalibrationSPD::IsPixelDead(Int_t col, Int_t row) const {
- //
- // Check if pixel (col,row) is dead
- //
- for (UInt_t i=0; i<fNrDead; i++) {
- if (fDeadChannels.At(i*2)==col && fDeadChannels.At(i*2+1)==row) {
- return kTRUE;
- }
- }
- return kFALSE;
-}
//____________________________________________________________________________
-void AliITSOnlineCalibrationSPD::AddNoisy(UInt_t col, UInt_t row) {
- //
- // add noisy pixel
- //
- fDeadChannels.Set(fNrNoisy*2+2);
- fNoisyChannels.AddAt(col,fNrNoisy*2);
- fNoisyChannels.AddAt(row,fNrNoisy*2+1);
- fNrNoisy++;
-}
-//____________________________________________________________________________
-Int_t AliITSOnlineCalibrationSPD::GetNoisyColAt(UInt_t index) const {
- //
- // Get column of index-th noisy pixel
- //
- if (index<fNrNoisy) {
- return fNoisyChannels.At(index*2);
+Int_t AliITSOnlineCalibrationSPD::GetKeyAt(UInt_t index) const {
+ // Get key of index-th bad pixel
+ if (index<fNrBad) {
+ return fBadChannels.At(index);
}
return -1;
}
-//____________________________________________________________________________
-Int_t AliITSOnlineCalibrationSPD::GetNoisyRowAt(UInt_t index) const {
- //
- // Get row of index-th noisy pixel
- //
- if (index<fNrNoisy) {
- return fNoisyChannels.At(index*2+1);
- }
- return -1;
-}
-//____________________________________________________________________________
-Bool_t AliITSOnlineCalibrationSPD::IsPixelNoisy(Int_t col, Int_t row) const {
- //
- // Check if pixel (col,row) is noisy
- //
- for (UInt_t i=0; i<fNrNoisy; i++) {
- if (fNoisyChannels.At(i*2)==col && fNoisyChannels.At(i*2+1)==row) {
- return kTRUE;
- }
- }
- return kFALSE;
-}
///////////////////////////////////////////////////////////////////////
// Author: Henrik Tydesjo //
// This class is used as a container to keep the dead and noisy //
-// pixels online. Each object corresponds to one module. //
+// pixels online. Each object corresponds to one DDL (eq). //
// Note: This class should not be used directly. //
// Use it via AliITSOnlineCalibrationSPDhandler instead. //
///////////////////////////////////////////////////////////////////////
AliITSOnlineCalibrationSPD();
virtual ~AliITSOnlineCalibrationSPD() {}
- void SetModuleNr(UInt_t mod) {fModuleNr=mod;}
- UInt_t GetModuleNr() const {return fModuleNr;}
- void SetDeadList(TArrayI deadlist) {fDeadChannels=deadlist;}
- void SetNoisyList(TArrayI noisylist) {fNoisyChannels=noisylist;}
- void SetNrDead(UInt_t nr) {fNrDead=nr;}
- void SetNrNoisy(UInt_t nr) {fNrNoisy=nr;}
-
- void AddDead(UInt_t col, UInt_t row);
- Int_t GetNrDead() const {return fNrDead;}
- Int_t GetDeadColAt(UInt_t index) const; //returns -1 if out of bounds
- Int_t GetDeadRowAt(UInt_t index) const; //returns -1 if out of bounds
- void ClearDead() {fDeadChannels.Reset(); fNrDead=0;}
- Bool_t IsPixelDead(Int_t col, Int_t row) const ;
- void AddNoisy(UInt_t col, UInt_t row);
- Int_t GetNrNoisy() const {return fNrNoisy;}
- Int_t GetNoisyColAt(UInt_t index) const; //returns -1 if out of bounds
- Int_t GetNoisyRowAt(UInt_t index) const; //returns -1 if out of bounds
- void ClearNoisy() {fNoisyChannels.Reset(); fNrNoisy=0;}
- Bool_t IsPixelNoisy(Int_t col, Int_t row) const ;
+ void SetEqNr(UInt_t mod) {fEqNr=mod;}
+ UInt_t GetEqNr() const {return fEqNr;}
+ void SetBadList(TArrayI badlist) {fBadChannels=badlist;}
+ void SetNrBad(UInt_t nr) {fNrBad=nr;}
+
+ UInt_t GetNrBad() const {return fNrBad;}
+ Int_t GetKeyAt(UInt_t index) const; //returns -1 if out of bounds
+
+ void ClearBad() {fBadChannels.Reset(); fNrBad=0;}
private:
- UInt_t fModuleNr; // module nr
- UInt_t fNrDead; // nr of dead pixels
- TArrayI fDeadChannels; // index 0 is nr of dead, then pairs of col and row
- UInt_t fNrNoisy; // nr of noisy pixels
- TArrayI fNoisyChannels; // index 0 is nr of noisy, then pairs of col and row
+ UInt_t fEqNr; // eq nr
+ UInt_t fNrBad; // nr of bad pixels
+ TArrayI fBadChannels; // array of keys for the bad
ClassDef(AliITSOnlineCalibrationSPD,1)
};
-/**************************************************************************
- * 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$ */
-
//////////////////////////////////////////////////////////////////////
// Author: Henrik Tydesjo //
// For easier handling of dead and noisy pixels they are kept in //
#include "AliCDBEntry.h"
#endif
+//____________________________________________________________________________________________
AliITSOnlineCalibrationSPDhandler::AliITSOnlineCalibrationSPDhandler():
- fFileLocation("."),
- fModuleMapInited(kFALSE)
+ fFileLocation(".")
{
// constructor
- for (UInt_t module=0; module<240; module++) {
- fNrDead[module]=0;
- fNrNoisy[module]=0;
- fDeadPixelMap[module] = new AliITSIntMap();
- fNoisyPixelMap[module] = new AliITSIntMap();
+ for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
+ fNrDead[gloChip]=0;
+ fNrNoisy[gloChip]=0;
+ fDeadPixelMap[gloChip] = new AliITSIntMap();
+ fNoisyPixelMap[gloChip] = new AliITSIntMap();
}
}
-
AliITSOnlineCalibrationSPDhandler::AliITSOnlineCalibrationSPDhandler(const AliITSOnlineCalibrationSPDhandler& handle):
- fFileLocation("."),
- fModuleMapInited(kFALSE)
+ fFileLocation(".")
{
// copy constructor
- for (UInt_t module=0; module<240; module++) {
- fNrDead[module] = handle.fNrDead[module];
- fNrNoisy[module] = handle.fNrNoisy[module];
- fDeadPixelMap[module] = handle.fDeadPixelMap[module]->Clone();
- fNoisyPixelMap[module] = handle.fNoisyPixelMap[module]->Clone();
+ for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
+ fNrDead[gloChip] = handle.fNrDead[gloChip];
+ fNrNoisy[gloChip] = handle.fNrNoisy[gloChip];
+ fDeadPixelMap[gloChip] = handle.fDeadPixelMap[gloChip]->Clone();
+ fNoisyPixelMap[gloChip] = handle.fNoisyPixelMap[gloChip]->Clone();
}
fFileLocation = handle.fFileLocation;
}
-
AliITSOnlineCalibrationSPDhandler::~AliITSOnlineCalibrationSPDhandler() {
- ClearMaps();
+ // ClearMaps();
+ for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
+ delete fDeadPixelMap[gloChip];
+ delete fNoisyPixelMap[gloChip];
+ }
}
-
AliITSOnlineCalibrationSPDhandler& AliITSOnlineCalibrationSPDhandler::operator=(const AliITSOnlineCalibrationSPDhandler& handle) {
// assignment operator
if (this!=&handle) {
this->ClearMaps();
- for (UInt_t module=0; module<240; module++) {
- fNrDead[module] = handle.fNrDead[module];
- fNrNoisy[module] = handle.fNrNoisy[module];
- fDeadPixelMap[module] = handle.fDeadPixelMap[module]->Clone();
- fNoisyPixelMap[module] = handle.fNoisyPixelMap[module]->Clone();
+ for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
+ fNrDead[gloChip] = handle.fNrDead[gloChip];
+ fNrNoisy[gloChip] = handle.fNrNoisy[gloChip];
+ fDeadPixelMap[gloChip] = handle.fDeadPixelMap[gloChip]->Clone();
+ fNoisyPixelMap[gloChip] = handle.fNoisyPixelMap[gloChip]->Clone();
}
fFileLocation = handle.fFileLocation;
}
return *this;
}
-
+//____________________________________________________________________________________________
void AliITSOnlineCalibrationSPDhandler::ClearMaps() {
// clear the lists of dead and noisy
ResetDead();
ResetNoisy();
}
-
-Bool_t AliITSOnlineCalibrationSPDhandler::ReadFromFiles() {
- // read dead and noisy files from file location. returns true if at least one file found
- Bool_t returnval=kFALSE;
- for (UInt_t module=0; module<240; module++) {
- if (ReadFromFile(module)) {
- returnval=kTRUE;
- }
+void AliITSOnlineCalibrationSPDhandler::ResetDead() {
+ // reset the dead pixel map
+ for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
+ fNrDead[gloChip]=0;
+ fDeadPixelMap[gloChip]->Clear();
}
- return returnval;
}
-Bool_t AliITSOnlineCalibrationSPDhandler::ReadFromFile(UInt_t module) {
- // read dead and noisy files for module from file location.
- TString fileName = Form("%s/SPD_DeadNoisy_%d.root",fFileLocation.Data(),module);
- return ReadFromFileName(fileName.Data());
+void AliITSOnlineCalibrationSPDhandler::ResetNoisy() {
+ // clear the list of noisy pixels
+ for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
+ fNrNoisy[gloChip]=0;
+ fNoisyPixelMap[gloChip]->Clear();
+ }
}
-Bool_t AliITSOnlineCalibrationSPDhandler::ReadFromFileName(const char *fileName) {
- // read dead and noisy from file fileName
- AliITSOnlineCalibrationSPD* calib;
- FILE* fp0 = fopen(fileName, "r");
- if (fp0 == NULL) {return kFALSE;}
- else {
- fclose(fp0);
- TFile file(fileName, "READ");
- if (file.IsOpen()) {
- file.GetObject("AliITSOnlineCalibrationSPD", calib);
- file.Close();
- if (calib!=NULL) {
- UInt_t module = calib->GetModuleNr();
- Int_t nrDead=calib->GetNrDead();
- for (Int_t index=0; index<nrDead; index++) {
- UInt_t colM=calib->GetDeadColAt(index);
- UInt_t row=calib->GetDeadRowAt(index);
- SetDeadPixelM(module,colM,row);
- }
- Int_t nrNoisy=calib->GetNrNoisy();
- for (Int_t index=0; index<nrNoisy; index++) {
- UInt_t colM=calib->GetNoisyColAt(index);
- UInt_t row=calib->GetNoisyRowAt(index);
- SetNoisyPixelM(module,colM,row);
- }
+void AliITSOnlineCalibrationSPDhandler::ResetDeadForChip(UInt_t eq, UInt_t hs, UInt_t chip) {
+ // clear the dead pixels for this chip
+ UInt_t gloChip = GetGloChip(eq,hs,chip);
+ for (UInt_t col=0; col<32; col++) {
+ for (UInt_t row=0; row<256; row++) {
+ Int_t key = GetKey(eq,hs,chip,col,row);
+ if (fDeadPixelMap[gloChip]->Remove(key)) {
+ fNrDead[gloChip]--;
}
}
}
- return kTRUE;
}
+void AliITSOnlineCalibrationSPDhandler::ResetNoisyForChip(UInt_t eq, UInt_t hs, UInt_t chip) {
+ // clear the noisy pixels for this chip
+ UInt_t gloChip = GetGloChip(eq,hs,chip);
+ if (gloChip>=1200) {
+ Error("AliITSOnlineCalibrationSPDhandler::ResetNoisyForChip","global chip nr (%d) out of bounds\n",gloChip);
+ return;
+ }
+ for (UInt_t col=0; col<32; col++) {
+ for (UInt_t row=0; row<256; row++) {
+ Int_t key = GetKey(eq,hs,chip,col,row);
+ if (fNoisyPixelMap[gloChip]->Remove(key)) {
+ fNrNoisy[gloChip]--;
+ }
+ }
+ }
+}
+void AliITSOnlineCalibrationSPDhandler::ResetDeadForEq(UInt_t eq) {
+ // clear the dead pixels for this eq
+ if (eq>=20) {
+ Error("AliITSOnlineCalibrationSPDhandler::ResetDeadForEq", "eq (%d) out of bounds.",eq);
+ return;
+ }
+ for (UInt_t hs=0; hs<6; hs++) {
+ for (UInt_t chip=0; chip<10; chip++) {
+ ResetDeadForChip(eq, hs, chip);
+ }
+ }
+}
+void AliITSOnlineCalibrationSPDhandler::ResetNoisyForEq(UInt_t eq) {
+ // clear the noisy pixels for this eq
+ if (eq>=20) {
+ Error("AliITSOnlineCalibrationSPDhandler::ResetNoisyForEq", "eq (%d) out of bounds.",eq);
+ return;
+ }
+ for (UInt_t hs=0; hs<6; hs++) {
+ for (UInt_t chip=0; chip<10; chip++) {
+ ResetNoisyForChip(eq, hs, chip);
+ }
+ }
+}
+//____________________________________________________________________________________________
+Bool_t AliITSOnlineCalibrationSPDhandler::ReadFromFiles() {
+ // read dead and noisy files from file location. returns true if at least one file found
+ Bool_t b1 = ReadNoisyFromFiles();
+ Bool_t b2 = ReadDeadFromFiles();
+ return (b1 && b2);
+}
+
Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromFiles() {
// read dead files from file location. returns true if at least one file found
Bool_t returnval=kFALSE;
- for (UInt_t module=0; module<240; module++) {
- if (ReadDeadFromFile(module)) {
+ for (UInt_t eq=0; eq<20; eq++) {
+ if (ReadDeadFromFile(eq)) {
+ returnval=kTRUE;
+ }
+ }
+ return returnval;
+}
+Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromFiles() {
+ // read noisy files from file location. returns true if at least one file found
+ Bool_t returnval=kFALSE;
+ for (UInt_t eq=0; eq<20; eq++) {
+ if (ReadNoisyFromFile(eq)) {
returnval=kTRUE;
}
}
return returnval;
}
-Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromFile(UInt_t module) {
- // read dead for module from file location.
- TString fileName = Form("%s/SPD_DeadNoisy_%d.root",fFileLocation.Data(),module);
+Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromFile(UInt_t eq) {
+ // read dead file for module from file location.
+ TString fileName = Form("%s/SPD_Dead_%d.root",fFileLocation.Data(),eq);
return ReadDeadFromFileName(fileName.Data());
}
+Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromFile(UInt_t eq) {
+ // read noisy file for module from file location.
+ TString fileName = Form("%s/SPD_Noisy_%d.root",fFileLocation.Data(),eq);
+ return ReadNoisyFromFileName(fileName.Data());
+}
Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromFileName(const char *fileName) {
// read dead from file fileName
AliITSOnlineCalibrationSPD* calib;
file.GetObject("AliITSOnlineCalibrationSPD", calib);
file.Close();
if (calib!=NULL) {
- UInt_t module = calib->GetModuleNr();
- Int_t nrDead=calib->GetNrDead();
- for (Int_t index=0; index<nrDead; index++) {
- UInt_t colM=calib->GetDeadColAt(index);
- UInt_t row=calib->GetDeadRowAt(index);
- SetDeadPixelM(module,colM,row);
+ UInt_t nrDead=calib->GetNrBad();
+ for (UInt_t index=0; index<nrDead; index++) {
+ UInt_t key = calib->GetKeyAt(index);
+ UInt_t eq = GetEqIdFromKey(key);
+ UInt_t hs = GetHSFromKey(key);
+ UInt_t chip = GetChipFromKey(key);
+ UInt_t col = GetColFromKey(key);
+ UInt_t row = GetRowFromKey(key);
+ SetDeadPixel(eq,hs,chip,col,row);
}
}
}
}
return kTRUE;
}
-Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromFiles() {
- // read noisy files from file location. returns true if at least one file found
- Bool_t returnval=kFALSE;
- for (UInt_t module=0; module<240; module++) {
- if (ReadNoisyFromFile(module)) {
- returnval=kTRUE;
- }
- }
- return returnval;
-}
-Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromFile(UInt_t module) {
- // read noisy for module from file location.
- TString fileName = Form("%s/SPD_DeadNoisy_%d.root",fFileLocation.Data(),module);
- return ReadNoisyFromFileName(fileName.Data());
-}
Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromFileName(const char *fileName) {
// read noisy from file fileName
AliITSOnlineCalibrationSPD* calib;
file.GetObject("AliITSOnlineCalibrationSPD", calib);
file.Close();
if (calib!=NULL) {
- UInt_t module = calib->GetModuleNr();
- Int_t nrNoisy=calib->GetNrNoisy();
- for (Int_t index=0; index<nrNoisy; index++) {
- UInt_t colM=calib->GetNoisyColAt(index);
- UInt_t row=calib->GetNoisyRowAt(index);
- SetNoisyPixelM(module,colM,row);
+ UInt_t nrNoisy=calib->GetNrBad();
+ for (UInt_t index=0; index<nrNoisy; index++) {
+ UInt_t key = calib->GetKeyAt(index);
+ UInt_t eq = GetEqIdFromKey(key);
+ UInt_t hs = GetHSFromKey(key);
+ UInt_t chip = GetChipFromKey(key);
+ UInt_t col = GetColFromKey(key);
+ UInt_t row = GetRowFromKey(key);
+ SetNoisyPixel(eq,hs,chip,col,row);
}
}
}
}
return kTRUE;
}
-
-
-UInt_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromText(const char *fileName) {
- // read dead from a text file (lines with eqId,hs,chip,col,row). returns nr of pixels added (not already there)
+UInt_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromText(const char *fileName, UInt_t module) {
+ // read dead from a text file (lines with eq,hs,chip,col,row). returns nr of pixels added (not already here)
+ // insert only those pixels that belong to module (or all if module=240).
UInt_t newNrDead=0;
ifstream textFile;
textFile.open(fileName, ifstream::in);
if (textFile.fail()) {
- Error("AliITSOnlineCalibrationSPDhandler::ReadDeadFromText","No noisy text file (%s) present.",fileName);
+ Warning("AliITSOnlineCalibrationSPDhandler::ReadDeadFromText","No dead text file (%s) present.",fileName);
}
else {
while(1) {
- UInt_t eqId,hs,chip,col,row;
- textFile >> eqId; if (textFile.eof()) break;
+ UInt_t eq,hs,chip,col,row;
+ textFile >> eq; if (textFile.eof()) break;
textFile >> hs; if (textFile.eof()) break;
textFile >> chip; if (textFile.eof()) break;
textFile >> col; if (textFile.eof()) break;
textFile >> row;
- if (SetDeadPixel(eqId,hs,chip,col,row)) {
- newNrDead++;
+ if (module==240 || (Int_t)module==AliITSRawStreamSPD::GetModuleNumber(eq,hs,chip)){
+ if (SetDeadPixel(eq,hs,chip,col,row)) {
+ newNrDead++;
+ }
}
if (textFile.eof()) break;
}
}
return newNrDead;
}
-
-UInt_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromText(const char *fileName) {
- // read noisy from a text file (lines with eqId,hs,chip,col,row). returns nr of pixels added (not already here)
+UInt_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromText(const char *fileName, UInt_t module) {
+ // read noisy from a text file (lines with eq,hs,chip,col,row). returns nr of pixels added (not already here)
+ // insert only those pixels that belong to module (or all if module=240).
UInt_t newNrNoisy=0;
ifstream textFile;
textFile.open(fileName, ifstream::in);
if (textFile.fail()) {
- Error("AliITSOnlineCalibrationSPDhandler::ReadNoisyFromText","No noisy text file (%s) present.",fileName);
+ Warning("AliITSOnlineCalibrationSPDhandler::ReadNoisyFromText","No noisy text file (%s) present.",fileName);
}
else {
while(1) {
- UInt_t eqId,hs,chip,col,row;
- textFile >> eqId; if (textFile.eof()) break;
+ UInt_t eq,hs,chip,col,row;
+ textFile >> eq; if (textFile.eof()) break;
textFile >> hs; if (textFile.eof()) break;
textFile >> chip; if (textFile.eof()) break;
textFile >> col; if (textFile.eof()) break;
textFile >> row;
- if (SetNoisyPixel(eqId,hs,chip,col,row)) {
- newNrNoisy++;
+ if (module==240 || (Int_t)module==AliITSRawStreamSPD::GetModuleNumber(eq,hs,chip)){
+ if (SetNoisyPixel(eq,hs,chip,col,row)) {
+ newNrNoisy++;
+ }
}
if (textFile.eof()) break;
}
}
return newNrNoisy;
}
-
-
+//____________________________________________________________________________________________
+void AliITSOnlineCalibrationSPDhandler::WriteToFilesAlways() {
+ // write the lists of dead and noisy to files
+ for (UInt_t eq=0; eq<20; eq++) {
+ WriteDeadToFile(eq);
+ WriteNoisyToFile(eq);
+ }
+}
+UInt_t AliITSOnlineCalibrationSPDhandler::WriteToFiles() {
+ // write the lists of dead and noisy to files (only if there are >0 dead or noisy pixels) , returns nr of files produced
+ return (WriteNoisyToFiles() + WriteDeadToFiles());
+}
+void AliITSOnlineCalibrationSPDhandler::WriteDeadToFilesAlways() {
+ // write the lists of dead to files
+ for (UInt_t eq=0; eq<20; eq++) {
+ WriteDeadToFile(eq);
+ }
+}
+void AliITSOnlineCalibrationSPDhandler::WriteNoisyToFilesAlways() {
+ // write the lists of noisy to files
+ for (UInt_t eq=0; eq<20; eq++) {
+ WriteNoisyToFile(eq);
+ }
+}
+UInt_t AliITSOnlineCalibrationSPDhandler::WriteDeadToFiles() {
+ // write the list of dead to file (only if there are >0 dead pixels) , returns nr of files produced
+ UInt_t nrFiles=0;
+ for (UInt_t eq=0; eq<20; eq++) {
+ if (GetNrDeadEq(eq) > 0) {
+ WriteDeadToFile(eq);
+ nrFiles++;
+ }
+ }
+ return nrFiles;
+}
+UInt_t AliITSOnlineCalibrationSPDhandler::WriteNoisyToFiles() {
+ // write the list of noisy to file (only if there are >0 noisy pixels) , returns nr of files produced
+ UInt_t nrFiles=0;
+ for (UInt_t eq=0; eq<20; eq++) {
+ if (GetNrNoisyEq(eq) > 0) {
+ WriteNoisyToFile(eq);
+ nrFiles++;
+ }
+ }
+ return nrFiles;
+}
+void AliITSOnlineCalibrationSPDhandler::WriteDeadToFile(UInt_t eq) {
+ // write the lists of dead and noisy for module to file
+ AliITSOnlineCalibrationSPD* calib = new AliITSOnlineCalibrationSPD();
+ calib->SetEqNr(eq);
+ calib->SetBadList(GetDeadArrayOnline(eq));
+ calib->SetNrBad(GetNrDeadEq(eq));
+ TString fileName = Form("%s/SPD_Dead_%d.root",fFileLocation.Data(),eq);
+ TFile file(fileName.Data(), "RECREATE");
+ file.WriteTObject(calib, "AliITSOnlineCalibrationSPD");
+ file.Close();
+ delete calib;
+}
+void AliITSOnlineCalibrationSPDhandler::WriteNoisyToFile(UInt_t eq) {
+ // write the lists of noisy and noisy for module to file
+ AliITSOnlineCalibrationSPD* calib = new AliITSOnlineCalibrationSPD();
+ calib->SetEqNr(eq);
+ calib->SetBadList(GetNoisyArrayOnline(eq));
+ calib->SetNrBad(GetNrNoisyEq(eq));
+ TString fileName = Form("%s/SPD_Noisy_%d.root",fFileLocation.Data(),eq);
+ TFile file(fileName.Data(), "RECREATE");
+ file.WriteTObject(calib, "AliITSOnlineCalibrationSPD");
+ file.Close();
+ delete calib;
+}
+//____________________________________________________________________________________________
#ifndef SPD_DA_OFF
-Bool_t AliITSOnlineCalibrationSPDhandler::ReadModuleFromDB(UInt_t module, Int_t runNr) {
- // reads dead and noisy pixels from DB for given module and runNr
+Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadModuleFromDB(UInt_t module, Int_t runNr, Bool_t treeSerial) {
+ // reads dead pixels from DB for given module and runNr
AliCDBManager* man = AliCDBManager::Instance();
if(!man->IsDefaultStorageSet()) {
man->SetDefaultStorage("local://$ALICE_ROOT");
}
- AliCDBEntry *cdbEntry = man->Get("ITS/Calib/CalibSPD", runNr);
+ AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDDead", runNr);
TObjArray* spdEntry;
if(cdbEntry) {
spdEntry = (TObjArray*)cdbEntry->GetObject();
if(!spdEntry) return kFALSE;
}
else {
- Warning("AliITSOnlineCalibrationSPDhandler::ReadModuleFromDB","Calibration for run %d not found in database.",runNr);
+ Warning("AliITSOnlineCalibrationSPDhandler::ReadDeadModuleFromDB","Calibration for run %d not found in database.",runNr);
return kFALSE;
}
AliITSCalibrationSPD* calibSPD;
calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
- UInt_t nrDead = calibSPD->GetNrDead();
- for (UInt_t index=0; index<nrDead; index++) {
- UInt_t colM = calibSPD->GetDeadColAt(index);
- UInt_t row = calibSPD->GetDeadRowAt(index);
- SetDeadPixelM(module,colM,row);
- }
- UInt_t nrNoisy = calibSPD->GetNrNoisy();
- for (UInt_t index=0; index<nrNoisy; index++) {
- UInt_t colM = calibSPD->GetNoisyColAt(index);
- UInt_t row = calibSPD->GetNoisyRowAt(index);
- SetNoisyPixelM(module,colM,row);
+ UInt_t nrDead = calibSPD->GetNrBad();
+ if (nrDead>0) {
+ if (!treeSerial) RecursiveInsertDead(calibSPD,module,0,nrDead-1);
+ else {
+ for (UInt_t index=0; index<nrDead; index++) {
+ UInt_t colM = calibSPD->GetBadColAt(index);
+ UInt_t rowM = calibSPD->GetBadRowAt(index);
+ SetDeadPixelM(module,colM,rowM);
+ }
+ }
}
spdEntry->SetOwner(kTRUE);
spdEntry->Clear();
return kTRUE;
}
-
-Bool_t AliITSOnlineCalibrationSPDhandler::ReadFromDB(Int_t runNr) {
+Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyModuleFromDB(UInt_t module, Int_t runNr, Bool_t treeSerial) {
+ // reads noisy pixels from DB for given module and runNr
+ AliCDBManager* man = AliCDBManager::Instance();
+ if(!man->IsDefaultStorageSet()) {
+ man->SetDefaultStorage("local://$ALICE_ROOT");
+ }
+ AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDNoisy", runNr);
+ TObjArray* spdEntry;
+ if(cdbEntry) {
+ spdEntry = (TObjArray*)cdbEntry->GetObject();
+ if(!spdEntry) return kFALSE;
+ }
+ else {
+ Warning("AliITSOnlineCalibrationSPDhandler::ReadNoisyModuleFromDB","Calibration for run %d not found in database.",runNr);
+ return kFALSE;
+ }
+ AliITSCalibrationSPD* calibSPD;
+ calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
+ UInt_t nrNoisy = calibSPD->GetNrBad();
+ if (nrNoisy>0) {
+ if (!treeSerial) RecursiveInsertNoisy(calibSPD,module,0,nrNoisy-1);
+ else {
+ for (UInt_t index=0; index<nrNoisy; index++) {
+ UInt_t colM = calibSPD->GetBadColAt(index);
+ UInt_t rowM = calibSPD->GetBadRowAt(index);
+ SetNoisyPixelM(module,colM,rowM);
+ }
+ }
+ }
+ spdEntry->SetOwner(kTRUE);
+ spdEntry->Clear();
+ return kTRUE;
+}
+Bool_t AliITSOnlineCalibrationSPDhandler::ReadFromDB(Int_t runNr, Bool_t treeSerial) {
// reads dead and noisy pixels from DB for given runNr
// note that you may want to clear the lists (if they are not empty) before reading
+ return (ReadNoisyFromDB(runNr,treeSerial) && ReadDeadFromDB(runNr,treeSerial));
+}
+Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromDB(Int_t runNr, Bool_t treeSerial) {
+ // reads dead pixels from DB for given runNr
+ // note that you may want to clear the list (if it is not empty) before reading
AliCDBManager* man = AliCDBManager::Instance();
if(!man->IsDefaultStorageSet()) {
man->SetDefaultStorage("local://$ALICE_ROOT");
}
- AliCDBEntry *cdbEntry = man->Get("ITS/Calib/CalibSPD", runNr);
+ AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDDead", runNr);
TObjArray* spdEntry;
if(cdbEntry) {
spdEntry = (TObjArray*)cdbEntry->GetObject();
if(!spdEntry) return kFALSE;
}
else {
- Warning("AliITSOnlineCalibrationSPDhandler::ReadFromDB","Calibration for run %d not found in database.",runNr);
+ Warning("AliITSOnlineCalibrationSPDhandler::ReadDeadFromDB","Calibration for run %d not found in database.",runNr);
return kFALSE;
}
AliITSCalibrationSPD* calibSPD;
for (UInt_t module=0; module<240; module++) {
// printf("Reading module %d\n",module);
calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
- UInt_t nrDead = calibSPD->GetNrDead();
- for (UInt_t index=0; index<nrDead; index++) {
- UInt_t colM = calibSPD->GetDeadColAt(index);
- UInt_t row = calibSPD->GetDeadRowAt(index);
- SetDeadPixelM(module,colM,row);
+ UInt_t nrDead = calibSPD->GetNrBad();
+ if (nrDead>0) {
+ if (!treeSerial) RecursiveInsertDead(calibSPD,module,0,nrDead-1);
+ else {
+ for (UInt_t index=0; index<nrDead; index++) {
+ UInt_t colM = calibSPD->GetBadColAt(index);
+ UInt_t rowM = calibSPD->GetBadRowAt(index);
+ SetDeadPixelM(module,colM,rowM);
+ }
+ }
}
- UInt_t nrNoisy = calibSPD->GetNrNoisy();
- for (UInt_t index=0; index<nrNoisy; index++) {
- UInt_t colM = calibSPD->GetNoisyColAt(index);
- UInt_t row = calibSPD->GetNoisyRowAt(index);
- SetNoisyPixelM(module,colM,row);
+ }
+ spdEntry->SetOwner(kTRUE);
+ spdEntry->Clear();
+ return kTRUE;
+}
+Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromDB(Int_t runNr, Bool_t treeSerial) {
+ // reads noisy pixels from DB for given runNr
+ // note that you may want to clear the list (if it is not empty) before reading
+ AliCDBManager* man = AliCDBManager::Instance();
+ if(!man->IsDefaultStorageSet()) {
+ man->SetDefaultStorage("local://$ALICE_ROOT");
+ }
+ AliCDBEntry *cdbEntry = man->Get("ITS/Calib/SPDNoisy", runNr);
+ TObjArray* spdEntry;
+ if(cdbEntry) {
+ spdEntry = (TObjArray*)cdbEntry->GetObject();
+ if(!spdEntry) return kFALSE;
+ }
+ else {
+ Warning("AliITSOnlineCalibrationSPDhandler::ReadNoisyFromDB","Calibration for run %d not found in database.",runNr);
+ return kFALSE;
+ }
+ AliITSCalibrationSPD* calibSPD;
+ for (UInt_t module=0; module<240; module++) {
+ // printf("Reading module %d\n",module);
+ calibSPD = (AliITSCalibrationSPD*) spdEntry->At(module);
+ UInt_t nrNoisy = calibSPD->GetNrBad();
+ if (nrNoisy>0) {
+ if (!treeSerial) {
+ printf("*** mod %d nrnoisy=%d\n",module,nrNoisy);
+ RecursiveInsertNoisy(calibSPD,module,0,nrNoisy-1);
+ }
+ else {
+ for (UInt_t index=0; index<nrNoisy; index++) {
+ UInt_t colM = calibSPD->GetBadColAt(index);
+ UInt_t rowM = calibSPD->GetBadRowAt(index);
+ SetNoisyPixelM(module,colM,rowM);
+ }
+ }
}
}
spdEntry->SetOwner(kTRUE);
spdEntry->Clear();
return kTRUE;
}
-
+Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromCalibObj(TObjArray* calObj) {
+ // reads dead pixels from calib object
+ for (UInt_t module=0; module<240; module++) {
+ for (Int_t i=0; i<((AliITSCalibrationSPD*)calObj->At(module))->GetNrBad(); i++) {
+ SetDeadPixelM(module,
+ ((AliITSCalibrationSPD*)calObj->At(module))->GetBadColAt(i),
+ ((AliITSCalibrationSPD*)calObj->At(module))->GetBadRowAt(i));
+ }
+ }
+ return kTRUE;
+}
+Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromCalibObj(TObjArray* calObj) {
+ // reads noisy pixels from calib object
+ for (UInt_t module=0; module<240; module++) {
+ for (Int_t i=0; i<((AliITSCalibrationSPD*)calObj->At(module))->GetNrBad(); i++) {
+ SetNoisyPixelM(module,
+ ((AliITSCalibrationSPD*)calObj->At(module))->GetBadColAt(i),
+ ((AliITSCalibrationSPD*)calObj->At(module))->GetBadRowAt(i));
+ }
+ }
+ return kTRUE;
+}
Bool_t AliITSOnlineCalibrationSPDhandler::WriteToDB(Int_t runNrStart, Int_t runNrEnd) {
- // writes dead and noisy pixels to DB for given runNr
+ // writes dead and noisy pixels to DB for given runNrs
+ // overwrites any previous entries
+ return (WriteNoisyToDB(runNrStart,runNrEnd) && WriteDeadToDB(runNrStart,runNrEnd));
+}
+Bool_t AliITSOnlineCalibrationSPDhandler::WriteDeadToDB(Int_t runNrStart, Int_t runNrEnd) {
+ // writes dead pixels to DB for given runNrs
// overwrites any previous entries
AliCDBManager* man = AliCDBManager::Instance();
if(!man->IsDefaultStorageSet()) {
AliCDBMetaData* metaData = new AliCDBMetaData();
metaData->SetResponsible("Henrik Tydesjo");
metaData->SetComment("Created by AliITSOnlineCalibrationSPDhandler.");
- AliCDBId idCalSPD("ITS/Calib/CalibSPD",runNrStart,runNrEnd);
+ AliCDBId idCalSPD("ITS/Calib/SPDDead",runNrStart,runNrEnd);
TObjArray* spdEntry = new TObjArray(240);
spdEntry->SetOwner(kTRUE);
for(UInt_t module=0; module<240; module++){
calObj->SetThresholds(3000, 250);
calObj->SetBiasVoltage(18.182);
calObj->SetNoiseParam(0,0);
- // CouplingRaw changed to 0.055 (fine tuning), was 0.047 in PDC06
calObj->SetCouplingParam(0.,0.055);
// *** remove later...
// ************************************************************
spdEntry->Add(calObj);
}
for(UInt_t module=0; module<240; module++){
- ((AliITSCalibrationSPD*) spdEntry->At(module)) -> SetNrDead( GetNrDead(module) );
- ((AliITSCalibrationSPD*) spdEntry->At(module)) -> SetDeadList( GetDeadArray(module) );
- ((AliITSCalibrationSPD*) spdEntry->At(module)) -> SetNrNoisy( GetNrNoisy(module) );
- ((AliITSCalibrationSPD*) spdEntry->At(module)) -> SetNoisyList( GetNoisyArray(module) );
+ ((AliITSCalibrationSPD*) spdEntry->At(module)) -> SetNrBad( GetNrDead(module) );
+ ((AliITSCalibrationSPD*) spdEntry->At(module)) -> SetBadList( GetDeadArray(module) );
}
AliCDBEntry* cdbEntry = new AliCDBEntry((TObject*)spdEntry,idCalSPD,metaData);
man->Put(cdbEntry);
delete metaData;
return kTRUE;
}
-#endif
+Bool_t AliITSOnlineCalibrationSPDhandler::WriteNoisyToDB(Int_t runNrStart, Int_t runNrEnd) {
+ // writes noisy pixels to DB for given runNrs
+ // overwrites any previous entries
+ AliCDBManager* man = AliCDBManager::Instance();
+ if(!man->IsDefaultStorageSet()) {
+ man->SetDefaultStorage("local://$ALICE_ROOT");
+ }
+ AliCDBMetaData* metaData = new AliCDBMetaData();
+ metaData->SetResponsible("Henrik Tydesjo");
+ metaData->SetComment("Created by AliITSOnlineCalibrationSPDhandler.");
+ AliCDBId idCalSPD("ITS/Calib/SPDNoisy",runNrStart,runNrEnd);
+ TObjArray* spdEntry = new TObjArray(240);
+ spdEntry->SetOwner(kTRUE);
+ for(UInt_t module=0; module<240; module++){
+ AliITSCalibrationSPD* calObj = new AliITSCalibrationSPD();
-void AliITSOnlineCalibrationSPDhandler::WriteToFilesAlways() {
- // write the lists of dead and noisy to files (only if there are >0 dead or noisy pixels)
- for (UInt_t module=0; module<240; module++) {
- WriteToFile(module);
+ // *** this is temporarily hard coded here ********************
+ // (later these parameters will be separated from the cal.obj.)
+ calObj->SetThresholds(3000, 250);
+ calObj->SetBiasVoltage(18.182);
+ calObj->SetNoiseParam(0,0);
+ calObj->SetCouplingParam(0.,0.055);
+ // *** remove later...
+ // ************************************************************
+
+ spdEntry->Add(calObj);
}
-}
-void AliITSOnlineCalibrationSPDhandler::WriteToFiles() {
- // write the lists of dead and noisy to files (only if there are >0 dead or noisy pixels)
- for (UInt_t module=0; module<240; module++) {
- if (fNrDead[module]+fNrNoisy[module] > 0) {
- WriteToFile(module);
- }
+ for(UInt_t module=0; module<240; module++){
+ ((AliITSCalibrationSPD*) spdEntry->At(module)) -> SetNrBad( GetNrNoisy(module) );
+ ((AliITSCalibrationSPD*) spdEntry->At(module)) -> SetBadList( GetNoisyArray(module) );
}
+ AliCDBEntry* cdbEntry = new AliCDBEntry((TObject*)spdEntry,idCalSPD,metaData);
+ man->Put(cdbEntry);
+ delete spdEntry;
+ delete cdbEntry;
+ delete metaData;
+ return kTRUE;
}
-void AliITSOnlineCalibrationSPDhandler::WriteToFile(UInt_t module) {
- // write the lists of dead and noisy for module to file
- AliITSOnlineCalibrationSPD* calib = new AliITSOnlineCalibrationSPD();
- calib->SetModuleNr(module);
- calib->SetDeadList(GetDeadArray(module));
- calib->SetNoisyList(GetNoisyArray(module));
- calib->SetNrDead(GetNrDead(module));
- calib->SetNrNoisy(GetNrNoisy(module));
- TString fileName = Form("%s/SPD_DeadNoisy_%d.root",fFileLocation.Data(),module);
- TFile file(fileName.Data(), "RECREATE");
- file.WriteTObject(calib, "AliITSOnlineCalibrationSPD");
- file.Close();
- delete calib;
+//____________________________________________________________________________________________
+void AliITSOnlineCalibrationSPDhandler::RecursiveInsertDead(AliITSCalibrationSPD* calibSPD, UInt_t module, Int_t lowInd, Int_t highInd) {
+ // inserts dead pixels recursively, used when reading from db
+ if (lowInd>highInd) return;
+ Int_t thisInd = lowInd+(highInd-lowInd)/2;
+ SetDeadPixelM(module,calibSPD->GetBadColAt(thisInd),calibSPD->GetBadRowAt(thisInd));
+ RecursiveInsertDead(calibSPD,module,lowInd,thisInd-1);
+ RecursiveInsertDead(calibSPD,module,thisInd+1,highInd);
+}
+void AliITSOnlineCalibrationSPDhandler::RecursiveInsertNoisy(AliITSCalibrationSPD* calibSPD, UInt_t module, Int_t lowInd, Int_t highInd) {
+ // inserts noisy pixels recursively, used when reading from db
+ printf("Rec mod %d : %d,%d\n",module,lowInd,highInd);
+ if (lowInd>highInd) return;
+ Int_t thisInd = lowInd+(highInd-lowInd)/2;
+ SetNoisyPixelM(module,calibSPD->GetBadColAt(thisInd),calibSPD->GetBadRowAt(thisInd));
+ RecursiveInsertNoisy(calibSPD,module,lowInd,thisInd-1);
+ RecursiveInsertNoisy(calibSPD,module,thisInd+1,highInd);
}
-void AliITSOnlineCalibrationSPDhandler::WriteDeadToFiles() {
- // write the lists of dead to files (only if there are >0 dead pixels)
+
+#endif
+//____________________________________________________________________________________________
+void AliITSOnlineCalibrationSPDhandler::GenerateDCSConfigFile(const Char_t* fileName) {
+ // generates an ascii file in the format as the one produced by online da (but with dummy runNr=0)
+ ofstream dcsfile;
+ dcsfile.open(fileName);
+ dcsfile << "[SPD SCAN]\n";
+ dcsfile << "RunNumber=" << "0" << "\n"; // dummy value
+ dcsfile << "Type=" << "4" << "\n";
+ dcsfile << "Router=" << "0" << "\n"; // dummy value
+ dcsfile << "ActualDetCoonfiguration=" << "0,-1,-1\n"; // dummy values
+ dcsfile << "[NOISY]\n";
for (UInt_t module=0; module<240; module++) {
- if (fNrDead[module] > 0) {
- WriteDeadToFile(module);
+ UInt_t headkey=20*10*6;
+ for (UInt_t ind=0; ind<GetNrNoisy(module); ind++) {
+ UInt_t newkey = GetNoisyEqIdAt(module,ind)*10*6 +
+ GetNoisyHSAt(module,ind)*10 +
+ GetNoisyChipAt(module,ind);
+ if (newkey!=headkey) { // print eq,hs,chip header
+ headkey = newkey;
+ dcsfile << "-" << newkey/(6*10) << "," << (newkey%(6*10))/10 << "," << (newkey%(6*10))%10 << "\n";
+ }
+ dcsfile << GetNoisyColAt(module,ind) << "," << GetNoisyRowAt(module,ind) << "\n";
}
}
+ dcsfile.close();
}
-void AliITSOnlineCalibrationSPDhandler::WriteDeadToFile(UInt_t module) {
- // write the lists of dead for module to file
- AliITSOnlineCalibrationSPD* calib = new AliITSOnlineCalibrationSPD();
- calib->SetModuleNr(module);
- calib->SetDeadList(GetDeadArray(module));
- calib->SetNrDead(GetNrDead(module));
- TString fileName = Form("%s/SPD_DeadNoisy_%d.root",fFileLocation.Data(),module);
- TFile file(fileName.Data(), "RECREATE");
- file.WriteTObject(calib, "AliITSOnlineCalibrationSPD");
- file.Close();
- delete calib;
-}
-void AliITSOnlineCalibrationSPDhandler::WriteNoisyToFiles() {
- // write the lists of noisy to files (only if there are >0 dead pixels)
- for (UInt_t module=0; module<240; module++) {
- if (fNrNoisy[module] > 0) {
- printf("writing noisy to file for module %d\n",module);
- WriteNoisyToFile(module);
+//____________________________________________________________________________________________
+TArrayI AliITSOnlineCalibrationSPDhandler::GetDeadArray(UInt_t module, Bool_t treeSerial) {
+ // get a TArrayI of the dead pixels (format for the AliITSCalibrationSPD object)
+ TArrayI returnArray;
+
+ UInt_t eq = GetEqIdFromOffline(module);
+ UInt_t hs = GetHSFromOffline(module);
+ UInt_t size=0;
+ for (UInt_t chip=0; chip<5; chip++) {
+ UInt_t gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,chip*32));
+ size += fNrDead[gloChip];
+ }
+ returnArray.Set(size*2);
+ UInt_t gloIndex=0;
+ for (UInt_t chip=0; chip<5; chip++) {
+ UInt_t gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,chip*32));
+ if (treeSerial) fDeadPixelMap[gloChip]->PrepareSerialize(); // for tree ordered values
+ else fDeadPixelMap[gloChip]->PrepareSerializeOrdered(); // for key ordered values
+ for (UInt_t index=0; index<fNrDead[gloChip]; index++) {
+ Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
+ Int_t colM = GetColMFromKey(key);
+ Int_t rowM = GetRowMFromKey(key);
+ returnArray.AddAt(colM,gloIndex*2);
+ returnArray.AddAt(rowM,gloIndex*2+1);
+ gloIndex++;
}
}
+ return returnArray;
}
-void AliITSOnlineCalibrationSPDhandler::WriteNoisyToFile(UInt_t module) {
- // write the lists of noisy for module to file
- AliITSOnlineCalibrationSPD* calib = new AliITSOnlineCalibrationSPD();
- calib->SetModuleNr(module);
- calib->SetNoisyList(GetNoisyArray(module));
- calib->SetNrNoisy(GetNrNoisy(module));
- TString fileName = Form("%s/SPD_DeadNoisy_%d.root",fFileLocation.Data(),module);
- TFile file(fileName.Data(), "RECREATE");
- file.WriteTObject(calib, "AliITSOnlineCalibrationSPD");
- file.Close();
- delete calib;
-}
-
-TArrayI AliITSOnlineCalibrationSPDhandler::GetDeadArray(UInt_t module) {
- // get a TArrayI of the dead pixels (format for the AliITSCalibrationSPD object)
+TArrayI AliITSOnlineCalibrationSPDhandler::GetNoisyArray(UInt_t module, Bool_t treeSerial) {
+ // get a TArrayI of the noisy pixels (format for the AliITSCalibrationSPD object)
TArrayI returnArray;
- returnArray.Set(GetNrDead(module)*2);
- fDeadPixelMap[module]->PrepareSerialize(); // for tree ordered values
- for (UInt_t index=0; index<GetNrDead(module); index++) {
- Int_t key = fDeadPixelMap[module]->GetKeyIndex(index);
- Int_t colM = GetColMFromKey(key);
- Int_t row = GetRowFromKey(key);
- returnArray.AddAt(colM,index*2);
- returnArray.AddAt(row,index*2+1);
+
+ UInt_t eq = GetEqIdFromOffline(module);
+ UInt_t hs = GetHSFromOffline(module);
+ UInt_t size=0;
+ for (UInt_t chip=0; chip<5; chip++) {
+ UInt_t gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,chip*32));
+ size += fNrNoisy[gloChip];
+ }
+ returnArray.Set(size*2);
+ UInt_t gloIndex=0;
+ for (UInt_t chip=0; chip<5; chip++) {
+ UInt_t gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,chip*32));
+ if (treeSerial) fNoisyPixelMap[gloChip]->PrepareSerialize(); // for tree ordered values
+ else fNoisyPixelMap[gloChip]->PrepareSerializeOrdered(); // for key ordered values
+ for (UInt_t index=0; index<fNrNoisy[gloChip]; index++) {
+ Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
+ Int_t colM = GetColMFromKey(key);
+ Int_t rowM = GetRowMFromKey(key);
+ returnArray.AddAt(colM,gloIndex*2);
+ returnArray.AddAt(rowM,gloIndex*2+1);
+ gloIndex++;
+ }
}
return returnArray;
}
-TArrayI AliITSOnlineCalibrationSPDhandler::GetNoisyArray(UInt_t module) {
- // get a TArrayI of the noisy pixels (format for the AliITSCalibrationSPD object)
+TArrayI AliITSOnlineCalibrationSPDhandler::GetDeadArrayOnline(UInt_t eq) {
+ // get a TArrayI of the dead pixels (format for the AliITSOnlineCalibrationSPD object)
TArrayI returnArray;
- returnArray.Set(GetNrNoisy(module)*2);
- fNoisyPixelMap[module]->PrepareSerialize(); // for tree ordered values
- for (UInt_t index=0; index<GetNrNoisy(module); index++) {
- Int_t key = fNoisyPixelMap[module]->GetKeyIndex(index);
- Int_t colM = GetColMFromKey(key);
- Int_t row = GetRowFromKey(key);
- returnArray.AddAt(colM,index*2);
- returnArray.AddAt(row,index*2+1);
+ // fix size of array
+ UInt_t size=0;
+ for (UInt_t hs=0; hs<6; hs++) {
+ for (UInt_t chip=0; chip<10; chip++) {
+ UInt_t gloChip = GetGloChip(eq,hs,chip);
+ size+=fNrDead[gloChip];
+ }
+ }
+ returnArray.Set(size);
+ // put keys in array
+ UInt_t gloIndex=0;
+ for (UInt_t hs=0; hs<6; hs++) {
+ for (UInt_t chip=0; chip<10; chip++) {
+ UInt_t gloChip = GetGloChip(eq,hs,chip);
+ fDeadPixelMap[gloChip]->PrepareSerialize(); // for tree ordered values
+ for (UInt_t index=0; index<fNrDead[gloChip]; index++) {
+ Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
+ returnArray.AddAt(key,gloIndex);
+ gloIndex++;
+ }
+ }
}
return returnArray;
}
-
-void AliITSOnlineCalibrationSPDhandler::ResetDead() {
- // reset the dead pixel map
- for (UInt_t module=0; module<240; module++) {
- fNrDead[module]=0;
- fDeadPixelMap[module]->Clear();
+TArrayI AliITSOnlineCalibrationSPDhandler::GetNoisyArrayOnline(UInt_t eq) {
+ // get a TArrayI of the noisy pixels (format for the AliITSOnlineCalibrationSPD object)
+ TArrayI returnArray;
+ // fix size of array
+ UInt_t size=0;
+ for (UInt_t hs=0; hs<6; hs++) {
+ for (UInt_t chip=0; chip<10; chip++) {
+ UInt_t gloChip = GetGloChip(eq,hs,chip);
+ size+=fNrNoisy[gloChip];
+ }
}
-}
-
-void AliITSOnlineCalibrationSPDhandler::ResetDeadForChip(UInt_t eqId, UInt_t hs, UInt_t chip) {
- // clear the noisy pixels for this chip
- UInt_t module = AliITSRawStreamSPD::GetModuleNumber(eqId,hs,chip);
- for (UInt_t col=0; col<32; col++) {
- for (UInt_t row=0; row<256; row++) {
- Int_t key = GetKey(eqId,hs,chip,col,row);
- if (fDeadPixelMap[module]->Remove(key)) {
- fNrDead[module]--;
+ returnArray.Set(size);
+ // put keys in array
+ UInt_t gloIndex=0;
+ for (UInt_t hs=0; hs<6; hs++) {
+ for (UInt_t chip=0; chip<10; chip++) {
+ UInt_t gloChip = GetGloChip(eq,hs,chip);
+ fNoisyPixelMap[gloChip]->PrepareSerialize(); // for tree ordered values
+ for (UInt_t index=0; index<fNrNoisy[gloChip]; index++) {
+ Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
+ returnArray.AddAt(key,gloIndex);
+ gloIndex++;
}
}
}
+ return returnArray;
}
-
-Bool_t AliITSOnlineCalibrationSPDhandler::SetDeadPixel(UInt_t eqId, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) {
- // set a dead pixel, returns false if pixel is already dead
- UInt_t module = AliITSRawStreamSPD::GetModuleNumber(eqId,hs,chip);
- Int_t key = GetKey(eqId,hs,chip,col,row);
-//!!! // if noisy we dont want to add it...
-//!!! if (fNoisyPixelMap[module]->Find(key) != NULL) return kFALSE;
- if (fDeadPixelMap[module]->Insert(key,module)) {
- fNrDead[module]++;
- return kTRUE;
+//____________________________________________________________________________________________
+void AliITSOnlineCalibrationSPDhandler::PrintEqSummary() {
+// print summary (nr of dead and noisy) for each equipment
+ printf("-----------\n");
+ printf("Eq summary:\n");
+ printf("-----------\n");
+ for (UInt_t eq=0; eq<20; eq++) {
+ printf("Eq %*d: %*d dead , %*d noisy\n",2,eq,5,GetNrDeadEq(eq),5,GetNrNoisyEq(eq));
}
- return kFALSE;
}
+void AliITSOnlineCalibrationSPDhandler::PrintDead() const {
+ // print the dead pixels to screen
+ printf("------------------------------------------------------\n");
+ printf("Dead Pixels: (eq,hs,chip,col,row | module,colM,rowM)\n");
+ printf("------------------------------------------------------\n");
+ for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
+ for (UInt_t index=0; index<fNrDead[gloChip]; index++) {
+ Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
+ UInt_t eq = GetEqIdFromKey(key);
+ UInt_t hs = GetHSFromKey(key);
+ UInt_t chip = GetChipFromKey(key);
+ UInt_t col = GetColFromKey(key);
+ UInt_t row = GetRowFromKey(key);
-Bool_t AliITSOnlineCalibrationSPDhandler::SetDeadPixelM(UInt_t module, UInt_t colM, UInt_t row) {
- // set a dead pixel, returns false if pixel is already dead
- UInt_t eqId = GetEqIdFromOffline(module);
- UInt_t hs = GetHSFromOffline(module);
- UInt_t chip = GetChipFromOffline(module,colM);
- UInt_t col = GetColFromOffline(colM);
- Int_t key = GetKey(eqId,hs,chip,col,row);
-//!!! // if noisy we dont want to add it...
-//!!! if (fNoisyPixelMap[module]->Find(key) != NULL) return kFALSE;
- if (fDeadPixelMap[module]->Insert(key,module)) {
- fNrDead[module]++;
- return kTRUE;
+ UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
+ UInt_t colM = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,col);
+ UInt_t rowM = AliITSRawStreamSPD::GetOfflineRowFromOnline(eq,hs,chip,row);
+
+ printf("%*d,%*d,%*d,%*d,%*d | %*d,%*d,%*d\n",2,eq,1,hs,1,chip,2,col,3,row,3,module,3,colM,3,rowM);
+ }
}
- return kFALSE;
}
+void AliITSOnlineCalibrationSPDhandler::PrintNoisy() const {
+ // print the dead pixels to screen
+ printf("-------------------------------------------------------\n");
+ printf("Noisy Pixels: (eq,hs,chip,col,row | module,colM,rowM)\n");
+ printf("-------------------------------------------------------\n");
+ for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
+ for (UInt_t index=0; index<fNrNoisy[gloChip]; index++) {
+ Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
+ UInt_t eq = GetEqIdFromKey(key);
+ UInt_t hs = GetHSFromKey(key);
+ UInt_t chip = GetChipFromKey(key);
+ UInt_t col = GetColFromKey(key);
+ UInt_t row = GetRowFromKey(key);
-Bool_t AliITSOnlineCalibrationSPDhandler::UnSetDeadPixel(UInt_t eqId, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) {
- // unset a dead pixel, returns false if pixel is not dead
- UInt_t module = AliITSRawStreamSPD::GetModuleNumber(eqId,hs,chip);
- Int_t key = GetKey(eqId,hs,chip,col,row);
- if (fDeadPixelMap[module]->Remove(key)) {
- fNrDead[module]--;
- return kTRUE;
+ UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
+ UInt_t colM = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,col);
+ UInt_t rowM = AliITSRawStreamSPD::GetOfflineRowFromOnline(eq,hs,chip,row);
+
+ printf("%*d,%*d,%*d,%*d,%*d | %*d,%*d,%*d\n",2,eq,1,hs,1,chip,2,col,3,row,3,module,3,colM,3,rowM);
+ }
}
- return kFALSE;
}
-
-Bool_t AliITSOnlineCalibrationSPDhandler::UnSetDeadPixelM(UInt_t module, UInt_t colM, UInt_t row) {
- // unset a dead pixel, returns false if pixel is not dead
- UInt_t eqId = GetEqIdFromOffline(module);
- UInt_t hs = GetHSFromOffline(module);
- UInt_t chip = GetChipFromOffline(module,colM);
- UInt_t col = GetColFromOffline(colM);
- Int_t key = GetKey(eqId,hs,chip,col,row);
- if (fDeadPixelMap[module]->Remove(key)) {
- fNrDead[module]--;
+//____________________________________________________________________________________________
+Bool_t AliITSOnlineCalibrationSPDhandler::SetDeadPixel(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) {
+ // set a dead pixel, returns false if pixel is already dead
+ UInt_t gloChip = GetGloChip(eq,hs,chip);
+ if (gloChip>=1200) {
+ Error("AliITSOnlineCalibrationSPDhandler::SetDeadPixel", "eq,hs,chip nrs (%d,%d,%d) out of bounds.",eq,hs,chip);
+ return kFALSE;
+ }
+ if (col>=32 && row>=256) {
+ Error("AliITSOnlineCalibrationSPDhandler::SetDeadPixel", "col,row nrs (%d,%d) out of bounds.",col,row);
+ return kFALSE;
+ }
+ Int_t key = GetKey(eq,hs,chip,col,row);
+ // if noisy we dont want to add it...
+ if (fNoisyPixelMap[gloChip]->Find(key) != NULL) return kFALSE;
+ if (fDeadPixelMap[gloChip]->Insert(key,gloChip)) {
+ fNrDead[gloChip]++;
return kTRUE;
}
return kFALSE;
}
-
-Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelDeadKey(Int_t key) const {
- // is this pixel noisy?
- UInt_t eqId = GetEqIdFromKey(key);
- UInt_t hs = GetHSFromKey(key);
- UInt_t chip = GetChipFromKey(key);
- UInt_t module = AliITSRawStreamSPD::GetModuleNumber(eqId,hs,chip);
- return IsPixelDeadMKey(module,key);
-}
-
-Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelDeadMKey(UInt_t module, Int_t key) const {
- // is this pixel dead?
- if ( fDeadPixelMap[module]->Find(key) != NULL ) {
- return kTRUE;
+Bool_t AliITSOnlineCalibrationSPDhandler::SetNoisyPixel(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) {
+ // set a noisy pixel, returns false if pixel is already noisy
+ UInt_t gloChip = GetGloChip(eq,hs,chip);
+ if (gloChip>=1200) {
+ Error("AliITSOnlineCalibrationSPDhandler::SetNoisyPixel", "eq,hs,chip nrs (%d,%d,%d) out of bounds.",eq,hs,chip);
+ return kFALSE;
}
- else {
+ if (col>=32 && row>=256) {
+ Error("AliITSOnlineCalibrationSPDhandler::SetNoisyPixel", "col,row nrs (%d,%d) out of bounds.",col,row);
return kFALSE;
}
+ Int_t key = GetKey(eq,hs,chip,col,row);
+ // if dead before - remove from the dead list
+ if (fDeadPixelMap[gloChip]->Remove(key)) {
+ fNrDead[gloChip]--;
+ }
+ if (fNoisyPixelMap[gloChip]->Insert(key,gloChip)) {
+ fNrNoisy[gloChip]++;
+ return kTRUE;
+ }
+ return kFALSE;
}
-
-Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelDead(UInt_t eqId, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) const {
- // is the pixel dead?
- UInt_t module = AliITSRawStreamSPD::GetModuleNumber(eqId,hs,chip);
- Int_t key = GetKey(eqId,hs,chip,col,row);
- return IsPixelDeadMKey(module,key);
-}
-
-Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelDeadM(UInt_t module, UInt_t colM, UInt_t row) {
- // is the pixel dead?
- UInt_t eqId = GetEqIdFromOffline(module);
+Bool_t AliITSOnlineCalibrationSPDhandler::SetDeadPixelM(UInt_t module, UInt_t colM, UInt_t rowM) {
+ // set a dead pixel, returns false if pixel is already dead
+ UInt_t eq = GetEqIdFromOffline(module);
UInt_t hs = GetHSFromOffline(module);
UInt_t chip = GetChipFromOffline(module,colM);
- UInt_t col = GetColFromOffline(colM);
- Int_t key = GetKey(eqId,hs,chip,col,row);
- return IsPixelDeadMKey(module,key);
+ UInt_t col = GetColFromOffline(module,colM);
+ UInt_t row = GetRowFromOffline(module,rowM);
+ return SetDeadPixel(eq,hs,chip,col,row);
}
-
-UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDead() const {
- // returns the total nr of dead pixels
- UInt_t nrDead = 0;
- for (UInt_t module=0; module<240; module++) {
- nrDead+=fNrDead[module];
- }
- return nrDead;
+Bool_t AliITSOnlineCalibrationSPDhandler::SetNoisyPixelM(UInt_t module, UInt_t colM, UInt_t rowM) {
+ // set a noisy pixel, returns false if pixel is already noisy
+ UInt_t eq = GetEqIdFromOffline(module);
+ UInt_t hs = GetHSFromOffline(module);
+ UInt_t chip = GetChipFromOffline(module,colM);
+ UInt_t col = GetColFromOffline(module,colM);
+ UInt_t row = GetRowFromOffline(module,rowM);
+ return SetNoisyPixel(eq,hs,chip,col,row);
}
-
-UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDead(UInt_t module) const {
- // returns the number of dead pixels for a certain module
- if (module<240) {
- return fNrDead[module];
+Bool_t AliITSOnlineCalibrationSPDhandler::UnSetDeadPixel(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) {
+ // unset a dead pixel, returns false if pixel is not dead
+ UInt_t gloChip = GetGloChip(eq,hs,chip);
+ if (gloChip>=1200) {
+ Error("AliITSOnlineCalibrationSPDhandler::UnSetDeadPixel", "eq,hs,chip nrs (%d,%d,%d) out of bounds.",eq,hs,chip);
+ return kFALSE;
}
- else {
- return 0;
+ Int_t key = GetKey(eq,hs,chip,col,row);
+ if (fDeadPixelMap[gloChip]->Remove(key)) {
+ fNrDead[gloChip]--;
+ return kTRUE;
}
+ return kFALSE;
}
-
-UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAt(UInt_t module, UInt_t index) {
- // get eqId for the dead pixel at position index in list of dead
- if (index<GetNrDead(module)) {
- Int_t key = fDeadPixelMap[module]->GetKeyIndex(index);
- return GetEqIdFromKey(key);
+Bool_t AliITSOnlineCalibrationSPDhandler::UnSetNoisyPixel(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) {
+ // unset a noisy pixel, returns false if pixel is not noisy
+ UInt_t gloChip = GetGloChip(eq,hs,chip);
+ if (gloChip>=1200) {
+ Error("AliITSOnlineCalibrationSPDhandler::UnSetNoisyPixel", "eq,hs,chip nrs (%d,%d,%d) out of bounds.",eq,hs,chip);
+ return kFALSE;
}
- else {
- Error("AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAt", "Index %d out of bounds.", index);
- return 0;
+ Int_t key = GetKey(eq,hs,chip,col,row);
+ if (fNoisyPixelMap[gloChip]->Remove(key)) {
+ fNrNoisy[gloChip]--;
+ return kTRUE;
}
+ return kFALSE;
}
-UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAt(UInt_t module, UInt_t index) {
- // get hs for the dead pixel at position index in list of dead
- if (index<GetNrDead(module)) {
- Int_t key = fDeadPixelMap[module]->GetKeyIndex(index);
- return GetHSFromKey(key);
- }
- else {
- Error("AliITSOnlineCalibrationSPDhandler::GetDeadHSAt", "Index %d out of bounds.", index);
- return 0;
- }
+Bool_t AliITSOnlineCalibrationSPDhandler::UnSetDeadPixelM(UInt_t module, UInt_t colM, UInt_t rowM) {
+ // unset a dead pixel, returns false if pixel is not dead
+ UInt_t eq = GetEqIdFromOffline(module);
+ UInt_t hs = GetHSFromOffline(module);
+ UInt_t chip = GetChipFromOffline(module,colM);
+ UInt_t col = GetColFromOffline(module,colM);
+ UInt_t row = GetRowFromOffline(module,rowM);
+ return UnSetDeadPixel(eq,hs,chip,col,row);
}
-UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAt(UInt_t module, UInt_t index) {
- // get chip for the dead pixel at position index in list of dead
- if (index<GetNrDead(module)) {
- Int_t key = fDeadPixelMap[module]->GetKeyIndex(index);
- return GetChipFromKey(key);
- }
- else {
- Error("AliITSOnlineCalibrationSPDhandler::GetDeadChipAt", "Index %d out of bounds.", index);
- return 0;
- }
+Bool_t AliITSOnlineCalibrationSPDhandler::UnSetNoisyPixelM(UInt_t module, UInt_t colM, UInt_t rowM) {
+ // unset a noisy pixel, returns false if pixel is not noisy
+ UInt_t eq = GetEqIdFromOffline(module);
+ UInt_t hs = GetHSFromOffline(module);
+ UInt_t chip = GetChipFromOffline(module,colM);
+ UInt_t col = GetColFromOffline(module,colM);
+ UInt_t row = GetRowFromOffline(module,rowM);
+ return UnSetNoisyPixel(eq,hs,chip,col,row);
}
-UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAt(UInt_t module, UInt_t index) {
- // get column for the dead pixel at position index in list of dead
- if (index<GetNrDead(module)) {
- Int_t key = fDeadPixelMap[module]->GetKeyIndex(index);
- return GetColFromKey(key);
- }
- else {
- Error("AliITSOnlineCalibrationSPDhandler::GetDeadColAt", "Index %d out of bounds.", index);
- return 0;
+UInt_t AliITSOnlineCalibrationSPDhandler::SetDeadChip(UInt_t eq, UInt_t hs, UInt_t chip) {
+ // set a full chip dead, returns nr of new dead pixels
+ UInt_t nrNew = 0;
+ for (UInt_t col=0; col<32; col++) {
+ for (UInt_t row=0; row<256; row++) {
+ if (SetDeadPixel(eq,hs,chip,col,row)) {
+ nrNew++;
+ }
+ }
}
+ return nrNew;
}
-UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAt(UInt_t module, UInt_t index) {
- // get row for the dead pixel at position index in list of dead
- if (index<GetNrDead(module)) {
- Int_t key = fDeadPixelMap[module]->GetKeyIndex(index);
- return GetRowFromKey(key);
- }
- else {
- Error("AliITSOnlineCalibrationSPDhandler::GetDeadRowAt", "Index %d out of bounds.", index);
- return 0;
+UInt_t AliITSOnlineCalibrationSPDhandler::SetNoisyChip(UInt_t eq, UInt_t hs, UInt_t chip) {
+ // set a full chip noisy, returns nr of new noisy pixels
+ UInt_t nrNew = 0;
+ for (UInt_t col=0; col<32; col++) {
+ for (UInt_t row=0; row<256; row++) {
+ if (SetNoisyPixel(eq,hs,chip,col,row)) {
+ nrNew++;
+ }
+ }
}
+ return nrNew;
}
-
-void AliITSOnlineCalibrationSPDhandler::ResetNoisy() {
- // clear the list of noisy pixels
- for (UInt_t module=0; module<240; module++) {
- fNrNoisy[module]=0;
- fNoisyPixelMap[module]->Clear();
+Bool_t AliITSOnlineCalibrationSPDhandler::UnSetDeadChip(UInt_t eq, UInt_t hs, UInt_t chip) {
+ // unset a full dead chip, returns false if it was not all dead before
+ UInt_t nrUnset = 0;
+ for (UInt_t col=0; col<32; col++) {
+ for (UInt_t row=0; row<256; row++) {
+ if (UnSetDeadPixel(eq,hs,chip,col,row)) {
+ nrUnset++;
+ }
+ }
}
+ if (nrUnset+GetNrNoisyC(eq,hs,chip)<8192) return kFALSE;
+ else return kTRUE;
}
-void AliITSOnlineCalibrationSPDhandler::ResetNoisyForChip(UInt_t eqId, UInt_t hs, UInt_t chip) {
- // clear the noisy pixels for this chip
- UInt_t module = AliITSRawStreamSPD::GetModuleNumber(eqId,hs,chip);
+Bool_t AliITSOnlineCalibrationSPDhandler::UnSetNoisyChip(UInt_t eq, UInt_t hs, UInt_t chip) {
+ // unset a full noisy chip, returns false if it was not all noisy before
+ UInt_t nrUnset = 0;
for (UInt_t col=0; col<32; col++) {
for (UInt_t row=0; row<256; row++) {
- Int_t key = GetKey(eqId,hs,chip,col,row);
- if (fNoisyPixelMap[module]->Remove(key)) {
- fNrNoisy[module]--;
+ if (UnSetNoisyPixel(eq,hs,chip,col,row)) {
+ nrUnset++;
}
}
}
+ if (nrUnset<8192) return kFALSE;
+ else return kTRUE;
}
-
-
-Bool_t AliITSOnlineCalibrationSPDhandler::SetNoisyPixel(UInt_t eqId, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) {
- // set a noisy pixel, returns false if already there
- UInt_t module = AliITSRawStreamSPD::GetModuleNumber(eqId,hs,chip);
- Int_t key = GetKey(eqId,hs,chip,col,row);
-//!!! // if dead before - remove from the dead list
-//!!! UInt_t module = AliITSRawStreamSPD::GetModuleNumber(eqId,hs,chip);
-//!!! if (fDeadPixelMap.Remove(key)) {
-//!!! fNrDead[module]--;
-//!!! }
- if (fNoisyPixelMap[module]->Insert(key,col)) {
- fNrNoisy[module]++;
- return kTRUE;
+//____________________________________________________________________________________________
+Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelDead(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) const {
+ // is the pixel dead?
+ UInt_t gloChip = GetGloChip(eq,hs,chip);
+ if (gloChip>=1200) {
+ Error("AliITSOnlineCalibrationSPDhandler::IsPixelDead", "eq,hs,chip nrs (%d,%d,%d) out of bounds.",eq,hs,chip);
+ return kFALSE;
}
- return kFALSE;
-}
-
-Bool_t AliITSOnlineCalibrationSPDhandler::SetNoisyPixelM(UInt_t module, UInt_t colM, UInt_t row) {
- // set a noisy pixel, returns false if already there
- UInt_t eqId = GetEqIdFromOffline(module);
- UInt_t hs = GetHSFromOffline(module);
- UInt_t chip = GetChipFromOffline(module,colM);
- UInt_t col = GetColFromOffline(colM);
- Int_t key = GetKey(eqId,hs,chip,col,row);
-//!!! // if dead before - remove from the dead list
-//!!! if (fDeadPixelMap[module]->Remove(key)) {
-//!!! fNrDead[module]--;
-//!!! }
- if (fNoisyPixelMap[module]->Insert(key,col)) {
- fNrNoisy[module]++;
+ UInt_t key = GetKey(eq,hs,chip,col,row);
+ if ( fDeadPixelMap[gloChip]->Find(key) != NULL ) {
return kTRUE;
}
- return kFALSE;
+ else {
+ return kFALSE;
+ }
}
-
-Bool_t AliITSOnlineCalibrationSPDhandler::UnSetNoisyPixel(UInt_t eqId, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) {
- // unset a noisy pixel, returns false if not there
- UInt_t module = AliITSRawStreamSPD::GetModuleNumber(eqId,hs,chip);
- Int_t key = GetKey(eqId,hs,chip,col,row);
- if (fNoisyPixelMap[module]->Remove(key)) {
- fNrNoisy[module]--;
+Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelNoisy(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) const {
+ // is the pixel noisy?
+ UInt_t gloChip = GetGloChip(eq,hs,chip);
+ if (gloChip>=1200) {
+ Error("AliITSOnlineCalibrationSPDhandler::IsPixelNoisy", "eq,hs,chip nrs (%d,%d,%d) out of bounds.",eq,hs,chip);
+ return kFALSE;
+ }
+ UInt_t key = GetKey(eq,hs,chip,col,row);
+ if ( fNoisyPixelMap[gloChip]->Find(key) != NULL ) {
return kTRUE;
}
- return kFALSE;
+ else {
+ return kFALSE;
+ }
}
-
-Bool_t AliITSOnlineCalibrationSPDhandler::UnSetNoisyPixelM(UInt_t module, UInt_t colM, UInt_t row) {
- // unset a noisy pixel, returns false if not there
- UInt_t eqId = GetEqIdFromOffline(module);
+Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelDeadM(UInt_t module, UInt_t colM, UInt_t rowM) const {
+ // is the pixel dead?
+ UInt_t eq = GetEqIdFromOffline(module);
UInt_t hs = GetHSFromOffline(module);
UInt_t chip = GetChipFromOffline(module,colM);
- UInt_t col = GetColFromOffline(colM);
- Int_t key = GetKey(eqId,hs,chip,col,row);
- if (fNoisyPixelMap[module]->Remove(key)) {
- fNrNoisy[module]--;
- return kTRUE;
- }
- return kFALSE;
+ UInt_t col = GetColFromOffline(module,colM);
+ UInt_t row = GetRowFromOffline(module,rowM);
+ return IsPixelDead(eq,hs,chip,col,row);
+}
+Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelNoisyM(UInt_t module, UInt_t colM, UInt_t rowM) const {
+ // is the pixel noisy?
+ UInt_t eq = GetEqIdFromOffline(module);
+ UInt_t hs = GetHSFromOffline(module);
+ UInt_t chip = GetChipFromOffline(module,colM);
+ UInt_t col = GetColFromOffline(module,colM);
+ UInt_t row = GetRowFromOffline(module,rowM);
+ return IsPixelNoisy(eq,hs,chip,col,row);
+}
+Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelDeadKey(Int_t key) const {
+ // is this pixel dead?
+ UInt_t eq = GetEqIdFromKey(key);
+ UInt_t hs = GetHSFromKey(key);
+ UInt_t chip = GetChipFromKey(key);
+ UInt_t col = GetColFromKey(key);
+ UInt_t row = GetRowFromKey(key);
+ return IsPixelDead(eq,hs,chip,col,row);
}
-
Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelNoisyKey(Int_t key) const {
// is this pixel noisy?
- UInt_t eqId = GetEqIdFromKey(key);
+ UInt_t eq = GetEqIdFromKey(key);
UInt_t hs = GetHSFromKey(key);
UInt_t chip = GetChipFromKey(key);
- UInt_t module = AliITSRawStreamSPD::GetModuleNumber(eqId,hs,chip);
- return IsPixelNoisyMKey(module,key);
+ UInt_t col = GetColFromKey(key);
+ UInt_t row = GetRowFromKey(key);
+ return IsPixelNoisy(eq,hs,chip,col,row);
}
-
-Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelNoisyMKey(UInt_t module, Int_t key) const {
- // is this pixel noisy?
- if ( fNoisyPixelMap[module]->Find(key) != NULL ) {
- return kTRUE;
- }
- else {
- return kFALSE;
+//____________________________________________________________________________________________
+UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDead() const {
+ // returns the total nr of dead pixels
+ UInt_t nrDead = 0;
+ for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
+ nrDead+=fNrDead[gloChip];
}
+ return nrDead;
}
-
-Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelNoisy(UInt_t eqId, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) const {
- // is this pixel noisy?
- UInt_t module = AliITSRawStreamSPD::GetModuleNumber(eqId,hs,chip);
- Int_t key = GetKey(eqId,hs,chip,col,row);
- return IsPixelNoisyMKey(module,key);
-}
-
-Bool_t AliITSOnlineCalibrationSPDhandler::IsPixelNoisyM(UInt_t module, UInt_t colM, UInt_t row) {
- // is this pixel noisy?
- UInt_t eqId = GetEqIdFromOffline(module);
- UInt_t hs = GetHSFromOffline(module);
- UInt_t chip = GetChipFromOffline(module,colM);
- UInt_t col = GetColFromOffline(colM);
- Int_t key = GetKey(eqId,hs,chip,col,row);
- return IsPixelNoisyMKey(module,key);
-}
-
UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisy() const {
// returns the total nr of noisy pixels
UInt_t nrNoisy = 0;
- for (UInt_t module=0; module<240; module++) {
- nrNoisy+=fNrNoisy[module];
+ for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
+ nrNoisy+=fNrNoisy[gloChip];
}
return nrNoisy;
}
-
-UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisy(UInt_t module) const {
-// returns the number of noisy pixels for a certain module
- if (module<240) {
- return fNrNoisy[module];
- }
- else {
+UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAt(UInt_t index) {
+ // get eq for the dead pixel at position index in list of dead
+ UInt_t gloChip;
+ UInt_t chipIndex;
+ GetChipAndIndexTotDead(index,gloChip,chipIndex);
+ return GetDeadEqIdAtC2(gloChip,chipIndex);
+}
+UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAt(UInt_t index) {
+ // get eq for the noisy pixel at position index in list of noisy
+ UInt_t gloChip;
+ UInt_t chipIndex;
+ GetChipAndIndexTotNoisy(index,gloChip,chipIndex);
+ return GetNoisyEqIdAtC2(gloChip,chipIndex);
+}
+UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAt(UInt_t index) {
+ // get hs for the dead pixel at position index in list of dead
+ UInt_t gloChip;
+ UInt_t chipIndex;
+ GetChipAndIndexTotDead(index,gloChip,chipIndex);
+ return GetDeadHSAtC2(gloChip,chipIndex);
+}
+UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAt(UInt_t index) {
+ // get hs for the noisy pixel at position index in list of noisy
+ UInt_t gloChip;
+ UInt_t chipIndex;
+ GetChipAndIndexTotNoisy(index,gloChip,chipIndex);
+ return GetNoisyHSAtC2(gloChip,chipIndex);
+}
+UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAt(UInt_t index) {
+ // get chip for the dead pixel at position index in list of dead
+ UInt_t gloChip;
+ UInt_t chipIndex;
+ GetChipAndIndexTotDead(index,gloChip,chipIndex);
+ return GetDeadChipAtC2(gloChip,chipIndex);
+}
+UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAt(UInt_t index) {
+ // get chip for the noisy pixel at position index in list of noisy
+ UInt_t gloChip;
+ UInt_t chipIndex;
+ GetChipAndIndexTotNoisy(index,gloChip,chipIndex);
+ return GetNoisyChipAtC2(gloChip,chipIndex);
+}
+UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAt(UInt_t index) {
+ // get hs for the dead pixel at position index in list of dead
+ UInt_t gloChip;
+ UInt_t chipIndex;
+ GetChipAndIndexTotDead(index,gloChip,chipIndex);
+ return GetDeadColAtC2(gloChip,chipIndex);
+}
+UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAt(UInt_t index) {
+ // get hs for the noisy pixel at position index in list of noisy
+ UInt_t gloChip;
+ UInt_t chipIndex;
+ GetChipAndIndexTotNoisy(index,gloChip,chipIndex);
+ return GetNoisyColAtC2(gloChip,chipIndex);
+}
+UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAt(UInt_t index) {
+ // get hs for the dead pixel at position index in list of dead
+ UInt_t gloChip;
+ UInt_t chipIndex;
+ GetChipAndIndexTotDead(index,gloChip,chipIndex);
+ return GetDeadRowAtC2(gloChip,chipIndex);
+}
+UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAt(UInt_t index) {
+ // get hs for the noisy pixel at position index in list of noisy
+ UInt_t gloChip;
+ UInt_t chipIndex;
+ GetChipAndIndexTotNoisy(index,gloChip,chipIndex);
+ return GetNoisyRowAtC2(gloChip,chipIndex);
+}
+//____________________________________________________________________________________________
+UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDead(UInt_t module) const {
+ // returns the number of dead pixels for a certain module
+ if (module>=240) {
+ Error("AliITSOnlineCalibrationSPDhandler::GetNrDead", "module nr (%d) out of bounds.",module);
return 0;
}
-}
+ UInt_t nrDead = 0;
+ UInt_t eq = GetEqIdFromOffline(module);
+ UInt_t hs = GetHSFromOffline(module);
+ for (UInt_t chip=0; chip<5; chip++) {
+ UInt_t gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,chip*32));
+ nrDead+=fNrDead[gloChip];
-UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAt(UInt_t module, UInt_t index) {
- // get chip for the noisy pixel at position index in list of noisy
- if (index<GetNrNoisy(module)) {
- Int_t key = fNoisyPixelMap[module]->GetKeyIndex(index);
- return GetEqIdFromKey(key);
}
- else {
- Error("AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAt", "Index %d out of bounds.", index);
+ return nrDead;
+}
+UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisy(UInt_t module) const {
+ // returns the number of noisy pixels for a certain module
+ if (module>=240) {
+ Error("AliITSOnlineCalibrationSPDhandler::GetNrNoisy", "module nr (%d) out of bounds.",module);
return 0;
}
+ UInt_t nrNoisy = 0;
+ UInt_t eq = GetEqIdFromOffline(module);
+ UInt_t hs = GetHSFromOffline(module);
+ for (UInt_t chip=0; chip<5; chip++) {
+ UInt_t gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,chip*32));
+ nrNoisy+=fNrNoisy[gloChip];
+
+ }
+ return nrNoisy;
+}
+UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAt(UInt_t module, UInt_t index) {
+ // get eq for the dead pixel at position index in list of dead
+ UInt_t gloChip;
+ UInt_t chipIndex;
+ GetChipAndIndexDead(module,index,gloChip,chipIndex);
+ return GetDeadEqIdAtC2(gloChip,chipIndex);
+}
+UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAt(UInt_t module, UInt_t index) {
+ // get eq for the noisy pixel at position index in list of noisy
+ UInt_t gloChip;
+ UInt_t chipIndex;
+ GetChipAndIndexNoisy(module,index,gloChip,chipIndex);
+ return GetNoisyEqIdAtC2(gloChip,chipIndex);
+}
+UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAt(UInt_t module, UInt_t index) {
+ // get hs for the dead pixel at position index in list of dead
+ UInt_t gloChip;
+ UInt_t chipIndex;
+ GetChipAndIndexDead(module,index,gloChip,chipIndex);
+ return GetDeadHSAtC2(gloChip,chipIndex);
}
UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAt(UInt_t module, UInt_t index) {
+ // get hs for the noisy pixel at position index in list of noisy
+ UInt_t gloChip;
+ UInt_t chipIndex;
+ GetChipAndIndexNoisy(module,index,gloChip,chipIndex);
+ return GetNoisyHSAtC2(gloChip,chipIndex);
+}
+UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAt(UInt_t module, UInt_t index) {
+ // get chip for the dead pixel at position index in list of dead
+ UInt_t gloChip;
+ UInt_t chipIndex;
+ GetChipAndIndexDead(module,index,gloChip,chipIndex);
+ return GetDeadChipAtC2(gloChip,chipIndex);
+}
+UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAt(UInt_t module, UInt_t index) {
// get chip for the noisy pixel at position index in list of noisy
- if (index<GetNrNoisy(module)) {
- Int_t key = fNoisyPixelMap[module]->GetKeyIndex(index);
- return GetHSFromKey(key);
+ UInt_t gloChip;
+ UInt_t chipIndex;
+ GetChipAndIndexNoisy(module,index,gloChip,chipIndex);
+ return GetNoisyChipAtC2(gloChip,chipIndex);
+}
+UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAt(UInt_t module, UInt_t index) {
+ // get hs for the dead pixel at position index in list of dead
+ UInt_t gloChip;
+ UInt_t chipIndex;
+ GetChipAndIndexDead(module,index,gloChip,chipIndex);
+ return GetDeadColAtC2(gloChip,chipIndex);
+}
+UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAt(UInt_t module, UInt_t index) {
+ // get hs for the noisy pixel at position index in list of noisy
+ UInt_t gloChip;
+ UInt_t chipIndex;
+ GetChipAndIndexNoisy(module,index,gloChip,chipIndex);
+ return GetNoisyColAtC2(gloChip,chipIndex);
+}
+UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAt(UInt_t module, UInt_t index) {
+ // get hs for the dead pixel at position index in list of dead
+ UInt_t gloChip;
+ UInt_t chipIndex;
+ GetChipAndIndexDead(module,index,gloChip,chipIndex);
+ return GetDeadRowAtC2(gloChip,chipIndex);
+}
+UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAt(UInt_t module, UInt_t index) {
+ // get hs for the noisy pixel at position index in list of noisy
+ UInt_t gloChip;
+ UInt_t chipIndex;
+ GetChipAndIndexNoisy(module,index,gloChip,chipIndex);
+ return GetNoisyRowAtC2(gloChip,chipIndex);
+}
+//____________________________________________________________________________________________
+UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDeadEq(UInt_t eq) const {
+ // returns nr of dead for eq
+ UInt_t returnval=0;
+ for (UInt_t hs=0; hs<6; hs++) {
+ for (UInt_t chip=0; chip<10; chip++) {
+ returnval+=GetNrDeadC(eq,hs,chip);
+ }
}
- else {
- Error("AliITSOnlineCalibrationSPDhandler::GetNoisyHSAt", "Index %d out of bounds.", index);
- return 0;
+ return returnval;
+}
+UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisyEq(UInt_t eq) const {
+ // returns nr of noisy for eq
+ UInt_t returnval=0;
+ for (UInt_t hs=0; hs<6; hs++) {
+ for (UInt_t chip=0; chip<10; chip++) {
+ returnval+=GetNrNoisyC(eq,hs,chip);
+ }
}
+ return returnval;
}
-UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAt(UInt_t module, UInt_t index) {
- // get chip for the noisy pixel at position index in list of noisy
- if (index<GetNrNoisy(module)) {
- Int_t key = fNoisyPixelMap[module]->GetKeyIndex(index);
- return GetChipFromKey(key);
+UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAtEq(UInt_t eq, UInt_t index) const {
+ // get eq for the dead pixel at position index in list of dead
+ if (eq<20 && index<GetNrDeadEq(eq)) {
+ return eq;
}
else {
- Error("AliITSOnlineCalibrationSPDhandler::GetNoisyChipAt", "Index %d out of bounds.", index);
- return 0;
+ return 20;
}
}
-UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAt(UInt_t module, UInt_t index) {
- // get column for the noisy pixel at position index in list of noisy
- if (index<GetNrNoisy(module)) {
- Int_t key = fNoisyPixelMap[module]->GetKeyIndex(index);
- return GetColFromKey(key);
+UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAtEq(UInt_t eq, UInt_t index) const {
+ // get eq for the noisy pixel at position index in list of noisy
+ if (eq<20 && index<GetNrNoisyEq(eq)) {
+ return eq;
}
else {
- Warning("AliITSOnlineCalibrationSPDhandler::GetNoisyColAt", "Index %d out of bounds.", index);
- return 0;
+ return 20;
}
}
-UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAt(UInt_t module, UInt_t index) {
- // get row for the noisy pixel at position index in list of noisy
- if (index<GetNrNoisy(module)) {
- Int_t key = fNoisyPixelMap[module]->GetKeyIndex(index);
- return GetRowFromKey(key);
+UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAtEq(UInt_t eq, UInt_t index) {
+ // get hs for the dead pixel at position index in list of dead
+ UInt_t gloChip;
+ UInt_t chipIndex;
+ GetChipAndIndexEqDead(eq,index,gloChip,chipIndex);
+ return GetDeadHSAtC2(gloChip,chipIndex);
+}
+UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAtEq(UInt_t eq, UInt_t index) {
+ // get hs for the noisy pixel at position index in list of noisy
+ UInt_t gloChip;
+ UInt_t chipIndex;
+ GetChipAndIndexEqNoisy(eq,index,gloChip,chipIndex);
+ return GetNoisyHSAtC2(gloChip,chipIndex);
+}
+UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAtEq(UInt_t eq, UInt_t index) {
+ // get chip for the dead pixel at position index in list of dead
+ UInt_t gloChip;
+ UInt_t chipIndex;
+ GetChipAndIndexEqDead(eq,index,gloChip,chipIndex);
+ return GetDeadChipAtC2(gloChip,chipIndex);
+}
+UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAtEq(UInt_t eq, UInt_t index) {
+ // get chip for the noisy pixel at position index in list of noisy
+ UInt_t gloChip;
+ UInt_t chipIndex;
+ GetChipAndIndexEqNoisy(eq,index,gloChip,chipIndex);
+ return GetNoisyChipAtC2(gloChip,chipIndex);
+}
+UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAtEq(UInt_t eq, UInt_t index) {
+ // get hs for the dead pixel at position index in list of dead
+ UInt_t gloChip;
+ UInt_t chipIndex;
+ GetChipAndIndexEqDead(eq,index,gloChip,chipIndex);
+ return GetDeadColAtC2(gloChip,chipIndex);
+}
+UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAtEq(UInt_t eq, UInt_t index) {
+ // get hs for the noisy pixel at position index in list of noisy
+ UInt_t gloChip;
+ UInt_t chipIndex;
+ GetChipAndIndexEqNoisy(eq,index,gloChip,chipIndex);
+ return GetNoisyColAtC2(gloChip,chipIndex);
+}
+UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAtEq(UInt_t eq, UInt_t index) {
+ // get hs for the dead pixel at position index in list of dead
+ UInt_t gloChip;
+ UInt_t chipIndex;
+ GetChipAndIndexEqDead(eq,index,gloChip,chipIndex);
+ return GetDeadRowAtC2(gloChip,chipIndex);
+}
+UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAtEq(UInt_t eq, UInt_t index) {
+ // get hs for the noisy pixel at position index in list of noisy
+ UInt_t gloChip;
+ UInt_t chipIndex;
+ GetChipAndIndexEqNoisy(eq,index,gloChip,chipIndex);
+ return GetNoisyRowAtC2(gloChip,chipIndex);
+}
+//____________________________________________________________________________________________
+UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDeadC(UInt_t eq, UInt_t hs, UInt_t chip) const {
+ UInt_t gloChip = GetGloChip(eq,hs,chip);
+ return GetNrDeadC2(gloChip);
+}
+UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisyC(UInt_t eq, UInt_t hs, UInt_t chip) const {
+ UInt_t gloChip = GetGloChip(eq,hs,chip);
+ return GetNrNoisyC2(gloChip);
+}
+UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
+ UInt_t gloChip = GetGloChip(eq,hs,chip);
+ return GetDeadEqIdAtC2(gloChip,index);
+}
+UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
+ UInt_t gloChip = GetGloChip(eq,hs,chip);
+ return GetNoisyEqIdAtC2(gloChip,index);
+}
+UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
+ UInt_t gloChip = GetGloChip(eq,hs,chip);
+ return GetDeadHSAtC2(gloChip,index);
+}
+UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
+ UInt_t gloChip = GetGloChip(eq,hs,chip);
+ return GetNoisyHSAtC2(gloChip,index);
+}
+UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
+ UInt_t gloChip = GetGloChip(eq,hs,chip);
+ return GetDeadChipAtC2(gloChip,index);
+}
+UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
+ UInt_t gloChip = GetGloChip(eq,hs,chip);
+ return GetNoisyChipAtC2(gloChip,index);
+}
+UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
+ UInt_t gloChip = GetGloChip(eq,hs,chip);
+ return GetDeadColAtC2(gloChip,index);
+}
+UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
+ UInt_t gloChip = GetGloChip(eq,hs,chip);
+ return GetNoisyColAtC2(gloChip,index);
+}
+UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
+ UInt_t gloChip = GetGloChip(eq,hs,chip);
+ return GetDeadRowAtC2(gloChip,index);
+}
+UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
+ UInt_t gloChip = GetGloChip(eq,hs,chip);
+ return GetNoisyRowAtC2(gloChip,index);
+}
+//____________________________________________________________________________________________
+const Char_t* AliITSOnlineCalibrationSPDhandler::GetDeadPixelAsTextC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
+ // get a string of dead pixel info
+ TString returnMess = "";
+ UInt_t gloChip = GetGloChip(eq,hs,chip);
+ if (gloChip>=1200) {
+ Error("AliITSOnlineCalibrationSPDhandler::GetDeadPixelAsTextC", "global chip nr (%d) out of bounds.",gloChip);
+ return returnMess.Data();
+ }
+ if (index<fNrDead[gloChip]) {
+ Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
+ UInt_t eq = GetEqIdFromKey(key);
+ UInt_t hs = GetHSFromKey(key);
+ UInt_t chip = GetChipFromKey(key);
+ UInt_t col = GetColFromKey(key);
+ UInt_t row = GetRowFromKey(key);
+ UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
+ UInt_t colM = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,col);
+ UInt_t rowM = AliITSRawStreamSPD::GetOfflineRowFromOnline(eq,hs,chip,row);
+ returnMess = Form("%*d,%*d,%*d,%*d,%*d | %*d,%*d,%*d\n",2,eq,1,hs,1,chip,2,col,3,row,3,module,3,colM,3,rowM);
+ return returnMess.Data();
}
else {
- Error("AliITSOnlineCalibrationSPDhandler::GetNoisyRowAt", "Index %d out of bounds.", index);
- return 0;
+ Error("AliITSOnlineCalibrationSPDhandler::GetDeadPixelAsTextC", "Index %d out of bounds.", index);
+ return returnMess.Data();
+ }
+}
+const Char_t* AliITSOnlineCalibrationSPDhandler::GetNoisyPixelAsTextC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const {
+ // get a string of noisy pixel info
+ TString returnMess = "";
+ UInt_t gloChip = GetGloChip(eq,hs,chip);
+ if (gloChip>=1200) {
+ Error("AliITSOnlineCalibrationSPDhandler::GetNoisyPixelAsTextC", "global chip nr (%d) out of bounds.",gloChip);
+ return returnMess.Data();
+ }
+ if (index<fNrNoisy[gloChip]) {
+ Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
+ UInt_t eq = GetEqIdFromKey(key);
+ UInt_t hs = GetHSFromKey(key);
+ UInt_t chip = GetChipFromKey(key);
+ UInt_t col = GetColFromKey(key);
+ UInt_t row = GetRowFromKey(key);
+ UInt_t module = AliITSRawStreamSPD::GetOfflineModuleFromOnline(eq,hs,chip);
+ UInt_t colM = AliITSRawStreamSPD::GetOfflineColFromOnline(eq,hs,chip,col);
+ UInt_t rowM = AliITSRawStreamSPD::GetOfflineRowFromOnline(eq,hs,chip,row);
+ returnMess = Form("%*d,%*d,%*d,%*d,%*d | %*d,%*d,%*d\n",2,eq,1,hs,1,chip,2,col,3,row,3,module,3,colM,3,rowM);
+ return returnMess.Data();
+ }
+ else {
+ Error("AliITSOnlineCalibrationSPDhandler::GetNoisyPixelAsTextC", "Index %d out of bounds.", index);
+ return returnMess.Data();
}
}
-
-void AliITSOnlineCalibrationSPDhandler::PrintDead() const {
- // print the dead pixels to screen
- printf("-----------------------------------\n");
- printf("Dead Pixels: (eqId,hs,chip,col,row)\n");
- printf("-----------------------------------\n");
- for (UInt_t module=0; module<240; module++) {
- for (UInt_t index=0; index<GetNrDead(module); index++) {
- Int_t key = fDeadPixelMap[module]->GetKeyIndex(index);
- UInt_t eqId = GetEqIdFromKey(key);
- UInt_t hs = GetHSFromKey(key);
- UInt_t chip = GetChipFromKey(key);
- UInt_t col = GetColFromKey(key);
- UInt_t row = GetRowFromKey(key);
- printf("%d,%d,%d,%d,%d\n",eqId,hs,chip,col,row);
+//____________________________________________________________________________________________
+UInt_t AliITSOnlineCalibrationSPDhandler::AddDeadFrom(AliITSOnlineCalibrationSPDhandler* other) {
+ // returns number of new dead pixels in this' list
+ UInt_t returnval=0;
+ for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
+ for (UInt_t ind1=0; ind1<other->fNrDead[gloChip]; ind1++) {
+ UInt_t eq = other->GetDeadEqIdAtC2(gloChip,ind1);
+ UInt_t hs = other->GetDeadHSAtC2(gloChip,ind1);
+ UInt_t chip = other->GetDeadChipAtC2(gloChip,ind1);
+ UInt_t col = other->GetDeadColAtC2(gloChip,ind1);
+ UInt_t row = other->GetDeadRowAtC2(gloChip,ind1);
+ if (SetDeadPixel(eq,hs,chip,col,row)) {
+ returnval++;
+ }
}
}
+ return returnval;
}
-
-void AliITSOnlineCalibrationSPDhandler::PrintNoisy() const {
- // print the dead pixels to screen
- printf("-----------------------------------\n");
- printf("Noisy Pixels: (eqId,hs,chip,col,row)\n");
- printf("-----------------------------------\n");
- for (UInt_t module=0; module<240; module++) {
- for (UInt_t index=0; index<GetNrNoisy(module); index++) {
- Int_t key = fNoisyPixelMap[module]->GetKeyIndex(index);
- UInt_t eqId = GetEqIdFromKey(key);
- UInt_t hs = GetHSFromKey(key);
- UInt_t chip = GetChipFromKey(key);
- UInt_t col = GetColFromKey(key);
- UInt_t row = GetRowFromKey(key);
- printf("%d,%d,%d,%d,%d\n",eqId,hs,chip,col,row);
+UInt_t AliITSOnlineCalibrationSPDhandler::AddNoisyFrom(AliITSOnlineCalibrationSPDhandler* other) {
+ // returns number of new noisy pixels in this' list
+ UInt_t returnval=0;
+ for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
+ for (UInt_t ind1=0; ind1<other->fNrNoisy[gloChip]; ind1++) {
+ UInt_t eq = other->GetNoisyEqIdAtC2(gloChip,ind1);
+ UInt_t hs = other->GetNoisyHSAtC2(gloChip,ind1);
+ UInt_t chip = other->GetNoisyChipAtC2(gloChip,ind1);
+ UInt_t col = other->GetNoisyColAtC2(gloChip,ind1);
+ UInt_t row = other->GetNoisyRowAtC2(gloChip,ind1);
+ if (SetNoisyPixel(eq,hs,chip,col,row)) {
+ returnval++;
+ }
}
}
+ return returnval;
+}
+//____________________________________________________________________________________________
+UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDiff(AliITSOnlineCalibrationSPDhandler* other) const {
+ // returns nr of dead/noisy in this' lists and not in other's lists
+ return GetNrDeadDiff(other) + GetNrNoisyDiff(other);
}
-
UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDeadDiff(AliITSOnlineCalibrationSPDhandler* other) const {
// returns nr of dead in this' lists and not in other's lists
UInt_t returnval=0;
- for (UInt_t module=0; module<240; module++) {
- for (UInt_t ind1=0; ind1<fNrDead[module]; ind1++) {
- Int_t key = fDeadPixelMap[module]->GetKeyIndex(ind1);
- UInt_t eqId = GetEqIdFromKey(key);
+ for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
+ for (UInt_t ind1=0; ind1<fNrDead[gloChip]; ind1++) {
+ Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(ind1);
+ UInt_t eq = GetEqIdFromKey(key);
UInt_t hs = GetHSFromKey(key);
UInt_t chip = GetChipFromKey(key);
UInt_t col = GetColFromKey(key);
UInt_t row = GetRowFromKey(key);
- if (!(other->IsPixelDead(eqId,hs,chip,col,row))) {
+ if (!(other->IsPixelDead(eq,hs,chip,col,row))) {
returnval++;
}
}
}
return returnval;
}
-
UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisyDiff(AliITSOnlineCalibrationSPDhandler* other) const {
// returns nr of noisy in this' lists and not in other's lists
UInt_t returnval=0;
- for (UInt_t module=0; module<240; module++) {
- for (UInt_t ind1=0; ind1<fNrNoisy[module]; ind1++) {
- Int_t key = fNoisyPixelMap[module]->GetKeyIndex(ind1);
- UInt_t eqId = GetEqIdFromKey(key);
+ for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
+ for (UInt_t ind1=0; ind1<fNrNoisy[gloChip]; ind1++) {
+ Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(ind1);
+ UInt_t eq = GetEqIdFromKey(key);
UInt_t hs = GetHSFromKey(key);
UInt_t chip = GetChipFromKey(key);
UInt_t col = GetColFromKey(key);
UInt_t row = GetRowFromKey(key);
- if (!(other->IsPixelNoisy(eqId,hs,chip,col,row))) {
+ if (!(other->IsPixelNoisy(eq,hs,chip,col,row))) {
returnval++;
}
}
}
return returnval;
}
-
-UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDiff(AliITSOnlineCalibrationSPDhandler* other) const {
- // returns nr of dead/noisy in this' lists and not in other's lists
- return GetNrDeadDiff(other) + GetNrNoisyDiff(other);
-}
-
AliITSOnlineCalibrationSPDhandler* AliITSOnlineCalibrationSPDhandler::GetDiff(AliITSOnlineCalibrationSPDhandler* other) const {
// returns handler with dead/noisy in this' lists, except for those in other's lists
AliITSOnlineCalibrationSPDhandler* newHandler = new AliITSOnlineCalibrationSPDhandler();
- for (UInt_t module=0; module<240; module++) {
- for (UInt_t ind1=0; ind1<fNrDead[module]; ind1++) {
- Int_t key = fDeadPixelMap[module]->GetKeyIndex(ind1);
- UInt_t eqId = GetEqIdFromKey(key);
+ for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
+ for (UInt_t ind1=0; ind1<fNrDead[gloChip]; ind1++) {
+ Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(ind1);
+ UInt_t eq = GetEqIdFromKey(key);
UInt_t hs = GetHSFromKey(key);
UInt_t chip = GetChipFromKey(key);
UInt_t col = GetColFromKey(key);
UInt_t row = GetRowFromKey(key);
- if (!(other->IsPixelDead(eqId,hs,chip,col,row))) {
- newHandler->SetDeadPixel(eqId,hs,chip,col,row);
+ if (!(other->IsPixelDead(eq,hs,chip,col,row))) {
+ newHandler->SetDeadPixel(eq,hs,chip,col,row);
}
}
- for (UInt_t ind2=0; ind2<fNrNoisy[module]; ind2++) {
- Int_t key = fNoisyPixelMap[module]->GetKeyIndex(ind2);
- UInt_t eqId = GetEqIdFromKey(key);
+ for (UInt_t ind2=0; ind2<fNrNoisy[gloChip]; ind2++) {
+ Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(ind2);
+ UInt_t eq = GetEqIdFromKey(key);
UInt_t hs = GetHSFromKey(key);
UInt_t chip = GetChipFromKey(key);
UInt_t col = GetColFromKey(key);
UInt_t row = GetRowFromKey(key);
- if (!(other->IsPixelNoisy(eqId,hs,chip,col,row))) {
- newHandler->SetNoisyPixel(eqId,hs,chip,col,row);
+ if (!(other->IsPixelNoisy(eq,hs,chip,col,row))) {
+ newHandler->SetNoisyPixel(eq,hs,chip,col,row);
}
}
}
return newHandler;
}
-
AliITSOnlineCalibrationSPDhandler* AliITSOnlineCalibrationSPDhandler::GetDeadDiff(AliITSOnlineCalibrationSPDhandler* other) const {
// returns handler with dead in this' lists, except for those in other's lists
AliITSOnlineCalibrationSPDhandler* newHandler = new AliITSOnlineCalibrationSPDhandler();
- for (UInt_t module=0; module<240; module++) {
- for (UInt_t ind1=0; ind1<fNrDead[module]; ind1++) {
- Int_t key = fDeadPixelMap[module]->GetKeyIndex(ind1);
- UInt_t eqId = GetEqIdFromKey(key);
+ for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
+ for (UInt_t ind1=0; ind1<fNrDead[gloChip]; ind1++) {
+ Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(ind1);
+ UInt_t eq = GetEqIdFromKey(key);
UInt_t hs = GetHSFromKey(key);
UInt_t chip = GetChipFromKey(key);
UInt_t col = GetColFromKey(key);
UInt_t row = GetRowFromKey(key);
- if (!(other->IsPixelDead(eqId,hs,chip,col,row))) {
- newHandler->SetDeadPixel(eqId,hs,chip,col,row);
+ if (!(other->IsPixelDead(eq,hs,chip,col,row))) {
+ newHandler->SetDeadPixel(eq,hs,chip,col,row);
}
}
}
return newHandler;
}
-
AliITSOnlineCalibrationSPDhandler* AliITSOnlineCalibrationSPDhandler::GetNoisyDiff(AliITSOnlineCalibrationSPDhandler* other) const {
// returns handler with noisy in this' lists, except for those in other's lists
AliITSOnlineCalibrationSPDhandler* newHandler = new AliITSOnlineCalibrationSPDhandler();
- for (UInt_t module=0; module<240; module++) {
- for (UInt_t ind2=0; ind2<fNrNoisy[module]; ind2++) {
- Int_t key = fNoisyPixelMap[module]->GetKeyIndex(ind2);
- UInt_t eqId = GetEqIdFromKey(key);
+ for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
+ for (UInt_t ind2=0; ind2<fNrNoisy[gloChip]; ind2++) {
+ Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(ind2);
+ UInt_t eq = GetEqIdFromKey(key);
UInt_t hs = GetHSFromKey(key);
UInt_t chip = GetChipFromKey(key);
UInt_t col = GetColFromKey(key);
UInt_t row = GetRowFromKey(key);
- if (!(other->IsPixelNoisy(eqId,hs,chip,col,row))) {
- newHandler->SetNoisyPixel(eqId,hs,chip,col,row);
+ if (!(other->IsPixelNoisy(eq,hs,chip,col,row))) {
+ newHandler->SetNoisyPixel(eq,hs,chip,col,row);
}
}
}
return newHandler;
}
+//____________________________________________________________________________________________
+void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexDead(UInt_t module, UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) {
+ // find gloChip and chipIndex from module and index
+ if (index<GetNrDead(module)) {
+ UInt_t eq = GetEqIdFromOffline(module);
+ UInt_t hs = GetHSFromOffline(module);
+
+ UInt_t glVal=0;
+ for (UInt_t chip=0; chip<5; chip++) {
+ gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,chip*32));
+ if (glVal+fNrDead[gloChip]>index) {
+ chipIndex = index-glVal;
+ break;
+ }
+ else {
+ glVal+=fNrDead[gloChip];
+ }
+ }
-void AliITSOnlineCalibrationSPDhandler::InitModuleMaps() {
- // initializes the module mapping arrays needed for the methods below (GetEqIdFromOffline etc.)
- for (UInt_t iDDL=0; iDDL<20; iDDL++) {
- for (UInt_t iModule=0; iModule<12; iModule++) {
- UInt_t module = AliITSRawStreamSPD::GetModuleNumber(iDDL,iModule);
- fiDDL[module] = iDDL;
- fiModule[module] = iModule;
+ }
+ else {
+ Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexDead", "Index %d out of bounds.", index);
+ }
+}
+void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexNoisy(UInt_t module, UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) {
+ // find gloChip and chipIndex from module and index
+ if (index<GetNrNoisy(module)) {
+ UInt_t eq = GetEqIdFromOffline(module);
+ UInt_t hs = GetHSFromOffline(module);
+
+ UInt_t glVal=0;
+ for (UInt_t chip=0; chip<5; chip++) {
+ gloChip = GetGloChip(eq,hs,GetChipFromOffline(module,chip*32));
+ if (glVal+fNrNoisy[gloChip]>index) {
+ chipIndex = index-glVal;
+ break;
+ }
+ else {
+ glVal+=fNrNoisy[gloChip];
+ }
}
+
+ }
+ else {
+ Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexNoisy", "Index %d out of bounds.", index);
}
}
+void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexEqDead(UInt_t eq, UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) {
+ // find gloChip and chipIndex from module and index
+ if (index<GetNrDeadEq(eq)) {
-void AliITSOnlineCalibrationSPDhandler::GenerateDCSConfigFile(const Char_t* fileName) {
- // generates an ascii file in the format as the one produced by online da (but with dummy runNr=0)
- ofstream dcsfile;
- dcsfile.open(fileName);
- dcsfile << "[SPD SCAN]\n";
- dcsfile << "RunNumber=" << "0" << "\n"; // dummy value
- dcsfile << "Type=" << "4" << "\n";
- dcsfile << "Router=" << "0" << "\n"; // dummy value
- dcsfile << "ActualDetCoonfiguration=" << "0,-1,-1\n"; // dummy values
- dcsfile << "[NOISY]\n";
- for (UInt_t module=0; module<240; module++) {
- UInt_t headkey=20*10*6;
- for (UInt_t ind=0; ind<fNrNoisy[module]; ind++) {
- UInt_t newkey = GetNoisyEqIdAt(module,ind)*10*6 +
- GetNoisyHSAt(module,ind)*10 +
- GetNoisyChipAt(module,ind);
- if (newkey!=headkey) { // print eqId,hs,chip header
- headkey = newkey;
- dcsfile << "-" << newkey/(6*10) << "," << (newkey%(6*10))/10 << "," << (newkey%(6*10))%10 << "\n";
+ UInt_t glVal=0;
+ for (UInt_t hs=0; hs<6; hs++) {
+ for (UInt_t chip=0; chip<10; chip++) {
+ gloChip = GetGloChip(eq,hs,chip);
+ if (glVal+fNrDead[gloChip]>index) {
+ chipIndex = index-glVal;
+ break;
+ }
+ else {
+ glVal+=fNrDead[gloChip];
+ }
}
- dcsfile << GetNoisyColAt(module,ind) << "," << GetNoisyRowAt(module,ind) << "\n";
}
+
+ }
+ else {
+ Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexEqDead", "Index %d out of bounds.", index);
}
- dcsfile.close();
}
+void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexEqNoisy(UInt_t eq, UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) {
+ // find gloChip and chipIndex from module and index
+ if (index<GetNrNoisyEq(eq)) {
+
+ UInt_t glVal=0;
+ for (UInt_t hs=0; hs<6; hs++) {
+ for (UInt_t chip=0; chip<10; chip++) {
+ gloChip = GetGloChip(eq,hs,chip);
+ if (glVal+fNrNoisy[gloChip]>index) {
+ chipIndex = index-glVal;
+ break;
+ }
+ else {
+ glVal+=fNrNoisy[gloChip];
+ }
+ }
+ }
+
+ }
+ else {
+ Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexEqNoisy", "Index %d out of bounds.", index);
+ }
+}
+void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexTotDead(UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) {
+ // find gloChip and chipIndex from global index
+ if (index<GetNrDead()) {
+
+ UInt_t glVal=0;
+ for (gloChip=0; gloChip<1200; gloChip++) {
+ if (glVal+fNrDead[gloChip]>index) {
+ chipIndex = index-glVal;
+ break;
+ }
+ else {
+ glVal+=fNrDead[gloChip];
+ }
+ }
+
+ }
+ else {
+ Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexTotDead", "Index %d out of bounds.", index);
+ }
+}
+void AliITSOnlineCalibrationSPDhandler::GetChipAndIndexTotNoisy(UInt_t index, UInt_t& gloChip, UInt_t& chipIndex) {
+ // find gloChip and chipIndex from global index
+ if (index<GetNrNoisy()) {
+
+ UInt_t glVal=0;
+ for (gloChip=0; gloChip<1200; gloChip++) {
+ if (glVal+fNrNoisy[gloChip]>index) {
+ chipIndex = index-glVal;
+ break;
+ }
+ else {
+ glVal+=fNrNoisy[gloChip];
+ }
+ }
-UInt_t AliITSOnlineCalibrationSPDhandler::GetEqIdFromOffline(UInt_t module) {
- // module to eqId mapping
- if (!fModuleMapInited) InitModuleMaps();
- return fiDDL[module];
+ }
+ else {
+ Error("AliITSOnlineCalibrationSPDhandler::GetChipAndIndexTotNoisy", "Index %d out of bounds.", index);
+ }
+}
+//____________________________________________________________________________________________
+UInt_t AliITSOnlineCalibrationSPDhandler::GetEqIdFromOffline(UInt_t module) const {
+ // module to eq mapping
+ if (module>=240) {
+ Error("AliITSOnlineCalibrationSPDhandler::GetEqIdFromOffline", "module nr (%d) out of bounds.",module);
+ return 20;
+ }
+ return AliITSRawStreamSPD::GetOnlineEqIdFromOffline(module);
}
-UInt_t AliITSOnlineCalibrationSPDhandler::GetHSFromOffline(UInt_t module) {
+UInt_t AliITSOnlineCalibrationSPDhandler::GetHSFromOffline(UInt_t module) const {
// module to hs mapping
- if (!fModuleMapInited) InitModuleMaps();
- return fiModule[module]/2;
+ if (module>=240) {
+ Error("AliITSOnlineCalibrationSPDhandler::GetHSFromOffline", "module nr (%d) out of bounds.",module);
+ return 6;
+ }
+ return AliITSRawStreamSPD::GetOnlineHSFromOffline(module);
}
-UInt_t AliITSOnlineCalibrationSPDhandler::GetChipFromOffline(UInt_t module, UInt_t colM) {
+UInt_t AliITSOnlineCalibrationSPDhandler::GetChipFromOffline(UInt_t module, UInt_t colM) const {
// module,colM to chip mapping
- if (!fModuleMapInited) InitModuleMaps();
- return colM/32 + 5*(fiModule[module]%2);
+ if (module>=240 || colM>=160) {
+ Error("AliITSOnlineCalibrationSPDhandler::GetChipFromOffline", "module,colM nrs (%d,%d) out of bounds.",module,colM);
+ return 10;
+ }
+ return AliITSRawStreamSPD::GetOnlineChipFromOffline(module,colM);
}
-UInt_t AliITSOnlineCalibrationSPDhandler::GetColFromOffline(UInt_t colM) const {
+UInt_t AliITSOnlineCalibrationSPDhandler::GetColFromOffline(UInt_t module, UInt_t colM) const {
// colM to col mapping
- return colM%32;
+ if (colM>=160) {
+ Error("AliITSOnlineCalibrationSPDhandler::GetColFromOffline", "colM nr (%d) out of bounds.",colM);
+ return 160;
+ }
+ return AliITSRawStreamSPD::GetOnlineColFromOffline(module,colM);
+}
+
+UInt_t AliITSOnlineCalibrationSPDhandler::GetRowFromOffline(UInt_t module, UInt_t rowM) const {
+ // rowM to row mapping
+ if (rowM>=256) {
+ Error("AliITSOnlineCalibrationSPDhandler::GetRowFromOffline", "rowM nr (%d) out of bounds.",rowM);
+ return 256;
+ }
+ return AliITSRawStreamSPD::GetOnlineRowFromOffline(module,rowM);
+}
+//____________________________________________________________________________________________
+UInt_t AliITSOnlineCalibrationSPDhandler::GetNrDeadC2(UInt_t gloChip) const {
+ // returns nr of dead pixels on this chip
+ if (gloChip>=1200) {
+ Error("AliITSOnlineCalibrationSPDhandler::GetNrDeadC2", "global chip nr (%d) out of bounds.",gloChip);
+ return 0;
+ }
+ return fNrDead[gloChip];
+}
+UInt_t AliITSOnlineCalibrationSPDhandler::GetNrNoisyC2(UInt_t gloChip) const {
+ // returns nr of noisy pixels on this chip
+ if (gloChip>=1200) {
+ Error("AliITSOnlineCalibrationSPDhandler::GetNrNoisyC2", "global chip nr (%d) out of bounds.",gloChip);
+ return 0;
+ }
+ return fNrNoisy[gloChip];
+}
+UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAtC2(UInt_t gloChip, UInt_t index) const {
+ // get eq for the dead pixel at position index in list of dead
+ if (gloChip>=1200) {
+ Error("AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAtC", "global chip nr (%d) out of bounds.",gloChip);
+ return 20;
+ }
+ if (index<fNrDead[gloChip]) {
+ Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
+ return GetEqIdFromKey(key);
+ }
+ else {
+ Error("AliITSOnlineCalibrationSPDhandler::GetDeadEqIdAtC", "Index %d out of bounds.", index);
+ return 0;
+ }
+}
+UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAtC2(UInt_t gloChip, UInt_t index) const {
+ // get eq for the noisy pixel at position index in list of noisy
+ if (gloChip>=1200) {
+ Error("AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAtC", "global chip nr (%d) out of bounds.",gloChip);
+ return 20;
+ }
+ if (index<fNrNoisy[gloChip]) {
+ Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
+ return GetEqIdFromKey(key);
+ }
+ else {
+ Error("AliITSOnlineCalibrationSPDhandler::GetNoisyEqIdAtC", "Index %d out of bounds.", index);
+ return 0;
+ }
+}
+UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadHSAtC2(UInt_t gloChip, UInt_t index) const {
+ // get hs for the dead pixel at position index in list of dead
+ if (gloChip>=1200) {
+ Error("AliITSOnlineCalibrationSPDhandler::GetDeadHSAtC", "global chip nr (%d) out of bounds.",gloChip);
+ return 20;
+ }
+ if (index<fNrDead[gloChip]) {
+ Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
+ return GetHSFromKey(key);
+ }
+ else {
+ Error("AliITSOnlineCalibrationSPDhandler::GetDeadHSAtC", "Index %d out of bounds.", index);
+ return 0;
+ }
+}
+UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyHSAtC2(UInt_t gloChip, UInt_t index) const {
+ // get hs for the noisy pixel at position index in list of noisy
+ if (gloChip>=1200) {
+ Error("AliITSOnlineCalibrationSPDhandler::GetNoisyHSAtC", "global chip nr (%d) out of bounds.",gloChip);
+ return 20;
+ }
+ if (index<fNrNoisy[gloChip]) {
+ Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
+ return GetHSFromKey(key);
+ }
+ else {
+ Error("AliITSOnlineCalibrationSPDhandler::GetNoisyHSAtC", "Index %d out of bounds.", index);
+ return 0;
+ }
}
+UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadChipAtC2(UInt_t gloChip, UInt_t index) const {
+ // get chip for the dead pixel at position index in list of dead
+ if (gloChip>=1200) {
+ Error("AliITSOnlineCalibrationSPDhandler::GetDeadChipAtC", "global chip nr (%d) out of bounds.",gloChip);
+ return 20;
+ }
+ if (index<fNrDead[gloChip]) {
+ Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
+ return GetChipFromKey(key);
+ }
+ else {
+ Error("AliITSOnlineCalibrationSPDhandler::GetDeadChipAtC", "Index %d out of bounds.", index);
+ return 0;
+ }
+}
+UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyChipAtC2(UInt_t gloChip, UInt_t index) const {
+ // get chip for the noisy pixel at position index in list of noisy
+ if (gloChip>=1200) {
+ Error("AliITSOnlineCalibrationSPDhandler::GetNoisyChipAtC", "global chip nr (%d) out of bounds.",gloChip);
+ return 20;
+ }
+ if (index<fNrNoisy[gloChip]) {
+ Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
+ return GetChipFromKey(key);
+ }
+ else {
+ Error("AliITSOnlineCalibrationSPDhandler::GetNoisyChipAtC", "Index %d out of bounds.", index);
+ return 0;
+ }
+}
+UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadColAtC2(UInt_t gloChip, UInt_t index) const {
+ // get col for the dead pixel at position index in list of dead
+ if (gloChip>=1200) {
+ Error("AliITSOnlineCalibrationSPDhandler::GetDeadColAtC2", "global chip nr (%d) out of bounds.",gloChip);
+ return 20;
+ }
+ if (index<fNrDead[gloChip]) {
+ Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
+ return GetColFromKey(key);
+ }
+ else {
+ Error("AliITSOnlineCalibrationSPDhandler::GetDeadColAtC2", "Index %d out of bounds.", index);
+ return 0;
+ }
+}
+UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyColAtC2(UInt_t gloChip, UInt_t index) const {
+ // get col for the noisy pixel at position index in list of noisy
+ if (gloChip>=1200) {
+ Error("AliITSOnlineCalibrationSPDhandler::GetNoisyColAtC", "global chip nr (%d) out of bounds.",gloChip);
+ return 20;
+ }
+ if (index<fNrNoisy[gloChip]) {
+ Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
+ return GetColFromKey(key);
+ }
+ else {
+ Error("AliITSOnlineCalibrationSPDhandler::GetNoisyColAtC", "Index %d out of bounds.", index);
+ return 0;
+ }
+}
+UInt_t AliITSOnlineCalibrationSPDhandler::GetDeadRowAtC2(UInt_t gloChip, UInt_t index) const {
+ // get row for the dead pixel at position index in list of dead
+ if (gloChip>=1200) {
+ Error("AliITSOnlineCalibrationSPDhandler::GetDeadRowAtC", "global chip nr (%d) out of bounds.",gloChip);
+ return 20;
+ }
+ if (index<fNrDead[gloChip]) {
+ Int_t key = fDeadPixelMap[gloChip]->GetKeyIndex(index);
+ return GetRowFromKey(key);
+ }
+ else {
+ Error("AliITSOnlineCalibrationSPDhandler::GetDeadRowAtC", "Index %d out of bounds.", index);
+ return 0;
+ }
+}
+UInt_t AliITSOnlineCalibrationSPDhandler::GetNoisyRowAtC2(UInt_t gloChip, UInt_t index) const {
+ // get row for the noisy pixel at position index in list of noisy
+ if (gloChip>=1200) {
+ Error("AliITSOnlineCalibrationSPDhandler::GetNoisyRowAtC", "global chip nr (%d) out of bounds.",gloChip);
+ return 20;
+ }
+ if (index<fNrNoisy[gloChip]) {
+ Int_t key = fNoisyPixelMap[gloChip]->GetKeyIndex(index);
+ return GetRowFromKey(key);
+ }
+ else {
+ Error("AliITSOnlineCalibrationSPDhandler::GetNoisyRowAtC", "Index %d out of bounds.", index);
+ return 0;
+ }
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
#ifndef ALI_ITS_ONLINECALIBRATIONSPDHANDLER_H
#define ALI_ITS_ONLINECALIBRATIONSPDHANDLER_H
-/* Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice */
-
-/* $Id$ */
-
//////////////////////////////////////////////////////////////////////////
// Author: Henrik Tydesjo //
// Class that simplifies the managing of dead and noisy pixels. //
// through reading and writing to TFile. //
//////////////////////////////////////////////////////////////////////////
-
#include "AliITSRawStreamSPD.h"
#include <TString.h>
class TArrayI;
class AliITSIntMap;
+class AliITSCalibrationSPD;
class AliITSOnlineCalibrationSPDhandler {
TString GetFileLocation() const {return fFileLocation;}
void ClearMaps();
+ void ResetDead();
+ void ResetNoisy();
+ void ResetDeadForChip(UInt_t eq, UInt_t hs, UInt_t chip);
+ void ResetNoisyForChip(UInt_t eq, UInt_t hs, UInt_t chip);
+ void ResetDeadForEq(UInt_t eq);
+ void ResetNoisyForEq(UInt_t eq);
Bool_t ReadFromFiles();
Bool_t ReadDeadFromFiles();
Bool_t ReadNoisyFromFiles();
- Bool_t ReadFromFile(UInt_t module);
- Bool_t ReadDeadFromFile(UInt_t module);
- Bool_t ReadNoisyFromFile(UInt_t module);
- Bool_t ReadFromFileName(const char *fileName);
+ Bool_t ReadDeadFromFile(UInt_t eq);
+ Bool_t ReadNoisyFromFile(UInt_t eq);
Bool_t ReadDeadFromFileName(const char *fileName);
Bool_t ReadNoisyFromFileName(const char *fileName);
+ UInt_t ReadDeadFromText(const char *fileName, UInt_t module);
+ UInt_t ReadNoisyFromText(const char *fileName, UInt_t module);
void WriteToFilesAlways();
- void WriteToFiles();
- void WriteDeadToFiles();
- void WriteNoisyToFiles();
- void WriteToFile(UInt_t module);
- void WriteDeadToFile(UInt_t module);
- void WriteNoisyToFile(UInt_t module);
+ UInt_t WriteToFiles();
+ void WriteDeadToFilesAlways();
+ void WriteNoisyToFilesAlways();
+ UInt_t WriteDeadToFiles();
+ UInt_t WriteNoisyToFiles();
+ void WriteDeadToFile(UInt_t eq);
+ void WriteNoisyToFile(UInt_t eq);
#ifndef SPD_DA_OFF
- Bool_t ReadModuleFromDB(UInt_t module, Int_t runNr);
- Bool_t ReadFromDB(Int_t runNr);
+ Bool_t ReadDeadModuleFromDB(UInt_t module, Int_t runNr, Bool_t treeSerial=kFALSE);
+ Bool_t ReadNoisyModuleFromDB(UInt_t module, Int_t runNr, Bool_t treeSerial=kFALSE);
+ Bool_t ReadFromDB(Int_t runNr, Bool_t treeSerial=kFALSE);
+ Bool_t ReadDeadFromDB(Int_t runNr, Bool_t treeSerial=kFALSE);
+ Bool_t ReadNoisyFromDB(Int_t runNr, Bool_t treeSerial=kFALSE);
+ Bool_t ReadDeadFromCalibObj(TObjArray* calObj);
+ Bool_t ReadNoisyFromCalibObj(TObjArray* calObj);
Bool_t WriteToDB(Int_t runNrStart, Int_t runNrEnd);
+ Bool_t WriteDeadToDB(Int_t runNrStart, Int_t runNrEnd);
+ Bool_t WriteNoisyToDB(Int_t runNrStart, Int_t runNrEnd);
#endif
- UInt_t ReadNoisyFromText(const char *fileName);
- UInt_t ReadDeadFromText(const char *fileName);
- void GenerateDCSConfigFile(const Char_t* fileName);
- TArrayI GetDeadArray(UInt_t module);
- TArrayI GetNoisyArray(UInt_t module);
+ void GenerateDCSConfigFile(const Char_t* fileName);
- void ResetDead();
- void ResetDeadForChip(UInt_t eqId, UInt_t hs, UInt_t chip);
- Bool_t SetDeadPixel(UInt_t eqId, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row);
- Bool_t SetDeadPixelM(UInt_t module, UInt_t colM, UInt_t row);
- Bool_t UnSetDeadPixel(UInt_t eqId, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row);
- Bool_t UnSetDeadPixelM(UInt_t module, UInt_t colM, UInt_t row);
- Bool_t IsPixelDead(UInt_t eqId, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) const;
- Bool_t IsPixelDeadM(UInt_t module, UInt_t colM, UInt_t row);
+ TArrayI GetDeadArray(UInt_t module, Bool_t treeSerial=kFALSE);
+ TArrayI GetNoisyArray(UInt_t module, Bool_t treeSerial=kFALSE);
+ TArrayI GetDeadArrayOnline(UInt_t eq);
+ TArrayI GetNoisyArrayOnline(UInt_t eq);
- UInt_t GetNrDead(UInt_t module) const;
- UInt_t GetDeadEqIdAt(UInt_t module,UInt_t index);
- UInt_t GetDeadHSAt(UInt_t module,UInt_t index);
- UInt_t GetDeadChipAt(UInt_t module,UInt_t index);
- UInt_t GetDeadColAt(UInt_t module,UInt_t index);
- UInt_t GetDeadRowAt(UInt_t module,UInt_t index);
+ void PrintEqSummary();
+ void PrintDead() const;
+ void PrintNoisy() const;
- void ResetNoisy();
- void ResetNoisyForChip(UInt_t eqId, UInt_t hs, UInt_t chip);
- Bool_t SetNoisyPixel(UInt_t eqId, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row);
+ Bool_t SetDeadPixel(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row);
+ Bool_t SetNoisyPixel(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row);
+ Bool_t SetDeadPixelM(UInt_t module, UInt_t colM, UInt_t row);
Bool_t SetNoisyPixelM(UInt_t module, UInt_t colM, UInt_t row);
- Bool_t UnSetNoisyPixel(UInt_t eqId, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row);
+ Bool_t UnSetDeadPixel(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row);
+ Bool_t UnSetNoisyPixel(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row);
+ Bool_t UnSetDeadPixelM(UInt_t module, UInt_t colM, UInt_t row);
Bool_t UnSetNoisyPixelM(UInt_t module, UInt_t colM, UInt_t row);
- Bool_t IsPixelNoisy(UInt_t eqId, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) const;
- Bool_t IsPixelNoisyM(UInt_t module, UInt_t colM, UInt_t row);
+ UInt_t SetDeadChip(UInt_t eq, UInt_t hs, UInt_t chip);
+ UInt_t SetNoisyChip(UInt_t eq, UInt_t hs, UInt_t chip);
+ Bool_t UnSetDeadChip(UInt_t eq, UInt_t hs, UInt_t chip);
+ Bool_t UnSetNoisyChip(UInt_t eq, UInt_t hs, UInt_t chip);
+
+ Bool_t IsPixelDead(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) const;
+ Bool_t IsPixelNoisy(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) const;
+ Bool_t IsPixelDeadM(UInt_t module, UInt_t colM, UInt_t row) const;
+ Bool_t IsPixelNoisyM(UInt_t module, UInt_t colM, UInt_t row) const;
+ Bool_t IsPixelDeadKey(Int_t key) const;
+ Bool_t IsPixelNoisyKey(Int_t key) const;
+ UInt_t GetNrDead() const;
+ UInt_t GetNrNoisy() const;
+ UInt_t GetDeadEqIdAt(UInt_t index);
+ UInt_t GetNoisyEqIdAt(UInt_t index);
+ UInt_t GetDeadHSAt(UInt_t index);
+ UInt_t GetNoisyHSAt(UInt_t index);
+ UInt_t GetDeadChipAt(UInt_t index);
+ UInt_t GetNoisyChipAt(UInt_t index);
+ UInt_t GetDeadColAt(UInt_t index);
+ UInt_t GetNoisyColAt(UInt_t index);
+ UInt_t GetDeadRowAt(UInt_t index);
+ UInt_t GetNoisyRowAt(UInt_t index);
+
+ UInt_t GetNrDead(UInt_t module) const;
UInt_t GetNrNoisy(UInt_t module) const;
+ UInt_t GetDeadEqIdAt(UInt_t module,UInt_t index);
UInt_t GetNoisyEqIdAt(UInt_t module, UInt_t index);
+ UInt_t GetDeadHSAt(UInt_t module,UInt_t index);
UInt_t GetNoisyHSAt(UInt_t module, UInt_t index);
+ UInt_t GetDeadChipAt(UInt_t module,UInt_t index);
UInt_t GetNoisyChipAt(UInt_t module, UInt_t index);
+ UInt_t GetDeadColAt(UInt_t module,UInt_t index);
UInt_t GetNoisyColAt(UInt_t module, UInt_t index);
+ UInt_t GetDeadRowAt(UInt_t module,UInt_t index);
UInt_t GetNoisyRowAt(UInt_t module, UInt_t index);
- UInt_t GetNrDead() const;
- UInt_t GetNrNoisy() const;
- void PrintDead() const;
- void PrintNoisy() const;
+ UInt_t GetNrDeadEq(UInt_t eq) const;
+ UInt_t GetNrNoisyEq(UInt_t eq) const;
+ UInt_t GetDeadEqIdAtEq(UInt_t eq, UInt_t index) const;
+ UInt_t GetNoisyEqIdAtEq(UInt_t eq, UInt_t index) const;
+ UInt_t GetDeadHSAtEq(UInt_t eq, UInt_t index);
+ UInt_t GetNoisyHSAtEq(UInt_t eq, UInt_t index);
+ UInt_t GetDeadChipAtEq(UInt_t eq, UInt_t index);
+ UInt_t GetNoisyChipAtEq(UInt_t eq, UInt_t index);
+ UInt_t GetDeadColAtEq(UInt_t eq, UInt_t index);
+ UInt_t GetNoisyColAtEq(UInt_t eq, UInt_t index);
+ UInt_t GetDeadRowAtEq(UInt_t eq, UInt_t index);
+ UInt_t GetNoisyRowAtEq(UInt_t eq, UInt_t index);
+
+ UInt_t GetNrDeadC(UInt_t eq, UInt_t hs, UInt_t chip) const;
+ UInt_t GetNrNoisyC(UInt_t eq, UInt_t hs, UInt_t chip) const;
+ UInt_t GetDeadEqIdAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const;
+ UInt_t GetNoisyEqIdAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const;
+ UInt_t GetDeadHSAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const;
+ UInt_t GetNoisyHSAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const;
+ UInt_t GetDeadChipAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const;
+ UInt_t GetNoisyChipAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const;
+ UInt_t GetDeadColAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const;
+ UInt_t GetNoisyColAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const;
+ UInt_t GetDeadRowAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const;
+ UInt_t GetNoisyRowAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const;
+
+ const Char_t* GetDeadPixelAsTextC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const;
+ const Char_t* GetNoisyPixelAsTextC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const;
+
+ UInt_t AddDeadFrom(AliITSOnlineCalibrationSPDhandler* other);
+ UInt_t AddNoisyFrom(AliITSOnlineCalibrationSPDhandler* other);
UInt_t GetNrDiff(AliITSOnlineCalibrationSPDhandler* other) const;
UInt_t GetNrDeadDiff(AliITSOnlineCalibrationSPDhandler* other) const;
private:
- TString fFileLocation; // location (dir) of files to read and write from
- AliITSIntMap* fDeadPixelMap[240]; // lists of dead pixels for each module
- AliITSIntMap* fNoisyPixelMap[240]; // lists of noisy pixels for each module
- UInt_t fNrDead[240]; // nr of dead pixels for each module
- UInt_t fNrNoisy[240]; // nr of noisy pixels for each module
+ TString fFileLocation; // location (dir) of files to read and write from
+ AliITSIntMap* fDeadPixelMap[1200]; // lists of dead pixels for each chip
+ AliITSIntMap* fNoisyPixelMap[1200]; // lists of noisy pixels for each chip
+ UInt_t fNrDead[1200]; // nr of dead pixels for each chip
+ UInt_t fNrNoisy[1200]; // nr of noisy pixels for each chip
- Bool_t fModuleMapInited; // flag to know if arrays below are filled
- UInt_t fiDDL[240]; // iDDL value for each module (inited when used, fModuleMapInited flag)
- UInt_t fiModule[240]; // iModule value for each module (inited when used, fModuleMapInited flag)
-
- Int_t GetKey(UInt_t eqId, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) const
- {return eqId*6*10*32*256 + hs*10*32*256 + chip*32*256 + col*256 + row;}
-
+ Int_t GetKey(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) const
+ {return eq*6*10*32*256 + hs*10*32*256 + chip*32*256 + col*256 + row;}
UInt_t GetEqIdFromKey(Int_t key) const
{return key/(6*10*32*256);}
UInt_t GetHSFromKey(Int_t key) const
UInt_t GetRowFromKey(Int_t key) const
{return (((key%(6*10*32*256))%(10*32*256))%(32*256))%256;}
UInt_t GetModuleFromKey(Int_t key) const
- {return AliITSRawStreamSPD::GetModuleNumber(GetEqIdFromKey(key),GetHSFromKey(key),GetChipFromKey(key));}
+ {return AliITSRawStreamSPD::GetOfflineModuleFromOnline(GetEqIdFromKey(key),GetHSFromKey(key),GetChipFromKey(key));}
UInt_t GetColMFromKey(Int_t key) const
- {return GetColFromKey(key) + 32 * (GetChipFromKey(key) % 5);}
-
- void InitModuleMaps();
- UInt_t GetEqIdFromOffline(UInt_t module);
- UInt_t GetHSFromOffline(UInt_t module);
- UInt_t GetChipFromOffline(UInt_t module, UInt_t colM);
- UInt_t GetColFromOffline(UInt_t colM) const;
-
- Bool_t IsPixelDeadKey(Int_t key) const;
- Bool_t IsPixelDeadMKey(UInt_t module, Int_t key) const;
- Bool_t IsPixelNoisyKey(Int_t key) const;
- Bool_t IsPixelNoisyMKey(UInt_t module, Int_t key) const;
+ {return AliITSRawStreamSPD::GetOfflineColFromOnline(GetEqIdFromKey(key),GetHSFromKey(key),GetChipFromKey(key),GetColFromKey(key));}
+ UInt_t GetRowMFromKey(Int_t key) const
+ {return AliITSRawStreamSPD::GetOfflineRowFromOnline(GetEqIdFromKey(key),GetHSFromKey(key),GetChipFromKey(key),GetRowFromKey(key));}
+
+ UInt_t GetGloChip(UInt_t eq, UInt_t hs, UInt_t chip) const
+ {return eq*6*10 + hs*10 + chip;}
+
+ void GetChipAndIndexDead(UInt_t module, UInt_t index, UInt_t& gloChip, UInt_t& chipIndex);
+ void GetChipAndIndexNoisy(UInt_t module, UInt_t index, UInt_t& gloChip, UInt_t& chipIndex);
+ void GetChipAndIndexEqDead(UInt_t eq, UInt_t index, UInt_t& gloChip, UInt_t& chipIndex);
+ void GetChipAndIndexEqNoisy(UInt_t eq, UInt_t index, UInt_t& gloChip, UInt_t& chipIndex);
+ void GetChipAndIndexTotDead(UInt_t index, UInt_t& gloChip, UInt_t& chipIndex);
+ void GetChipAndIndexTotNoisy(UInt_t index, UInt_t& gloChip, UInt_t& chipIndex);
+
+ UInt_t GetEqIdFromOffline(UInt_t module) const;
+ UInt_t GetHSFromOffline(UInt_t module) const;
+ UInt_t GetChipFromOffline(UInt_t module, UInt_t colM) const;
+ UInt_t GetColFromOffline(UInt_t module, UInt_t colM) const;
+ UInt_t GetRowFromOffline(UInt_t module, UInt_t rowM) const;
+
+ void RecursiveInsertDead(AliITSCalibrationSPD* calibSPD, UInt_t module, Int_t lowInd, Int_t highInd);
+ void RecursiveInsertNoisy(AliITSCalibrationSPD* calibSPD, UInt_t module, Int_t lowInd, Int_t highInd);
+
+ UInt_t GetNrDeadC2(UInt_t gloChip) const;
+ UInt_t GetNrNoisyC2(UInt_t gloChip) const;
+ UInt_t GetDeadEqIdAtC2(UInt_t gloChip, UInt_t index) const;
+ UInt_t GetNoisyEqIdAtC2(UInt_t gloChip, UInt_t index) const;
+ UInt_t GetDeadHSAtC2(UInt_t gloChip, UInt_t index) const;
+ UInt_t GetNoisyHSAtC2(UInt_t gloChip, UInt_t index) const;
+ UInt_t GetDeadChipAtC2(UInt_t gloChip, UInt_t index) const;
+ UInt_t GetNoisyChipAtC2(UInt_t gloChip, UInt_t index) const;
+ UInt_t GetDeadColAtC2(UInt_t gloChip, UInt_t index) const;
+ UInt_t GetNoisyColAtC2(UInt_t gloChip, UInt_t index) const;
+ UInt_t GetDeadRowAtC2(UInt_t gloChip, UInt_t index) const;
+ UInt_t GetNoisyRowAtC2(UInt_t gloChip, UInt_t index) const;
};
// One object for each half stave and step in a scan. It keeps //
// the nr of hits in each pixel. //
// This class should only be used through the interface of the //
-// AliITSOnlineSPDscan class. //
+// AliITSOnlineSPDscan and AliITSOnlineSPDphys classes. //
/////////////////////////////////////////////////////////////////
#include <TObject.h>
--- /dev/null
+////////////////////////////////////////////////////////////
+// Author: Henrik Tydesjo //
+// Interface class to the containers of an online scan. //
+// Directly connected to a TFile with all containers. //
+// Handles reading and writing of this TFile. Hitmaps are //
+// stored in this file (AliITSOnlineSPDHitArray). //
+// Also some general information is stored //
+// (AliITSOnlineSPDphysInfo). //
+////////////////////////////////////////////////////////////
+
+#include <math.h>
+
+#include <TFile.h>
+#include "AliITSOnlineSPDphys.h"
+#include "AliITSOnlineSPDphysInfo.h"
+#include "AliITSOnlineSPDHitArray.h"
+
+AliITSOnlineSPDphys::AliITSOnlineSPDphys(const Char_t *fileName) :
+ fFile(NULL),
+ fWrite(kFALSE),
+ fModified(kFALSE),
+ fInfoModified(kFALSE),
+ fPhysInfo(NULL),
+ fFileName(fileName)
+{
+ // constructor, open file for reading or writing
+ // look for a previously saved info object
+ // (if file not found create a new one and return, else read)
+ FILE* fp0 = fopen(fFileName.Data(), "r");
+ if (fp0 == NULL) {
+ fPhysInfo = new AliITSOnlineSPDphysInfo();
+ fInfoModified=kTRUE;
+ fFile = new TFile(fFileName.Data(), "RECREATE");
+ fWrite=kTRUE;
+ InitHitmap();
+ }
+ else {
+ fclose(fp0);
+ fFile = new TFile(fFileName.Data(), "READ");
+ fWrite=kFALSE;
+ fFile->GetObject("AliITSOnlineSPDphysInfo", fPhysInfo);
+ ReadHitmap();
+ }
+}
+
+AliITSOnlineSPDphys::AliITSOnlineSPDphys(const AliITSOnlineSPDphys& /*phys*/) :
+ fFile(NULL),
+ fWrite(kFALSE),
+ fModified(kFALSE),
+ fInfoModified(kFALSE),
+ fPhysInfo(NULL),
+ fFileName(".")
+{
+ printf("This object should not be copied!");
+}
+
+AliITSOnlineSPDphys::~AliITSOnlineSPDphys() {
+ // destructor
+ if (fModified) {
+ SaveHitmap();
+ }
+ for (UInt_t hs=0; hs<6; hs++) {
+ if (fHitArray[hs]!=NULL) {
+ delete fHitArray[hs];
+ fHitArray[hs]=NULL;
+ }
+ }
+ if (fInfoModified) {
+ if (!fWrite) {
+ fFile->Close();
+ delete fFile;
+ fFile = new TFile(fFileName.Data(), "UPDATE");
+ fWrite=kTRUE;
+ }
+ fFile->Delete("AliITSOnlineSPDphysInfo;*");
+ fFile->WriteTObject(fPhysInfo, "AliITSOnlineSPDphysInfo");
+ fFile->Close();
+ delete fFile;
+ }
+}
+
+AliITSOnlineSPDphys& AliITSOnlineSPDphys::operator=(const AliITSOnlineSPDphys& phys) {
+ // assignment operator (should not be used)
+ printf("This object should not be copied!");
+ if (this!=&phys) {
+ // still do nothing...
+ }
+ return *this;
+}
+
+void AliITSOnlineSPDphys::ClearThis() {
+ // clear this phys, close file and open new
+ for (UInt_t hs=0; hs<6; hs++) {
+ if (fHitArray[hs]!=NULL) {
+ delete fHitArray[hs];
+ }
+ fHitArray[hs] = NULL;
+ }
+ InitHitmap();
+ fPhysInfo->ClearThis();
+ fFile->Close();
+ delete fFile;
+ fFile = new TFile(fFileName.Data(), "RECREATE");
+ fWrite=kTRUE;
+ fFile->WriteTObject(fPhysInfo, "AliITSOnlineSPDphysInfo");
+ fInfoModified=kTRUE;
+}
+
+void AliITSOnlineSPDphys::InitHitmap() {
+ // init hit arrays and hit events
+ for (UInt_t hs=0; hs<6; hs++) {
+ fHitArray[hs] = new AliITSOnlineSPDHitArray();
+ }
+ fModified=kTRUE;
+}
+
+void AliITSOnlineSPDphys::AddPhys(AliITSOnlineSPDphys* phys2) {
+ // add hitmap and info from another phys object
+ if (phys2==NULL) return;
+ if (GetEqNr()!=phys2->GetEqNr() && GetEqNr()!=999) {
+ printf("AliITSOnlineSPDphys::AddPhys eqNr mismatch!\n");
+ return;
+ }
+ if (GetEqNr()==999) {
+ SetEqNr(phys2->GetEqNr());
+ }
+ UInt_t nrRuns = phys2->GetNrRuns();
+ for (UInt_t i=0; i<nrRuns; i++) {
+ AddRunNr(phys2->GetRunNr(i));
+ }
+ SetNrEvents(GetNrEvents() + phys2->GetNrEvents());
+ for (UInt_t hs=0; hs<6; hs++) {
+ for (UInt_t chip=0; chip<10; chip++) {
+ for (UInt_t col=0; col<32; col++) {
+ for (UInt_t row=0; row<256; row++) {
+ SetHits(hs,chip,col,row,GetHits(hs,chip,col,row)+phys2->GetHits(hs,chip,col,row));
+ }
+ }
+ }
+ }
+}
+
+void AliITSOnlineSPDphys::ReadHitmap() {
+ // read hitmap into memory
+ for (UInt_t hs=0; hs<6; hs++) {
+ TString hName = Form("HitArray_HS%d",hs);
+ fFile->GetObject(hName.Data(), fHitArray[hs]);
+ }
+}
+
+void AliITSOnlineSPDphys::SaveHitmap() {
+ // save hitmap to file
+ if (!fWrite) {
+ fFile->Close();
+ delete fFile;
+ fFile = new TFile(fFileName.Data(), "UPDATE");
+ fWrite=kTRUE;
+ }
+ for (UInt_t hs=0; hs<6; hs++) {
+ TString hName = Form("HitArray_HS%d",hs);
+ TString hDelete = Form("%s;*",hName.Data());
+ fFile->Delete(hDelete.Data());
+ fFile->WriteTObject(fHitArray[hs], hName.Data());
+ }
+ fModified=kFALSE;
+}
+
+void AliITSOnlineSPDphys::SetHits(UInt_t hs, UInt_t chipi, UInt_t coli, UInt_t rowi, UInt_t val) {
+ // set nr of hits for pixel
+ fHitArray[hs]->SetHits(chipi,coli,rowi,val);
+ fModified=kTRUE;
+}
+void AliITSOnlineSPDphys::AddHits(UInt_t hs, UInt_t chipi, UInt_t coli, UInt_t rowi, Int_t val) {
+ // add val nr of hits for pixel (val could be negative)
+ Int_t summedVal = fHitArray[hs]->GetHits(chipi,coli,rowi)+val;
+ if (summedVal>0) {
+ fHitArray[hs]->SetHits(chipi,coli,rowi,(UInt_t)summedVal);
+ }
+ else {
+ fHitArray[hs]->SetHits(chipi,coli,rowi,0);
+ }
+ fModified=kTRUE;
+}
+void AliITSOnlineSPDphys::IncrementHits(UInt_t hs, UInt_t chipi, UInt_t coli, UInt_t rowi) {
+ // increment nr of hits for pixel
+ fHitArray[hs]->IncrementHits(chipi,coli,rowi);
+ fModified=kTRUE;
+}
+
+UInt_t AliITSOnlineSPDphys::GetHits(UInt_t hs, UInt_t chipi, UInt_t coli, UInt_t rowi) {
+ // get nr of hits for pixel
+ return fHitArray[hs]->GetHits(chipi,coli,rowi);
+}
+Float_t AliITSOnlineSPDphys::GetHitsEfficiency(UInt_t hs, UInt_t chipi, UInt_t coli, UInt_t rowi) {
+ // get the hit efficiency for pixel
+ UInt_t ntr = GetNrEvents();
+ if (ntr>0) {
+ return ((Float_t)GetHits(hs,chipi,coli,rowi))/ntr;
+ }
+ else {
+ return 0;
+ }
+}
+Float_t AliITSOnlineSPDphys::GetHitsEfficiencyError(UInt_t hs, UInt_t chipi, UInt_t coli, UInt_t rowi) {
+ // get error in hit efficiency for pixel
+ Float_t hits = GetHits(hs,chipi,coli,rowi);
+ UInt_t ntr = GetNrEvents();
+ return sqrt(hits*(ntr-hits)/ntr)/ntr;
+}
+Float_t AliITSOnlineSPDphys::GetAverageMultiplicity(UInt_t hs, UInt_t chipi) {
+ // get average multiplicity for a chip
+ Float_t nrhits = 0;
+ for (UInt_t chip=0;chip<10;chip++) {
+ if (chipi==10 || chip==chipi) {
+ for (Int_t col=0; col<32; col++) {
+ for (Int_t row=0; row<256; row++) {
+ nrhits+=GetHits(hs,chip,col,row);
+ }
+ }
+ }
+ }
+ UInt_t ntr = GetNrEvents();
+ if (ntr>0) {
+ return nrhits/ntr;
+ }
+ else {
+ return 0;
+ }
+}
+Float_t AliITSOnlineSPDphys::GetAverageMultiplicityTot(UInt_t hs) {
+ // get average multiplicity for 10 chips
+ return GetAverageMultiplicity(hs,10);
+}
+
+void AliITSOnlineSPDphys::AddRunNr(UInt_t val) {
+ // add a run nr
+ fPhysInfo->AddRunNr(val);
+ fInfoModified=kTRUE;
+}
+void AliITSOnlineSPDphys::SetEqNr(UInt_t val) {
+ // set router nr
+ fPhysInfo->SetEqNr(val);
+ fInfoModified=kTRUE;
+}
+void AliITSOnlineSPDphys::SetNrEvents(UInt_t val) {
+ // set nr of events
+ fPhysInfo->SetNrEvents(val);
+ fInfoModified=kTRUE;
+}
+void AliITSOnlineSPDphys::AddNrEvents(Int_t val) {
+ // add val nr of events (val could be negative)
+ fPhysInfo->AddNrEvents(val);
+ fInfoModified=kTRUE;
+}
+void AliITSOnlineSPDphys::IncrementNrEvents() {
+ // increment nr of events
+ fPhysInfo->IncrementNrEvents();
+ fInfoModified=kTRUE;
+}
+
+
+UInt_t AliITSOnlineSPDphys::GetNrRuns() const {
+ return fPhysInfo->GetNrRuns();
+}
+UInt_t AliITSOnlineSPDphys::GetRunNr(UInt_t posi) const {
+ return fPhysInfo->GetRunNr(posi);
+}
+UInt_t AliITSOnlineSPDphys::GetEqNr() const {
+ return fPhysInfo->GetEqNr();
+}
+UInt_t AliITSOnlineSPDphys::GetNrEvents() const {
+ return fPhysInfo->GetNrEvents();
+}
--- /dev/null
+#ifndef ALI_ITS_ONLINESPDPHYS_H
+#define ALI_ITS_ONLINESPDPHYS_H
+
+////////////////////////////////////////////////////////////
+// Author: Henrik Tydesjo //
+// Interface class to the containers of an online //
+// physics run. //
+// Directly connected to a TFile with all containers. //
+// Handles reading and writing of this TFile. Hitmaps are //
+// stored in this file (AliITSOnlineSPDHitArray). //
+// Also some general information is stored //
+// (AliITSOnlineSPDphysInfo). //
+////////////////////////////////////////////////////////////
+
+#include <TString.h>
+
+class TFile;
+class AliITSOnlineSPDphysInfo;
+class AliITSOnlineSPDHitArray;
+
+class AliITSOnlineSPDphys {
+
+ public:
+ AliITSOnlineSPDphys():fFile(NULL),fWrite(kFALSE),fModified(kFALSE),fInfoModified(kFALSE),fPhysInfo(NULL),fFileName("."){}
+ AliITSOnlineSPDphys(const Char_t *fileName);
+ AliITSOnlineSPDphys(const AliITSOnlineSPDphys& phys);
+ virtual ~AliITSOnlineSPDphys();
+ AliITSOnlineSPDphys& operator=(const AliITSOnlineSPDphys& phys);
+
+ virtual void AddPhys(AliITSOnlineSPDphys* phys2);
+ virtual void ClearThis();
+ // SET METHODS ***********************************
+ void AddRunNr(UInt_t val);
+ void SetEqNr(UInt_t val);
+
+ void SetNrEvents(UInt_t val);
+ void AddNrEvents(Int_t val);
+ void IncrementNrEvents();
+
+ void SetHits(UInt_t hs, UInt_t chipi, UInt_t coli, UInt_t rowi, UInt_t val);
+ void AddHits(UInt_t hs, UInt_t chipi, UInt_t coli, UInt_t rowi, Int_t val);
+ void IncrementHits(UInt_t hs, UInt_t chipi, UInt_t coli, UInt_t rowi);
+ // GET METHODS ***********************************
+ UInt_t GetNrRuns() const;
+ UInt_t GetRunNr(UInt_t posi) const;
+ UInt_t GetEqNr() const;
+ UInt_t GetNrEvents() const;
+
+ UInt_t GetHits(UInt_t hs, UInt_t chipi, UInt_t coli, UInt_t rowi);
+ Float_t GetHitsEfficiency(UInt_t hs, UInt_t chipi, UInt_t coli, UInt_t rowi);
+ Float_t GetHitsEfficiencyError(UInt_t hs, UInt_t chipi, UInt_t coli, UInt_t rowi);
+ Float_t GetAverageMultiplicity(UInt_t hs, UInt_t chipi);
+ Float_t GetAverageMultiplicityTot(UInt_t hs);
+
+ protected:
+ TFile *fFile; // file to read and write from
+ Bool_t fWrite; // is file opened for writing?
+ Bool_t fModified; // is the hitmap modified (needs saving)?
+ Bool_t fInfoModified; // is the overall phys information modified (needs saving)?
+ AliITSOnlineSPDphysInfo *fPhysInfo; // overall phys information
+ AliITSOnlineSPDHitArray *fHitArray[6]; // hit array, one for each halfstave
+ TString fFileName; // filename of file to read write
+
+ void InitHitmap();
+ void ReadHitmap();
+ void SaveHitmap();
+
+};
+
+#endif
--- /dev/null
+/**************************************************************************
+ * 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. *
+ **************************************************************************/
+
+////////////////////////////////////////////////////////////
+// Author: Henrik Tydesjo //
+// This class is used in the detector algorithm framework //
+// to process the data stored in special container files //
+// (see AliITSOnlineSPDphys). //
+////////////////////////////////////////////////////////////
+
+#include "AliITSOnlineSPDphysAnalyzer.h"
+#include "AliITSOnlineSPDphys.h"
+#include "AliITSOnlineCalibrationSPDhandler.h"
+#include "AliITSRawStreamSPD.h"
+#include "AliITSIntMap.h"
+#include <TStyle.h>
+#include <TMath.h>
+#include <TF1.h>
+#include <TGraph.h>
+#include <TH2F.h>
+#include <TError.h>
+#include <iostream>
+#include <fstream>
+
+AliITSOnlineSPDphysAnalyzer::AliITSOnlineSPDphysAnalyzer(const Char_t *fileName, AliITSOnlineCalibrationSPDhandler* handler) :
+ fFileName(fileName),fPhysObj(NULL),fHandler(handler),
+ fNrEnoughStatChips(0),fNrDeadChips(0),fNrInefficientChips(0),
+ fNrEqHits(0),fbDeadProcessed(kFALSE),
+ fThreshNoisy(1),fThreshNoisyExp(-12),fThreshDead(1),fThreshDeadExp(-12),
+ fMinEventsForNoisy(10000),fMinEventsForDead(10000),
+ fDefinitelyNoisyRatio(0.1),
+ fMinNrEqHitsForDeadChips(60000),fRatioToMeanForInefficientChip(0.1)//!!!
+{
+ // constructor
+ Init();
+}
+
+AliITSOnlineSPDphysAnalyzer::AliITSOnlineSPDphysAnalyzer(AliITSOnlineSPDphys* physObj, AliITSOnlineCalibrationSPDhandler* handler) :
+ fFileName("test.root"),fPhysObj(NULL),fHandler(handler),
+ fNrEnoughStatChips(0),fNrDeadChips(0),fNrInefficientChips(0),
+ fNrEqHits(0),fbDeadProcessed(kFALSE),
+ fThreshNoisy(1),fThreshNoisyExp(-12),fThreshDead(1),fThreshDeadExp(-12),
+ fMinEventsForNoisy(10000),fMinEventsForDead(10000),
+ fDefinitelyNoisyRatio(0.1),
+ fMinNrEqHitsForDeadChips(60000),fRatioToMeanForInefficientChip(0.1)//!!!
+{
+ // alt constructor
+ fPhysObj = physObj;
+}
+
+AliITSOnlineSPDphysAnalyzer::AliITSOnlineSPDphysAnalyzer(const AliITSOnlineSPDphysAnalyzer& handle) :
+ fFileName("test.root"),fPhysObj(NULL),fHandler(NULL),
+ fNrEnoughStatChips(0),fNrDeadChips(0),fNrInefficientChips(0),
+ fNrEqHits(0),fbDeadProcessed(kFALSE),
+ fThreshNoisy(1),fThreshNoisyExp(-12),fThreshDead(1),fThreshDeadExp(-12),
+ fMinEventsForNoisy(10000),fMinEventsForDead(10000),
+ fDefinitelyNoisyRatio(0.1),
+ fMinNrEqHitsForDeadChips(60000),fRatioToMeanForInefficientChip(0.1)//!!!
+{
+ // copy constructor, only copies the filename and params (not the processed data)
+ fFileName=handle.fFileName;
+ fThreshNoisy = handle.fThreshNoisy;
+ fThreshNoisyExp = handle.fThreshNoisyExp;
+ fThreshDead = handle.fThreshDead;
+ fThreshDeadExp = handle.fThreshDeadExp;
+ fMinEventsForNoisy = handle.fMinEventsForNoisy;
+ fMinEventsForDead = handle.fMinEventsForDead;
+ fDefinitelyNoisyRatio = handle.fDefinitelyNoisyRatio;
+ fMinNrEqHitsForDeadChips = handle.fMinNrEqHitsForDeadChips;
+ fRatioToMeanForInefficientChip = handle.fRatioToMeanForInefficientChip;
+
+ Init();
+}
+
+AliITSOnlineSPDphysAnalyzer::~AliITSOnlineSPDphysAnalyzer() {
+ // destructor
+ if (fPhysObj!=NULL) delete fPhysObj;
+}
+
+AliITSOnlineSPDphysAnalyzer& AliITSOnlineSPDphysAnalyzer::operator=(const AliITSOnlineSPDphysAnalyzer& handle) {
+ // assignment operator, only copies the filename and params (not the processed data)
+ if (this!=&handle) {
+ if (fPhysObj!=NULL) delete fPhysObj;
+
+ fFileName=handle.fFileName;
+ fThreshNoisy = handle.fThreshNoisy;
+ fThreshNoisyExp = handle.fThreshNoisyExp;
+ fThreshDead = handle.fThreshDead;
+ fThreshDeadExp = handle.fThreshDeadExp;
+ fMinEventsForNoisy = handle.fMinEventsForNoisy;
+ fMinEventsForDead = handle.fMinEventsForDead;
+ fDefinitelyNoisyRatio = handle.fDefinitelyNoisyRatio;
+ fMinNrEqHitsForDeadChips = handle.fMinNrEqHitsForDeadChips;
+ fRatioToMeanForInefficientChip = handle.fRatioToMeanForInefficientChip;
+
+ fPhysObj = NULL;
+ fHandler = NULL;
+ fNrEnoughStatChips = 0;
+ fNrDeadChips = 0;
+ fNrInefficientChips = 0;
+ fNrEqHits = 0;
+ fbDeadProcessed = kFALSE;
+
+ Init();
+ }
+ return *this;
+}
+
+void AliITSOnlineSPDphysAnalyzer::Init() {
+ // initialize container obj
+ FILE* fp0 = fopen(fFileName.Data(), "r");
+ if (fp0 == NULL) {
+ return;
+ }
+ else {
+ fclose(fp0);
+ }
+ fPhysObj = new AliITSOnlineSPDphys(fFileName.Data());
+}
+
+void AliITSOnlineSPDphysAnalyzer::SetParam(const Char_t *pname, const Char_t *pval) {
+ // set a parameter
+ TString name = pname;
+ TString val = pval;
+ // printf("Setting Param %s to %s\n",name.Data(),val.Data());
+ if (name.CompareTo("MistakeProbabilityNoisy")==0) {
+ Double_t mistakeProbabilityNoisy = val.Atof();
+ fThreshNoisy = mistakeProbabilityNoisy;
+ fThreshNoisyExp = 0;
+ Exponent(fThreshNoisy,fThreshNoisyExp);
+ fThreshNoisy/=(20*6*10*32*256);
+ Exponent(fThreshNoisy,fThreshNoisyExp);
+ }
+ else if (name.CompareTo("MistakeProbabilityDead")==0) {
+ Double_t mistakeProbabilityDead = val.Atof();
+ fThreshDead = mistakeProbabilityDead;
+ fThreshDeadExp = 0;
+ Exponent(fThreshDead,fThreshDeadExp);
+ fThreshDead/=(20*6*10*32*256);
+ Exponent(fThreshDead,fThreshDeadExp);
+ }
+ else if (name.CompareTo("fMinEventsForNoisy")==0) {
+ fMinEventsForNoisy = val.Atoi();
+ }
+ else if (name.CompareTo("fMinEventsForDead")==0) {
+ fMinEventsForDead = val.Atoi();
+ }
+ else if (name.CompareTo("fDefinitelyNoisyRatio")==0) {
+ fDefinitelyNoisyRatio = val.Atof();
+ }
+ else if (name.CompareTo("fMinNrEqHitsForDeadChips")==0) {
+ fMinNrEqHitsForDeadChips = val.Atof();
+ }
+ else if (name.CompareTo("fRatioToMeanForInefficientChip")==0) {
+ fRatioToMeanForInefficientChip = val.Atof();
+ }
+ else {
+ Error("AliITSOnlineSPDphysAnalyzer::SetParam","Parameter %s in configuration file unknown.",name.Data());
+ }
+}
+
+void AliITSOnlineSPDphysAnalyzer::ReadParamsFromLocation(const Char_t *dirName) {
+ // opens file (default name) in dir dirName and reads parameters from it
+ TString paramsFileName = Form("%s/physics_params.txt",dirName);
+ ifstream paramsFile;
+ paramsFile.open(paramsFileName, ifstream::in);
+ if (paramsFile.fail()) {
+ printf("No config file (%s) present. Using default tuning parameters.\n",paramsFileName.Data());
+ }
+ else {
+ while(1) {
+ Char_t paramN[50];
+ Char_t paramV[50];
+ paramsFile >> paramN;
+ if (paramsFile.eof()) break;
+ paramsFile >> paramV;
+ SetParam(paramN,paramV);
+ if (paramsFile.eof()) break;
+ }
+ paramsFile.close();
+ }
+}
+
+
+UInt_t AliITSOnlineSPDphysAnalyzer::ProcessNoisyPixels() {
+ // process noisy pixel data , returns number of chips with enough statistics
+ if (fPhysObj==NULL) {
+ Warning("AliITSOnlineSPDphysAnalyzer::ProcessNoisyPixels","No data!");
+ return 0;
+ }
+ // do we have enough events to even try the algorithm?
+ if (GetNrEvents() < fMinEventsForNoisy) {
+ Warning("AliITSOnlineSPDphysAnalyzer::ProcessNoisyPixels","Nr events (%d) < fMinEventsForNoisy (%d)!",GetNrEvents(),fMinEventsForNoisy);
+ return 0;
+ }
+ // handler should be initialized
+ if (fHandler==NULL) {
+ Error("AliITSOnlineSPDphysAnalyzer::ProcessNoisyPixels","Calibration handler is not initialized!");
+ return 0;
+ }
+
+ UInt_t nrEnoughStatChips = 0;
+
+ for (UInt_t hs=0; hs<6; hs++) {
+ for (UInt_t chip=0; chip<10; chip++) {
+
+ UInt_t nrPixels = 0;
+ UInt_t nrChipHits = 0;
+ UInt_t nrMostHits = 0;
+ for (UInt_t col=0; col<32; col++) {
+ for (UInt_t row=0; row<256; row++) {
+ UInt_t nrHits = fPhysObj->GetHits(hs,chip,col,row);
+ nrChipHits += nrHits;
+ // if (nrHits>0) nrPixels++; // don't include pixels that might be dead
+ nrPixels++;
+ if (nrHits>fDefinitelyNoisyRatio*GetNrEvents()) {
+ fHandler->SetNoisyPixel(GetEqNr(),hs,chip,col,row);
+ nrPixels--;
+ nrChipHits-=nrHits;
+ }
+ else {
+ if (nrMostHits<nrHits) nrMostHits=nrHits;
+ }
+ }
+ }
+
+ if (nrChipHits>0) { // otherwise there are for sure no noisy
+ // Binomial with n events and probability p for pixel hit
+ UInt_t n = GetNrEvents();
+ if (nrPixels>0 && n>0) {
+
+ Double_t p = (Double_t)nrChipHits/nrPixels/n;
+
+ Double_t bin = 1;
+ Int_t binExp = 0;
+ // Bin(n,k=0):
+ for (UInt_t i=0; i<n; i++) {
+ bin*=(1-p);
+ Exponent(bin,binExp);
+ }
+ // Bin(n,k)
+ UInt_t k=1;
+ while (((binExp>fThreshNoisyExp || (binExp==fThreshNoisyExp && bin>fThreshNoisy)) || k<n*p) && k<=n) {
+ k++;
+ bin = bin*(n-k+1)/k*p/(1-p);
+ Exponent(bin,binExp);
+ }
+
+ // can we find noisy pixels...?
+ if (k<=n) {
+ // printf("eq %d , hs %d , chip %d : Noisy level = %d\n",GetEqNr(),hs,chip,k);
+ nrEnoughStatChips++;
+ // add noisy pixels to handler
+ UInt_t noiseLimit=k;
+ if (nrMostHits>=noiseLimit) {
+ for (UInt_t col=0; col<32; col++) {
+ for (UInt_t row=0; row<256; row++) {
+ UInt_t nrHits = fPhysObj->GetHits(hs,chip,col,row);
+ if (nrHits >= noiseLimit) {
+ fHandler->SetNoisyPixel(GetEqNr(),hs,chip,col,row);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ }
+
+ } // for chip
+ } // for hs
+
+ return nrEnoughStatChips;
+}
+
+
+UInt_t AliITSOnlineSPDphysAnalyzer::ProcessDeadPixels() {
+ // process dead pixel data , returns number of chips with enough statistics
+ if (fPhysObj==NULL) {
+ Warning("AliITSOnlineSPDphysAnalyzer::ProcessDeadPixels","No data!");
+ return 0;
+ }
+ // do we have enough events to even try the algorithm?
+ if (GetNrEvents() < fMinEventsForDead) {
+ Warning("AliITSOnlineSPDphysAnalyzer::ProcessDeadPixels","Nr events (%d) < fMinEventsForDead (%d)!",GetNrEvents(),fMinEventsForDead);
+ return 0;
+ }
+ // handler should be initialized
+ if (fHandler==NULL) {
+ Error("AliITSOnlineSPDphysAnalyzer::ProcessDeadPixels","Calibration handler is not initialized!");
+ return 0;
+ }
+
+ AliITSOnlineCalibrationSPDhandler *deadChipHandler = new AliITSOnlineCalibrationSPDhandler();
+ AliITSIntMap* possiblyIneff = new AliITSIntMap();
+
+ fNrEnoughStatChips = 0;
+ fNrDeadChips = 0;
+ fNrInefficientChips = 0;
+ UInt_t nrPossiblyDeadChips = 0;
+ fNrEqHits = 0;
+
+ for (UInt_t hs=0; hs<6; hs++) {
+ for (UInt_t chip=0; chip<10; chip++) {
+ Bool_t good=kFALSE;
+
+ AliITSOnlineCalibrationSPDhandler *deadPixelHandler = new AliITSOnlineCalibrationSPDhandler();
+
+ UInt_t nrPossiblyDeadPixels = 0;
+ UInt_t nrPixels = 0;
+ UInt_t nrChipHits = 0;
+ for (UInt_t col=0; col<32; col++) {
+ for (UInt_t row=0; row<256; row++) {
+ UInt_t nrHits = fPhysObj->GetHits(hs,chip,col,row);
+ nrChipHits += nrHits;
+ if (!fHandler->IsPixelNoisy(GetEqNr(),hs,chip,col,row)) {
+ // don't include noisy pixels
+ nrPixels++;
+ if (nrHits==0) {
+ nrPossiblyDeadPixels++;
+ deadPixelHandler->SetDeadPixel(GetEqNr(),hs,chip,col,row);
+ }
+ }
+ else {
+ nrChipHits -= nrHits; // this is needed when running offline (online nrHits should be 0 already)
+ }
+ }
+ }
+ fNrEqHits+=nrChipHits;
+
+ // check all pixels that were declared dead from before...
+ UInt_t nrDeadBefore = fHandler->GetNrDeadC(GetEqNr(),hs,chip);
+ UInt_t nrNoisyNow = fHandler->GetNrNoisyC(GetEqNr(),hs,chip);
+ if (nrDeadBefore+nrNoisyNow==8192) {
+ if (nrChipHits>0) {
+ fHandler->UnSetDeadChip(GetEqNr(),hs,chip);
+ }
+ }
+ else {
+ AliITSOnlineCalibrationSPDhandler *tmpHand = new AliITSOnlineCalibrationSPDhandler();
+ for (UInt_t index=0; index<nrDeadBefore; index++) {
+ UInt_t col = fHandler->GetDeadColAtC(GetEqNr(),hs,chip,index);
+ UInt_t row = fHandler->GetDeadRowAtC(GetEqNr(),hs,chip,index);
+ if (fPhysObj->GetHits(hs,chip,col,row)>0) {
+ // fHandler->UnSetDeadPixel(GetEqNr(),hs,chip,col,row);
+ tmpHand->SetDeadPixel(GetEqNr(),hs,chip,col,row);
+ }
+ }
+ UInt_t nrToRemove = tmpHand->GetNrDead();
+ for (UInt_t index=0; index<nrToRemove; index++) {
+ fHandler->UnSetDeadPixel(GetEqNr(),hs,chip,tmpHand->GetDeadColAtC(GetEqNr(),hs,chip,index),tmpHand->GetDeadRowAtC(GetEqNr(),hs,chip,index));
+ }
+ delete tmpHand;
+ }
+
+
+
+
+ if (nrPossiblyDeadPixels==0) {
+ // no need to see if we have enough statistics...
+ fNrEnoughStatChips++;
+ good=kTRUE;
+ delete deadPixelHandler;
+ good=kTRUE;
+ printf("%3d",good);
+ if (chip==9) printf("\n");
+ continue;
+ }
+
+ if (nrChipHits==0) {
+ nrPossiblyDeadChips++;
+ deadChipHandler->SetDeadChip(GetEqNr(),hs,chip);
+ delete deadPixelHandler;
+ good=kFALSE;
+ printf("%3d",good);
+ if (chip==9) printf("\n");
+ continue;
+ }
+
+ // Binomial with n events and probability p for pixel hit
+ UInt_t n = GetNrEvents();
+ if (nrPixels>0 && n>0) {
+
+ Double_t p = (Double_t)nrChipHits/nrPixels/n;
+
+ // probability of falsely assigning a dead pixel
+ Double_t falselyDeadProb = 1;
+ Int_t falselyDeadProbExp = 0;
+ for (UInt_t i=0; i<n; i++) {
+ falselyDeadProb*=(1-p);
+ Exponent(falselyDeadProb,falselyDeadProbExp);
+ }
+
+ // can we find dead pixels...?
+ if (falselyDeadProbExp<fThreshDeadExp || (falselyDeadProbExp==fThreshDeadExp && falselyDeadProb<fThreshDead)) {
+ fNrEnoughStatChips++;
+ good=kTRUE;
+ // add dead pixels to handler
+ fHandler->AddDeadFrom(deadPixelHandler);
+ }
+ else {
+ // this might be an inefficient chip
+ possiblyIneff->Insert(hs*10+chip,nrChipHits);
+ }
+
+ }
+ else {
+ if (n>0) {
+ // this is a completely noisy chip... put in category enough stat
+ fNrEnoughStatChips++;
+ good=kTRUE;
+ }
+ }
+
+ delete deadPixelHandler;
+
+ printf("%3d",good);
+ if (chip==9) printf("\n");
+
+ } // for chip
+ } // for hs
+
+
+ // dead chips?
+ if (fNrEqHits>fMinNrEqHitsForDeadChips) {
+ fHandler->AddDeadFrom(deadChipHandler);
+ fNrDeadChips=nrPossiblyDeadChips;
+ }
+ else {
+ fNrDeadChips=0;
+ }
+ delete deadChipHandler;
+
+
+ // inefficient chips?
+ Int_t key,val;
+ while (possiblyIneff->Pop(key,val)) {
+ if (val<fNrEqHits/60*fRatioToMeanForInefficientChip) {
+ fNrInefficientChips++;
+ }
+ }
+ delete possiblyIneff;
+
+
+ fbDeadProcessed = kTRUE;
+
+ return fNrEnoughStatChips;
+}
+
+
+UInt_t AliITSOnlineSPDphysAnalyzer::GetNrEnoughStatChips() {
+ // returns nr of enough stat chips
+ if (!fbDeadProcessed) ProcessDeadPixels();
+ return fNrEnoughStatChips;
+}
+UInt_t AliITSOnlineSPDphysAnalyzer::GetNrDeadChips() {
+ // returns nr of dead chips
+ if (!fbDeadProcessed) ProcessDeadPixels();
+ return fNrDeadChips;
+}
+UInt_t AliITSOnlineSPDphysAnalyzer::GetNrInefficientChips() {
+ // returns nr of inefficient chips
+ if (!fbDeadProcessed) ProcessDeadPixels();
+ return fNrInefficientChips;
+}
+UInt_t AliITSOnlineSPDphysAnalyzer::GetNrNeedsMoreStatChips() {
+ // returns nr of needs more stat chips
+ if (!fbDeadProcessed) ProcessDeadPixels();
+ return 60-fNrEnoughStatChips-fNrDeadChips-fNrInefficientChips;
+}
+
+UInt_t AliITSOnlineSPDphysAnalyzer::GetEqNr() const {
+ // returns the eq nr of phys obj
+ if (fPhysObj!=NULL) return fPhysObj->GetEqNr();
+ else return 999;
+}
+
+UInt_t AliITSOnlineSPDphysAnalyzer::GetNrEvents() const {
+ // returns the nr of events of phys obj
+ if (fPhysObj!=NULL) return fPhysObj->GetNrEvents();
+ else return 0;
+}
+
+void AliITSOnlineSPDphysAnalyzer::Exponent(Double_t &val, Int_t &valExp) const {
+ // put double in format with val and exp so that 1<val<10 - The actual value is val*10e(valExp)
+ while (val>10) {
+ val/=10;
+ valExp++;
+ }
+ while (val<1) {
+ val*=10;
+ valExp--;
+ }
+}
+
+
+
+TH2F* AliITSOnlineSPDphysAnalyzer::GetHitMapTot() {
+ // creates and returns a pointer to a hitmap histo (half sector style a la spdmood)
+ if (fPhysObj==NULL) {
+ Error("AliITSOnlineSPDphysAnalyzer::GetHitMapTot","No data!");
+ return NULL;
+ }
+ TString histoname = Form("Eq %d",GetEqNr());
+ TH2F* fHitMapTot = new TH2F(histoname.Data(),histoname.Data(),32*10,-0.5,32*10-0.5,256*6,-0.5,256*6-0.5);
+ fHitMapTot->SetNdivisions(-10,"X");
+ fHitMapTot->SetNdivisions(-006,"Y");
+ fHitMapTot->SetTickLength(0,"X");
+ fHitMapTot->SetTickLength(0,"Y");
+ fHitMapTot->GetXaxis()->SetLabelColor(gStyle->GetCanvasColor());
+ fHitMapTot->GetYaxis()->SetLabelColor(gStyle->GetCanvasColor());
+ for (UInt_t hs=0; hs<6; hs++) {
+ for (UInt_t chipNr=0; chipNr<10; chipNr++) {
+ for (UInt_t col=0; col<32; col++) {
+ for (UInt_t row=0; row<256; row++) {
+ fHitMapTot->Fill(chipNr*32+col,(5-hs)*256+row,fPhysObj->GetHits(hs,chipNr,col,row));
+ }
+ }
+ }
+ }
+ return fHitMapTot;
+}
+
+TH2F* AliITSOnlineSPDphysAnalyzer::GetHitMapChip(UInt_t hs, UInt_t chip) {
+ // creates and returns a pointer to a hitmap histo (chip style a la spdmood)
+ if (fPhysObj==NULL) {
+ Error("AliITSOnlineSPDphysAnalyzer::GetHitMapChip","No data!");
+ return NULL;
+ }
+
+ TString histoName;
+ TString histoTitle;
+ histoName = Form("fChipHisto_%d_%d_%d", GetEqNr(), hs, chip);
+ histoTitle = Form("Eq ID %d, Half Stave %d, Chip %d", GetEqNr(), hs, chip);
+
+ TH2F *returnHisto = new TH2F(histoName.Data(), histoTitle.Data(), 32, -0.5, 31.5, 256, -0.5, 255.5);
+ returnHisto->SetMinimum(0);
+ for (UInt_t col=0; col<32; col++) {
+ for (UInt_t row=0; row<256; row++) {
+ returnHisto->Fill(col,row,fPhysObj->GetHits(hs,chip,col,row));
+ }
+ }
+
+ return returnHisto;
+}
--- /dev/null
+#ifndef ALIITSONLINESPDPHYSANALYZER_H
+#define ALIITSONLINESPDPHYSANALYZER_H
+/* Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+////////////////////////////////////////////////////////////
+// Author: Henrik Tydesjo //
+// This class is used in the detector algorithm framework //
+// to process the data stored in special container files //
+// (see AliITSOnlineSPDphys). //
+////////////////////////////////////////////////////////////
+
+#include <TString.h>
+
+class AliITSOnlineSPDphys;
+class AliITSOnlineCalibrationSPDhandler;
+class TGraph;
+class TH2F;
+
+class AliITSOnlineSPDphysAnalyzer {
+
+ public:
+ AliITSOnlineSPDphysAnalyzer(const Char_t *fileName, AliITSOnlineCalibrationSPDhandler* handler);
+ AliITSOnlineSPDphysAnalyzer(AliITSOnlineSPDphys* physObj, AliITSOnlineCalibrationSPDhandler* handler);
+ AliITSOnlineSPDphysAnalyzer(const AliITSOnlineSPDphysAnalyzer& handle);
+ ~AliITSOnlineSPDphysAnalyzer();
+
+ AliITSOnlineSPDphysAnalyzer& operator=(const AliITSOnlineSPDphysAnalyzer& handle);
+
+ void SetCalibHandler(AliITSOnlineCalibrationSPDhandler *handler) {fHandler=handler;}
+ void SetParam(const Char_t *pname, const Char_t *pval);
+ void ReadParamsFromLocation(const Char_t *dirName);
+
+ UInt_t ProcessDeadPixels();
+ UInt_t ProcessNoisyPixels();
+
+ UInt_t GetNrEnoughStatChips();
+ UInt_t GetNrDeadChips();
+ UInt_t GetNrInefficientChips();
+ UInt_t GetNrNeedsMoreStatChips();
+
+ AliITSOnlineSPDphys* GetOnlinePhys() {return fPhysObj;}
+ UInt_t GetEqNr() const;
+ UInt_t GetNrEvents() const;
+
+ TH2F* GetHitMapTot();
+ TH2F* GetHitMapChip(UInt_t hs, UInt_t chip);
+
+ private:
+ TString fFileName; // container file name
+ enum calibvals{kMINTH,kMEANTH,kDAC,kUNIMA,kNOISE,kDELAY}; // calib types
+ AliITSOnlineSPDphys *fPhysObj; // container obj
+ AliITSOnlineCalibrationSPDhandler *fHandler; // calib helper obj
+ void Init(); // initialization
+ void Exponent(Double_t &val, Int_t &valExp) const;
+
+ UInt_t fNrEnoughStatChips; // nr of enough stat chips
+ UInt_t fNrDeadChips; // nr of dead chips
+ UInt_t fNrInefficientChips; // nr of inefficient chips
+
+ Double_t fNrEqHits; // total nr of hits for associated eq
+ Bool_t fbDeadProcessed; // flag to tell if ProcessDeadPixels has been called
+
+ // dead noisy parameters:
+ Double_t fThreshNoisy; // at what confidence level do we search for noisy
+ Int_t fThreshNoisyExp; // at what confidence level do we search for noisy
+ Double_t fThreshDead; // at what confidence level do we search for dead
+ Int_t fThreshDeadExp; // at what confidence level do we search for dead
+ UInt_t fMinEventsForNoisy; // min nr of events required to try noisy algorithm
+ UInt_t fMinEventsForDead; // min nr of events required to try dead algorithm
+ Float_t fDefinitelyNoisyRatio; // if a pixel fires more than this ratio of the events, it must be noisy
+ Double_t fMinNrEqHitsForDeadChips; // minimum nr of hits for eq to assign dead chip
+ Double_t fRatioToMeanForInefficientChip; // ratio to mean nr of hits per chip to assign ineff. chip
+
+
+};
+
+#endif
--- /dev/null
+/////////////////////////////////////////////////////////////////
+// Author: Henrik Tydesjo //
+// This class is used as a container online. //
+// It holds information needed for a scan. //
+// This class should only be used through the interface of the //
+// AliITSOnlineSPDphys class. //
+/////////////////////////////////////////////////////////////////
+
+#include "AliITSOnlineSPDphysInfo.h"
+
+ClassImp(AliITSOnlineSPDphysInfo)
+
+AliITSOnlineSPDphysInfo::AliITSOnlineSPDphysInfo():
+ fNrRuns(0),
+ fRunNrs(0),
+ fEqNr(999),
+ fNrEvents(0)
+{}
+
+AliITSOnlineSPDphysInfo::~AliITSOnlineSPDphysInfo() {}
+
+void AliITSOnlineSPDphysInfo::ClearThis() {
+ // reset all values for this object
+ fNrRuns=0;
+ fRunNrs=0;
+ fEqNr=999;
+ fNrEvents=0;
+}
+
+void AliITSOnlineSPDphysInfo::AddRunNr(UInt_t val) {
+ // add a new run nr, allocate space for TArrayI
+ fNrRuns++;
+ fRunNrs.Set(fNrRuns);
+ fRunNrs.AddAt(val, fNrRuns-1);
+}
+
+UInt_t AliITSOnlineSPDphysInfo::GetRunNr(UInt_t posi) const {
+ // get run nr
+ if (posi<fNrRuns) {
+ return fRunNrs.At(posi);
+ }
+ else {
+ return 0;
+ }
+}
+
+void AliITSOnlineSPDphysInfo::AddNrEvents(Int_t val) {
+ // add val nr of events (val could be negative)
+ if (fNrEvents+val>0) {
+ fNrEvents+=val;
+ }
+ else {
+ fNrEvents=0;
+ }
+}
--- /dev/null
+#ifndef ALI_ITS_ONLINESPDPHYSINFO_H
+#define ALI_ITS_ONLINESPDPHYSINFO_H
+
+/////////////////////////////////////////////////////////////////
+// Author: Henrik Tydesjo //
+// This class is used as a container online. //
+// It holds information needed for a physics run. //
+// This class should only be used through the interface of the //
+// AliITSOnlineSPDphys class. //
+/////////////////////////////////////////////////////////////////
+
+#include <TObject.h>
+#include <TArrayI.h>
+
+class AliITSOnlineSPDphysInfo : public TObject {
+
+ public:
+ AliITSOnlineSPDphysInfo();
+ virtual ~AliITSOnlineSPDphysInfo();
+
+ virtual void ClearThis();
+ // SET METHODS ***********************************
+ void AddRunNr(UInt_t val);
+ void SetEqNr(UInt_t val) {fEqNr=val;}
+ void SetNrEvents(UInt_t val) {fNrEvents=val;}
+ void AddNrEvents(Int_t val);
+ void IncrementNrEvents() {fNrEvents++;}
+
+ // GET METHODS ***********************************
+ UInt_t GetNrRuns() const {return fNrRuns;}
+ UInt_t GetRunNr(UInt_t posi) const ;
+ UInt_t GetEqNr() const {return fEqNr;}
+ UInt_t GetNrEvents() const {return fNrEvents;}
+
+ protected:
+ UInt_t fNrRuns; // nr of runs used to fill hitmap
+ TArrayI fRunNrs; // list of run nrs for the hitmap
+ UInt_t fEqNr; // eq nr
+ UInt_t fNrEvents; // number of events
+
+ ClassDef(AliITSOnlineSPDphysInfo,1)
+ };
+
+#endif
class AliITSOnlineSPDscan {
public:
- AliITSOnlineSPDscan():fFile(NULL),fWrite(kFALSE),fCurrentStep(-1),fModified(kFALSE),fInfoModified(kFALSE),fScanInfo(NULL),fFileName("."){}
+ AliITSOnlineSPDscan():fFile(NULL),fWrite(kFALSE),fCurrentStep(-1),fModified(kFALSE),fInfoModified(kFALSE),fScanInfo(NULL),fFileName("./test.root"){}
AliITSOnlineSPDscan(const Char_t *fileName);
AliITSOnlineSPDscan(const AliITSOnlineSPDscan& scan);
virtual ~AliITSOnlineSPDscan();
// This class is used in the detector algorithm framework //
// to process the data stored in special container files //
// (see AliITSOnlineSPDscan). For instance, minimum //
-// threshold values can be calculated. //
+// threshold values can be extracted. //
////////////////////////////////////////////////////////////
#include "AliITSOnlineSPDscanAnalyzer.h"
#include <TGraph.h>
#include <TH2F.h>
#include <TError.h>
+#include <iostream>
+#include <fstream>
Double_t itsSpdErrorf(Double_t *x, Double_t *par){
if (par[2]<0) par[2]=0;
//}
-AliITSOnlineSPDscanAnalyzer::AliITSOnlineSPDscanAnalyzer(const Char_t *fileName) :
- fType(99),fDacId(99),fRouterNr(99),fFileName(fileName),fScanObj(NULL),fTriggers(NULL),
+AliITSOnlineSPDscanAnalyzer::AliITSOnlineSPDscanAnalyzer(const Char_t *fileName, AliITSOnlineCalibrationSPDhandler *handler) :
+ fType(99),fDacId(99),fFileName(fileName),fScanObj(NULL),fHandler(handler),fTriggers(NULL),
fOverWrite(kFALSE),fNoiseThreshold(0.01),fNoiseMinimumEvents(100),
- fMinNrStepsBeforeIncrease(5),fMinIncreaseFromBaseLine(2),fStepDownDacSafe(2),fMaxBaseLineLevel(10)
+ fMinNrStepsBeforeIncrease(5),fMinIncreaseFromBaseLine(2),fStepDownDacSafe(5),fMaxBaseLineLevel(10)
{
// constructor
for (UInt_t chipNr=0; chipNr<11; chipNr++) {
fHitEventEfficiency[hs][chipNr]=NULL;
}
}
- for (Int_t module=0; module<240; module++) {
- fHandler[module]=NULL;
+ for (UInt_t mod=0; mod<240; mod++) {
+ fbModuleScanned[mod]=kFALSE;
}
Init();
}
AliITSOnlineSPDscanAnalyzer::AliITSOnlineSPDscanAnalyzer(const AliITSOnlineSPDscanAnalyzer& handle) :
- fType(99),fDacId(99),fRouterNr(99),fFileName("."),fScanObj(NULL),fTriggers(NULL),
+ fType(99),fDacId(99),fFileName("."),fScanObj(NULL),fHandler(NULL),fTriggers(NULL),
fOverWrite(kFALSE),fNoiseThreshold(0.01),fNoiseMinimumEvents(100),
- fMinNrStepsBeforeIncrease(5),fMinIncreaseFromBaseLine(2),fStepDownDacSafe(2),fMaxBaseLineLevel(10)
+ fMinNrStepsBeforeIncrease(5),fMinIncreaseFromBaseLine(2),fStepDownDacSafe(5),fMaxBaseLineLevel(10)
{
- // copy constructor, only copies the filename (not the processed data)
+ // copy constructor, only copies the filename and params (not the processed data)
fFileName=handle.fFileName;
+ fOverWrite=handle.fOverWrite;
+ fNoiseThreshold=handle.fNoiseThreshold;
+ fNoiseMinimumEvents=handle.fNoiseMinimumEvents;
+ fMinNrStepsBeforeIncrease=handle.fMinNrStepsBeforeIncrease;
+ fMinIncreaseFromBaseLine=handle.fMinIncreaseFromBaseLine;
+ fStepDownDacSafe=handle.fStepDownDacSafe;
+ fMaxBaseLineLevel=handle.fMaxBaseLineLevel;
- fScanObj=NULL;
for (UInt_t chipNr=0; chipNr<11; chipNr++) {
for (UInt_t hs=0; hs<6; hs++) {
fMeanMultiplicity[hs][chipNr]=NULL;
fHitEventEfficiency[hs][chipNr]=NULL;
}
}
- fTriggers=NULL;
- for (Int_t module=0; module<240; module++) {
- fHandler[module]=NULL;
+ for (UInt_t mod=0; mod<240; mod++) {
+ fbModuleScanned[mod]=kFALSE;
}
Init();
}
if (fTriggers!=NULL) delete fTriggers;
if (fScanObj!=NULL) delete fScanObj;
- for (Int_t module=0; module<240; module++) {
- if (fHandler[module]!=NULL) {
- delete fHandler[module];
- }
- }
}
AliITSOnlineSPDscanAnalyzer& AliITSOnlineSPDscanAnalyzer::operator=(const AliITSOnlineSPDscanAnalyzer& handle) {
- // assignment operator, only copies the filename (not the processed data)
+ // assignment operator, only copies the filename and params (not the processed data)
if (this!=&handle) {
for (UInt_t hs=0; hs<6; hs++) {
for (UInt_t chipNr=0; chipNr<11; chipNr++) {
}
if (fTriggers!=NULL) delete fTriggers;
if (fScanObj!=NULL) delete fScanObj;
- for (Int_t module=0; module<240; module++) {
- if (fHandler[module]!=NULL) {
- delete fHandler[module];
- }
- }
fFileName=handle.fFileName;
+ fOverWrite=handle.fOverWrite;
+ fNoiseThreshold=handle.fNoiseThreshold;
+ fNoiseMinimumEvents=handle.fNoiseMinimumEvents;
+ fMinNrStepsBeforeIncrease=handle.fMinNrStepsBeforeIncrease;
+ fMinIncreaseFromBaseLine=handle.fMinIncreaseFromBaseLine;
+ fStepDownDacSafe=handle.fStepDownDacSafe;
+ fMaxBaseLineLevel=handle.fMaxBaseLineLevel;
- fScanObj=NULL;
- fType=99;
- fDacId=99;
- fRouterNr=99;
for (UInt_t chipNr=0; chipNr<11; chipNr++) {
for (UInt_t hs=0; hs<6; hs++) {
fMeanMultiplicity[hs][chipNr]=NULL;
fHitEventEfficiency[hs][chipNr]=NULL;
}
}
- fTriggers=NULL;
- for (Int_t module=0; module<240; module++) {
- fHandler[module]=NULL;
+ for (UInt_t mod=0; mod<240; mod++) {
+ fbModuleScanned[mod]=kFALSE;
}
+ fTriggers=NULL;
+ fHandler=NULL;
+ fScanObj=NULL;
+ fType=99;
+ fDacId=99;
+
Init();
}
return *this;
}
fScanObj = new AliITSOnlineSPDscan(fFileName.Data());
fType = fScanObj->GetType();
- fRouterNr = fScanObj->GetRouterNr();
delete fScanObj;
// init container
break;
}
- // set some default values (these should later be read from text file)
- fOverWrite=kFALSE;
- fNoiseThreshold=0.01;
- fNoiseMinimumEvents=100;
- fMinNrStepsBeforeIncrease=6;
- fMinIncreaseFromBaseLine=2;
- fStepDownDacSafe=2;
- fMaxBaseLineLevel=10;
-
}
void AliITSOnlineSPDscanAnalyzer::SetParam(const Char_t *pname, const Char_t *pval) {
TString name = pname;
TString val = pval;
if (name.CompareTo("fOverWrite")==0) {
- if (val.CompareTo("YES")==0) {
+ if (val.CompareTo("YES")==0 || val.CompareTo("1")==0) {
fOverWrite = kTRUE;
}
+ else fOverWrite = kFALSE;
}
else if (name.CompareTo("fNoiseThreshold")==0) {
fNoiseThreshold = val.Atof();
}
}
-Bool_t AliITSOnlineSPDscanAnalyzer::ProcessDeadPixels(Char_t *oldcalibDir) {
+void AliITSOnlineSPDscanAnalyzer::ReadParamsFromLocation(const Char_t *dirName) {
+ // opens file (default name) in dir dirName and reads parameters from it
+ TString paramsFileName = Form("%s/standal_params.txt",dirName);
+ ifstream paramsFile;
+ paramsFile.open(paramsFileName, ifstream::in);
+ if (paramsFile.fail()) {
+ printf("No config file (%s) present. Using default tuning parameters.\n",paramsFileName.Data());
+ }
+ else {
+ while(1) {
+ Char_t paramN[50];
+ Char_t paramV[50];
+ paramsFile >> paramN;
+ if (paramsFile.eof()) break;
+ paramsFile >> paramV;
+ SetParam(paramN,paramV);
+ if (paramsFile.eof()) break;
+ }
+ paramsFile.close();
+ }
+}
+
+Bool_t AliITSOnlineSPDscanAnalyzer::IsModuleScanned(UInt_t module) const {
+ // is this module scanned?
+ if (module<240) {
+ return fbModuleScanned[module];
+ }
+ return kFALSE;
+}
+
+Bool_t AliITSOnlineSPDscanAnalyzer::ProcessDeadPixels(/*Char_t *oldcalibDir*/) {
// process dead pixel data, for uniformity scan,
// NB: This will not be the general way of finding dead pixels.
if (fScanObj==NULL) {
Warning("AliITSOnlineSPDscanAnalyzer::ProcessDeadPixels","Dead pixels only for scan type %d.",kUNIMA);
return kFALSE;
}
+ // handler should be initialized
+ if (fHandler==NULL) {
+ Error("AliITSOnlineSPDscanAnalyzer::ProcessDeadPixels","Calibration handler is not initialized!");
+ return kFALSE;
+ }
UInt_t routerNr = fScanObj->GetRouterNr();
UInt_t rowStart = fScanObj->GetRowStart();
for (UInt_t chipNr=0; chipNr<10; chipNr++) {
if (fScanObj->GetChipPresent(hs,chipNr) && fScanObj->GetAverageMultiplicity(0,hs,chipNr)>0) { // check the status of the chippresent parameter in the mood header!!!!!!!!!!!!!!!!!!!!!!!!!!!!
UInt_t module = AliITSRawStreamSPD::GetModuleNumber(routerNr,hs,chipNr);
+ if (!fbModuleScanned[module]) {
+ fbModuleScanned[module]=kTRUE;
+ // fHandler[module]->SetFileLocation(oldcalibDir);
+ // fHandler[module]->ReadFromFile(module);
+ if (fOverWrite) {fHandler->ResetDeadForChip(routerNr,hs,chipNr);}
+ }
for (UInt_t col=0; col<32; col++) {
for (UInt_t row=rowStart; row<=rowEnd; row++) {
if (col!=1 && col!=9 && col!=17 && col!=25) { //exclude test columns!!!
if (fScanObj->GetHits(0,hs,chipNr,col,row)==0) {
- if (!fHandler[module]) {
- fHandler[module] = new AliITSOnlineCalibrationSPDhandler();
- fHandler[module]->SetFileLocation(oldcalibDir);
- fHandler[module]->ReadFromFile(module);
- if (fOverWrite) {fHandler[module]->ResetDeadForChip(routerNr,hs,chipNr);}
- }
- fHandler[module]->SetDeadPixel(routerNr,hs,chipNr,col,row);
+ fHandler->SetDeadPixel(routerNr,hs,chipNr,col,row);
}
}
}
-Bool_t AliITSOnlineSPDscanAnalyzer::ProcessNoisyPixels(Char_t *oldcalibDir) {
+Bool_t AliITSOnlineSPDscanAnalyzer::ProcessNoisyPixels(/*Char_t *oldcalibDir*/) {
// process noisy pixel data
if (fScanObj==NULL) {
Warning("AliITSOnlineSPDscanAnalyzer::ProcessNoisyPixels","No data!");
Warning("AliITSOnlineSPDscanAnalyzer::ProcessNoisyPixels","Noisy pixels only for scan type %d.",kNOISE);
return kFALSE;
}
-
+ // handler should be initialized
+ if (fHandler==NULL) {
+ Error("AliITSOnlineSPDscanAnalyzer::ProcessNoisyPixels","Calibration handler is not initialized!");
+ return kFALSE;
+ }
+ // check if enough statistics
if (fScanObj->GetTriggers(0)<fNoiseMinimumEvents) {
Warning("AliITSOnlineSPDscanAnalyzer::ProcessNoisyPixels","Process noisy: Too few events.");
return kFALSE;
}
+
UInt_t routerNr = fScanObj->GetRouterNr();
for (UInt_t hs=0; hs<6; hs++) {
for (UInt_t chipNr=0; chipNr<10; chipNr++) {
if (fScanObj->GetChipPresent(hs,chipNr)) { // check the status of the chippresent parameter in the mood header!!!!!!!!!!!!!!!!!!!!!!!!!!!!
UInt_t module = AliITSRawStreamSPD::GetModuleNumber(routerNr,hs,chipNr);
+ if (!fbModuleScanned[module]) {
+ fbModuleScanned[module]=kTRUE;
+ if (fOverWrite) {fHandler->ResetNoisyForChip(routerNr,hs,chipNr);}
+ }
for (UInt_t col=0; col<32; col++) {
for (UInt_t row=0; row<256; row++) {
if (fScanObj->GetHitsEfficiency(0,hs,chipNr,col,row)>fNoiseThreshold) {
- if (!fHandler[module]) {
- fHandler[module] = new AliITSOnlineCalibrationSPDhandler();
- fHandler[module]->SetFileLocation(oldcalibDir);
- fHandler[module]->ReadFromFile(module);
- if (fOverWrite) {fHandler[module]->ResetNoisyForChip(routerNr,hs,chipNr);}
- }
- fHandler[module]->SetNoisyPixel(routerNr,hs,chipNr,col,row);
+ fHandler->SetNoisyPixel(routerNr,hs,chipNr,col,row);
}
}
}
return kTRUE;
}
-Bool_t AliITSOnlineSPDscanAnalyzer::SaveDeadNoisyPixels(UInt_t module, Char_t *calibDir) {
- // save dead and noisy pixels to file in dir calibDir
- if (fHandler[module]!=NULL) {
- fHandler[module]->SetFileLocation(calibDir);
- fHandler[module]->WriteToFile(module);
- return kTRUE;
- }
- return kFALSE;
-}
-
-
Int_t AliITSOnlineSPDscanAnalyzer::GetDelay(UInt_t hs, UInt_t chipNr) {
// get delay
if (hs>=6 || chipNr>10) return -1;
return kFALSE;
}
-AliITSOnlineCalibrationSPDhandler* AliITSOnlineSPDscanAnalyzer::GetOnlineCalibrationHandler(UInt_t module) {
- // returns a pointer to the AliITSOnlineCalibrationSPDhandler
- if (module<240) return fHandler[module];
- else return NULL;
-}
-
UInt_t AliITSOnlineSPDscanAnalyzer::GetRouterNr() {
// returns the router nr of scan obj
if (fScanObj!=NULL) return fScanObj->GetRouterNr();
}
return fHitMapTot;
}
+
+TH2F* AliITSOnlineSPDscanAnalyzer::GetHitMapChip(UInt_t step, UInt_t hs, UInt_t chip) {
+ // creates and returns a pointer to a hitmap histo (chip style a la spdmood)
+ if (fScanObj==NULL) {
+ Error("AliITSOnlineSPDscanAnalyzer::GetHitMapChip","No data!");
+ return NULL;
+ }
+
+ TString histoName;
+ TString histoTitle;
+ histoName = Form("fChipHisto_%d_%d_%d", GetRouterNr(), hs, chip);
+ histoTitle = Form("Eq ID %d, Half Stave %d, Chip %d", GetRouterNr(), hs, chip);
+
+ TH2F *returnHisto = new TH2F(histoName.Data(), histoTitle.Data(), 32, -0.5, 31.5, 256, -0.5, 255.5);
+ returnHisto->SetMinimum(0);
+ for (UInt_t col=0; col<32; col++) {
+ for (UInt_t row=0; row<256; row++) {
+ returnHisto->Fill(col,row,fScanObj->GetHits(step,hs,chip,col,row));
+ }
+ }
+
+ return returnHisto;
+}
// This class is used in the detector algorithm framework //
// to process the data stored in special container files //
// (see AliITSOnlineSPDscan). For instance, minimum //
-// threshold values can be calculated. //
+// threshold values can be extracted. //
////////////////////////////////////////////////////////////
#include <TString.h>
class AliITSOnlineSPDscanAnalyzer {
public:
- AliITSOnlineSPDscanAnalyzer(const Char_t *fileName);
+ AliITSOnlineSPDscanAnalyzer(const Char_t *fileName, AliITSOnlineCalibrationSPDhandler *handler);
AliITSOnlineSPDscanAnalyzer(const AliITSOnlineSPDscanAnalyzer& handle);
~AliITSOnlineSPDscanAnalyzer();
AliITSOnlineSPDscanAnalyzer& operator=(const AliITSOnlineSPDscanAnalyzer& handle);
+ Bool_t IsModuleScanned(UInt_t module) const;
+ Bool_t IsOverWriteSet() const {return fOverWrite;}
+ void SetCalibHandler(AliITSOnlineCalibrationSPDhandler *handler) {fHandler=handler;}
void SetParam(const Char_t *pname, const Char_t *pval);
+ void ReadParamsFromLocation(const Char_t *dirName);
UInt_t GetType() const {return fType;}
UInt_t GetDacId() const {return fDacId;}
- UInt_t GetRouterNr() const {return fRouterNr;}
Int_t GetDelay(UInt_t hs, UInt_t chipNr);
Int_t GetMinTh(UInt_t hs, UInt_t chipNr);
Int_t GetNrNoisyUnima(UInt_t hs, UInt_t chipNr);
- Bool_t ProcessDeadPixels(Char_t *oldCalibDir);
- Bool_t ProcessNoisyPixels(Char_t *oldCalibDir);
- Bool_t SaveDeadNoisyPixels(UInt_t module, Char_t *calibDir);
+ Bool_t ProcessDeadPixels();
+ Bool_t ProcessNoisyPixels();
Bool_t ProcessNrTriggers();
- AliITSOnlineCalibrationSPDhandler* GetOnlineCalibrationHandler(UInt_t module);
AliITSOnlineSPDscan* GetOnlineScan() {return fScanObj;}
UInt_t GetRouterNr();
Bool_t GetHalfStavePresent(UInt_t hs);
TGraph* GetMeanMultiplicityG(UInt_t hs, UInt_t chipNr);
TGraph* GetHitEventEfficiencyG(UInt_t hs, UInt_t chipNr);
TH2F* GetHitMapTot(UInt_t step);
+ TH2F* GetHitMapChip(UInt_t step, UInt_t hs, UInt_t chip);
private:
UInt_t fType; // calib type
UInt_t fDacId; // dac id
- UInt_t fRouterNr; // router nr
TString fFileName; // container file name
enum calibvals{kMINTH,kMEANTH,kDAC,kUNIMA,kNOISE,kDELAY}; // calib types
- AliITSOnlineSPDscan *fScanObj; // container obj
- AliITSOnlineCalibrationSPDhandler *fHandler[240]; // calib help objs
+ AliITSOnlineSPDscan *fScanObj; // container obj
+ AliITSOnlineCalibrationSPDhandler *fHandler; // calib helper obj
+ Bool_t fbModuleScanned[240]; // is module used in scan?
TGraph* fMeanMultiplicity[6][11]; // mean mult graphs
TGraph* fHitEventEfficiency[6][11]; // hit event graphs
TString runType = GetRunType();
+ UInt_t nrEqForScan = 0;
+ UInt_t nrEqForPhysN = 0;
+ UInt_t nrEqForPhysD = 0;
-
+ // ******************************************************************************************** //
// *** REFERENCE DATA *** //
// Standalone runs:
runType == "DAQ_NOISY_PIX_SCAN" ||
runType == "DAQ_PIX_DELAY_SCAN" ||
runType == "DAQ_FO_UNIF_SCAN") {
- // Store the scan container files as reference data (one file for each equipment)
+ // Store the scan container files as reference data (0 or 1 file for each equipment)
for (UInt_t eq=0; eq<20; eq++) {
- TString id = Form("SPD_reference_%d",eq);
+ TString id = Form("SPD_ref_scan_%d",eq);
TList* list = GetFileSources(kDAQ,id.Data()); // (the id should be unique, so always 1 file)
if (list) {
TObjString* fileNameEntry = (TObjString*) list->First();
if (fileNameEntry!=NULL) {
+ nrEqForScan++;
TString fileName = GetFile(kDAQ, id, fileNameEntry->GetString().Data());
- TString refCAT = Form("SPDref_eq_%d.root",eq);
+ TString refCAT = Form("SPD_ref_scan_eq_%d",eq);
if (!StoreReferenceFile(fileName.Data(),refCAT.Data())) {
Log(Form("Failed to store reference file %s.",fileName.Data()));
return 1;
// Physics runs (online monitoring):
if (runType == "PHYSICS") {
- // *** code to be written *** //
+ // Store the phys "per run" container files as reference data (0 or 1 file for each equipment)
+ for (UInt_t eq=0; eq<20; eq++) {
+ TString id = Form("SPD_ref_phys_%d",eq);
+ TList* list = GetFileSources(kDAQ,id.Data()); // (the id should be unique, so always 1 file)
+ if (list) {
+ TObjString* fileNameEntry = (TObjString*) list->First();
+ if (fileNameEntry!=NULL) {
+ nrEqForPhysN++;
+ TString fileName = GetFile(kDAQ, id, fileNameEntry->GetString().Data());
+ TString refCAT = Form("SPD_ref_phys_eq_%d",eq);
+ if (!StoreReferenceFile(fileName.Data(),refCAT.Data())) {
+ Log(Form("Failed to store reference file %s.",fileName.Data()));
+ return 1;
+ }
+ }
+ }
+ }
+ // Store the phys "dead" container files as reference data (0 or 1 file for each equipment)
+ for (UInt_t eq=0; eq<20; eq++) {
+ TString id = Form("SPD_ref_phys_dead_%d",eq);
+ TList* list = GetFileSources(kDAQ,id.Data()); // (the id should be unique, so always 1 file)
+ if (list) {
+ TObjString* fileNameEntry = (TObjString*) list->First();
+ if (fileNameEntry!=NULL) {
+ nrEqForPhysD++;
+ TString fileName = GetFile(kDAQ, id, fileNameEntry->GetString().Data());
+ TString refCAT = Form("SPD_ref_phys_dead_eq_%d",eq);
+ if (!StoreReferenceFile(fileName.Data(),refCAT.Data())) {
+ Log(Form("Failed to store reference file %s.",fileName.Data()));
+ return 1;
+ }
+ }
+ }
+ }
}
+ // ******************************************************************************************** //
// *** NOISY AND DEAD DATA *** //
- if (runType == "DAQ_NOISY_PIX_SCAN" || runType == "PHYSICS") {
- // Read old calibration
- AliCDBEntry* cdbEntry = GetFromOCDB("Calib", "CalibSPD");
- TObjArray* spdEntry;
+ // Standalone runs:
+ if (runType == "DAQ_NOISY_PIX_SCAN") {
+ // Retrieve and unpack tared calibration files from FXS
+ TList* list = GetFileSources(kDAQ,"SPD_scan_noisy");
+ if (list) {
+ UInt_t index = 0;
+ while (list->At(index)!=NULL) {
+ TObjString* fileNameEntry = (TObjString*) list->At(index);
+ TString fileName = GetFile(kDAQ, "SPD_scan_noisy", fileNameEntry->GetString().Data());
+ TString command = Form("tar -xf %s",fileName.Data());
+ gSystem->Exec(command.Data());
+ index++;
+ }
+ }
+ // Create new database entries
+ TObjArray* spdEntryNoisy = new TObjArray(240);
+ spdEntryNoisy->SetOwner(kTRUE);
+ for(UInt_t module=0; module<240; module++){
+ AliITSCalibrationSPD* calObj = new AliITSCalibrationSPD();
+ spdEntryNoisy->Add(calObj);
+ }
+ // Add noisy from the copied FXS files
+ AliITSOnlineCalibrationSPDhandler* handler = new AliITSOnlineCalibrationSPDhandler();
+ TString fileLoc = ".";
+ handler->SetFileLocation(fileLoc.Data());
+ handler->ReadNoisyFromFiles();
+ for (Int_t module=0; module<240; module++) {
+ ((AliITSCalibrationSPD*) spdEntryNoisy->At(module)) -> SetNrBad( handler->GetNrNoisy(module) );
+ ((AliITSCalibrationSPD*) spdEntryNoisy->At(module)) -> SetBadList( handler->GetNoisyArray(module) );
+ }
+ delete handler;
+ // Store the new calibration objects in OCDB
+ Log("Noisy lists (scan) will be stored...");
+ AliCDBMetaData metaData;
+ metaData.SetBeamPeriod(0);
+ metaData.SetResponsible("Henrik Tydesjo");
+ metaData.SetComment("Created by SPD PreProcessor");
+ // validity for this run until infinity
+ if (!Store("Calib", "SPDNoisy", spdEntryNoisy, &metaData, 0, kTRUE)) {
+ Log("Failed to store calibration data.");
+ return 1;
+ }
+ Log("Database updated.");
+ delete spdEntryNoisy;
+ }
+
+ // Physics runs (online monitoring):
+ else if (runType == "PHYSICS") {
+
+ // Noisy pixels:
+ // Read noisy from previous calibration
+ AliCDBEntry* cdbEntry = GetFromOCDB("Calib", "SPDNoisy");
+ TObjArray* spdEntryNoisy;
if(cdbEntry) {
- spdEntry = (TObjArray*)cdbEntry->GetObject();
- if(!spdEntry) return 1;
+ spdEntryNoisy = (TObjArray*)cdbEntry->GetObject();
+ if(!spdEntryNoisy) return 1;
}
else {
Log("Old calibration not found in database. This is required for further processing.");
return 1;
}
-
- // Standalone runs:
- if (runType == "DAQ_NOISY_PIX_SCAN") {
- UInt_t nrUpdatedMods = 0;
- // Retrieve and unpack tared calibration files from FXS
- TList* list = GetFileSources(kDAQ,"SPD_noisy");
- if (list) {
- UInt_t index = 0;
- while (list->At(index)!=NULL) {
- TObjString* fileNameEntry = (TObjString*) list->At(index);
- TString fileName = GetFile(kDAQ, "SPD_noisy", fileNameEntry->GetString().Data());
- TString command = Form("tar -xf %s",fileName.Data());
- gSystem->Exec(command.Data());
- index++;
- }
+ AliITSOnlineCalibrationSPDhandler* handOld = new AliITSOnlineCalibrationSPDhandler();
+ handOld->ReadNoisyFromCalibObj(spdEntryNoisy);
+ // Retrieve and unpack tared calibration files from FXS
+ TList* listN = GetFileSources(kDAQ,"SPD_phys_noisy");
+ if (listN) {
+ UInt_t index = 0;
+ while (listN->At(index)!=NULL) {
+ TObjString* fileNameEntry = (TObjString*) listN->At(index);
+ TString fileName = GetFile(kDAQ, "SPD_phys_noisy", fileNameEntry->GetString().Data());
+ TString command = Form("tar -xf %s",fileName.Data());
+ gSystem->Exec(command.Data());
+ index++;
}
- // Update the database entries for the modules that were scanned
- AliITSOnlineCalibrationSPDhandler* handler = new AliITSOnlineCalibrationSPDhandler();
- TString fileLoc = ".";
- handler->SetFileLocation(fileLoc.Data());
+ }
+ AliITSOnlineCalibrationSPDhandler* handNew = new AliITSOnlineCalibrationSPDhandler();
+ handNew->SetFileLocation(".");
+ handNew->ReadNoisyFromFiles();
+ // add the new list to the old one
+ UInt_t nrNewNoisy = handOld->AddNoisyFrom(handNew);
+ // If new noisy pixels were found: Update calibration objects
+ if (nrNewNoisy>0) {
for (Int_t module=0; module<240; module++) {
- if (handler->ReadFromFile(module)) {
- ((AliITSCalibrationSPD*) spdEntry->At(module)) -> SetNrNoisy( handler->GetNrNoisy(module) );
- ((AliITSCalibrationSPD*) spdEntry->At(module)) -> SetNoisyList( handler->GetNoisyArray(module) );
- nrUpdatedMods++;
- }
+ ((AliITSCalibrationSPD*) spdEntryNoisy->At(module)) -> SetNrBad( handOld->GetNrNoisy(module) );
+ ((AliITSCalibrationSPD*) spdEntryNoisy->At(module)) -> SetBadList( handOld->GetNoisyArray(module) );
}
- delete handler;
- // Store the new calibration objects (if any modifications were made) in OCDB
- if (nrUpdatedMods>0) {
- Log(Form("Noisy lists for %d modules will be updated and stored...",nrUpdatedMods));
- AliCDBMetaData metaData;
- metaData.SetBeamPeriod(0);
- metaData.SetResponsible("Henrik Tydesjo");
- metaData.SetComment("Preprocessor test for SPD.");
- if (!Store("Calib", "CalibSPD", spdEntry, &metaData, 0, kTRUE)) {
- Log("Failed to store calibration data.");
- return 1;
- }
- Log("Database updated.");
+ // Store the new calibration objects in OCDB
+ Log("Noisy lists (phys) will be stored...");
+ AliCDBMetaData metaData;
+ metaData.SetBeamPeriod(0);
+ metaData.SetResponsible("Henrik Tydesjo");
+ metaData.SetComment("Created by SPD PreProcessor");
+ // validity for this run only
+ if (!Store("Calib", "SPDNoisy", spdEntryNoisy, &metaData, 0, kFALSE)) {
+ Log("Failed to store calibration data.");
+ return 1;
}
+ Log("Database updated.");
}
+ delete handNew;
- // Physics runs (online monitoring):
- if (runType == "PHYSICS") {
- // *** code to be written *** //
+ // Dead pixels:
+ // Retrieve and unpack tared calibration files from FXS
+ TList* listD = GetFileSources(kDAQ,"SPD_phys_dead");
+ if (listD) {
+ UInt_t index = 0;
+ while (listD->At(index)!=NULL) {
+ TObjString* fileNameEntry = (TObjString*) listD->At(index);
+ TString fileName = GetFile(kDAQ, "SPD_phys_dead", fileNameEntry->GetString().Data());
+ TString command = Form("tar -xf %s",fileName.Data());
+ gSystem->Exec(command.Data());
+ index++;
+ }
}
-
+ // Create new database entries
+ TObjArray* spdEntryDead = new TObjArray(240);
+ spdEntryDead->SetOwner(kTRUE);
+ for(UInt_t module=0; module<240; module++){
+ AliITSCalibrationSPD* calObj = new AliITSCalibrationSPD();
+ spdEntryDead->Add(calObj);
+ }
+ // Add dead from the copied FXS files
+ handOld->SetFileLocation(".");
+ handOld->ReadDeadFromFiles();
+ for (Int_t module=0; module<240; module++) {
+ ((AliITSCalibrationSPD*) spdEntryDead->At(module)) -> SetNrBad( handOld->GetNrDead(module) );
+ ((AliITSCalibrationSPD*) spdEntryDead->At(module)) -> SetBadList( handOld->GetDeadArray(module) );
+ }
+ delete handOld;
+ // Store the new calibration objects in OCDB
+ Log("Dead lists (phys) will be stored...");
+ AliCDBMetaData metaData;
+ metaData.SetBeamPeriod(0);
+ metaData.SetResponsible("Henrik Tydesjo");
+ metaData.SetComment("Created by SPD PreProcessor");
+ // validity for this run only
+ if (!Store("Calib", "SPDDead", spdEntryDead, &metaData, 0, kFALSE)) {
+ Log("Failed to store calibration data.");
+ return 1;
+ }
+ Log("Database updated.");
+ delete spdEntryDead;
}
-
return 0; // 0 means success
}
ClassImp(AliITSRawStreamSPD)
- // this map has to change, waiting for the new geometry
const Int_t AliITSRawStreamSPD::fgkDDLModuleMap[kDDLsNumber][kModulesPerDDL] = {
{ 0, 1, 4, 5, 80, 81, 84, 85, 88, 89, 92, 93},
{ 8, 9,12,13, 96, 97,100,101,104,105,108,109},
fHalfStaveNr=5;
}
// translate ("online") ddl, hs, chip nr to ("offline") module id :
- fModuleID = fgkDDLModuleMap[ddlID][fHalfStaveNr*2+fChipAddr/5];
- fOffset = 32 * (fChipAddr % 5);
+ fModuleID = GetOfflineModuleFromOnline(ddlID,fHalfStaveNr,fChipAddr);
}
else if ((fData & 0xC000) == 0x0000) { // trailer
UShort_t hitCount = fData & 0x1FFF;
fCol = (fData & 0x001F);
fRow = (fData >> 5) & 0x00FF;
- // translate ("online") chipcol, chiprow to ("offline") col (coord1), row (coord2):
- // This will change, waiting for new geometry!!!
- fCoord1 = fCol;
- // if (fModuleID < 80 && ddlID < 10) fCoord1=31-fCoord1;
- // else if (fModuleID >=80 && ddlID >=10) fCoord1=31-fCoord1;
- fCoord1 += fOffset;
- // if (ddlID>=10) fCoord1=159-fCoord1;
- fCoord2 = fRow;
- // if (fModuleID<80) fCoord2=255-fCoord2;
+ fCoord1 = GetOfflineColFromOnline(ddlID,fHalfStaveNr,fChipAddr,fCol);
+ fCoord2 = GetOfflineRowFromOnline(ddlID,fHalfStaveNr,fChipAddr,fRow);
return kTRUE;
}
if (chip<10) return ((( fCalHeadWord[7]>>(16+chip)) & 0x00000001) == 1);
else return kFALSE;
}
+
+
+
+
+Int_t AliITSRawStreamSPD::GetModuleNumber(UInt_t iDDL, UInt_t iModule) {
+ if (iDDL<20 && iModule<12) return fgkDDLModuleMap[iDDL][iModule];
+ else return 240;
+}
+
+
+
+
+Bool_t AliITSRawStreamSPD::OfflineToOnline(UInt_t module, UInt_t colM, UInt_t rowM, UInt_t& eq, UInt_t& hs, UInt_t& chip, UInt_t& col, UInt_t& row) {
+ // converts offline coordinates to online
+ eq = GetOnlineEqIdFromOffline(module);
+ hs = GetOnlineHSFromOffline(module);
+ chip = GetOnlineChipFromOffline(module,colM);
+ col = GetOnlineColFromOffline(module,colM);
+ row = GetOnlineRowFromOffline(module,rowM);
+ if (eq>=20 || hs>=6 || chip>=10 || col>=32 || row>=256) return kFALSE;
+ else return kTRUE;
+}
+
+
+Bool_t AliITSRawStreamSPD::OnlineToOffline(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row, UInt_t& module, UInt_t& colM, UInt_t& rowM) {
+ // converts online coordinates to offline
+ module = GetOfflineModuleFromOnline(eq,hs,chip);
+ colM = GetOfflineColFromOnline(eq,hs,chip,col);
+ rowM = GetOfflineRowFromOnline(eq,hs,chip,row);
+ if (module>=240 || colM>=160 || rowM>=256) return kFALSE;
+ else return kTRUE;
+}
+
+
+UInt_t AliITSRawStreamSPD::GetOnlineEqIdFromOffline(UInt_t module) {
+ // offline->online (eq)
+ for (UInt_t eqId=0; eqId<20; eqId++) {
+ for (UInt_t iModule=0; iModule<12; iModule++) {
+ if (GetModuleNumber(eqId,iModule)==(Int_t)module) return eqId;
+ }
+ }
+ return 20; // error
+}
+
+UInt_t AliITSRawStreamSPD::GetOnlineHSFromOffline(UInt_t module) {
+ // offline->online (hs)
+ for (UInt_t eqId=0; eqId<20; eqId++) {
+ for (UInt_t iModule=0; iModule<12; iModule++) {
+ if (GetModuleNumber(eqId,iModule)==(Int_t)module) return iModule/2;
+ }
+ }
+ return 6; // error
+}
+
+UInt_t AliITSRawStreamSPD::GetOnlineChipFromOffline(UInt_t module, UInt_t colM) {
+ // offline->online (chip)
+ for (UInt_t eq=0; eq<20; eq++) {
+ for (UInt_t iModule=0; iModule<12; iModule++) {
+ if (GetModuleNumber(eq,iModule)==(Int_t)module) {
+ return colM/32 + 5*(iModule%2);
+ }
+ }
+ }
+ return 10; // error
+}
+
+UInt_t AliITSRawStreamSPD::GetOnlineColFromOffline(UInt_t module, UInt_t colM) {
+ // offline->online (col)
+ if (colM<160) return colM%32;
+ else return 32; // error
+}
+
+UInt_t AliITSRawStreamSPD::GetOnlineRowFromOffline(UInt_t module, UInt_t rowM) {
+ // offline->online (row)
+ if (rowM<256) return rowM;
+ else return 256; // error
+}
+
+
+
+
+
+UInt_t AliITSRawStreamSPD::GetOfflineModuleFromOnline(UInt_t eqId, UInt_t hs, UInt_t chip) {
+ // online->offline (module)
+ if (eqId<20 && hs<6 && chip<10) return fgkDDLModuleMap[eqId][hs*2+chip/5];
+ else return 240;
+}
+
+UInt_t AliITSRawStreamSPD::GetOfflineColFromOnline(UInt_t eqId, UInt_t hs, UInt_t chip, UInt_t col) {
+ // online->offline (col)
+ if (eqId>=20 || hs>=6 || chip>=10 || col>=32) return 160; // error
+ UInt_t offset = 32 * (chip % 5);
+ return col+offset;
+}
+
+UInt_t AliITSRawStreamSPD::GetOfflineRowFromOnline(UInt_t eqId, UInt_t hs, UInt_t chip, UInt_t row) {
+ // online->offline (row)
+ if (eqId>=20 || hs>=6 || chip>=10 || row>=256) return 256; // error
+ return row;
+}
Int_t GetChipRow() const {return fRow;};
// module mapping
- static Int_t GetModuleNumber(UInt_t iDDL, UInt_t iModule) {return fgkDDLModuleMap[iDDL][iModule];}
- static Int_t GetModuleNumber(UInt_t iDDL, UInt_t iHS, UInt_t iChip) {return fgkDDLModuleMap[iDDL][iHS*2+iChip/5];}
+ static Int_t GetModuleNumber(UInt_t iDDL, UInt_t iModule);
+ static Int_t GetModuleNumber(UInt_t iDDL, UInt_t iHS, UInt_t iChip)
+ {return GetOfflineModuleFromOnline(iDDL,iHS,iChip);}
+
+ // coordinate conversions:
+ static Bool_t OfflineToOnline(UInt_t module, UInt_t colM, UInt_t RowM, UInt_t& eq, UInt_t& hs, UInt_t& chip, UInt_t& col, UInt_t& row);
+ static Bool_t OnlineToOffline(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row, UInt_t& module, UInt_t& colM, UInt_t& rowM);
+ // coordinate conversions - offline->online
+ static UInt_t GetOnlineEqIdFromOffline(UInt_t module);
+ static UInt_t GetOnlineHSFromOffline(UInt_t module);
+ static UInt_t GetOnlineChipFromOffline(UInt_t module, UInt_t colM);
+ static UInt_t GetOnlineColFromOffline(UInt_t module, UInt_t colM);
+ static UInt_t GetOnlineRowFromOffline(UInt_t module, UInt_t rowM);
+ // coordinate conversions - online->offline
+ static UInt_t GetOfflineModuleFromOnline(UInt_t eqId, UInt_t hs, UInt_t chip);
+ static UInt_t GetOfflineColFromOnline(UInt_t eqId, UInt_t hs, UInt_t chip, UInt_t col);
+ static UInt_t GetOfflineRowFromOnline(UInt_t eqId, UInt_t hs, UInt_t chip, UInt_t row);
+
Bool_t GetHalfStavePresent(UInt_t hs);
--- /dev/null
+/**************************************************************************
+ * 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 access to ITS SPD digits in raw data.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#include "AliITSRawStreamSPD.h"
+#include "AliRawReader.h"
+#include "AliLog.h"
+
+ClassImp(AliITSRawStreamSPD)
+
+
+const Int_t AliITSRawStreamSPD::fgkDDLModuleMap[kDDLsNumber][kModulesPerDDL] = {
+ { 4, 5, 0, 1, 80, 81, 84, 85, 88, 89, 92, 93},
+ {12,13, 8, 9, 96, 97,100,101,104,105,108,109},
+ {20,21,16,17,112,113,116,117,120,121,124,125},
+ {28,29,24,25,128,129,132,133,136,137,140,141},
+ {36,37,32,33,144,145,148,149,152,153,156,157},
+ {44,45,40,41,160,161,164,165,168,169,172,173},
+ {52,53,48,49,176,177,180,181,184,185,188,189},
+ {60,61,56,57,192,193,196,197,200,201,204,205},
+ {68,69,64,65,208,209,212,213,216,217,220,221},
+ {76,77,72,73,224,225,228,229,232,233,236,237},
+ { 7, 6, 3, 2, 83, 82, 87, 86, 91, 90, 95, 94},
+ {15,14,11,10, 99, 98,103,102,107,106,111,110},
+ {23,22,19,18,115,114,119,118,123,122,127,126},
+ {31,30,27,26,131,130,135,134,139,138,143,142},
+ {39,38,35,34,147,146,151,150,155,154,159,158},
+ {47,46,43,42,163,162,167,166,171,170,175,174},
+ {55,54,51,50,179,178,183,182,187,186,191,190},
+ {63,62,59,58,195,194,199,198,203,202,207,206},
+ {71,70,67,66,211,210,215,214,219,218,223,222},
+ {79,78,75,74,227,226,231,230,235,234,239,238}
+};
+
+
+AliITSRawStreamSPD::AliITSRawStreamSPD(AliRawReader* rawReader) :
+ AliITSRawStream(rawReader),
+ fEventNumber(-1),fChipAddr(0),fHalfStaveNr(0),fCol(0),fRow(0),
+ fData(0),fOffset(0),fHitCount(0),
+ fDataChar1(0),fDataChar2(0),fDataChar3(0),fDataChar4(0),
+ fFirstWord(kTRUE),fPrevEventId(0xffffffff)
+{
+ // create an object to read ITS SPD raw digits
+ fRawReader->Select("ITSSPD");
+ // reset calib header words
+ for (UInt_t iword=0; iword<kCalHeadLenMax; iword++) {
+ fCalHeadWord[iword]=0xffffffff;
+ }
+ NewEvent();
+}
+
+Bool_t AliITSRawStreamSPD::ReadNextShort()
+{
+ // read next 16 bit word into fData
+ if (fFirstWord) {
+ Bool_t b1 = fRawReader->ReadNextChar(fDataChar1);
+ if (!b1) return kFALSE;
+ Bool_t b2, b3, b4;
+ b2 = fRawReader->ReadNextChar(fDataChar2);
+ b3 = fRawReader->ReadNextChar(fDataChar3);
+ b4 = fRawReader->ReadNextChar(fDataChar4);
+ if (!(b2 && b3 && b4)) {
+ return kFALSE;
+ }
+ fData = fDataChar3+(fDataChar4<<8);
+ if ((*fRawReader->GetEventId())!=fPrevEventId) { // if new event...
+ NewEvent();
+ fPrevEventId=(*fRawReader->GetEventId());
+ }
+ fFirstWord=kFALSE;
+ }
+ else {
+ fFirstWord=kTRUE;
+ fData = fDataChar1+(fDataChar2<<8);
+ }
+
+ return kTRUE;
+}
+
+Bool_t AliITSRawStreamSPD::ReadNextInt()
+{
+ // reads next 32 bit into fDataChar1..4
+ // (if first 16 bits read already, just completes the present word)
+ if (fFirstWord) {
+ if (ReadNextShort() && ReadNextShort()) {
+ return kTRUE;
+ }
+ }
+ else {
+ if (ReadNextShort()) {
+ return kTRUE;
+ }
+ }
+ return kFALSE;
+}
+
+void AliITSRawStreamSPD::NewEvent()
+{
+ // call this to reset flags for a new event
+ for (UInt_t eqId=0; eqId<20; eqId++) {
+ fCalHeadRead[eqId]=kFALSE;
+ }
+ fEventNumber=-1;
+}
+
+Bool_t AliITSRawStreamSPD::ReadCalibHeader()
+{
+ // read the extra calibration header
+ // returns kTRUE if the header is present and has length > 0
+
+ Int_t ddlID = fRawReader->GetDDLID();
+ if (ddlID==-1) { // we may need to read one word to get the blockAttr
+ if (!ReadNextShort()) return kFALSE;
+ ddlID = fRawReader->GetDDLID();
+ }
+ UChar_t attr = fRawReader->GetBlockAttributes();
+ if (ddlID>=0 && ddlID<20) fCalHeadRead[ddlID]=kTRUE;
+ if ((attr & 0x40) == 0x40) { // is the header present?
+ if (ReadNextInt()) {
+ // length of cal header:
+ UInt_t calLen = fDataChar1+(fDataChar2<<8)+(fDataChar3<<16)+(fDataChar4<<24);
+ if (calLen>kCalHeadLenMax) {
+ fRawReader->AddMajorErrorLog(kCalHeaderLengthErr,Form("Header length %d > max = %d",calLen,kCalHeadLenMax));
+ AliWarning(Form("Header length problem. %d > %d (max)",calLen,kCalHeadLenMax));
+ return kFALSE;
+ }
+ else if (calLen>0) {
+ for (UInt_t iword=0; iword<calLen; iword++) {
+ if (ReadNextInt()) {
+ fCalHeadWord[iword] = fDataChar1+(fDataChar2<<8)+(fDataChar3<<16)+(fDataChar4<<24);
+ }
+ else {
+ fRawReader->AddMajorErrorLog(kCalHeaderLengthErr,"header length problem");
+ AliWarning("header length problem");
+ return kFALSE;
+ }
+ }
+ return kTRUE;
+ }
+ }
+ }
+
+ return kFALSE;
+}
+
+Bool_t AliITSRawStreamSPD::Next()
+{
+// read the next raw digit
+// returns kFALSE if there is no digit left
+
+ Int_t ddlID=-1;
+ fPrevModuleID = fModuleID;
+
+ while (ReadNextShort()) {
+
+ ddlID = fRawReader->GetDDLID();
+ if (ddlID>=0 && ddlID<20) {
+ if (!fCalHeadRead[ddlID]) {
+ ReadCalibHeader();
+ }
+ }
+ else {
+ fRawReader->AddMajorErrorLog(kDDLNumberErr,Form("Wrong DDL number %d",ddlID));
+ AliWarning(Form("DDL number error (= %d) , setting it to 19", ddlID));
+ ddlID=19;
+ }
+
+ if ((fData & 0xC000) == 0x4000) { // header
+ fHitCount = 0;
+ UShort_t eventNumber = (fData >> 4) & 0x007F;
+ if (fEventNumber < 0) {
+ fEventNumber = eventNumber;
+ }
+ else if (eventNumber != fEventNumber) {
+ fRawReader->AddMajorErrorLog(kEventNumberErr,Form("Reading event number %d instead of %d",eventNumber,fEventNumber));
+ AliWarning(Form("mismatching event numbers: %d != %d",eventNumber, fEventNumber));
+ }
+ fChipAddr = fData & 0x000F;
+ if (fChipAddr>9) {
+ fRawReader->AddMajorErrorLog(kChipAddrErr,Form("Overflow chip address %d - set to 9",fChipAddr));
+ AliWarning(Form("overflow chip addr (= %d) , setting it to 9", fChipAddr));
+ fChipAddr=9;
+ }
+ fHalfStaveNr = (fData & 0x3800)>>11;
+ if (fHalfStaveNr>5 || fRawReader->TestBlockAttribute(fHalfStaveNr)) {
+ fRawReader->AddMajorErrorLog(kStaveNumberErr,Form("Half stave number error %d - set to 5",fHalfStaveNr));
+ AliWarning(Form("half stave number error(=%d) , setting it to 5", fHalfStaveNr));
+ fHalfStaveNr=5;
+ }
+ // translate ("online") ddl, hs, chip nr to ("offline") module id :
+ fModuleID = GetOfflineModuleFromOnline(ddlID,fHalfStaveNr,fChipAddr);
+ // fOffset = 32 * (fChipAddr % 5);
+ }
+ else if ((fData & 0xC000) == 0x0000) { // trailer
+ UShort_t hitCount = fData & 0x1FFF;
+ if (hitCount != fHitCount){
+ fRawReader->AddMajorErrorLog(kNumbHitsErr,Form("Number of hits %d instead of %d",hitCount,fHitCount));
+ AliWarning(Form("wrong number of hits: %d != %d", fHitCount, hitCount));
+ }
+ }
+ else if ((fData & 0xC000) == 0x8000) { // pixel hit
+ fHitCount++;
+ fCol = (fData & 0x001F);
+ fRow = (fData >> 5) & 0x00FF;
+
+ fCoord1 = GetOfflineColFromOnline(ddlID,fHalfStaveNr,fChipAddr,fCol);
+ fCoord2 = GetOfflineRowFromOnline(ddlID,fHalfStaveNr,fChipAddr,fRow);
+
+ // translate ("online") chipcol, chiprow to ("offline") col (coord1), row (coord2):
+ // This will change, waiting for new geometry!!!
+ // fCoord1 = fCol;
+ // if (fModuleID < 80 && ddlID < 10) fCoord1=31-fCoord1;
+ // else if (fModuleID >=80 && ddlID >=10) fCoord1=31-fCoord1;
+ // fCoord1 += fOffset;
+ // if (ddlID>=10) fCoord1=159-fCoord1;
+ // fCoord2 = fRow;
+ // if (fModuleID<80) fCoord2=255-fCoord2;
+
+ return kTRUE;
+ }
+ else { // fill word
+ if ((fData & 0xC000) != 0xC000) {
+ fRawReader->AddMajorErrorLog(kWrongWordErr,"Wrong fill word");
+ AliWarning("wrong fill word!");
+ }
+ }
+
+ }
+
+ return kFALSE;
+}
+Bool_t AliITSRawStreamSPD::GetHalfStavePresent(UInt_t hs) {
+ // Reads the half stave present status from the block attributes
+ Int_t ddlID = fRawReader->GetDDLID();
+ if (ddlID==-1) {
+ fRawReader->AddMinorErrorLog(kHalfStaveStatusErr,"DDL ID = -1. Cannot read block attributes.");
+ AliWarning("DDL ID = -1. Cannot read block attributes. Return kFALSE.");
+ return kFALSE;
+ }
+ else {
+ if (hs>=6) {
+ fRawReader->AddMinorErrorLog(kHalfStaveStatusErr,Form( "HS >= 6 requested (%d). Return kFALSE.",hs));
+ AliWarning(Form("HS >= 6 requested (%d). Return kFALSE.",hs));
+ return kFALSE;
+ }
+ UChar_t attr = fRawReader->GetBlockAttributes();
+ if (((attr>>hs) & 0x01) == 0x01) { // bit set means not present
+ return kFALSE;
+ }
+ else {
+ return kTRUE;
+ }
+ }
+}
+
+Bool_t AliITSRawStreamSPD::GetHhalfStaveScanned(UInt_t hs) const {
+ if (hs<6) return (Bool_t)((fCalHeadWord[0]>>(6+hs)) & (0x00000001));
+ else return kFALSE;
+}
+Bool_t AliITSRawStreamSPD::GetHchipPresent(UInt_t hs, UInt_t chip) const {
+ if (hs<6 && chip<10) return ((( fCalHeadWord[hs/3+3]>>((hs%3)*10+chip)) & 0x00000001) == 1);
+ else return kFALSE;
+}
+UInt_t AliITSRawStreamSPD::GetHdacHigh(UInt_t hs) const {
+ if (hs<6) return (fCalHeadWord[hs/2+7]>>(24-16*(hs%2)) & 0x000000ff);
+ else return 0;
+}
+UInt_t AliITSRawStreamSPD::GetHdacLow(UInt_t hs) const {
+ if (hs<6) return (fCalHeadWord[hs/2+7]>>(16-16*(hs%2)) & 0x000000ff);
+ else return 0;
+}
+UInt_t AliITSRawStreamSPD::GetHTPAmp(UInt_t hs) const {
+ if (hs<6) return fCalHeadWord[hs+10];
+ else return 0;
+}
+Bool_t AliITSRawStreamSPD::GetHminTHchipPresent(UInt_t chip) const {
+ if (chip<10) return ((( fCalHeadWord[7]>>(16+chip)) & 0x00000001) == 1);
+ else return kFALSE;
+}
+
+
+
+
+Int_t AliITSRawStreamSPD::GetModuleNumber(UInt_t iDDL, UInt_t iModule) {
+ if (iDDL<20 && iModule<12) return fgkDDLModuleMap[iDDL][iModule];
+ else return 240;
+}
+
+
+
+
+Bool_t AliITSRawStreamSPD::OfflineToOnline(UInt_t module, UInt_t colM, UInt_t rowM, UInt_t& eq, UInt_t& hs, UInt_t& chip, UInt_t& col, UInt_t& row) {
+ // converts offline coordinates to online
+ eq = GetOnlineEqIdFromOffline(module);
+ hs = GetOnlineHSFromOffline(module);
+ chip = GetOnlineChipFromOffline(module,colM);
+ col = GetOnlineColFromOffline(module,colM);
+ row = GetOnlineRowFromOffline(module,rowM);
+ if (eq>=20 || hs>=6 || chip>=10 || col>=32 || row>=256) return kFALSE;
+ else return kTRUE;
+}
+
+
+Bool_t AliITSRawStreamSPD::OnlineToOffline(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row, UInt_t& module, UInt_t& colM, UInt_t& rowM) {
+ // converts online coordinates to offline
+ module = GetOfflineModuleFromOnline(eq,hs,chip);
+ colM = GetOfflineColFromOnline(eq,hs,chip,col);
+ rowM = GetOfflineRowFromOnline(eq,hs,chip,row);
+ if (module>=240 || colM>=160 || rowM>=256) return kFALSE;
+ else return kTRUE;
+}
+
+
+UInt_t AliITSRawStreamSPD::GetOnlineEqIdFromOffline(UInt_t module) {
+ // offline->online (eq)
+ for (UInt_t eqId=0; eqId<20; eqId++) {
+ for (UInt_t iModule=0; iModule<12; iModule++) {
+ if (GetModuleNumber(eqId,iModule)==(Int_t)module) return eqId;
+ }
+ }
+ return 20; // error
+}
+
+UInt_t AliITSRawStreamSPD::GetOnlineHSFromOffline(UInt_t module) {
+ // offline->online (hs)
+ for (UInt_t eqId=0; eqId<20; eqId++) {
+ for (UInt_t iModule=0; iModule<12; iModule++) {
+ if (GetModuleNumber(eqId,iModule)==(Int_t)module) return iModule/2;
+ }
+ }
+ return 6; // error
+}
+
+UInt_t AliITSRawStreamSPD::GetOnlineChipFromOffline(UInt_t module, UInt_t colM) {
+ // offline->online (chip)
+ for (UInt_t eq=0; eq<20; eq++) {
+ for (UInt_t iModule=0; iModule<12; iModule++) {
+ if (GetModuleNumber(eq,iModule)==(Int_t)module) {
+ if (eq<10) { // side A
+ return (159-colM)/32 + 5*(iModule%2);
+ }
+ else { // side C
+ return colM/32 + 5*(iModule%2);
+ }
+ }
+ }
+ }
+ return 10; // error
+}
+
+UInt_t AliITSRawStreamSPD::GetOnlineColFromOffline(UInt_t module, UInt_t colM) {
+ // offline->online (col)
+ if (module<80) { // inner layer
+ return colM%32;
+ }
+ else if (module<240) { // outer layer
+ return (159-colM)%32;
+ }
+ return 32; // error
+}
+
+UInt_t AliITSRawStreamSPD::GetOnlineRowFromOffline(UInt_t module, UInt_t rowM) {
+ // offline->online (row)
+ if (module<80) { // inner layer
+ return rowM;
+ }
+ else if (module<240) { // outer layer
+ return (255-rowM);
+ }
+ return 256; // error
+}
+
+
+
+
+
+UInt_t AliITSRawStreamSPD::GetOfflineModuleFromOnline(UInt_t eqId, UInt_t hs, UInt_t chip) {
+ // online->offline (module)
+ if (eqId<20 && hs<6 && chip<10) return fgkDDLModuleMap[eqId][hs*2+chip/5];
+ else return 240;
+}
+
+UInt_t AliITSRawStreamSPD::GetOfflineColFromOnline(UInt_t eqId, UInt_t hs, UInt_t chip, UInt_t col) {
+ // online->offline (col)
+ if (eqId>=20 || hs>=6 || chip>=10 || col>=32) return 160; // error
+ UInt_t offset = 32 * (chip % 5);
+ if (hs<2) {
+ if (eqId<10) {
+ return 159 - (31-col + offset); // inner layer, side A
+ }
+ else {
+ return col + offset; // inner layer, side C
+ }
+ }
+ else {
+ if (eqId<10) {
+ return 159 - (col + offset); // outer layer, side A
+ }
+ else {
+ return 31-col + offset; // outer layer, side C
+ }
+ }
+}
+
+UInt_t AliITSRawStreamSPD::GetOfflineRowFromOnline(UInt_t eqId, UInt_t hs, UInt_t chip, UInt_t row) {
+ // online->offline (row)
+ if (eqId>=20 || hs>=6 || chip>=10 || row>=256) return 256; // error
+ if (hs<2) {
+ return row;
+ }
+ else {
+ return 255-row;
+ }
+}
Int_t moduleNr = mod->GetIndex();
AliITSCalibrationSPD* calObj = (AliITSCalibrationSPD*) GetCalibrationModel(moduleNr);
- Int_t nrDead = calObj->GetNrDead();
+ Int_t nrDead = calObj->GetNrBad();
// cout << "Module --> " << moduleNr << endl; // dom
// cout << "nr of dead " << nrDead << endl; // dom
for (Int_t i=0; i<nrDead; i++) {
- GetMap()->DeleteHit(calObj->GetDeadColAt(i),calObj->GetDeadRowAt(i));
+ GetMap()->DeleteHit(calObj->GetBadColAt(i),calObj->GetBadRowAt(i));
// cout << "dead index " << i << endl; // dom
// cout << "col row --> " << calObj->GetDeadColAt(i) << " " << calObj->GetDeadRowAt(i) << endl; // dom
}
/////////////////////////////////////////////////////////////
// Checking overlaps
/////////////////////////////////////////////////////////////
- coolingsystemother->CheckOverlaps(0.01);
+ //coolingsystemother->CheckOverlaps(0.01);
/////////////////////////////////////////////////////////////
return coolingsystemother;
}
+ fgkSSDFlexHeight[1]));
ssdflexmother->AddNode(ssdflex[i],1,ssdflextrans[i]);
}
- ssdflexmother->CheckOverlaps(0.01);
+ //ssdflexmother->CheckOverlaps(0.01);
return ssdflexmother;
}
/////////////////////////////////////////////////////////////////////////////////
for(Int_t i=0; i<kendflexlayernumber+1; i++) delete transvector[i];
delete deltatransvector;
/////////////////////////////////////////////////////////////
- ssdendflexmother->CheckOverlaps(0.01);
+ //ssdendflexmother->CheckOverlaps(0.01);
return ssdendflexmother;
}
///////////////////////////////////////////////////////////////////////////////
fendladdersegment[1]->AddNode(fendladdercoolingtube[3],2,fendladdercoolingtubematrix[1][1]);
fendladdersegment[1]->AddNode(fendladdercoolingtube[4],1,fendladdercoolingtubematrix[1][2]);
fendladdersegment[1]->AddNode(fendladdercoolingtube[4],2,fendladdercoolingtubematrix[1][3]);
- fendladdersegment[0]->CheckOverlaps(0.01);
- fendladdersegment[1]->CheckOverlaps(0.01);
+ // fendladdersegment[0]->CheckOverlaps(0.01);
+ // fendladdersegment[1]->CheckOverlaps(0.01);
}
///////////////////////////////////////////////////////////////////////////////
void AliITSv11GeometrySSD::SetLadder(){
--- /dev/null
+/*
+- "Contact:" - henrik.tydesjo@cern.ch
+- "Link:" -
+- "Run Type:" - PHYSICS
+- "DA Type:" - MON
+- "Number of events needed:"
+- "Input Files:" - daq db config files: spd_physics_params , previous dead ref: ./calibResults/DeadReferenceTmp/* , previous dead lists: ./calibResults/DeadToFXS/*
+- "Output Files:" - Ref Data: ./calibResults/NoisyReference/* , Ref Data: ./calibResults/DeadReference/* , noisy lists: ./calibResults/NoisyToFXS/* , persistent files: ./calibResults/DeadReferenceTmp/*,./calibResults/DeadToFXS/*
+- "Trigger types used:" PHYSICS
+*/
+
+////////////////////////////////////////////////////////////////////////////////
+// This program can be compiled in two modes. //
+// //
+// 1. Online. With the DAQ DA framework. This is the default operating mode. //
+// //
+// 2. Offline. Without the DAQ DA framework. Define the SPD_DA_OFF //
+// environment var. Call this program with the name of the executable //
+// followed by the runNr and the data files to process. //
+// //
+////////////////////////////////////////////////////////////////////////////////
+
+extern "C" {
+#include "daqDA.h"
+}
+#include "event.h"
+#include "monitor.h"
+#include "AliRawReaderDate.h"
+#include "AliITSRawStreamSPD.h"
+#include "AliITSOnlineSPDphys.h"
+#include "AliITSOnlineSPDphysAnalyzer.h"
+#include "AliITSOnlineCalibrationSPDhandler.h"
+#include "AliLog.h"
+#include <iostream>
+#include <fstream>
+#include <TROOT.h>
+#include <TPluginManager.h>
+#include <TObjArray.h>
+#include <TString.h>
+
+int main(int argc, char **argv) {
+ if (argc<2) {
+ printf("Wrong number of arguments\n");
+ return -1;
+ }
+
+ // directory structure, hard coded
+ char *saveDirDeadToFXS = "./calibResults/DeadToFXS"; // may NOT delete content
+ char *saveDirDeadRef = "./calibResults/DeadReference"; // may delete content
+ char *saveDirDeadRefTmp = "./calibResults/DeadReferenceTmp"; // may NOT delete content
+ char *saveDirNoisyToFXS = "./calibResults/NoisyToFXS"; // may delete content
+ char *saveDirNoisyRef = "./calibResults/NoisyReference"; // may delete content
+ char *configFilesDir = "./configFiles"; // may delete content
+ // make sure the directory structure is put up correctly:
+ system("mkdir ./calibResults >& /dev/null");
+ system("mkdir ./calibResults/DeadToFXS >& /dev/null");
+ system("mkdir ./calibResults/DeadReference >& /dev/null");
+ system("mkdir ./calibResults/DeadReferenceTmp >& /dev/null");
+ system("mkdir ./calibResults/NoisyToFXS >& /dev/null");
+ system("mkdir ./calibResults/NoisyReference >& /dev/null");
+ system("mkdir ./configFiles >& /dev/null");
+ // parameters config file
+ TString paramsFileName = Form("%s/physics_params.txt",configFilesDir);
+
+ // This line is needed in case of a stand-alone application w/o
+ // $ROOTSYS/etc/system.rootrc file
+ gROOT->GetPluginManager()->AddHandler("TVirtualStreamerInfo",
+ "*",
+ "TStreamerInfo",
+ "RIO",
+ "TStreamerInfo()");
+
+ // turn off annoying warning messages
+ new AliLog;
+ AliLog::Instance()->SetGlobalDebugLevel(-20);
+
+
+ // ********* STEP 0: Get configuration files from db (if there are any) , then read parameters*********
+ UInt_t nrTuningParams = 0;
+ TObjArray paramNames; paramNames.SetOwner(kTRUE);
+ TObjArray paramVals; paramVals.SetOwner(kTRUE);
+
+ // tuning parameters:
+ Int_t par_status = 0;
+#ifndef SPD_DA_OFF
+ TString idp = "spd_physics_params";
+ par_status=daqDA_DB_getFile(idp.Data(),paramsFileName.Data());
+ if (par_status) {
+ printf("Failed to get config file %s: status=%d. Using default tuning parameters.\n",idp.Data(),par_status);
+ }
+#endif
+ if (par_status==0) {
+ ifstream paramsFile;
+ paramsFile.open(paramsFileName.Data(), ifstream::in);
+ if (paramsFile.fail()) {
+ printf("No config file (%s) present. Using default tuning parameters.\n",paramsFileName.Data());
+ }
+ else {
+ while(1) {
+ Char_t paramN[50];
+ Char_t paramV[50];
+ paramsFile >> paramN;
+ if (paramsFile.eof()) break;
+ paramsFile >> paramV;
+ TString* paramNS = new TString(paramN);
+ TString* paramVS = new TString(paramV);
+ paramNames.AddAtAndExpand((TObject*)paramNS,nrTuningParams);
+ paramVals.AddAtAndExpand((TObject*)paramVS,nrTuningParams);
+ nrTuningParams++;
+ if (paramsFile.eof()) break;
+ }
+ paramsFile.close();
+ }
+ }
+ // for (UInt_t i=0; i<nrTuningParams; i++) {
+ // printf("Entry %d: N=%s , V=%s\n",i,((TString*)paramNames.At(i))->Data(),((TString*)paramVals.At(i))->Data());
+ // }
+
+
+
+
+
+ // ********* STEP 1: Produce phys container files (Reference Data). ***********************************
+
+#ifndef SPD_DA_OFF
+ int runNr = atoi(getenv("DATE_RUN_NUMBER"));
+#else
+ int runNr = atoi(argv[1]);
+ int startSeg = 2;
+#endif
+
+
+ // container objects
+ AliITSOnlineSPDphys *physObj[20];
+ Bool_t bPhysInit[20];
+ for (UInt_t eqId=0; eqId<20; eqId++) {
+ physObj[eqId]=NULL;
+ bPhysInit[eqId]=kFALSE;
+ }
+
+
+ // loop over run segments in case of offline mode
+#ifdef SPD_DA_OFF
+ for (int segNr=startSeg; segNr<argc; segNr++) {
+#endif
+
+ int status;
+
+ /* define data source : */
+#ifndef SPD_DA_OFF
+ status=monitorSetDataSource( argv[1] ); // should be "^SPD" in order to get full detector online
+#else
+ status=monitorSetDataSource( argv[segNr] );
+#endif
+ if (status!=0) {
+ printf("monitorSetDataSource() failed : %s\n",monitorDecodeError(status));
+ return -1;
+ }
+ /* declare monitoring program */
+ status=monitorDeclareMp("ITS_SPD_PHYS");
+ if (status!=0) {
+ printf("monitorDeclareMp() failed : %s\n",monitorDecodeError(status));
+ return -1;
+ }
+ /* define wait event timeout - 1s max */
+ monitorSetNowait();
+ monitorSetNoWaitNetworkTimeout(1000);
+
+
+ UInt_t eventNr=0;
+
+ /* main loop (infinite) */
+ for(;;) {
+
+ struct eventHeaderStruct *event;
+ eventTypeType eventT;
+
+ /* check shutdown condition */
+#ifndef SPD_DA_OFF
+ if (daqDA_checkShutdown()) {break;}
+#endif
+
+ /* get next event (blocking call until timeout) */
+ status=monitorGetEventDynamic((void **)&event);
+ if (status==MON_ERR_EOF) {
+ printf ("End of File detected\n");
+ break; /* end of monitoring file has been reached */
+ }
+
+ if (status!=0) {
+ printf("monitorGetEventDynamic() failed : %s\n",monitorDecodeError(status));
+ break;
+ }
+
+ /* retry if got no event */
+ if (event==NULL) {
+ continue;
+ }
+
+ eventT=event->eventType;
+ if (eventT == PHYSICS_EVENT){
+
+ eventNr++;
+ // printf("eventNr %d\n",eventNr);
+
+ AliRawReader *reader = new AliRawReaderDate((void*)event);
+ AliITSRawStreamSPD *str = new AliITSRawStreamSPD(reader);
+
+ // for (UInt_t eqId=0; eqId<20; eqId++) {
+ // reader->Reset();
+ // reader->Select("ITSSPD",eqId,eqId);
+
+ while (str->Next()) {
+
+ Int_t eqId = reader->GetDDLID();
+ if (eqId>=0 && eqId<20) {
+ if (!bPhysInit[eqId]) {
+ TString fileName = Form("%s/SPDphys_run_%d_eq_%d.root",saveDirNoisyRef,runNr,eqId);
+ physObj[eqId] = new AliITSOnlineSPDphys(fileName.Data());
+ physObj[eqId]->AddRunNr(runNr);
+ physObj[eqId]->SetEqNr(eqId);
+ bPhysInit[eqId]=kTRUE;
+ }
+
+ UInt_t hs = str->GetHalfStaveNr();
+ UInt_t chip = str->GetChipAddr();
+ physObj[eqId]->IncrementHits(hs,chip,str->GetChipCol(),str->GetChipRow());
+
+ }
+ }
+
+ for (UInt_t eqId=0; eqId<20; eqId++) {
+ if (bPhysInit[eqId]) {
+ physObj[eqId]->IncrementNrEvents();
+ }
+ }
+
+ // }
+
+ delete str;
+ delete reader;
+
+ }
+
+ /* free resources */
+ free(event);
+
+ }
+
+
+#ifdef SPD_DA_OFF
+ printf("progress: %d\n",(unsigned int)( ((Float_t)(segNr-startSeg+1))/(argc-startSeg)*50 ));
+ }
+#endif
+
+ // clean up phys objects (also saves them)
+ for (UInt_t eqId=0; eqId<20; eqId++) {
+ if (physObj[eqId]!=NULL) delete physObj[eqId];
+ }
+
+
+
+
+
+ // ********* STEP 2: Analyze phys container files. ************************************************
+
+ // clear noisyToFXS dir:
+ TString command;
+ command = Form("cd %s; rm -f *",saveDirNoisyToFXS);
+ system(command.Data());
+ // delete dead.tar file
+ command = Form("cd %s; rm -f dead.tar",saveDirDeadToFXS);
+ system(command.Data());
+
+
+ // create calibration handler and read dead from previous calibrations
+ AliITSOnlineCalibrationSPDhandler* handler = new AliITSOnlineCalibrationSPDhandler();
+ handler->SetFileLocation(saveDirDeadToFXS);
+ handler->ReadDeadFromFiles();
+
+
+ UInt_t firstRunNrDead = runNr;
+
+
+ UInt_t nrEnoughStatNoisy = 0;
+ UInt_t nrEqActiveNoisy = 0;
+ Bool_t eqActiveNoisy[20];
+
+ // *** *** *** start loop over equipments (eq_id)
+ for (UInt_t eqId=0; eqId<20; eqId++) {
+ eqActiveNoisy[eqId] = kFALSE;
+
+ // create analyzer for this eq
+ TString fileName = Form("%s/SPDphys_run_%d_eq_%d.root",saveDirNoisyRef,runNr,eqId);
+ AliITSOnlineSPDphysAnalyzer *noisyAnalyzer = new AliITSOnlineSPDphysAnalyzer(fileName.Data(),handler);
+
+ // check data in container
+ if (noisyAnalyzer->GetEqNr() != eqId) {
+ if (noisyAnalyzer->GetEqNr() != 999) {
+ printf("Error: Mismatching EqId in Container data and filename (%d!=%d). Skipping.\n",
+ noisyAnalyzer->GetEqNr(),eqId);
+ }
+ delete noisyAnalyzer;
+ continue;
+ }
+
+ nrEqActiveNoisy++;
+ eqActiveNoisy[eqId] = kTRUE;
+
+ // configure analyzer with tuning parameters etc:
+ for (UInt_t i=0; i<nrTuningParams; i++) {
+ noisyAnalyzer->SetParam(((TString*)paramNames.At(i))->Data(),((TString*)paramVals.At(i))->Data());
+ }
+
+ printf("SPD phys STEP 2: Noisy search for eq %d\n",eqId);
+
+ // search for noisy pixels:
+ nrEnoughStatNoisy += noisyAnalyzer->ProcessNoisyPixels();
+
+ // copy this phys obj to temporary dead reference dir to process after noisy search
+ TString fileNameDead = Form("%s/SPDphys_dead_run_0_0_eq_%d.root",saveDirDeadRefTmp,eqId);
+ AliITSOnlineSPDphys* physObj = new AliITSOnlineSPDphys(fileNameDead.Data());
+ physObj->AddPhys(noisyAnalyzer->GetOnlinePhys());
+ if (physObj->GetNrRuns()>0) {
+ UInt_t firstRunNr = physObj->GetRunNr(0);
+ if (firstRunNrDead>firstRunNr) {
+ firstRunNrDead=firstRunNr;
+ }
+ }
+ // remove noisy pixels from dead hitmap
+ for (UInt_t iModule=0; iModule<12; iModule++) {
+ UInt_t module = AliITSRawStreamSPD::GetModuleNumber(eqId,iModule);
+ for (UInt_t ind=0; ind<handler->GetNrNoisy(module); ind++) {
+ UInt_t hs = handler->GetNoisyHSAt(module,ind);
+ UInt_t chip = handler->GetNoisyChipAt(module,ind);
+ UInt_t col = handler->GetNoisyColAt(module,ind);
+ UInt_t row = handler->GetNoisyRowAt(module,ind);
+ physObj->AddHits(hs,chip,col,row,-noisyAnalyzer->GetOnlinePhys()->GetHits(hs,chip,col,row));
+ }
+ }
+
+ delete physObj;
+ delete noisyAnalyzer;
+
+#ifndef SPD_DA_OFF
+ daqDA_progressReport((unsigned int)((eqId+1)*2.5));
+#else
+ printf("progress: %d\n",(unsigned int)(50+(eqId+1)*1.25));
+#endif
+ }
+ // *** *** *** end loop over equipments (eq_id)
+
+ printf("Noisy search finished. %d noisy pixels found. %d chips (%d) had enough statistics.\n",
+ handler->GetNrNoisy(),nrEnoughStatNoisy,nrEqActiveNoisy*60);
+ handler->SetFileLocation(saveDirNoisyToFXS);
+ handler->WriteNoisyToFiles();
+
+
+
+
+
+
+
+
+ UInt_t nrEnoughStatChips = 0;
+ UInt_t nrDeadChips = 0;
+ UInt_t nrInefficientChips = 0;
+ UInt_t nrEqActiveDead = 0;
+ Bool_t eqActiveDead[20];
+
+ // *** *** *** start loop over equipments (eq_id)
+ for (UInt_t eqId=0; eqId<20; eqId++) {
+ eqActiveDead[eqId] = kFALSE;
+
+ // setup analyzer for dead search
+ TString fileNameDead = Form("%s/SPDphys_dead_run_0_0_eq_%d.root",saveDirDeadRefTmp,eqId);
+ AliITSOnlineSPDphys* physObj = new AliITSOnlineSPDphys(fileNameDead.Data());
+ AliITSOnlineSPDphysAnalyzer* deadAnalyzer = new AliITSOnlineSPDphysAnalyzer(physObj,handler);
+ // check data in container
+ if (deadAnalyzer->GetEqNr() != eqId) {
+ if (deadAnalyzer->GetEqNr() != 999) {
+ printf("Error: Mismatching EqId in Dead Container data and filename (%d!=%d). Skipping.\n",
+ deadAnalyzer->GetEqNr(),eqId);
+ }
+ delete deadAnalyzer;
+ continue;
+ }
+
+ nrEqActiveDead++;
+ eqActiveDead[eqId] = kTRUE;
+
+ // configure analyzer with tuning parameters etc:
+ for (UInt_t i=0; i<nrTuningParams; i++) {
+ deadAnalyzer->SetParam(((TString*)paramNames.At(i))->Data(),((TString*)paramVals.At(i))->Data());
+ }
+
+ printf("SPD phys STEP 2: Dead search for eq %d\n",eqId);
+
+ // search for dead pixels:
+ nrEnoughStatChips += deadAnalyzer->ProcessDeadPixels();
+ nrDeadChips += deadAnalyzer->GetNrDeadChips();
+ nrInefficientChips += deadAnalyzer->GetNrInefficientChips();
+
+ delete deadAnalyzer;
+
+#ifndef SPD_DA_OFF
+ daqDA_progressReport((unsigned int)(50+(eqId+1)*2.5));
+#else
+ printf("progress: %d\n",(unsigned int)(75+(eqId+1)*1.25));
+#endif
+ }
+ // *** *** *** end loop over equipments (eq_id)
+
+
+ printf("Dead search finished. %d dead pixels in total.\n%d chips (%d) had enough statistics. %d chips were dead. %d chips were inefficient.\n",handler->GetNrDead(),nrEnoughStatChips,nrEqActiveDead*60,nrDeadChips,nrInefficientChips);
+ handler->SetFileLocation(saveDirDeadToFXS);
+ handler->WriteDeadToFilesAlways();
+
+
+
+
+
+
+
+
+ // if there is no chip in category "needsMoreStat"
+ if (nrEnoughStatChips+nrDeadChips+nrInefficientChips == nrEqActiveDead*60) {
+ // calibration is complete
+ printf("Dead calibration is complete.\n");
+ for (UInt_t eqId=0; eqId<20; eqId++) {
+ if (eqActiveDead[eqId]) {
+ TString fileName = Form("%s/SPDphys_dead_run_0_0_eq_%d.root",saveDirDeadRefTmp,eqId);
+//!!! // find out the run span
+//!!! AliITSOnlineSPDphys* physObj = new AliITSOnlineSPDphys(fileName.Data());
+//!!! UInt_t nrRuns = physObj->GetNrRuns();
+//!!! UInt_t firstRun = physObj->GetRunNr(0);
+//!!! UInt_t lastRun = physObj->GetRunNr(nrRuns-1);
+//!!! delete physObj;
+ // move file to ref dir
+ TString newFileName = Form("%s/SPDphys_dead_run_%d_%d_eq_%d.root",saveDirDeadRef,firstRunNrDead,runNr,eqId);
+ TString command = Form("mv -f %s %s",fileName.Data(),newFileName.Data());
+ system(command.Data());
+#ifndef SPD_DA_OFF
+ // send ref data to FXS
+ TString id = Form("SPD_ref_phys_dead_%d",eqId);
+ Int_t status = daqDA_FES_storeFile(newFileName.Data(),id.Data());
+ if (status!=0) {
+ printf("Failed to export file %s , status %d\n",newFileName.Data(),status);
+ return -1;
+ }
+#endif
+ }
+ else {
+ TString command = Form("rm -f %s/SPDphys_dead_run_0_0_eq_%d.root",saveDirDeadRefTmp,eqId);
+ system(command.Data());
+ }
+ }
+ }
+
+ // send reference data for this run to FXS
+#ifndef SPD_DA_OFF
+ for (UInt_t eqId=0; eqId<20; eqId++) {
+ if (eqActiveNoisy[eqId]) {
+ TString fileName = Form("%s/SPDphys_run_%d_eq_%d.root",saveDirNoisyRef,runNr,eqId);
+ TString id = Form("SPD_ref_phys_%d",eqId);
+ Int_t status = daqDA_FES_storeFile(fileName.Data(),id.Data());
+ if (status!=0) {
+ printf("Failed to export file %s , status %d\n",fileName.Data(),status);
+ return -1;
+ }
+ }
+ }
+#endif
+
+ // send dead files to FXS
+ // send a tared file of all the dead files
+ TString send_command = Form("cd %s; tar -cf dead_phys.tar *",saveDirDeadToFXS);
+ // printf("\n\n%s\n\n",command.Data());
+ system(send_command.Data());
+#ifndef SPD_DA_OFF
+ TString fileName = Form("%s/dead_phys.tar",saveDirDeadToFXS);
+ TString id = "SPD_phys_dead";
+ Int_t send_status = daqDA_FES_storeFile(fileName.Data(),id.Data());
+ if (send_status!=0) {
+ printf("Failed to export file %s , status %d\n",fileName.Data(),send_status);
+ return -1;
+ }
+#endif
+
+ // send noisy files to FXS
+ if (handler->GetNrNoisy()>0) { // there must be at least one file created
+ // send a tared file of all the noisy files
+ TString command = Form("cd %s; tar -cf noisy_phys.tar *",saveDirNoisyToFXS);
+ // printf("\n\n%s\n\n",command.Data());
+ system(command.Data());
+#ifndef SPD_DA_OFF
+ TString fileName = Form("%s/noisy_phys.tar",saveDirNoisyToFXS);
+ TString id = "SPD_phys_noisy";
+ Int_t status = daqDA_FES_storeFile(fileName.Data(),id.Data());
+ if (status!=0) {
+ printf("Failed to export file %s , status %d\n",fileName.Data(),status);
+ return -1;
+ }
+#endif
+ }
+
+
+
+
+ delete handler;
+
+
+ return 0;
+}
+/*
+- "Contact:" - henrik.tydesjo@cern.ch
+- "Link:" -
+- "Run Type:" - DAQ_MIN_TH_SCAN,DAQ_MEAN_TH_SCAN,DAQ_UNIFORMITY_SCAN,DAQ_NOISY_PIX_SCAN,DAQ_PIX_DELAY_SCAN,DAQ_FO_UNIF_SCAN
+- "DA Type:" - LDC
+- "Number of events needed:"
+- "Input Files:" - daq db config files: spd_standal_params,spd_perm_noisy , previous noisy lists: ./calibResults/ScanNoisy/* , raw data
+- "Output Files:" - Ref Data: ./calibResults/ScanReference/* , DCS update: ./calibResults/ScanDCSconfigToFXS/* , OCDB update: ./calibResults/ScanNoisyToFXS/* , persistent files: ./calibResults/ScanNoisy/*
+- "Trigger types used:"
+*/
+
////////////////////////////////////////////////////////////////////////////////
-// This program can be run in two modes. //
+// This program can be compiled in two modes. //
// //
// 1. With the DAQ DA framework on. This is the default operating mode. //
// Call this program with the name of the executable followed by the //
return -1;
}
- // make directory structure (if not here already):
+ // directory structure, hard coded
+ char *saveDirNoisy = "./calibResults/ScanNoisy"; // may NOT delete content
+ char *saveDirNoisyToFXS = "./calibResults/ScanNoisyToFXS"; // may delete content
+ char *saveDirDCSconfigToFXS= "./calibResults/ScanDCSconfigToFXS"; // may delete content
+ char *saveDirRef = "./calibResults/ScanReference"; // may delete content
+ char *configFilesDir = "./configFiles"; // may delete content
+ // make sure the directory structure is correct:
system("mkdir ./calibResults >& /dev/null");
- system("mkdir ./calibResults/Noisy >& /dev/null");
- system("mkdir ./calibResults/NoisyToFXS >& /dev/null");
- system("mkdir ./calibResults/DCSconfigToFXS >& /dev/null");
- system("mkdir ./calibResults/Parameters >& /dev/null");
- system("mkdir ./calibResults/Reference >& /dev/null");
- char *saveDirNoisy = "./calibResults/Noisy";
- char *saveDirNoisyToFXS = "./calibResults/NoisyToFXS";
- char *saveDirDCSconfigToFXS= "./calibResults/DCSconfigToFXS";
- char *saveDirParameters = "./calibResults/Parameters";
- char *saveDirRef = "./calibResults/Reference";
-
- char *paramsFileName = "./standal_params.txt";
- char *permNoisyFileName = "./perm_noisy.txt";
+ system("mkdir ./calibResults/ScanNoisy >& /dev/null");
+ system("mkdir ./calibResults/ScanNoisyToFXS >& /dev/null");
+ system("mkdir ./calibResults/ScanDCSconfigToFXS >& /dev/null");
+ system("mkdir ./calibResults/ScanReference >& /dev/null");
+ system("mkdir ./configFiles >& /dev/null");
+ // prameters config files
+ TString paramsFileName = Form("%s/standal_params.txt",configFilesDir);
+ TString permNoisyFileName = Form("%s/perm_noisy.txt",configFilesDir);
// This line is needed in case of a stand-alone application w/o
// $ROOTSYS/etc/system.rootrc file
Int_t status = 0;
#ifndef SPD_DA_OFF
TString idp = "spd_standal_params";
- status=daqDA_DB_getFile(idp.Data(),paramsFileName);
+ status=daqDA_DB_getFile(idp.Data(),paramsFileName.Data());
if (status) {
printf("Failed to get config file %s: status=%d. Using default tuning parameters.\n",idp.Data(),status);
}
#endif
if (status==0) {
ifstream paramsFile;
- paramsFile.open(paramsFileName, ifstream::in);
+ paramsFile.open(paramsFileName.Data(), ifstream::in);
if (paramsFile.fail()) {
- printf("No config file (%s) present. Using default tuning parameters.\n",paramsFileName);
+ printf("No config file (%s) present. Using default tuning parameters.\n",paramsFileName.Data());
}
else {
while(1) {
Int_t permstatus = 0;
#ifndef SPD_DA_OFF
TString idn = "spd_perm_noisy";
- permstatus=daqDA_DB_getFile(idn.Data(),permNoisyFileName);
+ permstatus=daqDA_DB_getFile(idn.Data(),permNoisyFileName.Data());
if (permstatus) {
- printf("Failed to get config file %s: status=%d. No additional noisy pixels added.\n",idn.Data(),permstatus);
+ printf("Failed to get config file %s: status=%d. No permanently noisy pixels will be added.\n",idn.Data(),permstatus);
}
#endif
// loop over run segments
for (int segNr=startSeg; segNr<argc; segNr++) {
-
int status;
/* define data source : this is argument 1 */
/* define wait event timeout - 1s max */
monitorSetNowait();
monitorSetNoWaitNetworkTimeout(1000);
-
-
- struct eventHeaderStruct *event;
- eventTypeType eventT;
+
+
UInt_t eventNr=0;
-
/* main loop (infinite) */
for(;;) {
-
+
+ struct eventHeaderStruct *event;
+ eventTypeType eventT;
+
/* check shutdown condition */
#ifndef SPD_DA_OFF
if (daqDA_checkShutdown()) {break;}
}
/* retry if got no event */
if (event==NULL) {
- printf("event==NULL\n");
continue;
}
eventT=event->eventType;
- if (eventT == PHYSICS_EVENT){
-
-
+ if (eventT == PHYSICS_EVENT) {
+
eventNr++;
// printf("eventNr %d\n",eventNr);
-
+
AliRawReader *reader = new AliRawReaderDate((void*)event);
AliITSRawStreamSPD *str = new AliITSRawStreamSPD(reader);
-
-
+
for (UInt_t eqId=0; eqId<20; eqId++) {
-
+
reader->Reset();
reader->Select("ITSSPD",eqId,eqId);
-
+
// Hit Event flags, specific for one event
Bool_t hitEventHSIncremented[6];
Bool_t hitEventChipIncremented[6][10];
hitEventChipIncremented[hs][chip] = kFALSE;
}
}
-
+
if (str->ReadCalibHeader()) {
// first check the type:
if (bScanInit[eqId] && type[eqId]!=str->GetHtype()) {
#else
if (type[eqId]!=MINTH || minTHchipPresent[eqId][chip] || runNr<=416900) {
#endif
- //*************************************************************************
+ //*************************************************************************
scanObj[eqId]->IncrementHits(currentStep[eqId],hs,chip,str->GetChipCol(),str->GetChipRow());
-
+
if (!hitEventHSIncremented[hs]) {
scanObj[eqId]->IncrementHitEventsTot(currentStep[eqId],hs);
hitEventHSIncremented[hs]=kTRUE;
}
-
+
if (!hitEventChipIncremented[hs][chip]) {
scanObj[eqId]->IncrementHitEvents(currentStep[eqId],hs,chip);
hitEventChipIncremented[hs][chip]=kTRUE;
}
- status = monitorLogout();
- if (status != 0) {
- printf("monitorLogout() failed : %s\n",monitorDecodeError(status));
- return -1;
- }
-
#ifndef SPD_DA_OFF
daqDA_progressReport((unsigned int)( ((Float_t)(segNr-startSeg+1))/(argc-startSeg)*50 ));
#else
}
- // clean up scan objects
+
+ // clean up scan objects (which also saves them)
for (UInt_t eqId=0; eqId<20; eqId++) {
if (scanObj[eqId]!=NULL) delete scanObj[eqId];
}
UInt_t nrNoisyFilesProduced=0;
UInt_t nrDCSconfigFilesProduced=0;
- AliITSOnlineSPDscanAnalyzer *analyzer;
+ AliITSOnlineCalibrationSPDhandler* handler = new AliITSOnlineCalibrationSPDhandler();
+ AliITSOnlineSPDscanAnalyzer *analyzer = NULL;
+ AliITSOnlineCalibrationSPDhandler* handlerPermNoisy = NULL;
+ // fill permanent noisy list to add later...
+ if (permstatus==0) {
+ handlerPermNoisy = new AliITSOnlineCalibrationSPDhandler();
+ UInt_t permNoisy = handlerPermNoisy->ReadNoisyFromText(permNoisyFileName.Data(),240); // 240 = read for all modules
+ if (permNoisy>0) {
+ printf("%d noisy pixels read from permanent list.\n",permNoisy);
+ }
+ }
+
// *** *** *** start loop over equipments (eq_id)
for (int eqId=0; eqId<20; eqId++) {
// create analyzer for this eq
TString fileName = Form("%s/SPDcal_run_%d_eq_%d.root",saveDirRef,runNr,eqId);
- analyzer = new AliITSOnlineSPDscanAnalyzer(fileName.Data());
+ analyzer = new AliITSOnlineSPDscanAnalyzer(fileName.Data(),handler);
// configure analyzer with tuning parameters etc:
for (UInt_t i=0; i<nrTuningParams; i++) {
UInt_t routerNr = analyzer->GetRouterNr();
if (type!=99) {
if (type==DAC) {
- printf("SPD calibrator Step2: eqId %d, type %d, dacId %d\n",eqId,type,dacId);
+ printf("SPD scan calibrator Step2: eqId %d, type %d, dacId %d\n",eqId,type,dacId);
}
- else printf("SPD calibrator Step2: eqId %d type %d\n",eqId,type);
+ else printf("SPD scan calibrator Step2: eqId %d type %d\n",eqId,type);
}
}
else if (type==NOISE) {
- if (analyzer->ProcessNoisyPixels(saveDirNoisy)) {
+ // read previous noisy list
+ handler->SetFileLocation(saveDirNoisy);
+ handler->ReadFromFiles();
+ if (analyzer->ProcessNoisyPixels(/*saveDirNoisy*/)) {
+ if (permstatus==0) {
+ handler->AddNoisyFrom(handlerPermNoisy);
+ }
// init dcs config text file
TString dcsConfigFileName = Form("%s/dcsConfig_run_%d_eq_%d.txt",saveDirDCSconfigToFXS,runNr,eqId);
ofstream dcsfile;
dcsfile << "RunNumber=" << runNr << "\n";
dcsfile << "Type=" << type << "\n";
dcsfile << "Router=" << routerNr << "\n";
- dcsfile << "ActualDetCoonfiguration=" << "0,-1,-1\n"; // dummy values for now
+ dcsfile << "ActualDetConfiguration=" << "0,-1,-1\n"; // dummy values for now
dcsfile << "[NOISY]\n";
nrDCSconfigFilesProduced++;
for (UInt_t iModule=0; iModule<12; iModule++) {
UInt_t module = AliITSRawStreamSPD::GetModuleNumber(eqId,iModule);
- AliITSOnlineCalibrationSPDhandler *handler = analyzer->GetOnlineCalibrationHandler(module);
- if (permstatus==0) { // add permanent noisy list
- UInt_t newNoisy = handler->ReadNoisyFromText(permNoisyFileName);
- if (newNoisy>0) {
- printf("%d additional noisy pixels added from permanent list.\n",newNoisy);
- }
- }
- if (analyzer->SaveDeadNoisyPixels(module,saveDirNoisy)) {
- UInt_t nrNoisy = handler->GetNrNoisy(module);
+ UInt_t nrNoisy = handler->GetNrNoisy(module);
+ if (analyzer->IsModuleScanned(module) || analyzer->IsOverWriteSet()) {
UInt_t headkey=20*10*6;
for (UInt_t ind=0; ind<nrNoisy; ind++) {
- UInt_t newkey = handler->GetNoisyEqIdAt(module,ind)*10*6 +
- handler->GetNoisyHSAt(module,ind)*10 +
- handler->GetNoisyChipAt(module,ind);
+ UInt_t nEqId = handler->GetNoisyEqIdAt(module,ind);
+ UInt_t nHs = handler->GetNoisyHSAt(module,ind);
+ UInt_t nChip = handler->GetNoisyChipAt(module,ind);
+ UInt_t newkey = nEqId*10*6 + nHs*10 + nChip;
if (newkey!=headkey) { // print eqId,hs,chip_header
headkey = newkey;
- dcsfile << "-" << newkey/(6*10) << "," << (newkey%(6*10))/10 << "," << (newkey%(6*10))%10 << "\n";
+ dcsfile << "-" << nEqId << "," << nHs << "," << nChip << "\n";
}
dcsfile << handler->GetNoisyColAt(module,ind) << "," << handler->GetNoisyRowAt(module,ind) << "\n";
}
+ handler->SetFileLocation(saveDirNoisy);
+ handler->WriteNoisyToFile(module);
+ handler->SetFileLocation(saveDirNoisyToFXS);
+ handler->WriteNoisyToFile(module);
nrNoisyFilesProduced++;
- TString command = Form("cp %s/SPD_DeadNoisy_%d.root %s/.",saveDirNoisy,module,saveDirNoisyToFXS);
- system(command.Data());
}
}
dcsfile.close();
dcsfile << "ActualDetCoonfiguration=" << "0,-1,-1\n"; // dummy values for now
dcsfile << "[DACvalues]\n";
nrDCSconfigFilesProduced++;
- TString ofileName = Form("%s/minth_eq_%d.txt",saveDirParameters,eqId);
- ofstream ofile;
- ofile.open (ofileName.Data());
+ // TString ofileName = Form("%s/minth_eq_%d.txt",saveDirParameters,eqId);
+ // ofstream ofile;
+ // ofile.open (ofileName.Data());
for (UInt_t hs=0; hs<6; hs++) {
for (UInt_t chipNr=0; chipNr<10; chipNr++) {
Int_t minTh = -1;
printf("MinTh failed for Eq %d , HS %d , Chip %d\n",eqId,hs,chipNr);
}
}
- ofile << minTh;
- ofile << "\t";
+ // ofile << minTh;
+ // ofile << "\t";
}
- ofile << "\n";
+ // ofile << "\n";
}
- ofile.close();
+ // ofile.close();
dcsfile.close();
}
dcsfile << "ActualDetCoonfiguration=" << "0,-1,-1\n"; // dummy values for now
dcsfile << "[DACvalues]\n";
nrDCSconfigFilesProduced++;
- TString ofileName = Form("%s/delay_eq_%d.txt",saveDirParameters,eqId);
- ofstream ofile;
- ofile.open (ofileName.Data());
+// TString ofileName = Form("%s/delay_eq_%d.txt",saveDirParameters,eqId);
+// ofstream ofile;
+// ofile.open (ofileName.Data());
for (UInt_t hs=0; hs<6; hs++) {
for (UInt_t chipNr=0; chipNr<10; chipNr++) {
Int_t clockCycle = -1;
printf("Delay failed for Eq %d , HS %d , Chip %d\n",eqId,hs,chipNr);
}
}
- ofile << delayCtrl << "/" << miscCtrl;
- ofile << "\t";
+ // ofile << delayCtrl << "/" << miscCtrl;
+ // ofile << "\t";
}
- ofile << "\n";
+ // ofile << "\n";
}
- ofile.close();
+ // ofile.close();
dcsfile.close();
}
}
// *** *** *** end loop over equipments (eq_id)
+ delete handler;
+ if (handlerPermNoisy!=NULL) {
+ delete handlerPermNoisy;
+ }
+
+
+
+ // send noisy data to FXS
if (nrNoisyFilesProduced>0) {
// send a tared file of all new noisy maps
- TString command = Form("cd %s; tar -cf noisy.tar *",saveDirNoisyToFXS);
- printf("\n\n%s\n\n",command.Data());
+ TString command = Form("cd %s; tar -cf noisy_scan.tar *",saveDirNoisyToFXS);
+ // printf("\n\n%s\n\n",command.Data());
system(command.Data());
#ifndef SPD_DA_OFF
- TString fileName = Form("%s/noisy.tar",saveDirNoisyToFXS);
- TString id = "SPD_noisy";
+ TString fileName = Form("%s/noisy_scan.tar",saveDirNoisyToFXS);
+ TString id = "SPD_scan_noisy";
Int_t status = daqDA_FES_storeFile(fileName.Data(),id.Data());
if (status!=0) {
printf("Failed to export file %s , status %d\n",fileName.Data(),status);
#endif
}
+ // send dcs config files to FXS
if (nrDCSconfigFilesProduced>0) {
// send a tared file of all the dcsConfig text files
TString command = Form("cd %s; tar -cf dcsConfig.tar *",saveDirDCSconfigToFXS);
#endif
}
+ // send reference data to FXS
+#ifndef SPD_DA_OFF
+ for (UInt_t eqId=0; eqId<20; eqId++) {
+ if (bScanInit[eqId]) {
+ TString fileName = Form("%s/SPDcal_run_%d_eq_%d.root",saveDirRef,runNr,eqId);
+ TString id = Form("SPD_ref_scan_%d",eqId);
+ Int_t status = daqDA_FES_storeFile(fileName.Data(),id.Data());
+ if (status!=0) {
+ printf("Failed to export file %s , status %d\n",fileName.Data(),status);
+ return -1;
+ }
+ }
+ }
+#endif
+
+
+
return 0;
#pragma link C++ class AliITSOnlineSPDscanMeanTh+;
#pragma link C++ class AliITSOnlineSPDscanMultiple+;
#pragma link C++ class AliITSOnlineSPDscanSingle+;
+#pragma link C++ class AliITSOnlineSPDphys+;
+#pragma link C++ class AliITSOnlineSPDphysAnalyzer+;
+#pragma link C++ class AliITSOnlineSPDphysInfo+;
#pragma link C++ class AliITSPreprocessorSDD+;
#pragma link C++ class AliITSOnlineSDD+;
#pragma link C++ class AliITSOnlineSDDBase+;
AliITSOnlineSPDscanMeanTh.cxx \
AliITSOnlineSPDscanMultiple.cxx \
AliITSOnlineSPDscanSingle.cxx \
+ AliITSOnlineSPDphys.cxx \
+ AliITSOnlineSPDphysAnalyzer.cxx \
+ AliITSOnlineSPDphysInfo.cxx \
AliITSBadChannelsAuxSPD.cxx \
AliITSBadChannelsSPD.cxx \
AliITSChannelSPD.cxx \