#include "TObjectTable.h"
// --- AliRoot header files ---
+#include "AliRun.h"
#include "AliRunDigitizer.h"
#include "AliRunLoader.h"
#include "AliEMCALDigit.h"
#include "AliEMCALSDigitizer.h"
#include "AliEMCALGeometry.h"
#include "AliEMCALTick.h"
-#include "AliEMCALJetMicroDst.h"
+#include "AliEMCALHistoUtilities.h"
ClassImp(AliEMCALDigitizer)
//____________________________________________________________________________
AliEMCALDigitizer::~AliEMCALDigitizer()
{
+ //dtor
if (AliRunLoader::GetRunLoader()) {
AliLoader *emcalLoader=0;
if ((emcalLoader = AliRunLoader::GetRunLoader()->GetDetectorLoader("EMCAL")))
AliDebug(1," no runloader present");
delete [] fInputFileNames ;
delete [] fEventNames ;
+
+ if(fHists) delete fHists;
}
//____________________________________________________________________________
AliRunLoader *rl = AliRunLoader::GetRunLoader();
AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*>(rl->GetDetectorLoader("EMCAL"));
- Int_t ReadEvent = event ;
+ Int_t readEvent = event ;
// fManager is data member from AliDigitizer
if (fManager)
- ReadEvent = dynamic_cast<AliStream*>(fManager->GetInputStream(0))->GetCurrentEventNumber() ;
+ readEvent = dynamic_cast<AliStream*>(fManager->GetInputStream(0))->GetCurrentEventNumber() ;
AliDebug(1,Form("Adding event %d from input stream 0 %s %s",
- ReadEvent, GetTitle(), fEventFolderName.Data())) ;
- rl->GetEvent(ReadEvent);
+ readEvent, GetTitle(), fEventFolderName.Data())) ;
+ rl->GetEvent(readEvent);
TClonesArray * digits = emcalLoader->Digits() ;
digits->Clear() ;
- const AliEMCALGeometry *geom = AliEMCALGeometry::GetInstance();
+ // 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) {
TString ng(geom->GetName());
isTrd1Geom = 0;
for(i = 1 ; i < fInput ; i++){
TString tempo(fEventNames[i]) ;
tempo += i ;
- rl = AliRunLoader::Open(fInputFileNames[i], tempo) ;
+
+ AliRunLoader * rl2 = AliRunLoader::GetRunLoader(tempo) ;
+
+ if (rl2==0)
+ rl2 = AliRunLoader::Open(fInputFileNames[i], tempo) ;
+
if (fManager)
- ReadEvent = dynamic_cast<AliStream*>(fManager->GetInputStream(i))->GetCurrentEventNumber() ;
- Info("Digitize", "Adding event %d from input stream %d %s %s", ReadEvent, i, fInputFileNames[i].Data(), tempo.Data()) ;
- rl->LoadSDigits();
- rl->GetEvent(ReadEvent);
- sdigArray->AddAt(emcalLoader->SDigits(), i) ;
+ readEvent = dynamic_cast<AliStream*>(fManager->GetInputStream(i))->GetCurrentEventNumber() ;
+ Info("Digitize", "Adding event %d from input stream %d %s %s", readEvent, i, fInputFileNames[i].Data(), tempo.Data()) ;
+ rl2->LoadSDigits();
+ rl2->GetEvent(readEvent);
+ AliEMCALLoader *emcalLoader2 = dynamic_cast<AliEMCALLoader*>(rl2->GetDetectorLoader("EMCAL"));
+ sdigArray->AddAt(emcalLoader2->SDigits(), i) ;
}
//Find the first tower with signal
digits->Expand(ndigits) ;
//Set indexes in list of digits and fill hists.
- sv::FillH1(fHists, 0, Double_t(ndigits));
+ AliEMCALHistoUtilities::FillH1(fHists, 0, Double_t(ndigits));
Float_t energy=0., esum=0.;
for (i = 0 ; i < ndigits ; i++) {
digit = dynamic_cast<AliEMCALDigit *>( digits->At(i) ) ;
digit->SetIndexInList(i) ;
energy = sDigitizer->Calibrate(digit->GetAmp()) ;
esum += energy;
- digit->SetAmp(DigitizeEnergy(energy) ) ; // for what ??
- sv::FillH1(fHists, 2, double(digit->GetAmp()));
- sv::FillH1(fHists, 3, double(energy));
- sv::FillH1(fHists, 4, double(digit->GetId()));
+ digit->SetAmp(DigitizeEnergy(energy, digit->GetId()) ) ; // for what ??
+ AliEMCALHistoUtilities::FillH1(fHists, 2, double(digit->GetAmp()));
+ AliEMCALHistoUtilities::FillH1(fHists, 3, double(energy));
+ AliEMCALHistoUtilities::FillH1(fHists, 4, double(digit->GetId()));
}
- sv::FillH1(fHists, 1, esum);
+ AliEMCALHistoUtilities::FillH1(fHists, 1, esum);
}
-//____________________________________________________________________________
-
-Int_t AliEMCALDigitizer::DigitizeEnergy(Float_t energy)
+// //_____________________________________________________________________
+Int_t AliEMCALDigitizer::DigitizeEnergy(Float_t energy, Int_t AbsId)
{
+ // Returns digitized value of the energy in a cell absId
+ // Loader
+ AliRunLoader *rl = AliRunLoader::GetRunLoader();
+ AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*>
+ (rl->GetDetectorLoader("EMCAL"));
+
+ // Load EMCAL Geometry
+ rl->LoadgAlice();
+ AliRun * gAlice = rl->GetAliRun();
+ AliEMCAL * emcal = (AliEMCAL*)gAlice->GetDetector("EMCAL");
+ AliEMCALGeometry * geom = emcal->GetGeometry();
+
+ if (geom==0)
+ AliFatal("Did not get geometry from EMCALLoader") ;
+
+ Int_t iSupMod = -1;
+ Int_t nTower = -1;
+ Int_t nIphi = -1;
+ Int_t nIeta = -1;
+ Int_t iphi = -1;
+ Int_t ieta = -1;
Int_t channel = -999;
+
+ Bool_t bCell = geom->GetCellIndex(AbsId, iSupMod, nTower, nIphi, nIeta) ;
+ if(!bCell)
+ Error("DigitizeEnergy","Wrong cell id number") ;
+ geom->GetCellPhiEtaIndexInSModule(iSupMod,nTower,nIphi, nIeta,iphi,ieta);
+
+ if(emcalLoader->CalibData()) {
+ fADCpedestalEC = emcalLoader->CalibData()
+ ->GetADCpedestal(iSupMod,ieta,iphi);
+ fADCchannelEC = emcalLoader->CalibData()
+ ->GetADCchannel(iSupMod,ieta,iphi);
+ }
+
channel = static_cast<Int_t> (TMath::Ceil( (energy + fADCpedestalEC)/fADCchannelEC )) ;
+
if(channel > fNADCEC )
channel = fNADCEC ;
return channel ;
+
}
//____________________________________________________________________________
rl->LoadSDigits("EMCAL");
for (ievent = fFirstEvent; ievent <= fLastEvent; ievent++) {
- //gime->Event(ievent,"S") ;
+
rl->GetEvent(ievent);
Digitize(ievent) ; //Add prepared SDigits to digits and add the noise
//increment the total number of Digits per run
fDigitsInRun += emcalLoader->Digits()->GetEntriesFast() ;
}
- // gime->WriteDigitizer("OVERWRITE");
-
+
emcalLoader->CleanDigitizer() ;
if(strstr(option,"tim")){
//to prevent cleaning of this object while GetEvent is called
emcalLoader->GetDigitsDataLoader()->GetBaseTaskLoader()->SetDoNotReload(kTRUE);
+
+ //PH Print();
return fInit ;
}
//____________________________________________________________________________
void AliEMCALDigitizer::InitParameters()
-{ // Tune parameters - 24-nov-04
+{
+ //parameter initialization for digitizer
+ // Tune parameters - 24-nov-04
fMeanPhotonElectron = 3300 ; // electrons per GeV
fPinNoise = 0.004;
return ;
}
// looking for the file which contains SDigits
- //AliEMCALGetter * gime = AliEMCALGetter::Instance() ;
AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*>(AliRunLoader::GetRunLoader()->GetDetectorLoader("EMCAL"));
TString fileName( emcalLoader->GetSDigitsFileName() ) ;
if ( eventFolderName != AliConfig::GetDefaultEventFolderName()) // only if not the default folder name
}
//__________________________________________________________________
-void AliEMCALDigitizer::PrintDigits(Option_t * option){
+void AliEMCALDigitizer::PrintDigits(Option_t * option)
+{
+ //utility method for printing digit information
+
AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*>(AliRunLoader::GetRunLoader()->GetDetectorLoader("EMCAL"));
TClonesArray * digits = emcalLoader->Digits() ;
TClonesArray * sdigits = emcalLoader->SDigits() ;
}
TList *AliEMCALDigitizer::BookControlHists(int var)
-{ // 22-nov-04
+{
+ // 22-nov-04
+ // histograms for monitoring digitizer performance
+
Info("BookControlHists"," started ");
gROOT->cd();
const AliEMCALGeometry *geom = AliEMCALGeometry::GetInstance();
new TH1F("hDigiAbsId","EMCAL absId cells with fAmp > fDigitThreshold ",
geom->GetNCells(), 0.5, Double_t(geom->GetNCells())+0.5);
}
- fHists = sv::MoveHistsToList("EmcalDigiControlHists", kFALSE);
- fHists = 0;
+
+ fHists = AliEMCALHistoUtilities::MoveHistsToList("EmcalDigiControlHists", kFALSE);
+ fHists = 0; //huh? JLK 03-Mar-2006
return fHists;
}
void AliEMCALDigitizer::SaveHists(const char* name, Bool_t kSingleKey, const char* opt)
{
- sv::SaveListOfHists(fHists, name, kSingleKey, opt);
+ AliEMCALHistoUtilities::SaveListOfHists(fHists, name, kSingleKey, opt);
}