// //
///////////////////////////////////////////////////////////////////////////////
+#include <TMath.h>
#include <TRandom.h>
#include "AliCDBManager.h"
}
return fgInstance;
+
}
//_____________________________________________________________________________
{
//
// Singleton implementation
- // Deletes the instance of this class and sets the terminated flag, instances cannot be requested anymore
+ // Deletes the instance of this class and sets the terminated flag,
+ // instances cannot be requested anymore
// This function can be called several times.
//
// TODO invalid calibration data to be used.
//
- for (Int_t i=0; i<kCDBCacheSize; ++i) {
+ for (Int_t i = 0; i < kCDBCacheSize; ++i) {
fCDBCache[i] = 0;
fCDBEntries[i] = 0;
}
// Copy constructor (not that it make any sense for a singleton...)
//
- for (Int_t i=0; i<kCDBCacheSize; ++i) {
+ for (Int_t i = 0; i < kCDBCacheSize; ++i) {
fCDBCache[i] = 0;
fCDBEntries[i] = 0;
}
if (this != &c) {
AliFatal("No assignment operator defined");
}
+
return *this;
}
}
//_caching functions____________________________________________________________
-const TObject* AliTRDcalibDB::GetCachedCDBObject(Int_t id)
+const TObject *AliTRDcalibDB::GetCachedCDBObject(Int_t id)
{
//
// Retrieves a cdb object with the given id. The objects are cached as
}
//_____________________________________________________________________________
-AliCDBEntry* AliTRDcalibDB::GetCDBEntry(const char* cdbPath)
+AliCDBEntry *AliTRDcalibDB::GetCDBEntry(const char *cdbPath)
{
//
// Retrieves an entry with path <cdbPath> from the CDB.
//
- AliCDBEntry* entry = AliCDBManager::Instance()->Get(cdbPath, fRun);
+ AliCDBEntry *entry = AliCDBManager::Instance()->Get(cdbPath,fRun);
if (!entry) {
AliError(Form("Failed to get entry: %s",cdbPath));
return 0;
}
- AliInfo(Form("AliTRDcalibDB: Retrieved object: %s",cdbPath));
-
return entry;
}
//_____________________________________________________________________________
-const TObject* AliTRDcalibDB::CacheCDBEntry(Int_t id, const char* cdbPath)
+const TObject *AliTRDcalibDB::CacheCDBEntry(Int_t id, const char *cdbPath)
{
//
// Caches the entry <id> with cdb path <cdbPath>
if (!fCDBCache[id]) {
fCDBEntries[id] = GetCDBEntry(cdbPath);
- if (fCDBEntries[id])
+ if (fCDBEntries[id]) {
fCDBCache[id] = fCDBEntries[id]->GetObject();
+ }
}
+
return fCDBCache[id];
}
}
fRun = run;
+
Invalidate();
}
// Invalidates cache (when run number is changed).
//
- for (Int_t i=0; i<kCDBCacheSize; ++i) {
+ for (Int_t i = 0; i < kCDBCacheSize; ++i) {
if (fCDBEntries[i]) {
if (AliCDBManager::Instance()->GetCacheFlag() == kFALSE) {
- if (fCDBEntries[i]->IsOwner() == kFALSE && fCDBCache[i]) {
+ if ((fCDBEntries[i]->IsOwner() == kFALSE) && fCDBCache[i]) {
delete fCDBCache[i];
}
delete fCDBEntries[i];
// Returns the drift velocity for the given pad.
//
- const AliTRDCalPad* calPad = dynamic_cast<const AliTRDCalPad*>
+ const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
(GetCachedCDBObject(kIDVdriftPad));
if (!calPad) {
return -1;
}
- AliTRDCalROC* roc = calPad->GetCalROC(det);
+ AliTRDCalROC *roc = calPad->GetCalROC(det);
if (!roc) {
return -1;
}
- const AliTRDCalDet* calChamber = dynamic_cast<const AliTRDCalDet*>
+ const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
(GetCachedCDBObject(kIDVdriftChamber));
if (!calChamber) {
return -1;
}
- return calChamber->GetValue(det) * roc->GetValue(col, row);
+ return calChamber->GetValue(det) * roc->GetValue(col,row);
}
// Returns the average drift velocity for the given detector
//
- const AliTRDCalDet* calDet = dynamic_cast<const AliTRDCalDet*>
+ const AliTRDCalDet *calDet = dynamic_cast<const AliTRDCalDet *>
(GetCachedCDBObject(kIDVdriftChamber));
if (!calDet) {
return -1;
// Returns t0 for the given pad.
//
- const AliTRDCalPad* calPad = dynamic_cast<const AliTRDCalPad*>
+ const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
(GetCachedCDBObject(kIDT0Pad));
if (!calPad) {
return -1;
}
- AliTRDCalROC* roc = calPad->GetCalROC(det);
+ AliTRDCalROC *roc = calPad->GetCalROC(det);
if (!roc) {
return -1;
}
- const AliTRDCalDet* calChamber = dynamic_cast<const AliTRDCalDet*>
+ const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
(GetCachedCDBObject(kIDT0Chamber));
if (!calChamber) {
return -1;
}
- return calChamber->GetValue(det) * roc->GetValue(col, row);
+ return calChamber->GetValue(det) * roc->GetValue(col,row);
}
// Returns the average t0 for the given detector
//
- const AliTRDCalDet* calDet = dynamic_cast<const AliTRDCalDet*>
+ const AliTRDCalDet *calDet = dynamic_cast<const AliTRDCalDet *>
(GetCachedCDBObject(kIDT0Chamber));
if (!calDet) {
return -1;
// Returns the gain factor for the given pad.
//
- const AliTRDCalPad* calPad = dynamic_cast<const AliTRDCalPad*>
+ const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
(GetCachedCDBObject(kIDGainFactorPad));
if (!calPad) {
return -1;
}
- AliTRDCalROC* roc = calPad->GetCalROC(det);
+ AliTRDCalROC *roc = calPad->GetCalROC(det);
if (!roc)
return -1;
- const AliTRDCalDet* calChamber = dynamic_cast<const AliTRDCalDet*>
+ const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
(GetCachedCDBObject(kIDGainFactorChamber));
if (!calChamber) {
return -1;
}
- return calChamber->GetValue(det) * roc->GetValue(col, row);
+ return calChamber->GetValue(det) * roc->GetValue(col,row);
}
// Returns the average gain factor for the given detector
//
- const AliTRDCalDet* calDet = dynamic_cast<const AliTRDCalDet*>
+ const AliTRDCalDet *calDet = dynamic_cast<const AliTRDCalDet *>
(GetCachedCDBObject(kIDGainFactorChamber));
if (!calDet) {
return -1;
// Returns the PRF width for the given pad.
//
- const AliTRDCalPad* calPad = dynamic_cast<const AliTRDCalPad*>
+ const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
(GetCachedCDBObject(kIDPRFWidth));
if (!calPad) {
return -1;
}
- AliTRDCalROC* roc = calPad->GetCalROC(det);
+ AliTRDCalROC *roc = calPad->GetCalROC(det);
if (!roc) {
return -1;
}
- return roc->GetValue(col, row);
+ return roc->GetValue(col,row);
}
// Returns the sampling frequency of the TRD read-out.
//
- const AliTRDCalGlobals* calGlobal = dynamic_cast<const AliTRDCalGlobals*>
+ const AliTRDCalGlobals *calGlobal = dynamic_cast<const AliTRDCalGlobals *>
(GetCachedCDBObject(kIDGlobals));
if (!calGlobal) {
return -1;
// Returns the number of time bins which are read-out.
//
- const AliTRDCalGlobals* calGlobal = dynamic_cast<const AliTRDCalGlobals*>
+ const AliTRDCalGlobals *calGlobal = dynamic_cast<const AliTRDCalGlobals *>
(GetCachedCDBObject(kIDGlobals));
if (!calGlobal) {
return -1;
// Returns the status of the given pad
//
- const AliTRDCalPadStatus* cal = dynamic_cast<const AliTRDCalPadStatus*>
+ const AliTRDCalPadStatus *cal = dynamic_cast<const AliTRDCalPadStatus *>
(GetCachedCDBObject(kIDPadStatus));
if (!cal) {
return -1;
}
- const AliTRDCalSingleChamberStatus* roc = cal->GetCalROC(det);
+ const AliTRDCalSingleChamberStatus *roc = cal->GetCalROC(det);
if (!roc) {
return -1;
}
- return roc->GetStatus(col, row);
+ return roc->GetStatus(col,row);
}
// Returns the status of the given MCM
//
- // To translate pad column number into MCM number
- Int_t mcm = ((Int_t) col / 18);
-
- const AliTRDCalMCMStatus* cal = dynamic_cast<const AliTRDCalMCMStatus*>
+ const AliTRDCalMCMStatus *cal = dynamic_cast<const AliTRDCalMCMStatus *>
(GetCachedCDBObject(kIDMCMStatus));
if (!cal) {
return -1;
}
- const AliTRDCalSingleChamberStatus* roc = cal->GetCalROC(det);
- if (!roc) {
- return -1;
- }
-
- return roc->GetStatus(mcm, row);
+ return cal->GetStatus(det,col,row);
}
// Returns the status of the given chamber
//
- const AliTRDCalChamberStatus* cal = dynamic_cast<const AliTRDCalChamberStatus*>
+ const AliTRDCalChamberStatus *cal = dynamic_cast<const AliTRDCalChamberStatus *>
(GetCachedCDBObject(kIDChamberStatus));
if (!cal) {
return -1;
// Returns the status of the given chamber
//
- const AliTRDCalSuperModuleStatus* cal = dynamic_cast<const AliTRDCalSuperModuleStatus*>
+ const AliTRDCalSuperModuleStatus *cal = dynamic_cast<const AliTRDCalSuperModuleStatus *>
(GetCachedCDBObject(kIDSuperModuleStatus));
if (!cal) {
return -1;
// Returns status, see name of functions for details ;-)
//
- const AliTRDCalPadStatus* cal = dynamic_cast<const AliTRDCalPadStatus*>
- (GetCachedCDBObject(kIDPadStatus));
+ const AliTRDCalPadStatus *cal = dynamic_cast<const AliTRDCalPadStatus *>
+ (GetCachedCDBObject(kIDPadStatus));
if (!cal) {
return -1;
}
- return cal->IsMasked(det, col, row);
+ return cal->IsMasked(det,col,row);
}
// Returns status, see name of functions for details ;-)
//
- const AliTRDCalPadStatus* cal = dynamic_cast<const AliTRDCalPadStatus*>
- (GetCachedCDBObject(kIDPadStatus));
+ const AliTRDCalPadStatus *cal = dynamic_cast<const AliTRDCalPadStatus *>
+ (GetCachedCDBObject(kIDPadStatus));
if (!cal) {
return -1;
}
- return cal->IsBridgedLeft(det, col, row);
+ return cal->IsBridgedLeft(det,col,row);
}
// Returns status, see name of functions for details ;-)
//
- const AliTRDCalPadStatus* cal = dynamic_cast<const AliTRDCalPadStatus*>
- (GetCachedCDBObject(kIDPadStatus));
+ const AliTRDCalPadStatus * cal = dynamic_cast<const AliTRDCalPadStatus *>
+ (GetCachedCDBObject(kIDPadStatus));
if (!cal) {
return -1;
}
- return cal->IsBridgedRight(det, col, row);
+ return cal->IsBridgedRight(det,col,row);
}
// Returns status, see name of functions for details ;-)
//
- const AliTRDCalMCMStatus* cal = dynamic_cast<const AliTRDCalMCMStatus*>
- (GetCachedCDBObject(kIDMCMStatus));
+ const AliTRDCalMCMStatus * cal = dynamic_cast<const AliTRDCalMCMStatus *>
+ (GetCachedCDBObject(kIDMCMStatus));
if (!cal) {
return -1;
}
- return cal->IsMasked(det, col, row);
+ return cal->IsMasked(det,col,row);
}
// Returns status, see name of functions for details ;-)
//
- const AliTRDCalChamberStatus* cal = dynamic_cast<const AliTRDCalChamberStatus*>
- (GetCachedCDBObject(kIDChamberStatus));
+ const AliTRDCalChamberStatus * cal = dynamic_cast<const AliTRDCalChamberStatus *>
+ (GetCachedCDBObject(kIDChamberStatus));
if (!cal) {
return -1;
}
// Returns status, see name of functions for details ;-)
//
- const AliTRDCalChamberStatus* cal = dynamic_cast<const AliTRDCalChamberStatus*>
- (GetCachedCDBObject(kIDChamberStatus));
+ const AliTRDCalChamberStatus * cal = dynamic_cast<const AliTRDCalChamberStatus *>
+ (GetCachedCDBObject(kIDChamberStatus));
if (!cal) {
return -1;
}
// Returns status, see name of functions for details ;-)
//
- const AliTRDCalSuperModuleStatus* cal = dynamic_cast<const AliTRDCalSuperModuleStatus*>
- (GetCachedCDBObject(kIDSuperModuleStatus));
+ const AliTRDCalSuperModuleStatus * cal = dynamic_cast<const AliTRDCalSuperModuleStatus *>
+ (GetCachedCDBObject(kIDSuperModuleStatus));
if (!cal) {
return -1;
}
// Returns status, see name of functions for details ;-)
//
- const AliTRDCalSuperModuleStatus* cal = dynamic_cast<const AliTRDCalSuperModuleStatus*>
- (GetCachedCDBObject(kIDSuperModuleStatus));
+ const AliTRDCalSuperModuleStatus * cal = dynamic_cast<const AliTRDCalSuperModuleStatus *>
+ (GetCachedCDBObject(kIDSuperModuleStatus));
if (!cal) {
return -1;
}
// Returns the object storing the distributions for PID with likelihood
//
- return dynamic_cast<const AliTRDCalPIDLQ*> (GetCachedCDBObject(kIDPIDLQ));
+ return dynamic_cast<const AliTRDCalPIDLQ *> (GetCachedCDBObject(kIDPIDLQ));
}
// Returns the object storing the monitoring data
//
- return dynamic_cast<const AliTRDCalMonitoring*> (GetCachedCDBObject(kIDMonitoringData));
-
+ return dynamic_cast<const AliTRDCalMonitoring *> (GetCachedCDBObject(kIDMonitoringData));
+
}
//_____________________________________________________________________________
-Float_t AliTRDcalibDB::GetOmegaTau(Float_t vdrift)
+Float_t AliTRDcalibDB::GetOmegaTau(Float_t vdrift, Float_t bz)
{
//
- // Returns omega*tau (tan(Lorentz-angle)) for a given drift velocity <vd>
- // and a B-field <b> for Xe/CO2 (15%).
+ // Returns omega*tau (tan(Lorentz-angle)) for a given drift velocity <vdrift>
+ // and a B-field <bz> for Xe/CO2 (15%).
// The values are according to a GARFIELD simulation.
//
- // This function basically does not belong to the calibration class. It should be moved somewhere else.
+ // This function basically does not belong to the calibration class.
+ // It should be moved somewhere else.
// However, currently it is in use by simulation and reconstruction.
//
- AliTRDCommonParam* commonParam = AliTRDCommonParam::Instance();
- if (!commonParam)
- return -1;
- Float_t fieldAbs = TMath::Abs(commonParam->GetField());
- Float_t fieldSgn = 1.0;
- if (fieldAbs > 0.0) {
- fieldSgn = commonParam->GetField() / fieldAbs;
- }
+ Float_t fieldAbs = TMath::Abs(bz);
+ Float_t fieldSgn = (bz > 0.0) ? 1.0 : -1.0;
const Int_t kNb = 5;
Float_t p0[kNb] = { 0.004810, 0.007412, 0.010252, 0.013409, 0.016888 };
Float_t p2[kNb] = { -0.008682, -0.012896, -0.016987, -0.020880, -0.024623 };
Float_t p3[kNb] = { 0.000155, 0.000238, 0.000330, 0.000428, 0.000541 };
- Int_t ib = ((Int_t) (10 * (fieldAbs - 0.15)));
- ib = TMath::Max( 0,ib);
- ib = TMath::Min(kNb,ib);
+ // No ExB if field is too small (or zero)
+ if (fieldAbs < 0.01) {
- Float_t alphaL = p0[ib]
- + p1[ib] * vdrift
- + p2[ib] * vdrift*vdrift
- + p3[ib] * vdrift*vdrift*vdrift;
+ return 0.0;
- return TMath::Tan(fieldSgn * alphaL);
+ }
+ // Calculate ExB from parametrization
+ else {
+
+ Int_t ib = ((Int_t) (10 * (fieldAbs - 0.15)));
+ ib = TMath::Max( 0,ib);
+ ib = TMath::Min(kNb,ib);
+
+ Float_t alphaL = p0[ib]
+ + p1[ib] * vdrift
+ + p2[ib] * vdrift*vdrift
+ + p3[ib] * vdrift*vdrift*vdrift;
+
+ return TMath::Tan(fieldSgn * alphaL);
+
+ }
}