{
// ctor
fSplitFile= 0 ;
- fHitsFileName = "" ;
- fSDigitsFileName = "" ;
- fDigitsFileName = "" ;
+ fToSplit = kFALSE ;
+// fHitsFileName = "" ;
+// fSDigitsFileName = "" ;
+// fDigitsFileName = "" ;
}
//____________________________________________________________________________
-AliPHOSClusterizer::AliPHOSClusterizer(const char* headerFile, const char* name):
+AliPHOSClusterizer::AliPHOSClusterizer(const char* headerFile, const char* name, const Bool_t toSplit):
TTask(name, headerFile)
{
// ctor
+ fToSplit = toSplit ;
fSplitFile= 0 ;
- fDigitsFileName = headerFile ;
- AliPHOSGetter * gime = AliPHOSGetter::GetInstance(headerFile, name) ;
- gime->Event(0,"D") ;
- fSDigitsFileName = gime->Digitizer()->GetTitle() ;
- gime = AliPHOSGetter::GetInstance(fSDigitsFileName, name) ;
- gime->Event(0,"S") ;
- fHitsFileName = gime->SDigitizer()->GetTitle() ;
+ // fDigitsFileName = headerFile ;
+ // AliPHOSGetter * gime = AliPHOSGetter::GetInstance(headerFile, name,toSplit) ;
+// gime->Event(0,"D") ;
+// fSDigitsFileName = gime->Digitizer()->GetTitle() ;
+// gime = AliPHOSGetter::GetInstance(fSDigitsFileName, name) ;
+// gime->Event(0,"S") ;
+// fHitsFileName = gime->SDigitizer()->GetTitle() ;
}
//____________________________________________________________________________
{
// dtor
- fSplitFile = 0 ; ;
+ fSplitFile = 0 ;
}
-//____________________________________________________________________________
-void AliPHOSClusterizer::SetSplitFile(const TString splitFileName)
-{
- // Diverts the RecPoints in a file separate from the Digits file
+// //____________________________________________________________________________
+// void AliPHOSClusterizer::SetSplitFile(const TString splitFileName)
+// {
+// // Diverts the RecPoints in a file separate from the Digits file
- TDirectory * cwd = gDirectory ;
- fSplitFile = gAlice->InitTreeFile("R",splitFileName.Data());
- fSplitFile->cd() ;
- gAlice->Write(0, TObject::kOverwrite);
+// TDirectory * cwd = gDirectory ;
+// fSplitFile = gAlice->InitTreeFile("R",splitFileName.Data());
+// fSplitFile->cd() ;
+// gAlice->Write(0, TObject::kOverwrite);
- TTree *treeE = gAlice->TreeE();
- if (!treeE) {
- cerr << "ERROR: AliPHOSClusterizer::SetSplitFile -> No TreeE found "<<endl;
- abort() ;
- }
+// TTree *treeE = gAlice->TreeE();
+// if (!treeE) {
+// cerr << "ERROR: AliPHOSClusterizer::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 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: AliPHOSClusterizer::SetSplitFile -> AliceGeom was not found in the input file "<<endl;
- abort() ;
- }
- AliceGeom->Write(0, TObject::kOverwrite);
+// // copy AliceGeom
+// TGeometry *AliceGeom = static_cast<TGeometry*>(cwd->Get("AliceGeom"));
+// if (!AliceGeom) {
+// cerr << "ERROR: AliPHOSClusterizer::SetSplitFile -> AliceGeom was not found in the input file "<<endl;
+// abort() ;
+// }
+// AliceGeom->Write(0, TObject::kOverwrite);
- gAlice->MakeTree("R", fSplitFile);
- cwd->cd() ;
- cout << "INFO: AliPHOSClusterizer::SetSPlitMode -> RecPoints will be stored in " << splitFileName.Data() << endl ;
-}
+// gAlice->MakeTree("R", fSplitFile);
+// cwd->cd() ;
+// cout << "INFO: AliPHOSClusterizer::SetSPlitMode -> RecPoints will be stored in " << splitFileName.Data() << endl ;
+// }
public:
AliPHOSClusterizer() ; // default ctor
- AliPHOSClusterizer(const char * headerFile, const char * name) ;
+ AliPHOSClusterizer(const char * headerFile, const char * name, const Bool_t toSplit) ;
virtual ~AliPHOSClusterizer() ; // dtor
- const TString GetHitsFileName() const { return fHitsFileName ; }
- const TString GetSDigitsFileName() const { return fSDigitsFileName ; }
- const TString GetDigitsFileName() const { return fDigitsFileName ; }
+ // const TString GetHitsFileName() const { return fHitsFileName ; }
+ // const TString GetSDigitsFileName() const { return fSDigitsFileName ; }
+ // const TString GetDigitsFileName() const { return fDigitsFileName ; }
virtual Float_t GetEmcClusteringThreshold()const {cout << "Not Defined" << endl ; return 0. ; }
virtual Float_t GetEmcLocalMaxCut()const {cout << "Not Defined" << endl ; return 0. ; }
virtual Float_t GetCpvClusteringThreshold()const {cout << "Not Defined" << endl ; return 0. ; }
virtual Float_t GetCpvLocalMaxCut()const {cout << "Not Defined" << endl ; return 0. ; }
virtual Float_t GetCpvLogWeight()const {cout << "Not Defined" << endl ; return 0. ; }
- virtual char * GetRecPointsBranch() 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 char * GetDigitsBranch() const{cout << "Not Defined" << endl ; return 0 ; } ;
+ virtual const char * GetDigitsBranch() const{cout << "Not Defined" << endl ; return 0 ; } ;
virtual void MakeClusters() {cout << "Not Defined" << endl ; }
virtual void Print(Option_t * option)const {cout << "Not Defined" << endl ; }
virtual void SetCpvLogWeight(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 SetSplitFile(const TString splitFileName = "PHOS.RecData.root") ;
+ // // virtual void SetSplitFile(const TString splitFileName = "PHOS.RecData.root") ;
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
+ // 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(AliPHOSClusterizer,2) // Clusterization algorithm class
}
//____________________________________________________________________________
-AliPHOSClusterizerv1::AliPHOSClusterizerv1(const char* headerFile,const char* name, const char * from)
-:AliPHOSClusterizer(headerFile, name)
+AliPHOSClusterizerv1::AliPHOSClusterizerv1(const char* headerFile,const char* name, const Bool_t toSplit)
+:AliPHOSClusterizer(headerFile, name, toSplit)
{
// ctor with the indication of the file where header Tree and digits Tree are stored
InitParameters() ;
- if ( from == 0 )
- fFrom = name ;
- else
- fFrom = from ;
Init() ;
fDefaultInit = kFALSE ;
AliPHOSClusterizerv1::~AliPHOSClusterizerv1()
{
// dtor
- // fDefaultInit = kTRUE if Clusterizer created by default ctor (to get just the parameters)
- if (!fDefaultInit) {
- AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
+// if (!fDefaultInit) {
+// AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
- // remove the task from the folder list
- gime->RemoveTask("C",GetName()) ;
+// // remove the task from the folder list
+// gime->RemoveTask("C",GetName()) ;
- // remove the data from the folder list
- TString name(GetName()) ;
- name.Remove(name.Index(":")) ;
- gime->RemoveObjects("D", name) ; // Digits
- gime->RemoveObjects("RE", name) ; // EMCARecPoints
- gime->RemoveObjects("RC", name) ; // CPVRecPoints
+// // remove the data from the folder list
+// TString name(GetName()) ;
+// name.Remove(name.Index(":")) ;
+// gime->RemoveObjects("D", name) ; // Digits
+// gime->RemoveObjects("RE", name) ; // EMCARecPoints
+// gime->RemoveObjects("RC", name) ; // CPVRecPoints
- // Delete gAlice
- gime->CloseFile() ;
+// // Delete gAlice
+// gime->CloseFile() ;
fSplitFile = 0 ;
- }
+// }
}
//____________________________________________________________________________
//____________________________________________________________________________
Float_t AliPHOSClusterizerv1::Calibrate(Int_t amp, Int_t absId) const
-{
+{ //To be replased later by the method, reading individual parameters from the database
if(absId <= fEmcCrystals) //calibrate as EMC
return fADCpedestalEmc + amp*fADCchanelEmc ;
else //Digitize as CPV
if(strstr(option,"print"))
Print("") ;
- gAlice->GetEvent(0) ;
+// gAlice->GetEvent(0) ;
- //check, if the branch with name of this" already exits?
- if(gAlice->TreeR()) {
- TObjArray * lob = (TObjArray*)gAlice->TreeR()->GetListOfBranches() ;
- TIter next(lob) ;
- TBranch * branch = 0 ;
- Bool_t phosemcfound = kFALSE, phoscpvfound = kFALSE, clusterizerfound = kFALSE ;
+// //check, if the branch with name of this" already exits?
+// if(gAlice->TreeR()) {
+// TObjArray * lob = (TObjArray*)gAlice->TreeR()->GetListOfBranches() ;
+// TIter next(lob) ;
+// TBranch * branch = 0 ;
+// Bool_t phosemcfound = kFALSE, phoscpvfound = kFALSE, clusterizerfound = kFALSE ;
- TString branchname = GetName() ;
- branchname.Remove(branchname.Index(Version())-1) ;
+// TString branchname = GetName() ;
+// branchname.Remove(branchname.Index(Version())-1) ;
- while ( (branch = (TBranch*)next()) && (!phosemcfound || !phoscpvfound || !clusterizerfound) ) {
- if ( (strcmp(branch->GetName(), "PHOSEmcRP")==0) && (strcmp(branch->GetTitle(), branchname.Data())==0) )
- phosemcfound = kTRUE ;
+// while ( (branch = (TBranch*)next()) && (!phosemcfound || !phoscpvfound || !clusterizerfound) ) {
+// if ( (strcmp(branch->GetName(), "PHOSEmcRP")==0) && (strcmp(branch->GetTitle(), branchname.Data())==0) )
+// phosemcfound = kTRUE ;
- else if ( (strcmp(branch->GetName(), "PHOSCpvRP")==0) && (strcmp(branch->GetTitle(), branchname.Data())==0) )
- phoscpvfound = kTRUE ;
+// else if ( (strcmp(branch->GetName(), "PHOSCpvRP")==0) && (strcmp(branch->GetTitle(), branchname.Data())==0) )
+// phoscpvfound = kTRUE ;
- else if ((strcmp(branch->GetName(), "AliPHOSClusterizer")==0) && (strcmp(branch->GetTitle(), GetName())==0) )
- clusterizerfound = kTRUE ;
- }
+// else if ((strcmp(branch->GetName(), "AliPHOSClusterizer")==0) && (strcmp(branch->GetTitle(), GetName())==0) )
+// clusterizerfound = kTRUE ;
+// }
- if ( phoscpvfound || phosemcfound || clusterizerfound ) {
- cerr << "WARNING: AliPHOSClusterizer::Exec -> Emc(Cpv)RecPoints and/or Clusterizer branch with name "
- << branchname.Data() << " already exits" << endl ;
- return ;
- }
- }
+// if ( phoscpvfound || phosemcfound || clusterizerfound ) {
+// cerr << "WARNING: AliPHOSClusterizer::Exec -> Emc(Cpv)RecPoints and/or Clusterizer branch with name "
+// << branchname.Data() << " already exits" << endl ;
+// return ;
+// }
+// }
AliPHOSGetter * gime = AliPHOSGetter::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++){
-
- if(ievent == 0) GetCalibrationParameters() ;
-
+
+ gime->Event(ievent,"D") ;
+
+ if(ievent == 0)
+ GetCalibrationParameters() ;
+
fNumberOfEmcClusters = 0 ;
fNumberOfCpvClusters = 0 ;
-
- gime->Event(ievent,"D") ;
+
// if(!ReadDigits(ievent)) continue; //reads digits for event ievent
PrintRecPoints(option) ;
//increment the total number of digits per run
- fRecPointsInRun += gime->EmcRecPoints(BranchName())->GetEntriesFast() ;
- fRecPointsInRun += gime->CpvRecPoints(BranchName())->GetEntriesFast() ;
+ fRecPointsInRun += gime->EmcRecPoints()->GetEntriesFast() ;
+ fRecPointsInRun += gime->CpvRecPoints()->GetEntriesFast() ;
}
if(strstr(option,"tim")){
// Cluster will be fitted as a superposition of nPar/3 electromagnetic showers
AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
- TClonesArray * digits = gime->Digits(fFrom) ;
+ TClonesArray * digits = gime->Digits() ;
gMinuit->mncler(); // Reset Minuit's list of paramters
void AliPHOSClusterizerv1::GetCalibrationParameters()
{
AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
- TString branchname = GetName() ;
- branchname.Remove(branchname.Index(Version())-1) ;
- AliPHOSDigitizer * dig = gime->Digitizer(fFrom) ;
+ const AliPHOSDigitizer * dig = gime->Digitizer(BranchName()) ;
+
fADCchanelEmc = dig->GetEMCchannel() ;
fADCpedestalEmc = dig->GetEMCpedestal();
-
+
fADCchanelCpv = dig->GetCPVchannel() ;
fADCpedestalCpv = dig->GetCPVpedestal() ;
-
+
}
//____________________________________________________________________________
void AliPHOSClusterizerv1::Init()
TString branchname = GetName() ;
branchname.Remove(branchname.Index(Version())-1) ;
- AliPHOSGetter * gime = AliPHOSGetter::GetInstance(GetTitle(), fFrom.Data()) ;
+ AliPHOSGetter * gime = AliPHOSGetter::GetInstance(GetTitle(),branchname.Data(), fToSplit ) ;
if ( gime == 0 ) {
cerr << "ERROR: AliPHOSClusterizerv1::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+="PHOS.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 AliPHOSGeometry * geom = gime->PHOSGeometry() ;
fEmcCrystals = geom->GetNModules() * geom->GetNCristalsInModule() ;
if(!gMinuit)
gMinuit = new TMinuit(100) ;
+
gime->PostClusterizer(this) ;
- // create a folder on the white board //YSAlice/WhiteBoard/RecPoints/PHOS/recpointsName
gime->PostRecPoints(branchname) ;
- gime->PostDigits(fFrom) ;
- gime->PostDigitizer(fFrom) ;
+ // gime->PostDigits() ;
+ // gime->PostDigitizer() ;
}
fToUnfold = kTRUE ;
- fHeaderFileName = GetTitle() ;
- fDigitsBranchTitle = GetName() ;
+ // fHeaderFileName = GetTitle() ;
+ // fDigitsBranchTitle = GetName() ;
TString clusterizerName( GetName()) ;
if (clusterizerName.IsNull() )
// Creates new branches with given title
// fills and writes into TreeR.
-
-
+
+
AliPHOSGetter *gime = AliPHOSGetter::GetInstance() ;
- TObjArray * emcRecPoints = gime->EmcRecPoints(BranchName()) ;
- TObjArray * cpvRecPoints = gime->CpvRecPoints(BranchName()) ;
- TClonesArray * digits = gime->Digits(fFrom) ;
- TTree * treeR = gAlice->TreeR();
-
- if (!gAlice->TreeR() )
+ TObjArray * emcRecPoints = gime->EmcRecPoints() ;
+ TObjArray * cpvRecPoints = gime->CpvRecPoints() ;
+ 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(!treeR){
gAlice->MakeTree("R", fSplitFile);
- treeR = gAlice->TreeR() ;
-
+ treeR = gAlice->TreeR() ;
+ }
+
Int_t index ;
//Evaluate position, dispersion and other RecPoint properties...
for(index = 0; index < emcRecPoints->GetEntries(); index++)
((AliPHOSEmcRecPoint *)emcRecPoints->At(index))->EvalAll(fW0,digits) ;
-
+
emcRecPoints->Sort() ;
for(index = 0; index < emcRecPoints->GetEntries(); index++)
((AliPHOSEmcRecPoint *)emcRecPoints->At(index))->SetIndexInList(index) ;
-
+
emcRecPoints->Expand(emcRecPoints->GetEntriesFast()) ;
-
+
//Now the same for CPV
for(index = 0; index < cpvRecPoints->GetEntries(); index++)
((AliPHOSRecPoint *)cpvRecPoints->At(index))->EvalAll(fW0CPV,digits) ;
-
+
cpvRecPoints->Sort() ;
-
+
for(index = 0; index < cpvRecPoints->GetEntries(); index++)
((AliPHOSRecPoint *)cpvRecPoints->At(index))->SetIndexInList(index) ;
-
+
cpvRecPoints->Expand(cpvRecPoints->GetEntriesFast()) ;
Int_t bufferSize = 32000 ;
cpvBranch ->Fill() ;
clusterizerBranch->Fill() ;
- treeR->AutoSave() ; //Write(0,kOverwrite) ;
-
+ treeR->AutoSave() ; //Write(0,kOverwrite) ;
+ if(gAlice->TreeR()!=treeR)
+ treeR->Delete();
}
//____________________________________________________________________________
emcRecPoints->Delete() ;
cpvRecPoints->Delete() ;
- TClonesArray * digits = gime->Digits(fFrom) ;
+ TClonesArray * digits = gime->Digits() ;
if ( !digits ) {
cerr << "ERROR: AliPHOSClusterizerv1::MakeClusters -> Digits with name "
- << fFrom << " not found ! " << endl ;
+ << GetName() << " not found ! " << endl ;
abort() ;
}
TClonesArray * digitsC = (TClonesArray*)digits->Clone() ;
const AliPHOSGeometry * geom = gime->PHOSGeometry() ;
TObjArray * emcRecPoints = gime->EmcRecPoints(BranchName()) ;
TObjArray * cpvRecPoints = gime->CpvRecPoints(BranchName()) ;
- TClonesArray * digits = gime->Digits(fFrom) ;
+ TClonesArray * digits = gime->Digits() ;
// Unfold first EMC clusters
if(fNumberOfEmcClusters > 0){
AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
const AliPHOSGeometry * geom = gime->PHOSGeometry() ;
- const TClonesArray * digits = gime->Digits(fFrom) ;
- TObjArray * emcRecPoints = gime->EmcRecPoints(BranchName()) ;
- TObjArray * cpvRecPoints = gime->CpvRecPoints(BranchName()) ;
+ const TClonesArray * digits = gime->Digits() ;
+ TObjArray * emcRecPoints = gime->EmcRecPoints() ;
+ TObjArray * cpvRecPoints = gime->CpvRecPoints() ;
Int_t nPar = 3 * nMax ;
Float_t * fitparameters = new Float_t[nPar] ;
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 = " << fEmcClusteringThreshold << endl
<< " EMC Local Maximum cut = " << fEmcLocMaxCut << endl
public:
AliPHOSClusterizerv1() ;
- AliPHOSClusterizerv1(const char * headerFile, const char * name = "Default", const char * from = 0);
+ AliPHOSClusterizerv1(const char * headerFile, const char * name = "Default", const Bool_t toSplit=kFALSE);
virtual ~AliPHOSClusterizerv1() ;
virtual Int_t AreNeighbours(AliPHOSDigit * d1, AliPHOSDigit * d2)const ;
virtual Float_t GetCpvClusteringThreshold()const{ return fCpvClusteringThreshold; }
virtual Float_t GetCpvLocalMaxCut()const { return fCpvLocMaxCut;}
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 const char * GetRecPointsBranch() const{ return GetName() ;}
+ virtual const Int_t GetRecPointsInRun() const {return fRecPointsInRun ;}
+ // virtual const char * GetDigitsBranch() const { return (char*) fDigitsBranchTitle.Data() ;}
void Exec(Option_t *option); // Does the job
virtual void SetEmcClusteringThreshold(Float_t cluth) { fEmcClusteringThreshold = cluth ; }
virtual void SetEmcLocalMaxCut(Float_t cut) { fEmcLocMaxCut = cut ; }
virtual void SetEmcLogWeight(Float_t w) { fW0 = w ; }
- virtual void SetEmcTimeGate(Float_t gate) {fEmcTimeGate = gate ;}
+ virtual void SetEmcTimeGate(Float_t gate) { fEmcTimeGate = gate ;}
virtual void SetCpvClusteringThreshold(Float_t cluth) { fCpvClusteringThreshold = cluth ; }
virtual void SetCpvLocalMaxCut(Float_t cut) { fCpvLocMaxCut = cut ; }
virtual void SetCpvLogWeight(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 SetDigitsBranch(const char * title) { fDigitsBranchTitle = title ;}
+ // virtual void SetRecPointsBranch(const char *title){fRecPointsBranchTitle = title; }
+ 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 ;
+ const TString BranchName() const ;
void GetCalibrationParameters(void) ;
Bool_t FindFit(AliPHOSEmcRecPoint * emcRP, AliPHOSDigit ** MaxAt, Float_t * maxAtEnergy,
Int_t NPar, Float_t * FitParametres) const; //Used in UnfoldClusters, calls TMinuit
- void Init() ;
- void InitParameters() ;
+ void Init() ;
+ void InitParameters() ;
virtual void MakeUnfolding() ;
void UnfoldCluster(AliPHOSEmcRecPoint * iniEmc,Int_t Nmax,
private:
Bool_t fDefaultInit; //! Says if the task was created by defaut ctor (only parameters are initialized)
- TString fFrom ; // name of Digits
- 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
+ // TString fFrom ; // name of Digits
+ // 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 fEmcCrystals ; // number of EMC cristalls in PHOS
Int_t fNumberOfEmcClusters ; // number of EMC clusters found
Int_t fNumberOfCpvClusters ; // number of CPV clusters found
+ //Calibration parameters... to be replaced by database
Float_t fADCchanelEmc ; // width of one ADC channel in GeV
Float_t fADCpedestalEmc ; //
Float_t fADCchanelCpv ; // width of one ADC channel in CPV 'popugais'
AliPHOSClusterizerv2::AliPHOSClusterizerv2() : AliPHOSClusterizerv1()
{}
-AliPHOSClusterizerv2::AliPHOSClusterizerv2(const char* File, const char* name):
- AliPHOSClusterizerv1(File,name)
+AliPHOSClusterizerv2::AliPHOSClusterizerv2(const char * headerFile, const char * name, const Bool_t toSplit):
+AliPHOSClusterizerv1(headerFile,name,toSplit)
{}
void AliPHOSClusterizerv2::GetNumberOfClustersFound(int* numb) const
AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
- TFolder* aliceF = (TFolder*)gROOT->FindObjectAny("YSAlice");
- TFolder* storage = (TFolder*)aliceF->FindObject("WhiteBoard/RecPoints/PHOS");
- TFolder* wPoolF = storage->AddFolder("SmP","SmartRecPoints for PHOS");
-
+ TFolder* storage = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/Run/Event/RecData/RecPoints/PHOS"));
+ TFolder* wPoolF = storage->AddFolder("SmP","SmartRecPoints for PHOS");
+
TObjArray* wPool = new TObjArray(400);
wPool->SetName("SmartPoints");
wPoolF->Add(wPool);
}
}
-
+//---------------------------------------------------------------------------------
Int_t AliPHOSClusterizerv2::AreNeighbours(AliPHOSDigit* d1, AliPHOSDigit* d2) const
{
// Points are neighbours if they have common edge.
}
-// //Do NOT clusterize upper PPSD // YVK 30.09.2001
-// if( IsInPpsd(d1) && IsInPpsd(d2) &&
-// relid1[1] > 0 &&
-// relid1[1] < geom->GetNumberOfPadsPhi()*geom->GetNumberOfPadsPhi() ) rv = 2 ;
-
return rv ;
}
public:
AliPHOSClusterizerv2();
- AliPHOSClusterizerv2(const char* headerFile, const char* name = 0);
+ AliPHOSClusterizerv2(const char * headerFile, const char * name = "Default", const Bool_t toSplit=kFALSE) ;
~AliPHOSClusterizerv2() {}
Int_t AreNeighbours(AliPHOSDigit* d1, AliPHOSDigit* d2) const ;
AliPHOSDigitizer::AliPHOSDigitizer()
{
// ctor
-
InitParameters() ;
fDefaultInit = kTRUE ;
+ fManager = 0 ; // We work in the standalong mode
- fHitsFileName = "" ;
- fSDigitsFileName = "" ;
+ // fHitsFileName = "" ;
+ // fSDigitsFileName = "" ;
}
//____________________________________________________________________________
-AliPHOSDigitizer::AliPHOSDigitizer(const char *headerFile,const char * name)
+AliPHOSDigitizer::AliPHOSDigitizer(const char *headerFile, const char * name, const Bool_t toSplit)
{
// ctor
fManager = 0 ; // We work in the standalong mode
fSplitFile= 0 ;
InitParameters() ;
+ fToSplit = toSplit ;
Init() ;
fDefaultInit = kFALSE ;
- fSDigitsFileName = headerFile ;
- AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
- gime->Event(0, "S") ;
- fHitsFileName = gime->SDigitizer()->GetTitle() ;
+ // fSDigitsFileName = headerFile ;
+ // AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
+ // gime->Event(0, "S") ;
+ // fHitsFileName = gime->SDigitizer()->GetTitle() ;
}
//____________________________________________________________________________
AliPHOSDigitizer::AliPHOSDigitizer(AliRunDigitizer * ard):AliDigitizer(ard)
{
// ctor
- SetTitle("aliroot") ;
- SetName("Default") ;
+ SetTitle(ard->GetInputFileName(0,0)) ;
InitParameters() ;
- fDefaultInit = kTRUE ;
-
- fSDigitsFileName = fManager->GetInputFileName(0, 0) ;
- AliPHOSGetter * gime = AliPHOSGetter::GetInstance(fSDigitsFileName, GetName()) ;
- gime->Event(0,"S") ;
- fHitsFileName = gime->SDigitizer()->GetTitle() ;
+ fDefaultInit = kFALSE ;
+ fSplitFile = 0 ;
+
+ if (ard->GetOutputFile()) {
+ SetName(ard->GetOutputFile().Data());
+ fToSplit = kTRUE ;
+ } else {
+ SetName("Default") ;
+ fToSplit = kFALSE ;
+ }
+
+// fSDigitsFileName = fManager->GetInputFileName(0, 0) ;
+// AliPHOSGetter * gime = AliPHOSGetter::GetInstance(fSDigitsFileName, GetName()) ;
+// gime->Event(0,"S") ;
+// fHitsFileName = gime->SDigitizer()->GetTitle() ;
}
// dtor
// fDefaultInit = kTRUE if Digitizer created by default ctor (to get just the parameters)
- if (!fDefaultInit) {
- AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
+// if (!fDefaultInit) {
+// AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
- // remove the task from the folder list
- gime->RemoveTask("S",GetName()) ;
- gime->RemoveTask("D",GetName()) ;
+// // 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 Digits from the folder list
+// gime->RemoveObjects("D", GetName()) ;
- // remove the SDigits from the folder list
- gime->RemoveSDigits() ;
+// // remove the SDigits from the folder list
+// gime->RemoveSDigits() ;
- // Delete gAlice
- gime->CloseFile() ;
+// // Delete gAlice
+// gime->CloseFile() ;
fSplitFile = 0 ;
- }
+ // }
}
//____________________________________________________________________________
if ( (sdigits = (TClonesArray*)folder->FindObject(GetName()) ) ) {
TString fileName(folder->GetName()) ;
fileName.ReplaceAll("_","/") ;
- cout << "INFO: AliPHOSDigitizer::Digitize -> Adding SDigits "
- << GetName() << " from " << fileName << endl ;
+// cout << "INFO: AliPHOSDigitizer::Digitize -> Adding SDigits "
+// << GetName() << " from " << fileName << endl ;
sdigArray->AddAt(sdigits, input) ;
input++ ;
}
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 phosfound = kFALSE, digitizerfound = kFALSE ;
- while ( (branch = (TBranch*)next()) && (!phosfound || !digitizerfound) ) {
- if ( (strcmp(branch->GetName(), "PHOS")==0) &&
- (strcmp(branch->GetTitle(), GetName())==0) )
- phosfound = kTRUE ;
+ //Check, if this branch already exits
+ if (treeD) {
+ TObjArray * lob = (TObjArray*)treeD->GetListOfBranches() ;
+ TIter next(lob) ;
+ TBranch * branch = 0 ;
+ Bool_t phosfound = kFALSE, digitizerfound = kFALSE ;
- else if ( (strcmp(branch->GetName(), "AliPHOSDigitizer")==0) &&
- (strcmp(branch->GetTitle(), GetName())==0) )
- digitizerfound = kTRUE ;
- }
-
- if ( phosfound ) {
- cerr << "WARNING: AliPHOSDigitizer -> Digits branch with name " << GetName()
- << " already exits" << endl ;
- return ;
- }
- if ( digitizerfound ) {
- cerr << "WARNING: AliPHOSDigitizer -> Digitizer branch with name " << GetName()
- << " already exits" << endl ;
- return ;
+ while ( (branch = (TBranch*)next()) && (!phosfound || !digitizerfound) ) {
+ if ( (strcmp(branch->GetName(), "PHOS")==0) &&
+ (strcmp(branch->GetTitle(), GetName())==0) )
+ phosfound = kTRUE ;
+
+ else if ( (strcmp(branch->GetName(), "AliPHOSDigitizer")==0) &&
+ (strcmp(branch->GetTitle(), GetName())==0) )
+ digitizerfound = kTRUE ;
+ }
+
+ if ( phosfound ) {
+ cerr << "WARNING: AliPHOSDigitizer -> Digits branch with name " << GetName()
+ << " already exits" << endl ;
+ return ;
+ }
+ if ( digitizerfound ) {
+ cerr << "WARNING: AliPHOSDigitizer -> Digitizer branch with name " << GetName()
+ << " already exits" << endl ;
+ return ;
+ }
}
}
-
+ else { //PHOS standalone
+ if(gime->BranchExists("Digits") )
+ return ;
+ nevents=gime->MaxEvent() ;
+ }
+
Int_t ievent ;
for(ievent = 0; ievent < nevents; ievent++){
//____________________________________________________________________________
Bool_t AliPHOSDigitizer::Init()
{
+ // Makes all memory allocations
+
+ if( strcmp(GetTitle(), "") == 0 )
+ SetTitle("galice.root") ;
- AliPHOSGetter * gime = AliPHOSGetter::GetInstance(GetTitle(), GetName()) ;
+ AliPHOSGetter * gime = AliPHOSGetter::GetInstance(GetTitle(), GetName(), fToSplit) ;
if ( gime == 0 ) {
cerr << "ERROR: AliPHOSDigitizer::Init -> Could not obtain the Getter object !" << endl ;
return kFALSE;
// Post Digitizer to the white board
gime->PostDigitizer(this) ;
+
+ fSplitFile = 0 ;
+ if(fToSplit){
+ // construct the name of the file as /path/PHOS.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+="PHOS.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){
}
-//__________________________________________________________________
-void AliPHOSDigitizer::SetSplitFile(const TString splitFileName)
-{
- // Diverts the Digits in a file separate from the hits file
+// //__________________________________________________________________
+// void AliPHOSDigitizer::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: AliPHOSDigitizer::SetSplitFile -> Not yet available in case of merging activated " << endl ;
-// return ;
-// }
+// // I guess it is not going to work if we do merging
+// // if (fManager) {
+// // cerr << "ERROR: AliPHOSDigitizer::SetSplitFile -> Not yet available in case of merging activated " << endl ;
+// // return ;
+// // }
- cout << "AliPHOSDigitizer::SetSplitFile " << gDirectory->GetName() << endl ;
- cout << "AliPHOSDigitizer::SetSplitFile " << gAlice->GetTreeDFileName() << endl ;
- cout << "AliPHOSDigitizer::SetSplitFile " << splitFileName.Data() << endl ;
+// cout << "AliPHOSDigitizer::SetSplitFile " << gDirectory->GetName() << endl ;
+// cout << "AliPHOSDigitizer::SetSplitFile " << gAlice->GetTreeDFileName() << endl ;
+// cout << "AliPHOSDigitizer::SetSplitFile " << splitFileName.Data() << endl ;
- SetTitle(splitFileName) ;
+// SetTitle(splitFileName) ;
- TDirectory * cwd = gDirectory ;
- if ( !(gAlice->GetTreeDFileName() == splitFileName) ) {
- if (gAlice->GetTreeDFile() )
- gAlice->GetTreeDFile()->Close() ;
- }
+// 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: AliPHOSDigitizer::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: AliPHOSDigitizer::SetSplitFile -> AliceGeom was not found in the input file "<<endl;
- abort() ;
- }
- AliceGeom->Write(0, TObject::kOverwrite);
-
- gAlice->MakeTree("D",fSplitFile);
- cwd->cd() ;
- cout << "INFO: AliPHOSDigitizer::SetSPlitMode -> Digits will be stored in " << splitFileName.Data() << endl ;
-}
+// fSplitFile = gAlice->InitTreeFile("D",splitFileName.Data());
+// fSplitFile->cd() ;
+// gAlice->Write(0, TObject::kOverwrite);
+
+// TTree *treeE = gAlice->TreeE();
+// if (!treeE) {
+// cerr << "ERROR: AliPHOSDigitizer::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: AliPHOSDigitizer::SetSplitFile -> AliceGeom was not found in the input file "<<endl;
+// abort() ;
+// }
+// AliceGeom->Write(0, TObject::kOverwrite);
+
+// gAlice->MakeTree("D",fSplitFile);
+// cwd->cd() ;
+// cout << "INFO: AliPHOSDigitizer::SetSPlitMode -> Digits will be stored in " << splitFileName.Data() << endl ;
+// }
//__________________________________________________________________
void AliPHOSDigitizer::Print(Option_t* option)const {
// Print Digitizer's parameters
if( strcmp(GetName(), "") != 0 ){
-
+
+
cout << "------------------- "<< GetName() << " -------------" << endl ;
const Int_t nStreams = GetNInputStreams() ;
// 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 ;
}
-//__________________________________________________________________
-void AliPHOSDigitizer::SetSDigitsBranch(const char* title)
-{
- // we set title (comment) of the SDigits branch in the first! header file
- if( strcmp(GetName(), "") == 0 )
- Init() ;
+// //__________________________________________________________________
+// void AliPHOSDigitizer::SetSDigitsBranch(const char* title)
+// {
+// // we set title (comment) of the SDigits branch in the first! header file
+// if( strcmp(GetName(), "") == 0 )
+// Init() ;
- AliPHOSGetter::GetInstance()->SDigits()->SetName(title) ;
+// AliPHOSGetter::GetInstance()->SDigits()->SetName(title) ;
-}
+// }
//__________________________________________________________________
Float_t AliPHOSDigitizer::TimeOfNoise(void)
{ // Calculates the time signal generated by noise
return 1. ;
}
-//____________________________________________________________________________
-void AliPHOSDigitizer::Reset()
-{
- // sets current event number to the first simulated event
+// //____________________________________________________________________________
+// void AliPHOSDigitizer::Reset()
+// {
+// // sets current event number to the first simulated event
- if( strcmp(GetName(), "") == 0 )
- Init() ;
+// if( strcmp(GetName(), "") == 0 )
+// Init() ;
- // Int_t inputs ;
-// for(inputs = 0; inputs < fNinputs ;inputs++)
-// fIevent->AddAt(-1, inputs ) ;
+// // Int_t inputs ;
+// // for(inputs = 0; inputs < fNinputs ;inputs++)
+// // fIevent->AddAt(-1, inputs ) ;
-}
+// }
//____________________________________________________________________________
void AliPHOSDigitizer::WriteDigits(Int_t event)
AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
const TClonesArray * digits = gime->Digits(GetName()) ;
TTree * treeD ;
-
-
- if(fManager)
- treeD = fManager->GetTreeD() ;
- else {
- if (!gAlice->TreeD() )
- gAlice->MakeTree("D", fSplitFile);
- treeD = gAlice->TreeD();
- }
-
-
+
+ if(fManager)
+ treeD = fManager->GetTreeD() ;
+ else {
+ 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 Digits branch
Int_t bufferSize = 32000 ;
TBranch * digitsBranch = treeD->Branch("PHOS",&digits,bufferSize);
digitsBranch->SetTitle(GetName());
-
+
// -- Create Digitizer branch
Int_t splitlevel = 0 ;
- AliPHOSDigitizer * d = gime->Digitizer(GetName()) ;
+ const AliPHOSDigitizer * d = gime->Digitizer(GetName()) ;
TBranch * digitizerBranch = treeD->Branch("AliPHOSDigitizer", "AliPHOSDigitizer", &d,bufferSize,splitlevel);
digitizerBranch->SetTitle(GetName());
digitsBranch->Fill() ;
digitizerBranch->Fill() ;
treeD->AutoSave() ;
-
}
public:
AliPHOSDigitizer() ; // ctor
- AliPHOSDigitizer(const char *headerFile, const char * name = "Default") ;
+ AliPHOSDigitizer(const char *headerFile, const char * name = "Default", const Bool_t toSplit = kFALSE ) ;
AliPHOSDigitizer(AliRunDigitizer * ard) ;
AliPHOSDigitizer(const AliPHOSDigitizer & dtizer)
{( (AliPHOSDigitizer &)dtizer ).Copy(*this) ;}
void SetNEMCchannels(Int_t n) { fNADCemc = n; }
void SetEMCchannel(Float_t width) { fADCchanelEmc = width; }
void SetEMCpedestal(Float_t ped) { fADCpedestalEmc = ped ; }
+ void SetTimeResolution(Float_t res){ fTimeResolution = res ; }
//General
const Int_t GetDigitsInRun() const { return fDigitsInRun ;}
- const TString GetHitsFileName() const { return fHitsFileName ; }
- const TString GetSDigitsFileName() const { return fSDigitsFileName ; }
+ // const TString GetHitsFileName() const { return fHitsFileName ; }
+ // const TString GetSDigitsFileName() const { return fSDigitsFileName ; }
void MixWith(const char* HeaderFile) ; // Add another one file to mix
void Print(Option_t* option)const ;
- void Reset() ; //restarts starts event processing from 0 event(s)
- void SetSplitFile(const TString splitFileName = "PHOS.Digits.root") ;
- void SetSDigitsBranch(const char* file) ;
+ // void Reset() ; //restarts starts event processing from 0 event(s)
+ // void SetSplitFile(const TString splitFileName = "PHOS.Digits.root") ;
+ // void SetSDigitsBranch(const char* file) ;
AliPHOSDigitizer & operator = (const AliPHOSDigitizer & rvalue) {
// assignement operator requested by coding convention but not needed
private:
- TString fHitsFileName ; // file name that contains the original hits
- TString fSDigitsFileName ; // file name that contains the original SDigits
+ // 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)
Int_t fEmcCrystals ; // Number of EMC crystalls in the given geometry
Float_t fADCchanelCpv ; // width of one ADC channel in CPV 'popugais'
Float_t fADCpedestalCpv ; //
Int_t fNADCcpv ; // number of channels in CPV ADC
- TFile * fSplitFile ; //! file in which Digits will eventually be stored
+
+ Bool_t fToSplit ; //! Do we work in the split mode
+ TFile * fSplitFile ; //! file in which Digits will eventually be stored
ClassDef(AliPHOSDigitizer,1) // description
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
TFile * AliPHOSGetter::fFile = 0 ;
//____________________________________________________________________________
-AliPHOSGetter::AliPHOSGetter(const char* headerFile, const char* branchTitle )
+AliPHOSGetter::AliPHOSGetter(const char* headerFile, const char* branchTitle, const Bool_t toSplit )
{
- //Initialize all lists
+ // This is the ctor called by GetInstance and the only one that can be used
- fDebug = 0 ;
+ if( fHeaderFile.Contains("_") ) {
+ cerr << "AliPHOSGetter::AliPHOSGetter -> Invalid file name (_ not allowed) " << fHeaderFile.Data() << endl ;
+ abort() ;
+ }
- fAlice = 0 ;
-
- fHeaderFile = headerFile ;
- fBranchTitle = branchTitle ;
- fSDigitsTitle = branchTitle ;
- fDigitsTitle = branchTitle ;
- fRecPointsTitle = branchTitle ;
- fRecParticlesTitle = branchTitle ;
- fTrackSegmentsTitle = branchTitle ;
+ //Initialize all data
+
+ fFailed = kFALSE ;
+ fDebug = 0 ;
+ fAlice = 0 ;
+
+ fToSplit = toSplit ;
+ fHeaderFile = headerFile ;
fPrimaries = new TObjArray(1) ;
fRecoFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/Run/Event/RecData"));
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(),"update") ;
if (!fFile->IsOpen()) {
cerr << "ERROR : AliPHOSGetter::AliPHOSGetter -> Cannot open " << fHeaderFile.Data() << endl ;
else
cerr << "ERROR: AliPHOSGetter:AliPHOSGetter -> detector PHOS not found" << endl ;
}
- cout << "gAlice C " << gAlice << " " << gAlice->TreeH() << endl ;
fDebug=0;
}
+
//____________________________________________________________________________
AliPHOSGetter::~AliPHOSGetter(){
// Returns the pointer of the unique instance already defined
if ( fgObjGetter ) {
- if (fFile) // not the case if fManager
- fFile->cd() ;
+// if (fFile) // not the case if fManager
+// fFile->cd() ;
return fgObjGetter ;
}
else {
//____________________________________________________________________________
AliPHOSGetter * AliPHOSGetter::GetInstance(const char* headerFile,
- const char* branchTitle)
+ const char* branchTitle,
+ const Bool_t toSplit)
{
-
- cout << "headerFile " << headerFile << " | " << branchTitle << endl ;
// Creates and returns the pointer of the unique instance
- // Must be called only when the environment has changed
+ // Must be called only when the environment has changed
+ if(!fgObjGetter){
+ fgObjGetter = new AliPHOSGetter(headerFile,branchTitle,toSplit) ;
+ if(fgObjGetter->fFailed)
+ return 0;
+ else
+ return fgObjGetter ;
+ }
- if ( fgObjGetter && !fFile) // an instance exists and getter was called without a file (case of merging)
- return fgObjGetter ;
+ //First checks, if header file already opened
+ if(!fgObjGetter->fFile){
+ fgObjGetter = new AliPHOSGetter(headerFile,branchTitle,toSplit) ;
+ if(fgObjGetter->fFailed)
+ return 0;
+ else
+ return fgObjGetter ;
+ }
- 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->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 // another file than the existing one is required, scratch the getter
- fgObjGetter->~AliPHOSGetter() ; // delete it already exists another version
+ else{ //Clean all data and AliPHOS...zers
+ if(fgObjGetter->fToSplit)
+ fgObjGetter->CloseSplitFiles() ;
+ fgObjGetter->CleanWhiteBoard() ;
+ fgObjGetter->fToSplit = toSplit ;
+ fgObjGetter->SetTitle(branchTitle) ;
+ return fgObjGetter ;
+ }
+ }
+ 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 AliPHOSGetter(headerFile,branchTitle,toSplit) ;
+ return fgObjGetter ;
+ }
+ return fgObjGetter ;
- cout << "bbbbb " << endl ;
- fgObjGetter = new AliPHOSGetter(headerFile,branchTitle) ;
+}
- cout << "ccccc " << endl ;
- if (fgObjGetter->HasFailed() )
- fgObjGetter = 0 ;
-
- // Posts a few item to the white board (folders)
- // fgObjGetter->CreateWhiteBoard() ;
+//____________________________________________________________________________
+const Bool_t AliPHOSGetter::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()) ;
- cout << "end " << fgObjGetter->fHeaderFile.Data() << " | " << fgObjGetter->fBranchTitle.Data() << endl ;
+ if(!tree )
+ return kFALSE ;
- if (fFile)
- fFile->cd() ;
- return fgObjGetter ;
+ 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: AliPHOSGetter::BranchExists -> branch " << dataname.Data() << " with title " << fBranchTitle << " already exits in "
+ << name.Data() << endl;
+ return kTRUE ;
+ }
+ if ( branchName.BeginsWith(zername) && branchTitle.BeginsWith(titleName) ){
+ cerr << "WARNING: AliPHOSGetter::BranchExists -> branch AliPHOS... with title " << branch->GetTitle() << " already exits in "
+ << name.Data() << endl;
+ return kTRUE ;
+ }
+ }
+ tree->Delete();
+
+ return kFALSE ;
}
TBranch * branch = 0 ;
if (gAlice->GetEvent(event) == -1)
return ;
-
+
TTree * t = gAlice->TreeH() ;
if(t){
- cout << "****** Hits : " << endl ;
+ cout << "INFO: AliPHOSGetter::ListBranches -> ****** Hits : " << endl ;
TObjArray * lob = t->GetListOfBranches() ;
TIter next(lob) ;
while ( (branch = static_cast<TBranch*>(next())) )
cout << " " << branch->GetName() << endl ;
- }
+ } else
+ cerr << "WARNING::AliPHOSGetter::ListBranches -> TreeH not found for event " << event << endl ;
t = gAlice->TreeS() ;
if(t){
- cout << "****** SDigits : " << endl ;
+ cout << "INFO: AliPHOSGetter::ListBranches -> ****** SDigits : " << endl ;
TObjArray * lob = t->GetListOfBranches() ;
TIter next(lob) ;
while ( (branch = static_cast<TBranch*>(next())) )
- cout << " " << branch->GetName() << endl ;
- }
+ cout << " " << branch->GetName() << " " << branch->GetTitle() << endl ;
+ } else
+ cerr << "WARNING::AliPHOSGetter::ListBranches -> TreeS not found for event " << event << endl ;
+
+
t = gAlice->TreeD() ;
if(t){
- cout << "****** Digits : " << endl ;
+ cout << "INFO: AliPHOSGetter::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::AliPHOSGetter::ListBranches -> TreeD not found for event " << event << endl ;
+
t = gAlice->TreeR() ;
if(t){
- cout << "****** Recon : " << endl ;
+ cout << "INFO: AliPHOSGetter::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::AliPHOSGetter::ListBranches -> TreeR not found for event " << event << endl ;
+
}
//____________________________________________________________________________
}
//____________________________________________________________________________
-Bool_t AliPHOSGetter::PostPrimaries(void) const
+const Bool_t AliPHOSGetter::PostPrimaries(void) const
{ //------- Primaries ----------------------
// the hierarchy is //Folders/RunMC/Event/Data/Primaries
}
//____________________________________________________________________________
-Bool_t AliPHOSGetter::PostHits(void) const
+const Bool_t AliPHOSGetter::PostHits(void) const
{ //------- Hits ----------------------
// the hierarchy is //Folders/RunMC/Event/Data/PHOS/Hits
}
//____________________________________________________________________________
-Bool_t AliPHOSGetter::PostSDigits(const char * name, const char * headerFile) const
+const Bool_t AliPHOSGetter::PostSDigits(const char * name, const char * headerFile) const
{ //---------- SDigits -------------------------
}
phosFolder = fSDigitsFolder->AddFolder("PHOS", "SDigits from PHOS") ;
}
+
TString subdir(headerFile) ;
subdir.ReplaceAll("/","_") ;
TFolder * phosSubFolder = dynamic_cast<TFolder*>(phosFolder->FindObject(subdir)) ;
if ( !phosSubFolder )
phosSubFolder = phosFolder->AddFolder(subdir, "");
+
TObject * sd = phosSubFolder->FindObject(name);
- if ( sd ) {
- if (fDebug)
- cerr <<"INFO: AliPHOSGetter::Post S -> Folder " << subdir
- << " already exists!" << endl ;
- }else{
+ if ( !sd ) {
TClonesArray * sdigits = new TClonesArray("AliPHOSDigit",1) ;
sdigits->SetName(name) ;
phosSubFolder->Add(sdigits) ;
}
//____________________________________________________________________________
-Bool_t AliPHOSGetter::PostSDigitizer(AliPHOSSDigitizer * sdigitizer) const
+const Bool_t AliPHOSGetter::PostSDigitizer(AliPHOSSDigitizer * sdigitizer) const
{ //---------- SDigitizer -------------------------
// the hierarchy is //Folders/Tasks/SDigitizer/PHOS/sdigitsname
}
//____________________________________________________________________________
-Bool_t AliPHOSGetter::PostSDigitizer(const char * name, const char * file) const
+const Bool_t AliPHOSGetter::PostSDigitizer(const char * name, const char * file) const
{ //---------- SDigitizer -------------------------
// the hierarchy is //Folders/Tasks/SDigitizer/PHOS/sdigitsname
return kTRUE;
}
-
//____________________________________________________________________________
-Bool_t AliPHOSGetter::PostDigits(const char * name) const
+const Bool_t AliPHOSGetter::PostDigits(const char * name) const
{ //---------- Digits -------------------------
// the hierarchy is //Folders/Run/Event/Data/PHOS/SDigits/name
}
//____________________________________________________________________________
-Bool_t AliPHOSGetter::PostDigitizer(AliPHOSDigitizer * digitizer) const
+const Bool_t AliPHOSGetter::PostDigitizer(AliPHOSDigitizer * digitizer) const
{ //---------- Digitizer -------------------------
TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("Digitizer")) ;
}
//____________________________________________________________________________
-Bool_t AliPHOSGetter::PostDigitizer(const char * name) const
+const Bool_t AliPHOSGetter::PostDigitizer(const char * name) const
{ //---------- Digitizer -------------------------
// the hierarchy is //Folders/Tasks/SDigitizer/PHOS/sdigitsname
}
//____________________________________________________________________________
-Bool_t AliPHOSGetter::PostRecPoints(const char * name) const
+const Bool_t AliPHOSGetter::PostRecPoints(const char * name) const
{ // -------------- RecPoints -------------------------------------------
// the hierarchy is //Folders/Run/Event/RecData/PHOS/EMCARecPoints/name
}
//____________________________________________________________________________
-Bool_t AliPHOSGetter::PostClusterizer(AliPHOSClusterizer * clu) const
+const Bool_t AliPHOSGetter::PostClusterizer(AliPHOSClusterizer * clu) const
{ // ------------------ AliPHOSClusterizer ------------------------
// the hierarchy is //Folders/Tasks/Reconstructioner/PHOS/sdigitsname
}
//____________________________________________________________________________
-Bool_t AliPHOSGetter::PostClusterizer(const char * name) const
+const Bool_t AliPHOSGetter::PostClusterizer(const char * name) const
{ // ------------------ AliPHOSClusterizer ------------------------
// the hierarchy is //Folders/Tasks/Reconstructioner/PHOS/sdigitsname
}
AliPHOSClusterizerv1 * phoscl = new AliPHOSClusterizerv1() ;
+ clun+="-v1" ;
+ phoscl->SetName(clun) ;
+ phoscl->SetTitle(fHeaderFile) ;
phos->Add(phoscl) ;
return kTRUE;
}
//____________________________________________________________________________
-Bool_t AliPHOSGetter::PostTrackSegments(const char * name) const
+const Bool_t AliPHOSGetter::PostTrackSegments(const char * name) const
{ // ---------------TrackSegments -----------------------------------
// the hierarchy is //Folders/Run/Event/RecData/PHOS/TrackSegments/name
}
//____________________________________________________________________________
-Bool_t AliPHOSGetter::PostTrackSegmentMaker(AliPHOSTrackSegmentMaker * tsmaker) const
+const Bool_t AliPHOSGetter::PostTrackSegmentMaker(AliPHOSTrackSegmentMaker * tsmaker) const
{ //------------Track Segment Maker ------------------------------
// the hierarchy is //Folders/Tasks/Reconstructioner/PHOS/sdigitsname
}
//____________________________________________________________________________
-Bool_t AliPHOSGetter::PostTrackSegmentMaker(const char * name) const
+const Bool_t AliPHOSGetter::PostTrackSegmentMaker(const char * name) const
{ //------------Track Segment Maker ------------------------------
// the hierarchy is //Folders/Tasks/Reconstructioner/PHOS/sdigitsname
}
AliPHOSTrackSegmentMakerv1 * phosts = new AliPHOSTrackSegmentMakerv1() ;
+ tsn+="-v1" ;
phosts->SetName(tsn) ;
-
+ phosts->SetTitle(fHeaderFile) ;
phos->Add(phosts) ;
return kTRUE;
}
//____________________________________________________________________________
-Bool_t AliPHOSGetter::PostRecParticles(const char * name) const
+const Bool_t AliPHOSGetter::PostRecParticles(const char * name) const
{ // -------------------- RecParticles ------------------------
// the hierarchy is //Folders/Run/Event/RecData/PHOS/RecParticles/name
}
//____________________________________________________________________________
-Bool_t AliPHOSGetter::PostPID(AliPHOSPID * pid) const
+const Bool_t AliPHOSGetter::PostPID(AliPHOSPID * pid) const
{ // ------------AliPHOS PID -----------------------------
TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
}
//____________________________________________________________________________
-Bool_t AliPHOSGetter::PostPID(const char * name) const
+const Bool_t AliPHOSGetter::PostPID(const char * name) const
{
// the hierarchy is //Folders/Tasks/Reconstructioner/PHOS/sdigitsname
}
AliPHOSPIDv1 * phospid = new AliPHOSPIDv1() ;
+ pidname+="-v1" ;
phospid->SetName(pidname) ;
+ phospid->SetTitle(fHeaderFile) ;
phos->Add(phospid) ;
return kTRUE;
}
//____________________________________________________________________________
-Bool_t AliPHOSGetter::PostQA(void) const
+const Bool_t AliPHOSGetter::PostQA(void) const
{ // ------------------ QA ---------------------------------
// the hierarchy is //Folders/Run/Conditions/QA/PHOS/alarmsName
}
//____________________________________________________________________________
-const TParticle * AliPHOSGetter::Primary(Int_t index)
+const TParticle * AliPHOSGetter::Primary(Int_t index) const
{
// Return primary particle numbered by <index>
}
//____________________________________________________________________________
-Int_t AliPHOSGetter::ReadTreeD()
+Int_t AliPHOSGetter::ReadTreeD(const Int_t event)
{
// Read the digit tree gAlice->TreeD()
- TTree * treeD = gAlice->TreeD() ;
-
- if(!treeD) { // TreeD not found in header file
+ 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: AliPHOSGetter::ReadTreeD -> Cannot find TreeD in " << fDigitsFileName.Data() << endl;
+ return 1;
+ }
+ }
+ else
+ treeD = gAlice->TreeD() ;
+
+// if(!treeD) { // TreeD not found in header file
- if (fDebug)
- cout << "WARNING: AliPHOSGetter::ReadTreeD -> Cannot find TreeD in " << fHeaderFile << endl ;
+// if (fDebug)
+// cout << "WARNING: AliPHOSGetter::ReadTreeD -> Cannot find TreeD in " << fHeaderFile << endl ;
- TString searchFileName("") ;
+// TString searchFileName("") ;
- if (Digitizer()) // Digitizer found in header file
- searchFileName = Digitizer()->GetTitle() ;
+// if (Digitizer()) // Digitizer found in header file
+// searchFileName = Digitizer()->GetTitle() ;
- else if (Clusterizer()) // Clusterizer found in header file
- searchFileName = Clusterizer()->GetDigitsFileName() ;
+// 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: AliPHOSGetter::ReadTreeD -> TreeD found in " << searchFileName.Data() << endl ;
+// if ( (treeD = TreeD(searchFileName)) ) { //found TreeD in the file which contains the hits
+// if (fDebug)
+// cout << "INFO: AliPHOSGetter::ReadTreeD -> TreeD found in " << searchFileName.Data() << endl ;
- } else {
- cerr << "ERROR: AliPHOSGetter::ReadTreeD -> TreeD not found " << endl ;
- return 1;
- }
- }
+// } else {
+// cerr << "ERROR: AliPHOSGetter::ReadTreeD -> TreeD not found " << endl ;
+// return 1;
+// }
+// }
+
TObjArray * lob = static_cast<TObjArray*>(treeD->GetListOfBranches()) ;
TIter next(lob) ;
digitizerbranch->SetAddress(DigitizerRef(fDigitsTitle)) ;
digitizerbranch->GetEntry(0) ;
+ // lob ->Delete();
+ if(gAlice->TreeD()!=treeD)
+ treeD->Delete();
return 0 ;
}
if (fDebug)
cout << "WARNING: AliPHOSGetter::ReadTreeH -> Cannot find TreeH 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()->GetHitsFileName() ;
+ TString searchFileName("PHOS.Hits") ;
+ if((strcmp(fBranchTitle.Data(),"Default")!=0)&&(strcmp(fBranchTitle.Data(),"")!=0)){
+ searchFileName+="." ;
+ searchFileName += fBranchTitle ;
+ }
+ searchFileName+=".root" ;
- 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 (fDebug)
cout << "INFO: AliPHOSGetter::ReadTreeH -> TreeH found in " << searchFileName.Data() << endl ;
PostHits() ;
if (hitsbranch->GetEntries() > 1 ) {
+ (dynamic_cast<TClonesArray*> (*HitsRef()))->Clear() ;
TClonesArray * tempo = new TClonesArray("AliPHOSHit",1000) ;
TClonesArray * hits = dynamic_cast<TClonesArray*>(*HitsRef()) ;
hitsbranch->SetAddress(&tempo) ;
delete tempo ;
}
else {
+ (dynamic_cast<TClonesArray*> (*HitsRef()))->Clear() ;
hitsbranch->SetAddress(HitsRef()) ;
hitsbranch->GetEntry(0) ;
}
}
//____________________________________________________________________________
-void AliPHOSGetter::Track(Int_t itrack)
+void AliPHOSGetter::Track(Int_t itrack)
{
// Read the first entry of PHOS branch in hit tree gAlice->TreeH()
if(!Hits())
PostHits() ;
+ (dynamic_cast<TClonesArray*> (*HitsRef()))->Clear() ;
hitsbranch->SetAddress(HitsRef()) ;
hitsbranch->GetEntry(itrack) ;
}
//____________________________________________________________________________
-Int_t AliPHOSGetter::ReadTreeR(Bool_t any)
+Int_t AliPHOSGetter::ReadTreeR(const Int_t event)
{
// Read the reconstrunction tree gAlice->TreeR()
// A particularity has been introduced here :
// any migh have become obsolete : to be checked
// See AliPHOSPIDv1
- if(gAlice->TreeR()== 0){
- if (fDebug)
- cout << "WARNING: AliPHOSGetter::ReadTreeR -> Cannot find TreeR" << endl ;
- return 1;
+ 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: AliPHOSGetter::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 * emcbranch = 0 ;
Bool_t phosemcrpfound = kFALSE, phoscpvrpfound = kFALSE, clusterizerfound = kFALSE ;
- while ( (branch = static_cast<TBranch*>(next())) && (!phosemcrpfound || !phoscpvrpfound || !clusterizerfound) )
-
- if(strcmp(branch->GetTitle(), fRecPointsTitle)==0 || any) {
+ while ( (branch = static_cast<TBranch*>(next())) && (!phosemcrpfound || !phoscpvrpfound || !clusterizerfound) ) {
+ if(strcmp(branch->GetTitle(), fRecPointsTitle)==0 ) {
if ( strcmp(branch->GetName(), "PHOSEmcRP")==0) {
emcbranch = branch ;
phosemcrpfound = kTRUE ;
clusterizerfound = kTRUE ;
}
}
+ }
if ( !phosemcrpfound || !phoscpvrpfound || !clusterizerfound) {
if (fDebug)
cpvbranch->SetAddress(CpvRecPointsRef(fRecPointsTitle)) ;
cpvbranch->GetEntry(0) ;
- if(!Clusterizer(fRecPointsTitle) )
+ if(!Clusterizer(fRecPointsTitle) )
PostClusterizer(fRecPointsTitle) ;
clusterizerbranch->SetAddress(ClusterizerRef(fRecPointsTitle)) ;
TBranch * tsbranch = 0 ;
TBranch * tsmakerbranch = 0 ;
Bool_t phostsfound = kFALSE, tsmakerfound = kFALSE ;
-
- while ( (branch = static_cast<TBranch*>(next())) && (!phostsfound || !tsmakerfound) )
- if(strcmp(branch->GetTitle(), fTrackSegmentsTitle)==0 || any) {
+ while ( (branch = static_cast<TBranch*>(next())) && (!phostsfound || !tsmakerfound) ) {
+ if(strcmp(branch->GetTitle(), fTrackSegmentsTitle)==0 ) {
if ( strcmp(branch->GetName(), "PHOSTS")==0){
tsbranch = branch ;
phostsfound = kTRUE ;
tsmakerfound = kTRUE ;
}
}
-
+ }
+
if ( !phostsfound || !tsmakerfound ) {
if (fDebug)
cout << "WARNING: AliPHOSGetter::ReadTreeR -> Cannot find TrackSegments and/or TrackSegmentMaker with name "
PostTrackSegments(fTrackSegmentsTitle) ;
tsbranch->SetAddress(TrackSegmentsRef(fTrackSegmentsTitle)) ;
tsbranch->GetEntry(0) ;
+
// Read and Post the TrackSegment Maker
if(!TrackSegmentMaker(fTrackSegmentsTitle))
PostTrackSegmentMaker(fTrackSegmentsTitle) ;
pidbranch->SetAddress(PIDRef(fRecParticlesTitle)) ;
pidbranch->GetEntry(0) ;
}
+
+ if(gAlice->TreeR()!=treeR){
+ treeR->Delete();
+ }
return 0 ;
}
//____________________________________________________________________________
-Int_t AliPHOSGetter::ReadTreeS(Int_t event)
+Int_t AliPHOSGetter::ReadTreeS(const 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 phosF
+ // So, first get list of files
TFolder * phosF = dynamic_cast<TFolder *>(fSDigitsFolder->FindObject("PHOS")) ;
if (!phosF)
phosF = fSDigitsFolder->AddFolder("PHOS", "SDigits from PHOS") ;
TCollection * folderslist = phosF->GetListOfFolders() ;
- //Add current file to list if it is not there yet
-
- TString subdir(fHeaderFile) ;
- subdir.ReplaceAll("/","_") ;
-
- if ( (subdir != "aliroot") && ( !folderslist->Contains(subdir) ) ){
- phosF->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()) ;
+ TString fileName("") ;
+ if(fToSplit)
+ fileName = folder->GetTitle() ;
+ else
+ fileName = folder->GetName() ;
fileName.ReplaceAll("_","/") ;
- if(fHeaderFile.CompareTo(fileName) == 0 )
- treeS=gAlice->TreeS() ;
- else{
- file = static_cast<TFile*>(gROOT->GetFile(fileName));
- file->cd() ;
-
- // Get SDigits Tree header from file
- TString treeName("TreeS") ;
- treeName += event ;
- treeS = dynamic_cast<TTree*>(gDirectory->Get(treeName.Data()));
- }
- if(!treeS){ // TreeS not found in header file
+ 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: AliPHOSGetter::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: AliPHOSGetter::ReadTreeS -> TreeS found in " << searchFileName.Data() << endl ;
-
- } else {
- cerr << "ERROR: AliPHOSGetter::ReadTreeS -> TreeS not found " << endl ;
+ cout << "WARNING: AliPHOSGetter::ReadTreeS -> Cannot find TreeS in " << fileName.Data() << endl;
return 1;
- }
}
//set address of the SDigits and SDigitizer
TObjArray * lob = static_cast<TObjArray*>(treeS->GetListOfBranches()) ;
TIter next(lob) ;
Bool_t phosfound = kFALSE, sdigitizerfound = kFALSE ;
-
+
while ( (branch = static_cast<TBranch*>(next())) && (!phosfound || !sdigitizerfound) ) {
if ( (strcmp(branch->GetName(), "PHOS")==0) && (strcmp(branch->GetTitle(), fSDigitsTitle)==0) ) {
phosfound = kTRUE ;
sdigitsBranch = branch ;
}
- else if ( (strcmp(branch->GetName(), "AliPHOSSDigitizer")==0) && (strcmp(branch->GetTitle(), fSDigitsTitle)==0) ) {
+ else if ( (strcmp(branch->GetName(), "AliPHOSSDigitizer")==0) &&
+ (strcmp(branch->GetTitle(), fSDigitsTitle)==0) ) {
sdigitizerfound = kTRUE ;
sdigitizerBranch = branch ;
}
if ( !folder->FindObject(fSDigitsTitle) )
PostSDigits(fSDigitsTitle,folder->GetName()) ;
+ ((TClonesArray*) (*SDigitsRef(fSDigitsTitle,folder->GetName())))->Clear() ;
sdigitsBranch->SetAddress(SDigitsRef(fSDigitsTitle,folder->GetName())) ;
sdigitsBranch->GetEntry(0) ;
PostSDigitizer(fSDigitsTitle,folder->GetName()) ;
sdigitizerBranch->SetAddress(SDigitizerRef(sdname)) ;
sdigitizerBranch->GetEntry(0) ;
+ // lob ->Delete();
+ if(gAlice->TreeS()!=treeS)
+ treeS->Delete();
}
-// 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() ;
- }
+ // 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() ;
+// }
return 0 ;
}
//____________________________________________________________________________
void AliPHOSGetter::ReadTreeS(TTree * treeS, Int_t input)
+
{ // Read the summable digits fron treeS()
PostSDigitizer(sdigitsBranch->GetTitle(),filename) ;
sdigitizerBranch->SetAddress(SDigitizerRef(sdname)) ;
sdigitizerBranch->GetEntry(0) ;
+ // lob ->Delete();
+ if(gAlice->TreeS()!=treeS)
+ treeS->Delete();
}
fAlice = 0 ;
} 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: AliPHOSGetter::ReadPrimaries -> TreeK found in " << searchFileName.Data() << endl ;
- fAlice->GetEvent(EventNumber()) ;
- fNPrimaries = fAlice->GetNtrack() ;
-
- } else {
- cerr << "ERROR: AliPHOSGetter::ReadPrimaries -> TreeK not found " << endl ;
- return ;
- }
+ cerr << "ERROR: AliPHOSGetter::ReadPrimaries -> TreeK not found " << endl ;
+ return ;
}
Int_t index = 0 ;
}
//____________________________________________________________________________
-void AliPHOSGetter::Event(const Int_t event, const char* opt)
+void AliPHOSGetter::Event(const Int_t event, const char* opt)
{
// Reads the content of all Tree's S, D and R
- cout << "galice1 " << gAlice->TreeE() << " " << gAlice->TreeH() << endl ;
if (event >= gAlice->TreeE()->GetEntries() ) {
cerr << "ERROR: AliPHOSGetter::Event -> " << event << " not found in TreeE!" << endl ;
return ;
if (strstr(opt,"A") ) // do not check the title of the branches
any = kTRUE;
- cout << "galice2 " << gAlice->TreeE() << " " << gAlice->TreeH() << endl ;
-
gAlice->GetEvent(event) ;
- Int_t rvRH = 0 ;
- Int_t rvRS = 0 ;
- Int_t rvRD = 0 ;
- Int_t rvRR = 0 ;
-
if( strstr(opt,"R") )
- rvRR = ReadTreeR(any) ;
+ ReadTreeR(event) ;
if( strstr(opt,"D") )
- rvRD = ReadTreeD() ;
+ ReadTreeD(event) ;
if(strstr(opt,"S") )
- rvRS = ReadTreeS(event) ;
+ ReadTreeS(event) ;
if(strstr(opt,"H") )
- rvRH = ReadTreeH() ;
+ ReadTreeH() ;
if( strstr(opt,"Q") )
ReadTreeQA() ;
phos->SetOwner() ;
phos->Clear() ;
}
+
+//____________________________________________________________________________
+void AliPHOSGetter::CleanWhiteBoard(void){
+
+ TFolder * phosmain = 0 ;
+ TFolder * phos ;
+ TObjArray * ar ;
+ TList * lofTasks = 0 ;
+ TTask * task = 0 ;
+ TTask * phost = 0 ;
+
+ // Hits
+ phos = dynamic_cast<TFolder*>(fHitsFolder->FindObject("PHOS")) ;
+ if (phos){
+ TObjArray * ar = dynamic_cast<TObjArray*>(phos->FindObject("Hits")) ;
+ if (ar) {
+ phos->Remove(ar) ;
+ ar->Delete() ;
+ delete ar ;
+ }
+ }
+
+ // SDigits
+ phosmain = dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("PHOS")) ;
+ if (phosmain){
+ phos = dynamic_cast<TFolder*>(phosmain->FindObject(fHeaderFile)) ;
+ if (phos) {
+ ar = dynamic_cast<TObjArray*>(phos->FindObject(fSDigitsTitle)) ;
+ if (ar) {
+ phos->Remove(ar) ;
+ ar->Delete() ;
+ delete ar ;
+ }
+ }
+ phosmain->Remove(phos) ;
+ }
+
+
+ // Digits
+ phos = dynamic_cast<TFolder*>(fDigitsFolder->FindObject("PHOS")) ;
+ if (phos){
+ ar = dynamic_cast<TObjArray*>(phos->FindObject(fDigitsTitle)) ;
+ if (ar) {
+ phos->Remove(ar) ;
+ ar->Delete() ;
+ delete ar ;
+ }
+ }
+
+
+ // EMCARecPoints
+ phos = dynamic_cast<TFolder*>(fRecoFolder->FindObject("PHOS/EMCARecPoints")) ;
+ if (phos){
+ ar = dynamic_cast<TObjArray*>(phos->FindObject(fRecPointsTitle)) ;
+ if (ar) {
+ phos->Remove(ar) ;
+ ar->Delete() ;
+ delete ar ;
+ }
+ }
+
+
+ // CPVRecPoints
+ phos = dynamic_cast<TFolder*>(fRecoFolder->FindObject("PHOS/CPVRecPoints")) ;
+ if (phos){
+ ar = dynamic_cast<TObjArray*>(phos->FindObject(fRecPointsTitle)) ;
+ if (ar) {
+ phos->Remove(ar) ;
+ ar->Delete() ;
+ delete ar ;
+ }
+ }
+
+
+ // TrackSegments
+ phos = dynamic_cast<TFolder*>(fRecoFolder->FindObject("PHOS/TrackSegments")) ;
+ if (phos) {
+ ar = dynamic_cast<TObjArray*>(phos->FindObject(fTrackSegmentsTitle)) ;
+ if (ar) {
+ phos->Remove(ar) ;
+ ar->Delete() ;
+ delete ar ;
+ }
+ }
+
+
+
+ // RecParticles
+ phos = dynamic_cast<TFolder*>(fRecoFolder->FindObject("PHOS/RecParticles")) ;
+ if (phos){
+ ar = dynamic_cast<TObjArray*>(phos->FindObject(fRecParticlesTitle)) ;
+ if (ar) {
+ phos->Remove(ar) ;
+ ar->Delete() ;
+ delete ar ;
+ }
+ }
+
+
+ //---- Now Tascks -----------
+
+ TObject * obj ;
+ TString sdname(fSDigitsTitle);
+
+ // Digitizer
+ task = dynamic_cast<TTask*>(fTasksFolder->FindObject("Digitizer")) ;
+ if (task){
+ phost = dynamic_cast<TTask*>(task->GetListOfTasks()->FindObject("PHOS")) ;
+ if (phost){
+ lofTasks = phost->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){
+ phost = dynamic_cast<TTask*>(task->GetListOfTasks()->FindObject("PHOS")) ;
+ if (phost){
+ lofTasks = phost->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) {
+ phost = dynamic_cast<TTask*>(task->GetListOfTasks()->FindObject("PHOS")) ;
+ if (phost){
+ lofTasks = phost->GetListOfTasks() ;
+ if (lofTasks){
+ obj = lofTasks->FindObject(sdname.Data()) ;
+ if (obj)
+ lofTasks->Remove(obj) ;
+ }
+ }
+ }
+
+}
+//____________________________________________________________________________
+void AliPHOSGetter::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 += "PHOS.SDigits." ;
+ fDigitsFileName += "PHOS.Digits." ;
+ fRecPointsFileName += "PHOS.RecData." ;
+ fTrackSegmentsFileName+= "PHOS.RecData." ;
+ fRecParticlesFileName += "PHOS.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 * phosFolder ;
+ phosFolder = dynamic_cast<TFolder*>(fHitsFolder->FindObject("PHOS")) ;
+ if ( !phosFolder )
+ phosFolder = fHitsFolder->AddFolder("PHOS", "Hits from PHOS") ;
+
+ phosFolder = dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("PHOS")) ;
+ if ( !phosFolder )
+ phosFolder = fSDigitsFolder->AddFolder("PHOS", "SDigits from PHOS") ;
+
+ //Make folder for SDigits
+ TString subdir(fHeaderFile) ;
+ subdir.ReplaceAll("/","_") ;
+ phosFolder->AddFolder(subdir, fSDigitsFileName.Data());
+
+
+ phosFolder = dynamic_cast<TFolder*>(fDigitsFolder->FindObject("PHOS")) ;
+ if ( !phosFolder )
+ phosFolder = fDigitsFolder->AddFolder("PHOS", "Digits from PHOS") ;
+
+ phosFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("PHOS")) ;
+ if ( !phosFolder )
+ phosFolder = fRecoFolder->AddFolder("PHOS", "Reconstructed data from PHOS") ;
+
+
+}
+//____________________________________________________________________________
+void AliPHOSGetter::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() ;
+
+}
public:
AliPHOSGetter(){ // 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 ;
+ cerr << "ERROR: AliPHOSGetter is a singleton default ctor not callable" << endl ;
abort() ;
}
AliPHOSGetter(const AliPHOSGetter & obj) {
abort() ;
}
+ AliPHOSGetter & operator = (const AliPHOSGetter & ) {
+ // assignement operator requested by coding convention, but not needed
+ abort() ;
+ return *this ;
+ }
virtual ~AliPHOSGetter() ;
-
- void CloseFile() ;
- const TFolder * Folder(const TString what) const ;
- void ListBranches(Int_t event=0) const ;
- void NewBranch(TString name, Int_t event = 0) ;
- Bool_t NewFile(TString name) ;
- const Bool_t HasFailed() 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(AliPHOSClusterizer * clu) const ;
- Bool_t PostSDigitizer (AliPHOSSDigitizer * sdigitizer) const ;
- Bool_t PostSDigitizer ( const char * name, const char * file ) const ;
- Bool_t PostDigitizer (AliPHOSDigitizer * digitizer) const ;
- Bool_t PostDigitizer ( const char * name) const ;
- Bool_t PostTrackSegmentMaker(AliPHOSTrackSegmentMaker * tsm) const ;
- Bool_t PostTrackSegmentMaker(const char * name ) const ;
- Bool_t PostPID (AliPHOSPID * pid) const ;
- Bool_t PostPID (const char * name ) const ;
- Bool_t PostQA (void) const ;
-
-
- void Event(const Int_t event, const char * opt = "HSDRP") ;
- void Track(Int_t itrack) ;
+ //=========== Instantiators ================
+ static AliPHOSGetter * GetInstance(const char* headerFile,
+ const char* branchTitle = "Default",
+ const Bool_t toSplit = kFALSE ) ;
+ static AliPHOSGetter * GetInstance() ;
- //Method to be used when digitizing under AliRunDigitizer, who opens all files etc.
- void ReadTreeS(TTree * treeS,Int_t input) ;
+ //=========== 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 tree) const ;
- Int_t EventNumber() { return (Int_t) gAlice->GetEvNumber() ; }
- Int_t MaxEvent() { return (Int_t) gAlice->TreeE()->GetEntries() ; }
- static AliPHOSGetter * GetInstance(const char* headerFile,
- const char* branchTitle = "Default" ) ;
- static AliPHOSGetter * GetInstance() ;
+ //========== PHOSGeometry and PHOS =============
+ const AliPHOS * PHOS() ;
+ const AliPHOSGeometry * PHOSGeometry() ;
- const AliPHOS * PHOS() ;
- const AliPHOSGeometry * PHOSGeometry() ;
- // Alarms
- TFolder * Alarms() const { return (TFolder*)(ReturnO("Alarms", 0)) ; }
- TObjArray * Alarms(const char * name ) const { return (TObjArray*)(ReturnO("Alarms", name)) ; }
+ //========== 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 control ofAliRunDigitizer,
+ //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) ; }
- // QA Tasks
- TTask * QATasks(const char * name = 0) const { return (TTask*)(ReturnT("QATasks", name)) ; }
+ //-----------------now getter's data--------------------------------------
- // Primaries
- TClonesArray * Primaries(void) const { return (TClonesArray*)(ReturnO("Primaries")) ; }
+ //=========== 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
+ //=========== Hits =================
TTree * TreeH(TString filename="") ;
- const TClonesArray * Hits(void) { return static_cast<const TClonesArray*>(ReturnO("Hits")) ; }
- const AliPHOSHit * Hit(Int_t index) { return static_cast<const AliPHOSHit*>(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)) ;
- }
- const AliPHOSDigit * SDigit(Int_t index) { return static_cast<const AliPHOSDigit*>(SDigits()->At(index)) ;}
-
- AliPHOSSDigitizer * SDigitizer(const char * name =0) const {
- return ((AliPHOSSDigitizer*)(ReturnT("SDigitizer", name))) ;
- }
+ const TClonesArray * Hits(void) { return dynamic_cast<const TClonesArray*>(ReturnO("Hits")) ; }
+ const AliPHOSHit * Hit(Int_t index) { return dynamic_cast<const AliPHOSHit*>(Hits()->At(index) );}
- // Digits
- TTree * TreeD(TString filename="") ;
- TClonesArray * Digits(const char * name = 0)const {
- return static_cast<TClonesArray*>(ReturnO("Digits", name)) ;
- }
- const AliPHOSDigit * Digit(Int_t index) { return static_cast<const AliPHOSDigit *>(Digits()->At(index)) ;}
- AliPHOSDigitizer * Digitizer(const char * name =0) const {
- return (AliPHOSDigitizer*)(ReturnT("Digitizer", name)) ;
+ //=========== SDigits ==============
+ TTree * TreeS(TString filename="") ;
+ TClonesArray * SDigits(const char * name = 0, const char * file=0) {
+ return dynamic_cast<TClonesArray*>(ReturnO("SDigits", name, file)) ; }
+ //const AliPHOSDigit * SDigit(Int_t index) { return static_cast<const AliPHOSDigit *>(SDigits()->At(index)) ;} !!! why no such method ?
+ const AliPHOSSDigitizer * SDigitizer(const char * name =0) const {
+ return (const AliPHOSSDigitizer *) ReturnT("SDigitizer", name) ; // here static or dynamic cast does not work ! why ?
}
+
+ //========== Digits ================
+ TTree * TreeD(TString filename="") ;
+ TClonesArray * Digits(const char * name = 0)const {
+ return dynamic_cast<TClonesArray*>(ReturnO("Digits", name)) ; }
+//const AliPHOSDigit * Digit(Int_t index) { return static_cast<const AliPHOSDigit *>(Digits()->At(index)) ;} !!! why no such method ?
+ const AliPHOSDigitizer * Digitizer(const char * name = 0) const {
+ return (const AliPHOSDigitizer*)(ReturnT("Digitizer", name)) ; }
- // RecPoints
- TObjArray * EmcRecPoints(const char * name = 0) {
- return static_cast<TObjArray*>(ReturnO("EmcRecPoints", name)) ;
- }
- TObjArray * CpvRecPoints(const char * name = 0) {
- return static_cast<TObjArray*>(ReturnO("CpvRecPoints", name)) ;
- }
- const AliPHOSEmcRecPoint * EmcRecPoint(Int_t index) {
- return static_cast<const AliPHOSEmcRecPoint *>(EmcRecPoints()->At(index)) ;
- }
- const AliPHOSCpvRecPoint * CpvRecPoint(Int_t index) {
- return static_cast<const AliPHOSCpvRecPoint *>(CpvRecPoints()->At(index)) ;
- }
-
- AliPHOSClusterizer * Clusterizer (const char * name =0) const {
- return (AliPHOSClusterizer*)(ReturnT("Clusterizer", name)) ;
- }
+ //========== RecPoints =============
+ //TTree * TreeR(TString filename="") ; !!! why no such method ?
+ TObjArray * EmcRecPoints(const char * name = 0) {
+ return dynamic_cast<TObjArray*>(ReturnO("EmcRecPoints", name)) ; }
+//const AliPHOSEmcRecPoint * EmcRecPoint(Int_t index) { return static_cast<const AliPHOSEmcRecPoint *>(EmcRecPoints()->At(index)) ;} !!! why no such method ?
+ TObjArray * CpvRecPoints(const char * name = 0) {
+ return dynamic_cast<TObjArray*>(ReturnO("CpvRecPoints", name)) ; }
+//const AliPHOSCpvRecPoint * CpvRecPoint(Int_t index) { return static_cast<const AliPHOSCpvRecPoint *>(EmcCpvPoints()->At(index)) ;} !!! why no such method ?
+ const AliPHOSClusterizer * Clusterizer (const char * name =0) const {
+ return (const AliPHOSClusterizer*)(ReturnT("Clusterizer", name)) ; // here static or dynamic cast does not work ! why ?
+}
- // TrackSegments
+ //========== TrackSegments ==========
TClonesArray * TrackSegments(const char * name = 0) {
- return static_cast<TClonesArray*>(ReturnO("TrackSegments", name)) ;
- }
- const AliPHOSTrackSegment * TrackSegment(Int_t index) {
- return static_cast<const AliPHOSTrackSegment*>(TrackSegments()->At(index)) ;
- }
- AliPHOSTrackSegmentMaker * TrackSegmentMaker (const char * name =0) const {
- return (AliPHOSTrackSegmentMaker*)(ReturnT("TrackSegmentMaker", name)) ;
- }
+ return static_cast<TClonesArray*>(ReturnO("TrackSegments", name)) ; }
+ const AliPHOSTrackSegmentMaker * TrackSegmentMaker (const char * name =0) const {
+ return (const AliPHOSTrackSegmentMaker*)(ReturnT("TrackSegmentMaker", name)) ; }
- // RecParticles
+ //========== RecParticles ===========
TClonesArray * RecParticles(const char * name = 0) {
- return static_cast<TClonesArray*>(ReturnO("RecParticles", name)) ;
- }
- const AliPHOSRecParticle * RecParticle(Int_t index) {
- return static_cast<const AliPHOSRecParticle*>(RecParticles()->At(index)) ;
- }
- AliPHOSPID * PID(const char * name =0) const {
- return (AliPHOSPID*)(ReturnT("PID", name)) ;
- }
-
- // Primaries
- TTree * TreeK(TString filename="") ;
- const TParticle * Primary(Int_t index) ;
- const Int_t NPrimaries()const { return fNPrimaries; }
- const TParticle * Secondary(TParticle * p, Int_t index=1) const ;
-
+ return static_cast<TClonesArray*>(ReturnO("RecParticles", name)) ; }
+ const AliPHOSPID * PID(const char * name =0) const {
+ return (const AliPHOSPID*)(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
-
- AliPHOSGetter & operator = (const AliPHOSGetter & ) {
- // assignement operator requested by coding convention, but not needed
- abort() ;
- return *this ;
- }
-
- TFolder * SDigitsFolder() { return dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("PHOS")) ; }
+ void RemoveSDigits() const ;
+ //----------------Auxiliary methods: miscellana----------------
+ void CloseFile() ;
+ const TFolder * Folder(const TString what) const ;
+ const Bool_t HasFailed() 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("PHOS")) ; }
+ 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(AliPHOSClusterizer * clu) const ;
+ const Bool_t PostSDigitizer (AliPHOSSDigitizer * sdigitizer) const ;
+ const Bool_t PostSDigitizer ( const char * name, const char * file ) const ;
+ const Bool_t PostDigitizer (AliPHOSDigitizer * digitizer) const ;
+ const Bool_t PostDigitizer ( const char * name) const ;
+ const Bool_t PostTrackSegmentMaker(AliPHOSTrackSegmentMaker * tsm) const ;
+ const Bool_t PostTrackSegmentMaker(const char * name ) const ;
+ const Bool_t PostPID (AliPHOSPID * pid) const ;
+ const Bool_t PostPID (const char * name ) const ;
+ const Bool_t PostQA (void) const ;
+
private:
- AliPHOSGetter(const char* headerFile, const char* branchTitle ="Default") ;
+ AliPHOSGetter(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) ;
- Int_t ReadTreeD() ;
- Int_t ReadTreeH() ;
- Int_t ReadTreeR(Bool_t any=kFALSE) ;
- Int_t 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 ;
private:
- static TFile * fFile; //!
- TString fHeaderFile ; //! File in which gAlice lives
- TString fBranchTitle ; //!
- TString fTrackSegmentsTitle ;//!
- TString fRecPointsTitle ; //!
- TString fRecParticlesTitle ; //!
- TString fDigitsTitle ; //! TDirectory tempo(gDirectory) ;
-
- TString fSDigitsTitle ; //!
-
+ 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 fTrackSegmentsFileName ;//!
+ TString fRecPointsTitle ; //!
+ TString fRecPointsFileName ; //!
+ TString fRecParticlesTitle ; //!
+ TString fRecParticlesFileName ; //!
+ TString fDigitsTitle ; //! TDirectory tempo(gDirectory)
+ TString fDigitsFileName ; //! TDirectory tempo(gDirectory)
+ TString fSDigitsTitle ; //!
+ TString fSDigitsFileName ; //!
Bool_t fFailed ; //! set if file not opend or galice not found
- Int_t fDebug ; // Debug level
-
+ 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
};
#endif // AliPHOSGETTER_H
+
+
//____________________________________________________________________________
-AliPHOSPID::AliPHOSPID(const char* headerFile, const char * name ):TTask(name, headerFile)
+AliPHOSPID::AliPHOSPID(const char* headerFile, const char * name, const Bool_t toSplit):TTask(name, headerFile)
{
// ctor
+ fToSplit = toSplit ;
fSplitFile= 0 ;
}
fSplitFile = 0 ;
}
-//____________________________________________________________________________
-void AliPHOSPID::SetSplitFile(const TString splitFileName) const
-{
- // Diverts the Digits in a file separate from the hits file
+// //____________________________________________________________________________
+// void AliPHOSPID::SetSplitFile(const TString splitFileName) const
+// {
+// // Diverts the Digits in a file separate from the hits file
- TDirectory * cwd = gDirectory ;
- TFile * splitFile = gAlice->InitTreeFile("R",splitFileName.Data());
- splitFile->cd() ;
- gAlice->Write(0, TObject::kOverwrite);
+// TDirectory * cwd = gDirectory ;
+// TFile * splitFile = gAlice->InitTreeFile("R",splitFileName.Data());
+// splitFile->cd() ;
+// gAlice->Write(0, TObject::kOverwrite);
- TTree *treeE = gAlice->TreeE();
- if (!treeE) {
- cerr << "ERROR: AliPHOSPID::SetSplitFile -> No TreeE found "<<endl;
- abort() ;
- }
+// TTree *treeE = gAlice->TreeE();
+// if (!treeE) {
+// cerr << "ERROR: AliPHOSPID::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 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: AliPHOSPID::SetSplitFile -> AliceGeom was not found in the input file "<<endl;
- abort() ;
- }
- AliceGeom->Write(0, TObject::kOverwrite) ;
+// // copy AliceGeom
+// TGeometry *AliceGeom = static_cast<TGeometry*>(cwd->Get("AliceGeom"));
+// if (!AliceGeom) {
+// cerr << "ERROR: AliPHOSPID::SetSplitFile -> AliceGeom was not found in the input file "<<endl;
+// abort() ;
+// }
+// AliceGeom->Write(0, TObject::kOverwrite) ;
- gAlice->MakeTree("R",splitFile);
- cwd->cd() ;
- cout << "INFO: AliPHOSPID::SetSPlitMode -> RecParticles will be stored in " << splitFileName.Data() << endl ;
-}
+// gAlice->MakeTree("R",splitFile);
+// cwd->cd() ;
+// cout << "INFO: AliPHOSPID::SetSPlitMode -> RecParticles will be stored in " << splitFileName.Data() << endl ;
+// }
public:
AliPHOSPID() ; // ctor
- AliPHOSPID(const char* headerFile,const char * name) ;
+ AliPHOSPID(const char* headerFile,const char * name, const Bool_t toSplit) ;
virtual ~AliPHOSPID() ; // dtor
virtual void Exec(Option_t * option) { cout << "AliPHOSPID::Exec not define " << endl ; }
- virtual char * GetRecParticlesBranch()const { cout << "AliPHOSPID::GetRecParticlesBranch not defined " << endl ; return 0 ; }
- virtual char * GetTrackSegmentsBranch()const { cout << "AliPHOSPID::GetTrackSegmentsBranch not defined " << endl ; return 0 ; }
+ // virtual char * GetRecParticlesBranch()const { cout << "AliPHOSPID::GetRecParticlesBranch not defined " << endl ; return 0 ; }
+ // virtual char * GetTrackSegmentsBranch()const { cout << "AliPHOSPID::GetTrackSegmentsBranch not defined " << endl ; return 0 ; }
virtual const Int_t GetRecParticlesInRun() const { cout << "AliPHOSPID:::GetRecParticlesInRun not defined " << endl ; return 0 ;}
virtual void Print(Option_t * option) const { cout << "AliPHOSPID::Print not defined " << endl ;}
//virtual void PlotDispersionCuts()const = 0;
//virtual void SetDispersionCut(Float_t cut) = 0 ;
virtual void SetCpvtoEmcDistanceCut(Float_t Cluster_En, TString Eff_Pur,Float_t cut ) { cout << "AliPHOSPID::SetCpvtoEmcDistanceCut not defined " << endl ;}
virtual void SetTimeGate(Float_t Cluster_En, TString Eff_Pur, Float_t gate) { cout << "AliPHOSPID::SetTimeGate not defined " << endl ; }
- virtual void SetTrackSegmentsBranch(const char* title) { cout << "AliPHOSPID::Exec not define " << endl ; }
- virtual void SetRecParticlesBranch (const char* title) { cout << "AliPHOSPID::SetTecParticlesBranch not defined " << endl ; }
- virtual void SetSplitFile(const TString splitFileName = "PHOS.RecData.root") const ;
+ // virtual void SetTrackSegmentsBranch(const char* title) { cout << "AliPHOSPID::Exec not define " << endl ; }
+ // virtual void SetRecParticlesBranch (const char* title) { cout << "AliPHOSPID::SetTecParticlesBranch not defined " << endl ; }
+ // virtual void SetSplitFile(const TString splitFileName = "PHOS.RecData.root") const ;
virtual const char * Version() const { cout << "AliPHOSPID::Version not defined " << endl ; return 0 ; }
virtual void WriteRecParticles(Int_t event) { cout << "AliPHOSPID::WriteRecParticles not defined " << endl ; }
protected:
TFile * fSplitFile ; //! file in which RecParticles will eventually be stored
-
+ Bool_t fToSplit ; //! do we in the split mode
ClassDef(AliPHOSPID,1) // Particle Identifier algorithm (base class)
} ;
}
//____________________________________________________________________________
-AliPHOSPIDv0::AliPHOSPIDv0(const char * headerFile,const char * name) : AliPHOSPID(headerFile, name)
+AliPHOSPIDv0::AliPHOSPIDv0(const char * headerFile,const char * name, const Bool_t toSplit) : AliPHOSPID(headerFile, name,toSplit)
{
//ctor with the indication on where to look for the track segments
{
}
-
//____________________________________________________________________________
Float_t AliPHOSPIDv0::GetDistance(AliPHOSEmcRecPoint * emc,AliPHOSRecPoint * cpv, Option_t * Axis)const
{
return ;
}
- 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 phospidfound = kFALSE, pidfound = kFALSE ;
+ AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
+ if(gime->BranchExists("RecParticles") )
+ return ;
+
+// 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 phospidfound = kFALSE, pidfound = kFALSE ;
- TString taskName(GetName()) ;
- taskName.Remove(taskName.Index(Version())-1) ;
+// TString taskName(GetName()) ;
+// taskName.Remove(taskName.Index(Version())-1) ;
- while ( (branch = (TBranch*)next()) && (!phospidfound || !pidfound) ) {
- if ( (strcmp(branch->GetName(), "PHOSPID")==0) && (strcmp(branch->GetTitle(), taskName.Data())==0) )
- phospidfound = kTRUE ;
+// while ( (branch = (TBranch*)next()) && (!phospidfound || !pidfound) ) {
+// if ( (strcmp(branch->GetName(), "PHOSPID")==0) && (strcmp(branch->GetTitle(), taskName.Data())==0) )
+// phospidfound = kTRUE ;
- else if ( (strcmp(branch->GetName(), "AliPHOSPID")==0) && (strcmp(branch->GetTitle(), taskName.Data())==0) )
- pidfound = kTRUE ;
- }
-
- if ( phospidfound || pidfound ) {
- cerr << "WARNING: AliPHOSPIDv0::Exec -> RecParticles and/or PIDtMaker branch with name "
- << taskName.Data() << " already exits" << endl ;
- return ;
- }
+// else if ( (strcmp(branch->GetName(), "AliPHOSPID")==0) && (strcmp(branch->GetTitle(), taskName.Data())==0) )
+// pidfound = kTRUE ;
+// }
+
+// if ( phospidfound || pidfound ) {
+// cerr << "WARNING: AliPHOSPIDv0::Exec -> RecParticles and/or PIDtMaker branch with name "
+// << taskName.Data() << " already exits" << endl ;
+// return ;
+// }
- Int_t nevents = (Int_t) gAlice->TreeE()->GetEntries() ;
+ Int_t nevents = gime->MaxEvent() ; //(Int_t) gAlice->TreeE()->GetEntries() ;
Int_t ievent ;
- AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
for(ievent = 0; ievent < nevents; ievent++){
gime->Event(ievent,"R") ;
-
+ cout << "event " << ievent << " " << gime->EmcRecPoints() << " " << gime->TrackSegments() << endl ;
MakeRecParticles() ;
WriteRecParticles(ievent);
TString taskName(GetName()) ;
taskName.Remove(taskName.Index(Version())-1) ;
- AliPHOSGetter * gime = AliPHOSGetter::GetInstance(GetTitle(), taskName.Data()) ;
+ AliPHOSGetter * gime = AliPHOSGetter::GetInstance(GetTitle(), taskName.Data(),fToSplit) ;
if ( gime == 0 ) {
cerr << "ERROR: AliPHOSPIDv0::Init -> Could not obtain the Getter object !" << endl ;
return ;
}
+ fSplitFile = 0 ;
+ if(fToSplit){
+ //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="" ;
+ fileName+="PHOS.RecData." ;
+ if((strcmp(taskName.Data(),"Default")!=0)&&(strcmp(taskName.Data(),"")!=0)){
+ fileName+=taskName ;
+ fileName+="." ;
+ }
+ fileName+="root" ;
+ fSplitFile = static_cast<TFile*>(gROOT->GetFile(fileName.Data()));
+ if(!fSplitFile)
+ fSplitFile = TFile::Open(fileName.Data(),"update") ;
+ }
+
+
gime->PostPID(this) ;
// create a folder on the white board //YSAlice/WhiteBoard/RecParticles/PHOS/recparticlesName
gime->PostRecParticles(taskName.Data() ) ;
TClonesArray * recParticles = gime->RecParticles(taskName) ;
recParticles->Expand(recParticles->GetEntriesFast() ) ;
- //Make branch in TreeR for RecParticles
- char * filename = 0;
- if(gSystem->Getenv("CONFIG_SPLIT_FILE")!=0){ //generating file name
- filename = new char[strlen(gAlice->GetBaseFile())+20] ;
- sprintf(filename,"%s/PHOS.Reco.root",gAlice->GetBaseFile()) ;
+ TTree * treeR ;
+
+ if(fToSplit){
+ if(!fSplitFile)
+ return ;
+ fSplitFile->cd() ;
+ char name[10] ;
+ sprintf(name,"%s%d", "TreeR",event) ;
+ treeR = dynamic_cast<TTree*>(fSplitFile->Get(name));
+ }
+ else{
+ treeR = gAlice->TreeR();
}
- TDirectory *cwd = gDirectory;
+ if(!treeR){
+ gAlice->MakeTree("R", fSplitFile);
+ treeR = gAlice->TreeR() ;
+ }
+
+// //Make branch in TreeR for RecParticles
+// char * filename = 0;
+// if(gSystem->Getenv("CONFIG_SPLIT_FILE")!=0){ //generating file name
+// filename = new char[strlen(gAlice->GetBaseFile())+20] ;
+// sprintf(filename,"%s/PHOS.Reco.root",gAlice->GetBaseFile()) ;
+// }
+
+// TDirectory *cwd = gDirectory;
//First rp
Int_t bufferSize = 32000 ;
- TBranch * rpBranch = gAlice->TreeR()->Branch("PHOSRP",&recParticles,bufferSize);
+ TBranch * rpBranch = treeR->Branch("PHOSRP",&recParticles,bufferSize);
rpBranch->SetTitle(fRecParticlesTitle);
- if (filename) {
- rpBranch->SetFile(filename);
- TIter next( rpBranch->GetListOfBranches());
- TBranch * sb ;
- while ((sb=(TBranch*)next())) {
- sb->SetFile(filename);
- }
- cwd->cd();
- }
+// if (filename) {
+// rpBranch->SetFile(filename);
+// TIter next( rpBranch->GetListOfBranches());
+// TBranch * sb ;
+// while ((sb=(TBranch*)next())) {
+// sb->SetFile(filename);
+// }
+// cwd->cd();
+// }
//second, pid
Int_t splitlevel = 0 ;
AliPHOSPIDv0 * pid = this ;
- TBranch * pidBranch = gAlice->TreeR()->Branch("AliPHOSPID","AliPHOSPIDv0",&pid,bufferSize,splitlevel);
+ TBranch * pidBranch = treeR->Branch("AliPHOSPID","AliPHOSPIDv0",&pid,bufferSize,splitlevel);
pidBranch->SetTitle(fRecParticlesTitle.Data());
- if (filename) {
- pidBranch->SetFile(filename);
- TIter next( pidBranch->GetListOfBranches());
- TBranch * sb ;
- while ((sb=(TBranch*)next())) {
- sb->SetFile(filename);
- }
- cwd->cd();
- }
+// if (filename) {
+// pidBranch->SetFile(filename);
+// TIter next( pidBranch->GetListOfBranches());
+// TBranch * sb ;
+// while ((sb=(TBranch*)next())) {
+// sb->SetFile(filename);
+// }
+// cwd->cd();
+// }
rpBranch->Fill() ;
pidBranch->Fill() ;
- gAlice->TreeR()->Write(0,kOverwrite) ;
+ treeR->AutoSave() ; //Write(0,kOverwrite) ;
- delete [] filename ;
}
//____________________________________________________________________________
public:
AliPHOSPIDv0() ; // ctor
- AliPHOSPIDv0(const char* headerFile, const char * tsBranch = "Default") ;
+ AliPHOSPIDv0(const char* headerFile, const char * tsBranch = "Default", const Bool_t toSplit=kFALSE) ;
virtual ~AliPHOSPIDv0() ; // dtor
virtual void Exec(Option_t * option);
- virtual char * GetRecParticlesBranch()const {return (char*) fRecParticlesTitle.Data() ;}
- virtual char * GetTrackSegmentsBranch()const{return (char*) fTrackSegmentsTitle.Data(); }
+ // virtual char * GetRecParticlesBranch()const {return (char*) fRecParticlesTitle.Data() ;}
+ // virtual char * GetTrackSegmentsBranch()const{return (char*) fTrackSegmentsTitle.Data(); }
virtual const Int_t GetRecParticlesInRun() const {return fRecParticlesInRun ;}
virtual void PlotDispersionCuts()const ;
virtual void SetDispersionCut(Float_t cut){fDispersion = cut ; }
virtual void SetCpvtoEmcDistanceCut(Float_t cut ) {fCpvEmcDistance = cut ;}
virtual void SetTimeGate(Float_t gate) {fTimeGate = gate ;}
- virtual void SetTrackSegmentsBranch(const char* title) { fTrackSegmentsTitle = title;}
- virtual void SetRecParticlesBranch (const char* title) { fRecParticlesTitle = title;}
+ // virtual void SetTrackSegmentsBranch(const char* title) { fTrackSegmentsTitle = title;}
+ // virtual void SetRecParticlesBranch (const char* title) { fRecParticlesTitle = title;}
virtual const char * Version() const { return "pid-v0" ; }
private:
AliPHOSClusterizer * fClusterizer ; // !
AliPHOSTrackSegmentMaker * fTSMaker ; // !
- TFormula * fFormula ; // formula to define cut on the shouer elips axis
+ TFormula * fFormula ; // formula to define cut on the shower elips axis
Float_t fDispersion ; // dispersion cut
Float_t fCpvEmcDistance ; // Max EMC-CPV distance
Float_t fTimeGate ; // Time of the latest EmcRecPoint accepted as EM
}
//____________________________________________________________________________
-AliPHOSPIDv1::AliPHOSPIDv1(const char * headerFile,const char * name, const char * from) : AliPHOSPID(headerFile, name)
-
-
+AliPHOSPIDv1::AliPHOSPIDv1(const char * headerFile,const char * name, const Bool_t toSplit)
+:AliPHOSPID(headerFile, name,toSplit)
{
//ctor with the indication on where to look for the track segments
InitParameters() ;
- if ( from == 0 )
- fFrom = name ;
- else
- fFrom = from ;
-
Init() ;
fDefaultInit = kFALSE ;
if (!fDefaultInit) {
- AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
+// AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
// remove the task from the folder list
- gime->RemoveTask("P",GetName()) ;
- TString name(GetName()) ;
- name.ReplaceAll("pid", "clu") ;
- gime->RemoveTask("C",name) ;
+// gime->RemoveTask("P",GetName()) ;
+// TString name(GetName()) ;
+// name.ReplaceAll("pid", "clu") ;
+// gime->RemoveTask("C",name) ;
- // remove the data from the folder list
- name = GetName() ;
- name.Remove(name.Index(":")) ;
- gime->RemoveObjects("RE", name) ; // EMCARecPoints
- gime->RemoveObjects("RC", name) ; // CPVRecPoints
- gime->RemoveObjects("T", name) ; // TrackSegments
- gime->RemoveObjects("P", name) ; // RecParticles
+// // remove the data from the folder list
+// name = GetName() ;
+// name.Remove(name.Index(":")) ;
+// gime->RemoveObjects("RE", name) ; // EMCARecPoints
+// gime->RemoveObjects("RC", name) ; // CPVRecPoints
+// gime->RemoveObjects("T", name) ; // TrackSegments
+// gime->RemoveObjects("P", name) ; // RecParticles
- // Delete gAlice
- gime->CloseFile() ;
+// // Delete gAlice
+// gime->CloseFile() ;
fSplitFile = 0 ;
}
if ( strcmp(GetTitle(), "") == 0 )
SetTitle("galice.root") ;
-
- AliPHOSGetter * gime = AliPHOSGetter::GetInstance(GetTitle(), fFrom.Data()) ;
- gime->SetRecParticlesTitle(BranchName()) ;
+ TString branchname(GetName()) ;
+ branchname.Remove(branchname.Index(Version())-1) ;
+ AliPHOSGetter * gime = AliPHOSGetter::GetInstance(GetTitle(),branchname.Data(),fToSplit ) ;
+
+ // gime->SetRecParticlesTitle(BranchName()) ;
if ( gime == 0 ) {
cerr << "ERROR: AliPHOSPIDv1::Init -> Could not obtain the Getter object !" << endl ;
return ;
}
+
+ fSplitFile = 0 ;
+ if(fToSplit){
+ //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="" ;
+ fileName+="PHOS.RecData." ;
+ if((strcmp(branchname.Data(),"Default")!=0)&&(strcmp(branchname.Data(),"")!=0)){
+ fileName+=branchname.Data() ;
+ fileName+="." ;
+ }
+ fileName+="root" ;
+ fSplitFile = static_cast<TFile*>(gROOT->GetFile(fileName.Data()));
+ if(!fSplitFile)
+ fSplitFile = TFile::Open(fileName.Data(),"update") ;
+ }
gime->PostPID(this) ;
// create a folder on the white board //YSAlice/WhiteBoard/RecParticles/PHOS/recparticlesName
- gime->PostRecParticles(BranchName()) ;
+ gime->PostRecParticles(branchname) ;
}
//____________________________________________________________________________
void AliPHOSPIDv1::InitParameters()
{
- fFrom = "" ;
- fHeaderFileName = GetTitle() ;
- TString name(GetName()) ;
- if (name.IsNull())
- name = "Default" ;
- fTrackSegmentsTitle = name ;
- fRecPointsTitle = name ;
- fRecParticlesTitle = name ;
- name.Append(":") ;
- name.Append(Version()) ;
- SetName(name) ;
+// fFrom = "" ;
+// fHeaderFileName = GetTitle() ;
+// TString name(GetName()) ;
+// if (name.IsNull())
+// name = "Default" ;
+// fTrackSegmentsTitle = name ;
+// fRecPointsTitle = name ;
+// fRecParticlesTitle = name ;
+// name.Append(":") ;
+// name.Append(Version()) ;
+// SetName(name) ;
fRecParticlesInRun = 0 ;
fNEvent = 0 ;
- fClusterizer = 0 ;
- fTSMaker = 0 ;
+ // fClusterizer = 0 ;
+ // fTSMaker = 0 ;
fRecParticlesInRun = 0 ;
+ TString pidName( GetName()) ;
+ if (pidName.IsNull() )
+ pidName = "Default" ;
+ pidName.Append(":") ;
+ pidName.Append(Version()) ;
+ SetName(pidName) ;
SetParameters() ; // fill the parameters matrix from parameters file
}
fParameters100 = new TMatrixD(22,3) ;
fParameters = new TMatrixD(22,3) ;
-#if defined (__GNUC__)&&(__GNUC__ >= 3)
ifstream paramFile5(fFileNamePar5) ;
-#else
- ifstream paramFile5(fFileNamePar5) ;
-#endif
Int_t i,j ;
}
paramFile5.close();
-#if defined (__GNUC__)&&(__GNUC__ >= 3)
- ifstream paramFile100(fFileNamePar100) ;
-#else
ifstream paramFile100(fFileNamePar100) ;
-#endif
Int_t l,k ;
}
paramFile100.close();
-#if defined (__GNUC__)&&(__GNUC__ >= 3)
ifstream paramFile(fFileNamePar100) ;
-#else
- ifstream paramFile(fFileNamePar100) ;
-#endif
Int_t h,n;
for(h = 0; h< 22; h++){
for(n = 0; n< 3; n++){
return ;
}
- //cout << gDirectory->GetName() << endl ;
- gAlice->GetEvent(0) ;
+// gAlice->GetEvent(0) ;
- //check, if the branch with name of this" already exits?
- if (gAlice->TreeR()) {
- TObjArray * lob = (TObjArray*)gAlice->TreeR()->GetListOfBranches() ;
- TIter next(lob) ;
- TBranch * branch = 0 ;
- Bool_t phospidfound = kFALSE, pidfound = kFALSE ;
+// //check, if the branch with name of this" already exits?
+// if (gAlice->TreeR()) {
+// TObjArray * lob = (TObjArray*)gAlice->TreeR()->GetListOfBranches() ;
+// TIter next(lob) ;
+// TBranch * branch = 0 ;
+// Bool_t phospidfound = kFALSE, pidfound = kFALSE ;
- TString taskName(GetName()) ;
- taskName.Remove(taskName.Index(Version())-1) ;
+// TString taskName(GetName()) ;
+// taskName.Remove(taskName.Index(Version())-1) ;
- while ( (branch = (TBranch*)next()) && (!phospidfound || !pidfound) ) {
- if ( (strcmp(branch->GetName(), "PHOSPID")==0) && (strcmp(branch->GetTitle(), taskName.Data())==0) )
- phospidfound = kTRUE ;
+// while ( (branch = (TBranch*)next()) && (!phospidfound || !pidfound) ) {
+// if ( (strcmp(branch->GetName(), "PHOSPID")==0) && (strcmp(branch->GetTitle(), taskName.Data())==0) )
+// phospidfound = kTRUE ;
- else if ( (strcmp(branch->GetName(), "AliPHOSPID")==0) && (strcmp(branch->GetTitle(), taskName.Data())==0) )
- pidfound = kTRUE ;
- }
+// else if ( (strcmp(branch->GetName(), "AliPHOSPID")==0) && (strcmp(branch->GetTitle(), taskName.Data())==0) )
+// pidfound = kTRUE ;
+// }
- if ( phospidfound || pidfound ) {
- cerr << "WARNING: AliPHOSPIDv1::Exec -> RecParticles and/or PIDtMaker branch with name "
- << taskName.Data() << " already exits" << endl ;
- return ;
- }
- }
+// if ( phospidfound || pidfound ) {
+// cerr << "WARNING: AliPHOSPIDv1::Exec -> RecParticles and/or PIDtMaker branch with name "
+// << taskName.Data() << " already exits" << endl ;
+// return ;
+// }
+// }
+
+// Int_t nevents = (Int_t) gAlice->TreeE()->GetEntries() ;
+// Int_t ievent ;
+// AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
- Int_t nevents = (Int_t) gAlice->TreeE()->GetEntries() ;
+ AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
+ if(gime->BranchExists("RecParticles") )
+ return ;
+ Int_t nevents = gime->MaxEvent() ; //(Int_t) gAlice->TreeE()->GetEntries() ;
Int_t ievent ;
- AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
+
+
for(ievent = 0; ievent < nevents; ievent++){
gime->Event(ievent,"R") ;
// Makes a RecParticle out of a TrackSegment
AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
- TObjArray * emcRecPoints = gime->EmcRecPoints(fFrom) ;
- TObjArray * cpvRecPoints = gime->CpvRecPoints(fFrom) ;
- TClonesArray * trackSegments = gime->TrackSegments(fFrom) ;
+ TObjArray * emcRecPoints = gime->EmcRecPoints() ;
+ TObjArray * cpvRecPoints = gime->CpvRecPoints() ;
+ TClonesArray * trackSegments = gime->TrackSegments() ;
if ( !emcRecPoints || !cpvRecPoints || !trackSegments ) {
- cerr << "ERROR: AliPHOSPIDv1::MakeRecParticles -> RecPoints or TrackSegments with name "
- << fFrom << " not found ! " << endl ;
+ cerr << "ERROR: AliPHOSPIDv1::MakeRecParticles -> RecPoints or TrackSegments not found ! " << endl ;
abort() ;
}
- TClonesArray * recParticles = gime->RecParticles(BranchName()) ;
+ TClonesArray * recParticles = gime->RecParticles() ;
recParticles->Clear();
AliPHOSTrackSegment * ts ;
Int_t index = 0 ;
AliPHOSRecParticle * rp ;
-
while ( (ts = (AliPHOSTrackSegment *)next()) ) {
new( (*recParticles)[index] ) AliPHOSRecParticle() ;
// Choose the cluster energy range
+ // YK: check if (emc != 0) !!!
+ if (!emc) {
+ cerr << "ERROR: AliPHOSPIDv1::MakeRecParticles -> emc("
+ <<ts->GetEmcIndex()<<") = " <<emc<< endl;
+ abort();
+ }
Float_t e = emc->GetEnergy() ;
GetAnalysisParameters(e);// Gives value to fCluster, fClusterrcpv, fMatrixExtraRow, and to fPrincipal and fParameters depending on the energy.
// Print the parameters used for the particle type identification
cout << "=============== AliPHOSPID1 ================" << endl ;
cout << "Making PID "<< endl ;
- cout << " Headers file: " << fHeaderFileName.Data() << endl ;
- cout << " RecPoints branch title: " << fRecPointsTitle.Data() << endl ;
- cout << " TrackSegments Branch title: " << fTrackSegmentsTitle.Data() << endl ;
- cout << " RecParticles Branch title " << fRecParticlesTitle.Data() << endl;
+// cout << " Headers file: " << fHeaderFileName.Data() << endl ;
+// cout << " RecPoints branch title: " << fRecPointsTitle.Data() << endl ;
+// cout << " TrackSegments Branch title: " << fTrackSegmentsTitle.Data() << endl ;
+// cout << " RecParticles Branch title " << fRecParticlesTitle.Data() << endl;
cout << " Pricipal analysis file from 0.5 to 5 " << fFileName5.Data() << endl;
cout << " Name of parameters file "<<fFileNamePar5.Data() << endl ;
AliPHOSGetter *gime = AliPHOSGetter::GetInstance() ;
- TClonesArray * recParticles = gime->RecParticles(BranchName()) ;
+ TClonesArray * recParticles = gime->RecParticles() ;
recParticles->Expand(recParticles->GetEntriesFast() ) ;
- TTree * treeR = gAlice->TreeR() ;
-
- if (!treeR)
- gAlice->MakeTree("R", fSplitFile);
- treeR = gAlice->TreeR() ;
+ TTree * treeR ;
+
+ if(fToSplit){
+ if(!fSplitFile)
+ return ;
+ fSplitFile->cd() ;
+ char name[10] ;
+ sprintf(name,"%s%d", "TreeR",event) ;
+ treeR = dynamic_cast<TTree*>(fSplitFile->Get(name));
+ }
+ else{
+ treeR = gAlice->TreeR();
+ }
+
+ if(!treeR){
+ gAlice->MakeTree("R", fSplitFile);
+ treeR = gAlice->TreeR() ;
+ }
//First rp
Int_t bufferSize = 32000 ;
TBranch * rpBranch = treeR->Branch("PHOSRP",&recParticles,bufferSize);
- rpBranch->SetTitle(fRecParticlesTitle);
+ rpBranch->SetTitle(BranchName());
//second, pid
Int_t splitlevel = 0 ;
AliPHOSPIDv1 * pid = this ;
TBranch * pidBranch = treeR->Branch("AliPHOSPID","AliPHOSPIDv1",&pid,bufferSize,splitlevel);
- pidBranch->SetTitle(fRecParticlesTitle.Data());
+ pidBranch->SetTitle(BranchName());
rpBranch->Fill() ;
pidBranch->Fill() ;
- gAlice->TreeR()->AutoSave() ;// Write(0,kOverwrite) ;
-
+ treeR->AutoSave() ; //Write(0,kOverwrite) ;
+ if(gAlice->TreeR()!=treeR){
+ treeR->Delete();
+ }
}
//____________________________________________________________________________
public:
AliPHOSPIDv1() ; // ctor
- AliPHOSPIDv1(const char* headerFile, const char * tsBranch = "Default", const char * from = 0) ;
+ AliPHOSPIDv1(const char* headerFile, const char * tsBranch = "Default", const Bool_t toSplit=kFALSE) ;
virtual ~AliPHOSPIDv1() ; // dtor
virtual void Exec(Option_t * option) ;
- virtual char * GetRecParticlesBranch()const {return (char*) fRecParticlesTitle.Data() ;}
- virtual char * GetTrackSegmentsBranch()const{return (char*) fTrackSegmentsTitle.Data(); }
+ // virtual char * GetRecParticlesBranch()const {return (char*) fRecParticlesTitle.Data() ;}
+ // virtual char * GetTrackSegmentsBranch()const{return (char*) fTrackSegmentsTitle.Data(); }
virtual const Int_t GetRecParticlesInRun() const {return fRecParticlesInRun ;}
virtual void Print(Option_t * option) const {}
Float_t GetEnergyAnalysisCut() {return fEnergyAnalysisCut ;}
void SetEnergyAnalysisCut(Float_t e) { fEnergyAnalysisCut = e ;}
- virtual void SetTrackSegmentsBranch(const char* title) { fTrackSegmentsTitle = title;}
- virtual void SetRecParticlesBranch (const char* title) { fRecParticlesTitle = title;}
+ // virtual void SetTrackSegmentsBranch(const char* title) { fTrackSegmentsTitle = title;}
+ // virtual void SetRecParticlesBranch (const char* title) { fRecParticlesTitle = title;}
virtual const char * Version() const { return "pid-v1" ; }
private:
TString fFileNamePar100 ;// File that contains the parameters for analysis from 0.5 to 100 GeV
- TString fFrom ; // name of Recpoints and TrackSegments
- TString fHeaderFileName ; // file name with event header
- TString fTrackSegmentsTitle; // branch name with track segments
- TString fRecPointsTitle ; // branch name with rec points
- TString fRecParticlesTitle ; // branch name with rec particles
+ // TString fFrom ; // name of Recpoints and TrackSegments
+ // TString fHeaderFileName ; // file name with event header
+ // TString fTrackSegmentsTitle; // branch name with track segments
+ // TString fRecPointsTitle ; // branch name with rec points
+ // TString fRecParticlesTitle ; // branch name with rec particles
Int_t fNEvent ; //! current event number
- AliPHOSClusterizer * fClusterizer ; //! clusterizer
- AliPHOSTrackSegmentMaker * fTSMaker ; //! track segment maker
+ // AliPHOSClusterizer * fClusterizer ; //! clusterizer
+ // AliPHOSTrackSegmentMaker * fTSMaker ; //! track segment maker
TPrincipal * fPrincipal5 ; //! TPrincipal from fFileName5
TPrincipal * fPrincipal100 ; //! TPrincipal from fFileName100
AliPHOSReconstructioner::AliPHOSReconstructioner():TTask("AliPHOSReconstructioner","")
{
// ctor
+ fToSplit = kFALSE ;
fDigitizer = 0 ;
fClusterizer = 0 ;
fTSMaker = 0 ;
}
//____________________________________________________________________________
-AliPHOSReconstructioner::AliPHOSReconstructioner(const char* headerFile,const char * branchName):
+AliPHOSReconstructioner::AliPHOSReconstructioner(const char* headerFile,const char * branchName,Bool_t toSplit):
TTask("AliPHOSReconstructioner","")
{
// ctor
fHeaderFileName = headerFile ;
-
+ fToSplit = toSplit ;
fSDigitsBranch= branchName;
- fSDigitizer = new AliPHOSSDigitizer(fHeaderFileName.Data(),fSDigitsBranch.Data()) ;
+ fSDigitizer = new AliPHOSSDigitizer(fHeaderFileName.Data(),fSDigitsBranch.Data(),toSplit) ;
Add(fSDigitizer) ;
fDigitsBranch=branchName ;
- fDigitizer = new AliPHOSDigitizer(fHeaderFileName.Data(),fDigitsBranch.Data()) ;
+ fDigitizer = new AliPHOSDigitizer(fHeaderFileName.Data(),fDigitsBranch.Data(),toSplit) ;
Add(fDigitizer) ;
fRecPointBranch=branchName ;
- fClusterizer = new AliPHOSClusterizerv1(fHeaderFileName.Data(),fRecPointBranch.Data()) ;
+ fClusterizer = new AliPHOSClusterizerv1(fHeaderFileName.Data(),fRecPointBranch.Data(),toSplit) ;
Add(fClusterizer) ;
fTSBranch=branchName ;
- fTSMaker = new AliPHOSTrackSegmentMakerv1(fHeaderFileName.Data(),fTSBranch.Data()) ;
+ fTSMaker = new AliPHOSTrackSegmentMakerv1(fHeaderFileName.Data(),fTSBranch.Data(),toSplit) ;
Add(fTSMaker) ;
fRecPartBranch=branchName ;
- fPID = new AliPHOSPIDv1(fHeaderFileName.Data(),fRecPartBranch.Data()) ;
+ fPID = new AliPHOSPIDv1(fHeaderFileName.Data(),fRecPartBranch.Data(),toSplit) ;
Add(fPID) ;
fIsInitialized = kTRUE ;
if(!fIsInitialized)
Init() ;
- gAlice->GetEvent(0) ;
-
- if(fSDigitizer->IsActive()&& gAlice->TreeS()){ //Will produce SDigits
- TBranch * sdigitsBranch = 0;
- TBranch * sdigitizerBranch = 0;
-
- TObjArray * branches = gAlice->TreeS()->GetListOfBranches() ;
- Int_t ibranch;
- Bool_t phosNotFound = kTRUE ;
- Bool_t sdigitizerNotFound = kTRUE ;
-
- for(ibranch = 0;ibranch <branches->GetEntries();ibranch++){
- if(phosNotFound){
- sdigitsBranch=(TBranch *) branches->At(ibranch) ;
- if(( strcmp("PHOS",sdigitsBranch->GetName())==0 ) &&
- (fSDigitsBranch.CompareTo(sdigitsBranch->GetTitle())== 0 ))
- phosNotFound = kFALSE ;
- }
- if(sdigitizerNotFound){
- sdigitizerBranch = (TBranch *) branches->At(ibranch) ;
- if(( strcmp(sdigitizerBranch->GetName(),"AliPHOSSDigitizer") == 0) &&
- (fSDigitsBranch.CompareTo(sdigitizerBranch->GetTitle())== 0 ) )
- sdigitizerNotFound = kFALSE ;
- }
- }
+// gAlice->GetEvent(0) ;
+
+// if(fSDigitizer->IsActive()&& gAlice->TreeS()){ //Will produce SDigits
+// TBranch * sdigitsBranch = 0;
+// TBranch * sdigitizerBranch = 0;
+
+// TObjArray * branches = gAlice->TreeS()->GetListOfBranches() ;
+// Int_t ibranch;
+// Bool_t phosNotFound = kTRUE ;
+// Bool_t sdigitizerNotFound = kTRUE ;
+
+// for(ibranch = 0;ibranch <branches->GetEntries();ibranch++){
+// if(phosNotFound){
+// sdigitsBranch=(TBranch *) branches->At(ibranch) ;
+// if(( strcmp("PHOS",sdigitsBranch->GetName())==0 ) &&
+// (fSDigitsBranch.CompareTo(sdigitsBranch->GetTitle())== 0 ))
+// phosNotFound = kFALSE ;
+// }
+// if(sdigitizerNotFound){
+// sdigitizerBranch = (TBranch *) branches->At(ibranch) ;
+// if(( strcmp(sdigitizerBranch->GetName(),"AliPHOSSDigitizer") == 0) &&
+// (fSDigitsBranch.CompareTo(sdigitizerBranch->GetTitle())== 0 ) )
+// sdigitizerNotFound = kFALSE ;
+// }
+// }
- if(!(sdigitizerNotFound && phosNotFound)){
- cout << "AliPHOSReconstructioner error: "<< endl ;
- cout << " Branches ''PHOS'' or ''AliPHOSSDigitizer'' with title ``" << fSDigitsBranch.Data() << "''" << endl ;
- cout << " already exist in TreeS. ROOT does not allow updating/overwriting." << endl ;
- cout << " Specify another title for branches or use ''StartFrom()'' method" << endl ;
+// if(!(sdigitizerNotFound && phosNotFound)){
+// cout << "AliPHOSReconstructioner error: "<< endl ;
+// cout << " Branches ''PHOS'' or ''AliPHOSSDigitizer'' with title ``" << fSDigitsBranch.Data() << "''" << endl ;
+// cout << " already exist in TreeS. ROOT does not allow updating/overwriting." << endl ;
+// cout << " Specify another title for branches or use ''StartFrom()'' method" << endl ;
- //mark all tasks as inactive
- TIter next(fTasks);
- TTask *task;
- while((task=(TTask*)next()))
- task->SetActive(kFALSE) ;
+// //mark all tasks as inactive
+// TIter next(fTasks);
+// TTask *task;
+// while((task=(TTask*)next()))
+// task->SetActive(kFALSE) ;
- return ;
- }
- }
+// return ;
+// }
+// }
- if(fDigitizer->IsActive() && gAlice->TreeD()){ //Will produce Digits
- TBranch * digitsBranch = 0;
- TBranch * digitizerBranch = 0;
+// if(fDigitizer->IsActive() && gAlice->TreeD()){ //Will produce Digits
+// TBranch * digitsBranch = 0;
+// TBranch * digitizerBranch = 0;
- TObjArray * branches = gAlice->TreeD()->GetListOfBranches() ;
- Int_t ibranch;
- Bool_t phosNotFound = kTRUE ;
- Bool_t digitizerNotFound = kTRUE ;
+// TObjArray * branches = gAlice->TreeD()->GetListOfBranches() ;
+// Int_t ibranch;
+// Bool_t phosNotFound = kTRUE ;
+// Bool_t digitizerNotFound = kTRUE ;
- for(ibranch = 0;ibranch <branches->GetEntries();ibranch++){
- if(phosNotFound){
- digitsBranch=(TBranch *) branches->At(ibranch) ;
- if(( strcmp("PHOS",digitsBranch->GetName())==0 ) &&
- (fDigitsBranch.CompareTo(digitsBranch->GetTitle())== 0 ))
- phosNotFound = kFALSE ;
- }
- if(digitizerNotFound){
- digitizerBranch = (TBranch *) branches->At(ibranch) ;
- if(( strcmp(digitizerBranch->GetName(),"AliPHOSDigitizer") == 0) &&
- (fDigitsBranch.CompareTo(digitizerBranch->GetTitle())== 0 ) )
- digitizerNotFound = kFALSE ;
- }
- }
+// for(ibranch = 0;ibranch <branches->GetEntries();ibranch++){
+// if(phosNotFound){
+// digitsBranch=(TBranch *) branches->At(ibranch) ;
+// if(( strcmp("PHOS",digitsBranch->GetName())==0 ) &&
+// (fDigitsBranch.CompareTo(digitsBranch->GetTitle())== 0 ))
+// phosNotFound = kFALSE ;
+// }
+// if(digitizerNotFound){
+// digitizerBranch = (TBranch *) branches->At(ibranch) ;
+// if(( strcmp(digitizerBranch->GetName(),"AliPHOSDigitizer") == 0) &&
+// (fDigitsBranch.CompareTo(digitizerBranch->GetTitle())== 0 ) )
+// digitizerNotFound = kFALSE ;
+// }
+// }
- if(!(digitizerNotFound && phosNotFound)){
- cout << "AliPHOSReconstructioner error: "<< endl ;
- cout << " Branches ''PHOS'' or ''AliPHOSDigitizer'' with title ``" << fDigitsBranch.Data() << "''" << endl ;
- cout << " already exist in TreeD. ROOT does not allow updating/overwriting." << endl ;
- cout << " Specify another title for branches or use ''StartFrom()'' method" << endl ;
+// if(!(digitizerNotFound && phosNotFound)){
+// cout << "AliPHOSReconstructioner error: "<< endl ;
+// cout << " Branches ''PHOS'' or ''AliPHOSDigitizer'' with title ``" << fDigitsBranch.Data() << "''" << endl ;
+// cout << " already exist in TreeD. ROOT does not allow updating/overwriting." << endl ;
+// cout << " Specify another title for branches or use ''StartFrom()'' method" << endl ;
- //mark all tasks as inactive
- TIter next(fTasks);
- TTask *task;
- while((task=(TTask*)next()))
- task->SetActive(kFALSE) ;
+// //mark all tasks as inactive
+// TIter next(fTasks);
+// TTask *task;
+// while((task=(TTask*)next()))
+// task->SetActive(kFALSE) ;
- return ;
- }
- }
-
- if(fClusterizer->IsActive() && gAlice->TreeR()){ //Will produce RecPoints
- TBranch * emcBranch = 0;
- TBranch * cpvBranch = 0;
- TBranch * clusterizerBranch = 0;
+// return ;
+// }
+// }
+
+// if(fClusterizer->IsActive() && gAlice->TreeR()){ //Will produce RecPoints
+// TBranch * emcBranch = 0;
+// TBranch * cpvBranch = 0;
+// TBranch * clusterizerBranch = 0;
- TObjArray * branches = gAlice->TreeR()->GetListOfBranches() ;
- Int_t ibranch;
- Bool_t emcNotFound = kTRUE ;
- Bool_t cpvNotFound = kTRUE ;
- Bool_t clusterizerNotFound = kTRUE ;
+// TObjArray * branches = gAlice->TreeR()->GetListOfBranches() ;
+// Int_t ibranch;
+// Bool_t emcNotFound = kTRUE ;
+// Bool_t cpvNotFound = kTRUE ;
+// Bool_t clusterizerNotFound = kTRUE ;
- for(ibranch = 0;ibranch <branches->GetEntries();ibranch++){
+// for(ibranch = 0;ibranch <branches->GetEntries();ibranch++){
- if(emcNotFound){
- emcBranch=(TBranch *) branches->At(ibranch) ;
- if(fRecPointBranch.CompareTo(emcBranch->GetTitle())==0 )
- if( strcmp(emcBranch->GetName(),"PHOSEmcRP") == 0)
- emcNotFound = kFALSE ;
- }
- if(cpvNotFound){
- cpvBranch=(TBranch *) branches->At(ibranch) ;
- if(fRecPointBranch.CompareTo(cpvBranch->GetTitle())==0 )
- if( strcmp(cpvBranch->GetName(),"PHOSCpvRP") == 0)
- cpvNotFound = kFALSE ;
- }
- if(clusterizerNotFound){
- clusterizerBranch = (TBranch *) branches->At(ibranch) ;
- if( fRecPointBranch.CompareTo(clusterizerBranch->GetTitle()) == 0)
- if( strcmp(clusterizerBranch->GetName(),"AliPHOSClusterizer") == 0)
- clusterizerNotFound = kFALSE ;
- }
- }
-
- if(!(clusterizerNotFound && emcNotFound && cpvNotFound)){
- cout << "AliPHOSReconstructioner error: "<< endl ;
- cout << " Branches ''PHOSEmcRP'', ''PHOSCpvRP'' or ''AliPHOSClusterizer'' with title ``"
- << fRecPointBranch.Data() << "''" << endl ;
- cout << " already exist in TreeR. ROOT does not allow updating/overwriting." << endl ;
- cout << " Specify another title for branches or use ''StartFrom()'' method" << endl ;
+// if(emcNotFound){
+// emcBranch=(TBranch *) branches->At(ibranch) ;
+// if(fRecPointBranch.CompareTo(emcBranch->GetTitle())==0 )
+// if( strcmp(emcBranch->GetName(),"PHOSEmcRP") == 0)
+// emcNotFound = kFALSE ;
+// }
+// if(cpvNotFound){
+// cpvBranch=(TBranch *) branches->At(ibranch) ;
+// if(fRecPointBranch.CompareTo(cpvBranch->GetTitle())==0 )
+// if( strcmp(cpvBranch->GetName(),"PHOSCpvRP") == 0)
+// cpvNotFound = kFALSE ;
+// }
+// if(clusterizerNotFound){
+// clusterizerBranch = (TBranch *) branches->At(ibranch) ;
+// if( fRecPointBranch.CompareTo(clusterizerBranch->GetTitle()) == 0)
+// if( strcmp(clusterizerBranch->GetName(),"AliPHOSClusterizer") == 0)
+// clusterizerNotFound = kFALSE ;
+// }
+// }
+
+// if(!(clusterizerNotFound && emcNotFound && cpvNotFound)){
+// cout << "AliPHOSReconstructioner error: "<< endl ;
+// cout << " Branches ''PHOSEmcRP'', ''PHOSCpvRP'' or ''AliPHOSClusterizer'' with title ``"
+// << fRecPointBranch.Data() << "''" << endl ;
+// cout << " already exist in TreeR. ROOT does not allow updating/overwriting." << endl ;
+// cout << " Specify another title for branches or use ''StartFrom()'' method" << endl ;
- //mark all tasks as inactive
- TIter next(fTasks);
- TTask *task;
- while((task=(TTask*)next()))
- task->SetActive(kFALSE) ;
- return ;
- }
- }
+// //mark all tasks as inactive
+// TIter next(fTasks);
+// TTask *task;
+// while((task=(TTask*)next()))
+// task->SetActive(kFALSE) ;
+// return ;
+// }
+// }
- if(fTSMaker->IsActive() && gAlice->TreeR()){ //Produce TrackSegments
- TBranch * tsMakerBranch = 0;
- TBranch * tsBranch = 0;
+// if(fTSMaker->IsActive() && gAlice->TreeR()){ //Produce TrackSegments
+// TBranch * tsMakerBranch = 0;
+// TBranch * tsBranch = 0;
- TObjArray * branches = gAlice->TreeR()->GetListOfBranches() ;
- Int_t ibranch;
- Bool_t tsMakerNotFound = kTRUE ;
- Bool_t tsNotFound = kTRUE ;
+// TObjArray * branches = gAlice->TreeR()->GetListOfBranches() ;
+// Int_t ibranch;
+// Bool_t tsMakerNotFound = kTRUE ;
+// Bool_t tsNotFound = kTRUE ;
- for(ibranch = 0;(ibranch <branches->GetEntries())&&(tsMakerNotFound||tsNotFound);ibranch++){
- if(tsMakerNotFound){
- tsMakerBranch=(TBranch *) branches->At(ibranch) ;
- if( fTSBranch.CompareTo(tsMakerBranch->GetTitle())==0 )
- if( strcmp(tsMakerBranch->GetName(),"AliPHOSTrackSegmentMaker") == 0)
- tsMakerNotFound = kFALSE ;
- }
- if(tsNotFound){
- tsBranch=(TBranch *) branches->At(ibranch) ;
- if( fTSBranch.CompareTo(tsBranch->GetTitle())==0 )
- if( strcmp(tsBranch->GetName(),"PHOSTS") == 0)
- tsNotFound = kFALSE ;
- }
- }
+// for(ibranch = 0;(ibranch <branches->GetEntries())&&(tsMakerNotFound||tsNotFound);ibranch++){
+// if(tsMakerNotFound){
+// tsMakerBranch=(TBranch *) branches->At(ibranch) ;
+// if( fTSBranch.CompareTo(tsMakerBranch->GetTitle())==0 )
+// if( strcmp(tsMakerBranch->GetName(),"AliPHOSTrackSegmentMaker") == 0)
+// tsMakerNotFound = kFALSE ;
+// }
+// if(tsNotFound){
+// tsBranch=(TBranch *) branches->At(ibranch) ;
+// if( fTSBranch.CompareTo(tsBranch->GetTitle())==0 )
+// if( strcmp(tsBranch->GetName(),"PHOSTS") == 0)
+// tsNotFound = kFALSE ;
+// }
+// }
- if(!(tsMakerNotFound &&tsNotFound) ){
- cout << "AliPHOSReconstructioner error: "<< endl ;
- cout << " Branches ''PHOSTS'' or ''AliPHOSTrackSegmentMaker'' with title ``"
- << fTSBranch.Data() << "''" << endl ;
- cout << " already exist in TreeR. ROOT does not allow updating/overwriting." << endl ;
- cout << " Specify another title for branches or use ''StartFrom()'' method" << endl ;
+// if(!(tsMakerNotFound &&tsNotFound) ){
+// cout << "AliPHOSReconstructioner error: "<< endl ;
+// cout << " Branches ''PHOSTS'' or ''AliPHOSTrackSegmentMaker'' with title ``"
+// << fTSBranch.Data() << "''" << endl ;
+// cout << " already exist in TreeR. ROOT does not allow updating/overwriting." << endl ;
+// cout << " Specify another title for branches or use ''StartFrom()'' method" << endl ;
- //mark all tasks as inactive
- TIter next(fTasks);
- TTask *task;
- while((task=(TTask*)next()))
- task->SetActive(kFALSE) ;
- return ;
+// //mark all tasks as inactive
+// TIter next(fTasks);
+// TTask *task;
+// while((task=(TTask*)next()))
+// task->SetActive(kFALSE) ;
+// return ;
- }
+// }
- }
+// }
- if(fPID->IsActive() && gAlice->TreeR()){ //Produce RecParticles
- TBranch * pidBranch = 0;
- TBranch * rpBranch = 0;
+// if(fPID->IsActive() && gAlice->TreeR()){ //Produce RecParticles
+// TBranch * pidBranch = 0;
+// TBranch * rpBranch = 0;
- TObjArray * branches = gAlice->TreeR()->GetListOfBranches() ;
- Int_t ibranch;
- Bool_t pidNotFound = kTRUE ;
- Bool_t rpNotFound = kTRUE ;
+// TObjArray * branches = gAlice->TreeR()->GetListOfBranches() ;
+// Int_t ibranch;
+// Bool_t pidNotFound = kTRUE ;
+// Bool_t rpNotFound = kTRUE ;
- for(ibranch = 0;(ibranch <branches->GetEntries()) && pidNotFound && rpNotFound ;ibranch++){
- if(pidNotFound){
- pidBranch=(TBranch *) branches->At(ibranch) ;
- if( (strcmp(fRecPartBranch,pidBranch->GetTitle())==0 ) &&
- (strcmp(pidBranch->GetName(),"AliPHOSPID") == 0) )
- pidNotFound = kFALSE ;
- }
- if(rpNotFound){
- rpBranch=(TBranch *) branches->At(ibranch) ;
- if( (strcmp(fRecPartBranch,rpBranch->GetTitle())==0 ) &&
- (strcmp(rpBranch->GetName(),"PHOSRP") == 0) )
- rpNotFound = kFALSE ;
- }
- }
+// for(ibranch = 0;(ibranch <branches->GetEntries()) && pidNotFound && rpNotFound ;ibranch++){
+// if(pidNotFound){
+// pidBranch=(TBranch *) branches->At(ibranch) ;
+// if( (strcmp(fRecPartBranch,pidBranch->GetTitle())==0 ) &&
+// (strcmp(pidBranch->GetName(),"AliPHOSPID") == 0) )
+// pidNotFound = kFALSE ;
+// }
+// if(rpNotFound){
+// rpBranch=(TBranch *) branches->At(ibranch) ;
+// if( (strcmp(fRecPartBranch,rpBranch->GetTitle())==0 ) &&
+// (strcmp(rpBranch->GetName(),"PHOSRP") == 0) )
+// rpNotFound = kFALSE ;
+// }
+// }
- if(!pidNotFound || !rpNotFound ){
- cout << "AliPHOSReconstructioner error: "<< endl ;
- cout << " Branches ''PHOSRP'' or ''AliPHOSPID'' with title ``"
- << fRecPartBranch.Data() << "''" << endl ;
- cout << " already exist in TreeR. ROOT does not allow updating/overwriting." << endl ;
- cout << " Specify another title for branches." << endl ;
+// if(!pidNotFound || !rpNotFound ){
+// cout << "AliPHOSReconstructioner error: "<< endl ;
+// cout << " Branches ''PHOSRP'' or ''AliPHOSPID'' with title ``"
+// << fRecPartBranch.Data() << "''" << endl ;
+// cout << " already exist in TreeR. ROOT does not allow updating/overwriting." << endl ;
+// cout << " Specify another title for branches." << endl ;
- //mark all tasks as inactive
- TIter next(fTasks);
- TTask *task;
- while((task=(TTask*)next()))
- task->SetActive(kFALSE) ;
- return ;
- }
+// //mark all tasks as inactive
+// TIter next(fTasks);
+// TTask *task;
+// while((task=(TTask*)next()))
+// task->SetActive(kFALSE) ;
+// return ;
+// }
- }
+// }
}
//____________________________________________________________________________
void AliPHOSReconstructioner::Init()
// Initialisation
fSDigitsBranch="Default" ;
- fSDigitizer = new AliPHOSSDigitizer(fHeaderFileName.Data(),fSDigitsBranch.Data()) ;
+ fSDigitizer = new AliPHOSSDigitizer(fHeaderFileName.Data(),fSDigitsBranch.Data(),fToSplit) ;
Add(fSDigitizer) ;
fDigitsBranch="Default" ;
- fDigitizer = new AliPHOSDigitizer(fHeaderFileName.Data(),fDigitsBranch.Data()) ;
+ fDigitizer = new AliPHOSDigitizer(fHeaderFileName.Data(),fDigitsBranch.Data(),fToSplit) ;
Add(fDigitizer) ;
fRecPointBranch="Default" ;
- fClusterizer = new AliPHOSClusterizerv1(fHeaderFileName.Data(),fRecPointBranch.Data()) ;
+ fClusterizer = new AliPHOSClusterizerv1(fHeaderFileName.Data(),fRecPointBranch.Data(),fToSplit) ;
Add(fClusterizer) ;
fTSBranch="Default" ;
- fTSMaker = new AliPHOSTrackSegmentMakerv1(fHeaderFileName.Data(),fTSBranch.Data()) ;
+ fTSMaker = new AliPHOSTrackSegmentMakerv1(fHeaderFileName.Data(),fTSBranch.Data(),fToSplit) ;
Add(fTSMaker) ;
fRecPartBranch="Default" ;
- fPID = new AliPHOSPIDv1(fHeaderFileName.Data(),fRecPartBranch.Data()) ;
+ fPID = new AliPHOSPIDv1(fHeaderFileName.Data(),fRecPartBranch.Data(),fToSplit) ;
Add(fPID) ;
fIsInitialized = kTRUE ;
// }
}
-//____________________________________________________________________________
-void AliPHOSReconstructioner::SetBranchTitle(const char* branch, const char * title)
-{
- //Diverge correcpoinding branch to the file "title"
-
- if(strcmp(branch,"SDigits") == 0){
- fSDigitizer->SetSDigitsBranch(title) ;
- fDigitizer->SetSDigitsBranch(title) ;
- fSDigitsBranch = title ;
- return ;
- }
+// //____________________________________________________________________________
+// void AliPHOSReconstructioner::SetBranchTitle(const char* branch, const char * title)
+// {
+// //Diverge correcpoinding branch to the file "title"
+
+// if(strcmp(branch,"SDigits") == 0){
+// fSDigitizer->SetSDigitsBranch(title) ;
+// fDigitizer->SetSDigitsBranch(title) ;
+// fSDigitsBranch = title ;
+// return ;
+// }
- if(strcmp(branch,"Digits") == 0){
- fDigitizer->SetName(title) ;
- fClusterizer->SetName(title) ;
- fDigitsBranch = title ;
- return ;
- }
-
- if(strcmp(branch,"RecPoints") == 0){
- fClusterizer->SetRecPointsBranch(title) ;
- fTSMaker->SetRecPointsBranch(title) ;
- fRecPointBranch = title ;
- return ;
- }
-
- if(strcmp(branch,"TrackSegments") == 0){
- fTSMaker->SetTrackSegmentsBranch(title) ;
- fPID->SetTrackSegmentsBranch(title) ;
- fTSBranch = title ;
- return ;
- }
-
- if(strcmp(branch,"RecParticles") == 0){
- fPID->SetRecParticlesBranch(title) ;
- fRecPartBranch = title ;
- return ;
- }
-
- cout << "There is no branch " << branch << "!"<< endl ;
- cout << "Available branches `SDigits', `Digits', `RecPoints', `TrackSegments' and `RecParticles' " << endl ;
+// if(strcmp(branch,"Digits") == 0){
+// fDigitizer->SetName(title) ;
+// fClusterizer->SetName(title) ;
+// fDigitsBranch = title ;
+// return ;
+// }
+
+// if(strcmp(branch,"RecPoints") == 0){
+// fClusterizer->SetRecPointsBranch(title) ;
+// fTSMaker->SetRecPointsBranch(title) ;
+// fRecPointBranch = title ;
+// return ;
+// }
+
+// if(strcmp(branch,"TrackSegments") == 0){
+// fTSMaker->SetTrackSegmentsBranch(title) ;
+// fPID->SetTrackSegmentsBranch(title) ;
+// fTSBranch = title ;
+// return ;
+// }
+
+// if(strcmp(branch,"RecParticles") == 0){
+// fPID->SetRecParticlesBranch(title) ;
+// fRecPartBranch = title ;
+// return ;
+// }
+
+// cout << "There is no branch " << branch << "!"<< endl ;
+// cout << "Available branches `SDigits', `Digits', `RecPoints', `TrackSegments' and `RecParticles' " << endl ;
-}
-//____________________________________________________________________________
-void AliPHOSReconstructioner::StartFrom(char * module,char* title)
-{
- // in the next pass of reconstruction (call ExecuteTask()) reconstruction will
- // start from the module "module", and in the case of non zero title all
- // pruduced branches will have title "title". The following "modules" are recognized
- // "SD" - AliPHOSSDigitizer,
- // "D" - AliPHOSDigitizer
- // "C" - AliPHOSClusterizer
- // "TS" - AliPHOSTrackSegmentMaker
- // "RP" - AliPHOSPID
-
- if(!fIsInitialized)
- Init() ;
-
- char * moduleName = new char[30];
- if(strstr(module,"SD"))
- sprintf(moduleName,"AliPHOSSDigitizer") ;
- else
- if(strstr(module,"D") )
- sprintf(moduleName,"AliPHOSDigitizer") ;
- else
- if(strstr(module,"C") || strstr(module,"RecPoint") )
- sprintf(moduleName,"AliPHOSClusterizer") ;
- else
- if(strstr(module,"TS") || strstr(module,"Track") )
- sprintf(moduleName,"AliPHOSTrackSegmentMaker") ;
- else
- if(strstr(module,"PID") || strstr(module,"Particle") || strstr(module,"RP") )
- sprintf(moduleName,"AliPHOSPID") ;
- else{
- cout << "Do not know such a module / Rec Object " << endl;
- return ;
- }
+// }
+// //____________________________________________________________________________
+// void AliPHOSReconstructioner::StartFrom(char * module,char* title)
+// {
+// // in the next pass of reconstruction (call ExecuteTask()) reconstruction will
+// // start from the module "module", and in the case of non zero title all
+// // pruduced branches will have title "title". The following "modules" are recognized
+// // "SD" - AliPHOSSDigitizer,
+// // "D" - AliPHOSDigitizer
+// // "C" - AliPHOSClusterizer
+// // "TS" - AliPHOSTrackSegmentMaker
+// // "RP" - AliPHOSPID
+
+// if(!fIsInitialized)
+// Init() ;
+
+// char * moduleName = new char[30];
+// if(strstr(module,"SD"))
+// sprintf(moduleName,"AliPHOSSDigitizer") ;
+// else
+// if(strstr(module,"D") )
+// sprintf(moduleName,"AliPHOSDigitizer") ;
+// else
+// if(strstr(module,"C") || strstr(module,"RecPoint") )
+// sprintf(moduleName,"AliPHOSClusterizer") ;
+// else
+// if(strstr(module,"TS") || strstr(module,"Track") )
+// sprintf(moduleName,"AliPHOSTrackSegmentMaker") ;
+// else
+// if(strstr(module,"PID") || strstr(module,"Particle") || strstr(module,"RP") )
+// sprintf(moduleName,"AliPHOSPID") ;
+// else{
+// cout << "Do not know such a module / Rec Object " << endl;
+// return ;
+// }
- TIter next(fTasks);
- TTask *task;
- Bool_t active = kFALSE ;
- while((task=(TTask*)next())){
- if (strcmp(moduleName,task->GetName())==0)
- active = kTRUE;
- task->SetActive(active) ;
- if(active && title){ // set title to branches
- switch(strlen(task->GetName()) ) {
- case 17: // "AliPHOSSDigitizer"
- fSDigitizer->SetSDigitsBranch(title) ;
- fDigitizer->SetSDigitsBranch(title) ;
- fSDigitsBranch = title ;
- break ;
- case 16: //"AliPHOSDigitizer"
- fDigitizer->SetName(title) ;
- fClusterizer->SetName(title) ;
- fDigitsBranch = title ;
- break ;
- case 18: //"AliPHOSClusterizer"
- fClusterizer->SetRecPointsBranch(title) ;
- fTSMaker->SetRecPointsBranch(title) ;
- fRecPointBranch = title ;
- break ;
- case 24: //"AliPHOSTrackSegmentMaker"
- fTSMaker->SetTrackSegmentsBranch(title) ;
- fPID->SetTrackSegmentsBranch(title) ;
- fTSBranch = title ;
- break ;
- case 10: // "AliPHOSPID"
- fPID->SetRecParticlesBranch(title) ;
- fRecPartBranch = title ;
- break ;
- }
+// TIter next(fTasks);
+// TTask *task;
+// Bool_t active = kFALSE ;
+// while((task=(TTask*)next())){
+// if (strcmp(moduleName,task->GetName())==0)
+// active = kTRUE;
+// task->SetActive(active) ;
+// if(active && title){ // set title to branches
+// switch(strlen(task->GetName()) ) {
+// case 17: // "AliPHOSSDigitizer"
+// fSDigitizer->SetSDigitsBranch(title) ;
+// fDigitizer->SetSDigitsBranch(title) ;
+// fSDigitsBranch = title ;
+// break ;
+// case 16: //"AliPHOSDigitizer"
+// fDigitizer->SetName(title) ;
+// fClusterizer->SetName(title) ;
+// fDigitsBranch = title ;
+// break ;
+// case 18: //"AliPHOSClusterizer"
+// fClusterizer->SetRecPointsBranch(title) ;
+// fTSMaker->SetRecPointsBranch(title) ;
+// fRecPointBranch = title ;
+// break ;
+// case 24: //"AliPHOSTrackSegmentMaker"
+// fTSMaker->SetTrackSegmentsBranch(title) ;
+// fPID->SetTrackSegmentsBranch(title) ;
+// fTSBranch = title ;
+// break ;
+// case 10: // "AliPHOSPID"
+// fPID->SetRecParticlesBranch(title) ;
+// fRecPartBranch = title ;
+// break ;
+// }
- }
- }
+// }
+// }
- delete [] moduleName;
-}
+// delete [] moduleName;
+// }
//____________________________________________________________________________
void AliPHOSReconstructioner::Print(Option_t * option)const {
public:
AliPHOSReconstructioner() ; //ctor
- AliPHOSReconstructioner(const char * headreFile, const char * branchName = "Default") ;
+ AliPHOSReconstructioner(const char * headreFile, const char * branchName = "Default",Bool_t toSplit = kFALSE) ;
AliPHOSReconstructioner(const AliPHOSReconstructioner & rec) {
// cpy ctor:
// requested by the Coding Convention
void Print(Option_t * option)const ;
- void SetBranchTitle(const char* branch,const char * title) ;
- // Sets the branch titles to separate different reconstruction flows
-
- void StartFrom(char * module = "SDigitizer",char * title = "Default") ;
- // From wich step reconstruction begins,
- // title to be set to all reconstructed branches
+ // void SetBranchTitle(const char* branch,const char * title) ;
+ // // Sets the branch titles to separate different reconstruction flows
+ //
+ // void StartFrom(char * module = "SDigitizer",char * title = "Default") ;
+ // // From wich step reconstruction begins,
+ // // title to be set to all reconstructed branches
AliPHOSReconstructioner & operator = (const AliPHOSReconstructioner & rvalue) {
// assignement operator requested by coding convention but not needed
private:
+ Bool_t fToSplit ;
TString fHeaderFileName ; // File with headers and gAlice
TString fDigitsBranch ; // Title of digits branch
TString fRecPointBranch ; // Title of RecPoints branch
#include "AliPHOSHit.h"
#include "AliPHOSSDigitizer.h"
-
ClassImp(AliPHOSSDigitizer)
}
//____________________________________________________________________________
-AliPHOSSDigitizer::AliPHOSSDigitizer(const char * headerFile, const char * sDigitsTitle):TTask(sDigitsTitle, headerFile)
+AliPHOSSDigitizer::AliPHOSSDigitizer(const char * headerFile, const char * sDigitsTitle, const Bool_t toSplit):
+TTask(sDigitsTitle, headerFile)
{
// ctor
InitParameters() ;
+ fToSplit = toSplit ;
Init();
fDefaultInit = kFALSE ;
}
AliPHOSSDigitizer::~AliPHOSSDigitizer()
{
// dtor
- // fDefaultInit = kTRUE if SDigitizer created by default ctor (to get just the parameters)
-
- if (!fDefaultInit) {
- AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
-
- // remove the task from the folder list
- gime->RemoveTask("S",GetName()) ;
-
- TString name(GetName()) ;
- if (! name.IsNull() )
- 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) ;
-
- // Delete gAlice
- gime->CloseFile() ;
-
- }
fSplitFile = 0 ;
}
if( strcmp(GetTitle(), "") == 0 )
SetTitle("galice.root") ;
- AliPHOSGetter * gime = AliPHOSGetter::GetInstance(GetTitle(), GetName()) ;
+ AliPHOSGetter * gime = AliPHOSGetter::GetInstance(GetTitle(), GetName(),fToSplit) ;
if ( gime == 0 ) {
- cerr << "ERROR: AliPHOSSDigitizer::Init -> Could not obtain the Getter object !" << endl ;
+ cerr << "ERROR: AliPHOSSDigitizer::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/PHOS.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+="PHOS.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() ) ;
fPrimThreshold = 0.01 ;
fSDigitsInRun = 0 ;
fSplitFile = 0 ;
+ fToSplit = kFALSE ;
}
//____________________________________________________________________________
if(strstr(option,"tim"))
gBenchmark->Start("PHOSSDigitizer");
-
+
//Check, if this branch already exits
- gAlice->GetEvent(0) ;
+ AliPHOSGetter * gime = AliPHOSGetter::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 phosfound = kFALSE, sdigitizerfound = kFALSE ;
-
- while ( (branch = (static_cast<TBranch*>(next()))) && (!phosfound || !sdigitizerfound) ) {
- TString thisName( GetName() ) ;
- TString branchName( branch->GetTitle() ) ;
- branchName.Append(":") ;
- if ( (strcmp(branch->GetName(), "PHOS")==0) && thisName.BeginsWith(branchName) )
- phosfound = kTRUE ;
- else if ( (strcmp(branch->GetName(), "AliPHOSSDigitizer")==0) && thisName.BeginsWith(branchName) )
- sdigitizerfound = kTRUE ;
- }
-
- if ( phosfound || sdigitizerfound ) {
- cerr << "WARNING: AliPHOSSDigitizer::Exec -> SDigits and/or SDigitizer branch with name " << GetName()
- << " already exits" << endl ;
- return ;
- }
- }
-
- AliPHOSGetter * gime = AliPHOSGetter::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") ;
sdigits->Clear();
Int_t nSdigits = 0 ;
-
//Now make SDigits from hits, for PHOS it is the same, so just copy
-
- Int_t Nprim = (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++) {
+ 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 PHOS branch from Hits Tree for the Primary iprim
gime->Track(iprim) ;
Int_t i;
if( hit->GetEnergy() > fPrimThreshold)
new((*sdigits)[nSdigits]) AliPHOSDigit(hit->GetPrimary(),hit->GetId(),
- Digitize(hit->GetEnergy()), hit->GetTime()) ;
+ Digitize(hit->GetEnergy()), hit->GetTime()) ;
else
new((*sdigits)[nSdigits]) AliPHOSDigit( -1 , hit->GetId(),
- Digitize(hit->GetEnergy()), hit->GetTime()) ;
+ Digitize(hit->GetEnergy()), hit->GetTime()) ;
nSdigits++ ;
}
-
+
} // loop over iprim
sdigits->Sort() ;
nSdigits = sdigits->GetEntriesFast() ;
fSDigitsInRun += nSdigits ;
sdigits->Expand(nSdigits) ;
-
+
Int_t i ;
for (i = 0 ; i < nSdigits ; i++) {
AliPHOSDigit * digit = dynamic_cast<AliPHOSDigit *>(sdigits->At(i)) ;
digit->SetIndexInList(i) ;
}
- if(gAlice->TreeS() == 0)
+ //Now write SDigits
+
+ if((gAlice->TreeS() == 0)|| (fSplitFile))
gAlice->MakeTree("S", fSplitFile);
+ if(fSplitFile)
+ fSplitFile->cd() ;
+
//First list of sdigits
- Int_t bufferSize = 32000 ;
+ Int_t bufferSize = 32000 ;
TBranch * sdigitsBranch = gAlice->TreeS()->Branch("PHOS",&sdigits,bufferSize);
sdigitsBranch->SetTitle(sdname);
-
+
//Next - SDigitizer
Int_t splitlevel = 0 ;
AliPHOSSDigitizer * sd = this ;
TBranch * sdigitizerBranch = gAlice->TreeS()->Branch("AliPHOSSDigitizer","AliPHOSSDigitizer",
- &sd,bufferSize,splitlevel);
+ &sd,bufferSize,splitlevel);
sdigitizerBranch->SetTitle(sdname);
-
- sdigitsBranch->Fill() ;
+
+ sdigitsBranch->Fill() ;
sdigitizerBranch->Fill() ;
+
gAlice->TreeS()->AutoSave() ;
-
+
if(strstr(option,"deb"))
PrintSDigits(option) ;
-
}
-
+
if(strstr(option,"tim")){
gBenchmark->Stop("PHOSSDigitizer");
cout << "AliPHOSSDigitizer:" << endl ;
<< gBenchmark->GetCpuTime("PHOSSDigitizer")/nevents << " seconds per event " << endl ;
cout << endl ;
}
-
-
}
//__________________________________________________________________
gime->PostSDigits( title, GetTitle()) ;
}
-//__________________________________________________________________
-void AliPHOSSDigitizer::SetSplitFile(const TString splitFileName)
-{
- // Diverts the SDigits in a file separate from the hits file
+// //__________________________________________________________________
+// void AliPHOSSDigitizer::SetSplitFile(const TString splitFileName)
+// {
+// // Diverts the SDigits in a file separate from the hits file
- TDirectory * cwd = gDirectory ;
+// TDirectory * cwd = gDirectory ;
- if ( !(gAlice->GetTreeSFileName() == splitFileName) ) {
- if (gAlice->GetTreeSFile() )
- gAlice->GetTreeSFile()->Close() ;
- }
+// if ( !(gAlice->GetTreeSFileName() == splitFileName) ) {
+// if (gAlice->GetTreeSFile() )
+// gAlice->GetTreeSFile()->Close() ;
+// }
- fSplitFile = gAlice->InitTreeFile("S",splitFileName.Data());
- fSplitFile->cd() ;
- gAlice->Write(0, TObject::kOverwrite);
+// fSplitFile = gAlice->InitTreeFile("S",splitFileName.Data());
+// fSplitFile->cd() ;
+// gAlice->Write(0, TObject::kOverwrite);
- TTree *treeE = gAlice->TreeE();
- if (!treeE) {
- cerr << "ERROR: AliPHOSSDigitizer::SetSPlitFile -> No TreeE found "<<endl;
- abort() ;
- }
+// TTree *treeE = gAlice->TreeE();
+// if (!treeE) {
+// cerr << "ERROR: AliPHOSSDigitizer::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 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: AliPHOSSDigitizer::SetSPlitFile -> AliceGeom was not found in the input file "<<endl;
- abort() ;
- }
- AliceGeom->Write(0, TObject::kOverwrite);
+// // copy AliceGeom
+// TGeometry *AliceGeom = static_cast<TGeometry*>(cwd->Get("AliceGeom"));
+// if (!AliceGeom) {
+// cerr << "ERROR: AliPHOSSDigitizer::SetSPlitFile -> AliceGeom was not found in the input file "<<endl;
+// abort() ;
+// }
+// AliceGeom->Write(0, TObject::kOverwrite);
- gAlice->MakeTree("S",fSplitFile);
- cwd->cd() ;
- cout << "INFO: AliPHOSSDigitizer::SetSPlitMode -> SDigits will be stored in " << splitFileName.Data() << endl ;
+// gAlice->MakeTree("S",fSplitFile);
+// cwd->cd() ;
+// cout << "INFO: AliPHOSSDigitizer::SetSPlitMode -> SDigits will be stored in " << splitFileName.Data() << endl ;
-}
+// }
//__________________________________________________________________
void AliPHOSSDigitizer::Print(Option_t* option)const
Int_t maxEmc = gime->PHOSGeometry()->GetNModules()*gime->PHOSGeometry()->GetNCristalsInModule() ;
Int_t index ;
for (index = 0 ; (index < sdigits->GetEntriesFast()) &&
- (((AliPHOSDigit * ) sdigits->At(index))->GetId() <= maxEmc) ; index++) {
- digit = (AliPHOSDigit * ) sdigits->At(index) ;
+ ((dynamic_cast<AliPHOSDigit *> (sdigits->At(index)))->GetId() <= maxEmc) ; index++) {
+ digit = dynamic_cast<AliPHOSDigit *>( sdigits->At(index) ) ;
if(digit->GetNprimary() == 0) continue;
cout << setw(6) << digit->GetId() << " " << setw(10) << digit->GetAmp() << " "
<< setw(6) << digit->GetIndexInList() << " "
Int_t maxEmc = gime->PHOSGeometry()->GetNModules()*gime->PHOSGeometry()->GetNCristalsInModule() ;
Int_t index ;
for (index = 0 ; index < sdigits->GetEntriesFast(); index++) {
- digit = (AliPHOSDigit * ) sdigits->At(index) ;
+ digit = dynamic_cast<AliPHOSDigit *>( sdigits->At(index) ) ;
if(digit->GetId() > maxEmc){
cout << setw(6) << digit->GetId() << " " << setw(10) << digit->GetAmp() << " "
<< setw(6) << digit->GetIndexInList() << " "
public:
AliPHOSSDigitizer() ; // ctor
- AliPHOSSDigitizer(const char* HeaderFile,const char *SdigitsTitle = "Default") ;
+ AliPHOSSDigitizer(const char* headerFile, const char *sdigitsTitle = "Default", const Bool_t toSplit = kFALSE) ;
virtual ~AliPHOSSDigitizer() ; // 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); }
- virtual void Exec(Option_t *option);
+ virtual void Exec(Option_t *option);
const char * GetSDigitsBranch()const{return GetName();}
const Int_t GetSDigitsInRun() const {return fSDigitsInRun ;}
virtual void Print(Option_t* option) const ;
void SetSDigitsBranch(const char * title ) ;
- void SetSplitFile(const TString splitFileName = "PHOS.SDigits.root") ;
+ // void SetSplitFile(const TString splitFileName = "PHOS.SDigits.root") ;
void UseHitsFrom(const char * filename) ;
Bool_t operator == (const AliPHOSSDigitizer & sd) const ;
void PrintSDigits(Option_t * option) ;
private:
-
Float_t fA ; // Pedestal parameter
Float_t fB ; // Slope Digitizition parameters
- Bool_t fDefaultInit; //! Says if the task was created by defaut ctor (only parameters are initialized)
Float_t fPrimThreshold ; // To store primari if Elos > threshold
- Int_t fSDigitsInRun ; //! Total number of sdigits in one run
+ 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(AliPHOSSDigitizer,1) // description
}
//____________________________________________________________________________
-AliPHOSTrackSegmentMaker::AliPHOSTrackSegmentMaker(const char * headerFile, const char * name): TTask(name, headerFile)
+AliPHOSTrackSegmentMaker::AliPHOSTrackSegmentMaker(const char * headerFile, const char * name, const Bool_t toSplit): TTask(name, headerFile)
{
// ctor
fSplitFile= 0 ;
+ fToSplit = toSplit ;
}
//____________________________________________________________________________
fSplitFile = 0 ;
}
-//____________________________________________________________________________
-void AliPHOSTrackSegmentMaker::SetSplitFile(const TString splitFileName) const
-{
- // Diverts the TrackSegments in a file separate from the Digits file
+// //____________________________________________________________________________
+// void AliPHOSTrackSegmentMaker::SetSplitFile(const TString splitFileName) const
+// {
+// // Diverts the TrackSegments in a file separate from the Digits file
- TDirectory * cwd = gDirectory ;
- TFile * splitFile = gAlice->InitTreeFile("R",splitFileName.Data());
- splitFile->cd() ;
- gAlice->Write(0, TObject::kOverwrite);
+// TDirectory * cwd = gDirectory ;
+// TFile * splitFile = gAlice->InitTreeFile("R",splitFileName.Data());
+// splitFile->cd() ;
+// gAlice->Write(0, TObject::kOverwrite);
- TTree *treeE = gAlice->TreeE();
- if (!treeE) {
- cerr << "ERROR: AliPHOSTrackSegmentMaker::SetSplitFile -> No TreeE found "<<endl;
- abort() ;
- }
+// TTree *treeE = gAlice->TreeE();
+// if (!treeE) {
+// cerr << "ERROR: AliPHOSTrackSegmentMaker::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 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: AliPHOSTrackSegmentMaker::SetSplitFile -> AliceGeom was not found in the input file "<<endl;
- abort() ;
- }
- AliceGeom->Write(0, TObject::kOverwrite);
+// // copy AliceGeom
+// TGeometry *AliceGeom = static_cast<TGeometry*>(cwd->Get("AliceGeom"));
+// if (!AliceGeom) {
+// cerr << "ERROR: AliPHOSTrackSegmentMaker::SetSplitFile -> AliceGeom was not found in the input file "<<endl;
+// abort() ;
+// }
+// AliceGeom->Write(0, TObject::kOverwrite);
- gAlice->MakeTree("R",splitFile);
- cwd->cd() ;
- cout << "INFO: AliPHOSTrackSegmentMaker::SetSPlitMode -> TrackSegments will be stored in " << splitFileName.Data() << endl ;
-}
+// gAlice->MakeTree("R",splitFile);
+// cwd->cd() ;
+// cout << "INFO: AliPHOSTrackSegmentMaker::SetSPlitMode -> TrackSegments will be stored in " << splitFileName.Data() << endl ;
+// }
public:
AliPHOSTrackSegmentMaker() ;
- AliPHOSTrackSegmentMaker(const char* headerFile, const char* name) ;
+ AliPHOSTrackSegmentMaker(const char* headerFile, const char* name, const Bool_t toSplit) ;
virtual ~ AliPHOSTrackSegmentMaker() ;
virtual void Exec(Option_t * option){cout << "Not Defined" << endl ; }
- virtual char* GetRecPointsBranch ()const{cout << "Not Defined" << endl ; return 0 ; }
- virtual char* GetTrackSegmentsBranch ()const{cout << "Not Defined" << endl ; return 0 ; }
+ // virtual char* GetRecPointsBranch ()const{cout << "Not Defined" << endl ; return 0 ; }
+ // virtual char* GetTrackSegmentsBranch ()const{cout << "Not Defined" << endl ; return 0 ; }
virtual const Int_t GetTrackSegmentsInRun() const {cout << "Not Defined" << endl ; return 0 ; }
virtual void Print(Option_t * option)const {cout << "Not Defined" << endl ; }
// virtual void Set... // method to choose recPoints: along z only, along x ...???
// virtual void SetChoosingAlgirithm(){cout << "Not Defined" << endl ; return 0 ; }
// virtual void SetMaxEmcCpvDistance(Float_t r) {cout << "Not Defined" << endl ; return 0 ; }
- virtual void SetRecPointsBranch(const char * title){cout << "Not Defined" << endl ; }
- virtual void SetTrackSegmentsBranch(const char * title){cout << "Not Defined" << endl ; }
- virtual void SetSplitFile(const TString splitFileName = "PHOS.RecData.root") const ;
+ // virtual void SetRecPointsBranch(const char * title){cout << "Not Defined" << endl ; }
+ // virtual void SetTrackSegmentsBranch(const char * title){cout << "Not Defined" << endl ; }
+ // virtual void SetSplitFile(const TString splitFileName = "PHOS.RecData.root") const ;
virtual const char * Version() const {cout << "Not Defined" << endl ; return 0 ; }
virtual void WriteTrackSegments(Int_t event){cout << "Not Defined" << endl ; }
protected:
TFile * fSplitFile ; //! file in which TrackSegments will eventually be stored
-
+ Bool_t fToSplit ; //! Do we work in the split mode
+
ClassDef( AliPHOSTrackSegmentMaker,1) // Algorithm class to make PHOS track segments (Base Class)
};
// EMC RecPoint + (possibly) CPV RecPoint + (possibly) PPSD RecPoint
// To find TrackSegments we do the following:
// for each EMC RecPoints we look at
-// CPV/PPSD RecPoints in the radious fR0.
+// CPV/PPSD RecPoints in the radious fRcpv.
// If there is such a CPV RecPoint,
// we make "Link" it is just indexes of EMC and CPV/PPSD RecPoint and distance
// between them in the PHOS plane.
// default ctor (to be used mainly by Streamer)
InitParameters() ;
- fHeaderFileName = "" ;
- fRecPointsBranchTitle = "" ;
- fTrackSegmentsBranchTitle = "" ;
- fFrom = "" ;
+// fHeaderFileName = "" ;
+// fRecPointsBranchTitle = "" ;
+// fTrackSegmentsBranchTitle = "" ;
+// fFrom = "" ;
fTrackSegmentsInRun = 0 ;
}
//____________________________________________________________________________
- AliPHOSTrackSegmentMakerv1::AliPHOSTrackSegmentMakerv1(const char * headerFile, const char * name, const char * from) : AliPHOSTrackSegmentMaker(headerFile, name)
+ AliPHOSTrackSegmentMakerv1::AliPHOSTrackSegmentMakerv1(const char * headerFile, const char * name, const Bool_t toSplit) : AliPHOSTrackSegmentMaker(headerFile, name, toSplit)
{
// ctor
InitParameters() ;
- fHeaderFileName = GetTitle() ;
- fRecPointsBranchTitle = GetName() ;
- fTrackSegmentsBranchTitle = GetName() ;
+// fHeaderFileName = GetTitle() ;
+// fRecPointsBranchTitle = GetName() ;
+// fTrackSegmentsBranchTitle = GetName() ;
fTrackSegmentsInRun = 0 ;
- if ( from == 0 )
- fFrom = name ;
- else
- fFrom = from ;
+// if ( from == 0 )
+// fFrom = name ;
+// else
+// fFrom = from ;
Init() ;
fDefaultInit = kFALSE ;
if (!fDefaultInit) {
delete fLinkUpArray ;
- AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
+// AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
- // remove the task from the folder list
- gime->RemoveTask("T",GetName()) ;
- TString name(GetName()) ;
- name.ReplaceAll("tsm", "clu") ;
- gime->RemoveTask("C",name) ;
+// // remove the task from the folder list
+// gime->RemoveTask("T",GetName()) ;
+// TString name(GetName()) ;
+// name.ReplaceAll("tsm", "clu") ;
+// gime->RemoveTask("C",name) ;
- // remove the data from the folder list
- name = GetName() ;
- name.Remove(name.Index(":")) ;
- gime->RemoveObjects("RE", name) ; // EMCARecPoints
- gime->RemoveObjects("RC", name) ; // CPVRecPoints
- gime->RemoveObjects("T", name) ; // TrackSegments
+// // remove the data from the folder list
+// name = GetName() ;
+// name.Remove(name.Index(":")) ;
+// gime->RemoveObjects("RE", name) ; // EMCARecPoints
+// gime->RemoveObjects("RC", name) ; // CPVRecPoints
+// gime->RemoveObjects("T", name) ; // TrackSegments
- // Delete gAlice
- gime->CloseFile() ;
+// // Delete gAlice
+// gime->CloseFile() ;
fSplitFile = 0 ;
}
// clusters from one PHOS module are
AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
- TObjArray * emcRecPoints = gime->EmcRecPoints(fFrom) ;
- TObjArray * cpvRecPoints = gime->CpvRecPoints(fFrom) ;
+ TObjArray * emcRecPoints = gime->EmcRecPoints() ;
+ TObjArray * cpvRecPoints = gime->CpvRecPoints() ;
//First EMC clusters
Int_t totalEmc = emcRecPoints->GetEntriesFast() ;
Float_t delta = 1 ; // Width of the rows in sorting of RecPoints (in cm)
// if you change this value, change it as well in xxxRecPoint::Compare()
- Float_t r = fR0 ;
+ Float_t r = fRcpv ;
TVector3 vecEmc ;
TVector3 vecCpv ;
cpvClu->GetLocalPosition(vecCpv) ;
if(emcClu->GetPHOSMod() == cpvClu->GetPHOSMod()){
- if(vecCpv.X() <= vecEmc.X() + fR0 + 2*delta ){
+ if(vecCpv.X() <= vecEmc.X() + fRcpv + 2*delta ){
vecCpv = vecCpv - vecEmc ;
r = vecCpv.Mag() ;
if ( strcmp(GetTitle(), "") == 0 )
SetTitle("galice.root") ;
- AliPHOSGetter * gime = AliPHOSGetter::GetInstance(GetTitle(), fFrom.Data()) ;
+ TString branchname = GetName() ;
+ branchname.Remove(branchname.Index(Version())-1) ;
+ AliPHOSGetter * gime = AliPHOSGetter::GetInstance(GetTitle(),branchname.Data(), fToSplit ) ;
if ( gime == 0 ) {
cerr << "ERROR: AliPHOSTrackSegmentMakerv1::Init -> Could not obtain the Getter object !" << endl ;
return ;
}
+ fSplitFile = 0 ;
+ if(fToSplit){
+ //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="" ;
+ fileName+="PHOS.RecData." ;
+ if((strcmp(branchname.Data(),"Default")!=0)&&(strcmp(branchname.Data(),"")!=0)){
+ fileName+=branchname ;
+ fileName+="." ;
+ }
+ fileName+="root" ;
+ fSplitFile = static_cast<TFile*>(gROOT->GetFile(fileName.Data()));
+ if(!fSplitFile)
+ fSplitFile = TFile::Open(fileName.Data(),"update") ;
+ }
+
fLinkUpArray = new TClonesArray("AliPHOSLink", 1000);
- //add Task to //YSAlice/tasks/Reconstructioner/PHOS
- gime->PostTrackSegmentMaker(this) ;
- // create a folder on the white board //YSAlice/WhiteBoard/RecPoints/PHOS/trackSegmentsName
+ gime->PostTrackSegmentMaker(this) ;
gime->PostTrackSegments(BranchName()) ;
}
//____________________________________________________________________________
void AliPHOSTrackSegmentMakerv1::InitParameters()
{
- fR0 = 10. ;
+ fRcpv = 10. ;
fEmcFirst = 0 ;
fEmcLast = 0 ;
fCpvFirst = 0 ;
void AliPHOSTrackSegmentMakerv1::MakeLinks()const
{
// Finds distances (links) between all EMC and PPSD clusters,
- // which are not further apart from each other than fR0
+ // which are not further apart from each other than fRcpv
// and sort them in accordance with this distance
AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
- TObjArray * emcRecPoints = gime->EmcRecPoints(fFrom) ;
- TObjArray * cpvRecPoints = gime->CpvRecPoints(fFrom) ;
+ TObjArray * emcRecPoints = gime->EmcRecPoints() ;
+ TObjArray * cpvRecPoints = gime->CpvRecPoints() ;
fLinkUpArray->Clear() ;
if(toofar)
break ;
- if(r < fR0) {
+ if(r < fRcpv) {
new ((*fLinkUpArray)[iLinkUp++]) AliPHOSLink(r, iEmcRP, iCpv) ;
}
}
// remove them from the list of "unassigned".
AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
- TObjArray * emcRecPoints = gime->EmcRecPoints(fFrom) ;
- TObjArray * cpvRecPoints = gime->CpvRecPoints(fFrom) ;
+ TObjArray * emcRecPoints = gime->EmcRecPoints() ;
+ TObjArray * cpvRecPoints = gime->CpvRecPoints() ;
TClonesArray * trackSegments = gime->TrackSegments(BranchName()) ;
//Make arrays to mark clusters already chosen
return ;
}
- gAlice->GetEvent(0) ;
- //check, if the branch with name of this" already exits?
- if (gAlice->TreeR()) {
- TObjArray * lob = static_cast<TObjArray*>(gAlice->TreeR()->GetListOfBranches()) ;
- TIter next(lob) ;
- TBranch * branch = 0 ;
- Bool_t phostsfound = kFALSE, tracksegmentmakerfound = kFALSE ;
+// gAlice->GetEvent(0) ;
+// //check, if the branch with name of this" already exits?
+// if (gAlice->TreeR()) {
+// TObjArray * lob = static_cast<TObjArray*>(gAlice->TreeR()->GetListOfBranches()) ;
+// TIter next(lob) ;
+// TBranch * branch = 0 ;
+// Bool_t phostsfound = kFALSE, tracksegmentmakerfound = kFALSE ;
- TString branchname = GetName() ;
- branchname.Remove(branchname.Index(Version())-1) ;
+// TString branchname = GetName() ;
+// branchname.Remove(branchname.Index(Version())-1) ;
- while ( (branch = static_cast<TBranch*>(next())) && (!phostsfound || !tracksegmentmakerfound) ) {
- if ( (strcmp(branch->GetName(), "PHOSTS")==0) && (strcmp(branch->GetTitle(), branchname.Data())==0) )
- phostsfound = kTRUE ;
+// while ( (branch = static_cast<TBranch*>(next())) && (!phostsfound || !tracksegmentmakerfound) ) {
+// if ( (strcmp(branch->GetName(), "PHOSTS")==0) && (strcmp(branch->GetTitle(), branchname.Data())==0) )
+// phostsfound = kTRUE ;
- else if ( (strcmp(branch->GetName(), "AliPHOSTrackSegmentMaker")==0) && (strcmp(branch->GetTitle(), GetName())==0) )
- tracksegmentmakerfound = kTRUE ;
- }
+// else if ( (strcmp(branch->GetName(), "AliPHOSTrackSegmentMaker")==0) && (strcmp(branch->GetTitle(), GetName())==0) )
+// tracksegmentmakerfound = kTRUE ;
+// }
- if ( phostsfound || tracksegmentmakerfound ) {
- cerr << "WARNING: AliPHOSTrackSegmentMakerv1::Exec -> TrackSegments and/or TrackSegmentMaker branch with name "
- << branchname.Data() << " already exits" << endl ;
- return ;
- }
- }
+// if ( phostsfound || tracksegmentmakerfound ) {
+// cerr << "WARNING: AliPHOSTrackSegmentMakerv1::Exec -> TrackSegments and/or TrackSegmentMaker branch with name "
+// << branchname.Data() << " already exits" << endl ;
+// return ;
+// }
+// }
AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
+ if(gime->BranchExists("TrackSegments") )
+ return ;
const AliPHOSGeometry * geom = gime->PHOSGeometry() ;
- Int_t nevents = (Int_t) gAlice->TreeE()->GetEntries() ;
+ Int_t nevents = gime->MaxEvent() ; //(Int_t) gAlice->TreeE()->GetEntries() ;
Int_t ievent ;
for(ievent = 0; ievent < nevents; ievent++){
if( strcmp(GetName(), "") != 0 ) {
cout << "======== AliPHOSTrackSegmentMakerv1 ========" << endl ;
cout << "Making Track segments "<< endl ;
- cout << " Headers file: " << fHeaderFileName.Data() << endl ;
- cout << " RecPoints branch file name: " << fRecPointsBranchTitle.Data() << endl ;
- cout << " TrackSegments Branch file name: " << fTrackSegmentsBranchTitle.Data() << endl ;
+ // cout << " Headers file: " << fHeaderFileName.Data() << endl ;
+ // cout << " RecPoints branch file name: " << fRecPointsBranchTitle.Data() << endl ;
+ // cout << " TrackSegments Branch file name: " << fTrackSegmentsBranchTitle.Data() << endl ;
cout << "with parameters: " << endl ;
- cout << " Maximal EMC - CPV (PPSD) distance (cm)" << fR0 << endl ;
+ cout << " Maximal EMC - CPV (PPSD) distance (cm)" << fRcpv << endl ;
cout << "============================================" << endl ;
}
else
AliPHOSGetter *gime = AliPHOSGetter::GetInstance() ;
- TClonesArray * trackSegments = gime->TrackSegments(BranchName()) ;
+ TClonesArray * trackSegments = gime->TrackSegments() ;
trackSegments->Expand(trackSegments->GetEntriesFast()) ;
- TTree * treeR = gAlice->TreeR();
-
- if (!treeR)
+ TTree * treeR ;
+
+ if(fToSplit){
+ if(!fSplitFile)
+ return ;
+ fSplitFile->cd() ;
+ char name[10] ;
+ sprintf(name,"%s%d", "TreeR",event) ;
+ treeR = dynamic_cast<TTree*>(fSplitFile->Get(name));
+ }
+ else{
+ treeR = gAlice->TreeR();
+ }
+
+ if(!treeR){
gAlice->MakeTree("R", fSplitFile);
- treeR = gAlice->TreeR();
-
+ treeR = gAlice->TreeR() ;
+ }
+
//First TS
Int_t bufferSize = 32000 ;
TBranch * tsBranch = treeR->Branch("PHOSTS",&trackSegments,bufferSize);
tsMakerBranch->Fill() ;
treeR->AutoSave() ; //Write(0,kOverwrite) ;
-
+ if(gAlice->TreeR()!=treeR)
+ treeR->Delete();
}
public:
AliPHOSTrackSegmentMakerv1() ;
- AliPHOSTrackSegmentMakerv1(const char* headerFile, const char* name = "Default", const char * from = 0) ;
+ AliPHOSTrackSegmentMakerv1(const char* headerFile, const char* name = "Default", const Bool_t toSplit = kFALSE) ;
AliPHOSTrackSegmentMakerv1(const AliPHOSTrackSegmentMakerv1 & tsm) {
// cpy ctor: no implementation yet
// requested by the Coding Convention
virtual ~ AliPHOSTrackSegmentMakerv1() ; // dtor
- virtual char* GetRecPointsBranch (void)const{return (char*)fRecPointsBranchTitle.Data() ;}
- virtual char* GetTrackSegmentsBranch(void)const{return (char*)fTrackSegmentsBranchTitle.Data() ;}
+ // virtual char* GetRecPointsBranch (void)const{return (char*)fRecPointsBranchTitle.Data() ;}
+ // virtual char* GetTrackSegmentsBranch(void)const{return (char*)fTrackSegmentsBranchTitle.Data() ;}
virtual const Int_t GetTrackSegmentsInRun()const {return fTrackSegmentsInRun ;}
virtual void Exec(Option_t * option) ;
void MakeLinks() const; //Evaluates distances(links) between EMC and PPSD
void MakePairs() ; //Finds pairs(triplets) with smallest link
virtual void Print(Option_t * option) const ;
- virtual void SetMaxEmcPpsdDistance(Float_t r){ fR0 = r ;}
- virtual void SetRecPointsBranch(const char * title) { fRecPointsBranchTitle = title ;}
- virtual void SetTrackSegmentsBranch(const char * title){ fTrackSegmentsBranchTitle = title ; }
+ virtual void SetMaxEmcCPVDistance(Float_t r){ fRcpv = r ;} //Maximal distance (in PHOS plane)
+ //between EMCrp and CPVrp
+ virtual void SetMaxEmcTPCDistance(Float_t r){ fRtpc = r ;} //Maximal distance (in PHOS plane)
+ //between EMCrp and extrapolation of TPC track
+ // virtual void SetRecPointsBranch(const char * title) { fRecPointsBranchTitle = title ;}
+ // virtual void SetTrackSegmentsBranch(const char * title){ fTrackSegmentsBranchTitle = title ; }
virtual const char * Version() const { return "tsm-v1" ; }
AliPHOSTrackSegmentMakerv1 & operator = (const AliPHOSTrackSegmentMakerv1 & ) {
private:
Bool_t fDefaultInit; //! Says if the task was created by defaut ctor (only parameters are initialized)
- TString fFrom ; // name of Recpoints
- TString fHeaderFileName ; // name of the file which contains gAlice, Tree headers etc.
- TString fRecPointsBranchTitle ; // name of the file, where RecPoints branchs are stored
- TString fTrackSegmentsBranchTitle ; // name of the file, where TrackSegment branchs is stored
+ // TString fFrom ; // name of Recpoints
+ // TString fHeaderFileName ; // name of the file which contains gAlice, Tree headers etc.
+ // TString fRecPointsBranchTitle ; // name of the file, where RecPoints branchs are stored
+ // TString fTrackSegmentsBranchTitle ; // name of the file, where TrackSegment branchs is stored
Int_t fNTrackSegments ; // number of track segments found
- Float_t fR0 ; // Maximum distance between a EMC RecPoint and a PPSD RecPoint
-
+ Float_t fRcpv ; // Maximum distance between a EMC RecPoint and a CPV RecPoint
+ Float_t fRtpc ; // Maximum distance between a EMC RecPoint and extrapolation of a TPC track
+
TClonesArray * fLinkUpArray ; //!
Int_t fEmcFirst; //! Index of first EMC RecPoint belonging to currect PHOS module
Int_t fEmcLast ; //!