X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=PHOS%2FAliPHOSv1.cxx;h=582d834f6f62cf0a7216f89031244904b08a336c;hb=fa7cce36cc9d89d826b515b7bd8c08120ca3c24d;hp=afa7bb3d59fb7e294658fb2623963f7c7cdfeadf;hpb=d4fc3e82bedf36d65157cb97955c510ced8f59d3;p=u%2Fmrichter%2FAliRoot.git diff --git a/PHOS/AliPHOSv1.cxx b/PHOS/AliPHOSv1.cxx index afa7bb3d59f..582d834f6f6 100644 --- a/PHOS/AliPHOSv1.cxx +++ b/PHOS/AliPHOSv1.cxx @@ -54,6 +54,9 @@ #include "AliConst.h" #include "AliMC.h" #include "AliPHOSGeometry.h" +#include "AliPHOSQAIntCheckable.h" +#include "AliPHOSQAFloatCheckable.h" +#include "AliPHOSQAMeanChecker.h" ClassImp(AliPHOSv1) @@ -67,7 +70,7 @@ AliPHOSv0() //____________________________________________________________________________ AliPHOSv1::AliPHOSv1(const char *name, const char *title): -AliPHOSv0(name,title) + AliPHOSv0(name,title) { // ctor : title is used to identify the layout // GPS2 = 5 modules (EMC + PPSD) @@ -85,14 +88,42 @@ AliPHOSv0(name,title) // We do not want to save in TreeH the raw hits // 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() ). + // and the TreeD at the end of the event (branch is set in FinishEvent() ). fHits= new TClonesArray("AliPHOSHit",1000) ; fNhits = 0 ; fIshunt = 1 ; // All hits are associated with primary particles + + Int_t nb = GetGeometry()->GetNModules() ; + // create checkables + fQAHitsMul = new AliPHOSQAIntCheckable("HitsM") ; + fQATotEner = new AliPHOSQAFloatCheckable("TotEn") ; + fQAHitsMulB = new TClonesArray("AliPHOSQAIntCheckable",nb) ; + fQATotEnerB = new TClonesArray("AliPHOSQAFloatCheckable", nb); + char tempo[20] ; + Int_t i ; + for ( i = 0 ; i < nb ; i++ ) { + sprintf(tempo, "HitsMB%d", i+1) ; + new( (*fQAHitsMulB)[i]) AliPHOSQAIntCheckable(tempo) ; + sprintf(tempo, "TotEnB%d", i+1) ; + new( (*fQATotEnerB)[i] ) AliPHOSQAFloatCheckable(tempo) ; + } + + AliPHOSQAMeanChecker * hmc = new AliPHOSQAMeanChecker("HitsMul", 100. ,25.) ; + AliPHOSQAMeanChecker * emc = new AliPHOSQAMeanChecker("TotEner", 10. ,5.) ; + AliPHOSQAMeanChecker * bhmc = new AliPHOSQAMeanChecker("HitsMulB", 100. ,5.) ; + AliPHOSQAMeanChecker * bemc = new AliPHOSQAMeanChecker("TotEnerB", 2. ,.5) ; + + // associate checkables and checkers + fQAHitsMul->AddChecker(hmc) ; + fQATotEner->AddChecker(emc) ; + for ( i = 0 ; i < nb ; i++ ) { + ((AliPHOSQAIntCheckable*)(*fQAHitsMulB)[i])->AddChecker(bhmc) ; + ((AliPHOSQAFloatCheckable*)(*fQATotEnerB)[i])->AddChecker(bemc) ; + } } //____________________________________________________________________________ @@ -118,12 +149,13 @@ void AliPHOSv1::AddHit(Int_t shunt, Int_t primary, Int_t tracknumber, Int_t Id, AliPHOSHit *newHit ; AliPHOSHit *curHit ; Bool_t deja = kFALSE ; + AliPHOSGeometry * geom = GetGeometry() ; newHit = new AliPHOSHit(shunt, primary, tracknumber, Id, hits) ; for ( hitCounter = fNhits-1 ; hitCounter >= 0 && !deja ; hitCounter-- ) { curHit = (AliPHOSHit*) (*fHits)[hitCounter] ; - if(curHit->GetPrimary() != primary) break ; // We add hits with the same primary, while GEANT treats primaries consequently + if(curHit->GetPrimary() != primary) break ; // We add hits with the same primary, while GEANT treats primaries succesively if( *curHit == *newHit ) { *curHit = *curHit + *newHit ; deja = kTRUE ; @@ -132,12 +164,72 @@ void AliPHOSv1::AddHit(Int_t shunt, Int_t primary, Int_t tracknumber, Int_t Id, if ( !deja ) { new((*fHits)[fNhits]) AliPHOSHit(*newHit) ; + // get the block Id number + Int_t * relid = new Int_t[geom->GetNModules()] ; + geom->AbsToRelNumbering(Id, relid) ; + // and fill the relevant QA checkable (only if in PbW04) + if ( relid[1] == 0 ) { + fQAHitsMul->Update(1) ; + ((AliPHOSQAIntCheckable*)(*fQAHitsMulB)[relid[0]-1])->Update(1) ; + } + delete relid ; fNhits++ ; } delete newHit; } +//____________________________________________________________________________ +void AliPHOSv1::FinishPrimary() +{ + // called at the end of each track (primary) by AliRun + // hits are reset for each new track + // accumulate the total hit-multiplicity +// if ( fQAHitsMul ) +// fQAHitsMul->Update( fHits->GetEntriesFast() ) ; + +} + +//____________________________________________________________________________ +void AliPHOSv1::FinishEvent() +{ + // called at the end of each event by AliRun + // accumulate the hit-multiplicity and total energy per block + // if the values have been updated check it + + if ( fQATotEner ) { + if ( fQATotEner->HasChanged() ) { + fQATotEner->CheckMe() ; + fQATotEner->Reset() ; + } + } + + Int_t i ; + if ( fQAHitsMulB && fQATotEnerB ) { + for (i = 0 ; i < GetGeometry()->GetNModules() ; i++) { + AliPHOSQAIntCheckable * ci = (AliPHOSQAIntCheckable*)(*fQAHitsMulB)[i] ; + AliPHOSQAFloatCheckable* cf = (AliPHOSQAFloatCheckable*)(*fQATotEnerB)[i] ; + if ( ci->HasChanged() ) { + ci->CheckMe() ; + ci->Reset() ; + } + if ( cf->HasChanged() ) { + cf->CheckMe() ; + cf->Reset() ; + } + } + } + + // check the total multiplicity + + if ( fQAHitsMul ) { + if ( fQAHitsMul->HasChanged() ) { + fQAHitsMul->CheckMe() ; + fQAHitsMul->Reset() ; + } + } +} + //____________________________________________________________________________ void AliPHOSv1::StepManager(void) { @@ -151,12 +243,12 @@ void AliPHOSv1::StepManager(void) Int_t tracknumber = gAlice->CurrentTrack() ; Int_t primary = gAlice->GetPrimary( gAlice->CurrentTrack() ); - TString name = fGeom->GetName() ; + TString name = GetGeometry()->GetName() ; if ( name == "GPS2" || name == "MIXT" ) { // ======> CPV is a GPS' PPSD - if( gMC->CurrentVolID(copy) == gMC->VolId("PCEL") ) // We are inside a gas cell + if( gMC->CurrentVolID(copy) == gMC->VolId("PPCE") ) // We are inside a gas cell { gMC->TrackPosition(pos) ; xyze[0] = pos[0] ; @@ -167,17 +259,17 @@ void AliPHOSv1::StepManager(void) if ( xyze[3] != 0 ) { // there is deposited energy gMC->CurrentVolOffID(5, relid[0]) ; // get the PHOS Module number if ( name == "MIXT" && strcmp(gMC->CurrentVolOffName(5),"PHO1") == 0 ){ - relid[0] += fGeom->GetNModules() - fGeom->GetNPPSDModules(); + relid[0] += GetGeometry()->GetNModules() - GetGeometry()->GetNPPSDModules(); } gMC->CurrentVolOffID(3, relid[1]) ; // get the Micromegas Module number - // 1-> fGeom->GetNumberOfModulesPhi() * fGeom->GetNumberOfModulesZ() upper - // > fGeom->GetNumberOfModulesPhi() * fGeom->GetNumberOfModulesZ() lower + // 1-> GetGeometry()->GetNumberOfModulesPhi() * GetGeometry()->GetNumberOfModulesZ() upper + // > GetGeometry()->GetNumberOfModulesPhi() * GetGeometry()->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 - fGeom->RelToAbsNumbering(relid, absid) ; + GetGeometry()->RelToAbsNumbering(relid, absid) ; // add current hit to the hit list AddHit(fIshunt, primary, tracknumber, absid, xyze); @@ -265,7 +357,7 @@ void AliPHOSv1::StepManager(void) relid[3] = cpvDigit->GetYpad() ; // row number of a pad // get the absolute Id number - fGeom->RelToAbsNumbering(relid, absid) ; + GetGeometry()->RelToAbsNumbering(relid, absid) ; // add current digit to the temporary hit list xyze[0] = 0. ; @@ -297,16 +389,20 @@ void AliPHOSv1::StepManager(void) if ( xyze[3] != 0 ) { // Track is inside the crystal and deposits some energy gMC->CurrentVolOffID(10, relid[0]) ; // get the PHOS module number ; + + // fill the relevant QA Checkables + fQATotEner->Update( xyze[3] ) ; // total energy in PHOS + ((AliPHOSQAFloatCheckable*)(*fQATotEnerB)[relid[0]-1])->Update( xyze[3] ) ; // energy in this block if ( name == "MIXT" && strcmp(gMC->CurrentVolOffName(10),"PHO1") == 0 ) - relid[0] += fGeom->GetNModules() - fGeom->GetNPPSDModules(); + relid[0] += GetGeometry()->GetNModules() - GetGeometry()->GetNPPSDModules(); 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 - fGeom->RelToAbsNumbering(relid, absid) ; + GetGeometry()->RelToAbsNumbering(relid, absid) ; // add current hit to the hit list AddHit(fIshunt, primary,tracknumber, absid, xyze); @@ -329,7 +425,7 @@ void AliPHOSv1::CPVDigitize (TLorentzVector p, Float_t *zxhit, Int_t moduleNumbe // 2 October 2000 // ------------------------------------------------------------------------ - const Float_t kCelWr = fGeom->GetPadSizePhi()/2; // Distance between wires (2 wires above 1 pad) + const Float_t kCelWr = GetGeometry()->GetPadSizePhi()/2; // Distance between wires (2 wires above 1 pad) const Float_t kDetR = 0.1; // Relative energy fluctuation in track for 100 e- const Float_t kdEdx = 4.0; // Average energy loss in CPV; const Int_t kNgamz = 5; // Ionization size in Z @@ -352,13 +448,13 @@ void AliPHOSv1::CPVDigitize (TLorentzVector p, Float_t *zxhit, Int_t moduleNumbe // cout << "CPVDigitize: YVK : "<GetCPVGasThickness(); - Float_t dXY = pX/pNorm * fGeom->GetCPVGasThickness(); + Float_t dZY = pZ/pNorm * GetGeometry()->GetCPVGasThickness(); + Float_t dXY = pX/pNorm * GetGeometry()->GetCPVGasThickness(); gRandom->Rannor(rnor1,rnor2); eloss *= (1 + kDetR*rnor1) * - TMath::Sqrt((1 + ( pow(dZY,2) + pow(dXY,2) ) / pow(fGeom->GetCPVGasThickness(),2))); - Float_t zhit1 = hitZ + fGeom->GetCPVActiveSize(1)/2 - dZY/2; - Float_t xhit1 = hitX + fGeom->GetCPVActiveSize(0)/2 - dXY/2; + TMath::Sqrt((1 + ( pow(dZY,2) + pow(dXY,2) ) / pow(GetGeometry()->GetCPVGasThickness(),2))); + Float_t zhit1 = hitZ + GetGeometry()->GetCPVActiveSize(1)/2 - dZY/2; + Float_t xhit1 = hitX + GetGeometry()->GetCPVActiveSize(0)/2 - dXY/2; Float_t zhit2 = zhit1 + dZY; Float_t xhit2 = xhit1 + dXY; @@ -418,8 +514,8 @@ void AliPHOSv1::CPVDigitize (TLorentzVector p, Float_t *zxhit, Int_t moduleNumbe // Finite size of ionization region - Int_t nCellZ = fGeom->GetNumberOfCPVPadsZ(); - Int_t nCellX = fGeom->GetNumberOfCPVPadsPhi(); + Int_t nCellZ = GetGeometry()->GetNumberOfCPVPadsZ(); + Int_t nCellX = GetGeometry()->GetNumberOfCPVPadsPhi(); Int_t nz3 = (kNgamz+1)/2; Int_t nx3 = (kNgamx+1)/2; cpvDigits->Expand(nIter*kNgamx*kNgamz); @@ -430,8 +526,8 @@ void AliPHOSv1::CPVDigitize (TLorentzVector p, Float_t *zxhit, Int_t moduleNumbe Float_t zhit = zxe[0][iter]; Float_t xhit = zxe[1][iter]; Float_t qhit = zxe[2][iter]; - Float_t zcell = zhit / fGeom->GetPadSizeZ(); - Float_t xcell = xhit / fGeom->GetPadSizePhi(); + Float_t zcell = zhit / GetGeometry()->GetPadSizeZ(); + Float_t xcell = xhit / GetGeometry()->GetPadSizePhi(); if ( zcell<=0 || xcell<=0 || zcell>=nCellZ || xcell>=nCellX) return; Int_t izcell = (Int_t) zcell; @@ -468,10 +564,10 @@ Float_t AliPHOSv1::CPVPadResponseFunction(Float_t qhit, Float_t zhit, Float_t xh // 3 October 2000 // ------------------------------------------------------------------------ - Double_t dz = fGeom->GetPadSizeZ() / 2; - Double_t dx = fGeom->GetPadSizePhi() / 2; - Double_t z = zhit * fGeom->GetPadSizeZ(); - Double_t x = xhit * fGeom->GetPadSizePhi(); + Double_t dz = GetGeometry()->GetPadSizeZ() / 2; + Double_t dx = GetGeometry()->GetPadSizePhi() / 2; + Double_t z = zhit * GetGeometry()->GetPadSizeZ(); + Double_t x = xhit * GetGeometry()->GetPadSizePhi(); Double_t amplitude = qhit * (CPVCumulPadResponse(z+dz,x+dx) - CPVCumulPadResponse(z+dz,x-dx) - CPVCumulPadResponse(z-dz,x+dx) + CPVCumulPadResponse(z-dz,x-dx));