#include "AliITSOnlineCalibrationSPDhandler.h"
#include "AliITSOnlineCalibrationSPD.h"
+#include "AliITSTriggerConditions.h"
#include "AliITSIntMap.h"
#include <TObjArray.h>
#include <TArrayI.h>
//____________________________________________________________________________________________
AliITSOnlineCalibrationSPDhandler::AliITSOnlineCalibrationSPDhandler():
- fFileLocation(".")
+ fFileLocation("."),
+ fTriggerConditions(0)
{
// constructor
for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
}
//____________________________________________________________________________________________
AliITSOnlineCalibrationSPDhandler::AliITSOnlineCalibrationSPDhandler(const AliITSOnlineCalibrationSPDhandler& handle):
- fFileLocation(".")
+ fFileLocation("."),
+ fTriggerConditions(handle.fTriggerConditions)
{
// copy constructor
for (UInt_t gloChip=0; gloChip<1200; gloChip++) {
UInt_t row = GetRowFromKey(key);
SetDeadPixel(eq,hs,chip,col,row);
}
- UInt_t eq = calib->GetEqNr();
- if (calib->IsDeadEq()) SetDeadEq(eq);
- else SetDeadEq(eq,kFALSE);
+ UInt_t eq1 = calib->GetEqNr();
+ if (calib->IsDeadEq()) SetDeadEq(eq1);
+ else SetDeadEq(eq1,kFALSE);
for (UInt_t hs=0; hs<6; hs++) {
- if (calib->IsDeadHS(hs)) SetDeadHS(eq,hs);
- else SetDeadHS(eq,hs,kFALSE);
+ if (calib->IsDeadHS(hs)) SetDeadHS(eq1,hs);
+ else SetDeadHS(eq1,hs,kFALSE);
for (UInt_t chip=0; chip<10; chip++) {
- if (calib->IsDeadChip(hs,chip)) SetDeadChip(eq,hs,chip);
- else SetDeadChip(eq,hs,chip,kFALSE);
+ if (calib->IsDeadChip(hs,chip)) SetDeadChip(eq1,hs,chip);
+ else SetDeadChip(eq1,hs,chip,kFALSE);
}
}
if (inactive) {
return newNrNoisy;
}
//____________________________________________________________________________________________
+void AliITSOnlineCalibrationSPDhandler::ReadPITConditionsFromText(const char *fileName) {
+ // read PIT conditions file from text as printed out at P2
+ // !!! please note that the chip numbering goes from 9 to 0 in the text. In PVSS panels is the opposite.
+ if(fTriggerConditions) fTriggerConditions->ResetAll();
+ else fTriggerConditions = new AliITSTriggerConditions();
+ fTriggerConditions->ReadFromTextFile(fileName);
+}
+//____________________________________________________________________________________________
+Bool_t AliITSOnlineCalibrationSPDhandler::ReadPITConditionsFromDB(Int_t runNr, const Char_t *storage){
+// read PIT conditions from the OCDB
+
+ AliCDBManager* man = AliCDBManager::Instance();
+ TString storageSTR = Form("%s",storage);
+ if (storageSTR.CompareTo("default")==0) {
+ if(!man->IsDefaultStorageSet()) {
+ man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
+ }
+ }
+ else {
+ storageSTR = Form("local://%s",storage);
+ man->SetDefaultStorage(storageSTR.Data());
+ }
+ AliCDBEntry *cdbEntry = man->Get("TRIGGER/SPD/PITConditions", runNr);
+ if(cdbEntry) {
+ fTriggerConditions = (AliITSTriggerConditions*)cdbEntry->GetObject();
+ return kTRUE;
+ } else return kFALSE;
+}
+//____________________________________________________________________________________________
void AliITSOnlineCalibrationSPDhandler::WriteToFilesAlways() {
// write the lists of active,dead,noisy to files
for (UInt_t eq=0; eq<20; eq++) {
}
//____________________________________________________________________________________________
#ifndef SPD_DA_OFF
-Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadModuleFromDB(UInt_t module, Int_t runNr, Char_t *storage, Bool_t treeSerial) {
+Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadModuleFromDB(UInt_t module, Int_t runNr, const Char_t *storage, Bool_t treeSerial) {
// reads dead pixels from DB for given module and runNr
AliCDBManager* man = AliCDBManager::Instance();
TString storageSTR = Form("%s",storage);
if (storageSTR.CompareTo("default")==0) {
if(!man->IsDefaultStorageSet()) {
- man->SetDefaultStorage("local://$ALICE_ROOT");
+ man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
}
}
else {
return kTRUE;
}
//____________________________________________________________________________________________
-Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyModuleFromDB(UInt_t module, Int_t runNr, Char_t *storage, Bool_t treeSerial) {
+Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyModuleFromDB(UInt_t module, Int_t runNr, const Char_t *storage, Bool_t treeSerial) {
// reads noisy pixels from DB for given module and runNr
AliCDBManager* man = AliCDBManager::Instance();
TString storageSTR = Form("%s",storage);
if (storageSTR.CompareTo("default")==0) {
if(!man->IsDefaultStorageSet()) {
- man->SetDefaultStorage("local://$ALICE_ROOT");
+ man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
}
}
else {
return kTRUE;
}
//____________________________________________________________________________________________
-Bool_t AliITSOnlineCalibrationSPDhandler::ReadFromDB(Int_t runNr, Char_t *storage, Bool_t treeSerial) {
+Bool_t AliITSOnlineCalibrationSPDhandler::ReadFromDB(Int_t runNr, const Char_t *storage, 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,storage,treeSerial) && ReadDeadFromDB(runNr,storage,treeSerial));
}
//____________________________________________________________________________________________
-Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromDB(Int_t runNr, Char_t *storage, Bool_t treeSerial) {
+Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromDB(Int_t runNr, const Char_t *storage, 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();
TString storageSTR = Form("%s",storage);
if (storageSTR.CompareTo("default")==0) {
if(!man->IsDefaultStorageSet()) {
- man->SetDefaultStorage("local://$ALICE_ROOT");
+ man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
}
}
else {
return kTRUE;
}
//____________________________________________________________________________________________
-Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromDB(Int_t runNr, Char_t *storage, Bool_t treeSerial) {
+Bool_t AliITSOnlineCalibrationSPDhandler::ReadNoisyFromDB(Int_t runNr, const Char_t *storage, 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();
TString storageSTR = Form("%s",storage);
if (storageSTR.CompareTo("default")==0) {
if(!man->IsDefaultStorageSet()) {
- man->SetDefaultStorage("local://$ALICE_ROOT");
+ man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
}
}
else {
return kTRUE;
}
//____________________________________________________________________________________________
-Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromDBasNoisy(Int_t runNr, Char_t *storage, Bool_t treeSerial) {
+Bool_t AliITSOnlineCalibrationSPDhandler::ReadDeadFromDBasNoisy(Int_t runNr, const Char_t *storage, Bool_t treeSerial) {
// reads dead pixels (put as noisy) 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();
TString storageSTR = Form("%s",storage);
if (storageSTR.CompareTo("default")==0) {
if(!man->IsDefaultStorageSet()) {
- man->SetDefaultStorage("local://$ALICE_ROOT");
+ man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
}
}
else {
return kTRUE;
}
//____________________________________________________________________________________________
-Bool_t AliITSOnlineCalibrationSPDhandler::WriteToDB(Int_t runNrStart, Int_t runNrEnd, Char_t *storage) {
+Bool_t AliITSOnlineCalibrationSPDhandler::WriteToDB(Int_t runNrStart, Int_t runNrEnd, const Char_t *storage) {
// writes dead and noisy pixels to DB for given runNrs
// overwrites any previous entries
return (WriteNoisyToDB(runNrStart,runNrEnd,storage) && WriteDeadToDB(runNrStart,runNrEnd,storage));
}
//____________________________________________________________________________________________
-Bool_t AliITSOnlineCalibrationSPDhandler::WriteDeadToDB(Int_t runNrStart, Int_t runNrEnd, Char_t *storage) {
+Bool_t AliITSOnlineCalibrationSPDhandler::WriteDeadToDB(Int_t runNrStart, Int_t runNrEnd, const Char_t *storage) {
// writes dead pixels to DB for given runNrs
// overwrites any previous entries
AliCDBManager* man = AliCDBManager::Instance();
TString storageSTR = Form("%s",storage);
if (storageSTR.CompareTo("default")==0) {
if(!man->IsDefaultStorageSet()) {
- man->SetDefaultStorage("local://$ALICE_ROOT");
+ man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
}
}
else {
return kTRUE;
}
//____________________________________________________________________________________________
-Bool_t AliITSOnlineCalibrationSPDhandler::WriteDeadToDBasNoisy(Int_t runNrStart, Int_t runNrEnd, Char_t *storage) {
+Bool_t AliITSOnlineCalibrationSPDhandler::WriteDeadToDBasNoisy(Int_t runNrStart, Int_t runNrEnd, const Char_t *storage) {
// writes dead pixels to DB for given runNrs
// overwrites any previous entries
AliCDBManager* man = AliCDBManager::Instance();
TString storageSTR = Form("%s",storage);
if (storageSTR.CompareTo("default")==0) {
if(!man->IsDefaultStorageSet()) {
- man->SetDefaultStorage("local://$ALICE_ROOT");
+ man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
}
}
else {
return kTRUE;
}
//____________________________________________________________________________________________
-Bool_t AliITSOnlineCalibrationSPDhandler::WriteNoisyToDB(Int_t runNrStart, Int_t runNrEnd, Char_t *storage) {
+Bool_t AliITSOnlineCalibrationSPDhandler::WriteNoisyToDB(Int_t runNrStart, Int_t runNrEnd, const Char_t *storage) {
// writes noisy pixels to DB for given runNrs
// overwrites any previous entries
AliCDBManager* man = AliCDBManager::Instance();
TString storageSTR = Form("%s",storage);
if (storageSTR.CompareTo("default")==0) {
if(!man->IsDefaultStorageSet()) {
- man->SetDefaultStorage("local://$ALICE_ROOT");
+ man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
}
}
else {
}
return (!IsActiveEq(eq) || IsDeadEq(eq) || !IsActiveHS(eq,hs) || IsDeadHS(eq,hs) || !IsActiveChip(eq,hs,chip) || IsDeadChip(eq,hs,chip));
}
+//____________________________________________________________________________________________
+Bool_t AliITSOnlineCalibrationSPDhandler::IsNoisyChip(UInt_t eq, UInt_t hs, UInt_t chip) const {
+ // returns true if there is at least a noisy pixel in the chip
+
+ if (eq>=20 || hs>=6 || chip>=10) {
+ Error("AliITSOnlineCalibrationSPDhandler::IsNoisyChip", "eq,hs,chip (%d,%d,%d) out of bounds.",eq,hs,chip);
+ return kFALSE;
+ }
+ Bool_t isNoisy = kFALSE;
+
+ UInt_t nrNoisy = GetNrNoisy();
+ for (UInt_t i=0; i<nrNoisy; i++) {
+ if(eq == GetNoisyEqIdAt(i)){
+ if(hs == GetNoisyHSAt(i)){
+ if(chip == GetNoisyChipAt(i)) {
+ UInt_t col = GetNoisyColAt(i);
+ UInt_t row = GetNoisyRowAt(i);
+ if (IsPixelNoisy(eq,hs,chip,col,row)) isNoisy = kTRUE;
+ }
+ }
+ }
+ }
+ return isNoisy;
+}
+//____________________________________________________________________________________________
+Bool_t AliITSOnlineCalibrationSPDhandler::WritePITConditionsToDB(Int_t runNrStart, Int_t runNrEnd, const Char_t *storage) {
+ // writes noisy pixels to DB for given runNrs
+ // overwrites any previous entries
+ AliCDBManager* man = AliCDBManager::Instance();
+ TString storageSTR = Form("%s",storage);
+ if (storageSTR.CompareTo("default")==0) {
+ if(!man->IsDefaultStorageSet()) {
+ man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
+ }
+ }
+ else {
+ storageSTR = Form("local://%s",storage);
+ man->SetDefaultStorage(storageSTR.Data());
+ }
+ AliCDBMetaData* metaData = new AliCDBMetaData();
+ metaData->SetResponsible("Annalisa Mastroserio");
+ metaData->SetComment("Created by AliITSOnlineCalibrationSPDhandler.");
+ AliCDBId idCalSPD("TRIGGER/SPD/PITConditions",runNrStart,runNrEnd);
+ AliCDBEntry* cdbEntry = new AliCDBEntry((TObject*)fTriggerConditions,idCalSPD,metaData);
+ man->Put(cdbEntry);
+ delete cdbEntry;
+ delete metaData;
+ return kTRUE;
+}
+
+//____________________________________________________________________________________________
+Bool_t AliITSOnlineCalibrationSPDhandler::SetInactiveChipInPITmask(UInt_t eq, UInt_t hs, UInt_t chip){
+ //
+ fTriggerConditions->SetInActiveChip(eq,hs,chip);
+ return kTRUE;
+}
+//____________________________________________________________________________________________
+Bool_t AliITSOnlineCalibrationSPDhandler::UnSetInactiveChipInPITmask(UInt_t eq, UInt_t hs, UInt_t chip){
+ //
+ fTriggerConditions->SetInActiveChip(eq,hs,chip);
+ return kTRUE;
+}
+
+