* provided "as is" without express or implied warranty. *
**************************************************************************/
+/* $Id$ */
+
//_________________________________________________________________________
-// Manager class for PHOS version SUBATECH
-//*-- Author : Y. Schutz SUBATECH
-//////////////////////////////////////////////////////////////////////////////
+// Implementation version v0 of PHOS Manager class
+// Layout EMC + PPSD has name GPS2
+//
+//*-- Author: Yves Schutz (SUBATECH)
+
// --- ROOT system ---
// --- Standard library ---
-#include <cstdio>
-#include <cstring>
-#include <cstdlib>
-#include <strstream>
-#include <cassert>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <strstream.h>
// --- AliRoot header files ---
//____________________________________________________________________________
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
// - fTmpHits, which retains all the hits of the current event. It
// is used for the digitization part.
- fPINElectronicNoise = 0.010 ;
+ fPinElectronicNoise = 0.010 ;
+ fDigitThreshold = 1. ; // 1 GeV
- fHits = new TClonesArray("AliPHOSHit",100) ;
- gAlice->AddHitList(fHits) ;
+ // 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",100) ;
fNTmpHits = fNhits = 0 ;
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
//
// - fTmpHits, which retains all the hits of the current event. It
// is used for the digitization part.
- fPINElectronicNoise = 0.010 ;
- fHits = new TClonesArray("AliPHOSHit",100) ;
+
+ fPinElectronicNoise = 0.010 ;
+
+ // We do not want to save in TreeH the raw hits
+ //fHits = new TClonesArray("AliPHOSHit",100) ;
+
fDigits = new TClonesArray("AliPHOSDigit",100) ;
fTmpHits= new TClonesArray("AliPHOSHit",100) ;
//____________________________________________________________________________
AliPHOSv0::~AliPHOSv0()
{
+ // dtor
+
fTmpHits->Delete() ;
delete fTmpHits ;
fTmpHits = 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( *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).
- // if (IsTreeSelected('H')) {
- // And, if we really want raw hits tree, have the fHits array filled also
- // TClonesArray &lhits = *fHits;
- // new(lhits[fNhits]) AliPHOSHit(*newHit) ;
- // fNhits++ ;
- // }
-
delete newHit;
}
//____________________________________________________________________________
void AliPHOSv0::BuildGeometry()
{
+ // Build the PHOS geometry for the ROOT display
+ //BEGIN_HTML
+ /*
+ <H2>
+ PHOS in ALICE displayed by root
+ </H2>
+ <UL>
+ <LI> All Views
+ <P>
+ <CENTER>
+ <IMG Align=BOTTOM ALT="All Views" SRC="../images/AliPHOSv0AllViews.gif">
+ </CENTER></P></LI>
+ <LI> Front View
+ <P>
+ <CENTER>
+ <IMG Align=BOTTOM ALT="Front View" SRC="../images/AliPHOSv0FrontView.gif">
+ </CENTER></P></LI>
+ <LI> 3D View 1
+ <P>
+ <CENTER>
+ <IMG Align=BOTTOM ALT="3D View 1" SRC="../images/AliPHOSv03DView1.gif">
+ </CENTER></P></LI>
+ <LI> 3D View 2
+ <P>
+ <CENTER>
+ <IMG Align=BOTTOM ALT="3D View 2" SRC="../images/AliPHOSv03DView2.gif">
+ </CENTER></P></LI>
+ </UL>
+ */
+ //END_HTML
this->BuildGeometryforPHOS() ;
if ( ( strcmp(fGeom->GetName(), "GPS2" ) == 0 ) )
//____________________________________________________________________________
void AliPHOSv0:: BuildGeometryforPHOS(void)
{
- // Build the PHOS geometry for the ROOT display
+ // Build the PHOS-EMC geometry for the ROOT display
const Int_t kColorPHOS = kRed ;
const Int_t kColorXTAL = kBlue ;
//____________________________________________________________________________
void AliPHOSv0:: BuildGeometryforPPSD(void)
{
- // Build the PPSD geometry for the ROOT display
-
+ // Build the PHOS-PPSD geometry for the ROOT display
+ //BEGIN_HTML
+ /*
+ <H2>
+ PPSD displayed by root
+ </H2>
+ <UL>
+ <LI> Zoom on PPSD: Front View
+ <P>
+ <CENTER>
+ <IMG Align=BOTTOM ALT="PPSD Front View" SRC="../images/AliPHOSv0PPSDFrontView.gif">
+ </CENTER></P></LI>
+ <LI> Zoom on PPSD: Perspective View
+ <P>
+ <CENTER>
+ <IMG Align=BOTTOM ALT="PPSD Prespective View" SRC="../images/AliPHOSv0PPSDPerspectiveView.gif">
+ </CENTER></P></LI>
+ </UL>
+ */
+ //END_HTML
Double_t const kRADDEG = 180.0 / kPI ;
const Int_t kColorPHOS = kRed ;
// inside the PPSD box:
// 1. fNumberOfModulesPhi x fNumberOfModulesZ top micromegas
x = ( fGeom->GetPPSDBoxSize(0) - fGeom->GetPPSDModuleSize(0) ) / 2. ;
- 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. ;
- TNode * micro1node ;
- for ( Int_t iz = 1; iz <= fGeom->GetNumberOfModulesZ(); iz++ ) { // the number of micromegas modules in z per PHOS module
- y = ( fGeom->GetPPSDBoxSize(1) - fGeom->GetMicromegas1Thickness() ) / 2. ;
- sprintf(nodename, "%s%d%d%d", "Mic1", i, iphi, iz) ;
- micro1node = new TNode(nodename, nodename, "PPSDModule", x, y, z) ;
- micro1node->SetLineColor(kColorPPSD) ;
- fNodes->Add(micro1node) ;
- // inside top micromegas
- micro1node->cd() ;
- // a. top lid
- y = ( fGeom->GetMicromegas1Thickness() - fGeom->GetLidThickness() ) / 2. ;
- sprintf(nodename, "%s%d%d%d", "Lid", i, iphi, iz) ;
- TNode * toplidnode = new TNode(nodename, nodename, "TopLid", 0, y, 0) ;
- toplidnode->SetLineColor(kColorPPSD) ;
- fNodes->Add(toplidnode) ;
- // b. composite panel
- y = y - fGeom->GetLidThickness() / 2. - fGeom->GetCompositeThickness() / 2. ;
- sprintf(nodename, "%s%d%d%d", "CompU", i, iphi, iz) ;
- TNode * compupnode = new TNode(nodename, nodename, "TopPanel", 0, y, 0) ;
- compupnode->SetLineColor(kColorPPSD) ;
- fNodes->Add(compupnode) ;
- // c. anode
- y = y - fGeom->GetCompositeThickness() / 2. - fGeom->GetAnodeThickness() / 2. ;
- sprintf(nodename, "%s%d%d%d", "Ano", i, iphi, iz) ;
- TNode * anodenode = new TNode(nodename, nodename, "Anode", 0, y, 0) ;
- anodenode->SetLineColor(kColorPHOS) ;
- fNodes->Add(anodenode) ;
- // d. gas
- y = y - fGeom->GetAnodeThickness() / 2. - ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() ) / 2. ;
- sprintf(nodename, "%s%d%d%d", "GGap", i, iphi, iz) ;
- TNode * ggapnode = new TNode(nodename, nodename, "GasGap", 0, y, 0) ;
- ggapnode->SetLineColor(kColorGas) ;
- fNodes->Add(ggapnode) ;
+ {
+ 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. ;
+ TNode * micro1node ;
+ for ( Int_t iz = 1; iz <= fGeom->GetNumberOfModulesZ(); iz++ ) { // the number of micromegas modules in z per PHOS module
+ y = ( fGeom->GetPPSDBoxSize(1) - fGeom->GetMicromegas1Thickness() ) / 2. ;
+ sprintf(nodename, "%s%d%d%d", "Mic1", i, iphi, iz) ;
+ micro1node = new TNode(nodename, nodename, "PPSDModule", x, y, z) ;
+ micro1node->SetLineColor(kColorPPSD) ;
+ fNodes->Add(micro1node) ;
+ // inside top micromegas
+ micro1node->cd() ;
+ // a. top lid
+ y = ( fGeom->GetMicromegas1Thickness() - fGeom->GetLidThickness() ) / 2. ;
+ sprintf(nodename, "%s%d%d%d", "Lid", i, iphi, iz) ;
+ TNode * toplidnode = new TNode(nodename, nodename, "TopLid", 0, y, 0) ;
+ toplidnode->SetLineColor(kColorPPSD) ;
+ fNodes->Add(toplidnode) ;
+ // b. composite panel
+ y = y - fGeom->GetLidThickness() / 2. - fGeom->GetCompositeThickness() / 2. ;
+ sprintf(nodename, "%s%d%d%d", "CompU", i, iphi, iz) ;
+ TNode * compupnode = new TNode(nodename, nodename, "TopPanel", 0, y, 0) ;
+ compupnode->SetLineColor(kColorPPSD) ;
+ fNodes->Add(compupnode) ;
+ // c. anode
+ y = y - fGeom->GetCompositeThickness() / 2. - fGeom->GetAnodeThickness() / 2. ;
+ sprintf(nodename, "%s%d%d%d", "Ano", i, iphi, iz) ;
+ TNode * anodenode = new TNode(nodename, nodename, "Anode", 0, y, 0) ;
+ anodenode->SetLineColor(kColorPHOS) ;
+ fNodes->Add(anodenode) ;
+ // d. gas
+ y = y - fGeom->GetAnodeThickness() / 2. - ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() ) / 2. ;
+ sprintf(nodename, "%s%d%d%d", "GGap", i, iphi, iz) ;
+ TNode * ggapnode = new TNode(nodename, nodename, "GasGap", 0, y, 0) ;
+ ggapnode->SetLineColor(kColorGas) ;
+ fNodes->Add(ggapnode) ;
// f. cathode
- y = y - ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() ) / 2. - fGeom->GetCathodeThickness() / 2. ;
- sprintf(nodename, "%s%d%d%d", "Cathode", i, iphi, iz) ;
- TNode * cathodenode = new TNode(nodename, nodename, "Cathode", 0, y, 0) ;
- cathodenode->SetLineColor(kColorPHOS) ;
- fNodes->Add(cathodenode) ;
- // g. printed circuit
- y = y - fGeom->GetCathodeThickness() / 2. - fGeom->GetPCThickness() / 2. ;
- sprintf(nodename, "%s%d%d%d", "PC", i, iphi, iz) ;
- TNode * pcnode = new TNode(nodename, nodename, "PCBoard", 0, y, 0) ;
- pcnode->SetLineColor(kColorPPSD) ;
- fNodes->Add(pcnode) ;
- // h. composite panel
- y = y - fGeom->GetPCThickness() / 2. - fGeom->GetCompositeThickness() / 2. ;
- sprintf(nodename, "%s%d%d%d", "CompDown", i, iphi, iz) ;
- TNode * compdownnode = new TNode(nodename, nodename, "BottomPanel", 0, y, 0) ;
- compdownnode->SetLineColor(kColorPPSD) ;
- fNodes->Add(compdownnode) ;
- z = z - fGeom->GetPPSDModuleSize(2) ;
+ y = y - ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() ) / 2. - fGeom->GetCathodeThickness() / 2. ;
+ sprintf(nodename, "%s%d%d%d", "Cathode", i, iphi, iz) ;
+ TNode * cathodenode = new TNode(nodename, nodename, "Cathode", 0, y, 0) ;
+ cathodenode->SetLineColor(kColorPHOS) ;
+ fNodes->Add(cathodenode) ;
+ // g. printed circuit
+ y = y - fGeom->GetCathodeThickness() / 2. - fGeom->GetPCThickness() / 2. ;
+ sprintf(nodename, "%s%d%d%d", "PC", i, iphi, iz) ;
+ TNode * pcnode = new TNode(nodename, nodename, "PCBoard", 0, y, 0) ;
+ pcnode->SetLineColor(kColorPPSD) ;
+ fNodes->Add(pcnode) ;
+ // h. composite panel
+ y = y - fGeom->GetPCThickness() / 2. - fGeom->GetCompositeThickness() / 2. ;
+ sprintf(nodename, "%s%d%d%d", "CompDown", i, iphi, iz) ;
+ TNode * compdownnode = new TNode(nodename, nodename, "BottomPanel", 0, y, 0) ;
+ compdownnode->SetLineColor(kColorPPSD) ;
+ fNodes->Add(compdownnode) ;
+ z = z - fGeom->GetPPSDModuleSize(2) ;
+ ppsdboxnode->cd() ;
+ } // end of Z module loop
+ x = x - fGeom->GetPPSDModuleSize(0) ;
ppsdboxnode->cd() ;
- } // end of Z module loop
- x = x - fGeom->GetPPSDModuleSize(0) ;
- ppsdboxnode->cd() ;
- } // end of phi module loop
+ } // end of phi module loop
+ }
// 2. air gap
ppsdboxnode->cd() ;
y = ( fGeom->GetPPSDBoxSize(1) - 2 * fGeom->GetMicromegas1Thickness() - fGeom->GetMicro1ToLeadGap() ) / 2. ;
fNodes->Add(gapdownnode) ;
// 5. fNumberOfModulesPhi x fNumberOfModulesZ bottom micromegas
x = ( fGeom->GetPPSDBoxSize(0) - fGeom->GetPPSDModuleSize(0) ) / 2. - fGeom->GetPhiDisplacement() ;
- for ( Int_t iphi = 1; iphi <= fGeom->GetNumberOfModulesPhi(); iphi++ ) {
- Float_t z = ( fGeom->GetPPSDBoxSize(2) - fGeom->GetPPSDModuleSize(2) ) / 2. - fGeom->GetZDisplacement() ;;
- TNode * micro2node ;
- for ( Int_t iz = 1; iz <= fGeom->GetNumberOfModulesZ(); iz++ ) {
- y = - ( fGeom->GetPPSDBoxSize(1) - fGeom->GetMicromegas2Thickness() ) / 2. ;
- sprintf(nodename, "%s%d%d%d", "Mic2", i, iphi, iz) ;
- micro2node = new TNode(nodename, nodename, "PPSDModule", x, y, z) ;
- micro2node->SetLineColor(kColorPPSD) ;
- fNodes->Add(micro2node) ;
- // inside bottom micromegas
- micro2node->cd() ;
+ {
+ for ( Int_t iphi = 1; iphi <= fGeom->GetNumberOfModulesPhi(); iphi++ ) {
+ Float_t z = ( fGeom->GetPPSDBoxSize(2) - fGeom->GetPPSDModuleSize(2) ) / 2. - fGeom->GetZDisplacement() ;;
+ TNode * micro2node ;
+ for ( Int_t iz = 1; iz <= fGeom->GetNumberOfModulesZ(); iz++ ) {
+ y = - ( fGeom->GetPPSDBoxSize(1) - fGeom->GetMicromegas2Thickness() ) / 2. ;
+ sprintf(nodename, "%s%d%d%d", "Mic2", i, iphi, iz) ;
+ micro2node = new TNode(nodename, nodename, "PPSDModule", x, y, z) ;
+ micro2node->SetLineColor(kColorPPSD) ;
+ fNodes->Add(micro2node) ;
+ // inside bottom micromegas
+ micro2node->cd() ;
// a. top lid
y = ( fGeom->GetMicromegas2Thickness() - fGeom->GetLidThickness() ) / 2. ;
sprintf(nodename, "%s%d", "Lidb", i) ;
} // end of Z module loop
x = x - fGeom->GetPPSDModuleSize(0) ;
ppsdboxnode->cd() ;
- } // end of phi module loop
- } // PHOS modules
- delete rotname ;
- delete nodename ;
+ } // end of phi module loop
+ }
+ } // PHOS modules
+
+ delete rotname ;
+ delete nodename ;
+
}
//____________________________________________________________________________
void AliPHOSv0::CreateGeometry()
{
+ // Create the PHOS geometry for Geant
AliPHOSv0 *phostmp = (AliPHOSv0*)gAlice->GetModule("PHOS") ;
return;
}
-
// Get pointer to the array containing media indeces
Int_t *idtmed = fIdtmed->GetArray() - 699 ;
//____________________________________________________________________________
void AliPHOSv0::CreateGeometryforPHOS()
{
- // Get pointer to the array containing media indeces
+ // Create the PHOS-EMC geometry for GEANT
+ //BEGIN_HTML
+ /*
+ <H2>
+ Geant3 geometry tree of PHOS-EMC in ALICE
+ </H2>
+ <P><CENTER>
+ <IMG Align=BOTTOM ALT="EMC geant tree" SRC="../images/EMCinAlice.gif">
+ </CENTER><P>
+ */
+ //END_HTML
+
+ // Get pointer to the array containing media indexes
Int_t *idtmed = fIdtmed->GetArray() - 699 ;
// ---
//____________________________________________________________________________
void AliPHOSv0::CreateGeometryforPPSD()
{
- // Get pointer to the array containing media indeces
+ // Create the PHOS-PPSD geometry for GEANT
+
+ //BEGIN_HTML
+ /*
+ <H2>
+ Geant3 geometry tree of PHOS-PPSD in ALICE
+ </H2>
+ <P><CENTER>
+ <IMG Align=BOTTOM ALT="PPSD geant tree" SRC="../images/PPSDinAlice.gif">
+ </CENTER><P>
+ */
+ //END_HTML
+
+ // Get pointer to the array containing media indexes
Int_t *idtmed = fIdtmed->GetArray() - 699 ;
// The box containing all ppsd's for one PHOS module filled with air
}
//___________________________________________________________________________
-Int_t AliPHOSv0::Digitize(Float_t Energy){
+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 ;
}
+
//___________________________________________________________________________
void AliPHOSv0::FinishEvent()
{
- // cout << "//_____________________________________________________" << endl ;
- // cout << "<I> AliPHOSv0::FinishEvent() -- Starting digitalization" << endl ;
+ // 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
+
+ // 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.
+ if ( fTmpHits && gAlice->TreeD() ) {
+ char branchname[10] ;
+ sprintf(branchname, "%sCH", GetName()) ;
+ gAlice->TreeD()->Branch(branchname, &fTmpHits, fBufferSize) ;
+ } else
+ cout << "AliPHOSv0::AliPHOSv0: Failed to create branch PHOSCH in TreeD " << endl ;
+
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) ;
- cout << "FinishEvent hit" << hit->GetPrimary() << " " << hit->GetId() << endl ;
newdigit = new AliPHOSDigit( hit->GetPrimary(), hit->GetId(), Digitize( hit->GetEnergy() ) ) ;
+ deja =kFALSE ;
for ( j = 0 ; j < fNdigits ; j++) {
- curdigit = (AliPHOSDigit*) lDigits[j] ;
+ curdigit = (AliPHOSDigit*) lDigits[j] ;
if ( *curdigit == *newdigit) {
- *curdigit = *newdigit + *curdigit ;
+ *curdigit = *curdigit + *newdigit ;
deja = kTRUE ;
}
}
delete newdigit ;
}
- for ( i = 0 ; i < fNdigits ; i++ ) {
- newdigit = (AliPHOSDigit*)lDigits[i] ;
- Int_t * prim = newdigit->GetPrimary() ;
- for ( j = 0 ; j < newdigit->GetNprimary() ; j++)
- cout << "FinishEvent digit " << prim[j] << " " << newdigit->GetId() << endl ;
- }
+ // Noise induced by the PIN diode of the PbWO crystals
Float_t energyandnoise ;
for ( i = 0 ; i < fNdigits ; i++ ) {
newdigit = (AliPHOSDigit * ) fDigits->At(i) ;
- energyandnoise = newdigit->GetAmp() + Digitize(gRandom->Gaus(0., fPINElectronicNoise)) ;
- if (energyandnoise < 0 ) energyandnoise = 0 ;
- newdigit->SetAmp(energyandnoise) ;
-
+ 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 ;
+
+ if ( newdigit->GetAmp() < fDigitThreshold ) // if threshold not surpassed, remove digit from list
+ fDigits->RemoveAt(i) ;
+ }
}
+
+ fDigits->Compress() ;
+ fNdigits = fDigits->GetEntries() ;
+ for (i = 0 ; i < fNdigits ; i++) {
+ newdigit = (AliPHOSDigit *) fDigits->At(i) ;
+ newdigit->SetIndexInList(i) ;
+ }
- // Reset the array of all the "accumulated hits" of this event.
- fNTmpHits = 0 ;
- fTmpHits->Delete();
}
//____________________________________________________________________________
void AliPHOSv0::Init(void)
{
-
+ // Just prints an information message
+
Int_t i;
printf("\n");
//___________________________________________________________________________
void AliPHOSv0::MakeBranch(Option_t* opt)
{
- //
- // Create a new branch in the current Root Tree
- // The branch of fHits is automatically split
- //
+ // Create new branche in the current Root Tree in the digit Tree
+
AliDetector::MakeBranch(opt) ;
char branchname[10];
sprintf(branchname,"%s",GetName());
- char *cd = strstr(opt,"D");
+ char *cdD = strstr(opt,"D");
- if (fDigits && gAlice->TreeD() && cd) {
- gAlice->TreeD()->Branch(branchname,&fDigits, fBufferSize);
- printf("* AliPHOS::MakeBranch * Making Branch %s for digits\n",branchname);
+ if (fDigits && gAlice->TreeD() && cdD) {
+ gAlice->TreeD()->Branch(branchname, &fDigits, fBufferSize);
}
}
//_____________________________________________________________________________
void AliPHOSv0::Reconstruction(AliPHOSReconstructioner * Reconstructioner)
{
- // reinitializes the existing RecPoint Lists and steers the reconstruction processes
-
+ // 1. Reinitializes the existing RecPoint, TrackSegment, and RecParticles Lists and
+ // 2. Creates TreeR wit 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 ;
+
if (fEmcClusters) {
fEmcClusters->Delete() ;
delete fEmcClusters ;
fEmcClusters = 0 ;
}
- fEmcClusters= new RecPointsList("AliPHOSEmcRecPoint", 100) ;
-
+
+ // fEmcClusters= new RecPointsList("AliPHOSEmcRecPoint", 100) ; if TClonesArray
+ fEmcClusters= new RecPointsList(100) ;
+
+ if ( fEmcClusters && gAlice->TreeR() ) {
+ sprintf(branchname,"%sEmcRP",GetName()) ;
+
+ // gAlice->TreeR()->Branch(branchname, &fEmcClusters, fBufferSize); if TClonesArray
+ gAlice->TreeR()->Branch(branchname, "TObjArray", &fEmcClusters, fBufferSize, splitlevel) ;
+ }
+
if (fPpsdClusters) {
fPpsdClusters->Delete() ;
delete fPpsdClusters ;
fPpsdClusters = 0 ;
}
- fPpsdClusters = new RecPointsList("AliPHOSPpsdRecPoint", 100) ;
- if (fTrackSegments) {
+ // fPpsdClusters = new RecPointsList("AliPHOSPpsdRecPoint", 100) ; if TClonesArray
+ fPpsdClusters = new RecPointsList(100) ;
+
+ if ( fPpsdClusters && gAlice->TreeR() ) {
+ sprintf(branchname,"%sPpsdRP",GetName()) ;
+
+ // gAlice->TreeR()->Branch(branchname, &fPpsdClusters, fBufferSize); if TClonesArray
+ gAlice->TreeR()->Branch(branchname, "TObjArray", &fPpsdClusters, fBufferSize, splitlevel);
+ }
+
+ if (fTrackSegments) {
fTrackSegments->Delete() ;
delete fTrackSegments ;
fTrackSegments = 0 ;
}
- fTrackSegments = new TrackSegmentsList(100) ;
-
- if (fRecParticles) {
- fRecParticles->Delete() ;
+
+ fTrackSegments = new TrackSegmentsList("AliPHOSTrackSegment", 100) ;
+ if ( fTrackSegments && gAlice->TreeR() ) {
+ sprintf(branchname,"%sTS",GetName()) ;
+ gAlice->TreeR()->Branch(branchname, &fTrackSegments, fBufferSize);
+ }
+
+ if (fRecParticles) {
+ fRecParticles->Delete() ;
delete fRecParticles ;
fRecParticles = 0 ;
}
fRecParticles = new RecParticlesList("AliPHOSRecParticle", 100) ;
+ if ( fRecParticles && gAlice->TreeR() ) {
+ sprintf(branchname,"%sRP",GetName()) ;
+ gAlice->TreeR()->Branch(branchname, &fRecParticles, fBufferSize);
+ }
+
+ // 3.
fReconstructioner->Make(fDigits, fEmcClusters, fPpsdClusters, fTrackSegments, fRecParticles);
+ // 4. Expand or Shrink the arrays to the proper size
+
+ Int_t size ;
+
+ size = fEmcClusters->GetEntries() ;
+ fEmcClusters->Expand(size) ;
+
+ size = fPpsdClusters->GetEntries() ;
+ fPpsdClusters->Expand(size) ;
+
+ size = fTrackSegments->GetEntries() ;
+ fTrackSegments->Expand(size) ;
+
+ size = fRecParticles->GetEntries() ;
+ fRecParticles->Expand(size) ;
+
+ gAlice->TreeR()->Fill() ;
+
+ // 5.
+
+ gAlice->TreeR()->Write() ;
+
}
+//____________________________________________________________________________
+void AliPHOSv0::ResetDigits()
+{
+ // May sound strange, but cumulative hits are store in digits Tree
+
+ if( fTmpHits ) {
+ fTmpHits->Delete();
+ fNTmpHits = 0 ;
+ }
+}
+
//____________________________________________________________________________
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 primary = gAlice->GetPrimary( gAlice->CurrentTrack() );
TString name = fGeom->GetName() ;
-
if ( name == "GPS2" ) { // the CPV is a PPSD
- if( gMC->CurrentVolID(copy) == gMC->VolId("GCEL") )
+ if( gMC->CurrentVolID(copy) == gMC->VolId("GCEL") ) // We are inside a gas cell
{
gMC->TrackPosition(pos) ;
xyze[0] = pos[0] ;