#include "AliPHOSCalibData.h"
#include "AliRunLoader.h"
#include "AliPHOSLoader.h"
+#include "AliPHOSPulseGenerator.h"
ClassImp(AliPHOSDigitizer)
fFirstEvent(0),
fLastEvent(0),
fcdb(0x0),
- fEventCounter(0)
+ fEventCounter(0),
+ fPulse(0),
+ fADCValuesLG(0),
+ fADCValuesHG(0)
{
// ctor
InitParameters() ;
fFirstEvent(0),
fLastEvent(0),
fcdb(0x0),
- fEventCounter(0)
+ fEventCounter(0),
+ fPulse(0),
+ fADCValuesLG(0),
+ fADCValuesHG(0)
{
// ctor
InitParameters() ;
Init() ;
fDefaultInit = kFALSE ;
- fManager = 0 ; // We work in the standalong mode
+ fManager = 0 ; // We work in the standalone mode
fcdb = new AliPHOSCalibData(-1);
}
fFirstEvent(d.fFirstEvent),
fLastEvent(d.fLastEvent),
fcdb (0x0),
- fEventCounter(0)
+ fEventCounter(0),
+ fPulse(0),
+ fADCValuesLG(0),
+ fADCValuesHG(0)
{
// copyy ctor
SetName(d.GetName()) ;
fFirstEvent(0),
fLastEvent(0),
fcdb (0x0),
- fEventCounter(0)
+ fEventCounter(0),
+ fPulse(0),
+ fADCValuesLG(0),
+ fADCValuesHG(0)
{
// ctor Init() is called by RunDigitizer
delete [] fInputFileNames ;
delete [] fEventNames ;
+ delete fPulse;
+ delete [] fADCValuesLG;
+ delete [] fADCValuesHG;
+
if(fcdb){ delete fcdb ; fcdb=0;}
}
// This design avoids scanning over the list of digits to add
// contribution to new SDigits only.
-
Bool_t toMakeNoise = kTRUE ; //Do not create noisy digits if merge with real data
//First stream
AliRunLoader* rl = AliRunLoader::GetRunLoader(fEventFolderName) ;
- AliPHOSLoader * phosLoader = dynamic_cast<AliPHOSLoader*>(rl->GetLoader("PHOSLoader"));
+ AliPHOSLoader * phosLoader = dynamic_cast<AliPHOSLoader*>(rl->GetLoader("PHOSLoader"));
Int_t readEvent = event ;
if (fManager)
//loop over inputs
for(Int_t i = 0 ; i < fInput ; i++){
- if( dynamic_cast<TClonesArray *>(sdigArray->At(i))->GetEntriesFast() > index[i] )
+ if( dynamic_cast<TClonesArray *>(sdigArray->At(i))->GetEntriesFast() > index[i] ){
curSDigit = dynamic_cast<AliPHOSDigit*>(dynamic_cast<TClonesArray *>(sdigArray->At(i))->At(index[i])) ;
+ if(AliPHOSSimParam::GetInstance()->IsStreamDigits(i)){ //This is Digits Stream
+ curSDigit->SetEnergy(Calibrate(curSDigit->GetEnergy(),curSDigit->GetId())) ;
+ curSDigit->SetTime(CalibrateT(curSDigit->GetTime(),curSDigit->GetId())) ;
+ }
+ }
else
curSDigit = 0 ;
//May be several digits will contribute from the same input
eTime=curSDigit->GetEnergy() ;
time=curSDigit->GetTime() ;
}
-
*digit += *curSDigit ; //add energies
index[i]++ ;
digit->SetEnergy(adcW*ceil(digit->GetEnergy()/adcW)) ;
}
}
-
+ //Apply decalibration if necessary
+ for(Int_t i = 0 ; i < nEMC ; i++){
+ digit = dynamic_cast<AliPHOSDigit*>( digits->At(i) ) ;
+ Decalibrate(digit) ;
+ }
+
// ticks->Delete() ;
// delete ticks ;
digits->RemoveAt(i) ;
continue ;
}
+
+ geom->AbsToRelNumbering(digit->GetId(),relId);
+
+ digit->SetEnergy(TMath::Ceil(digit->GetEnergy())-0.9999) ;
+
Float_t tres = TimeResolution(digit->GetEnergy()) ;
digit->SetTime(gRandom->Gaus(digit->GetTime(), tres) ) ;
+
+ fPulse->Reset();
+ fPulse->SetAmplitude(digit->GetEnergy()/
+ fcdb->GetADCchannelEmc(relId[0],relId[3],relId[2]));
+ fPulse->SetTZero(digit->GetTimeR());
+ fPulse->MakeSamples();
+ fPulse->GetSamples(fADCValuesHG, fADCValuesLG) ;
+ Int_t nSamples = fPulse->GetRawFormatTimeBins();
+ digit->SetALTROSamplesHG(nSamples,fADCValuesHG);
+ digit->SetALTROSamplesLG(nSamples,fADCValuesLG);
}
Float_t cpvDigitThreshold = AliPHOSSimParam::GetInstance()->GetCpvDigitsThreshold() ;
}
digits->Compress() ;
-
Int_t ndigits = digits->GetEntriesFast() ;
- digits->Expand(ndigits) ;
-
-
+
//Set indexes in list of digits and make true digitization of the energy
for (Int_t i = 0 ; i < ndigits ; i++) {
digit = dynamic_cast<AliPHOSDigit*>( digits->At(i) ) ;
}
}
+//____________________________________________________________________________
+Float_t AliPHOSDigitizer::Calibrate(Float_t amp,Int_t absId){
+ //Apply calibration
+ const AliPHOSGeometry *geom = AliPHOSGeometry::GetInstance() ;
+ //Determine rel.position of the cell absolute ID
+ Int_t relId[4];
+ geom->AbsToRelNumbering(absId,relId);
+ Int_t module=relId[0];
+ Int_t row =relId[2];
+ Int_t column=relId[3];
+ if(relId[1]==0){ //This Is EMC
+ Float_t calibration = fcdb->GetADCchannelEmc(module,column,row);
+ return amp*calibration ;
+ }
+ return 0 ;
+}
//____________________________________________________________________________
-void AliPHOSDigitizer::DecalibrateEMC(AliPHOSDigit *digit)
+void AliPHOSDigitizer::Decalibrate(AliPHOSDigit *digit)
{
// Decalibrate EMC digit, i.e. change its energy by a factor read from CDB
Int_t module=relId[0];
Int_t row =relId[2];
Int_t column=relId[3];
- Float_t decalibration = fcdb->GetADCchannelEmc(module,column,row);
- Float_t energy = digit->GetEnergy() / decalibration;
- digit->SetEnergy(energy);
+ if(relId[1]==0){ //This Is EMC
+ Float_t calibration = fcdb->GetADCchannelEmc(module,column,row);
+ Float_t energy = digit->GetEnergy()/calibration;
+ digit->SetEnergy(energy); //Now digit measures E in ADC counts
+ Float_t time = digit->GetTime() ;
+ time-=fcdb->GetTimeShiftEmc(module,column,row);
+ digit->SetTime(time) ;
+ }
+}
+//____________________________________________________________________________
+Float_t AliPHOSDigitizer::CalibrateT(Float_t time,Int_t absId){
+ //Apply time calibration
+ const AliPHOSGeometry *geom = AliPHOSGeometry::GetInstance() ;
+
+ //Determine rel.position of the cell absolute ID
+ Int_t relId[4];
+ geom->AbsToRelNumbering(absId,relId);
+ Int_t module=relId[0];
+ Int_t row =relId[2];
+ Int_t column=relId[3];
+ time += fcdb->GetTimeShiftEmc(module,column,row);
+ return time ;
}
//____________________________________________________________________________
Int_t AliPHOSDigitizer::DigitizeCPV(Float_t charge, Int_t absId)
fDigitsInRun = 0 ;
SetEventRange(0,-1) ;
+ fPulse = new AliPHOSPulseGenerator();
+ fADCValuesLG = new Int_t[fPulse->GetRawFormatTimeBins()];
+ fADCValuesHG = new Int_t[fPulse->GetRawFormatTimeBins()];
}