23 #include "AliCDBManager.h"
29 #include "Riostream.h"
31 #include "TObjArray.h"
32 #include "TGraphAsymmErrors.h"
60 fEfficiencyMap(effCells),
61 fEfficiencyObjects(0x0),
74 fEfficiencyObjects(0x0),
87 fIsOwner(other.fIsOwner),
88 fEfficiencyMap(other.fEfficiencyMap),
89 fEfficiencyObjects(other.fEfficiencyObjects),
90 fDisplayList(other.fDisplayList)
132 if ( ! effGraph )
return -1.;
135 effGraph->GetPoint(localBoard-1, xpt, ypt);
152 if ( ! effGraph )
return -1.;
155 if ( errType == 0 ) {
156 err = effGraph->GetErrorYlow(localBoard-1);
158 else if ( errType == 1 ) {
159 err = effGraph->GetErrorYhigh(localBoard-1);
178 trigBend = ( gRandom->Rndm() > effBend ) ? kFALSE : kTRUE;
184 effNonBend = ( trigBend ) ?
186 ( effNonBend - effBoth ) / ( 1. - effBend );
189 trigNonBend = ( gRandom->Rndm() > effNonBend ) ? kFALSE : kTRUE;
191 AliDebug(2,Form(
"Ch %i board %i resp (%i, %i) prob (%.2f, %.2f) effNB %.2f effBoth %.2f\n", detElemId/100, localBoard, trigBend, trigNonBend, effBend, effNonBend,
GetCellEfficiency(detElemId, localBoard,
AliMUONTriggerEfficiencyCells::kNonBendingEff), effBoth));
203 Int_t iChamber = detElemId/100 - 1;
217 const Int_t kNeffHistos =
223 TH1F *histoNum = 0x0, *histoDen=0x0;
224 TString histoName =
"";
230 Bool_t rebuildEfficiency = kTRUE;
232 for ( Int_t ide=0; ide<2; ide++){
233 Int_t currDe = deType[ide];
243 AliWarning(Form(
"Histogram %s not found. Efficiency won't be re-build", histoName.Data()));
244 rebuildEfficiency = kFALSE;
248 AliWarning(
"Histogram list not present: efficiency won't be re-build");
249 rebuildEfficiency = kFALSE;
253 for(Int_t hType=0; hType<nTypes; hType++){
256 histoNum = ( rebuildEfficiency ) ?
261 AliWarning(Form(
"Histogram %s not found. Skip to next", histoName.Data()));
265 index =
GetIndex(deTypeEff[ide], hType, ich);
269 TString debugString = Form(
"Adding object %s",effGraph->GetName());
270 if ( histoDen ) debugString += Form(
" (%s/%s)",histoNum->GetName(),histoDen->GetName());
271 debugString += Form(
" index %i",index);
272 AliDebug(5,debugString.Data());
274 if ( useMeanValues && rebuildEfficiency ){
281 Int_t iBin = histoNum->FindBin(detElemId%100);
283 auxHistoNum->SetBinContent(iBinBoard, histoNum->GetBinContent(iBin));
284 auxHistoDen->SetBinContent(iBinBoard, histoDen->GetBinContent(iBin));
289 AliDebug(5,Form(
"Adding object %s (%s/%s) at index %i",effGraph->GetName(),histoNum->GetName(),histoDen->GetName(),index));
306 if ( !AliCDBManager::Instance()->GetDefaultStorage() ){
307 AliWarning(
"Please set default CDB storage (needed for mapping).");
310 if ( AliCDBManager::Instance()->GetRun() < 0 ){
311 AliWarning(
"Please set CDB run number (needed for mapping).");
315 TString baseCanName =
"MTRtrigChEffCan";
320 TIter next(
gROOT->GetListOfCanvases());
321 while ((can = (TCanvas *)next())) {
322 histoName = can->GetName();
323 if ( histoName.Contains(baseCanName.Data()))
331 TH2F* displayHisto = 0x0;
344 Int_t currCh = 11 + ich;
346 index =
GetIndex(deType, hType, ich);
348 if ( ! graph )
continue;
349 histoName = graph->GetName();
350 histoName += baseCanName;
351 Int_t shift = 10*(index%((AliMUONTriggerEfficiencyCells::kNcounts - 1)*
352 AliMpConstants::NofTriggerChambers()));
353 can =
new TCanvas(histoName.Data(), histoName.Data(), 100+shift, shift, 700, 700);
354 can->SetRightMargin(0.14);
355 can->SetLeftMargin(0.12);
356 histoName.ReplaceAll(baseCanName.Data(),
"Display");
361 hType,currCh,histoName,
363 displayHisto->SetDirectory(0);
367 displayHisto->GetZaxis()->SetRangeUser(0.,1.);
368 displayHisto->GetYaxis()->SetTitleOffset(1.4);
369 displayHisto->SetStats(kFALSE);
370 displayHisto->DrawCopy(
"COLZ");
374 histoName = Form(
"labels%iChamber%i", hType, currCh);
377 displayHisto->SetDirectory(0);
378 displayHisto->DrawCopy(
"textsame");
383 TGraphAsymmErrors* drawGraph = (TGraphAsymmErrors*)graph->Clone(histoName.Data());
384 drawGraph->SetMarkerStyle(20);
385 drawGraph->SetMarkerSize(0.7);
386 drawGraph->SetMarkerColor(kRed);
388 drawGraph->Draw(
"ap");
404 AliInfo(
"Boards filled with the average efficiency of the RPC");
424 histoType * kNtypes * kNchambers +
439 Int_t index =
GetIndex(histoType, countType, chamber);
453 TGraphAsymmErrors* auxGraph = 0x0;
454 if ( histoDen ) auxGraph =
new TGraphAsymmErrors(histoNum,histoDen,
"cp");
455 else auxGraph =
new TGraphAsymmErrors(histoNum);
457 Int_t
npoints = histoNum->GetNbinsX();
458 TGraphAsymmErrors* effGraph =
new TGraphAsymmErrors(npoints);
459 TString histoName = histoNum->GetName();
460 histoName.ReplaceAll(
"Count",
"Eff");
461 effGraph->SetName(histoName.Data());
462 effGraph->SetTitle(histoName.Data());
464 for ( Int_t ibin=0; ibin<
npoints; ibin++ ) {
465 Int_t foundPoint = -1;
466 for (Int_t ipt=0; ipt<auxGraph->GetN(); ipt++) {
467 auxGraph->GetPoint(ipt, oldX, oldY);
468 if ( oldX > histoNum->GetBinLowEdge(ibin+1) &&
469 oldX < histoNum->GetBinLowEdge(ibin+2) ) {
474 Double_t currX = ( foundPoint < 0 ) ? histoNum->GetBinCenter(ibin+1) : oldX;
475 Double_t currY = ( foundPoint < 0 ) ? 0. : oldY;
476 Double_t eyl = ( foundPoint < 0 ) ? 0. : auxGraph->GetErrorYlow(foundPoint);
477 Double_t eyh = ( foundPoint < 0 ) ? 0. : auxGraph->GetErrorYhigh(foundPoint);
478 effGraph->SetPoint(ibin, currX, currY);
479 effGraph->SetPointError(ibin, 0., 0., eyl, eyh);
Int_t GetIndex(Int_t histoType, Int_t countType, Int_t chamber=-1) const
Efficiency per slat index.
TH2 * GetBoardNumberHisto(TString displayHistoName, Int_t chamber=11, TString displayHistoTitle="")
EDisplayType
Display element inidices (strip,board,slat)
Bool_t fIsOwner
Owner of efficiency map.
Int_t GetDEfromLocalBoard(Int_t localBoardId, Int_t chamberId) const
TList * GetHistoList()
Get list of histograms.
Store and give access to the trigger chamber efficiency.
AliMUONTriggerChamberEfficiency & operator=(const AliMUONTriggerChamberEfficiency &other)
Displays strip/board/slat content even if it is 0.
tracks used for calculation
TList * fDisplayList
! List of objects for display
TObjArray * fEfficiencyObjects
Collect all efficiency.
const Char_t * GetHistoName(Int_t histoType, Int_t countType, Int_t chamber=-1)
static Int_t NofLocalBoards()
Return number of trigger local boards.
static AliMpDDLStore * Instance(Bool_t warn=true)
Efficiency per board index.
void IsTriggered(Int_t detElemId, Int_t localBoard, Bool_t &trigBend, Bool_t &trigNonBend) const
void FillFromList(Bool_t useMeanValues=kFALSE)
Converts histograms as a function of strip/board/slat number in human readable histograms.
Float_t GetCellEfficiency(Int_t detElemId, Int_t localBoard, Int_t hType) const
TH1F * GetOldEffHisto(Int_t hType, Int_t ich, Int_t icath) const
TObject * GetEffObject(Int_t histoType, Int_t countType, Int_t chamber)
Bool_t LowStatisticsSettings(Bool_t useMeanValues=kTRUE)
void DisplayEfficiency(Bool_t perSlat=kFALSE, Bool_t show2Dhisto=kTRUE)
TH2 * GetDisplayHistogram(TH1 *inputHisto, TString displayHistoName, EDisplayType displayType, Int_t cathode, Int_t chamber=11, TString displayHistoTitle="", EDisplayOption displayOpt=kDefaultDisplay)
Int_t FindChamberIndex(Int_t detElemId) const
Calculate, apply and possibly draw trigger chamber efficiency.
TGraphAsymmErrors * GetEfficiencyGraph(TH1 *histoNum, TH1 *histoDen)
AliMUONTriggerEfficiencyCells * fEfficiencyMap
Efficiency map.
virtual ~AliMUONTriggerChamberEfficiency()
static Int_t NofTrackingChambers()
Return number of tracking chambers.
Float_t GetCellEfficiencyError(Int_t detElemId, Int_t localBoard, Int_t hType, Int_t errType) const
AliMUONTriggerChamberEfficiency(AliMUONTriggerEfficiencyCells *effMap)
static Int_t NofTriggerChambers()