From 548f01349068fc1dde9e5e15fa39dd91a358ee2b Mon Sep 17 00:00:00 2001 From: schutz Date: Fri, 23 Aug 2002 15:43:06 +0000 Subject: [PATCH] Mostly minor style modifications to be ready for cloning with EMCAL --- PHOS/AliPHOS.cxx | 8 +-- PHOS/AliPHOSClusterizer.cxx | 47 +------------ PHOS/AliPHOSClusterizer.h | 8 --- PHOS/AliPHOSClusterizerv1.cxx | 75 +++------------------ PHOS/AliPHOSClusterizerv1.h | 9 +-- PHOS/AliPHOSDigitizer.cxx | 123 +++------------------------------- PHOS/AliPHOSDigitizer.h | 13 +--- PHOS/AliPHOSGetter.cxx | 74 +++----------------- PHOS/AliPHOSGetter.h | 29 ++++---- PHOS/AliPHOSSDigitizer.cxx | 50 ++------------ PHOS/AliPHOSSDigitizer.h | 3 - 11 files changed, 51 insertions(+), 388 deletions(-) diff --git a/PHOS/AliPHOS.cxx b/PHOS/AliPHOS.cxx index d8f9a1a34a9..2b1230cb2f7 100644 --- a/PHOS/AliPHOS.cxx +++ b/PHOS/AliPHOS.cxx @@ -32,10 +32,9 @@ class TFile; #include "TFolder.h" // --- Standard library --- - #include -// --- AliRoot header files --- +// --- AliRoot header files --- #include "AliPHOS.h" #include "AliMC.h" #include "AliRun.h" @@ -62,7 +61,6 @@ AliPHOS::AliPHOS(const char* name, const char* title): AliDetector(name, title) fTreeQA = 0; } - //____________________________________________________________________________ AliPHOS::~AliPHOS() { @@ -373,10 +371,6 @@ AliPHOSGeometry * AliPHOS::GetGeometry() const void AliPHOS::SetTreeAddress() { - - // TBranch *branch; - // AliDetector::SetTreeAddress(); - TBranch *branch; char branchname[20]; sprintf(branchname,"%s",GetName()); diff --git a/PHOS/AliPHOSClusterizer.cxx b/PHOS/AliPHOSClusterizer.cxx index 458abc09c86..214f6a787a9 100644 --- a/PHOS/AliPHOSClusterizer.cxx +++ b/PHOS/AliPHOSClusterizer.cxx @@ -27,7 +27,6 @@ #include "TFile.h" #include "TTree.h" - // --- Standard library --- #include #include @@ -48,9 +47,6 @@ ClassImp(AliPHOSClusterizer) // ctor fSplitFile= 0 ; fToSplit = kFALSE ; -// fHitsFileName = "" ; -// fSDigitsFileName = "" ; -// fDigitsFileName = "" ; } @@ -61,13 +57,7 @@ TTask(name, headerFile) // ctor fToSplit = toSplit ; fSplitFile= 0 ; - // 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() ; + } //____________________________________________________________________________ @@ -78,39 +68,4 @@ AliPHOSClusterizer::~AliPHOSClusterizer() fSplitFile = 0 ; } -// //____________________________________________________________________________ -// 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); -// TTree *treeE = gAlice->TreeE(); -// if (!treeE) { -// cerr << "ERROR: AliPHOSClusterizer::SetSplitFile -> No TreeE found "<SetBranchAddress("Header", &header); -// treeE->SetBranchStatus("*",1); -// TTree *treeENew = treeE->CloneTree(); -// treeENew->Write(0, TObject::kOverwrite); - -// // copy AliceGeom -// TGeometry *AliceGeom = static_cast(cwd->Get("AliceGeom")); -// if (!AliceGeom) { -// cerr << "ERROR: AliPHOSClusterizer::SetSplitFile -> AliceGeom was not found in the input file "<Write(0, TObject::kOverwrite); - -// gAlice->MakeTree("R", fSplitFile); -// cwd->cd() ; -// cout << "INFO: AliPHOSClusterizer::SetSPlitMode -> RecPoints will be stored in " << splitFileName.Data() << endl ; -// } diff --git a/PHOS/AliPHOSClusterizer.h b/PHOS/AliPHOSClusterizer.h index 59614011345..5cd8953610d 100644 --- a/PHOS/AliPHOSClusterizer.h +++ b/PHOS/AliPHOSClusterizer.h @@ -27,10 +27,6 @@ public: 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 ; } - 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 GetEmcLogWeight()const {cout << "Not Defined" << endl ; return 0. ; } @@ -54,15 +50,11 @@ public: 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 SetUnfolding(Bool_t toUnfold ){cout << "Not Defined" << endl ;} virtual const char * Version() const {cout << "Not Defined" << endl ; return 0 ; } protected: - // TString fHitsFileName ; // file name that contains the original hits - // TString fSDigitsFileName ; // file name that contains the original SDigits - // TString fDigitsFileName ; // file name that contains the original Digits TFile * fSplitFile ; //! file in which RecPoints will eventually be stored Bool_t fToSplit ; //! Should we write to splitted file diff --git a/PHOS/AliPHOSClusterizerv1.cxx b/PHOS/AliPHOSClusterizerv1.cxx index 058321d5482..e7dc51b0fc3 100644 --- a/PHOS/AliPHOSClusterizerv1.cxx +++ b/PHOS/AliPHOSClusterizerv1.cxx @@ -100,7 +100,6 @@ AliPHOSClusterizerv1::AliPHOSClusterizerv1(const char* headerFile,const char* na // ctor with the indication of the file where header Tree and digits Tree are stored InitParameters() ; - Init() ; fDefaultInit = kFALSE ; @@ -110,26 +109,8 @@ AliPHOSClusterizerv1::AliPHOSClusterizerv1(const char* headerFile,const char* na AliPHOSClusterizerv1::~AliPHOSClusterizerv1() { // dtor + fSplitFile = 0 ; - -// if (!fDefaultInit) { -// AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; - -// // 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 - -// // Delete gAlice -// gime->CloseFile() ; - - fSplitFile = 0 ; -// } } //____________________________________________________________________________ @@ -143,11 +124,14 @@ const TString AliPHOSClusterizerv1::BranchName() const //____________________________________________________________________________ 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 ; + return fADCpedestalEmc + amp*fADCchanelEmc ; + else //Digitize as CPV return fADCpedestalCpv+ amp*fADCchanelCpv ; } + //____________________________________________________________________________ void AliPHOSClusterizerv1::Exec(Option_t * option) { @@ -162,36 +146,6 @@ void AliPHOSClusterizerv1::Exec(Option_t * option) if(strstr(option,"print")) Print("") ; -// 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 ; - -// 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 ; - -// 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 ; -// } - -// 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() ; if(gime->BranchExists("RecPoints")) return ; @@ -205,12 +159,8 @@ void AliPHOSClusterizerv1::Exec(Option_t * option) if(ievent == 0) GetCalibrationParameters() ; - fNumberOfEmcClusters = 0 ; - fNumberOfCpvClusters = 0 ; - - - // if(!ReadDigits(ievent)) continue; //reads digits for event ievent - + fNumberOfEmcClusters = fNumberOfCpvClusters = 0 ; + MakeClusters() ; if(fToUnfold) @@ -342,6 +292,7 @@ void AliPHOSClusterizerv1::GetCalibrationParameters() fADCpedestalCpv = dig->GetCPVpedestal() ; } + //____________________________________________________________________________ void AliPHOSClusterizerv1::Init() { @@ -393,9 +344,6 @@ void AliPHOSClusterizerv1::Init() gime->PostClusterizer(this) ; gime->PostRecPoints(branchname) ; - - // gime->PostDigits() ; - // gime->PostDigitizer() ; } @@ -418,10 +366,7 @@ void AliPHOSClusterizerv1::InitParameters() fEmcTimeGate = 1.e-8 ; fToUnfold = kTRUE ; - - // fHeaderFileName = GetTitle() ; - // fDigitsBranchTitle = GetName() ; - + TString clusterizerName( GetName()) ; if (clusterizerName.IsNull() ) clusterizerName = "Default" ; @@ -581,7 +526,7 @@ void AliPHOSClusterizerv1::WriteRecPoints(Int_t event) cpvBranch ->Fill() ; clusterizerBranch->Fill() ; - treeR->AutoSave() ; //Write(0,kOverwrite) ; + treeR->AutoSave() ; if(gAlice->TreeR()!=treeR) treeR->Delete(); } diff --git a/PHOS/AliPHOSClusterizerv1.h b/PHOS/AliPHOSClusterizerv1.h index c1269299e25..489c40d44dd 100644 --- a/PHOS/AliPHOSClusterizerv1.h +++ b/PHOS/AliPHOSClusterizerv1.h @@ -52,7 +52,6 @@ public: virtual Float_t GetCpvLogWeight()const { return fW0CPV;} 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 @@ -65,9 +64,7 @@ public: 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 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) ; @@ -100,10 +97,6 @@ private: 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 Int_t fEmcCrystals ; // number of EMC cristalls in PHOS diff --git a/PHOS/AliPHOSDigitizer.cxx b/PHOS/AliPHOSDigitizer.cxx index bbb894ac122..c65aa7674aa 100644 --- a/PHOS/AliPHOSDigitizer.cxx +++ b/PHOS/AliPHOSDigitizer.cxx @@ -68,7 +68,6 @@ #include // --- AliRoot header files --- - #include "AliRun.h" #include "AliHeader.h" #include "AliStream.h" @@ -91,9 +90,7 @@ ClassImp(AliPHOSDigitizer) InitParameters() ; fDefaultInit = kTRUE ; fManager = 0 ; // We work in the standalong mode - - // fHitsFileName = "" ; - // fSDigitsFileName = "" ; + } //____________________________________________________________________________ @@ -109,10 +106,6 @@ AliPHOSDigitizer::AliPHOSDigitizer(const char *headerFile, const char * name, co fToSplit = toSplit ; Init() ; fDefaultInit = kFALSE ; - // fSDigitsFileName = headerFile ; - // AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; - // gime->Event(0, "S") ; - // fHitsFileName = gime->SDigitizer()->GetTitle() ; } //____________________________________________________________________________ @@ -131,38 +124,14 @@ AliPHOSDigitizer::AliPHOSDigitizer(AliRunDigitizer * ard):AliDigitizer(ard) SetName("Default") ; fToSplit = kFALSE ; } - -// fSDigitsFileName = fManager->GetInputFileName(0, 0) ; -// AliPHOSGetter * gime = AliPHOSGetter::GetInstance(fSDigitsFileName, GetName()) ; -// gime->Event(0,"S") ; -// fHitsFileName = gime->SDigitizer()->GetTitle() ; - } //____________________________________________________________________________ AliPHOSDigitizer::~AliPHOSDigitizer() { // dtor - // fDefaultInit = kTRUE if Digitizer 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()) ; -// gime->RemoveTask("D",GetName()) ; - -// // remove the Digits from the folder list -// gime->RemoveObjects("D", GetName()) ; - -// // remove the SDigits from the folder list -// gime->RemoveSDigits() ; - -// // Delete gAlice -// gime->CloseFile() ; - + fSplitFile = 0 ; - // } } //____________________________________________________________________________ @@ -362,7 +331,7 @@ void AliPHOSDigitizer::Digitize(const Int_t event) //remove digits below thresholds for(i = 0; i < nEMC ; i++){ - digit = (AliPHOSDigit*) digits->At(i) ; + digit = dynamic_cast( digits->At(i) ) ; if(sDigitizer->Calibrate( digit->GetAmp() ) < fEMCDigitThreshold) digits->RemoveAt(i) ; else @@ -381,13 +350,14 @@ void AliPHOSDigitizer::Digitize(const Int_t event) //Set indexes in list of digits and make true digitization of the energy for (i = 0 ; i < ndigits ; i++) { - AliPHOSDigit * digit = (AliPHOSDigit *) digits->At(i) ; + digit = dynamic_cast( digits->At(i) ) ; digit->SetIndexInList(i) ; Float_t energy = sDigitizer->Calibrate(digit->GetAmp()) ; digit->SetAmp(DigitizeEnergy(energy,digit->GetId()) ) ; } } + //____________________________________________________________________________ Int_t AliPHOSDigitizer::DigitizeEnergy(Float_t energy, Int_t absId) { @@ -402,6 +372,7 @@ Int_t AliPHOSDigitizer::DigitizeEnergy(Float_t energy, Int_t absId) } return chanel ; } + //____________________________________________________________________________ void AliPHOSDigitizer::Exec(Option_t *option) { @@ -626,7 +597,10 @@ void AliPHOSDigitizer::MixWith(const char* headerFile) // check if the specified SDigits do not already exist on the White Board: // //Folders/RunMC/Event/Data/PHOS/SDigits/headerFile/sdigitsname - TString path = "Folders/RunMC/Event/Data/PHOS/SDigits" ; + AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; + TString path = gime->SDigitsFolder()->GetName() ; + + // before it was ???? "Folders/RunMC/Event/Data/PHOS/SDigits" ; path += headerFile ; path += "/" ; path += GetName() ; @@ -635,7 +609,6 @@ void AliPHOSDigitizer::MixWith(const char* headerFile) return; } - AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; gime->PostSDigits(GetName(),headerFile) ; // check if the requested file is already open or exist and if SDigits Branch exist @@ -650,59 +623,6 @@ void AliPHOSDigitizer::MixWith(const char* headerFile) } -// //__________________________________________________________________ -// 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 ; -// // } - -// cout << "AliPHOSDigitizer::SetSplitFile " << gDirectory->GetName() << endl ; -// cout << "AliPHOSDigitizer::SetSplitFile " << gAlice->GetTreeDFileName() << endl ; -// cout << "AliPHOSDigitizer::SetSplitFile " << splitFileName.Data() << endl ; - -// SetTitle(splitFileName) ; - -// TDirectory * cwd = gDirectory ; -// if ( !(gAlice->GetTreeDFileName() == splitFileName) ) { -// if (gAlice->GetTreeDFile() ) -// gAlice->GetTreeDFile()->Close() ; -// } - -// fSplitFile = gAlice->InitTreeFile("D",splitFileName.Data()); -// fSplitFile->cd() ; -// gAlice->Write(0, TObject::kOverwrite); - -// TTree *treeE = gAlice->TreeE(); -// if (!treeE) { -// cerr << "ERROR: AliPHOSDigitizer::SetSplitFile -> No TreeE found "<SetBranchAddress("Header", &header); -// treeE->SetBranchStatus("*",1); -// TTree *treeENew = treeE->CloneTree(); -// treeENew->Write(0, TObject::kOverwrite); - -// // copy AliceGeom -// TGeometry *AliceGeom = static_cast(cwd->Get("AliceGeom")); -// if (!AliceGeom) { -// cerr << "ERROR: AliPHOSDigitizer::SetSplitFile -> AliceGeom was not found in the input file "<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 @@ -806,16 +726,6 @@ void AliPHOSDigitizer::PrintDigits(Option_t * option){ } -// //__________________________________________________________________ -// 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) ; - -// } //__________________________________________________________________ Float_t AliPHOSDigitizer::TimeOfNoise(void) { // Calculates the time signal generated by noise @@ -823,19 +733,6 @@ Float_t AliPHOSDigitizer::TimeOfNoise(void) return 1. ; } -// //____________________________________________________________________________ -// void AliPHOSDigitizer::Reset() -// { -// // sets current event number to the first simulated event - -// if( strcmp(GetName(), "") == 0 ) -// Init() ; - -// // Int_t inputs ; -// // for(inputs = 0; inputs < fNinputs ;inputs++) -// // fIevent->AddAt(-1, inputs ) ; - -// } //____________________________________________________________________________ void AliPHOSDigitizer::WriteDigits(Int_t event) diff --git a/PHOS/AliPHOSDigitizer.h b/PHOS/AliPHOSDigitizer.h index 4842551d912..25b807af834 100644 --- a/PHOS/AliPHOSDigitizer.h +++ b/PHOS/AliPHOSDigitizer.h @@ -68,15 +68,9 @@ public: //General const Int_t GetDigitsInRun() const { return fDigitsInRun ;} - // 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) ; - + AliPHOSDigitizer & operator = (const AliPHOSDigitizer & rvalue) { // assignement operator requested by coding convention but not needed abort() ; @@ -97,9 +91,9 @@ private: private: - // TString fHitsFileName ; // file name that contains the original hits - // TString fSDigitsFileName ; // file name that contains the original SDigits Bool_t fDefaultInit; //! Says if the task was created by defaut ctor (only parameters are initialized) + Int_t fDigitsInRun ; //! Total number of digits in one run + Int_t fEmcCrystals ; // Number of EMC crystalls in the given geometry Float_t fPinNoise ; // Electronics noise in EMC @@ -108,7 +102,6 @@ private: Float_t fCPVNoise ; // Noise in CPV Float_t fCPVDigitThreshold ; // Threshold for storing digits in CPV - Int_t fDigitsInRun ; //! Total number of digits in one run Float_t fTimeResolution ; // Time resolution of FEE electronics Float_t fTimeThreshold ; // Threshold to start timing for given crystall diff --git a/PHOS/AliPHOSGetter.cxx b/PHOS/AliPHOSGetter.cxx index 373c22d7697..bb457101ec7 100644 --- a/PHOS/AliPHOSGetter.cxx +++ b/PHOS/AliPHOSGetter.cxx @@ -48,7 +48,6 @@ //*-- systematic usage of TFolders without changing the interface ////////////////////////////////////////////////////////////////////////////// - // --- ROOT system --- #include "TFile.h" #include "TTree.h" @@ -61,7 +60,6 @@ #include // --- AliRoot header files --- - #include "AliRun.h" #include "AliConfig.h" #include "AliPHOSGetter.h" @@ -204,8 +202,6 @@ AliPHOSGetter * AliPHOSGetter::GetInstance() // Returns the pointer of the unique instance already defined if ( fgObjGetter ) { -// if (fFile) // not the case if fManager -// fFile->cd() ; return fgObjGetter ; } else { @@ -221,6 +217,7 @@ AliPHOSGetter * AliPHOSGetter::GetInstance(const char* headerFile, { // Creates and returns the pointer of the unique instance // Must be called only when the environment has changed + if(!fgObjGetter){ fgObjGetter = new AliPHOSGetter(headerFile,branchTitle,toSplit) ; if(fgObjGetter->fFailed) @@ -716,6 +713,7 @@ const Bool_t AliPHOSGetter::PostSDigitizer(const char * name, const char * file) return kTRUE; } + //____________________________________________________________________________ const Bool_t AliPHOSGetter::PostDigits(const char * name) const { //---------- Digits ------------------------- @@ -1170,7 +1168,6 @@ const Bool_t AliPHOSGetter::PostTrackSegmentMaker(const char * name) const // the hierarchy is //Folders/Tasks/Reconstructioner/PHOS/sdigitsname - TTask * tasks = dynamic_cast(fTasksFolder->FindObject("Reconstructioner")) ; if ( !tasks ) { @@ -1283,7 +1280,7 @@ const Bool_t AliPHOSGetter::PostRecParticles(const char * name) const //____________________________________________________________________________ TObject** AliPHOSGetter::RecParticlesRef(const char * name) const -{ // ---------------TrackSegments ----------------------------------- +{ // ---------------RecParticles ----------------------------------- // the hierarchy is //Folders/Run/Event/RecData/PHOS/TrackSegments/name @@ -1571,27 +1568,9 @@ const TParticle * AliPHOSGetter::Primary(Int_t index) const p = fAlice->Particle(index) ; else p = gAlice->Particle(index) ; - // if (p->GetFirstMother() != -1 ) { - // cout << "AliPHOSGetter::Primary : Not a primary " << endl ; - // } return p ; - - - // Int_t primaryIndex = index % 10000000 ; -// Int_t primaryList = (Int_t ) ((index-primaryIndex)/10000000.) ; - -// if ( primaryList > 0 ) { -// if (fDebug) { -// cout << " Getter does not support currently Mixing of primary " << endl ; -// cout << " can not return primary: " << index<< " (list "<< primaryList<< " primary # " << primaryIndex << " )"<Particle(primaryIndex) ; - } //____________________________________________________________________________ @@ -1635,30 +1614,6 @@ Int_t AliPHOSGetter::ReadTreeD(const Int_t event) else treeD = gAlice->TreeD() ; -// if(!treeD) { // TreeD not found in header file - -// if (fDebug) -// cout << "WARNING: AliPHOSGetter::ReadTreeD -> Cannot find TreeD in " << fHeaderFile << endl ; - -// TString searchFileName("") ; - -// if (Digitizer()) // Digitizer found in header file -// searchFileName = Digitizer()->GetTitle() ; - -// else if (Clusterizer()) // Clusterizer found in header file -// searchFileName = Clusterizer()->GetDigitsFileName() ; - -// if ( (treeD = TreeD(searchFileName)) ) { //found TreeD in the file which contains the hits -// if (fDebug) -// cout << "INFO: AliPHOSGetter::ReadTreeD -> TreeD found in " << searchFileName.Data() << endl ; - -// } else { -// cerr << "ERROR: AliPHOSGetter::ReadTreeD -> TreeD not found " << endl ; -// return 1; -// } -// } - - TObjArray * lob = static_cast(treeD->GetListOfBranches()) ; TIter next(lob) ; TBranch * branch = 0 ; @@ -1791,8 +1746,8 @@ void AliPHOSGetter::Track(Int_t itrack) hitsbranch->SetAddress(HitsRef()) ; hitsbranch->GetEntry(itrack) ; - } + //____________________________________________________________________________ void AliPHOSGetter::ReadTreeQA() { @@ -1979,9 +1934,8 @@ Int_t AliPHOSGetter::ReadTreeR(const Int_t event) pidbranch->GetEntry(0) ; } - if(gAlice->TreeR()!=treeR){ + if(gAlice->TreeR()!=treeR) treeR->Delete(); - } return 0 ; } @@ -2063,23 +2017,12 @@ Int_t AliPHOSGetter::ReadTreeS(const Int_t event) 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(next()); -// if(folder){ -// TString fileName(folder->GetName()) ; -// fileName.ReplaceAll("_","/") ; -// file = static_cast(gROOT->GetFile(fileName)); -// file ->cd() ; -// } return 0 ; } + //____________________________________________________________________________ void AliPHOSGetter::ReadTreeS(TTree * treeS, Int_t input) @@ -2133,7 +2076,6 @@ void AliPHOSGetter::ReadTreeS(TTree * treeS, Int_t input) PostSDigitizer(sdigitsBranch->GetTitle(),filename) ; sdigitizerBranch->SetAddress(SDigitizerRef(sdname)) ; sdigitizerBranch->GetEntry(0) ; - // lob ->Delete(); if(gAlice->TreeS()!=treeS) treeS->Delete(); } @@ -2173,6 +2115,7 @@ void AliPHOSGetter::ReadPrimaries() void AliPHOSGetter::Event(const Int_t event, const char* opt) { // Reads the content of all Tree's S, D and R + if (event >= gAlice->TreeE()->GetEntries() ) { cerr << "ERROR: AliPHOSGetter::Event -> " << event << " not found in TreeE!" << endl ; return ; @@ -2216,7 +2159,6 @@ TObject * AliPHOSGetter::ReturnO(TString what, TString name, TString file) const TFolder * folder = 0 ; TObject * phosO = 0 ; - // if ( name.IsNull() ) { if ( what.CompareTo("Primaries") == 0 ) { folder = dynamic_cast(fPrimariesFolder->FindObject("Primaries")) ; if (folder) @@ -2591,7 +2533,7 @@ void AliPHOSGetter::CleanWhiteBoard(void){ } - //---- Now Tascks ----------- + //---- Now Tasks ----------- TObject * obj ; TString sdname(fSDigitsTitle); diff --git a/PHOS/AliPHOSGetter.h b/PHOS/AliPHOSGetter.h index 386f5f983aa..66259f54101 100644 --- a/PHOS/AliPHOSGetter.h +++ b/PHOS/AliPHOSGetter.h @@ -66,13 +66,13 @@ class AliPHOSGetter : public TObject { return *this ; } virtual ~AliPHOSGetter() ; - + //=========== Instantiators ================ static AliPHOSGetter * GetInstance(const char* headerFile, const char* branchTitle = "Default", const Bool_t toSplit = kFALSE ) ; static AliPHOSGetter * GetInstance() ; - + //=========== General information about run ============== const Int_t MaxEvent() const { return static_cast(gAlice->TreeE()->GetEntries()) ; } const Int_t EventNumber() const { return static_cast(gAlice->GetEvNumber()) ; } @@ -81,7 +81,7 @@ class AliPHOSGetter : public TObject { //========== PHOSGeometry and PHOS ============= const AliPHOS * PHOS() ; const AliPHOSGeometry * PHOSGeometry() ; - + //========== Methods to read something from file ========== void Event(const Int_t event, const char * opt = "HSDRP") ; void Track(const Int_t itrack) ; @@ -92,16 +92,16 @@ class AliPHOSGetter : public TObject { TFolder * Alarms() const { return dynamic_cast(ReturnO("Alarms", 0)) ; } const TObjArray * Alarms(const char * name ) const { return dynamic_cast(ReturnO("Alarms", name)) ; } const TTask * QATasks(const char * name = 0) const { return ReturnT("QATasks", name) ; } - + //-----------------now getter's data-------------------------------------- - + //=========== Primaries ============ TTree * TreeK(TString filename="") ; TClonesArray * Primaries(void) const { return dynamic_cast(ReturnO("Primaries")) ; } const TParticle * Primary(Int_t index) const ; const Int_t NPrimaries()const { return fNPrimaries; } const TParticle * Secondary(TParticle * p, Int_t index=1) const ; - + //=========== Hits ================= TTree * TreeH(TString filename="") ; const TClonesArray * Hits(void) { return dynamic_cast(ReturnO("Hits")) ; } @@ -115,26 +115,24 @@ class AliPHOSGetter : public TObject { 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(ReturnO("Digits", name)) ; } -//const AliPHOSDigit * Digit(Int_t index) { return static_cast(Digits()->At(index)) ;} !!! why no such method ? + //const AliPHOSDigit * Digit(Int_t index) { return static_cast(Digits()->At(index)) ;} !!! why no such method ? const AliPHOSDigitizer * Digitizer(const char * name = 0) const { return (const AliPHOSDigitizer*)(ReturnT("Digitizer", name)) ; } //========== RecPoints ============= - //TTree * TreeR(TString filename="") ; !!! why no such method ? TObjArray * EmcRecPoints(const char * name = 0) { return dynamic_cast(ReturnO("EmcRecPoints", name)) ; } -//const AliPHOSEmcRecPoint * EmcRecPoint(Int_t index) { return static_cast(EmcRecPoints()->At(index)) ;} !!! why no such method ? + //const AliPHOSEmcRecPoint * EmcRecPoint(Int_t index) { return static_cast(EmcRecPoints()->At(index)) ;} !!! why no such method ? TObjArray * CpvRecPoints(const char * name = 0) { return dynamic_cast(ReturnO("CpvRecPoints", name)) ; } -//const AliPHOSCpvRecPoint * CpvRecPoint(Int_t index) { return static_cast(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 ========== TClonesArray * TrackSegments(const char * name = 0) { @@ -146,9 +144,8 @@ class AliPHOSGetter : public TObject { TClonesArray * RecParticles(const char * name = 0) { return static_cast(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 ? - } - + 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 ; @@ -254,5 +251,3 @@ private: }; #endif // AliPHOSGETTER_H - - diff --git a/PHOS/AliPHOSSDigitizer.cxx b/PHOS/AliPHOSSDigitizer.cxx index 18d3e71d93f..704809538b6 100644 --- a/PHOS/AliPHOSSDigitizer.cxx +++ b/PHOS/AliPHOSSDigitizer.cxx @@ -76,7 +76,8 @@ ClassImp(AliPHOSSDigitizer) //____________________________________________________________________________ - AliPHOSSDigitizer::AliPHOSSDigitizer():TTask("","") { + AliPHOSSDigitizer::AliPHOSSDigitizer():TTask("","") +{ // ctor InitParameters() ; fDefaultInit = kTRUE ; @@ -168,6 +169,7 @@ void AliPHOSSDigitizer::InitParameters() void AliPHOSSDigitizer::Exec(Option_t *option) { // Collects all hits in the same active volume into digit + if( strcmp(GetName(), "") == 0 ) Init() ; @@ -299,49 +301,6 @@ void AliPHOSSDigitizer::SetSDigitsBranch(const char * title ) gime->PostSDigits( title, GetTitle()) ; } -// //__________________________________________________________________ -// void AliPHOSSDigitizer::SetSplitFile(const TString splitFileName) -// { -// // Diverts the SDigits in a file separate from the hits file - -// TDirectory * cwd = gDirectory ; - -// if ( !(gAlice->GetTreeSFileName() == splitFileName) ) { -// if (gAlice->GetTreeSFile() ) -// gAlice->GetTreeSFile()->Close() ; -// } - -// fSplitFile = gAlice->InitTreeFile("S",splitFileName.Data()); -// fSplitFile->cd() ; -// gAlice->Write(0, TObject::kOverwrite); - -// TTree *treeE = gAlice->TreeE(); -// if (!treeE) { -// cerr << "ERROR: AliPHOSSDigitizer::SetSPlitFile -> No TreeE found "<SetBranchAddress("Header", &header); -// treeE->SetBranchStatus("*",1); -// TTree *treeENew = treeE->CloneTree(); -// treeENew->Write(0, TObject::kOverwrite); - - -// // copy AliceGeom -// TGeometry *AliceGeom = static_cast(cwd->Get("AliceGeom")); -// if (!AliceGeom) { -// cerr << "ERROR: AliPHOSSDigitizer::SetSPlitFile -> AliceGeom was not found in the input file "<Write(0, TObject::kOverwrite); - -// 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 @@ -355,6 +314,7 @@ void AliPHOSSDigitizer::Print(Option_t* option)const cout << "---------------------------------------------------"<