/* $Id$ */
+/* History of cvs commits:
+ *
+ * $Log$
+ * Revision 1.49 2006/05/10 06:42:53 kharlov
+ * Remove redundant loop over primaries
+ *
+ * Revision 1.48 2006/04/22 10:30:17 hristov
+ * Add fEnergy to AliPHOSDigit and operate with EMC amplitude in energy units (Yu.Kharlov)
+ *
+ * Revision 1.47 2005/05/28 14:19:04 schutz
+ * Compilation warnings fixed by T.P.
+ *
+ */
+
//_________________________________________________________________________
// This is a TTask that makes SDigits out of Hits
// The name of the TTask is also the title of the branch that will contain
// --- ROOT system ---
#include "TBenchmark.h"
-#include "TRandom.h"
+ //#include "TObjectTable.h"
// --- Standard library ---
// --- AliRoot header files ---
+#include "AliLog.h"
#include "AliPHOSGeometry.h"
#include "AliPHOSDigit.h"
#include "AliPHOSGetter.h"
#include "AliPHOSHit.h"
#include "AliPHOSSDigitizer.h"
+//#include "AliMemoryWatcher.h"
ClassImp(AliPHOSSDigitizer)
//____________________________________________________________________________
- AliPHOSSDigitizer::AliPHOSSDigitizer():TTask("","")
+AliPHOSSDigitizer::AliPHOSSDigitizer() :
+ TTask("",""),
+ fA(0.f), fB(0.f),
+ fPrimThreshold(0.f),
+ fDefaultInit(kTRUE),
+ fEventFolderName(""),
+ fInit(kFALSE),
+ fSDigitsInRun(0),
+ fFirstEvent(0),
+ fLastEvent(0)
{
// ctor
- InitParameters() ;
- fDefaultInit = kTRUE ;
}
//____________________________________________________________________________
-AliPHOSSDigitizer::AliPHOSSDigitizer(const char * alirunFileName, const char * eventFolderName):
- TTask("PHOS"+AliConfig::fgkSDigitizerTaskName, alirunFileName),
- fEventFolderName(eventFolderName)
+AliPHOSSDigitizer::AliPHOSSDigitizer(const char * alirunFileName,
+ const char * eventFolderName):
+ TTask("PHOS"+AliConfig::Instance()->GetSDigitizerTaskName(), alirunFileName),
+ fA(0.f), fB(0.f),
+ fPrimThreshold(0.f),
+ fDefaultInit(kFALSE),
+ fEventFolderName(eventFolderName),
+ fInit(kFALSE),
+ fSDigitsInRun(0),
+ fFirstEvent(0),
+ fLastEvent(0)
{
-
// ctor
InitParameters() ;
Init();
fDefaultInit = kFALSE ;
}
-//____________________________________________________________________________
-AliPHOSSDigitizer::AliPHOSSDigitizer(const AliPHOSSDigitizer & sd)
- : TTask(sd)
-{
- //cpy ctor
-
- fA = sd.fA ;
- fB = sd.fB ;
- fPrimThreshold = sd.fPrimThreshold ;
- fSDigitsInRun = sd.fSDigitsInRun ;
- SetName(sd.GetName()) ;
- SetTitle(sd.GetTitle()) ;
- fEventFolderName = sd.fEventFolderName;
-}
-
-
//____________________________________________________________________________
AliPHOSSDigitizer::~AliPHOSSDigitizer() {
//dtor
+ // AliPHOSGetter * gime =
+ // AliPHOSGetter::Instance(GetTitle(),fEventFolderName.Data());
AliPHOSGetter * gime =
- AliPHOSGetter::Instance(GetTitle(),fEventFolderName.Data());
+ AliPHOSGetter::Instance();
gime->PhosLoader()->CleanSDigitizer();
}
//____________________________________________________________________________
gime->PostSDigitizer(this);
gime->PhosLoader()->GetSDigitsDataLoader()->GetBaseTaskLoader()->SetDoNotReload(kTRUE);
-
+
}
//____________________________________________________________________________
fB = 10000000.;
fPrimThreshold = 0.01 ;
fSDigitsInRun = 0 ;
- SetEventRange(0,-1) ;
}
//____________________________________________________________________________
//switch off reloading of this task while getting event
if (!fInit) { // to prevent overwrite existing file
- Error( "Exec", "Give a version name different from %s", fEventFolderName.Data() ) ;
+ AliError( Form("Give a version name different from %s", fEventFolderName.Data()) ) ;
return ;
}
-
if (fLastEvent == -1)
fLastEvent = gime->MaxEvent() - 1 ;
else
- fLastEvent = TMath::Min(fLastEvent,gime->MaxEvent());
+ fLastEvent = TMath::Min(fFirstEvent, gime->MaxEvent()); // only ine event at the time
Int_t nEvents = fLastEvent - fFirstEvent + 1;
- Int_t ievent ;
- for (ievent = fFirstEvent; ievent <= fLastEvent; ievent++) {
+ Int_t ievent, i;
- gime->Event(ievent,"H") ;
+ //AliMemoryWatcher memwatcher;
+ for (ievent = fFirstEvent; ievent <= fLastEvent; ievent++) {
+ gime->Event(ievent,"H") ;
TTree * treeS = gime->TreeS();
TClonesArray * hits = gime->Hits() ;
TClonesArray * sdigits = gime->SDigits() ;
sdigits->Clear();
Int_t nSdigits = 0 ;
//Now make SDigits from hits, for PHOS it is the same, so just copy
- Int_t nPrim = static_cast<Int_t>((gime->TreeH())->GetEntries()) ;
- // Attention nPrim is the number of primaries tracked by Geant
- // and this number could be different to the number of Primaries in TreeK;
- Int_t iprim ;
-
- for (iprim = 0 ; iprim < nPrim ; iprim ++) {
- //=========== Get the PHOS branch from Hits Tree for the Primary iprim
- gime->Track(iprim) ;
- Int_t i;
- for ( i = 0 ; i < hits->GetEntries() ; i++ ) {
- AliPHOSHit * hit = dynamic_cast<AliPHOSHit *>(hits->At(i)) ;
- // Assign primary number only if contribution is significant
-
- if( hit->GetEnergy() > fPrimThreshold)
- new((*sdigits)[nSdigits]) AliPHOSDigit(hit->GetPrimary(),hit->GetId(),
- Digitize(hit->GetEnergy()), hit->GetTime()) ;
- else
- new((*sdigits)[nSdigits]) AliPHOSDigit( -1 , hit->GetId(),
- Digitize(hit->GetEnergy()), hit->GetTime()) ;
- nSdigits++ ;
-
- }
+ for ( i = 0 ; i < hits->GetEntries() ; i++ ) {
+ AliPHOSHit * hit = dynamic_cast<AliPHOSHit *>(hits->At(i)) ;
+ // Assign primary number only if contribution is significant
+
+ if( hit->GetEnergy() > fPrimThreshold)
+ new((*sdigits)[nSdigits]) AliPHOSDigit(hit->GetPrimary(),hit->GetId(),
+ hit->GetEnergy() ,hit->GetTime()) ;
+ else
+ new((*sdigits)[nSdigits]) AliPHOSDigit(-1 ,hit->GetId(),
+ hit->GetEnergy() ,hit->GetTime()) ;
+ nSdigits++ ;
+
+ }
- } // loop over iprim
-
sdigits->Sort() ;
nSdigits = sdigits->GetEntriesFast() ;
fSDigitsInRun += nSdigits ;
sdigits->Expand(nSdigits) ;
- Int_t i ;
for (i = 0 ; i < nSdigits ; i++) {
AliPHOSDigit * digit = dynamic_cast<AliPHOSDigit *>(sdigits->At(i)) ;
digit->SetIndexInList(i) ;
//Next - SDigitizer
gime->WriteSDigitizer("OVERWRITE");
-
+ //gObjectTable->Print() ;
+
if(strstr(option,"deb"))
PrintSDigits(option) ;
- }
+
+ //memwatcher.Watch(ievent);
+ }// event loop
Unload();
- gime->PhosLoader()->GetSDigitsDataLoader()->GetBaseTaskLoader()->SetDoNotReload(kTRUE);
+ // gime->PhosLoader()->GetSDigitsDataLoader()->GetBaseTaskLoader()->SetDoNotReload(kTRUE);
if(strstr(option,"tim")){
gBenchmark->Stop("PHOSSDigitizer");
Info("Exec"," took %f seconds for SDigitizing %f seconds per event",
gBenchmark->GetCpuTime("PHOSSDigitizer"), gBenchmark->GetCpuTime("PHOSSDigitizer")/nEvents) ;
}
+
+ //TFile f("out.root","RECREATE");
+ //memwatcher.WriteToFile();
+ //f.Close();
}
//__________________________________________________________________
-void AliPHOSSDigitizer::Print()const
+void AliPHOSSDigitizer::Print(const Option_t *)const
{
// Prints parameters of SDigitizer
Info("Print", "\n------------------- %s -------------", GetName() ) ;
digit = dynamic_cast<AliPHOSDigit *>( sdigits->At(index) ) ;
// if(digit->GetNprimary() == 0)
// continue;
- printf("%6d %8d %6.5e %4d %2d :",
- digit->GetId(), digit->GetAmp(), digit->GetTime(), digit->GetIndexInList(), digit->GetNprimary()) ;
+// printf("%6d %8d %6.5e %4d %2d :\n", // YVK
+ printf("%6d %.4f %6.5e %4d %2d :\n",
+ digit->GetId(), digit->GetEnergy(), digit->GetTime(), digit->GetIndexInList(), digit->GetNprimary()) ;
Int_t iprimary;
for (iprimary=0; iprimary<digit->GetNprimary(); iprimary++) {
printf("%d ",digit->GetPrimary(iprimary+1) ) ;