X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=PHOS%2FAliPHOSv0.cxx;h=c59d7fe67fe8cf193d852d659e2c023a3e3fb11e;hb=4d3bb36be07145d6626f972636f86185230974f4;hp=d544906db6ce0b05c6ffbd21023fe72e37337bee;hpb=88714635380b3cd769507e2f5b0583b7214b1e96;p=u%2Fmrichter%2FAliRoot.git diff --git a/PHOS/AliPHOSv0.cxx b/PHOS/AliPHOSv0.cxx index d544906db6c..c59d7fe67fe 100644 --- a/PHOS/AliPHOSv0.cxx +++ b/PHOS/AliPHOSv0.cxx @@ -12,21 +12,27 @@ * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ - /* $Id$ */ + //_________________________________________________________________________ // Implementation version v0 of PHOS Manager class -// Layout EMC + PPSD has name GPS2 +// 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 // -//*-- Author: Yves Schutz (SUBATECH) +//*-- Author: Yves Schutz (SUBATECH) & Dmitri Peressounko (RRC KI & SUBATECH) // --- ROOT system --- #include "TBRIK.h" +#include "TTRD1.h" #include "TNode.h" #include "TRandom.h" +#include "TGeometry.h" +#include "TFolder.h" +#include "TROOT.h" +#include "TTree.h" // --- Standard library --- @@ -39,185 +45,25 @@ // --- AliRoot header files --- #include "AliPHOSv0.h" -#include "AliPHOSHit.h" -#include "AliPHOSDigit.h" -#include "AliPHOSReconstructioner.h" #include "AliRun.h" #include "AliConst.h" +#include "AliMC.h" +#include "AliPHOSGeometry.h" +#include "AliPHOSGetter.h" ClassImp(AliPHOSv0) -//____________________________________________________________________________ -AliPHOSv0::AliPHOSv0() -{ - // ctor - fNTmpHits = 0 ; - fTmpHits = 0 ; -} - //____________________________________________________________________________ AliPHOSv0::AliPHOSv0(const char *name, const char *title): AliPHOS(name,title) { // ctor : title is used to identify the layout - // GPS2 = 5 modules (EMC + PPSD) - // We use 2 arrays of hits : - // - // - fHits (the "normal" one), which retains the hits associated with - // the current primary particle being tracked - // (this array is reset after each primary has been tracked). - // - // - fTmpHits, which retains all the hits of the current event. It - // is used for the digitization part. - - fPinElectronicNoise = 0.010 ; - fDigitThreshold = 1. ; // 1 GeV - - // We do not want to save in TreeH the raw hits - // fHits = new TClonesArray("AliPHOSHit",100) ; - // gAlice->AddHitList(fHits) ; - - // But save the cumulated hits instead (need to create the branch myself) - // It is put in the Digit Tree because the TreeH is filled after each primary - // and the TreeD at the end of the event (branch is set in FinishEvent() ). - - fTmpHits= new TClonesArray("AliPHOSHit",1000) ; - - fNTmpHits = fNhits = 0 ; - - fDigits = new TClonesArray("AliPHOSDigit",1000) ; - - - fIshunt = 1 ; // All hits are associated with primary particles - - // gets an instance of the geometry parameters class - - fGeom = AliPHOSGeometry::GetInstance(title, "") ; - - if (fGeom->IsInitialized() ) - cout << "AliPHOSv0 : PHOS geometry intialized for " << fGeom->GetName() << endl ; - else - cout << "AliPHOSv0 : PHOS geometry initialization failed !" << endl ; -} - -//____________________________________________________________________________ -AliPHOSv0::AliPHOSv0(AliPHOSReconstructioner * Reconstructioner, const char *name, const char *title): - AliPHOS(name,title) -{ - // ctor : title is used to identify the layout - // GPS2 = 5 modules (EMC + PPSD) - // We use 2 arrays of hits : - // - // - fHits (the "normal" one), which retains the hits associated with - // the current primary particle being tracked - // (this array is reset after each primary has been tracked). - // - // - fTmpHits, which retains all the hits of the current event. It - // is used for the digitization part. - - fPinElectronicNoise = 0.010 ; - - // We do not want to save in TreeH the raw hits - //fHits = new TClonesArray("AliPHOSHit",100) ; - - fDigits = new TClonesArray("AliPHOSDigit",1000) ; - fTmpHits= new TClonesArray("AliPHOSHit",1000) ; - - fNTmpHits = fNhits = 0 ; - - fIshunt = 1 ; // All hits are associated with primary particles - - // gets an instance of the geometry parameters class - fGeom = AliPHOSGeometry::GetInstance(title, "") ; - - if (fGeom->IsInitialized() ) - cout << "AliPHOSv0 : PHOS geometry intialized for " << fGeom->GetName() << endl ; - else - cout << "AliPHOSv0 : PHOS geometry initialization failed !" << endl ; - - // Defining the PHOS Reconstructioner - fReconstructioner = Reconstructioner ; -} - -//____________________________________________________________________________ -AliPHOSv0::~AliPHOSv0() -{ - // dtor - - if ( fTmpHits) { - fTmpHits->Delete() ; - delete fTmpHits ; - fTmpHits = 0 ; - } - - if ( fEmcRecPoints ) { - fEmcRecPoints->Delete() ; - delete fEmcRecPoints ; - fEmcRecPoints = 0 ; - } - - if ( fPpsdRecPoints ) { - fPpsdRecPoints->Delete() ; - delete fPpsdRecPoints ; - fPpsdRecPoints = 0 ; - } + // create the getter + AliPHOSGetter::GetInstance(gDirectory->GetName(), 0); - if ( fTrackSegments ) { - fTrackSegments->Delete() ; - delete fTrackSegments ; - fTrackSegments = 0 ; - } - -} - -//____________________________________________________________________________ -void AliPHOSv0::AddHit(Int_t primary, Int_t Id, Float_t * hits) -{ - // Add a hit to the hit list. - // A PHOS hit is the sum of all hits in a single crystal - // or in a single PPSD gas cell - - Int_t hitCounter ; - TClonesArray <mphits = *fTmpHits ; - AliPHOSHit *newHit ; - AliPHOSHit *curHit ; - // AliPHOSHit *curHit2 ; - Bool_t deja = kFALSE ; - - // In any case, fills the fTmpHit TClonesArray (with "accumulated hits") - - newHit = new AliPHOSHit(primary, Id, hits) ; - - // We do not want to save in TreeH the raw hits - // TClonesArray &lhits = *fHits; - - for ( hitCounter = 0 ; hitCounter < fNTmpHits && !deja ; hitCounter++ ) { - curHit = (AliPHOSHit*) ltmphits[hitCounter] ; - if( *curHit == *newHit ) { - *curHit = *curHit + *newHit ; - deja = kTRUE ; - } - } - - if ( !deja ) { - new(ltmphits[fNTmpHits]) AliPHOSHit(*newHit) ; - fNTmpHits++ ; - } - - // We do not want to save in TreeH the raw hits - // new(lhits[fNhits]) AliPHOSHit(*newHit) ; - // fNhits++ ; - - // Please note that the fTmpHits array must survive up to the - // end of the events, so it does not appear e.g. in ResetHits() ( - // which is called at the end of each primary). - - delete newHit; - } - //____________________________________________________________________________ void AliPHOSv0::BuildGeometry() { @@ -251,378 +97,202 @@ void AliPHOSv0::BuildGeometry() */ //END_HTML - - this->BuildGeometryforPHOS() ; - if ( ( strcmp(fGeom->GetName(), "GPS2" ) == 0 ) ) - this->BuildGeometryforPPSD() ; - else - cout << "AliPHOSv0::BuildGeometry : no charged particle identification system installed" << endl; - + + this->BuildGeometryforEMC() ; + this->BuildGeometryforCPV() ; + } //____________________________________________________________________________ -void AliPHOSv0:: BuildGeometryforPHOS(void) +void AliPHOSv0:: BuildGeometryforEMC(void) { - // Build the PHOS-EMC geometry for the ROOT display - + // Build the PHOS-EMC geometry for the ROOT display + const Int_t kColorPHOS = kRed ; const Int_t kColorXTAL = kBlue ; - + Double_t const kRADDEG = 180.0 / kPI ; - - new TBRIK( "OuterBox", "PHOS box", "void", fGeom->GetOuterBoxSize(0)/2, - fGeom->GetOuterBoxSize(1)/2, - fGeom->GetOuterBoxSize(2)/2 ); - - // Textolit Wall box, position inside PHOS - new TBRIK( "TextolitBox", "PHOS Textolit box ", "void", fGeom->GetTextolitBoxSize(0)/2, - fGeom->GetTextolitBoxSize(1)/2, - fGeom->GetTextolitBoxSize(2)/2); - - // Polystyrene Foam Plate - - new TBRIK( "UpperFoamPlate", "PHOS Upper foam plate", "void", fGeom->GetTextolitBoxSize(0)/2, - fGeom->GetSecondUpperPlateThickness()/2, - fGeom->GetTextolitBoxSize(2)/2 ) ; - - // Air Filled Box - - new TBRIK( "AirFilledBox", "PHOS air filled box", "void", fGeom->GetAirFilledBoxSize(0)/2, - fGeom->GetAirFilledBoxSize(1)/2, - fGeom->GetAirFilledBoxSize(2)/2 ); + AliPHOSGeometry * geom = GetGeometry() ; + AliPHOSEMCAGeometry * emcg = geom->GetEMCAGeometry() ; + Float_t * boxparams = emcg->GetEMCParams() ; + new TTRD1("OuterBox", "PHOS box", "void",boxparams[0],boxparams[1],boxparams[2], boxparams[3] ); + + // Crystals Box - - Float_t xtlX = fGeom->GetCrystalSize(0) ; - Float_t xtlY = fGeom->GetCrystalSize(1) ; - Float_t xtlZ = fGeom->GetCrystalSize(2) ; - - Float_t xl = fGeom->GetNPhi() * ( xtlX + 2 * fGeom->GetGapBetweenCrystals() ) / 2.0 + fGeom->GetModuleBoxThickness() ; - Float_t yl = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() + fGeom->GetCrystalHolderThickness() ) / 2.0 - + fGeom->GetModuleBoxThickness() / 2.0 ; - Float_t zl = fGeom->GetNZ() * ( xtlZ + 2 * fGeom->GetGapBetweenCrystals() ) / 2.0 + fGeom->GetModuleBoxThickness() ; - new TBRIK( "CrystalsBox", "PHOS crystals box", "void", xl, yl, zl ) ; - -// position PHOS into ALICE - - Float_t r = fGeom->GetIPtoOuterCoverDistance() + fGeom->GetOuterBoxSize(1) / 2.0 ; + Float_t * cribox = emcg->GetInnerThermoHalfSize() ; + new TBRIK( "CrystalsBox", "PHOS crystals box", "void", cribox[0], cribox[2], cribox[1] ) ; + + // position PHOS into ALICE + + Float_t r = geom->GetIPtoOuterCoverDistance() + boxparams[3] ; Int_t number = 988 ; - Float_t pphi = TMath::ATan( fGeom->GetOuterBoxSize(0) / ( 2.0 * fGeom->GetIPtoOuterCoverDistance() ) ) ; - pphi *= kRADDEG ; TNode * top = gAlice->GetGeometry()->GetNode("alice") ; - + char * nodename = new char[20] ; char * rotname = new char[20] ; - for( Int_t i = 1; i <= fGeom->GetNModules(); i++ ) { - Float_t angle = pphi * 2 * ( i - fGeom->GetNModules() / 2.0 - 0.5 ) ; - sprintf(rotname, "%s%d", "rot", number++) ; - new TRotMatrix(rotname, rotname, 90, angle, 90, 90 + angle, 0, 0); - top->cd(); - sprintf(nodename,"%s%d", "Module", i) ; - Float_t x = r * TMath::Sin( angle / kRADDEG ) ; - Float_t y = -r * TMath::Cos( angle / kRADDEG ) ; - TNode * outerboxnode = new TNode(nodename, nodename, "OuterBox", x, y, 0, rotname ) ; - outerboxnode->SetLineColor(kColorPHOS) ; - fNodes->Add(outerboxnode) ; - outerboxnode->cd() ; - // now inside the outer box the textolit box - y = ( fGeom->GetOuterBoxThickness(1) - fGeom->GetUpperPlateThickness() ) / 2. ; - sprintf(nodename,"%s%d", "TexBox", i) ; - TNode * textolitboxnode = new TNode(nodename, nodename, "TextolitBox", 0, y, 0) ; - textolitboxnode->SetLineColor(kColorPHOS) ; - fNodes->Add(textolitboxnode) ; - // upper foam plate inside outre box - outerboxnode->cd() ; - sprintf(nodename, "%s%d", "UFPlate", i) ; - y = ( fGeom->GetTextolitBoxSize(1) - fGeom->GetSecondUpperPlateThickness() ) / 2.0 ; - TNode * upperfoamplatenode = new TNode(nodename, nodename, "UpperFoamPlate", 0, y, 0) ; - upperfoamplatenode->SetLineColor(kColorPHOS) ; - fNodes->Add(upperfoamplatenode) ; - // air filled box inside textolit box (not drawn) - textolitboxnode->cd(); - y = ( fGeom->GetTextolitBoxSize(1) - fGeom->GetAirFilledBoxSize(1) ) / 2.0 - fGeom->GetSecondUpperPlateThickness() ; - sprintf(nodename, "%s%d", "AFBox", i) ; - TNode * airfilledboxnode = new TNode(nodename, nodename, "AirFilledBox", 0, y, 0) ; - fNodes->Add(airfilledboxnode) ; - // crystals box inside air filled box - airfilledboxnode->cd() ; - y = fGeom->GetAirFilledBoxSize(1) / 2.0 - yl - - ( fGeom->GetIPtoCrystalSurface() - fGeom->GetIPtoOuterCoverDistance() - fGeom->GetModuleBoxThickness() - - fGeom->GetUpperPlateThickness() - fGeom->GetSecondUpperPlateThickness() ) ; - sprintf(nodename, "%s%d", "XTBox", i) ; - TNode * crystalsboxnode = new TNode(nodename, nodename, "CrystalsBox", 0, y, 0) ; - crystalsboxnode->SetLineColor(kColorXTAL) ; - fNodes->Add(crystalsboxnode) ; + new TRotMatrix("cribox", "cribox", 90, 0, 90, 90, 0, 0); + + for( Int_t i = 1; i <= geom->GetNModules(); i++ ) { + + Float_t angle = geom->GetPHOSAngle(i) ; + sprintf(rotname, "%s%d", "rot", number++) ; + new TRotMatrix(rotname, rotname, 90, angle, 0, 0, 90, 270 + angle); + + top->cd(); + sprintf(nodename,"%s%d", "Module", i) ; + Float_t x = r * TMath::Sin( angle / kRADDEG ) ; + Float_t y = -r * TMath::Cos( angle / kRADDEG ) ; + TNode * outerboxnode = new TNode(nodename, nodename, "OuterBox", x, y, 0, rotname ) ; + outerboxnode->SetLineColor(kColorPHOS) ; + fNodes->Add(outerboxnode) ; + outerboxnode->cd() ; + + Float_t z = -boxparams[3] - geom->GetIPtoOuterCoverDistance() + + cribox[1] + geom->GetIPtoCrystalSurface() ; + TNode * crystalsboxnode = new TNode(nodename, nodename, "CrystalsBox", 0, 0, z) ; + crystalsboxnode->SetLineColor(kColorXTAL) ; + fNodes->Add(crystalsboxnode) ; } + + delete[] rotname ; + delete[] nodename ; } + //____________________________________________________________________________ -void AliPHOSv0:: BuildGeometryforPPSD(void) +void AliPHOSv0:: BuildGeometryforCPV(void) { - // Build the PHOS-PPSD geometry for the ROOT display - //BEGIN_HTML + // Build the PHOS-CPV geometry for the ROOT display + // Author: Yuri Kharlov 11 September 2000 + // + //BEGIN_HTML /*
-
-
CPV perspective view | +CPV front view | +
![]() |
+ ![]() |
+
- */ - //END_HTML +
CPV perspective view | +CPV front view | +
![]() |
+ ![]() |
+
One CPV module, perspective view | +One CPV module, front view (extended in vertical direction) | +
![]() |
+ ![]() |
+
+ */ + //END_HTML + + Float_t par[5], x0,y0,z0 ; + Int_t i,j,copy; - gMC->Gsvolu("LPPS", "BOX ", idtmed[709], lpppsd, 3) ; - - y0 = y0 - fGeom->GetPCThickness() / 2. - fGeom->GetCompositeThickness() / 2. ; + // Get pointer to the array containing media indexes + Int_t *idtmed = fIdtmed->GetArray() - 699 ; - gMC->Gspos("LPPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ; + AliPHOSGeometry * geom = GetGeometry() ; - // Position the fNumberOfModulesPhi x fNumberOfModulesZ modules (mppsd) inside PPSD to cover a PHOS module - // the top and bottom one's (which are assumed identical) : + // --- Dummy box containing two rails on which PHOS support moves + // --- Put these rails to the bottom of the L3 magnet - Float_t yt = ( fGeom->GetPPSDBoxSize(1) - fGeom->GetMicromegas1Thickness() ) / 2. ; - Float_t yb = - ( fGeom->GetPPSDBoxSize(1) - fGeom->GetMicromegas2Thickness() ) / 2. ; + par[0] = geom->GetRailRoadSize(0) / 2.0 ; + par[1] = geom->GetRailRoadSize(1) / 2.0 ; + par[2] = geom->GetRailRoadSize(2) / 2.0 ; + gMC->Gsvolu("PRRD", "BOX ", idtmed[798], par, 3) ; - Int_t copyNumbertop = 0 ; - Int_t copyNumberbot = fGeom->GetNumberOfModulesPhi() * fGeom->GetNumberOfModulesZ() ; + y0 = -(geom->GetRailsDistanceFromIP() - geom->GetRailRoadSize(1) / 2.0) ; + gMC->Gspos("PRRD", 1, "ALIC", 0.0, y0, 0.0, 0, "ONLY") ; - Float_t x = ( fGeom->GetPPSDBoxSize(0) - fGeom->GetPPSDModuleSize(0) ) / 2. ; + // --- Dummy box containing one rail - for ( Int_t iphi = 1; iphi <= fGeom->GetNumberOfModulesPhi(); iphi++ ) { // the number of micromegas modules in phi per PHOS module - Float_t z = ( fGeom->GetPPSDBoxSize(2) - fGeom->GetPPSDModuleSize(2) ) / 2. ; + par[0] = geom->GetRailOuterSize(0) / 2.0 ; + par[1] = geom->GetRailOuterSize(1) / 2.0 ; + par[2] = geom->GetRailOuterSize(2) / 2.0 ; + gMC->Gsvolu("PRAI", "BOX ", idtmed[798], par, 3) ; - for ( Int_t iz = 1; iz <= fGeom->GetNumberOfModulesZ(); iz++ ) { // the number of micromegas modules in z per PHOS module - gMC->Gspos("MPPS", ++copyNumbertop, "PPSD", x, yt, z, 0, "ONLY") ; - gMC->Gspos("MPPS", ++copyNumberbot, "PPSD", x, yb, z, 0, "ONLY") ; - z = z - fGeom->GetPPSDModuleSize(2) ; - } // end of Z module loop - x = x - fGeom->GetPPSDModuleSize(0) ; - } // end of phi module loop + for (i=0; i<2; i++) { + x0 = (2*i-1) * geom->GetDistanceBetwRails() / 2.0 ; + gMC->Gspos("PRAI", i, "PRRD", x0, 0.0, 0.0, 0, "ONLY") ; + } - // The Lead converter between two air gaps - // 1. Upper air gap + // --- Upper and bottom steel parts of the rail - Float_t uappsd[3] ; - uappsd[0] = fGeom->GetPPSDBoxSize(0) / 2.0 ; - uappsd[1] = fGeom->GetMicro1ToLeadGap() / 2.0 ; - uappsd[2] = fGeom->GetPPSDBoxSize(2) / 2.0 ; + par[0] = geom->GetRailPart1(0) / 2.0 ; + par[1] = geom->GetRailPart1(1) / 2.0 ; + par[2] = geom->GetRailPart1(2) / 2.0 ; + gMC->Gsvolu("PRP1", "BOX ", idtmed[716], par, 3) ; - gMC->Gsvolu("UAPPSD", "BOX ", idtmed[798], uappsd, 3) ; + y0 = - (geom->GetRailOuterSize(1) - geom->GetRailPart1(1)) / 2.0 ; + gMC->Gspos("PRP1", 1, "PRAI", 0.0, y0, 0.0, 0, "ONLY") ; + y0 = (geom->GetRailOuterSize(1) - geom->GetRailPart1(1)) / 2.0 - geom->GetRailPart3(1); + gMC->Gspos("PRP1", 2, "PRAI", 0.0, y0, 0.0, 0, "ONLY") ; - y0 = ( fGeom->GetPPSDBoxSize(1) - 2 * fGeom->GetMicromegas1Thickness() - fGeom->GetMicro1ToLeadGap() ) / 2. ; + // --- The middle vertical steel parts of the rail - gMC->Gspos("UAPPSD", 1, "PPSD", 0.0, y0, 0.0, 0, "ONLY") ; + par[0] = geom->GetRailPart2(0) / 2.0 ; + par[1] = geom->GetRailPart2(1) / 2.0 ; + par[2] = geom->GetRailPart2(2) / 2.0 ; + gMC->Gsvolu("PRP2", "BOX ", idtmed[716], par, 3) ; - // 2. Lead converter - - Float_t lcppsd[3] ; - lcppsd[0] = fGeom->GetPPSDBoxSize(0) / 2.0 ; - lcppsd[1] = fGeom->GetLeadConverterThickness() / 2.0 ; - lcppsd[2] = fGeom->GetPPSDBoxSize(2) / 2.0 ; - - gMC->Gsvolu("LCPPSD", "BOX ", idtmed[712], lcppsd, 3) ; - - y0 = y0 - fGeom->GetMicro1ToLeadGap() / 2. - fGeom->GetLeadConverterThickness() / 2. ; + y0 = - geom->GetRailPart3(1) / 2.0 ; + gMC->Gspos("PRP2", 1, "PRAI", 0.0, y0, 0.0, 0, "ONLY") ; - gMC->Gspos("LCPPSD", 1, "PPSD", 0.0, y0, 0.0, 0, "ONLY") ; + // --- The most upper steel parts of the rail - // 3. Lower air gap + par[0] = geom->GetRailPart3(0) / 2.0 ; + par[1] = geom->GetRailPart3(1) / 2.0 ; + par[2] = geom->GetRailPart3(2) / 2.0 ; + gMC->Gsvolu("PRP3", "BOX ", idtmed[716], par, 3) ; - Float_t lappsd[3] ; - lappsd[0] = fGeom->GetPPSDBoxSize(0) / 2.0 ; - lappsd[1] = fGeom->GetLeadToMicro2Gap() / 2.0 ; - lappsd[2] = fGeom->GetPPSDBoxSize(2) / 2.0 ; + y0 = (geom->GetRailOuterSize(1) - geom->GetRailPart3(1)) / 2.0 ; + gMC->Gspos("PRP3", 1, "PRAI", 0.0, y0, 0.0, 0, "ONLY") ; - gMC->Gsvolu("LAPPSD", "BOX ", idtmed[798], lappsd, 3) ; - - y0 = y0 - fGeom->GetLeadConverterThickness() / 2. - fGeom->GetLeadToMicro2Gap() / 2. ; - - gMC->Gspos("LAPPSD", 1, "PPSD", 0.0, y0, 0.0, 0, "ONLY") ; - -} + // --- The wall of the cradle + // --- The wall is empty: steel thin walls and air inside -//___________________________________________________________________________ -Int_t AliPHOSv0::Digitize(Float_t Energy) -{ - // Applies the energy calibration - - Float_t fB = 100000000. ; - Float_t fA = 0. ; - Int_t chan = Int_t(fA + Energy*fB ) ; - return chan ; -} + par[1] = TMath::Sqrt(TMath::Power((geom->GetIPtoCPVDistance() + geom->GetOuterBoxSize(3)),2) + + TMath::Power((geom->GetOuterBoxSize(1)/2),2))+10. ; + par[0] = par[1] - geom->GetCradleWall(1) ; + par[2] = geom->GetCradleWall(2) / 2.0 ; + par[3] = geom->GetCradleWall(3) ; + par[4] = geom->GetCradleWall(4) ; + gMC->Gsvolu("PCRA", "TUBS", idtmed[716], par, 5) ; -//___________________________________________________________________________ -void AliPHOSv0::FinishEvent() -{ - // Makes the digits from the sum of summed hit in a single crystal or PPSD gas cell - // Adds to the energy the electronic noise - // Keeps digits with energy above fDigitThreshold + par[0] -= geom->GetCradleWallThickness() ; + par[1] -= geom->GetCradleWallThickness() ; + par[2] -= geom->GetCradleWallThickness() ; + gMC->Gsvolu("PCRE", "TUBS", idtmed[798], par, 5) ; + gMC->Gspos ("PCRE", 1, "PCRA", 0.0, 0.0, 0.0, 0, "ONLY") ; - // Save the cumulated hits instead of raw hits (need to create the branch myself) - // It is put in the Digit Tree because the TreeH is filled after each primary - // and the TreeD at the end of the event. - - - Int_t i ; - Int_t relid[4]; - Int_t j ; - TClonesArray &lDigits = *fDigits ; - AliPHOSHit * hit ; - AliPHOSDigit * newdigit ; - AliPHOSDigit * curdigit ; - Bool_t deja = kFALSE ; - - for ( i = 0 ; i < fNTmpHits ; i++ ) { - hit = (AliPHOSHit*)fTmpHits->At(i) ; - newdigit = new AliPHOSDigit( hit->GetPrimary(), hit->GetId(), Digitize( hit->GetEnergy() ) ) ; - deja =kFALSE ; - for ( j = 0 ; j < fNdigits ; j++) { - curdigit = (AliPHOSDigit*) lDigits[j] ; - if ( *curdigit == *newdigit) { - *curdigit = *curdigit + *newdigit ; - deja = kTRUE ; - } - } - if ( !deja ) { - new(lDigits[fNdigits]) AliPHOSDigit(* newdigit) ; - fNdigits++ ; - } - - delete newdigit ; - } - - // Noise induced by the PIN diode of the PbWO crystals - - Float_t energyandnoise ; - for ( i = 0 ; i < fNdigits ; i++ ) { - newdigit = (AliPHOSDigit * ) fDigits->At(i) ; - fGeom->AbsToRelNumbering(newdigit->GetId(), relid) ; - - if (relid[1]==0){ // Digits belong to EMC (PbW0_4 crystals) - energyandnoise = newdigit->GetAmp() + Digitize(gRandom->Gaus(0., fPinElectronicNoise)) ; - - if (energyandnoise < 0 ) - energyandnoise = 0 ; + for (i=0; i<2; i++) { + z0 = (2*i-1) * (geom->GetOuterBoxSize(2) + geom->GetCradleWall(2) )/ 2.0 ; + gMC->Gspos("PCRA", i, "ALIC", 0.0, 0.0, z0, 0, "ONLY") ; + } - if ( newdigit->GetAmp() < fDigitThreshold ) // if threshold not surpassed, remove digit from list - fDigits->RemoveAt(i) ; + // --- The "wheels" of the cradle + + par[0] = geom->GetCradleWheel(0) / 2; + par[1] = geom->GetCradleWheel(1) / 2; + par[2] = geom->GetCradleWheel(2) / 2; + gMC->Gsvolu("PWHE", "BOX ", idtmed[716], par, 3) ; + + y0 = -(geom->GetRailsDistanceFromIP() - geom->GetRailRoadSize(1) - + geom->GetCradleWheel(1)/2) ; + for (i=0; i<2; i++) { + z0 = (2*i-1) * ((geom->GetOuterBoxSize(2) + geom->GetCradleWheel(2))/ 2.0 + + geom->GetCradleWall(2)); + for (j=0; j<2; j++) { + copy = 2*i + j; + x0 = (2*j-1) * geom->GetDistanceBetwRails() / 2.0 ; + gMC->Gspos("PWHE", copy, "ALIC", x0, y0, z0, 0, "ONLY") ; } } - - fDigits->Compress() ; - fNdigits = fDigits->GetEntries() ; - for (i = 0 ; i < fNdigits ; i++) { - newdigit = (AliPHOSDigit *) fDigits->At(i) ; - newdigit->SetIndexInList(i) ; - } - } //____________________________________________________________________________ -void AliPHOSv0::Init(void) +Float_t AliPHOSv0::ZMin(void) const { - // Just prints an information message - - Int_t i; - - printf("\n"); - for(i=0;i<35;i++) printf("*"); - printf(" PHOS_INIT "); - for(i=0;i<35;i++) printf("*"); - printf("\n"); + // Overall dimension of the PHOS (min) - // Here the PHOS initialisation code (if any!) - - for(i=0;i<80;i++) printf("*"); - printf("\n"); - -} - -//___________________________________________________________________________ -void AliPHOSv0::MakeBranch(Option_t* opt) -{ - // Create new branche in the current Root Tree in the digit Tree - - AliDetector::MakeBranch(opt) ; - - char branchname[10]; - sprintf(branchname,"%s",GetName()); - char *cdD = strstr(opt,"D"); - if (fDigits && gAlice->TreeD() && cdD) { - gAlice->TreeD()->Branch(branchname, &fDigits, fBufferSize); - } - - // Create new branche PHOSCH in the current Root Tree in the digit Tree for accumulated Hits - if ( ! (gAlice->IsLegoRun()) ) { // only when not in lego plot mode - if ( fTmpHits && gAlice->TreeD() && cdD) { - char branchname[10] ; - sprintf(branchname, "%sCH", GetName()) ; - gAlice->TreeD()->Branch(branchname, &fTmpHits, fBufferSize) ; - } - } + AliPHOSGeometry * geom = GetGeometry() ; + return -geom->GetOuterBoxSize(2)/2.; } //____________________________________________________________________________ -AliPHOSRecPoint::RecPointsList * AliPHOSv0::PpsdRecPoints(Int_t evt) +Float_t AliPHOSv0::ZMax(void) const { - // returns the pointer to the PPSD RecPoints list - // if the list is empty, get it from TreeR on the disk file - - AliPHOSRecPoint::RecPointsList * rv = 0 ; + // Overall dimension of the PHOS (max) - if ( fPpsdRecPoints ) - rv = fPpsdRecPoints ; + AliPHOSGeometry * geom = GetGeometry() ; - else { - fPpsdRecPoints = new TClonesArray("AliPHOSPpsdRecPoint", 100) ; - gAlice->GetEvent(evt) ; - TTree * fReconstruct = gAlice->TreeR() ; - fReconstruct->SetBranchAddress( "PHOSPpsdRP", &fPpsdRecPoints) ; - fReconstruct->GetEvent(0) ; - rv = fPpsdRecPoints ; - } - - fPpsdRecPoints->Expand( fPpsdRecPoints->GetEntries() ) ; - - return rv ; - + return geom->GetOuterBoxSize(2)/2.; } -//_____________________________________________________________________________ -void AliPHOSv0::Reconstruction(AliPHOSReconstructioner * Reconstructioner) -{ - // 1. Reinitializes the existing RecPoint, TrackSegment, and RecParticles Lists and - // 2. Creates TreeR with a branch for each list - // 3. Steers the reconstruction processes - // 4. Saves the 3 lists in TreeR - // 5. Write the Tree to File - - fReconstructioner = Reconstructioner ; - - char branchname[10] ; - - - - - // 1. - - // gAlice->MakeTree("R") ; - Int_t splitlevel = 0 ; +//____________________________________________________________________________ +void AliPHOSv0::Init(void) +{ + // Just prints an information message - if (fEmcRecPoints) { - fEmcRecPoints->Delete() ; - delete fEmcRecPoints ; - fEmcRecPoints = 0 ; - } - - // fEmcRecPoints= new AliPHOSRecPoint::RecPointsList("AliPHOSEmcRecPoint", 1000) ; if TClonesArray - fEmcRecPoints= new AliPHOSRecPoint::RecPointsList(100) ; + Int_t i; - if ( fEmcRecPoints && gAlice->TreeR() ) { - sprintf(branchname,"%sEmcRP",GetName()) ; + if(fDebug) { + printf("\n%s: ",ClassName()); + for(i=0;i<35;i++) printf("*"); + printf(" PHOS_INIT "); + for(i=0;i<35;i++) printf("*"); + printf("\n%s: ",ClassName()); - // gAlice->TreeR()->Branch(branchname, &fEmcRecPoints, fBufferSize); if TClonesArray - gAlice->TreeR()->Branch(branchname, "TObjArray", &fEmcRecPoints, fBufferSize, splitlevel) ; - } - - if (fPpsdRecPoints) { - fPpsdRecPoints->Delete() ; - delete fPpsdRecPoints ; - fPpsdRecPoints = 0 ; - } - - // fPpsdRecPoints = new AliPHOSRecPoint::RecPointsList("AliPHOSPpsdRecPoint", 1000) ; if TClonesArray - fPpsdRecPoints = new AliPHOSRecPoint::RecPointsList(100) ; - - if ( fPpsdRecPoints && gAlice->TreeR() ) { - sprintf(branchname,"%sPpsdRP",GetName()) ; - - // gAlice->TreeR()->Branch(branchname, &fPpsdRecPoints, fBufferSize); if TClonesArray - gAlice->TreeR()->Branch(branchname, "TObjArray", &fPpsdRecPoints, fBufferSize, splitlevel) ; - } - - if (fTrackSegments) { - fTrackSegments->Delete() ; - delete fTrackSegments ; - fTrackSegments = 0 ; - } - - fTrackSegments = new AliPHOSTrackSegment::TrackSegmentsList("AliPHOSTrackSegment", 1000) ; - if ( fTrackSegments && gAlice->TreeR() ) { - sprintf(branchname,"%sTS",GetName()) ; - gAlice->TreeR()->Branch(branchname, &fTrackSegments, fBufferSize) ; - } - - if (fRecParticles) { - fRecParticles->Delete() ; - delete fRecParticles ; - fRecParticles = 0 ; - } - fRecParticles = new AliPHOSRecParticle::RecParticlesList("AliPHOSRecParticle", 1000) ; - if ( fRecParticles && gAlice->TreeR() ) { - sprintf(branchname,"%sRP",GetName()) ; - gAlice->TreeR()->Branch(branchname, &fRecParticles, fBufferSize) ; - } - - // 3. - - fReconstructioner->Make(fDigits, fEmcRecPoints, fPpsdRecPoints, fTrackSegments, fRecParticles); - - // 4. Expand or Shrink the arrays to the proper size - - Int_t size ; - - size = fEmcRecPoints->GetEntries() ; - fEmcRecPoints->Expand(size) ; - - size = fPpsdRecPoints->GetEntries() ; - fPpsdRecPoints->Expand(size) ; - - size = fTrackSegments->GetEntries() ; - fTrackSegments->Expand(size) ; - - size = fRecParticles->GetEntries() ; - fRecParticles->Expand(size) ; - - gAlice->TreeR()->Fill() ; - cout << "filled" << endl ; - // 5. - - gAlice->TreeR()->Write() ; - cout << "writen" << endl ; - - // Deleting reconstructed objects - ResetReconstruction(); + + // Here the PHOS initialisation code (if any!) - -} + AliPHOSGeometry * geom = GetGeometry() ; -//____________________________________________________________________________ -void AliPHOSv0::ResetDigits() -{ - // May sound strange, but cumulative hits are store in digits Tree - AliDetector::ResetDigits(); - if( fTmpHits ) { - fTmpHits->Delete(); - fNTmpHits = 0 ; - } -} -//____________________________________________________________________________ -void AliPHOSv0::ResetReconstruction() -{ - // Deleting reconstructed objects - - if ( fEmcRecPoints ) fEmcRecPoints->Delete(); - if ( fPpsdRecPoints ) fPpsdRecPoints->Delete(); - if ( fTrackSegments ) fTrackSegments->Delete(); - if ( fRecParticles ) fRecParticles->Delete(); - -} -//____________________________________________________________________________ -void AliPHOSv0::StepManager(void) -{ - // Accumulates hits as long as the track stays in a single crystal or PPSD gas Cell - - Int_t relid[4] ; // (box, layer, row, column) indices - Float_t xyze[4] ; // position wrt MRS and energy deposited - TLorentzVector pos ; - Int_t copy ; - - Int_t primary = gAlice->GetPrimary( gAlice->CurrentTrack() ); - TString name = fGeom->GetName() ; - if ( name == "GPS2" ) { // the CPV is a PPSD - if( gMC->CurrentVolID(copy) == gMC->VolId("GCEL") ) // We are inside a gas cell - { - gMC->TrackPosition(pos) ; - xyze[0] = pos[0] ; - xyze[1] = pos[1] ; - xyze[2] = pos[2] ; - xyze[3] = gMC->Edep() ; - - if ( xyze[3] != 0 ) { // there is deposited energy - gMC->CurrentVolOffID(5, relid[0]) ; // get the PHOS Module number - gMC->CurrentVolOffID(3, relid[1]) ; // get the Micromegas Module number - // 1-> Geom->GetNumberOfModulesPhi() * fGeom->GetNumberOfModulesZ() upper - // > fGeom->GetNumberOfModulesPhi() * fGeom->GetNumberOfModulesZ() lower - gMC->CurrentVolOffID(1, relid[2]) ; // get the row number of the cell - gMC->CurrentVolID(relid[3]) ; // get the column number - - // get the absolute Id number - - Int_t absid ; - fGeom->RelToAbsNumbering(relid, absid) ; - - // add current hit to the hit list - AddHit(primary, absid, xyze); - - } // there is deposited energy - } // We are inside the gas of the CPV - } // GPS2 configuration - - if(gMC->CurrentVolID(copy) == gMC->VolId("PXTL") ) // We are inside a PBWO crystal - { - gMC->TrackPosition(pos) ; - xyze[0] = pos[0] ; - xyze[1] = pos[1] ; - xyze[2] = pos[2] ; - xyze[3] = gMC->Edep() ; - - if ( xyze[3] != 0 ) { - gMC->CurrentVolOffID(10, relid[0]) ; // get the PHOS module number ; - relid[1] = 0 ; // means PBW04 - gMC->CurrentVolOffID(4, relid[2]) ; // get the row number inside the module - gMC->CurrentVolOffID(3, relid[3]) ; // get the cell number inside the module - - // get the absolute Id number - - Int_t absid ; - fGeom->RelToAbsNumbering(relid, absid) ; - - // add current hit to the hit list - - AddHit(primary, absid, xyze); + if (geom!=0) + cout << "AliPHOS" << Version() << " : PHOS geometry intialized for " << geom->GetName() << endl ; + else + cout << "AliPHOS" << Version() << " : PHOS geometry initialization failed !" << endl ; - } // there is deposited energy - } // we are inside a PHOS Xtal + for(i=0;i<80;i++) printf("*"); + printf("\n"); + } } +