// Classes for display
#include "AliMUONGeometryTransformer.h"
#include "AliMpCDB.h"
+#include "AliCDBManager.h"
#include "AliMpDDLStore.h"
#include "AliMpDDL.h"
#include "AliMpTriggerCrate.h"
/// \class AliMUONTriggerEfficiencyCells
/// A class to store and give access to the trigger chamber efficiency.
///
-/// Efficiency is stored per cathode on local boards, or, alternatively,
-/// on "cells" of a given size.
+/// Efficiency is stored per cathode on local boards
///
/// The main method of this class is IsTriggered().
///
-/// $ALICE_ROOT/MUON/data/TriggerChamberefficiencyCells.dat contains efficiency
+/// $ALICE_ROOT/MUON/data/efficiencyCells.dat contains efficiency
/// for each chamber (i.e. DetElement).
///
/// 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:
-///
-/// <pre>
-/// x
-/// <----------------------------------|
-/// |
-/// --------------------------- |
-/// | 0.97 | 0.97 | 0.97 | 0.97 | |
-/// --------------------------- |
-/// | 0.97 | 0.97 | 0.97 | 0.97 | |
-/// --------------------------- |
-/// | 0.97 | 0.97 | 0.97 | 0.97 | |
-/// --------------------------- |
-/// |
-/// \/ y
-/// </pre>
-///
-/// In both cases, the file can be edited in order to change efficiency
-/// in a chosen local board/region of the chamber.
+/// 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)
///
/// \author Diego Stocco; INFN Torino
//-----------------------------------------------------------------------------
/// Copy constructor
for(Int_t chCath=0; chCath<fgkNplanes; chCath++){
- for(Int_t slat=0; slat<fgkNslats; slat++){
- fCellContent[chCath][slat] = other.fCellContent[chCath][slat];
- }
- fCellSize[chCath] = other.fCellSize[chCath];
- fCellNumber[chCath] = other.fCellNumber[chCath];
fBoardEfficiency[chCath] = other.fBoardEfficiency[chCath];
fSlatEfficiency[chCath] = other.fSlatEfficiency[chCath];
}
return *this;
for(Int_t chCath=0; chCath<fgkNplanes; chCath++){
- for(Int_t slat=0; slat<fgkNslats; slat++){
- fCellContent[chCath][slat] = other.fCellContent[chCath][slat];
- }
- fCellSize[chCath] = other.fCellSize[chCath];
- fCellNumber[chCath] = other.fCellNumber[chCath];
fBoardEfficiency[chCath] = other.fBoardEfficiency[chCath];
fSlatEfficiency[chCath] = other.fSlatEfficiency[chCath];
}
}
-//__________________________________________________________________________
-void AliMUONTriggerEfficiencyCells::GetCellEfficiency(Int_t detElemId, Float_t x, Float_t y, Float_t &eff1, Float_t &eff2) const
-{
-/// Get the efficiencies of the 2 cathodes at a given location (x,y)
-
- Int_t chamber = FindChamberIndex(detElemId);
- Int_t slat = FindSlatIndex(detElemId);
- TArrayI cell = CellByCoord(detElemId,x,y);
- eff1 = 0.0;
- eff2 = 0.0;
- if(cell.At(0)>=0 && cell.At(1)>=0)
- {
- eff1 = fCellContent[chamber][slat][cell.At(0)][cell.At(1)];
- eff2 = fCellContent[fgkNchambers+chamber][slat][cell.At(0)][cell.At(1)];
- }
-}
-
-
//__________________________________________________________________________
void AliMUONTriggerEfficiencyCells::GetCellEfficiency(Int_t detElemId, Int_t localBoard, Float_t &eff1, Float_t &eff2) const
{
}
-//__________________________________________________________________________
-void
-AliMUONTriggerEfficiencyCells::IsTriggered(Int_t detElemId, Float_t x, Float_t y, Bool_t &trig1, Bool_t &trig2) const
-{
-/// Whether or not a given location (x,y) has a chance to trig, on each cathode.
-
- Float_t eff1 = 0.0;
- Float_t eff2 = 0.0;
- GetCellEfficiency(detElemId, x, y, eff1, eff2);
- trig1 = kTRUE;
- trig2 = kTRUE;
- if(gRandom->Rndm()>eff1)trig1 = kFALSE;
- if(gRandom->Rndm()>eff2)trig2 = kFALSE;
-}
-
-
//__________________________________________________________________________
void
AliMUONTriggerEfficiencyCells::IsTriggered(Int_t detElemId, Int_t localBoard, Bool_t &trig1, Bool_t &trig2) const
if(gRandom->Rndm()>eff2)trig2 = kFALSE;
}
-//__________________________________________________________________________
-TArrayI AliMUONTriggerEfficiencyCells::CellByCoord(Int_t detElemId, Float_t x, Float_t y) const
-{
-/// Get the efficiencies at a given location.
-
- Int_t chamber = FindChamberIndex(detElemId);
- Int_t slat = FindSlatIndex(detElemId);
- Int_t cell[fgkNcathodes]={-1,-1};
- Float_t maxX = fCellSize[chamber][slat]*((Float_t)fCellNumber[chamber][slat]);
- Float_t maxY = fCellSize[fgkNchambers+chamber][slat]*((Float_t)fCellNumber[fgkNchambers+chamber][slat]);
- if(x>=0 & x<maxX & y>=0 & y<maxY)
- {
- cell[0] = (Int_t)(x/fCellSize[chamber][slat]);
- cell[1] = (Int_t)(y/fCellSize[fgkNchambers+chamber][slat]);
- }
- return TArrayI(fgkNcathodes,cell);
-}
//__________________________________________________________________________
void AliMUONTriggerEfficiencyCells::ReadFile(const Char_t* filename)
if (file.good()){
file >> dat;
if(!strcmp(dat,"localBoards"))ReadFileBoards(file);
- else ReadFileXY(file);
+ else AliWarning("File .dat in wrong format");
file.close();
} else {
AliWarning(Form("Can't read file %s",fileName.Data()));
}
-//__________________________________________________________________________
-void AliMUONTriggerEfficiencyCells::ReadFileXY(ifstream &file)
-{
-/// Structure of file (.dat) containing geometrical efficency
- Int_t datInt=0, detEl=0, chamber=0, rpc=0, chCath=0;
- Float_t datFloat=0.0;
- Char_t dat[50];
-
- while (file >> dat) {
- file >> detEl;
- chamber = FindChamberIndex(detEl);
- rpc = FindSlatIndex(detEl);
- file >> dat;
- for(Int_t i=0; i<fgkNcathodes; i++){
- chCath = fgkNchambers*i + chamber;
- file >> datInt;
- fCellNumber[chCath][rpc] = datInt;
- file >> dat;
- }
- for(Int_t i=0; i<fgkNcathodes; i++){
- chCath = fgkNchambers*i + chamber;
- file >> datFloat;
- fCellSize[chCath][rpc] = datFloat;
- if(i==0)file >> dat;
- }
- for(Int_t cath=0; cath<fgkNcathodes; cath++){
- chCath = fgkNchambers*cath + chamber;
- file >> dat;
- file >> datInt;
- for(Int_t iy=0; iy<fCellNumber[fgkNchambers+chamber][rpc]; iy++){
- for(Int_t ix=0; ix<fCellNumber[chamber][rpc]; ix++){
- file >> datFloat;
- fCellContent[chCath][rpc][ix][iy] = datFloat;
- }
- }
- }
- }
-}
-
//__________________________________________________________________________
void AliMUONTriggerEfficiencyCells::ReadFileBoards(ifstream &file)
{
while (file >> dat) {
file >> detEl;
chamber = FindChamberIndex(detEl);
- //rpc = FindSlatIndex(detEl);
for(Int_t cath=0; cath<fgkNcathodes; cath++){
chCath = fgkNchambers*cath + chamber;
file >> dat;
AliWarning(Form("Can't read file %s",filename));
return;
}
- Char_t histoName[30];
+ Char_t histoName[40];
Char_t *cathCode[fgkNcathodes] = {"bendPlane", "nonBendPlane"};
+ enum {kAllChEff, kChNonEff, kNumOfHistoTypes};
+ Char_t *histoTypeName[2] = {"CountInCh", "NonCountInCh"};
- for(Int_t ch=0; ch<fgkNchambers; ch++){
- for(Int_t cath=0; cath<fgkNcathodes; cath++){
- sprintf(histoName, "%sBoardEffChamber%i", cathCode[cath], 11+ch);
- if(!(TH1F *)file->Get(histoName)) {
- AliWarning(Form("Can't find histo %s in file %s",histoName, filename));
- continue;
- }
- Int_t chCath = fgkNchambers*cath + ch;
- fBoardEfficiency[chCath] = (TH1F *)file->Get(histoName);
+ if(!fCountHistoList) fCountHistoList = new TList();
+ else fCountHistoList->Delete();
+ if(!fNoCountHistoList) fNoCountHistoList = new TList();
+ else fNoCountHistoList->Delete();
+
+ TList *currList[2] = {fCountHistoList, fNoCountHistoList};
+
+ TH1F *histo = 0x0;
+
+ for(Int_t cath=0; cath<fgkNcathodes; cath++){
+ for(Int_t hType=0; hType<kNumOfHistoTypes; hType++){
+ sprintf(histoName, "%sChamber%s", cathCode[cath], histoTypeName[hType]);
+ histo = (TH1F*)file->Get(histoName);
+ currList[hType]->Add(histo);
+ }
+ }
+
+ for(Int_t cath=0; cath<fgkNcathodes; cath++){
+ for(Int_t ch=0; ch<fgkNchambers; ch++){
+ for(Int_t hType=0; hType<kNumOfHistoTypes; hType++){
+ sprintf(histoName, "%sSlat%s%i", cathCode[cath], histoTypeName[hType], 11+ch);
+ histo = (TH1F*)file->Get(histoName);
+ currList[hType]->Add(histo);
}
+ }
}
+
+ for(Int_t cath=0; cath<fgkNcathodes; cath++){
+ for(Int_t ch=0; ch<fgkNchambers; ch++){
+ for(Int_t hType=0; hType<kNumOfHistoTypes; hType++){
+ sprintf(histoName, "%sBoard%s%i", cathCode[cath], histoTypeName[hType], 11+ch);
+ histo = (TH1F*)file->Get(histoName);
+ currList[hType]->Add(histo);
+ }
+ }
+ }
+
+ InitHistos();
+ FillHistosFromList();
}
}
-//__________________________________________________________________________
-Int_t AliMUONTriggerEfficiencyCells::FindSlatIndex(Int_t detElemId) const
-{
-/// From detElemId to slat index.
- Int_t slat = detElemId%100;
- return slat;
-}
-
-
-//__________________________________________________________________________
-TVector2 AliMUONTriggerEfficiencyCells::ChangeReferenceFrame(Float_t x, Float_t y, Float_t x0, Float_t y0)
-{
-/// (x0,y0) position of the local reference frame (center of the chamber)
-
- Float_t x1 = x0-x;//reflection of axis
- Float_t y1 = y+y0;
- return TVector2(x1,y1);
-}
-
//__________________________________________________________________________
void
AliMUONTriggerEfficiencyCells::Reset()
{
/// Sets our internal array contents to zero.
- for(Int_t chCath=0; chCath<fgkNplanes; chCath++){
- fCellSize[chCath].Set(fgkNslats);
- fCellNumber[chCath].Set(fgkNslats);
- for(Int_t slat=0; slat<fgkNslats; slat++){
- fCellContent[chCath][slat].ResizeTo(fgkNcells,fgkNcells);
- }
- }
-
- for(Int_t chCath=0; chCath<fgkNplanes; chCath++){
- fCellSize[chCath].Reset();
- fCellNumber[chCath].Reset();
- for(Int_t slat=0; slat<fgkNslats; slat++){
- fCellContent[chCath][slat].Zero();
- }
- }
-
- for(Int_t chCath=0; chCath<fgkNplanes; chCath++){
- fBoardEfficiency[chCath] = 0x0;
- fSlatEfficiency[chCath] = 0x0;
- }
+ for(Int_t chCath=0; chCath<fgkNplanes; chCath++){
+ fBoardEfficiency[chCath] = 0x0;
+ fSlatEfficiency[chCath] = 0x0;
+ }
}
/// Sets our internal array contents to zero.
const Int_t kNumOfBoards = AliMpConstants::NofLocalBoards();
+ const Int_t kNslats = 18;
Int_t chCath=0;
Char_t histoName[40];
sprintf(histoName, "%sBoardEffChamber%i", cathCode[cath], 11+ch);
fBoardEfficiency[chCath] = new TH1F(histoName, histoName, kNumOfBoards, 1-0.5, kNumOfBoards+1.-0.5);
sprintf(histoName, "%sSlatEffChamber%i", cathCode[cath], 11+ch);
- fSlatEfficiency[chCath] = new TH1F(histoName, histoName, fgkNslats, 0-0.5, fgkNslats-0.5);
+ fSlatEfficiency[chCath] = new TH1F(histoName, histoName, kNslats, 0-0.5, kNslats-0.5);
}
}
}
}
-
//_____________________________________________________________________________
void AliMUONTriggerEfficiencyCells::CalculateEfficiency(Int_t trigger44, Int_t trigger34,
Float_t &efficiency, Float_t &error,
//_____________________________________________________________________________
-void AliMUONTriggerEfficiencyCells::CheckFiredStrips(const Char_t* geoFilename)
+void AliMUONTriggerEfficiencyCells::CheckFiredStrips(const Char_t* geoFilename,
+ const Char_t* cdbStorage,
+ Int_t runNumber)
{
//
/// Check for fired strips participating to efficiency
return;
}
- GetListsForCheck(geoFilename);
+ GetListsForCheck(geoFilename, cdbStorage, runNumber);
Char_t histoName[40], histoTitle[90];
//_____________________________________________________________________________
-void AliMUONTriggerEfficiencyCells::DisplayEfficiency(Bool_t perSlat, const Char_t* geoFilename)
+void AliMUONTriggerEfficiencyCells::DisplayEfficiency(Bool_t perSlat,
+ const Char_t* geoFilename,
+ const Char_t* cdbStorage,
+ Int_t runNumber)
{
//
/// Display calculated efficiency.
return;
}
- GetListsForCheck(geoFilename);
+ GetListsForCheck(geoFilename, cdbStorage, runNumber);
const Int_t kNumOfBoards = AliMpConstants::NofLocalBoards();
//__________________________________________________________________________
-Bool_t AliMUONTriggerEfficiencyCells::GetListsForCheck(const Char_t* geoFilename)
+Bool_t AliMUONTriggerEfficiencyCells::GetListsForCheck(const Char_t* geoFilename,
+ const Char_t* cdbStorage,
+ Int_t runNumber)
{
//
/// Getting histograms for efficiency,
if(!fFiredFitHistoList && fFiredStrips) fFiredFitHistoList = new TList();
if(!fFiredDisplayHistoList && fFiredStrips) fFiredDisplayHistoList = new TList();
+ AliCDBManager::Instance()->SetDefaultStorage(cdbStorage);
+ AliCDBManager::Instance()->SetRun(runNumber);
+
AliMUONGeometryTransformer *transform = new AliMUONGeometryTransformer();
transform->LoadGeometryData(geoFilename);
Int_t histoBin = localId;
efficiency = fBoardEfficiency[chCath]->GetBinContent(histoBin);
efficiencyError = fBoardEfficiency[chCath]->GetBinError(histoBin);
+ if(efficiency==0.) efficiency = kDummyFired; // It allows to graphically distinguish
+ // efficiency = 0 from no hit on board
histoBin = slat+1;
efficiencySlat = fSlatEfficiency[chCath]->GetBinContent(histoBin);
efficiencySlatError = fSlatEfficiency[chCath]->GetBinError(histoBin);
+ if(efficiencySlat==0.) efficiencySlat = kDummyFired; // It allows to graphically distinguish
+ // efficiency = 0 from no hit on slat
for(Int_t binX=x1; binX<=x2; binX++){
for(Int_t binY=y1; binY<=y2; binY++){