PMDbase PMDsim PMDrec TRDbase TRDsim TRDrec TRDfast FMDbase FMDsim FMDrec
TOFbase TOFrec TOFsim PHOSUtils PHOSbase PHOSsim PHOSrec ACORDEbase ACORDEsim
ACORDErec HMPIDbase HMPIDrec HMPIDsim ZDCbase ZDCsim ZDCrec VZERObase
- VZEROsim VZEROrec EMCALbase EMCALsim EMCALrec BCM STRUCT T0base T0sim
+ VZEROsim VZEROrec EMCALUtils EMCALbase EMCALsim EMCALrec BCM STRUCT T0base T0sim
T0rec EVGEN STEERBase ESD AOD CDB STEER THijing hijing FASTSIM microcern
RAWDatabase RAWDatarec RAWDatasim MUONevaluation HLTbase )
ACORDEbase ACORDEsim ACORDErec \
HMPIDbase HMPIDrec HMPIDsim \
ZDCbase ZDCsim ZDCrec VZERObase VZEROsim VZEROrec \
- EMCALbase EMCALsim EMCALrec BCM \
+ EMCALUtils EMCALbase EMCALsim EMCALrec BCM \
STRUCT T0base T0sim T0rec EVGEN STEERBase ESD AOD CDB STEER \
THijing hijing \
FASTSIM microcern \
VZERO/tgt_$(ALICE_TARGET)/G__VZERObase.o $(LIBPATH)/libVZERObase.a \
VZERO/tgt_$(ALICE_TARGET)/G__VZEROsim.o $(LIBPATH)/libVZEROsim.a \
VZERO/tgt_$(ALICE_TARGET)/G__VZEROrec.o $(LIBPATH)/libVZEROrec.a \
+ EMCAL/tgt_$(ALICE_TARGET)/G__EMCALUtils.o $(LIBPATH)/libEMCALUtils.a \
EMCAL/tgt_$(ALICE_TARGET)/G__EMCALbase.o $(LIBPATH)/libEMCALbase.a \
EMCAL/tgt_$(ALICE_TARGET)/G__EMCALsim.o $(LIBPATH)/libEMCALsim.a \
EMCAL/tgt_$(ALICE_TARGET)/G__EMCALrec.o $(LIBPATH)/libEMCALrec.a \
--- /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. *
+ **************************************************************************/
+
+//_________________________________________________________________________
+// AliAODCaloCluster extension for EMCAL to recalculate cluster
+// parameters in case of recalibration.
+// Copy-paste from methods in AliEMCALRecPoint.
+//*--
+//*-- Author: Dmitri Peressounko (RRC KI) for PHOS
+//*-- Adapted for EMCAL: Gustavo Conesa (INFN-LNF)
+
+// --- ROOT system ---
+#include "TVector3.h"
+#include "TMath.h"
+
+// --- Standard library ---
+
+// --- AliRoot header files ---
+#include "AliLog.h"
+#include "AliEMCALGeometry.h"
+#include "AliEMCALPID.h"
+#include "AliEMCALAodCluster.h"
+#include "AliEMCALCalibData.h"
+#include "AliAODCaloCells.h"
+
+ClassImp(AliEMCALAodCluster)
+
+//____________________________________________________________________________
+AliEMCALAodCluster::AliEMCALAodCluster() :
+ AliAODCaloCluster(),fRecalibrated(0)
+{
+ // ctor
+}
+//____________________________________________________________________________
+AliEMCALAodCluster::AliEMCALAodCluster(const AliAODCaloCluster & clu) :
+ AliAODCaloCluster(clu),fRecalibrated(0)
+{
+ // cpy ctor
+}
+
+//____________________________________________________________________________
+AliEMCALAodCluster::~AliEMCALAodCluster()
+{
+ // dtor
+}
+//____________________________________________________________________________
+void AliEMCALAodCluster::Recalibrate(AliEMCALCalibData * calibData, AliAODCaloCells *emcCells, TString emcalGeoName){
+ //If not done yet, apply recalibration coefficients to energies list
+ //NOTE that after recalibration fCellsAmpFraction contains not FRACTION but FULL energy
+
+ if(fRecalibrated)
+ return ;
+
+ if(!calibData)
+ return ;
+
+ AliEMCALGeometry * emcalgeo = AliEMCALGeometry::GetInstance(emcalGeoName) ;
+ if(!emcalgeo)
+ AliFatal("AliEMCALGeometry was not constructed\n") ;
+
+ Double32_t * cellsAmpFraction = GetCellsAmplitudeFraction();
+ Int_t iSupMod = -1;
+ Int_t iTower = -1;
+ Int_t iIphi = -1;
+ Int_t iIeta = -1;
+ Int_t iphi = -1;
+ Int_t ieta = -1;
+
+ for(Int_t i=0; i < GetNCells(); i++){
+
+ //Get from the absid the supermodule, tower and eta/phi numbers
+ emcalgeo->GetCellIndex(GetCellAbsId(i),iSupMod,iTower,iIphi,iIeta);
+ //Gives SuperModule and Tower numbers
+ emcalgeo->GetCellPhiEtaIndexInSModule(iSupMod,iTower,
+ iIphi, iIeta,iphi,ieta);
+
+ Double_t energy = emcCells->GetCellAmplitude(GetCellAbsId(i)) ;
+ AliDebug(2,Form("Recalibrate: cell %f, calib %f, fraction %f\n",energy,calibData->GetADCchannel(iSupMod,ieta,iphi),cellsAmpFraction[i]));
+ cellsAmpFraction[i]*=energy*calibData->GetADCchannel(iSupMod,ieta,iphi);
+ }
+
+ SetCellsAmplitudeFraction(cellsAmpFraction);
+ fRecalibrated=kTRUE;
+}
+//____________________________________________________________________________
+void AliEMCALAodCluster::EvalAll(Float_t logWeight, TString geoname){
+ //If recalibrated - recalculate all cluster parameters
+ if(!fRecalibrated)
+ return ;
+ //printf("EvalAll e org %f\n",E());
+ EvalEnergy() ; //Energy should be evaluated first
+ //printf("EvalAll e2 %f\n",E());
+ EvalPositionAndShowerShape(logWeight, geoname) ;
+ //printf("EvalAll e3 %f\n",E());
+ EvalPID() ; //Should be evaluated after energy and shower shape recalculation
+ //printf("EvalAll e4 %f\n",E());
+}
+//____________________________________________________________________________
+void AliEMCALAodCluster::EvalEnergy(){
+ //Evaluate energy
+ if(!fRecalibrated) // no need to recalibrate
+ return ;
+
+ Float_t energy=0. ;
+ for(Int_t iDigit=0; iDigit < GetNCells(); iDigit++) {
+ energy+=GetCellAmplitudeFraction(iDigit) ;
+ }
+ //printf("EvalEnergy: e %f\n", energy);
+ SetE(energy);
+
+
+}
+////____________________________________________________________________________
+//void AliEMCALAodCluster::EnergyCorrection(AliEMCALPID * pid){
+// //apply nonlinearity correction same as in AliEMCALPID.
+// SetE(pid->GetCalibratedEnergy(E())) ;
+//}
+
+//____________________________________________________________________________
+void AliEMCALAodCluster::EvalPID(){
+
+ //re-evaluate identification parameters
+// pid->CalculatePID(E(),GetDispersion(),GetEmcCpvDistance(),GetTOF(),GetPID()) ;
+// pid->CalculatePID(E(),GetDispersion(),GetM20(),GetM02(),GetEmcCpvDistance(),GetTOF(),GetPID()) ;
+
+ //With bayesian
+ AliEMCALPID *pid = new AliEMCALPID(kFALSE);
+ pid->SetLowFluxParam(); // Need to be fixed
+ Float_t pidlist[AliPID::kSPECIESN+1];
+ for(Int_t i = 0; i < AliPID::kSPECIESN+1; i++) pidlist[i] = pid->GetPIDFinal(i);
+ SetPIDFromESD(pidlist);
+
+}
+
+//____________________________________________________________________________
+void AliEMCALAodCluster::EvalPositionAndShowerShape(Float_t logWeight, TString emcalGeoName)
+{
+ // Calculates new center of gravity in the local EMCAL-module coordinates
+ // and tranfers into global ALICE coordinates
+ // Calculates Dispersion and main axis
+ if(!fRecalibrated) // no need to recalibrate
+ return ;
+
+ Int_t nstat = 0;
+ Float_t wtot = 0. ;
+
+ Int_t idMax = -1;
+ Int_t iSupMod = -1;
+ Int_t iTower = -1;
+ Int_t iIphi = -1;
+ Int_t iIeta = -1;
+ Int_t iphi = -1;
+ Int_t ieta = -1;
+ Double_t etai = -1.;
+ Double_t phii = -1.;
+
+ Double_t clXYZ[3] ={0.,0.,0.};
+ Double_t xyzi[3] ={0.,0.,0.};
+
+ Double_t d = 0.;
+ Double_t dxx = 0.;
+ Double_t dzz = 0.;
+ Double_t dxz = 0.;
+ Double_t xmean = 0.;
+ Double_t zmean = 0.;
+
+ AliEMCALGeometry * emcalgeo = AliEMCALGeometry::GetInstance(emcalGeoName) ;
+ if(!emcalgeo)
+ AliFatal("AliEMCALGeometry was not constructed\n") ;
+
+ Double_t dist = 0;
+ for(Int_t iDigit=0; iDigit < GetNCells(); iDigit++) {
+ if(iDigit==0) {
+ //Check if this maximum at 0 is true!!
+ idMax = GetCellAbsId(iDigit);
+ dist = TmaxInCm(Double_t(GetCellAmplitudeFraction(iDigit)),0);
+ }
+
+ //Get from the absid the supermodule, tower and eta/phi numbers
+ emcalgeo->GetCellIndex(GetCellAbsId(iDigit),iSupMod,iTower,iIphi,iIeta);
+ emcalgeo->RelPosCellInSModule(GetCellAbsId(iDigit),idMax, dist, xyzi[0], xyzi[1], xyzi[2]);
+ emcalgeo->GetCellPhiEtaIndexInSModule(iSupMod,iTower,iIphi,iIeta, iphi,ieta);
+
+ Double_t ei = GetCellAmplitudeFraction(iDigit) ;
+ if (E() > 0 && ei > 0) {
+ Float_t w = ei;
+ if(logWeight > 0) w = TMath::Max( 0., logWeight + TMath::Log(ei/E()) ) ;
+ etai=(Double_t)ieta;
+ phii=(Double_t)iphi;
+ if(w > 0.0) {
+ wtot += w ;
+ nstat++;
+ for(Int_t i = 0; i < 3; i++ ) clXYZ[i] += (w*xyzi[i]);
+
+ //Shower shape
+ dxx += w * etai * etai ;
+ xmean+= w * etai ;
+ dzz += w * phii * phii ;
+ zmean+= w * phii ;
+ dxz += w * etai * phii ;
+ }
+ }
+ else
+ AliError(Form("Wrong energy %f and/or amplitude %f\n", ei, E()));
+ }
+
+ //Normalize to the weight
+ if (wtot > 0) {
+ for(Int_t i=0; i<3; i++ ) clXYZ[i] /= wtot;
+ xmean /= wtot ;
+ zmean /= wtot ;
+ }
+ else
+ AliError(Form("Wrong weight %f\n", wtot));
+
+ //Put cluster position in the global system
+ TVector3 gpos ;
+ emcalgeo->GetGlobal(clXYZ, gpos, iSupMod);
+
+ SetPosition(0, gpos[0]) ;
+ SetPosition(1, gpos[1]) ;
+ SetPosition(2, gpos[2]) ;
+
+ //Calculate dispersion
+ for(Int_t iDigit=0; iDigit < GetNCells(); iDigit++) {
+ //Get from the absid the supermodule, tower and eta/phi numbers
+ emcalgeo->GetCellIndex(GetCellAbsId(iDigit),iSupMod,iTower,iIphi,iIeta);
+ emcalgeo->GetCellPhiEtaIndexInSModule(iSupMod,iTower,iIphi,iIeta, iphi,ieta);
+
+ Double_t ei=GetCellAmplitudeFraction(iDigit) ;
+ if (E() > 0 && ei > 0) {
+ Float_t w = ei;
+ if(logWeight > 0) w = TMath::Max( 0., logWeight + TMath::Log(ei/E()) ) ;
+ etai=(Double_t)ieta;
+ phii=(Double_t)iphi;
+ if(w > 0.0) d += w*((etai-xmean)*(etai-xmean)+(phii-zmean)*(phii-zmean));
+ }
+ else
+ AliError(Form("Wrong energy %f and/or amplitude %f\n", ei, E()));
+ }
+
+ //Normalize to the weigth and set shower shape parameters
+ if (wtot > 0 && nstat > 1) {
+ d /= wtot ;
+ dxx /= wtot ;
+ dzz /= wtot ;
+ dxz /= wtot ;
+ dxx -= xmean * xmean ;
+ dzz -= zmean * zmean ;
+ dxz -= xmean * zmean ;
+ SetM02(0.5 * (dxx + dzz) + TMath::Sqrt( 0.25 * (dxx - dzz) * (dxx - dzz) + dxz * dxz )) ;
+ SetM20(0.5 * (dxx + dzz) - TMath::Sqrt( 0.25 * (dxx - dzz) * (dxx - dzz) + dxz * dxz ));
+ }
+ else{
+ d=0. ;
+ SetM20(0.) ;
+ SetM02(0.) ;
+ }
+
+ if (d>=0)
+ SetDispersion(TMath::Sqrt(d)) ;
+ else
+ SetDispersion(0) ;
+
+}
+
+//_____________________________________________________________________
+Double_t AliEMCALAodCluster::TmaxInCm(const Double_t e , const Int_t key) const
+{
+ // e energy in GeV)
+ // key = 0(gamma, default)
+ // != 0(electron)
+ static Double_t ca = 4.82; // shower max parameter - first guess; ca=TMath::Log(1000./8.07)
+ static Double_t x0 = 1.23; // radiation lenght (cm)
+ static Double_t tmax = 0.; // position of electromagnetic shower max in cm
+
+ tmax = 0.0;
+ if(e>0.1) {
+ tmax = TMath::Log(e) + ca;
+ if (key==0) tmax += 0.5;
+ else tmax -= 0.5;
+ tmax *= x0; // convert to cm
+ }
+ return tmax;
+}
+
--- /dev/null
+#ifndef ALIEMCALAODCLUSTER_H
+#define ALIEMCALAODCLUSTER_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+//_________________________________________________________________________
+// AliAodCaloCluster version for EMCAL (used for recalibration)
+// Copy-paste from methods in AliEMCALRecPoint.
+//
+//*-- Author: Dmitri Peressounko (RRC KI) for PHOS
+//*-- Adapted for EMCAL: Gustavo Conesa (INFN-LNF)
+
+// --- ROOT system ---
+class TVector3;
+// --- Standard library ---
+
+// --- AliRoot header files ---
+//class AliEMCALPID ;
+class AliEMCALCalibData ;
+class AliAODCaloCells ;
+#include "AliAODCaloCluster.h"
+
+class AliEMCALAodCluster : public AliAODCaloCluster {
+
+public:
+
+ AliEMCALAodCluster() ;
+ AliEMCALAodCluster(const AliAODCaloCluster & clu) ;
+
+ virtual ~AliEMCALAodCluster() ;
+
+ void EvalAll(Float_t logWeight, TString geoname) ; //re-calculate all cluster parameters
+ void Recalibrate(AliEMCALCalibData * calibData, AliAODCaloCells *phsCells, TString geoname) ; //Apply recalibration to this cluster
+// void EnergyCorrection(AliEMCALPID * pid) ; //Apply non-linearity correction
+ void EvalPID() ; //re-evaluate identification parameters
+
+protected:
+
+ Double_t TmaxInCm(const Double_t e , const Int_t key) const ; //Cluster max depth used in EvalPositionAndShowerShape
+ void EvalPositionAndShowerShape(Float_t logWeight, TString geoname) ; //calculate coordinate-related parameters (position, dispersion)
+ void EvalEnergy() ; //re-calculate energy of the cluster
+
+ Bool_t fRecalibrated ; //Has this cluster been recalibrated?
+
+ ClassDef(AliEMCALAodCluster,1) // (EMCAL AOD cluster)
+
+};
+
+#endif // AliEMCALAODCLUSTER_H
SetTitle(calibda.GetName());
Reset();
- Int_t nSMod = 12;
- Int_t nCol = 48;
- Int_t nRow = 24;
- Int_t nRow2 = 12; //Modules 11 and 12 are half modules
+ Int_t nSMod = AliEMCALGeoParams::fgkEMCALModules; //12
+ Int_t nCol = AliEMCALGeoParams::fgkEMCALCols; //48
+ Int_t nRow = AliEMCALGeoParams::fgkEMCALRows; //24
+ Int_t nRow2 = AliEMCALGeoParams::fgkEMCALRows; //12 - Modules 11 and 12 are half modules
for(Int_t supermodule=0; supermodule<nSMod; supermodule++) {
if(supermodule >= 10)
SetTitle(calibda.GetName());
Reset();
- Int_t nSMod = 12;
- Int_t nCol = 48;
- Int_t nRow = 24;
- Int_t nRow2 = 12; //Modules 11 and 12 are half modules
+ Int_t nSMod = AliEMCALGeoParams::fgkEMCALModules; //12
+ Int_t nCol = AliEMCALGeoParams::fgkEMCALCols; //48
+ Int_t nRow = AliEMCALGeoParams::fgkEMCALRows; //24
+ Int_t nRow2 = AliEMCALGeoParams::fgkEMCALRows/2; //12 - Modules 11 and 12 are half modules
for(Int_t supermodule=0; supermodule<nSMod; supermodule++) {
if(supermodule >= 10)
void AliEMCALCalibData::Reset()
{
// Set all pedestals to 0 and all ADC channels widths to 1
- memset(fADCchannel ,1,12*48*24*sizeof(Float_t));
- memset(fADCpedestal,0,12*48*24*sizeof(Float_t));
+ //memset(fADCchannel ,1,12*48*24*sizeof(Float_t));
+ //memset(fADCpedestal,0,12*48*24*sizeof(Float_t));
+ Int_t nSMod = AliEMCALGeoParams::fgkEMCALModules; //12
+ Int_t nCol = AliEMCALGeoParams::fgkEMCALCols; //48
+ Int_t nRow = AliEMCALGeoParams::fgkEMCALRows; //24
+ Int_t nRow2 = AliEMCALGeoParams::fgkEMCALRows/2; //12 - Modules 11 and 12 are half modules
+ for (Int_t supermodule=0; supermodule<nSMod; supermodule++){
+ if(supermodule >= 10)
+ nRow = nRow2;
+ for (Int_t column=0; column<nCol; column++){
+ for (Int_t row=0; row<nRow; row++){
+ fADCpedestal[supermodule][column][row]=0.;
+ fADCchannel [supermodule][column][row]=1.;
+ }
+ }
+ }
}
//________________________________________________________________
{
// Print tables of pedestals and ADC channels widths
- Int_t nSMod = 12;
- Int_t nCol = 48;
- Int_t nRow = 24;
- Int_t nRow2 = 12; //Modules 11 and 12 are half modules
+ Int_t nSMod = AliEMCALGeoParams::fgkEMCALModules; //12
+ Int_t nCol = AliEMCALGeoParams::fgkEMCALCols; //48
+ Int_t nRow = AliEMCALGeoParams::fgkEMCALRows; //24
+ Int_t nRow2 = AliEMCALGeoParams::fgkEMCALRows/2; //12 - Modules 11 and 12 are half modules
if (strstr(option,"ped")) {
printf("\n ---- Pedestal values ----\n\n");
for (Int_t supermodule=0; supermodule<nSMod; supermodule++){
////////////////////////////////////////////////
#include "TNamed.h"
+#include "AliEMCALGeoParams.h"
class AliEMCALCalibData: public TNamed {
void SetADCpedestal(Int_t module, Int_t column, Int_t row, Float_t value);
protected:
- Float_t fADCchannel[12][48][24] ; // width of one ADC channel in GeV ([mod][col][row])
- Float_t fADCpedestal[12][48][24] ; // value of the ADC pedestal ([mod][col][row])
+ Float_t fADCchannel [AliEMCALGeoParams::fgkEMCALModules][AliEMCALGeoParams::fgkEMCALCols][AliEMCALGeoParams::fgkEMCALRows] ; // width of one ADC channel in GeV ([mod][col][row])
+ Float_t fADCpedestal[AliEMCALGeoParams::fgkEMCALModules][AliEMCALGeoParams::fgkEMCALCols][AliEMCALGeoParams::fgkEMCALRows] ; // value of the ADC pedestal ([mod][col][row])
//
ClassDef(AliEMCALCalibData,1) // EMCAL Calibration data
};
}
//____________________________________________________________________________
-void AliEMCALCalibTimeDepCorrection::InitCorrection(Int_t nSM, Int_t nBins, Float_t val=1.0)
+void AliEMCALCalibTimeDepCorrection::InitCorrection(Int_t nSM, Int_t nBins, Float_t val)
{
// This methods assumes that you are using SuperModules 0..nSM-1
fNSuperModule = nSM;
/* $Id: $ */
#include <TObject.h>
+#include <TArrayF.h>
#include "AliEMCALGeoParams.h"
class TString;
class TArrayF;
AliEMCALCalibTimeDepCorrection();
// interface methods; getting the whole struct should be more efficient though
- void InitCorrection(Int_t nSM, Int_t nBins, Float_t val); // assign a certain value to all
+ void InitCorrection(Int_t nSM, Int_t nBins, Float_t val=1.0); // assign a certain value to all
// use the methods below with caution: take care that your argument ranges are valid
void SetCorrection(Int_t smIndex, Int_t iCol, Int_t iRow, Int_t iBin, Float_t val=1.0); // assign a certain value to a given bin
Float_t GetCorrection(Int_t smIndex, Int_t iCol, Int_t iRow, Int_t iBin) const; // assign a certain value to a given bin
}
+//____________________________________________________________________________
+AliEMCALClusterizerv1::AliEMCALClusterizerv1(AliEMCALGeometry* geometry, AliEMCALCalibData * calib)
+: AliEMCALClusterizer(),
+fGeom(geometry),
+fDefaultInit(kFALSE),
+fToUnfold(kFALSE),
+fNumberOfECAClusters(0),fCalibData(calib),
+fADCchannelECA(0.),fADCpedestalECA(0.),fECAClusteringThreshold(0.),fECALocMaxCut(0.),
+fECAW0(0.),fTimeCut(0.),fMinECut(0.)
+{
+ // ctor, geometry and calibration are initialized elsewhere.
+
+ if (!fGeom)
+ AliFatal("Geometry not initialized.");
+
+ if(!gMinuit)
+ gMinuit = new TMinuit(100) ;
+
+}
+
+
//____________________________________________________________________________
AliEMCALClusterizerv1::~AliEMCALClusterizerv1()
{
AliEMCALClusterizerv1() ;
AliEMCALClusterizerv1(AliEMCALGeometry* geometry);
-
+ AliEMCALClusterizerv1(AliEMCALGeometry* geometry, AliEMCALCalibData * calib);
+
virtual ~AliEMCALClusterizerv1() ;
virtual Int_t AreNeighbours(AliEMCALDigit * d1, AliEMCALDigit * d2)const ;
virtual void SetMinECut(Float_t mine) { fMinECut = mine; }
virtual void SetECALocalMaxCut(Float_t cut) { fECALocMaxCut = cut ; }
virtual void SetECALogWeight(Float_t w) { fECAW0 = w ; }
- virtual void SetTimeCut(Float_t gate) { fTimeCut = gate ;}
+ virtual void SetTimeCut(Float_t gate) { fTimeCut = gate ;}
virtual void SetUnfolding(Bool_t toUnfold = kTRUE ) {fToUnfold = toUnfold ;}
static Double_t ShowerShape(Double_t x, Double_t y) ; // Shape of EM shower used in unfolding;
//class member function (not object member function)
virtual const char * Version() const { return "clu-v1" ; }
void PrintRecoInfo(); //*MENU*
-
+ void SetCalibrationParameters(AliEMCALCalibData * calib) { fCalibData = calib ; }
+
protected:
virtual void MakeClusters();
--- /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: AliEMCALEMCGeometry.cxx 29514 2008-10-26 10:24:38Z hristov $*/
+
+//_________________________________________________________________________
+// Geometry class for EMCAL : singleton
+// EMCAL consists of layers of scintillator and lead
+// with scintillator fiber arranged as "shish-kebab" skewers
+// Places the the Barrel Geometry of The EMCAL at Midrapidity
+// between 80 and 180(or 190) degrees of Phi and
+// -0.7 to 0.7 in eta
+//
+// EMCAL geometry tree:
+// EMCAL -> superModule -> module -> tower(cell)
+// Indexes
+// absId -> nSupMod -> nModule -> (nIphi,nIeta)
+//
+// Name choices:
+// EMCAL_PDC06 (geometry used for PDC06 simulations, kept for backward compatibility)
+// = equivalent to SHISH_77_TRD1_2X2_FINAL_110DEG in old notation
+// EMCAL_COMPLETE (geometry for expected complete detector)
+// = equivalent to SHISH_77_TRD1_2X2_FINAL_110DEG scTh=0.176 pbTh=0.144
+// in old notation
+// EMCAL_WSUC (Wayne State test stand)
+// = no definite equivalent in old notation, was only used by
+// Aleksei, but kept for testing purposes
+//
+// etc.
+//
+//
+//
+//*-- Author: Sahal Yacoob (LBL / UCT)
+// and : Yves Schutz (SUBATECH)
+// and : Jennifer Klay (LBL)
+// and : Aleksei Pavlinov (WSU)
+// and : Magali Estienne (SUBATECH)
+
+// --- Root header files ---
+#include <TObjArray.h>
+#include <TObjString.h>
+#include <TRegexp.h>
+
+// -- ALICE Headers.
+#include "AliLog.h"
+
+// --- EMCAL headers
+#include "AliEMCALEMCGeometry.h"
+#include <cassert>
+
+ClassImp(AliEMCALEMCGeometry)
+
+// these initialisations are needed for a singleton
+Bool_t AliEMCALEMCGeometry::fgInit = kFALSE;
+const Char_t* AliEMCALEMCGeometry::fgkDefaultGeometryName = "EMCAL_COMPLETE";
+
+
+AliEMCALEMCGeometry::AliEMCALEMCGeometry()
+ : TNamed(),
+ fGeoName(0),fArrayOpts(0),fNAdditionalOpts(0),fECPbRadThickness(0.),fECScintThick(0.),
+ fNECLayers(0),fArm1PhiMin(0.),fArm1PhiMax(0.),fArm1EtaMin(0.),fArm1EtaMax(0.),fIPDistance(0.),
+ fShellThickness(0.),fZLength(0.),fNZ(0),fNPhi(0),fSampling(0.),fNumberOfSuperModules(0),
+ fFrontSteelStrip(0.),fLateralSteelStrip(0.),fPassiveScintThick(0.),fPhiModuleSize(0.),
+ fEtaModuleSize(0.),fPhiTileSize(0.),fEtaTileSize(0.),fLongModuleSize(0.),fNPhiSuperModule(0),
+ fNPHIdiv(0),fNETAdiv(0), fNCells(0),fNCellsInSupMod(0),fNCellsInModule(0),
+ // Trigger staff
+ fNTRUEta(0), fNTRUPhi(0), fNModulesInTRUEta(0), fNModulesInTRUPhi(0), fNEtaSubOfTRU(0),
+ //
+ fTrd1Angle(0.),f2Trd1Dx2(0.),
+ fPhiGapForSM(0.),fKey110DEG(0),fPhiBoundariesOfSM(0), fPhiCentersOfSM(0),fEtaMaxOfTRD1(0),
+ fCentersOfCellsEtaDir(0), fCentersOfCellsXDir(0),fCentersOfCellsPhiDir(0),
+ fEtaCentersOfCells(0),fPhiCentersOfCells(0),fShishKebabTrd1Modules(0),
+ fILOSS(-1), fIHADR(-1),
+ //obsolete member data
+ fAlFrontThick(0.), fGap2Active(0.), fSteelFrontThick(0.), fTrd2AngleY(0.),
+ f2Trd2Dy2(0.), fEmptySpace(0.), fTubsR(0.), fTubsTurnAngle(0.)
+{
+ // default ctor only for internal usage (singleton)
+ // must be kept public for root persistency purposes,
+ // but should never be called by the outside world
+
+ AliDebug(2, "AliEMCALEMCGeometry : default ctor ");
+}
+//______________________________________________________________________
+AliEMCALEMCGeometry::AliEMCALEMCGeometry(const Text_t* name, const Text_t* title) :
+ TNamed(name,title),
+ fGeoName(0),fArrayOpts(0),fNAdditionalOpts(0),fECPbRadThickness(0.),fECScintThick(0.),
+ fNECLayers(0),fArm1PhiMin(0.),fArm1PhiMax(0.),fArm1EtaMin(0.),fArm1EtaMax(0.),fIPDistance(0.),
+ fShellThickness(0.),fZLength(0.),fNZ(0),fNPhi(0),fSampling(0.),fNumberOfSuperModules(0),
+ fFrontSteelStrip(0.),fLateralSteelStrip(0.),fPassiveScintThick(0.),fPhiModuleSize(0.),
+ fEtaModuleSize(0.),fPhiTileSize(0.),fEtaTileSize(0.),fLongModuleSize(0.),fNPhiSuperModule(0),
+ fNPHIdiv(0),fNETAdiv(0), fNCells(0),fNCellsInSupMod(0),fNCellsInModule(0),
+ // Trigger staff
+ fNTRUEta(0), fNTRUPhi(0), fNModulesInTRUEta(0), fNModulesInTRUPhi(0), fNEtaSubOfTRU(0),
+ //
+ fTrd1Angle(0.),f2Trd1Dx2(0.),
+ fPhiGapForSM(0.),fKey110DEG(0),fPhiBoundariesOfSM(0), fPhiCentersOfSM(0), fEtaMaxOfTRD1(0),
+ fCentersOfCellsEtaDir(0),fCentersOfCellsXDir(0),fCentersOfCellsPhiDir(0),
+ fEtaCentersOfCells(0),fPhiCentersOfCells(0),fShishKebabTrd1Modules(0),
+ fILOSS(-1), fIHADR(-1),
+ //obsolete member data
+ fAlFrontThick(0.), fGap2Active(0.), fSteelFrontThick(0.), fTrd2AngleY(0.),
+ f2Trd2Dy2(0.), fEmptySpace(0.), fTubsR(0.), fTubsTurnAngle(0.)
+{
+ // ctor only for internal usage (singleton)
+ AliDebug(2, Form("AliEMCALEMCGeometry(%s,%s) ", name,title));
+
+ Init();
+
+ // CreateListOfTrd1Modules();
+
+ if (AliDebugLevel()>=2) {
+ PrintGeometry();
+ }
+
+}
+//______________________________________________________________________
+AliEMCALEMCGeometry::AliEMCALEMCGeometry(const AliEMCALEMCGeometry& geom)
+ : TNamed(geom),
+ fGeoName(geom.fGeoName),
+ fArrayOpts(geom.fArrayOpts),
+ fNAdditionalOpts(geom.fNAdditionalOpts),
+ fECPbRadThickness(geom.fECPbRadThickness),
+ fECScintThick(geom.fECScintThick),
+ fNECLayers(geom.fNECLayers),
+ fArm1PhiMin(geom.fArm1PhiMin),
+ fArm1PhiMax(geom.fArm1PhiMax),
+ fArm1EtaMin(geom.fArm1EtaMin),
+ fArm1EtaMax(geom.fArm1EtaMax),
+ fIPDistance(geom.fIPDistance),
+ fShellThickness(geom.fShellThickness),
+ fZLength(geom.fZLength),
+ fNZ(geom.fNZ),
+ fNPhi(geom.fNPhi),
+ fSampling(geom.fSampling),
+ fNumberOfSuperModules(geom.fNumberOfSuperModules),
+ fFrontSteelStrip(geom.fFrontSteelStrip),
+ fLateralSteelStrip(geom.fLateralSteelStrip),
+ fPassiveScintThick(geom.fPassiveScintThick),
+ fPhiModuleSize(geom.fPhiModuleSize),
+ fEtaModuleSize(geom.fEtaModuleSize),
+ fPhiTileSize(geom.fPhiTileSize),
+ fEtaTileSize(geom.fEtaTileSize),
+ fLongModuleSize(geom.fLongModuleSize),
+ fNPhiSuperModule(geom.fNPhiSuperModule),
+ fNPHIdiv(geom.fNPHIdiv),
+ fNETAdiv(geom.fNETAdiv),
+ fNCells(geom.fNCells),
+ fNCellsInSupMod(geom.fNCellsInSupMod),
+ fNCellsInModule(geom.fNCellsInModule),
+ // Trigger staff
+ fNTRUEta(geom.fNTRUEta),
+ fNTRUPhi(geom.fNTRUPhi),
+ fNModulesInTRUEta(geom.fNModulesInTRUEta),
+ fNModulesInTRUPhi(geom.fNModulesInTRUPhi),
+ fNEtaSubOfTRU(geom.fNEtaSubOfTRU),
+ //
+ fTrd1Angle(geom.fTrd1Angle),
+ f2Trd1Dx2(geom.f2Trd1Dx2),
+ fPhiGapForSM(geom.fPhiGapForSM),
+ fKey110DEG(geom.fKey110DEG),
+ fPhiBoundariesOfSM(geom.fPhiBoundariesOfSM),
+ fPhiCentersOfSM(geom.fPhiCentersOfSM),
+ fEtaMaxOfTRD1(geom.fEtaMaxOfTRD1),
+ fCentersOfCellsEtaDir(geom.fCentersOfCellsEtaDir),
+ fCentersOfCellsXDir(geom.fCentersOfCellsXDir),
+ fCentersOfCellsPhiDir(geom.fCentersOfCellsPhiDir),
+ fEtaCentersOfCells(geom.fEtaCentersOfCells),
+ fPhiCentersOfCells(geom.fPhiCentersOfCells),
+ fShishKebabTrd1Modules(geom.fShishKebabTrd1Modules),
+ fILOSS(geom.fILOSS), fIHADR(geom.fIHADR),
+ //obsolete member data
+ fAlFrontThick(geom.fAlFrontThick),
+ fGap2Active(geom.fGap2Active),
+ fSteelFrontThick(geom.fSteelFrontThick),
+ fTrd2AngleY(geom.fTrd2AngleY),
+ f2Trd2Dy2(geom.f2Trd2Dy2),
+ fEmptySpace(geom.fEmptySpace),
+ fTubsR(geom.fTubsR),
+ fTubsTurnAngle(geom.fTubsTurnAngle)
+{
+ //copy ctor
+}
+
+//______________________________________________________________________
+AliEMCALEMCGeometry::~AliEMCALEMCGeometry(void){
+ // dtor
+}
+
+//______________________________________________________________________
+void AliEMCALEMCGeometry::Init(void){
+ //
+ // Initializes the EMCAL parameters based on the name
+ // Only Shashlyk geometry is available, but various combinations of
+ // layers and number of supermodules can be selected with additional
+ // options or geometry name
+ //
+
+ fkAdditionalOpts[0] = "nl="; // number of sampling layers (fNECLayers)
+ fkAdditionalOpts[1] = "pbTh="; // cm, Thickness of the Pb (fECPbRadThick)
+ fkAdditionalOpts[2] = "scTh="; // cm, Thickness of the Sc (fECScintThick)
+ fkAdditionalOpts[3] = "latSS="; // cm, Thickness of lateral steel strip (fLateralSteelStrip)
+ fkAdditionalOpts[4] = "allILOSS="; // = 0,1,2,3,4 (4 - energy loss without fluctuation)
+ fkAdditionalOpts[5] = "allIHADR="; // = 0,1,2 (0 - no hadronic interaction)
+
+ fNAdditionalOpts = sizeof(fkAdditionalOpts) / sizeof(char*);
+
+ // geometry
+ fgInit = kFALSE; // Assume failed until proven otherwise.
+ fGeoName = GetName();
+ fGeoName.ToUpper();
+
+ //Convert old geometry names to new ones
+ if(fGeoName.Contains("SHISH_77_TRD1_2X2_FINAL_110DEG")) {
+ if(fGeoName.Contains("PBTH=0.144") && fGeoName.Contains("SCTH=0.176")) {
+ fGeoName = "EMCAL_COMPLETE";
+ } else {
+ fGeoName = "EMCAL_PDC06";
+ }
+ }
+ if(fGeoName.Contains("WSUC")) fGeoName = "EMCAL_WSUC";
+
+ //check that we have a valid geometry name
+ if(!(fGeoName.Contains("EMCAL_PDC06") || fGeoName.Contains("EMCAL_COMPLETE") || fGeoName.Contains("EMCAL_WSUC") || fGeoName.Contains("EMCAL_1stYear"))) {
+ Fatal("Init", "%s is an undefined geometry!", fGeoName.Data()) ;
+ }
+
+ // Option to know whether we have the "half" supermodule(s) or not
+ fKey110DEG = 0;
+ if(fGeoName.Contains("COMPLETE") || fGeoName.Contains("PDC06")) fKey110DEG = 1; // for GetAbsCellId
+ fShishKebabTrd1Modules = 0;
+
+ // JLK 13-Apr-2008
+ //default parameters are those of EMCAL_COMPLETE geometry
+ //all others render variations from these at the end of
+ //geometry-name specific options
+
+ fNumberOfSuperModules = 12; // 12 = 6 * 2 (6 in phi, 2 in Z)
+ fNPhi = 12; // module granularity in phi within smod (azimuth)
+ fNZ = 24; // module granularity along Z within smod (eta)
+ fNPHIdiv = fNETAdiv = 2; // tower granularity within module
+ fArm1PhiMin = 80.0; // degrees, Starting EMCAL Phi position
+ fArm1PhiMax = 200.0; // degrees, Ending EMCAL Phi position
+ fArm1EtaMin = -0.7; // pseudorapidity, Starting EMCAL Eta position
+ fArm1EtaMax = +0.7; // pseudorapidity, Ending EMCAL Eta position
+ fIPDistance = 428.0; // cm, radial distance to front face from nominal vertex point
+ fPhiGapForSM = 2.; // cm, only for final TRD1 geometry
+ fFrontSteelStrip = 0.025; // 0.025cm = 0.25mm (13-may-05 from V.Petrov)
+ fPassiveScintThick = 0.8; // 0.8cm = 8mm (13-may-05 from V.Petrov)
+ fLateralSteelStrip = 0.01; // 0.01cm = 0.1mm (13-may-05 from V.Petrov) - was 0.025
+ fTrd1Angle = 1.5; // in degrees
+
+ fSampling = 1.; // should be calculated with call to DefineSamplingFraction()
+ fNECLayers = 77; // (13-may-05 from V.Petrov) - can be changed with additional options
+ fECScintThick = 0.176; // scintillator layer thickness
+ fECPbRadThickness = 0.144; // lead layer thickness
+
+ fPhiModuleSize = 12.26 - fPhiGapForSM / Float_t(fNPhi); // first assumption
+ fEtaModuleSize = fPhiModuleSize;
+
+ fZLength = 700.; // Z coverage (cm)
+
+
+ //needs to be called for each geometry and before setting geometry
+ //parameters which can depend on the outcome
+ CheckAdditionalOptions();
+
+ //modifications to the above for PDC06 geometry
+ if(fGeoName.Contains("PDC06")){ // 18-may-05 - about common structure
+ fECScintThick = fECPbRadThickness = 0.16;// (13-may-05 from V.Petrov)
+ CheckAdditionalOptions();
+ }
+
+ //modifications to the above for WSUC geometry
+ if(fGeoName.Contains("WSUC")){ // 18-may-05 - about common structure
+ fPhiModuleSize = 12.5; // 20-may-05 - rectangular shape
+ fEtaModuleSize = 11.9;
+ fECScintThick = fECPbRadThickness = 0.16;// (13-may-05 from V.Petrov)
+ fNumberOfSuperModules = 1; // 27-may-05
+ fShellThickness = 30.; // should be change
+ fNPhi = fNZ = 4;
+ CheckAdditionalOptions();
+ }
+
+ if(fGeoName.Contains("1stYear")){
+ fNumberOfSuperModules = 2;
+
+ if(fGeoName.Contains("LowerEta")) {
+ fNPhiSuperModule = 1;
+ }
+ else if(fGeoName.Contains("LowerPhi_SideA")){
+ fNPhiSuperModule = 2;
+ fArm1EtaMax=0;
+ }
+ else if(fGeoName.Contains("LowerPhi_SideC")){
+ fNPhiSuperModule = 2;
+ fArm1EtaMin=0;
+ }
+
+ CheckAdditionalOptions();
+ }
+
+ // constant for transition absid <--> indexes
+ fNCellsInModule = fNPHIdiv*fNETAdiv;
+ fNCellsInSupMod = fNCellsInModule*fNPhi*fNZ;
+ fNCells = fNCellsInSupMod*fNumberOfSuperModules;
+ if(GetKey110DEG()) fNCells -= fNCellsInSupMod;
+
+ fNPhiSuperModule = fNumberOfSuperModules/2;
+ if(fNPhiSuperModule < 1) fNPhiSuperModule = 1;
+
+ fPhiTileSize = fPhiModuleSize/double(fNPHIdiv) - fLateralSteelStrip; // 13-may-05
+ fEtaTileSize = fEtaModuleSize/double(fNETAdiv) - fLateralSteelStrip; // 13-may-05
+
+ fLongModuleSize = fNECLayers*(fECScintThick + fECPbRadThickness);
+ f2Trd1Dx2 = fEtaModuleSize + 2.*fLongModuleSize*TMath::Tan(fTrd1Angle*TMath::DegToRad()/2.);
+ if(!fGeoName.Contains("WSUC")) fShellThickness = TMath::Sqrt(fLongModuleSize*fLongModuleSize + f2Trd1Dx2*f2Trd1Dx2);
+
+ //These parameters are used to create the mother volume to hold the supermodules
+ //2cm padding added to allow for misalignments - JLK 30-May-2008
+ fEnvelop[0] = fIPDistance - 1.; // mother volume inner radius
+ fEnvelop[1] = fIPDistance + fShellThickness + 1.; // mother volume outer r.
+ fEnvelop[2] = fZLength + 2.; //mother volume length
+
+ // Local coordinates
+ fParSM[0] = GetShellThickness()/2.;
+ fParSM[1] = GetPhiModuleSize() * GetNPhi()/2.;
+ fParSM[2] = fZLength/4.; //divide by 4 to get half-length of SM
+
+ // SM phi boundaries - (0,1),(2,3) .. (10,11) - has the same boundaries; Nov 7, 2006
+ fPhiBoundariesOfSM.Set(fNumberOfSuperModules);
+ fPhiCentersOfSM.Set(fNumberOfSuperModules/2);
+ fPhiBoundariesOfSM[0] = TMath::PiOver2() - TMath::ATan2(fParSM[1] , fIPDistance); // 1th and 2th modules)
+ fPhiCentersOfSM[0] = TMath::PiOver2();
+ if(fNumberOfSuperModules > 1)
+ fPhiBoundariesOfSM[1] = TMath::PiOver2() + TMath::ATan2(fParSM[1] , fIPDistance);
+ if(fNumberOfSuperModules > 2) {
+ for(int i=1; i<=4; i++) { // from 2th ro 9th
+ fPhiBoundariesOfSM[2*i] = fPhiBoundariesOfSM[0] + 20.*TMath::DegToRad()*i;
+ fPhiBoundariesOfSM[2*i+1] = fPhiBoundariesOfSM[1] + 20.*TMath::DegToRad()*i;
+ fPhiCentersOfSM[i] = fPhiCentersOfSM[0] + 20.*TMath::DegToRad()*i;
+ }
+ }
+ if(fNumberOfSuperModules > 10) {
+ fPhiBoundariesOfSM[11] = 190.*TMath::DegToRad();
+ fPhiBoundariesOfSM[10] = fPhiBoundariesOfSM[11] - TMath::ATan2((fParSM[1]) , fIPDistance);
+ fPhiCentersOfSM[5] = (fPhiBoundariesOfSM[10]+fPhiBoundariesOfSM[11])/2.;
+ }
+
+ //called after setting of scintillator and lead layer parameters
+ DefineSamplingFraction();
+
+
+ // TRU parameters - Apr 29,08 by PAI.
+ // These parameters values was updated at Nov 05, 2007
+ // As is on Olivier BOURRION (LPSC) ppt preasentation
+ // at ALICE trigger meeting at 13th-14th March
+ fNTRUEta = 1; // was 3
+ fNTRUPhi = 3; // was 1
+ fNModulesInTRUEta = 24; // was 8
+ fNModulesInTRUPhi = 4; // was 12
+ // Jet trigger
+ // 3*6*10 + 2*6*2 = 204 -> matrix (nphi(17), neta(12))
+ fNEtaSubOfTRU = 6;
+
+
+ fgInit = kTRUE;
+}
+
+//___________________________________________________________________
+void AliEMCALEMCGeometry::PrintGeometry()
+{
+ // Separate routine is callable from broswer; Nov 7,2006
+ printf("\nInit: geometry of EMCAL named %s :\n", fGeoName.Data());
+ if(fArrayOpts) {
+ for(Int_t i=0; i<fArrayOpts->GetEntries(); i++){
+ TObjString *o = (TObjString*)fArrayOpts->At(i);
+ printf(" %i : %s \n", i, o->String().Data());
+ }
+ }
+ printf("Granularity: %d in eta and %d in phi\n", GetNZ(), GetNPhi()) ;
+ printf("Layout: phi = (%7.1f, %7.1f), eta = (%5.2f, %5.2f), IP = %7.2f -> for EMCAL envelope only\n",
+ GetArm1PhiMin(), GetArm1PhiMax(),GetArm1EtaMin(), GetArm1EtaMax(), GetIPDistance() );
+
+ printf( " ECAL : %d x (%f cm Pb, %f cm Sc) \n",
+ GetNECLayers(), GetECPbRadThick(), GetECScintThick() ) ;
+ printf(" fSampling %5.2f \n", fSampling );
+ printf(" fIPDistance %6.3f cm \n", fIPDistance);
+ printf(" fNPhi %i | fNZ %i \n", fNPhi, fNZ);
+ printf(" fNCellsInModule %i : fNCellsInSupMod %i : fNCells %i\n",fNCellsInModule, fNCellsInSupMod, fNCells);
+ printf(" X:Y module size %6.3f , %6.3f cm \n", fPhiModuleSize, fEtaModuleSize);
+ printf(" X:Y tile size %6.3f , %6.3f cm \n", fPhiTileSize, fEtaTileSize);
+ printf(" #of sampling layers %i(fNECLayers) \n", fNECLayers);
+ printf(" fLongModuleSize %6.3f cm \n", fLongModuleSize);
+ printf(" #supermodule in phi direction %i \n", fNPhiSuperModule );
+ printf(" fILOSS %i : fIHADR %i \n", fILOSS, fIHADR);
+ printf(" fTrd1Angle %7.4f\n", fTrd1Angle);
+ printf(" f2Trd1Dx2 %7.4f\n", f2Trd1Dx2);
+ printf("SM dimensions(TRD1) : dx %7.2f dy %7.2f dz %7.2f (SMOD, BOX)\n",
+ fParSM[0],fParSM[1],fParSM[2]);
+ printf(" fPhiGapForSM %7.4f cm (%7.4f <- phi size in degree)\n",
+ fPhiGapForSM, TMath::ATan2(fPhiGapForSM,fIPDistance)*TMath::RadToDeg());
+ if(GetKey110DEG()) printf(" Last two modules have size 10 degree in phi (180<phi<190)\n");
+ printf(" phi SM boundaries \n");
+ for(int i=0; i<fPhiBoundariesOfSM.GetSize()/2.; i++) {
+ printf(" %i : %7.5f(%7.2f) -> %7.5f(%7.2f) : center %7.5f(%7.2f) \n", i,
+ fPhiBoundariesOfSM[2*i], fPhiBoundariesOfSM[2*i]*TMath::RadToDeg(),
+ fPhiBoundariesOfSM[2*i+1], fPhiBoundariesOfSM[2*i+1]*TMath::RadToDeg(),
+ fPhiCentersOfSM[i], fPhiCentersOfSM[i]*TMath::RadToDeg());
+ }
+
+}
+
+//______________________________________________________________________
+void AliEMCALEMCGeometry::CheckAdditionalOptions()
+{
+ // Feb 06,2006
+ // Additional options that
+ // can be used to select
+ // the specific geometry of
+ // EMCAL to run
+ // Dec 27,2006
+ // adeed allILOSS= and allIHADR= for MIP investigation
+ fArrayOpts = new TObjArray;
+ Int_t nopt = ParseString(fGeoName, *fArrayOpts);
+ if(nopt==1) { // no aditional option(s)
+ fArrayOpts->Delete();
+ delete fArrayOpts;
+ fArrayOpts = 0;
+ return;
+ }
+ for(Int_t i=1; i<nopt; i++){
+ TObjString *o = (TObjString*)fArrayOpts->At(i);
+
+ TString addOpt = o->String();
+ Int_t indj=-1;
+ for(Int_t j=0; j<fNAdditionalOpts; j++) {
+ TString opt = fkAdditionalOpts[j];
+ if(addOpt.Contains(opt,TString::kIgnoreCase)) {
+ indj = j;
+ break;
+ }
+ }
+ if(indj<0) {
+ AliDebug(2,Form("<E> option |%s| unavailable : ** look to the file AliEMCALGeometry.h **\n",
+ addOpt.Data()));
+ assert(0);
+ } else {
+ AliDebug(2,Form("<I> option |%s| is valid : number %i : |%s|\n",
+ addOpt.Data(), indj, fkAdditionalOpts[indj]));
+ if (addOpt.Contains("NL=",TString::kIgnoreCase)) {// number of sampling layers
+ sscanf(addOpt.Data(),"NL=%i", &fNECLayers);
+ AliDebug(2,Form(" fNECLayers %i (new) \n", fNECLayers));
+ } else if(addOpt.Contains("PBTH=",TString::kIgnoreCase)) {//Thickness of the Pb(fECPbRadThicknes)
+ sscanf(addOpt.Data(),"PBTH=%f", &fECPbRadThickness);
+ } else if(addOpt.Contains("SCTH=",TString::kIgnoreCase)) {//Thickness of the Sc(fECScintThick)
+ sscanf(addOpt.Data(),"SCTH=%f", &fECScintThick);
+ } else if(addOpt.Contains("LATSS=",TString::kIgnoreCase)) {// Thickness of lateral steel strip (fLateralSteelStrip)
+ sscanf(addOpt.Data(),"LATSS=%f", &fLateralSteelStrip);
+ AliDebug(2,Form(" fLateralSteelStrip %f (new) \n", fLateralSteelStrip));
+ } else if(addOpt.Contains("ILOSS=",TString::kIgnoreCase)) {// As in Geant
+ sscanf(addOpt.Data(),"ALLILOSS=%i", &fILOSS);
+ AliDebug(2,Form(" fILOSS %i \n", fILOSS));
+ } else if(addOpt.Contains("IHADR=",TString::kIgnoreCase)) {// As in Geant
+ sscanf(addOpt.Data(),"ALLIHADR=%i", &fIHADR);
+ AliDebug(2,Form(" fIHADR %i \n", fIHADR));
+ }
+ }
+ }
+}
+
+//__________________________________________________________________
+void AliEMCALEMCGeometry::DefineSamplingFraction()
+{
+ // Jun 05,2006
+ // Look http://rhic.physics.wayne.edu/~pavlinov/ALICE/SHISHKEBAB/RES/linearityAndResolutionForTRD1.html
+ // Keep for compatibilty
+ //
+ if(fNECLayers == 69) { // 10% layer reduction
+ fSampling = 12.55;
+ } else if(fNECLayers == 61) { // 20% layer reduction
+ fSampling = 12.80;
+ } else if(fNECLayers == 77) {
+ if (fECScintThick>0.159 && fECScintThick<0.161) { // original sampling fraction, equal layers
+ fSampling = 12.327; // fECScintThick = fECPbRadThickness = 0.160;
+ } else if (fECScintThick>0.175 && fECScintThick<0.177) { // 10% Pb thicknes reduction
+ fSampling = 10.5; // fECScintThick = 0.176, fECPbRadThickness=0.144;
+ } else if(fECScintThick>0.191 && fECScintThick<0.193) { // 20% Pb thicknes reduction
+ fSampling = 8.93; // fECScintThick = 0.192, fECPbRadThickness=0.128;
+ }
+
+ }
+}
+
+//________________________________________________________________________________________________
+Double_t AliEMCALEMCGeometry::GetPhiCenterOfSM(Int_t nsupmod) const
+{
+ //returns center of supermodule in phi
+ int i = nsupmod/2;
+ return fPhiCentersOfSM[i];
+
+}
+
+//________________________________________________________________________________________________
+Bool_t AliEMCALEMCGeometry::GetPhiBoundariesOfSM(Int_t nSupMod, Double_t &phiMin, Double_t &phiMax) const
+{
+ // 0<= nSupMod <=11; phi in rad
+ static int i;
+ if(nSupMod<0 || nSupMod >11) return kFALSE;
+ i = nSupMod/2;
+ phiMin = (Double_t)fPhiBoundariesOfSM[2*i];
+ phiMax = (Double_t)fPhiBoundariesOfSM[2*i+1];
+ return kTRUE;
+}
+
+//________________________________________________________________________________________________
+Bool_t AliEMCALEMCGeometry::GetPhiBoundariesOfSMGap(Int_t nPhiSec, Double_t &phiMin, Double_t &phiMax) const
+{
+ // 0<= nPhiSec <=4; phi in rad
+ // 0; gap boundaries between 0th&2th | 1th&3th SM
+ // 1; gap boundaries between 2th&4th | 3th&5th SM
+ // 2; gap boundaries between 4th&6th | 5th&7th SM
+ // 3; gap boundaries between 6th&8th | 7th&9th SM
+ // 4; gap boundaries between 8th&10th | 9th&11th SM
+ if(nPhiSec<0 || nPhiSec >4) return kFALSE;
+ phiMin = fPhiBoundariesOfSM[2*nPhiSec+1];
+ phiMax = fPhiBoundariesOfSM[2*nPhiSec+2];
+ return kTRUE;
+}
+
+//________________________________________________________________________________________________
+int AliEMCALEMCGeometry::ParseString(const TString &topt, TObjArray &Opt)
+{
+ //Parse string, does what? GCB 08/09
+ Ssiz_t begin, index, end, end2;
+ begin = index = end = end2 = 0;
+ TRegexp separator("[^ ;,\\t\\s/]+");
+ while ( (begin < topt.Length()) && (index != kNPOS) ) {
+ // loop over given options
+ index = topt.Index(separator,&end,begin);
+ if (index >= 0 && end >= 1) {
+ TString substring(topt(index,end));
+ Opt.Add(new TObjString(substring.Data()));
+ }
+ begin += end+1;
+ }
+ return Opt.GetEntries();
+}
+
--- /dev/null
+#ifndef ALIEMCALEMCGEOMETRY_H
+#define ALIEMCALEMCGEOMETRY_H
+/* Copyright(c) 1998-2004, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+/* $Id: AliEMCALEMCGeometry.h 26174 2008-05-26 20:27:16Z jklay $ */
+
+//_________________________________________________________________________
+// Geometry class for EMCAL : singleton
+// EMCAL consists of a layers of scintillator, and lead.
+//
+//*-- Author: Sahal Yacoob (LBL / UCT)
+//*-- and : Yves Schutz (Subatech)
+//*-- and : Aleksei Pavlinov (WSU) - shashlyk staff
+//*-- and : Gustavo Conesa: Add TRU mapping. TRU parameters still not fixed.
+//*-- and : Magali Estienne (Subatech): class added for new library for EMCALGeoUtils.par file
+
+// --- ROOT system ---
+#include <TMath.h>
+#include <TArrayD.h>
+#include <TNamed.h>
+class TString ;
+class TObjArray;
+class Riostream;
+
+// --- AliRoot header files ---
+class AliEMCALEMCGeometry;
+class AliEMCALShishKebabTrd1Module;
+
+class AliEMCALEMCGeometry : public TNamed {
+public:
+ AliEMCALEMCGeometry(); // default ctor only for internal usage (singleton)
+ AliEMCALEMCGeometry(const AliEMCALEMCGeometry& geom);
+ // ctor only for internal usage (singleton)
+ AliEMCALEMCGeometry(const Text_t* name, const Text_t* title);
+
+ virtual ~AliEMCALEMCGeometry(void);
+
+ AliEMCALEMCGeometry & operator = (const AliEMCALEMCGeometry & /*rvalue*/) {
+ // assignement operator requested by coding convention but not needed
+ Fatal("operator =", "not implemented");
+ return *this;
+ };
+
+ //////////
+ // General
+ //
+ Bool_t IsInitialized(void) const { return fgInit ; }
+ static const Char_t* GetDefaultGeometryName() {return fgkDefaultGeometryName;}
+ void PrintGeometry(); //*MENU*
+
+ void Init(void); // initializes the parameters of EMCAL
+ void CheckAdditionalOptions(); //
+ void DefineSamplingFraction(); // Jun 5, 2006
+
+ //////////////////////////////////////
+ // Return EMCAL geometrical parameters
+ //
+
+ TString GetGeoName() const {return fGeoName;}
+ const Char_t* GetNameOfEMCALEnvelope() const { const Char_t* env = "XEN1"; return env ;}
+ Float_t GetArm1PhiMin() const { return fArm1PhiMin ; }
+ Float_t GetArm1PhiMax() const { return fArm1PhiMax ; }
+ Float_t GetArm1EtaMin() const { return fArm1EtaMin;}
+ Float_t GetArm1EtaMax() const { return fArm1EtaMax;}
+ Float_t GetIPDistance() const { return fIPDistance;}
+ Float_t GetEnvelop(Int_t index) const { return fEnvelop[index] ; }
+ Float_t GetShellThickness() const { return fShellThickness ; }
+ Float_t GetZLength() const { return fZLength ; }
+ Int_t GetNECLayers() const {return fNECLayers ;}
+ Int_t GetNZ() const {return fNZ ;}
+ Int_t GetNEta() const {return fNZ ;}
+ Int_t GetNPhi() const {return fNPhi ;}
+ Float_t GetECPbRadThick()const {return fECPbRadThickness;}
+ Float_t GetECScintThick() const {return fECScintThick;}
+ Float_t GetSampling() const {return fSampling ; }
+ Int_t GetNumberOfSuperModules() const {return fNumberOfSuperModules;}
+ Float_t GetfPhiGapForSuperModules() const {return fPhiGapForSM;}
+ Float_t GetPhiModuleSize() const {return fPhiModuleSize;}
+ Float_t GetEtaModuleSize() const {return fEtaModuleSize;}
+ Float_t GetFrontSteelStrip() const {return fFrontSteelStrip;}
+ Float_t GetLateralSteelStrip() const {return fLateralSteelStrip;}
+ Float_t GetPassiveScintThick() const {return fPassiveScintThick;}
+ Float_t GetPhiTileSize() const {return fPhiTileSize;}
+ Float_t GetEtaTileSize() const {return fEtaTileSize;}
+ Int_t GetNPhiSuperModule() const {return fNPhiSuperModule;}
+ Int_t GetNPHIdiv() const {return fNPHIdiv ;}
+ Int_t GetNETAdiv() const {return fNETAdiv ;}
+ Int_t GetNCells() const {return fNCells;}
+ Float_t GetLongModuleSize() const {return fLongModuleSize;}
+ Float_t GetTrd1Angle() const {return fTrd1Angle;}
+ Float_t Get2Trd1Dx2() const {return f2Trd1Dx2;}
+ Float_t GetEtaMaxOfTRD1() const {return fEtaMaxOfTRD1;}
+ // --
+ Int_t GetNCellsInSupMod() const {return fNCellsInSupMod;}
+ Int_t GetNCellsInModule() const {return fNCellsInModule; }
+ Int_t GetKey110DEG() const {return fKey110DEG;}
+ Int_t GetILOSS() const {return fILOSS;}
+ Int_t GetIHADR() const {return fIHADR;}
+ // For gamma(Jet) trigger simulations
+ Int_t GetNTRU() const {return fNTRUEta*fNTRUPhi ; }
+ Int_t GetNTRUEta() const {return fNTRUEta ; }
+ Int_t GetNTRUPhi() const {return fNTRUPhi ; }
+ Int_t GetNEtaSubOfTRU() const {return fNEtaSubOfTRU;}
+ Int_t GetNModulesInTRU() const {return fNModulesInTRUEta*fNModulesInTRUPhi; }
+ Int_t GetNModulesInTRUEta() const {return fNModulesInTRUEta ; }
+ Int_t GetNModulesInTRUPhi() const {return fNModulesInTRUPhi ; }
+
+ // --
+ Float_t GetDeltaEta() const {return (fArm1EtaMax-fArm1EtaMin)/ ((Float_t)fNZ);}
+ Float_t GetDeltaPhi() const {return (fArm1PhiMax-fArm1PhiMin)/ ((Float_t)fNPhi);}
+ Int_t GetNTowers() const {return fNPhi * fNZ ;}
+ //
+ Double_t GetPhiCenterOfSM(Int_t nsupmod) const;
+ Float_t *GetSuperModulesPars() {return fParSM;}
+ //
+ Bool_t GetPhiBoundariesOfSM (Int_t nSupMod, Double_t &phiMin, Double_t &phiMax) const;
+ Bool_t GetPhiBoundariesOfSMGap(Int_t nPhiSec, Double_t &phiMin, Double_t &phiMax) const;
+ //
+ // Local Coordinates of SM
+/* TArrayD GetCentersOfCellsEtaDir() const {return fCentersOfCellsEtaDir;} // size fNEta*fNETAdiv (for TRD1 only) (eta or z in SM, in cm) */
+/* TArrayD GetCentersOfCellsXDir() const {return fCentersOfCellsXDir;} // size fNEta*fNETAdiv (for TRD1 only) ( x in SM, in cm) */
+/* TArrayD GetCentersOfCellsPhiDir() const {return fCentersOfCellsPhiDir;} // size fNPhi*fNPHIdiv (for TRD1 only) (phi or y in SM, in cm) */
+/* // */
+/* TArrayD GetEtaCentersOfCells() const {return fEtaCentersOfCells;} // [fNEta*fNETAdiv*fNPhi*fNPHIdiv], positive direction (eta>0); eta depend from phi position; */
+/* TArrayD GetPhiCentersOfCells() const {return fPhiCentersOfCells;} // [fNPhi*fNPHIdiv] from center of SM (-10. < phi < +10.) */
+
+ static int ParseString(const TString &topt, TObjArray &Opt) ;
+
+ ///////////////////////////////
+ //Geometry data member setters
+ //
+ void SetNZ(Int_t nz) { fNZ= nz;
+ printf("SetNZ: Number of modules in Z set to %d", fNZ) ; }
+ void SetNPhi(Int_t nphi) { fNPhi= nphi;
+ printf("SetNPhi: Number of modules in Phi set to %d", fNPhi) ; }
+ void SetNTRUEta(Int_t ntru) {fNTRUEta = ntru;
+ printf("SetNTRU: Number of TRUs per SuperModule in Etaset to %d", fNTRUEta) ;}
+ void SetNTRUPhi(Int_t ntru) {fNTRUPhi = ntru;
+ printf("SetNTRU: Number of TRUs per SuperModule in Phi set to %d", fNTRUPhi) ;}
+ void SetSampling(Float_t samp) { fSampling = samp;
+ printf("SetSampling: Sampling factor set to %f", fSampling) ; }
+
+ ///////////////////
+ // useful utilities
+ //
+ Float_t AngleFromEta(Float_t eta) const { // returns theta in radians for a given pseudorapidity
+ return 2.0*TMath::ATan(TMath::Exp(-eta));
+ }
+ Float_t ZFromEtaR(Float_t r,Float_t eta) const { // returns z in for a given
+ // pseudorapidity and r=sqrt(x*x+y*y).
+ return r/TMath::Tan(AngleFromEta(eta));
+ }
+
+ //////////////////////////////////////////////////
+ // Obsolete methods to be thrown out when feasible
+ Float_t GetAlFrontThickness() const { return fAlFrontThick;}
+ Float_t GetGap2Active() const {return fGap2Active ;}
+ Float_t GetSteelFrontThickness() const { return fSteelFrontThick;}
+ Float_t GetTrd2AngleY()const {return fTrd2AngleY;}
+ Float_t Get2Trd2Dy2() const {return f2Trd2Dy2;}
+ Float_t GetTubsR() const {return fTubsR;}
+ Float_t GetTubsTurnAngle() const {return fTubsTurnAngle;}
+ Float_t GetIP2ECASection() const { return ( GetIPDistance() + GetAlFrontThickness()
+ + GetGap2Active() ) ; }
+ //////////////////////////////////////////////////
+
+ static Bool_t fgInit; // Tells if geometry has been succesfully set up.
+ static const Char_t* fgkDefaultGeometryName; // Default name of geometry
+
+private:
+
+ // Member data
+
+ TString fGeoName; //geometry name
+
+ TObjArray *fArrayOpts; //! array of geometry options
+ const char *fkAdditionalOpts[6]; //! some additional options for the geometry type and name
+ int fNAdditionalOpts; //! size of additional options parameter
+
+ Float_t fECPbRadThickness; // cm, Thickness of the Pb radiators
+ Float_t fECScintThick; // cm, Thickness of the scintillators
+ Int_t fNECLayers; // number of scintillator layers
+
+ Float_t fArm1PhiMin; // Minimum angular position of EMCAL in Phi (degrees)
+ Float_t fArm1PhiMax; // Maximum angular position of EMCAL in Phi (degrees)
+ Float_t fArm1EtaMin; // Minimum pseudorapidity position of EMCAL in Eta
+ Float_t fArm1EtaMax; // Maximum pseudorapidity position of EMCAL in Eta
+
+ // Geometry Parameters
+ Float_t fEnvelop[3]; // the GEANT TUB for the detector
+ Float_t fIPDistance; // Radial Distance of the inner surface of the EMCAL
+ Float_t fShellThickness; // Total thickness in (x,y) direction
+ Float_t fZLength; // Total length in z direction
+ Int_t fNZ; // Number of Towers in the Z direction
+ Int_t fNPhi; // Number of Towers in the PHI direction
+ Float_t fSampling; // Sampling factor
+
+ // Shish-kebab option - 23-aug-04 by PAI; COMPACT, TWIST, TRD1 and TRD2
+ Int_t fNumberOfSuperModules; // default is 12 = 6 * 2
+ Float_t fFrontSteelStrip; // 13-may-05
+ Float_t fLateralSteelStrip; // 13-may-05
+ Float_t fPassiveScintThick; // 13-may-05
+ Float_t fPhiModuleSize; // Phi -> X
+ Float_t fEtaModuleSize; // Eta -> Y
+ Float_t fPhiTileSize; // Size of phi tile
+ Float_t fEtaTileSize; // Size of eta tile
+ Float_t fLongModuleSize; // Size of long module
+ Int_t fNPhiSuperModule; // 6 - number supermodule in phi direction
+ Int_t fNPHIdiv; // number phi divizion of module
+ Int_t fNETAdiv; // number eta divizion of module
+ //
+ Int_t fNCells; // number of cells in calo
+ Int_t fNCellsInSupMod; // number cell in super module
+ Int_t fNCellsInModule; // number cell in module)
+ //TRU parameters
+ Int_t fNTRUEta ; // Number of TRUs per module in eta
+ Int_t fNTRUPhi ; // Number of TRUs per module in phi
+ Int_t fNModulesInTRUEta; // Number of modules per TRU in eta
+ Int_t fNModulesInTRUPhi; // Number of modules per TRU in phi
+ Int_t fNEtaSubOfTRU; // Number of eta (z) subregiohi
+
+ // TRD1 options - 30-sep-04
+ Float_t fTrd1Angle; // angle in x-z plane (in degree)
+ Float_t f2Trd1Dx2; // 2*dx2 for TRD1
+ Float_t fPhiGapForSM; // Gap betweeen supermodules in phi direction
+ Int_t fKey110DEG; // for calculation abs cell id; 19-oct-05
+ TArrayD fPhiBoundariesOfSM; // phi boundaries of SM in rad; size is fNumberOfSuperModules;
+ TArrayD fPhiCentersOfSM; // phi of centers of SMl size is fNumberOfSuperModules/2
+ Float_t fEtaMaxOfTRD1; // max eta in case of TRD1 geometry (see AliEMCALShishKebabTrd1Module)
+ // Local Coordinates of SM
+ TArrayD fCentersOfCellsEtaDir; // size fNEta*fNETAdiv (for TRD1 only) (eta or z in SM, in cm)
+ TArrayD fCentersOfCellsXDir; // size fNEta*fNETAdiv (for TRD1 only) ( x in SM, in cm)
+ TArrayD fCentersOfCellsPhiDir; // size fNPhi*fNPHIdiv (for TRD1 only) (phi or y in SM, in cm)
+ //
+ TArrayD fEtaCentersOfCells; // [fNEta*fNETAdiv*fNPhi*fNPHIdiv], positive direction (eta>0); eta depend from phi position;
+ TArrayD fPhiCentersOfCells; // [fNPhi*fNPHIdiv] from center of SM (-10. < phi < +10.)
+ // Move from AliEMCALv0 - Feb 19, 2006
+ TList *fShishKebabTrd1Modules; //! list of modules
+ // Local coordinates of SM for TRD1
+ Float_t fParSM[3]; // SM sizes as in GEANT (TRD1)
+
+ Int_t fILOSS; // Options for Geant (MIP business) - will call in AliEMCAL
+ Int_t fIHADR; // Options for Geant (MIP business) - will call in AliEMCAL
+
+ ////////////////////////////////////////////////////////////
+ //Obsolete member data that will be thrown out when feasible
+ //
+ Float_t fAlFrontThick; // Thickness of the front Al face of the support box
+ Float_t fGap2Active; // Gap between the envelop and the active material
+ Float_t fSteelFrontThick; // Thickness of the front stell face of the support box - 9-sep-04
+ // TRD2 options - 27-jan-07
+ Float_t fTrd2AngleY; // angle in y-z plane (in degree)
+ Float_t f2Trd2Dy2; // 2*dy2 for TRD2
+ Float_t fEmptySpace; // 2mm om fred drawing
+ // Super module as TUBS
+ Float_t fTubsR; // radius of tubs
+ Float_t fTubsTurnAngle; // turn angle of tubs in degree
+
+ ///////////////////////////////////////////////////////////
+
+ ClassDef(AliEMCALEMCGeometry, 1) // EMCAL geometry class
+};
+
+#endif // AliEMCALEMCGEOMETRY_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: AliEMCALGeoUtils.cxx 25590 2008-05-06 07:09:11Z prsnko $ */
+
+//_________________________________________________________________________
+// Geometry class for EMCAL : singleton
+//
+// -- Author: Magali Estienne (magali.estienne@subatech.in2p3.fr)
+
+//
+// Usage:
+// You can create the AliEMCALGeoUtils object independently from anything.
+// You have to use just the correct name of geometry. If name is empty string the
+// default name of geometry will be used.
+//
+// AliEMCALGeoUtils* geom = new AliEMCALGeoUtils("EMCAL_COMPLETE","EMCAL");
+// TGeoManager::Import("geometry.root");
+//
+// MC: If you work with MC data you have to get geometry the next way:
+// == =============================
+// !!!!!!!!! This part has to be modified
+// AliRunLoader *rl = AliRunLoader::GetRunLoader();
+// AliEMCALEMCGeometry *geom = dynamic_cast<AliEMCAL*>(rl->GetAliRun()->GetDetector("EMCAL"))->GetGeometry();
+// TGeoManager::Import("geometry.root");
+
+
+// --- ROOT system ---
+
+#include <TParticle.h>
+#include <TGeoManager.h>
+#include <TGeoMatrix.h>
+#include <TList.h>
+#include <TBrowser.h>
+
+// --- Standard library ---
+//#include <Riostream.h>
+
+// --- AliRoot header files ---
+#include "AliEMCALGeoUtils.h"
+#include "AliEMCALShishKebabTrd1Module.h"
+
+ClassImp(AliEMCALGeoUtils)
+
+//____________________________________________________________________________
+AliEMCALGeoUtils::AliEMCALGeoUtils():
+ fEMCGeometry(0x0),fGeoName(0),
+ fKey110DEG(0),fNCellsInSupMod(0),fNETAdiv(0),fNPHIdiv(0),
+ fNCellsInModule(0),fPhiBoundariesOfSM(0x0),fPhiCentersOfSM(0x0),
+ fPhiCentersOfCells(0x0),fCentersOfCellsEtaDir(0x0),
+ fCentersOfCellsPhiDir(0x0),fEtaCentersOfCells(0x0),
+ fNCells(0),fNPhi(0),fCentersOfCellsXDir(0x0),fArm1EtaMin(0),
+ fArm1EtaMax(0),fArm1PhiMin(0),fArm1PhiMax(0),fEtaMaxOfTRD1(0),
+ fShishKebabTrd1Modules(0),fParSM(0x0),fPhiModuleSize(0.),
+ fEtaModuleSize(0.),fPhiTileSize(0.),fEtaTileSize(0.),fNZ(0),
+ fIPDistance(0.),fLongModuleSize(0.),fShellThickness(0.),
+ fZLength(0.),fSampling(0.)
+{
+ // default ctor
+ // must be kept public for root persistency purposes, but should never be called by the outside world
+ fEnvelop[0] = 0.;
+ fEnvelop[1] = 0.;
+ fEnvelop[2] = 0.;
+
+}
+
+//____________________________________________________________________________
+AliEMCALGeoUtils::AliEMCALGeoUtils(const AliEMCALGeoUtils & geo)
+ : TNamed(geo),
+ fEMCGeometry(geo.fEMCGeometry),fGeoName(geo.fGeoName),
+ fKey110DEG(geo.fKey110DEG),fNCellsInSupMod(geo.fNCellsInSupMod),fNETAdiv(geo.fNETAdiv),fNPHIdiv(geo.fNPHIdiv),
+ fNCellsInModule(geo.fNCellsInModule),fPhiBoundariesOfSM(geo.fPhiBoundariesOfSM),fPhiCentersOfSM(geo.fPhiCentersOfSM),
+ fPhiCentersOfCells(geo.fPhiCentersOfCells),fCentersOfCellsEtaDir(geo.fCentersOfCellsEtaDir),
+ fCentersOfCellsPhiDir(geo.fCentersOfCellsPhiDir),fEtaCentersOfCells(geo.fEtaCentersOfCells),
+ fNCells(geo.fNCells),fNPhi(geo.fNPhi),fCentersOfCellsXDir(geo.fCentersOfCellsXDir),fArm1EtaMin(geo.fArm1EtaMin),
+ fArm1EtaMax(geo.fArm1EtaMax),fArm1PhiMin(geo.fArm1PhiMin),fArm1PhiMax(geo.fArm1PhiMax),fEtaMaxOfTRD1(geo.fEtaMaxOfTRD1),
+ fShishKebabTrd1Modules(geo.fShishKebabTrd1Modules),fParSM(geo.fParSM),fPhiModuleSize(geo.fPhiModuleSize),
+ fEtaModuleSize(geo.fEtaModuleSize),fPhiTileSize(geo.fPhiTileSize),fEtaTileSize(geo.fEtaTileSize),fNZ(geo.fNZ),
+ fIPDistance(geo.fIPDistance),fLongModuleSize(geo.fLongModuleSize),fShellThickness(geo.fShellThickness),
+ fZLength(geo.fZLength),fSampling(geo.fSampling)
+{
+ fEnvelop[0] = geo.fEnvelop[0];
+ fEnvelop[1] = geo.fEnvelop[1];
+ fEnvelop[2] = geo.fEnvelop[2];
+}
+
+//____________________________________________________________________________
+AliEMCALGeoUtils::AliEMCALGeoUtils(const Text_t* name, const Text_t* title)
+ : TNamed(name, title),
+ fEMCGeometry(0x0),fGeoName(0),
+ fKey110DEG(0),fNCellsInSupMod(0),fNETAdiv(0),fNPHIdiv(0),
+ fNCellsInModule(0),fPhiBoundariesOfSM(0x0),fPhiCentersOfSM(0x0),
+ fPhiCentersOfCells(0x0),fCentersOfCellsEtaDir(0x0),
+ fCentersOfCellsPhiDir(0x0),fEtaCentersOfCells(0x0),
+ fNCells(0),fNPhi(0),fCentersOfCellsXDir(0x0),fArm1EtaMin(0),
+ fArm1EtaMax(0),fArm1PhiMin(0),fArm1PhiMax(0),fEtaMaxOfTRD1(0),
+ fShishKebabTrd1Modules(0),fParSM(0x0),fPhiModuleSize(0.),
+ fEtaModuleSize(0.),fPhiTileSize(0.),fEtaTileSize(0.),fNZ(0),
+ fIPDistance(0.),fLongModuleSize(0.),fShellThickness(0.),
+ fZLength(0.),fSampling(0.)
+{
+
+ // ctor only for normal usage
+
+ fEMCGeometry = new AliEMCALEMCGeometry(name,title);
+
+ fGeoName = fEMCGeometry->GetGeoName();
+ fKey110DEG = fEMCGeometry->GetKey110DEG();
+ fNCellsInSupMod = fEMCGeometry->GetNCellsInSupMod();
+ fNETAdiv = fEMCGeometry->GetNETAdiv();
+ fNPHIdiv = fEMCGeometry->GetNPHIdiv();
+ fNCellsInModule = fNPHIdiv*fNETAdiv;
+ static int i;
+ Int_t nSMod = fEMCGeometry->GetNumberOfSuperModules();
+ fPhiBoundariesOfSM.Set(nSMod);
+ fPhiCentersOfSM.Set(nSMod/2);
+ for(Int_t sm=0; sm<nSMod; sm++) {
+ i = sm/2;
+ fEMCGeometry->GetPhiBoundariesOfSM(sm,fPhiBoundariesOfSM[2*i],fPhiBoundariesOfSM[2*i+1]);
+ }
+
+ Double_t phiMin = 0.;
+ Double_t phiMax = 0.;
+ for(Int_t sm=0; sm<nSMod; sm++) {
+ fEMCGeometry->GetPhiBoundariesOfSM(sm,phiMin,phiMax);
+ i=sm/2;
+ fPhiCentersOfSM[i] = fEMCGeometry->GetPhiCenterOfSM(sm);
+ }
+ fNCells = fEMCGeometry->GetNCells();
+ fNPhi = fEMCGeometry->GetNPhi();
+ fEnvelop[0] = fEMCGeometry->GetEnvelop(0);
+ fEnvelop[1] = fEMCGeometry->GetEnvelop(1);
+ fEnvelop[2] = fEMCGeometry->GetEnvelop(2);
+ fArm1EtaMin = fEMCGeometry->GetArm1EtaMin();
+ fArm1EtaMax = fEMCGeometry->GetArm1EtaMax();
+ fArm1PhiMin = fEMCGeometry->GetArm1PhiMin();
+ fArm1PhiMax = fEMCGeometry->GetArm1PhiMax();
+ fShellThickness = fEMCGeometry->GetShellThickness();
+ fZLength = fEMCGeometry->GetZLength();
+ fSampling = fEMCGeometry->GetSampling();
+ fParSM = fEMCGeometry->GetSuperModulesPars();
+ fEtaModuleSize = fEMCGeometry->GetEtaModuleSize();
+ fPhiModuleSize = fEMCGeometry->GetPhiModuleSize();
+ fEtaTileSize = fEMCGeometry->GetEtaTileSize();
+ fPhiTileSize = fEMCGeometry->GetPhiTileSize();
+ fNZ = fEMCGeometry->GetNZ();
+ fIPDistance = fEMCGeometry->GetIPDistance();
+ fLongModuleSize = fEMCGeometry->GetLongModuleSize();
+
+ CreateListOfTrd1Modules();
+
+ for(Int_t smod=0; smod < fEMCGeometry->GetNumberOfSuperModules(); smod++)
+ fkSModuleMatrix[smod]=0 ;
+
+ if (AliDebugLevel()>=2) {
+ fEMCGeometry->Print();
+ PrintGeometry();
+ }
+
+}
+
+//____________________________________________________________________________
+AliEMCALGeoUtils & AliEMCALGeoUtils::operator = (const AliEMCALGeoUtils & /*rvalue*/) {
+
+ Fatal("assignment operator", "not implemented") ;
+ return *this ;
+}
+
+//____________________________________________________________________________
+AliEMCALGeoUtils::~AliEMCALGeoUtils(void)
+{
+ // dtor
+ if(fEMCGeometry){
+ delete fEMCGeometry; fEMCGeometry = 0 ;
+ }
+}
+
+
+//________________________________________________________________________________________________
+void AliEMCALGeoUtils::Browse(TBrowser* b)
+{
+ //Browse the modules
+ if(fShishKebabTrd1Modules) b->Add(fShishKebabTrd1Modules);
+}
+
+//________________________________________________________________________________________________
+Bool_t AliEMCALGeoUtils::IsFolder() const
+{
+ //Check if fShishKebabTrd1Modules is in folder
+ if(fShishKebabTrd1Modules) return kTRUE;
+ else return kFALSE;
+}
+
+//________________________________________________________________________________________________
+void AliEMCALGeoUtils::GetGlobal(const Double_t *loc, Double_t *glob, int ind) const
+{
+ // Figure out the global numbering
+ // of a given supermodule from the
+ // local numbering and the transformation
+ // matrix stored by the geometry manager (allows for misaligned
+ // geometry)
+
+// if(ind>=0 && ind < fEMCGeometry->GetNumberOfSuperModules()) {
+// TString volpath = "ALIC_1/XEN1_1/SMOD_";
+// volpath += ind+1;
+//
+// if(fKey110DEG && ind>=10) {
+// volpath = "ALIC_1/XEN1_1/SM10_";
+// volpath += ind-10+1;
+// }
+//
+// if(!gGeoManager->cd(volpath.Data()))
+// AliFatal(Form("AliEMCALGeometry::GeoManager cannot find path %s!",volpath.Data()));
+//
+// TGeoHMatrix* m = gGeoManager->GetCurrentMatrix();
+
+ const TGeoHMatrix* m = GetMatrixForSuperModule(ind);
+ if(m) {
+ m->LocalToMaster(loc, glob);
+ } else {
+ AliFatal("Geo matrixes are not loaded \n") ;
+ }
+// }
+}
+
+//________________________________________________________________________________________________
+void AliEMCALGeoUtils::GetGlobal(const TVector3 &vloc, TVector3 &vglob, int ind) const
+{
+ //Figure out the global numbering
+ //of a given supermodule from the
+ //local numbering given a 3-vector location
+
+ static Double_t tglob[3], tloc[3];
+ vloc.GetXYZ(tloc);
+ GetGlobal(tloc, tglob, ind);
+ vglob.SetXYZ(tglob[0], tglob[1], tglob[2]);
+}
+
+//________________________________________________________________________________________________
+void AliEMCALGeoUtils::GetGlobal(Int_t absId , double glob[3]) const
+{
+ // Alice numbering scheme - Jun 03, 2006
+ static Int_t nSupMod, nModule, nIphi, nIeta;
+ static double loc[3];
+
+ if (!gGeoManager || !gGeoManager->IsClosed()) {
+ AliError("Can't get the global coordinates! gGeoManager doesn't exist or it is still open!");
+ return;
+ }
+
+ glob[0]=glob[1]=glob[2]=0.0; // bad case
+ if(RelPosCellInSModule(absId, loc)) {
+ GetCellIndex(absId, nSupMod, nModule, nIphi, nIeta);
+
+// TString volpath = "ALIC_1/XEN1_1/SMOD_";
+// volpath += (nSupMod+1);
+//
+// if(fKey110DEG && nSupMod>=10) {
+// volpath = "ALIC_1/XEN1_1/SM10_";
+// volpath += (nSupMod-10+1);
+// }
+// if(!gGeoManager->cd(volpath.Data()))
+// AliFatal(Form("GeoManager cannot find path %s!",volpath.Data()));
+//
+// TGeoHMatrix* m = gGeoManager->GetCurrentMatrix();
+ const TGeoHMatrix* m = GetMatrixForSuperModule(nSupMod);
+ if(m) {
+ m->LocalToMaster(loc, glob);
+ } else {
+ AliFatal("Geo matrixes are not loaded \n") ;
+ }
+ }
+}
+
+//___________________________________________________________________
+void AliEMCALGeoUtils::GetGlobal(Int_t absId , TVector3 &vglob) const
+{
+ // Alice numbering scheme - Jun 03, 2006
+ static Double_t glob[3];
+
+ GetGlobal(absId, glob);
+ vglob.SetXYZ(glob[0], glob[1], glob[2]);
+
+}
+
+
+//______________________________________________________________________
+void AliEMCALGeoUtils::PrintCellIndexes(Int_t absId, int pri, const char *tit) const
+{
+ // Service methods
+ Int_t nSupMod, nModule, nIphi, nIeta;
+ Int_t iphi, ieta;
+ TVector3 vg;
+
+ GetCellIndex(absId, nSupMod, nModule, nIphi, nIeta);
+ printf(" %s | absId : %i -> nSupMod %i nModule %i nIphi %i nIeta %i \n", tit, absId, nSupMod, nModule, nIphi, nIeta);
+ if(pri>0) {
+ GetCellPhiEtaIndexInSModule(nSupMod,nModule,nIphi,nIeta, iphi,ieta);
+ printf(" local SM index : iphi %i : ieta %i \n", iphi,ieta);
+ GetGlobal(absId, vg);
+ printf(" vglob : mag %7.2f : perp %7.2f : z %7.2f : eta %6.4f : phi %6.4f(%6.2f) \n",
+ vg.Mag(), vg.Perp(), vg.Z(), vg.Eta(), vg.Phi(), vg.Phi()*TMath::RadToDeg());
+ }
+}
+
+//________________________________________________________________________________________________
+void AliEMCALGeoUtils::EtaPhiFromIndex(Int_t absId,Double_t &eta,Double_t &phi) const
+{
+ // Nov 16, 2006- float to double
+ // version for TRD1 only
+ static TVector3 vglob;
+ GetGlobal(absId, vglob);
+ eta = vglob.Eta();
+ phi = vglob.Phi();
+}
+
+//________________________________________________________________________________________________
+void AliEMCALGeoUtils::EtaPhiFromIndex(Int_t absId,Float_t &eta,Float_t &phi) const
+{
+ // Nov 16,2006 - should be discard in future
+ static TVector3 vglob;
+ GetGlobal(absId, vglob);
+ eta = float(vglob.Eta());
+ phi = float(vglob.Phi());
+}
+
+//
+// == Shish-kebab cases ==
+//
+//________________________________________________________________________________________________
+Int_t AliEMCALGeoUtils::GetAbsCellId(Int_t nSupMod, Int_t nModule, Int_t nIphi, Int_t nIeta) const
+{
+ // 27-aug-04;
+ // corr. 21-sep-04;
+ // 13-oct-05; 110 degree case
+ // May 31, 2006; ALICE numbering scheme:
+ // 0 <= nSupMod < fNumberOfSuperModules
+ // 0 <= nModule < fNPHI * fNZ ( fNPHI * fNZ/2 for fKey110DEG=1)
+ // 0 <= nIphi < fNPHIdiv
+ // 0 <= nIeta < fNETAdiv
+ // 0 <= absid < fNCells
+ static Int_t id=0; // have to change from 0 to fNCells-1
+ if(fKey110DEG == 1 && nSupMod >= 10) { // 110 degree case; last two supermodules
+ id = fNCellsInSupMod*10 + (fNCellsInSupMod/2)*(nSupMod-10);
+ } else {
+ id = fNCellsInSupMod*nSupMod;
+ }
+ id += fNCellsInModule *nModule;
+ id += fNPHIdiv *nIphi;
+ id += nIeta;
+ if(id<0 || id >= fNCells) {
+// printf(" wrong numerations !!\n");
+// printf(" id %6i(will be force to -1)\n", id);
+// printf(" fNCells %6i\n", fNCells);
+// printf(" nSupMod %6i\n", nSupMod);
+// printf(" nModule %6i\n", nModule);
+// printf(" nIphi %6i\n", nIphi);
+// printf(" nIeta %6i\n", nIeta);
+ id = -TMath::Abs(id); // if negative something wrong
+ }
+ return id;
+}
+
+//________________________________________________________________________________________________
+void AliEMCALGeoUtils::GetModuleIndexesFromCellIndexesInSModule(Int_t nSupMod, Int_t iphi, Int_t ieta,
+ Int_t &iphim, Int_t &ietam, Int_t &nModule) const
+{
+ // Transition from cell indexes (ieta,iphi) to module indexes (ietam,iphim, nModule)
+ static Int_t nphi;
+ nphi = GetNumberOfModuleInPhiDirection(nSupMod);
+
+ ietam = ieta/fNETAdiv;
+ iphim = iphi/fNPHIdiv;
+ nModule = ietam * nphi + iphim;
+}
+
+//________________________________________________________________________________________________
+Int_t AliEMCALGeoUtils::GetAbsCellIdFromCellIndexes(Int_t nSupMod, Int_t iphi, Int_t ieta) const
+{
+ // Transition from super module number(nSupMod) and cell indexes (ieta,iphi) to absId
+ static Int_t ietam, iphim, nModule;
+ static Int_t nIeta, nIphi; // cell indexes in module
+
+ GetModuleIndexesFromCellIndexesInSModule(nSupMod, iphi, ieta, ietam, iphim, nModule);
+
+ nIeta = ieta%fNETAdiv;
+ nIeta = fNETAdiv - 1 - nIeta;
+ nIphi = iphi%fNPHIdiv;
+
+ return GetAbsCellId(nSupMod, nModule, nIphi, nIeta);
+}
+
+//________________________________________________________________________________________________
+Bool_t AliEMCALGeoUtils::SuperModuleNumberFromEtaPhi(Double_t eta, Double_t phi, Int_t &nSupMod) const
+{
+ // Return false if phi belongs a phi cracks between SM
+
+ static Int_t i;
+
+ if(TMath::Abs(eta) > fEtaMaxOfTRD1) return kFALSE;
+
+ phi = TVector2::Phi_0_2pi(phi); // move phi to (0,2pi) boundaries
+ for(i=0; i<6; i++) {
+ if(phi>=fPhiBoundariesOfSM[2*i] && phi<=fPhiBoundariesOfSM[2*i+1]) {
+ nSupMod = 2*i;
+ if(eta < 0.0) nSupMod++;
+ AliDebug(1,Form("eta %f phi %f(%5.2f) : nSupMod %i : #bound %i", eta,phi,phi*TMath::RadToDeg(), nSupMod,i));
+ return kTRUE;
+ }
+ }
+ return kFALSE;
+}
+
+
+//________________________________________________________________________________________________
+Bool_t AliEMCALGeoUtils::GetAbsCellIdFromEtaPhi(Double_t eta, Double_t phi, Int_t &absId) const
+{
+ // Nov 17,2006
+ // stay here - phi problem as usual
+ static Int_t nSupMod, i, ieta, iphi, etaShift, nphi;
+ static Double_t absEta=0.0, d=0.0, dmin=0.0, phiLoc;
+ absId = nSupMod = - 1;
+ if(SuperModuleNumberFromEtaPhi(eta, phi, nSupMod)) {
+ // phi index first
+ phi = TVector2::Phi_0_2pi(phi);
+ phiLoc = phi - fPhiCentersOfSM[nSupMod/2];
+ nphi = fPhiCentersOfCells.GetSize();
+ if(nSupMod>=10) {
+ phiLoc = phi - 190.*TMath::DegToRad();
+ nphi /= 2;
+ }
+
+ dmin = TMath::Abs(fPhiCentersOfCells[0]-phiLoc);
+ iphi = 0;
+ for(i=1; i<nphi; i++) {
+ d = TMath::Abs(fPhiCentersOfCells[i] - phiLoc);
+ if(d < dmin) {
+ dmin = d;
+ iphi = i;
+ }
+ // printf(" i %i : d %f : dmin %f : fPhiCentersOfCells[i] %f \n", i, d, dmin, fPhiCentersOfCells[i]);
+ }
+ // odd SM are turned with respect of even SM - reverse indexes
+ AliDebug(2,Form(" iphi %i : dmin %f (phi %f, phiLoc %f ) ", iphi, dmin, phi, phiLoc));
+ // eta index
+ absEta = TMath::Abs(eta);
+ etaShift = iphi*fCentersOfCellsEtaDir.GetSize();
+ dmin = TMath::Abs(fEtaCentersOfCells[etaShift]-absEta);
+ ieta = 0;
+ for(i=1; i<fCentersOfCellsEtaDir.GetSize(); i++) {
+ d = TMath::Abs(fEtaCentersOfCells[i+etaShift] - absEta);
+ if(d < dmin) {
+ dmin = d;
+ ieta = i;
+ }
+ }
+ AliDebug(2,Form(" ieta %i : dmin %f (eta=%f) : nSupMod %i ", ieta, dmin, eta, nSupMod));
+
+ if(eta<0) iphi = (nphi-1) - iphi;
+ absId = GetAbsCellIdFromCellIndexes(nSupMod, iphi, ieta);
+
+ return kTRUE;
+ }
+ return kFALSE;
+}
+
+//________________________________________________________________________________________________
+Bool_t AliEMCALGeoUtils::CheckAbsCellId(Int_t absId) const
+{
+ // May 31, 2006; only trd1 now
+ if(absId<0 || absId >= fNCells) return kFALSE;
+ else return kTRUE;
+}
+
+//________________________________________________________________________________________________
+Bool_t AliEMCALGeoUtils::GetCellIndex(Int_t absId,Int_t &nSupMod,Int_t &nModule,Int_t &nIphi,Int_t &nIeta) const
+{
+ // 21-sep-04; 19-oct-05;
+ // May 31, 2006; ALICE numbering scheme:
+ //
+ // In:
+ // absId - cell is as in Geant, 0<= absId < fNCells;
+ // Out:
+ // nSupMod - super module(SM) number, 0<= nSupMod < fNumberOfSuperModules;
+ // nModule - module number in SM, 0<= nModule < fNCellsInSupMod/fNCellsInSupMod or(/2) for tow last SM (10th and 11th);
+ // nIphi - cell number in phi driection inside module; 0<= nIphi < fNPHIdiv;
+ // nIeta - cell number in eta driection inside module; 0<= nIeta < fNETAdiv;
+ //
+ static Int_t tmp=0, sm10=0;
+ if(!CheckAbsCellId(absId)) return kFALSE;
+
+ sm10 = fNCellsInSupMod*10;
+ if(fKey110DEG == 1 && absId >= sm10) { // 110 degree case; last two supermodules
+ nSupMod = (absId-sm10) / (fNCellsInSupMod/2) + 10;
+ tmp = (absId-sm10) % (fNCellsInSupMod/2);
+ } else {
+ nSupMod = absId / fNCellsInSupMod;
+ tmp = absId % fNCellsInSupMod;
+ }
+
+ nModule = tmp / fNCellsInModule;
+ tmp = tmp % fNCellsInModule;
+ nIphi = tmp / fNPHIdiv;
+ nIeta = tmp % fNPHIdiv;
+
+ return kTRUE;
+}
+
+//________________________________________________________________________________________________
+Int_t AliEMCALGeoUtils::GetSuperModuleNumber(Int_t absId) const
+{
+ // Return the number of the supermodule given the absolute
+ // ALICE numbering id
+
+ static Int_t nSupMod, nModule, nIphi, nIeta;
+ GetCellIndex(absId, nSupMod, nModule, nIphi, nIeta);
+ return nSupMod;
+}
+
+//________________________________________________________________________________________________
+void AliEMCALGeoUtils::GetModulePhiEtaIndexInSModule(Int_t nSupMod, Int_t nModule, int &iphim, int &ietam) const
+{
+ // added nSupMod; - 19-oct-05 !
+ // Alice numbering scheme - Jun 01,2006
+ // ietam, iphi - indexes of module in two dimensional grid of SM
+ // ietam - have to change from 0 to fNZ-1
+ // iphim - have to change from 0 to nphi-1 (fNPhi-1 or fNPhi/2-1)
+ static Int_t nphi;
+
+ if(fKey110DEG == 1 && nSupMod>=10) nphi = fNPhi/2;
+ else nphi = fNPhi;
+
+ ietam = nModule/nphi;
+ iphim = nModule%nphi;
+}
+
+//________________________________________________________________________________________________
+void AliEMCALGeoUtils::GetCellPhiEtaIndexInSModule(Int_t nSupMod, Int_t nModule, Int_t nIphi, Int_t nIeta,
+int &iphi, int &ieta) const
+{
+ //
+ // Added nSupMod; Nov 25, 05
+ // Alice numbering scheme - Jun 01,2006
+ // IN:
+ // nSupMod - super module(SM) number, 0<= nSupMod < fNumberOfSuperModules;
+ // nModule - module number in SM, 0<= nModule < fNCellsInSupMod/fNCellsInSupMod or(/2) for tow last SM (10th and 11th);
+ // nIphi - cell number in phi driection inside module; 0<= nIphi < fNPHIdiv;
+ // nIeta - cell number in eta driection inside module; 0<= nIeta < fNETAdiv;
+ //
+ // OUT:
+ // ieta, iphi - indexes of cell(tower) in two dimensional grid of SM
+ // ieta - have to change from 0 to (fNZ*fNETAdiv-1)
+ // iphi - have to change from 0 to (fNPhi*fNPHIdiv-1 or fNPhi*fNPHIdiv/2-1)
+ //
+ static Int_t iphim, ietam;
+
+ GetModulePhiEtaIndexInSModule(nSupMod,nModule, iphim, ietam);
+ // ieta = ietam*fNETAdiv + (1-nIeta); // x(module) = -z(SM)
+ ieta = ietam*fNETAdiv + (fNETAdiv - 1 - nIeta); // x(module) = -z(SM)
+ iphi = iphim*fNPHIdiv + nIphi; // y(module) = y(SM)
+
+ if(iphi<0 || ieta<0)
+ AliDebug(1,Form(" nSupMod %i nModule %i nIphi %i nIeta %i => ieta %i iphi %i\n",
+ nSupMod, nModule, nIphi, nIeta, ieta, iphi));
+}
+
+
+// Methods for AliEMCALRecPoint - Feb 19, 2006
+//________________________________________________________________________________________________
+Bool_t AliEMCALGeoUtils::RelPosCellInSModule(Int_t absId, Double_t &xr, Double_t &yr, Double_t &zr) const
+{
+ // Look to see what the relative
+ // position inside a given cell is
+ // for a recpoint.
+ // Alice numbering scheme - Jun 08, 2006
+ // In:
+ // absId - cell is as in Geant, 0<= absId < fNCells;
+ // OUT:
+ // xr,yr,zr - x,y,z coordinates of cell with absId inside SM
+
+ // Shift index taking into account the difference between standard SM
+ // and SM of half size in phi direction
+ const Int_t kphiIndexShift = fCentersOfCellsPhiDir.GetSize()/4; // Nov 22, 2006; was 6 for cas 2X2
+ static Int_t nSupMod, nModule, nIphi, nIeta, iphi, ieta;
+ if(!CheckAbsCellId(absId)) return kFALSE;
+
+ GetCellIndex(absId, nSupMod, nModule, nIphi, nIeta);
+ GetCellPhiEtaIndexInSModule(nSupMod,nModule,nIphi,nIeta, iphi, ieta);
+
+ xr = fCentersOfCellsXDir.At(ieta);
+ zr = fCentersOfCellsEtaDir.At(ieta);
+
+ if(nSupMod<10) {
+ yr = fCentersOfCellsPhiDir.At(iphi);
+ } else {
+ yr = fCentersOfCellsPhiDir.At(iphi + kphiIndexShift);
+ }
+ AliDebug(1,Form("absId %i nSupMod %i iphi %i ieta %i xr %f yr %f zr %f ",absId,nSupMod,iphi,ieta,xr,yr,zr));
+
+ return kTRUE;
+}
+
+//________________________________________________________________________________________________
+Bool_t AliEMCALGeoUtils::RelPosCellInSModule(Int_t absId, Double_t loc[3]) const
+{
+ // Look to see what the relative
+ // position inside a given cell is
+ // for a recpoint. // Alice numbering scheme - Jun 03, 2006
+ loc[0] = loc[1] = loc[2]=0.0;
+ if(RelPosCellInSModule(absId, loc[0],loc[1],loc[2])) {
+ return kTRUE;
+ }
+ return kFALSE;
+}
+
+//________________________________________________________________________________________________
+Bool_t AliEMCALGeoUtils::RelPosCellInSModule(Int_t absId, TVector3 &vloc) const
+{
+ // Look to see what the relative
+ // position inside a given cell is
+ // for a recpoint.
+ // Alice numbering scheme - Jun 03, 2006
+ static Double_t loc[3];
+ if(RelPosCellInSModule(absId,loc)) {
+ vloc.SetXYZ(loc[0], loc[1], loc[2]);
+ return kTRUE;
+ } else {
+ vloc.SetXYZ(0,0,0);
+ return kFALSE;
+ }
+}
+
+//________________________________________________________________________________________________
+void AliEMCALGeoUtils::CreateListOfTrd1Modules()
+{
+ // Generate the list of Trd1 modules
+ // which will make up the EMCAL
+ // geometry
+
+ AliDebug(2,Form(" AliEMCALGeometry::CreateListOfTrd1Modules() started "));
+
+ AliEMCALShishKebabTrd1Module *mod=0, *mTmp=0; // current module
+ if(fShishKebabTrd1Modules == 0) {
+ fShishKebabTrd1Modules = new TList;
+ fShishKebabTrd1Modules->SetName("ListOfTRD1");
+ for(int iz=0; iz< fEMCGeometry->GetNZ(); iz++) {
+ if(iz==0) {
+ // mod = new AliEMCALShishKebabTrd1Module(TMath::Pi()/2.,this);
+ mod = new AliEMCALShishKebabTrd1Module(TMath::Pi()/2.,fEMCGeometry);
+ } else {
+ mTmp = new AliEMCALShishKebabTrd1Module(*mod);
+ mod = mTmp;
+ }
+ fShishKebabTrd1Modules->Add(mod);
+ }
+ } else {
+ AliDebug(2,Form(" Already exits : "));
+ }
+ mod = (AliEMCALShishKebabTrd1Module*)fShishKebabTrd1Modules->At(fShishKebabTrd1Modules->GetSize()-1);
+ fEtaMaxOfTRD1 = mod->GetMaxEtaOfModule(0);
+
+ AliDebug(2,Form(" fShishKebabTrd1Modules has %i modules : max eta %5.4f \n",
+ fShishKebabTrd1Modules->GetSize(),fEtaMaxOfTRD1));
+ // Feb 20,2006;
+ // Jun 01, 2006 - ALICE numbering scheme
+ // define grid for cells in eta(z) and x directions in local coordinates system of SM
+ // Works just for 2x2 case only -- ?? start here
+ //
+ //
+ // Define grid for cells in phi(y) direction in local coordinates system of SM
+ // as for 2X2 as for 3X3 - Nov 8,2006
+ //
+ AliDebug(2,Form(" Cells grid in phi directions : size %i\n", fCentersOfCellsPhiDir.GetSize()));
+ Int_t ind=0; // this is phi index
+ Int_t ieta=0, nModule=0, iphiTemp;
+ Double_t xr=0., zr=0., theta=0., phi=0., eta=0., r=0., x=0.,y=0.;
+ TVector3 vglob;
+ Double_t ytCenterModule=0.0, ytCenterCell=0.0;
+
+ fCentersOfCellsPhiDir.Set(fNPhi*fNPHIdiv);
+ fPhiCentersOfCells.Set(fNPhi*fNPHIdiv);
+
+ Double_t r0 = fIPDistance + fLongModuleSize/2.;
+ for(Int_t it=0; it<fNPhi; it++) { // cycle on modules
+ ytCenterModule = -fParSM[1] + fPhiModuleSize*(2*it+1)/2; // center of module
+ for(Int_t ic=0; ic<fNPHIdiv; ic++) { // cycle on cells in module
+ if(fNPHIdiv==2) {
+ ytCenterCell = ytCenterModule + fPhiTileSize *(2*ic-1)/2.;
+ } else if(fNPHIdiv==3){
+ ytCenterCell = ytCenterModule + fPhiTileSize *(ic-1);
+ } else if(fNPHIdiv==1){
+ ytCenterCell = ytCenterModule;
+ }
+ fCentersOfCellsPhiDir.AddAt(ytCenterCell,ind);
+ // Define grid on phi direction
+ // Grid is not the same for different eta bin;
+ // Effect is small but is still here
+ phi = TMath::ATan2(ytCenterCell, r0);
+ fPhiCentersOfCells.AddAt(phi, ind);
+
+ AliDebug(2,Form(" ind %2.2i : y %8.3f ", ind, fCentersOfCellsPhiDir.At(ind)));
+ ind++;
+ }
+ }
+
+ fCentersOfCellsEtaDir.Set(fNZ *fNETAdiv);
+ fCentersOfCellsXDir.Set(fNZ *fNETAdiv);
+ fEtaCentersOfCells.Set(fNZ *fNETAdiv * fNPhi*fNPHIdiv);
+ AliDebug(2,Form(" Cells grid in eta directions : size %i\n", fCentersOfCellsEtaDir.GetSize()));
+ for(Int_t it=0; it<fNZ; it++) {
+ AliEMCALShishKebabTrd1Module *trd1 = GetShishKebabModule(it);
+ nModule = fNPhi*it;
+ for(Int_t ic=0; ic<fNETAdiv; ic++) {
+ if(fNPHIdiv==2) {
+ trd1->GetCenterOfCellInLocalCoordinateofSM(ic, xr, zr); // case of 2X2
+ GetCellPhiEtaIndexInSModule(0, nModule, 0, ic, iphiTemp, ieta);
+ } if(fNPHIdiv==3) {
+ trd1->GetCenterOfCellInLocalCoordinateofSM3X3(ic, xr, zr); // case of 3X3
+ GetCellPhiEtaIndexInSModule(0, nModule, 0, ic, iphiTemp, ieta);
+ } if(fNPHIdiv==1) {
+ trd1->GetCenterOfCellInLocalCoordinateofSM1X1(xr, zr); // case of 1X1
+ GetCellPhiEtaIndexInSModule(0, nModule, 0, ic, iphiTemp, ieta);
+ }
+ fCentersOfCellsXDir.AddAt(float(xr) - fParSM[0],ieta);
+ fCentersOfCellsEtaDir.AddAt(float(zr) - fParSM[2],ieta);
+ // Define grid on eta direction for each bin in phi
+ for(int iphi=0; iphi<fCentersOfCellsPhiDir.GetSize(); iphi++) {
+ x = xr + trd1->GetRadius();
+ y = fCentersOfCellsPhiDir[iphi];
+ r = TMath::Sqrt(x*x + y*y + zr*zr);
+ theta = TMath::ACos(zr/r);
+ eta = AliEMCALShishKebabTrd1Module::ThetaToEta(theta);
+ // ind = ieta*fCentersOfCellsPhiDir.GetSize() + iphi;
+ ind = iphi*fCentersOfCellsEtaDir.GetSize() + ieta;
+ fEtaCentersOfCells.AddAt(eta, ind);
+ }
+ //printf(" ieta %i : xr + trd1->GetRadius() %f : zr %f : eta %f \n", ieta, xr + trd1->GetRadius(), zr, eta);
+ }
+ }
+ for(Int_t i=0; i<fCentersOfCellsEtaDir.GetSize(); i++) {
+ AliDebug(2,Form(" ind %2.2i : z %8.3f : x %8.3f", i+1,
+ fCentersOfCellsEtaDir.At(i),fCentersOfCellsXDir.At(i)));
+ }
+
+}
+
+
+//________________________________________________________________________________________________
+AliEMCALShishKebabTrd1Module* AliEMCALGeoUtils::GetShishKebabModule(Int_t neta) const
+{
+ //This method was too long to be
+ //included in the header file - the
+ //rule checker complained about it's
+ //length, so we move it here. It returns the
+ //shishkebabmodule at a given eta index point.
+
+ static AliEMCALShishKebabTrd1Module* trd1=0;
+ if(fShishKebabTrd1Modules && neta>=0 && neta<fShishKebabTrd1Modules->GetSize()) {
+ trd1 = (AliEMCALShishKebabTrd1Module*)fShishKebabTrd1Modules->At(neta);
+ } else trd1 = 0;
+ return trd1;
+}
+
+//___________________________________________________________________
+void AliEMCALGeoUtils::PrintGeometry()
+{
+ //Print information from geometry
+ fEMCGeometry->PrintGeometry();
+
+ printf(" fShishKebabTrd1Modules has %i modules : max eta %5.4f \n",
+ fShishKebabTrd1Modules->GetSize(),fEtaMaxOfTRD1);
+
+ printf("\n Cells grid in eta directions : size %i\n", fCentersOfCellsEtaDir.GetSize());
+ for(Int_t i=0; i<fCentersOfCellsEtaDir.GetSize(); i++) {
+ printf(" ind %2.2i : z %8.3f : x %8.3f \n", i,
+ fCentersOfCellsEtaDir.At(i),fCentersOfCellsXDir.At(i));
+ int ind=0; // Nov 21,2006
+ for(Int_t iphi=0; iphi<fCentersOfCellsPhiDir.GetSize(); iphi++) {
+ ind = iphi*fCentersOfCellsEtaDir.GetSize() + i;
+ printf("%6.4f ", fEtaCentersOfCells[ind]);
+ if((iphi+1)%12 == 0) printf("\n");
+ }
+ printf("\n");
+
+ }
+
+ printf("\n Cells grid in phi directions : size %i\n", fCentersOfCellsPhiDir.GetSize());
+ for(Int_t i=0; i<fCentersOfCellsPhiDir.GetSize(); i++) {
+ double phi=fPhiCentersOfCells.At(i);
+ printf(" ind %2.2i : y %8.3f : phi %7.5f(%6.2f) \n", i, fCentersOfCellsPhiDir.At(i),
+ phi, phi*TMath::RadToDeg());
+ }
+
+}
+
+//____________________________________________________________________________
+Bool_t AliEMCALGeoUtils::Impact(const TParticle * particle) const
+{
+ // Tells if a particle enters EMCAL
+ Bool_t in=kFALSE;
+ Int_t absID=0;
+ TVector3 vtx(particle->Vx(),particle->Vy(),particle->Vz());
+ TVector3 vimpact(0,0,0);
+ ImpactOnEmcal(vtx,particle->Theta(),particle->Phi(),absID,vimpact);
+ if(absID!=0)
+ in=kTRUE;
+ return in;
+}
+//____________________________________________________________________________
+void AliEMCALGeoUtils::ImpactOnEmcal(TVector3 vtx, Double_t theta, Double_t phi,
+ Int_t & absId, TVector3 & vimpact) const
+{
+ // calculates the impact coordinates on EMCAL (centre of a tower/not on EMCAL surface)
+ // of a neutral particle
+ // emitted in the vertex vtx[3] with direction theta and phi in the ALICE global coordinate system
+
+ TVector3 p(TMath::Sin(theta)*TMath::Cos(phi),TMath::Sin(theta)*TMath::Sin(phi),TMath::Cos(theta)) ;
+
+ vimpact.SetXYZ(0,0,0);
+ absId=-1;
+ if(phi==0 || theta==0) return;
+
+ TVector3 direction;
+ Double_t factor = (fIPDistance-vtx[1])/p[1];
+ direction = vtx + factor*p;
+
+ if (!gGeoManager){
+ AliFatal("Geo manager not initialized\n");
+ }
+ //from particle direction -> tower hitted
+ GetAbsCellIdFromEtaPhi(direction.Eta(),direction.Phi(),absId);
+
+ //tower absID hitted -> tower/module plane (evaluated at the center of the tower)
+ Int_t nSupMod, nModule, nIphi, nIeta;
+ Double_t loc[3],loc2[3],loc3[3];
+ Double_t glob[3]={},glob2[3]={},glob3[3]={};
+
+ if(!RelPosCellInSModule(absId,loc)) return;
+
+ //loc is cell center of tower
+ GetCellIndex(absId, nSupMod, nModule, nIphi, nIeta);
+
+ //look at 2 neighbours-s cell using nIphi={0,1} and nIeta={0,1}
+ Int_t nIphi2,nIeta2,absId2,absId3;
+ if(nIeta==0) nIeta2=1;
+ else nIeta2=0;
+ absId2=GetAbsCellId(nSupMod,nModule,nIphi,nIeta2);
+ if(nIphi==0) nIphi2=1;
+ else nIphi2=0;
+ absId3=GetAbsCellId(nSupMod,nModule,nIphi2,nIeta);
+
+ //2nd point on emcal cell plane
+ if(!RelPosCellInSModule(absId2,loc2)) return;
+
+ //3rd point on emcal cell plane
+ if(!RelPosCellInSModule(absId3,loc3)) return;
+
+// TString volpath = "ALIC_1/XEN1_1/SMOD_";
+// volpath += (nSupMod+1);
+//
+// if(fKey110DEG && nSupMod>=10) {
+// volpath = "ALIC_1/XEN1_1/SM10_";
+// volpath += (nSupMod-10+1);
+// }
+// if(!gGeoManager->cd(volpath.Data())){
+// AliFatal(Form("GeoManager cannot find path %s!",volpath.Data()))
+// return;
+// }
+// TGeoHMatrix* m = gGeoManager->GetCurrentMatrix();
+ const TGeoHMatrix* m = GetMatrixForSuperModule(nSupMod);
+ if(m) {
+ m->LocalToMaster(loc, glob);
+ m->LocalToMaster(loc2, glob2);
+ m->LocalToMaster(loc3, glob3);
+ } else {
+ AliFatal("Geo matrixes are not loaded \n") ;
+ }
+
+ //Equation of Plane from glob,glob2,glob3 (Ax+By+Cz+D=0)
+ Double_t a = glob[1]*(glob2[2]-glob3[2]) + glob2[1]*(glob3[2]-glob[2]) + glob3[1]*(glob[2]-glob2[2]);
+ Double_t b = glob[2]*(glob2[0]-glob3[0]) + glob2[2]*(glob3[0]-glob[0]) + glob3[2]*(glob[0]-glob2[0]);
+ Double_t c = glob[0]*(glob2[1]-glob3[1]) + glob2[0]*(glob3[1]-glob[1]) + glob3[0]*(glob[1]-glob2[1]);
+ Double_t d = glob[0]*(glob2[1]*glob3[2]-glob3[1]*glob2[2]) + glob2[0]*(glob3[1]*glob[2]-glob[1]*glob3[2]) + glob3[0]*(glob[1]*glob2[2]-glob2[1]*glob[2]);
+ d=-d;
+
+ //shift equation of plane from tower/module center to surface along vector (A,B,C) normal to tower/module plane
+ Double_t dist = fLongModuleSize/2.;
+ Double_t norm = TMath::Sqrt(a*a+b*b+c*c);
+ Double_t glob4[3]={};
+ TVector3 dir(a,b,c);
+ TVector3 point(glob[0],glob[1],glob[2]);
+ if(point.Dot(dir)<0) dist*=-1;
+ glob4[0]=glob[0]-dist*a/norm;
+ glob4[1]=glob[1]-dist*b/norm;
+ glob4[2]=glob[2]-dist*c/norm;
+ d = glob4[0]*a + glob4[1]*b + glob4[2]*c ;
+ d = -d;
+
+ //Line determination (2 points for equation of line : vtx and direction)
+ //impact between line (particle) and plane (module/tower plane)
+ Double_t den = a*(vtx(0)-direction(0)) + b*(vtx(1)-direction(1)) + c*(vtx(2)-direction(2));
+ if(den==0){
+ printf("ImpactOnEmcal() No solution :\n");
+ return;
+ }
+
+ Double_t length = a*vtx(0)+b*vtx(1)+c*vtx(2)+d;
+ length /=den;
+
+ vimpact.SetXYZ(vtx(0)+length*(direction(0)-vtx(0)),vtx(1)+length*(direction(1)-vtx(1)),vtx(2)+length*(direction(2)-vtx(2)));
+
+ //shift vimpact from tower/module surface to center along vector (A,B,C) normal to tower/module plane
+ vimpact.SetXYZ(vimpact(0)+dist*a/norm,vimpact(1)+dist*b/norm,vimpact(2)+dist*c/norm);
+
+ return;
+}
+
+//_____________________________________________________________________________
+Bool_t AliEMCALGeoUtils::IsInEMCAL(Double_t x, Double_t y, Double_t z) const {
+ // Checks whether point is inside the EMCal volume, used in AliEMCALv*.cxx
+ //
+ // Code uses cylindrical approximation made of inner radius (for speed)
+ //
+ // Points behind EMCAl, i.e. R > outer radius, but eta, phi in acceptance
+ // are considered to inside
+
+ Double_t r=sqrt(x*x+y*y);
+
+ if ( r > fEnvelop[0] ) {
+ Double_t theta;
+ theta = TMath::ATan2(r,z);
+ Double_t eta;
+ if(theta == 0)
+ eta = 9999;
+ else
+ eta = -TMath::Log(TMath::Tan(theta/2.));
+ if (eta < fArm1EtaMin || eta > fArm1EtaMax)
+ return 0;
+
+ Double_t phi = TMath::ATan2(y,x) * 180./TMath::Pi();
+ if (phi < 0) phi += 360; // phi should go from 0 to 360 in this case
+ if (phi > fArm1PhiMin && phi < fArm1PhiMax)
+ return 1;
+ }
+ return 0;
+}
+
+//________________________________________________________________________________________________
+Int_t AliEMCALGeoUtils::GetAbsTRUNumberFromNumberInSm(const Int_t row, const Int_t col, const Int_t sm) const
+{ // Nov 6, 2007
+ // Get TRU absolute number from column, row and Super Module number
+ Int_t itru = row + col*fEMCGeometry->GetNModulesInTRUPhi() + sm*fEMCGeometry->GetNTRU();
+ // printf(" GetAbsTRUNumberFromNumberInSm : row %2i col %2i sm %2i -> itru %2i\n", row, col, sm, itru);
+ return itru;
+}
+
+
+//____________________________________________________________________________
+const TGeoHMatrix * AliEMCALGeoUtils::GetMatrixForSuperModule(Int_t smod) const {
+ //Provides shift-rotation matrix for EMCAL
+
+ if(smod < 0 || smod > fEMCGeometry->GetNumberOfSuperModules())
+ AliFatal(Form("Wrong supermodule index -> %d",smod));
+
+ //If GeoManager exists, take matrixes from it
+
+ //
+ // if(fKey110DEG && ind>=10) {
+ // }
+ //
+ // if(!gGeoManager->cd(volpath.Data()))
+ // AliFatal(Form("AliEMCALGeometry::GeoManager cannot find path %s!",volpath.Data()));
+ //
+ // TGeoHMatrix* m = gGeoManager->GetCurrentMatrix();
+
+ if(gGeoManager){
+ char path[255] ;
+ sprintf(path,"/ALIC_1/XEN1_1/SMOD_%d",smod+1) ;
+ //TString volpath = "ALIC_1/XEN1_1/SMOD_";
+ //volpath += smod+1;
+
+ if(fKey110DEG && smod >= 10){
+ sprintf(path,"/ALIC_1/XEN1_1/SM10_%d",smod-10+1) ;
+ //volpath = "ALIC_1/XEN1_1/SM10_";
+ //volpath += smod-10+1;
+ }
+ if (!gGeoManager->cd(path)){
+ AliFatal(Form("Geo manager can not find path %s!\n",path));
+ }
+ return gGeoManager->GetCurrentMatrix();
+ }
+
+ if(fkSModuleMatrix[smod]){
+ return fkSModuleMatrix[smod] ;
+ }
+ else{
+ printf("Can not find EMCAL misalignment matrixes\n") ;
+ printf("Either import TGeoManager from geometry.root or \n");
+ printf("read stored matrixes from AliESD Header: \n") ;
+ printf("AliEMCALGeoUtils::SetMisalMatrixes(header->GetEMCALMisalMatrix()) \n") ;
+ abort() ;
+ }
+ return 0 ;
+}
+
+//______________________________________________________________________
+void AliEMCALGeoUtils::GetModulePhiEtaIndexInSModuleFromTRUIndex(Int_t itru, Int_t iphitru, Int_t ietatru, Int_t &iphiSM, Int_t &ietaSM) const
+{
+
+ // This method transforms the (eta,phi) index of module in a
+ // TRU matrix into Super Module (eta,phi) index.
+
+ // Calculate in which row and column where the TRU are
+ // ordered in the SM
+
+ Int_t col = itru/fEMCGeometry->GetNTRUPhi() ; // indexes of TRU in SM
+ Int_t row = itru - col*fEMCGeometry->GetNTRUPhi();
+
+ iphiSM = fEMCGeometry->GetNModulesInTRUPhi()*row + iphitru ;
+ ietaSM = fEMCGeometry->GetNModulesInTRUEta()*col + ietatru ;
+ //printf(" GetModulePhiEtaIndexInSModuleFromTRUIndex : itru %2i iphitru %2i ietatru %2i iphiSM %2i ietaSM %2i \n",
+ // itru, iphitru, ietatru, iphiSM, ietaSM);
+}
--- /dev/null
+#ifndef ALIEMCALGEOUTILS_H
+#define ALIEMCALGEOUTILS_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+//_________________________________________________________________________
+// class for geometry transformations in EMCAL
+// this class contains AliRoot-independent transformations,
+// AliRoot part is in AliEMCALGeometry
+//
+//*-- Author: Magali Estienne
+
+// --- ROOT system ---
+#include <TNamed.h>
+#include <TMath.h>
+#include <TArrayD.h>
+#include <TVector3.h>
+class TBrowser ;
+class TParticle ;
+class TGeoHMatrix ;
+
+// --- AliRoot header files ---
+#include "AliEMCALEMCGeometry.h"
+class AliEMCALShishKebabTrd1Module;
+#include "AliLog.h"
+
+class AliEMCALGeoUtils : public TNamed {
+
+public:
+
+ AliEMCALGeoUtils();
+ AliEMCALGeoUtils(const Text_t* name, const Text_t* title="");
+ AliEMCALGeoUtils(const AliEMCALGeoUtils & geom);
+
+ virtual ~AliEMCALGeoUtils(void);
+ AliEMCALGeoUtils & operator = (const AliEMCALGeoUtils & rvalue);
+
+ /////////////
+ // TRD1 stuff
+ void CreateListOfTrd1Modules();
+ TList *GetShishKebabTrd1Modules() const {return fShishKebabTrd1Modules;}
+ AliEMCALShishKebabTrd1Module *GetShishKebabModule(Int_t neta) const;
+
+ void PrintGeometry();
+ void PrintCellIndexes(Int_t absId=0, int pri=0, const char *tit="") const ; //*MENU*
+ virtual void Browse(TBrowser* b);
+ virtual Bool_t IsFolder() const;
+
+ virtual Bool_t Impact(const TParticle *) const;
+ void ImpactOnEmcal(TVector3 vtx, Double_t theta, Double_t phi, Int_t & absId, TVector3 & vimpact) const;
+ Bool_t IsInEMCAL(Double_t x, Double_t y, Double_t z) const;
+
+
+ AliEMCALEMCGeometry* GetEMCGeometry() const { return fEMCGeometry;}
+
+ //////////////////////////
+ // Global geometry methods
+ //
+ void GetGlobal(const Double_t *loc, Double_t *glob, int ind) const;
+ void GetGlobal(const TVector3 &vloc, TVector3 &vglob, int ind) const;
+ void GetGlobal(Int_t absId, Double_t glob[3]) const;
+ void GetGlobal(Int_t absId, TVector3 &vglob) const;
+
+ ////////////////////////////////////////
+ // May 31, 2006; ALICE numbering scheme:
+ // see ALICE-INT-2003-038: ALICE Coordinate System and Software Numbering Convention
+ // All indexes are stared from zero now.
+ //
+ // abs id <-> indexes; Shish-kebab case, only TRD1 now.
+ // EMCAL -> Super Module -> module -> tower(or cell) - logic tree of EMCAL
+ //
+ //** Usual name of variable - Dec 18,2006 **
+ // nSupMod - index of super module (SM)
+ // nModule - index of module in SM
+ // nIphi - phi index of tower(cell) in module
+ // nIeta - eta index of tower(cell) in module
+ //
+ // Inside SM
+ // iphim - phi index of module in SM
+ // ietam - eta index of module in SM
+ //
+ // iphi - phi index of tower(cell) in SM
+ // ieta - eta index of tower(cell) in SM
+ //
+ // for a given tower index absId returns eta and phi of gravity center of tower.
+ void EtaPhiFromIndex(Int_t absId, Double_t &eta, Double_t &phi) const;
+ void EtaPhiFromIndex(Int_t absId, Float_t &eta, Float_t &phi) const;
+
+ Bool_t GetAbsCellIdFromEtaPhi(Double_t eta,Double_t phi, Int_t &absId) const;
+ Bool_t SuperModuleNumberFromEtaPhi(Double_t eta, Double_t phi, Int_t &nSupMod) const;
+ Int_t GetAbsCellId(Int_t nSupMod, Int_t nModule, Int_t nIphi, Int_t nIeta) const;
+ Bool_t CheckAbsCellId(Int_t absId) const;
+ Bool_t GetCellIndex(Int_t absId, Int_t &nSupMod, Int_t &nModule, Int_t &nIphi,
+ Int_t &nIeta) const;
+ // Local coordinate of Super Module
+ void GetModulePhiEtaIndexInSModule(Int_t nSupMod, Int_t nModule, Int_t &iphim,
+ Int_t &ietam) const;
+ void GetCellPhiEtaIndexInSModule(Int_t nSupMod, Int_t nModule, Int_t nIphi, Int_t nIeta,
+ Int_t &iphi, Int_t &ieta) const ;
+ Int_t GetSuperModuleNumber(Int_t absId) const;
+ Int_t GetNumberOfModuleInPhiDirection(Int_t nSupMod) const
+ {
+ if(fKey110DEG == 1 && nSupMod>=10) return fNPhi/2;
+ else return fNPhi;
+ }
+ // From cell indexes to abs cell id
+ void GetModuleIndexesFromCellIndexesInSModule(Int_t nSupMod, Int_t iphi, Int_t ieta,
+ Int_t &iphim, Int_t &ietam, Int_t &nModule) const;
+ Int_t GetAbsCellIdFromCellIndexes(Int_t nSupMod, Int_t iphi, Int_t ieta) const;
+
+ // Methods for AliEMCALRecPoint - Feb 19, 2006
+ Bool_t RelPosCellInSModule(Int_t absId, Double_t &xr, Double_t &yr, Double_t &zr) const;
+ Bool_t RelPosCellInSModule(Int_t absId, Double_t loc[3]) const;
+ Bool_t RelPosCellInSModule(Int_t absId, TVector3 &vloc) const;
+
+ // Local Coordinates of SM
+ TArrayD GetCentersOfCellsEtaDir() const {return fCentersOfCellsEtaDir;} // size fNEta*fNETAdiv (for TRD1 only) (eta or z in SM, in cm)
+ TArrayD GetCentersOfCellsXDir() const {return fCentersOfCellsXDir;} // size fNEta*fNETAdiv (for TRD1 only) ( x in SM, in cm)
+ TArrayD GetCentersOfCellsPhiDir() const {return fCentersOfCellsPhiDir;} // size fNPhi*fNPHIdiv (for TRD1 only) (phi or y in SM, in cm)
+ //
+ TArrayD GetEtaCentersOfCells() const {return fEtaCentersOfCells;} // [fNEta*fNETAdiv*fNPhi*fNPHIdiv], positive direction (eta>0); eta depend from phi position;
+ TArrayD GetPhiCentersOfCells() const {return fPhiCentersOfCells;} // [fNPhi*fNPHIdiv] from center of SM (-10. < phi < +10.)
+
+ //
+ // Tranforms Eta-Phi Module index in TRU into Eta-Phi index in Super Module
+ void GetModulePhiEtaIndexInSModuleFromTRUIndex(
+ Int_t itru, Int_t iphitru, Int_t ietatru, Int_t &ietaSM, Int_t &iphiSM) const;
+ Int_t GetAbsTRUNumberFromNumberInSm(const Int_t row, const Int_t col, const Int_t sm) const ;
+
+
+
+ ///////////////////
+ // useful utilities
+ //
+ Float_t AngleFromEta(Float_t eta) const { // returns theta in radians for a given pseudorapidity
+ return 2.0*TMath::ATan(TMath::Exp(-eta));
+ }
+ Float_t ZFromEtaR(Float_t r,Float_t eta) const { // returns z in for a given
+ // pseudorapidity and r=sqrt(x*x+y*y).
+ return r/TMath::Tan(AngleFromEta(eta));
+ }
+
+ //Method to set shift-rotational matrixes from ESDHeader
+ void SetMisalMatrix(const TGeoHMatrix * m, Int_t smod) {
+ if (smod >= 0 && smod < fEMCGeometry->GetNumberOfSuperModules()) fkSModuleMatrix[smod] = m ;
+ else AliFatal(Form("Wrong supermodule index -> %d",smod));
+ }
+
+protected:
+ //Returns shift-rotational matrixes for different volumes
+ const TGeoHMatrix * GetMatrixForSuperModule(Int_t smod)const ;
+
+protected:
+
+ // ctor only for internal usage (singleton)
+ // AliEMCALGeoUtils(const Text_t* name, const Text_t* title);
+ AliEMCALEMCGeometry *fEMCGeometry; // Geometry object for Electromagnetic calorimeter
+
+ void Init(void); // initializes the parameters of EMCAL
+
+ TString fGeoName; //geometry name
+
+ Int_t fKey110DEG; // for calculation abs cell id; 19-oct-05
+ Int_t fNCellsInSupMod; // number cell in super module
+ Int_t fNETAdiv; // number eta divizion of module
+ Int_t fNPHIdiv; // number phi divizion of module
+ Int_t fNCellsInModule; // number cell in module
+ TArrayD fPhiBoundariesOfSM; // phi boundaries of SM in rad; size is fNumberOfSuperModules;
+ TArrayD fPhiCentersOfSM; // phi of centers of SMl size is fNumberOfSuperModules/2
+ // Local Coordinates of SM
+ TArrayD fPhiCentersOfCells; // [fNPhi*fNPHIdiv] from center of SM (-10. < phi < +10.)
+ TArrayD fCentersOfCellsEtaDir; // size fNEta*fNETAdiv (for TRD1 only) (eta or z in SM, in cm)
+ TArrayD fCentersOfCellsPhiDir; // size fNPhi*fNPHIdiv (for TRD1 only) (phi or y in SM, in cm)
+ TArrayD fEtaCentersOfCells; // [fNEta*fNETAdiv*fNPhi*fNPHIdiv], positive direction (eta>0); eta depend from phi position;
+ Int_t fNCells; // number of cells in calo
+ Int_t fNPhi; // Number of Towers in the PHI direction
+ TArrayD fCentersOfCellsXDir; // size fNEta*fNETAdiv (for TRD1 only) ( x in SM, in cm)
+ Float_t fEnvelop[3]; // the GEANT TUB for the detector
+ Float_t fArm1EtaMin; // Minimum pseudorapidity position of EMCAL in Eta
+ Float_t fArm1EtaMax; // Maximum pseudorapidity position of EMCAL in Eta
+ Float_t fArm1PhiMin; // Minimum angular position of EMCAL in Phi (degrees)
+ Float_t fArm1PhiMax; // Maximum angular position of EMCAL in Phi (degrees)
+ Float_t fEtaMaxOfTRD1; // Max eta in case of TRD1 geometry (see AliEMCALShishKebabTrd1Module)
+ TList *fShishKebabTrd1Modules; //! list of modules
+ Float_t *fParSM; // SM sizes as in GEANT (TRD1)
+ Float_t fPhiModuleSize; // Phi -> X
+ Float_t fEtaModuleSize; // Eta -> Y
+ Float_t fPhiTileSize; // Size of phi tile
+ Float_t fEtaTileSize; // Size of eta tile
+ Int_t fNZ; // Number of Towers in the Z direction
+ Float_t fIPDistance; // Radial Distance of the inner surface of the EMCAL
+ Float_t fLongModuleSize; // Size of long module
+ // Geometry Parameters
+ Float_t fShellThickness; // Total thickness in (x,y) direction
+ Float_t fZLength; // Total length in z direction
+ Float_t fSampling; // Sampling factor
+
+ const TGeoHMatrix* fkSModuleMatrix[12] ; //Orientations of EMCAL super modules
+
+
+ ClassDef(AliEMCALGeoUtils,1) // EMCAL geometry class
+
+} ;
+
+#endif // AliEMCALGEOUTILS_H
// and : Aleksei Pavlinov (WSU)
//
-#include <cassert>
-
-// --- Root header files ---
-#include <Riostream.h>
-#include <TBrowser.h>
-#include <TClonesArray.h>
-#include <TGeoManager.h>
-#include <TGeoMatrix.h>
-#include <TGeoNode.h>
-#include <TList.h>
-#include <TMatrixD.h>
-#include <TObjArray.h>
-#include <TObjString.h>
+//--- Root header files ---
#include <TVector2.h>
#include <TVector3.h>
-#include <TParticle.h>
-// -- ALICE Headers.
+//-- ALICE Headers.
#include "AliLog.h"
-// --- EMCAL headers
+// // --- EMCAL headers
#include "AliEMCALGeometry.h"
#include "AliEMCALShishKebabTrd1Module.h"
#include "AliEMCALRecPoint.h"
-#include "AliEMCALDigit.h"
-#include "AliEMCALHistoUtilities.h"
+//#include "AliEMCALHistoUtilities.h"
ClassImp(AliEMCALGeometry)
// these initialisations are needed for a singleton
AliEMCALGeometry *AliEMCALGeometry::fgGeom = 0;
-Bool_t AliEMCALGeometry::fgInit = kFALSE;
-const Char_t* AliEMCALGeometry::fgDefaultGeometryName = "EMCAL_COMPLETE";
+const Char_t* AliEMCALGeometry::fgkDefaultGeometryName = "EMCAL_COMPLETE";
//
// Usage:
// You can create the AliEMCALGeometry object independently from anything.
// TGeoManager::Import("geometry.root");
AliEMCALGeometry::AliEMCALGeometry()
- : AliGeometry(),
- fGeoName(0),fArrayOpts(0),fNAdditionalOpts(0),fECPbRadThickness(0.),fECScintThick(0.),
- fNECLayers(0),fArm1PhiMin(0.),fArm1PhiMax(0.),fArm1EtaMin(0.),fArm1EtaMax(0.),fIPDistance(0.),
- fShellThickness(0.),fZLength(0.),fNZ(0),fNPhi(0),fSampling(0.),fNumberOfSuperModules(0),
- fFrontSteelStrip(0.),fLateralSteelStrip(0.),fPassiveScintThick(0.),fPhiModuleSize(0.),
- fEtaModuleSize(0.),fPhiTileSize(0.),fEtaTileSize(0.),fLongModuleSize(0.),fNPhiSuperModule(0),
- fNPHIdiv(0),fNETAdiv(0), fNCells(0),fNCellsInSupMod(0),fNCellsInModule(0),
- // Trigger staff
- fNTRUEta(0),
- fNTRUPhi(0),
- fNModulesInTRUEta(0),
- fNModulesInTRUPhi(0),
- fNEtaSubOfTRU(0),
- //
- fTrd1Angle(0.),f2Trd1Dx2(0.),
- fPhiGapForSM(0.),fKey110DEG(0),fPhiBoundariesOfSM(0), fPhiCentersOfSM(0),fEtaMaxOfTRD1(0),
- fCentersOfCellsEtaDir(0), fCentersOfCellsXDir(0),fCentersOfCellsPhiDir(0),
- fEtaCentersOfCells(0),fPhiCentersOfCells(0),fShishKebabTrd1Modules(0),
- fILOSS(-1), fIHADR(-1),
- //obsolete member data
- fAlFrontThick(0.), fGap2Active(0.), fSteelFrontThick(0.), fTrd2AngleY(0.),
- f2Trd2Dy2(0.), fEmptySpace(0.), fTubsR(0.), fTubsTurnAngle(0.)
+ : AliEMCALGeoUtils()
{
// default ctor only for internal usage (singleton)
// must be kept public for root persistency purposes,
}
//______________________________________________________________________
AliEMCALGeometry::AliEMCALGeometry(const Text_t* name, const Text_t* title)
- : AliGeometry(name, title),
- fGeoName(0),fArrayOpts(0),fNAdditionalOpts(0),fECPbRadThickness(0.),fECScintThick(0.),
- fNECLayers(0),fArm1PhiMin(0.),fArm1PhiMax(0.),fArm1EtaMin(0.),fArm1EtaMax(0.),fIPDistance(0.),
- fShellThickness(0.),fZLength(0.),fNZ(0),fNPhi(0),fSampling(0.),fNumberOfSuperModules(0),
- fFrontSteelStrip(0.),fLateralSteelStrip(0.),fPassiveScintThick(0.),fPhiModuleSize(0.),
- fEtaModuleSize(0.),fPhiTileSize(0.),fEtaTileSize(0.),fLongModuleSize(0.),fNPhiSuperModule(0),
- fNPHIdiv(0),fNETAdiv(0), fNCells(0),fNCellsInSupMod(0),fNCellsInModule(0),
- // Trigger staff
- fNTRUEta(0),
- fNTRUPhi(0),
- fNModulesInTRUEta(0),
- fNModulesInTRUPhi(0),
- fNEtaSubOfTRU(0),
- //
- fTrd1Angle(0.),f2Trd1Dx2(0.),
- fPhiGapForSM(0.),fKey110DEG(0),fPhiBoundariesOfSM(0), fPhiCentersOfSM(0), fEtaMaxOfTRD1(0),
- fCentersOfCellsEtaDir(0),fCentersOfCellsXDir(0),fCentersOfCellsPhiDir(0),
- fEtaCentersOfCells(0),fPhiCentersOfCells(0),fShishKebabTrd1Modules(0),
- fILOSS(-1), fIHADR(-1),
- //obsolete member data
- fAlFrontThick(0.), fGap2Active(0.), fSteelFrontThick(0.), fTrd2AngleY(0.),
- f2Trd2Dy2(0.), fEmptySpace(0.), fTubsR(0.), fTubsTurnAngle(0.)
+ : AliEMCALGeoUtils(name, title)
{
// ctor only for internal usage (singleton)
AliDebug(2, Form("AliEMCALGeometry(%s,%s) ", name,title));
- Init();
-
- CreateListOfTrd1Modules();
-
- if (AliDebugLevel()>=2) {
- PrintGeometry();
- }
-
}
//______________________________________________________________________
AliEMCALGeometry::AliEMCALGeometry(const AliEMCALGeometry& geom)
- : AliGeometry(geom),
- fGeoName(geom.fGeoName),
- fArrayOpts(geom.fArrayOpts),
- fNAdditionalOpts(geom.fNAdditionalOpts),
- fECPbRadThickness(geom.fECPbRadThickness),
- fECScintThick(geom.fECScintThick),
- fNECLayers(geom.fNECLayers),
- fArm1PhiMin(geom.fArm1PhiMin),
- fArm1PhiMax(geom.fArm1PhiMax),
- fArm1EtaMin(geom.fArm1EtaMin),
- fArm1EtaMax(geom.fArm1EtaMax),
- fIPDistance(geom.fIPDistance),
- fShellThickness(geom.fShellThickness),
- fZLength(geom.fZLength),
- fNZ(geom.fNZ),
- fNPhi(geom.fNPhi),
- fSampling(geom.fSampling),
- fNumberOfSuperModules(geom.fNumberOfSuperModules),
- fFrontSteelStrip(geom.fFrontSteelStrip),
- fLateralSteelStrip(geom.fLateralSteelStrip),
- fPassiveScintThick(geom.fPassiveScintThick),
- fPhiModuleSize(geom.fPhiModuleSize),
- fEtaModuleSize(geom.fEtaModuleSize),
- fPhiTileSize(geom.fPhiTileSize),
- fEtaTileSize(geom.fEtaTileSize),
- fLongModuleSize(geom.fLongModuleSize),
- fNPhiSuperModule(geom.fNPhiSuperModule),
- fNPHIdiv(geom.fNPHIdiv),
- fNETAdiv(geom.fNETAdiv),
- fNCells(geom.fNCells),
- fNCellsInSupMod(geom.fNCellsInSupMod),
- fNCellsInModule(geom.fNCellsInModule),
- // Trigger staff
- fNTRUEta(geom.fNTRUEta),
- fNTRUPhi(geom.fNTRUPhi),
- fNModulesInTRUEta(geom.fNModulesInTRUEta),
- fNModulesInTRUPhi(geom.fNModulesInTRUPhi),
- fNEtaSubOfTRU(geom.fNEtaSubOfTRU),
- //
- fTrd1Angle(geom.fTrd1Angle),
- f2Trd1Dx2(geom.f2Trd1Dx2),
- fPhiGapForSM(geom.fPhiGapForSM),
- fKey110DEG(geom.fKey110DEG),
- fPhiBoundariesOfSM(geom.fPhiBoundariesOfSM),
- fPhiCentersOfSM(geom.fPhiCentersOfSM),
- fEtaMaxOfTRD1(geom.fEtaMaxOfTRD1),
- fCentersOfCellsEtaDir(geom.fCentersOfCellsEtaDir),
- fCentersOfCellsXDir(geom.fCentersOfCellsXDir),
- fCentersOfCellsPhiDir(geom.fCentersOfCellsPhiDir),
- fEtaCentersOfCells(geom.fEtaCentersOfCells),
- fPhiCentersOfCells(geom.fPhiCentersOfCells),
- fShishKebabTrd1Modules(geom.fShishKebabTrd1Modules),
- fILOSS(geom.fILOSS), fIHADR(geom.fIHADR),
- //obsolete member data
- fAlFrontThick(geom.fAlFrontThick),
- fGap2Active(geom.fGap2Active),
- fSteelFrontThick(geom.fSteelFrontThick),
- fTrd2AngleY(geom.fTrd2AngleY),
- f2Trd2Dy2(geom.f2Trd2Dy2),
- fEmptySpace(geom.fEmptySpace),
- fTubsR(geom.fTubsR),
- fTubsTurnAngle(geom.fTubsTurnAngle)
+ : AliEMCALGeoUtils(geom)
{
//copy ctor
}
// dtor
}
-//______________________________________________________________________
-void AliEMCALGeometry::Init(void){
- //
- // Initializes the EMCAL parameters based on the name
- // Only Shashlyk geometry is available, but various combinations of
- // layers and number of supermodules can be selected with additional
- // options or geometry name
- //
-
- fAdditionalOpts[0] = "nl="; // number of sampling layers (fNECLayers)
- fAdditionalOpts[1] = "pbTh="; // cm, Thickness of the Pb (fECPbRadThick)
- fAdditionalOpts[2] = "scTh="; // cm, Thickness of the Sc (fECScintThick)
- fAdditionalOpts[3] = "latSS="; // cm, Thickness of lateral steel strip (fLateralSteelStrip)
- fAdditionalOpts[4] = "allILOSS="; // = 0,1,2,3,4 (4 - energy loss without fluctuation)
- fAdditionalOpts[5] = "allIHADR="; // = 0,1,2 (0 - no hadronic interaction)
-
- fNAdditionalOpts = sizeof(fAdditionalOpts) / sizeof(char*);
-
- // geometry
- fgInit = kFALSE; // Assume failed until proven otherwise.
- fGeoName = GetName();
- fGeoName.ToUpper();
-
- //Convert old geometry names to new ones
- if(fGeoName.Contains("SHISH_77_TRD1_2X2_FINAL_110DEG")) {
- if(fGeoName.Contains("PBTH=0.144") && fGeoName.Contains("SCTH=0.176")) {
- fGeoName = "EMCAL_COMPLETE";
- } else {
- fGeoName = "EMCAL_PDC06";
- }
- }
- if(fGeoName.Contains("WSUC")) fGeoName = "EMCAL_WSUC";
-
- //check that we have a valid geometry name
- if(!(fGeoName.Contains("EMCAL_PDC06") || fGeoName.Contains("EMCAL_COMPLETE") || fGeoName.Contains("EMCAL_WSUC") || fGeoName.Contains("EMCAL_1stYear"))) {
- Fatal("Init", "%s is an undefined geometry!", fGeoName.Data()) ;
- }
-
- // Option to know whether we have the "half" supermodule(s) or not
- fKey110DEG = 0;
- if(fGeoName.Contains("COMPLETE") || fGeoName.Contains("PDC06")) fKey110DEG = 1; // for GetAbsCellId
- fShishKebabTrd1Modules = 0;
-
- // JLK 13-Apr-2008
- //default parameters are those of EMCAL_COMPLETE geometry
- //all others render variations from these at the end of
- //geometry-name specific options
-
- fNumberOfSuperModules = 12; // 12 = 6 * 2 (6 in phi, 2 in Z)
- fNPhi = 12; // module granularity in phi within smod (azimuth)
- fNZ = 24; // module granularity along Z within smod (eta)
- fNPHIdiv = fNETAdiv = 2; // tower granularity within module
- fArm1PhiMin = 80.0; // degrees, Starting EMCAL Phi position
- fArm1PhiMax = 200.0; // degrees, Ending EMCAL Phi position
- fArm1EtaMin = -0.7; // pseudorapidity, Starting EMCAL Eta position
- fArm1EtaMax = +0.7; // pseudorapidity, Ending EMCAL Eta position
- fIPDistance = 428.0; // cm, radial distance to front face from nominal vertex point
- fPhiGapForSM = 2.; // cm, only for final TRD1 geometry
- fFrontSteelStrip = 0.025; // 0.025cm = 0.25mm (13-may-05 from V.Petrov)
- fPassiveScintThick = 0.8; // 0.8cm = 8mm (13-may-05 from V.Petrov)
- fLateralSteelStrip = 0.01; // 0.01cm = 0.1mm (13-may-05 from V.Petrov) - was 0.025
- fTrd1Angle = 1.5; // in degrees
-
- fSampling = 1.; // should be calculated with call to DefineSamplingFraction()
- fNECLayers = 77; // (13-may-05 from V.Petrov) - can be changed with additional options
- fECScintThick = 0.176; // scintillator layer thickness
- fECPbRadThickness = 0.144; // lead layer thickness
-
- fPhiModuleSize = 12.26 - fPhiGapForSM / Float_t(fNPhi); // first assumption
- fEtaModuleSize = fPhiModuleSize;
-
- fZLength = 700.; // Z coverage (cm)
-
-
- //needs to be called for each geometry and before setting geometry
- //parameters which can depend on the outcome
- CheckAdditionalOptions();
-
- //modifications to the above for PDC06 geometry
- if(fGeoName.Contains("PDC06")){ // 18-may-05 - about common structure
- fECScintThick = fECPbRadThickness = 0.16;// (13-may-05 from V.Petrov)
- CheckAdditionalOptions();
- }
-
- //modifications to the above for WSUC geometry
- if(fGeoName.Contains("WSUC")){ // 18-may-05 - about common structure
- fPhiModuleSize = 12.5; // 20-may-05 - rectangular shape
- fEtaModuleSize = 11.9;
- fECScintThick = fECPbRadThickness = 0.16;// (13-may-05 from V.Petrov)
- fNumberOfSuperModules = 1; // 27-may-05
- fShellThickness = 30.; // should be change
- fNPhi = fNZ = 4;
- CheckAdditionalOptions();
- }
-
- if(fGeoName.Contains("1stYear")){
- fNumberOfSuperModules = 2;
-
- if(fGeoName.Contains("LowerEta")) {
- fNPhiSuperModule = 1;
- }
- else if(fGeoName.Contains("LowerPhi_SideA")){
- fNPhiSuperModule = 2;
- fArm1EtaMax=0;
- }
- else if(fGeoName.Contains("LowerPhi_SideC")){
- fNPhiSuperModule = 2;
- fArm1EtaMin=0;
- }
-
- CheckAdditionalOptions();
- }
-
- // constant for transition absid <--> indexes
- fNCellsInModule = fNPHIdiv*fNETAdiv;
- fNCellsInSupMod = fNCellsInModule*fNPhi*fNZ;
- fNCells = fNCellsInSupMod*fNumberOfSuperModules;
- if(GetKey110DEG()) fNCells -= fNCellsInSupMod;
-
- fNPhiSuperModule = fNumberOfSuperModules/2;
- if(fNPhiSuperModule < 1) fNPhiSuperModule = 1;
-
- fPhiTileSize = fPhiModuleSize/double(fNPHIdiv) - fLateralSteelStrip; // 13-may-05
- fEtaTileSize = fEtaModuleSize/double(fNETAdiv) - fLateralSteelStrip; // 13-may-05
-
- fLongModuleSize = fNECLayers*(fECScintThick + fECPbRadThickness);
- f2Trd1Dx2 = fEtaModuleSize + 2.*fLongModuleSize*TMath::Tan(fTrd1Angle*TMath::DegToRad()/2.);
- if(!fGeoName.Contains("WSUC")) fShellThickness = TMath::Sqrt(fLongModuleSize*fLongModuleSize + f2Trd1Dx2*f2Trd1Dx2);
-
- //These parameters are used to create the mother volume to hold the supermodules
- //2cm padding added to allow for misalignments - JLK 30-May-2008
- fEnvelop[0] = fIPDistance - 1.; // mother volume inner radius
- fEnvelop[1] = fIPDistance + fShellThickness + 1.; // mother volume outer r.
- fEnvelop[2] = fZLength + 2.; //mother volume length
-
- // Local coordinates
- fParSM[0] = GetShellThickness()/2.;
- fParSM[1] = GetPhiModuleSize() * GetNPhi()/2.;
- fParSM[2] = fZLength/4.; //divide by 4 to get half-length of SM
-
- // SM phi boundaries - (0,1),(2,3) .. (10,11) - has the same boundaries; Nov 7, 2006
- fPhiBoundariesOfSM.Set(fNumberOfSuperModules);
- fPhiCentersOfSM.Set(fNumberOfSuperModules/2);
- fPhiBoundariesOfSM[0] = TMath::PiOver2() - TMath::ATan2(fParSM[1] , fIPDistance); // 1th and 2th modules)
- fPhiCentersOfSM[0] = TMath::PiOver2();
- if(fNumberOfSuperModules > 1)
- fPhiBoundariesOfSM[1] = TMath::PiOver2() + TMath::ATan2(fParSM[1] , fIPDistance);
- if(fNumberOfSuperModules > 2) {
- for(int i=1; i<=4; i++) { // from 2th ro 9th
- fPhiBoundariesOfSM[2*i] = fPhiBoundariesOfSM[0] + 20.*TMath::DegToRad()*i;
- fPhiBoundariesOfSM[2*i+1] = fPhiBoundariesOfSM[1] + 20.*TMath::DegToRad()*i;
- fPhiCentersOfSM[i] = fPhiCentersOfSM[0] + 20.*TMath::DegToRad()*i;
- }
- }
- if(fNumberOfSuperModules > 10) {
- fPhiBoundariesOfSM[11] = 190.*TMath::DegToRad();
- fPhiBoundariesOfSM[10] = fPhiBoundariesOfSM[11] - TMath::ATan2((fParSM[1]) , fIPDistance);
- fPhiCentersOfSM[5] = (fPhiBoundariesOfSM[10]+fPhiBoundariesOfSM[11])/2.;
- }
-
- //called after setting of scintillator and lead layer parameters
- DefineSamplingFraction();
-
- // TRU parameters - Apr 29,08 by PAI.
- // These parameters values was updated at Nov 05, 2007
- // As is on Olivier BOURRION (LPSC) ppt preasentation
- // at ALICE trigger meeting at 13th-14th March
- fNTRUEta = 1; // was 3
- fNTRUPhi = 3; // was 1
- fNModulesInTRUEta = 24; // was 8
- fNModulesInTRUPhi = 4; // was 12
- // Jet trigger
- // 3*6*10 + 2*6*2 = 204 -> matrix (nphi(17), neta(12))
- fNEtaSubOfTRU = 6;
-
- fgInit = kTRUE;
-}
-
-//___________________________________________________________________
-void AliEMCALGeometry::PrintGeometry()
-{
- // Separate routine is callable from broswer; Nov 7,2006
- printf("\nInit: geometry of EMCAL named %s :\n", fGeoName.Data());
- if(fArrayOpts) {
- for(Int_t i=0; i<fArrayOpts->GetEntries(); i++){
- TObjString *o = (TObjString*)fArrayOpts->At(i);
- printf(" %i : %s \n", i, o->String().Data());
- }
- }
- printf("Granularity: %d in eta and %d in phi\n", GetNZ(), GetNPhi()) ;
- printf("Layout: phi = (%7.1f, %7.1f), eta = (%5.2f, %5.2f), IP = %7.2f -> for EMCAL envelope only\n",
- GetArm1PhiMin(), GetArm1PhiMax(),GetArm1EtaMin(), GetArm1EtaMax(), GetIPDistance() );
-
- printf( " ECAL : %d x (%f cm Pb, %f cm Sc) \n",
- GetNECLayers(), GetECPbRadThick(), GetECScintThick() ) ;
- printf(" fSampling %5.2f \n", fSampling );
- printf(" fIPDistance %6.3f cm \n", fIPDistance);
- printf(" fNPhi %i | fNZ %i \n", fNPhi, fNZ);
- printf(" fNCellsInModule %i : fNCellsInSupMod %i : fNCells %i\n",fNCellsInModule, fNCellsInSupMod, fNCells);
- printf(" X:Y module size %6.3f , %6.3f cm \n", fPhiModuleSize, fEtaModuleSize);
- printf(" X:Y tile size %6.3f , %6.3f cm \n", fPhiTileSize, fEtaTileSize);
- printf(" #of sampling layers %i(fNECLayers) \n", fNECLayers);
- printf(" fLongModuleSize %6.3f cm \n", fLongModuleSize);
- printf(" #supermodule in phi direction %i \n", fNPhiSuperModule );
- printf(" fILOSS %i : fIHADR %i \n", fILOSS, fIHADR);
- printf(" fTrd1Angle %7.4f\n", fTrd1Angle);
- printf(" f2Trd1Dx2 %7.4f\n", f2Trd1Dx2);
- printf("SM dimensions(TRD1) : dx %7.2f dy %7.2f dz %7.2f (SMOD, BOX)\n",
- fParSM[0],fParSM[1],fParSM[2]);
- printf(" fPhiGapForSM %7.4f cm (%7.4f <- phi size in degree)\n",
- fPhiGapForSM, TMath::ATan2(fPhiGapForSM,fIPDistance)*TMath::RadToDeg());
- if(GetKey110DEG()) printf(" Last two modules have size 10 degree in phi (180<phi<190)\n");
- printf(" phi SM boundaries \n");
- for(int i=0; i<fPhiBoundariesOfSM.GetSize()/2.; i++) {
- printf(" %i : %7.5f(%7.2f) -> %7.5f(%7.2f) : center %7.5f(%7.2f) \n", i,
- fPhiBoundariesOfSM[2*i], fPhiBoundariesOfSM[2*i]*TMath::RadToDeg(),
- fPhiBoundariesOfSM[2*i+1], fPhiBoundariesOfSM[2*i+1]*TMath::RadToDeg(),
- fPhiCentersOfSM[i], fPhiCentersOfSM[i]*TMath::RadToDeg());
- }
- printf(" fShishKebabTrd1Modules has %i modules : max eta %5.4f \n",
- fShishKebabTrd1Modules->GetSize(),fEtaMaxOfTRD1);
-
- printf("\n Cells grid in eta directions : size %i\n", fCentersOfCellsEtaDir.GetSize());
- for(Int_t i=0; i<fCentersOfCellsEtaDir.GetSize(); i++) {
- printf(" ind %2.2i : z %8.3f : x %8.3f \n", i,
- fCentersOfCellsEtaDir.At(i),fCentersOfCellsXDir.At(i));
- int ind=0; // Nov 21,2006
- for(Int_t iphi=0; iphi<fCentersOfCellsPhiDir.GetSize(); iphi++) {
- ind = iphi*fCentersOfCellsEtaDir.GetSize() + i;
- printf("%6.4f ", fEtaCentersOfCells[ind]);
- if((iphi+1)%12 == 0) printf("\n");
- }
- printf("\n");
-
- }
-
- printf("\n Cells grid in phi directions : size %i\n", fCentersOfCellsPhiDir.GetSize());
- for(Int_t i=0; i<fCentersOfCellsPhiDir.GetSize(); i++) {
- double phi=fPhiCentersOfCells.At(i);
- printf(" ind %2.2i : y %8.3f : phi %7.5f(%6.2f) \n", i, fCentersOfCellsPhiDir.At(i),
- phi, phi*TMath::RadToDeg());
- }
-
-}
-
-//______________________________________________________________________
-void AliEMCALGeometry::PrintCellIndexes(Int_t absId, int pri, const char *tit)
-{
- // Service methods
- Int_t nSupMod, nModule, nIphi, nIeta;
- Int_t iphi, ieta;
- TVector3 vg;
-
- GetCellIndex(absId, nSupMod, nModule, nIphi, nIeta);
- printf(" %s | absId : %i -> nSupMod %i nModule %i nIphi %i nIeta %i \n", tit, absId, nSupMod, nModule, nIphi, nIeta);
- if(pri>0) {
- GetCellPhiEtaIndexInSModule(nSupMod,nModule,nIphi,nIeta, iphi,ieta);
- printf(" local SM index : iphi %i : ieta %i \n", iphi,ieta);
- GetGlobal(absId, vg);
- printf(" vglob : mag %7.2f : perp %7.2f : z %7.2f : eta %6.4f : phi %6.4f(%6.2f) \n",
- vg.Mag(), vg.Perp(), vg.Z(), vg.Eta(), vg.Phi(), vg.Phi()*TMath::RadToDeg());
- }
-}
-
-//______________________________________________________________________
-void AliEMCALGeometry::CheckAdditionalOptions()
-{
- // Feb 06,2006
- // Additional options that
- // can be used to select
- // the specific geometry of
- // EMCAL to run
- // Dec 27,2006
- // adeed allILOSS= and allIHADR= for MIP investigation
- fArrayOpts = new TObjArray;
- Int_t nopt = AliEMCALHistoUtilities::ParseString(fGeoName, *fArrayOpts);
- if(nopt==1) { // no aditional option(s)
- fArrayOpts->Delete();
- delete fArrayOpts;
- fArrayOpts = 0;
- return;
- }
- for(Int_t i=1; i<nopt; i++){
- TObjString *o = (TObjString*)fArrayOpts->At(i);
-
- TString addOpt = o->String();
- Int_t indj=-1;
- for(Int_t j=0; j<fNAdditionalOpts; j++) {
- TString opt = fAdditionalOpts[j];
- if(addOpt.Contains(opt,TString::kIgnoreCase)) {
- indj = j;
- break;
- }
- }
- if(indj<0) {
- AliDebug(2,Form("<E> option |%s| unavailable : ** look to the file AliEMCALGeometry.h **\n",
- addOpt.Data()));
- assert(0);
- } else {
- AliDebug(2,Form("<I> option |%s| is valid : number %i : |%s|\n",
- addOpt.Data(), indj, fAdditionalOpts[indj]));
- if (addOpt.Contains("NL=",TString::kIgnoreCase)) {// number of sampling layers
- sscanf(addOpt.Data(),"NL=%i", &fNECLayers);
- AliDebug(2,Form(" fNECLayers %i (new) \n", fNECLayers));
- } else if(addOpt.Contains("PBTH=",TString::kIgnoreCase)) {//Thickness of the Pb(fECPbRadThicknes)
- sscanf(addOpt.Data(),"PBTH=%f", &fECPbRadThickness);
- } else if(addOpt.Contains("SCTH=",TString::kIgnoreCase)) {//Thickness of the Sc(fECScintThick)
- sscanf(addOpt.Data(),"SCTH=%f", &fECScintThick);
- } else if(addOpt.Contains("LATSS=",TString::kIgnoreCase)) {// Thickness of lateral steel strip (fLateralSteelStrip)
- sscanf(addOpt.Data(),"LATSS=%f", &fLateralSteelStrip);
- AliDebug(2,Form(" fLateralSteelStrip %f (new) \n", fLateralSteelStrip));
- } else if(addOpt.Contains("ILOSS=",TString::kIgnoreCase)) {// As in Geant
- sscanf(addOpt.Data(),"ALLILOSS=%i", &fILOSS);
- AliDebug(2,Form(" fILOSS %i \n", fILOSS));
- } else if(addOpt.Contains("IHADR=",TString::kIgnoreCase)) {// As in Geant
- sscanf(addOpt.Data(),"ALLIHADR=%i", &fIHADR);
- AliDebug(2,Form(" fIHADR %i \n", fIHADR));
- }
- }
- }
-}
-
-//__________________________________________________________________
-void AliEMCALGeometry::DefineSamplingFraction()
-{
- // Jun 05,2006
- // Look http://rhic.physics.wayne.edu/~pavlinov/ALICE/SHISHKEBAB/RES/linearityAndResolutionForTRD1.html
- // Keep for compatibilty
- //
- if(fNECLayers == 69) { // 10% layer reduction
- fSampling = 12.55;
- } else if(fNECLayers == 61) { // 20% layer reduction
- fSampling = 12.80;
- } else if(fNECLayers == 77) {
- if (fECScintThick>0.159 && fECScintThick<0.161) { // original sampling fraction, equal layers
- fSampling = 12.327; // fECScintThick = fECPbRadThickness = 0.160;
- } else if (fECScintThick>0.175 && fECScintThick<0.177) { // 10% Pb thicknes reduction
- fSampling = 10.5; // fECScintThick = 0.176, fECPbRadThickness=0.144;
- } else if(fECScintThick>0.191 && fECScintThick<0.193) { // 20% Pb thicknes reduction
- fSampling = 8.93; // fECScintThick = 0.192, fECPbRadThickness=0.128;
- }
-
- }
-}
-
-//______________________________________________________________________
-void AliEMCALGeometry::GetModulePhiEtaIndexInSModuleFromTRUIndex(Int_t itru, Int_t iphitru, Int_t ietatru, Int_t &iphiSM, Int_t &ietaSM) const
-{
-
- // This method transforms the (eta,phi) index of module in a
- // TRU matrix into Super Module (eta,phi) index.
-
- // Calculate in which row and column where the TRU are
- // ordered in the SM
-
- Int_t col = itru/ fNTRUPhi ; // indexes of TRU in SM
- Int_t row = itru - col*fNTRUPhi ;
-
- iphiSM = fNModulesInTRUPhi*row + iphitru ;
- ietaSM = fNModulesInTRUEta*col + ietatru ;
- //printf(" GetModulePhiEtaIndexInSModuleFromTRUIndex : itru %2i iphitru %2i ietatru %2i iphiSM %2i ietaSM %2i \n",
- // itru, iphitru, ietatru, iphiSM, ietaSM);
-}
//______________________________________________________________________
AliEMCALGeometry * AliEMCALGeometry::GetInstance(){
AliEMCALGeometry * rv = 0;
if ( fgGeom == 0 ) {
if ( strcmp(name,"") == 0 ) { // get default geometry
- fgGeom = new AliEMCALGeometry(fgDefaultGeometryName, title);
+ fgGeom = new AliEMCALGeometry(fgkDefaultGeometryName, title);
} else {
fgGeom = new AliEMCALGeometry(name, title);
} // end if strcmp(name,"")
- if ( fgInit ) rv = (AliEMCALGeometry * ) fgGeom;
+ if ( AliEMCALEMCGeometry::fgInit ) rv = (AliEMCALGeometry * ) fgGeom;
else {
rv = 0;
delete fgGeom;
return rv;
}
-//_____________________________________________________________________________
-Bool_t AliEMCALGeometry::IsInEMCAL(Double_t x, Double_t y, Double_t z) const {
- // Checks whether point is inside the EMCal volume, used in AliEMCALv*.cxx
- //
- // Code uses cylindrical approximation made of inner radius (for speed)
- //
- // Points behind EMCAl, i.e. R > outer radius, but eta, phi in acceptance
- // are considered to inside
-
- Double_t r=sqrt(x*x+y*y);
-
- if ( r > fEnvelop[0] ) {
- Double_t theta;
- theta = TMath::ATan2(r,z);
- Double_t eta;
- if(theta == 0)
- eta = 9999;
- else
- eta = -TMath::Log(TMath::Tan(theta/2.));
- if (eta < fArm1EtaMin || eta > fArm1EtaMax)
- return 0;
-
- Double_t phi = TMath::ATan2(y,x) * 180./TMath::Pi();
- if (phi < 0) phi += 360; // phi should go from 0 to 360 in this case
- if (phi > fArm1PhiMin && phi < fArm1PhiMax)
- return 1;
- }
- return 0;
-}
-
-//
-// == Shish-kebab cases ==
-//
-//________________________________________________________________________________________________
-Int_t AliEMCALGeometry::GetAbsCellId(Int_t nSupMod, Int_t nModule, Int_t nIphi, Int_t nIeta) const
-{
- // 27-aug-04;
- // corr. 21-sep-04;
- // 13-oct-05; 110 degree case
- // May 31, 2006; ALICE numbering scheme:
- // 0 <= nSupMod < fNumberOfSuperModules
- // 0 <= nModule < fNPHI * fNZ ( fNPHI * fNZ/2 for fKey110DEG=1)
- // 0 <= nIphi < fNPHIdiv
- // 0 <= nIeta < fNETAdiv
- // 0 <= absid < fNCells
- static Int_t id=0; // have to change from 0 to fNCells-1
- if(fKey110DEG == 1 && nSupMod >= 10) { // 110 degree case; last two supermodules
- id = fNCellsInSupMod*10 + (fNCellsInSupMod/2)*(nSupMod-10);
- } else {
- id = fNCellsInSupMod*nSupMod;
- }
- id += fNCellsInModule *nModule;
- id += fNPHIdiv *nIphi;
- id += nIeta;
- if(id<0 || id >= fNCells) {
-// printf(" wrong numerations !!\n");
-// printf(" id %6i(will be force to -1)\n", id);
-// printf(" fNCells %6i\n", fNCells);
-// printf(" nSupMod %6i\n", nSupMod);
-// printf(" nModule %6i\n", nModule);
-// printf(" nIphi %6i\n", nIphi);
-// printf(" nIeta %6i\n", nIeta);
- id = -TMath::Abs(id); // if negative something wrong
- }
- return id;
-}
-
-//________________________________________________________________________________________________
-Bool_t AliEMCALGeometry::CheckAbsCellId(Int_t absId) const
-{
- // May 31, 2006; only trd1 now
- if(absId<0 || absId >= fNCells) return kFALSE;
- else return kTRUE;
-}
-
-//________________________________________________________________________________________________
-Bool_t AliEMCALGeometry::GetCellIndex(Int_t absId,Int_t &nSupMod,Int_t &nModule,Int_t &nIphi,Int_t &nIeta) const
-{
- // 21-sep-04; 19-oct-05;
- // May 31, 2006; ALICE numbering scheme:
- //
- // In:
- // absId - cell is as in Geant, 0<= absId < fNCells;
- // Out:
- // nSupMod - super module(SM) number, 0<= nSupMod < fNumberOfSuperModules;
- // nModule - module number in SM, 0<= nModule < fNCellsInSupMod/fNCellsInSupMod or(/2) for tow last SM (10th and 11th);
- // nIphi - cell number in phi driection inside module; 0<= nIphi < fNPHIdiv;
- // nIeta - cell number in eta driection inside module; 0<= nIeta < fNETAdiv;
- //
- static Int_t tmp=0, sm10=0;
- if(!CheckAbsCellId(absId)) return kFALSE;
-
- sm10 = fNCellsInSupMod*10;
- if(fKey110DEG == 1 && absId >= sm10) { // 110 degree case; last two supermodules
- nSupMod = (absId-sm10) / (fNCellsInSupMod/2) + 10;
- tmp = (absId-sm10) % (fNCellsInSupMod/2);
- } else {
- nSupMod = absId / fNCellsInSupMod;
- tmp = absId % fNCellsInSupMod;
- }
-
- nModule = tmp / fNCellsInModule;
- tmp = tmp % fNCellsInModule;
- nIphi = tmp / fNPHIdiv;
- nIeta = tmp % fNPHIdiv;
-
- return kTRUE;
-}
-
-//________________________________________________________________________________________________
-void AliEMCALGeometry::GetModulePhiEtaIndexInSModule(Int_t nSupMod, Int_t nModule, int &iphim, int &ietam) const
-{
- // added nSupMod; - 19-oct-05 !
- // Alice numbering scheme - Jun 01,2006
- // ietam, iphi - indexes of module in two dimensional grid of SM
- // ietam - have to change from 0 to fNZ-1
- // iphim - have to change from 0 to nphi-1 (fNPhi-1 or fNPhi/2-1)
- static Int_t nphi;
-
- if(fKey110DEG == 1 && nSupMod>=10) nphi = fNPhi/2;
- else nphi = fNPhi;
-
- ietam = nModule/nphi;
- iphim = nModule%nphi;
-}
-
-//________________________________________________________________________________________________
-void AliEMCALGeometry::GetCellPhiEtaIndexInSModule(Int_t nSupMod, Int_t nModule, Int_t nIphi, Int_t nIeta,
-int &iphi, int &ieta) const
-{
- //
- // Added nSupMod; Nov 25, 05
- // Alice numbering scheme - Jun 01,2006
- // IN:
- // nSupMod - super module(SM) number, 0<= nSupMod < fNumberOfSuperModules;
- // nModule - module number in SM, 0<= nModule < fNCellsInSupMod/fNCellsInSupMod or(/2) for tow last SM (10th and 11th);
- // nIphi - cell number in phi driection inside module; 0<= nIphi < fNPHIdiv;
- // nIeta - cell number in eta driection inside module; 0<= nIeta < fNETAdiv;
- //
- // OUT:
- // ieta, iphi - indexes of cell(tower) in two dimensional grid of SM
- // ieta - have to change from 0 to (fNZ*fNETAdiv-1)
- // iphi - have to change from 0 to (fNPhi*fNPHIdiv-1 or fNPhi*fNPHIdiv/2-1)
- //
- static Int_t iphim, ietam;
-
- GetModulePhiEtaIndexInSModule(nSupMod,nModule, iphim, ietam);
- // ieta = ietam*fNETAdiv + (1-nIeta); // x(module) = -z(SM)
- ieta = ietam*fNETAdiv + (fNETAdiv - 1 - nIeta); // x(module) = -z(SM)
- iphi = iphim*fNPHIdiv + nIphi; // y(module) = y(SM)
-
- if(iphi<0 || ieta<0)
- AliDebug(1,Form(" nSupMod %i nModule %i nIphi %i nIeta %i => ieta %i iphi %i\n",
- nSupMod, nModule, nIphi, nIeta, ieta, iphi));
-}
-
-//________________________________________________________________________________________________
-Int_t AliEMCALGeometry::GetSuperModuleNumber(Int_t absId) const
-{
- // Return the number of the supermodule given the absolute
- // ALICE numbering id
-
- static Int_t nSupMod, nModule, nIphi, nIeta;
- GetCellIndex(absId, nSupMod, nModule, nIphi, nIeta);
- return nSupMod;
-}
-
-//________________________________________________________________________________________________
-void AliEMCALGeometry::GetModuleIndexesFromCellIndexesInSModule(Int_t nSupMod, Int_t iphi, Int_t ieta,
- Int_t &iphim, Int_t &ietam, Int_t &nModule) const
-{
- // Transition from cell indexes (ieta,iphi) to module indexes (ietam,iphim, nModule)
- static Int_t nphi;
- nphi = GetNumberOfModuleInPhiDirection(nSupMod);
-
- ietam = ieta/fNETAdiv;
- iphim = iphi/fNPHIdiv;
- nModule = ietam * nphi + iphim;
-}
-
-//________________________________________________________________________________________________
-Int_t AliEMCALGeometry::GetAbsCellIdFromCellIndexes(Int_t nSupMod, Int_t iphi, Int_t ieta) const
-{
- // Transition from super module number(nSupMod) and cell indexes (ieta,iphi) to absId
- static Int_t ietam, iphim, nModule;
- static Int_t nIeta, nIphi; // cell indexes in module
-
- GetModuleIndexesFromCellIndexesInSModule(nSupMod, iphi, ieta, ietam, iphim, nModule);
-
- nIeta = ieta%fNETAdiv;
- nIeta = fNETAdiv - 1 - nIeta;
- nIphi = iphi%fNPHIdiv;
-
- return GetAbsCellId(nSupMod, nModule, nIphi, nIeta);
-}
-
-
-// Methods for AliEMCALRecPoint - Feb 19, 2006
-//________________________________________________________________________________________________
-Bool_t AliEMCALGeometry::RelPosCellInSModule(Int_t absId, Double_t &xr, Double_t &yr, Double_t &zr) const
-{
- // Look to see what the relative
- // position inside a given cell is
- // for a recpoint.
- // Alice numbering scheme - Jun 08, 2006
- // In:
- // absId - cell is as in Geant, 0<= absId < fNCells;
- // OUT:
- // xr,yr,zr - x,y,z coordinates of cell with absId inside SM
-
- // Shift index taking into account the difference between standard SM
- // and SM of half size in phi direction
- const Int_t kphiIndexShift = fCentersOfCellsPhiDir.GetSize()/4; // Nov 22, 2006; was 6 for cas 2X2
- static Int_t nSupMod, nModule, nIphi, nIeta, iphi, ieta;
- if(!CheckAbsCellId(absId)) return kFALSE;
-
- GetCellIndex(absId, nSupMod, nModule, nIphi, nIeta);
- GetCellPhiEtaIndexInSModule(nSupMod,nModule,nIphi,nIeta, iphi, ieta);
-
- xr = fCentersOfCellsXDir.At(ieta);
- zr = fCentersOfCellsEtaDir.At(ieta);
-
- if(nSupMod<10) {
- yr = fCentersOfCellsPhiDir.At(iphi);
- } else {
- yr = fCentersOfCellsPhiDir.At(iphi + kphiIndexShift);
- }
- AliDebug(1,Form("absId %i nSupMod %i iphi %i ieta %i xr %f yr %f zr %f ",absId,nSupMod,iphi,ieta,xr,yr,zr));
-
- return kTRUE;
-}
-
-//________________________________________________________________________________________________
-Bool_t AliEMCALGeometry::RelPosCellInSModule(Int_t absId, Double_t loc[3]) const
-{
- // Alice numbering scheme - Jun 03, 2006
- loc[0] = loc[1] = loc[2]=0.0;
- if(RelPosCellInSModule(absId, loc[0],loc[1],loc[2])) {
- return kTRUE;
- }
- return kFALSE;
-}
-
-//________________________________________________________________________________________________
-Bool_t AliEMCALGeometry::RelPosCellInSModule(Int_t absId, TVector3 &vloc) const
-{
- static Double_t loc[3];
- if(RelPosCellInSModule(absId,loc)) {
- vloc.SetXYZ(loc[0], loc[1], loc[2]);
- return kTRUE;
- } else {
- vloc.SetXYZ(0,0,0);
- return kFALSE;
- }
- // Alice numbering scheme - Jun 03, 2006
-}
-
//________________________________________________________________________________________________
Bool_t AliEMCALGeometry::RelPosCellInSModule(Int_t absId, Double_t distEff, Double_t &xr, Double_t &yr, Double_t &zr) const
{
modM = GetShishKebabModule(ietamM); // do I need this ?
maxAbsIdCopy = maxAbsId;
}
+
if(ietamM !=0) {
- distCorr = GetEtaModuleSize()*(ietam-ietamM)/TMath::Tan(modM->GetTheta()); // Stay here
+ distCorr = fEMCGeometry->GetEtaModuleSize()*(ietam-ietamM)/TMath::Tan(modM->GetTheta()); // Stay here
//printf(" distCorr %f | dist %f | ietam %i -> etamM %i\n", distCorr, dist, ietam, ietamM);
}
// distEff += distCorr;
return kTRUE;
}
-//________________________________________________________________________________________________
-void AliEMCALGeometry::CreateListOfTrd1Modules()
-{
- // Generate the list of Trd1 modules
- // which will make up the EMCAL
- // geometry
-
- AliDebug(2,Form(" AliEMCALGeometry::CreateListOfTrd1Modules() started "));
-
- AliEMCALShishKebabTrd1Module *mod=0, *mTmp=0; // current module
- if(fShishKebabTrd1Modules == 0) {
- fShishKebabTrd1Modules = new TList;
- fShishKebabTrd1Modules->SetName("ListOfTRD1");
- for(int iz=0; iz< GetNZ(); iz++) {
- if(iz==0) {
- mod = new AliEMCALShishKebabTrd1Module(TMath::Pi()/2.,this);
- } else {
- mTmp = new AliEMCALShishKebabTrd1Module(*mod);
- mod = mTmp;
- }
- fShishKebabTrd1Modules->Add(mod);
- }
- } else {
- AliDebug(2,Form(" Already exits : "));
- }
- mod = (AliEMCALShishKebabTrd1Module*)fShishKebabTrd1Modules->At(fShishKebabTrd1Modules->GetSize()-1);
- fEtaMaxOfTRD1 = mod->GetMaxEtaOfModule(0);
-
- AliDebug(2,Form(" fShishKebabTrd1Modules has %i modules : max eta %5.4f \n",
- fShishKebabTrd1Modules->GetSize(),fEtaMaxOfTRD1));
- // Feb 20,2006;
- // Jun 01, 2006 - ALICE numbering scheme
- // define grid for cells in eta(z) and x directions in local coordinates system of SM
- // Works just for 2x2 case only -- ?? start here
- //
- //
- // Define grid for cells in phi(y) direction in local coordinates system of SM
- // as for 2X2 as for 3X3 - Nov 8,2006
- //
- AliDebug(2,Form(" Cells grid in phi directions : size %i\n", fCentersOfCellsPhiDir.GetSize()));
- Int_t ind=0; // this is phi index
- Int_t ieta=0, nModule=0, iphiTemp;
- Double_t xr=0., zr=0., theta=0., phi=0., eta=0., r=0., x=0.,y=0.;
- TVector3 vglob;
- Double_t ytCenterModule=0.0, ytCenterCell=0.0;
-
- fCentersOfCellsPhiDir.Set(fNPhi*fNPHIdiv);
- fPhiCentersOfCells.Set(fNPhi*fNPHIdiv);
-
- Double_t r0 = GetIPDistance() + GetLongModuleSize()/2.;
- for(Int_t it=0; it<fNPhi; it++) { // cycle on modules
- ytCenterModule = -fParSM[1] + fPhiModuleSize*(2*it+1)/2; // center of module
- for(Int_t ic=0; ic<fNPHIdiv; ic++) { // cycle on cells in module
- if(fNPHIdiv==2) {
- ytCenterCell = ytCenterModule + fPhiTileSize *(2*ic-1)/2.;
- } else if(fNPHIdiv==3){
- ytCenterCell = ytCenterModule + fPhiTileSize *(ic-1);
- } else if(fNPHIdiv==1){
- ytCenterCell = ytCenterModule;
- }
- fCentersOfCellsPhiDir.AddAt(ytCenterCell,ind);
- // Define grid on phi direction
- // Grid is not the same for different eta bin;
- // Effect is small but is still here
- phi = TMath::ATan2(ytCenterCell, r0);
- fPhiCentersOfCells.AddAt(phi, ind);
- AliDebug(2,Form(" ind %2.2i : y %8.3f ", ind, fCentersOfCellsPhiDir.At(ind)));
- ind++;
- }
- }
-
- fCentersOfCellsEtaDir.Set(fNZ *fNETAdiv);
- fCentersOfCellsXDir.Set(fNZ *fNETAdiv);
- fEtaCentersOfCells.Set(fNZ *fNETAdiv * fNPhi*fNPHIdiv);
- AliDebug(2,Form(" Cells grid in eta directions : size %i\n", fCentersOfCellsEtaDir.GetSize()));
- for(Int_t it=0; it<fNZ; it++) {
- AliEMCALShishKebabTrd1Module *trd1 = GetShishKebabModule(it);
- nModule = fNPhi*it;
- for(Int_t ic=0; ic<fNETAdiv; ic++) {
- if(fNPHIdiv==2) {
- trd1->GetCenterOfCellInLocalCoordinateofSM(ic, xr, zr); // case of 2X2
- GetCellPhiEtaIndexInSModule(0, nModule, 0, ic, iphiTemp, ieta);
- } if(fNPHIdiv==3) {
- trd1->GetCenterOfCellInLocalCoordinateofSM_3X3(ic, xr, zr); // case of 3X3
- GetCellPhiEtaIndexInSModule(0, nModule, 0, ic, iphiTemp, ieta);
- } if(fNPHIdiv==1) {
- trd1->GetCenterOfCellInLocalCoordinateofSM_1X1(xr, zr); // case of 1X1
- GetCellPhiEtaIndexInSModule(0, nModule, 0, ic, iphiTemp, ieta);
- }
- fCentersOfCellsXDir.AddAt(float(xr) - fParSM[0],ieta);
- fCentersOfCellsEtaDir.AddAt(float(zr) - fParSM[2],ieta);
- // Define grid on eta direction for each bin in phi
- for(int iphi=0; iphi<fCentersOfCellsPhiDir.GetSize(); iphi++) {
- x = xr + trd1->GetRadius();
- y = fCentersOfCellsPhiDir[iphi];
- r = TMath::Sqrt(x*x + y*y + zr*zr);
- theta = TMath::ACos(zr/r);
- eta = AliEMCALShishKebabTrd1Module::ThetaToEta(theta);
- // ind = ieta*fCentersOfCellsPhiDir.GetSize() + iphi;
- ind = iphi*fCentersOfCellsEtaDir.GetSize() + ieta;
- fEtaCentersOfCells.AddAt(eta, ind);
- }
- //printf(" ieta %i : xr + trd1->GetRadius() %f : zr %f : eta %f \n", ieta, xr + trd1->GetRadius(), zr, eta);
- }
- }
- for(Int_t i=0; i<fCentersOfCellsEtaDir.GetSize(); i++) {
- AliDebug(2,Form(" ind %2.2i : z %8.3f : x %8.3f", i+1,
- fCentersOfCellsEtaDir.At(i),fCentersOfCellsXDir.At(i)));
- }
-
-}
-
-//________________________________________________________________________________________________
-void AliEMCALGeometry::GetGlobal(const Double_t *loc, Double_t *glob, int ind) const
-{
- // Figure out the global numbering
- // of a given supermodule from the
- // local numbering and the transformation
- // matrix stored by the geometry manager (allows for misaligned
- // geometry)
-
- if(ind>=0 && ind < GetNumberOfSuperModules()) {
- TString volpath = "ALIC_1/XEN1_1/SMOD_";
- volpath += ind+1;
-
- if(GetKey110DEG() && ind>=10) {
- volpath = "ALIC_1/XEN1_1/SM10_";
- volpath += ind-10+1;
- }
-
- if(!gGeoManager->cd(volpath.Data()))
- AliFatal(Form("AliEMCALGeometry::GeoManager cannot find path %s!",volpath.Data()));
-
- TGeoHMatrix* m = gGeoManager->GetCurrentMatrix();
- if(m) {
- m->LocalToMaster(loc, glob);
- } else {
- AliFatal("Geo matrixes are not loaded \n") ;
- }
- }
-}
-
-//________________________________________________________________________________________________
-void AliEMCALGeometry::GetGlobal(const TVector3 &vloc, TVector3 &vglob, int ind) const
-{
- //Figure out the global numbering
- //of a given supermodule from the
- //local numbering given a 3-vector location
-
- static Double_t tglob[3], tloc[3];
- vloc.GetXYZ(tloc);
- GetGlobal(tloc, tglob, ind);
- vglob.SetXYZ(tglob[0], tglob[1], tglob[2]);
-}
-
-//________________________________________________________________________________________________
-void AliEMCALGeometry::GetGlobal(Int_t absId , double glob[3]) const
-{
- // Alice numbering scheme - Jun 03, 2006
- static Int_t nSupMod, nModule, nIphi, nIeta;
- static double loc[3];
-
- if (!gGeoManager || !gGeoManager->IsClosed()) {
- AliError("Can't get the global coordinates! gGeoManager doesn't exist or it is still open!");
- return;
- }
-
- glob[0]=glob[1]=glob[2]=0.0; // bad case
- if(RelPosCellInSModule(absId, loc)) {
- GetCellIndex(absId, nSupMod, nModule, nIphi, nIeta);
-
- TString volpath = "ALIC_1/XEN1_1/SMOD_";
- volpath += (nSupMod+1);
-
- if(GetKey110DEG() && nSupMod>=10) {
- volpath = "ALIC_1/XEN1_1/SM10_";
- volpath += (nSupMod-10+1);
- }
- if(!gGeoManager->cd(volpath.Data()))
- AliFatal(Form("GeoManager cannot find path %s!",volpath.Data()));
-
- TGeoHMatrix* m = gGeoManager->GetCurrentMatrix();
- if(m) {
- m->LocalToMaster(loc, glob);
- } else {
- AliFatal("Geo matrixes are not loaded \n") ;
- }
- }
-}
-
-//___________________________________________________________________
-void AliEMCALGeometry::GetGlobal(Int_t absId , TVector3 &vglob) const
-{
- // Alice numbering scheme - Jun 03, 2006
- static Double_t glob[3];
-
- GetGlobal(absId, glob);
- vglob.SetXYZ(glob[0], glob[1], glob[2]);
+//
+// == Shish-kebab cases ==
+//
-}
//____________________________________________________________________________
void AliEMCALGeometry::GetGlobal(const AliRecPoint* /*rp*/, TVector3& /* vglob */) const
GetGlobal(vloc, vglob, nSupMod);
}
-//________________________________________________________________________________________________
-void AliEMCALGeometry::EtaPhiFromIndex(Int_t absId,Double_t &eta,Double_t &phi) const
-{
- // Nov 16, 2006- float to double
- // version for TRD1 only
- static TVector3 vglob;
- GetGlobal(absId, vglob);
- eta = vglob.Eta();
- phi = vglob.Phi();
-}
-
-//________________________________________________________________________________________________
-void AliEMCALGeometry::EtaPhiFromIndex(Int_t absId,Float_t &eta,Float_t &phi) const
-{
- // Nov 16,2006 - should be discard in future
- static TVector3 vglob;
- GetGlobal(absId, vglob);
- eta = float(vglob.Eta());
- phi = float(vglob.Phi());
-}
-
-//________________________________________________________________________________________________
-Bool_t AliEMCALGeometry::GetPhiBoundariesOfSM(Int_t nSupMod, Double_t &phiMin, Double_t &phiMax) const
-{
- // 0<= nSupMod <=11; phi in rad
- static int i;
- if(nSupMod<0 || nSupMod >11) return kFALSE;
- i = nSupMod/2;
- phiMin = fPhiBoundariesOfSM[2*i];
- phiMax = fPhiBoundariesOfSM[2*i+1];
- return kTRUE;
-}
-
-//________________________________________________________________________________________________
-Bool_t AliEMCALGeometry::GetPhiBoundariesOfSMGap(Int_t nPhiSec, Double_t &phiMin, Double_t &phiMax) const
-{
- // 0<= nPhiSec <=4; phi in rad
- // 0; gap boundaries between 0th&2th | 1th&3th SM
- // 1; gap boundaries between 2th&4th | 3th&5th SM
- // 2; gap boundaries between 4th&6th | 5th&7th SM
- // 3; gap boundaries between 6th&8th | 7th&9th SM
- // 4; gap boundaries between 8th&10th | 9th&11th SM
- if(nPhiSec<0 || nPhiSec >4) return kFALSE;
- phiMin = fPhiBoundariesOfSM[2*nPhiSec+1];
- phiMax = fPhiBoundariesOfSM[2*nPhiSec+2];
- return kTRUE;
-}
-
-//________________________________________________________________________________________________
-Bool_t AliEMCALGeometry::SuperModuleNumberFromEtaPhi(Double_t eta, Double_t phi, Int_t &nSupMod) const
-{
- // Return false if phi belongs a phi cracks between SM
-
- static Int_t i;
-
- if(TMath::Abs(eta) > fEtaMaxOfTRD1) return kFALSE;
-
- phi = TVector2::Phi_0_2pi(phi); // move phi to (0,2pi) boundaries
- for(i=0; i<6; i++) {
- if(phi>=fPhiBoundariesOfSM[2*i] && phi<=fPhiBoundariesOfSM[2*i+1]) {
- nSupMod = 2*i;
- if(eta < 0.0) nSupMod++;
- AliDebug(1,Form("eta %f phi %f(%5.2f) : nSupMod %i : #bound %i", eta,phi,phi*TMath::RadToDeg(), nSupMod,i));
- return kTRUE;
- }
- }
- return kFALSE;
-}
-
-//________________________________________________________________________________________________
-Bool_t AliEMCALGeometry::GetAbsCellIdFromEtaPhi(Double_t eta, Double_t phi, Int_t &absId) const
-{
- // Nov 17,2006
- // stay here - phi problem as usual
- static Int_t nSupMod, i, ieta, iphi, etaShift, nphi;
- static Double_t absEta=0.0, d=0.0, dmin=0.0, phiLoc;
- absId = nSupMod = - 1;
- if(SuperModuleNumberFromEtaPhi(eta, phi, nSupMod)) {
- // phi index first
- phi = TVector2::Phi_0_2pi(phi);
- phiLoc = phi - fPhiCentersOfSM[nSupMod/2];
- nphi = fPhiCentersOfCells.GetSize();
- if(nSupMod>=10) {
- phiLoc = phi - 190.*TMath::DegToRad();
- nphi /= 2;
- }
-
- dmin = TMath::Abs(fPhiCentersOfCells[0]-phiLoc);
- iphi = 0;
- for(i=1; i<nphi; i++) {
- d = TMath::Abs(fPhiCentersOfCells[i] - phiLoc);
- if(d < dmin) {
- dmin = d;
- iphi = i;
- }
- // printf(" i %i : d %f : dmin %f : fPhiCentersOfCells[i] %f \n", i, d, dmin, fPhiCentersOfCells[i]);
- }
- // odd SM are turned with respect of even SM - reverse indexes
- AliDebug(2,Form(" iphi %i : dmin %f (phi %f, phiLoc %f ) ", iphi, dmin, phi, phiLoc));
- // eta index
- absEta = TMath::Abs(eta);
- etaShift = iphi*fCentersOfCellsEtaDir.GetSize();
- dmin = TMath::Abs(fEtaCentersOfCells[etaShift]-absEta);
- ieta = 0;
- for(i=1; i<fCentersOfCellsEtaDir.GetSize(); i++) {
- d = TMath::Abs(fEtaCentersOfCells[i+etaShift] - absEta);
- if(d < dmin) {
- dmin = d;
- ieta = i;
- }
- }
- AliDebug(2,Form(" ieta %i : dmin %f (eta=%f) : nSupMod %i ", ieta, dmin, eta, nSupMod));
-
- if(eta<0) iphi = (nphi-1) - iphi;
- absId = GetAbsCellIdFromCellIndexes(nSupMod, iphi, ieta);
-
- return kTRUE;
- }
- return kFALSE;
-}
-
-//________________________________________________________________________________________________
-AliEMCALShishKebabTrd1Module* AliEMCALGeometry::GetShishKebabModule(Int_t neta) const
-{
- //This method was too long to be
- //included in the header file - the
- //rule checker complained about it's
- //length, so we move it here. It returns the
- //shishkebabmodule at a given eta index point.
-
- static AliEMCALShishKebabTrd1Module* trd1=0;
- if(fShishKebabTrd1Modules && neta>=0 && neta<fShishKebabTrd1Modules->GetSize()) {
- trd1 = (AliEMCALShishKebabTrd1Module*)fShishKebabTrd1Modules->At(neta);
- } else trd1 = 0;
- return trd1;
-}
-
-//________________________________________________________________________________________________
-Int_t AliEMCALGeometry::GetAbsTRUNumberFromNumberInSm(const Int_t row, const Int_t col, const Int_t sm)
-{ // Nov 6, 2007
- Int_t itru = row + col*GetNModulesInTRUPhi() + sm*GetNTRU();
- // printf(" GetAbsTRUNumberFromNumberInSm : row %2i col %2i sm %2i -> itru %2i\n", row, col, sm, itru);
- return itru;
-}
-
-//________________________________________________________________________________________________
-void AliEMCALGeometry::Browse(TBrowser* b)
-{
- //Browse the modules
- if(fShishKebabTrd1Modules) b->Add(fShishKebabTrd1Modules);
-}
-
-//________________________________________________________________________________________________
-Bool_t AliEMCALGeometry::IsFolder() const
-{
- //Check if fShishKebabTrd1Modules is in folder
- if(fShishKebabTrd1Modules) return kTRUE;
- else return kFALSE;
-}
-
-//________________________________________________________________________________________________
-Double_t AliEMCALGeometry::GetPhiCenterOfSM(Int_t nsupmod) const
-{
- //returns center of supermodule in phi
- int i = nsupmod/2;
- return fPhiCentersOfSM[i];
-
-}
-//____________________________________________________________________________
-Bool_t AliEMCALGeometry::Impact(const TParticle * particle) const
-{
- // Tells if a particle enters EMCAL
- Bool_t in=kFALSE;
- Int_t AbsID=0;
- TVector3 vtx(particle->Vx(),particle->Vy(),particle->Vz());
- TVector3 vimpact(0,0,0);
- ImpactOnEmcal(vtx,particle->Theta(),particle->Phi(),AbsID,vimpact);
- if(AbsID!=0)
- in=kTRUE;
- return in;
-}
-//____________________________________________________________________________
-void AliEMCALGeometry::ImpactOnEmcal(TVector3 vtx, Double_t theta, Double_t phi,
- Int_t & absId, TVector3 & vimpact) const
-{
- // calculates the impact coordinates on EMCAL (centre of a tower/not on EMCAL surface)
- // of a neutral particle
- // emitted in the vertex vtx[3] with direction theta and phi in the ALICE global coordinate system
-
- TVector3 p(TMath::Sin(theta)*TMath::Cos(phi),TMath::Sin(theta)*TMath::Sin(phi),TMath::Cos(theta)) ;
-
- vimpact.SetXYZ(0,0,0);
- absId=-1;
- if(phi==0 || theta==0) return;
-
- TVector3 direction;
- Double_t factor = (GetIPDistance()-vtx[1])/p[1];
- direction = vtx + factor*p;
-
- if (!gGeoManager){
- AliFatal("Geo manager not initialized\n");
- }
- //from particle direction -> tower hitted
- GetAbsCellIdFromEtaPhi(direction.Eta(),direction.Phi(),absId);
-
- //tower absID hitted -> tower/module plane (evaluated at the center of the tower)
- Int_t nSupMod, nModule, nIphi, nIeta;
- Double_t loc[3],loc2[3],loc3[3];
- Double_t glob[3]={},glob2[3]={},glob3[3]={};
-
- if(!RelPosCellInSModule(absId,loc)) return;
-
- //loc is cell center of tower
- GetCellIndex(absId, nSupMod, nModule, nIphi, nIeta);
-
- //look at 2 neighbours-s cell using nIphi={0,1} and nIeta={0,1}
- Int_t nIphi2,nIeta2,absId2,absId3;
- if(nIeta==0) nIeta2=1;
- else nIeta2=0;
- absId2=GetAbsCellId(nSupMod,nModule,nIphi,nIeta2);
- if(nIphi==0) nIphi2=1;
- else nIphi2=0;
- absId3=GetAbsCellId(nSupMod,nModule,nIphi2,nIeta);
-
- //2nd point on emcal cell plane
- if(!RelPosCellInSModule(absId2,loc2)) return;
-
- //3rd point on emcal cell plane
- if(!RelPosCellInSModule(absId3,loc3)) return;
-
- TString volpath = "ALIC_1/XEN1_1/SMOD_";
- volpath += (nSupMod+1);
-
- if(GetKey110DEG() && nSupMod>=10) {
- volpath = "ALIC_1/XEN1_1/SM10_";
- volpath += (nSupMod-10+1);
- }
- if(!gGeoManager->cd(volpath.Data())){
- AliFatal(Form("GeoManager cannot find path %s!",volpath.Data()))
- return;
- }
- TGeoHMatrix* m = gGeoManager->GetCurrentMatrix();
- if(m) {
- m->LocalToMaster(loc, glob);
- m->LocalToMaster(loc2, glob2);
- m->LocalToMaster(loc3, glob3);
- } else {
- AliFatal("Geo matrixes are not loaded \n") ;
- }
-
- //Equation of Plane from glob,glob2,glob3 (Ax+By+Cz+D=0)
- Double_t A = glob[1]*(glob2[2]-glob3[2]) + glob2[1]*(glob3[2]-glob[2]) + glob3[1]*(glob[2]-glob2[2]);
- Double_t B = glob[2]*(glob2[0]-glob3[0]) + glob2[2]*(glob3[0]-glob[0]) + glob3[2]*(glob[0]-glob2[0]);
- Double_t C = glob[0]*(glob2[1]-glob3[1]) + glob2[0]*(glob3[1]-glob[1]) + glob3[0]*(glob[1]-glob2[1]);
- Double_t D = glob[0]*(glob2[1]*glob3[2]-glob3[1]*glob2[2]) + glob2[0]*(glob3[1]*glob[2]-glob[1]*glob3[2]) + glob3[0]*(glob[1]*glob2[2]-glob2[1]*glob[2]);
- D=-D;
-
- //shift equation of plane from tower/module center to surface along vector (A,B,C) normal to tower/module plane
- Double_t dist = GetLongModuleSize()/2.;
- Double_t norm = TMath::Sqrt(A*A+B*B+C*C);
- Double_t glob4[3]={};
- TVector3 dir(A,B,C);
- TVector3 point(glob[0],glob[1],glob[2]);
- if(point.Dot(dir)<0) dist*=-1;
- glob4[0]=glob[0]-dist*A/norm;
- glob4[1]=glob[1]-dist*B/norm;
- glob4[2]=glob[2]-dist*C/norm;
- D = glob4[0]*A + glob4[1]*B + glob4[2]*C ;
- D = -D;
-
- //Line determination (2 points for equation of line : vtx and direction)
- //impact between line (particle) and plane (module/tower plane)
- Double_t den = A*(vtx(0)-direction(0)) + B*(vtx(1)-direction(1)) + C*(vtx(2)-direction(2));
- if(den==0){
- printf("ImpactOnEmcal() No solution :\n");
- return;
- }
-
- Double_t length = A*vtx(0)+B*vtx(1)+C*vtx(2)+D;
- length /=den;
-
- vimpact.SetXYZ(vtx(0)+length*(direction(0)-vtx(0)),vtx(1)+length*(direction(1)-vtx(1)),vtx(2)+length*(direction(2)-vtx(2)));
-
- //shift vimpact from tower/module surface to center along vector (A,B,C) normal to tower/module plane
- vimpact.SetXYZ(vimpact(0)+dist*A/norm,vimpact(1)+dist*B/norm,vimpact(2)+dist*C/norm);
-
- return;
-}
//*-- and : Gustavo Conesa: Add TRU mapping. TRU parameters still not fixed.
// --- ROOT system ---
-class TString ;
-class TObjArray;
-class TVector3;
-class TGeoMatrix;
-class TParticle ;
-class TClonesArray ;
+#include <Riostream.h>
#include <TMath.h>
#include <TArrayD.h>
-class assert;
-class Riostream;
-class TClonesArray;
-class TGeoNode;
-class TGeoManager;
+#include <TMatrixF.h>
+class TVector3;
// --- AliRoot header files ---
-class AliEMCALGeometry;
-class AliEMCALShishKebabTrd1Module;
+#include "AliEMCALGeoUtils.h"
+#include "AliEMCALEMCGeometry.h"
+class AliRecPoint;
class AliEMCALRecPoint;
-class AliEMCALDigit;
-#include "AliGeometry.h"
+class AliEMCALGeometry : public AliEMCALGeoUtils {
-class AliEMCALGeometry : public AliGeometry {
public:
+
+ AliEMCALGeometry(); // default ctor only for internal usage (singleton)
AliEMCALGeometry(const AliEMCALGeometry& geom);
virtual ~AliEMCALGeometry(void);
return *this;
};
- AliEMCALGeometry(); // default ctor only for internal usage (singleton)
//////////
// General
//
- Bool_t IsInitialized(void) const { return fgInit ; }
- static const Char_t* GetDefaultGeometryName() {return fgDefaultGeometryName;}
- void PrintGeometry(); //*MENU*
- void PrintCellIndexes(Int_t absId=0, int pri=0, const char *tit=""); //*MENU*
- virtual void Browse(TBrowser* b);
- virtual Bool_t IsFolder() const;
-
+ Bool_t IsInitialized(void) const { return AliEMCALEMCGeometry::fgInit ; }
+ static const Char_t* GetDefaultGeometryName() {return AliEMCALEMCGeometry::fgkDefaultGeometryName;}
+
//////////////////////////
// Global geometry methods
//
- void GetGlobal(const Double_t *loc, Double_t *glob, int ind) const;
- void GetGlobal(const TVector3 &vloc, TVector3 &vglob, int ind) const;
- void GetGlobal(Int_t absId, Double_t glob[3]) const;
- void GetGlobal(Int_t absId, TVector3 &vglob) const;
- //
+ using AliEMCALGeoUtils::GetGlobal;
+
virtual void GetGlobal(const AliRecPoint *rp, TVector3 &vglob) const;
virtual void GetGlobal(const AliRecPoint *rp, TVector3 & gpos, TMatrixF & /* gmat */)
const {GetGlobal(rp,gpos); }
virtual void GetGlobalEMCAL(const AliEMCALRecPoint *rp, TVector3 & gpos, TMatrixF & /* gmat */)
const {GetGlobalEMCAL(rp,gpos); }
- /////////////
- // TRD1 stuff
- void CreateListOfTrd1Modules();
- TList *GetShishKebabTrd1Modules() const {return fShishKebabTrd1Modules;}
- AliEMCALShishKebabTrd1Module *GetShishKebabModule(Int_t neta) const;
+ // Return EMC geometry parameters
+ AliEMCALEMCGeometry * GetEMCGeometry() const {return fEMCGeometry ;}
//////////////////////////////////////
// Return EMCAL geometrical parameters
//
- const Char_t* GetNameOfEMCALEnvelope() const { const Char_t* env = "XEN1"; return env ;}
- Float_t GetArm1PhiMin() const { return fArm1PhiMin ; }
- Float_t GetArm1PhiMax() const { return fArm1PhiMax ; }
- Float_t GetArm1EtaMin() const { return fArm1EtaMin;}
- Float_t GetArm1EtaMax() const { return fArm1EtaMax;}
- Float_t GetIPDistance() const { return fIPDistance;}
- Float_t GetEnvelop(Int_t index) const { return fEnvelop[index] ; }
- Float_t GetShellThickness() const { return fShellThickness ; }
- Float_t GetZLength() const { return fZLength ; }
- Int_t GetNECLayers() const {return fNECLayers ;}
- Int_t GetNZ() const {return fNZ ;}
- Int_t GetNEta() const {return fNZ ;}
- Int_t GetNPhi() const {return fNPhi ;}
- Float_t GetECPbRadThick()const {return fECPbRadThickness;}
- Float_t GetECScintThick() const {return fECScintThick;}
- Float_t GetSampling() const {return fSampling ; }
- Int_t GetNumberOfSuperModules() const {return fNumberOfSuperModules;}
- Float_t GetfPhiGapForSuperModules() const {return fPhiGapForSM;}
- Float_t GetPhiModuleSize() const {return fPhiModuleSize;}
- Float_t GetEtaModuleSize() const {return fEtaModuleSize;}
- Float_t GetFrontSteelStrip() const {return fFrontSteelStrip;}
- Float_t GetLateralSteelStrip() const {return fLateralSteelStrip;}
- Float_t GetPassiveScintThick() const {return fPassiveScintThick;}
- Float_t GetPhiTileSize() const {return fPhiTileSize;}
- Float_t GetEtaTileSize() const {return fEtaTileSize;}
- Int_t GetNPhiSuperModule() const {return fNPhiSuperModule;}
- Int_t GetNPHIdiv() const {return fNPHIdiv ;}
- Int_t GetNETAdiv() const {return fNETAdiv ;}
- Int_t GetNCells() const {return fNCells;}
- Float_t GetLongModuleSize() const {return fLongModuleSize;}
- Float_t GetTrd1Angle() const {return fTrd1Angle;}
- Float_t Get2Trd1Dx2() const {return f2Trd1Dx2;}
+ const Char_t* GetNameOfEMCALEnvelope(void) const {return fEMCGeometry->GetNameOfEMCALEnvelope();}
+ Float_t GetArm1PhiMin(void) const { return fEMCGeometry->GetArm1PhiMin(); }
+ Float_t GetArm1PhiMax(void) const { return fEMCGeometry->GetArm1PhiMax(); }
+ Float_t GetArm1EtaMin(void) const { return fEMCGeometry->GetArm1EtaMin();}
+ Float_t GetArm1EtaMax(void) const { return fEMCGeometry->GetArm1EtaMax();}
+ Float_t GetIPDistance(void) const { return fEMCGeometry->GetIPDistance();}
+ Float_t GetEnvelop(Int_t index) const { return fEMCGeometry->GetEnvelop(index); }
+ Float_t GetShellThickness(void) const { return fEMCGeometry->GetShellThickness(); }
+ Float_t GetZLength(void) const { return fEMCGeometry->GetZLength(); }
+ Int_t GetNECLayers(void) const {return fEMCGeometry->GetNECLayers();}
+ Int_t GetNZ(void) const {return fEMCGeometry->GetNZ();}
+ Int_t GetNEta(void) const {return fEMCGeometry->GetNEta();}
+ Int_t GetNPhi(void) const {return fEMCGeometry->GetNPhi();}
+ Float_t GetECPbRadThick(void)const {return fEMCGeometry->GetECPbRadThick();}
+ Float_t GetECScintThick(void) const {return fEMCGeometry->GetECScintThick();}
+ Float_t GetSampling(void) const {return fEMCGeometry->GetSampling(); }
+ Int_t GetNumberOfSuperModules(void) const {return fEMCGeometry->GetNumberOfSuperModules();}
+ Float_t GetfPhiGapForSuperModules(void) const {return fEMCGeometry->GetfPhiGapForSuperModules();}
+ Float_t GetPhiModuleSize(void) const {return fEMCGeometry->GetPhiModuleSize();}
+ Float_t GetEtaModuleSize(void) const {return fEMCGeometry->GetEtaModuleSize();}
+ Float_t GetFrontSteelStrip(void) const {return fEMCGeometry->GetFrontSteelStrip();}
+ Float_t GetLateralSteelStrip(void) const {return fEMCGeometry->GetLateralSteelStrip();}
+ Float_t GetPassiveScintThick(void) const {return fEMCGeometry->GetPassiveScintThick();}
+ Float_t GetPhiTileSize(void) const {return fEMCGeometry->GetPhiTileSize();}
+ Float_t GetEtaTileSize(void) const {return fEMCGeometry->GetEtaTileSize();}
+ Int_t GetNPhiSuperModule(void) const {return fEMCGeometry->GetNPhiSuperModule();}
+ Int_t GetNPHIdiv(void) const {return fEMCGeometry->GetNPHIdiv();}
+ Int_t GetNETAdiv(void) const {return fEMCGeometry->GetNETAdiv();}
+ Int_t GetNCells(void) const {return fEMCGeometry->GetNCells();}
+ Float_t GetLongModuleSize(void) const {return fEMCGeometry->GetLongModuleSize();}
+ Float_t GetTrd1Angle(void) const {return fEMCGeometry->GetTrd1Angle();}
+ Float_t Get2Trd1Dx2(void) const {return fEMCGeometry->Get2Trd1Dx2();}
// --
- Int_t GetNCellsInSupMod() const {return fNCellsInSupMod;}
- Int_t GetNCellsInModule() const {return fNCellsInModule; }
- Int_t GetKey110DEG() const {return fKey110DEG;}
- Int_t GetILOSS() const {return fILOSS;}
- Int_t GetIHADR() const {return fIHADR;}
+ Int_t GetNCellsInSupMod(void) const {return fEMCGeometry->GetNCellsInSupMod();}
+ Int_t GetNCellsInModule(void) const {return fEMCGeometry->GetNCellsInModule(); }
+ Int_t GetKey110DEG(void) const {return fEMCGeometry->GetKey110DEG();}
+ Int_t GetILOSS(void) const {return fEMCGeometry->GetILOSS();}
+ Int_t GetIHADR(void) const {return fEMCGeometry->GetIHADR();}
// For gamma(Jet) trigger simulations
- Int_t GetNTRU() const {return fNTRUEta*fNTRUPhi ; }
- Int_t GetNTRUEta() const {return fNTRUEta ; }
- Int_t GetNTRUPhi() const {return fNTRUPhi ; }
- Int_t GetNEtaSubOfTRU() const {return fNEtaSubOfTRU;}
- Int_t GetNModulesInTRU() const {return fNModulesInTRUEta*fNModulesInTRUPhi; }
- Int_t GetNModulesInTRUEta() const {return fNModulesInTRUEta ; }
- Int_t GetNModulesInTRUPhi() const {return fNModulesInTRUPhi ; }
- Int_t GetAbsTRUNumberFromNumberInSm(const Int_t row, const Int_t col, const Int_t sm);
-
+ Int_t GetNTRU() const {return fEMCGeometry->GetNTRU(); }
+ Int_t GetNTRUEta() const {return fEMCGeometry->GetNTRUEta(); }
+ Int_t GetNTRUPhi() const {return fEMCGeometry->GetNTRUPhi(); }
+ Int_t GetNEtaSubOfTRU() const {return fEMCGeometry->GetNEtaSubOfTRU();}
+ Int_t GetNModulesInTRU() const {return fEMCGeometry->GetNModulesInTRU(); }
+ Int_t GetNModulesInTRUEta() const {return fEMCGeometry->GetNModulesInTRUEta(); }
+ Int_t GetNModulesInTRUPhi() const {return fEMCGeometry->GetNModulesInTRUPhi(); }
+
// --
- Float_t GetDeltaEta() const {return (fArm1EtaMax-fArm1EtaMin)/ ((Float_t)fNZ);}
- Float_t GetDeltaPhi() const {return (fArm1PhiMax-fArm1PhiMin)/ ((Float_t)fNPhi);}
- Int_t GetNTowers() const {return fNPhi * fNZ ;}
+ Float_t GetDeltaEta(void) const {return fEMCGeometry->GetDeltaEta();}
+ Float_t GetDeltaPhi(void) const {return fEMCGeometry->GetDeltaPhi();}
+ Int_t GetNTowers(void) const {return fEMCGeometry->GetNTowers();}
//
- Double_t GetPhiCenterOfSM(Int_t nsupmod) const;
- Float_t *GetSuperModulesPars() {return fParSM;}
+ Double_t GetPhiCenterOfSM(Int_t nsupmod) const {return fEMCGeometry->GetPhiCenterOfSM(nsupmod);}
+ Float_t *GetSuperModulesPars(void) const {return fEMCGeometry->GetSuperModulesPars();}
//
- Bool_t GetPhiBoundariesOfSM (Int_t nSupMod, Double_t &phiMin, Double_t &phiMax) const;
- Bool_t GetPhiBoundariesOfSMGap(Int_t nPhiSec, Double_t &phiMin, Double_t &phiMax) const;
+ Bool_t GetPhiBoundariesOfSM(Int_t nSupMod, Double_t &phiMin, Double_t &phiMax) const {return fEMCGeometry->GetPhiBoundariesOfSM(nSupMod, phiMin, phiMax);}
+ Bool_t GetPhiBoundariesOfSMGap(Int_t nPhiSec, Double_t &phiMin, Double_t &phiMax) const {return fEMCGeometry->GetPhiBoundariesOfSMGap(nPhiSec, phiMin, phiMax);}
//
- virtual Bool_t Impact(const TParticle *) const;
- void ImpactOnEmcal(TVector3 vtx, Double_t theta, Double_t phi, Int_t & absId, TVector3 & vimpact) const;
- Bool_t IsInEMCAL(Double_t x, Double_t y, Double_t z) const;
-
- ////////////////////////////////////////
- // May 31, 2006; ALICE numbering scheme:
- // see ALICE-INT-2003-038: ALICE Coordinate System and Software Numbering Convention
- // All indexes are stared from zero now.
- //
- // abs id <-> indexes; Shish-kebab case, only TRD1 now.
- // EMCAL -> Super Module -> module -> tower(or cell) - logic tree of EMCAL
- //
- //** Usual name of variable - Dec 18,2006 **
- // nSupMod - index of super module (SM)
- // nModule - index of module in SM
- // nIphi - phi index of tower(cell) in module
- // nIeta - eta index of tower(cell) in module
- //
- // Inside SM
- // iphim - phi index of module in SM
- // ietam - eta index of module in SM
- //
- // iphi - phi index of tower(cell) in SM
- // ieta - eta index of tower(cell) in SM
- //
- // for a given tower index absId returns eta and phi of gravity center of tower.
- void EtaPhiFromIndex(Int_t absId, Double_t &eta, Double_t &phi) const;
- void EtaPhiFromIndex(Int_t absId, Float_t &eta, Float_t &phi) const;
- //
- // Tranforms Eta-Phi Module index in TRU into Eta-Phi index in Super Module
- void GetModulePhiEtaIndexInSModuleFromTRUIndex(
- Int_t itru, Int_t iphitru, Int_t ietatru, Int_t &ietaSM, Int_t &iphiSM) const ;
-
- Bool_t GetAbsCellIdFromEtaPhi(Double_t eta,Double_t phi, Int_t &absId) const;
- Bool_t SuperModuleNumberFromEtaPhi(Double_t eta, Double_t phi, Int_t &nSupMod) const;
- Int_t GetAbsCellId(Int_t nSupMod, Int_t nModule, Int_t nIphi, Int_t nIeta) const;
- Bool_t CheckAbsCellId(Int_t absId) const;
- Bool_t GetCellIndex(Int_t absId, Int_t &nSupMod, Int_t &nModule, Int_t &nIphi,
- Int_t &nIeta) const;
- // Local coordinate of Super Module
- void GetModulePhiEtaIndexInSModule(Int_t nSupMod, Int_t nModule, Int_t &iphim,
- Int_t &ietam) const;
- void GetCellPhiEtaIndexInSModule(Int_t nSupMod, Int_t nModule, Int_t nIphi, Int_t nIeta,
- Int_t &iphi, Int_t &ieta) const ;
- Int_t GetSuperModuleNumber(Int_t absId) const;
- Int_t GetNumberOfModuleInPhiDirection(Int_t nSupMod) const
- {
- if(fKey110DEG == 1 && nSupMod>=10) return fNPhi/2;
- else return fNPhi;
- }
- // From cell indexes to abs cell id
- void GetModuleIndexesFromCellIndexesInSModule(Int_t nSupMod, Int_t iphi, Int_t ieta,
- Int_t &iphim, Int_t &ietam, Int_t &nModule) const;
- Int_t GetAbsCellIdFromCellIndexes(Int_t nSupMod, Int_t iphi, Int_t ieta) const;
-
- // Methods for AliEMCALRecPoint - Feb 19, 2006
- Bool_t RelPosCellInSModule(Int_t absId, Double_t &xr, Double_t &yr, Double_t &zr) const;
- Bool_t RelPosCellInSModule(Int_t absId, Double_t loc[3]) const;
- Bool_t RelPosCellInSModule(Int_t absId, TVector3 &vloc) const;
// Methods for AliEMCALRecPoint with taking into account energy of rec.point - Jul 30. 2007
- Bool_t RelPosCellInSModule(Int_t absId,Double_t distEff,Double_t &xr,Double_t &yr,
- Double_t & zr) const;
- Bool_t RelPosCellInSModule(Int_t absId,Int_t maxAbsId,Double_t distEff,Double_t &xr,
- Double_t &yr,Double_t &zr) const;
+ using AliEMCALGeoUtils::RelPosCellInSModule;
+ Bool_t RelPosCellInSModule(Int_t absId,Double_t distEff,Double_t &xr,Double_t &yr,
+ Double_t & zr) const;
+ Bool_t RelPosCellInSModule(Int_t absId,Int_t maxAbsId,Double_t distEff,Double_t &xr,
+ Double_t &yr,Double_t &zr) const;
///////////////////////////////
//Geometry data member setters
//
- void SetNZ(Int_t nz) { fNZ= nz;
- printf("SetNZ: Number of modules in Z set to %d", fNZ) ; }
- void SetNPhi(Int_t nphi) { fNPhi= nphi;
- printf("SetNPhi: Number of modules in Phi set to %d", fNPhi) ; }
- void SetNTRUEta(Int_t ntru) {fNTRUEta = ntru;
- printf("SetNTRU: Number of TRUs per SuperModule in Etaset to %d", fNTRUEta) ;}
- void SetNTRUPhi(Int_t ntru) {fNTRUPhi = ntru;
- printf("SetNTRU: Number of TRUs per SuperModule in Phi set to %d", fNTRUPhi) ;}
- void SetSampling(Float_t samp) { fSampling = samp;
- printf("SetSampling: Sampling factor set to %f", fSampling) ; }
+ void SetNZ(Int_t nz) { fEMCGeometry->SetNZ(nz);}
+ void SetNPhi(Int_t nphi) { fEMCGeometry->SetNPhi(nphi);}
- ///////////////////
- // useful utilities
- //
- Float_t AngleFromEta(Float_t eta) const { // returns theta in radians for a given pseudorapidity
- return 2.0*TMath::ATan(TMath::Exp(-eta));
- }
- Float_t ZFromEtaR(Float_t r,Float_t eta) const { // returns z in for a given
- // pseudorapidity and r=sqrt(x*x+y*y).
- return r/TMath::Tan(AngleFromEta(eta));
- }
+ void SetNTRUEta(Int_t ntru) { fEMCGeometry->SetNTRUEta(ntru);}
+ void SetNTRUPhi(Int_t ntru) { fEMCGeometry->SetNTRUPhi(ntru);}
+ void SetSampling(Float_t samp) { fEMCGeometry->SetSampling(samp);}
+
+/* /////////////////// */
+/* // useful utilities */
+/* // */
+/* Float_t AngleFromEta(Float_t eta) const { // returns theta in radians for a given pseudorapidity */
+/* return 2.0*TMath::ATan(TMath::Exp(-eta)); */
+/* } */
+/* Float_t ZFromEtaR(Float_t r,Float_t eta) const { // returns z in for a given */
+/* // pseudorapidity and r=sqrt(x*x+y*y). */
+/* return r/TMath::Tan(AngleFromEta(eta)); */
+/* } */
//////////////////////////////////////////////////
// Obsolete methods to be thrown out when feasible
- Float_t GetAlFrontThickness() const { return fAlFrontThick;}
- Float_t GetGap2Active() const {return fGap2Active ;}
- Float_t GetSteelFrontThickness() const { return fSteelFrontThick;}
- Float_t GetTrd2AngleY()const {return fTrd2AngleY;}
- Float_t Get2Trd2Dy2() const {return f2Trd2Dy2;}
- Float_t GetTubsR() const {return fTubsR;}
- Float_t GetTubsTurnAngle() const {return fTubsTurnAngle;}
- Float_t GetIP2ECASection() const { return ( GetIPDistance() + GetAlFrontThickness()
- + GetGap2Active() ) ; }
+ Float_t GetAlFrontThickness(void) const { return fEMCGeometry->GetAlFrontThickness();}
+ Float_t GetGap2Active(void) const {return fEMCGeometry->GetGap2Active();}
+ Float_t GetSteelFrontThickness(void) const { return fEMCGeometry->GetSteelFrontThickness();}
+ Float_t GetTrd2AngleY(void) const {return fEMCGeometry->GetTrd2AngleY();}
+ Float_t Get2Trd2Dy2(void) const {return fEMCGeometry->Get2Trd2Dy2();}
+ Float_t GetTubsR(void) const {return fEMCGeometry->GetTubsR();}
+ Float_t GetTubsTurnAngle(void) const {return fEMCGeometry->GetTubsTurnAngle();}
+ Float_t GetIP2ECASection(void) const { return fEMCGeometry->GetIP2ECASection(); }
//////////////////////////////////////////////////
protected:
AliEMCALGeometry(const Text_t* name, const Text_t* title);
void Init(void); // initializes the parameters of EMCAL
- void CheckAdditionalOptions(); //
- void DefineSamplingFraction(); // Jun 5, 2006
private:
//Member data
static AliEMCALGeometry * fgGeom; // pointer to the unique instance of the singleton
- static Bool_t fgInit; // Tells if geometry has been succesfully set up.
- static const Char_t* fgDefaultGeometryName; // Default name of geometry
-
- TString fGeoName; //geometry name
-
- TObjArray *fArrayOpts; //! array of geometry options
- const char *fAdditionalOpts[6]; //! some additional options for the geometry type and name
- int fNAdditionalOpts; //! size of additional options parameter
-
- Float_t fECPbRadThickness; // cm, Thickness of the Pb radiators
- Float_t fECScintThick; // cm, Thickness of the scintillators
- Int_t fNECLayers; // number of scintillator layers
-
- Float_t fArm1PhiMin; // Minimum angular position of EMCAL in Phi (degrees)
- Float_t fArm1PhiMax; // Maximum angular position of EMCAL in Phi (degrees)
- Float_t fArm1EtaMin; // Minimum pseudorapidity position of EMCAL in Eta
- Float_t fArm1EtaMax; // Maximum pseudorapidity position of EMCAL in Eta
-
- // Geometry Parameters
- Float_t fEnvelop[3]; // the GEANT TUB for the detector
- Float_t fIPDistance; // Radial Distance of the inner surface of the EMCAL
- Float_t fShellThickness; // Total thickness in (x,y) direction
- Float_t fZLength; // Total length in z direction
- Int_t fNZ; // Number of Towers in the Z direction
- Int_t fNPhi; // Number of Towers in the PHI direction
- Float_t fSampling; // Sampling factor
-
- // Shish-kebab option - 23-aug-04 by PAI; COMPACT, TWIST, TRD1 and TRD2
- Int_t fNumberOfSuperModules; // default is 12 = 6 * 2
- Float_t fFrontSteelStrip; // 13-may-05
- Float_t fLateralSteelStrip; // 13-may-05
- Float_t fPassiveScintThick; // 13-may-05
- Float_t fPhiModuleSize; // Phi -> X
- Float_t fEtaModuleSize; // Eta -> Y
- Float_t fPhiTileSize; // Size of phi tile
- Float_t fEtaTileSize; // Size of eta tile
- Float_t fLongModuleSize; // Size of long module
- Int_t fNPhiSuperModule; // 6 - number supermodule in phi direction
- Int_t fNPHIdiv; // number phi divizion of module
- Int_t fNETAdiv; // number eta divizion of module
- //
- Int_t fNCells; // number of cells in calo
- Int_t fNCellsInSupMod; // number cell in super module
- Int_t fNCellsInModule; // number cell in module)
- //TRU parameters
- Int_t fNTRUEta ; // Number of TRUs per module in eta
- Int_t fNTRUPhi ; // Number of TRUs per module in phi
- Int_t fNModulesInTRUEta; // Number of modules per TRU in eta
- Int_t fNModulesInTRUPhi; // Number of modules per TRU in phi
- Int_t fNEtaSubOfTRU; // Number of eta (z) subregiohi
-
- // TRD1 options - 30-sep-04
- Float_t fTrd1Angle; // angle in x-z plane (in degree)
- Float_t f2Trd1Dx2; // 2*dx2 for TRD1
- Float_t fPhiGapForSM; // Gap betweeen supermodules in phi direction
- Int_t fKey110DEG; // for calculation abs cell id; 19-oct-05
- TArrayD fPhiBoundariesOfSM; // phi boundaries of SM in rad; size is fNumberOfSuperModules;
- TArrayD fPhiCentersOfSM; // phi of centers of SMl size is fNumberOfSuperModules/2
- Float_t fEtaMaxOfTRD1; // max eta in case of TRD1 geometry (see AliEMCALShishKebabTrd1Module)
- // Local Coordinates of SM
- TArrayD fCentersOfCellsEtaDir; // size fNEta*fNETAdiv (for TRD1 only) (eta or z in SM, in cm)
- TArrayD fCentersOfCellsXDir; // size fNEta*fNETAdiv (for TRD1 only) ( x in SM, in cm)
- TArrayD fCentersOfCellsPhiDir; // size fNPhi*fNPHIdiv (for TRD1 only) (phi or y in SM, in cm)
- //
- TArrayD fEtaCentersOfCells; // [fNEta*fNETAdiv*fNPhi*fNPHIdiv], positive direction (eta>0); eta depend from phi position;
- TArrayD fPhiCentersOfCells; // [fNPhi*fNPHIdiv] from center of SM (-10. < phi < +10.)
- // Move from AliEMCALv0 - Feb 19, 2006
- TList *fShishKebabTrd1Modules; //! list of modules
- // Local coordinates of SM for TRD1
- Float_t fParSM[3]; // SM sizes as in GEANT (TRD1)
-
- Int_t fILOSS; // Options for Geant (MIP business) - will call in AliEMCAL
- Int_t fIHADR; // Options for Geant (MIP business) - will call in AliEMCAL
-
- ////////////////////////////////////////////////////////////
- //Obsolete member data that will be thrown out when feasible
- //
- Float_t fAlFrontThick; // Thickness of the front Al face of the support box
- Float_t fGap2Active; // Gap between the envelop and the active material
- Float_t fSteelFrontThick; // Thickness of the front stell face of the support box - 9-sep-04
- // TRD2 options - 27-jan-07
- Float_t fTrd2AngleY; // angle in y-z plane (in degree)
- Float_t f2Trd2Dy2; // 2*dy2 for TRD2
- Float_t fEmptySpace; // 2mm om fred drawing
- // Super module as TUBS
- Float_t fTubsR; // radius of tubs
- Float_t fTubsTurnAngle; // turn angle of tubs in degree
+ // static Bool_t fgInit; // Tells if geometry has been succesfully set up.
+ static const Char_t* fgkDefaultGeometryName; // Default name of geometry
///////////////////////////////////////////////////////////
- ClassDef(AliEMCALGeometry, 13) // EMCAL geometry class
+ ClassDef(AliEMCALGeometry, 15) // EMCAL geometry class
};
#endif // AliEMCALGEOMETRY_H
//
// Double_t PIDFinal[AliPID::kSPECIESN] is the standard PID for :
//
-//
-//
// kElectron : fPIDFinal[0]
// kMuon : fPIDFinal[1]
// kPion : fPIDFinal[2]
// Pi0 PID[1]
// Hadron PID[2]
//
+// Author: Genole Bourdaud 2007 (SUBATECH)
+// Marie Germain 07/2009 (SUBATECH), new parametrization for low and high flux environment
+// Gustavo Conesa 08/2009 (LNF), divide class in AliEMCALPID and AliEMCALPIDUtils, PIDUtils belong to library EMCALUtils
// --- standard c ---
// standard C++ includes
//#include <Riostream.h>
// ROOT includes
-#include "TMath.h"
-#include "TArrayD.h"
// STEER includes
#include "AliESDEvent.h"
ClassImp(AliEMCALPID)
//______________________________________________
- AliEMCALPID::AliEMCALPID():
- fPrintInfo(kFALSE), fProbGamma(0.),fProbPiZero(0.),fProbHadron(0.), fWeightHadronEnergy(1.), fWeightGammaEnergy(1.),fWeightPiZeroEnergy(1.),fReconstructor(kTRUE)
+ AliEMCALPID::AliEMCALPID()
+ : AliEMCALPIDUtils(), fReconstructor(kTRUE)
{
//
// Constructor.
}
//______________________________________________
-AliEMCALPID::AliEMCALPID(Bool_t reconstructor):
- fPrintInfo(kFALSE), fProbGamma(0.),fProbPiZero(0.),fProbHadron(0.), fWeightHadronEnergy(1.), fWeightGammaEnergy(1.),fWeightPiZeroEnergy(1.),fReconstructor(reconstructor)
+AliEMCALPID::AliEMCALPID(Bool_t reconstructor)
+: AliEMCALPIDUtils(), fReconstructor(reconstructor)
{
//
// Constructor.
} // end for (iCluster...)
}
-//__________________________________________________________
-void AliEMCALPID::ComputePID(Double_t energy, Double_t lambda0)
-{
-//
-// This is the main command, which uses the distributions computed and parametrised,
-// and gives the PID by the bayesian method.
-//
-
- Double_t weightGammaEnergy = DistEnergy(energy, 1);
- Double_t weightPiZeroEnergy = DistEnergy(energy, 2);
- Double_t weightHadronEnergy = DistEnergy(energy, 3);
-
- Double_t energyhadron=energy;
- if(energyhadron<1.)energyhadron=1.; // no energy dependance of parametrisation for hadrons below 1 GeV
- if (energy<2){energy =2;} // no energy dependance of parametrisation for gamma and pi0 below 2 GeV
-
- if (energy>55){
- energy =55.;
- energyhadron=55.;
- } // same parametrisation for gamma and hadrons above 55 GeV
- // for the pi0 above 55GeV the 2 gammas supperposed no way to distinguish from real gamma PIDWeight[1]=0
-
- TArrayD paramDistribGamma = DistLambda0(energy, 1);
- TArrayD paramDistribPiZero = DistLambda0(energy, 2);
- TArrayD paramDistribHadron = DistLambda0(energyhadron, 3);
-
- Bool_t norm = kFALSE;
-
-
- fProbGamma = TMath::Gaus(lambda0, paramDistribGamma[1], paramDistribGamma[2], norm) * paramDistribGamma[0];
- fProbGamma += TMath::Landau(((1-paramDistribGamma[4])-lambda0),paramDistribGamma[4],paramDistribGamma[5],norm)* paramDistribGamma[3];
- if(fProbGamma<0.)fProbGamma=0.;
-
- fProbGamma = fProbGamma*weightGammaEnergy;
-
- if(energy>10. || energy < 55.){
- fProbPiZero = TMath::Gaus(lambda0, paramDistribPiZero[1], paramDistribPiZero[2], norm) * paramDistribPiZero[0];
- fProbPiZero += TMath::Landau(lambda0, paramDistribPiZero[4], paramDistribPiZero[5], norm) * paramDistribPiZero[3];
- if(fProbPiZero<0. || energy<5.)fProbPiZero=0.;
- fProbPiZero = fProbPiZero*weightPiZeroEnergy;
- }
- else {
- fProbPiZero = 0.;
- }
-
- fProbHadron = TMath::Gaus(lambda0, paramDistribHadron[1], paramDistribHadron[2], norm) * paramDistribHadron[0];
- fProbHadron += TMath::Landau(lambda0, paramDistribHadron[4], paramDistribHadron[5], norm) * paramDistribHadron[3];
- if(fProbHadron<0.)fProbHadron=0.;
- fProbHadron = fProbHadron*weightHadronEnergy; // to take into account the probability for a hadron to have a given reconstructed energy
-
- // compute PID Weight
- if( (fProbGamma + fProbPiZero + fProbHadron)>0.){
- fPIDWeight[0] = fProbGamma / (fProbGamma + fProbPiZero + fProbHadron);
- fPIDWeight[1] = fProbPiZero / (fProbGamma+fProbPiZero+fProbHadron);
- fPIDWeight[2] = fProbHadron / (fProbGamma+fProbPiZero+fProbHadron);
- }
- else{
-// cases where energy and lambda0 large, probably du to 2 clusters folded the clusters PID not assigned to hadron nor Pi0 nor gammas
- fPIDWeight[0] = 0.;
- fPIDWeight[1] = 0.;
- fPIDWeight[2] = 0.;
- }
-
-
- // cout << " PID[0] "<< fPIDWeight[0] << " PID[1] "<< fPIDWeight[1] << " PID[2] "<< fPIDWeight[2] << endl;
-
- SetPID(fPIDWeight[0], 0);
- SetPID(fPIDWeight[1], 1);
- SetPID(fPIDWeight[2], 2);
-
- // print pid Weight only for control
- if (fPrintInfo) {
- AliInfo(Form( "Energy in loop = %f", energy) );
- AliInfo(Form( "Lambda0 in loop = %f", lambda0) );
- AliInfo(Form( "fProbGamma in loop = %f", fProbGamma) );
- AliInfo(Form( "fProbaPiZero = %f", fProbPiZero ));
- AliInfo(Form( "fProbaHadron = %f", fProbHadron) );
- AliInfo(Form( "PIDWeight in loop = %f ||| %f ||| %f", fPIDWeight[0] , fPIDWeight[1], fPIDWeight[2]) );
- AliInfo("********************************************************" );
- }
-
- fPIDFinal[0] = fPIDWeight[0]/2; // photon
- fPIDFinal[1] = fPIDWeight[2]/8;
- fPIDFinal[2] = fPIDWeight[2]/8;
- fPIDFinal[3] = fPIDWeight[2]/8;
- fPIDFinal[4] = fPIDWeight[2]/8;
- fPIDFinal[5] = fPIDWeight[0]/2; // electron
- fPIDFinal[6] = fPIDWeight[1] ; // Pi0
- fPIDFinal[7] = fPIDWeight[2]/8;
- fPIDFinal[8] = fPIDWeight[2]/8;
- fPIDFinal[9] = fPIDWeight[2]/8;
- fPIDFinal[10] = fPIDWeight[2]/8;
-
-}
-
-
-
-
-//________________________________________________________
-TArrayD AliEMCALPID::DistLambda0(const Double_t energy, const Int_t type)
-{
- //
- // Compute the values of the parametrised distributions using the data initialised before.
- //
- Double_t constGauss = 0., meanGauss = 0., sigmaGauss = 0.;
- Double_t constLandau=0., mpvLandau=0., sigmaLandau=0.;
- TArrayD distributionParam(6);
-
- switch (type) {
-
- case 1:
-
- constGauss = PolynomialMixed2(energy, fGamma[0]);
- meanGauss = PolynomialMixed2(energy, fGamma[1]);
- sigmaGauss = PolynomialMixed2(energy, fGamma[2]);
- constLandau = PolynomialMixed2(energy, fGamma[3]);
- mpvLandau = PolynomialMixed2(energy, fGamma[4]);
- sigmaLandau = PolynomialMixed2(energy, fGamma[5]);
- break;
-
- case 2:
-
- constGauss = PolynomialMixed2(energy, fPiZero[0]);
- meanGauss = PolynomialMixed2(energy, fPiZero[1]);
- sigmaGauss = PolynomialMixed2(energy, fPiZero[2]);
- constLandau = PolynomialMixed2(energy, fPiZero[3]);
- mpvLandau = PolynomialMixed2(energy, fPiZero[4]);
- sigmaLandau = PolynomialMixed2(energy, fPiZero[5]);
-
- break;
- case 3:
-
- constGauss = PolynomialMixed2(energy, fHadron[0]);
- meanGauss = PolynomialMixed2(energy, fHadron[1]);
- sigmaGauss = PolynomialMixed2(energy, fHadron[2]);
- constLandau = PolynomialMixed2(energy, fHadron[3]);
- mpvLandau = PolynomialMixed2(energy, fHadron[4]);
- sigmaLandau = PolynomialMixed2(energy, fHadron[5]);
-
- break;
- }
-
- distributionParam[0] = constGauss;
- distributionParam[1] = meanGauss;
- distributionParam[2] = sigmaGauss;
- distributionParam[3] = constLandau;
- distributionParam[4] = mpvLandau;
- distributionParam[5] = sigmaLandau;
-
- return distributionParam;
-}
-
-//________________________________________________________
-Double_t AliEMCALPID::DistEnergy(const Double_t energy, const Int_t type)
-{
- //
- // Compute the values of the weigh for a given energy the parametrised distribution using the data initialised before.
- //
- Double_t constante = 0.;
- Double_t energyParam;
-
- switch (type) {
-
- case 1:
- constante = 1.;
- break;
- case 2:
- constante = 1.;
- break;
- case 3:
- constante = PowerExp(energy, fHadronEnergyProb);
- break;
- }
-
- energyParam = constante;
-
- // // cout << "Weight " << constante << " for energy "<< energy<< " GeV "<< endl;
-
- return energyParam;
-}
-
-
-//_______________________________________________________
-Double_t AliEMCALPID::Polynomial(const Double_t x, const Double_t *params) const
-{
- //
- // Compute a polynomial for a given value of 'x'
- // with the array of parameters passed as the second arg
- //
-
- Double_t y;
- y = params[0];
- y += params[1] * x;
- y += params[2] * x * x;
- y += params[3] * x * x * x;
- y += params[4] * x * x * x * x;
- y += params[5] * x * x * x * x * x;
-
- return y;
-}
-//_______________________________________________________
-Double_t AliEMCALPID::Polynomial0(const Double_t *params) const
-{
- //
- // Compute a polynomial for a given value of 'x'
- // with the array of parameters passed as the second arg
- //
-
- Double_t y;
- y = params[0];
- return y;
-}
-
-//_______________________________________________________
-Double_t AliEMCALPID::Polynomialinv(const Double_t x, const Double_t *params) const
-{
- //
- // Compute a polynomial for a given value of 'x'
- // with the array of parameters passed as the second arg
- //
-
- Double_t y;
- if(x>0){
- y = params[0];
- y += params[1] / x;
- y += params[2] / (x * x);
- y += params[3] / (x * x * x);
- y += params[4] / (x * x * x * x);
- y += params[5] / (x * x * x * x * x);
- }
- else
- y=0.;
- return y;
-
-}
-//_______________________________________________________
-Double_t AliEMCALPID::PolynomialMixed1(const Double_t x, const Double_t *params) const
-{
- //
- // Compute a polynomial for a given value of 'x'
- // with the array of parameters passed as the second arg
- //
-
- Double_t y;
- if(x>0){
- y = params[0] / x;
- y += params[1] ;
- y += params[2] * x ;
- // y += params[3] * 0.;
- // y += params[4] * 0.;
- // y += params[5] * 0.;
- }
- else
- y=0.;
-
- return y;
-
-}
-
-//_______________________________________________________
-Double_t AliEMCALPID::PolynomialMixed2(const Double_t x, const Double_t *params) const
-{
- //
- // Compute a polynomial for a given value of 'x'
- // with the array of parameters passed as the second arg
- //
-
- Double_t y;
- if(x>0){
- y = params[0] / ( x * x);
- y += params[1] / x;
- y += params[2] ;
- y += params[3] * x ;
- y += params[4] * x * x ;
- // y += params[5] * 0.;
- }
- else
- y=0.;
-
- return y;
-
-}
-
-//_______________________________________________________
-Double_t AliEMCALPID::PowerExp(const Double_t x, const Double_t *params) const
-{
- //
- // Compute a polynomial for a given value of 'x'
- // with the array of parameters passed as the second arg
- // par[0]*TMath::Power(x[0],par[1])
- // par[0]*TMath::Exp((x[0]-par[1])*par[2]);
-
- Double_t y;
-
- y = params[0] *TMath::Power( x,params[1]);
- y += params[2] *TMath::Exp((x-params[3])*params[4]);
-
- return y;
-
-}
-
//_______________________________________________________
void AliEMCALPID::InitParameters()
}
-
-//_______________________________________________________
-void AliEMCALPID::SetLowFluxParam()
-{
-
- // as a first step, all array elements are initialized to 0.0
- Int_t i, j;
-
- for (i = 0; i < 6; i++) {
- for (j = 0; j < 6; j++) {
- fGamma[i][j] = fHadron[i][j] = fPiZero[i][j] = 0.;
- fGamma1to10[i][j] = fHadron1to10[i][j] = 0.;
- }
- fGammaEnergyProb[i] = fGammaEnergyProb[i];
- fPiZeroEnergyProb[i] = fPiZeroEnergyProb[i];
- fHadronEnergyProb[i] = fHadronEnergyProb[i];
- }
-
- // New parameterization for lambda0^2 (=x): f(x) = normLandau*TMath::Landau(x,mpvLandau,widthLandau)+normgaus*TMath::Gaus(x,meangaus,sigmagaus)
- // See AliEMCALPid (index j) refers to the polynomial parameters of the fit of each parameter vs energy
- // pp
-
- // paramtype[0][j] = norm gauss
- // paramtype[1][j] = mean gaus
- // paramtype[2][j] = sigma gaus
- // paramtype[3][j] = norm landau
- // paramtype[4][j] = mpv landau
- // paramtype[5][j] = sigma landau
-
- fGamma[0][0] = -7.656908e-01;
- fGamma[0][1] = 2.352536e-01;
- fGamma[0][2] = 1.555996e-02;
- fGamma[0][3] = 2.243525e-04;
- fGamma[0][4] = -2.560087e-06;
-
- fGamma[1][0] = 6.500216e+00;
- fGamma[1][1] = -2.564958e-01;
- fGamma[1][2] = 1.967894e-01;
- fGamma[1][3] = -3.982273e-04;
- fGamma[1][4] = 2.797737e-06;
-
- fGamma[2][0] = 2.416489e+00;
- fGamma[2][1] = -1.601258e-01;
- fGamma[2][2] = 3.126839e-02;
- fGamma[2][3] = 3.387532e-04;
- fGamma[2][4] = -4.089145e-06;
-
- fGamma[3][0] = 0.;
- fGamma[3][1] = -2.696008e+00;
- fGamma[3][2] = 6.920305e-01;
- fGamma[3][3] = -2.281122e-03;
- fGamma[3][4] = 0.;
-
- fGamma[4][0] = 2.281564e-01;
- fGamma[4][1] = -7.575040e-02;
- fGamma[4][2] = 3.813423e-01;
- fGamma[4][3] = -1.243854e-04;
- fGamma[4][4] = 1.232045e-06;
-
- fGamma[5][0] = -3.290107e-01;
- fGamma[5][1] = 3.707545e-02;
- fGamma[5][2] = 2.917397e-03;
- fGamma[5][3] = 4.695306e-05;
- fGamma[5][4] = -3.572981e-07;
-
- fHadron[0][0] = 9.482243e-01;
- fHadron[0][1] = -2.780896e-01;
- fHadron[0][2] = 2.223507e-02;
- fHadron[0][3] = 7.294263e-04;
- fHadron[0][4] = -5.665872e-06;
-
- fHadron[1][0] = 0.;
- fHadron[1][1] = 0.;
- fHadron[1][2] = 2.483298e-01;
- fHadron[1][3] = 0.;
- fHadron[1][4] = 0.;
-
- fHadron[2][0] = -5.601199e+00;
- fHadron[2][1] = 2.097382e+00;
- fHadron[2][2] = -2.307965e-01;
- fHadron[2][3] = 9.206871e-03;
- fHadron[2][4] = -8.887548e-05;
-
- fHadron[3][0] = 6.543101e+00;
- fHadron[3][1] = -2.305203e+00;
- fHadron[3][2] = 2.761673e-01;
- fHadron[3][3] = -5.465855e-03;
- fHadron[3][4] = 2.784329e-05;
-
- fHadron[4][0] = -2.443530e+01;
- fHadron[4][1] = 8.902578e+00 ;
- fHadron[4][2] = -5.265901e-01;
- fHadron[4][3] = 2.549111e-02;
- fHadron[4][4] = -2.196801e-04;
-
- fHadron[5][0] = 2.102007e-01;
- fHadron[5][1] = -3.844418e-02;
- fHadron[5][2] = 1.234682e-01;
- fHadron[5][3] = -3.866733e-03;
- fHadron[5][4] = 3.362719e-05 ;
-
- fPiZero[0][0] = 5.072157e-01;
- fPiZero[0][1] = -5.352747e-01;
- fPiZero[0][2] = 8.499259e-02;
- fPiZero[0][3] = -3.687401e-03;
- fPiZero[0][4] = 5.482280e-05;
-
- fPiZero[1][0] = 4.590137e+02;
- fPiZero[1][1] = -7.079341e+01;
- fPiZero[1][2] = 4.990735e+00;
- fPiZero[1][3] = -1.241302e-01;
- fPiZero[1][4] = 1.065772e-03;
-
- fPiZero[2][0] = 1.376415e+02;
- fPiZero[2][1] = -3.031577e+01;
- fPiZero[2][2] = 2.474338e+00;
- fPiZero[2][3] = -6.903410e-02;
- fPiZero[2][4] = 6.244089e-04;
-
- fPiZero[3][0] = 0.;
- fPiZero[3][1] = 1.145983e+00;
- fPiZero[3][2] = -2.476052e-01;
- fPiZero[3][3] = 1.367373e-02;
- fPiZero[3][4] = 0.;
-
- fPiZero[4][0] = -2.097586e+02;
- fPiZero[4][1] = 6.300800e+01;
- fPiZero[4][2] = -4.038906e+00;
- fPiZero[4][3] = 1.088543e-01;
- fPiZero[4][4] = -9.362485e-04;
-
- fPiZero[5][0] = -1.671477e+01;
- fPiZero[5][1] = 2.995415e+00;
- fPiZero[5][2] = -6.040360e-02;
- fPiZero[5][3] = -6.137459e-04;
- fPiZero[5][4] = 1.847328e-05;
-
- fHadronEnergyProb[0] = 4.767543e-02;
- fHadronEnergyProb[1] = -1.537523e+00;
- fHadronEnergyProb[2] = 2.956727e-01;
- fHadronEnergyProb[3] = -3.051022e+01;
- fHadronEnergyProb[4] =-6.036931e-02;
-
-// Int_t ii= 0;
-// Int_t jj= 3;
-// AliDebug(1,Form("PID parameters (%d, %d): fGamma=%.3f, fPi=%.3f, fHadron=%.3f",
-// ii,jj, fGamma[ii][jj],fPiZero[ii][jj],fHadron[ii][jj] ));
-
- // end for proton-proton
-
-}
-
-//_______________________________________________________
-void AliEMCALPID::SetHighFluxParam()
-{
-
- // as a first step, all array elements are initialized to 0.0
- Int_t i, j;
- for (i = 0; i < 6; i++) {
- for (j = 0; j < 6; j++) {
- fGamma[i][j] = fHadron[i][j] = fPiZero[i][j] = 0.;
- fGamma1to10[i][j] = fHadron1to10[i][j] = 0.;
- }
- fGammaEnergyProb[i] = 0.;
- fPiZeroEnergyProb[i] = 0.;
- fHadronEnergyProb[i] = 0.;
- }
-
- // Pb Pb this goes with inverted landau + gaussian for gammas, landau+gaussian for Pi0 and hadrons
-
- fGamma[0][0] = -7.656908e-01;
- fGamma[0][1] = 2.352536e-01;
- fGamma[0][2] = 1.555996e-02;
- fGamma[0][3] = 2.243525e-04;
- fGamma[0][4] = -2.560087e-06;
-
- fGamma[1][0] = 6.500216e+00;
- fGamma[1][1] = -2.564958e-01;
- fGamma[1][2] = 1.967894e-01;
- fGamma[1][3] = -3.982273e-04;
- fGamma[1][4] = 2.797737e-06;
-
- fGamma[2][0] = 2.416489e+00;
- fGamma[2][1] = -1.601258e-01;
- fGamma[2][2] = 3.126839e-02;
- fGamma[2][3] = 3.387532e-04;
- fGamma[2][4] = -4.089145e-06;
-
- fGamma[3][0] = 0.;
- fGamma[3][1] = -2.696008e+00;
- fGamma[3][2] = 6.920305e-01;
- fGamma[3][3] = -2.281122e-03;
- fGamma[3][4] = 0.;
-
- fGamma[4][0] = 2.281564e-01;
- fGamma[4][1] = -7.575040e-02;
- fGamma[4][2] = 3.813423e-01;
- fGamma[4][3] = -1.243854e-04;
- fGamma[4][4] = 1.232045e-06;
-
- fGamma[5][0] = -3.290107e-01;
- fGamma[5][1] = 3.707545e-02;
- fGamma[5][2] = 2.917397e-03;
- fGamma[5][3] = 4.695306e-05;
- fGamma[5][4] = -3.572981e-07;
-
- fHadron[0][0] = 1.519112e-01;
- fHadron[0][1] = -8.267603e-02;
- fHadron[0][2] = 1.914574e-02;
- fHadron[0][3] = -2.677921e-04;
- fHadron[0][4] = 5.447939e-06;
-
- fHadron[1][0] = 0.;
- fHadron[1][1] = -7.549870e-02;
- fHadron[1][2] = 3.930087e-01;
- fHadron[1][3] = -2.368500e-03;
- fHadron[1][4] = 0.;
-
- fHadron[2][0] = 0.;
- fHadron[2][1] = -2.463152e-02;
- fHadron[2][2] = 1.349257e-01;
- fHadron[2][3] = -1.089440e-03;
- fHadron[2][4] = 0.;
-
- fHadron[3][0] = 0.;
- fHadron[3][1] = 5.101560e-01;
- fHadron[3][2] = 1.458679e-01;
- fHadron[3][3] = 4.903068e-04;
- fHadron[3][4] = 0.;
-
- fHadron[4][0] = 0.;
- fHadron[4][1] = -6.693943e-03;
- fHadron[4][2] = 2.444753e-01;
- fHadron[4][3] = -5.553749e-05;
- fHadron[4][4] = 0.;
-
- fHadron[5][0] = -4.414030e-01;
- fHadron[5][1] = 2.292277e-01;
- fHadron[5][2] = -2.433737e-02;
- fHadron[5][3] = 1.758422e-03;
- fHadron[5][4] = -3.001493e-05;
-
- fPiZero[0][0] = 5.072157e-01;
- fPiZero[0][1] = -5.352747e-01;
- fPiZero[0][2] = 8.499259e-02;
- fPiZero[0][3] = -3.687401e-03;
- fPiZero[0][4] = 5.482280e-05;
-
- fPiZero[1][0] = 4.590137e+02;
- fPiZero[1][1] = -7.079341e+01;
- fPiZero[1][2] = 4.990735e+00;
- fPiZero[1][3] = -1.241302e-01;
- fPiZero[1][4] = 1.065772e-03;
-
- fPiZero[2][0] = 1.376415e+02;
- fPiZero[2][1] = -3.031577e+01;
- fPiZero[2][2] = 2.474338e+00;
- fPiZero[2][3] = -6.903410e-02;
- fPiZero[2][4] = 6.244089e-04;
-
- fPiZero[3][0] = 0.;
- fPiZero[3][1] = 1.145983e+00;
- fPiZero[3][2] = -2.476052e-01;
- fPiZero[3][3] = 1.367373e-02;
- fPiZero[3][4] = 0.;
-
- fPiZero[4][0] = -2.097586e+02;
- fPiZero[4][1] = 6.300800e+01;
- fPiZero[4][2] = -4.038906e+00;
- fPiZero[4][3] = 1.088543e-01;
- fPiZero[4][4] = -9.362485e-04;
-
- fPiZero[5][0] = -1.671477e+01;
- fPiZero[5][1] = 2.995415e+00;
- fPiZero[5][2] = -6.040360e-02;
- fPiZero[5][3] = -6.137459e-04;
- fPiZero[5][4] = 1.847328e-05;
-
- // those are the High Flux PbPb ones
- fHadronEnergyProb[0] = 0.;
- fHadronEnergyProb[1] = 0.;
- fHadronEnergyProb[2] = 6.188452e-02;
- fHadronEnergyProb[3] = 2.030230e+00;
- fHadronEnergyProb[4] = -6.402242e-02;
-
-// Int_t ii= 0;
-// Int_t jj= 3;
-// AliDebug(1,Form("PID parameters (%d, %d): fGamma=%.3f, fPi=%.3f, fHadron=%.3f",
-// ii,jj, fGamma[ii][jj],fPiZero[ii][jj],fHadron[ii][jj] ));
-
-}
//AliRoot includes
class AliESDEvent ;
-#include "AliPID.h"
+#include "AliEMCALPIDUtils.h"
-class AliEMCALPID : public TTask {
+class AliEMCALPID : public AliEMCALPIDUtils {
public:
AliEMCALPID();
AliEMCALPID(Bool_t reconstructor);
- virtual ~AliEMCALPID() { }
+ //virtual ~AliEMCALPID() { }
- void RunPID(AliESDEvent *esd);
- void ComputePID(Double_t energy, Double_t lambda0); // give the PID of a cluster
-
- void InitParameters();
- void SetLowFluxParam();
- void SetHighFluxParam();
-
- TArrayD DistLambda0(const Double_t energy, const Int_t nature) ; // compute lambda0 distributions
-
- Double_t DistEnergy(const Double_t energy, const Int_t nature) ;
-
- Double_t GetPID(Int_t idx) const {if (idx>=0&&idx<3) return fPID[idx]; else return 0.;}
- Double_t GetPIDFinal(Int_t idx) const {if (idx>=0&&idx<AliPID::kSPECIESN) return fPIDFinal[idx]; else return 0.;}
- Double_t GetPIDWeight(Int_t idx) const {if (idx>=0&&idx<3) return fPIDWeight[idx]; else return 0.;}
-
- void SetPID(Double_t val, Int_t idx) {if (idx>=0&&idx<3) fPID[idx] = val;}
- void SetPIDFinal(Double_t val, Int_t idx) {if (idx>=0&&idx<AliPID::kSPECIESN) fPIDFinal[idx] = val;}
- void SetPIDWeight(Double_t val, Int_t idx) {if (idx>=0&&idx<3) fPIDWeight[idx] = val;}
- void SetPrintInfo(Bool_t yesno) {fPrintInfo = yesno;}
+ void RunPID(AliESDEvent *esd);
+ void InitParameters();
void SetReconstructor(Bool_t yesno) {fReconstructor = yesno;}
private:
- Double_t Polynomial(const Double_t x, const Double_t *params) const ;
- Double_t Polynomialinv(const Double_t x, const Double_t *params) const ;
- Double_t PolynomialMixed1(const Double_t x, const Double_t *params) const ;
- Double_t PolynomialMixed2(const Double_t x, const Double_t *params) const ;
- Double_t Polynomial0(const Double_t *params) const ;
- Double_t PowerExp(const Double_t x, const Double_t *params) const ;
-
- Bool_t fPrintInfo; // flag to decide if details about PID must be printed
-
- Double_t fGamma[6][6]; // Parameter to Compute PID for photons
- Double_t fGamma1to10[6][6]; // Parameter to Compute PID not used
- Double_t fHadron[6][6]; // Parameter to Compute PID for hadrons, 1 to 10 GeV
- Double_t fHadron1to10[6][6]; // Parameter to Compute PID for hadrons, 1 to 10 GeV
- Double_t fPiZero[6][6]; // Parameter to Compute PID for pi0
- Double_t fHadronEnergyProb[6]; // Parameter to Compute PID for energy ponderation for hadrons
- Double_t fPiZeroEnergyProb[6]; // Parameter to Compute PID for energy ponderation for Pi0
- Double_t fGammaEnergyProb[6]; // Parameter to Compute PID for energy ponderation for gamma
-
- Float_t fPID[3];
-
- Float_t fPIDFinal[AliPID::kSPECIESN+1]; // final PID format
- Float_t fPIDWeight[3]; // order: gamma, pi0, hadrons,
- Double_t fProbGamma; // probility to be a Gamma
- Double_t fProbPiZero; // probility to be a PiO
- Double_t fProbHadron; // probility to be a Hadron
- Double_t fWeightHadronEnergy; // Weight for a a Hadron to have a given energy (parametr from a flat distrib from 0 to 100)
- Double_t fWeightGammaEnergy; // Weight for a Gamma to have a given energy (for the moment =1.)
- Double_t fWeightPiZeroEnergy; // Weight for a Pi0 Hadron to have a given energy (for the moment =1.)
Bool_t fReconstructor; // Fill esdcalocluster when called from EMCALReconstructor
- ClassDef(AliEMCALPID, 4)
+ ClassDef(AliEMCALPID, 5)
+
};
+
#endif // ALIEMCALPID_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: AliEMCALPIDUtils.cxx 33808 2009-07-15 09:48:08Z gconesab $ */
+
+// Compute PID weights for all the clusters that are in AliESDs.root file
+// the AliESDs.root have to be in the same directory as the class
+//
+// and do:
+// AliEMCALPIDUtils *pid = new AliEMCALPIDUtils();
+// pid->SetPrintInfo(kTRUE);
+// pid->SetHighFluxParam(); // pid->SetLowFluxParam();
+//
+// then in cluster loop do
+// pid->ComputePID(energy, lambda0);
+//
+// Compute PID Weight for all clusters in AliESDs.root file
+// keep this function for the moment for a simple verification, could be removed
+//
+// pid->GetPIDFinal(idx) gives the probabilities
+//
+// Double_t PIDFinal[AliPID::kSPECIESN] is the standard PID for :
+//
+// kElectron : fPIDFinal[0]
+// kMuon : fPIDFinal[1]
+// kPion : fPIDFinal[2]
+// kKaon : fPIDFinal[3]
+// kProton : fPIDFinal[4]
+// kPhoton : fPIDFinal[5]
+// kPi0 : fPIDFinal[6]
+// kNeutron : fPIDFinal[7]
+// kKaon0 : fPIDFinal[8]
+// kEleCon : fPIDFinal[9]
+// kUnknown : fPIDFinal[10]
+//
+//
+// PID[3] is a simple PID for
+// Electron & Photon PID[0]
+// Pi0 PID[1]
+// Hadron PID[2]
+//
+// Author: Genole Bourdaud 2007 (SUBATECH)
+// Marie Germain 07/2009 (SUBATECH), new parametrization for low and high flux environment
+// Gustavo Conesa 08/2009 (LNF), divide class in AliEMCALPID and AliEMCALPIDUtils, PIDUtils belong to library EMCALUtils
+// --- standard c ---
+
+// standard C++ includes
+//#include <Riostream.h>
+
+// ROOT includes
+#include "TMath.h"
+#include "TArrayD.h"
+
+// STEER includes
+#include "AliEMCALPIDUtils.h"
+#include "AliLog.h"
+
+ClassImp(AliEMCALPIDUtils)
+
+//______________________________________________
+ AliEMCALPIDUtils::AliEMCALPIDUtils():
+ fPrintInfo(kFALSE), fProbGamma(0.),fProbPiZero(0.),fProbHadron(0.), fWeightHadronEnergy(1.), fWeightGammaEnergy(1.),fWeightPiZeroEnergy(1.)
+{
+ //
+ // Constructor.
+ // Initialize all constant values which have to be used
+ // during PID algorithm execution
+ //
+
+ InitParameters();
+
+
+}
+
+//__________________________________________________________
+void AliEMCALPIDUtils::ComputePID(Double_t energy, Double_t lambda0)
+{
+//
+// This is the main command, which uses the distributions computed and parametrised,
+// and gives the PID by the bayesian method.
+//
+
+ Double_t weightGammaEnergy = DistEnergy(energy, 1);
+ Double_t weightPiZeroEnergy = DistEnergy(energy, 2);
+ Double_t weightHadronEnergy = DistEnergy(energy, 3);
+
+ Double_t energyhadron=energy;
+ if(energyhadron<1.)energyhadron=1.; // no energy dependance of parametrisation for hadrons below 1 GeV
+ if (energy<2){energy =2;} // no energy dependance of parametrisation for gamma and pi0 below 2 GeV
+
+ if (energy>55){
+ energy =55.;
+ energyhadron=55.;
+ } // same parametrisation for gamma and hadrons above 55 GeV
+ // for the pi0 above 55GeV the 2 gammas supperposed no way to distinguish from real gamma PIDWeight[1]=0
+
+ TArrayD paramDistribGamma = DistLambda0(energy, 1);
+ TArrayD paramDistribPiZero = DistLambda0(energy, 2);
+ TArrayD paramDistribHadron = DistLambda0(energyhadron, 3);
+
+ Bool_t norm = kFALSE;
+
+
+ fProbGamma = TMath::Gaus(lambda0, paramDistribGamma[1], paramDistribGamma[2], norm) * paramDistribGamma[0];
+ fProbGamma += TMath::Landau(((1-paramDistribGamma[4])-lambda0),paramDistribGamma[4],paramDistribGamma[5],norm)* paramDistribGamma[3];
+ if(fProbGamma<0.)fProbGamma=0.;
+
+ fProbGamma = fProbGamma*weightGammaEnergy;
+
+ if(energy>10. || energy < 55.){
+ fProbPiZero = TMath::Gaus(lambda0, paramDistribPiZero[1], paramDistribPiZero[2], norm) * paramDistribPiZero[0];
+ fProbPiZero += TMath::Landau(lambda0, paramDistribPiZero[4], paramDistribPiZero[5], norm) * paramDistribPiZero[3];
+ if(fProbPiZero<0. || energy<5.)fProbPiZero=0.;
+ fProbPiZero = fProbPiZero*weightPiZeroEnergy;
+ }
+ else {
+ fProbPiZero = 0.;
+ }
+
+ fProbHadron = TMath::Gaus(lambda0, paramDistribHadron[1], paramDistribHadron[2], norm) * paramDistribHadron[0];
+ fProbHadron += TMath::Landau(lambda0, paramDistribHadron[4], paramDistribHadron[5], norm) * paramDistribHadron[3];
+ if(fProbHadron<0.)fProbHadron=0.;
+ fProbHadron = fProbHadron*weightHadronEnergy; // to take into account the probability for a hadron to have a given reconstructed energy
+
+ // compute PID Weight
+ if( (fProbGamma + fProbPiZero + fProbHadron)>0.){
+ fPIDWeight[0] = fProbGamma / (fProbGamma + fProbPiZero + fProbHadron);
+ fPIDWeight[1] = fProbPiZero / (fProbGamma+fProbPiZero+fProbHadron);
+ fPIDWeight[2] = fProbHadron / (fProbGamma+fProbPiZero+fProbHadron);
+ }
+ else{
+// cases where energy and lambda0 large, probably du to 2 clusters folded the clusters PID not assigned to hadron nor Pi0 nor gammas
+ fPIDWeight[0] = 0.;
+ fPIDWeight[1] = 0.;
+ fPIDWeight[2] = 0.;
+ }
+
+
+ // cout << " PID[0] "<< fPIDWeight[0] << " PID[1] "<< fPIDWeight[1] << " PID[2] "<< fPIDWeight[2] << endl;
+
+ SetPID(fPIDWeight[0], 0);
+ SetPID(fPIDWeight[1], 1);
+ SetPID(fPIDWeight[2], 2);
+
+ // print pid Weight only for control
+ if (fPrintInfo) {
+ AliInfo(Form( "Energy in loop = %f", energy) );
+ AliInfo(Form( "Lambda0 in loop = %f", lambda0) );
+ AliInfo(Form( "fProbGamma in loop = %f", fProbGamma) );
+ AliInfo(Form( "fProbaPiZero = %f", fProbPiZero ));
+ AliInfo(Form( "fProbaHadron = %f", fProbHadron) );
+ AliInfo(Form( "PIDWeight in loop = %f ||| %f ||| %f", fPIDWeight[0] , fPIDWeight[1], fPIDWeight[2]) );
+ AliInfo("********************************************************" );
+ }
+
+ fPIDFinal[0] = fPIDWeight[0]/2; // photon
+ fPIDFinal[1] = fPIDWeight[2]/8;
+ fPIDFinal[2] = fPIDWeight[2]/8;
+ fPIDFinal[3] = fPIDWeight[2]/8;
+ fPIDFinal[4] = fPIDWeight[2]/8;
+ fPIDFinal[5] = fPIDWeight[0]/2; // electron
+ fPIDFinal[6] = fPIDWeight[1] ; // Pi0
+ fPIDFinal[7] = fPIDWeight[2]/8;
+ fPIDFinal[8] = fPIDWeight[2]/8;
+ fPIDFinal[9] = fPIDWeight[2]/8;
+ fPIDFinal[10] = fPIDWeight[2]/8;
+
+}
+
+
+
+
+//________________________________________________________
+TArrayD AliEMCALPIDUtils::DistLambda0(const Double_t energy, const Int_t type)
+{
+ //
+ // Compute the values of the parametrised distributions using the data initialised before.
+ //
+ Double_t constGauss = 0., meanGauss = 0., sigmaGauss = 0.;
+ Double_t constLandau=0., mpvLandau=0., sigmaLandau=0.;
+ TArrayD distributionParam(6);
+
+ switch (type) {
+
+ case 1:
+
+ constGauss = PolynomialMixed2(energy, fGamma[0]);
+ meanGauss = PolynomialMixed2(energy, fGamma[1]);
+ sigmaGauss = PolynomialMixed2(energy, fGamma[2]);
+ constLandau = PolynomialMixed2(energy, fGamma[3]);
+ mpvLandau = PolynomialMixed2(energy, fGamma[4]);
+ sigmaLandau = PolynomialMixed2(energy, fGamma[5]);
+ break;
+
+ case 2:
+
+ constGauss = PolynomialMixed2(energy, fPiZero[0]);
+ meanGauss = PolynomialMixed2(energy, fPiZero[1]);
+ sigmaGauss = PolynomialMixed2(energy, fPiZero[2]);
+ constLandau = PolynomialMixed2(energy, fPiZero[3]);
+ mpvLandau = PolynomialMixed2(energy, fPiZero[4]);
+ sigmaLandau = PolynomialMixed2(energy, fPiZero[5]);
+
+ break;
+ case 3:
+
+ constGauss = PolynomialMixed2(energy, fHadron[0]);
+ meanGauss = PolynomialMixed2(energy, fHadron[1]);
+ sigmaGauss = PolynomialMixed2(energy, fHadron[2]);
+ constLandau = PolynomialMixed2(energy, fHadron[3]);
+ mpvLandau = PolynomialMixed2(energy, fHadron[4]);
+ sigmaLandau = PolynomialMixed2(energy, fHadron[5]);
+
+ break;
+ }
+
+ distributionParam[0] = constGauss;
+ distributionParam[1] = meanGauss;
+ distributionParam[2] = sigmaGauss;
+ distributionParam[3] = constLandau;
+ distributionParam[4] = mpvLandau;
+ distributionParam[5] = sigmaLandau;
+
+ return distributionParam;
+}
+
+//________________________________________________________
+Double_t AliEMCALPIDUtils::DistEnergy(const Double_t energy, const Int_t type)
+{
+ //
+ // Compute the values of the weigh for a given energy the parametrised distribution using the data initialised before.
+ //
+ Double_t constante = 0.;
+ Double_t energyParam;
+
+ switch (type) {
+
+ case 1:
+ constante = 1.;
+ break;
+ case 2:
+ constante = 1.;
+ break;
+ case 3:
+ constante = PowerExp(energy, fHadronEnergyProb);
+ break;
+ }
+
+ energyParam = constante;
+
+ // // cout << "Weight " << constante << " for energy "<< energy<< " GeV "<< endl;
+
+ return energyParam;
+}
+
+
+//_______________________________________________________
+Double_t AliEMCALPIDUtils::Polynomial(const Double_t x, const Double_t *params) const
+{
+ //
+ // Compute a polynomial for a given value of 'x'
+ // with the array of parameters passed as the second arg
+ //
+
+ Double_t y;
+ y = params[0];
+ y += params[1] * x;
+ y += params[2] * x * x;
+ y += params[3] * x * x * x;
+ y += params[4] * x * x * x * x;
+ y += params[5] * x * x * x * x * x;
+
+ return y;
+}
+//_______________________________________________________
+Double_t AliEMCALPIDUtils::Polynomial0(const Double_t *params) const
+{
+ //
+ // Compute a polynomial for a given value of 'x'
+ // with the array of parameters passed as the second arg
+ //
+
+ Double_t y;
+ y = params[0];
+ return y;
+}
+
+//_______________________________________________________
+Double_t AliEMCALPIDUtils::Polynomialinv(const Double_t x, const Double_t *params) const
+{
+ //
+ // Compute a polynomial for a given value of 'x'
+ // with the array of parameters passed as the second arg
+ //
+
+ Double_t y;
+ if(x>0){
+ y = params[0];
+ y += params[1] / x;
+ y += params[2] / (x * x);
+ y += params[3] / (x * x * x);
+ y += params[4] / (x * x * x * x);
+ y += params[5] / (x * x * x * x * x);
+ }
+ else
+ y=0.;
+ return y;
+
+}
+//_______________________________________________________
+Double_t AliEMCALPIDUtils::PolynomialMixed1(const Double_t x, const Double_t *params) const
+{
+ //
+ // Compute a polynomial for a given value of 'x'
+ // with the array of parameters passed as the second arg
+ //
+
+ Double_t y;
+ if(x>0){
+ y = params[0] / x;
+ y += params[1] ;
+ y += params[2] * x ;
+ // y += params[3] * 0.;
+ // y += params[4] * 0.;
+ // y += params[5] * 0.;
+ }
+ else
+ y=0.;
+
+ return y;
+
+}
+
+//_______________________________________________________
+Double_t AliEMCALPIDUtils::PolynomialMixed2(const Double_t x, const Double_t *params) const
+{
+ //
+ // Compute a polynomial for a given value of 'x'
+ // with the array of parameters passed as the second arg
+ //
+
+ Double_t y;
+ if(x>0){
+ y = params[0] / ( x * x);
+ y += params[1] / x;
+ y += params[2] ;
+ y += params[3] * x ;
+ y += params[4] * x * x ;
+ // y += params[5] * 0.;
+ }
+ else
+ y=0.;
+
+ return y;
+
+}
+
+//_______________________________________________________
+Double_t AliEMCALPIDUtils::PowerExp(const Double_t x, const Double_t *params) const
+{
+ //
+ // Compute a polynomial for a given value of 'x'
+ // with the array of parameters passed as the second arg
+ // par[0]*TMath::Power(x[0],par[1])
+ // par[0]*TMath::Exp((x[0]-par[1])*par[2]);
+
+ Double_t y;
+
+ y = params[0] *TMath::Power( x,params[1]);
+ y += params[2] *TMath::Exp((x-params[3])*params[4]);
+
+ return y;
+
+}
+
+
+//_______________________________________________________
+void AliEMCALPIDUtils::InitParameters()
+{
+ // Initialize PID parameters, depending on the use or not of the reconstructor
+ // and the kind of event type if the reconstructor is not used.
+ // fWeightHadronEnergy=0.;
+ // fWeightPiZeroEnergy=0.;
+ // fWeightGammaEnergy=0.;
+
+ fPIDWeight[0] = -1;
+ fPIDWeight[1] = -1;
+ fPIDWeight[2] = -1;
+
+ for(Int_t i=0; i<AliPID::kSPECIESN+1; i++)
+ fPIDFinal[i]= 0;
+
+ // init the parameters here instead of from loading from recparam
+ // default parameters are PbPb parameters.
+ SetHighFluxParam();
+
+}
+
+
+//_______________________________________________________
+void AliEMCALPIDUtils::SetLowFluxParam()
+{
+
+ // as a first step, all array elements are initialized to 0.0
+ Int_t i, j;
+
+ for (i = 0; i < 6; i++) {
+ for (j = 0; j < 6; j++) {
+ fGamma[i][j] = fHadron[i][j] = fPiZero[i][j] = 0.;
+ fGamma1to10[i][j] = fHadron1to10[i][j] = 0.;
+ }
+ fGammaEnergyProb[i] = fGammaEnergyProb[i];
+ fPiZeroEnergyProb[i] = fPiZeroEnergyProb[i];
+ fHadronEnergyProb[i] = fHadronEnergyProb[i];
+ }
+
+ // New parameterization for lambda0^2 (=x): f(x) = normLandau*TMath::Landau(x,mpvLandau,widthLandau)+normgaus*TMath::Gaus(x,meangaus,sigmagaus)
+ // See AliEMCALPid (index j) refers to the polynomial parameters of the fit of each parameter vs energy
+ // pp
+
+ // paramtype[0][j] = norm gauss
+ // paramtype[1][j] = mean gaus
+ // paramtype[2][j] = sigma gaus
+ // paramtype[3][j] = norm landau
+ // paramtype[4][j] = mpv landau
+ // paramtype[5][j] = sigma landau
+
+ fGamma[0][0] = -7.656908e-01;
+ fGamma[0][1] = 2.352536e-01;
+ fGamma[0][2] = 1.555996e-02;
+ fGamma[0][3] = 2.243525e-04;
+ fGamma[0][4] = -2.560087e-06;
+
+ fGamma[1][0] = 6.500216e+00;
+ fGamma[1][1] = -2.564958e-01;
+ fGamma[1][2] = 1.967894e-01;
+ fGamma[1][3] = -3.982273e-04;
+ fGamma[1][4] = 2.797737e-06;
+
+ fGamma[2][0] = 2.416489e+00;
+ fGamma[2][1] = -1.601258e-01;
+ fGamma[2][2] = 3.126839e-02;
+ fGamma[2][3] = 3.387532e-04;
+ fGamma[2][4] = -4.089145e-06;
+
+ fGamma[3][0] = 0.;
+ fGamma[3][1] = -2.696008e+00;
+ fGamma[3][2] = 6.920305e-01;
+ fGamma[3][3] = -2.281122e-03;
+ fGamma[3][4] = 0.;
+
+ fGamma[4][0] = 2.281564e-01;
+ fGamma[4][1] = -7.575040e-02;
+ fGamma[4][2] = 3.813423e-01;
+ fGamma[4][3] = -1.243854e-04;
+ fGamma[4][4] = 1.232045e-06;
+
+ fGamma[5][0] = -3.290107e-01;
+ fGamma[5][1] = 3.707545e-02;
+ fGamma[5][2] = 2.917397e-03;
+ fGamma[5][3] = 4.695306e-05;
+ fGamma[5][4] = -3.572981e-07;
+
+ fHadron[0][0] = 9.482243e-01;
+ fHadron[0][1] = -2.780896e-01;
+ fHadron[0][2] = 2.223507e-02;
+ fHadron[0][3] = 7.294263e-04;
+ fHadron[0][4] = -5.665872e-06;
+
+ fHadron[1][0] = 0.;
+ fHadron[1][1] = 0.;
+ fHadron[1][2] = 2.483298e-01;
+ fHadron[1][3] = 0.;
+ fHadron[1][4] = 0.;
+
+ fHadron[2][0] = -5.601199e+00;
+ fHadron[2][1] = 2.097382e+00;
+ fHadron[2][2] = -2.307965e-01;
+ fHadron[2][3] = 9.206871e-03;
+ fHadron[2][4] = -8.887548e-05;
+
+ fHadron[3][0] = 6.543101e+00;
+ fHadron[3][1] = -2.305203e+00;
+ fHadron[3][2] = 2.761673e-01;
+ fHadron[3][3] = -5.465855e-03;
+ fHadron[3][4] = 2.784329e-05;
+
+ fHadron[4][0] = -2.443530e+01;
+ fHadron[4][1] = 8.902578e+00 ;
+ fHadron[4][2] = -5.265901e-01;
+ fHadron[4][3] = 2.549111e-02;
+ fHadron[4][4] = -2.196801e-04;
+
+ fHadron[5][0] = 2.102007e-01;
+ fHadron[5][1] = -3.844418e-02;
+ fHadron[5][2] = 1.234682e-01;
+ fHadron[5][3] = -3.866733e-03;
+ fHadron[5][4] = 3.362719e-05 ;
+
+ fPiZero[0][0] = 5.072157e-01;
+ fPiZero[0][1] = -5.352747e-01;
+ fPiZero[0][2] = 8.499259e-02;
+ fPiZero[0][3] = -3.687401e-03;
+ fPiZero[0][4] = 5.482280e-05;
+
+ fPiZero[1][0] = 4.590137e+02;
+ fPiZero[1][1] = -7.079341e+01;
+ fPiZero[1][2] = 4.990735e+00;
+ fPiZero[1][3] = -1.241302e-01;
+ fPiZero[1][4] = 1.065772e-03;
+
+ fPiZero[2][0] = 1.376415e+02;
+ fPiZero[2][1] = -3.031577e+01;
+ fPiZero[2][2] = 2.474338e+00;
+ fPiZero[2][3] = -6.903410e-02;
+ fPiZero[2][4] = 6.244089e-04;
+
+ fPiZero[3][0] = 0.;
+ fPiZero[3][1] = 1.145983e+00;
+ fPiZero[3][2] = -2.476052e-01;
+ fPiZero[3][3] = 1.367373e-02;
+ fPiZero[3][4] = 0.;
+
+ fPiZero[4][0] = -2.097586e+02;
+ fPiZero[4][1] = 6.300800e+01;
+ fPiZero[4][2] = -4.038906e+00;
+ fPiZero[4][3] = 1.088543e-01;
+ fPiZero[4][4] = -9.362485e-04;
+
+ fPiZero[5][0] = -1.671477e+01;
+ fPiZero[5][1] = 2.995415e+00;
+ fPiZero[5][2] = -6.040360e-02;
+ fPiZero[5][3] = -6.137459e-04;
+ fPiZero[5][4] = 1.847328e-05;
+
+ fHadronEnergyProb[0] = 4.767543e-02;
+ fHadronEnergyProb[1] = -1.537523e+00;
+ fHadronEnergyProb[2] = 2.956727e-01;
+ fHadronEnergyProb[3] = -3.051022e+01;
+ fHadronEnergyProb[4] =-6.036931e-02;
+
+// Int_t ii= 0;
+// Int_t jj= 3;
+// AliDebug(1,Form("PID parameters (%d, %d): fGamma=%.3f, fPi=%.3f, fHadron=%.3f",
+// ii,jj, fGamma[ii][jj],fPiZero[ii][jj],fHadron[ii][jj] ));
+
+ // end for proton-proton
+
+}
+
+//_______________________________________________________
+void AliEMCALPIDUtils::SetHighFluxParam()
+{
+
+ // as a first step, all array elements are initialized to 0.0
+ Int_t i, j;
+ for (i = 0; i < 6; i++) {
+ for (j = 0; j < 6; j++) {
+ fGamma[i][j] = fHadron[i][j] = fPiZero[i][j] = 0.;
+ fGamma1to10[i][j] = fHadron1to10[i][j] = 0.;
+ }
+ fGammaEnergyProb[i] = 0.;
+ fPiZeroEnergyProb[i] = 0.;
+ fHadronEnergyProb[i] = 0.;
+ }
+
+ // Pb Pb this goes with inverted landau + gaussian for gammas, landau+gaussian for Pi0 and hadrons
+
+ fGamma[0][0] = -7.656908e-01;
+ fGamma[0][1] = 2.352536e-01;
+ fGamma[0][2] = 1.555996e-02;
+ fGamma[0][3] = 2.243525e-04;
+ fGamma[0][4] = -2.560087e-06;
+
+ fGamma[1][0] = 6.500216e+00;
+ fGamma[1][1] = -2.564958e-01;
+ fGamma[1][2] = 1.967894e-01;
+ fGamma[1][3] = -3.982273e-04;
+ fGamma[1][4] = 2.797737e-06;
+
+ fGamma[2][0] = 2.416489e+00;
+ fGamma[2][1] = -1.601258e-01;
+ fGamma[2][2] = 3.126839e-02;
+ fGamma[2][3] = 3.387532e-04;
+ fGamma[2][4] = -4.089145e-06;
+
+ fGamma[3][0] = 0.;
+ fGamma[3][1] = -2.696008e+00;
+ fGamma[3][2] = 6.920305e-01;
+ fGamma[3][3] = -2.281122e-03;
+ fGamma[3][4] = 0.;
+
+ fGamma[4][0] = 2.281564e-01;
+ fGamma[4][1] = -7.575040e-02;
+ fGamma[4][2] = 3.813423e-01;
+ fGamma[4][3] = -1.243854e-04;
+ fGamma[4][4] = 1.232045e-06;
+
+ fGamma[5][0] = -3.290107e-01;
+ fGamma[5][1] = 3.707545e-02;
+ fGamma[5][2] = 2.917397e-03;
+ fGamma[5][3] = 4.695306e-05;
+ fGamma[5][4] = -3.572981e-07;
+
+ fHadron[0][0] = 1.519112e-01;
+ fHadron[0][1] = -8.267603e-02;
+ fHadron[0][2] = 1.914574e-02;
+ fHadron[0][3] = -2.677921e-04;
+ fHadron[0][4] = 5.447939e-06;
+
+ fHadron[1][0] = 0.;
+ fHadron[1][1] = -7.549870e-02;
+ fHadron[1][2] = 3.930087e-01;
+ fHadron[1][3] = -2.368500e-03;
+ fHadron[1][4] = 0.;
+
+ fHadron[2][0] = 0.;
+ fHadron[2][1] = -2.463152e-02;
+ fHadron[2][2] = 1.349257e-01;
+ fHadron[2][3] = -1.089440e-03;
+ fHadron[2][4] = 0.;
+
+ fHadron[3][0] = 0.;
+ fHadron[3][1] = 5.101560e-01;
+ fHadron[3][2] = 1.458679e-01;
+ fHadron[3][3] = 4.903068e-04;
+ fHadron[3][4] = 0.;
+
+ fHadron[4][0] = 0.;
+ fHadron[4][1] = -6.693943e-03;
+ fHadron[4][2] = 2.444753e-01;
+ fHadron[4][3] = -5.553749e-05;
+ fHadron[4][4] = 0.;
+
+ fHadron[5][0] = -4.414030e-01;
+ fHadron[5][1] = 2.292277e-01;
+ fHadron[5][2] = -2.433737e-02;
+ fHadron[5][3] = 1.758422e-03;
+ fHadron[5][4] = -3.001493e-05;
+
+ fPiZero[0][0] = 5.072157e-01;
+ fPiZero[0][1] = -5.352747e-01;
+ fPiZero[0][2] = 8.499259e-02;
+ fPiZero[0][3] = -3.687401e-03;
+ fPiZero[0][4] = 5.482280e-05;
+
+ fPiZero[1][0] = 4.590137e+02;
+ fPiZero[1][1] = -7.079341e+01;
+ fPiZero[1][2] = 4.990735e+00;
+ fPiZero[1][3] = -1.241302e-01;
+ fPiZero[1][4] = 1.065772e-03;
+
+ fPiZero[2][0] = 1.376415e+02;
+ fPiZero[2][1] = -3.031577e+01;
+ fPiZero[2][2] = 2.474338e+00;
+ fPiZero[2][3] = -6.903410e-02;
+ fPiZero[2][4] = 6.244089e-04;
+
+ fPiZero[3][0] = 0.;
+ fPiZero[3][1] = 1.145983e+00;
+ fPiZero[3][2] = -2.476052e-01;
+ fPiZero[3][3] = 1.367373e-02;
+ fPiZero[3][4] = 0.;
+
+ fPiZero[4][0] = -2.097586e+02;
+ fPiZero[4][1] = 6.300800e+01;
+ fPiZero[4][2] = -4.038906e+00;
+ fPiZero[4][3] = 1.088543e-01;
+ fPiZero[4][4] = -9.362485e-04;
+
+ fPiZero[5][0] = -1.671477e+01;
+ fPiZero[5][1] = 2.995415e+00;
+ fPiZero[5][2] = -6.040360e-02;
+ fPiZero[5][3] = -6.137459e-04;
+ fPiZero[5][4] = 1.847328e-05;
+
+ // those are the High Flux PbPb ones
+ fHadronEnergyProb[0] = 0.;
+ fHadronEnergyProb[1] = 0.;
+ fHadronEnergyProb[2] = 6.188452e-02;
+ fHadronEnergyProb[3] = 2.030230e+00;
+ fHadronEnergyProb[4] = -6.402242e-02;
+
+// Int_t ii= 0;
+// Int_t jj= 3;
+// AliDebug(1,Form("PID parameters (%d, %d): fGamma=%.3f, fPi=%.3f, fHadron=%.3f",
+// ii,jj, fGamma[ii][jj],fPiZero[ii][jj],fHadron[ii][jj] ));
+
+}
--- /dev/null
+#ifndef ALIEMCALPIDUTILS_H
+#define ALIEMCALPIDUTILS_H
+
+/* $Id: AliEMCALPIDUtils.h 33808 2009-07-15 09:48:08Z gconesab $ */
+
+///////////////////////////////////////////////////////////////////////////////
+// Class AliEMCALPIDUtils
+// Compute PID weights for all the clusters
+///////////////////////////////////////////////////////////////////////////////
+
+//Root includes
+#include "TTask.h"
+class TArrayD ;
+
+//AliRoot includes
+#include "AliPID.h"
+
+class AliEMCALPIDUtils : public TTask {
+
+public:
+
+ AliEMCALPIDUtils();
+/* AliEMCALPIDUtils(Bool_t reconstructor); */
+ //virtual ~AliEMCALPIDUtils() { }
+
+ void ComputePID(Double_t energy, Double_t lambda0); // give the PID of a cluster
+
+ void InitParameters();
+ void SetLowFluxParam();
+ void SetHighFluxParam();
+
+ TArrayD DistLambda0(const Double_t energy, const Int_t nature) ; // compute lambda0 distributions
+
+ Double_t DistEnergy(const Double_t energy, const Int_t nature) ;
+
+ Double_t GetPID(Int_t idx) const {if (idx>=0&&idx<3) return fPID[idx]; else return 0.;}
+ Double_t GetPIDFinal(Int_t idx) const {if (idx>=0&&idx<AliPID::kSPECIESN) return fPIDFinal[idx]; else return 0.;}
+ Double_t GetPIDWeight(Int_t idx) const {if (idx>=0&&idx<3) return fPIDWeight[idx]; else return 0.;}
+
+ void SetPID(Double_t val, Int_t idx) {if (idx>=0&&idx<3) fPID[idx] = val;}
+ void SetPIDFinal(Double_t val, Int_t idx) {if (idx>=0&&idx<AliPID::kSPECIESN) fPIDFinal[idx] = val;}
+ void SetPIDWeight(Double_t val, Int_t idx) {if (idx>=0&&idx<3) fPIDWeight[idx] = val;}
+ void SetPrintInfo(Bool_t yesno) {fPrintInfo = yesno;}
+
+
+
+ private:
+
+ Double_t Polynomial(const Double_t x, const Double_t *params) const ;
+ Double_t Polynomialinv(const Double_t x, const Double_t *params) const ;
+ Double_t PolynomialMixed1(const Double_t x, const Double_t *params) const ;
+ Double_t PolynomialMixed2(const Double_t x, const Double_t *params) const ;
+ Double_t Polynomial0(const Double_t *params) const ;
+ Double_t PowerExp(const Double_t x, const Double_t *params) const ;
+
+protected:
+ Bool_t fPrintInfo; // flag to decide if details about PID must be printed
+
+ Double_t fGamma[6][6]; // Parameter to Compute PID for photons
+ Double_t fGamma1to10[6][6]; // Parameter to Compute PID not used
+ Double_t fHadron[6][6]; // Parameter to Compute PID for hadrons, 1 to 10 GeV
+ Double_t fHadron1to10[6][6]; // Parameter to Compute PID for hadrons, 1 to 10 GeV
+ Double_t fPiZero[6][6]; // Parameter to Compute PID for pi0
+ Double_t fHadronEnergyProb[6]; // Parameter to Compute PID for energy ponderation for hadrons
+ Double_t fPiZeroEnergyProb[6]; // Parameter to Compute PID for energy ponderation for Pi0
+ Double_t fGammaEnergyProb[6]; // Parameter to Compute PID for energy ponderation for gamma
+
+ Float_t fPID[3];
+
+ Float_t fPIDFinal[AliPID::kSPECIESN+1]; // final PID format
+ Float_t fPIDWeight[3]; // order: gamma, pi0, hadrons,
+ Double_t fProbGamma; // probility to be a Gamma
+ Double_t fProbPiZero; // probility to be a PiO
+ Double_t fProbHadron; // probility to be a Hadron
+ Double_t fWeightHadronEnergy; // Weight for a a Hadron to have a given energy (parametr from a flat distrib from 0 to 100)
+ Double_t fWeightGammaEnergy; // Weight for a Gamma to have a given energy (for the moment =1.)
+ Double_t fWeightPiZeroEnergy; // Weight for a Pi0 Hadron to have a given energy (for the moment =1.)
+
+ ClassDef(AliEMCALPIDUtils, 1)
+
+};
+
+#endif // ALIEMCALPIDUTILS_H
+
+
#include <TList.h>
#include <TClonesArray.h>
#include <TH2.h>
+#include "TGeoManager.h"
+#include "TGeoMatrix.h"
// --- Standard library ---
#include "AliEMCAL.h"
#include "AliEMCALHistoUtilities.h"
#include "AliESDVZERO.h"
-
+#include "AliCDBManager.h"
#include "AliRunLoader.h"
#include "AliRun.h"
TClonesArray* AliEMCALReconstructor::fgDigitsArr = 0; // shoud read just once at event
//____________________________________________________________________________
AliEMCALReconstructor::AliEMCALReconstructor()
- : fDebug(kFALSE), fList(0), fGeom(0)
+ : fDebug(kFALSE), fList(0), fGeom(0),fCalibData(0)
{
// ctor
fgRawUtils = new AliEMCALRawUtils;
- fgClusterizer = new AliEMCALClusterizerv1;
//To make sure we match with the geometry in a simulation file,
//let's try to get it first. If not, take the default geometry
fGeom = AliEMCALGeometry::GetInstance(AliEMCALGeometry::GetDefaultGeometryName());
}
+ //Get calibration parameters
+ if(!fCalibData)
+ {
+ AliCDBEntry *entry = (AliCDBEntry*)
+ AliCDBManager::Instance()->Get("EMCAL/Calib/Data");
+ if (entry) fCalibData = (AliEMCALCalibData*) entry->GetObject();
+ }
+
+ if(!fCalibData)
+ AliFatal("Calibration parameters not found in CDB!");
+
+ //Init the clusterizer with geometry and calibration pointers, avoid doing it twice.
+ fgClusterizer = new AliEMCALClusterizerv1(fGeom, fCalibData);
+
if(!fGeom) AliFatal(Form("Could not get geometry!"));
}
: AliReconstructor(rec),
fDebug(rec.fDebug),
fList(rec.fList),
- fGeom(rec.fGeom)
+ fGeom(rec.fGeom),
+ fCalibData(rec.fCalibData)
{
//copy ctor
}
ReadDigitsArrayFromTree(digitsTree);
fgClusterizer->InitParameters();
fgClusterizer->SetOutput(clustersTree);
-
+
if(fgDigitsArr && fgDigitsArr->GetEntries()) {
fgClusterizer->SetInput(digitsTree);
TClonesArray *digits = new TClonesArray("AliEMCALDigit",1000);
TBranch *branchdig = digitsTree->GetBranch("EMCAL");
if (!branchdig) {
- AliError("can't get the branch with the PHOS digits !");
+ AliError("can't get the branch with the EMCAL digits !");
return;
}
branchdig->SetAddress(&digits);
AliESDCaloCells &emcCells = *(esd->GetEMCALCells());
emcCells.CreateContainer(nDigits);
emcCells.SetType(AliESDCaloCells::kEMCALCell);
+ Float_t energy = 0;
for (Int_t idig = 0 ; idig < nDigits ; idig++) {
const AliEMCALDigit * dig = (const AliEMCALDigit*)digits->At(idig);
if(dig->GetAmp() > 0 ){
- emcCells.SetCell(idignew,dig->GetId(),dig->GetAmp(), dig->GetTime());
+ energy = (static_cast<AliEMCALClusterizerv1*> (fgClusterizer))->Calibrate(dig->GetAmp(),dig->GetId());
+ emcCells.SetCell(idignew,dig->GetId(),energy, dig->GetTime());
idignew++;
}
}
delete clusters;
// printf(" ## AliEMCALReconstructor::FillESD() is ended : ncl %i -> %i ### \n ",nClusters, nClustersNew);
+
+ //Store EMCAL misalignment matrixes
+ FillMisalMatrixes(esd) ;
+
+}
+
+//==================================================================================
+void AliEMCALReconstructor::FillMisalMatrixes(AliESDEvent* esd)const{
+ //Store EMCAL matrixes in ESD Header
+
+ //Check, if matrixes was already stored
+ for(Int_t sm = 0 ; sm < 12; sm++){
+ if(esd->GetEMCALMatrix(sm)!=0)
+ return ;
+ }
+
+ //Create and store matrixes
+ if(!gGeoManager){
+ AliError("Can not store misal. matrixes: no gGeoManager! \n") ;
+ return ;
+ }
+ //Note, that owner of copied marixes will be header
+ char path[255] ;
+ TGeoHMatrix * m ;
+ for(Int_t sm = 0; sm < 12; sm++){
+ sprintf(path,"/ALIC_1/XEN1_1/SMOD_%d",sm+1) ; //In Geometry modules numbered 1,2,.,5
+ if(sm >= 10) sprintf(path,"/ALIC_1/XEN1_1/SM10_%d",sm-10+1) ;
+
+ if (gGeoManager->cd(path)){
+ m = gGeoManager->GetCurrentMatrix() ;
+ esd->SetEMCALMatrix(new TGeoHMatrix(*m),sm) ;
+ }
+ else{
+ esd->SetEMCALMatrix(NULL,sm) ;
+ }
+ }
+
}
+
+
//__________________________________________________________________________
void AliEMCALReconstructor::ReadDigitsArrayFromTree(TTree *digitsTree) const
{
//*-- Dmitri Peressounko (SUBATECH & Kurchatov Institute)
// --- ROOT system ---
-#include "AliEMCALRecParam.h"
-#include "AliReconstructor.h"
-#include "AliEMCALTracker.h"
-
class TList;
class TClonesArray;
class TTree;
+
+// --- AliRoot header files ---
+#include "AliReconstructor.h"
+#include "AliEMCALTracker.h"
+#include "AliEMCALRecParam.h"
+
+
class AliEMCALDigitizer ;
class AliEMCALClusterizer ;
class AliEMCALSDigitizer ;
class AliRawReader ;
class AliEMCALRawUtils;
class AliEMCALGeometry;
+class AliEMCALCalibData ;
// --- Standard library ---
-// --- AliRoot header files ---
+
class AliEMCALReconstructor : public AliReconstructor {
static TClonesArray* GetDigitsArr() {return fgDigitsArr;}
+ void FillMisalMatrixes(AliESDEvent* esd)const ;
+
private:
Bool_t fDebug; //! verbosity controller
static AliEMCALRawUtils* fgRawUtils; // raw utilities class -
// only need one per reco
static TClonesArray* fgDigitsArr; // Array with EMCAL digits
+ AliEMCALCalibData * fCalibData ; //! Calibration database if aval
- ClassDef(AliEMCALReconstructor,6) // Reconstruction algorithm class (Base Class)
+ ClassDef(AliEMCALReconstructor,7) // Reconstruction algorithm class (Base Class)
};
#include "AliLog.h"
#include "AliEMCALShishKebabTrd1Module.h"
-#include "AliEMCALGeometry.h"
+#include "AliEMCALEMCGeometry.h"
#include <cassert>
-#include <Riostream.h>
-
ClassImp(AliEMCALShishKebabTrd1Module)
- AliEMCALGeometry *AliEMCALShishKebabTrd1Module::fgGeometry=0;
+ AliEMCALEMCGeometry *AliEMCALShishKebabTrd1Module::fgGeometry=0;
Double_t AliEMCALShishKebabTrd1Module::fga=0.;
Double_t AliEMCALShishKebabTrd1Module::fga2=0.;
Double_t AliEMCALShishKebabTrd1Module::fgb=0.;
Double_t AliEMCALShishKebabTrd1Module::fgtanBetta=0; //
//_____________________________________________________________________________
-AliEMCALShishKebabTrd1Module::AliEMCALShishKebabTrd1Module(Double_t theta, AliEMCALGeometry *g)
+AliEMCALShishKebabTrd1Module::AliEMCALShishKebabTrd1Module(Double_t theta, AliEMCALEMCGeometry *g)
: TNamed(),
fOK(),
fA(0.),
}
} else Warning("AliEMCALShishKebabTrd1Module(theta)","You should call this constractor just once !!");
DefineName(fTheta);
- AliDebug(1,Form("First module: theta %1.4f geometry %s",fTheta,g->GetName()));
+ AliInfo(Form("AliEMCALShishKebabTrd1Module - first module: theta %1.4f geometry %s",fTheta,g->GetName()));
}
//_____________________________________________________________________________
void AliEMCALShishKebabTrd1Module::DefineAllStaff()
{
+ //Define some parameters
DefineName(fTheta);
// Centers of cells - 2X2 case
Double_t kk1 = (fga+fga2)/(2.*4.); // kk1=kk2
//_____________________________________________________________________________
Bool_t AliEMCALShishKebabTrd1Module::GetParameters()
{
- // Get needing module parameters from EMCAL geometry
- if(!fgGeometry) fgGeometry = AliEMCALGeometry::GetInstance();
+
+ // Get needing module parameters from EMCAL geometry
TString sn(fgGeometry->GetName()); // 2-Feb-05
sn.ToUpper();
if(!fgGeometry) {
Warning("GetParameters()"," No geometry ");
return kFALSE;
}
+
fga = (Double_t)fgGeometry->GetEtaModuleSize();
fgb = (Double_t)fgGeometry->GetLongModuleSize();
#include <TMath.h>
#include <TVector2.h>
-class AliEMCALGeometry;
+class AliEMCALEMCGeometry;
class AliEMCALShishKebabTrd1Module : public TNamed {
public:
- AliEMCALShishKebabTrd1Module(Double_t theta=0.0, AliEMCALGeometry *g=0);
+ AliEMCALShishKebabTrd1Module(Double_t theta=0.0, AliEMCALEMCGeometry *g=0);
AliEMCALShishKebabTrd1Module(AliEMCALShishKebabTrd1Module &leftNeighbor);
void Init(Double_t A, Double_t B);
void DefineAllStaff();
} else {xr = fOK1.Y(); zr = fOK1.X();
}
}
- void GetCenterOfCellInLocalCoordinateofSM_3X3(Int_t ieta, Double_t &xr, Double_t &zr) const
+ void GetCenterOfCellInLocalCoordinateofSM3X3(Int_t ieta, Double_t &xr, Double_t &zr) const
{ // 3X3 case - Nov 9,2006
- if(ieta < 0) ieta = 0;
- if(ieta > 2) ieta = 2;
- // ieta = ieta<0? ieta=0 : ieta; // check index
- //ieta = ieta>2? ieta=2 : ieta;
- xr = fOK3X3[2-ieta].Y();
- zr = fOK3X3[2-ieta].X();
+ if(ieta < 0) ieta = 0; //ieta = ieta<0? ieta=0 : ieta; // check index
+ if(ieta > 2) ieta = 2; //ieta = ieta>2? ieta=2 : ieta;
+ xr = fOK3X3[2-ieta].Y(); zr = fOK3X3[2-ieta].X();
}
- void GetCenterOfCellInLocalCoordinateofSM_1X1(Double_t &xr, Double_t &zr) const
- { // 1X1 case - Nov 27,2006
- // Center of cell is center of module
+ void GetCenterOfCellInLocalCoordinateofSM1X1(Double_t &xr, Double_t &zr) const
+ { // 1X1 case - Nov 27,2006 // Center of cell is center of module
xr = fOK.Y() - fgr;
zr = fOK.X();
}
protected:
// geometry info
- static AliEMCALGeometry *fgGeometry; //!
+ static AliEMCALEMCGeometry *fgGeometry; //!
static Double_t fga; // 2*dx1=2*dy1
static Double_t fga2; // 2*dx2
static Double_t fgb; // 2*dz1
// 3X3 case - Nov 9,2006
TVector2 fOK3X3[3];
// public:
- ClassDef(AliEMCALShishKebabTrd1Module,2) // TRD1 Shish-Kebab module
+ ClassDef(AliEMCALShishKebabTrd1Module,3) // TRD1 Shish-Kebab module
};
#endif
${ROOT_INCLUDE_DIR}
)
+# Make sure the compiler can find files from our library
include_directories( ${INCLUDE_DIRECTORIES})
set(LINK_DIRECTORIES
${ROOT_LIBRARY_DIR}
)
+# Make sure the linker can find the library once it is built
link_directories( ${LINK_DIRECTORIES})
SetModule()
+include(CMake_libEMCALUtils.txt)
+
include(CMake_libEMCALrec.txt)
include(CMake_libEMCALbase.txt)
include(CMake_libEMCALsim.txt)
include(CMake_libEMCALcalib.txt)
-
-
--- /dev/null
+# -*- mode: cmake -*-
+
+set(SRCS
+AliEMCALGeoUtils.cxx
+AliEMCALEMCGeometry.cxx
+AliEMCALShishKebabTrd1Module.cxx
+AliEMCALPIDUtils.cxx
+)
+
+# fill list of header files from list of source files
+# by exchanging the file extension
+String(REPLACE ".cxx" ".h" HDRS "${SRCS}")
+
+# Create a library called EMCALUtils which includes the source files SRCS
+# The extension is already found. Any nu;ber of sources could be listed here
+AddLibrary(EMCALUtils "${SRCS}" "${HDRS}")
AliEMCALHit.cxx
AliEMCALLoader.cxx
AliEMCALShishKebabModule.cxx
-AliEMCALShishKebabTrd1Module.cxx
AliEMCALWsuCosmicRaySetUp.cxx
AliEMCALRecPoint.cxx
AliEMCALClusterizer.cxx
AliEMCALTracker.cxx
AliEMCALPID.cxx
AliEMCALQADataMakerRec.cxx
+AliEMCALAodCluster.cxx
)
# fill list of header files from list of source files
--- /dev/null
+#ifdef __CINT__
+// for libEMCALrec.pkg
+#pragma link off all globals;
+#pragma link off all classes;
+#pragma link off all functions;
+
+#pragma link C++ class AliEMCALGeoUtils+;
+#pragma link C++ class AliEMCALEMCGeometry+;
+#pragma link C++ class AliEMCALShishKebabTrd1Module+;
+#pragma link C++ class AliEMCALPIDUtils+;
+
+#endif
#pragma link C++ class AliEMCALHit+;
#pragma link C++ class AliEMCALLoader+;
#pragma link C++ class AliEMCALShishKebabModule+;
-#pragma link C++ class AliEMCALShishKebabTrd1Module+;
#pragma link C++ class AliEMCALWsuCosmicRaySetUp+;
#pragma link C++ class AliEMCALRecPoint+;
#pragma link C++ class AliEMCALClusterizer+;
#pragma link C++ class AliEMCALCalibData+;
#pragma link C++ class AliEMCALCalibHistoProducer+;
#pragma link C++ class AliEMCALCalibTimeDep+;
+#pragma link C++ class AliEMCALCalibTimeDepCorrection+;
#pragma link C++ class AliEMCALPreprocessor+;
#pragma link C++ class AliEMCALSensorTemp+;
#pragma link C++ class AliEMCALSensorTempArray+;
#pragma link C++ class AliEMCALQAChecker+;
#pragma link C++ class AliEMCALSpaceFrame+;
#pragma link C++ class AliEMCALSTURawStream+;
-#pragma link C++ class AliEMCALBiasAPD+;
-#pragma link C++ class AliEMCALCalibMapAPD+;
-#pragma link C++ class AliEMCALCalibAbs+;
-#pragma link C++ class AliEMCALCalibTimeDepCorrection+;
#pragma link C++ class AliEMCALCCUSBRawStream+;
+// #pragma link C++ class AliEMCALShishKebabTrd1Module+;
+
#endif
#pragma link C++ class AliEMCALTracker+;
#pragma link C++ class AliEMCALPID+;
#pragma link C++ class AliEMCALQADataMakerRec+;
+#pragma link C++ class AliEMCALAodCluster+;
#endif
--- /dev/null
+#-*- Mode: Makefile -*-
+
+SRCS = AliEMCALGeoUtils.cxx AliEMCALEMCGeometry.cxx \
+ AliEMCALShishKebabTrd1Module.cxx AliEMCALPIDUtils.cxx
+
+HDRS:= $(SRCS:.cxx=.h)
+
+DHDR= EMCALUtilsLinkDef.h
+
+EXPORT:=AliEMCALGeoUtils.h AliEMCALEMCGeometry.h AliEMCALShishKebabTrd1Module.h AliEMCALPIDUtils.h
+
+CXXFLAGS+=-D__EMCALUTIL__
+
+ifeq (win32gcc,$(ALICE_TARGET))
+PACKSOFLAGS:= $(SOFLAGS) -L$(ALICE_ROOT)/lib/tgt_$(ALICE_TARGET) \
+ -L$(shell root-config --libdir) -lGeom
+endif
AliEMCALHit.cxx \
AliEMCALLoader.cxx \
AliEMCALShishKebabModule.cxx \
-AliEMCALShishKebabTrd1Module.cxx \
AliEMCALWsuCosmicRaySetUp.cxx \
AliEMCALRecPoint.cxx \
AliEMCALClusterizer.cxx \
AliEMCALCalibData.cxx \
AliEMCALCalibHistoProducer.cxx \
AliEMCALCalibTimeDep.cxx \
+AliEMCALCalibTimeDepCorrection.cxx \
AliEMCALPreprocessor.cxx \
AliEMCALSensorTemp.cxx \
AliEMCALSensorTempArray.cxx \
AliEMCALQAChecker.cxx \
AliEMCALSpaceFrame.cxx \
AliEMCALSTURawStream.cxx \
-AliEMCALBiasAPD.cxx \
-AliEMCALCalibMapAPD.cxx \
-AliEMCALCalibAbs.cxx \
-AliEMCALCalibTimeDepCorrection.cxx \
SMcalib/AliEMCALCCUSBRawStream.cxx
-
+# AliEMCALShishKebabTrd1Module.cxx \
HDRS= $(SRCS:.cxx=.h)
DHDR:=EMCALbaseLinkDef.h
# have to tune
-EINCLUDE:=PYTHIA6 RAW EVGEN THijing
+EINCLUDE:=PYTHIA6 RAW EVGEN THijing
ifeq (win32gcc,$(ALICE_TARGET))
PACKSOFLAGS:= $(SOFLAGS) -L$(ALICE_ROOT)/lib/tgt_$(ALICE_TARGET) \
+ -lEMCALUtils \
-lSTEERBase -lCDB -lSTEER \
-lRAWDatarec -lRAWDatabase \
-L$(shell root-config --libdir) -lVMC -lGeom -lMinuit
AliEMCALTrack.cxx \
AliEMCALTracker.cxx \
AliEMCALPID.cxx \
-AliEMCALQADataMakerRec.cxx
+AliEMCALQADataMakerRec.cxx AliEMCALAodCluster.cxx
HDRS= $(SRCS:.cxx=.h)
-CINTHDRS:= $(HDRS) AliEMCALGeometry.h
+CINTHDRS:= $(HDRS) AliEMCALGeometry.h AliEMCALGeoUtils.h
DHDR:=EMCALrecLinkDef.h
# have to tune
-EINCLUDE:=PYTHIA6 RAW EVGEN THijing
+EINCLUDE:=PYTHIA6 RAW EVGEN THijing
ifeq (win32gcc,$(ALICE_TARGET))
PACKSOFLAGS:= $(SOFLAGS) -L$(ALICE_ROOT)/lib/tgt_$(ALICE_TARGET) \
- -lEMCALbase -lEMCALsim -lSTEER -lESD -lCDB -lSTEERBase \
+ -lEMCALUtils -lEMCALbase -lEMCALsim -lSTEER -lESD -lCDB -lSTEERBase \
-L$(shell root-config --libdir) -lMinuit
endif
DHDR:=EMCALsimLinkDef.h
# have to tune
-EINCLUDE:=PYTHIA6 RAW EVGEN THijing
+EINCLUDE:=PYTHIA6 RAW EVGEN THijing
ifeq (win32gcc,$(ALICE_TARGET))
PACKSOFLAGS:= $(SOFLAGS) -L$(ALICE_ROOT)/lib/tgt_$(ALICE_TARGET) \
- -lEMCALbase -lSTEER -lSTEERBase \
+ -lEMCALUtils -lEMCALbase -lSTEER -lSTEERBase \
-lRAWDatarec -lRAWDatasim -lRAWDatabase \
-L$(shell root-config --libdir) -lVMC -lGeom
endif
PMDsim PMDrec TRDbase TRDsim TRDrec TRDfast FMDbase FMDsim FMDrec TOFbase
TOFrec TOFsim PHOSUtils PHOSbase PHOSsim PHOSrec ACORDEbase ACORDEsim ACORDErec
HMPIDbase HMPIDrec HMPIDsim ZDCbase ZDCsim ZDCrec VZERObase VZEROsim
- VZEROrec EMCALbase EMCALsim EMCALrec BCM STRUCT T0base T0sim T0rec EVGEN
+ VZEROrec EMCALUtils EMCALbase EMCALsim EMCALrec BCM STRUCT T0base T0sim T0rec EVGEN
STEERBase ESD AOD CDB STEER THijing hijing TEPEMGEN FASTSIM microcern
RAWDatabase RAWDatarec RAWDatasim HLTbase)
ACORDEbase ACORDEsim ACORDErec \
HMPIDbase HMPIDrec HMPIDsim \
ZDCbase ZDCsim ZDCrec VZERObase VZEROsim VZEROrec \
- EMCALbase EMCALsim EMCALrec BCM \
+ EMCALUtils EMCALbase EMCALsim EMCALrec BCM \
STRUCT T0base T0sim T0rec EVGEN STEERBase ESD AOD CDB STEER MONITOR \
ANALYSIS ANALYSISalice \
THijing \
-lITSbase \
-lMUONgeometry -lMUONmapping -lMUONrec -lMUONsim -lMUONbase -lMUONcore \
-lPMDbase -lT0base -lTOFbase -lTOFsim -lTPCbase -lTRDbase -lTRDrec \
- -lFMDbase -lFMDrec -lEMCALbase \
+ -lFMDbase -lFMDrec -lEMCALbase -lEMCALUtils \
-lVZERObase -lVZEROrec \
-lRAWDatarec -lRAWDatabase \
-L$(shell root-config --libdir) -lEve -lRGL -lGed -lGui -lGeom -lEG
EINCLUDE := HLT/BASE HLT/BASE/util HLT/EMCAL HLT/TPC HLT/TRD EMCAL TPC TRD STEER RAW
LIBRARY_DEP := -lHLTbase -lAliHLTUtil -lESD -lCDB \
- -lEMCALrec -lEMCALsim -lEMCALbase \
+ -lEMCALrec -lEMCALsim -lEMCALbase -lEMCALUtils \
-lTPCrec -lTPCbase -lTRDrec -lTRDbase \
-lSTEER -lSTEERBase -lRAWDatarec
ALIROOT/module.mk: ALIROOT/binaliroot.pkg
ANALYSIS/module.mk: ANALYSIS/libANALYSIS.pkg ANALYSIS/libANALYSISalice.pkg ANALYSIS/libANALYSISRL.pkg ANALYSIS/libAliengui.pkg ANALYSIS/binaliengui.pkg
ACORDE/module.mk: ACORDE/libACORDEbase.pkg ACORDE/libACORDErec.pkg ACORDE/libACORDEsim.pkg
-EMCAL/module.mk: EMCAL/libEMCALbase.pkg EMCAL/libEMCALsim.pkg EMCAL/libEMCALrec.pkg EMCAL/libEMCALcalib.pkg
+EMCAL/module.mk: EMCAL/libEMCALbase.pkg EMCAL/libEMCALsim.pkg EMCAL/libEMCALrec.pkg EMCAL/libEMCALcalib.pkg EMCAL/libEMCALUtils.pkg
EPOS/module.mk: EPOS/libEPOS.pkg
EVGEN/module.mk: EVGEN/libEVGEN.pkg
FMD/module.mk: FMD/libFMDbase.pkg FMD/libFMDsim.pkg FMD/libFMDrec.pkg FMD/libFMDutil.pkg FMD/libFMDflow.pkg FMD/analysis/FMDanalysisLinkDef.h