//
//////////////////////////////////////////////////////////////////////////////
-// --- Standard library ---
-#include <strstream.h>
-
// --- ROOT system ---
class TFile;
#include "TBranch.h"
#include "TClonesArray.h"
#include "TTree.h"
-// --- AliRoot header files ---
+// --- Standard library ---
+#include <strstream.h>
+// --- AliRoot header files ---
#include "AliEMCAL.h"
-#include "AliEMCALGeometry.h"
#include "AliMC.h"
#include "AliRun.h"
#include "AliMagF.h"
+#include "AliEMCALGeometry.h"
+//#include "AliEMCALQAChecker.h"
ClassImp(AliEMCAL)
-
//____________________________________________________________________________
AliEMCAL::AliEMCAL():AliDetector()
{
- // ctor
- //We do not create objects, because these pointers will be overwritten during reading from file.
- fGeom = 0;
+ // Default ctor
+ fName="EMCAL";
+ //fQATask = 0;
+ fTreeQA = 0;
}
+
//____________________________________________________________________________
-AliEMCAL::AliEMCAL(const char* name, const char* title): AliDetector(name,title) {
-// ctor : title is used to identify the layout
- fGeom = 0;
-// gets an instance of the geometry parameters class
+AliEMCAL::AliEMCAL(const char* name, const char* title): AliDetector(name,title)
+{
+ // ctor : title is used to identify the layout
+
+ //fQATask = 0;
+ fTreeQA = 0;
}
+
//____________________________________________________________________________
-AliEMCAL::~AliEMCAL(){
- // dtor
- delete fHits;
+AliEMCAL::~AliEMCAL()
+{
+
}
//____________________________________________________________________________
-void AliEMCAL::CreateMaterials(){
+void AliEMCAL::CreateMaterials()
+{
// Definitions of materials to build EMCAL and associated tracking media.
// media number in idtmed are 1599 to 1698.
// --- Generate explicitly delta rays in Lead ---
gMC->Gstpar(idtmed[1600], "LOSS",3.) ;
gMC->Gstpar(idtmed[1600], "DRAY",1.) ;
-
+ gMC->Gstpar(idtmed[1600], "DCUTE",0.00001) ;
+ gMC->Gstpar(idtmed[1600], "DCUTM",0.00001) ;
+
// --- and in aluminium parts ---
gMC->Gstpar(idtmed[1602], "LOSS",3.) ;
gMC->Gstpar(idtmed[1602], "DRAY",1.) ;
+ gMC->Gstpar(idtmed[1602], "DCUTE",0.00001) ;
+ gMC->Gstpar(idtmed[1602], "DCUTM",0.00001) ;
// --- and finally thresholds for photons and electrons in the scintillator ---
}
+
+//____________________________________________________________________________
+AliEMCALGeometry * AliEMCAL::GetGeometry() const
+{
+ // gets the pointer to the AliEMCALGeometry unique instance
+
+ return AliEMCALGeometry::GetInstance(GetTitle(),"") ;
+
+}
+
//____________________________________________________________________________
void AliEMCAL::SetTreeAddress()
{
branch = treeH->GetBranch(branchname);
if (branch) branch->SetAddress(&fHits);
}
-
}
+//____________________________________________________________________________
+void AliEMCAL::WriteQA()
+{
+
+ // Make TreeQA in the output file.
+
+ if(fTreeQA == 0)
+ fTreeQA = new TTree("TreeQA", "QA Alarms") ;
+ // Create Alarms branches
+// Int_t bufferSize = 32000 ;
+// Int_t splitlevel = 0 ;
+// TFolder * alarmsF = (TFolder*)gROOT->FindObjectAny("Folders/Run/Conditions/QA/PHOS") ;
+// TString branchName(alarmsF->GetName());
+// TBranch * alarmsBranch = fTreeQA->Branch(branchName,"TFolder", &alarmsF, bufferSize, splitlevel);
+// TString branchTitle = branchName + " QA alarms" ;
+// alarmsBranch->SetTitle(branchTitle);
+// alarmsBranch->Fill() ;
+
+ //fTreeQA->Fill() ;
+}
//
//*-- Author: Yves Schutz (SUBATECH)
-#include <assert.h>
+#include <stdlib.h>
// --- ROOT system ---
+
class TString ;
-class TClonesArray ;
+class TTask ;
+class TFolder ;
// --- AliRoot header files ---
-#include <stdlib.h>
+
#include "AliDetector.h"
-#include "AliEMCALGeometry.h"
class AliEMCALGeometry ;
+//class AliEMCALQAChecker ;
class AliEMCAL : public AliDetector {
// do not use this definition but the one below
abort() ;
}
- virtual void AddHit( Int_t shunt, Int_t primary, Int_t track,
+ virtual void AddHit( Int_t shunt, Int_t primary, Int_t track,
Int_t id, Float_t *hits ) = 0 ;
-
-
- virtual void CreateMaterials() ;
- //virtual AliEMCALGeometry * GetGeometry() = 0 ;
- Int_t IsVersion(void) const { return -1 ; }
- virtual void SetTreeAddress() ;
- virtual TString Version() {return TString(" ") ; }
+ virtual void CreateMaterials() ;
+ virtual void FinishRun() {WriteQA();}
+ virtual AliEMCALGeometry * GetGeometry() const ;
+ virtual Int_t IsVersion(void) const = 0 ;
+ //AliEMCALQAChecker * QAChecker() const {return fQATask;}
+ virtual void SetTreeAddress() ;
+ virtual TTree * TreeQA() const {return fTreeQA; }
+ virtual const TString Version() const {return TString(" ") ; }
+ virtual void WriteQA() ;
AliEMCAL & operator = (const AliEMCAL & rvalue) {
// assignement operator requested by coding convention
// but not needed
protected:
- AliEMCALGeometry * fGeom ; // Geometry definition
+ //AliEMCALQAChecker * fQATask ; //! PHOS checkers container
+ TTree * fTreeQA ; // the QA tree that contains the alarms
- ClassDef(AliEMCAL,1) // Electromagnetic calorimeter (base class)
+ ClassDef(AliEMCAL,2) // Electromagnetic calorimeter (base class)
} ;
// Base class for the clusterization algorithm (pure abstract)
//*--
//*-- Author: Yves Schutz SUBATECH
+// Modif:
+// August 2002 Yves Schutz: clone PHOS as closely as possible and intoduction
+// of new IO (à la PHOS)
//////////////////////////////////////////////////////////////////////////////
// --- ROOT system ---
-
#include "TGeometry.h"
#include "TDirectory.h"
#include "TFile.h"
#include "TTree.h"
// --- Standard library ---
-
#include <iostream.h>
#include <stdlib.h>
// --- AliRoot header files ---
-
#include "AliRun.h"
#include "AliEMCALClusterizer.h"
#include "AliHeader.h"
{
// ctor
fSplitFile = 0 ;
- fHitsFileName = "" ;
- fSDigitsFileName = "" ;
- fDigitsFileName = "" ;
+ fToSplit = kFALSE ;
}
//____________________________________________________________________________
-AliEMCALClusterizer::AliEMCALClusterizer(const char* headerFile, const char* name):
+AliEMCALClusterizer::AliEMCALClusterizer(const char* headerFile, const char* name, const Bool_t toSplit):
TTask(name, headerFile)
{
// ctor
+ fToSplit = toSplit ;
fSplitFile = 0 ;
- fDigitsFileName = headerFile ;
- AliEMCALGetter * gime = AliEMCALGetter::GetInstance(headerFile, name) ;
- gime->Event(0,"D") ;
- fSDigitsFileName = gime->Digitizer()->GetTitle() ;
- gime = AliEMCALGetter::GetInstance(fSDigitsFileName, name) ;
- gime->Event(0,"S") ;
- fHitsFileName = gime->SDigitizer()->GetTitle() ;
+
}
//____________________________________________________________________________
// dtor
fSplitFile = 0 ;
-
-}
-
-//____________________________________________________________________________
-void AliEMCALClusterizer::SetSplitFile(const TString splitFileName)
-{
- // Diverts the Digits in a file separate from the hits file
-
+ }
- TDirectory * cwd = gDirectory ;
- fSplitFile = gAlice->InitTreeFile("R",splitFileName.Data());
- fSplitFile->cd() ;
- gAlice->Write(0, TObject::kOverwrite);
-
- TTree *treeE = gAlice->TreeE();
- if (!treeE) {
- cerr << "ERROR: AliEMCALClusterizer::SetSplitFile -> No TreeE found "<<endl;
- abort() ;
- }
-
- // copy TreeE
- AliHeader *header = new AliHeader();
- treeE->SetBranchAddress("Header", &header);
- treeE->SetBranchStatus("*",1);
- TTree *treeENew = treeE->CloneTree();
- treeENew->Write(0, TObject::kOverwrite);
-
- // copy AliceGeom
- TGeometry *AliceGeom = static_cast<TGeometry*>(cwd->Get("AliceGeom"));
- if (!AliceGeom) {
- cerr << "ERROR: AliEMCALClusterizer::SetSplitFile -> AliceGeom was not found in the input file "<<endl;
- abort() ;
- }
- AliceGeom->Write(0, TObject::kOverwrite);
-
- gAlice->MakeTree("R", fSplitFile);
- cwd->cd() ;
- cout << "INFO: AliEMCALClusterizer::SetSPlitMode -> RecPoints will be stored in " << splitFileName.Data() << endl ;
-}
//_________________________________________________________________________
// Base class for the clusterization algorithm (pure abstract)
//*-- Author: Yves Schutz (SUBATECH) & Dmitri Peressounko (SUBATECH & Kurchatov Institute)
+// Modif:
+// August 2002 Yves Schutz: clone PHOS as closely as possible and intoduction
+// of new IO (à la PHOS)
// --- ROOT system ---
#include "TTask.h"
-class TFile ;
+
// --- Standard library ---
+#include <iostream.h>
// --- AliRoot header files ---
public:
AliEMCALClusterizer() ; // default ctor
- AliEMCALClusterizer(const char * headerFile, const char * name) ;
+ AliEMCALClusterizer(const char * headerFile, const char * name, const Bool_t toSplit) ;
virtual ~AliEMCALClusterizer() ; // dtor
- const TString GetHitsFileName() const { return fHitsFileName ; }
- const TString GetSDigitsFileName() const { return fSDigitsFileName ; }
- const TString GetDigitsFileName() const { return fDigitsFileName ; }
-
- virtual Float_t GetEmcClusteringThreshold()const = 0 ;
- virtual Float_t GetEmcLocalMaxCut()const = 0 ;
- virtual Float_t GetEmcLogWeight()const = 0 ;
- virtual Float_t GetTimeGate() const = 0 ;
- virtual Float_t GetCpvClusteringThreshold()const = 0 ;
- virtual Float_t GetCpvLocalMaxCut()const = 0 ;
- virtual Float_t GetCpvLogWeight()const = 0 ;
- virtual char * GetRecPointsBranch() const = 0 ;
- virtual const Int_t GetRecPointsInRun() const = 0 ;
- virtual char * GetDigitsBranch() const = 0 ;
+ virtual Float_t GetTowerClusteringThreshold()const {cout << "Not Defined" << endl ; return 0. ; }
+ virtual Float_t GetTowerLocalMaxCut()const {cout << "Not Defined" << endl ; return 0. ; }
+ virtual Float_t GetTowerLogWeight()const {cout << "Not Defined" << endl ; return 0. ; }
+ virtual Float_t GetTimeGate() const {cout << "Not Defined" << endl ; return 0. ; }
+ virtual Float_t GetPreShoClusteringThreshold()const {cout << "Not Defined" << endl ; return 0. ; }
+ virtual Float_t GetPreShoLocalMaxCut()const {cout << "Not Defined" << endl ; return 0. ; }
+ virtual Float_t GetPreShoLogWeight()const {cout << "Not Defined" << endl ; return 0. ; }
+ virtual const char * GetRecPointsBranch() const {cout << "Not Defined" << endl ; return 0 ; }
+ virtual const Int_t GetRecPointsInRun() const {cout << "Not Defined" << endl ; return 0 ; }
+ virtual const char * GetDigitsBranch() const {cout << "Not Defined" << endl ; return 0 ; }
- virtual void MakeClusters() = 0 ;
- virtual void Print(Option_t * option)const = 0;
+ virtual void MakeClusters() {cout << "Not Defined" << endl ; }
+ virtual void Print(Option_t * option)const {cout << "Not Defined" << endl ; }
- virtual void SetTowerClusteringThreshold(Float_t cluth) = 0 ;
- virtual void SetTowerLocalMaxCut(Float_t cut) = 0 ;
- virtual void SetTowerLogWeight(Float_t w) = 0 ;
- virtual void SetTimeGate(Float_t gate) = 0 ;
- virtual void SetPreShoClusteringThreshold(Float_t cluth) = 0 ;
- virtual void SetPreShoLocalMaxCut(Float_t cut) = 0 ;
- virtual void SetPreShoLogWeight(Float_t w) = 0 ;
- virtual void SetDigitsBranch(const char * title) = 0 ;
- virtual void SetRecPointsBranch(const char *title) = 0 ;
- void SetSplitFile(const TString splitFileName = "EMCAL.RecPoints.root") ;
- virtual void SetUnfolding(Bool_t toUnfold ) = 0 ;
- virtual const char * Version() const = 0 ;
+ virtual void SetTowerClusteringThreshold(Float_t cluth) {cout << "Not Defined" << endl ; }
+ virtual void SetTowerLocalMaxCut(Float_t cut) {cout << "Not Defined" << endl ; }
+ virtual void SetTowerLogWeight(Float_t w) {cout << "Not Defined" << endl ; }
+ virtual void SetTimeGate(Float_t gate) {cout << "Not Defined" << endl ; }
+ virtual void SetPreShoClusteringThreshold(Float_t cluth) {cout << "Not Defined" << endl ; }
+ virtual void SetPreShoLocalMaxCut(Float_t cut) {cout << "Not Defined" << endl ; }
+ virtual void SetPreShoLogWeight(Float_t w) {cout << "Not Defined" << endl ; }
+ virtual void SetDigitsBranch(const char * title) {cout << "Not Defined" << endl ; }
+ virtual void SetRecPointsBranch(const char *title) {cout << "Not Defined" << endl ; }
+ virtual void SetUnfolding(Bool_t toUnfold ) {cout << "Not Defined" << endl ; }
+ virtual const char * Version() const {cout << "Not Defined" << endl ; return 0 ; }
protected:
- TString fHitsFileName ; // file name that contains the original hits
- TString fSDigitsFileName ; // file name that contains the original SDigits
- TString fDigitsFileName ; // file name that contains the original Digits
TFile * fSplitFile ; //! file in which RecPoints will eventually be stored
+ Bool_t fToSplit ; //! Should we write to splitted file
- ClassDef(AliEMCALClusterizer,1) // Clusterization algorithm class
+ ClassDef(AliEMCALClusterizer,2) // Clusterization algorithm class
} ;
After first PPSD digit remove EMC digits only once
*/
//*-- Author: Yves Schutz (SUBATECH) & Dmitri Peressounko (SUBATECH & Kurchatov Institute)
+// August 2002 Yves Schutz: clone PHOS as closely as possible and intoduction
+// of new IO (à la PHOS)
//////////////////////////////////////////////////////////////////////////////
// Clusterization class. Performs clusterization (collects neighbouring active cells) and
// unfolds the clusters having several local maxima.
#include "AliEMCALTowerRecPoint.h"
#include "AliEMCAL.h"
#include "AliEMCALGetter.h"
+#include "AliEMCALGeometry.h"
#include "AliRun.h"
ClassImp(AliEMCALClusterizerv1)
}
//____________________________________________________________________________
-AliEMCALClusterizerv1::AliEMCALClusterizerv1(const char* headerFile,const char* name)
-:AliEMCALClusterizer(headerFile, name)
+AliEMCALClusterizerv1::AliEMCALClusterizerv1(const char* headerFile, const char* name, const Bool_t toSplit)
+:AliEMCALClusterizer(headerFile, name, toSplit)
{
// ctor with the indication of the file where header Tree and digits Tree are stored
InitParameters() ;
- fDefaultInit = kFALSE ;
Init() ;
+ fDefaultInit = kFALSE ;
}
+
//____________________________________________________________________________
AliEMCALClusterizerv1::~AliEMCALClusterizerv1()
{
// dtor
- // fDefaultInit = kTRUE if Clusterizer created by default ctor (to get just the parameters)
+ fSplitFile = 0 ;
- if (!fDefaultInit) {
- AliEMCALGetter * gime = AliEMCALGetter::GetInstance() ;
-
- // remove the task from the folder list
- gime->RemoveTask("C",GetName()) ;
-
- // remove the RecPoints from the folder list
- TString name(GetName()) ;
- name.Remove(name.Index(":")) ;
- gime->RemoveObjects("D", name) ; // Digits
- gime->RemoveObjects("RT", name) ; // TowerRecPoints
- gime->RemoveObjects("RP", name) ; // PreShoRecPoints
-
- // Delete gAlice
- gime->CloseFile() ;
-
- }
}
//____________________________________________________________________________
//____________________________________________________________________________
Float_t AliEMCALClusterizerv1::Calibrate(Int_t amp, Bool_t inpresho) const
-{
+{//To be replased later by the method, reading individual parameters from the database
+
if ( inpresho ) // calibrate as pre shower
return -fADCpedestalPreSho + amp * fADCchannelPreSho ;
else //calibrate as tower
return -fADCpedestalTower + amp * fADCchannelTower ;
}
+
//____________________________________________________________________________
void AliEMCALClusterizerv1::Exec(Option_t * option)
{
if(strstr(option,"print"))
Print("") ;
- gAlice->GetEvent(0) ;
-
- //check, if the branch with name of this" already exits?
- TObjArray * lob = (TObjArray*)gAlice->TreeR()->GetListOfBranches() ;
- TIter next(lob) ;
- TBranch * branch = 0 ;
- Bool_t emcaltowerfound = kFALSE, emcalpreshofound = kFALSE, clusterizerfound = kFALSE ;
-
- TString branchname = GetName() ;
- branchname.Remove(branchname.Index(Version())-1) ;
-
- while ( (branch = (TBranch*)next()) && (!emcaltowerfound || !emcalpreshofound || !clusterizerfound) ) {
- if ( (strcmp(branch->GetName(), "EMCALTowerRP")==0) && (strcmp(branch->GetTitle(), branchname.Data())==0) )
- emcaltowerfound = kTRUE ;
-
- else if ( (strcmp(branch->GetName(), "EMCALPreShoRP")==0) && (strcmp(branch->GetTitle(), branchname.Data())==0) )
- emcalpreshofound = kTRUE ;
-
- else if ((strcmp(branch->GetName(), "AliEMCALClusterizer")==0) && (strcmp(branch->GetTitle(), GetName())==0) )
- clusterizerfound = kTRUE ;
- }
-
- if ( emcalpreshofound || emcaltowerfound || clusterizerfound ) {
- cerr << "WARNING: AliEMCALClusterizer::Exec -> Tower(PreSho)RecPoints and/or Clusterizer branch with name "
- << branchname.Data() << " already exits" << endl ;
- return ;
- }
-
AliEMCALGetter * gime = AliEMCALGetter::GetInstance() ;
- Int_t nevents = (Int_t) gAlice->TreeE()->GetEntries() ;
+ if(gime->BranchExists("RecPoints"))
+ return ;
+ Int_t nevents = gime->MaxEvent() ;
Int_t ievent ;
for(ievent = 0; ievent < nevents; ievent++){
+ gime->Event(ievent,"D") ;
+
if(ievent == 0)
GetCalibrationParameters() ;
fNumberOfTowerClusters = fNumberOfPreShoClusters = 0 ;
-
- gime->Event(ievent,"D") ;
-
+
MakeClusters() ;
if(fToUnfold)
void AliEMCALClusterizerv1::GetCalibrationParameters()
{
AliEMCALGetter * gime = AliEMCALGetter::GetInstance() ;
- TString branchname = GetName() ;
- branchname.Remove(branchname.Index(Version())-1) ;
-
- AliEMCALDigitizer * dig = gime->Digitizer(branchname) ;
+ const AliEMCALDigitizer * dig = gime->Digitizer(BranchName()) ;
fADCchannelTower = dig->GetTowerchannel() ;
fADCpedestalTower = dig->GetTowerpedestal();
fADCpedestalPreSho = dig->GetPreShopedestal() ;
}
+
//____________________________________________________________________________
void AliEMCALClusterizerv1::Init()
{
TString branchname = GetName() ;
branchname.Remove(branchname.Index(Version())-1) ;
- AliEMCALGetter * gime = AliEMCALGetter::GetInstance(GetTitle(), branchname, "update") ;
+ AliEMCALGetter * gime = AliEMCALGetter::GetInstance(GetTitle(), branchname.Data(), fToSplit ) ;
if ( gime == 0 ) {
cerr << "ERROR: AliEMCALClusterizerv1::Init -> Could not obtain the Getter object !" << endl ;
return ;
}
+
+ fSplitFile = 0 ;
+ if(fToSplit){
+ // construct the name of the file as /path/EMCAL.SDigits.root
+ //First - extract full path if necessary
+ TString fileName(GetTitle()) ;
+ Ssiz_t islash = fileName.Last('/') ;
+ if(islash<fileName.Length())
+ fileName.Remove(islash+1,fileName.Length()) ;
+ else
+ fileName="" ;
+ // Next - append the file name
+ fileName+="EMCAL.RecData." ;
+ if((strcmp(branchname.Data(),"Default")!=0)&&(strcmp(branchname.Data(),"")!=0)){
+ fileName+=branchname ;
+ fileName+="." ;
+ }
+ fileName+="root" ;
+ // Finally - check if the file already opened or open the file
+ fSplitFile = static_cast<TFile*>(gROOT->GetFile(fileName.Data()));
+ if(!fSplitFile)
+ fSplitFile = TFile::Open(fileName.Data(),"update") ;
+ }
+
const AliEMCALGeometry * geom = gime->EMCALGeometry() ;
fNTowers = geom->GetNZ() * geom->GetNPhi() ;
gMinuit = new TMinuit(100) ;
gime->PostClusterizer(this) ;
- // create a folder on the white board
gime->PostRecPoints(branchname ) ;
-
- gime->PostDigits(branchname) ;
- gime->PostDigitizer(branchname) ;
-
+
}
//____________________________________________________________________________
fTimeGate = 1.e-8 ;
fToUnfold = kFALSE ;
-
- fHeaderFileName = GetTitle() ;
- fDigitsBranchTitle = GetName() ;
-
+
TString clusterizerName( GetName()) ;
if (clusterizerName.IsNull() )
clusterizerName = "Default" ;
clusterizerName.Append(Version()) ;
SetName(clusterizerName) ;
fRecPointsInRun = 0 ;
+
}
//____________________________________________________________________________
// fills and writes into TreeR.
AliEMCALGetter *gime = AliEMCALGetter::GetInstance() ;
- TObjArray * towerRecPoints = gime->TowerRecPoints(BranchName()) ;
- TObjArray * preshoRecPoints = gime->PreShowerRecPoints(BranchName()) ;
- TClonesArray * digits = gime->Digits(BranchName()) ;
+ TObjArray * towerRecPoints = gime->TowerRecPoints() ;
+ TObjArray * preshoRecPoints = gime->PreShowerRecPoints() ;
+ TClonesArray * digits = gime->Digits() ;
TTree * treeR ;
+
+ if(fToSplit){
+ if(!fSplitFile)
+ return ;
+ fSplitFile->cd() ;
+ TString name("TreeR") ;
+ name += event ;
+ treeR = dynamic_cast<TTree*>(fSplitFile->Get(name));
+ }
+ else{
+ treeR = gAlice->TreeR();
+ }
- if (!gAlice->TreeR() )
+ if(!treeR){
gAlice->MakeTree("R", fSplitFile);
- treeR = gAlice->TreeR() ;
-
- Int_t index ;
+ treeR = gAlice->TreeR() ;
+ }
+
+ Int_t index ;
//Evaluate position, dispersion and other RecPoint properties...
for(index = 0; index < towerRecPoints->GetEntries(); index++)
(dynamic_cast<AliEMCALTowerRecPoint *>(towerRecPoints->At(index)))->EvalAll(fW0,digits) ;
-
+
towerRecPoints->Sort() ;
for(index = 0; index < towerRecPoints->GetEntries(); index++)
preshoRecPoints->Expand(preshoRecPoints->GetEntriesFast()) ;
- //Make branches in TreeR for RecPoints and Clusterizer
-
-
Int_t bufferSize = 32000 ;
Int_t splitlevel = 0 ;
//First Tower branch
- TBranch * emcBranch = treeR->Branch("EMCALTowerRP","TObjArray",&towerRecPoints,bufferSize,splitlevel);
- emcBranch->SetTitle(BranchName());
-
-
+ TBranch * towerBranch = treeR->Branch("EMCALTowerRP","TObjArray",&towerRecPoints,bufferSize,splitlevel);
+ towerBranch->SetTitle(BranchName());
+
//Now Pre Shower branch
- TBranch * cpvBranch = treeR->Branch("EMCALPreShoRP","TObjArray",&preshoRecPoints,bufferSize,splitlevel);
- cpvBranch->SetTitle(BranchName());
-
+ TBranch * preshoBranch = treeR->Branch("EMCALPreShoRP","TObjArray",&preshoRecPoints,bufferSize,splitlevel);
+ preshoBranch->SetTitle(BranchName());
//And Finally clusterizer branch
AliEMCALClusterizerv1 * cl = (AliEMCALClusterizerv1*)gime->Clusterizer(BranchName()) ;
&cl,bufferSize,splitlevel);
clusterizerBranch->SetTitle(BranchName());
- emcBranch ->Fill() ;
- cpvBranch ->Fill() ;
+ towerBranch ->Fill() ;
+ preshoBranch ->Fill() ;
clusterizerBranch->Fill() ;
treeR->AutoSave() ; //Write(0,kOverwrite) ;
-
+ if(gAlice->TreeR()!=treeR)
+ treeR->Delete();
}
//____________________________________________________________________________
{
// Steering method to construct the clusters stored in a list of Reconstructed Points
// A cluster is defined as a list of neighbour digits
-
- TString branchName(GetName()) ;
- branchName.Remove(branchName.Index(Version())-1) ;
-
+
AliEMCALGetter * gime = AliEMCALGetter::GetInstance() ;
- TObjArray * towerRecPoints = gime->TowerRecPoints(branchName) ;
- TObjArray * preshoRecPoints = gime->PreShowerRecPoints(branchName) ;
+ TObjArray * towerRecPoints = gime->TowerRecPoints(BranchName()) ;
+ TObjArray * preshoRecPoints = gime->PreShowerRecPoints(BranchName()) ;
towerRecPoints->Delete() ;
preshoRecPoints->Delete() ;
- TClonesArray * digits = gime->Digits(branchName) ;
+ TClonesArray * digits = gime->Digits() ;
+ if ( !digits ) {
+ cerr << "ERROR: AliEMCALClusterizerv1::MakeClusters -> Digits with name "
+ << GetName() << " not found ! " << endl ;
+ abort() ;
+ }
TClonesArray * digitsC = dynamic_cast<TClonesArray*>(digits->Clone()) ;
taskName.ReplaceAll(Version(), "") ;
cout << "---------------"<< taskName.Data() << " " << GetTitle()<< "-----------" << endl
- << "Clusterizing digits from the file: " << fHeaderFileName.Data() << endl
- << " Branch: " << fDigitsBranchTitle.Data() << endl
+ << "Clusterizing digits from the file: " << taskName.Data() << endl
+ << " Branch: " << GetName() << endl
<< endl
<< " EMC Clustering threshold = " << fTowerClusteringThreshold << endl
<< " EMC Local Maximum cut = " << fTowerLocMaxCut << endl
// PHOSCpvRP (CPV RecPoints) and AliPHOSClusterizer
//
//*-- Author: Yves Schutz (SUBATECH)
+// Modif:
+// August 2002 Yves Schutz: clone PHOS as closely as possible and intoduction
+// of new IO (à la PHOS)
// --- ROOT system ---
public:
AliEMCALClusterizerv1() ;
- AliEMCALClusterizerv1(const char * headerFile, const char * name = "Default");
+ AliEMCALClusterizerv1(const char * headerFile, const char * name = "Default", const Bool_t toSplit=kFALSE);
virtual ~AliEMCALClusterizerv1() ;
virtual Int_t AreNeighbours(AliEMCALDigit * d1, AliEMCALDigit * d2)const ;
// Checks if digits are in neighbour cells
- const TString BranchName() const ;
virtual Float_t Calibrate(Int_t amp, Bool_t inpresho)const ; // Tranforms Amp to energy
virtual void GetNumberOfClustersFound(int * numb )const{ numb[0] = fNumberOfTowerClusters ;
numb[1] = fNumberOfPreShoClusters ; }
- virtual Float_t GetEmcClusteringThreshold()const{ return fTowerClusteringThreshold;}
- virtual Float_t GetEmcLocalMaxCut()const { return fTowerLocMaxCut;}
- virtual Float_t GetEmcLogWeight()const { return fW0;}
+ virtual Float_t GetTowerClusteringThreshold()const{ return fTowerClusteringThreshold;}
+ virtual Float_t GetTowerLocalMaxCut()const { return fTowerLocMaxCut;}
+ virtual Float_t GetTowerLogWeight()const { return fW0;}
virtual Float_t GetTimeGate() const { return fTimeGate ; }
- virtual Float_t GetCpvClusteringThreshold()const{ return fPreShoClusteringThreshold; }
- virtual Float_t GetCpvLocalMaxCut()const { return fPreShoLocMaxCut;}
- virtual Float_t GetCpvLogWeight()const { return fW0CPV;}
- virtual char * GetRecPointsBranch() const { return (char*) fRecPointsBranchTitle.Data() ;}
- virtual const Int_t GetRecPointsInRun() const {return fRecPointsInRun ;}
- virtual char * GetDigitsBranch() const { return (char*) fDigitsBranchTitle.Data() ;}
+ virtual Float_t GetPreShoClusteringThreshold()const{ return fPreShoClusteringThreshold; }
+ virtual Float_t GetPreShoLocalMaxCut()const { return fPreShoLocMaxCut;}
+ virtual Float_t GetPreShoLogWeight()const { return fW0CPV;}
+ virtual const char * GetRecPointsBranch() const{ return GetName() ;}
+ virtual const Int_t GetRecPointsInRun() const {return fRecPointsInRun ;}
void Exec(Option_t *option); // Does the job
virtual void SetPreShoClusteringThreshold(Float_t cluth) { fPreShoClusteringThreshold = cluth ; }
virtual void SetPreShoLocalMaxCut(Float_t cut) { fPreShoLocMaxCut = cut ; }
virtual void SetPreShoLogWeight(Float_t w) { fW0CPV = w ; }
- virtual void SetDigitsBranch(const char * title) { fDigitsBranchTitle = title ;}
- virtual void SetRecPointsBranch(const char *title){fRecPointsBranchTitle = title; }
- virtual void SetUnfolding(Bool_t toUnfold = kTRUE ) {fToUnfold = toUnfold ;}
+ virtual void SetUnfolding(Bool_t toUnfold = kTRUE ) {fToUnfold = toUnfold ;}
static Double_t ShowerShape(Double_t r) ; // Shape of EM shower used in unfolding;
//class member function (not object member function)
static void UnfoldingChiSquare(Int_t & nPar, Double_t * Grad, Double_t & fret, Double_t * x, Int_t iflag) ;
private:
+ const TString BranchName() const ;
void GetCalibrationParameters(void) ;
Bool_t FindFit(AliEMCALTowerRecPoint * emcRP, AliEMCALDigit ** MaxAt, Float_t * maxAtEnergy,
private:
Bool_t fDefaultInit; //! Says if the task was created by defaut ctor (only parameters are initialized)
- TString fHeaderFileName ; // name of the file which contains gAlice, Tree headers etc.
- TString fDigitsBranchTitle ; // name of the file, where digits branch is stored
- TString fRecPointsBranchTitle ; // name of the file, where RecPoints branchs are stored
Int_t fNTowers ; // number of Towers in EMCAL
Int_t fNumberOfTowerClusters ; // number of Tower clusters found
Int_t fNumberOfPreShoClusters ; // number of PreShower clusters found
+ //Calibration parameters... to be replaced by database
Float_t fADCchannelTower ; // width of one ADC channel for Tower (GeV)
Float_t fADCpedestalTower ; // pedestal of ADC for Tower (GeV)
Float_t fADCchannelPreSho ; // width of one ADC channel for Pre Shower (GeV)
Int_t fRecPointsInRun ; //! Total number of recpoints in one run
Float_t fTimeGate ; // Maximum time difference between the digits in ont EMC cluster
- ClassDef(AliEMCALClusterizerv1,1) // Clusterizer implementation version 1
+ ClassDef(AliEMCALClusterizerv1,2) // Clusterizer implementation version 1
};
//
//*-- Author: Sahal Yacoob (LBL)
// based on : AliEMCALDigitizer
-//_________________________________________________________________________________
+// Modif:
+// August 2002 Yves Schutz: clone PHOS as closely as possible and intoduction
+// of new IO (à la PHOS)
+///_________________________________________________________________________________
// --- ROOT system ---
#include "TFile.h"
#include "TObjString.h"
#include "TGeometry.h"
#include "TBenchmark.h"
+
// --- Standard library ---
#include <iomanip.h>
// --- AliRoot header files ---
-
#include "AliRun.h"
#include "AliHeader.h"
#include "AliStream.h"
#include "AliRunDigitizer.h"
#include "AliEMCALDigit.h"
-#include "AliEMCALHit.h"
-#include "AliEMCALTick.h"
-#include "AliEMCALv1.h"
+#include "AliEMCAL.h"
+#include "AliEMCALGetter.h"
#include "AliEMCALDigitizer.h"
#include "AliEMCALSDigitizer.h"
#include "AliEMCALGeometry.h"
-#include "AliEMCALGetter.h"
+#include "AliEMCALTick.h"
+
ClassImp(AliEMCALDigitizer)
AliEMCALDigitizer::AliEMCALDigitizer()
{
// ctor
-
InitParameters() ;
fDefaultInit = kTRUE ;
+ fManager = 0 ; // We work in the standalong mode
- fHitsFileName = "" ;
- fSDigitsFileName = "" ;
-
}
//____________________________________________________________________________
-AliEMCALDigitizer::AliEMCALDigitizer(const char *headerFile,const char *name)
+AliEMCALDigitizer::AliEMCALDigitizer(const char *headerFile, const char *name, const Bool_t toSplit)
{
- SetName(name) ;
+ // ctor
+
SetTitle(headerFile) ;
+ SetName(name) ;
fManager = 0 ; // We work in the standalong mode
fSplitFile= 0 ;
InitParameters() ;
+ fToSplit = toSplit ;
Init() ;
fDefaultInit = kFALSE ;
- fSDigitsFileName = headerFile ;
- AliEMCALGetter * gime = AliEMCALGetter::GetInstance() ;
- gime->Event(0, "S") ;
- fHitsFileName = gime->SDigitizer()->GetTitle() ;
}
//____________________________________________________________________________
AliEMCALDigitizer::AliEMCALDigitizer(AliRunDigitizer * ard):AliDigitizer(ard)
{
// ctor
- SetName("Default");
- SetTitle("aliroot") ;
+ SetTitle(ard->GetInputFileName(0,0)) ;
+ InitParameters() ;
fDefaultInit = kFALSE ;
-
- fSDigitsFileName = fManager->GetInputFileName(0, 0) ;
- AliEMCALGetter * gime = AliEMCALGetter::GetInstance(fSDigitsFileName, GetName()) ;
- gime->Event(0,"S") ;
- fHitsFileName = gime->SDigitizer()->GetTitle() ;
+ fSplitFile = 0 ;
+
+ if (ard->GetOutputFile()) {
+ SetName(ard->GetOutputFile().Data());
+ fToSplit = kTRUE ;
+ } else {
+ SetName("Default") ;
+ fToSplit = kFALSE ;
+ }
}
//____________________________________________________________________________
AliEMCALDigitizer::~AliEMCALDigitizer()
{
// dtor
- // fDefaultInit = kTRUE if Digitizer created by default ctor (to get just the parameters)
-
- if (!fDefaultInit) {
- AliEMCALGetter * gime = AliEMCALGetter::GetInstance() ;
-
- // remove the task from the folder list
- gime->RemoveTask("S",GetName()) ;
- gime->RemoveTask("D",GetName()) ;
-
- // remove the Digits from the folder list
- gime->RemoveObjects("D", GetName()) ;
-
- // remove the SDigits from the folder list
- gime->RemoveSDigits() ;
-
- // Delete gAlice
- gime->CloseFile() ;
-
- fSplitFile = 0 ;
- }
-}
-
-//____________________________________________________________________________
-void AliEMCALDigitizer::InitParameters()
-{
- fSDigitizer = 0 ;
- fNinputs = 1 ;
- fPinNoise = 0.00001 ;
- fTowerDigitThreshold = 0.001 ;
- fTimeResolution = 0.5e-9 ;
- fTimeSignalLength = 1.0e-9 ;
- fPreShowerDigitThreshold = fTowerDigitThreshold/25. ;
- fInitialized = kFALSE ;
- fADCchannelTower = 0.000220; // width of one ADC channel in GeV
- fADCpedestalTower = 0.005 ; // GeV
- fNADCTower = (Int_t) TMath::Power(2,16) ; // number of channels in Tower ADC
-
- fADCchannelPreSho = 0.0000300; // width of one ADC channel in Pre Shower
- fADCpedestalPreSho = 0.005 ; //
- fNADCPreSho = (Int_t) TMath::Power(2,12); // number of channels in Pre ShowerADC
-
- fTimeThreshold = 0.001*10000000 ; //Means 1 MeV in terms of SDigits amplitude
-
-}
-
-//____________________________________________________________________________
-Bool_t AliEMCALDigitizer::Init()
-{
- // Makes all memory allocations
- AliEMCALGetter * gime = AliEMCALGetter::GetInstance(GetTitle(), GetName(), "update") ;
- if ( gime == 0 ) {
- cerr << "ERROR: AliEMCALDigitizer::Init -> Could not obtain the Getter object !" << endl ;
- return kFALSE;
- }
-
- //const AliEMCALGeometry * geom = gime->EMCALGeometry() ;
- //fEmcCrystals = geom->GetNModules() * geom->GetNCristalsInModule() ;
-
- // Post Digits to the white board
- gime->PostDigits(GetName() ) ;
-
- // Post Digitizer to the white board
- gime->PostDigitizer(this) ;
-
- //Mark that we will use current header file
- if(!fManager){
- gime->PostSDigits(GetName(),GetTitle()) ;
- gime->PostSDigitizer(GetName(),GetTitle()) ;
- }
- return kTRUE ;
-
-}
-
-//____________________________________________________________________________
-void AliEMCALDigitizer::Reset() {
- //sets current event number to the first simulated event
-if( strcmp(GetName(), "") == 0 )
- Init() ;
-
- // Int_t inputs ;
- // for(inputs = 0; inputs < fNinputs ;inputs++)
- // fIevent->AddAt(-1, inputs ) ;
-
+ fSplitFile = 0 ;
}
//____________________________________________________________________________
-void AliEMCALDigitizer::Digitize(const Int_t event) {
+void AliEMCALDigitizer::Digitize(const Int_t event)
+{
// Makes the digitization of the collected summable digits
// for this it first creates the array of all EMCAL modules
digits->Clear() ;
- const AliEMCALGeometry *geom = gime->EMCALGeometry() ;
-
-
+ const AliEMCALGeometry *geom = gime->EMCALGeometry() ;
//Making digits with noise, first EMC
Int_t nEMC = 2*geom->GetNPhi()*geom->GetNZ();
+
Int_t absID ;
TString name = geom->GetName() ;
cerr << "ERROR: AliEMCALDigitizer::Digitize -> SDigitizer with name " << GetName() << " not found " << endl ;
abort() ;
}
+
// loop through the sdigits posted to the White Board and add them to the noise
TCollection * folderslist = gime->SDigitsFolder()->GetListOfFolders() ;
TIter next(folderslist) ;
if ( (sdigits = (TClonesArray*)folder->FindObject(GetName()) ) ) {
TString fileName(folder->GetName()) ;
fileName.ReplaceAll("_","/") ;
- cout << "INFO: AliEMCALDigitizer::Digitize -> Adding SDigits "
- << GetName() << " from " << fileName << endl ;
+ // cout << "INFO: AliEMCALDigitizer::Digitize -> Adding SDigits "
+ // << GetName() << " from " << fileName << endl ;
sdigArray->AddAt(sdigits, input) ;
input++ ;
}
TArrayI index(input) ;
index.Reset() ; //Set all indexes to zero
- AliEMCALDigit * digit = 0 ;
- AliEMCALDigit * curSDigit = 0 ;
+ AliEMCALDigit * digit ;
+ AliEMCALDigit * curSDigit ;
TClonesArray * ticks = new TClonesArray("AliEMCALTick",1000) ;
new((*digits)[absID-1]) AliEMCALDigit( -1, -1, absID,sDigitizer->Digitize(noise), TimeOfNoise() ) ;
//look if we have to add signal?
digit = (AliEMCALDigit *) digits->At(absID-1) ;
+
if(absID==nextSig){
//Add SDigits from all inputs
ticks->Clear() ;
new((*ticks)[contrib++]) AliEMCALTick(digit->GetTime()+fTimeSignalLength, -a, -b);
// loop over input
-
for(i = 0; i< input ; i++){ //loop over (possible) merge sources
if(((TClonesArray *)sdigArray->At(i))->GetEntriesFast() > index[i] )
curSDigit = (AliEMCALDigit*)((TClonesArray *)sdigArray->At(i))->At(index[i]) ;
}
}
-//calculate and set time
+ //calculate and set time
Float_t time = FrontEdgeTime(ticks) ;
digit->SetTime(time) ;
ticks->Delete() ;
delete ticks ;
-
-
+ delete sdigArray ; //We should not delete its contents
//remove digits below thresholds
-
for(absID = 0; absID < nEMC/2 ; absID++){
- if(sDigitizer->Calibrate(((AliEMCALDigit*)digits->At(absID))->GetAmp()) < fTowerDigitThreshold)
+ digit = dynamic_cast<AliEMCALDigit*>( digits->At(i) ) ;
+ if(sDigitizer->Calibrate( digit->GetAmp() ) < fTowerDigitThreshold)
digits->RemoveAt(absID) ;
else
digit->SetTime(gRandom->Gaus(digit->GetTime(),fTimeResolution) ) ;
}
- for(absID = nEMC/2; absID < nEMC ; absID++){
-
- if(sDigitizer->Calibrate(((AliEMCALDigit*)digits->At(absID))->GetAmp()) < fPreShowerDigitThreshold)
- digits->RemoveAt(absID) ;
- else
- digit->SetTime(gRandom->Gaus(digit->GetTime(),fTimeResolution) ) ;
- }
+
+ for(absID = nEMC/2; absID < nEMC ; absID++){
+ digit = dynamic_cast<AliEMCALDigit*>( digits->At(i) ) ;
+ if(sDigitizer->Calibrate( digit->GetAmp() ) < fPreShowerDigitThreshold)
+ digits->RemoveAt(absID) ;
+ else
+ digit->SetTime(gRandom->Gaus(digit->GetTime(),fTimeResolution) ) ;
+ }
digits->Compress() ;
- Int_t ndigits = digits->GetEntriesFast() ;
-
+ Int_t ndigits = digits->GetEntriesFast() ;
digits->Expand(ndigits) ;
-
//Set indexes in list of digits
- //Int_t i ;
- for (i = 0 ; i < ndigits ; i++) {
- AliEMCALDigit * digit = (AliEMCALDigit *) digits->At(i) ;
+ for (i = 0 ; i < ndigits ; i++) {
+ digit = dynamic_cast<AliEMCALDigit *>( digits->At(i) ) ;
digit->SetIndexInList(i) ;
Float_t energy = sDigitizer->Calibrate(digit->GetAmp()) ;
digit->SetAmp(DigitizeEnergy(energy,digit->GetId()) ) ;
}
//____________________________________________________________________________
-void AliEMCALDigitizer::Exec(Option_t *option) {
+void AliEMCALDigitizer::Exec(Option_t *option)
+{
// Managing method
-if(strcmp(GetName(), "") == 0 )
+
+ if(strcmp(GetName(), "") == 0 )
Init() ;
-
if (strstr(option,"print")) {
Print("");
return ;
if(fManager){
treeD = fManager->GetTreeD() ;
nevents = 1 ; // Will process only one event
- }
- else {
- gAlice->GetEvent(0) ;
- nevents = (Int_t) gAlice->TreeE()->GetEntries() ;
- treeD=gAlice->TreeD() ;
- }
-
-
- //Check, if this branch already exits
- if (treeD) {
- TObjArray * lob = (TObjArray*)treeD->GetListOfBranches() ;
- TIter next(lob) ;
- TBranch * branch = 0 ;
- Bool_t emcalfound = kFALSE, digitizerfound = kFALSE ;
- while ( (branch = (TBranch*)next()) && (!emcalfound || !digitizerfound) ) {
- if ( (strcmp(branch->GetName(), "EMCAL")==0) &&
- (strcmp(branch->GetTitle(), GetName())==0) )
- emcalfound = kTRUE ;
+ //Check, if this branch already exits
+ if (treeD) {
+ TObjArray * lob = (TObjArray*)treeD->GetListOfBranches() ;
+ TIter next(lob) ;
+ TBranch * branch = 0 ;
+ Bool_t emcalfound = kFALSE, digitizerfound = kFALSE ;
- else if ( (strcmp(branch->GetName(), "AliEMCALDigitizer")==0) &&
- (strcmp(branch->GetTitle(), GetName())==0) )
- digitizerfound = kTRUE ;
- }
-
- if ( emcalfound ) {
- cerr << "WARNING: AliEMCALDigitizer -> Digits branch with name " << GetName()
- << " already exits" << endl ;
- return ;
- }
- if ( digitizerfound ) {
- cerr << "WARNING: AliEMCALDigitizer -> Digitizer branch with name " << GetName()
- << " already exits" << endl ;
- return ;
+ while ( (branch = (TBranch*)next()) && (!emcalfound || !digitizerfound) ) {
+ if ( (strcmp(branch->GetName(), "EMCAL")==0) &&
+ (strcmp(branch->GetTitle(), GetName())==0) )
+ emcalfound = kTRUE ;
+
+ else if ( (strcmp(branch->GetName(), "AliEMCALDigitizer")==0) &&
+ (strcmp(branch->GetTitle(), GetName())==0) )
+ digitizerfound = kTRUE ;
+ }
+
+ if ( emcalfound ) {
+ cerr << "WARNING: AliEMCALDigitizer -> Digits branch with name " << GetName()
+ << " already exits" << endl ;
+ return ;
+ }
+ if ( digitizerfound ) {
+ cerr << "WARNING: AliEMCALDigitizer -> Digitizer branch with name " << GetName()
+ << " already exits" << endl ;
+ return ;
+ }
}
}
+ else { //EMCAL standalone
+ if(gime->BranchExists("Digits") )
+ return ;
+ nevents=gime->MaxEvent() ;
+ }
+
Int_t ievent ;
for(ievent = 0; ievent < nevents; ievent++){
if(fManager){
+
Int_t input ;
for(input = 0 ; input < fManager->GetNinputs(); input ++){
TTree * treeS = fManager->GetInputTreeS(input) ;
}
gime->ReadTreeS(treeS,input) ;
}
+
}
else
gime->Event(ievent,"S") ;
}
+//____________________________________________________________________________
+Float_t AliEMCALDigitizer::FrontEdgeTime(TClonesArray * ticks)
+{ //
+ ticks->Sort() ; //Sort in accordance with times of ticks
+ TIter it(ticks) ;
+ AliEMCALTick * ctick = (AliEMCALTick *) it.Next() ;
+ Float_t time = ctick->CrossingTime(fTimeThreshold) ;
+
+ AliEMCALTick * t ;
+ while((t=(AliEMCALTick*) it.Next())){
+ if(t->GetTime() < time) //This tick starts before crossing
+ *ctick+=*t ;
+ else
+ return time ;
+
+ time = ctick->CrossingTime(fTimeThreshold) ;
+ }
+ return time ;
+}
+
+//____________________________________________________________________________
+Bool_t AliEMCALDigitizer::Init()
+{
+ // Makes all memory allocations
+
+ if( strcmp(GetTitle(), "") == 0 )
+ SetTitle("galice.root") ;
+
+ AliEMCALGetter * gime = AliEMCALGetter::GetInstance(GetTitle(), GetName(), fToSplit) ;
+ if ( gime == 0 ) {
+ cerr << "ERROR: AliEMCALDigitizer::Init -> Could not obtain the Getter object !" << endl ;
+ return kFALSE;
+ }
+
+ //const AliEMCALGeometry * geom = gime->EMCALGeometry() ;
+
+ //fEmcCrystals = geom->GetNModules() * geom->GetNCristalsInModule() ;
+
+ // Post Digits to the white board
+ gime->PostDigits(GetName() ) ;
+
+ // Post Digitizer to the white board
+ gime->PostDigitizer(this) ;
+
+ fSplitFile = 0 ;
+ if(fToSplit){
+ // construct the name of the file as /path/EMCAL.SDigits.root
+ //First - extract full path if necessary
+ TString digitsFileName(GetTitle()) ;
+ Ssiz_t islash = digitsFileName.Last('/') ;
+ if(islash<digitsFileName.Length())
+ digitsFileName.Remove(islash+1,digitsFileName.Length()) ;
+ else
+ digitsFileName="" ;
+ // Next - append the file name
+ digitsFileName+="EMCAL.Digits." ;
+ if((strcmp(GetName(),"Default")!=0)&&(strcmp(GetName(),"")!=0)){
+ digitsFileName+=GetName() ;
+ digitsFileName+="." ;
+ }
+ digitsFileName+="root" ;
+ // Finally - check if the file already opened or open the file
+ fSplitFile = static_cast<TFile*>(gROOT->GetFile(digitsFileName.Data()));
+ if(!fSplitFile)
+ fSplitFile = TFile::Open(digitsFileName.Data(),"update") ;
+ }
+
+ //Mark that we will use current header file
+ if(!fManager){
+ gime->PostSDigits(GetName(),GetTitle()) ;
+ gime->PostSDigitizer(GetName(),GetTitle()) ;
+ }
+ return kTRUE ;
+}
+
+//____________________________________________________________________________
+void AliEMCALDigitizer::InitParameters()
+{
+ fPinNoise = 0.00001 ;
+ fTowerDigitThreshold = 0.001 ;
+ fTimeResolution = 0.5e-9 ;
+ fTimeSignalLength = 1.0e-9 ;
+ fPreShowerDigitThreshold = fTowerDigitThreshold/25. ;
+ fADCchannelTower = 0.000220; // width of one ADC channel in GeV
+ fADCpedestalTower = 0.005 ; // GeV
+ fNADCTower = (Int_t) TMath::Power(2,16) ; // number of channels in Tower ADC
+
+ fADCchannelPreSho = 0.0000300; // width of one ADC channel in Pre Shower
+ fADCpedestalPreSho = 0.005 ; //
+ fNADCPreSho = (Int_t) TMath::Power(2,12); // number of channels in Pre ShowerADC
+ fTimeThreshold = 0.001*10000000 ; //Means 1 MeV in terms of SDigits amplitude
+
+}
//__________________________________________________________________
-void AliEMCALDigitizer::MixWith(char* headerFile){
- // Alows produce digits by superimposing background and signal event.
+void AliEMCALDigitizer::MixWith(char* headerFile)
+{
+ // Allows to produce digits by superimposing background and signal event.
// It is assumed, that headers file with SIGNAL events is opened in
- // constructor, and now we set the BACKGROUND event, with which we
- // will mix. Thus we avoid writing (changing) huge and expencive
+ // the constructor.
+ // Sets the BACKGROUND event, with which the SIGNAL event is to be mixed
+ // Thus we avoid writing (changing) huge and expensive
// backgound files: all output will be writen into SIGNAL, i.e.
// opened in constructor file.
//
- // One can open as many files to mix with as one wants.
+ // One can open as many files to mix with as one needs.
+ // However only Sdigits with the same name (i.e. constructed with the same SDigitizer)
+ // can be mixed.
-if( strcmp(GetName(), "") == 0 )
+ if( strcmp(GetName(), "") == 0 )
Init() ;
- if(fManager){
+ if(fManager){
cout << "Can not use this method under AliRunDigitizer " << endl ;
return ;
- } // check if the specified SDigits do not already exist on the White Board:
+ }
+
+ // check if the specified SDigits do not already exist on the White Board:
// //Folders/RunMC/Event/Data/EMCAL/SDigits/headerFile/sdigitsname
- TString path = "Folders/RunMC/Event/Data/EMCAL/SDigits" ;
+ AliEMCALGetter * gime = AliEMCALGetter::GetInstance() ;
+ TString path = gime->SDigitsFolder()->GetName() ;
+
+ // before it was ???? "Folders/RunMC/Event/Data/EMCAL/SDigits" ;
path += headerFile ;
path += "/" ;
path += GetName() ;
return;
}
- AliEMCALGetter * gime = AliEMCALGetter::GetInstance() ;
gime->PostSDigits(GetName(),headerFile) ;
// check if the requested file is already open or exist and if SDigits Branch exist
}
}
-
+
//__________________________________________________________________
void AliEMCALDigitizer::Print(Option_t* option)const {
// while ( (folder = (TFolder*)next()) ) {
// if ( folder->FindObject(GetName()) )
- cout << "Adding SDigits " << GetName() << " from " << GetSDigitsFileName() << endl ;
+// cout << "Adding SDigits " << GetName() << " from " << GetSDigitsFileName() << endl ;
// }
cout << endl ;
cout << "Writing digits to " << GetTitle() << endl ;
}
}
+
+//__________________________________________________________________
+Float_t AliEMCALDigitizer::TimeOfNoise(void)
+{ // Calculates the time signal generated by noise
+ //to be rewritten, now returns just big number
+ return 1. ;
+
+}
+
//_________________________________________________________________________________________
void AliEMCALDigitizer::WriteDigits(Int_t event)
{
if(fManager)
treeD = fManager->GetTreeD() ;
else {
- if (!gAlice->TreeD() )
- gAlice->MakeTree("D",fSplitFile);
+ if ((gAlice->TreeD() == 0) || (fSplitFile)) // we should not create TreeD if it is already here
+ gAlice->MakeTree("D", fSplitFile); // We overwrite TreeD in split file in the case of second reconstruction
+ if(fSplitFile)
+ fSplitFile->cd() ;
treeD = gAlice->TreeD();
}
// -- Create Digitizer branch
Int_t splitlevel = 0 ;
- AliEMCALDigitizer * d = gime->Digitizer(GetName()) ;
+ const AliEMCALDigitizer * d = gime->Digitizer(GetName()) ;
TBranch * digitizerBranch = treeD->Branch("AliEMCALDigitizer", "AliEMCALDigitizer", &d,bufferSize,splitlevel);
digitizerBranch->SetTitle(GetName());
treeD->AutoSave() ;
}
-//____________________________________________________________________________
-Float_t AliEMCALDigitizer::FrontEdgeTime(TClonesArray * ticks)
-{ //
- ticks->Sort() ; //Sort in accordance with times of ticks
- TIter it(ticks) ;
- AliEMCALTick * ctick = (AliEMCALTick *) it.Next() ;
- Float_t time = ctick->CrossingTime(fTimeThreshold) ;
-
- AliEMCALTick * t ;
- while((t=(AliEMCALTick*) it.Next())){
- if(t->GetTime() < time) //This tick starts before crossing
- *ctick+=*t ;
- else
- return time ;
-
- time = ctick->CrossingTime(fTimeThreshold) ;
- }
- return time ;
-}
-//____________________________________________________________________________
-Float_t AliEMCALDigitizer::TimeOfNoise(void)
-{ // Calculates the time signal generated by noise
- //to be rewritten, now returns just big number
- return 1. ;
-
-}
-//____________________________________________________________________________
-void AliEMCALDigitizer::SetSDigitsBranch(const char* title)
-{
- // we set title (comment) of the SDigits branch in the first! header file
- if( strcmp(GetName(), "") == 0 )
- Init() ;
- AliEMCALGetter::GetInstance()->SDigits()->SetName(title) ;
-}
-
-//__________________________________________________________________
-void AliEMCALDigitizer::SetSplitFile(const TString splitFileName)
-{
- // Diverts the Digits in a file separate from the hits file
-
- // I guess it is not going to work if we do merging
- if (fManager) {
- cerr << "ERROR: AliEMCALDigitizer::SetSplitFile -> Not yet available in case of merging activated " << endl ;
- return ;
- }
-
- SetTitle(splitFileName) ;
-
- TDirectory * cwd = gDirectory ;
- if ( !(gAlice->GetTreeDFileName() == splitFileName) ) {
- if (gAlice->GetTreeDFile() )
- gAlice->GetTreeDFile()->Close() ;
- }
-
- fSplitFile = gAlice->InitTreeFile("D",splitFileName.Data());
- fSplitFile->cd() ;
- gAlice->Write(0, TObject::kOverwrite);
-
- TTree *treeE = gAlice->TreeE();
- if (!treeE) {
- cerr << "ERROR: AliEMCALDigitizer::SetSplitFile -> No TreeE found "<<endl;
- abort() ;
- }
-
- // copy TreeE
- AliHeader *header = new AliHeader();
- treeE->SetBranchAddress("Header", &header);
- treeE->SetBranchStatus("*",1);
- TTree *treeENew = treeE->CloneTree();
- treeENew->Write(0, TObject::kOverwrite);
-
- // copy AliceGeom
- TGeometry *AliceGeom = static_cast<TGeometry*>(cwd->Get("AliceGeom"));
- if (!AliceGeom) {
- cerr << "ERROR: AliEMCALDigitizer::SetSplitFile -> AliceGeom was not found in the input file "<<endl;
- abort() ;
- }
- AliceGeom->Write(0, TObject::kOverwrite);
-
- gAlice->MakeTree("D",fSplitFile);
- cwd->cd() ;
- cout << "INFO: AliEMCALDigitizer::SetSPlitMode -> Digits will be stored in " << splitFileName.Data() << endl ;
-}
//_________________________________________________________________________
-#include <stdlib.h>
// --- ROOT system ---
-
#include "TObjString.h"
class TArrayI ;
+class TClonesArray ;
+
// --- Standard library ---
+#include <stdlib.h>
// --- AliRoot header files ---
-class AliEMCALSDigitizer ;
-#include "AliRunDigitizer.h"
#include "AliDigitizer.h"
-
+class AliEMCALSDigitizer ;
+class AliRunDigitizer ;
class AliEMCALDigitizer: public AliDigitizer {
public:
AliEMCALDigitizer() ; // ctor
- AliEMCALDigitizer(const char *headerFile,const char * sDigitsBranchTitle = "Default") ;
+ AliEMCALDigitizer(const char *headerFile, const char * sDigitsBranchTitle = "Default", const Bool_t toSplit = kFALSE) ;
AliEMCALDigitizer(AliRunDigitizer * ard) ;
AliEMCALDigitizer(const AliEMCALDigitizer & dtizer)
{( (AliEMCALDigitizer &)dtizer ).Copy(*this) ;}
virtual ~AliEMCALDigitizer() ;
- void Digitize(const Int_t); // Make Digits from SDigits stored in fSDigits
- void Exec(Option_t *option); // Supervising method
+ void Digitize(const Int_t event); // Make Digits from SDigits stored in fSDigits
+ void Exec(Option_t *option); // Supervising method
- const TString GetHitsFileName() const { return fHitsFileName ; }
- const TString GetSDigitsFileName() const { return fSDigitsFileName ; }
const Float_t GetTowerThreshold() const { return fTowerDigitThreshold;}
const Float_t GetPedestal() const { return fPedestal; }
const Float_t GetPinNoise() const { return fPinNoise;}
const Float_t GetPreShochannel() const { return fADCchannelPreSho ; }
const Float_t GetPreShopedestal() const { return fADCpedestalPreSho ; }
- void MixWith(char* HeaderFile) ; // Add another one file to mix
- virtual void Print(Option_t* option)const ;
- void Reset() ; //restarts starts event processing from 0 event(s)
- const Int_t GetDigitsInRun() const { return fDigitsInRun; } ;
void SetTowerThreshold(Float_t EMCThreshold) {fTowerDigitThreshold = EMCThreshold;}
void SetPinNoise(Float_t PinNoise ) {fPinNoise = PinNoise;}
- void SetSDigitsBranch(const char* file) ;
- void SetSplitFile(const TString splitFileName = "EMCAL.Digits.root") ;
+ //General
+ const Int_t GetDigitsInRun() const { return fDigitsInRun; } ;
+ void MixWith(char* HeaderFile) ; // Add another one file to mix
+ void Print(Option_t* option)const ;
-
AliEMCALDigitizer & operator = (const AliEMCALDigitizer & rvalue) {
// assignement operator requested by coding convention but not needed
abort() ;
return *this ;
}
-
private:
Bool_t Init();
void InitParameters() ;
- Bool_t ReadSDigits() ; // Read sdigits for particular events
- void WriteDigits(Int_t evt) ; // Writes Digits for particular event
void PrintDigits(Option_t * option) ;
+ void WriteDigits(Int_t evt) ; // Writes Digits for particular event
Float_t TimeOfNoise(void) ; // Calculate time signal generated by noise
+ //Calculate the time of crossing of the threshold by front edge
Float_t FrontEdgeTime(TClonesArray * ticks) ;
Int_t DigitizeEnergy(Float_t energy, Int_t absId) ;
private:
- TString fHitsFileName ; // file name that contains the original hits
- TString fSDigitsFileName ; // file name that contains the original SDigits
- Bool_t fDefaultInit; //! Says if the task was created by defaut ctor (only parameters are initialized)
- // !!! the following is not necessary, it is in the folder !!!!!!!
- AliEMCALSDigitizer * fSDigitizer ; // ! SDigitizer to extract some sdigitizing parameters
- Int_t fNinputs ; // Number of input files
- Bool_t fInitialized ; //
+ Bool_t fDefaultInit; //! Says if the task was created by defaut ctor (only parameters are initialized)
+ Int_t fDigitsInRun ; //! Total number of digits in one run
- Int_t fDigitsInRun ; //! Total number of digits in one run
Float_t fPedestal ; // Calibration parameters
Float_t fSlope ; // read from SDigitizer
- Float_t fPinNoise ; // Electronics noise in EMC
- Float_t fTowerDigitThreshold ; // Threshold for storing digits in EMC
+ Float_t fPinNoise ; // Electronics noise in EMC
+ Float_t fTowerDigitThreshold ; // Threshold for storing digits in EMC
Float_t fPreShowerDigitThreshold ; // Threshold for Preshower digits
- Float_t fTimeResolution ; // Time resolution of FEE electronics
- Float_t fTimeThreshold ; // Threshold to start timing for given crystall
- Float_t fTimeSignalLength ; // Length of the timing signal
+ Float_t fTimeResolution ; // Time resolution of FEE electronics
+ Float_t fTimeThreshold ; // Threshold to start timing for given crystall
+ Float_t fTimeSignalLength ; // Length of the timing signal
- Float_t fADCchannelTower ; // width of one ADC channel in Tower (GeV)
- Float_t fADCpedestalTower ; //
- Int_t fNADCTower ; // number of channels in Tower ADC
+ Float_t fADCchannelTower ; // width of one ADC channel in Tower (GeV)
+ Float_t fADCpedestalTower ; //
+ Int_t fNADCTower ; // number of channels in Tower ADC
- Float_t fADCchannelPreSho ; // width of one ADC channel in Pre Shower (GeV)
- Float_t fADCpedestalPreSho ; //
+ Float_t fADCchannelPreSho ; // width of one ADC channel in Pre Shower (GeV)
+ Float_t fADCpedestalPreSho ; //
Int_t fNADCPreSho ; // number of channels in Pre Shower ADC
+
+ Bool_t fToSplit ; //! Do we work in the split mode
TFile * fSplitFile ; //! file in which Digits will eventually be stored
ClassDef(AliEMCALDigitizer,1) // description
// Initializes the EMCAL parameters
fgInit = kFALSE; // Assume failer untill proven otherwise.
- if(!( (strcmp( fName, "EMCALArch1a" ) == 0) |
- (strcmp( fName, "EMCALArch1b" ) == 0) |
- (strcmp( fName, "EMCALArch2a" ) == 0) |
- (strcmp( fName, "EMCALArch2b" ) == 0) )){
- cout <<"Instance " << fName << " undefined" << endl;
+
+ TString name(GetName()) ;
+
+ if( name != "EMCALArch1a" &&
+ name != "EMCALArch1b" &&
+ name != "EMCALArch2a" &&
+ name != "EMCALArch2b" ){
+ cerr << "ERROR: " << ClassName() << "::Init -> " << name.Data()
+ << " is not a known geometry (choose among EMCALArch1a, EMCALArch1b, EMCALArch2a and EMCALArch2b)"
+ << endl ;
+ abort() ;
} // end if
//
- if (((strcmp( fName, "EMCALArch1a" )) == 0) |
- ((strcmp( fName, "EMCALArch1b" )) == 0)){
+ if ( name == "EMCALArch1a" ||
+ name == "EMCALArch1b" ) {
fNZ = 96;
fNPhi = 144;
} // end if
- if (((strcmp( fName, "EMCALArch2a" )) == 0) |
- ((strcmp( fName, "EMCALArch2b" )) == 0)){
+ if ( name == "EMCALArch2a" ||
+ name, "EMCALArch2b" ) {
fNZ = 112;
fNPhi = 168;
} // end if
- if (((strcmp( fName, "EMCALArch1a" )) == 0) |
- ((strcmp( fName, "EMCALArch2a" )) == 0)){
+ if ( name == "EMCALArch1a" ||
+ name == "EMCALArch2a" ) {
fNLayers = 21;
} // end if
- if (((strcmp( fName, "EMCALArch1b" )) == 0) |
- ((strcmp( fName, "EMCALArch2b" )) == 0)){
+ if ( name == "EMCALArch1b" ||
+ name == "EMCALArch2b" ) {
fNLayers = 25;
} // end if
}
//______________________________________________________________________
AliEMCALGeometry * AliEMCALGeometry::GetInstance(){
- // Returns the pointer of the unique instance
-
- return (AliEMCALGeometry *) fgGeom;
+ // Returns the pointer of the unique instance
+
+ return static_cast<AliEMCALGeometry *>( fgGeom ) ;
}
//______________________________________________________________________
AliEMCALGeometry* AliEMCALGeometry::GetInstance(const Text_t* name,
Everywhere reading the treese TTree->GetEvent(i)
is replaced by reading the branches TBranch->GetEntry(0)
*/
+/* $Log:
+ 08.2002 Dmitri Peressounko:
+
+*/
//_________________________________________________________________________
// A singleton. This class should be used in the analysis stage to get
//*-- Completely redesigned by Dmitri Peressounko March 2001
//
//*-- YS June 2001 : renamed the original AliEMCALIndexToObject and make
-//*-- systematic usage of TFolders without changing the interface
+//*-- systematic usage of TFolders without changing the interface
+//*-- YS August 2002 : clone PHOS as closely as possible and intoduction
+// of new IO (à la PHOS)
//////////////////////////////////////////////////////////////////////////////
-
// --- ROOT system ---
-
#include "TFile.h"
#include "TTree.h"
#include "TROOT.h"
#include "TObjString.h"
#include "TFolder.h"
+#include "TParticle.h"
// --- Standard library ---
#include <iostream.h>
// --- AliRoot header files ---
-
#include "AliRun.h"
#include "AliConfig.h"
#include "AliEMCALGetter.h"
-#include "AliEMCALHit.h"
-#include "AliEMCALv1.h"
+#include "AliEMCAL.h"
#include "AliEMCALDigitizer.h"
#include "AliEMCALSDigitizer.h"
-#include "AliEMCALClusterizer.h"
#include "AliEMCALClusterizerv1.h"
-//#include "AliEMCALTrackSegmentMaker.h"
//#include "AliEMCALTrackSegmentMakerv1.h"
//#include "AliEMCALTrackSegment.h"
-//#include "AliEMCALPID.h"
//#include "AliEMCALPIDv1.h"
#include "AliEMCALGeometry.h"
TFile * AliEMCALGetter::fFile = 0 ;
//____________________________________________________________________________
-AliEMCALGetter::AliEMCALGetter(const char* headerFile, const char* branchTitle, const Option_t * rw)
+AliEMCALGetter::AliEMCALGetter(const char* headerFile, const char* branchTitle, const Bool_t toSplit)
{
- //Initialize all lists
-
- fDebug = 0 ;
+ // This is the ctor called by GetInstance and the only one that can be used
- fAlice = 0 ;
-
- fHeaderFile = headerFile ;
- fBranchTitle = branchTitle ;
- fSDigitsTitle = branchTitle ;
- fDigitsTitle = branchTitle ;
- fRecPointsTitle = branchTitle ;
- //fRecParticlesTitle = branchTitle ;
- //fTrackSegmentsTitle = branchTitle ;
+ if ( fHeaderFile.Contains("_") ) {
+ cerr << "AliEMCALGetter::AliEMCALGetter -> Invalid file name (_ not allowed) " << fHeaderFile.Data() << endl ;
+ abort() ;
+ }
+
+ //Initialize all data
+
+ fFailed = kFALSE ;
+ fDebug = 0 ;
+ fAlice = 0 ;
+
+ fToSplit = toSplit ;
+ fHeaderFile = headerFile ;
fPrimaries = new TObjArray(1) ;
//fQAFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/Run/Conditions/QA"));
fTasksFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/Tasks")) ;
- fFailed = kFALSE ;
-
+ //Set titles to branches and create PHOS specific folders
+ SetTitle(branchTitle) ;
+
if ( fHeaderFile != "aliroot" ) { // to call the getter without a file
-
//open headers file
fFile = static_cast<TFile*>(gROOT->GetFile(fHeaderFile.Data() ) ) ;
+
if(!fFile){ //if file was not opened yet, read gAlice
- if ( fHeaderFile.Contains("_") ) {
- cerr << "AliPHOSGetter::AliPHOSGetter -> Invalid file name (_ not allowed) " << fHeaderFile.Data() << endl ;
- abort() ;
- }
- fFile = TFile::Open(fHeaderFile.Data(),rw) ;
-
+ fFile = TFile::Open(fHeaderFile.Data(), "update") ;
if (!fFile->IsOpen()) {
cerr << "ERROR : AliEMCALGetter::AliEMCALGetter -> Cannot open " << fHeaderFile.Data() << endl ;
fFailed = kTRUE ;
}
}
-
if (!gAlice) {
cerr << "ERROR : AliEMCALGetter::AliEMCALGetter -> Cannot find gAlice in " << fHeaderFile.Data() << endl ;
fFailed = kTRUE ;
fDebug=0;
}
+
//____________________________________________________________________________
AliEMCALGetter::~AliEMCALGetter()
{
while ( (folder = static_cast<TFolder*>(next())) )
emcalF->Remove(folder) ;
- delete fFile ;
- fFile = 0 ;
-
+ if (fFile) {
+ fFile->Close() ;
+ delete fFile ;
+ fFile = 0 ;
+ }
fgObjGetter = 0 ;
}
-//____________________________________________________________________________
-void AliEMCALGetter::CreateWhiteBoard() const
-{
-
-}
-
//____________________________________________________________________________
void AliEMCALGetter::CloseFile()
{
- delete gAlice ;
+ delete gAlice ;
gAlice = 0 ;
delete fAlice ;
fAlice = 0 ;
return 0 ;
}
}
+
//____________________________________________________________________________
AliEMCALGetter * AliEMCALGetter::GetInstance()
{
// Returns the pointer of the unique instance already defined
if ( fgObjGetter ) {
- fFile->cd() ;
return fgObjGetter ;
}
else {
//____________________________________________________________________________
AliEMCALGetter * AliEMCALGetter::GetInstance(const char* headerFile,
- const char* branchTitle, const Option_t * rw)
+ const char* branchTitle,
+ const Bool_t toSplit)
{
// Creates and returns the pointer of the unique instance
// Must be called only when the environment has changed
- if ( fgObjGetter && fFile->IsOpen()) // an instance exists and the file is still open
- if((fgObjGetter->fBranchTitle.CompareTo(branchTitle) == 0) &&
- (fgObjGetter->fHeaderFile.CompareTo(headerFile)==0)) {
- fFile->cd() ;
+ if(!fgObjGetter){
+ fgObjGetter = new AliEMCALGetter(headerFile,branchTitle,toSplit) ;
+ if(fgObjGetter->fFailed)
+ return 0;
+ else
+ return fgObjGetter ;
+ }
+
+ //First checks, if header file already opened
+ if(!fgObjGetter->fFile){
+ fgObjGetter = new AliEMCALGetter(headerFile,branchTitle,toSplit) ;
+ if(fgObjGetter->fFailed)
+ return 0;
+ else
+ return fgObjGetter ;
+ }
+
+ if(fgObjGetter->fHeaderFile.CompareTo(headerFile)==0){ //Opened the same header file
+ if((fgObjGetter->fBranchTitle.CompareTo(branchTitle) == 0)&& //Open the same branch title
+ (toSplit==fgObjGetter->fToSplit)){ //Nothing should be cleaned
+ return fgObjGetter ;
+ }
+ else{ //Clean all data and AliEMCAL...zers
+ if(fgObjGetter->fToSplit)
+ fgObjGetter->CloseSplitFiles() ;
+ fgObjGetter->CleanWhiteBoard() ;
+ fgObjGetter->fToSplit = toSplit ;
+ fgObjGetter->SetTitle(branchTitle) ;
return fgObjGetter ;
}
- else // another file than the existing one is required, scratch the getter
- fgObjGetter->~AliEMCALGetter() ; // delete it already exists another version
+ }
+ else{ //Close already opened files, clean memory and open new header file
+ if(gAlice)
+ delete gAlice ;
+ gAlice= 0;
+ if(fgObjGetter->fFile){
+ fgObjGetter->fFile->Close() ;
+ fgObjGetter->fFile=0;
+ }
+ if(fgObjGetter->fToSplit)
+ fgObjGetter->CloseSplitFiles() ;
+ fgObjGetter->CleanWhiteBoard() ;
+ fgObjGetter = new AliEMCALGetter(headerFile,branchTitle,toSplit) ;
+ return fgObjGetter ;
+ }
+ return fgObjGetter ;
+
+}
+
+//____________________________________________________________________________
+const Bool_t AliEMCALGetter::BranchExists(const TString recName) const
+{
+ //Looks in the tree Tree"name" if branch with current name olready exists
+
+ TString filename("") ;
+ TString name, dataname, zername;
+ if(recName == "SDigits"){
+ filename=fSDigitsFileName ;
+ name = "TreeS0" ;
+ dataname = "PHOS" ;
+ zername = "AliPHOSSDigitizer" ;
+ }
+ else
+ if(recName == "Digits"){
+ filename=fDigitsFileName ;
+ name = "TreeD0" ;
+ dataname = "PHOS" ;
+ zername = "AliPHOSDigitizer" ;
+ }
+ else
+ if(recName =="RecPoints"){
+ filename=fRecPointsFileName ;
+ name = "TreeR0" ;
+ dataname = "PHOSEmcRP" ;
+ zername = "AliPHOSClusterizer" ;
+ }
+ else
+ if(recName == "TrackSegments"){
+ filename=fTrackSegmentsFileName ;
+ name = "TreeR0" ;
+ dataname = "PHOSTS" ;
+ zername = "AliPHOSTrackSegmentMaker" ;
+ }
+ else
+ if(recName == "RecParticles"){
+ filename= fRecParticlesFileName ;
+ name = "TreeR0" ;
+ dataname = "PHOSRP" ;
+ zername = "AliPHOSPID" ;
+ }
+ else
+ return kFALSE ;
+
+ TFile * file ;
+ TTree * tree ;
+ if(fToSplit){
+ file = static_cast<TFile*>(gROOT->GetFile(filename.Data() ) ) ;
+ if(!file)
+ file = TFile::Open(fSDigitsFileName.Data(),"update");
+ }
+ else
+ file = fFile ;
+
+ tree = (TTree *)file->Get(name.Data()) ;
+
+ if(!tree )
+ return kFALSE ;
+
+ TObjArray * lob = static_cast<TObjArray*>(tree->GetListOfBranches()) ;
+ TIter next(lob) ;
+ TBranch * branch = 0 ;
+ TString titleName(fBranchTitle);
+ titleName+=":";
+ while ((branch = (static_cast<TBranch*>(next())))) {
+ TString branchName(branch->GetName() ) ;
+ TString branchTitle(branch->GetTitle() ) ;
+ if ( branchName.BeginsWith(dataname) && branchTitle.BeginsWith(fBranchTitle) ){
+ cerr << "WARNING: AliEMCALGetter::BranchExists -> branch " << dataname.Data() << " with title " << fBranchTitle << " already exits in "
+ << name.Data() << endl;
+ return kTRUE ;
+ }
+ if ( branchName.BeginsWith(zername) && branchTitle.BeginsWith(titleName) ){
+ cerr << "WARNING: AliEMCALGetter::BranchExists -> branch AliEMCAL... with title " << branch->GetTitle() << " already exits in "
+ << name.Data() << endl;
+ return kTRUE ;
+ }
+ }
+ tree->Delete();
+
+ return kFALSE ;
+
+}
- fgObjGetter = new AliEMCALGetter(headerFile,branchTitle, rw) ;
+//____________________________________________________________________________
+void AliEMCALGetter::ListBranches(Int_t event) const
+{
+
+ TBranch * branch = 0 ;
+ if (gAlice->GetEvent(event) == -1)
+ return ;
- if (fgObjGetter->HasFailed() )
- fgObjGetter = 0 ;
+ TTree * t = gAlice->TreeH() ;
+ if(t){
+ cout << "INFO: AliEMCALGetter::ListBranches -> ****** Hits : " << endl ;
+ TObjArray * lob = t->GetListOfBranches() ;
+ TIter next(lob) ;
+ while ( (branch = static_cast<TBranch*>(next())) )
+ cout << " " << branch->GetName() << endl ;
+ } else
+ cerr << "WARNING::AliEMCALGetter::ListBranches -> TreeH not found for event " << event << endl ;
+
+
+ t = gAlice->TreeS() ;
+ if(t){
+ cout << "INFO: AliEMCALGetter::ListBranches -> ****** SDigits : " << endl ;
+ TObjArray * lob = t->GetListOfBranches() ;
+ TIter next(lob) ;
+ while ( (branch = static_cast<TBranch*>(next())) )
+ cout << " " << branch->GetName() << " " << branch->GetTitle() << endl ;
+ } else
+ cerr << "WARNING::AliEMCALGetter::ListBranches -> TreeS not found for event " << event << endl ;
- fFile->cd() ;
- return fgObjGetter ;
+ t = gAlice->TreeD() ;
+ if(t){
+ cout << "INFO: AliEMCALGetter::ListBranches -> ****** Digits : " << endl ;
+ TObjArray * lob = t->GetListOfBranches() ;
+ TIter next(lob) ;
+ while ( (branch = static_cast<TBranch*>(next())) )
+ cout << " " << branch->GetName() << " " << branch->GetTitle() << endl ;
+ } else
+ cerr << "WARNING::AliEMCALGetter::ListBranches -> TreeD not found for event " << event << endl ;
+
+
+ t = gAlice->TreeR() ;
+ if(t){
+ cout << "INFO: AliEMCALGetter::ListBranches -> ****** Recon : " << endl ;
+ TObjArray * lob = t->GetListOfBranches() ;
+ TIter next(lob) ;
+ while ( (branch = static_cast<TBranch*>(next())) )
+ cout << " " << branch->GetName() << " " << branch->GetTitle() << endl ;
+ } else
+ cerr << "WARNING::AliEMCALGetter::ListBranches -> TreeR not found for event " << event << endl ;
+
+}
+
+//____________________________________________________________________________
+void AliEMCALGetter::NewBranch(TString name, Int_t event)
+{
+ fBranchTitle = fSDigitsTitle = fDigitsTitle = fRecPointsTitle = fTrackSegmentsTitle = fRecParticlesTitle = name ;
+ Event(event) ;
+}
+
+//____________________________________________________________________________
+Bool_t AliEMCALGetter::NewFile(TString name)
+{
+ fHeaderFile = name ;
+ fFile->Close() ;
+ fFailed = kFALSE;
+
+ fFile = static_cast<TFile*>(gROOT->GetFile(fHeaderFile.Data() ) ) ;
+ if(!fFile) { //if file was not opened yet, read gAlice
+ fFile = TFile::Open(fHeaderFile.Data(),"update") ;
+ if (!fFile->IsOpen()) {
+ cerr << "ERROR : AliEMCALGetter::NewFile -> Cannot open " << fHeaderFile.Data() << endl ;
+ fFailed = kTRUE ;
+ return fFailed ;
+ }
+ gAlice = static_cast<AliRun *>(fFile->Get("gAlice")) ;
+ }
+ if (!gAlice) {
+ cerr << "ERROR : AliEMCALGetter::AliEMCALGetter -> Cannot find gAlice in " << fHeaderFile.Data() << endl ;
+ fFailed = kTRUE ;
+ return fFailed ;
+ }
+ return fFailed ;
}
//____________________________________________________________________________
-const AliEMCALv1 * AliEMCALGetter::EMCAL()
+const AliEMCAL * AliEMCALGetter::EMCAL()
{
// returns the EMCAL object
- AliEMCALv1 * emcal = dynamic_cast<AliEMCALv1*>(fModuleFolder->FindObject("EMCAL")) ;
+ AliEMCAL * emcal = dynamic_cast<AliEMCAL*>(fModuleFolder->FindObject("EMCAL")) ;
if (!emcal)
if (fDebug)
cout << "WARNING: AliEMCALGetter::EMCAL -> EMCAL module not found in Folders" << endl ;
}
//____________________________________________________________________________
-Bool_t AliEMCALGetter::PostPrimaries(void) const
+const Bool_t AliEMCALGetter::PostPrimaries(void) const
{ //------- Primaries ----------------------
// the hierarchy is //Folders/RunMC/Event/Data/Primaries
}
//____________________________________________________________________________
-Bool_t AliEMCALGetter::PostHits(void) const
+const Bool_t AliEMCALGetter::PostHits(void) const
{ //------- Hits ----------------------
// the hierarchy is //Folders/RunMC/Event/Data/EMCAL/Hits
}
//____________________________________________________________________________
-Bool_t AliEMCALGetter::PostSDigits(const char * name, const char * headerFile) const
+const Bool_t AliEMCALGetter::PostSDigits(const char * name, const char * headerFile) const
{ //---------- SDigits -------------------------
}
emcalFolder = fSDigitsFolder->AddFolder("EMCAL", "SDigits from EMCAL") ;
}
+
TString subdir(headerFile) ;
subdir.ReplaceAll("/", "_") ;
TFolder * emcalSubFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject(subdir)) ;
if ( !emcalSubFolder )
emcalSubFolder = emcalFolder->AddFolder(subdir, "");
+
TObject * sd = emcalSubFolder->FindObject(name);
- if ( sd ) {
- if (fDebug)
- cerr <<"INFO: AliEMCALGetter::Post S -> Folder " << subdir
- << " already exists!" << endl ;
- }else{
+ if ( !sd ) {
TClonesArray * sdigits = new TClonesArray("AliEMCALDigit",1) ;
sdigits->SetName(name) ;
emcalSubFolder->Add(sdigits) ;
if ( !fSDigitsFolder ) {
cerr << "ERROR: AliEMCALGetter::Post SRef -> Folder //" << fSDigitsFolder << " not found!" << endl;
- return 0;
+ abort() ;
}
TFolder * emcalFolder = dynamic_cast<TFolder *>(fSDigitsFolder->FindObject("EMCAL")) ;
if ( !emcalFolder ) {
cerr << "ERROR: AliEMCALGetter::Post SRef -> Folder //" << fSDigitsFolder << "/EMCAL/ not found!" << endl;
- return 0;
+ abort() ;
}
TFolder * emcalSubFolder = 0 ;
if(!emcalSubFolder) {
cerr << "ERROR: AliEMCALGetter::Post SRef -> Folder //Folders/RunMC/Event/Data/EMCAL/" << file << "not found!" << endl;
- return 0;
+ abort() ;
}
TObject * dis = emcalSubFolder->FindObject(name) ;
- if(!dis)
- return 0 ;
+ if(!dis) {
+ cerr << "ERROR: AliEMCALGetter::DigitesSRef -> object " << name << " not found! " << endl ;
+ abort() ;
+ }
else
return emcalSubFolder->GetListOfFolders()->GetObjectRef(dis) ;
}
//____________________________________________________________________________
-Bool_t AliEMCALGetter::PostSDigitizer(AliEMCALSDigitizer * sdigitizer) const
+const Bool_t AliEMCALGetter::PostSDigitizer(AliEMCALSDigitizer * sdigitizer) const
{ //---------- SDigitizer -------------------------
// the hierarchy is //Folders/Tasks/SDigitizer/EMCAL/sdigitsname
}
//____________________________________________________________________________
-Bool_t AliEMCALGetter::PostSDigitizer(const char * name, const char * file) const
+const Bool_t AliEMCALGetter::PostSDigitizer(const char * name, const char * file) const
{ //---------- SDigitizer -------------------------
// the hierarchy is //Folders/Tasks/SDigitizer/EMCAL/sdigitsname
-
TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("SDigitizer")) ;
if ( !sd ) {
cerr << "ERROR: AliEMCALGetter::Post Ser -> Task //" << fTasksFolder << "/SDigitizer not found!" << endl;
}
//____________________________________________________________________________
-Bool_t AliEMCALGetter::PostDigits(const char * name) const
+const Bool_t AliEMCALGetter::PostDigits(const char * name) const
{ //---------- Digits -------------------------
// the hierarchy is //Folders/Run/Event/Data/EMCAL/SDigits/name
if ( !fDigitsFolder ) {
cerr << "ERROR: AliEMCALGetter::Post DRef -> Folder //" << fDigitsFolder << " not found!" << endl;
- return 0;
+ abort() ;
}
TFolder * emcalFolder = dynamic_cast<TFolder*>(fDigitsFolder->FindObject("EMCAL")) ;
if ( !emcalFolder ) {
cerr << "ERROR: AliEMCALGetter::DRef -> Folder //" << fDigitsFolder << "/EMCAL/ not found!" << endl;
- return 0;
+ abort() ;
}
TObject * d = emcalFolder->FindObject(name) ;
- if(!d)
- return 0 ;
+ if(!d) {
+ cerr << "ERROR: AliEMCALGetter::DigitsRef -> object " << name << " not found! " << endl ;
+ abort() ;
+ }
else
return emcalFolder->GetListOfFolders()->GetObjectRef(d) ;
}
//____________________________________________________________________________
-Bool_t AliEMCALGetter::PostDigitizer(AliEMCALDigitizer * digitizer) const
+const Bool_t AliEMCALGetter::PostDigitizer(AliEMCALDigitizer * digitizer) const
{ //---------- Digitizer -------------------------
TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("Digitizer")) ;
}
//____________________________________________________________________________
-Bool_t AliEMCALGetter::PostDigitizer(const char * name) const
+const Bool_t AliEMCALGetter::PostDigitizer(const char * name) const
{ //---------- Digitizer -------------------------
// the hierarchy is //Folders/Tasks/SDigitizer/EMCAL/sdigitsname
}
//____________________________________________________________________________
-Bool_t AliEMCALGetter::PostRecPoints(const char * name) const
+const Bool_t AliEMCALGetter::PostRecPoints(const char * name) const
{ // -------------- RecPoints -------------------------------------------
// the hierarchy is //Folders/Run/Event/RecData/EMCAL/TowerRecPoints/name
- // the hierarchy is //Folders/Run/Event/RecData/EMCAL/PreShoRecPoints/name
+ // the hierarchy is //Folders/Run/Event/RecData/EMCAL/PreShowerRecPoints/name
TFolder * emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL")) ;
}
// Pre Shower RecPoints
- TFolder * emcalRPoPreShoFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject("PreShoRecPoints")) ;
+ TFolder * emcalRPoPreShoFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject("PreShowerRecPoints")) ;
if ( !emcalRPoPreShoFolder ) {
if (fDebug) {
- cout << "WARNING: AliEMCALGetter::Post RPo -> Folder //" << fRecoFolder << "/EMCAL/PreShoRecPoints/ not found!" << endl;
- cout << "INFO: AliEMCALGetter::Post Rpo -> Adding Folder //" << fRecoFolder << "/EMCAL/PreShoRecPoints/" << endl;
+ cout << "WARNING: AliEMCALGetter::Post RPo -> Folder //" << fRecoFolder << "/EMCAL/PreShowerRecPoints/ not found!" << endl;
+ cout << "INFO: AliEMCALGetter::Post Rpo -> Adding Folder //" << fRecoFolder << "/EMCAL/PreShowerRecPoints/" << endl;
}
- emcalRPoPreShoFolder = emcalFolder->AddFolder("PreShoRecPoints", "PreSho RecPoints from EMCAL") ;
+ emcalRPoPreShoFolder = emcalFolder->AddFolder("PreShowerRecPoints", "PreSho RecPoints from EMCAL") ;
}
TObject * crp = emcalRPoPreShoFolder->FindObject( name ) ;
}
//____________________________________________________________________________
-TObject ** AliEMCALGetter::PreShoRecPointsRef(const char * name) const
+TObject ** AliEMCALGetter::PreShowerRecPointsRef(const char * name) const
{ // -------------- RecPoints -------------------------------------------
- // the hierarchy is //Folders/Run/Event/RecData/EMCAL/PreShoRecPoints/name
+ // the hierarchy is //Folders/Run/Event/RecData/EMCAL/PreShowerRecPoints/name
if ( !fRecoFolder ) {
- cerr << "ERROR: AliEMCALGetter::PreShoRecPointsRef -> Folder //" << fRecoFolder << " not found!" << endl;
+ cerr << "ERROR: AliEMCALGetter::PreShowerRecPointsRef -> Folder //" << fRecoFolder << " not found!" << endl;
abort() ;
}
- TFolder * preshoFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/PreShoRecPoints")) ;
+ TFolder * preshoFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/PreShowerRecPoints")) ;
if ( !preshoFolder ) {
- cerr << "ERROR: AliEMCALGetter::PreShoRecPointsRef -> Folder //" << fRecoFolder << "/EMCAL/PreShoRecPoints/" << endl;
+ cerr << "ERROR: AliEMCALGetter::PreShowerRecPointsRef -> Folder //" << fRecoFolder << "/EMCAL/PreShowerRecPoints/" << endl;
abort() ;
}
TObject * prp = preshoFolder->FindObject(name ) ;
if ( !prp ) {
- cerr << "ERROR: AliEMCALGetter::PreShoRecPointsRef -> Object " << name << " not found! " << endl ;
+ cerr << "ERROR: AliEMCALGetter::PreShowerRecPointsRef -> Object " << name << " not found! " << endl ;
abort() ;
}
return preshoFolder->GetListOfFolders()->GetObjectRef(prp) ;
}
//____________________________________________________________________________
-Bool_t AliEMCALGetter::PostClusterizer(AliEMCALClusterizerv1 * clu) const
+const Bool_t AliEMCALGetter::PostClusterizer(AliEMCALClusterizer * clu) const
{ // ------------------ AliEMCALClusterizer ------------------------
// the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname
}
//____________________________________________________________________________
-Bool_t AliEMCALGetter::PostClusterizer(const char * name) const
+const Bool_t AliEMCALGetter::PostClusterizer(const char * name) const
{ // ------------------ AliEMCALClusterizer ------------------------
// the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname
}
AliEMCALClusterizerv1 * emcalcl = new AliEMCALClusterizerv1() ;
+ clun+="-v1" ;
+ emcalcl->SetName(clun) ;
+ emcalcl->SetTitle(fHeaderFile) ;
emcal->Add(emcalcl) ;
return kTRUE;
}
//____________________________________________________________________________
-/*Bool_t AliEMCALGetter::PostTrackSegments(const char * name) const
+/*const Bool_t AliEMCALGetter::PostTrackSegments(const char * name) const
{ // ---------------TrackSegments -----------------------------------
// the hierarchy is //Folders/Run/Event/RecData/EMCAL/TrackSegments/name
}
//____________________________________________________________________________
-Bool_t AliEMCALGetter::PostTrackSegmentMaker(AliEMCALTrackSegmentMaker * tsmaker) const
+const Bool_t AliEMCALGetter::PostTrackSegmentMaker(AliEMCALTrackSegmentMaker * tsmaker) const
{ //------------Track Segment Maker ------------------------------
// the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname
}
//____________________________________________________________________________
-Bool_t AliEMCALGetter::PostTrackSegmentMaker(const char * name) const
+const Bool_t AliEMCALGetter::PostTrackSegmentMaker(const char * name) const
{ //------------Track Segment Maker ------------------------------
// the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname
-
-
+
TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
if ( !tasks ) {
- cerr << "ERROR: AliEMCALGetter::Post Ter -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
+ cerr << "ERROR: AliEMCALGetter::Post Ter -> Task //" << fTasksFolder->GetName() << "/Reconstructioner not found!" << endl;
return kFALSE ;
}
TTask * emcal = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
if ( !emcal ) {
if (fDebug) {
- cout <<"WARNING: AliEMCALGetter::Post Rer -> //" << fTasksFolder << "/Reconstructioner/EMCAL not found!" << endl;
- cout <<"INFO: AliEMCALGetter::Post Rer -> Adding //" << fTasksFolder->GetName() << "/Reconstructioner/EMCAL" << endl;
+ cout <<"WARNING: AliEMCALGetter::Post Ter -> //" << fTasksFolder->GetName() << "/Reconstructioner/EMCAL not found!" << endl;
+ cout <<"INFO: AliEMCALGetter::Post Ter -> Adding //" << fTasksFolder->GetName() << "/Reconstructioner/EMCAL" << endl;
}
emcal = new TTask("EMCAL", "") ;
tasks->Add(emcal) ;
}
- AliEMCALTrackSegmentMaker * emcalts =
- dynamic_cast<AliEMCALTrackSegmentMaker*>(emcal->GetListOfTasks()->FindObject(name)) ;
- if (!emcalts) {
- emcalts = new AliEMCALTrackSegmentMakerv1() ;
- TString tsn(name);
- tsn+=":tsm-v1" ;
- emcalts->SetName(tsn) ;
- emcal->Add(emcalts) ;
+ TList * l = emcal->GetListOfTasks() ;
+ TIter it(l) ;
+ TString tsn(name);
+ tsn+=":tsm" ;
+ TTask * task ;
+ while((task = static_cast<TTask *>(it.Next()) )){
+ TString taskname(task->GetName()) ;
+ if(taskname.BeginsWith(tsn))
+ return kTRUE ;
}
+
+ AliEMCALTrackSegmentMakerv1 * emcalts = new AliEMCALTrackSegmentMakerv1() ;
+ tsn+="-v1" ;
+ emcalts->SetName(tsn) ;
+ emcalts->SetTitle(fHeaderFile) ;
+ emcal->Add(emcalts) ;
return kTRUE;
}
+
+
+
//____________________________________________________________________________
TObject ** AliEMCALGetter::TSMakerRef(const char * name) const
}
//____________________________________________________________________________
-Bool_t AliEMCALGetter::PostRecParticles(const char * name) const
+const Bool_t AliEMCALGetter::PostRecParticles(const char * name) const
{ // -------------------- RecParticles ------------------------
// the hierarchy is //Folders/Run/Event/RecData/EMCAL/TrackSegments/name
//____________________________________________________________________________
TObject ** AliEMCALGetter::RecParticlesRef(const char * name) const
-{ // ---------------TrackSegments -----------------------------------
+{ // ---------------RecParticles -----------------------------------
// the hierarchy is //Folders/Run/Event/RecData/EMCAL/TrackSegments/name
}
//____________________________________________________________________________
-Bool_t AliEMCALGetter::PostPID(AliEMCALPID * pid) const
+const Bool_t AliEMCALGetter::PostPID(AliEMCALPID * pid) const
{ // ------------AliEMCAL PID -----------------------------
TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
}
//____________________________________________________________________________
-Bool_t AliEMCALGetter::PostPID(const char * name) const
+const Bool_t AliEMCALGetter::PostPID(const char * name) const
{
// the hierarchy is //Folders/Tasks/Reconstructioner/EMCAL/sdigitsname
AliEMCALPIDv1 * emcalpid = new AliEMCALPIDv1() ;
pidname+="-v1" ;
emcalpid->SetName(pidname) ;
+ emcalpid->SetTitle(fHeaderFile) ;
emcal->Add(emcalpid) ;
return kTRUE;
cerr << "ERROR: AliEMCALGetter::PIDRef -> task " << task->GetName() << " not found! " << endl ;
abort() ;
}
+
}
//____________________________________________________________________________
-Bool_t AliEMCALGetter::PostQA(void) const
+const Bool_t AliEMCALGetter::PostQA(void) const
{ // ------------------ QA ---------------------------------
// the hierarchy is //Folders/Run/Conditions/QA/EMCAL/alarmsName
return fQAFolder->GetListOfFolders()->GetObjectRef(emcalFolder) ;
}
*/
+
+//____________________________________________________________________________
+TTree * AliEMCALGetter::TreeK(TString filename)
+{
+
+ // returns TreeK from file filename
+ // usefull in case of split file
+
+ if ( filename.IsNull() )
+ filename = fHeaderFile ;
+
+ TFile * file = 0 ;
+ file = static_cast<TFile*>(gROOT->GetFile(filename.Data() ) ) ;
+ if (file && (filename != fHeaderFile) ) { // file already open
+ file->Close() ;
+ delete fAlice ;
+ }
+ file = TFile::Open(filename.Data(), "read") ;
+ fAlice = static_cast<AliRun *>(file->Get("gAlice")) ;
+ TString treeName("TreeK") ;
+ treeName += EventNumber() ;
+ TTree * tree = static_cast<TTree *>(file->Get(treeName.Data())) ;
+ if (!tree && fDebug)
+ cout << "WARNING: AliEMCALGetter::TreeK -> " << treeName.Data() << " not found in " << filename.Data() << endl ;
+
+ return tree ;
+}
+
+//____________________________________________________________________________
+TTree * AliEMCALGetter::TreeH(TString filename)
+{
+
+ // returns TreeH from file filename
+ // usefull in case of split file
+
+ if ( filename.IsNull() )
+ filename = fHeaderFile ;
+
+ TFile * file = 0 ;
+ file = static_cast<TFile*>(gROOT->GetFile(filename.Data() ) ) ;
+ if (!file) { // file not open yet
+ file = TFile::Open(filename.Data(), "read") ;
+ }
+ TString treeName("TreeH") ;
+ treeName += EventNumber() ;
+ TTree * tree = static_cast<TTree *>(file->Get(treeName.Data())) ;
+ if (!tree && fDebug)
+ cout << "WARNING: AliEMCALGetter::TreeH -> " << treeName.Data() << " not found in " << filename.Data() << endl ;
+
+ return tree ;
+}
+
+//____________________________________________________________________________
+TTree * AliEMCALGetter::TreeS(TString filename)
+{
+
+ // returns TreeS from file filename
+ // usefull in case of split file
+
+ if ( filename.IsNull() )
+ filename = fHeaderFile ;
+
+ TFile * file = 0 ;
+ file = static_cast<TFile*>(gROOT->GetFile(filename.Data() ) ) ;
+ if (!file) { // file not open yet
+ file = TFile::Open(filename.Data(), "read") ;
+ }
+ TString treeName("TreeS") ;
+ treeName += EventNumber() ;
+ TTree * tree = static_cast<TTree *>(file->Get(treeName.Data())) ;
+ if (!tree && fDebug)
+ cout << "WARNING: AliEMCALGetter::TreeS -> " << treeName.Data() << " not found in " << filename.Data() << endl ;
+
+ return tree ;
+}
+
+//____________________________________________________________________________
+TTree * AliEMCALGetter::TreeD(TString filename)
+{
+
+ // returns TreeD from file filename
+ // usefull in case of split file
+
+ if ( filename.IsNull() )
+ filename = fHeaderFile ;
+
+ TFile * file = 0 ;
+ file = static_cast<TFile*>(gROOT->GetFile(filename.Data() ) ) ;
+ if (!file) { // file not open yet
+ file = TFile::Open(filename.Data(), "read") ;
+ }
+ TString treeName("TreeD") ;
+ treeName += EventNumber() ;
+ TTree * tree = static_cast<TTree *>(file->Get(treeName.Data())) ;
+ if (!tree && fDebug)
+ cout << "WARNING: AliEMCALGetter::TreeD -> " << treeName.Data() << " not found in " << filename.Data() << endl ;
+
+ return tree ;
+}
+
//____________________________________________________________________________
const TParticle * AliEMCALGetter::Primary(Int_t index) const
{
p = fAlice->Particle(index) ;
else
p = gAlice->Particle(index) ;
- // if (p->GetFirstMother() != -1 ) {
- // cout << "AliEMCALGetter::Primary : Not a primary " << endl ;
- // }
return p ;
}
//____________________________________________________________________________
-void AliEMCALGetter::ReadTreeD()
+const TParticle * AliEMCALGetter::Secondary(TParticle* p, Int_t index) const
{
- // Read the digit tree gAlice->TreeD()
+ // Return first (index=1) or second (index=2) secondary particle of primary particle p
+
+ if(index <= 0)
+ return 0 ;
+ if(index > 2)
+ return 0 ;
+
+ if(p) {
+ Int_t daughterIndex = p->GetDaughter(index-1) ;
+ return gAlice->Particle(daughterIndex) ;
+ }
+ else
+ return 0 ;
+}
- TTree * treeD = gAlice->TreeD() ;
+//____________________________________________________________________________
+Int_t AliEMCALGetter::ReadTreeD(const Int_t event)
+{
+ // Read the digit tree gAlice->TreeD()
- if(!treeD) { // TreeD not found in header file
-
- if (fDebug)
- cout << "WARNING: AliEMCALGetter::ReadTreeD -> Cannot find TreeD in " << fHeaderFile << endl ;
-
- TString searchFileName("") ;
-
- if (Digitizer()) // Digitizer found in header file
- searchFileName = Digitizer()->GetTitle() ;
-
- else if (Clusterizer()) // Clusterizer found in header file
- searchFileName = Clusterizer()->GetDigitsFileName() ;
-
- if (treeD = TreeD(searchFileName)) { //found TreeD in the file which contains the hits
- if (fDebug)
- cout << "INFO: AliEMCALGetter::ReadTreeD -> TreeD found in " << searchFileName.Data() << endl ;
-
- } else {
- cerr << "ERROR: AliEMCALGetter::ReadTreeD -> TreeD not found " << endl ;
- return ;
- }
+ TTree * treeD ;
+ if(fToSplit){
+ TFile * file = static_cast<TFile*>(gROOT->GetFile(fDigitsFileName));
+ if(!file)
+ file = TFile::Open(fDigitsFileName) ;
+ // Get Digits Tree header from file
+ TString treeName("TreeD") ;
+ treeName += event ;
+ treeD = dynamic_cast<TTree*>(file->Get(treeName.Data()));
+ if(!treeD){ // TreeD not found in header file
+ if (fDebug)
+ cout << "WARNING: AliEMCALGetter::ReadTreeD -> Cannot find TreeD in " << fDigitsFileName.Data() << endl;
+ return 1;
+ }
}
- TObjArray * lob = static_cast<TObjArray*>(gAlice->TreeD()->GetListOfBranches()) ;
+ else
+ treeD = gAlice->TreeD() ;
+
+ TObjArray * lob = static_cast<TObjArray*>(treeD->GetListOfBranches()) ;
TIter next(lob) ;
TBranch * branch = 0 ;
TBranch * digitsbranch = 0 ;
if (fDebug)
cout << "WARNING: AliEMCALGetter::ReadTreeD -> Cannot find Digits and/or Digitizer with name "
<< fDigitsTitle << endl ;
- return ;
+ return 2;
}
//read digits
// read the Digitizer
+ RemoveTask("D", fDigitsTitle) ; // I do not understand why I need that
if(!Digitizer(fDigitsTitle))
PostDigitizer(fDigitsTitle) ;
-
digitizerbranch->SetAddress(DigitizerRef(fDigitsTitle)) ;
digitizerbranch->GetEntry(0) ;
-
+ lob ->Delete();
+ if(gAlice->TreeD()!=treeD)
+ treeD->Delete();
+ return 0 ;
}
//____________________________________________________________________________
-void AliEMCALGetter::ReadTreeH()
+Int_t AliEMCALGetter::ReadTreeH()
{
// Read the first entry of EMCAL branch in hit tree gAlice->TreeH()
if (fDebug)
cout << "WARNING: AliEMCALGetter::ReadTreeH -> Cannot find TreeH in " << fHeaderFile << endl ;
- TString searchFileName("") ;
+ TString searchFileName("EMCAL.HITS") ;
+ if((strcmp(fBranchTitle.Data(),"Default")!=0)&&(strcmp(fBranchTitle.Data(),"")!=0)){
+ searchFileName+="." ;
+ searchFileName += fBranchTitle ;
+ }
+ searchFileName+=".root" ;
- if (SDigitizer()) // SDigitizer found in header file
- searchFileName = SDigitizer()->GetTitle() ;
-
- else if (Digitizer()) // Digitizer found in header file
- searchFileName = Digitizer()->GetHitsFileName() ;
-
- else if (Clusterizer()) // Clusterizer found in header file
- searchFileName = Clusterizer()->GetHitsFileName() ;
-
- if (treeH = TreeH(searchFileName)) { //found TreeH in the file which contains the hits
+ if ( (treeH = TreeH(searchFileName)) ) { //found TreeH in the file which contains the hits
if (fDebug)
cout << "INFO: AliEMCALGetter::ReadTreeH -> TreeH found in " << searchFileName.Data() << endl ;
} else {
cerr << "ERROR: AliEMCALGetter::ReadTreeH -> TreeH not found " << endl ;
- return ;
+ return 1;
}
- }
+ }
TBranch * hitsbranch = static_cast<TBranch*>(gAlice->TreeH()->GetBranch("EMCAL")) ;
if ( !hitsbranch ) {
if (fDebug)
cout << "WARNING: AliEMCALGetter::ReadTreeH -> Cannot find branch EMCAL" << endl ;
- return ;
+ return 2;
}
if(!Hits())
PostHits() ;
if (hitsbranch->GetEntries() > 1 ) {
+ (dynamic_cast<TClonesArray*> (*HitsRef()))->Clear() ;
TClonesArray * tempo = new TClonesArray("AliEMCALHit",1000) ;
TClonesArray * hits = dynamic_cast<TClonesArray*>(*HitsRef()) ;
hitsbranch->SetAddress(&tempo) ;
delete tempo ;
}
else {
+ (dynamic_cast<TClonesArray*> (*HitsRef()))->Clear() ;
hitsbranch->SetAddress(HitsRef()) ;
hitsbranch->GetEntry(0) ;
}
+ return 0 ;
}
//____________________________________________________________________________
}
if(!Hits())
PostHits() ;
+
+ (dynamic_cast<TClonesArray*> (*HitsRef()))->Clear() ;
hitsbranch->SetAddress(HitsRef()) ;
hitsbranch->GetEntry(itrack) ;
-
-
-}
-
-
-//____________________________________________________________________________
-TTree * AliEMCALGetter::TreeK(TString filename)
-{
-
- // returns TreeK from file filename
- // usefull in case of split file
-
- if ( filename.IsNull() )
- filename = fHeaderFile ;
-
- TFile * file = 0 ;
- // file = static_cast<TFile*>(gROOT->GetFile(filename.Data() ) ) ;
- if (!file) { // file not open yet
- // file->Close() ;
- file = TFile::Open(filename.Data(), "read") ;
- delete fAlice ;
- fAlice = static_cast<AliRun *>(file->Get("gAlice")) ;
- }
-
- TString treeName("TreeK") ;
- treeName += EventNumber() ;
- TTree * tree = static_cast<TTree *>(file->Get(treeName.Data())) ;
- if (!tree && fDebug)
- cout << "WARNING: AliEMCALGetter::TreeK -> " << treeName.Data() << " not found in " << filename.Data() << endl ;
- return tree ;
}
//____________________________________________________________________________
-TTree * AliEMCALGetter::TreeH(TString filename)
+void AliEMCALGetter::ReadTreeQA()
{
-
- // returns TreeH from file filename
- // usefull in case of split file
-
- if ( filename.IsNull() )
- filename = fHeaderFile ;
-
- TFile * file = 0 ;
- file = static_cast<TFile*>(gROOT->GetFile(filename.Data() ) ) ;
- if (!file) { // file not open yet
- file = TFile::Open(filename.Data(), "read") ;
- }
- TString treeName("TreeH") ;
- treeName += EventNumber() ;
- TTree * tree = static_cast<TTree *>(file->Get(treeName.Data())) ;
- if (!tree && fDebug)
- cout << "WARNING: AliEMCALGetter::TreeH -> " << treeName.Data() << " not found in " << filename.Data() << endl ;
-
- return tree ;
-}
-
-//____________________________________________________________________________
-TTree * AliEMCALGetter::TreeS(TString filename)
-{
-
- // returns TreeS from file filename
- // usefull in case of split file
-
- if ( filename.IsNull() )
- filename = fHeaderFile ;
-
- TFile * file = 0 ;
- file = static_cast<TFile*>(gROOT->GetFile(filename.Data() ) ) ;
- if (!file) { // file not open yet
- file = TFile::Open(filename.Data(), "read") ;
- }
- TString treeName("TreeS") ;
- treeName += EventNumber() ;
- TTree * tree = static_cast<TTree *>(file->Get(treeName.Data())) ;
- if (!tree && fDebug)
- cout << "WARNING: AliEMCALGetter::TreeS -> " << treeName.Data() << " not found in " << filename.Data() << endl ;
-
- return tree ;
-}
-
-//____________________________________________________________________________
-TTree * AliEMCALGetter::TreeD(TString filename)
-{
-
- // returns TreeD from file filename
- // usefull in case of split file
-
- if ( filename.IsNull() )
- filename = fHeaderFile ;
-
- TFile * file = 0 ;
- file = static_cast<TFile*>(gROOT->GetFile(filename.Data() ) ) ;
- if (!file) { // file not open yet
- file = TFile::Open(filename.Data(), "read") ;
- }
- TString treeName("TreeD") ;
- treeName += EventNumber() ;
- TTree * tree = static_cast<TTree *>(file->Get(treeName.Data())) ;
- if (!tree && fDebug)
- cout << "WARNING: AliEMCALGetter::TreeD -> " << treeName.Data() << " not found in " << filename.Data() << endl ;
-
- return tree ;
-}
-
-//____________________________________________________________________________
-// void AliEMCALGetter::ReadTreeQA()
-//{
+ if (fDebug)
+ cout << "WARNING : " << ClassName() << "::ReadTreeQA -> not implemented" << endl ;
// Read the digit tree gAlice->TreeQA()
// so far only EMCAL knows about this Tree
// qabranch->SetAddress(&alarmsF) ;
// qabranch->GetEntry(0) ;
-//}
+}
//____________________________________________________________________________
-void AliEMCALGetter::ReadTreeR()
+Int_t AliEMCALGetter::ReadTreeR(const Int_t event)
{
- // Read the reconstrunction tree gAlice->TreeR()
-
- if(gAlice->TreeR()== 0){
- if (fDebug)
- cout << "WARNING: AliEMCALGetter::ReadTreeR: can not read TreeR " << endl ;
- return ;
+ // Read the reconstrunction tree gAlice->TreeR()
+ // A particularity has been introduced here :
+ // if gime->Event(ievent,"R") is called branches with the current title are read, the current title
+ // being for example give in AliPHOSPID(fileName, title)
+ // if gime(Event(ievent, "RA") is called the title of the branches is not checked anymore, "A" stands for any
+ // This is a feature needed by PID to be able to reconstruct several times particles (each time a ther title is given)
+ // from a given set of TrackSegments (with a given name)
+ // This is why any is NOT used to read the branch of RecParticles
+ // any migh have become obsolete : to be checked
+ // See AliEMCALPIDv1
+
+ TTree * treeR ;
+ if(fToSplit){
+ TFile * file = static_cast<TFile*>(gROOT->GetFile(fRecPointsFileName));
+ if(!file)
+ file = TFile::Open(fRecPointsFileName) ;
+ // Get Digits Tree header from file
+ TString treeName("TreeR") ;
+ treeName += event ;
+ treeR = dynamic_cast<TTree*>(file->Get(treeName.Data()));
+ if(!treeR){ // TreeR not found in header file
+ if (fDebug)
+ cout << "WARNING: AliEMCALGetter::ReadTreeD -> Cannot find TreeR in " << fRecPointsFileName.Data() << endl;
+ return 1;
+ }
}
+ else
+ treeR = gAlice->TreeR() ;
// RecPoints
- TObjArray * lob = static_cast<TObjArray*>(gAlice->TreeR()->GetListOfBranches()) ;
+ TObjArray * lob = static_cast<TObjArray*>(treeR->GetListOfBranches()) ;
TIter next(lob) ;
TBranch * branch = 0 ;
TBranch * towerbranch = 0 ;
- TBranch * preshobranch = 0 ;
+ TBranch * preshowerbranch = 0 ;
TBranch * clusterizerbranch = 0 ;
- Bool_t emcaltowerrpfound = kFALSE, emcalpreshorpfound = kFALSE, clusterizerfound = kFALSE ;
+ Bool_t emcalTowerRPfound = kFALSE, emcalPreShoRPfound = kFALSE, clusterizerfound = kFALSE ;
+
- while ( (branch = static_cast<TBranch*>(next())) && (!emcaltowerrpfound || !emcalpreshorpfound || !clusterizerfound) )
- if(strcmp(branch->GetTitle(), fRecPointsTitle)==0) {
+ while ( (branch = static_cast<TBranch*>(next())) && (!emcalTowerRPfound || !emcalPreShoRPfound || !clusterizerfound) ) {
+ if(strcmp(branch->GetTitle(), fRecPointsTitle)==0 ) {
if ( strcmp(branch->GetName(), "EMCALTowerRP")==0) {
towerbranch = branch ;
- emcaltowerrpfound = kTRUE ;
+ emcalTowerRPfound = kTRUE ;
}
else if ( strcmp(branch->GetName(), "EMCALPreShoRP")==0) {
- preshobranch = branch ;
- emcalpreshorpfound = kTRUE ;
+ preshowerbranch = branch ;
+ emcalPreShoRPfound = kTRUE ;
}
else if(strcmp(branch->GetName(), "AliEMCALClusterizer")==0){
clusterizerbranch = branch ;
clusterizerfound = kTRUE ;
}
}
+ }
- if ( !emcaltowerrpfound ) {
- if (fDebug)
- cout << "WARNING: AliEMCALGetter::ReadTreeR -> Cannot find TowerRecPoints with title "
- << fRecPointsTitle << endl ;
- return ;
- }
- if ( !emcalpreshorpfound ) {
+ if ( !emcalTowerRPfound || !emcalPreShoRPfound || !clusterizerfound) {
if (fDebug)
- cout << "WARNING: AliEMCALGetter::ReadTreeR -> Cannot find PreShoRecPoints with title "
+ cout << "WARNING: AliEMCALGetter::ReadTreeR -> Cannot find RecPoints and/or Clusterizer with name "
<< fRecPointsTitle << endl ;
- return ;
- }
- if ( !clusterizerfound ) {
- if (fDebug)
- cout << "WARNING: AliEMCALGetter::ReadTreeR -> Can not find Clusterizer with title "
- << fRecPointsTitle << endl ;
- return ;
- }
-
- // Read and Post the RecPoints
- if(!TowerRecPoints(fRecPointsTitle) )
- PostRecPoints(fRecPointsTitle) ;
- towerbranch->SetAddress(TowerRecPointsRef(fRecPointsTitle)) ;
- towerbranch->GetEntry(0) ;
-
- preshobranch->SetAddress(PreShoRecPointsRef(fRecPointsTitle)) ;
- preshobranch->GetEntry(0) ;
-
- if(!Clusterizer(fRecPointsTitle) )
- PostClusterizer(fRecPointsTitle) ;
-
- clusterizerbranch->SetAddress(ClusterizerRef(fRecPointsTitle)) ;
- clusterizerbranch->GetEntry(0) ;
+ } else {
+ if(!TowerRecPoints(fRecPointsTitle) )
+ PostRecPoints(fRecPointsTitle) ;
+
+ towerbranch->SetAddress(TowerRecPointsRef(fRecPointsTitle)) ;
+ towerbranch->GetEntry(0) ;
+
+ preshowerbranch->SetAddress(PreShowerRecPointsRef(fRecPointsTitle)) ;
+ preshowerbranch->GetEntry(0) ;
+
+ if(!Clusterizer(fRecPointsTitle) )
+ PostClusterizer(fRecPointsTitle) ;
+
+ clusterizerbranch->SetAddress(ClusterizerRef(fRecPointsTitle)) ;
+ clusterizerbranch->GetEntry(0) ;
+ }
- //------------------- TrackSegments ---------------------
+// //------------------- TrackSegments ---------------------
// next.Reset() ;
// TBranch * tsbranch = 0 ;
// TBranch * tsmakerbranch = 0 ;
// Bool_t emcaltsfound = kFALSE, tsmakerfound = kFALSE ;
-
-// while ( (branch = static_cast<TBranch*>(next())) && (!emcaltsfound || !tsmakerfound) )
-// if(strcmp(branch->GetTitle(), fTrackSegmentsTitle)==0) {
+// while ( (branch = static_cast<TBranch*>(next())) && (!emcaltsfound || !tsmakerfound) ) {
+// if(strcmp(branch->GetTitle(), fTrackSegmentsTitle)==0 ) {
// if ( strcmp(branch->GetName(), "EMCALTS")==0){
// tsbranch = branch ;
// emcaltsfound = kTRUE ;
// tsmakerfound = kTRUE ;
// }
// }
-
+// }
+
// if ( !emcaltsfound || !tsmakerfound ) {
// if (fDebug)
// cout << "WARNING: AliEMCALGetter::ReadTreeR -> Cannot find TrackSegments and/or TrackSegmentMaker with name "
// << fTrackSegmentsTitle << endl ;
-// return ;
-// }
-
-// // Read and Post the TrackSegments
-// if(!TrackSegments(fTrackSegmentsTitle))
-// PostTrackSegments(fTrackSegmentsTitle) ;
-// tsbranch->SetAddress(TrackSegmentsRef(fTrackSegmentsTitle)) ;
-// tsbranch->GetEntry(0) ;
-
-// // Read and Post the TrackSegment Maker
-// if(!TrackSegmentMaker(fTrackSegmentsTitle))
-// PostTrackSegmentMaker(fTrackSegmentsTitle) ;
-// tsmakerbranch->SetAddress(TSMakerRef(fTrackSegmentsTitle)) ;
-// tsmakerbranch->GetEntry(0) ;
+// } else {
+// // Read and Post the TrackSegments
+// if(!TrackSegments(fTrackSegmentsTitle))
+// PostTrackSegments(fTrackSegmentsTitle) ;
+// tsbranch->SetAddress(TrackSegmentsRef(fTrackSegmentsTitle)) ;
+// tsbranch->GetEntry(0) ;
+
+// // Read and Post the TrackSegment Maker
+// if(!TrackSegmentMaker(fTrackSegmentsTitle))
+// PostTrackSegmentMaker(fTrackSegmentsTitle) ;
+// tsmakerbranch->SetAddress(TSMakerRef(fTrackSegmentsTitle)) ;
+// tsmakerbranch->GetEntry(0) ;
+// }
// //------------ RecParticles ----------------------------
// if ( !emcalrpafound || !pidfound ) {
// if (fDebug)
// cout << "WARNING: AliEMCALGetter::ReadTreeR -> Cannot find RecParticles and/or PID with name "
-// << fRecParticlesTitle << endl ;
-// return ;
-// }
-
-// // Read and Post the RecParticles
-// if(!RecParticles(fRecParticlesTitle))
-// PostRecParticles(fRecParticlesTitle) ;
-// rpabranch->SetAddress(RecParticlesRef(fRecParticlesTitle)) ;
-// rpabranch->GetEntry(0) ;
-
-// // Read and Post the PID
-// if(!PID(fRecParticlesTitle))
-// PostPID(fRecParticlesTitle) ;
-// pidbranch->SetAddress(PIDRef(fRecParticlesTitle)) ;
-// pidbranch->GetEntry(0) ;
-
-
+// << fRecParticlesTitle << endl ;
+// } else {
+// // Read and Post the RecParticles
+// if(!RecParticles(fRecParticlesTitle))
+// PostRecParticles(fRecParticlesTitle) ;
+// rpabranch->SetAddress(RecParticlesRef(fRecParticlesTitle)) ;
+// rpabranch->GetEntry(0) ;
+// // Read and Post the PID
+// if(!PID(fRecParticlesTitle))
+// PostPID(fRecParticlesTitle) ;
+// pidbranch->SetAddress(PIDRef(fRecParticlesTitle)) ;
+// pidbranch->GetEntry(0) ;
+// }
+
+ if(gAlice->TreeR()!=treeR)
+ treeR->Delete();
+ return 0 ;
}
//____________________________________________________________________________
-void AliEMCALGetter::ReadTreeS(Int_t event)
+Int_t AliEMCALGetter::ReadTreeS(Int_t event)
{
- // Read the summable digits tree gAlice->TreeS()
-
- // loop over all opened files and read their SDigits to the White Board
+ // Reads the SDigits treeS from all files
+ // Files, which should be opened are listed in emcalF
+ // So, first get list of files
TFolder * emcalF = dynamic_cast<TFolder *>(fSDigitsFolder->FindObject("EMCAL")) ;
if (!emcalF)
emcalF = fSDigitsFolder->AddFolder("EMCAL", "SDigits from EMCAL") ;
TCollection * folderslist = emcalF->GetListOfFolders() ;
- //Add current file to list if it is not there yet
-
- TString subdir(fHeaderFile) ;
- subdir.ReplaceAll("/","_") ;
-
- if ( (subdir != "aliroot") && ( !folderslist->Contains(subdir) ) ){
- emcalF->AddFolder(subdir, "");
- }
-
+ // Now iterate over the list of files and read TreeS into Whiteboard
TIter next(folderslist) ;
TFolder * folder = 0 ;
TFile * file;
TTree * treeS = 0;
while ( (folder = static_cast<TFolder*>(next())) ) {
- TString fileName(folder->GetName()) ;
- fileName.ReplaceAll("_","/") ;
- if(fHeaderFile.CompareTo(fileName) == 0 )
- treeS=gAlice->TreeS() ;
- else{
- file = static_cast<TFile*>(gROOT->GetFile(fileName));
- file->cd() ;
+ TString fileName("") ;
+ if(fToSplit)
+ fileName = folder->GetTitle() ;
+ else
+ fileName = folder->GetName() ;
+ fileName.ReplaceAll("_","/") ;
+ file = static_cast<TFile*>(gROOT->GetFile(fileName));
+ if(!file)
+ file = TFile::Open(fileName) ;
+ // Get SDigits Tree header from file
+ TString treeName("TreeS") ;
+ treeName += event ;
+ treeS = dynamic_cast<TTree*>(file->Get(treeName.Data()));
+
+ if(!treeS){ // TreeS not found in header file
+ if (fDebug)
+ cout << "WARNING: AliEMCALGetter::ReadTreeS -> Cannot find TreeS in " << fileName.Data() << endl;
+ return 1;
+ }
+
+ //set address of the SDigits and SDigitizer
+ TBranch * sdigitsBranch = 0;
+ TBranch * sdigitizerBranch = 0;
+ TBranch * branch = 0 ;
+ TObjArray * lob = static_cast<TObjArray*>(treeS->GetListOfBranches()) ;
+ TIter next(lob) ;
+ Bool_t emcalfound = kFALSE, sdigitizerfound = kFALSE ;
+
+ while ( (branch = static_cast<TBranch*>(next())) && (!emcalfound || !sdigitizerfound) ) {
+ if ( (strcmp(branch->GetName(), "EMCAL")==0) && (strcmp(branch->GetTitle(), fSDigitsTitle)==0) ) {
+ emcalfound = kTRUE ;
+ sdigitsBranch = branch ;
+ }
- // Get SDigits Tree header from file
- TString treeName("TreeS") ;
- treeName += event ;
- treeS = dynamic_cast<TTree*>(gDirectory->Get(treeName.Data()));
+ else if ( (strcmp(branch->GetName(), "AliEMCALSDigitizer")==0) &&
+ (strcmp(branch->GetTitle(), fSDigitsTitle)==0) ) {
+ sdigitizerfound = kTRUE ;
+ sdigitizerBranch = branch ;
+ }
}
- if(!treeS){ // TreeS not found in header file
-
- if (fDebug)
- cout << "WARNING: AliEMCALGetter::ReadTreeS -> Cannot find TreeS in " << fHeaderFile << endl;
-
- TString searchFileName("") ;
-
- if (SDigitizer()) // SDigitizer found in header file
- searchFileName = SDigitizer()->GetTitle() ;
-
- else if (Digitizer()) // Digitizer found in header file
- searchFileName = Digitizer()->GetSDigitsFileName() ;
-
- else if (Clusterizer()) // Clusterizer found in header file
- searchFileName = Clusterizer()->GetSDigitsFileName() ;
-
- if (treeS = TreeS(searchFileName)) { //found TreeS in the file which contains the hits
- if (fDebug)
- cout << "INFO: AliEMCALGetter::ReadTreeS -> TreeS found in " << searchFileName.Data() << endl ;
-
- } else {
- cerr << "ERROR: AliEMCALGetter::ReadTreeS -> TreeS not found " << endl ;
- return ;
- }
- }
-
- //set address of the SDigits and SDigitizer
- TBranch * sdigitsBranch = 0;
- TBranch * sdigitizerBranch = 0;
- TBranch * branch = 0 ;
- TObjArray * lob = static_cast<TObjArray*>(treeS->GetListOfBranches()) ;
- TIter next(lob) ;
- Bool_t emcalfound = kFALSE, sdigitizerfound = kFALSE ;
-
- while ( (branch = static_cast<TBranch*>(next())) && (!emcalfound || !sdigitizerfound) ) {
- if ( (strcmp(branch->GetName(), "EMCAL")==0) && (strcmp(branch->GetTitle(), fSDigitsTitle)==0) ) {
- emcalfound = kTRUE ;
- sdigitsBranch = branch ;
- }
-
- else if ( (strcmp(branch->GetName(), "AliEMCALSDigitizer")==0) && (strcmp(branch->GetTitle(), fSDigitsTitle)==0) ) {
- sdigitizerfound = kTRUE ;
- sdigitizerBranch = branch ;
- }
- }
- if ( !emcalfound || !sdigitizerfound ) {
- if (fDebug)
- cout << "WARNING: AliEMCALGetter::ReadSDigits -> Digits and/or Digitizer branch with name " << fSDigitsTitle
- << " not found" << endl ;
- return ;
- }
-
- if ( !folder->FindObject(fSDigitsTitle) )
- PostSDigits(fSDigitsTitle,folder->GetName()) ;
- sdigitsBranch->SetAddress(SDigitsRef(fSDigitsTitle,folder->GetName())) ;
- sdigitsBranch->GetEntry(0) ;
-
- TString sdname(fSDigitsTitle) ;
- sdname+=":" ;
- sdname+=folder->GetName() ;
- if(!SDigitizer(sdname) )
- PostSDigitizer(fSDigitsTitle,folder->GetName()) ;
-
- sdigitizerBranch->SetAddress(SDigitizerRef(sdname)) ;
- sdigitizerBranch->GetEntry(0) ;
-
- }
-
- // After SDigits have been read from all files, return to the first one
-
- next.Reset();
- folder = static_cast<TFolder*>(next());
- if(folder){
- TString fileName(folder->GetName()) ;
- fileName.ReplaceAll("_","/") ;
- file = static_cast<TFile*>(gROOT->GetFile(fileName));
- file ->cd() ;
- }
-
+ if ( !emcalfound || !sdigitizerfound ) {
+ if (fDebug)
+ cout << "WARNING: AliEMCALDigitizer::ReadSDigits -> Digits and/or Digitizer branch with name " << GetName()
+ << " not found" << endl ;
+ return 2;
+ }
+
+ if ( !folder->FindObject(fSDigitsTitle) )
+ PostSDigits(fSDigitsTitle,folder->GetName()) ;
+
+ ((TClonesArray*) (*SDigitsRef(fSDigitsTitle,folder->GetName())))->Clear() ;
+ sdigitsBranch->SetAddress(SDigitsRef(fSDigitsTitle,folder->GetName())) ;
+ sdigitsBranch->GetEntry(0) ;
+
+ TString sdname(fSDigitsTitle) ;
+ sdname+=":" ;
+ sdname+=folder->GetName() ;
+ if(!SDigitizer(sdname) )
+ PostSDigitizer(fSDigitsTitle,folder->GetName()) ;
+ sdigitizerBranch->SetAddress(SDigitizerRef(sdname)) ;
+ sdigitizerBranch->GetEntry(0) ;
+ if(gAlice->TreeS()!=treeS)
+ treeS->Delete();
+ }
+ return 0 ;
}
//____________________________________________________________________________
TString sdname(sdigitsBranch->GetTitle()) ;
sdname+=":" ;
sdname+=filename ;
+
if(!SDigitizer(sdigitsBranch->GetTitle()) )
PostSDigitizer(sdigitsBranch->GetTitle(),filename) ;
-
sdigitizerBranch->SetAddress(SDigitizerRef(sdname)) ;
sdigitizerBranch->GetEntry(0) ;
-
+ if(gAlice->TreeS()!=treeS)
+ treeS->Delete();
}
} else { // treeK not found in header file
- TString searchFileName("") ;
-
- if (SDigitizer()) // SDigitizer found in header file
- searchFileName = SDigitizer()->GetTitle() ;
-
- else if (Digitizer()) // Digitizer found in header file
- searchFileName = Digitizer()->GetHitsFileName() ;
-
- else if (Clusterizer()) // Clusterizer found in header file
- searchFileName = Clusterizer()->GetHitsFileName() ;
-
- if (TreeK(searchFileName)) { //found TreeK in the file which contains the hits
- if (fDebug)
- cout << "INFO: AliEMCALGetter::ReadPrimaries -> TreeK found in " << searchFileName.Data() << endl ;
- fAlice->GetEvent(EventNumber()) ;
- fNPrimaries = fAlice->GetNtrack() ;
-
- } else {
- cerr << "ERROR: AliEMCALGetter::ReadPrimaries -> TreeK not found " << endl ;
- return ;
- }
+ cerr << "ERROR: AliEMCALGetter::ReadPrimaries -> TreeK not found " << endl ;
+ return ;
}
Int_t index = 0 ;
cerr << "ERROR: AliEMCALGetter::Event -> " << event << " not found in TreeE!" << endl ;
return ;
}
- gAlice->GetEvent(event) ;
- // Carefull the order of reading is important
-
+ Bool_t any = kFALSE ;
+ if (strstr(opt,"A") ) // do not check the title of the branches
+ any = kTRUE;
+
+ gAlice->GetEvent(event) ;
+
if( strstr(opt,"R") )
- ReadTreeR() ;
+ ReadTreeR(event) ;
if( strstr(opt,"D") )
- ReadTreeD() ;
+ ReadTreeD(event) ;
if(strstr(opt,"S") )
ReadTreeS(event) ;
if(strstr(opt,"H") )
ReadTreeH() ;
-
- // if( strstr(opt,"Q") )
- // ReadTreeQA() ;
-
+
+ if( strstr(opt,"Q") )
+ ReadTreeQA() ;
+
if( strstr(opt,"P") || (strcmp(opt,"")==0) )
ReadPrimaries() ;
TFolder * folder = 0 ;
TObject * emcalO = 0 ;
- // if ( name.IsNull() ) {
- if ( what.CompareTo("Hits") == 0 ) {
+ if ( what.CompareTo("Primaries") == 0 ) {
+ folder = dynamic_cast<TFolder *>(fPrimariesFolder->FindObject("Primaries")) ;
+ if (folder)
+ emcalO = dynamic_cast<TObject *>(folder->FindObject("Primaries")) ;
+ else
+ return 0 ;
+ }
+ else if ( what.CompareTo("Hits") == 0 ) {
folder = dynamic_cast<TFolder *>(fHitsFolder->FindObject("EMCAL")) ;
if (folder)
emcalO = dynamic_cast<TObject *>(folder->FindObject("Hits")) ;
emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
}
}
- else if ( what.CompareTo("PreShoRecPoints") == 0 ) {
- folder = dynamic_cast<TFolder *>(fRecoFolder->FindObject("EMCAL/PreShoRecPoints")) ;
+ else if ( what.CompareTo("PreShowerRecPoints") == 0 ) {
+ folder = dynamic_cast<TFolder *>(fRecoFolder->FindObject("EMCAL/PreShowerRecPoints")) ;
if (folder) {
if (name.IsNull())
name = fRecPointsTitle ;
cout << "WARNING : AliEMCALGetter::ReturnO -> Object " << what << " not found in " << folder->GetName() << endl ;
return 0 ;
}
+
return emcalO ;
}
return 0 ;
}
-
//____________________________________________________________________________
void AliEMCALGetter::RemoveTask(TString opt, TString name) const
{
task = dynamic_cast<TTask*>(fTasksFolder->FindObject("SDigitizer")) ;
if (!task)
return ;
- }
-
+ }
else if (opt == "D") { // Digitizer
task = dynamic_cast<TTask*>(fTasksFolder->FindObject("Digitizer")) ;
if (!task)
else {
cerr << "WARNING: AliEMCALGetter::RemoveTask -> Unknown option " << opt.Data() << endl ;
return ;
- }
-
+ }
emcal = dynamic_cast<TTask*>(task->GetListOfTasks()->FindObject("EMCAL")) ;
if (!emcal)
return ;
TObject * obj = lofTasks->FindObject(name) ;
if (obj)
lofTasks->Remove(obj) ;
+
}
//____________________________________________________________________________
}
else if (opt == "RP") { // Preshower RecPoints
- emcal = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/PreShoRecPoints")) ;
+ emcal = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/PreShowerRecPoints")) ;
+ if (!emcal)
+ return ;
+ }
+
+ else if (opt == "T") { // TrackSegments
+ emcal = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/TrackSegments")) ;
if (!emcal)
return ;
}
+ else if (opt == "P") { // RecParticles
+ emcal = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/RecParticles")) ;
+ if (!emcal)
+ return ;
+ }
+
else {
cerr << "WARNING: AliEMCALGetter::RemoveObjects -> Unknown option " << opt.Data() << endl ;
return ;
emcal->SetOwner() ;
emcal->Clear() ;
}
+
+//____________________________________________________________________________
+void AliEMCALGetter::CleanWhiteBoard(void){
+
+ TFolder * emcalmain = 0 ;
+ TFolder * emcal ;
+ TObjArray * ar ;
+ TList * lofTasks = 0 ;
+ TTask * task = 0 ;
+ TTask * emcalt = 0 ;
+
+ // Hits
+ emcal = dynamic_cast<TFolder*>(fHitsFolder->FindObject("EMCAL")) ;
+ if (emcal){
+ TObjArray * ar = dynamic_cast<TObjArray*>(emcal->FindObject("Hits")) ;
+ if (ar) {
+ emcal->Remove(ar) ;
+ ar->Delete() ;
+ delete ar ;
+ }
+ }
+
+ // SDigits
+ emcalmain = dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("EMCAL")) ;
+ if (emcalmain){
+ emcal = dynamic_cast<TFolder*>(emcalmain->FindObject(fHeaderFile)) ;
+ if (emcal) {
+ ar = dynamic_cast<TObjArray*>(emcal->FindObject(fSDigitsTitle)) ;
+ if (ar) {
+ emcal->Remove(ar) ;
+ ar->Delete() ;
+ delete ar ;
+ }
+ }
+ emcalmain->Remove(emcal) ;
+ }
+
+
+ // Digits
+ emcal = dynamic_cast<TFolder*>(fDigitsFolder->FindObject("EMCAL")) ;
+ if (emcal){
+ ar = dynamic_cast<TObjArray*>(emcal->FindObject(fDigitsTitle)) ;
+ if (ar) {
+ emcal->Remove(ar) ;
+ ar->Delete() ;
+ delete ar ;
+ }
+ }
+
+
+ // TowerRecPoints
+ emcal = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/TowerRecPoints")) ;
+ if (emcal){
+ ar = dynamic_cast<TObjArray*>(emcal->FindObject(fRecPointsTitle)) ;
+ if (ar) {
+ emcal->Remove(ar) ;
+ ar->Delete() ;
+ delete ar ;
+ }
+ }
+
+
+ // PreShowerRecPoints
+ emcal = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/PreShowerRecPoints")) ;
+ if (emcal){
+ ar = dynamic_cast<TObjArray*>(emcal->FindObject(fRecPointsTitle)) ;
+ if (ar) {
+ emcal->Remove(ar) ;
+ ar->Delete() ;
+ delete ar ;
+ }
+ }
+
+
+ // TrackSegments
+ emcal = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/TrackSegments")) ;
+ if (emcal) {
+ ar = dynamic_cast<TObjArray*>(emcal->FindObject(fTrackSegmentsTitle)) ;
+ if (ar) {
+ emcal->Remove(ar) ;
+ ar->Delete() ;
+ delete ar ;
+ }
+ }
+
+
+
+ // RecParticles
+ emcal = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL/RecParticles")) ;
+ if (emcal){
+ ar = dynamic_cast<TObjArray*>(emcal->FindObject(fRecParticlesTitle)) ;
+ if (ar) {
+ emcal->Remove(ar) ;
+ ar->Delete() ;
+ delete ar ;
+ }
+ }
+
+
+ //---- Now Tasks -----------
+
+ TObject * obj ;
+ TString sdname(fSDigitsTitle);
+
+ // Digitizer
+ task = dynamic_cast<TTask*>(fTasksFolder->FindObject("Digitizer")) ;
+ if (task){
+ emcalt = dynamic_cast<TTask*>(task->GetListOfTasks()->FindObject("EMCAL")) ;
+ if (emcalt){
+ lofTasks = emcalt->GetListOfTasks() ;
+ if (lofTasks){
+ obj = lofTasks->FindObject(sdname.Data()) ;
+ if (obj)
+ lofTasks->Remove(obj) ;
+ }
+ }
+ }
+
+
+ sdname.Append(":") ;
+ // Clusterizer, TrackSegmentMaker, PID
+ task = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
+ if (task){
+ emcalt = dynamic_cast<TTask*>(task->GetListOfTasks()->FindObject("EMCAL")) ;
+ if (emcalt){
+ lofTasks = emcalt->GetListOfTasks() ;
+ TIter next(lofTasks);
+ while((obj=next())){
+ TString oname(obj->GetName()) ;
+ if (oname.BeginsWith(sdname)){
+ lofTasks->Remove(obj) ;
+ }
+ }
+ }
+ }
+
+
+ // SDigitizer
+ sdname.Append(fHeaderFile) ;
+ task = dynamic_cast<TTask*>(fTasksFolder->FindObject("SDigitizer")) ;
+ if (task) {
+ emcalt = dynamic_cast<TTask*>(task->GetListOfTasks()->FindObject("EMCAL")) ;
+ if (emcalt){
+ lofTasks = emcalt->GetListOfTasks() ;
+ if (lofTasks){
+ obj = lofTasks->FindObject(sdname.Data()) ;
+ if (obj)
+ lofTasks->Remove(obj) ;
+ }
+ }
+ }
+
+}
+//____________________________________________________________________________
+void AliEMCALGetter::SetTitle(const char * branchTitle )
+{
+ fBranchTitle = branchTitle ;
+ fSDigitsTitle = branchTitle ;
+ fDigitsTitle = branchTitle ;
+ fRecPointsTitle = branchTitle ;
+ fRecParticlesTitle = branchTitle ;
+ fTrackSegmentsTitle = branchTitle ;
+ if(fToSplit){
+ //First - extract full path if necessary
+ TString sFileName(fHeaderFile) ;
+ Ssiz_t islash = sFileName.Last('/') ;
+ if(islash<sFileName.Length())
+ sFileName.Remove(islash+1,sFileName.Length()) ;
+ else
+ sFileName="" ;
+ //Now construct file names
+ fSDigitsFileName = sFileName ;
+ fDigitsFileName = sFileName ;
+ fRecPointsFileName = sFileName ;
+ fRecParticlesFileName = sFileName ;
+ fTrackSegmentsFileName = sFileName ;
+ fSDigitsFileName += "EMCAL.SDigits." ;
+ fDigitsFileName += "EMCAL.Digits." ;
+ fRecPointsFileName += "EMCAL.RecData." ;
+ fTrackSegmentsFileName+= "EMCAL.RecData." ;
+ fRecParticlesFileName += "EMCAL.RecData." ;
+ if((strcmp(fBranchTitle.Data(),"Default")!=0)&&(strcmp(fBranchTitle.Data(),"")!=0)){
+ fSDigitsFileName += fBranchTitle ;
+ fSDigitsFileName += "." ;
+ fDigitsFileName += fBranchTitle ;
+ fDigitsFileName += "." ;
+ fRecPointsFileName += fBranchTitle ;
+ fRecPointsFileName += "." ;
+ fRecParticlesFileName += fBranchTitle ;
+ fRecParticlesFileName += "." ;
+ fTrackSegmentsFileName+= fBranchTitle ;
+ fTrackSegmentsFileName+= "." ;
+ }
+ fSDigitsFileName += "root" ;
+ fDigitsFileName += "root" ;
+ fRecPointsFileName += "root" ;
+ fRecParticlesFileName += "root" ;
+ fTrackSegmentsFileName+= "root" ;
+ }else{
+ fSDigitsFileName = "" ;
+ fDigitsFileName = "" ;
+ fRecPointsFileName = "" ;
+ fRecParticlesFileName = "" ;
+ fTrackSegmentsFileName = "" ;
+ }
+ TFolder * emcalFolder ;
+ emcalFolder = dynamic_cast<TFolder*>(fHitsFolder->FindObject("EMCAL")) ;
+ if ( !emcalFolder )
+ emcalFolder = fHitsFolder->AddFolder("EMCAL", "Hits from EMCAL") ;
+
+ emcalFolder = dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("EMCAL")) ;
+ if ( !emcalFolder )
+ emcalFolder = fSDigitsFolder->AddFolder("EMCAL", "SDigits from EMCAL") ;
+
+ //Make folder for SDigits
+ TString subdir(fHeaderFile) ;
+ subdir.ReplaceAll("/","_") ;
+ emcalFolder->AddFolder(subdir, fSDigitsFileName.Data());
+
+
+ emcalFolder = dynamic_cast<TFolder*>(fDigitsFolder->FindObject("EMCAL")) ;
+ if ( !emcalFolder )
+ emcalFolder = fDigitsFolder->AddFolder("EMCAL", "Digits from EMCAL") ;
+
+ emcalFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("EMCAL")) ;
+ if ( !emcalFolder )
+ emcalFolder = fRecoFolder->AddFolder("EMCAL", "Reconstructed data from EMCAL") ;
+
+
+}
+//____________________________________________________________________________
+void AliEMCALGetter::CloseSplitFiles(void){
+ TFile * file ;
+ file = static_cast<TFile*>(gROOT->GetFile(fSDigitsFileName.Data() ) ) ;
+ if(file)
+ file->Close() ;
+ file = static_cast<TFile*>(gROOT->GetFile(fDigitsFileName.Data() ) ) ;
+ if(file)
+ file->Close() ;
+ file = static_cast<TFile*>(gROOT->GetFile(fRecPointsFileName.Data() ) ) ;
+ if(file)
+ file->Close() ;
+ file = static_cast<TFile*>(gROOT->GetFile(fTrackSegmentsFileName.Data() ) ) ;
+ if(file)
+ file->Close() ;
+ file = static_cast<TFile*>(gROOT->GetFile(fRecParticlesFileName.Data() ) ) ;
+ if(file)
+ file->Close() ;
+
+}
//*-- Author: Yves Schutz (SUBATECH) & Dmitri Peressounko (RRC KI & SUBATECH)
//
-
+// Modif:
+// August 2002 Yves Schutz: clone PHOS as closely as possible and intoduction
+// of new IO (à la PHOS)
+
// --- ROOT system ---
#include "TClonesArray.h"
#include "TFolder.h"
// --- AliRoot header files ---
#include "AliRun.h"
-#include "AliEMCALv1.h"
+#include "AliEMCAL.h"
#include "AliEMCALHit.h"
#include "AliEMCALDigit.h"
-#include "AliEMCALDigitizer.h"
-#include "AliEMCALSDigitizer.h"
#include "AliEMCALTowerRecPoint.h"
-class AliEMCALGeometry ;
-class AliEMCALClusterizerv1 ;
//class AliEMCALTrackSegment ;
-//class AliEMCALTrackSegmentMaker ;
//class AliEMCALRecParticle ;
+class AliEMCALGeometry ;
+#include "AliEMCALDigitizer.h"
+#include "AliEMCALSDigitizer.h"
+class AliEMCALClusterizer ;
+//class AliEMCALTrackSegmentMaker ;
//class AliEMCALPID ;
class AliEMCALGetter : public TObject {
public:
- AliEMCALGetter(){
- // ctor: this is a singleton, the ctor should never be called but cint needs it as public
- cerr << "ERROR: AliPHOGetter is a singleton default ctor not callable" << endl ;
+ AliEMCALGetter(){ // ctor: this is a singleton, the ctor should never be called but cint needs it as public
+ cerr << "ERROR: AliEMCALGetter is a singleton default ctor not callable" << endl ;
abort() ;
}
AliEMCALGetter(const AliEMCALGetter & obj) {
abort() ;
}
+ AliEMCALGetter & operator = (const AliEMCALGetter & ) {
+ // assignement operator requested by coding convention, but not needed
+ abort() ;
+ return *this ;
+ }
virtual ~AliEMCALGetter() ;
- void CloseFile() ;
- const TFolder * Folder(const TString what) const ;
- const Bool_t HasFailed(void) const {return fFailed ;}
- Bool_t PostPrimaries(void ) const ;
- Bool_t PostHits(void ) const ;
- Bool_t PostSDigits( const char * name, const char * file = 0) const ;
- Bool_t PostDigits( const char * name ) const ;
- Bool_t PostRecPoints( const char * name ) const ;
- //Bool_t PostTrackSegments(const char * name) const ;
- //Bool_t PostRecParticles( const char * name) const ;
-
- Bool_t PostClusterizer( const char * name) const ;
- Bool_t PostClusterizer(AliEMCALClusterizerv1 * clu) const ;
- Bool_t PostSDigitizer (AliEMCALSDigitizer * sdigitizer) const ;
- Bool_t PostSDigitizer ( const char * name, const char * file ) const ;
- Bool_t PostDigitizer (AliEMCALDigitizer * digitizer) const ;
- Bool_t PostDigitizer ( const char * name) const ;
- //Bool_t PostTrackSegmentMaker(AliEMCALTrackSegmentMaker * tsm) const ;
- //Bool_t PostTrackSegmentMaker(const char * name ) const ;
- //Bool_t PostPID (AliEMCALPID * pid) const ;
- //Bool_t PostPID (const char * name ) const ;
- //Bool_t PostQA (void) const ;
-
-
- void Event(const Int_t event, const char * opt = "HSDR") ;
- void Track(Int_t itrack) ;
-
- //Method to be used when digitizing under AliRunDigitizer, who opens all files etc.
- void ReadTreeS(TTree * treeS,Int_t input) ;
-
- Int_t EventNumber() { return (Int_t) gAlice->GetEvNumber() ; }
- Int_t MaxEvent() { return (Int_t) gAlice->TreeE()->GetEntries() ; }
+ //=========== Instantiators ================
static AliEMCALGetter * GetInstance(const char* headerFile,
- const char* branchTitle = "Default", const Option_t * rw="" ) ;
- static AliEMCALGetter * GetInstance() ;
+ const char* branchTitle = "Default",
+ const Bool_t toSplit = kFALSE ) ;
+ static AliEMCALGetter * GetInstance() ;
+
+ //=========== General information about run ==============
+ const Int_t MaxEvent() const { return static_cast<Int_t>(gAlice->TreeE()->GetEntries()) ; }
+ const Int_t EventNumber() const { return static_cast<Int_t>(gAlice->GetEvNumber()) ; }
+ const Bool_t BranchExists(const TString recName) const ;
- const AliEMCALv1 * EMCAL() ;
+ //========== EMCALGeometry and EMCAL =============
+ const AliEMCAL * EMCAL() ;
AliEMCALGeometry * EMCALGeometry() ;
- // Alarms
- //TFolder * Alarms() const { return (TFolder*)(ReturnO("Alarms", 0)) ; }
- //TObjArray * Alarms(const char * name ) const { return (TObjArray*)(ReturnO("Alarms", name)) ; }
- // QA Tasks
- //TTask * QATasks(const char * name = 0) const { return (TTask*)(ReturnT("QATasks", name)) ; }
-
- // Primaries
- TClonesArray * Primaries(void) const { return (TClonesArray*)(ReturnO("Primaries")) ; }
-
-
- // Hits
+ //========== Methods to read something from file ==========
+ void Event(const Int_t event, const char * opt = "HSDRP") ;
+ void Track(const Int_t itrack) ;
+ void ReadTreeS(TTree * treeS,Int_t input) ; //Method to be used when
+ //digitizing is under the conytrol of AliRunDigitizer,
+ //which opens all files etc.
+ //========== Alarms ======================
+ //TFolder * Alarms() const { return dynamic_cast<TFolder*>(ReturnO("Alarms", 0)) ; }
+ //const TObjArray * Alarms(const char * name ) const { return dynamic_cast<const TObjArray*>(ReturnO("Alarms", name)) ; }
+ //const TTask * QATasks(const char * name = 0) const { return ReturnT("QATasks", name) ; }
+
+ //-----------------now getter's data--------------------------------------
+
+ //=========== Primaries ============
+ TTree * TreeK(TString filename="") ;
+ TClonesArray * Primaries(void) const { return dynamic_cast<TClonesArray*>(ReturnO("Primaries")) ; }
+ const TParticle * Primary(Int_t index) const;
+ const Int_t NPrimaries()const { return fNPrimaries; }
+ const TParticle * Secondary(TParticle * p, Int_t index=1) const ;
+
+ //=========== Hits =================
TTree * TreeH(TString filename="") ;
- const TClonesArray * Hits(void) { return static_cast<const TClonesArray*>(ReturnO("Hits")) ; }
- const AliEMCALHit * Hit(Int_t index) { return static_cast<const AliEMCALHit*>(Hits()->At(index) );}
-
- // SDigits
+ const TClonesArray * Hits(void) { return dynamic_cast<const TClonesArray*>(ReturnO("Hits")) ; }
+ const AliEMCALHit * Hit(Int_t index) { return dynamic_cast<const AliEMCALHit*>(Hits()->At(index) );}
+
+ //=========== SDigits ==============
TTree * TreeS(TString filename="") ;
TClonesArray * SDigits(const char * name = 0, const char * file=0) {
- return static_cast<TClonesArray*>(ReturnO("SDigits", name, file)) ;
- }
+ return dynamic_cast<TClonesArray*>(ReturnO("SDigits", name, file)) ; }
const AliEMCALDigit * SDigit(Int_t index) { return static_cast<const AliEMCALDigit*>(SDigits()->At(index)) ;}
-
- AliEMCALSDigitizer * SDigitizer(const char * name =0) const {
- return ((AliEMCALSDigitizer*)(ReturnT("SDigitizer", name))) ;
+ const AliEMCALSDigitizer * SDigitizer(const char * name =0) const {
+ return (const AliEMCALSDigitizer*)(ReturnT("SDigitizer", name)) ; // here static or dynamic cast does not work ! why ?
}
-
- // Digits
+
+ //========== Digits ================
TTree * TreeD(TString filename="") ;
TClonesArray * Digits(const char * name = 0)const {
- return static_cast<TClonesArray*>(ReturnO("Digits", name)) ;
- }
+ return dynamic_cast<TClonesArray*>(ReturnO("Digits", name)) ; }
const AliEMCALDigit * Digit(Int_t index) { return static_cast<const AliEMCALDigit *>(Digits()->At(index)) ;}
- AliEMCALDigitizer * Digitizer(const char * name =0) const {
- return (AliEMCALDigitizer*)(ReturnT("Digitizer", name)) ;
- }
-
- // RecPoints
+ const AliEMCALDigitizer * Digitizer(const char * name =0) const {
+ return (const AliEMCALDigitizer*)(ReturnT("Digitizer", name)) ; }
+
+ //========== RecPoints =============
TObjArray * TowerRecPoints(const char * name = 0) const {
- return (TObjArray*)(ReturnO("TowerRecPoints", name)) ; }
+ return (dynamic_cast<TObjArray*>(ReturnO("TowerRecPoints", name))) ; }
+ const AliEMCALTowerRecPoint * TowerRecPoint(Int_t index) { return static_cast<const AliEMCALTowerRecPoint *>(TowerRecPoints()->At(index)) ;}
TObjArray * PreShowerRecPoints(const char * name = 0) const {
- return (TObjArray*)(ReturnO("PreShoRecPoints", name)) ; }
- const AliEMCALTowerRecPoint * TowerRecPoint(Int_t index) {
- return static_cast<const AliEMCALTowerRecPoint *>(TowerRecPoints()->At(index)) ;}
- const AliEMCALTowerRecPoint * PreShowerRecPoint(Int_t index) {
- return static_cast<const AliEMCALTowerRecPoint *>(PreShowerRecPoints()->At(index)) ;}
-
- AliEMCALClusterizerv1 * Clusterizer (const char * name =0) const {
- return (AliEMCALClusterizerv1*)(ReturnT("Clusterizer", name)) ; }
-
- // TrackSegments
- //TClonesArray * TrackSegments(const char * name = 0) const
- // { return (TClonesArray*)(ReturnO("TrackSegments", name)) ; }
- //AliEMCALTrackSegmentMaker * TrackSegmentMaker (const char * name =0) const
- // { return (AliEMCALTrackSegmentMaker*)(ReturnT("TrackSegmentMaker", name)) ; }
-
- // RecParticles
- //TClonesArray * RecParticles(const char * name = 0) const
- // { return (TClonesArray*)(ReturnO("RecParticles", name)) ; }
- //AliEMCALPID * PID(const char * name =0) const
- // { return (AliEMCALPID*)(ReturnT("PID", name)) ; }
-
- // Primaries
- TTree * TreeK(TString filename="") ;
- const TParticle * Primary(Int_t index) const ;
- const Int_t NPrimaries()const { return fNPrimaries; }
+ return (dynamic_cast<TObjArray*>(ReturnO("PreShowerRecPoints", name))) ; }
+ const AliEMCALClusterizer * Clusterizer (const char * name =0) const {
+ return (const AliEMCALClusterizer*)(ReturnT("Clusterizer", name)) ;// here static or dynamic cast does not work ! why ?
+ }
+
+ //========== TrackSegments ==========
+ //TClonesArray * TrackSegments(const char * name = 0) const {
+ // return (dynamic_cast<TClonesArray*>(ReturnO("TrackSegments", name))) ; }
+ //const AliEMCALTrackSegmentMaker * TrackSegmentMaker (const char * name =0) const {
+ // return (const AliEMCALTrackSegmentMaker*)(ReturnT("TrackSegmentMaker", name)) ;// here static or dynamic cast does not work ! why }
+
+ //========== RecParticles ===========
+ //TClonesArray * RecParticles(const char * name = 0) const {
+ // return (dynamic_cast<TClonesArray*>(ReturnO("RecParticles", name))) ; }
+ //const AliEMCALPID * PID(const char * name =0) const {
+ // return (const AliEMCALPID*)(ReturnT("PID", name)) ;// here static or dynamic cast does not work ! why }
+ //-----------------Auxiliary methods: cleaners-----------------
void RemoveTask(TString opt, TString name) const ;
void RemoveObjects(TString opt, TString name) const ;
void RemoveSDigits() const ;
- void SetDebug(Int_t level) {fDebug = level;} // Set debug level
- AliEMCALGetter & operator = (const AliEMCALGetter & ) {
- // assignement operator requested by coding convention, but not needed
- abort() ;
- return *this ;
- }
-
+ //-----------------Auxiliary methods: miscellana-----------------
+ void CloseFile() ;
+ const TFolder * Folder(const TString what) const ;
+ const Bool_t HasFailed(void) const {return fFailed ;}
+ void ListBranches(Int_t event=0) const ;
+ void NewBranch(TString name, Int_t event = 0) ;
+ Bool_t NewFile(TString name) ;
TFolder * SDigitsFolder() { return dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("EMCAL")) ; }
-
+ void SetDebug(Int_t level) {fDebug = level;} // Set debug level
+ void SetRecParticlesTitle(const TString title) { fRecParticlesTitle = title ; }
+
+ //------------Auxiliary methods: Posters--------------------
+ const Bool_t PostPrimaries(void ) const ;
+ const Bool_t PostHits(void ) const ;
+ const Bool_t PostSDigits( const char * name, const char * file = 0) const ;
+ const Bool_t PostDigits( const char * name ) const ;
+ const Bool_t PostRecPoints( const char * name ) const ;
+ //const Bool_t PostTrackSegments(const char * name) const ;
+ //const Bool_t PostRecParticles( const char * name) const ;
+ const Bool_t PostClusterizer( const char * name) const ;
+ const Bool_t PostClusterizer(AliEMCALClusterizer * clu) const ;
+ const Bool_t PostSDigitizer (AliEMCALSDigitizer * sdigitizer) const ;
+ const Bool_t PostSDigitizer ( const char * name, const char * file ) const ;
+ const Bool_t PostDigitizer (AliEMCALDigitizer * digitizer) const ;
+ const Bool_t PostDigitizer ( const char * name) const ;
+ //const Bool_t PostTrackSegmentMaker(AliEMCALTrackSegmentMaker * tsm) const ;
+ //const Bool_t PostTrackSegmentMaker(const char * name ) const ;
+ //const Bool_t PostPID (AliEMCALPID * pid) const ;
+ //const Bool_t PostPID (const char * name ) const ;
+ //const Bool_t PostQA (void) const ;
+
private:
- AliEMCALGetter(const char* headerFile, const char* branchTitle ="Default", const Option_t * rw ="") ;
- void CreateWhiteBoard() const ;
+ AliEMCALGetter(const char* headerFile, const char* branchTitle ="Default", const Bool_t toSplit = kFALSE) ;
TObject * ReturnO(TString what, TString name=0, TString file=0) const ;
const TTask * ReturnT(TString what,TString name=0) const ;
void DefineBranchTitles(char* branch, char* branchTitle) ;
- void ReadTreeD() ;
- void ReadTreeH() ;
- void ReadTreeR() ;
- void ReadTreeS(Int_t event) ;
- //void ReadTreeQA() ;
- void ReadPrimaries() ;
+ Int_t ReadTreeD(const Int_t event) ;
+ Int_t ReadTreeH(void) ;
+ Int_t ReadTreeR(const Int_t event) ;
+ Int_t ReadTreeS(const Int_t event) ;
+ void ReadTreeQA(void) ;
+ void ReadPrimaries(void) ;
+ void CleanWhiteBoard(void) ;
+ void CloseSplitFiles(void) ;
+ void SetTitle(const char * title) ;
TObject ** PrimariesRef(void) const ;
TObject ** HitsRef(void) const ;
TObject ** SDigitsRef(const char * name, const char * file = 0 ) const;
TObject ** DigitsRef (const char * name) const ;
TObject ** TowerRecPointsRef (const char * name) const ;
- TObject ** PreShoRecPointsRef (const char * name) const ;
+ TObject ** PreShowerRecPointsRef (const char * name) const ;
//TObject ** TrackSegmentsRef(const char * name) const ;
//TObject ** RecParticlesRef (const char * name) const ;
//TObject ** AlarmsRef (void) const ;
private:
- static TFile * fFile ; //!
+ static TFile * fFile ; //!
+ Bool_t fToSplit ; //! Do we work in the split mode
TString fHeaderFile ; //! File in which gAlice lives
TString fBranchTitle ; //!
- //TString fTrackSegmentsTitle ;//!
+ TString fTrackSegmentsTitle ;//!
+ TString fTrackSegmentsFileName ;//!
TString fRecPointsTitle ; //!
- //TString fRecParticlesTitle ; //!
- TString fDigitsTitle ; //!
+ TString fRecPointsFileName ; //!
+ TString fRecParticlesTitle ; //!
+ TString fRecParticlesFileName ; //!
+ TString fDigitsTitle ; //!TDirectory tempo(gDirectory)
+ TString fDigitsFileName ; //! TDirectory tempo(gDirectory)
TString fSDigitsTitle ; //!
-
+ TString fSDigitsFileName ; //!
Bool_t fFailed ; //! true if file is not opened and/or galice not found
Int_t fDebug ; // Debug level
-
AliRun * fAlice ; //! needed to read TreeK if in an other file than fHeaderFile
- Int_t fNPrimaries ; //! # of primaries
-
+ Int_t fNPrimaries ; //! # of primaries
TObjArray * fPrimaries ; //! list of lists of primaries-for the case of mixing
-
TFolder * fModuleFolder ; //!Folder that contains the modules
TFolder * fPrimariesFolder ; //!Folder that contains the Primary Particles
TFolder * fHitsFolder ; //!Folder that contains the Hits
TFolder * fSDigitsFolder ; //!Folder that contains the SDigits
TFolder * fDigitsFolder ; //!Folder that contains the Digits
TFolder * fRecoFolder ; //!Folder that contains the reconstructed objects (RecPoints, TrackSegments, RecParticles)
- //TFolder * fQAFolder ; //!Folder that contains the QA objects
+ TFolder * fQAFolder ; //!Folder that contains the QA objects
TFolder * fTasksFolder ; //!Folder that contains the Tasks (sdigitizer, digitizer, reconstructioner)
static AliEMCALGetter * fgObjGetter; // pointer to the unique instance of the singleton
// YS Subatech Mai 2002
-// YK Subatech 7 Aug 2002
+// YK Subatech 6 Aug 2002
// EMCAL Reconstruction chain:
-// Hits -> SDigits -> Digits -> RecPoints
+// Hits -> SDigits -> Digits -> RecPoints -> TrackSegments -> RecParticles
//Root
#include "TString.h"
#include "EMCAL/AliEMCALSDigitizer.h"
#include "EMCAL/AliEMCALDigitizer.h"
#include "EMCAL/AliEMCALClusterizerv1.h"
+// #include "EMCAL/AliEMCALTrackSegmentMakerv1.h"
+// #include "EMCAL/AliEMCALPIDv1.h"
void EMCALHits2SDigits( Bool_t split=kFALSE, TString fileName = "galice.root") {
//root [1] SDigits2Digits()
// 2. write SDigits in a separate file, one per detector, from Hits --------------- (OK)
//root [0] .L Reconstruct.C++
- //root [1] SDigits2Digits(kTRUE) // SDigits saved in [DET}.SDigits.root (DET=PHOS, EMCAL)
+ //root [1] SDigits2Digits(kTRUE) // SDigits saved in [DET}.SDigits.root (DET=EMCAL, EMCAL)
delete gAlice ;
gAlice = 0 ;
- AliEMCALSDigitizer * sde = new AliEMCALSDigitizer(fileName) ;
+ AliEMCALSDigitizer * sdp = new AliEMCALSDigitizer(fileName) ;
if (split)
- sde->SetSplitFile() ;
- sde->ExecuteTask("deb") ;
-
- delete sde ;
+ sdp->SetSplitFile() ;
+ sdp->ExecuteTask("deb") ;
+ delete sdp ;
}
//________________________________________________________________________
//root [1] SDigits2Digits()
// 2. write SDigits in a separate file, one per detector, from SDigits --------------- (OK)
//root [0] .L Reconstruct.C++
- //root [1] SDigitsDigits(kTRUE) // Digits saved in [DET}.Digits.root (DET=PHOS, EMCAL)
+ //root [1] SDigitsDigits(kTRUE) // Digits saved in [DET}.Digits.root (DET=EMCAL, EMCAL)
delete gAlice ;
gAlice = 0 ;
- AliEMCALDigitizer * de = 0 ;
-
+ // EMCAL
+ AliEMCALDigitizer * dp = 0 ;
+
if (split) {
- de = new AliEMCALDigitizer("EMCAL.SDigits.root") ;
- de->SetSplitFile() ;
- } else
- de = new AliEMCALDigitizer(fileName) ;
+ dp = new AliEMCALDigitizer("EMCAL.SDigits.root") ;
+ dp->SetSplitFile() ; }
+ else
+ dp = new AliEMCALDigitizer(fileName) ;
- de->ExecuteTask("deb") ;
+ dp->ExecuteTask("deb") ;
- delete de ;
+ delete dp ;
}
//________________________________________________________________________
//root [1] Digits2RecPoints()
// 2. write RecPoints in a separate file, one per detector, from Digits --------------- OK
//root [0] .L Reconstruct.C++
- //root [1] Digits2RecPoints(kTRUE) // RecPoints saved in [DET}.RecPoints.root (DET=PHOS, EMCAL)
+ //root [1] Digits2RecPoints(kTRUE) // RecPoints saved in [DET}.RecPoints.root (DET=EMCAL, EMCAL)
delete gAlice ;
gAlice = 0 ;
- AliEMCALClusterizerv1 * ce = 0 ;
-
+ AliEMCALClusterizer * cp = 0 ;
+
if (split) {
- ce = new AliEMCALClusterizerv1("EMCAL.Digits.root") ;
- ce->SetSplitFile() ;
- } else
- ce = new AliEMCALClusterizerv1(fileName) ;
+ cp = new AliEMCALClusterizerv1("EMCAL.Digits.root") ;
+ cp->SetSplitFile() ; }
+ else
+ cp = new AliEMCALClusterizerv1(fileName) ;
- ce->ExecuteTask("deb") ;
+ cp->ExecuteTask("deb") ;
- delete ce ;
+ delete cp ;
}
+// //________________________________________________________________________
+// void EMCALRecPoints2TrackSegments( Bool_t split=kFALSE, TString fileName = "galice.root") {
+
+// // usage :
+// // 1. write TrackSegments in the same file as RecPoints --------------- (OK)
+// //root [0] .L Reconstruct.C++
+// //root [1] RecPoints2TrackSegments()
+// // 2. write TrackSegments in a separate file, one per detector, from RecPoints --------------- (Not needed)
+// //root [0] .L Reconstruct.C++
+// //root [1] RecPoints2TrackSegments(kTRUE) // TrackSegments saved in [DET}.RecData.root (DET=EMCAL, EMCAL)
+
+// delete gAlice ;
+// gAlice = 0 ;
+
+// AliEMCALTrackSegmentMaker * tmp = 0 ;
+
+// if (split)
+// tmp = new AliEMCALTrackSegmentMakerv1("EMCAL.RecData.root") ;
+// else
+// tmp = new AliEMCALTrackSegmentMakerv1(fileName) ;
+
+// tmp->ExecuteTask("deb") ;
+
+// delete tmp ;
+// }
+
+// //________________________________________________________________________
+// void EMCALTrackSegments2RecParticles( Bool_t split=kFALSE, TString fileName = "galice.root") {
+
+// // usage :
+// // 1. write RecParticles in the same file as TrackSegments --------------- (OK)
+// //root [0] .L Reconstruct.C++
+// //root [1] TrackSegments2RecParticles()
+// // 2. write RecParticles in a separate file, one per detector, from TrackSegments --------------- (Not needed)
+// //root [0] .L Reconstruct.C++
+// //root [1] TrackSegments2RecParticles(kTRUE) // RecParticles saved in [DET}.RecData.root (DET=EMCAL, EMCAL)
+
+// delete gAlice ;
+// gAlice = 0 ;
+
+// AliEMCALPID * pp = 0 ;
+
+// if (split)
+// pp = new AliEMCALPIDv1("EMCAL.RecData.root") ;
+// else
+// pp = new AliEMCALPIDv1(fileName) ;
+
+// pp->ExecuteTask("deb") ;
+
+// delete pp ;
+// }
+
+// //________________________________________________________________________
+// void EMCALDigits2RecParticles( Bool_t split=kFALSE, TString fileName = "galice.root") {
+
+// // usage :
+// // 1. write RecPoints, TrackSegments and RecParticles in the same file as Digits --------------- (OK)
+// //root [0] .L Reconstruct.C++
+// //root [1] Digits2RecParticles()
+// // 2. write RecPoints , TrackSegments and RecParticles in a separate file, one per detector, from Digits --------------- (OK)
+// //root [0] .L Reconstruct.C++
+// //root [1] Digits2RecParticles(kTRUE) // TrackSegments saved in [DET}.RecData.root (DET=EMCAL, EMCAL)
+
+
+// delete gAlice ;
+// gAlice = 0 ;
+
+// // EMCAL
+// AliEMCALClusterizer * cp = 0 ;
+
+// if (split) {
+// cp = new AliEMCALClusterizerv1("EMCAL.Digits.root") ;
+// cp->SetSplitFile() ; }
+// else
+// cp = new AliEMCALClusterizerv1(fileName) ;
+
+// cp->ExecuteTask("deb") ;
+
+// if (split)
+// delete cp ;
+
+// AliEMCALTrackSegmentMaker * tmp = 0 ;
+
+// if (split)
+// tmp = new AliEMCALTrackSegmentMakerv1("EMCAL.RecData.root") ;
+// else
+// tmp = new AliEMCALTrackSegmentMakerv1(fileName) ;
+
+// tmp->ExecuteTask("deb") ;
+
+// AliEMCALPID * pp = 0 ;
+
+// if (split)
+// pp = new AliEMCALPIDv1("EMCAL.RecData.root") ;
+// else
+// pp = new AliEMCALPIDv1(fileName) ;
+
+// pp->ExecuteTask("deb") ;
+
+// delete tmp;
+// delete pp ;
+// }
+
//________________________________________________________________________
void EMCALHits2Digits (Bool_t split=kFALSE, TString fileName = "galice.root") {
// usage :
//root [1] Hits2Digits()
// 2. write (S)Digits in a separate file, one per detector, from Hits --------------- (OK)
//root [0] .L Reconstruct.C++
- //root [1] Hits2Digits(kTRUE) // SDigits saved in [DET}.SDigits.root (DET=PHOS, EMCAL)
- // Digits saved in [DET}.Digits.root (DET=PHOS, EMCAL)
+ //root [1] Hits2Digits(kTRUE) // SDigits saved in [DET}.SDigits.root (DET=EMCAL, EMCAL)
+ // Digits saved in [DET}.Digits.root (DET=EMCAL, EMCAL)
delete gAlice ;
gAlice = 0 ;
//EMCAL
- AliEMCALSDigitizer * sde = new AliEMCALSDigitizer(fileName) ;
+ AliEMCALSDigitizer * sdp = new AliEMCALSDigitizer(fileName) ;
if (split)
- sde->SetSplitFile() ;
- sde->ExecuteTask("deb") ;
-
- delete sde ;
-
- AliEMCALDigitizer * de = 0 ;
+ sdp->SetSplitFile() ;
+ sdp->ExecuteTask("deb") ;
+
+ if (split)
+ delete sdp ;
+
+ AliEMCALDigitizer * dp = 0 ;
+
if (split) {
- de = new AliEMCALDigitizer("EMCAL.SDigits.root") ;
- de->SetSplitFile() ;
- } else
- de = new AliEMCALDigitizer(fileName) ;
-
- de->ExecuteTask("deb") ;
+ dp = new AliEMCALDigitizer("EMCAL.SDigits.root") ;
+ dp->SetSplitFile() ; }
+ else
+ dp = new AliEMCALDigitizer(fileName) ;
- delete de ;
+ dp->ExecuteTask("deb") ;
+
+ if (split)
+ delete dp ;
+ if (!split) {
+ delete sdp ;
+ delete dp ;
+ }
}
* provided "as is" without express or implied warranty. *
**************************************************************************/
+
/* $Id$ */
//_________________________________________________________________________
//
//*-- Author : Sahal Yacoob (LBL)
// based on : AliPHOSSDigitzer
+// Modif:
+// August 2002 Yves Schutz: clone PHOS as closely as possible and intoduction
+// of new IO (à la PHOS)
//////////////////////////////////////////////////////////////////////////////
#include "TSystem.h"
#include "TROOT.h"
#include "TFolder.h"
-#include "TGeometry.h"
#include "TBenchmark.h"
+#include "TGeometry.h"
+
// --- Standard library ---
#include <iomanip.h>
#include "AliRun.h"
#include "AliHeader.h"
#include "AliEMCALDigit.h"
-#include "AliEMCALHit.h"
-#include "AliEMCALSDigitizer.h"
#include "AliEMCALGeometry.h"
-#include "AliEMCALv1.h"
#include "AliEMCALGetter.h"
+#include "AliEMCALHit.h"
+#include "AliEMCALSDigitizer.h"
ClassImp(AliEMCALSDigitizer)
}
//____________________________________________________________________________
-AliEMCALSDigitizer::AliEMCALSDigitizer(const char* headerFile, const char *sDigitsTitle):TTask(sDigitsTitle, headerFile)
+AliEMCALSDigitizer::AliEMCALSDigitizer(const char* headerFile, const char *sDigitsTitle, const Bool_t toSplit):
+TTask(sDigitsTitle, headerFile)
{
// ctor
InitParameters() ;
+ fToSplit = toSplit ;
Init();
fDefaultInit = kFALSE ;
}
AliEMCALSDigitizer::~AliEMCALSDigitizer()
{
// dtor
- // fDefaultInit = kTRUE if SDigitizer created by default ctor (to get just the parameters)
-
- if (!fDefaultInit) {
- AliEMCALGetter * gime = AliEMCALGetter::GetInstance() ;
-
- // remove the task from the folder list
- gime->RemoveTask("S",GetName()) ;
-
- TString name(GetName()) ;
- if (! name.IsNull() )
- if (name.Index(":") > 0)
- name.Remove(name.Index(":")) ;
-
- // remove the Hits from the folder list
- gime->RemoveObjects("H",name) ;
-
- // remove the SDigits from the folder list
- gime->RemoveObjects("S", name) ;
-
- // Close the root file
- gime->CloseFile() ;
-
- }
+
fSplitFile = 0 ;
}
if( strcmp(GetTitle(), "") == 0 )
SetTitle("galice.root") ;
- AliEMCALGetter * gime = AliEMCALGetter::GetInstance(GetTitle(), GetName(), "update") ;
+ AliEMCALGetter * gime = AliEMCALGetter::GetInstance(GetTitle(), GetName(), fToSplit) ;
if ( gime == 0 ) {
- cerr << "ERROR: AliEMCALSDigitizer::Init -> Could not obtain the Getter object !" << endl ;
+ cerr << "ERROR: AliEMCALSDigitizer::Init -> Could not obtain the Getter object !"
+ << endl ;
return ;
}
gime->PostSDigits( GetName(), GetTitle() ) ;
+
+ fSplitFile = 0 ;
+ if(fToSplit){
+ // construct the name of the file as /path/EMCAL.SDigits.root
+ // First - extract full path if necessary
+ TString sDigitsFileName(GetTitle()) ;
+ Ssiz_t islash = sDigitsFileName.Last('/') ;
+ if(islash<sDigitsFileName.Length())
+ sDigitsFileName.Remove(islash+1,sDigitsFileName.Length()) ;
+ else
+ sDigitsFileName="" ;
+ // Next - append the file name
+ sDigitsFileName+="EMCAL.SDigits." ;
+ if((strcmp(GetName(),"Default")!=0)&&(strcmp(GetName(),"")!=0)){
+ sDigitsFileName+=GetName() ;
+ sDigitsFileName+="." ;
+ }
+ sDigitsFileName+="root" ;
+ // Finally - check if the file already opened or open the file
+ fSplitFile = static_cast<TFile*>(gROOT->GetFile(sDigitsFileName.Data()));
+ if(!fSplitFile)
+ fSplitFile = TFile::Open(sDigitsFileName.Data(),"update") ;
+ }
TString sdname(GetName() );
sdname.Append(":") ;
sdname.Append(GetTitle() ) ;
- SetName(sdname.Data()) ;
+ SetName(sdname) ;
gime->PostSDigitizer(this) ;
-
-
}
//____________________________________________________________________________
void AliEMCALSDigitizer::InitParameters(){
- fA = 0;
- fB = 10000000.;
- fTowerPrimThreshold = 0.01 ;
+ fA = 0;
+ fB = 10000000.;
+ fTowerPrimThreshold = 0.01 ;
fPreShowerPrimThreshold = 0.0001 ;
- fNevents = 0 ;
- fPhotonElectronFactor = 5000. ; // photoelectrons per GeV
- fSplitFile = 0 ;
-
+ fPhotonElectronFactor = 5000. ; // photoelectrons per GeV
+ fSplitFile = 0 ;
+ fToSplit = kFALSE ;
}
//____________________________________________________________________________
if(strstr(option,"tim"))
gBenchmark->Start("EMCALSDigitizer");
-
//Check, if this branch already exits
- gAlice->GetEvent(0) ;
-
+ AliEMCALGetter * gime = AliEMCALGetter::GetInstance() ;
+ if(gime->BranchExists("SDigits") )
+ return;
+
TString sdname(GetName()) ;
sdname.Remove(sdname.Index(GetTitle())-1) ;
- if(gAlice->TreeS() ) {
- TObjArray * lob = static_cast<TObjArray*>(gAlice->TreeS()->GetListOfBranches()) ;
- TIter next(lob) ;
- TBranch * branch = 0 ;
- Bool_t emcalfound = kFALSE, sdigitizerfound = kFALSE ;
-
- while ( (branch = (static_cast<TBranch*>(next()))) && (!emcalfound || !sdigitizerfound) ) {
- TString thisName( GetName() ) ;
- TString branchName( branch->GetTitle() ) ;
- branchName.Append(":") ;
- if ( (strcmp(branch->GetName(), "EMCAL")==0) && thisName.BeginsWith(branchName) )
- emcalfound = kTRUE ;
-
- else if ( (strcmp(branch->GetName(), "AliEMCALSDigitizer")==0) && thisName.BeginsWith(branchName) )
- sdigitizerfound = kTRUE ;
- }
-
- if ( emcalfound || sdigitizerfound ) {
- cerr << "WARNING: AliEMCALSDigitizer::Exec -> SDigits and/or SDigitizer branch with name " << GetName()
- << " already exits" << endl ;
- return ;
- }
- }
-
- AliEMCALGetter * gime = AliEMCALGetter::GetInstance() ;
- Int_t nevents = (Int_t) gAlice->TreeE()->GetEntries() ;
-
+ Int_t nevents = gime->MaxEvent() ;
Int_t ievent ;
for(ievent = 0; ievent < nevents; ievent++){
gime->Event(ievent,"H") ;
- const TClonesArray * fHits = gime->Hits() ;
+ const TClonesArray * hits = gime->Hits() ;
TClonesArray * sdigits = gime->SDigits(sdname.Data()) ;
sdigits->Clear();
Int_t nSdigits = 0 ;
- //Collects all hits in the same active volume into digit
-
-
-
+ //Collects all hits in the same active volume into digit
- //Now made SDigits from hits, for EMCAL it is the same, so just copy
- // Int_t itrack ;
- // for (itrack=0; itrack < gAlice->GetNtrack(); itrack++){
- //gime->Track(itrack);
- //=========== Get the EMCAL branch from Hits Tree for the Primary track itrack
-
- Int_t i;
- for ( i = 0 ; i < fHits->GetEntries() ; i++ ) { // loop over all hits (hit = deposited energy/layer/entering particle)
- AliEMCALHit * hit = dynamic_cast<AliEMCALHit*>(fHits->At(i)) ;
- AliEMCALDigit * curSDigit = 0 ;
- AliEMCALDigit * sdigit = 0 ;
- Bool_t newsdigit = kTRUE;
-
-
-
- // Assign primary number only if deposited energy is significant
-
- if( (!hit->IsInPreShower() && hit->GetEnergy() > fTowerPrimThreshold) ||
- (hit->IsInPreShower() && hit->GetEnergy() > fPreShowerPrimThreshold)) {
- curSDigit = new AliEMCALDigit( hit->GetPrimary(),
- hit->GetIparent(),Layer2TowerID(hit->GetId(),hit->IsInPreShower()),
- Digitize(hit->GetEnergy()),
- hit->GetTime()) ;
- } else {
- curSDigit = new AliEMCALDigit( -1 ,
- -1 ,
- Layer2TowerID(hit->GetId(),hit->IsInPreShower()),
- Digitize(hit->GetEnergy()),
- hit->GetTime() ) ;
- }
- Int_t check = 0 ;
- for(check= 0; check < nSdigits ; check++) {
- sdigit = (AliEMCALDigit *)sdigits->At(check);
- if( sdigit->GetId() == curSDigit->GetId()) { // Are we in the same tower or the same preshower ?
- *sdigit = *sdigit + *curSDigit;
+ //Now make SDigits from hits, for EMCAL it is the same, so just copy
+ Int_t nPrim = static_cast<Int_t>((gAlice->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 EMCAL branch from Hits Tree for the Primary iprim
+ gime->Track(iprim) ;
+ Int_t i;
+ for ( i = 0 ; i < hits->GetEntries() ; i++ ) {
+ AliEMCALHit * hit = dynamic_cast<AliEMCALHit*>(hits->At(i)) ;
+ AliEMCALDigit * curSDigit = 0 ;
+ AliEMCALDigit * sdigit = 0 ;
+ Bool_t newsdigit = kTRUE;
+ // Assign primary number only if deposited energy is significant
+ if( (!hit->IsInPreShower() && hit->GetEnergy() > fTowerPrimThreshold) ||
+ (hit->IsInPreShower() && hit->GetEnergy() > fPreShowerPrimThreshold))
+ curSDigit = new AliEMCALDigit( hit->GetPrimary(),
+ hit->GetIparent(),Layer2TowerID(hit->GetId(),hit->IsInPreShower()),
+ Digitize(hit->GetEnergy()), hit->GetTime() ) ;
+ else
+ curSDigit = new AliEMCALDigit( -1 ,
+ -1 ,
+ Layer2TowerID(hit->GetId(),hit->IsInPreShower()),
+ Digitize(hit->GetEnergy()), hit->GetTime() ) ;
+ Int_t check = 0 ;
+ for(check= 0; check < nSdigits ; check++) {
+ sdigit = dynamic_cast<AliEMCALDigit *>(sdigits->At(check)) ;
+ if( sdigit->GetId() == curSDigit->GetId()) { // Are we in the same tower or the same preshower ?
+ *sdigit = *sdigit + *curSDigit;
newsdigit = kFALSE;
+ }
}
- }
- if (newsdigit) {
- new((*sdigits)[nSdigits]) AliEMCALDigit(*curSDigit);
- nSdigits++ ;
- }
- } // loop over all hits (hit = deposited energy/layer/entering particle)
- // } // loop over tracks
+ if (newsdigit) {
+ new((*sdigits)[nSdigits]) AliEMCALDigit(*curSDigit);
+ nSdigits++ ;
+ }
+ } // loop over all hits (hit = deposited energy/layer/entering particle)
+ } // loop over iprim
sdigits->Sort() ;
nSdigits = sdigits->GetEntriesFast() ;
- if (nSdigits > 0) {
- sdigits->Expand(nSdigits) ;
-
- // Int_t i ;
- const AliEMCALGeometry * geom = gime->EMCALGeometry() ;
+ fSDigitsInRun += nSdigits ;
+ sdigits->Expand(nSdigits) ;
- Int_t lastPreShowerIndex = nSdigits - 1 ;
- if (!(dynamic_cast<AliEMCALDigit *>(sdigits->At(lastPreShowerIndex))->IsInPreShower()))
- lastPreShowerIndex = -2;
- Int_t firstPreShowerIndex = 100000 ;
- Int_t index ;
- AliEMCALDigit * sdigit = 0 ;
- for ( index = 0; index < nSdigits ; index++) {
- sdigit = dynamic_cast<AliEMCALDigit *>(sdigits->At(index) ) ;
- if (sdigit->IsInPreShower() ){
- firstPreShowerIndex = index ;
- break ;
- }
+ const AliEMCALGeometry * geom = gime->EMCALGeometry() ;
+
+ Int_t lastPreShowerIndex = nSdigits - 1 ;
+ if (!(dynamic_cast<AliEMCALDigit *>(sdigits->At(lastPreShowerIndex))->IsInPreShower()))
+ lastPreShowerIndex = -2;
+ Int_t firstPreShowerIndex = 100000 ;
+ Int_t index ;
+ AliEMCALDigit * sdigit = 0 ;
+ for ( index = 0; index < nSdigits ; index++) {
+ sdigit = dynamic_cast<AliEMCALDigit *>(sdigits->At(index) ) ;
+ if (sdigit->IsInPreShower() ){
+ firstPreShowerIndex = index ;
+ break ;
}
+ }
- AliEMCALDigit * preshower ;
- AliEMCALDigit * tower ;
- Int_t lastIndex = lastPreShowerIndex +1 ;
-
-
- for (index = firstPreShowerIndex ; index <= lastPreShowerIndex; index++) {
- preshower = dynamic_cast<AliEMCALDigit *>(sdigits->At(index) );
- Bool_t towerFound = kFALSE ;
- Int_t jndex ;
- for (jndex = 0; jndex < firstPreShowerIndex; jndex++) {
- tower = dynamic_cast<AliEMCALDigit *>(sdigits->At(jndex) );
- if ( (preshower->GetId() - (geom->GetNZ() * geom->GetNPhi()) ) == tower->GetId() ) {
- Float_t towerEnergy = static_cast<Float_t>(tower->GetAmp()) ;
- Float_t preshoEnergy = static_cast<Float_t>(preshower->GetAmp()) ;
- towerEnergy +=preshoEnergy ;
- *tower = *tower + *preshower ; // and add preshower multiplied by layer ratio to tower
- tower->SetAmp(static_cast<Int_t>(TMath::Ceil(towerEnergy))) ;
- towerFound = kTRUE ;
- }
- }
- if ( !towerFound ) {
-
- new((*sdigits)[lastIndex]) AliEMCALDigit(*preshower);
- AliEMCALDigit * temp = dynamic_cast<AliEMCALDigit *>(sdigits->At(lastIndex)) ;
- temp->SetId(temp->GetId() - (geom->GetNZ() * geom->GetNPhi()) ) ;
- lastIndex++ ;
+ AliEMCALDigit * preshower ;
+ AliEMCALDigit * tower ;
+ Int_t lastIndex = lastPreShowerIndex +1 ;
+
+ for (index = firstPreShowerIndex ; index <= lastPreShowerIndex; index++) {
+ preshower = dynamic_cast<AliEMCALDigit *>(sdigits->At(index) );
+ Bool_t towerFound = kFALSE ;
+ Int_t jndex ;
+ for (jndex = 0; jndex < firstPreShowerIndex; jndex++) {
+ tower = dynamic_cast<AliEMCALDigit *>(sdigits->At(jndex) );
+ if ( (preshower->GetId() - (geom->GetNZ() * geom->GetNPhi()) ) == tower->GetId() ) {
+ Float_t towerEnergy = static_cast<Float_t>(tower->GetAmp()) ;
+ Float_t preshoEnergy = static_cast<Float_t>(preshower->GetAmp()) ;
+ towerEnergy +=preshoEnergy ;
+ *tower = *tower + *preshower ; // and add preshower multiplied by layer ratio to tower
+ tower->SetAmp(static_cast<Int_t>(TMath::Ceil(towerEnergy))) ;
+ towerFound = kTRUE ;
}
}
-
- sdigits->Sort() ;
- Int_t NPrimarymax = -1 ;
- for (i = 0 ; i < sdigits->GetEntriesFast() ; i++) {
- sdigit = dynamic_cast<AliEMCALDigit *>(sdigits->At(i)) ;
- sdigit->SetIndexInList(i) ;
- }
-
- for (i = 0 ; i < sdigits->GetEntriesFast() ; i++) {
- if (((dynamic_cast<AliEMCALDigit *>(sdigits->At(i)))->GetNprimary()) > NPrimarymax)
- NPrimarymax = ((dynamic_cast<AliEMCALDigit *>(sdigits->At(i)))->GetNprimary()) ;
+ if ( !towerFound ) {
+
+ new((*sdigits)[lastIndex]) AliEMCALDigit(*preshower);
+ AliEMCALDigit * temp = dynamic_cast<AliEMCALDigit *>(sdigits->At(lastIndex)) ;
+ temp->SetId(temp->GetId() - (geom->GetNZ() * geom->GetNPhi()) ) ;
+ lastIndex++ ;
}
}
- if(gAlice->TreeS() == 0)
- gAlice->MakeTree("S",fSplitFile);
-
+
+ sdigits->Sort() ;
+ Int_t NPrimarymax = -1 ;
+ Int_t i ;
+ for (i = 0 ; i < sdigits->GetEntriesFast() ; i++) {
+ sdigit = dynamic_cast<AliEMCALDigit *>(sdigits->At(i)) ;
+ sdigit->SetIndexInList(i) ;
+ }
+
+ for (i = 0 ; i < sdigits->GetEntriesFast() ; i++) {
+ if (((dynamic_cast<AliEMCALDigit *>(sdigits->At(i)))->GetNprimary()) > NPrimarymax)
+ NPrimarymax = ((dynamic_cast<AliEMCALDigit *>(sdigits->At(i)))->GetNprimary()) ;
+ }
+
+ //Now write SDigits
+
+ if(gAlice->TreeS() == 0 || (fSplitFile)) //<--- To be checked: we should not create TreeS if it is already here
+ gAlice->MakeTree("S",fSplitFile);
+
+ if(fSplitFile)
+ fSplitFile->cd() ;
+
//First list of sdigits
Int_t bufferSize = 32000 ;
TBranch * sdigitsBranch = gAlice->TreeS()->Branch("EMCAL",&sdigits,bufferSize);
sdigitsBranch->SetTitle(sdname);
- //second - SDigitizer
+ //NEXT - SDigitizer
Int_t splitlevel = 0 ;
AliEMCALSDigitizer * sd = this ;
TBranch * sdigitizerBranch = gAlice->TreeS()->Branch("AliEMCALSDigitizer","AliEMCALSDigitizer",
sdigitsBranch->Fill() ;
sdigitizerBranch->Fill() ;
gAlice->TreeS()->AutoSave() ;
-
+
if(strstr(option,"deb"))
PrintSDigits(option) ;
}
-
+
if(strstr(option,"tim")){
gBenchmark->Stop("EMCALSDigitizer");
cout << "AliEMCALSDigitizer:" << endl ;
cout << " took " << gBenchmark->GetCpuTime("EMCALSDigitizer") << " seconds for SDigitizing "
- << gBenchmark->GetCpuTime("EMCALSDigitizer")/fNevents << " seconds per event " << endl ;
+ << gBenchmark->GetCpuTime("EMCALSDigitizer") << " seconds per event " << endl ;
cout << endl ;
- }
-
-
+ }
}
+
//__________________________________________________________________
void AliEMCALSDigitizer::SetSDigitsBranch(const char * title ){
// Post to the WhiteBoard
AliEMCALGetter * gime = AliEMCALGetter::GetInstance() ;
gime->PostSDigits( title, GetTitle()) ;
-
-
}
-//__________________________________________________________________
-void AliEMCALSDigitizer::SetSplitFile(const TString splitFileName)
-{
- // Diverts the SDigits in a file separate from the hits file
-
- TDirectory * cwd = gDirectory ;
-
- if ( !(gAlice->GetTreeSFileName() == splitFileName) ) {
- if (gAlice->GetTreeSFile() )
- gAlice->GetTreeSFile()->Close() ;
- }
-
- fSplitFile = gAlice->InitTreeFile("S",splitFileName.Data());
- fSplitFile->cd() ;
- gAlice->Write(0, TObject::kOverwrite);
-
- TTree *treeE = gAlice->TreeE();
- if (!treeE) {
- cerr << "ERROR: AliEMCALSDigitizer::SetSPlitFile -> No TreeE found "<<endl;
- abort() ;
- }
-
- // copy TreeE
-
- AliHeader *header = new AliHeader();
- treeE->SetBranchAddress("Header", &header);
- treeE->SetBranchStatus("*",1);
- TTree *treeENew = treeE->CloneTree();
- treeENew->Write(0, TObject::kOverwrite);
-
- // copy AliceGeom
- TGeometry *AliceGeom = static_cast<TGeometry*>(cwd->Get("AliceGeom"));
- if (!AliceGeom) {
- cerr << "ERROR: AliEMCALSDigitizer::SetSPlitFile -> AliceGeom was not found in the input file "<<endl;
- abort() ;
- }
- AliceGeom->Write(0, TObject::kOverwrite) ;
-
- gAlice->MakeTree("S",fSplitFile);
- cwd->cd() ;
- cout << "INFO: AliEMCALSDigitizer::SetSPlitFile -> SDigits will be stored in " << splitFileName.Data() << endl ;
-}
//__________________________________________________________________
-void AliEMCALSDigitizer::Print(Option_t* option)const{
+void AliEMCALSDigitizer::Print(Option_t* option)const
+{
+ // Prints parameters of SDigitizer
+
cout << "------------------- "<< GetName() << " -------------" << endl ;
cout << " Writing SDigitis to branch with title " << GetName() << endl ;
cout << " with digitization parameters A = " << fA << endl ;
cout << "---------------------------------------------------"<<endl ;
}
+
//__________________________________________________________________
-Bool_t AliEMCALSDigitizer::operator==( AliEMCALSDigitizer const &sd )const{
+Bool_t AliEMCALSDigitizer::operator==( AliEMCALSDigitizer const &sd )const
+{
+ // Equal operator.
+ // SDititizers are equal if their pedestal, slope and threshold are equal
+
if( (fA==sd.fA)&&(fB==sd.fB)&&
(fTowerPrimThreshold==sd.fTowerPrimThreshold) &&
(fPreShowerPrimThreshold==sd.fPreShowerPrimThreshold))
cout << "SDigit Id " << " Amplitude " << " Time " << " Index " << " Nprim " << " Primaries list " << endl;
Int_t index ;
for (index = 0 ; index < sdigits->GetEntries() ; index++) {
- digit = (AliEMCALDigit * ) sdigits->At(index) ;
+ digit = dynamic_cast<AliEMCALDigit *>( sdigits->At(index) ) ;
cout << setw(6) << digit->GetId() << " " << setw(10) << digit->GetAmp() << " " << digit->GetTime()
<< setw(6) << digit->GetIndexInList() << " "
<< setw(5) << digit->GetNprimary() <<" ";
cout <<endl;
}
}
+
//________________________________________________________________________
-Int_t AliEMCALSDigitizer::Layer2TowerID(Int_t ihit, Bool_t preshower){
+const Int_t AliEMCALSDigitizer::Layer2TowerID(Int_t ihit, Bool_t preshower)
+{
// Method to Transform from Hit Id to Digit Id
// This function should be one to one
AliEMCALGetter * gime = AliEMCALGetter::GetInstance() ;
// }
// }
// }
+
+//____________________________________________________________________________
+void AliEMCALSDigitizer::UseHitsFrom(const char * filename)
+{
+ SetTitle(filename) ;
+ Init() ;
+}
//*-- Author: Sahal Yacoob (LBL)
// based on : AliPHOSSDigitizer
//_________________________________________________________________________
-
-
+//
+// Modif:
+// August 2002 Yves Schutz: clone PHOS as closely as possible and intoduction
+// of new IO (à la PHOS)
+
// --- ROOT system ---
#include "TTask.h"
#include "TString.h"
public:
AliEMCALSDigitizer() ; // ctor
- AliEMCALSDigitizer(const char* HeaderFile,const char *SdigitsTitle = "Default") ;
+ AliEMCALSDigitizer(const char* headerFile,const char* hdigitsTitle = "Default", const Bool_t toSplit = kFALSE) ;
virtual ~AliEMCALSDigitizer() ; // dtor
Float_t Calibrate(Int_t amp)const {return (amp - fA)/fB ; }
Int_t Digitize(Float_t Energy)const { return (Int_t ) ( fA + Energy*fB); }
-
- // void TestTowerID(void) ;
virtual void Exec(Option_t *option);
-
- Float_t GetPedestalParameter()const {return fA;}
- Float_t GetCalibrationParameter()const{return fB;}
- char * GetSDigitsBranch()const{return (char*) fSDigitsTitle.Data();}
- void SetSplitFile(const TString splitFileName = "EMCAL.SDigits.root" ) ;
- virtual void Print(Option_t* option) const ;
-
- void SetPedestalParameter(Float_t A){fA = A ;}
- void SetSlopeParameter(Float_t B){fB = B ;}
- void SetSDigitsBranch(const char * title ) ;
-
- Bool_t operator == (const AliEMCALSDigitizer & sd) const ;
- Int_t Segment2TowerID(Int_t SegmentID){
- return Layer2TowerID(SegmentID,kFALSE);
+ const char * GetSDigitsBranch()const{return GetName();}
+ const Int_t GetSDigitsInRun() const {return fSDigitsInRun ;}
+ const Float_t GetPedestalParameter()const {return fA;}
+ const Float_t GetCalibrationParameter()const{return fB;}
+ virtual void Print(Option_t* option) const ;
+ void SetSDigitsBranch(const char * title ) ;
+ void SetPedestalParameter(Float_t A){fA = A ;}
+ void SetSlopeParameter(Float_t B){fB = B ;}
+ void UseHitsFrom(const char * filename) ;
+ Bool_t operator == (const AliEMCALSDigitizer & sd) const ;
+ const Int_t Segment2TowerID(Int_t SegmentID){
+ return Layer2TowerID(SegmentID,kFALSE);
}
private:
void Init() ;
void InitParameters() ;
void PrintSDigits(Option_t * option) ;
- Int_t Layer2TowerID(Int_t,Bool_t) ;
+ const Int_t Layer2TowerID(Int_t,Bool_t) ;
private:
- Float_t fA ; //Pedestal parameter
- Float_t fB ; //Slope Digitizition parameters
+ Float_t fA ; // Pedestal parameter
+ Float_t fB ; // Slope Digitizition parameters
Float_t fPhotonElectronFactor ; // number of photon electrons per GeV
- // should be calculated independently for each layer as :
- // LightYield*LightCollectionEfficiency*LightAttenuation*APDPhotoElectronEfficiency*APDGain
-
- Bool_t fDefaultInit; //! Says if the task was created by defaut ctor (only parameters are initialized)
- Int_t fNevents ; // Number of events to digitize
- Float_t fTowerPrimThreshold ; // To store primary in Tower if Elos > threshold
- Float_t fPreShowerPrimThreshold ; // To store primary if Pre Shower Elos > threshold
- TString fSDigitsTitle ; // title of SDigits branch
- TString fHeadersFile ; //input file
- Bool_t fIsInitialized ;
- TClonesArray * fSDigits ; //! list of SDigits
- TClonesArray * fHits ; //!
- TFile * fSplitFile ; //! file in which SDigits will eventually be stored
+ // should be calculated independently for each layer as :
+ // LightYield*LightCollectionEfficiency*LightAttenuation*APDPhotoElectronEfficiency*APDGain
+ Float_t fTowerPrimThreshold ; // To store primary in Tower if Elos > threshold
+ Float_t fPreShowerPrimThreshold ;// To store primary if Pre Shower Elos > threshold
+ Bool_t fDefaultInit; //! Says if the task was created by defaut ctor (only parameters are initialized)
+ Int_t fSDigitsInRun ; //! Total number of sdigits in one run
+ TFile * fSplitFile ; //! file in which SDigits will eventually be stored
+ Bool_t fToSplit ; //! Says that sigits should be written into splip file
ClassDef(AliEMCALSDigitizer,2) // description
/**************************************************************************
-
* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
-
* *
-
* Author: The ALICE Off-line Project. *
-
* Contributors are mentioned in the code where appropriate. *
-
* *
-
* Permission to use, copy, modify and distribute this software and its *
-
* documentation strictly for non-commercial purposes is hereby granted *
-
* without fee, provided that the above copyright notice appears in all *
-
* copies and that both the copyright notice and this permission notice *
-
* appear in the supporting documentation. The authors make no claims *
-
* about the suitability of this software for any purpose. It is *
-
* provided "as is" without express or implied warranty. *
-
**************************************************************************/
-
-
-
/* $Id$ */
-
-
//_________________________________________________________________________
-
// Implementation version v0 of EMCAL Manager class
-
// An object of this class does not produce hits nor digits
-
// It is the one to use if you do not want to produce outputs in TREEH or TREED
-
// This class places a Geometry of the EMCAL in the ALICE Detector as defined in AliEMCALGeometry.cxx
-
//*-- Author: Yves Schutz (SUBATECH)
-
//*-- and : Sahal Yacoob (LBL / UCT)
-
-
// This Version of AliEMCALv0 reduces the number of volumes placed in XEN1 (the envelope) to less than five hundred
-
// The Envelope is Placed in Alice, And the Aluminium layer. Mini envelopes (XU) are then placed in XEN1.
-
// Each mini envelope contains 2 scintillator, and 2 lead layers, except the last one which contains just one scintillator layer.
-
// At the moment I cannot place the 36 and above layers in the mini envelopes so all layers are still placed in XEN1
-
-
-
// --- ROOT system ---
#include "TPGON.h"
-
#include "TTUBS.h"
-
#include "TNode.h"
-
#include "TRandom.h"
-
#include "TGeometry.h"
-//#include "Tstring.h"
-
-
-
// --- Standard library ---
-
-
#include <stdio.h>
-
#include <string.h>
-
#include <stdlib.h>
-
#include <strstream.h>
-
#include <iostream.h>
-
-
// --- AliRoot header files ---
-
-
#include "AliEMCALv0.h"
-
#include "AliEMCALGeometry.h"
-
#include "AliConst.h"
-
#include "AliRun.h"
-
#include "AliMC.h"
-
-
ClassImp(AliEMCALv0)
-
-
//______________________________________________________________________
-
AliEMCALv0::AliEMCALv0(const char *name, const char *title):
-
- AliEMCAL(name,title){
-
- // Standard Constructor
-
-
-
- if (strcmp(GetTitle(),"") != 0 )
-
- fGeom = AliEMCALGeometry::GetInstance(GetTitle(), "") ;
-
-
+ AliEMCAL(name,title)
+{
+ // ctor : title is used to identify the layout
+ GetGeometry() ;
}
//______________________________________________________________________
-
-void AliEMCALv0::BuildGeometry(){
-
+void AliEMCALv0::BuildGeometry()
+{
// Display Geometry for display.C
-
-
const Int_t kColorArm1 = kBlue ;
+ AliEMCALGeometry * geom = GetGeometry() ;
-
- // Difine the shape of the Calorimeter
-
-
+ // Define the shape of the Calorimeter
TNode * top = gAlice->GetGeometry()->GetNode("alice") ;
-
new TTUBS("Envelop1", "Tubs that contains arm 1", "void",
-
- fGeom->GetEnvelop(0), // rmin
-
- fGeom->GetEnvelop(1) +30 , // rmax
-
- fGeom->GetEnvelop(2)/2.0, // half length in Z
-
- fGeom->GetArm1PhiMin(), // minimun phi angle
-
- fGeom->GetArm1PhiMax() // maximun phi angle
-
+ geom->GetEnvelop(0), // rmin
+ geom->GetEnvelop(1) +30 , // rmax
+ geom->GetEnvelop(2)/2.0, // half length in Z
+ geom->GetArm1PhiMin(), // minimun phi angle
+ geom->GetArm1PhiMax() // maximun phi angle
);
// Place the Node
top->cd();
-
TNode * envelop1node = new TNode("Envelop1", "Arm1 Envelop", "Envelop1"
,0., 0., 0., "") ;
-
envelop1node->SetLineColor(kColorArm1) ;
-
fNodes->Add(envelop1node) ;
-
}
//______________________________________________________________________
-
-void AliEMCALv0::CreateGeometry(){
-
+void AliEMCALv0::CreateGeometry()
+{
// Create the EMCAL geometry for Geant
Float_t etamin,etamax;
-
Float_t *dum=0;
+ AliEMCALGeometry * geom = GetGeometry() ;
-
- if(!(fGeom->IsInitialized())){
-
+ if(!(geom->IsInitialized())){
Error("CreateGeometry","EMCAL Geometry class has not been set up.");
-
} // end if
// Get pointer to the array containing media indices
-
Int_t *idtmed = fIdtmed->GetArray() - 1599 ;
-
-
// Create an Envelope within which to place the Detector
-
-
-
Float_t envelopA[5];
-
- envelopA[0] = fGeom->GetEnvelop(0); // rmin
-
- envelopA[1] = fGeom->GetEnvelop(1); // rmax
-
- envelopA[2] = fGeom->GetEnvelop(2)/2.0; // dz
-
- envelopA[3] = fGeom->GetArm1PhiMin(); // minimun phi angle
-
- envelopA[4] = fGeom->GetArm1PhiMax(); // maximun phi angle
-
-
+ envelopA[0] = geom->GetEnvelop(0); // rmin
+ envelopA[1] = geom->GetEnvelop(1); // rmax
+ envelopA[2] = geom->GetEnvelop(2)/2.0; // dz
+ envelopA[3] = geom->GetArm1PhiMin(); // minimun phi angle
+ envelopA[4] = geom->GetArm1PhiMax(); // maximun phi angle
// create XEN1
-
gMC->Gsvolu("XEN1", "TUBS ", idtmed[1599], envelopA, 5) ; //filled with air
-
-
-
Int_t idrotm = 1;
-
AliMatrix(idrotm, 90.0, 0., 90.0, 90.0, 0.0, 0.0) ;
-
-
// Position the EMCAL Mother Volume in Alice
-
gMC->Gspos("XEN1", 1, "ALIC", 0.0, 0.0, 0.0, idrotm, "ONLY") ;
-
-
//
-
TString label = "XU0";
-
-
//rmin Start mini envelopes after the aluminium layer
-
- envelopA[0] = fGeom->GetEnvelop(0) + fGeom->GetGap2Active() +
-
- fGeom->GetAlFrontThickness();
+ envelopA[0] = geom->GetEnvelop(0) + geom->GetGap2Active() +
+ geom->GetAlFrontThickness();
//rmax larger for first two layers (preshower);
-
- Float_t tseg = fGeom->GetPreSintThick()+fGeom->GetPbRadThick();
-
+ Float_t tseg = geom->GetPreSintThick()+geom->GetPbRadThick();
envelopA[1] = envelopA[0] + 2.0*tseg;
-
- envelopA[2] = fGeom->GetEnvelop(2)/2.0; // dz
-
- envelopA[3] = fGeom->GetArm1PhiMin(); // minimun phi angle
-
- envelopA[4] = fGeom->GetArm1PhiMax(); // maximun phi angle
+ envelopA[2] = geom->GetEnvelop(2)/2.0; // dz
+ envelopA[3] = geom->GetArm1PhiMin(); // minimun phi angle
+ envelopA[4] = geom->GetArm1PhiMax(); // maximun phi angle
//filled with air
-
gMC->Gsvolu(label.Data(), "TUBS ", idtmed[1599], envelopA, 5);
// Place XU0 in to XEN1
-
gMC->Gspos(label.Data(), 1, "XEN1", 0.0, 0.0, 0.0, idrotm, "ONLY");
-
-
- tseg = fGeom->GetFullSintThick()+fGeom->GetPbRadThick();
-
- for (int i = 1; i < ((fGeom->GetNLayers()-1)/2) + 1 ; i++ ){
-
+ tseg = geom->GetFullSintThick()+geom->GetPbRadThick();
+ for (int i = 1; i < ((geom->GetNLayers()-1)/2) + 1 ; i++ ){
label = "XU" ;
-
label += i ;
-
envelopA[0] = envelopA[1]; //rmin
-
envelopA[1] = envelopA[0] + 2.0*tseg; //rmax
- //filled with air
-
+ //filled with air
gMC->Gsvolu(label.Data(), "TUBS ", idtmed[1599], envelopA, 5);
-
gMC->Gspos(label.Data(), 1, "XEN1", 0.0, 0.0, 0.0, idrotm, "ONLY") ;
-
} // end i
-
-
// Create the shapes of active material (LEAD/Aluminium/Scintillator)
-
// to be placed
-
Float_t envelopB[10]; // First Layer of Aluminium
-
Float_t envelopC[10]; // Scintillator Layers
-
Float_t envelopD[10]; // Lead Layers
//starting position in Phi
-
- envelopC[0] = envelopD[0] = envelopB[0] = fGeom->GetArm1PhiMin();
+ envelopC[0] = envelopD[0] = envelopB[0] = geom->GetArm1PhiMin();
// Angular size of the Detector in Phi
-
- envelopB[1] = fGeom->GetArm1PhiMax() - fGeom->GetArm1PhiMin();
-
+ envelopB[1] = geom->GetArm1PhiMax() - geom->GetArm1PhiMin();
envelopC[1] = envelopD[1] = envelopB[1];
// Number of Section in Phi
-
- envelopC[2] = envelopD[2] = envelopB[2] = fGeom->GetNPhi();
+ envelopC[2] = envelopD[2] = envelopB[2] = geom->GetNPhi();
// each section will be passed 2 z coordinates
-
envelopD[3] = envelopC[3] = envelopB[3] = 2;
-
- envelopB[4] = fGeom->ZFromEtaR(fGeom->GetEnvelop(0)+fGeom->GetGap2Active(),
-
- fGeom->GetArm1EtaMin());// z co-ordinate 1
-
- envelopB[5] = fGeom->GetEnvelop(0) + fGeom->GetGap2Active(); //rmin at z1
-
- envelopB[6] = envelopB[5] + fGeom->GetAlFrontThickness();//rmax at z1
-
+ envelopB[4] = geom->ZFromEtaR(geom->GetEnvelop(0)+geom->GetGap2Active(),
+ geom->GetArm1EtaMin());// z co-ordinate 1
+ envelopB[5] = geom->GetEnvelop(0) + geom->GetGap2Active(); //rmin at z1
+ envelopB[6] = envelopB[5] + geom->GetAlFrontThickness();//rmax at z1
envelopD[6] = envelopB[6];
-
- envelopB[7] =fGeom->ZFromEtaR(fGeom->GetEnvelop(0)+fGeom->GetGap2Active(),
-
- fGeom->GetArm1EtaMax()); // z co-ordinate 2
-
+ envelopB[7] = geom->ZFromEtaR(geom->GetEnvelop(0)+geom->GetGap2Active(),
+ geom->GetArm1EtaMax()); // z co-ordinate 2
envelopB[8] = envelopB[5] ; //
-
envelopB[9] = envelopB[6] ; // radii are the same.
-
-
// filled shapes wit hactive material
// Define Aluminium volume completely
-
gMC->Gsvolu("XALU", "PGON", idtmed[1602], envelopB, 10);
// The polystyrene layers will be defined when placed
-
gMC->Gsvolu("XPST", "PGON", idtmed[1601], dum, 0);
-
gMC->Gsvolu("XPBX", "PGON", idtmed[1600], dum, 0);// as will the lead layers
// Dividind eta polystyrene divisions into phi segments.
-
- gMC->Gsdvn("XPHI", "XPST", fGeom->GetNPhi(), 2);
+ gMC->Gsdvn("XPHI", "XPST", geom->GetNPhi(), 2);
// Position Aluminium Layer in the Envelope
-
gMC->Gspos("XALU", 1, "XEN1", 0.0, 0.0, 0.0 , idrotm, "ONLY") ;
-
-
// The loop below places the scintillator in Lead Layers alternately.
-
- for (int i = 0; i < fGeom->GetNLayers() ; i++ ){
-
+ for (int i = 0; i < geom->GetNLayers() ; i++ ){
label = "XU" ;
-
label += (int) i/2 ; // we will place two layers (i = one layer) in each mini envelope)
-
envelopC[5] = envelopD[6] ; //rmin
-
- envelopC[6] = envelopD[6] + ((i > 1) ? fGeom->GetFullSintThick() :
-
- fGeom->GetPreSintThick());//rmax larger for first two layers (preshower)
-
+ envelopC[6] = envelopD[6] + ((i > 1) ? geom->GetFullSintThick() :
+ geom->GetPreSintThick());//rmax larger for first two layers (preshower)
envelopC[8] = envelopD[6] ; //rmin
-
- envelopC[9] = envelopD[6] + ((i > 1 ) ? fGeom->GetFullSintThick() :
-
- fGeom->GetPreSintThick());//rmax larger for first two layers (preshower)
-
- for (int j =0; j < (fGeom->GetNEta()) ; j++){
-
-
-
- etamin = fGeom->GetArm1EtaMin()+
-
- (j*fGeom->GetDeltaEta());
-
- etamax = fGeom->GetArm1EtaMin()+
-
- ((j+1)*fGeom->GetDeltaEta());
-
- envelopC[4] = fGeom->ZFromEtaR(envelopD[6],etamin); //z begin
-
- envelopC[7] = fGeom->ZFromEtaR(envelopD[6],etamax);// z end
-
- gMC->Gsposp("XPST",1+j+i*(fGeom->GetNEta()), label.Data(), // should be used but there's a weird crash above i = 18,
-
+ envelopC[9] = envelopD[6] + ((i > 1 ) ? geom->GetFullSintThick() :
+ geom->GetPreSintThick());//rmax larger for first two layers (preshower)
+ for (int j =0; j < (geom->GetNEta()) ; j++){
+ etamin = geom->GetArm1EtaMin()+
+ (j*geom->GetDeltaEta());
+ etamax = geom->GetArm1EtaMin()+
+ ((j+1)*geom->GetDeltaEta());
+ envelopC[4] = geom->ZFromEtaR(envelopD[6],etamin); //z begin
+ envelopC[7] = geom->ZFromEtaR(envelopD[6],etamax);// z end
+ gMC->Gsposp("XPST",1+j+i*(geom->GetNEta()), label.Data(), // should be used but there's a weird crash above i = 18,
0.0, 0.0, 0.0 , idrotm, "ONLY", envelopC, 10); // Position and define layer
-
} // end for j
- if (i < (fGeom->GetNLayers()-1)){
-
+ if (i < (geom->GetNLayers()-1)){
envelopD[5] = envelopC[6] ; //rmin
-
- envelopD[6] = envelopC[6] + fGeom->GetPbRadThick(); //rmax
-
+ envelopD[6] = envelopC[6] + geom->GetPbRadThick(); //rmax
envelopD[8] = envelopC[6] ; //rmin
-
- envelopD[9] = envelopC[6] + fGeom->GetPbRadThick(); //rmax
-
- for (int j =0; j < (fGeom->GetNEta()) ; j++){
-
- etamin = fGeom->GetArm1EtaMin()+
-
- (j*fGeom->GetDeltaEta());
-
- etamax = fGeom->GetArm1EtaMin()+
-
- ((j+1)*fGeom->GetDeltaEta());
-
- envelopD[4] = fGeom->ZFromEtaR(envelopC[6],etamin);//z begin
-
- envelopD[7] = fGeom->ZFromEtaR(envelopC[6],etamax);// z end
+ envelopD[9] = envelopC[6] + geom->GetPbRadThick(); //rmax
+ for (int j =0; j < (geom->GetNEta()) ; j++){
+ etamin = geom->GetArm1EtaMin()+
+ (j*geom->GetDeltaEta());
+ etamax = geom->GetArm1EtaMin()+
+ ((j+1)*geom->GetDeltaEta());
+ envelopD[4] = geom->ZFromEtaR(envelopC[6],etamin);//z begin
+ envelopD[7] = geom->ZFromEtaR(envelopC[6],etamax);// z end
// Position and Define Layer
-
- gMC->Gsposp("XPBX",1+ j+i*(fGeom->GetNEta()), label.Data(),
-
+ gMC->Gsposp("XPBX",1+ j+i*(geom->GetNEta()), label.Data(),
0.0, 0.0, 0.0 , idrotm, "ONLY", envelopD, 10);
-
} // end for j
-
} // end if i
-
} // for i
}
//______________________________________________________________________
-
-void AliEMCALv0::Init(void){
-
+void AliEMCALv0::Init(void)
+{
// Just prints an information message
Int_t i;
-
-
-
- cout << endl;
-
- for(i=0;i<35;i++) cout <<"*";
-
- cout << " EMCAL_INIT ";
-
- for(i=0;i<35;i++) cout << "*";
-
+
+ if(fDebug) {
+ cout << endl;
+ for(i=0;i<35;i++)
+ cout <<"*";
+ cout << "INFO: " << ClassName() << "::Init ";
+ for(i=0;i<35;i++)
+ cout << "*";
cout << endl;
-
-
// Here the EMCAL initialisation code (if any!)
-
-
- if (fGeom!=0)
-
+ AliEMCALGeometry * geom = GetGeometry() ;
+
+ if (geom!=0)
cout << "AliEMCAL" << Version() << " : EMCAL geometry intialized for "
-
- << fGeom->GetName() << endl ;
-
+ << geom->GetName() << endl ;
else
-
cout << "AliEMCAL" << Version() <<
-
" : EMCAL geometry initialization failed !" << endl ;
- for(i=0;i<80;i++) printf("*");
-
+ for(i=0;i<80;i++)
+ cout << "*" ;
cout << endl;
-
+ }
}
-
virtual void BuildGeometry();// creates the geometry for the ROOT display
virtual void CreateGeometry() ;// creates the geometry for GEANT
-
- virtual AliEMCALGeometry * GetGeometry() const {
- // gets the pointer to the AliEMCALGeometry unique instance
- return fGeom ;
- }
-
-
-
virtual void Init(void) ; // does nothing
virtual Int_t IsVersion(void) const {
// Gives the version number
return 0 ;
}
- virtual TString Version(void){
+ virtual const TString Version(void) const{
// As above
return TString("v0") ;
}
static Float_t ienergy = 0;
Int_t copy = 0;
+ AliEMCALGeometry * geom = GetGeometry() ;
+
if(gMC->IsTrackEntering() && (strcmp(gMC->CurrentVolName(),"XALU") == 0)){ // This Particle in enterring the Calorimeter
gMC->TrackPosition(pos) ;
xyzte[0] = pos[0] ;
xyzte[1] = pos[1] ;
xyzte[2] = pos[2] ;
if ( (xyzte[0]*xyzte[0] + xyzte[1]*xyzte[1])
- < (fGeom->GetEnvelop(0)+fGeom->GetGap2Active()+1.5 )*(fGeom->GetEnvelop(0)+fGeom->GetGap2Active()+1.5 ) ) {
+ < (geom->GetEnvelop(0)+geom->GetGap2Active()+1.5 )*(geom->GetEnvelop(0)+geom->GetGap2Active()+1.5 ) ) {
iparent = tracknumber;
gMC->TrackMomentum(mom);
ienergy = mom[3];
gMC->CurrentVolOffID(1, id[0]); // get the POLY copy number;
gMC->CurrentVolID(id[1]); // get the phi number inside the layer
- absid = (id[0]-1)*(fGeom->GetNPhi()) + id[1];
+ absid = (id[0]-1)*(geom->GetNPhi()) + id[1];
//Calculates the light yield, the number of photons produced in the
//plastic layer
// Gives the version number
virtual Int_t IsVersion(void) const {return 1;}
virtual void StepManager(void) ;
- virtual TString Version(void){return TString("v0");}
+ virtual const TString Version(void)const {return TString("v0");}
// assignement operator requested by coding convention but not needed
AliEMCALv1 & operator = (const AliEMCALv0 & rvalue){abort();return *this;}