X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=EMCAL%2FAliEMCALv0.cxx;h=cec6fa40a6564b13cf0228943beaaba1adba97c6;hb=9be2fe3a9a5bd6d1b698aaff07f2179224694e66;hp=2152e65bc3c51cc422023095f8eed5c1e83b789b;hpb=152bf70fc0347ea05a55f9f44f1f66a0b14320ba;p=u%2Fmrichter%2FAliRoot.git diff --git a/EMCAL/AliEMCALv0.cxx b/EMCAL/AliEMCALv0.cxx index 2152e65bc3c..cec6fa40a65 100644 --- a/EMCAL/AliEMCALv0.cxx +++ b/EMCAL/AliEMCALv0.cxx @@ -12,234 +12,333 @@ * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ - /* $Id$ */ //_________________________________________________________________________ // Implementation version v0 of EMCAL Manager class // An object of this class does not produce hits nor digits // It is the one to use if you do not want to produce outputs in TREEH or TREED -// +// This class places a Geometry of the EMCAL in the ALICE Detector as defined in AliEMCALGeometry.cxx //*-- Author: Yves Schutz (SUBATECH) +//*-- and : Sahal Yacoob (LBL / UCT) + +// This Version of AliEMCALv0 reduces the number of volumes placed in XEN1 (the envelope) to less than five hundred +// The Envelope is Placed in Alice, And the Aluminium layer. Mini envelopes (XU) are then placed in XEN1. +// Each mini envelope contains 1 scintillator, and 1 lead layer, except the last one which contains just one scintillator layer. +// At the moment I cannot place the 36 and above layers in the mini envelopes so all layers are still placed in XEN1 // --- ROOT system --- +//#include "TPGON.h" #include "TTUBS.h" #include "TNode.h" -#include "TRandom.h" #include "TGeometry.h" - +#include "TVirtualMC.h" +#include "TArrayI.h" // --- Standard library --- -#include +//#include // --- AliRoot header files --- #include "AliEMCALv0.h" #include "AliEMCALGeometry.h" #include "AliRun.h" -#include "AliMC.h" ClassImp(AliEMCALv0) -//____________________________________________________________________________ +//______________________________________________________________________ AliEMCALv0::AliEMCALv0(const char *name, const char *title): AliEMCAL(name,title) { - // ctor/* $Id$ */ - - cout << " $Id$ " << endl ; + // ctor : title is used to identify the layout + GetGeometry() ; } -//____________________________________________________________________________ +//______________________________________________________________________ void AliEMCALv0::BuildGeometry() { - - const Int_t kColorEmcal = kGreen ; - const Int_t kColorArm1 = kBlue ; - const Int_t kColorArm2 = kBlue ; - const Int_t kColorArm1Active = kRed ; - const Int_t kColorArm2Active = kRed ; - - // make the container of entire calorimeter - - new TTUBS("EMCAL", "Tubs that contains the calorimeter", "void", - fGeom->GetEnvelop(0), // rmin - fGeom->GetEnvelop(1), // rmax - fGeom->GetEnvelop(2)/2.0, // half length in Z - 0., - 360. - ) ; - - // make the container of Arm1 - - new TTUBS("Envelop1", "Tubs that contains arm 1", "void", - fGeom->GetEnvelop(0), // rmin - fGeom->GetEnvelop(1), // rmax - fGeom->GetEnvelop(2)/2.0, // half length in Z - fGeom->GetArm1PhiMin(), // minimun phi angle - fGeom->GetArm1PhiMax() // maximun phi angle - ) ; - // Active material of Arm1 - - new TTUBS("Arm1", "Active material of arm 1", "void", - fGeom->GetEnvelop(0) + fGeom->GetGap2Active(), // rmin - fGeom->GetEnvelop(0) + fGeom->GetGap2Active() + fGeom->GetLmat(),// rmax - fGeom->GetEnvelop(2)/2.0, // half length in Z - fGeom->GetArm1PhiMin(), // minimun phi angle - fGeom->GetArm1PhiMax() // maximun phi angle - ) ; - // make the container of Arm2 - - new TTUBS("Envelop2", "Tubs that contains arm 2", "void", - fGeom->GetEnvelop(0), // rmin - fGeom->GetEnvelop(1), // rmax - fGeom->GetEnvelop(2)/2.0, // half length in Z - fGeom->GetArm2PhiMin(), // minimun phi angle - fGeom->GetArm2PhiMax() // maximun phi angle - ) ; - - // Active material of Arm2 - - new TTUBS("Arm2", "Active material of arm 2", "void", - fGeom->GetEnvelop(0) + fGeom->GetGap2Active(), // rmin - fGeom->GetEnvelop(0) + fGeom->GetGap2Active() + fGeom->GetLmat(),// rmax - fGeom->GetEnvelop(2)/2.0, // half length in Z - fGeom->GetArm2PhiMin(), // minimun phi angle - fGeom->GetArm2PhiMax() // maximun phi angle - ) ; - - TNode * top = gAlice->GetGeometry()->GetNode("alice") ; - top->cd(); - - // Calorimeter inside alice - TNode * emcanode = new TNode("EMCAL", "EMCAL Envelop", "EMCAL") ; - emcanode->SetLineColor(kColorEmcal) ; - fNodes->Add(emcanode) ; - - // Arm 1 inside Calorimeter - emcanode->cd(); - TNode * envelop1node = new TNode("Envelop1", "Arm1 Envelop", "Envelop1") ; - envelop1node->SetLineColor(kColorArm1) ; - fNodes->Add(envelop1node) ; - - // Arm 2 inside alice - TNode * envelop2node = new TNode("Envelop2", "Arm2 Envelop", "Envelop2") ; - envelop2node->SetLineColor(kColorArm2) ; - fNodes->Add(envelop2node) ; - - // active material inside Arm 1 - envelop1node->cd() ; - TNode * arm1node = new TNode("Arm1", "Arm1 with Mat", "Arm1") ; - arm1node->SetLineColor(kColorArm1Active) ; - fNodes->Add(arm1node) ; - - // active material inside Arm 2 - envelop2node->cd() ; - TNode * arm2node = new TNode("Arm2", "Arm2 with Mat", "Arm2") ; - arm2node->SetLineColor(kColorArm2Active) ; - fNodes->Add(arm2node) ; - + // Display Geometry for display.C + + const Int_t kColorArm1 = kBlue ; + + AliEMCALGeometry * geom = GetGeometry() ; + + // Define the shape of the Calorimeter + TNode * top = gAlice->GetGeometry()->GetNode("alice") ; + new TTUBS("Envelop1", "Tubs that contains arm 1", "void", + geom->GetEnvelop(0), // rmin + geom->GetEnvelop(1) +30 ,// rmax + geom->GetEnvelop(2)/2.0, // half length in Z + geom->GetArm1PhiMin(), // minimum phi angle + geom->GetArm1PhiMax() // maximum phi angle + ); + + // Place the Node + top->cd(); + TNode * envelop1node = new TNode("Envelop1", "Arm1 Envelop", "Envelop1" + ,0., 0., 0., "") ; + envelop1node->SetLineColor(kColorArm1) ; + fNodes->Add(envelop1node) ; } -//____________________________________________________________________________ +//______________________________________________________________________ void AliEMCALv0::CreateGeometry() { // Create the EMCAL geometry for Geant - - AliEMCALv0 *emcaltmp = (AliEMCALv0*)gAlice->GetModule("EMCAL") ; - - if ( emcaltmp == NULL ) { + // Geometry of a tower + //|-----------------------------------------------------| XEN1 + //| | | | + //| | Al thickness = GetAlFrontThickness() | | + //| | | | + //| | | | + //| | | | + //| ------------------------------------------------- | + //| | Air Gap = GetGap2Active() | | + //| | | | + //| ------------------------------------------------- | + //| | XU1 : XPST (ECAL e = GetECScintThick() ) | | + //| ------------------------------------------------- | + //| | XU1 : XPBX (ECAL e = GetECPbRadThick() ) | | + //| ------------------------------------------------- | + //| | XU1 : XPST (ECAL e = GetECScintThick() | | + //| ------------------------------------------------- | + //| | XU1 : XPBX (ECAL e = GetECPbRadThick() ) | | + //| ------------------------------------------------- | + //| etc ..... GetNECLayers() - 1 times | + //| ------------------------------------------------- | + //| | XUNLayer : XPST (ECAL e = GetECScintThick() | | + //| ------------------------------------------------- | + + Float_t etamin,etamax; + Float_t *dum=0; + + AliEMCALGeometry * geom = GetGeometry() ; + + if(!(geom->IsInitialized())){ + Error("CreateGeometry","EMCAL Geometry class has not been set up."); + } // end if + + // Get pointer to the array containing media indices + Int_t *idtmed = fIdtmed->GetArray() - 1599 ; + + Int_t idrotm = 1; + AliMatrix(idrotm, 90.0, 0., 90.0, 90.0, 0.0, 0.0) ; + + // Create the EMCAL Mother Volume (a polygone) within which to place the Detector and named XEN1 + + Float_t envelopA[10]; + envelopA[0] = geom->GetArm1PhiMin(); // minimum phi angle + envelopA[1] = geom->GetArm1PhiMax() - geom->GetArm1PhiMin(); // angular range in phi + envelopA[2] = geom->GetNPhi(); // number of sections in phi + envelopA[3] = 2; // 2 z coordinates + envelopA[4] = geom->ZFromEtaR(geom->GetEnvelop(1), + geom->GetArm1EtaMin()); // z coordinate 1 + //add some padding for mother volume + envelopA[5] = geom->GetEnvelop(0) ; // rmin at z1 + envelopA[6] = geom->GetEnvelop(1) ; // rmax at z1 + envelopA[7] = geom->ZFromEtaR(geom->GetEnvelop(1), + geom->GetArm1EtaMax()); // z coordinate 2 + envelopA[8] = envelopA[5] ; // radii are the same. + envelopA[9] = envelopA[6] ; // radii are the same. + + gMC->Gsvolu("XEN1", "PGON ", idtmed[1599], envelopA, 10) ; // Polygone filled with air + + // Position the EMCAL Mother Volume (XEN1) in Alice (ALIC) + + gMC->Gspos("XEN1", 1, "ALIC", 0.0, 0.0, 0.0, idrotm, "ONLY") ; - fprintf(stderr, "EMCAL detector not found!\n") ; - return; + if (gDebug==2) { + printf("CreateGeometry: XEN1 = %f, %f\n", envelopA[5], envelopA[6]); + printf("CreateGeometry: XU0 = %f, %f\n", envelopA[5], envelopA[6]); + } + // Create mini-envelopes which will contain the Tower scintillator-radiator - } - // Get pointer to the array containing media indices - Int_t *idtmed = fIdtmed->GetArray() - 1599 ; - - // Create the EMCA volume that contains entirely EMCAL - - Float_t envelopA[5] ; - envelopA[0] = fGeom->GetEnvelop(0) ; // rmin - envelopA[1] = fGeom->GetEnvelop(1) ; // rmax - envelopA[2] = fGeom->GetEnvelop(2) / 2.0 ; // dz - envelopA[3] = 0. ; - envelopA[4] = 360.; - - gMC->Gsvolu("EMCA", "TUBS ", idtmed[1599], envelopA, 5) ; // filled with air - - // Create tube sectors that contains Arm 1 & 2 + TString label ; + + envelopA[5] = envelopA[5] + geom->GetGap2Active() // we are at the first scintllator + + geom->GetAlFrontThickness(); // rmin at z1 + envelopA[6] = envelopA[5] ; + + + Int_t i ; + + Int_t nLayers = geom->GetNECLayers(); + + for (i = 0; i < (nLayers-1); i++ ){ + label = "XU" ; + label += i ; + Float_t tseg ; + tseg = geom->GetECScintThick()+geom->GetECPbRadThick(); // thickness of scintillator+Pb in E Cal + envelopA[5] = envelopA[6] ; // rmin at z1 + envelopA[4] = geom->ZFromEtaR(envelopA[5] + tseg, + geom->GetArm1EtaMin()); // z coordinate 1 + envelopA[7] = geom->ZFromEtaR(envelopA[5] + tseg, + geom->GetArm1EtaMax()); // z coordinate 2 + envelopA[6] = envelopA[5] + tseg ; // rmax at z1 + envelopA[8] = envelopA[5] ; // radii are the same. + envelopA[9] = envelopA[6] ; // radii are the same. - envelopA[3] = fGeom->GetArm1PhiMin() ; // minimun phi angle - envelopA[4] = fGeom->GetArm1PhiMax() ; // maximun phi angle - - gMC->Gsvolu("XEN1", "TUBS ", idtmed[1599], envelopA, 5) ; // filled with air + gMC->Gsvolu(label.Data(), "PGON", idtmed[1599], envelopA, 10);// Polygone filled with air - envelopA[3] = fGeom->GetArm2PhiMin() ; // minimun phi angle - envelopA[4] = fGeom->GetArm2PhiMax() ; // maximun phi angle - - gMC->Gsvolu("XEN2", "TUBS ", idtmed[1599], envelopA, 5) ; // filled with air - - // Create a tube sector that contains active material Arm 1 & 2 - - envelopA[0] = fGeom->GetEnvelop(0) + fGeom->GetGap2Active() ; - envelopA[1] = envelopA[0] + fGeom->GetLmat() ; - envelopA[3] = fGeom->GetArm1PhiMin() ; // minimun phi angle - envelopA[4] = fGeom->GetArm1PhiMax() ; // maximun phi angle + // Position XUi in XEN1 + + gMC->Gspos(label.Data(), 1, "XEN1", 0.0, 0.0, 0.0, idrotm, "ONLY") ; - gMC->Gsvolu("XAR1", "TUBS ", idtmed[1601], envelopA, 5) ; // filled with active material (average) + if (gDebug == 2) + printf("CreateGeometry: XU%d = %f, %f\n", i, envelopA[5], envelopA[6]); - envelopA[3] = fGeom->GetArm2PhiMin() ; // minimun phi angle - envelopA[4] = fGeom->GetArm2PhiMax() ; // maximun phi angle + } // end i - gMC->Gsvolu("XAR2", "TUBS ", idtmed[1601], envelopA, 5) ; // filled with active material (average) - Int_t idrotm = 1; - AliMatrix(idrotm, 90.0, 0., 90.0, 90.0, 0.0, 0.0) ; - - // Position Calorimeter in ALICE - gMC->Gspos("EMCA", 1, "ALIC", 0.0, 0.0, 0.0, idrotm, "ONLY") ; + // Create one mini-envelope which will contain the last scintillator XU(nlayers-1) because there is one more scintillator than Pb layer XU(nlayers-1) + + label = "XU" ; + label += i ; + envelopA[5] = envelopA[6] ; // rmin at z1 + envelopA[4] = geom->ZFromEtaR(envelopA[5] + geom->GetECScintThick(), + geom->GetArm1EtaMin()); // z coordinate 1 + envelopA[7] = geom->ZFromEtaR(envelopA[5] + geom->GetECScintThick(), + geom->GetArm1EtaMax()); // z coordinate 2 + envelopA[6] = envelopA[5] + geom->GetECScintThick() ; // rmax at z1 + envelopA[8] = envelopA[5] ; // radii are the same. + envelopA[9] = envelopA[6] ; // radii are the same. + + gMC->Gsvolu(label.Data(), "PGON", idtmed[1599], envelopA, 10); // Polygone filled with air + + // Position the last minienvelope in XEN1 + + gMC->Gspos(label.Data(), 1, "XEN1", 0.0, 0.0, 0.0, idrotm, "ONLY") ; + + if(gDebug == 2) + printf("CreateGeometry: XEN%d = %f, %f\n", i, envelopA[5], envelopA[6]); + + // Create the shapes of active material (LEAD/Aluminium/Scintillator) + // to be placed + Float_t envelopB[10]; // First Layer of Aluminium + Float_t envelopC[10]; // Scintillator Layers + Float_t envelopD[10]; // Lead Layers + + envelopC[0] = envelopD[0] = envelopB[0] = envelopA[0] ; // starting position in Phi + envelopC[1] = envelopD[1] = envelopB[1] = envelopA[1] ; // angular range in phi + envelopC[2] = envelopD[2] = envelopB[2] = envelopA[2] ; // number of sections in Phi + envelopC[3] = envelopD[3] = envelopB[3] = envelopA[3] ; // 2 z coordinates + + Float_t dist = geom->GetEnvelop(0) + geom->GetAlFrontThickness() + geom->GetGap2Active() ; + envelopB[4] = geom->ZFromEtaR(dist, + geom->GetArm1EtaMin()); // z co-ordinate 1 + envelopB[5] = geom->GetEnvelop(0) ; // rmin at z1 + envelopB[6] = envelopB[5] + geom->GetAlFrontThickness();// rmax at z1 + envelopB[7] = geom->ZFromEtaR(dist, + geom->GetArm1EtaMax()); // z co-ordinate 2 + envelopB[8] = envelopB[5] ; // radii are the same. + envelopB[9] = envelopB[6] ; // radii are the same. + + // Define active volumes completely + + gMC->Gsvolu("XALU", "PGON", idtmed[1602], envelopB, 10); // PGON filled with Al + + gMC->Gspos("XALU", 1, "XEN1", 0.0, 0.0, 0.0 , idrotm, "ONLY") ; // Position Aluminium Layer in XEN1 - // Position ENV1 container in EMCA - gMC->Gspos("XEN1", 1, "EMCA", 0.0, 0.0, 0.0, idrotm, "ONLY") ; + gMC->Gsvolu("XPST", "PGON", idtmed[1601], dum, 0); // PGON filled with Scintillator (shape to be defined by GSPOSP) - // Position ARM1 into ENV1 - gMC->Gspos("XAR1", 1, "XEN1", 0.0, 0.0, 0.0, idrotm, "ONLY") ; + gMC->Gsvolu("XPBX", "PGON", idtmed[1600], dum, 0); // PGON filled with Lead (shape to be defined by GSPOSP) + + //gMC->Gsvolu("XCUX", "PGON", idtmed[1603], dum, 0); // PGON filled with Copper (shape to be defined by GSPOSP) - // Position ENV2 container in ALIC - gMC->Gspos("XEN2", 1, "EMCA", 0.0, 0.0, 0.0, idrotm, "ONLY") ; + gMC->Gsdvn("XPHI", "XPST", geom->GetNPhi(), 2); // Divide eta section of scintillators into phi segments. + + // Position alternatively scintillator and Lead Layers in XUi. - // Position ARM2 into ENV2 - gMC->Gspos("XAR2", 1, "XEN2", 0.0, 0.0, 0.0, idrotm, "ONLY") ; - + envelopD[6] = envelopB[6] + geom->GetGap2Active() ;// gap between Al layer and XU0 + + for (int i = 0; i < nLayers; i++ ){ + label = "XU" ; + label += i ; // we will place one layer in each mini envelope) + + Float_t scthick ; // scintillator thickness + scthick = geom->GetECScintThick() ; + + envelopC[5] = envelopD[6] ; //rmin + envelopC[6] = envelopC[5] + scthick ; //rmax + envelopC[8] = envelopC[5] ; //rmin + envelopC[9] = envelopC[6] ; //rmax + + if(gDebug == 2 ) + printf("CreateGeometry: volume = %s, name = XPST thickness = %f deb = %f/%f fin = %f/%f", label.Data(), scthick, envelopC[5], envelopC[8], envelopC[6], envelopC[9]) ; + + for (int j =0; j < (geom->GetNEta()) ; j++){ + etamin = geom->GetArm1EtaMin()+ + (j*geom->GetDeltaEta()); + etamax = geom->GetArm1EtaMin()+ + ((j+1)*geom->GetDeltaEta()); + envelopC[4] = geom->ZFromEtaR(envelopC[5],etamin); //z begin + envelopC[7] = geom->ZFromEtaR(envelopC[5],etamax);// z end + + gMC->Gsposp("XPST",1+j+i*(geom->GetNEta()), label.Data(), + 0.0, 0.0, 0.0 , idrotm, "ONLY", envelopC, 10); // Position and define layer + } // end for j + + Float_t radthick ; // radiator thickness + TString radname ; // radiator name + radthick = geom->GetECPbRadThick(); + radname = "XPBX" ; + + if ( i < nLayers -1 ) { // except for the last XU which contains only one scintillator layer + + envelopD[5] = envelopC[6] ; //rmin + envelopD[8] = envelopD[5] ; //rmin + envelopD[6] = envelopD[5] + radthick ; // rmax + envelopD[9] = envelopD[6] ; //rmax + + if(gDebug == 2 ) + printf("CreateGeometry: volume = %s, name = %s thickness = %f deb = %f/%f fin = %f/%f", label.Data(), radname.Data(), radthick, envelopD[5], envelopD[8], envelopD[6], envelopD[9]) ; + + for (int j =0; j < (geom->GetNEta()) ; j++){ + etamin = geom->GetArm1EtaMin()+ + (j*geom->GetDeltaEta()); + etamax = geom->GetArm1EtaMin()+ + ((j+1)*geom->GetDeltaEta()); + envelopD[4] = geom->ZFromEtaR(envelopD[5],etamin);//z begin + envelopD[7] = geom->ZFromEtaR(envelopD[5],etamax);// z end + + // Position and Define Layer + + gMC->Gsposp(radname.Data(),1+j+i*(geom->GetNEta()), label.Data(), + 0.0, 0.0, 0.0 , idrotm, "ONLY", envelopD, 10); + } // end for j + } // if not last layer + } // for i } -//____________________________________________________________________________ +//______________________________________________________________________ void AliEMCALv0::Init(void) { - // Just prints an information message - - Int_t i; - - printf("\n"); - for(i=0;i<35;i++) printf("*"); - printf(" EMCAL_INIT "); - for(i=0;i<35;i++) printf("*"); - printf("\n"); - - // Here the EMCAL initialisation code (if any!) - - if (fGeom!=0) - cout << "AliEMCAL" << Version() << " : EMCAL geometry intialized for " << fGeom->GetName() << endl ; - else - cout << "AliEMCAL" << Version() << " : EMCAL geometry initialization failed !" << endl ; - - for(i=0;i<80;i++) printf("*"); - printf("\n"); + // Just prints an information message + if(fDebug) { + TString message("\n") ; + message += "*****************************************\n" ; + + // Here the EMCAL initialisation code (if any!) + + AliEMCALGeometry * geom = GetGeometry() ; + + if (geom!=0) { + message += "AliEMCAL " ; + message += Version() ; + message += "EMCAL geometry initialized for " ; + message += geom->GetName() ; + } + else { + message += "AliEMCAL " ; + message += Version() ; + message += "EMCAL geometry initialization failed !" ; + } + message += "\n*****************************************" ; + printf(message.Data() ) ; + } } -