// //
///////////////////////////////////////////////////////////////////////////////
-#include <TMath.h>
-#include <TRandom.h>
+#include <TClonesArray.h>
+#include <TObjArray.h>
#include "AliCDBManager.h"
-#include "AliCDBStorage.h"
#include "AliCDBEntry.h"
#include "AliLog.h"
#include "AliTRDcalibDB.h"
-#include "AliTRDgeometry.h"
-#include "AliTRDpadPlane.h"
-#include "AliTRDCommonParam.h"
#include "Cal/AliTRDCalROC.h"
#include "Cal/AliTRDCalPad.h"
#include "Cal/AliTRDCalDet.h"
-#include "Cal/AliTRDCalFEE.h"
+#include "Cal/AliTRDCalDCS.h"
#include "Cal/AliTRDCalPID.h"
#include "Cal/AliTRDCalMonitoring.h"
#include "Cal/AliTRDCalChamberStatus.h"
case kIDFEE :
return CacheCDBEntry(kIDFEE ,"TRD/Calib/FEE");
break;
+ case kIDDCS :
+ return CacheCDBEntry(kIDDCS ,"TRD/Calib/DCS");
+ break;
case kIDPIDNN :
return CacheCDBEntry(kIDPIDNN ,"TRD/Calib/PIDNN");
case kIDPIDLQ :
return CacheCDBEntry(kIDPIDLQ ,"TRD/Calib/PIDLQ");
break;
+ case kIDRecoParam :
+ return CacheCDBEntry(kIDRecoParam ,"TRD/Calib/RecoParam");
+ break;
}
AliCDBEntry *entry = AliCDBManager::Instance()->Get(cdbPath,fRun);
if (!entry) {
- AliFatal(Form("Failed to get entry: %s",cdbPath));
+ AliError(Form("Failed to get entry: %s",cdbPath));
return 0;
}
}
//_____________________________________________________________________________
-Int_t AliTRDcalibDB::GetNumberOfTimeBins()
+Int_t AliTRDcalibDB::GetNumberOfTimeBinsDCS()
{
//
- // Returns the number of time bins which are read-out.
+ // Returns Number of time bins from the DCS
//
- const AliTRDCalFEE *calFEE = dynamic_cast<const AliTRDCalFEE *>
- (GetCachedCDBObject(kIDFEE));
- if (!calFEE) {
- return -1;
+ const TObjArray *dcsArr = dynamic_cast<const TObjArray *>(GetCachedCDBObject(kIDDCS));
+
+ if(!dcsArr){
+ printf("No DCS Object found\n");
+ //return -1;
+ return 30;
}
+ const AliTRDCalDCS *calDCSsor = dynamic_cast<const AliTRDCalDCS *>(dcsArr->At(0)); // Take SOR
+ const AliTRDCalDCS *calDCSeor = dynamic_cast<const AliTRDCalDCS *>(dcsArr->At(1));
- return calFEE->GetNumberOfTimeBins();
+ // prefer SOR
+ if(!calDCSsor){
+ if(!calDCSeor){
+ printf("No calDCSeor found\n");
+ //return -1;
+ return 30;
+ }
+ if(calDCSeor->GetGlobalNumberOfTimeBins() > 0) return calDCSeor->GetGlobalNumberOfTimeBins();
+ else return 30;
+ }
+ // if SOR is available and the number of timebins is > -1, take this, otherwise check EOR
+ Int_t nTimeSOR = calDCSsor->GetGlobalNumberOfTimeBins();
+ if(nTimeSOR > -1){
+ // Make a consistency check
+ if(calDCSeor){
+ Int_t nTimeEOR = calDCSeor->GetGlobalNumberOfTimeBins();
+ if((nTimeEOR > -1) && (nTimeSOR != nTimeEOR)){
+ // Parameter inconsistency found, return -2 to be able to catch the error
+ //return -2;
+ printf("Inconsistency\n");
+ return 30;
+ }
+ }
+ // Consisency check passed or not done
+ if(nTimeSOR > 0.0) return nTimeSOR;
+ else return 30;
+ } else {
+ // SOR has unphysical time parameter, take EOR
+ if(calDCSeor) {
+ if(calDCSeor->GetGlobalNumberOfTimeBins() > 0) return calDCSeor->GetGlobalNumberOfTimeBins();
+ else return 30;
+ }
+ return 30; // Both SOR and EOR not available
+ }
+}
+
+//_____________________________________________________________________________
+void AliTRDcalibDB::GetFilterType(TString &filterType)
+{
+ //
+ // Returns the filter type
+ //
+
+ const TObjArray *dcsArr = dynamic_cast<const TObjArray *>(GetCachedCDBObject(kIDDCS));
+ if(!dcsArr){
+ filterType = "";
+ return;
+ }
+ const AliTRDCalDCS *calDCS = dynamic_cast<const AliTRDCalDCS *>(dcsArr->At(1)); // Take EOR
+
+ if(!calDCS){
+ filterType = "";
+ return;
+ }
+ filterType = calDCS->GetGlobalFilterType();
}
}
+//_____________________________________________________________________________
+AliTRDrecoParam* AliTRDcalibDB::GetRecoParam(Int_t */*eventtype*/)
+{
+ //
+ // Returns the TRD reconstruction parameters from the OCDB
+ //
+
+ const TClonesArray *recos = dynamic_cast<const TClonesArray*>(GetCachedCDBObject(kIDRecoParam));
+ if (!recos) return 0x0;
+
+ // calculate entry based on event type info
+ Int_t n = 0; //f(eventtype[0], eventtype[1], ....)
+
+ return (AliTRDrecoParam*)recos->UncheckedAt(n);
+
+}
+
//_____________________________________________________________________________
Bool_t AliTRDcalibDB::IsPadMasked(Int_t det, Int_t col, Int_t row)
{
//
// Returns status, see name of functions for details ;-)
//
+
const AliTRDCalPadStatus * cal = dynamic_cast<const AliTRDCalPadStatus *>
(GetCachedCDBObject(kIDPadStatus));
if (!cal) {
return cal->IsMasked(det);
}
+//_____________________________________________________________________________
+Bool_t AliTRDcalibDB::IsHalfChamberMasked(Int_t det, Int_t side){
+ //
+ // Returns status, see name of functions for details ;-)
+ //
+
+ const AliTRDCalChamberStatus * cal = dynamic_cast<const AliTRDCalChamberStatus *>
+ (GetCachedCDBObject(kIDChamberStatus));
+ if (!cal) {
+ return -1;
+ }
+ return side > 0 ? cal->IsHalfChamberSideBMasked(det) : cal->IsHalfChamberSideAMasked(det);
+
+}
//_____________________________________________________________________________
-const AliTRDCalPID *AliTRDcalibDB::GetPIDObject(const Int_t method)
+const AliTRDCalPID *AliTRDcalibDB::GetPIDObject(AliTRDpidUtil::ETRDPIDMethod method)
{
//
// Returns the object storing the distributions for PID with likelihood
//
switch(method) {
- case 0: return dynamic_cast<const AliTRDCalPID *>
- (GetCachedCDBObject(kIDPIDLQ));
- case 1: return dynamic_cast<const AliTRDCalPID *>
- (GetCachedCDBObject(kIDPIDNN));
+ case AliTRDpidUtil::kLQ:
+ return dynamic_cast<const AliTRDCalPID *>(GetCachedCDBObject(kIDPIDLQ));
+ case AliTRDpidUtil::kNN:
+ return dynamic_cast<const AliTRDCalPID *>(GetCachedCDBObject(kIDPIDNN));
+ case AliTRDpidUtil::kESD:
+ return 0x0; // To avoid compiler warnings
}
return 0x0;
}
-//_____________________________________________________________________________
-Float_t AliTRDcalibDB::GetOmegaTau(Float_t vdrift, Float_t bz)
-{
- //
- // 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.
- // However, currently it is in use by simulation and reconstruction.
- //
-
- 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 p1[kNb] = { 0.054875, 0.081534, 0.107333, 0.131983, 0.155455 };
- 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 };
-
- // No ExB if field is too small (or zero)
- if (fieldAbs < 0.01) {
-
- return 0.0;
-
- }
- // 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);
-
- }
-
-}
-
//_____________________________________________________________________________
void AliTRDcalibDB::SamplePRF()
{
//_____________________________________________________________________________
Int_t AliTRDcalibDB::PadResponse(Double_t signal, Double_t dist
- , Int_t layer, Double_t *pad) const
+ , Int_t layer, Double_t *pad) const
{
//
// Applies the pad response
// something dependent on calibration values
//
- Int_t iBin = ((Int_t) (( - dist - fPRFlo) / fPRFwid));
+ Int_t iBin = ((Int_t) ((-dist - fPRFlo) / fPRFwid));
Int_t iOff = layer * fPRFbin;
Int_t iBin0 = iBin - fPRFpad + iOff;
}
}
+
+