+++ /dev/null
-/**************************************************************************
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * *
- * Author: The ALICE Off-line Project. *
- * Contributors are mentioned in the code where appropriate. *
- * *
- * Permission to use, copy, modify and distribute this software and its *
- * documentation strictly for non-commercial purposes is hereby granted *
- * without fee, provided that the above copyright notice appears in all *
- * copies and that both the copyright notice and this permission notice *
- * appear in the supporting documentation. The authors make no claims *
- * about the suitability of this software for any purpose. It is *
- * provided "as is" without express or implied warranty. *
- **************************************************************************/
-
-/* $Id$ */
-
-//_________________________________________________________________________
-//*-- Author : Dmitri Peressounko (SUBATECH & Kurchatov Institute)
-//////////////////////////////////////////////////////////////////////////////
-// This TTask performs digitization of Summable digits (in the PHOS case it is just
-// the sum of contributions from all primary particles into a given cell).
-// In addition it performs mixing of summable digits from different events.
-// The name of the TTask is also the title of the branch that will contain
-// the created SDigits
-// The title of the TTAsk is the name of the file that contains the hits from
-// which the SDigits are created
-//
-// For each event two branches are created in TreeD:
-// "PHOS" - list of digits
-// "AliPHOSDigitizer" - AliPHOSDigitizer with all parameters used in digitization
-//
-// Note, that one can set a title for new digits branch, and repeat digitization with
-// another set of parameters.
-//
-// Use case:
-// root[0] AliPHOSDigitizer * d = new AliPHOSDigitizer() ;
-// root[1] d->ExecuteTask()
-// Warning in <TDatabasePDG::TDatabasePDG>: object already instantiated
-// //Digitizes SDigitis in all events found in file galice.root
-//
-// root[2] AliPHOSDigitizer * d1 = new AliPHOSDigitizer("galice1.root") ;
-// // Will read sdigits from galice1.root
-// root[3] d1->MixWith("galice2.root")
-// Warning in <TDatabasePDG::TDatabasePDG>: object already instantiated
-// // Reads another set of sdigits from galice2.root
-// root[3] d1->MixWith("galice3.root")
-// // Reads another set of sdigits from galice3.root
-// root[4] d->ExecuteTask("deb timing")
-// // Reads SDigits from files galice1.root, galice2.root ....
-// // mixes them and stores produced Digits in file galice1.root
-// // deb - prints number of produced digits
-// // deb all - prints list of produced digits
-// // timing - prints time used for digitization
-//
-
-// --- ROOT system ---
-#include "TFile.h"
-#include "TTree.h"
-#include "TSystem.h"
-#include "TROOT.h"
-#include "TFolder.h"
-#include "TObjString.h"
-#include "TBenchmark.h"
-
-// --- Standard library ---
-#include <iomanip.h>
-
-// --- AliRoot header files ---
-
-#include "AliRun.h"
-#include "AliRunDigitizer.h"
-#include "AliPHOSDigit.h"
-#include "AliPHOS.h"
-#include "AliPHOSGetter.h"
-#include "AliPHOSDigitizer.h"
-#include "AliPHOSSDigitizer.h"
-#include "AliPHOSGeometry.h"
-#include "AliPHOSTick.h"
-
-ClassImp(AliPHOSDigitizer)
-
-
-//____________________________________________________________________________
- AliPHOSDigitizer::AliPHOSDigitizer()
-{
- // ctor
-
- fPinNoise = 0.01 ;
- fEMCDigitThreshold = 0.01 ;
- fCPVNoise = 0.01;
- fCPVDigitThreshold = 0.09 ;
- fTimeResolution = 0.5e-9 ;
- fTimeSignalLength = 1.0e-9 ;
- fDigitsInRun = 0 ;
- fADCchanelEmc = 0.0015; // width of one ADC channel in GeV
- fADCpedestalEmc = 0.005 ; //
- fNADCemc = (Int_t) TMath::Power(2,16) ; // number of channels in EMC ADC
-
- fADCchanelCpv = 0.0012 ; // width of one ADC channel in CPV 'popugais'
- fADCpedestalCpv = 0.012 ; //
- fNADCcpv = (Int_t) TMath::Power(2,12); // number of channels in CPV ADC
-
- fTimeThreshold = 0.001*10000000 ; //Means 1 MeV in terms of SDigits amplitude
- fARD = 0 ; // We work in the standalong mode
-}
-
-//____________________________________________________________________________
-AliPHOSDigitizer::AliPHOSDigitizer(const char *headerFile,const char * name)
-{
- // ctor
- SetName(name) ;
- SetTitle(headerFile) ;
- fARD = 0 ; // We work in the standalong mode
- Init() ;
-
-}
-
-//____________________________________________________________________________
-AliPHOSDigitizer::AliPHOSDigitizer(AliRunDigitizer * ard)
-{
- // ctor
- fARD = ard ;
- SetName(""); //Will call init in the digitizing
- SetTitle("aliroot") ;
-}
-
-//____________________________________________________________________________
- AliPHOSDigitizer::~AliPHOSDigitizer()
-{
- // dtor
-
-
-}
-
-//____________________________________________________________________________
-void AliPHOSDigitizer::Digitize(const Int_t event)
-{
-
- // Makes the digitization of the collected summable digits.
- // It first creates the array of all PHOS modules
- // filled with noise (different for EMC, CPV and PPSD) and
- // then adds contributions from SDigits.
- // This design avoids scanning over the list of digits to add
- // contribution to new SDigits only.
-
- AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
- TClonesArray * digits = gime->Digits(GetName()) ;
-
- digits->Clear() ;
-
- const AliPHOSGeometry *geom = gime->PHOSGeometry() ;
-
- //Making digits with noise, first EMC
- Int_t nEMC = geom->GetNModules()*geom->GetNPhi()*geom->GetNZ();
-
- Int_t nCPV ;
- Int_t absID ;
- TString name = geom->GetName() ;
-
- nCPV = nEMC + geom->GetNumberOfCPVPadsZ()*geom->GetNumberOfCPVPadsPhi()*
- geom->GetNModules() ;
-
- digits->Expand(nCPV) ;
-
- // get first the sdigitizer from the tasks list (must have same name as the digitizer)
- const AliPHOSSDigitizer * sDigitizer = gime->SDigitizer(GetName());
- if ( !sDigitizer) {
- cerr << "ERROR: AliPHOSDigitizer::Digitize -> SDigitizer with name " << GetName() << " not found " << endl ;
- abort() ;
- }
-
- // loop through the sdigits posted to the White Board and add them to the noise
- TCollection * folderslist = gime->SDigitsFolder()->GetListOfFolders() ;
- TIter next(folderslist) ;
- TFolder * folder = 0 ;
- TClonesArray * sdigits = 0 ;
- Int_t input = 0 ;
- TObjArray * sdigArray = new TObjArray(2) ;
- while ( (folder = (TFolder*)next()) )
- if ( (sdigits = (TClonesArray*)folder->FindObject(GetName()) ) ) {
- cout << "INFO: AliPHOSDigitizer::Digitize -> Adding SDigits "
- << GetName() << " from " << folder->GetName() << endl ;
- sdigArray->AddAt(sdigits, input) ;
- input++ ;
- }
-
- //Find the first crystall with signal
- Int_t nextSig = 200000 ;
- Int_t i;
- for(i=0; i<input; i++){
- sdigits = (TClonesArray *)sdigArray->At(i) ;
- if ( !sdigits->GetEntriesFast() )
- continue ;
- Int_t curNext = ((AliPHOSDigit *)sdigits->At(0))->GetId() ;
- if(curNext < nextSig)
- nextSig = curNext ;
- }
-
- TArrayI index(input) ;
- index.Reset() ; //Set all indexes to zero
-
- AliPHOSDigit * digit ;
- AliPHOSDigit * curSDigit ;
-
- TClonesArray * ticks = new TClonesArray("AliPHOSTick",1000) ;
-
- //Put Noise contribution
- for(absID = 1; absID <= nEMC; absID++){
- Float_t noise = gRandom->Gaus(0., fPinNoise) ;
- new((*digits)[absID-1]) AliPHOSDigit( -1,absID,sDigitizer->Digitize(noise), TimeOfNoise() ) ;
- //look if we have to add signal?
- if(absID==nextSig){
- //Add SDigits from all inputs
- digit = (AliPHOSDigit *) digits->At(absID-1) ;
-
- ticks->Clear() ;
- Int_t contrib = 0 ;
- Float_t a = digit->GetAmp() ;
- Float_t b = TMath::Abs( a /fTimeSignalLength) ;
- //Mark the beginnign of the signal
- new((*ticks)[contrib++]) AliPHOSTick(digit->GetTime(),0, b);
- //Mark the end of the ignal
- new((*ticks)[contrib++]) AliPHOSTick(digit->GetTime()+fTimeSignalLength, -a, -b);
-
- //loop over inputs
- for(i=0; i<input; i++){
- if(((TClonesArray *)sdigArray->At(i))->GetEntriesFast() > index[i] )
- curSDigit = (AliPHOSDigit*)((TClonesArray *)sdigArray->At(i))->At(index[i]) ;
- else
- curSDigit = 0 ;
- //May be several digits will contribute from the same input
- while(curSDigit && curSDigit->GetId() == absID){
- //Shift primary to separate primaries belonging different inputs
- Int_t primaryoffset ;
- if(fARD)
- primaryoffset = fARD->GetMask(i) ;
- else
- primaryoffset = 10000000*i ;
- curSDigit->ShiftPrimary(primaryoffset) ;
-
- a = curSDigit->GetAmp() ;
- b = a /fTimeSignalLength ;
- new((*ticks)[contrib++]) AliPHOSTick(curSDigit->GetTime(),0, b);
- new((*ticks)[contrib++]) AliPHOSTick(curSDigit->GetTime()+fTimeSignalLength, -a, -b);
-
- *digit = *digit + *curSDigit ; //add energies
-
- index[i]++ ;
- if(((TClonesArray *)sdigArray->At(i))->GetEntriesFast() > index[i] )
- curSDigit = (AliPHOSDigit*)((TClonesArray *)sdigArray->At(i))->At(index[i]) ;
- else
- curSDigit = 0 ;
- }
- }
-
- //calculate and set time
- Float_t time = FrontEdgeTime(ticks) ;
- digit->SetTime(time) ;
-
- //Find next signal module
- nextSig = 200000 ;
- for(i=0; i<input; i++){
- sdigits = ((TClonesArray *)sdigArray->At(i)) ;
- Int_t curNext = nextSig ;
- if(sdigits->GetEntriesFast() > index[i] ){
- curNext = ((AliPHOSDigit *) sdigits->At(index[i]))->GetId() ;
-
- }
- if(curNext < nextSig) nextSig = curNext ;
- }
- }
- }
-
- ticks->Delete() ;
- delete ticks ;
-
-
- //Now CPV digits (different noise and no timing)
- for(absID = nEMC+1; absID <= nCPV; absID++){
- Float_t noise = gRandom->Gaus(0., fCPVNoise) ;
- new((*digits)[absID-1]) AliPHOSDigit( -1,absID,sDigitizer->Digitize(noise), TimeOfNoise() ) ;
- //look if we have to add signal?
- if(absID==nextSig){
- digit = (AliPHOSDigit *) digits->At(absID-1) ;
- //Add SDigits from all inputs
- for(i=0; i<input; i++){
- if(((TClonesArray *)sdigArray->At(i))->GetEntriesFast() > index[i] )
- curSDigit = (AliPHOSDigit*)((TClonesArray *)sdigArray->At(i))->At(index[i]) ;
- else
- curSDigit = 0 ;
-
- //May be several digits will contribute from the same input
- while(curSDigit && curSDigit->GetId() == absID){
- //Shift primary to separate primaries belonging different inputs
- Int_t primaryoffset ;
- if(fARD)
- primaryoffset = fARD->GetMask(i) ;
- else
- primaryoffset = 10000000*i ;
- curSDigit->ShiftPrimary(primaryoffset) ;
-
- //add energies
- *digit = *digit + *curSDigit ;
- index[i]++ ;
- if(((TClonesArray *)sdigArray->At(i))->GetEntriesFast() > index[i] )
- curSDigit = (AliPHOSDigit*)((TClonesArray *)sdigArray->At(i))->At(index[i]) ;
- else
- curSDigit = 0 ;
- }
- }
-
- //Find next signal module
- nextSig = 200000 ;
- for(i=0; i<input; i++){
- sdigits = (TClonesArray *)sdigArray->At(i) ;
- Int_t curNext = nextSig ;
- if(sdigits->GetEntriesFast() > index[i] )
- curNext = ((AliPHOSDigit *) sdigits->At(index[i]))->GetId() ;
- if(curNext < nextSig) nextSig = curNext ;
- }
-
- }
- }
- delete sdigArray ; //We should not delete its contents
-
-
-
- //remove digits below thresholds
- for(i = 0; i < nEMC ; i++){
- digit = (AliPHOSDigit*) digits->At(i) ;
- if(sDigitizer->Calibrate( digit->GetAmp() ) < fEMCDigitThreshold)
- digits->RemoveAt(i) ;
- else
- digit->SetTime(gRandom->Gaus(digit->GetTime(),fTimeResolution) ) ;
- }
-
-
- for(i = nEMC; i < nCPV ; i++)
- if(sDigitizer->Calibrate(((AliPHOSDigit*)digits->At(i))->GetAmp()) < fCPVDigitThreshold)
- digits->RemoveAt(i) ;
-
- digits->Compress() ;
-
- Int_t ndigits = digits->GetEntriesFast() ;
- digits->Expand(ndigits) ;
-
- //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->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)
-{
- Int_t chanel ;
- if(absId <= fEmcCrystals){ //digitize as EMC
- chanel = (Int_t) TMath::Ceil((energy - fADCpedestalEmc)/fADCchanelEmc) ;
- if(chanel > fNADCemc ) chanel = fNADCemc ;
- }
- else{ //Digitize as CPV
- chanel = (Int_t) TMath::Ceil((energy - fADCpedestalCpv)/fADCchanelCpv) ;
- if(chanel > fNADCcpv ) chanel = fNADCcpv ;
- }
- return chanel ;
-}
-//____________________________________________________________________________
-void AliPHOSDigitizer::Exec(Option_t *option)
-{
- // Managing method
-
- if(strcmp(GetName(), "") == 0 )
- Init() ;
-
- if (strstr(option,"print")) {
- Print("");
- return ;
- }
-
- if(strstr(option,"tim"))
- gBenchmark->Start("PHOSDigitizer");
-
- AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
-
- Int_t nevents ;
-
- TTree * treeD ;
-
- if(fARD){
- treeD = fARD->GetTreeD() ;
- nevents = 1 ; // Will process only one event
- }
- else {
- gAlice->GetEvent(0) ;
- nevents = (Int_t) gAlice->TreeE()->GetEntries() ;
- treeD=gAlice->TreeD() ;
- }
- if(treeD == 0 ){
- cerr << " AliPHOSDigitizer :: Can not find TreeD " << endl ;
- return ;
- }
-
- //Check, if this branch already exits
- 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 ;
-
- 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 ;
- }
-
- Int_t ievent ;
-
- for(ievent = 0; ievent < nevents; ievent++){
-
- if(fARD){
- Int_t input ;
- for(input = 0 ; input < fARD->GetNinputs(); input ++){
- TTree * treeS = fARD->GetInputTreeS(input) ;
- if(!treeS){
- cerr << "AliPHOSDigitizer -> No Input " << endl ;
- return ;
- }
- gime->ReadTreeS(treeS,input) ;
- }
- }
- else
- gime->Event(ievent,"S") ;
-
- Digitize(ievent) ; //Add prepared SDigits to digits and add the noise
-
- WriteDigits(ievent) ;
-
- if(strstr(option,"deb"))
- PrintDigits(option);
-
- //increment the total number of Digits per run
- fDigitsInRun += gime->Digits()->GetEntriesFast() ;
- }
-
- if(strstr(option,"tim")){
- gBenchmark->Stop("PHOSDigitizer");
- cout << "AliPHOSDigitizer:" << endl ;
- cout << " took " << gBenchmark->GetCpuTime("PHOSDigitizer") << " seconds for Digitizing "
- << gBenchmark->GetCpuTime("PHOSDigitizer")/nevents << " seconds per event " << endl ;
- cout << endl ;
- }
-
-}
-
-//____________________________________________________________________________
-Float_t AliPHOSDigitizer::FrontEdgeTime(TClonesArray * ticks)
-{ //
- ticks->Sort() ; //Sort in accordance with times of ticks
- TIter it(ticks) ;
- AliPHOSTick * ctick = (AliPHOSTick *) it.Next() ;
- Float_t time = ctick->CrossingTime(fTimeThreshold) ;
-
- AliPHOSTick * t ;
- while((t=(AliPHOSTick*) it.Next())){
- if(t->GetTime() < time) //This tick starts before crossing
- *ctick+=*t ;
- else
- return time ;
-
- time = ctick->CrossingTime(fTimeThreshold) ;
- }
- return time ;
-}
-//____________________________________________________________________________
-Bool_t AliPHOSDigitizer::Init()
-{
- fPinNoise = 0.01 ;
- fEMCDigitThreshold = 0.01 ;
- fCPVNoise = 0.01;
- fCPVDigitThreshold = 0.09 ;
- fTimeResolution = 0.5e-9 ;
- fTimeSignalLength = 1.0e-9 ;
- fDigitsInRun = 0 ;
- fADCchanelEmc = 0.0015; // width of one ADC channel in GeV
- fADCpedestalEmc = 0.005 ; //
- fNADCemc = (Int_t) TMath::Power(2,16) ; // number of channels in EMC ADC
-
- fADCchanelCpv = 0.0012 ; // width of one ADC channel in CPV 'popugais'
- fADCpedestalCpv = 0.012 ; //
- fNADCcpv = (Int_t) TMath::Power(2,12); // number of channels in CPV ADC
-
- fTimeThreshold = 0.001*10000000 ; //Means 1 MeV in terms of SDigits amplitude
-
- if(fARD)
- SetTitle("aliroot") ;
- else
- SetTitle("galice.root") ;
-
- if( strcmp(GetName(), "") == 0 )
- SetName("Default") ;
-
- AliPHOSGetter * gime = AliPHOSGetter::GetInstance(GetTitle(), GetName()) ;
- if ( gime == 0 ) {
- cerr << "ERROR: AliPHOSDigitizer::Init -> Could not obtain the Getter object !" << endl ;
- return kFALSE;
- }
-
- const AliPHOSGeometry * geom = gime->PHOSGeometry() ;
- fEmcCrystals = geom->GetNModules() * geom->GetNCristalsInModule() ;
-
- // create a folder on the white board //YSAlice/WhiteBoard/Digits/PHOS/headerFile/digitsTitle
- gime->PostDigits(GetName() ) ;
-
- //add Task to //YSAlice/tasks/Digitizer/PHOS
- gime->PostDigitizer(this) ;
-
- //Mark that we will use current header file
- if(!fARD){
- gime->PostSDigits(GetName(),GetTitle()) ;
- gime->PostSDigitizer(GetName(),GetTitle()) ;
- }
- return kTRUE ;
-}
-
-//__________________________________________________________________
-void AliPHOSDigitizer::MixWith(const char* headerFile)
-{
- // Allows to produce digits by superimposing background and signal event.
- // It is assumed, that headers file with SIGNAL events is opened in
- // the constructor.
- // Sets the BACKGROUND event, with which the SIGNAL event is to be mixed
- // Thus we avoid writing (changing) huge and expensive
- // backgound files: all output will be writen into SIGNAL, i.e.
- // opened in constructor file.
- //
- // One can open as many files to mix with as one needs.
- // However only Sdigits with the same name (i.e. constructed with the same SDigitizer)
- // can be mixed.
-
- if( strcmp(GetName(), "") == 0 )
- Init() ;
-
- if(fARD){
- cout << "Can not use this method under AliRunDigitizer " << endl ;
- return ;
- }
-
- // check if the specified SDigits do not already exist on the White Board:
- // //YSAlice/WhiteBoard/SDigits/PHOS/headerFile/sDigitsTitle
-
- TString path = "YSAlice/WhiteBoard/SDigits/PHOS/" ;
- path += headerFile ;
- path += "/" ;
- path += GetName() ;
- if ( gROOT->FindObjectAny(path.Data()) ) {
- cerr << "WARNING: AliPHOSDigitizer::MixWith -> Entry already exists, do not add" << endl ;
- return;
- }
-
- AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
- gime->PostSDigits(GetName(),headerFile) ;
-
- // check if the requested file is already open or exist and if SDigits Branch exist
- TFile * file = (TFile*)gROOT->FindObject(headerFile);
- if ( !file ) {
- file = new TFile(headerFile, "READ") ;
- if (!file) {
- cerr << "ERROR: AliPHOSDigitizer::MixWith -> File " << headerFile << " does not exist!" << endl ;
- return ;
- }
- }
-
-}
-
-//__________________________________________________________________
-void AliPHOSDigitizer::Print(Option_t* option)const {
- // Print Digitizer's parameters
- if( strcmp(GetName(), "") != 0 ){
-
- cout << "------------------- "<< GetName() << " -------------" << endl ;
- cout << "Digitizing sDigits from file(s): " <<endl ;
-
- TCollection * folderslist = ((TFolder*)gROOT->FindObjectAny("YSAlice/WhiteBoard/SDigits/PHOS"))->GetListOfFolders() ;
- TIter next(folderslist) ;
- TFolder * folder = 0 ;
-
- while ( (folder = (TFolder*)next()) ) {
- if ( folder->FindObject(GetName()) )
- cout << "Adding SDigits " << GetName() << " from " << folder->GetName() << endl ;
- }
- cout << endl ;
- cout << "Writing digits to " << GetTitle() << endl ;
-
- cout << endl ;
- cout << "With following parameters: " << endl ;
- cout << " Electronics noise in EMC (fPinNoise) = " << fPinNoise << endl ;
- cout << " Threshold in EMC (fEMCDigitThreshold) = " << fEMCDigitThreshold << endl ; ;
- cout << " Noise in CPV (fCPVNoise) = " << fCPVNoise << endl ;
- cout << " Threshold in CPV (fCPVDigitThreshold) = " << fCPVDigitThreshold << endl ;
- cout << "---------------------------------------------------" << endl ;
- }
- else
- cout << "AliPHOSDigitizer not initialized " << endl ;
-
-}
-
-//__________________________________________________________________
-void AliPHOSDigitizer::PrintDigits(Option_t * option){
- // Print a table of digits
-
- AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
- TClonesArray * digits = gime->Digits() ;
-
- cout << "AliPHOSDigitiser: event " << gAlice->GetEvNumber() << endl ;
- cout << " Number of entries in Digits list " << digits->GetEntriesFast() << endl ;
- cout << endl ;
- if(strstr(option,"all")||strstr(option,"EMC")){
-
- //loop over digits
- AliPHOSDigit * digit;
- cout << "EMC digits (with primaries): " << endl ;
- cout << "Digit Id Amplitude Index Nprim Primaries list " << endl;
- Int_t maxEmc = gime->PHOSGeometry()->GetNModules()*gime->PHOSGeometry()->GetNCristalsInModule() ;
- Int_t index ;
- for (index = 0 ; (index < digits->GetEntriesFast()) &&
- (((AliPHOSDigit * ) digits->At(index))->GetId() <= maxEmc) ; index++) {
- digit = (AliPHOSDigit * ) digits->At(index) ;
- if(digit->GetNprimary() == 0) continue;
- cout << setw(6) << digit->GetId() << " " << setw(10) << digit->GetAmp() << " "
- << setw(6) << digit->GetIndexInList() << " "
- << setw(5) << digit->GetNprimary() <<" ";
-
- Int_t iprimary;
- for (iprimary=0; iprimary<digit->GetNprimary(); iprimary++)
- cout << setw(5) << digit->GetPrimary(iprimary+1) << " ";
- cout << endl;
- }
- cout << endl;
- }
-
- if(strstr(option,"all")||strstr(option,"CPV")){
-
- //loop over CPV digits
- AliPHOSDigit * digit;
- cout << "CPV digits: " << endl ;
- cout << "Digit Id Amplitude Index Nprim Primaries list " << endl;
- Int_t maxEmc = gime->PHOSGeometry()->GetNModules()*gime->PHOSGeometry()->GetNCristalsInModule() ;
- Int_t index ;
- for (index = 0 ; index < digits->GetEntriesFast(); index++) {
- digit = (AliPHOSDigit * ) digits->At(index) ;
- if(digit->GetId() > maxEmc){
- cout << setw(6) << digit->GetId() << " " << setw(10) << digit->GetAmp() << " "
- << setw(6) << digit->GetIndexInList() << " "
- << setw(5) << digit->GetNprimary() <<" ";
-
- Int_t iprimary;
- for (iprimary=0; iprimary<digit->GetNprimary(); iprimary++)
- cout << setw(5) << digit->GetPrimary(iprimary+1) << " ";
- cout << 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() ;
-
- AliPHOSGetter::GetInstance()->SDigits()->SetName(title) ;
-
-}
-//__________________________________________________________________
-Float_t AliPHOSDigitizer::TimeOfNoise(void)
-{ // Calculates the time signal generated by noise
- //to be rewritten, now returns just big number
- 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)
-{
-
- // Makes TreeD in the output file.
- // Check if branch already exists:
- // if yes, exit without writing: ROOT TTree does not support overwriting/updating of
- // already existing branches.
- // else creates branch with Digits, named "PHOS", title "...",
- // and branch "AliPHOSDigitizer", with the same title to keep all the parameters
- // and names of files, from which digits are made.
-
- AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
- TClonesArray * digits = gime->Digits(GetName()) ;
-
- TTree * treeD ;
-
- if(fARD)
- treeD = fARD->GetTreeD() ;
- else
- treeD = gAlice->TreeD();
-
- // create new branches
- // -- generate file name if necessary
- char * file =0;
- if(gSystem->Getenv("CONFIG_SPLIT_FILE")){ //generating file name
- file = new char[strlen(gAlice->GetBaseFile())+20] ;
- sprintf(file,"%s/PHOS.Digits.root",gAlice->GetBaseFile()) ;
- }
-
- TDirectory *cwd = gDirectory;
- // -- create Digits branch
- Int_t bufferSize = 32000 ;
- TBranch * digitsBranch = treeD->Branch("PHOS",&digits,bufferSize);
- digitsBranch->SetTitle(GetName());
- if (file) {
- digitsBranch->SetFile(file);
- TIter next( digitsBranch->GetListOfBranches());
- TBranch * sbr ;
- while ((sbr=(TBranch*)next())) {
- sbr->SetFile(file);
- }
- cwd->cd();
- }
-
- // -- Create Digitizer branch
- Int_t splitlevel = 0 ;
- AliPHOSDigitizer * d = gime->Digitizer(GetName()) ;
- TBranch * digitizerBranch = treeD->Branch("AliPHOSDigitizer", "AliPHOSDigitizer", &d,bufferSize,splitlevel);
- digitizerBranch->SetTitle(GetName());
- if (file) {
- digitizerBranch->SetFile(file);
- TIter next( digitizerBranch->GetListOfBranches());
- TBranch * sbr;
- while ((sbr=(TBranch*)next())) {
- sbr->SetFile(file);
- }
- cwd->cd();
- }
-
- digitsBranch->Fill() ;
- digitizerBranch->Fill() ;
-
- treeD->Write(0,kOverwrite) ;
-
-}
+++ /dev/null
-#ifndef ALIPHOSDigitizer_H
-#define ALIPHOSDigitizer_H
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice */
-
-/* $Id$ */
-
-//_________________________________________________________________________
-// Task Class for making SDigits in PHOS
-// Class performs digitization of Summable digits (in the PHOS case this is just
-// sum of contributions of all primary particles into given cell).
-// In addition it performs mixing of summable digits from different events.
-//
-//*-- Author: Dmitri Peressounko(SUBATECH & KI)
-
-
-// --- ROOT system ---
-#include "TObjString.h"
-class TArrayI ;
-// --- Standard library ---
-
-// --- AliRoot header files ---
-#include "AliDigitizer.h"
-class AliPHOSSDigitizer ;
-class AliRunDigitizer ;
-
-class AliPHOSDigitizer: public AliDigitizer {
-
-public:
- AliPHOSDigitizer() ; // ctor
- AliPHOSDigitizer(const char *headerFile, const char * name = "Default") ;
- AliPHOSDigitizer(AliRunDigitizer * ard) ;
- AliPHOSDigitizer(const AliPHOSDigitizer & dtizer)
- {( (AliPHOSDigitizer &)dtizer ).Copy(*this) ;}
- virtual ~AliPHOSDigitizer() ;
-
- void Digitize(const Int_t event) ; // Make Digits from SDigits
- void Exec(Option_t *option); // Supervising method
-
- //CPV parameters
- const Float_t GetCPVNoise() const { return fCPVNoise ;}
- const Float_t GetCPVThreshold() const { return fCPVDigitThreshold ;}
- const Float_t GetCPVchannel() const { return fADCchanelCpv; }
- const Float_t GetCPVpedestal() const { return fADCpedestalCpv; }
-
- void SetCPVNoise(Float_t CPVNoise) {fCPVNoise = CPVNoise;}
- void SetCPVThreshold(Float_t CPVThreshold) {fCPVDigitThreshold= CPVThreshold;}
- void SetNCPVchannels(Int_t n) { fNADCcpv = n; }
- void SetCPVchannel(Float_t width) { fADCchanelCpv = width; }
- void SetCPVpedestal(Float_t ped) { fADCpedestalCpv = ped; }
-
-
- //EMC parameters
- const Float_t GetEMCThreshold() const { return fEMCDigitThreshold;}
- const Float_t GetEMCchannel() const { return fADCchanelEmc; }
- const Float_t GetEMCpedestal() const { return fADCpedestalEmc; }
- const Float_t GetPinNoise() const { return fPinNoise;}
- const Float_t GetTimeResolution() const { return fTimeResolution ; }
-
- void SetEMCThreshold(Float_t EMCThreshold) {fEMCDigitThreshold = EMCThreshold;}
- void SetPinNoise(Float_t PinNoise ) {fPinNoise = PinNoise;}
- void SetNEMCchannels(Int_t n) { fNADCemc = n; }
- void SetEMCchannel(Float_t width) { fADCchanelEmc = width; }
- void SetEMCpedestal(Float_t ped) { fADCpedestalEmc = ped ; }
-
- //General
- const Int_t GetDigitsInRun() const { return fDigitsInRun ;}
-
- 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 SetSDigitsBranch(const char* file) ;
-
- AliPHOSDigitizer & operator = (const AliPHOSDigitizer & rvalue) {
- // assignement operator requested by coding convention but not needed
- abort() ;
- return *this ;
- }
-
-private:
-
- Bool_t Init() ;
- void PrintDigits(Option_t * option) ;
- void WriteDigits(Int_t evt) ; // Writes Digits for particular event
- Float_t TimeOfNoise(void) ; // Calculate time signal generated by noise
- //Calculate the time of crossing of the threshold by front edge
- Float_t FrontEdgeTime(TClonesArray * ticks) ;
- //Calculate digitized signal with gived ADC parameters
- Int_t DigitizeEnergy(Float_t energy, Int_t absId) ;
-
-private:
-
- AliRunDigitizer * fARD ; //! Pointer to the Digitization Manager class
-
- Int_t fEmcCrystals ; // Number of EMC crystalls in the given geometry
-
- Float_t fPinNoise ; // Electronics noise in EMC
- Float_t fEMCDigitThreshold ; // Threshold for storing digits in EMC
-
- 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
- Float_t fTimeSignalLength ; // Length of the timing signal
-
- Float_t fADCchanelEmc ; // width of one ADC channel in GeV
- Float_t fADCpedestalEmc ; //
- Int_t fNADCemc ; // number of channels in EMC ADC
-
- Float_t fADCchanelCpv ; // width of one ADC channel in CPV 'popugais'
- Float_t fADCpedestalCpv ; //
- Int_t fNADCcpv ; // number of channels in CPV ADC
-
-
- ClassDef(AliPHOSDigitizer,1) // description
-
-};
-
-
-#endif // AliPHOSDigitizer_H
+++ /dev/null
-/**************************************************************************
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * *
- * Author: The ALICE Off-line Project. *
- * Contributors are mentioned in the code where appropriate. *
- * *
- * Permission to use, copy, modify and distribute this software and its *
- * documentation strictly for non-commercial purposes is hereby granted *
- * without fee, provided that the above copyright notice appears in all *
- * copies and that both the copyright notice and this permission notice *
- * appear in the supporting documentation. The authors make no claims *
- * about the suitability of this software for any purpose. It is *
- * provided "as is" without express or implied warranty. *
- **************************************************************************/
-
-/* $Id: */
-
-/* $Log:
- 29.05.2001 Yuri Kharlov:
- Everywhere reading the treese TTree->GetEvent(i)
- is replaced by reading the branches TBranch->GetEntry(0)
-*/
-
-//_________________________________________________________________________
-// A singleton. This class should be used in the analysis stage to get
-// reconstructed objects: Digits, RecPoints, TrackSegments and RecParticles,
-// instead of directly reading them from galice.root file. This container
-// ensures, that one reads Digits, made of these particular digits, RecPoints,
-// made of these particular RecPoints, TrackSegments and RecParticles.
-// This becomes non trivial if there are several identical branches, produced with
-// different set of parameters.
-//
-// An example of how to use (see also class AliPHOSAnalyser):
-// AliPHOSGetter * gime = AliPHOSGetter::GetInstance("galice.root","test") ;
-// for(Int_t irecp = 0; irecp < gime->NRecParticles() ; irecp++)
-// AliPHOSRecParticle * part = gime->RecParticle(1) ;
-// ................
-// please->GetEvent(event) ; // reads new event from galice.root
-//
-//*-- Author: Yves Schutz (SUBATECH) & Dmitri Peressounko (RRC KI & SUBATECH)
-//*-- Completely redesigned by Dmitri Peressounko March 2001
-//
-//*-- YS June 2001 : renamed the original AliPHOSIndexToObject and make
-//*-- systematic usage of TFolders without changing the interface
-//////////////////////////////////////////////////////////////////////////////
-
-
-// --- ROOT system ---
-
-#include "TFile.h"
-#include "TTree.h"
-#include "TROOT.h"
-#include "TObjString.h"
-#include "TFolder.h"
-
-// --- Standard library ---
-#include <iostream.h>
-
-// --- AliRoot header files ---
-
-#include "AliRun.h"
-#include "AliConfig.h"
-#include "AliPHOSGetter.h"
-#include "AliPHOS.h"
-#include "AliPHOSDigitizer.h"
-#include "AliPHOSSDigitizer.h"
-#include "AliPHOSClusterizer.h"
-#include "AliPHOSClusterizerv1.h"
-#include "AliPHOSTrackSegmentMaker.h"
-#include "AliPHOSTrackSegmentMakerv1.h"
-#include "AliPHOSTrackSegment.h"
-#include "AliPHOSPID.h"
-#include "AliPHOSPIDv1.h"
-#include "AliPHOSGeometry.h"
-
-ClassImp(AliPHOSGetter)
-
- AliPHOSGetter * AliPHOSGetter::fgObjGetter = 0 ;
-
-//____________________________________________________________________________
-AliPHOSGetter::AliPHOSGetter(const char* headerFile, const char* branchTitle )
-{
- //Initialize all lists
-
- fHeaderFile = headerFile ;
- fBranchTitle = branchTitle ;
- fSDigitsTitle = branchTitle ;
- fDigitsTitle = branchTitle ;
- fRecPointsTitle = branchTitle ;
- fRecParticlesTitle = branchTitle ;
- fTrackSegmentsTitle = branchTitle ;
-
- fPrimaries = new TObjArray(1) ;
-
- fModuleFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/Run/Configuration/Modules"));
- fHitsFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/RunMC/Event/Data/Hits"));
- fSDigitsFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/RunMC/Event/Data/SDigits"));
- fDigitsFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/Run/Event/Data"));
- 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")) ;
-
- if ( fHeaderFile != "aliroot" ) { // to call the getter without a file
-
- //open headers file
- TFile * file = static_cast<TFile*>(gROOT->GetFile(fHeaderFile.Data() ) ) ;
-
- if(file == 0){ //if file was not opened yet, read gAlice
- if(fHeaderFile.Contains("rfio")) // if we read file using HPSS
- file = TFile::Open(fHeaderFile.Data(),"update") ;
- else
- file = new TFile(fHeaderFile.Data(),"update") ;
-
- if (!file->IsOpen()) {
- cerr << "ERROR : AliPHOSGetter::AliPHOSGetter -> Cannot open " << fHeaderFile.Data() << endl ;
- abort() ;
- }
-
- gAlice = static_cast<AliRun *>(file->Get("gAlice")) ;
- }
- }
-
- if (!gAlice) {
- cerr << "ERROR : AliPHOSGetter::AliPHOSGetter -> Cannot find gAlice in " << fHeaderFile.Data() << endl ;
- abort() ;
- }
- if (!PHOS()) {
- if (fDebug)
- cout << "INFO: AliPHOSGetter -> Posting PHOS to Folders" << endl ;
- AliConfig * conf = AliConfig::Instance() ;
- conf->Add(static_cast<AliDetector*>(gAlice->GetDetector("PHOS"))) ;
- conf->Add(static_cast<AliModule*>(gAlice->GetDetector("PHOS"))) ;
- }
-
- fDebug=0;
-}
-//____________________________________________________________________________
-AliPHOSGetter::~AliPHOSGetter(){
-
-}
-
-//____________________________________________________________________________
-void AliPHOSGetter::CreateWhiteBoard() const
-{
-
-}
-
-//____________________________________________________________________________
-AliPHOSGetter * AliPHOSGetter::GetInstance()
-{
- // Returns the pointer of the unique instance already defined
-
- AliPHOSGetter * rv = 0 ;
- if ( fgObjGetter )
- rv = fgObjGetter ;
- else
- cout << "AliPHOSGetter::GetInstance ERROR: not yet initialized" << endl ;
-
- return rv ;
-}
-
-//____________________________________________________________________________
-AliPHOSGetter * AliPHOSGetter::GetInstance(const char* headerFile,
- const char* branchTitle)
-{
- // Creates and returns the pointer of the unique instance
- // Must be called only when the environment has changed
-
- if ( fgObjGetter )
- if((fgObjGetter->fBranchTitle.CompareTo(branchTitle) == 0) &&
- (fgObjGetter->fHeaderFile.CompareTo(headerFile)==0))
- return fgObjGetter ;
- else
- fgObjGetter->~AliPHOSGetter() ; // delete it if already exists another version
-
- fgObjGetter = new AliPHOSGetter(headerFile,branchTitle) ;
-
- // Posts a few item to the white board (folders)
- // fgObjGetter->CreateWhiteBoard() ;
-
- return fgObjGetter ;
-
-}
-
-//____________________________________________________________________________
-const AliPHOS * AliPHOSGetter::PHOS()
-{
- // returns the PHOS object
- AliPHOS * phos = dynamic_cast<AliPHOS*>(fModuleFolder->FindObject("PHOS")) ;
- if (!phos)
- if (fDebug)
- cout << "WARNING: AliPHOSGetter::PHOS -> PHOS module not found in Folders" << endl ;
- return phos ;
-}
-
-//____________________________________________________________________________
-const AliPHOSGeometry * AliPHOSGetter::PHOSGeometry()
-{
- AliPHOSGeometry * rv = 0 ;
- if (PHOS() )
- rv = PHOS()->GetGeometry() ;
- return rv ;
-}
-
-//____________________________________________________________________________
-Bool_t AliPHOSGetter::PostHits(void) const
-{ //------- Hits ----------------------
-
- // the hierarchy is //Folders/RunMC/Event/Data/PHOS/Hits
-
- TFolder * phosFolder = dynamic_cast<TFolder*>(fHitsFolder->FindObject("PHOS")) ;
- if ( !phosFolder ) {
- if (fDebug) {
- cout << "WARNING: AliPHOSGetter::Post H -> Folder //" << fHitsFolder << "/PHOS/ not found!" << endl;
- cout << "INFO: AliPHOSGetter::Post H -> Adding Folder //" << fHitsFolder << "/PHOS/" << endl;
- }
- phosFolder = fHitsFolder->AddFolder("PHOS", "Hits from PHOS") ;
- }
- TClonesArray *hits= new TClonesArray("AliPHOSHit",1000) ;
- hits->SetName("Hits") ;
- phosFolder->Add(hits) ;
-
- return kTRUE;
-}
-
-//____________________________________________________________________________
-void * AliPHOSGetter::HitsRef(void) const
-{ //------- Hits ----------------------
-
-
- // the hierarchy is //Folders/RunMC/Event/Data/PHOS/Hits
- if ( !fHitsFolder ) {
- cerr << "ERROR: AliPHOSGetter::Post H -> Folder //" << fHitsFolder << " not found!" << endl;
- return 0;
- }
-
- TFolder * phosFolder = dynamic_cast<TFolder *>(fHitsFolder->FindObject("PHOS")) ;
- if ( !phosFolder ) {
- cerr << "ERROR: AliPHOSGetter::Post HRef -> Folder //" << fHitsFolder << "/PHOS/ not found!" << endl;
- return 0;
- }
-
- TObject * h = phosFolder->FindObject("Hits") ;
- if(!h) {
- cerr << "ERROR: AliPHOSGetter::HRef -> " << phosFolder->GetName() << "/Hits not found !" << endl ;
- return 0 ;
- }
- else
- return static_cast<void *>(phosFolder->GetListOfFolders()->GetObjectRef(h)) ;
-}
-
-//____________________________________________________________________________
-Bool_t AliPHOSGetter::PostSDigits(const char * name, const char * headerFile) const
-{ //---------- SDigits -------------------------
-
-
- // the hierarchy is //Folders/RunMC/Event/Data/PHOS/SDigits/headerFile/sdigitsname
- // because you can have sdigits from several hit files for mixing
-
- TFolder * phosFolder = dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("PHOS")) ;
- if ( !phosFolder ) {
- if (fDebug) {
- cout << "WARNING: AliPHOSGetter::Post S -> Folder //" << fSDigitsFolder << "/PHOS/ not found!" << endl;
- cout << "INFO: AliPHOSGetter::Post S -> Adding Folder //" << fHitsFolder << "/PHOS/" << endl;
- }
- phosFolder = fSDigitsFolder->AddFolder("PHOS", "SDigits from PHOS") ;
- }
- TString subdir(headerFile) ;
- 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{
- TClonesArray * sdigits = new TClonesArray("AliPHOSDigit",1) ;
- sdigits->SetName(name) ;
- phosSubFolder->Add(sdigits) ;
- }
-
- return kTRUE;
-}
-//____________________________________________________________________________
-void * AliPHOSGetter::SDigitsRef(const char * name, const char * file) const
-{ //------- SDigits ----------------------
-
- // the hierarchy is //Folders/RunMC/Event/Data/PHOS/SDigits/filename/SDigits
-
- if ( !fSDigitsFolder ) {
- cerr << "ERROR: AliPHOSGetter::Post SRef -> Folder //" << fSDigitsFolder << " not found!" << endl;
- return 0;
- }
-
- TFolder * phosFolder = dynamic_cast<TFolder *>(fSDigitsFolder->FindObject("PHOS")) ;
- if ( !phosFolder ) {
- cerr << "ERROR: AliPHOSGetter::Post SRef -> Folder //" << fSDigitsFolder << "/PHOS/ not found!" << endl;
- return 0;
- }
-
- TFolder * phosSubFolder = 0 ;
- if(file)
- phosSubFolder = dynamic_cast<TFolder *>(phosFolder->FindObject(file)) ;
- else
- phosSubFolder = dynamic_cast<TFolder *>(phosFolder->FindObject(fHeaderFile)) ;
-
- if(!phosSubFolder) {
- cerr << "ERROR: AliPHOSGetter::Post SRef -> Folder //Folders/RunMC/Event/Data/PHOS/" << file << "not found!" << endl;
- return 0;
- }
-
- TObject * dis = phosSubFolder->FindObject(name) ;
- if(!dis)
- return 0 ;
- else
- return static_cast<void *>(phosSubFolder->GetListOfFolders()->GetObjectRef(dis)) ;
-
-}
-
-//____________________________________________________________________________
-Bool_t AliPHOSGetter::PostSDigitizer(AliPHOSSDigitizer * sdigitizer) const
-{ //---------- SDigitizer -------------------------
-
- // the hierarchy is //Folders/Tasks/SDigitizer/PHOS/sdigitsname
-
-
- TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("SDigitizer")) ;
-
- if ( !sd ) {
- cerr << "ERROR: AliPHOSGetter::Post Ser -> Task //" << fTasksFolder << "/SDigitizer not found!" << endl;
- return kFALSE ;
- }
- TTask * phos = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("PHOS")) ;
- if ( !phos ) {
- if (fDebug) {
- cout <<"WARNING: AliPHOSGetter::Post Ser ->//" << fTasksFolder << "/SDigitizer/PHOS/ not found!" << endl;
- cout <<"INFO: AliPHOSGetter::Post Ser -> Adding //" << fTasksFolder << "/SDigitizer/PHOS/" << endl;
- }
- phos = new TTask("PHOS", "") ;
- sd->Add(phos) ;
- }
- AliPHOSSDigitizer * phossd = dynamic_cast<AliPHOSSDigitizer *>(phos->GetListOfTasks()->FindObject( sdigitizer->GetName() ));
- if (phossd) {
- if (fDebug)
- cout << "INFO: AliPHOSGetter::Post Ser -> Task " << sdigitizer->GetName() << " already exists" << endl ;
- phos->GetListOfTasks()->Remove(phossd) ;
- }
- phos->Add(sdigitizer) ;
- return kTRUE;
-
-}
-
-//____________________________________________________________________________
-void * AliPHOSGetter::SDigitizerRef(const char * name) const
-{
-
- TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("SDigitizer")) ;
- if ( !sd ) {
- cerr << "ERROR: AliPHOSGetter::Post SerRef -> Task //" << fTasksFolder << "/SDigitizer not found!" << endl;
- abort();
- }
-
- TTask * phos = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("PHOS")) ;
- if ( !phos ) {
- cerr <<"ERROR: AliPHOSGetter::Post SerRef -> //" << fTasksFolder << "/SDigitizer/PHOS not found!" << endl;
- abort();
- }
-
- TTask * task = dynamic_cast<TTask*>(phos->GetListOfTasks()->FindObject(name)) ;
-
- return static_cast<void *>(phos->GetListOfTasks()->GetObjectRef(task)) ;
-
-}
-
-//____________________________________________________________________________
-Bool_t AliPHOSGetter::PostSDigitizer(const char * name, const char * file) const
-{ //---------- SDigitizer -------------------------
-
- // the hierarchy is //Folders/Tasks/SDigitizer/PHOS/sdigitsname
-
-
- TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("SDigitizer")) ;
- if ( !sd ) {
- cerr << "ERROR: AliPHOSGetter::Post Ser -> Task //" << fTasksFolder << "/SDigitizer not found!" << endl;
- return kFALSE ;
- }
-
- TTask * phos = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("PHOS")) ;
- if ( !phos ) {
- if (fDebug) {
- cout <<"WARNING: AliPHOSGetter::Post Ser -> //" << fTasksFolder << "/SDigitizer/PHOS/ not found!" << endl;
- cout <<"INFO: AliPHOSGetter::Post Ser -> Adding //" << fTasksFolder << "/SDigitizer/PHOS" << endl;
- }
- phos = new TTask("PHOS", "") ;
- sd->Add(phos) ;
- }
-
- TString sdname(name) ;
- sdname.Append(":") ;
- sdname.Append(file);
- AliPHOSSDigitizer * phossd = dynamic_cast<AliPHOSSDigitizer *>(phos->GetListOfTasks()->FindObject( sdname ));
- if (!phossd) {
- phossd = new AliPHOSSDigitizer() ;
- //Note, we can not call constructor with parameters: it will call Getter and scrud up everething
- phossd->SetName(sdname) ;
- phossd->SetTitle(file) ;
- phos->Add(phossd) ;
- }
- return kTRUE;
-
-}
-
-//____________________________________________________________________________
-Bool_t AliPHOSGetter::PostDigits(const char * name) const
-{ //---------- Digits -------------------------
-
- // the hierarchy is //Folders/Run/Event/Data/PHOS/SDigits/name
-
- TFolder * phosFolder = dynamic_cast<TFolder*>(fDigitsFolder->FindObject("PHOS")) ;
-
- if ( !phosFolder ) {
- if (fDebug) {
- cout << "WARNING: AliPHOSGetter::Post D -> Folder //" << fDigitsFolder << "/PHOS/ not found!" << endl;
- cout << "INFO: AliPHOSGetter::Post D -> Adding Folder //" << fDigitsFolder << "/PHOS/" << endl;
- }
- phosFolder = fDigitsFolder->AddFolder("PHOS", "Digits from PHOS") ;
- }
-
- TObject* dig = phosFolder->FindObject( name ) ;
- if ( !dig ) {
- TClonesArray * digits = new TClonesArray("AliPHOSDigit",1000) ;
- digits->SetName(name) ;
- phosFolder->Add(digits) ;
- }
- return kTRUE;
-}
-
-//____________________________________________________________________________
-void * AliPHOSGetter::DigitsRef(const char * name) const
-{ //------- Digits ----------------------
-
- // the hierarchy is //Folders/Run/Event/Data/PHOS/Digits/name
-
- if ( !fDigitsFolder ) {
- cerr << "ERROR: AliPHOSGetter::Post DRef -> Folder //" << fDigitsFolder << " not found!" << endl;
- return 0;
- }
-
- TFolder * phosFolder = dynamic_cast<TFolder*>(fDigitsFolder->FindObject("PHOS")) ;
- if ( !phosFolder ) {
- cerr << "ERROR: AliPHOSGetter::DRef -> Folder //" << fDigitsFolder << "/PHOS/ not found!" << endl;
- return 0;
- }
-
- TObject * d = phosFolder->FindObject(name) ;
- if(!d)
- return 0 ;
- else
- return static_cast<void *>(phosFolder->GetListOfFolders()->GetObjectRef(d)) ;
-
-}
-
-//____________________________________________________________________________
-Bool_t AliPHOSGetter::PostDigitizer(AliPHOSDigitizer * digitizer) const
-{ //---------- Digitizer -------------------------
-
- TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("Digitizer")) ;
-
- if ( !sd ) {
- cerr << "ERROR: AliPHOSGetter::Post Der -> Task //" << fTasksFolder << "/Digitizer not found!" << endl;
- return kFALSE ;
- }
- TTask * phos = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("PHOS")) ;
- if ( !phos ) {
- if (fDebug) {
- cout <<"WARNING: AliPHOSGetter::Post Der -> //" << fTasksFolder << "/Digitizer/PHOS not found!" << endl;
- cout <<"INFO: AliPHOSGetter::Post Der -> Adding //" << fTasksFolder << "/Digitizer/PHOS" << endl;
- }
- phos = new TTask("PHOS", "") ;
- sd->Add(phos) ;
- }
-
- AliPHOSDigitizer * phosd = dynamic_cast<AliPHOSDigitizer*>(phos->GetListOfTasks()->FindObject(digitizer->GetName())) ;
- if (phosd) {
- phosd->Delete() ;
- phos->GetListOfTasks()->Remove(phosd) ;
- }
- phos->Add(digitizer) ;
- return kTRUE;
-}
-
-//____________________________________________________________________________
-Bool_t AliPHOSGetter::PostDigitizer(const char * name) const
-{ //---------- Digitizer -------------------------
-
- // the hierarchy is //Folders/Tasks/SDigitizer/PHOS/sdigitsname
-
- TTask * d = dynamic_cast<TTask*>(fTasksFolder->FindObject("Digitizer")) ;
- if ( !d ) {
- cerr << "ERROR: AliPHOSGetter::Post Der -> Task //" << fTasksFolder << "/Digitizer not found!" << endl;
- return kFALSE ;
- }
-
- TTask * phos = dynamic_cast<TTask*>(d->GetListOfTasks()->FindObject("PHOS")) ;
- if ( !phos ) {
- if (fDebug) {
- cout <<"WARNING: AliPHOSGetter::Post Der -> //" << fTasksFolder << "/Digitizer/PHOS not found!" << endl;
- cout <<"INFO: AliPHOSGetter::Post Der -> Adding //" << fTasksFolder << "/Digitizer/PHOS" << endl;
- }
- phos = new TTask("PHOS", "") ;
- d->Add(phos) ;
-}
-
- AliPHOSDigitizer * phosd = dynamic_cast<AliPHOSDigitizer*>(phos->GetListOfTasks()->FindObject(name)) ;
- if (!phosd) {
- phosd = new AliPHOSDigitizer() ;
- phosd->SetName(fDigitsTitle) ;
- phosd->SetTitle(fHeaderFile) ;
- phos->Add(phosd) ;
- }
- return kTRUE;
-}
-
-//____________________________________________________________________________
-void * AliPHOSGetter::DigitizerRef(const char * name) const
-{
- TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("Digitizer")) ;
- if ( !sd ) {
- cerr << "ERROR: AliPHOSGetter::Post DerRef -> Task //" << fTasksFolder << "/Digitizer not found!" << endl;
- abort();
- }
-
- TTask * phos = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("PHOS")) ;
- if ( !phos ) {
- cerr <<"ERROR: AliPHOSGetter::Post DerRef -> //" << fTasksFolder << "/Digitizer/PHOS" << endl;
- abort();
- }
-
- TTask * task = dynamic_cast<TTask*>(phos->GetListOfTasks()->FindObject(name)) ;
-
- return static_cast<void *>(phos->GetListOfTasks()->GetObjectRef(task)) ;
-
-}
-
-//____________________________________________________________________________
-Bool_t AliPHOSGetter::PostRecPoints(const char * name) const
-{ // -------------- RecPoints -------------------------------------------
-
- // the hierarchy is //Folders/Run/Event/RecData/PHOS/EMCARecPoints/name
- // the hierarchy is //Folders/Run/Event/RecData/PHOS/CPVRecPoints/name
-
- TFolder * phosFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("PHOS")) ;
-
- if ( !phosFolder ) {
- if (fDebug) {
- cout << "WARNING: AliPHOSGetter::Post RPo -> Folder //" << fRecoFolder << "/PHOS/ not found!" << endl;
- cout << "INFO: AliPHOSGetter::Post Rpo -> Adding Folder //" << fRecoFolder << "/PHOS/" << endl;
- }
- phosFolder = fRecoFolder->AddFolder("PHOS", "Reconstructed data from PHOS") ;
- }
-
- // EMCA RecPoints
- TFolder * phosRPoEMCAFolder = dynamic_cast<TFolder*>(phosFolder->FindObject("EMCARecPoints")) ;
- if ( !phosRPoEMCAFolder ) {
- if (fDebug) {
- cout << "WARNING: AliPHOSGetter::Post RPo -> Folder //" << fRecoFolder << "/PHOS/EMCARecPoints/ not found!" << endl;
- cout << "INFO: AliPHOSGetter::Post Rpo -> Adding Folder //" << fRecoFolder << "/PHOS/EMCARecPoints not found!" << endl;
- }
- phosRPoEMCAFolder = phosFolder->AddFolder("EMCARecPoints", "EMCA RecPoints from PHOS") ;
- }
-
- TObject * erp = phosFolder->FindObject( name ) ;
- if ( !erp ) {
- TObjArray * emcrp = new TObjArray(100) ;
- emcrp->SetName(name) ;
- phosRPoEMCAFolder->Add(emcrp) ;
- }
-
- // CPV RecPoints
- TFolder * phosRPoCPVFolder = dynamic_cast<TFolder*>(phosFolder->FindObject("CPVRecPoints")) ;
- if ( !phosRPoCPVFolder ) {
- if (fDebug) {
- cout << "WARNING: AliPHOSGetter::Post RPo -> Folder //" << fRecoFolder << "/PHOS/CPVRecPoints/ not found!" << endl;
- cout << "INFO: AliPHOSGetter::Post Rpo -> Adding Folder //" << fRecoFolder << "/PHOS/CPVRecPoints/" << endl;
- }
- phosRPoCPVFolder = phosFolder->AddFolder("CPVRecPoints", "CPV RecPoints from PHOS") ;
- }
-
- TObject * crp = phosRPoCPVFolder->FindObject( name ) ;
- if ( !crp ) {
- TObjArray * cpvrp = new TObjArray(100) ;
- cpvrp->SetName(name) ;
- phosRPoCPVFolder->Add(cpvrp) ;
- }
- return kTRUE;
-}
-
-//____________________________________________________________________________
-void * AliPHOSGetter::EmcRecPointsRef(const char * name) const
-{ // -------------- RecPoints -------------------------------------------
-
- // the hierarchy is //Folders/Run/Event/RecData/PHOS/EMCARecPoints/name
-
- if ( !fRecoFolder ) {
- cerr << "ERROR: AliPHOSGetter::EmcRecPointsRef -> Folder //" << fRecoFolder << " not found!" << endl;
- return 0 ;
- }
-
- TFolder * phosFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("PHOS/EMCARecPoints")) ;
- if ( !phosFolder ) {
- cerr << "ERROR: AliPHOSGetter::EmcRecPointsRef -> Folder //" << fRecoFolder << "/PHOS/EMCARecPoints/ not found!" << endl;
- return 0;
- }
-
-
- TObject * erp = phosFolder->FindObject(name ) ;
- if ( !erp ) {
- return 0 ;
- }
- return static_cast<void *>(phosFolder->GetListOfFolders()->GetObjectRef(erp)) ;
-
-}
-
-//____________________________________________________________________________
-void * AliPHOSGetter::CpvRecPointsRef(const char * name) const
-{ // -------------- RecPoints -------------------------------------------
-
- // the hierarchy is //Folders/Run/Event/RecData/PHOS/CPVRecPoints/name
-
- if ( !fRecoFolder ) {
- cerr << "ERROR: AliPHOSGetter::EmcRecPointsRef -> Folder //" << fRecoFolder << " not found!" << endl;
- return 0 ;
- }
-
- TFolder * phosFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("PHOS/CPVRecPoints")) ;
- if ( !phosFolder ) {
- cerr << "ERROR: AliPHOSGetter::CpvRecPointsRef -> Folder //" << fRecoFolder << "/PHOS/CPVRecPoints/" << endl;
- return 0;
- }
-
- TObject * crp = phosFolder->FindObject(name ) ;
- if ( !crp ) {
- return 0 ;
- }
- return static_cast<void *>(phosFolder->GetListOfFolders()->GetObjectRef(crp)) ;
-
-}
-
-//____________________________________________________________________________
-Bool_t AliPHOSGetter::PostClusterizer(AliPHOSClusterizer * clu) const
-{ // ------------------ AliPHOSClusterizer ------------------------
-
- // the hierarchy is //Folders/Tasks/Reconstructioner/PHOS/sdigitsname
-
- TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
-
- if ( !tasks ) {
- cerr << "ERROR: AliPHOSGetter::Post Rer -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
- return kFALSE ;
- }
-
- TTask * phos = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("PHOS")) ;
- if ( !phos ) {
- if (fDebug) {
- cout <<"WARNING: AliPHOSGetter::Post Rer -> //" << fTasksFolder << "/ReconstructionerPHOS not found!" << endl;
- cout <<"INFO: AliPHOSGetter::Post Rer -> Adding //" << fTasksFolder << "/Reconstructioner/PHOS" << endl;
- }
- phos = new TTask("PHOS", "") ;
- tasks->Add(phos) ;
- }
-
- AliPHOSClusterizer * phoscl = dynamic_cast<AliPHOSClusterizer*>(phos->GetListOfTasks()->FindObject(clu->GetName())) ;
- if (phoscl) {
- if (fDebug)
- cout << "INFO: AliPHOSGetter::Post Rer -> Task " << clu->GetName() << " already exists" << endl ;
- phoscl->Delete() ;
- phos->GetListOfTasks()->Remove(phoscl) ;
- }
- phos->Add(clu) ;
- return kTRUE;
-}
-
-//____________________________________________________________________________
-void * AliPHOSGetter::ClusterizerRef(const char * name) const
-{ // ------------------ AliPHOSClusterizer ------------------------
-
- TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
-
- if ( !tasks ) {
- cerr << "ERROR: AliPHOSGetter::Post RerRef -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
- return kFALSE ;
- }
-
- TTask * phos = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("PHOS")) ;
- if ( !phos ) {
- cerr <<"WARNING: AliPHOSGetter::Post RerRef -> //" << fTasksFolder << "/Reconstructioner/PHOS" << endl;
- return 0 ;
- }
-
- TList * l = phos->GetListOfTasks() ;
- TIter it(l) ;
- TTask * task ;
- TTask * clu = 0 ;
- TString cluname(name) ;
- cluname+=":clu-" ;
- while((task = static_cast<TTask *>(it.Next()) )){
- TString taskname(task->GetName()) ;
- if(taskname.BeginsWith(cluname)){
- clu = task ;
- break ;
- }
- }
-
- if(clu)
- return static_cast<void *>(l->GetObjectRef(clu)) ;
- else
- return 0 ;
-}
-
-//____________________________________________________________________________
-Bool_t AliPHOSGetter::PostClusterizer(const char * name) const
-{ // ------------------ AliPHOSClusterizer ------------------------
-
- // the hierarchy is //Folders/Tasks/Reconstructioner/PHOS/sdigitsname
-
- TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
-
- if ( !tasks ) {
- cerr << "ERROR: AliPHOSGetter::Post Rer -> Task//" << fTasksFolder << "/Reconstructioner not found!" << endl;
- return kFALSE ;
- }
-
- TTask * phos = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("PHOS")) ;
- if ( !phos ) {
- if (fDebug) {
- cout <<"WARNING: AliPHOSGetter::Post Rer -> //" << fTasksFolder << "/Reconstructioner/PHOS not found!" << endl;
- cout <<"INFO: AliPHOSGetter::Post Rer -> Adding //" << fTasksFolder << "/Reconstructioner/PHOS" << endl;
- }
- phos = new TTask("PHOS", "") ;
- tasks->Add(phos) ;
- }
-
- AliPHOSClusterizer * phoscl = new AliPHOSClusterizerv1() ;
- TString clun(name) ;
- clun+=":clu-v1" ;
- phoscl->SetName(clun) ;
- phos->Add(phoscl) ;
- return kTRUE;
-
-}
-
-//____________________________________________________________________________
-Bool_t AliPHOSGetter::PostTrackSegments(const char * name) const
-{ // ---------------TrackSegments -----------------------------------
-
- // the hierarchy is //Folders/Run/Event/RecData/PHOS/TrackSegments/name
-
- TFolder * phosFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("PHOS")) ;
-
- if ( !phosFolder ) {
- if (fDebug) {
- cout << "WARNING: AliPHOSGetter::Post TS -> Folder //" << fRecoFolder << "/PHOS/ not found!" << endl;
- cout << "INFO: AliPHOSGetter::Post TS -> Adding Folder //" << fRecoFolder << "/PHOS" << endl;
- }
- phosFolder = fRecoFolder->AddFolder("PHOS", "Reconstructed data from PHOS") ;
- }
-
- TFolder * phosTSFolder = dynamic_cast<TFolder*>(phosFolder->FindObject("TrackSegments")) ;
- if ( !phosTSFolder ) {
- if (fDebug) {
- cout << "WARNING: AliPHOSGetter::Post TS -> Folder//" << fRecoFolder << "/PHOS/TrackSegments/ not found!" << endl;
- cout << "INFO: AliPHOSGetter::Post TS -> Adding Folder //" << fRecoFolder << "/PHOS/TrackSegments/" << endl;
- }
- phosTSFolder = phosFolder->AddFolder("TrackSegments", "TrackSegments from PHOS") ;
- }
-
- TObject * tss = phosTSFolder->FindObject( name ) ;
- if (!tss) {
- TClonesArray * ts = new TClonesArray("AliPHOSTrackSegment",100) ;
- ts->SetName(name) ;
- phosTSFolder->Add(ts) ;
- }
- return kTRUE;
-}
-
-//____________________________________________________________________________
-void * AliPHOSGetter::TrackSegmentsRef(const char * name) const
-{ // ---------------TrackSegments -----------------------------------
-
- // the hierarchy is //Folders/Run/Event/RecData/PHOS/TrackSegments/name
-
- if ( !fRecoFolder ) {
- cerr << "ERROR: AliPHOSGetter::TrackSegmentsRef -> Folder //" << fRecoFolder << "not found!" << endl;
- return 0 ;
- }
-
- TFolder * phosFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("PHOS/TrackSegments")) ;
- if ( !phosFolder ) {
- cerr << "ERROR: AliPHOSGetter::TrackSegmentsRef -> Folder //" << fRecoFolder << "/PHOS/TrackSegments/ not found!" << endl;
- return 0;
- }
-
- TObject * tss = phosFolder->FindObject(name) ;
- if (!tss) {
- return 0 ;
- }
- return static_cast<void *>(phosFolder->GetListOfFolders()->GetObjectRef(tss)) ;
-}
-
-//____________________________________________________________________________
-Bool_t AliPHOSGetter::PostTrackSegmentMaker(AliPHOSTrackSegmentMaker * tsmaker) const
-{ //------------Track Segment Maker ------------------------------
-
- // the hierarchy is //Folders/Tasks/Reconstructioner/PHOS/sdigitsname
-
- TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
-
- if ( !tasks ) {
- cerr << "ERROR: AliPHOSGetter::Post Ter -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
- return kFALSE ;
- }
-
- TTask * phos = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("PHOS")) ;
- if ( !phos ) {
- if (fDebug) {
- cout <<"WARNING: AliPHOSGetter::Post Rer -> //" << fTasksFolder << "/Reconstructioner/PHOS not found!" << endl;
- cout <<"INFO: AliPHOSGetter::Post Rer -> Adding //" << fTasksFolder << "/Reconstructioner/PHOS" << endl;
- }
- phos = new TTask("PHOS", "") ;
- tasks->Add(phos) ;
- }
-
- AliPHOSTrackSegmentMaker * phosts =
- dynamic_cast<AliPHOSTrackSegmentMaker*>(phos->GetListOfTasks()->FindObject(tsmaker->GetName())) ;
- if (phosts) {
- phosts->Delete() ;
- phos->GetListOfTasks()->Remove(phosts) ;
- }
- phos->Add(tsmaker) ;
- return kTRUE;
-
-}
-//____________________________________________________________________________
-Bool_t AliPHOSGetter::PostTrackSegmentMaker(const char * name) const
-{ //------------Track Segment Maker ------------------------------
-
- // the hierarchy is //Folders/Tasks/Reconstructioner/PHOS/sdigitsname
-
-
- TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
-
- if ( !tasks ) {
- cerr << "ERROR: AliPHOSGetter::Post Ter -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
- return kFALSE ;
- }
-
- TTask * phos = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("PHOS")) ;
- if ( !phos ) {
- if (fDebug) {
- cout <<"WARNING: AliPHOSGetter::Post Rer -> //" << fTasksFolder << "/Reconstructioner/PHOS not found!" << endl;
- cout <<"INFO: AliPHOSGetter::Post Rer -> Adding //" << fTasksFolder << "/Reconstructioner/PHOS" << endl;
- }
- phos = new TTask("PHOS", "") ;
- tasks->Add(phos) ;
- }
-
- AliPHOSTrackSegmentMaker * phosts =
- dynamic_cast<AliPHOSTrackSegmentMaker*>(phos->GetListOfTasks()->FindObject(name)) ;
- if (!phosts) {
- phosts = new AliPHOSTrackSegmentMakerv1() ;
- TString tsn(name);
- tsn+=":tsm-v1" ;
- phosts->SetName(tsn) ;
- phos->Add(phosts) ;
- }
- return kTRUE;
-
-}
-
-//____________________________________________________________________________
-void * AliPHOSGetter::TSMakerRef(const char * name) const
-{ //------------Track Segment Maker ------------------------------
-
- TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
-
- if ( !tasks ) {
- cerr << "ERROR: AliPHOSGetter::Post TerRef -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
- return kFALSE ;
- }
-
- TTask * phos = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("PHOS")) ;
- if ( !phos ) {
- cerr <<"WARNING: AliPHOSGetter::Post TerRef -> //" << fTasksFolder << "/Reconstructioner/PHOS not found!" << endl;
- return 0 ;
- }
-
- TList * l = phos->GetListOfTasks() ;
- TIter it(l) ;
- TTask * task ;
- TTask * tsm = 0 ;
- TString tsmname(name) ;
- tsmname+=":tsm-" ;
- while((task = static_cast<TTask *>(it.Next()) )){
- TString taskname(task->GetName()) ;
- if(taskname.BeginsWith(tsmname)){
- tsm = task ;
- break ;
- }
- }
-
- if(tsm)
- return static_cast<void *>(l->GetObjectRef(tsm)) ;
- else
- return 0 ;
-
-}
-
-//____________________________________________________________________________
-Bool_t AliPHOSGetter::PostRecParticles(const char * name) const
-{ // -------------------- RecParticles ------------------------
-
- // the hierarchy is //Folders/Run/Event/RecData/PHOS/TrackSegments/name
-
- TFolder * phosFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("PHOS")) ;
-
- if ( !phosFolder ) {
- if (fDebug) {
- cout << "WARNING: AliPHOSGetter::Post RPa -> Folder //" << fRecoFolder << "/PHOS/ not found!" << endl;
- cout << "INFO: AliPHOSGetter::Post Rpa -> Adding Folder //" << fRecoFolder << "/PHOS/" << endl;
- }
- phosFolder = fRecoFolder->AddFolder("PHOS", "Reconstructed data from PHOS") ;
- }
-
- TFolder * phosRPaFolder = dynamic_cast<TFolder*>(phosFolder->FindObject("RecParticles")) ;
- if ( !phosRPaFolder ) {
- if (fDebug) {
- cout << "WARNING: AliPHOSGetter::Post RPa -> Folder //" << fRecoFolder << "/PHOS/RecParticles/ not found!" << endl;
- cout << "INFO: AliPHOSGetter::Post RPa -> Adding Folder //" << fRecoFolder << "/PHOS/RecParticles/" << endl;
- }
- phosRPaFolder = phosFolder->AddFolder("RecParticles", "RecParticles from PHOS") ;
- }
-
- TObject * rps = phosRPaFolder->FindObject( name ) ;
- if ( !rps ) {
- TClonesArray * rp = new TClonesArray("AliPHOSRecParticle",100) ;
- rp->SetName(name) ;
- phosRPaFolder->Add(rp) ;
- }
- return kTRUE;
-}
-
-//____________________________________________________________________________
-void * AliPHOSGetter::RecParticlesRef(const char * name) const
-{ // ---------------TrackSegments -----------------------------------
-
- // the hierarchy is //Folders/Run/Event/RecData/PHOS/TrackSegments/name
-
- if ( !fRecoFolder ) {
- cerr << "ERROR: AliPHOSGetter::RecParticlesRef -> Folder//" << fRecoFolder << " not found!" << endl;
- return 0 ;
- }
-
- TFolder * phosFolder = dynamic_cast<TFolder*>(fRecoFolder->FindObject("PHOS/RecParticles")) ;
- if ( !phosFolder ) {
- cerr << "ERROR: AliPHOSGetter::RecParticlesRef -> Folder //" << fRecoFolder << "/PHOS/RecParticles/ not found!" << endl;
- return 0;
- }
-
- TObject * tss = phosFolder->FindObject(name ) ;
- if (!tss) {
- return 0 ;
- }
- return static_cast<void *>(phosFolder->GetListOfFolders()->GetObjectRef(tss)) ;
-}
-
-//____________________________________________________________________________
-Bool_t AliPHOSGetter::PostPID(AliPHOSPID * pid) const
-{ // ------------AliPHOS PID -----------------------------
-
- TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
-
- if ( !tasks ) {
- cerr << "ERROR: AliPHOSGetter::Post Per -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
- return kFALSE ;
- }
-
- TTask * phos = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("PHOS")) ;
- if ( !phos ) {
- if (fDebug) {
- cout <<"WARNING: AliPHOSGetter::Post Per -> //" << fTasksFolder << "/Reconstructioner/PHOS not found!" << endl;
- cout <<"INFO: AliPHOSGetter::Post Per -> Adding //" << fTasksFolder << "/Reconstructioner/PHOS" << endl;
- }
- phos = new TTask("PHOS", "") ;
- tasks->Add(phos) ;
- }
-
- AliPHOSPID * phospid = dynamic_cast<AliPHOSPID*>(phos->GetListOfTasks()->FindObject(pid->GetName())) ;
- if (phospid) {
- if (fDebug)
- cout << "INFO: AliPHOSGetter::Post Per -> Task " << pid->GetName()
- << " already exists" << endl ;
- phos->GetListOfTasks()->Remove(phospid) ;
- }
-
- phos->Add(pid) ;
- return kTRUE;
-}
-
-//____________________________________________________________________________
-Bool_t AliPHOSGetter::PostPID(const char * name) const
-{
- // the hierarchy is //Folders/Tasks/Reconstructioner/PHOS/sdigitsname
-
- TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
-
- if ( !tasks ) {
- cerr << "ERROR: AliPHOSGetter::Post Per -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
- return kFALSE ;
- }
-
- TTask * phos = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("PHOS")) ;
- if ( !phos ) {
- if (fDebug) {
- cout <<"WARNING: AliPHOSGetter::Post Per -> //" << fTasksFolder << "/Reconstructioner/PHOS not found!" << endl;
- cout <<"INFO: AliPHOSGetter::Post Per -> Adding //" << fTasksFolder << "/Reconstructioner/PHOS" << endl;
- }
- phos = new TTask("PHOS", "") ;
- tasks->Add(phos) ;
- }
-
- TList * l = phos->GetListOfTasks() ;
- TIter it(l) ;
- TString pidname(name) ;
- pidname+=":pid" ;
- TTask * task ;
- while((task = static_cast<TTask *>(it.Next()) )){
- TString taskname(task->GetName()) ;
- if(taskname.BeginsWith(pidname))
- return kTRUE ;
- }
-
- AliPHOSPIDv1 * phospid = new AliPHOSPIDv1() ;
- pidname+="-v1" ;
- phospid->SetName(pidname) ;
- phos->Add(phospid) ;
-
- return kTRUE;
-}
-
-//____________________________________________________________________________
-void * AliPHOSGetter::PIDRef(const char * name) const
-{ //------------PID ------------------------------
-
- TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject("Reconstructioner")) ;
-
- if ( !tasks ) {
- cerr << "ERROR: AliPHOSGetter::Post PerRef -> Task //" << fTasksFolder << "/Reconstructioner not found!" << endl;
- return kFALSE ;
- }
-
- TTask * phos = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("PHOS")) ;
- if ( !phos ) {
- cerr <<"WARNING: AliPHOSGetter::Post PerRef -> //" << fTasksFolder << "/ReconstructionerPHOS not found!" << endl;
- return 0 ;
- }
-
- TList * l = phos->GetListOfTasks() ;
- TIter it(l) ;
- TTask * task ;
- TTask * pid = 0 ;
- TString pidname(name) ;
- pidname+=":pid-" ;
- while((task = static_cast<TTask *>(it.Next()) )){
- TString taskname(task->GetName()) ;
- if(taskname.BeginsWith(pidname)){
- pid = task ;
- break ;
- }
- }
-
- if(pid)
- return static_cast<void *>(l->GetObjectRef(pid)) ;
- else
- return 0 ;
-
-}
-
-//____________________________________________________________________________
-Bool_t AliPHOSGetter::PostQA(void) const
-{ // ------------------ QA ---------------------------------
-
- // the hierarchy is //Folders/Run/Conditions/QA/PHOS/alarmsName
-
- TFolder * phosFolder = dynamic_cast<TFolder*>(fQAFolder->FindObject("PHOS")) ;
- if ( !phosFolder ) {
- if (fDebug) {
- cout << "WARNING: AliPHOSGetter::Post Q -> Folder //" << fQAFolder << "/PHOS/ not found!" << endl;
- cout << "INFO: AliPHOSGetter::Post Q -> Adding Folder //" << fQAFolder << "/PHOS/" << endl;
- }
- phosFolder = fQAFolder->AddFolder("PHOS", "QA from PHOS") ;
- }
-
- return kTRUE;
-}
-
-//____________________________________________________________________________
-void * AliPHOSGetter::AlarmsRef(void) const
-{ //------- Alarms ----------------------
-
-
- // the hierarchy is //Folders/Run/Conditions/QA/PHOS
- if ( !fQAFolder ) {
- cerr << "ERROR: AliPHOSGetter::Post QRef -> Folder //" << fQAFolder << " not found!" << endl;
- return 0;
- }
-
- TFolder * phosFolder = dynamic_cast<TFolder *>(fQAFolder->FindObject("PHOS")) ;
- if ( !phosFolder ) {
- cerr << "ERROR: AliPHOSGetter::Post QRef -> Folder //" << fQAFolder << "/PHOS/ not found!" << endl;
- return 0;
- }
-
- return static_cast<void *>(fQAFolder->GetListOfFolders()->GetObjectRef(phosFolder)) ;
-}
-
-//____________________________________________________________________________
-const TParticle * AliPHOSGetter::Primary(Int_t index) const
-{
- // Return primary particle numbered by <index>
-
- if(index < 0)
- return 0 ;
-
- 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 << " )"<<endl ;
- }
- return 0;
- }
-
- return gAlice->Particle(primaryIndex) ;
-
-}
-
-//____________________________________________________________________________
-void AliPHOSGetter::ReadTreeD()
-{
- // Read the digit tree gAlice->TreeD()
- if(gAlice->TreeD()== 0){
- cerr << "ERROR: AliPHOSGetter::ReadTreeD: can not read TreeD " << endl ;
- return ;
- }
-
- TObjArray * lob = static_cast<TObjArray*>(gAlice->TreeD()->GetListOfBranches()) ;
- TIter next(lob) ;
- TBranch * branch = 0 ;
- TBranch * digitsbranch = 0 ;
- TBranch * digitizerbranch = 0 ;
- Bool_t phosfound = kFALSE, digitizerfound = kFALSE ;
-
- while ( (branch = static_cast<TBranch*>(next())) && (!phosfound || !digitizerfound) ) {
- if ( (strcmp(branch->GetName(), "PHOS")==0) && (strcmp(branch->GetTitle(), fDigitsTitle)==0) ) {
- digitsbranch = branch ;
- phosfound = kTRUE ;
- }
- else if ( (strcmp(branch->GetName(), "AliPHOSDigitizer")==0) && (strcmp(branch->GetTitle(), fDigitsTitle)==0) ) {
- digitizerbranch = branch ;
- digitizerfound = kTRUE ;
- }
- }
-
- if ( !phosfound || !digitizerfound ) {
- if (fDebug)
- cout << "WARNING: AliPHOSGetter::ReadTreeD -> Cannot find Digits and/or Digitizer with name "
- << fDigitsTitle << endl ;
- return ;
- }
-
- //read digits
- if(!Digits(fDigitsTitle) )
- PostDigits(fDigitsTitle);
- digitsbranch->SetAddress(DigitsRef(fDigitsTitle)) ;
- digitsbranch->GetEntry(0) ;
-
-
- // read the Digitizer
- if(!Digitizer(fDigitsTitle))
- PostDigitizer(fDigitsTitle) ;
- digitizerbranch->SetAddress(DigitizerRef(fDigitsTitle)) ;
- digitizerbranch->GetEntry(0) ;
-
-
-}
-
-//____________________________________________________________________________
-void AliPHOSGetter::ReadTreeH()
-{
- // Read the first entry of PHOS branch in hit tree gAlice->TreeH()
-
- if(gAlice->TreeH()== 0){
- cerr << "ERROR: AliPHOSGetter::ReadTreeH: -> Cannot read TreeH " << endl ;
- return ;
- }
-
- TBranch * hitsbranch = static_cast<TBranch*>(gAlice->TreeH()->GetBranch("PHOS")) ;
- if ( !hitsbranch ) {
- if (fDebug)
- cout << "WARNING: AliPHOSGetter::ReadTreeH -> Cannot find branch PHOS" << endl ;
- return ;
- }
- if(!Hits())
- PostHits() ;
-
- hitsbranch->SetAddress(HitsRef()) ;
-
- hitsbranch->GetEntry(0) ;
-
-}
-
-//____________________________________________________________________________
-void AliPHOSGetter::Track(Int_t itrack)
-{
- // Read the first entry of PHOS branch in hit tree gAlice->TreeH()
-
- if(gAlice->TreeH()== 0){
- cerr << "ERROR: AliPHOSGetter::ReadTreeH: -> Cannot read TreeH " << endl ;
- return ;
- }
-
- TBranch * hitsbranch = dynamic_cast<TBranch*>(gAlice->TreeH()->GetListOfBranches()->FindObject("PHOS")) ;
- if ( !hitsbranch ) {
- if (fDebug)
- cout << "WARNING: AliPHOSGetter::ReadTreeH -> Cannot find branch PHOS" << endl ;
- return ;
- }
- if(!Hits())
- PostHits() ;
- hitsbranch->SetAddress(HitsRef()) ;
- hitsbranch->GetEntry(itrack) ;
-
-
-}
-//____________________________________________________________________________
-void AliPHOSGetter::ReadTreeQA()
-{
- // Read the digit tree gAlice->TreeQA()
- // so far only PHOS knows about this Tree
-
- if(PHOS()->TreeQA()== 0){
- cerr << "ERROR: AliPHOSGetter::ReadTreeQA: can not read TreeQA " << endl ;
- return ;
- }
-
- TBranch * qabranch = PHOS()->TreeQA()->GetBranch("PHOS") ;
- if (!qabranch) {
- if (fDebug)
- cout << "WARNING: AliPHOSGetter::ReadTreeQA -> Cannot find QA Alarms for PHOS" << endl ;
- return ;
- }
-
- if(!Alarms())
- PostQA() ;
-
- qabranch->SetAddress(AlarmsRef()) ;
-
- qabranch->GetEntry(0) ;
-
-// PostQA("PHOS") ;
-// TFolder * alarmsF = Alarms() ;
-// alarmsF->Clear() ;
-// qabranch->SetAddress(&alarmsF) ;
-// qabranch->GetEntry(0) ;
-
-}
-
-//____________________________________________________________________________
-void AliPHOSGetter::ReadTreeR()
-{
- // Read the reconstrunction tree gAlice->TreeR()
-
- if(gAlice->TreeR()== 0){
- cerr << "ERROR: AliPHOSGetter::ReadTreeR: can not read TreeR " << endl ;
- return ;
- }
-
- // RecPoints
- TObjArray * lob = static_cast<TObjArray*>(gAlice->TreeR()->GetListOfBranches()) ;
- TIter next(lob) ;
- TBranch * branch = 0 ;
- TBranch * emcbranch = 0 ;
- TBranch * cpvbranch = 0 ;
- TBranch * clusterizerbranch = 0 ;
- Bool_t phosemcrpfound = kFALSE, phoscpvrpfound = kFALSE, clusterizerfound = kFALSE ;
-
- 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 ;
- }
- else if ( strcmp(branch->GetName(), "PHOSCpvRP")==0) {
- cpvbranch = branch ;
- phoscpvrpfound = kTRUE ;
- }
- else if(strcmp(branch->GetName(), "AliPHOSClusterizer")==0){
- clusterizerbranch = branch ;
- clusterizerfound = kTRUE ;
- }
- }
-
- if ( !phosemcrpfound ) {
- if (fDebug)
- cout << "WARNING: AliPHOSGetter::ReadTreeR -> Cannot find EmcRecPoints with title "
- << fRecPointsTitle << endl ;
- return ;
- }
- if ( !phoscpvrpfound ) {
- if (fDebug)
- cout << "WARNING: AliPHOSGetter::ReadTreeR -> Cannot find CpvRecPoints with title "
- << fRecPointsTitle << endl ;
- return ;
- }
- if ( !clusterizerfound ) {
- if (fDebug)
- cout << "WARNING: AliPHOSGetter::ReadTreeR -> Can not find Clusterizer with title "
- << fRecPointsTitle << endl ;
- return ;
- }
-
- // Read and Post the RecPoints
- if(!EmcRecPoints(fRecPointsTitle) )
- PostRecPoints(fRecPointsTitle) ;
- emcbranch->SetAddress(EmcRecPointsRef(fRecPointsTitle)) ;
- emcbranch->GetEntry(0) ;
-
- cpvbranch->SetAddress(CpvRecPointsRef(fRecPointsTitle)) ;
- cpvbranch->GetEntry(0) ;
-
- if(!Clusterizer(fRecPointsTitle) )
- PostClusterizer(fRecPointsTitle) ;
- clusterizerbranch->SetAddress(ClusterizerRef(fRecPointsTitle)) ;
- clusterizerbranch->GetEntry(0) ;
-
-
- //------------------- TrackSegments ---------------------
- next.Reset() ;
- 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) {
- if ( strcmp(branch->GetName(), "PHOSTS")==0){
- tsbranch = branch ;
- phostsfound = kTRUE ;
- }
- else if(strcmp(branch->GetName(), "AliPHOSTrackSegmentMaker")==0) {
- tsmakerbranch = branch ;
- tsmakerfound = kTRUE ;
- }
- }
-
- if ( !phostsfound || !tsmakerfound ) {
- if (fDebug)
- cout << "WARNING: AliPHOSGetter::ReadTreeR -> Cannot find TrackSegments and/or TrackSegmentMaker with name "
- << fTrackSegmentsTitle << endl ;
- return ;
- }
-
- // Read and Post the TrackSegments
- if(!TrackSegments(fTrackSegmentsTitle))
- PostTrackSegments(fTrackSegmentsTitle) ;
- tsbranch->SetAddress(TrackSegmentsRef(fTrackSegmentsTitle)) ;
- tsbranch->GetEntry(0) ;
-
- // Read and Post the TrackSegment Maker
- if(!TrackSegmentMaker(fTrackSegmentsTitle))
- PostTrackSegmentMaker(fTrackSegmentsTitle) ;
- tsmakerbranch->SetAddress(TSMakerRef(fTrackSegmentsTitle)) ;
- tsmakerbranch->GetEntry(0) ;
-
-
- //------------ RecParticles ----------------------------
- next.Reset() ;
- TBranch * rpabranch = 0 ;
- TBranch * pidbranch = 0 ;
- Bool_t phosrpafound = kFALSE, pidfound = kFALSE ;
-
- while ( (branch = static_cast<TBranch*>(next())) && (!phosrpafound || !pidfound) )
- if(strcmp(branch->GetTitle(), fRecParticlesTitle)==0) {
- if ( strcmp(branch->GetName(), "PHOSRP")==0) {
- rpabranch = branch ;
- phosrpafound = kTRUE ;
- }
- else if (strcmp(branch->GetName(), "AliPHOSPID")==0) {
- pidbranch = branch ;
- pidfound = kTRUE ;
- }
- }
-
- if ( !phosrpafound || !pidfound ) {
- if (fDebug)
- cout << "WARNING: AliPHOSGetter::ReadTreeR -> Cannot find RecParticles and/or PID with name "
- << fRecParticlesTitle << endl ;
- return ;
- }
-
- // Read and Post the RecParticles
- if(!RecParticles(fRecParticlesTitle))
- PostRecParticles(fRecParticlesTitle) ;
- rpabranch->SetAddress(RecParticlesRef(fRecParticlesTitle)) ;
- rpabranch->GetEntry(0) ;
-
- // Read and Post the PID
- if(!PID(fRecParticlesTitle))
- PostPID(fRecParticlesTitle) ;
- pidbranch->SetAddress(PIDRef(fRecParticlesTitle)) ;
- pidbranch->GetEntry(0) ;
-
-
-}
-
-//____________________________________________________________________________
-void AliPHOSGetter::ReadTreeS(Int_t event)
-{
- // Read the summable digits tree gAlice->TreeS()
-
- // loop over all opened files and read their SDigits to the White Board
- 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
- if ( (fHeaderFile != "aliroot") && ( !folderslist->Contains(fHeaderFile) ) ){
- phosF->AddFolder(fHeaderFile, "");
- }
-
- TIter next(folderslist) ;
- TFolder * folder = 0 ;
- TFile * file;
- TTree * treeS = 0;
- while ( (folder = static_cast<TFolder*>(next())) ) {
- if(fHeaderFile.CompareTo(folder->GetName()) == 0 )
- treeS=gAlice->TreeS() ;
- else{
- file = static_cast<TFile*>(gROOT->GetFile(folder->GetName()));
- file->cd() ;
-
- // Get SDigits Tree header from file
- TString treeName("TreeS") ;
- treeName += event ;
- treeS = dynamic_cast<TTree*>(gDirectory->Get(treeName.Data()));
- }
- if(treeS==0){
- cerr << "ERROR: AliPHOSGetter::ReadTreeS There is no SDigit Tree" << endl;
- return ;
- }
-
- //set address of the SDigits and SDigitizer
- TBranch * sdigitsBranch = 0;
- TBranch * sdigitizerBranch = 0;
- TBranch * branch = 0 ;
- TObjArray * lob = static_cast<TObjArray*>(treeS->GetListOfBranches()) ;
- TIter next(lob) ;
- Bool_t 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) ) {
- sdigitizerfound = kTRUE ;
- sdigitizerBranch = branch ;
- }
- }
- if ( !phosfound || !sdigitizerfound ) {
- if (fDebug)
- cout << "WARNING: AliPHOSDigitizer::ReadSDigits -> Digits and/or Digitizer branch with name " << GetName()
- << " not found" << endl ;
- return ;
- }
-
- if ( !folder->FindObject(fSDigitsTitle) )
- PostSDigits(fSDigitsTitle,folder->GetName()) ;
- sdigitsBranch->SetAddress(SDigitsRef(fSDigitsTitle,folder->GetName())) ;
- sdigitsBranch->GetEntry(0) ;
-
- TString sdname(fSDigitsTitle) ;
- sdname+=":" ;
- sdname+=folder->GetName() ;
- if(!SDigitizer(sdname) )
- PostSDigitizer(fSDigitsTitle,folder->GetName()) ;
- sdigitizerBranch->SetAddress(SDigitizerRef(sdname)) ;
- sdigitizerBranch->GetEntry(0) ;
-
- }
-
- // After SDigits have been read from all files, return to the first one
-
- next.Reset();
- folder = static_cast<TFolder*>(next());
- if(folder){
- file = static_cast<TFile*>(gROOT->GetFile(folder->GetName()));
- file ->cd() ;
- }
-
-}
-//____________________________________________________________________________
-void AliPHOSGetter::ReadTreeS(TTree * treeS, Int_t input)
-{ // Read the summable digits fron treeS()
-
-
- TString filename("mergefile") ;
- filename+= input ;
-
- TFolder * phosFolder = dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("PHOS")) ;
- if ( !phosFolder ) {
- phosFolder = fSDigitsFolder->AddFolder("PHOS", "SDigits from PHOS") ;
- }
- TFolder * folder=(TFolder*)phosFolder->FindObject(filename) ;
- //set address of the SDigits and SDigitizer
- TBranch * sdigitsBranch = 0;
- TBranch * sdigitizerBranch = 0;
- TBranch * branch = 0 ;
- TObjArray * lob = (TObjArray*)treeS->GetListOfBranches() ;
- TIter next(lob) ;
- Bool_t phosfound = kFALSE, sdigitizerfound = kFALSE ;
-
- while ( (branch = (TBranch*)next()) && (!phosfound || !sdigitizerfound) ) {
- if ( strcmp(branch->GetName(), "PHOS")==0) {
- phosfound = kTRUE ;
- sdigitsBranch = branch ;
- }
-
- else if ( strcmp(branch->GetName(), "AliPHOSSDigitizer")==0) {
- sdigitizerfound = kTRUE ;
- sdigitizerBranch = branch ;
- }
- }
- if ( !phosfound || !sdigitizerfound ) {
- if (fDebug)
- cout << "WARNING: AliPHOSGetter::ReadTreeS -> Digits and/or Digitizer branch not found" << endl ;
- return ;
- }
-
- if (!folder || !(folder->FindObject(sdigitsBranch->GetTitle()) ) )
- PostSDigits(sdigitsBranch->GetTitle(),filename) ;
-
- sdigitsBranch->SetAddress(SDigitsRef(sdigitsBranch->GetTitle(),filename)) ;
- sdigitsBranch->GetEntry(0) ;
-
- TString sdname(sdigitsBranch->GetTitle()) ;
- sdname+=":" ;
- sdname+=filename ;
- if(!SDigitizer(sdigitsBranch->GetTitle()) )
- PostSDigitizer(sdigitsBranch->GetTitle(),filename) ;
-
- sdigitizerBranch->SetAddress(SDigitizerRef(sdname)) ;
- sdigitizerBranch->GetEntry(0) ;
-
-}
-
-
-//____________________________________________________________________________
-void AliPHOSGetter::ReadPrimaries()
-{
- // Reads specific branches of primaries
-
- fNPrimaries = gAlice->GetNtrack();
-
- // //Check, is it necessary to open new files
- // TArrayI* events = fDigitizer->GetCurrentEvents() ;
- // TClonesArray * filenames = fDigitizer->GetHeadersFiles() ;
-// Int_t input ;
-// for(input = 0; input < filenames->GetEntriesFast(); input++){
-
-// TObjString * filename = (TObjString *) filenames->At(input) ;
-
-// //Test, if this file already open
-// TFile *file = (TFile*) gROOT->GetFile( filename->GetString() ) ;
-// if(file == 0)
-// file = new TFile( filename->GetString()) ;
-// file->cd() ;
-
-// // Get Kine Tree from file
-// // char treeName[20];
-// // sprintf(treeName,"TreeK%d",events->At(input));
-// // TTree * treeK = (TTree*)gDirectory->Get(treeName);
-// // if (treeK)
-// // treeK->SetBranchAddress("Particles", &fParticleBuffer);
-// // else
-// // cout << "AliPHOSGetter: cannot find Kine Tree for event:" << events->At(input) << endl;
-
-// // // Create the particle stack
-// // if(!fParticles) fParticles = new TClonesArray("TParticle",1000);
-// // // Build the pointer list
-// // if(fParticleMap) { <----
-// // fParticleMap->Clear();
-// // fParticleMap->Expand(treeK->GetEntries());
-// // } else
-// // fParticleMap = new TObjArray(treeK->GetEntries());
-
-// // From gAlice->Particle(i)
-
-
-// // if(!(*fParticleMap)[i]) {
-// // Int_t nentries = fParticles->GetEntries();
-
-// // // algorithmic way of getting entry index
-// // // (primary particles are filled after secondaries)
-// // Int_t entry;
-// // if (i<fHeader.GetNprimary())
-// // entry = i+fHeader.GetNsecondary();
-// // else
-// // entry = i-fHeader.GetNprimary();
-
-// // // only check the algorithmic way and give
-// // // the fatal error if it is wrong
-// // if (entry != fParticleFileMap[i]) {
-// // Fatal("Particle",
-// // "!!!! The algorithmic way is WRONG: !!!\n entry: %d map: %d",
-// // entry, fParticleFileMap[i]);
-// // }
-
-// // fTreeK->GetEntry(fParticleFileMap[i]);
-// // new ((*fParticles)[nentries]) TParticle(*fParticleBuffer);
-// // fParticleMap->AddAt((*fParticles)[nentries],i);
-// // }
-// // return (TParticle *) (*fParticleMap)[i];
-
-
-
-// }
-
-
-// //scan over opened files and read corresponding TreeK##
-
- return ;
-}
-//____________________________________________________________________________
-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 ;
- }
- gAlice->GetEvent(event) ;
-
- if(strstr(opt,"H") )
- ReadTreeH() ;
-
- if(strstr(opt,"S") )
- ReadTreeS(event) ;
-
- if( strstr(opt,"D") )
- ReadTreeD() ;
-
- if( strstr(opt,"R") )
- ReadTreeR() ;
-
- if( strstr(opt,"Q") )
- ReadTreeQA() ;
-
- if( strstr(opt,"P") || (strcmp(opt,"")==0) )
- ReadPrimaries() ;
-
-}
-
-//____________________________________________________________________________
-const TObject * AliPHOSGetter::ReturnO(TString what, TString name, TString file) const
-{
- // get the object named "what" from the folder
- // folders are named like //Folders
-
- if ( file.IsNull() )
- file = fHeaderFile ;
-
- TFolder * folder = 0 ;
- TObject * phosO = 0 ;
-
- // if ( name.IsNull() ) {
- if ( what.CompareTo("Hits") == 0 ) {
- folder = dynamic_cast<TFolder *>(fHitsFolder->FindObject("PHOS")) ;
- if (folder)
- phosO = dynamic_cast<TObject *>(folder->FindObject("Hits")) ;
- }
- else if ( what.CompareTo("SDigits") == 0 ) {
- TString path = "PHOS/" + file ;
- folder = dynamic_cast<TFolder *>(fSDigitsFolder->FindObject(path.Data())) ;
- if (folder) {
- if (name.IsNull())
- name = fSDigitsTitle ;
- phosO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
- }
- }
- else if ( what.CompareTo("Digits") == 0 ){
- folder = dynamic_cast<TFolder *>(fDigitsFolder->FindObject("PHOS")) ;
- if (folder) {
- if (name.IsNull())
- name = fDigitsTitle ;
- phosO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
- }
- }
- else if ( what.CompareTo("EmcRecPoints") == 0 ) {
- folder = dynamic_cast<TFolder *>(fRecoFolder->FindObject("PHOS/EMCARecPoints")) ;
- if (folder) {
- if (name.IsNull())
- name = fRecPointsTitle ;
- phosO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
- }
- }
- else if ( what.CompareTo("CpvRecPoints") == 0 ) {
- folder = dynamic_cast<TFolder *>(fRecoFolder->FindObject("PHOS/CPVRecPoints")) ;
- if (folder) {
- if (name.IsNull())
- name = fRecPointsTitle ;
- phosO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
- }
- }
- else if ( what.CompareTo("TrackSegments") == 0 ) {
- folder = dynamic_cast<TFolder *>(fRecoFolder->FindObject("PHOS/TrackSegments")) ;
- if (folder) {
- if (name.IsNull())
- name = fTrackSegmentsTitle ;
- phosO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
- }
- }
- else if ( what.CompareTo("RecParticles") == 0 ) {
- folder = dynamic_cast<TFolder *>(fRecoFolder->FindObject("PHOS/RecParticles")) ;
- if (folder) {
- if (name.IsNull())
- name = fRecParticlesTitle ;
- phosO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
- }
- }
- else if ( what.CompareTo("Alarms") == 0 ){
- if (name.IsNull() )
- phosO = dynamic_cast<TObject *>(fQAFolder->FindObject("PHOS")) ;
- else {
- folder = dynamic_cast<TFolder *>(fQAFolder->FindObject("PHOS")) ;
- if (!folder)
- phosO = 0 ;
- else
- phosO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
- }
- }
- if (!phosO) {
- if(fDebug)
- cerr << "ERROR : AliPHOSGetter::ReturnO -> Object " << what << " not found in " << folder->GetName() << endl ;
- return 0 ;
- }
- return phosO ;
-}
-
-//____________________________________________________________________________
-const TTask * AliPHOSGetter::ReturnT(TString what, TString name) const
-{
- // get the TTask named "what" from the folder
- // folders are named like //Folders/Tasks/what/PHOS/name
-
- TString search(what) ;
- if ( what.CompareTo("Clusterizer") == 0 )
- search = "Reconstructioner" ;
- else if ( what.CompareTo("TrackSegmentMaker") == 0 )
- search = "Reconstructioner" ;
- else if ( what.CompareTo("PID") == 0 )
- search = "Reconstructioner" ;
- else if ( what.CompareTo("QATasks") == 0 )
- search = "QA" ;
-
- TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject(search)) ;
-
- if (!tasks) {
- cerr << "ERROR: AliPHOSGetter::ReturnT -> Task " << what << " not found!" << endl ;
- return 0 ;
- }
-
- TTask * phosT = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("PHOS")) ;
- if (!phosT) {
- cerr << "ERROR: AliPHOSGetter::ReturnT -> Task " << what << "/PHOS not found!" << endl ;
- return 0 ;
- }
-
- TList * list = phosT->GetListOfTasks() ;
-
- if (what.CompareTo("SDigitizer") == 0) {
- if ( name.IsNull() )
- name = fSDigitsTitle ;
- } else if (what.CompareTo("Digitizer") == 0){
- if ( name.IsNull() )
- name = fDigitsTitle ;
- } else if (what.CompareTo("Clusterizer") == 0){
- if ( name.IsNull() )
- name = fRecPointsTitle ;
- name.Append(":clu") ;
- }
- else if (what.CompareTo("TrackSegmentMaker") == 0){
- if ( name.IsNull() )
- name = fTrackSegmentsTitle ;
- name.Append(":tsm") ;
- }
- else if (what.CompareTo("PID") == 0){
- if ( name.IsNull() )
- name = fRecParticlesTitle ;
- name.Append(":pid") ;
- }
- else if (what.CompareTo("QATasks") == 0){
- if ( name.IsNull() )
- return phosT ;
- }
-
- TIter it(list) ;
- TTask * task = 0 ;
- while((task = static_cast<TTask *>(it.Next()) )){
- TString taskname(task->GetName()) ;
- if(taskname.BeginsWith(name))
- return task ;
- }
-
- if(fDebug)
- cout << "WARNING: AliPHOSGetter::ReturnT -> Task " << search << "/" << name << " not found!" << endl ;
- return 0 ;
-}
+++ /dev/null
-#ifndef ALIEMCALGETTER_H
-#define ALIEMCALGETTER_H
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice */
-
-/* $Id$ */
-
-//_________________________________________________________________________
-// A singleton that returns various objects
-// Should be used on the analysis stage to avoid confusing between different
-// branches of reconstruction tree: e.g. reading RecPoints and TS made from
-// another set of RecPoints.
-//
-// The objects are retrived from folders.
-//*-- Author: Yves Schutz (SUBATECH) & Dmitri Peressounko (RRC KI & SUBATECH)
-//
-
-
-// --- ROOT system ---
-#include "TClonesArray.h"
-#include "TFolder.h"
-#include "TTree.h"
-class TString ;
-class TParticle ;
-class TTask ;
-
-// --- Standard library ---
-#include <stdlib.h>
-#include <iostream.h>
-
-// --- AliRoot header files ---
-
-#include "AliRun.h"
-#include "AliEMCAL.h"
-class AliEMCALGeometry ;
-class AliEMCALHit ;
-class AliEMCALDigit ;
-class AliEMCALDigitizer ;
-class AliEMCALSDigitizer ;
-//class AliEMCALEmcRecPoint ;
-//class AliEMCALCpvRecPoint ;
-//class AliEMCALClusterizer ;
-//class AliEMCALTrackSegment ;
-//class AliEMCALTrackSegmentMaker ;
-//class AliEMCALRecParticle ;
-//class AliEMCALPID ;
-
-class AliEMCALGetter : public TObject {
-
- public:
-
- AliEMCALGetter(){
- // ctor: this is a singleton, the ctor should never be called but cint needs it as public
- cerr << "ERROR: AliPHOGetter is a singleton default ctor not callable" << endl ;
- abort() ;
- }
- AliEMCALGetter(const AliEMCALGetter & obj) {
- // cpy ctor requested by Coding Convention
- // but not yet needed
- abort() ;
- }
-
- virtual ~AliEMCALGetter() ;
-
- 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(AliEMCALClusterizer * clu) const ;
- Bool_t PostSDigitizer (AliEMCALSDigitizer * sdigitizer) const ;
- Bool_t PostSDigitizer ( const char * name, const char * file ) const ;
- Bool_t PostDigitizer (AliEMCALDigitizer * digitizer) const ;
- Bool_t PostDigitizer ( const char * name) const ;
- //Bool_t PostTrackSegmentMaker(AliEMCALTrackSegmentMaker * tsm) const ;
- //Bool_t PostTrackSegmentMaker(const char * name ) const ;
- //Bool_t PostPID (AliEMCALPID * pid) const ;
- //Bool_t PostPID (const char * name ) const ;
- //Bool_t PostQA (void) const ;
-
-
- void Event(const Int_t event, const char * opt = "HSDRQ") ;
- void Track(Int_t itrack) ;
-
- //Method to be used when digitizing under AliRunDigitizer, who opens all files etc.
- void ReadTreeS(TTree * treeS,Int_t input) ;
-
- Int_t EventNumber() { return (Int_t) gAlice->GetEvNumber() ; }
- Int_t MaxEvent() { return (Int_t) gAlice->TreeE()->GetEntries() ; }
- static AliEMCALGetter * GetInstance(const char* headerFile,
- const char* branchTitle = "Default" ) ;
- static AliEMCALGetter * GetInstance() ;
-
- const AliEMCAL * EMCAL() ;
- const AliEMCALGeometry * EMCALGeometry() ;
- // Alarms
- //TFolder * Alarms() const { return (TFolder*)(ReturnO("Alarms", 0)) ; }
- //TObjArray * Alarms(const char * name ) const { return (TObjArray*)(ReturnO("Alarms", name)) ; }
-
- // QA Tasks
- //TTask * QATasks(const char * name = 0) const { return (TTask*)(ReturnT("QATasks", name)) ; }
-
- // Hits
- TClonesArray * Hits(void) const { return (TClonesArray*)(ReturnO("Hits")) ; }
-
- // SDigits
- TClonesArray * SDigits(const char * name = 0, const char * file=0) const
- { return (TClonesArray*)(ReturnO("SDigits", name, file)) ; }
-
- AliEMCALSDigitizer * SDigitizer(const char * name =0) const
- { return ((AliEMCALSDigitizer*)(ReturnT("SDigitizer", name))) ; }
-
- // Digits
- TClonesArray * Digits(const char * name = 0) const
- { return (TClonesArray*)(ReturnO("Digits", name)) ; }
- AliEMCALDigitizer * Digitizer(const char * name =0) const
- { return (AliEMCALDigitizer*)(ReturnT("Digitizer", name)) ; }
-
- // RecPoints
- //TObjArray * EmcRecPoints(const char * name = 0) const {
- // return (TObjArray*)(ReturnO("EmcRecPoints", name)) ; }
- //TObjArray * CpvRecPoints(const char * name = 0) const {
- // return (TObjArray*)(ReturnO("CpvRecPoints", name)) ; }
-
- //AliEMCALClusterizer * Clusterizer (const char * name =0) const
- // { return (AliEMCALClusterizer*)(ReturnT("Clusterizer", name)) ; }
-
- // TrackSegments
- //TClonesArray * TrackSegments(const char * name = 0) const
- // { return (TClonesArray*)(ReturnO("TrackSegments", name)) ; }
- //AliEMCALTrackSegmentMaker * TrackSegmentMaker (const char * name =0) const
- // { return (AliEMCALTrackSegmentMaker*)(ReturnT("TrackSegmentMaker", name)) ; }
-
- // RecParticles
- //TClonesArray * RecParticles(const char * name = 0) const
- // { return (TClonesArray*)(ReturnO("RecParticles", name)) ; }
- //AliEMCALPID * PID(const char * name =0) const
- // { return (AliEMCALPID*)(ReturnT("PID", name)) ; }
-
- // Primaries
- const TParticle * Primary(Int_t index) const ;
- const Int_t NPrimaries()const { return fNPrimaries; }
-
- void SetDebug(Int_t level) {fDebug = level;} // Set debug level
-
- AliEMCALGetter & operator = (const AliEMCALGetter & ) {
- // assignement operator requested by coding convention, but not needed
- abort() ;
- return *this ;
- }
-
- TFolder * SDigitsFolder() { return dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("EMCAL")) ; }
-
- private:
-
- AliEMCALGetter(const char* headerFile, const char* branchTitle ="Default") ;
- void CreateWhiteBoard() const ;
- const TObject * ReturnO(TString what, TString name=0, TString file=0) const ;
- const TTask * ReturnT(TString what,TString name=0) const ;
- void DefineBranchTitles(char* branch, char* branchTitle) ;
- void ReadTreeD() ;
- void ReadTreeH() ;
- //void ReadTreeR() ;
- void ReadTreeS(Int_t event) ;
- //void ReadTreeQA() ;
- void ReadPrimaries() ;
-
- void * HitsRef(void) const ;
- void * SDigitsRef(const char * name, const char * file = 0 ) const;
- void * DigitsRef (const char * name) const ;
- //void * EmcRecPointsRef (const char * name) const ;
- //void * CpvRecPointsRef (const char * name) const ;
- //void * TrackSegmentsRef(const char * name) const ;
- //void * RecParticlesRef (const char * name) const ;
- //void * AlarmsRef (void) const ;
-
- void * SDigitizerRef (const char * name) const ;
- void * DigitizerRef (const char * name) const ;
- //void * ClusterizerRef(const char * name) const ;
- //void * TSMakerRef (const char * name) const ;
- //void * PIDRef (const char * name) const ;
-
- private:
-
- TString fHeaderFile ; //! File in which gAlice lives
- TString fBranchTitle ; //!
- //TString fTrackSegmentsTitle ;//!
- //TString fRecPointsTitle ; //!
- //TString fRecParticlesTitle ; //!
- TString fDigitsTitle ; //!
- TString fSDigitsTitle ; //!
-
- Int_t fDebug ; // Debug level
-
- 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 * fHitsFolder ; //!Folder that contains the Hits
- TFolder * fSDigitsFolder ; //!Folder that contains the SDigits
- TFolder * fDigitsFolder ; //!Folder that contains the Digits
- //TFolder * fRecoFolder ; //!Folder that contains the reconstructed objects (RecPoints, TrackSegments, RecParticles)
- //TFolder * fQAFolder ; //!Folder that contains the QA objects
- TFolder * fTasksFolder ; //!Folder that contains the Tasks (sdigitizer, digitizer, reconstructioner)
-
- static AliEMCALGetter * fgObjGetter; // pointer to the unique instance of the singleton
-
- ClassDef(AliEMCALGetter,1) // Algorithm class that provides methods to retrieve objects from a list knowing the index
-
-};
-
-#endif // AliEMCALGETTER_H
+++ /dev/null
-/**************************************************************************
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * *
- * Author: The ALICE Off-line Project. *
- * Contributors are mentioned in the code where appropriate. *
- * *
- * Permission to use, copy, modify and distribute this software and its *
- * documentation strictly for non-commercial purposes is hereby granted *
- * without fee, provided that the above copyright notice appears in all *
- * copies and that both the copyright notice and this permission notice *
- * appear in the supporting documentation. The authors make no claims *
- * about the suitability of this software for any purpose. It is *
- * provided "as is" without express or implied warranty. *
- **************************************************************************/
-
-/* $Id$ */
-
-//_________________________________________________________________________
-// This is a TTask that makes SDigits out of Hits
-// The name of the TTask is also the title of the branch that will contain
-// the created SDigits
-// The title of the TTAsk is the name of the file that contains the hits from
-// which the SDigits are created
-// A Summable Digits is the sum of all hits originating
-// from one primary in one active cell
-// A threshold for assignment of the primary to SDigit is applied
-// SDigits are written to TreeS, branch "PHOS"
-// AliPHOSSDigitizer with all current parameters is written
-// to TreeS branch "AliPHOSSDigitizer".
-// Both branches have the same title. If necessary one can produce
-// another set of SDigits with different parameters. Two versions
-// can be distunguished using titles of the branches.
-// User case:
-// root [0] AliPHOSSDigitizer * s = new AliPHOSSDigitizer("galice.root")
-// Warning in <TDatabasePDG::TDatabasePDG>: object already instantiated
-// root [1] s->ExecuteTask()
-// // Makes SDigitis for all events stored in galice.root
-// root [2] s->SetPedestalParameter(0.001)
-// // One can change parameters of digitization
-// root [3] s->SetSDigitsBranch("Pedestal 0.001")
-// // and write them into the new branch
-// root [4] s->ExecuteTask("deb all tim")
-// // available parameters:
-// deb - print # of produced SDigitis
-// deb all - print # and list of produced SDigits
-// tim - print benchmarking information
-//
-//*-- Author : Dmitri Peressounko (SUBATECH & KI)
-//////////////////////////////////////////////////////////////////////////////
-
-
-// --- ROOT system ---
-#include "TFile.h"
-#include "TTask.h"
-#include "TTree.h"
-#include "TSystem.h"
-#include "TROOT.h"
-#include "TFolder.h"
-#include "TBenchmark.h"
-// --- Standard library ---
-#include <iomanip.h>
-
-// --- AliRoot header files ---
-#include "AliRun.h"
-#include "AliPHOSDigit.h"
-#include "AliPHOSGeometry.h"
-#include "AliPHOSGetter.h"
-#include "AliPHOSHit.h"
-#include "AliPHOSSDigitizer.h"
-
-
-ClassImp(AliPHOSSDigitizer)
-
-
-//____________________________________________________________________________
- AliPHOSSDigitizer::AliPHOSSDigitizer():TTask("","")
-{
- // ctor
- fA = 0;
- fB = 10000000.;
- fPrimThreshold = 0.01 ;
- fSDigitsInRun = 0 ;
-}
-
-//____________________________________________________________________________
-AliPHOSSDigitizer::AliPHOSSDigitizer(const char * headerFile, const char * sDigitsTitle):TTask(sDigitsTitle, headerFile)
-{
- // ctor
- fA = 0;
- fB = 10000000.;
- fPrimThreshold = 0.01 ;
- fSDigitsInRun = 0 ;
- Init();
-}
-
-
-//____________________________________________________________________________
-void AliPHOSSDigitizer::Init()
-{
- // Initialization: open root-file, allocate arrays for hits and sdigits,
- // attach task SDigitizer to the list of PHOS tasks
- //
- // Initialization can not be done in the default constructor
- //============================================================= YS
- // The initialisation is now done by AliPHOSGetter
-
- if( strcmp(GetTitle(), "") == 0 )
- SetTitle("galice.root") ;
-
- AliPHOSGetter * gime = AliPHOSGetter::GetInstance(GetTitle(), GetName()) ;
- if ( gime == 0 ) {
- cerr << "ERROR: AliPHOSSDigitizer::Init -> Could not obtain the Getter object !" << endl ;
- return ;
- }
-
- gime->PostSDigits( GetName(), GetTitle() ) ;
-
- TString sdname(GetName() );
- sdname.Append(":") ;
- sdname.Append(GetTitle() ) ;
- SetName(sdname) ;
- gime->PostSDigitizer(this) ;
-
- // create a folder on the white board //YSAlice/WhiteBoard/SDigits/PHOS/headerFile/sdigitsTitle
-
-}
-
-//____________________________________________________________________________
-void AliPHOSSDigitizer::Exec(Option_t *option)
-{
- // Collects all hits in the same active volume into digit
- if( strcmp(GetName(), "") == 0 )
- Init() ;
-
- if (strstr(option, "print") ) {
- Print("") ;
- return ;
- }
-
- if(strstr(option,"tim"))
- gBenchmark->Start("PHOSSDigitizer");
-
- //Check, if this branch already exits
- gAlice->GetEvent(0) ;
- 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) ) {
- if ( (strcmp(branch->GetName(), "PHOS")==0) && (strcmp(branch->GetTitle(), GetName())==0) )
- phosfound = kTRUE ;
-
- else if ( (strcmp(branch->GetName(), "AliPHOSSDigitizer")==0) && (strcmp(branch->GetTitle(), GetName())==0) )
- sdigitizerfound = kTRUE ;
- }
-
- if ( phosfound || sdigitizerfound ) {
- cerr << "WARNING: AliPHOSSDigitizer::Exec -> SDigits and/or SDigitizer branch with name " << GetName()
- << " already exits" << endl ;
- return ;
- }
- }
-
- TString sdname(GetName()) ;
- sdname.Remove(sdname.Index(GetTitle())-1) ;
-
- AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
-
- Int_t nevents = (Int_t) gAlice->TreeE()->GetEntries() ;
-
- Int_t ievent ;
- for(ievent = 0; ievent < nevents; ievent++){
- gime->Event(ievent,"H") ;
-
- TClonesArray * sdigits = gime->SDigits(sdname.Data()) ;
- sdigits->Clear();
- Int_t nSdigits = 0 ;
-
-
- //Now make SDigits from hits, for PHOS it is the same, so just copy
- Int_t itrack ;
- for (itrack=0; itrack < gAlice->GetNtrack(); itrack++){
-
- //=========== Get the PHOS branch from Hits Tree for the Primary track itrack
- gime->Track(itrack) ;
- TClonesArray * hits = gime->Hits() ;
- Int_t i;
- for ( i = 0 ; i < hits->GetEntries() ; i++ ) {
- AliPHOSHit * hit = dynamic_cast<AliPHOSHit *>(hits->At(i)) ;
- // Assign primary number only if contribution is significant
-
- if( hit->GetEnergy() > fPrimThreshold)
- new((*sdigits)[nSdigits]) AliPHOSDigit(hit->GetPrimary(),hit->GetId(),
- Digitize(hit->GetEnergy()), hit->GetTime()) ;
- else
- new((*sdigits)[nSdigits]) AliPHOSDigit( -1 , hit->GetId(),
- Digitize(hit->GetEnergy()), hit->GetTime()) ;
- nSdigits++ ;
-
- }
- } // loop over tracks
-
- 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)
- gAlice->MakeTree("S") ;
-
- //Make (if necessary) branches
- char * file =0;
- if(gSystem->Getenv("CONFIG_SPLIT_FILE")){ //generating file name
- file = new char[strlen(gAlice->GetBaseFile())+20] ;
- sprintf(file,"%s/PHOS.SDigits.root",gAlice->GetBaseFile()) ;
- }
-
- TDirectory *cwd = gDirectory;
-
- //First list of sdigits
- Int_t bufferSize = 32000 ;
- TBranch * sdigitsBranch = gAlice->TreeS()->Branch("PHOS",&sdigits,bufferSize);
- sdigitsBranch->SetTitle(sdname);
- if (file) {
- sdigitsBranch->SetFile(file);
- TIter next( sdigitsBranch->GetListOfBranches());
- TBranch * subbr;
- while ((subbr=static_cast<TBranch*>(next()))) {
- subbr->SetFile(file);
- }
- cwd->cd();
- }
-
- //Next - SDigitizer
- Int_t splitlevel = 0 ;
- AliPHOSSDigitizer * sd = this ;
- TBranch * sdigitizerBranch = gAlice->TreeS()->Branch("AliPHOSSDigitizer","AliPHOSSDigitizer",
- &sd,bufferSize,splitlevel);
- sdigitizerBranch->SetTitle(sdname);
- if (file) {
- sdigitizerBranch->SetFile(file);
- TIter next( sdigitizerBranch->GetListOfBranches());
- TBranch * subbr ;
- while ((subbr=static_cast<TBranch*>(next()))) {
- subbr->SetFile(file);
- }
- cwd->cd();
- delete file;
- }
-
- sdigitsBranch->Fill() ;
- sdigitizerBranch->Fill() ;
- gAlice->TreeS()->Write(0,TObject::kOverwrite) ;
-
- if(strstr(option,"deb"))
- PrintSDigits(option) ;
-
- }
-
- if(strstr(option,"tim")){
- gBenchmark->Stop("PHOSSDigitizer");
- cout << "AliPHOSSDigitizer:" << endl ;
- cout << " took " << gBenchmark->GetCpuTime("PHOSSDigitizer") << " seconds for SDigitizing "
- << gBenchmark->GetCpuTime("PHOSSDigitizer")/nevents << " seconds per event " << endl ;
- cout << endl ;
- }
-
-
-}
-//__________________________________________________________________
-void AliPHOSSDigitizer::SetSDigitsBranch(const char * title )
-{
- // Setting title to branch SDigits
-
- TString stitle(title) ;
-
- // check if branch with title already exists
- TBranch * sdigitsBranch =
- static_cast<TBranch*>(gAlice->TreeS()->GetListOfBranches()->FindObject("PHOS")) ;
- TBranch * sdigitizerBranch =
- static_cast<TBranch*>(gAlice->TreeS()->GetListOfBranches()->FindObject("AliPHOSSDigitizer")) ;
- const char * sdigitsTitle = sdigitsBranch ->GetTitle() ;
- const char * sdigitizerTitle = sdigitizerBranch ->GetTitle() ;
- if ( stitle.CompareTo(sdigitsTitle)==0 || stitle.CompareTo(sdigitizerTitle)==0 ){
- cerr << "ERROR: AliPHOSSdigitizer::SetSDigitsBranch -> Cannot overwrite existing branch with title " << title << endl ;
- return ;
- }
-
- cout << "AliPHOSSdigitizer::SetSDigitsBranch -> Changing SDigits file from " << GetName() << " to " << title << endl ;
-
- SetName(title) ;
-
- // Post to the WhiteBoard
- AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
- gime->PostSDigits( title, GetTitle()) ;
-}
-
-//__________________________________________________________________
-void AliPHOSSDigitizer::Print(Option_t* option)const
-{
- // Prints parameters of SDigitizer
- cout << "------------------- "<< GetName() << " -------------" << endl ;
- cout << " Writing SDigits to branch with title " << GetName() << endl ;
- cout << " with digitization parameters A = " << fA << endl ;
- cout << " B = " << fB << endl ;
- cout << " Threshold for Primary assignment= " << fPrimThreshold << endl ;
- cout << "---------------------------------------------------"<<endl ;
-
-}
-//__________________________________________________________________
-Bool_t AliPHOSSDigitizer::operator==( AliPHOSSDigitizer const &sd )const
-{
- // Equal operator.
- // SDititizers are equal if their pedestal, slope and threshold are equal
-
- if( (fA==sd.fA)&&(fB==sd.fB)&&(fPrimThreshold==sd.fPrimThreshold))
- return kTRUE ;
- else
- return kFALSE ;
-}
-//__________________________________________________________________
-//__________________________________________________________________
-void AliPHOSSDigitizer::PrintSDigits(Option_t * option)
-{
- // Prints list of digits produced in the current pass of AliPHOSDigitizer
-
-
- AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
- TString sdname(GetName()) ;
- sdname.Remove(sdname.Index(GetTitle())-1) ;
- TClonesArray * sdigits = gime->SDigits(sdname.Data()) ;
-
- cout << "AliPHOSSDigitiser: event " << gAlice->GetEvNumber() << endl ;
- cout << " Number of entries in SDigits list " << sdigits->GetEntriesFast() << endl ;
- cout << endl ;
- if(strstr(option,"all")||strstr(option,"EMC")){
-
- //loop over digits
- AliPHOSDigit * digit;
- cout << "EMC sdigits " << endl ;
- cout << "Digit Id Amplitude Index Nprim Primaries list " << endl;
- 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) ;
- if(digit->GetNprimary() == 0) continue;
- cout << setw(6) << digit->GetId() << " " << setw(10) << digit->GetAmp() << " "
- << setw(6) << digit->GetIndexInList() << " "
- << setw(5) << digit->GetNprimary() <<" ";
-
- Int_t iprimary;
- for (iprimary=0; iprimary<digit->GetNprimary(); iprimary++)
- cout << setw(5) << digit->GetPrimary(iprimary+1) << " ";
- cout << endl;
- }
- cout << endl;
- }
-
- if(strstr(option,"all")||strstr(option,"CPV")){
-
- //loop over CPV digits
- AliPHOSDigit * digit;
- cout << "CPV sdigits " << endl ;
- cout << "Digit Id Amplitude Index Nprim Primaries list " << endl;
- Int_t maxEmc = gime->PHOSGeometry()->GetNModules()*gime->PHOSGeometry()->GetNCristalsInModule() ;
- Int_t index ;
- for (index = 0 ; index < sdigits->GetEntriesFast(); index++) {
- digit = (AliPHOSDigit * ) sdigits->At(index) ;
- if(digit->GetId() > maxEmc){
- cout << setw(6) << digit->GetId() << " " << setw(10) << digit->GetAmp() << " "
- << setw(6) << digit->GetIndexInList() << " "
- << setw(5) << digit->GetNprimary() <<" ";
-
- Int_t iprimary;
- for (iprimary=0; iprimary<digit->GetNprimary(); iprimary++)
- cout << setw(5) << digit->GetPrimary(iprimary+1) << " ";
- cout << endl;
- }
- }
- }
-
-}
-
-//____________________________________________________________________________
-void AliPHOSSDigitizer::UseHitsFrom(const char * filename)
-{
- SetTitle(filename) ;
- Init() ;
-}
+++ /dev/null
-#ifndef ALIPHOSSDigitizer_H
-#define ALIPHOSSDigitizer_H
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice */
-
-/* $Id$ */
-
-//_________________________________________________________________________
-// Task Class for making SDigits in PHOS
-// A Summable Digits is the sum of all hits originating
-// from one primary in one active cell
-//*--
-//*-- Author: Dmitri Peressounko(SUBATECH & KI)
-
-
-// --- ROOT system ---
-#include "TTask.h"
-#include "TString.h"
-// --- Standard library ---
-
-// --- AliRoot header files ---
-
-class AliPHOSSDigitizer: public TTask {
-
-public:
- AliPHOSSDigitizer() ; // ctor
- AliPHOSSDigitizer(const char* HeaderFile,const char *SdigitsTitle = "Default") ;
- 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);
-
- 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 UseHitsFrom(const char * filename) ;
-
- Bool_t operator == (const AliPHOSSDigitizer & sd) const ;
-
-private:
- void Init() ;
- void PrintSDigits(Option_t * option) ;
-
-private:
-
- Float_t fA ; // Pedestal parameter
- Float_t fB ; // Slope Digitizition parameters
- Float_t fPrimThreshold ; // To store primari if Elos > threshold
- Int_t fSDigitsInRun ; //! Total number of sdigits in one run
-
-
- ClassDef(AliPHOSSDigitizer,1) // description
-
-};
-
-#endif // AliPHOSSDigitizer_H
+++ /dev/null
-/**************************************************************************
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * *
- * Author: The ALICE Off-line Project. *
- * Contributors are mentioned in the code where appropriate. *
- * *
- * Permission to use, copy, modify and distribute this software and its *
- * documentation strictly for non-commercial purposes is hereby granted *
- * without fee, provided that the above copyright notice appears in all *
- * copies and that both the copyright notice and this permission notice *
- * appear in the supporting documentation. The authors make no claims *
- * about the suitability of this software for any purpose. It is *
- * provided "as is" without express or implied warranty. *
- **************************************************************************/
-
-/* $Id: */
-
-/* $Log:
-*/
-
-//_________________________________________________________________________
-// A singleton. This class should be used in the analysis stage to get
-// reconstructed objects: Digits, RecPoints, TrackSegments and RecParticles,
-// instead of directly reading them from galice.root file. This container
-// ensures, that one reads Digits, made of these particular digits, RecPoints,
-// made of these particular RecPoints, TrackSegments and RecParticles.
-// This becomes non trivial if there are several identical branches, produced with
-// different set of parameters. Currently This class only Retrieves Hits, Digits, and SDigits.
-//
-// An example of how to use (see also class AliEMCALAnalyser):
-// AliEMCALGetter * gime = AliEMCALGetter::GetInstance("galice.root","test") ;
-// ................
-// please->GetEvent(event) ; // reads new event from galice.root
-//
-//*-- Author: Sahal Yacoob (LBL)
-// based on : AliPHOSGetter
-//////////////////////////////////////////////////////////////////////////////
-
-
-// --- ROOT system ---
-
-#include "TFile.h"
-#include "TTree.h"
-#include "TROOT.h"
-#include "TObjString.h"
-#include "TFolder.h"
-
-// --- Standard library ---
-#include <iostream.h>
-
-// --- AliRoot header files ---
-
-#include "AliRun.h"
-#include "AliConfig.h"
-#include "AliEMCALGetter.h"
-#include "AliEMCALv1.h"
-#include "AliEMCALDigitizer.h"
-#include "AliEMCALSDigitizer.h"
-#include "AliEMCALGeometry.h"
-
-ClassImp(AliEMCALGetter)
-
- AliEMCALGetter * AliEMCALGetter::fgObjGetter = 0 ;
-
-//____________________________________________________________________________
-AliEMCALGetter::AliEMCALGetter(const char* headerFile, const char* branchTitle )
-{
- //Initialize all lists
-
- fHeaderFile = headerFile ;
- fBranchTitle = branchTitle ;
- fSDigitsTitle = branchTitle ;
- fDigitsTitle = branchTitle ;
-
- fPrimaries = new TObjArray(1) ;
- fModuleFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/Run/Configuration/Modules"));
- fHitsFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/RunMC/Event/Data/Hits"));
- fSDigitsFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/RunMC/Event/Data/SDigits"));
- fDigitsFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/Run/Event/Data"));
- fTasksFolder = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/Tasks")) ;
-
- if ( fHeaderFile != "aliroot" ) { // to call the getter without a file
-
- //open headers file
- TFile * file = static_cast<TFile*>(gROOT->GetFile(fHeaderFile.Data() ) ) ;
-
- if(file == 0){ //if file was not opened yet, read gAlice
- if(fHeaderFile.Contains("rfio")) // if we read file using HPSS
- file = TFile::Open(fHeaderFile.Data(),"update") ;
- else
- file = new TFile(fHeaderFile.Data(),"update") ;
-
- if (!file->IsOpen()) {
- cerr << "ERROR : AliEMCALGetter::AliEMCALGetter -> Cannot open " << fHeaderFile.Data() << endl ;
- abort() ;
- }
-
- gAlice = static_cast<AliRun *>(file->Get("gAlice")) ;
-
- if (!gAlice) {
- cerr << "ERROR : AliEMCALGetter::AliEMCALGetter -> Cannot find gAlice in " << fHeaderFile.Data() << endl ;
- abort() ;
- }
- if (!EMCAL()) {
- cout << "INFO: AliEMCALGetter -> Posting EMCAL to Folders" << endl ;
- AliConfig * conf = AliConfig::Instance() ;
- conf->Add(static_cast<AliDetector*>(gAlice->GetDetector("EMCAL"))) ;
- conf->Add(static_cast<AliModule*>(gAlice->GetDetector("EMCAL"))) ;
- }
- }
-
- }
-}
-//____________________________________________________________________________
-AliEMCALGetter::~AliEMCALGetter(){
-
-}
-
-//____________________________________________________________________________
-void AliEMCALGetter::CreateWhiteBoard() const
-{
-
-}
-
-//____________________________________________________________________________
-AliEMCALGetter * AliEMCALGetter::GetInstance()
-{
- // Returns the pointer of the unique instance already defined
-
- AliEMCALGetter * rv = 0 ;
- if ( fgObjGetter )
- rv = fgObjGetter ;
- else
- cout << "AliEMCALGetter::GetInstance ERROR: not yet initialized" << endl ;
-
- return rv ;
-}
-
-//____________________________________________________________________________
-AliEMCALGetter * AliEMCALGetter::GetInstance(const char* headerFile,
- const char* branchTitle)
-{
- // Creates and returns the pointer of the unique instance
- // Must be called only when the environment has changed
-
- if ( fgObjGetter )
- if((fgObjGetter->fBranchTitle.CompareTo(branchTitle) == 0) &&
- (fgObjGetter->fHeaderFile.CompareTo(headerFile)==0))
- return fgObjGetter ;
- else
- fgObjGetter->~AliEMCALGetter() ; // delete it if already exists another version
-
- fgObjGetter = new AliEMCALGetter(headerFile,branchTitle) ;
-
- // Posts a few item to the white board (folders)
- // fgObjGetter->CreateWhiteBoard() ;
-
- return fgObjGetter ;
-
-}
-
-//____________________________________________________________________________
-const AliEMCALv0 * AliEMCALGetter::EMCAL()
-{
- // returns the EMCAL object
- //AliEMCALv0 * emcal = dynamic_cast<AliEMCALv0 *>(gAlice->GetDetector("EMCAL")) ;
- AliEMCALv0 * emcal = dynamic_cast<AliEMCALv1 *>(fModuleFolder->FindObject("EMCAL")) ;
- if (!emcal)
- cout << "WARNING: AliEMCALGetter::EMCAL -> EMCAL module not found in Folders" << endl ;
- return emcal ;
-}
-
-//____________________________________________________________________________
-const AliEMCALGeometry * AliEMCALGetter::EMCALGeometry()
-{
- AliEMCALGeometry * rv = 0 ;
- if (EMCAL() )
- rv = EMCAL()->GetGeometry() ;
- return rv ;
-}
-
-//____________________________________________________________________________
-Bool_t AliEMCALGetter::PostHits(void) const
-{ //------- Hits ----------------------
-
- // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/Hits
-
- TFolder * emcalFolder = dynamic_cast<TFolder*>(fHitsFolder->FindObject("EMCAL")) ;
- if ( !emcalFolder ) {
- cout << "WARNING: AliEMCALGetter::Post H -> Folder //" << fHitsFolder << "/EMCAL/ not found!" << endl;
- cout << "INFO: AliEMCALGetter::Post H -> Adding Folder //" << fHitsFolder << "/EMCAL/" << endl;
- emcalFolder = fHitsFolder->AddFolder("EMCAL", "Hits from EMCAL") ;
- }
- TClonesArray *hits= new TClonesArray("AliEMCALHit",1000) ;
- hits->SetName("Hits") ;
- emcalFolder->Add(hits) ;
-
- return kTRUE;
-}
-
-//____________________________________________________________________________
-void * AliEMCALGetter::HitsRef(void) const
-{ //------- Hits ----------------------
-
-
- // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/Hits
- if ( !fHitsFolder ) {
- cerr << "ERROR: AliEMCALGetter::Post H -> Folder //" << fHitsFolder << " not found!" << endl;
- return 0;
- }
-
- TFolder * emcalFolder = dynamic_cast<TFolder *>(fHitsFolder->FindObject("EMCAL")) ;
- if ( !emcalFolder ) {
- cerr << "ERROR: AliEMCALGetter::Post HRef -> Folder //" << fHitsFolder << "/EMCAL/ not found!" << endl;
- return 0;
- }
-
- TObject * h = emcalFolder->FindObject("Hits") ;
- if(!h) {
- cerr << "ERROR: AliEMCALGetter::HRef -> " << emcalFolder->GetName() << "/Hits not found !" << endl ;
- return 0 ;
- }
- else
- return static_cast<void *>(emcalFolder->GetListOfFolders()->GetObjectRef(h)) ;
-}
-
-//____________________________________________________________________________
-Bool_t AliEMCALGetter::PostSDigits(const char * name, const char * headerFile) const
-{ //---------- SDigits -------------------------
-
-
- // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/SDigits/headerFile/sdigitsname
- // because you can have sdigits from several hit files for mixing
-
- TFolder * emcalFolder = dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("EMCAL")) ;
- if ( !emcalFolder ) {
- cout << "WARNING: AliEMCALGetter::Post S -> Folder //" << fSDigitsFolder << "/EMCAL/ not found!" << endl;
- cout << "INFO: AliEMCALGetter::Post S -> Adding Folder //" << fHitsFolder << "/EMCAL/" << endl;
- emcalFolder = fSDigitsFolder->AddFolder("EMCAL", "SDigits from EMCAL") ;
- }
- TString subdir(headerFile) ;
- TFolder * emcalSubFolder = dynamic_cast<TFolder*>(emcalFolder->FindObject(subdir)) ;
- if ( !emcalSubFolder )
- emcalSubFolder = emcalFolder->AddFolder(subdir, "");
-
- TObject * sd = emcalSubFolder->FindObject(name);
- if ( sd ) {
- cerr <<"INFO: AliEMCALGetter::Post S -> Folder " << subdir
- << " already exists!" << endl ;
- }else{
- TClonesArray * sdigits = new TClonesArray("AliEMCALDigit",1000) ;
- sdigits->SetName(name) ;
- emcalSubFolder->Add(sdigits) ;
- }
-
- return kTRUE;
-}
-//____________________________________________________________________________
-void * AliEMCALGetter::SDigitsRef(const char * name, const char * file) const
-{ //------- SDigits ----------------------
-
- // the hierarchy is //Folders/RunMC/Event/Data/EMCAL/SDigits/filename/SDigits
-
- if ( !fSDigitsFolder ) {
- cerr << "ERROR: AliEMCALGetter::Post SRef -> Folder //" << fSDigitsFolder << " not found!" << endl;
- return 0;
- }
-
- TFolder * emcalFolder = dynamic_cast<TFolder *>(fSDigitsFolder->FindObject("EMCAL")) ;
- if ( !emcalFolder ) {
- cerr << "ERROR: AliEMCALGetter::Post SRef -> Folder //" << fSDigitsFolder << "/EMCAL/ not found!" << endl;
- return 0;
- }
-
- TFolder * emcalSubFolder = 0 ;
- if(file)
- emcalSubFolder = dynamic_cast<TFolder *>(emcalFolder->FindObject(file)) ;
- else
- emcalSubFolder = dynamic_cast<TFolder *>(emcalFolder->FindObject(fHeaderFile)) ;
-
- if(!emcalSubFolder) {
- cerr << "ERROR: AliEMCALGetter::Post SRef -> Folder //Folders/RunMC/Event/Data/EMCAL/" << file << "not found!" << endl;
- return 0;
- }
-
- TObject * dis = emcalSubFolder->FindObject(name) ;
- if(!dis)
- return 0 ;
- else
- return static_cast<void *>(emcalSubFolder->GetListOfFolders()->GetObjectRef(dis)) ;
-
-}
-
-//____________________________________________________________________________
-Bool_t AliEMCALGetter::PostSDigitizer(AliEMCALSDigitizer * sdigitizer) const
-{ //---------- SDigitizer -------------------------
-
- // the hierarchy is //Folders/Tasks/SDigitizer/EMCAL/sdigitsname
-
-
- TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("SDigitizer")) ;
-
- if ( !sd ) {
- cerr << "ERROR: AliEMCALGetter::Post Ser -> Task //" << fTasksFolder << "/SDigitizer not found!" << endl;
- return kFALSE ;
- }
- TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ;
- if ( !emcal ) {
- cout <<"WARNING: AliEMCALGetter::Post Ser ->//" << fTasksFolder << "/SDigitizer/EMCAL/ not found!" << endl;
- cout <<"INFO: AliEMCALGetter::Post Ser -> Adding //" << fTasksFolder << "/SDigitizer/EMCAL/" << endl;
- emcal = new TTask("EMCAL", "") ;
- sd->Add(emcal) ;
- }
- AliEMCALSDigitizer * emcalsd = dynamic_cast<AliEMCALSDigitizer *>(emcal->GetListOfTasks()->FindObject( sdigitizer->GetName() ));
- if (emcalsd) {
- cout << "INFO: AliEMCALGetter::Post Ser -> Task " << sdigitizer->GetName() << " already exists" << endl ;
- emcal->GetListOfTasks()->Remove(emcalsd) ;
- }
- emcal->Add(sdigitizer) ;
- return kTRUE;
-
-}
-
-//____________________________________________________________________________
-void * AliEMCALGetter::SDigitizerRef(const char * name) const
-{
-
- TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("SDigitizer")) ;
- if ( !sd ) {
- cerr << "ERROR: AliEMCALGetter::Post SerRef -> Task //" << fTasksFolder << "/SDigitizer not found!" << endl;
- abort();
- }
-
- TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ;
- if ( !emcal ) {
- cerr <<"ERROR: AliEMCALGetter::Post SerRef -> //" << fTasksFolder << "/SDigitizer/EMCAL not found!" << endl;
- abort();
- }
-
- TTask * task = dynamic_cast<TTask*>(emcal->GetListOfTasks()->FindObject(name)) ;
-
- return static_cast<void *>(emcal->GetListOfTasks()->GetObjectRef(task)) ;
-
-}
-
-//____________________________________________________________________________
-Bool_t AliEMCALGetter::PostSDigitizer(const char * name, const char * file) const
-{ //---------- SDigitizer -------------------------
-
- // the hierarchy is //Folders/Tasks/SDigitizer/EMCAL/sdigitsname
-
-
- TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("SDigitizer")) ;
- if ( !sd ) {
- cerr << "ERROR: AliEMCALGetter::Post Ser -> Task //" << fTasksFolder << "/SDigitizer not found!" << endl;
- return kFALSE ;
- }
-
- TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ;
- if ( !emcal ) {
- cout <<"WARNING: AliEMCALGetter::Post Ser -> //" << fTasksFolder << "/SDigitizer/EMCAL/ not found!" << endl;
- cout <<"INFO: AliEMCALGetter::Post Ser -> Adding //" << fTasksFolder << "/SDigitizer/EMCAL" << endl;
- emcal = new TTask("EMCAL", "") ;
- sd->Add(emcal) ;
- }
-
- TString sdname(name) ;
- sdname.Append(":") ;
- sdname.Append(file);
- AliEMCALSDigitizer * emcalsd = dynamic_cast<AliEMCALSDigitizer *>(emcal->GetListOfTasks()->FindObject( sdname ));
- if (!emcalsd) {
- emcalsd = new AliEMCALSDigitizer() ;
- //Note, we can not call constructor with parameters: it will call Getter and scrud up everething
- emcalsd->SetName(sdname) ;
- emcalsd->SetTitle(file) ;
- emcal->Add(emcalsd) ;
- }
- return kTRUE;
-
-}
-
-//____________________________________________________________________________
-Bool_t AliEMCALGetter::PostDigits(const char * name) const
-{ //---------- Digits -------------------------
-
- // the hierarchy is //Folders/Run/Event/Data/EMCAL/SDigits/name
-
- TFolder * emcalFolder = dynamic_cast<TFolder*>(fDigitsFolder->FindObject("EMCAL")) ;
-
- if ( !emcalFolder ) {
- cout << "WARNING: AliEMCALGetter::Post D -> Folder //" << fDigitsFolder << "/EMCAL/ not found!" << endl;
- cout << "INFO: AliEMCALGetter::Post D -> Adding Folder //" << fDigitsFolder << "/EMCAL/" << endl;
- emcalFolder = fDigitsFolder->AddFolder("EMCAL", "Digits from EMCAL") ;
- }
-
- TObject* dig = emcalFolder->FindObject( name ) ;
- if ( !dig ) {
- TClonesArray * digits = new TClonesArray("AliEMCALDigit",1000) ;
- digits->SetName(name) ;
- emcalFolder->Add(digits) ;
- }
- return kTRUE;
-}
-
-//____________________________________________________________________________
-void * AliEMCALGetter::DigitsRef(const char * name) const
-{ //------- Digits ----------------------
-
- // the hierarchy is //Folders/Run/Event/Data/EMCAL/Digits/name
-
- if ( !fDigitsFolder ) {
- cerr << "ERROR: AliEMCALGetter::Post DRef -> Folder //" << fDigitsFolder << " not found!" << endl;
- return 0;
- }
-
- TFolder * emcalFolder = dynamic_cast<TFolder*>(fDigitsFolder->FindObject("EMCAL")) ;
- if ( !emcalFolder ) {
- cerr << "ERROR: AliEMCALGetter::DRef -> Folder //" << fDigitsFolder << "/EMCAL/ not found!" << endl;
- return 0;
- }
-
- TObject * d = emcalFolder->FindObject(name) ;
- if(!d)
- return 0 ;
- else
- return static_cast<void *>(emcalFolder->GetListOfFolders()->GetObjectRef(d)) ;
-
-}
-
-//____________________________________________________________________________
-Bool_t AliEMCALGetter::PostDigitizer(AliEMCALDigitizer * digitizer) const
-{ //---------- Digitizer -------------------------
-
- TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("Digitizer")) ;
-
- if ( !sd ) {
- cerr << "ERROR: AliEMCALGetter::Post Der -> Task //" << fTasksFolder << "/Digitizer not found!" << endl;
- return kFALSE ;
- }
- TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ;
- if ( !emcal ) {
- cout <<"WARNING: AliEMCALGetter::Post Der -> //" << fTasksFolder << "/Digitizer/EMCAL not found!" << endl;
- cout <<"INFO: AliEMCALGetter::Post Der -> Adding //" << fTasksFolder << "/Digitizer/EMCAL" << endl;
- emcal = new TTask("EMCAL", "") ;
- sd->Add(emcal) ;
- }
-
- AliEMCALDigitizer * emcald = dynamic_cast<AliEMCALDigitizer*>(emcal->GetListOfTasks()->FindObject(digitizer->GetName())) ;
- if (emcald) {
- emcald->Delete() ;
- emcal->GetListOfTasks()->Remove(emcald) ;
- }
- emcal->Add(digitizer) ;
- return kTRUE;
-}
-
-//____________________________________________________________________________
-Bool_t AliEMCALGetter::PostDigitizer(const char * name) const
-{ //---------- Digitizer -------------------------
-
- // the hierarchy is //Folders/Tasks/SDigitizer/EMCAL/sdigitsname
-
- TTask * d = dynamic_cast<TTask*>(fTasksFolder->FindObject("Digitizer")) ;
- if ( !d ) {
- cerr << "ERROR: AliEMCALGetter::Post Der -> Task //" << fTasksFolder << "/Digitizer not found!" << endl;
- return kFALSE ;
- }
-
- TTask * emcal = dynamic_cast<TTask*>(d->GetListOfTasks()->FindObject("EMCAL")) ;
- if ( !emcal ) {
- cout <<"WARNING: AliEMCALGetter::Post Der -> //" << fTasksFolder << "/Digitizer/EMCAL not found!" << endl;
- cout <<"INFO: AliEMCALGetter::Post Der -> Adding //" << fTasksFolder << "/Digitizer/EMCAL" << endl;
- emcal = new TTask("EMCAL", "") ;
- d->Add(emcal) ;
-}
-
- AliEMCALDigitizer * emcald = dynamic_cast<AliEMCALDigitizer*>(emcal->GetListOfTasks()->FindObject(name)) ;
- if (!emcald) {
- emcald = new AliEMCALDigitizer() ;
- emcald->SetName(fDigitsTitle) ;
- emcald->SetTitle(fHeaderFile) ;
- emcal->Add(emcald) ;
- }
- return kTRUE;
-}
-
-//____________________________________________________________________________
-void * AliEMCALGetter::DigitizerRef(const char * name) const
-{
- TTask * sd = dynamic_cast<TTask*>(fTasksFolder->FindObject("Digitizer")) ;
- if ( !sd ) {
- cerr << "ERROR: AliEMCALGetter::Post DerRef -> Task //" << fTasksFolder << "/Digitizer not found!" << endl;
- abort();
- }
-
- TTask * emcal = dynamic_cast<TTask*>(sd->GetListOfTasks()->FindObject("EMCAL")) ;
- if ( !emcal ) {
- cerr <<"ERROR: AliEMCALGetter::Post DerRef -> //" << fTasksFolder << "/Digitizer/EMCAL" << endl;
- abort();
- }
-
- TTask * task = dynamic_cast<TTask*>(emcal->GetListOfTasks()->FindObject(name)) ;
-
- return static_cast<void *>(emcal->GetListOfTasks()->GetObjectRef(task)) ;
-
-}
-
-//____________________________________________________________________________
-const TParticle * AliEMCALGetter::Primary(Int_t index) const
-{
- // Return primary particle numbered by <index>
-
- if(index < 0)
- return 0 ;
-
- Int_t primaryIndex = index % 10000000 ;
- Int_t primaryList = (Int_t ) ((index-primaryIndex)/10000000.) ;
-
- if ( primaryList > 0 ) {
- cout << " Getter does not support currently Mixing of primary " << endl ;
- cout << " can not return primary: " << index<< " (list "<< primaryList<< " primary # " << primaryIndex << " )"<<endl ;
- return 0;
- }
-
- return gAlice->Particle(primaryIndex) ;
-
-}
-
-//____________________________________________________________________________
-void AliEMCALGetter::ReadTreeD()
-{
- // Read the digit tree gAlice->TreeD()
- if(gAlice->TreeD()== 0){
- cerr << "ERROR: AliEMCALGetter::ReadTreeD: can not read TreeD " << endl ;
- return ;
- }
- cout << "hello" << endl;
- TObjArray * lob = static_cast<TObjArray*>(gAlice->TreeD()->GetListOfBranches()) ;
- TIter next(lob) ;
- TBranch * branch = 0 ;
- TBranch * digitsbranch = 0 ;
- TBranch * digitizerbranch = 0 ;
- Bool_t emcalfound = kFALSE, digitizerfound = kFALSE ;
-
- while ( (branch = static_cast<TBranch*>(next())) && (!emcalfound || !digitizerfound) ) {
- if ( (strcmp(branch->GetName(), "EMCAL")==0) && (strcmp(branch->GetTitle(), fDigitsTitle)==0) ) {
- digitsbranch = branch ;
- emcalfound = kTRUE ;
- }
- else if ( (strcmp(branch->GetName(), "AliEMCALDigitizer")==0) && (strcmp(branch->GetTitle(), fDigitsTitle)==0) ) {
- digitizerbranch = branch ;
- digitizerfound = kTRUE ;
- }
- }
-
- if ( !emcalfound || !digitizerfound ) {
- cout << "WARNING: AliEMCALGetter::ReadTreeD -> Cannot find Digits and/or Digitizer with name "
- << fDigitsTitle << endl ;
- return ;
- }
-
- //read digits
- if(!Digits(fDigitsTitle) )
- PostDigits(fDigitsTitle);
- digitsbranch->SetAddress(DigitsRef(fDigitsTitle)) ;
- digitsbranch->GetEntry(0) ;
-
-
- // read the Digitizer
- if(!Digitizer(fDigitsTitle))
- PostDigitizer(fDigitsTitle) ;
- digitizerbranch->SetAddress(DigitizerRef(fDigitsTitle)) ;
- digitizerbranch->GetEntry(0) ;
-
-
-}
-
-//____________________________________________________________________________
-void AliEMCALGetter::ReadTreeH()
-{
- // Read the first entry of EMCAL branch in hit tree gAlice->TreeH()
-
- if(gAlice->TreeH()== 0){
- cerr << "ERROR: AliEMCALGetter::ReadTreeH: -> Cannot read TreeH " << endl ;
- return ;
- }
-
- TBranch * hitsbranch = static_cast<TBranch*>(gAlice->TreeH()->GetBranch("EMCAL")) ;
- if ( !hitsbranch ) {
- cout << "WARNING: AliEMCALGetter::ReadTreeH -> Cannot find branch EMCAL" << endl ;
- return ;
- }
- if(!Hits())
- PostHits() ;
-
- hitsbranch->SetAddress(HitsRef()) ;
-
- hitsbranch->GetEntry(0) ;
-
-}
-
-//____________________________________________________________________________
-void AliEMCALGetter::Track(Int_t itrack)
-{
- // Read the first entry of EMCAL branch in hit tree gAlice->TreeH()
-
- if(gAlice->TreeH()== 0){
- cerr << "ERROR: AliEMCALGetter::ReadTreeH: -> Cannot read TreeH " << endl ;
- return ;
- }
-
- TBranch * hitsbranch = dynamic_cast<TBranch*>(gAlice->TreeH()->GetListOfBranches()->FindObject("EMCAL")) ;
- if ( !hitsbranch ) {
- cout << "WARNING: AliEMCALGetter::ReadTreeH -> Cannot find branch EMCAL" << endl ;
- return ;
- }
- if(!Hits())
- PostHits() ;
- hitsbranch->SetAddress(HitsRef()) ;
- hitsbranch->GetEntry(itrack) ;
-
-
-}
-//____________________________________________________________________________
-void AliEMCALGetter::ReadTreeS(Int_t event)
-{
- // Read the summable digits tree gAlice->TreeS()
-
- // loop over all opened files and read their SDigits to the White Board
- TFolder * emcalF = dynamic_cast<TFolder *>(fSDigitsFolder->FindObject("EMCAL")) ;
- if (!emcalF)
- emcalF = fSDigitsFolder->AddFolder("EMCAL", "SDigits from EMCAL") ;
- TCollection * folderslist = emcalF->GetListOfFolders() ;
-
- //Add current file to list if it is not there yet
- if ( (fHeaderFile != "aliroot") && ( !folderslist->Contains(fHeaderFile) ) ){
- emcalF->AddFolder(fHeaderFile, "");
- }
-
- TIter next(folderslist) ;
- TFolder * folder = 0 ;
- TFile * file;
- TTree * treeS = 0;
- while ( (folder = static_cast<TFolder*>(next())) ) {
- if(fHeaderFile.CompareTo(folder->GetName()) == 0 )
- {treeS=gAlice->TreeS() ;
- cout << "ReadTreeS "<< gAlice->TreeS() <<endl ;}
- else{
- cout << " AliEMCALGetter::ReadTreeS 2 " << folder->GetName() << endl ;
- file = static_cast<TFile*>(gROOT->GetFile(folder->GetName()));
- file->cd() ;
-
- // Get SDigits Tree header from file
- TString treeName("TreeS") ;
- treeName += event ;
- treeS = dynamic_cast<TTree*>(gDirectory->Get(treeName.Data()));
- }
- if(treeS==0){
- cerr << "ERROR: AliEMCALGetter::ReadTreeS There is no SDigit Tree" << endl;
- return ;
- }
-
- //set address of the SDigits and SDigitizer
- TBranch * sdigitsBranch = 0;
- TBranch * sdigitizerBranch = 0;
- TBranch * branch = 0 ;
- TObjArray * lob = static_cast<TObjArray*>(treeS->GetListOfBranches()) ;
- TIter next(lob) ;
- Bool_t emcalfound = kFALSE, sdigitizerfound = kFALSE ;
-
- while ( (branch = static_cast<TBranch*>(next())) && (!emcalfound || !sdigitizerfound) ) {
-
- if ( (strcmp(branch->GetName(), "EMCAL")==0) && (strcmp(branch->GetTitle(), fSDigitsTitle)==0) ) {
- emcalfound = kTRUE ;
- sdigitsBranch = branch ;
- cout << "sdigitsbranch found = " << branch << endl ;
- }
-
- else if ( (strcmp(branch->GetName(), "AliEMCALSDigitizer")==0) && (strcmp(branch->GetTitle(), fSDigitsTitle)==0) ) {
- sdigitizerfound = kTRUE ;
- sdigitizerBranch = branch ;
- cout << "sdigitizerbranch found = " << branch << endl ;
- }
- }
- if ( !emcalfound || !sdigitizerfound ) {
- cout << "WARNING: AliEMCALDigitizer::ReadSDigits -> Digits and/or Digitizer branch with name " << GetName()
- << " not found" << endl ;
- return ;
- }
-
- if ( !folder->FindObject(fSDigitsTitle) )
- { PostSDigits(fSDigitsTitle,folder->GetName()) ;
- cout << "Posting SDigits " << endl << endl ;}
- sdigitsBranch->SetAddress(SDigitsRef(fSDigitsTitle,folder->GetName())) ;
-
- sdigitsBranch->GetEntry(0) ;
-
- TString sdname(fSDigitsTitle) ;
- cout << sdname << endl ;
- sdname+=":" ;
- sdname+=folder->GetName() ;
- if(!SDigitizer(sdname) )
- PostSDigitizer(fSDigitsTitle,folder->GetName()) ;
- sdigitizerBranch->SetAddress(SDigitizerRef(sdname)) ;
- sdigitizerBranch->GetEntry(0) ;
-
- }
-
- // After SDigits have been read from all files, return to the first one
-
- next.Reset();
- folder = static_cast<TFolder*>(next());
- if(folder){
- file = static_cast<TFile*>(gROOT->GetFile(folder->GetName()));
- file ->cd() ;
- }
-
-}
-//____________________________________________________________________________
-void AliEMCALGetter::ReadTreeS(TTree * treeS, Int_t input)
-{ // Read the summable digits fron treeS()
-
-
- TString filename("mergefile") ;
- filename+= input ;
-
- TFolder * emcalFolder = dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("EMCAL")) ;
- if ( !emcalFolder ) {
- emcalFolder = fSDigitsFolder->AddFolder("EMCAL", "SDigits from EMCAL") ;
- }
- TFolder * folder=(TFolder*)emcalFolder->FindObject(filename) ;
- //set address of the SDigits and SDigitizer
- TBranch * sdigitsBranch = 0;
- TBranch * sdigitizerBranch = 0;
- TBranch * branch = 0 ;
- TObjArray * lob = (TObjArray*)treeS->GetListOfBranches() ;
- TIter next(lob) ;
- Bool_t emcalfound = kFALSE, sdigitizerfound = kFALSE ;
-
- while ( (branch = (TBranch*)next()) && (!emcalfound || !sdigitizerfound) ) {
- if ( strcmp(branch->GetName(), "EMCAL")==0) {
- emcalfound = kTRUE ;
- sdigitsBranch = branch ;
- }
-
- else if ( strcmp(branch->GetName(), "AliEMCALSDigitizer")==0) {
- sdigitizerfound = kTRUE ;
- sdigitizerBranch = branch ;
- }
- }
- if ( !emcalfound || !sdigitizerfound ) {
- cout << "WARNING: AliEMCALGetter::ReadTreeS -> Digits and/or Digitizer branch not found" << endl ;
- return ;
- }
-
- if (!folder || !(folder->FindObject(sdigitsBranch->GetTitle()) ) )
- PostSDigits(sdigitsBranch->GetTitle(),filename) ;
-
- sdigitsBranch->SetAddress(SDigitsRef(sdigitsBranch->GetTitle(),filename)) ;
-
- TString sdname(sdigitsBranch->GetTitle()) ;
- sdname+=":" ;
- sdname+=filename ;
- if(!SDigitizer(sdigitsBranch->GetTitle()) )
- PostSDigitizer(sdigitsBranch->GetTitle(),filename) ;
- sdigitizerBranch->SetAddress(SDigitizerRef(sdname)) ;
-
- sdigitsBranch->GetEntry(0) ;
- sdigitizerBranch->GetEntry(0) ;
-
-}
-
-
-//____________________________________________________________________________
-void AliEMCALGetter::ReadPrimaries()
-{
- // Reads specific branches of primaries
-
- fNPrimaries = gAlice->GetNtrack();
-
- // //Check, is it necessary to open new files
- // TArrayI* events = fDigitizer->GetCurrentEvents() ;
- // TClonesArray * filenames = fDigitizer->GetHeadersFiles() ;
-// Int_t input ;
-// for(input = 0; input < filenames->GetEntriesFast(); input++){
-
-// TObjString * filename = (TObjString *) filenames->At(input) ;
-
-// //Test, if this file already open
-// TFile *file = (TFile*) gROOT->GetFile( filename->GetString() ) ;
-// if(file == 0)
-// file = new TFile( filename->GetString()) ;
-// file->cd() ;
-
-// // Get Kine Tree from file
-// // char treeName[20];
-// // sprintf(treeName,"TreeK%d",events->At(input));
-// // TTree * treeK = (TTree*)gDirectory->Get(treeName);
-// // if (treeK)
-// // treeK->SetBranchAddress("Particles", &fParticleBuffer);
-// // else
-// // cout << "AliEMCALGetter: cannot find Kine Tree for event:" << events->At(input) << endl;
-
-// // // Create the particle stack
-// // if(!fParticles) fParticles = new TClonesArray("TParticle",1000);
-// // // Build the pointer list
-// // if(fParticleMap) { <----
-// // fParticleMap->Clear();
-// // fParticleMap->Expand(treeK->GetEntries());
-// // } else
-// // fParticleMap = new TObjArray(treeK->GetEntries());
-
-// // From gAlice->Particle(i)
-
-
-// // if(!(*fParticleMap)[i]) {
-// // Int_t nentries = fParticles->GetEntries();
-
-// // // algorithmic way of getting entry index
-// // // (primary particles are filled after secondaries)
-// // Int_t entry;
-// // if (i<fHeader.GetNprimary())
-// // entry = i+fHeader.GetNsecondary();
-// // else
-// // entry = i-fHeader.GetNprimary();
-
-// // // only check the algorithmic way and give
-// // // the fatal error if it is wrong
-// // if (entry != fParticleFileMap[i]) {
-// // Fatal("Particle",
-// // "!!!! The algorithmic way is WRONG: !!!\n entry: %d map: %d",
-// // entry, fParticleFileMap[i]);
-// // }
-
-// // fTreeK->GetEntry(fParticleFileMap[i]);
-// // new ((*fParticles)[nentries]) TParticle(*fParticleBuffer);
-// // fParticleMap->AddAt((*fParticles)[nentries],i);
-// // }
-// // return (TParticle *) (*fParticleMap)[i];
-
-
-
-// }
-
-
-// //scan over opened files and read corresponding TreeK##
-
- return ;
-}
-//____________________________________________________________________________
-void AliEMCALGetter::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: AliEMCALGetter::Event -> " << event << " not found in TreeE!" << endl ;
- return ;
- }
- gAlice->GetEvent(event) ;
-
- if(strstr(opt,"H") )
- {cout<<"Reading TreeH" << endl ;
- ReadTreeH() ;}
-
- if(strstr(opt,"S") )
- { cout << "Reading TreeS" << endl ;
- ReadTreeS(event) ;}
-
- if( strstr(opt,"D") )
- ReadTreeD() ;
-
- if( strstr(opt,"R") )
-// ReadTreeR() ;
-
- if( strstr(opt,"Q") )
-// ReadTreeQA() ;
-
- if( strstr(opt,"P") )
- ReadPrimaries() ;
-
-}
-
-//____________________________________________________________________________
-const TObject * AliEMCALGetter::ReturnO(TString what, TString name, TString file) const
-{
- // get the object named "what" from the folder
- // folders are named like //Folders
-
- if ( file.IsNull() )
- file = fHeaderFile ;
-
- TFolder * folder = 0 ;
- TObject * emcalO = 0 ;
-
- // if ( name.IsNull() ) {
- if ( what.CompareTo("Hits") == 0 ) {
- folder = dynamic_cast<TFolder *>(fHitsFolder->FindObject("EMCAL")) ;
- if (folder)
- emcalO = dynamic_cast<TObject *>(folder->FindObject("Hits")) ;
- }
- else if ( what.CompareTo("SDigits") == 0 ) {
- TString path = "EMCAL/" + file ;
- folder = dynamic_cast<TFolder *>(fSDigitsFolder->FindObject(path.Data())) ;
- if (folder) {
- cout << "folder found" << endl ;
- if (name.IsNull())
- name = fSDigitsTitle ;
- emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
- }
- }
- else if ( what.CompareTo("Digits") == 0 ){
- folder = dynamic_cast<TFolder *>(fDigitsFolder->FindObject("EMCAL")) ;
- if (folder) {
- if (name.IsNull())
- name = fDigitsTitle ;
- emcalO = dynamic_cast<TObject *>(folder->FindObject(name)) ;
- }
- }
- if (!emcalO) {
- cerr << "ERROR : AliEMCALGetter::ReturnO -> Object " << what << " not found in " << folder->GetName() << endl ;
- return 0 ;
- }
- return emcalO ;
-}
-
-//____________________________________________________________________________
-const TTask * AliEMCALGetter::ReturnT(TString what, TString name) const
-{
- // get the TTask named "what" from the folder
- // folders are named like //Folders/Tasks/what/EMCAL/name
-
- TString search(what) ;
-
- TTask * tasks = dynamic_cast<TTask*>(fTasksFolder->FindObject(search)) ;
-
- if (!tasks) {
- cerr << "ERROR: AliEMCALGetter::ReturnT -> Task " << what << " not found!" << endl ;
- return 0 ;
- }
-
- TTask * emcalT = dynamic_cast<TTask*>(tasks->GetListOfTasks()->FindObject("EMCAL")) ;
- if (!emcalT) {
- cerr << "ERROR: AliEMCALGetter::ReturnT -> Task " << what << "/EMCAL not found!" << endl ;
- return 0 ;
- }
-
- TList * list = emcalT->GetListOfTasks() ;
-
- if (what.CompareTo("SDigitizer") == 0) {
- if ( name.IsNull() )
- name = fSDigitsTitle ;
- } else if (what.CompareTo("Digitizer") == 0){
- if ( name.IsNull() )
- name = fDigitsTitle ;
- }
-
- TIter it(list) ;
- TTask * task = 0 ;
- while((task = static_cast<TTask *>(it.Next()) )){
- TString taskname(task->GetName()) ;
- if(taskname.BeginsWith(name))
- return task ;
- }
-
- cout << "WARNING: AliEMCALGetter::ReturnT -> Task " << search << "/" << name << " not found!" << endl ;
- return 0 ;
-}
+++ /dev/null
-#ifndef ALIEMCALGETTER_H
-#define ALIEMCALGETTER_H
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice */
-
-/* $Id$ */
-
-//_________________________________________________________________________
-// A singleton that returns various objects
-// Should be used on the analysis stage to avoid confusing between different
-// branches of reconstruction tree: e.g. reading RecPoints and TS made from
-// another set of RecPoints.
-// At this stage the Getter class handles only Hits, Digits, and SDigits.
-// The objects are retrived from folders.
-//*-- Author: Sahal Yacoob (LBL)
-// based on : AliPHOSGetter
-
-
-// --- ROOT system ---
-#include "TClonesArray.h"
-#include "TFolder.h"
-#include "TTree.h"
-class TString ;
-class TParticle ;
-class TTask ;
-
-// --- Standard library ---
-#include <stdlib.h>
-#include <iostream.h>
-
-// --- AliRoot header files ---
-
-#include "AliRun.h"
-#include "AliEMCALv1.h"
-class AliEMCALGeometry ;
-class AliEMCALHit ;
-class AliEMCALDigit ;
-class AliEMCALDigitizer ;
-class AliEMCALSDigitizer ;
-
-class AliEMCALGetter : public TObject {
-
- public:
-
- AliEMCALGetter(){
- // ctor: this is a singleton, the ctor should never be called but cint needs it as public
- cerr << "ERROR: AliPHOGetter is a singleton default ctor not callable" << endl ;
- abort() ;
- }
- AliEMCALGetter(const AliEMCALGetter & obj) {
- // cpy ctor requested by Coding Convention
- // but not yet needed
- abort() ;
- }
-
- virtual ~AliEMCALGetter() ;
-
- 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 PostSDigitizer (AliEMCALSDigitizer * sdigitizer) const ;
- Bool_t PostSDigitizer ( const char * name, const char * file ) const ;
- Bool_t PostDigitizer (AliEMCALDigitizer * digitizer) const ;
- Bool_t PostDigitizer ( const char * name) const ;
-
-
- void Event(const Int_t event, const char * opt = "HSD") ;
- void Track(Int_t itrack) ;
-
- //Method to be used when digitizing under AliRunDigitizer, who opens all files etc.
- void ReadTreeS(TTree * treeS,Int_t input) ;
-
- Int_t EventNumber() { return (Int_t) gAlice->GetEvNumber() ; }
- Int_t MaxEvent() { return (Int_t) gAlice->TreeE()->GetEntries() ; }
- static AliEMCALGetter * GetInstance(const char* headerFile,
- const char* branchTitle = "Default" ) ;
- static AliEMCALGetter * GetInstance() ;
-
- const AliEMCALv0 * EMCAL() ;
- const AliEMCALGeometry * EMCALGeometry() ;
-
- // Hits
- TClonesArray * Hits(void) const { return (TClonesArray*)(ReturnO("Hits")) ; }
-
- // SDigits
- TClonesArray * SDigits(const char * name = 0, const char * file=0) const
- { return (TClonesArray*)(ReturnO("SDigits", name, file)) ; }
-
- AliEMCALSDigitizer * SDigitizer(const char * name =0) const
- { return ((AliEMCALSDigitizer*)(ReturnT("SDigitizer", name))) ; }
-
- // Digits
- TClonesArray * Digits(const char * name = 0) const
- { return (TClonesArray*)(ReturnO("Digits", name)) ; }
- AliEMCALDigitizer * Digitizer(const char * name =0) const
- { return (AliEMCALDigitizer*)(ReturnT("Digitizer", name)) ; }
-
- // Primaries
- const TParticle * Primary(Int_t index) const ;
- const Int_t NPrimaries()const { return fNPrimaries; }
-
-
- AliEMCALGetter & operator = (const AliEMCALGetter & ) {
- // assignement operator requested by coding convention, but not needed
- abort() ;
- return *this ;
- }
-
- TFolder * SDigitsFolder() { return dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("EMCAL")) ; }
-
- private:
-
- AliEMCALGetter(const char* headerFile, const char* branchTitle ="Default") ;
- void CreateWhiteBoard() const ;
- const TObject * ReturnO(TString what, TString name=0, TString file=0) const ;
- const TTask * ReturnT(TString what,TString name=0) const ;
- void DefineBranchTitles(char* branch, char* branchTitle) ;
- void ReadTreeD() ;
- void ReadTreeH() ;
- void ReadTreeS(Int_t event) ;
- void ReadPrimaries() ;
-
- void * HitsRef(void) const ;
- void * SDigitsRef(const char * name, const char * file = 0 ) const;
- void * DigitsRef (const char * name) const ;
-
- void * SDigitizerRef (const char * name) const ;
- void * DigitizerRef (const char * name) const ;
-
- private:
-
- TString fHeaderFile ; //! File in which gAlice lives
- TString fBranchTitle ; //!
- TString fDigitsTitle ; //!
- TString fSDigitsTitle ; //!
-
- Int_t fDebug ; // Debug level
-
- Int_t fNPrimaries ; //! # of primaries
-
- TObjArray * fPrimaries ; //! list of lists of primaries-for the case of mixing
-
- TFolder * fHitsFolder ; //!Folder that contains the Hits
- TFolder * fSDigitsFolder ; //!Folder that contains the SDigits
- TFolder * fDigitsFolder ; //!Folder that contains the Digits
- TFolder * fTasksFolder ; //!Folder that contains the Tasks (sdigitizer, digitizer, reconstructioner)
- TFolder * fModuleFolder ; //!
- static AliEMCALGetter * fgObjGetter; // pointer to the unique instance of the singleton
-
- ClassDef(AliEMCALGetter,1) // Algorithm class that provides methods to retrieve objects from a list knowing the index
-
-};
-
-#endif // AliEMCALGETTER_H