From: pcrochet Date: Mon, 18 Dec 2006 16:23:55 +0000 (+0000) Subject: Trigger chamber efficiency according to local boards (Diego) X-Git-Url: http://git.uio.no/git/?p=u%2Fmrichter%2FAliRoot.git;a=commitdiff_plain;h=081d3361e968f8c807435b4b6a753b14ed794b92 Trigger chamber efficiency according to local boards (Diego) --- diff --git a/MUON/AliMUONDigitizerV3.cxx b/MUON/AliMUONDigitizerV3.cxx index 41352170c76..32758b4bd42 100644 --- a/MUON/AliMUONDigitizerV3.cxx +++ b/MUON/AliMUONDigitizerV3.cxx @@ -227,32 +227,17 @@ AliMUONDigitizerV3::ApplyResponseToTriggerDigit(AliMUONDigit& digit, segment[1]->PadByIndices(AliMpIntPair(correspondingDigit->PadX(),correspondingDigit->PadY()),kTRUE) }; - Int_t ix(0); - Int_t iy(1); + Int_t p0(1); + if (digit.Cathode()==0)p0=0; + + AliMpIntPair location = pad[p0].GetLocation(0); + Int_t nboard = location.GetFirst(); - if (digit.Cathode()==0) - { - ix=1; - iy=0; - } - - Float_t x = pad[ix].Position().X(); - Float_t y = pad[iy].Position().Y(); - if ( x==-1 && y==-1 ) - { - x=-9999.; - y=-9999.; - AliError(Form("Got an unknown position for a digit in DE %d at (ix,iy)=(%d,%d)", - detElemId,pad[ix].GetIndices().GetFirst(),pad[iy].GetIndices().GetSecond())); - } - Float_t x0 = segment[0]->Dimensions().X(); - Float_t y0 = segment[1]->Dimensions().Y(); - TVector2 newCoord = fTriggerEfficiency->ChangeReferenceFrame(x, y, x0, y0); - Bool_t isTrig[2]; - fTriggerEfficiency->IsTriggered(detElemId, newCoord.Px(), newCoord.Py(), + + fTriggerEfficiency->IsTriggered(detElemId, nboard-1, isTrig[0], isTrig[1]); - + if (!isTrig[digit.Cathode()]) { digit.SetSignal(0); diff --git a/MUON/AliMUONTriggerEfficiencyCells.cxx b/MUON/AliMUONTriggerEfficiencyCells.cxx index 60994a4a831..ecfb08fc5c6 100755 --- a/MUON/AliMUONTriggerEfficiencyCells.cxx +++ b/MUON/AliMUONTriggerEfficiencyCells.cxx @@ -16,27 +16,27 @@ #include #include #include "Riostream.h" +#include "TSystem.h" #include "AliMUONTriggerEfficiencyCells.h" #include "AliMUONConstants.h" -#include "AliRun.h" -#include "AliMpPad.h" -#include "AliMUON.h" -#include "AliMpVSegmentation.h" -#include "AliMpTriggerSegmentation.h" -#include "AliMpTrigger.h" #include "AliLog.h" /// \class AliMUONTriggerEfficiencyCells /// A class to store and give access to the trigger chamber efficiency. /// -/// Efficiency is stored per cathode, on "cells" of a given size. +/// Efficiency is stored per cathode on local boards, or, alternatively, +/// on "cells" of a given size. /// /// The main method of this class is IsTriggered(). /// /// $ALICE_ROOT/MUON/data/TriggerChamberefficiencyCells.dat contains efficiency /// for each chamber (i.e. DetElement). -/// The efficiency cells goes from right to left and +/// +/// In the case of local boards, efficiency is stored from left to right +/// per increasing board number (from 1 to 234) +/// +/// Otherwise, he efficiency cells goes from right to left and /// from bottom to top of the chamber, namely, the efficiencies tabulated in the /// file refers to the following reference frame: /// @@ -54,8 +54,10 @@ /// | /// \/ y /// -/// The file can be edited in order to change efficiency in a chosen region -/// of the chamber. +/// +/// In both cases, the file can be edited in order to change efficiency +/// in a chosen local board/region of the chamber. +/// /// /// But please note that this object is also available from the CDB /// (generated using the MUONCDB.C macro) @@ -91,28 +93,12 @@ AliMUONTriggerEfficiencyCells::~AliMUONTriggerEfficiencyCells() { /// Destructor. Does nothing ;-) } - -//__________________________________________________________________________ -Float_t AliMUONTriggerEfficiencyCells::GetCellEfficiency(Int_t detElemId, Int_t cathode, Float_t x, Float_t y) -{ -/// Get the efficiency at a given position (x,y) for a given cathode - - Int_t chamber = FindChamberIndex(detElemId); - Int_t slat = FindSlatIndex(detElemId); - TArrayI cell = CellByCoord(detElemId,x,y); - Float_t efficiency = 0.0; - if (cell.At(0)>=0 && cell.At(1)>=0) - { - efficiency = fCellContent[chamber][slat][cathode][cell.At(0)][cell.At(1)]; - } - return efficiency; -} //__________________________________________________________________________ void AliMUONTriggerEfficiencyCells::GetCellEfficiency(Int_t detElemId, Float_t x, Float_t y, Float_t &eff1, Float_t &eff2) { -/// Get the efficiencies of the 2 cathode at a given location (x,y) +/// Get the efficiencies of the 2 cathodes at a given location (x,y) Int_t chamber = FindChamberIndex(detElemId); Int_t slat = FindSlatIndex(detElemId); @@ -128,18 +114,13 @@ void AliMUONTriggerEfficiencyCells::GetCellEfficiency(Int_t detElemId, Float_t x //__________________________________________________________________________ -Bool_t -AliMUONTriggerEfficiencyCells::IsTriggered(Int_t detElemId, Int_t cathode, Float_t x, Float_t y) +void AliMUONTriggerEfficiencyCells::GetCellEfficiency(Int_t detElemId, Int_t localBoard, Float_t &eff1, Float_t &eff2) { -/// Random decision of whether a given "location" (x,y) trigs or not. +/// Get the efficiencies of the 2 cathodes at a given local board - Float_t efficiency = GetCellEfficiency(detElemId, cathode, x, y); - Bool_t trigger = kTRUE; - if(gRandom->Rndm()>efficiency) - { - trigger = kFALSE; - } - return trigger; + Int_t chamber = FindChamberIndex(detElemId); + eff1 = fBoardContent[chamber][0][localBoard]; + eff2 = fBoardContent[chamber][1][localBoard]; } @@ -159,6 +140,21 @@ AliMUONTriggerEfficiencyCells::IsTriggered(Int_t detElemId, Float_t x, Float_t y } +//__________________________________________________________________________ +void +AliMUONTriggerEfficiencyCells::IsTriggered(Int_t detElemId, Int_t localBoard, Bool_t &trig1, Bool_t &trig2) +{ +/// Whether or not a given local board has a chance to trig, on each cathode. + + Float_t eff1 = 0.0; + Float_t eff2 = 0.0; + GetCellEfficiency(detElemId, localBoard, eff1, eff2); + trig1 = kTRUE; + trig2 = kTRUE; + if(gRandom->Rndm()>eff1)trig1 = kFALSE; + if(gRandom->Rndm()>eff2)trig2 = kFALSE; +} + //__________________________________________________________________________ TArrayI AliMUONTriggerEfficiencyCells::CellByCoord(Int_t detElemId, Float_t x, Float_t y) { @@ -184,10 +180,26 @@ void AliMUONTriggerEfficiencyCells::ReadFile(const char* filename) TString fileName = gSystem->ExpandPathName(filename); ifstream file(fileName.Data()); - Int_t datInt=0, detEl=0, chamber=0, rpc=0; - Float_t datFloat=0.0; char dat[50]; if (file.good()){ + file >> dat; + if(!strcmp(dat,"localBoards"))ReadFileBoards(file); + else ReadFileXY(file); + file.close(); + } else { + AliWarning(Form("Can't read file %s",fileName.Data())); + } +} + + +//__________________________________________________________________________ +void AliMUONTriggerEfficiencyCells::ReadFileXY(ifstream &file) +{ +/// Structure of file containing geometrical efficency + Int_t datInt=0, detEl=0, chamber=0, rpc=0; + Float_t datFloat=0.0; + char dat[50]; + while (file >> dat) { file >> detEl; chamber = FindChamberIndex(detEl); @@ -214,12 +226,30 @@ void AliMUONTriggerEfficiencyCells::ReadFile(const char* filename) } } } - file.close(); - } else { - AliWarning(Form("Can't read file %s",fileName.Data())); - } } +//__________________________________________________________________________ +void AliMUONTriggerEfficiencyCells::ReadFileBoards(ifstream &file) +{ +/// Structure of file containing local board efficency + Int_t datInt=0, detEl=0, chamber=0; + Float_t datFloat=0.0; + char dat[50]; + + while (file >> dat) { + file >> detEl; + chamber = FindChamberIndex(detEl); + //rpc = FindSlatIndex(detEl); + for(Int_t cath=0; cath<2; cath++){ + file >> dat; + file >> datInt; + for(Int_t board=0; board> datFloat; + fBoardContent[chamber][cath][board] = datFloat; + } + } + } +} //__________________________________________________________________________ Int_t AliMUONTriggerEfficiencyCells::FindChamberIndex(Int_t detElemId) @@ -277,6 +307,13 @@ AliMUONTriggerEfficiencyCells::Reset() } } } + for(Int_t cath=0; cath<2; cath++) + { + for(Int_t board=0; board