+//------------------------------------------------------------------------------------
+void AliJetDummyGeo::CreateListOfTrd1Modules()
+{
+ // Generate the list of Trd1 modules
+ // which will make up the EMCAL
+ // geometry
+ printf("CreateListOfTrd1Modules() \n");
+
+ AliJetDummyShishKebabTrd1Module *mod=0, *mTmp=0; // current module
+ if(fShishKebabTrd1Modules == 0) {
+ fShishKebabTrd1Modules = new TList;
+ fShishKebabTrd1Modules->SetName("ListOfTRD1");
+ for(Int_t iz=0; iz< GetNZ(); iz++) {
+ if(iz==0) {
+ mod = new AliJetDummyShishKebabTrd1Module(TMath::Pi()/2.,this);
+ } else {
+ mTmp = new AliJetDummyShishKebabTrd1Module(*mod);
+ mod = mTmp;
+ }
+ fShishKebabTrd1Modules->Add(mod);
+ }
+ } else {
+ printf(" Already exits : ");
+ }
+ mod = (AliJetDummyShishKebabTrd1Module*)fShishKebabTrd1Modules->At(fShishKebabTrd1Modules->GetSize()-1);
+ fEtaMaxOfTRD1 = mod->GetMaxEtaOfModule(0);
+
+ // printf(" 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
+ //
+
+ // printf(" 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, zr, theta, phi, eta, r, x,y;
+ xr = 0.;
+ zr = 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);
+
+ // printf(" 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);
+ if(fDebug>1) AliInfo(Form(" Cells grid in eta directions : size %i\n", fCentersOfCellsEtaDir.GetSize()));
+ for(Int_t it=0; it<fNZ; it++) {
+ AliJetDummyShishKebabTrd1Module *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_t(xr) - fParSM[0],ieta);
+ fCentersOfCellsEtaDir.AddAt(Float_t(zr) - fParSM[2],ieta);
+ // Define grid on eta direction for each bin in phi
+ for(Int_t 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 = AliJetDummyShishKebabTrd1Module::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);
+ }
+ }
+
+ if(fDebug>1){
+ for(Int_t i=0; i<fCentersOfCellsEtaDir.GetSize(); i++) {
+ AliInfo(Form(" ind %2.2i : z %8.3f : x %8.3f", i+1,
+ fCentersOfCellsEtaDir.At(i),fCentersOfCellsXDir.At(i)));
+ }
+ }
+}
+
+//------------------------------------------------------------------------------------
+AliJetDummyShishKebabTrd1Module* AliJetDummyGeo::GetShishKebabModule(Int_t neta)
+{
+ // 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 AliJetDummyShishKebabTrd1Module* trd1=0;
+ if(fShishKebabTrd1Modules && neta>=0 && neta<fShishKebabTrd1Modules->GetSize()) {
+ trd1 = (AliJetDummyShishKebabTrd1Module*)fShishKebabTrd1Modules->At(neta);
+ } else trd1 = 0;
+ return trd1;
+}
+