#include "AliTRDCommonParam.h"
#include "AliTRDfeeParam.h"
#include "AliTRDmcmSim.h"
+#include "AliTRDdigitsParam.h"
+
#include "Cal/AliTRDCalROC.h"
#include "Cal/AliTRDCalDet.h"
+#include "Cal/AliTRDCalOnlineGainTableROC.h"
ClassImp(AliTRDdigitizer)
,fSDigitsManagerList(0)
,fTRD(0)
,fGeo(0)
+ ,fMcmSim(new AliTRDmcmSim)
,fEvent(0)
,fMasks(0)
,fCompress(kTRUE)
// AliTRDdigitizer default constructor
//
- Init();
-
}
//_____________________________________________________________________________
,fSDigitsManagerList(0)
,fTRD(0)
,fGeo(0)
+ ,fMcmSim(new AliTRDmcmSim)
,fEvent(0)
,fMasks(0)
,fCompress(kTRUE)
// AliTRDdigitizer constructor
//
- Init();
-
}
//_____________________________________________________________________________
,fSDigitsManagerList(0)
,fTRD(0)
,fGeo(0)
+ ,fMcmSim(new AliTRDmcmSim)
,fEvent(0)
,fMasks(0)
,fCompress(kTRUE)
// AliTRDdigitizer constructor
//
- Init();
-
}
//_____________________________________________________________________________
,fSDigitsManagerList(0)
,fTRD(0)
,fGeo(0)
+ ,fMcmSim(new AliTRDmcmSim)
,fEvent(0)
,fMasks(0)
,fCompress(kTRUE)
// AliTRDdigitizer constructor
//
- Init();
-
-}
-
-//_____________________________________________________________________________
-Bool_t AliTRDdigitizer::Init()
-{
- //
- // Initialize the digitizer with default values
- //
-
- fRunLoader = 0;
- fDigitsManager = 0;
- fSDigitsManager = 0;
- fSDigitsManagerList = 0;
- fTRD = 0;
- fGeo = 0;
-
- fEvent = 0;
- fMasks = 0;
- fCompress = kTRUE;
- fSDigits = kFALSE;
- fMergeSignalOnly = kFALSE;
-
- return AliDigitizer::Init();
-
}
//_____________________________________________________________________________
,fSDigitsManagerList(0)
,fTRD(0)
,fGeo(0)
+ ,fMcmSim(new AliTRDmcmSim)
,fEvent(0)
,fMasks(0)
,fCompress(d.fCompress)
fDigitsManager = 0;
}
- if (fDigitsManager) { //typo? fSDigitsManager?
- delete fSDigitsManager;
+ if (fSDigitsManager) {
+ // s-digitsmanager will be deleted via list
fSDigitsManager = 0;
}
fMasks = 0;
}
+ if (fMcmSim) {
+ delete fMcmSim;
+ fMcmSim = 0;
+ }
+
if (fGeo) {
delete fGeo;
fGeo = 0;
inrl->LoadgAlice();
gAlice = inrl->GetAliRun();
if (!gAlice) {
- AliError("Could not find AliRun object.")
+ AliError("Could not find AliRun object.");
return;
}
}
return kTRUE;
}
+
//_____________________________________________________________________________
Bool_t AliTRDdigitizer::MakeBranch(TTree *tree) const
{
Int_t *nhit = new Int_t[kNdet];
AliTRDarraySignal *signals = 0x0;
+
+ // Check the number of time bins from simParam against OCDB,
+ // if OCDB value is not supposed to be used.
+ // As default, the value from OCDB is taken
+ if (AliTRDSimParam::Instance()->GetNTBoverwriteOCDB()) {
+ if (calibration->GetNumberOfTimeBinsDCS() != AliTRDSimParam::Instance()->GetNTimeBins()) {
+ AliWarning(Form("Number of time bins is different to OCDB value [SIM=%d, OCDB=%d]"
+ ,AliTRDSimParam::Instance()->GetNTimeBins()
+ ,calibration->GetNumberOfTimeBinsDCS()));
+ }
+ // Save the values for the raw data headers
+ fDigitsManager->GetDigitsParam()->SetNTimeBinsAll(AliTRDSimParam::Instance()->GetNTimeBins());
+ }
+ else {
+ // Save the values for the raw data headers
+ fDigitsManager->GetDigitsParam()->SetNTimeBinsAll(calibration->GetNumberOfTimeBinsDCS());
+ }
+
+ // Save the values for the raw data headers
+ fDigitsManager->GetDigitsParam()->SetADCbaselineAll(AliTRDSimParam::Instance()->GetADCbaseline());
// Sort all hits according to detector number
if (!SortHits(hits,nhit)) {
AliError("Sorting hits failed");
+ delete [] hits;
+ delete [] nhit;
return kFALSE;
}
// Convert the hits of the current detector to detector signals
if (!ConvertHits(det,hits[det],nhit[det],signals)) {
AliError(Form("Conversion of hits failed for detector=%d",det));
+ delete [] hits;
+ delete [] nhit;
+ delete signals;
+ 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));
+ delete [] hits;
+ delete [] nhit;
+ delete signals;
+ signals = 0x0;
return kFALSE;
}
} // for: detector
+ if (!fSDigits) {
+ if (AliDataLoader *trklLoader
+ = AliRunLoader::Instance()->GetLoader("TRDLoader")->GetDataLoader("tracklets")) {
+ if (trklLoader->Tree())
+ trklLoader->WriteData("OVERWRITE");
+ }
+ }
+
delete [] hits;
delete [] nhit;
TTree *hitTree = gimme->TreeH();
if (hitTree == 0x0) {
AliError("Can not get TreeH");
+ delete [] lhit;
return kFALSE;
}
fTRD->SetTreeAddress();
* commonParam->GetSamplingFrequency())) - 1;
}
- Int_t nTimeTotal = calibration->GetNumberOfTimeBins();
+ Int_t nTimeTotal = fDigitsManager->GetDigitsParam()->GetNTimeBins(det);
Float_t samplingRate = commonParam->GetSamplingFrequency();
Float_t elAttachProp = simParam->GetElAttachProp() / 100.0;
Int_t nRowMax = fGeo->GetPadPlane(det)->GetNrows();
Int_t nColMax = fGeo->GetPadPlane(det)->GetNcols();
- Int_t nTimeTotal = calibration->GetNumberOfTimeBins();
+ Int_t nTimeTotal = fDigitsManager->GetDigitsParam()->GetNTimeBins(det);
+ if (fSDigitsManager->GetDigitsParam()->GetNTimeBins(det)) {
+ nTimeTotal = fSDigitsManager->GetDigitsParam()->GetNTimeBins(det);
+ }
+ else {
+ AliFatal("Could not get number of time bins");
+ 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)) {
+ if (calibration->IsPadMasked(det,col,row) ||
+ calibration->IsPadNotConnected(det,col,row)) {
continue;
}
Int_t nRowMax = fGeo->GetPadPlane(det)->GetNrows();
Int_t nColMax = fGeo->GetPadPlane(det)->GetNcols();
- Int_t nTimeTotal = calibration->GetNumberOfTimeBins();
+ Int_t nTimeTotal = fDigitsManager->GetDigitsParam()->GetNTimeBins(det);
// Get the container for the digits of this detector
-
if (!fDigitsManager->HasSDigits()) {
AliError("Digits manager has no s-digits");
return kFALSE;
Int_t nRowMax = fGeo->GetPadPlane(det)->GetNrows();
Int_t nColMax = fGeo->GetPadPlane(det)->GetNcols();
- Int_t nTimeTotal = calibration->GetNumberOfTimeBins();
+ Int_t nTimeTotal = manDig->GetDigitsParam()->GetNTimeBins(det);
// Get the calibration objects
//calGainFactorROC = calibration->GetGainFactorROC(det);
tracks1->Allocate(nRowMax,nColMax,nTimeTotal);
tracks2->Allocate(nRowMax,nColMax,nTimeTotal);
- // Create the sdigits for this chamber
- for (row = 0; row < nRowMax; row++ ) {
- for (col = 0; col < nColMax; col++ ) {
+ // Keep the digits param
+ manSDig->GetDigitsParam()->SetNTimeBinsAll(manDig->GetDigitsParam()->GetNTimeBins(0));
+ manSDig->GetDigitsParam()->SetADCbaselineAll(manDig->GetDigitsParam()->GetADCbaseline(0));
- // The gain factors
- //Float_t padgain = calGainFactorDetValue
- // * calGainFactorROC->GetValue(col,row);
+ if (digits->HasData()) {
- for (time = 0; time < nTimeTotal; time++) {
-
- Double_t signal = (Double_t) digits->GetData(row,col,time);
+ digits->Expand();
- // ADC -> signal in mV
- signal /= adcConvert;
+ // Create the sdigits for this chamber
+ for (row = 0; row < nRowMax; row++ ) {
+ for (col = 0; col < nColMax; col++ ) {
- // Subtract baseline in mV
- signal -= baseline;
+ // The gain factors
+ //Float_t padgain = calGainFactorDetValue
+ // * calGainFactorROC->GetValue(col,row);
- // Signal in mV -> signal in #electrons
- signal /= convert;
+ for (time = 0; time < nTimeTotal; time++) {
- // Gain factor
- //signal /= padgain; // Not needed for real data
+ Short_t adcVal = digits->GetData(row,col,time);
+ Double_t signal = (Double_t) adcVal;
+ // ADC -> signal in mV
+ signal /= adcConvert;
+ // Subtract baseline in mV
+ signal -= baseline;
+ // Signal in mV -> signal in #electrons
+ signal /= convert;
+ // Gain factor
+ //signal /= padgain; // Not needed for real data
+ // Pad and time coupling
+ signal /= coupling;
- // Pad and time coupling
- signal /= coupling;
+ sdigits->SetData(row,col,time,signal);
+ tracks0->SetData(row,col,time,0);
+ tracks1->SetData(row,col,time,0);
+ tracks2->SetData(row,col,time,0);
- sdigits->SetData(row,col,time,signal);
- tracks0->SetData(row,col,time,0);
- tracks1->SetData(row,col,time,0);
- tracks2->SetData(row,col,time,0);
+ } // for: time
- } // for: time
-
- } // for: col
- } // for: row
+ } // for: col
+ } // for: row
+ } // if: has data
+
sdigits->Compress(0);
tracks0->Compress();
tracks1->Compress();
tracks2->Compress();
+ // No compress just remove
+ manDig->RemoveDigits(det);
+ manDig->RemoveDictionaries(det);
+
} // for: det
return kTRUE;
AliDebug(1,"Only one input file.");
}
- Int_t nTimeTotal = calibration->GetNumberOfTimeBins();
Int_t iMerge = 0;
while (mergeSDigitsManager) {
iMerge++;
-
+
// Loop through the detectors
for (Int_t iDet = 0; iDet < AliTRDgeometry::Ndet(); iDet++) {
+ Int_t nTimeTotal = fSDigitsManager->GetDigitsParam()->GetNTimeBins(iDet);
+ if (mergeSDigitsManager->GetDigitsParam()->GetNTimeBins(iDet) != nTimeTotal) {
+ AliError(Form("Mismatch in the number of time bins [%d,%d] in detector %d"
+ ,nTimeTotal
+ ,mergeSDigitsManager->GetDigitsParam()->GetNTimeBins(iDet)
+ ,iDet));
+ return kFALSE;
+ }
+
Int_t nRowMax = fGeo->GetPadPlane(iDet)->GetNrows();
Int_t nColMax = fGeo->GetPadPlane(iDet)->GetNcols();
} // for: detector numbers
+ if (AliDataLoader *trklLoader = AliRunLoader::Instance()->GetLoader("TRDLoader")->GetDataLoader("tracklets")) {
+ if (trklLoader->Tree())
+ trklLoader->WriteData("OVERWRITE");
+ }
+
+ // Save the values for the raw data headers
+ if (AliTRDSimParam::Instance()->GetNTBoverwriteOCDB()) {
+ fDigitsManager->GetDigitsParam()->SetNTimeBinsAll(AliTRDSimParam::Instance()->GetNTimeBins());
+ }
+ else {
+ fDigitsManager->GetDigitsParam()->SetNTimeBinsAll(AliTRDcalibDB::Instance()->GetNumberOfTimeBinsDCS());
+ }
+ fDigitsManager->GetDigitsParam()->SetADCbaselineAll(AliTRDSimParam::Instance()->GetADCbaseline());
return kTRUE;
Int_t nRowMax = fGeo->GetPadPlane(det)->GetNrows();
Int_t nColMax = fGeo->GetPadPlane(det)->GetNcols();
- Int_t nTimeTotal = calibration->GetNumberOfTimeBins();
+ Int_t nTimeTotal = fSDigitsManager->GetDigitsParam()->GetNTimeBins(det);
Int_t row = 0;
Int_t col = 0;
AliTRDfeeParam *feeParam = AliTRDfeeParam::Instance();
- //Create and initialize the mcm object
- AliTRDmcmSim* mcmfast = new AliTRDmcmSim();
-
AliTRDarrayADC *digits = fDigitsManager->GetDigits(det);
if (!digits)
return;
{
for(Int_t mcm = 0; mcm < 16; mcm++)
{
- mcmfast->Init(det, rob, mcm);
- mcmfast->SetData(digits, fDigitsManager);
- mcmfast->Filter();
+ fMcmSim->Init(det, rob, mcm);
+ fMcmSim->SetDataByPad(digits, fDigitsManager);
+ fMcmSim->Filter();
if (feeParam->GetTracklet()) {
- mcmfast->Tracklet();
- mcmfast->StoreTracklets();
+ fMcmSim->Tracklet();
+ fMcmSim->StoreTracklets();
}
- mcmfast->ZSMapping();
- mcmfast->WriteData(digits);
+ fMcmSim->ZSMapping();
+ fMcmSim->WriteData(digits);
}
}
- delete mcmfast;
-
}
+