#include <TBrowser.h>
#include <TObjectTable.h>
#include <TRandom.h>
+#include <cassert>
// --- AliRoot header files ---
#include "AliLog.h"
fFirstEvent(0),
fLastEvent(0),
fControlHists(0),
- fHists(0)
+ fHists(0),fCalibData(0x0)
{
// ctor
InitParameters() ;
fFirstEvent(0),
fLastEvent(0),
fControlHists(0),
- fHists(0)
+ fHists(0),fCalibData(0x0)
{
// ctor Init() is called by RunDigitizer
fManager = rd ;
// after that adds contributions from SDigits. This design
// helps to avoid scanning over the list of digits to add
// contribution of any new SDigit.
- static int isTrd1Geom = -1; // -1 - mean undefined
static int nEMC=0; //max number of digits possible
AliRunLoader *rl = AliRunLoader::GetRunLoader();
rl->GetEvent(readEvent);
TClonesArray * digits = emcalLoader->Digits() ;
- digits->Clear() ;
+ digits->Delete() ; //JLK why is this created then deleted?
// Load Geometry
- // const AliEMCALGeometry *geom = AliEMCALGeometry::GetInstance();
- rl->LoadgAlice();
- AliRun * gAlice = rl->GetAliRun();
- AliEMCAL * emcal = (AliEMCAL*)gAlice->GetDetector("EMCAL");
- AliEMCALGeometry * geom = emcal->GetGeometry();
-
- if(isTrd1Geom < 0) {
- AliInfo(Form(" get Geometry %s : %s ", geom->GetName(),geom->GetTitle()));
- TString ng(geom->GetName());
- isTrd1Geom = 0;
- if(ng.Contains("SHISH") && ng.Contains("TRD1")) isTrd1Geom = 1;
-
- if(isTrd1Geom == 0) nEMC = geom->GetNPhi()*geom->GetNZ();
- else nEMC = geom->GetNCells();
- AliDebug(1,Form("nEMC %i (number cells in EMCAL) | %s | isTrd1Geom %i\n", nEMC, geom->GetName(), isTrd1Geom));
+ AliEMCALGeometry *geom = 0;
+ if (rl->GetAliRun()) {
+ AliEMCAL * emcal = (AliEMCAL*)rl->GetAliRun()->GetDetector("EMCAL");
+ geom = emcal->GetGeometry();
}
+ else
+ AliFatal("Could not get AliRun from runLoader");
+
+ nEMC = geom->GetNCells();
+ AliDebug(1,Form("nEMC %i (number cells in EMCAL) | %s \n", nEMC, geom->GetName()));
+
Int_t absID ;
digits->Expand(nEMC) ;
AliEMCALDigit * digit ;
AliEMCALDigit * curSDigit ;
- TClonesArray * ticks = new TClonesArray("AliEMCALTick",1000) ;
+ // TClonesArray * ticks = new TClonesArray("AliEMCALTick",1000) ;
//Put Noise contribution
for(absID = 0; absID < nEMC; absID++){ // Nov 30, 2006 by PAI; was from 1 to nEMC
if(absID==nextSig){
//Add SDigits from all inputs
- ticks->Clear() ;
- Int_t contrib = 0 ;
- Float_t a = digit->GetAmp() ;
- Float_t b = TMath::Abs( a /fTimeSignalLength) ;
+ // ticks->Clear() ;
+ //Int_t contrib = 0 ;
+
+ //Follow PHOS and comment out this timing model til a better one
+ //can be developed - JLK 28-Apr-2008
+
+ //Float_t a = digit->GetAmp() ;
+ //Float_t b = TMath::Abs( a /fTimeSignalLength) ;
//Mark the beginning of the signal
- new((*ticks)[contrib++]) AliEMCALTick(digit->GetTime(),0, b);
+ //new((*ticks)[contrib++]) AliEMCALTick(digit->GetTime(),0, b);
//Mark the end of the signal
- new((*ticks)[contrib++]) AliEMCALTick(digit->GetTime()+fTimeSignalLength, -a, -b);
+ //new((*ticks)[contrib++]) AliEMCALTick(digit->GetTime()+fTimeSignalLength, -a, -b);
+
+ // Calculate time as time of the largest digit
+ Float_t time = digit->GetTime() ;
+ Float_t eTime= digit->GetAmp() ;
// loop over input
for(i = 0; i< fInput ; i++){ //loop over (possible) merge sources
else
primaryoffset = i ;
curSDigit->ShiftPrimary(primaryoffset) ;
-
- a = curSDigit->GetAmp() ;
- b = a /fTimeSignalLength ;
- new((*ticks)[contrib++]) AliEMCALTick(curSDigit->GetTime(),0, b);
- new((*ticks)[contrib++]) AliEMCALTick(curSDigit->GetTime()+fTimeSignalLength, -a, -b);
+
+ //Remove old timing model - JLK 28-April-2008
+ //a = curSDigit->GetAmp() ;
+ //b = a /fTimeSignalLength ;
+ //new((*ticks)[contrib++]) AliEMCALTick(curSDigit->GetTime(),0, b);
+ //new((*ticks)[contrib++]) AliEMCALTick(curSDigit->GetTime()+fTimeSignalLength, -a, -b);
+ if(curSDigit->GetAmp()>eTime) {
+ eTime = curSDigit->GetAmp();
+ time = curSDigit->GetTime();
+ }
*digit = *digit + *curSDigit ; //add energies
amp *= static_cast<Float_t>(gRandom->Poisson(fMeanPhotonElectron)) / static_cast<Float_t>(fMeanPhotonElectron) ;
//calculate and set time
- Float_t time = FrontEdgeTime(ticks) ;
+ //New timing model needed - JLK 28-April-2008
+ //Float_t time = FrontEdgeTime(ticks) ;
digit->SetTime(time) ;
//Find next signal module
absID, amp, nextSig));
} // for(absID = 1; absID <= nEMC; absID++)
- ticks->Delete() ;
- delete ticks ;
+ //ticks->Delete() ;
+ //delete ticks ;
delete sdigArray ; //We should not delete its contents
digits->Compress() ;
Int_t ndigits = digits->GetEntriesFast() ;
- digits->Expand(ndigits) ;
//Set indexes in list of digits and fill hists.
AliEMCALHistoUtilities::FillH1(fHists, 0, Double_t(ndigits));
// Post Digitizer to the white board
emcalLoader->PostDigitizer(this) ;
- if (fLastEvent == -1)
+ if (fLastEvent == -1) {
fLastEvent = rl->GetNumberOfEvents() - 1 ;
+ }
else if (fManager)
fLastEvent = fFirstEvent ; // what is this ??
//____________________________________________________________________________
void AliEMCALDigitizer::InitParameters()
{
- //parameter initialization for digitizer
- // Tune parameters - 24-nov-04
+ // Parameter initialization for digitizer
+ // Tune parameters - 24-nov-04; Apr 29, 2007
+ // New parameters JLK 14-Apr-2008
- fMeanPhotonElectron = 3300 ; // electrons per GeV
- fPinNoise = 0.004;
+ fMeanPhotonElectron = 4400; // electrons per GeV
+ fPinNoise = 0.037; // pin noise in GEV from analysis test beam data
if (fPinNoise == 0. )
Warning("InitParameters", "No noise added\n") ;
fDigitThreshold = fPinNoise * 3; // 3 * sigma
fTimeResolution = 0.3e-9 ; // 300 psc
fTimeSignalLength = 1.0e-9 ;
- fADCchannelEC = 0.00305; // 200./65536 - width of one ADC channel in GeV
- fADCpedestalEC = 0.009 ; // GeV
+ // These defaults are normally not used.
+ // Values are read from calibration database instead
+ fADCchannelEC = 0.0153; // Update 24 Apr 2007: 250./16/1024 - width of one ADC channel in GeV
+ fADCpedestalEC = 0.0 ; // GeV
fNADCEC = (Int_t) TMath::Power(2,16) ; // number of channels in Tower ADC - 65536
fTimeThreshold = 0.001*10000000 ; // Means 1 MeV in terms of SDigits amplitude ??
return ;
}
// need to increase the arrays
+ // MvL: This code only works when fInput == 1, I think.
TString tempo = fInputFileNames[fInput-1] ;
delete [] fInputFileNames ;
fInputFileNames = new TString[fInput+1] ;
fInput++ ;
}
+//__________________________________________________________________
void AliEMCALDigitizer::Print1(Option_t * option)
{ // 19-nov-04 - just for convinience
Print();
// -- create Digits branch
Int_t bufferSize = 32000 ;
TBranch * digitsBranch = 0;
- if ((digitsBranch = treeD->GetBranch("EMCAL")))
+ if ((digitsBranch = treeD->GetBranch("EMCAL"))) {
digitsBranch->SetAddress(&digits);
+ AliWarning("Digits Branch already exists. Not all digits will be visible");
+ }
else
treeD->Branch("EMCAL","TClonesArray",&digits,bufferSize);
//digitsBranch->SetTitle(fEventFolderName);
}
+//__________________________________________________________________
void AliEMCALDigitizer::Browse(TBrowser* b)
{
if(fHists) b->Add(fHists);
TTask::Browse(b);
}
+//__________________________________________________________________
TList *AliEMCALDigitizer::BookControlHists(int var)
{
// 22-nov-04
return fHists;
}
+//__________________________________________________________________
void AliEMCALDigitizer::SaveHists(const char* name, Bool_t kSingleKey, const char* opt)
{
AliEMCALHistoUtilities::SaveListOfHists(fHists, name, kSingleKey, opt);