#include "Cal/AliTRDCalDet.h"
#include "Cal/AliTRDCalDCS.h"
#include "Cal/AliTRDCalDCSv2.h"
+#include "Cal/AliTRDCalDCSFEEv2.h"
#include "Cal/AliTRDCalPID.h"
#include "Cal/AliTRDCalMonitoring.h"
#include "Cal/AliTRDCalChamberStatus.h"
#include "Cal/AliTRDCalPadStatus.h"
#include "Cal/AliTRDCalSingleChamberStatus.h"
#include "Cal/AliTRDCalTrkAttach.h"
+#include "Cal/AliTRDCalOnlineGainTable.h"
ClassImp(AliTRDcalibDB)
,fPRFwid(0)
,fPRFpad(0)
,fPIDResponse(NULL)
+ ,fOnlineGainTableID(0)
{
//
// Default constructor
,fPRFwid(0)
,fPRFpad(0)
,fPIDResponse(NULL)
+ ,fOnlineGainTableID(0)
{
//
// Copy constructor (not that it make any sense for a singleton...)
delete [] fPRFsmp;
fPRFsmp = 0;
}
- if(fPIDResponse) delete fPIDResponse;
+
+ if (fPIDResponse) {
+ delete fPIDResponse;
+ fPIDResponse = 0x0;
+ }
Invalidate();
case kIDGainFactorChamber :
return CacheCDBEntry(kIDGainFactorChamber ,"TRD/Calib/ChamberGainFactor");
break;
+
+ case kIDOnlineGainFactor :
+ switch(GetOnlineGainTableID()) {
+ case 0:
+ // For testing purposes only !!!
+ AliInfo("No gain table name from OCDB. Use default table!");
+ return CacheCDBEntry(kIDOnlineGainFactor ,"TRD/Calib/Krypton_2011-01");
+ break;
+ case 1:
+ // Online gain table ID 1
+ return CacheCDBEntry(kIDOnlineGainFactor ,"TRD/Calib/Krypton_2011-01");
+ break;
+ }
+ break;
+
case kIDNoiseChamber :
- return CacheCDBEntry(kIDNoiseChamber ,"TRD/Calib/DetNoise");
+ return CacheCDBEntry(kIDNoiseChamber ,"TRD/Calib/DetNoise");
break;
case kIDNoisePad :
- return CacheCDBEntry(kIDNoisePad ,"TRD/Calib/PadNoise");
+ return CacheCDBEntry(kIDNoisePad ,"TRD/Calib/PadNoise");
break;
-
// Parameters defined per pad
case kIDPRFWidth :
return CacheCDBEntry(kIDPRFWidth ,"TRD/Calib/PRFWidth");
break;
case kIDPIDNN :
return CacheCDBEntry(kIDPIDNN ,"TRD/Calib/PIDNN");
+ break;
case kIDPIDLQ :
return CacheCDBEntry(kIDPIDLQ ,"TRD/Calib/PIDLQ");
break;
}
return fCDBCache[id];
+
}
//_____________________________________________________________________________
}
}
+ fOnlineGainTableID = 0;
+
}
+
//_____________________________________________________________________________
Float_t AliTRDcalibDB::GetNoise(Int_t det, Int_t col, Int_t row)
{
}
+//_____________________________________________________________________________
+AliTRDCalOnlineGainTableROC* AliTRDcalibDB::GetOnlineGainTableROC(Int_t det)
+{
+ //
+ // Returns the online gain factor table for a given ROC.
+ //
+
+ const AliTRDCalOnlineGainTable *calOnline
+ = dynamic_cast<const AliTRDCalOnlineGainTable *>
+ (GetCachedCDBObject(kIDOnlineGainFactor));
+ if (!calOnline) {
+ return 0x0;
+ }
+
+ return calOnline->GetGainTableROC(det);
+
+}
+
+//_____________________________________________________________________________
+Float_t AliTRDcalibDB::GetOnlineGainFactor(Int_t det, Int_t col, Int_t row)
+{
+ //
+ // Returns the online gain factor for the given pad.
+ //
+
+ const AliTRDCalOnlineGainTable *calOnline
+ = dynamic_cast<const AliTRDCalOnlineGainTable *>
+ (GetCachedCDBObject(kIDOnlineGainFactor));
+ if (!calOnline) {
+ return -1;
+ }
+
+ return calOnline->GetGainCorrectionFactor(det,row,col);
+
+}
+
//_____________________________________________________________________________
AliTRDCalROC *AliTRDcalibDB::GetGainFactorROC(Int_t det)
{
// only remains: two different numbers >= 0
return nMixed;
+
}
//_____________________________________________________________________________
if (!strcmp(dcsArr->At(0)->ClassName(),"AliTRDCalDCS")) calver = 1;
if (!strcmp(dcsArr->At(0)->ClassName(),"AliTRDCalDCSv2")) calver = 2;
- if (calver == 1) {
+ if (calver == 1) {
+
// DCS object
const AliTRDCalDCS *calDCS = dynamic_cast<const AliTRDCalDCS *>(dcsArr->At(esor));
if(!calDCS){
return;
}
filterType = calDCS->GetGlobalFilterType();
- } else if (calver == 2) {
+
+ }
+ else if (calver == 2) {
+
// DCSv2 object
const AliTRDCalDCSv2 *calDCSv2 = dynamic_cast<const AliTRDCalDCSv2 *>(dcsArr->At(esor));
if(!calDCSv2){
return;
}
filterType = calDCSv2->GetGlobalFilterType();
- } else AliError("NO DCS/DCSv2 OCDB entry found!");
+
+ }
+ else {
+
+ AliError("NO DCS/DCSv2 OCDB entry found!");
+
+ }
}
//_____________________________________________________________________________
-void AliTRDcalibDB::GetGlobalConfiguration(TString &config){
+Int_t AliTRDcalibDB::GetOnlineGainTableID()
+{
+ //
+ // Get the gain table ID from the DCS
+ //
+
+ if (fOnlineGainTableID > 0) {
+ return fOnlineGainTableID;
+ }
+
+ const TObjArray *dcsArr = dynamic_cast<const TObjArray *>(GetCachedCDBObject(kIDDCS));
+ if (!dcsArr){
+ return -1;
+ }
+
+ Int_t esor = 0; // Take SOR
+ Int_t calver = 0; // Check CalDCS version
+ if (!strcmp(dcsArr->At(0)->ClassName(),"AliTRDCalDCS")) calver = 1;
+ if (!strcmp(dcsArr->At(0)->ClassName(),"AliTRDCalDCSv2")) calver = 2;
+
+ if (calver == 1) {
+
+ // No data for old DCS object available, anyway
+ return -1;
+
+ }
+ else if (calver == 2) {
+
+ // DCSv2 object
+ const AliTRDCalDCSv2 *calDCSv2 = dynamic_cast<const AliTRDCalDCSv2 *>(dcsArr->At(esor));
+ if(!calDCSv2){
+ return -1;
+ }
+
+ TString tableName = "";
+ for (Int_t i = 0; i < 540; i++) {
+ const AliTRDCalDCSFEEv2 *calDCSFEEv2 = calDCSv2->GetCalDCSFEEObj(0);
+ tableName = calDCSFEEv2->GetGainTableName();
+ if (tableName.Length() > 0) {
+ break;
+ }
+ }
+ if (tableName.CompareTo("Krypton_2011-01") == 0) {
+ fOnlineGainTableID = 1;
+ return fOnlineGainTableID;
+ }
+
+ }
+ else {
+
+ AliError("NO DCS/DCSv2 OCDB entry found!");
+ return -1;
+
+ }
+
+}
+
+//_____________________________________________________________________________
+void AliTRDcalibDB::GetGlobalConfiguration(TString &config)
+{
//
// Get Configuration from the DCS
//
if (!strcmp(dcsArr->At(0)->ClassName(),"AliTRDCalDCS")) calver = 1;
if (!strcmp(dcsArr->At(0)->ClassName(),"AliTRDCalDCSv2")) calver = 2;
- if (calver == 1) {
+ if (calver == 1) {
+
// DCS object
- const AliTRDCalDCS *calDCS = dynamic_cast<const AliTRDCalDCS *>(dcsArr->At(esor));
+ const AliTRDCalDCS *calDCS = dynamic_cast<const AliTRDCalDCS *>(dcsArr->At(esor));
if(!calDCS){
config = "";
return;
}
config = calDCS->GetGlobalConfigName();
- } else if (calver == 2) {
+
+ }
+ else if (calver == 2) {
+
// DCSv2 object
const AliTRDCalDCSv2 *calDCSv2 = dynamic_cast<const AliTRDCalDCSv2 *>(dcsArr->At(esor));
if(!calDCSv2){
return;
}
config = calDCSv2->GetGlobalConfigName();
- } else AliError("NO DCS/DCSv2 OCDB entry found!");
+
+ }
+ else {
+
+ AliError("NO DCS/DCSv2 OCDB entry found!");
+
+ }
}
//
// Checks whether pedestal filter was applied online
//
+
TString cname;
+
// Temporary: Get the filter config from the configuration name
GetGlobalConfiguration(cname);
TString filterconfig = cname(cname.First("_") + 1, cname.First("-") - cname.First("_") - 1);
+
// TString filterconfig;
//GetFilterType(filterconfig);
+
return filterconfig.Contains("p");
+
}
//_____________________________________________________________________________
-Bool_t AliTRDcalibDB::HasOnlineFilterGain(){
+Bool_t AliTRDcalibDB::HasOnlineFilterGain()
+{
//
// Checks whether online gain filter was applied
//
+
TString cname;
+
// Temporary: Get the filter config from the configuration name
GetGlobalConfiguration(cname);
TString filterconfig = cname(cname.First("_") + 1, cname.First("-") - cname.First("_") - 1);
+
//TString filterconfig;
//GetFilterType(filterconfig);
+
return filterconfig.Contains("g");
+
}
//_____________________________________________________________________________
-Bool_t AliTRDcalibDB::HasOnlineTailCancellation(){
+Bool_t AliTRDcalibDB::HasOnlineTailCancellation()
+{
//
// Checks whether online tail cancellation was applied
//
+
TString cname;
+
// Temporary: Get the filter config from the configuration name
GetGlobalConfiguration(cname);
TString filterconfig = cname(cname.First("_") + 1, cname.First("-") - cname.First("_") - 1);
+
//TString filterconfig;
//GetFilterType(filterconfig);
+
return filterconfig.Contains("t");
+
}
//_____________________________________________________________________________
// calculate entry based on event type info
Int_t n = 0; //f(eventtype[0], eventtype[1], ....)
- return (AliTRDrecoParam*)recos->UncheckedAt(n);
+ return (AliTRDrecoParam *) recos->UncheckedAt(n);
}
return cal->IsMasked(det);
}
+
//_____________________________________________________________________________
-Bool_t AliTRDcalibDB::IsHalfChamberMasked(Int_t det, Int_t side){
+Bool_t AliTRDcalibDB::IsHalfChamberMasked(Int_t det, Int_t side)
+{
//
// Returns status, see name of functions for details ;-)
//
return side > 0 ? cal->IsHalfChamberSideBMasked(det) : cal->IsHalfChamberSideAMasked(det);
}
+
//_____________________________________________________________________________
const AliTRDCalPID *AliTRDcalibDB::GetPIDObject(AliTRDpidUtil::ETRDPIDMethod method)
{
}
//_____________________________________________________________________________
-AliTRDPIDResponse *AliTRDcalibDB::GetPIDResponse(AliTRDPIDResponse::ETRDPIDMethod method){
- if(!fPIDResponse){
+AliTRDPIDResponse *AliTRDcalibDB::GetPIDResponse(AliTRDPIDResponse::ETRDPIDMethod method)
+{
+ //
+ // Returns the PID response object for 1D-LQ
+ //
+
+ if (!fPIDResponse) {
+
fPIDResponse = new AliTRDPIDResponse;
+
// Load Reference Histos from OCDB
fPIDResponse->SetPIDmethod(method);
const TObjArray *references = dynamic_cast<const TObjArray *>(GetCachedCDBObject(kIDPIDLQ1D));
+
TIter refs(references);
TObject *obj = NULL;
AliTRDPIDReference *ref = NULL;
Bool_t hasReference = kFALSE;
- while((obj = refs())){
- if((ref = dynamic_cast<AliTRDPIDReference *>(obj))){
- fPIDResponse->Load(ref);
- hasReference = kTRUE;
- break;
- }
+ while ((obj = refs())){
+ if ((ref = dynamic_cast<AliTRDPIDReference *>(obj))){
+ fPIDResponse->Load(ref);
+ hasReference = kTRUE;
+ break;
+ }
}
- if(!hasReference) AliError("Reference histograms not found in the OCDB");
+
+ if (!hasReference) {
+ AliError("Reference histograms not found in the OCDB");
+ }
+
}
+
return fPIDResponse;
+
}
//_____________________________________________________________________________
//
// Returns the object storing likelihood distributions for cluster to track attachment
//
+
return dynamic_cast<const AliTRDCalTrkAttach*>(GetCachedCDBObject(kIDAttach));
-}
+}
//_____________________________________________________________________________
const AliTRDCalMonitoring *AliTRDcalibDB::GetMonitoringObject()
#include "AliTRDPIDResponse.h"
#endif
+class TString;
+
class AliCDBEntry;
class AliTRDrecoParam;
class AliTRDCalROC;
class AliTRDCalDet;
class AliTRDCalSingleChamberStatus;
-class TString;
+class AliTRDCalOnlineGainTableROC;
+
class AliTRDcalibDB : public TObject {
public:
AliTRDCalROC *GetGainFactorROC(Int_t det);
const AliTRDCalDet *GetGainFactorDet();
+ Float_t GetOnlineGainFactor(Int_t det, Int_t col, Int_t row);
+ AliTRDCalOnlineGainTableROC *GetOnlineGainTableROC(Int_t det);
+
AliTRDCalROC *GetPRFROC(Int_t det);
Float_t GetPRFWidth(Int_t det, Int_t col, Int_t row);
Int_t GetNumberOfTimeBinsDCS();
void GetFilterType(TString &filterType);
void GetGlobalConfiguration(TString &config);
+
+ Int_t GetOnlineGainTableID();
+
Bool_t HasOnlineFilterPedestal();
Bool_t HasOnlineFilterGain();
Bool_t HasOnlineTailCancellation();
const AliTRDCalTrkAttach *GetAttachObject();
// Related functions, these depend on calibration data
- Int_t PadResponse(Double_t signal, Double_t dist
+ Int_t PadResponse(Double_t signal, Double_t dist
, Int_t layer, Double_t *pad) const;
protected:
, kIDT0Chamber
, kIDGainFactorPad
, kIDGainFactorChamber
+ , kIDOnlineGainFactor
, kIDNoiseChamber
, kIDNoisePad
, kIDPRFWidth
TObject *fCDBCache[kCDBCacheSize]; // Cache for calibration objects.
Long64_t fRun; // Run Number
-
+
Float_t *fPRFsmp; //! Sampled pad response
Int_t fPRFbin; // Number of bins for the PRF
Float_t fPRFlo; // Lower boundary of the PRF
Float_t fPRFhi; // Higher boundary of the PRF
Float_t fPRFwid; // Bin width of the sampled PRF
Int_t fPRFpad; // Distance to next pad in PRF
+
AliTRDPIDResponse *fPIDResponse; // TRD PID Response function
+
+ Int_t fOnlineGainTableID; // ID for online gain table
private:
AliTRDcalibDB &operator=(const AliTRDcalibDB &c);
virtual ~AliTRDcalibDB();
- ClassDef(AliTRDcalibDB, 5) // Provides central access to the CDB
+ ClassDef(AliTRDcalibDB, 7) // Provides central access to the CDB
};
#include "Cal/AliTRDCalROC.h"
#include "Cal/AliTRDCalDet.h"
+#include "Cal/AliTRDCalOnlineGainTableROC.h"
ClassImp(AliTRDdigitizer)
signals = 0x0;
return kFALSE;
}
+
// Convert the detector signals to digits or s-digits
if (!ConvertSignals(det,signals)) {
AliError(Form("Conversion of signals failed for detector=%d",det));
} // for: detector
if (!fSDigits) {
- if (AliDataLoader *trklLoader = AliRunLoader::Instance()->GetLoader("TRDLoader")->GetDataLoader("tracklets")) {
+ if (AliDataLoader *trklLoader
+ = AliRunLoader::Instance()->GetLoader("TRDLoader")->GetDataLoader("tracklets")) {
if (trklLoader->Tree())
trklLoader->WriteData("OVERWRITE");
}
return kFALSE;
}
- // The gainfactor calibration objects
+ // The gain factor calibration objects
const AliTRDCalDet *calGainFactorDet = calibration->GetGainFactorDet();
- AliTRDCalROC *calGainFactorROC = 0;
+ AliTRDCalROC *calGainFactorROC = 0x0;
Float_t calGainFactorDetValue = 0.0;
AliTRDarrayADC *digits = 0x0;
calGainFactorROC = calibration->GetGainFactorROC(det);
calGainFactorDetValue = calGainFactorDet->GetValue(det);
+ // Get the online gain factors
+ AliTRDCalOnlineGainTableROC *onlineGainFactorROC
+ = calibration->GetOnlineGainTableROC(det);
+
// Create the digits for this chamber
for (row = 0; row < nRowMax; row++ ) {
for (col = 0; col < nColMax; col++ ) {
// Check whether pad is masked
// Bridged pads are not considered yet!!!
- if (calibration->IsPadMasked(det,col,row) || calibration->IsPadNotConnected(det,col,row)) {
+ if (calibration->IsPadMasked(det,col,row) ||
+ calibration->IsPadNotConnected(det,col,row)) {
continue;
}