// 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;
}
}
//_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));
+ AliDebug(1,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);
}
// 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);
+ const AliTRDCalSingleChamberStatus *roc = cal->GetCalROC(det);
if (!roc) {
return -1;
}
- return roc->GetStatus(mcm, row);
+ return roc->GetStatus(mcm,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));
}
// However, currently it is in use by simulation and reconstruction.
//
- AliTRDCommonParam* commonParam = AliTRDCommonParam::Instance();
- if (!commonParam)
+ AliTRDCommonParam *commonParam = AliTRDCommonParam::Instance();
+ if (!commonParam) {
return -1;
+ }
+
Float_t fieldAbs = TMath::Abs(commonParam->GetField());
Float_t fieldSgn = 1.0;
if (fieldAbs > 0.0) {
// Do not copy timestructs, just invalidate lastvdrift.
// Next time they are requested, they get recalculated
if (target.fTimeStruct1) {
- delete[] target.fTimeStruct1;
+ delete [] target.fTimeStruct1;
target.fTimeStruct1 = 0;
}
if (target.fTimeStruct2) {
- delete[] target.fTimeStruct2;
+ delete [] target.fTimeStruct2;
target.fTimeStruct2 = 0;
}
target.fTimeLastVdrift = -1;
// Initialization
//
- AliRunLoader* orl = AliRunLoader::GetRunLoader(fManager->GetOutputFolderName());
+ AliRunLoader *orl = AliRunLoader::GetRunLoader(fManager->GetOutputFolderName());
+
if (InitDetector()) {
- AliLoader* ogime = orl->GetLoader("TRDLoader");
+ AliLoader *ogime = orl->GetLoader("TRDLoader");
- TTree* tree = 0;
+ TTree *tree = 0;
if (fSDigits) {
// If we produce SDigits
tree = ogime->TreeS();
fRunLoader = AliRunLoader::Open(file,evfoldname,"UPDATE");
}
if (!fRunLoader) {
- AliError(Form("Can not open session for file %s.",file));
- return kFALSE;
+ AliError(Form("Can not open session for file %s.",file));
+ return kFALSE;
}
if (!fRunLoader->GetAliRun()) {
}
else {
// If we produce Digits
+ tree = loader->TreeD();
+ if (!tree) {
+ loader->MakeTree("D");
+ tree = loader->TreeD();
+ }
+ }
+ return MakeBranch(tree);
+ }
+ else {
+ return kFALSE;
+ }
+
+}
+
+//_____________________________________________________________________________
+Bool_t AliTRDdigitizer::Open(AliRunLoader *runLoader, Int_t nEvent)
+{
+ //
+ // Opens a ROOT-file with TRD-hits and reads in the hit-tree
+ //
+ // Connect the AliRoot file containing Geometry, Kine, and Hits
+ //
+
+ fRunLoader = runLoader;
+ if (!fRunLoader) {
+ AliError("RunLoader does not exist");
+ return kFALSE;
+ }
+
+ if (!fRunLoader->GetAliRun()) {
+ fRunLoader->LoadgAlice();
+ }
+ gAlice = fRunLoader->GetAliRun();
+
+ if (gAlice) {
+ AliDebug(1,"AliRun object found on file.\n");
+ }
+ else {
+ AliError("Could not find AliRun object.\n");
+ return kFALSE;
+ }
+
+ fEvent = nEvent;
+
+ AliLoader *loader = fRunLoader->GetLoader("TRDLoader");
+ if (!loader) {
+ AliError("Can not get TRD loader from Run Loader");
+ return kFALSE;
+ }
+
+ if (InitDetector()) {
+ TTree *tree = 0;
+ if (fSDigits) {
+ // If we produce SDigits
+ tree = loader->TreeS();
+ if (!tree) {
+ loader->MakeTree("S");
+ tree = loader->TreeS();
+ }
+ }
+ else {
+ // If we produce Digits
+ tree = loader->TreeD();
if (!tree) {
loader->MakeTree("D");
tree = loader->TreeD();
}
//_____________________________________________________________________________
-Bool_t AliTRDdigitizer::MakeBranch(TTree* tree) const
+Bool_t AliTRDdigitizer::MakeBranch(TTree *tree) const
{
//
// Create the branches for the digits array