/*
$Log$
+Revision 1.2 2006/02/03 11:31:18 masera
+Calibration framework improved (E. Crescio)
+
+Revision 1.1 2005/10/11 12:31:50 masera
+Preprocessor classes for SPD (Paul Nilsson)
+
*/
///////////////////////////////////////////////////////////////////////////
// .readNoisyChannels.C (Read noisy channels from the CDB)
// .findDeadChannels.C (Locate and store dead channels in the CDB)
// .readDeadChannels.C (Read dead channels from the CDB)
+//
+// Modified by D. Elia, H. Tydesjo
+// March 2006: Mixed up coordinates, bug fixed
+//
///////////////////////////////////////////////////////////////////////////
+#include "TFile.h"
#include "AliITSPreprocessorSPD.h"
-
+#include "AliCDBEntry.h"
+#include "AliITSCalibrationSPD.h"
ClassImp(AliITSPreprocessorSPD)
{
// Get the current digit
digitSPD = (AliITSdigitSPD*) digitsArraySPD->At(digit);
- row = digitSPD->GetCoord1();
- column = digitSPD->GetCoord2();
+ column = digitSPD->GetCoord1();
+ row = digitSPD->GetCoord2();
// Fill the digits histogram
((TH2F*)(*fDigitsHistogram)[module])->Fill(column, row);
-
+
} // end digit loop
} // end module loop
} // end event loop
} // end numberOfEvents > 0
+
else
{
status = kFALSE;
// Keep track of the highest module number
if (module > fHighestModuleNumber) fHighestModuleNumber = module;
- AliInfo(Form("New dead pixel in (m,c,r) = (%d,%d,%d)", module, xBin - 1, yBin - 1));
+ //AliInfo(Form("New dead pixel in (m,c,r) = (%d,%d,%d)", module, xBin - 1, yBin - 1));
}
} // end bin loop
if (fInit)
{
// (For testing purposes, noisy channels can be inserted here)
- // SetFakeNoisyChannel(4,10,10);
-
+ //SetFakeNoisyChannel(4,10,10);
// Initialize counters
fNumberOfBadChannels = new Int_t[fNumberOfModules];
for (UInt_t module = 0; module < fNumberOfModules; module++)
}
}
}
-
+
// Calculate the average. Remove the largest neighboring bin
// (Correction for potential clusters of noisy channels)
if (fSelectedAlgorithm == kOptimizedForRealDataRMS)
{
// Square the max bin content before removing it from the average calculation
maxBinContent *= maxBinContent;
-
// RMS
- averageBinContent = sqrt((sumBinContent - maxBinContent)/(Float_t)(numberOfNeighboringBins - 1));
+ averageBinContent = TMath::Sqrt((sumBinContent - maxBinContent)/(Float_t)(numberOfNeighboringBins - 1));
}
else
{
{
// Get the current digit
digitSPD = (AliITSdigitSPD*) digitsArraySPD->At(digit);
- newDigit[0] = digitSPD->GetCoord1(); // row
- newDigit[1] = digitSPD->GetCoord2(); // column
+ newDigit[0] = digitSPD->GetCoord1(); // column
+ newDigit[1] = digitSPD->GetCoord2(); // row
newDigit[2] = digitSPD->GetSignal(); // signal
// Check if this channel is noisy
}
}
-
+/*
//__________________________________________________________________________
Bool_t AliITSPreprocessorSPD::Store(AliCDBId &id, AliCDBMetaData *md)
// Store the container
if(!AliCDBManager::Instance()->IsDefaultStorageSet()) {
- AliError("No storage set!");
- return status;
- }
+ //AliError("No storage set!");
+ // return status;
+ AliCDBManager::Instance()->SetDefaultStorage("local://Calib");
+ }
if (AliCDBManager::Instance()->GetDefaultStorage()->Put(fBadChannelsContainer, id, md))
{
return status;
}
-
+*/
//__________________________________________________________________________
-void AliITSPreprocessorSPD::ConvertObjToIntArray(void)
+void AliITSPreprocessorSPD::ConvertObjToIntArray()
{
// Convert the bad channel TObjArray to an Int_t array
//
}
}
}
+
+
+//__________________________________________________________________________
+Bool_t AliITSPreprocessorSPD::Store(AliCDBId& /*id*/, AliCDBMetaData* /*md*/, Int_t runNumber)
+{
+ // Store the bad channels object in the calibration database
+ // (See the corresponding run macro for further explanations)
+ //
+ // Input : fBadChannelsObjArray (now containing all found bad channels), object meta data
+ // Output: Database file containing the bad channels
+ // Return: kTRUE if successful
+
+ Bool_t status = kFALSE;
+
+ AliInfo("Storing bad channels");
+
+ if(!AliCDBManager::Instance()->IsDefaultStorageSet()) {
+ AliWarning("No storage set! Will use dummy one");
+ AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
+ }
+
+
+ AliCDBEntry *entrySPD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSPD", runNumber);
+ if(!entrySPD){
+ AliWarning("Calibration object retrieval failed! Dummy calibration will be used.");
+ AliCDBStorage *origStorage = AliCDBManager::Instance()->GetDefaultStorage();
+ AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
+
+ entrySPD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSPD", runNumber);
+ AliCDBManager::Instance()->SetDefaultStorage(origStorage);
+ }
+
+ TObjArray *respSPD = (TObjArray *)entrySPD->GetObject();
+
+ if ((! respSPD)) {
+ AliWarning("Can not get calibration from calibration database !");
+ return kFALSE;
+ }
+
+
+ Int_t i=0;
+ AliITSChannelSPD *channel = 0;
+ AliITSCalibrationSPD* res;
+ for (Int_t module=0; module<respSPD->GetEntries(); module++) {
+ res = (AliITSCalibrationSPD*) respSPD->At(module);
+ Int_t j = 0;
+ while (j < fNumberOfBadChannels[module]) {
+ channel = (AliITSChannelSPD *) fBadChannelsObjArray->At(i++);
+ res->AddDead(channel->GetColumn(),channel->GetRow());
+ // Go to next bad channel
+ j++;
+ }
+ }
+
+
+ AliCDBManager::Instance()->Put(entrySPD);
+ entrySPD->SetObject(NULL);
+ entrySPD->SetOwner(kTRUE);
+
+ delete entrySPD;
+ status=kTRUE;
+ return status;
+}