/* $Id$ */
+//-----------------------------------------------------------------------------
/// \class AliMUONTriggerChamberEff
-/// implementation of the trigger chamber efficiency determination from
+/// Implementation of the trigger chamber efficiency determination from
/// data, and returns the
/// efficiencyCells.dat with the calculated efficiencies
///
/// \author Diego Stocco (Torino)
+//-----------------------------------------------------------------------------
#include "AliMUONTriggerChamberEff.h"
#include "AliMUONVDigit.h"
#include "AliMUONVTriggerStore.h"
#include "AliMUONVTriggerTrackStore.h"
#include "AliMUONVTrackStore.h"
+#include "AliMUONTriggerEfficiencyCells.h"
#include "AliMpVSegmentation.h"
#include "AliMpSegmentation.h"
#include "AliMpDEIterator.h"
#include "AliMpPlaneType.h"
#include "AliMpDEManager.h"
+#include "AliMpConstants.h"
#include "AliLog.h"
+//#include "AliESDEvent.h"
+
#include <Riostream.h>
#include <TFile.h>
#include <TH1F.h>
+#include <TH3F.h>
#include <TMath.h>
#include <TSeqCollection.h>
#include <TTree.h>
#include <TROOT.h>
+#include <cassert>
/// \cond CLASSIMP
ClassImp(AliMUONTriggerChamberEff)
/// \endcond
-
//_____________________________________________________________________________
AliMUONTriggerChamberEff::AliMUONTriggerChamberEff()
: TObject(),
fDebugLevel(0),
fkMaxDistance(99999.)
{
-/// Standard constructor
+/// Default constructor
+
+ CheckConstants();
ResetArrays();
+ InitHistos();
}
fkMaxDistance(99999.)
{
/// Standard constructor
+
+ CheckConstants();
ResetArrays();
+ InitHistos();
}
AliMUONTriggerChamberEff::~AliMUONTriggerChamberEff()
{
/// Destructor
- Bool_t writeOnESD=fWriteOnESD;
+
+ // Bool_t writeOnESD=fWriteOnESD;
fWriteOnESD=kFALSE;
- if(writeOnESD) SaveInESDFile();
+ // if(writeOnESD) SaveInESDFile();
}
fPrintInfo(other.fPrintInfo),
fWriteOnESD(other.fWriteOnESD),
fDebugLevel(other.fDebugLevel),
- fkMaxDistance(other.fkMaxDistance)
+ fkMaxDistance(other.fkMaxDistance),
+ fTrigger44(other.fTrigger44),
+ fTrigger34(other.fTrigger34)
{
-/// copy constructor
+/// Copy constructor
- for(Int_t ch=0; ch<fgkNchambers; ch++){
- for(Int_t cath=0; cath<fgkNcathodes; cath++){
- fTrigger34[ch][cath] = other.fTrigger34[ch][cath];
- fTrigger44[cath] = other.fTrigger44[cath];
- for(Int_t slat=0; slat<fgkNslats; slat++){
- fInefficientSlat[ch][cath][slat] = other.fInefficientSlat[ch][cath][slat];
- fHitPerSlat[ch][cath][slat] = other.fHitPerSlat[ch][cath][slat];
- }
- for(Int_t board=0; board<fgkNboards; board++){
- fInefficientBoard[ch][cath][board] = other.fInefficientBoard[ch][cath][board];
- fHitPerBoard[ch][cath][board] = other.fHitPerBoard[ch][cath][board];
- }
- }
+ for(Int_t chCath=0; chCath<fgkNplanes; chCath++){
+ fInefficientSlat[chCath] = other.fInefficientSlat[chCath];
+ fHitPerSlat[chCath] = other.fHitPerSlat[chCath];
+ fInefficientBoard[chCath] = other.fInefficientBoard[chCath];
+ fHitPerBoard[chCath] = other.fHitPerBoard[chCath];
}
}
fPrintInfo = other.fPrintInfo;
fWriteOnESD = other.fWriteOnESD;
fDebugLevel = other.fDebugLevel;
- //fkMaxDistance = other.fkMaxDistance;
+
+ fTrigger44 = other.fTrigger44;
+ fTrigger34 = other.fTrigger34;
+
+ for(Int_t chCath=0; chCath<fgkNplanes; chCath++){
+ fInefficientSlat[chCath] = other.fInefficientSlat[chCath];
+ fHitPerSlat[chCath] = other.fHitPerSlat[chCath];
+ fInefficientBoard[chCath] = other.fInefficientBoard[chCath];
+ fHitPerBoard[chCath] = other.fHitPerBoard[chCath];
+ }
return *this;
}
/// Sets the data member counters to 0.
//
- for(Int_t ch=0; ch<fgkNchambers; ch++){
- for(Int_t cath=0; cath<fgkNcathodes; cath++){
- fTrigger34[ch][cath] = 0;
- fTrigger44[cath] = 0;
- for(Int_t slat=0; slat<fgkNslats; slat++){
- fInefficientSlat[ch][cath][slat] = 0;
- fHitPerSlat[ch][cath][slat] = 0;
- }
- for(Int_t board=0; board<fgkNboards; board++){
- fInefficientBoard[ch][cath][board] = 0;
- fHitPerBoard[ch][cath][board] = 0;
- }
- }
+ fTrigger44.Set(fgkNcathodes);
+ fTrigger34.Set(fgkNplanes);
+
+ for(Int_t chCath=0; chCath<fgkNplanes; chCath++){
+ fInefficientSlat[chCath].Set(fgkNslats);
+ fHitPerSlat[chCath].Set(fgkNslats);
+ fInefficientBoard[chCath].Set(AliMpConstants::NofLocalBoards());
+ fHitPerBoard[chCath].Set(AliMpConstants::NofLocalBoards());
+ }
+
+ fTrigger44.Reset();
+ fTrigger34.Reset();
+
+ for(Int_t chCath=0; chCath<fgkNplanes; chCath++){
+ fInefficientSlat[chCath].Reset();
+ fHitPerSlat[chCath].Reset();
+ fInefficientBoard[chCath].Reset();
+ fHitPerBoard[chCath].Reset();
}
}
+//_____________________________________________________________________________
+void AliMUONTriggerChamberEff::InitHistos()
+{
+ //
+ /// Initialize histogram for firef pads counting.
+ //
+ const Int_t kMaxNpads[fgkNcathodes] = {GetMaxX(0)*GetMaxY(0), GetMaxX(1)*GetMaxY(1)};
+ Char_t histoName[40];
+ Char_t *cathCode[fgkNcathodes] = {"bendPlane", "nonBendPlane"};
+
+ for(Int_t cath=0; cath<fgkNcathodes; cath++){
+ sprintf(histoName, "fPadFired%s", cathCode[cath]);
+ fPadFired[cath] = new TH3F(histoName, histoName,
+ fgkNchambers, -0.5, (Float_t)fgkNchambers - 0.5,
+ fgkNslats, -0.5, (Float_t)fgkNslats - 0.5,
+ kMaxNpads[cath], -0.5, (Float_t)kMaxNpads[cath] - 0.5);
+ }
+}
+
+
//______________________________________________________________________________
Bool_t
AliMUONTriggerChamberEff::TriggerDigits(const AliMUONVTriggerStore& triggerStore,
{
if (locTrg->IsNull()) continue;
- TArrayS xyPattern[2];
+ TArrayS xyPattern[fgkNcathodes];
locTrg->GetXPattern(xyPattern[0]);
locTrg->GetYPattern(xyPattern[1]);
//_____________________________________________________________________________
Int_t AliMUONTriggerChamberEff::MatchingPad(AliMUONVDigitStore& digitStore, Int_t &detElemId,
- Float_t coor[2], Bool_t isMatch[fgkNcathodes],
- Int_t nboard[fgkNcathodes][4],
- Float_t zRealMatch[fgkNchambers], Float_t y11)
+ Float_t coor[2], Bool_t isMatch[2],
+ TArrayI nboard[2], TArrayF &zRealMatch, Float_t y11)
{
//
/// Check slat and board number of digit matching track
AliMpIntPair location = pad.GetLocation(loc);
nboard[cathode][loc] = location.GetFirst();
}
- for(Int_t loc=pad.GetNofLocations(); loc<4; loc++){
+ for(Int_t loc=pad.GetNofLocations(); loc<fgkNlocations; loc++){
nboard[cathode][loc]=-1;
}
+
+ // Fired pads info
+ Int_t currPair = ix*GetMaxY(cathode) + iy;
+ fPadFired[cathode]->Fill(ch, currSlat, currPair);
}
for(Int_t cath=0; cath<fgkNcathodes; cath++){
/// it returns the corresponding local board
//
- for(Int_t loc=0; loc<4; loc++){
+ for(Int_t loc=0; loc<fgkNlocations; loc++){
localBoard[loc]=-1;
}
Float_t xl, yl, zl;
Float_t rad2deg = 180./TMath::Pi();
Int_t chOrder[fgkNchambers] = {0,2,1,3};
- Float_t zRealMatch[fgkNchambers] = {0.0};
- Float_t correctFactor[fgkNcathodes] = {1.};
- Bool_t match[fgkNchambers][fgkNcathodes] = {{kFALSE}};
- Bool_t matchPad[fgkNcathodes]={kFALSE};
+ TArrayF zRealMatch(fgkNchambers);
+ TArrayF correctFactor(fgkNcathodes);
+ Bool_t match[fgkNchambers][fgkNcathodes];
+ Bool_t matchPad[fgkNcathodes];
+ for(Int_t cath=0; cath<fgkNcathodes; cath++){
+ matchPad[cath] = kFALSE;
+ }
- Float_t zMeanChamber[fgkNchambers];
+ TArrayF zMeanChamber(fgkNchambers);
for(Int_t ch=0; ch<fgkNchambers; ch++){
zMeanChamber[ch] = AliMUONConstants::DefaultChamberZ(10+ch);
}
- Int_t digitPerTrack[fgkNcathodes] = {0};
+ TArrayI digitPerTrack(fgkNcathodes);
- Float_t trackIntersectCh[fgkNchambers][2]={{0.0}};
+ Float_t trackIntersectCh[fgkNchambers][fgkNcathodes];
- Int_t triggeredDigits[2][fgkNchambers] = {{-1}};
+ TArrayI triggeredDigits[2];
+ for(Int_t itrack=0; itrack<2; itrack++){
+ triggeredDigits[itrack].Set(fgkNchambers);
+ triggeredDigits[itrack].Reset(-1);
+ }
+
+ TArrayI trigScheme[fgkNcathodes];
+ TArrayI slatThatTriggered[fgkNcathodes];
+ for(Int_t cath=0; cath<fgkNcathodes; cath++){
+ trigScheme[cath].Set(fgkNchambers);
+ slatThatTriggered[cath].Set(fgkNchambers);
+ }
- Int_t trigScheme[fgkNchambers][fgkNcathodes]={{0}};
- Int_t slatThatTriggered[fgkNchambers][fgkNcathodes]={{-1}};
- Int_t boardThatTriggered[fgkNchambers][fgkNcathodes][4]={{{-1}}};
- Int_t nboard[fgkNcathodes][4]={{-1}};
- Int_t ineffBoard[4]={-1};
+ Int_t boardThatTriggered[fgkNchambers][fgkNcathodes][fgkNlocations];
+ TArrayI nboard[fgkNcathodes];
+ for(Int_t cath=0; cath<fgkNcathodes; cath++){
+ nboard[cath].Set(fgkNlocations);
+ }
+ Int_t ineffBoard[fgkNlocations];
+ for(Int_t loc=0; loc<fgkNlocations; loc++){
+ ineffBoard[loc] = -1;
+ }
AliMUONDigitStoreV1 digitStore;
TriggerDigits(triggerStore,digitStore);
- for(Int_t ch=0; ch<fgkNchambers; ch++){
- for(Int_t itrack=0; itrack<2; itrack++){
- triggeredDigits[itrack][ch]=-1;
- }
- }
-
AliMUONTriggerTrack *recTrigTrack = 0x0;
TIter next(trigTrackStore.CreateIterator());
while ( ( recTrigTrack = static_cast<AliMUONTriggerTrack*>(next()) ) )
{
- for(Int_t cath=0; cath<fgkNcathodes; cath++){
- digitPerTrack[cath]=0;
+ if(!IsCleanTrack(recTrigTrack, trackStore)) {
+ if(fDebugLevel>=1) printf("\tTrack %p (%f, %f) don't match tracker track: rejected!\n",(void *)recTrigTrack,recTrigTrack->GetX11(),recTrigTrack->GetY11());
+ continue;
}
+
+ digitPerTrack.Reset();
for(Int_t ch=0; ch<fgkNchambers; ch++){
+ zRealMatch[ch] = zMeanChamber[ch];
for(Int_t cath=0; cath<fgkNcathodes; cath++){
match[ch][cath]=kFALSE;
- slatThatTriggered[ch][cath]=-1;
- for(Int_t loc=0; loc<4; loc++){
+ //slatThatTriggered[ch][cath]=-1;
+ //trigScheme[ch][cath] = 0;
+ for(Int_t loc=0; loc<fgkNlocations; loc++){
boardThatTriggered[ch][cath][loc]=-1;
}
}
}
+ for(Int_t cath=0; cath<fgkNcathodes; cath++){
+ slatThatTriggered[cath].Reset(-1);
+ trigScheme[cath].Reset();
+ }
+
Bool_t isClearEvent = kTRUE;
Bool_t doubleCountTrack = kFALSE;
- if(!IsCleanTrack(recTrigTrack, trackStore)) {
- if(fDebugLevel>=1) printf("\tTrack %p (%f, %f) don't match tracker track: rejected!\n",recTrigTrack,recTrigTrack->GetX11(),recTrigTrack->GetY11());
- continue;
- }
-
Float_t x11 = recTrigTrack->GetX11();// x position (info from non-bending plane)
Float_t y11 = recTrigTrack->GetY11();// y position (info from bending plane)
Float_t thetaX = recTrigTrack->GetThetax();
Float_t thetaY = recTrigTrack->GetThetay();
- if(fDebugLevel>=3) printf("\tTrack = %p\npos from track: (x,y) = (%f, %f), (thetaX, thetaY) = (%f, %f)\n",recTrigTrack,x11,y11,thetaX*rad2deg,thetaY*rad2deg);
-
- for(Int_t ch=0; ch<fgkNchambers; ch++) {
- zRealMatch[ch] = zMeanChamber[ch];
- for(Int_t cath=0; cath<fgkNcathodes; cath++){
- trigScheme[ch][cath] = 0;
- }
- }
+ if(fDebugLevel>=3) printf("\tTrack = %p\npos from track: (x,y) = (%f, %f), (thetaX, thetaY) = (%f, %f)\n",(void *)recTrigTrack,x11,y11,thetaX*rad2deg,thetaY*rad2deg);
for(Int_t ch=0; ch<fgkNchambers; ch++) { // chamber loop
Int_t currCh = chOrder[ch];
// => Event not clear => Reject track
if(triggeredDigits[1][currCh]<-100){
isClearEvent = kFALSE;
- if(fDebugLevel>=1) printf("Warning: track = %p (%i) matches many pads. Rejected!\n",recTrigTrack, detElemIdFromTrack);
+ if(fDebugLevel>=1) printf("Warning: track = %p (%i) matches many pads. Rejected!\n",(void *)recTrigTrack, detElemIdFromTrack);
break;
}
match[currCh][cath] = (matchPad[cath] && !isDiffLocBoard);
if(!match[currCh][cath]) continue;
digitPerTrack[cath]++;
- trigScheme[currCh][cath]++;
- slatThatTriggered[currCh][cath] = detElemIdFromTrack;
- for(Int_t loc=0; loc<4; loc++){
+ trigScheme[cath][currCh]++;
+ slatThatTriggered[cath][currCh] = detElemIdFromTrack;
+ for(Int_t loc=0; loc<fgkNlocations; loc++){
boardThatTriggered[currCh][cath][loc] = nboard[cath][loc];
}
}
Bool_t goodForBoardEff = kTRUE;
Int_t ineffSlat = -1;
Int_t ineffDetElId = -1;
- Int_t firstSlat = slatThatTriggered[0][cath]%100;
- if(firstSlat<0) firstSlat=slatThatTriggered[1][cath]%100;
+ Int_t firstSlat = slatThatTriggered[cath][0]%100;
+ if(firstSlat<0) firstSlat=slatThatTriggered[cath][1]%100;
Int_t firstBoard = boardThatTriggered[0][kBending][0];
if(firstBoard<0) firstBoard=boardThatTriggered[1][kBending][0];
for(Int_t ch=0; ch<fgkNchambers; ch++){
Bool_t isCurrChIneff = kFALSE;
- is44 *= trigScheme[ch][cath];
- Int_t currSlat = slatThatTriggered[ch][cath]%100;
+ is44 *= trigScheme[cath][ch];
+ Int_t currSlat = slatThatTriggered[cath][ch]%100;
if(currSlat<0){
ineffDetElId = DetElemIdFromPos(trackIntersectCh[ch][0], trackIntersectCh[ch][1], 11+ch, cath);
currSlat = ineffDetElId%100;
if(currSlat!=firstSlat)goodForSlatEff=kFALSE;
Bool_t atLeastOneLoc=kFALSE;
if(isCurrChIneff) LocalBoardFromPos(trackIntersectCh[ch][0], trackIntersectCh[ch][1], ineffDetElId, cath, ineffBoard);
- for(Int_t loc=0; loc<4; loc++){
+ for(Int_t loc=0; loc<fgkNlocations; loc++){
Int_t currBoard = boardThatTriggered[ch][cath][loc];
if(isCurrChIneff) currBoard = ineffBoard[loc];
if(currBoard==firstBoard){
if(fDebugLevel>=1)printf("Trigger44[%i] = %i\n",cath,fTrigger44[cath]);
if(goodForSlatEff){
for(Int_t ch=0; ch<fgkNchambers; ch++){
- fHitPerSlat[ch][cath][firstSlat]++;
- if(fDebugLevel>=1)printf("Slat that triggered = %i\n",slatThatTriggered[ch][cath]);
+ Int_t chCath = fgkNchambers*cath + ch;
+ fHitPerSlat[chCath][firstSlat]++;
+ if(fDebugLevel>=1)printf("Slat that triggered = %i\n",slatThatTriggered[cath][ch]);
if(goodForBoardEff && firstBoard>0){
- fHitPerBoard[ch][cath][firstBoard-1]++;
+ fHitPerBoard[chCath][firstBoard-1]++;
if(fDebugLevel>=1)printf("Board that triggered = %i\n",firstBoard);
}
- else if(fDebugLevel>=1) printf("Track = %p: Particle crossed different boards: rejected!\n",recTrigTrack);
+ else if(fDebugLevel>=1) printf("Track = %p: Particle crossed different boards: rejected!\n",(void *)recTrigTrack);
}
}
- else if(fDebugLevel>=1) printf("Track = %p: Particle crossed different slats: rejected!\n",recTrigTrack);
- //cout<<"fTrigger44["<<cath<<"] = "<<fTrigger44[cath]<<"\tfHitPerSlat["<<0<<"]["<<cath<<"]["<<firstSlat<<"] = "<<fHitPerSlat[0][cath][firstSlat]<<"\tfHitPerBoard["<<0<<"]["<<cath<<"]["<<firstBoard-1<<"] = "<<fHitPerBoard[0][cath][firstBoard-1]<<endl; //REMEMBER TO CUT
+ else if(fDebugLevel>=1) printf("Track = %p: Particle crossed different slats: rejected!\n",(void *)recTrigTrack);
}
// Trigger 3/4
if(ineffDetElId>0){
Int_t ineffCh = ineffDetElId/100-11;
- fTrigger34[ineffCh][cath]++;
- if(fDebugLevel>=1) printf("Trigger34[%i][%i] = %i\n",ineffCh,cath,fTrigger34[ineffCh][cath]);
+ Int_t chCath = fgkNchambers*cath + ineffCh;
+ fTrigger34[chCath]++;
+ if(fDebugLevel>=1) printf("Trigger34[%i] = %i\n",chCath,fTrigger34[chCath]);
if(goodForSlatEff){
if(fDebugLevel>=1) printf("Slat non efficient = %i\n",ineffDetElId);
- fInefficientSlat[ineffCh][cath][ineffSlat]++;
+ fInefficientSlat[chCath][ineffSlat]++;
if(goodForBoardEff && firstBoard>0){
if(fDebugLevel>=1) printf("Board non efficient = %i\n",firstBoard);
- fInefficientBoard[ineffCh][cath][firstBoard-1]++;
+ fInefficientBoard[chCath][firstBoard-1]++;
}
- else if(fDebugLevel>=1) printf("Track = %p: Particle crossed different boards: rejected!\n",recTrigTrack);
+ else if(fDebugLevel>=1) printf("Track = %p: Particle crossed different boards: rejected!\n",(void *)recTrigTrack);
}
- else if(fDebugLevel>=1) printf("Track = %p: Particle crossed different slats: rejected!\n",recTrigTrack);
- //cout<<"fTrigger34["<<ineffCh<<"]["<<cath<<"] = "<<fTrigger34[ineffCh][cath]<<"\tfInefficientSlat["<<ineffCh<<"]["<<cath<<"]["<<ineffSlat<<"] = "<<fInefficientSlat[ineffCh][cath][ineffSlat]<<"\tfInefficientBoard["<<ineffCh<<"]["<<cath<<"]["<<firstBoard-1<<"] = "<<fInefficientBoard[ineffCh][cath][firstBoard-1]<<endl; //REMEMBER TO CUT
+ else if(fDebugLevel>=1) printf("Track = %p: Particle crossed different slats: rejected!\n",(void *)recTrigTrack);
}
} // end loop on cathodes
}
else if(doubleCountTrack){
if(fDebugLevel>=1)
- printf("\n\tTrack = %p: \nDouble Count Track: Track rejected!\n",recTrigTrack);
+ printf("\n\tTrack = %p: \nDouble Count Track: Track rejected!\n",(void *)recTrigTrack);
}
} // end trigger tracks loop
}
//_____________________________________________________________________________
-void AliMUONTriggerChamberEff::WriteEfficiencyMap(const char* outputDir)
+void AliMUONTriggerChamberEff::GetEfficiencyHistos(TList &countList, TList &noCountList)
{
- //
- /// Writes information on calculated efficiency.
- /// It writes: triggerChamberEff.root file containing efficiency histograms.
- //
-
- char *cathCode[fgkNcathodes] = {"bendPlane", "nonBendPlane"};
-
- char outFileName[100];
-
- sprintf(outFileName, "%s/MUON.TriggerEfficiencyMap.root",outputDir);
- TFile *outputHistoFile = new TFile(outFileName,"RECREATE");
- TDirectory *dir = gDirectory;
-
- enum {kSlatIn11, kSlatIn12, kSlatIn13, kSlatIn14, kChamberEff};
- char *yAxisTitle = "trigger efficiency (a.u.)";
- char *xAxisTitle = "chamber";
-
- TH1F *histo[fgkNcathodes][fgkNchambers+1];
- TH1F *histoBoard[fgkNcathodes][fgkNchambers];
-
- // ADDED for check
- enum {allChEff, chNonEff, numOfHistoTypes};
- char *histoTypeName[numOfHistoTypes] = {"CountInCh", "NonCountInCh"};
- char *histoTypeTitle[numOfHistoTypes] = {"counted", "non counted"};
- TH1F *histoCheckSlat[fgkNcathodes][fgkNchambers][numOfHistoTypes];
- TH1F *histoCheckBoard[fgkNcathodes][fgkNchambers][numOfHistoTypes];
- // end ADDED for check
-
- char histoName[40];
- char histoTitle[90];
-
- for(Int_t cath=0; cath<fgkNcathodes; cath++){
- for(Int_t ch=0; ch<fgkNchambers+1; ch++){
- if(ch==kChamberEff){
- sprintf(histoName, "%sChamberEff", cathCode[cath]);
- sprintf(histoTitle, "Chamber efficiency %s", cathCode[cath]);
- histo[cath][ch] = new TH1F(histoName, histoTitle, fgkNchambers, 11-0.5, 15-0.5);
- histo[cath][ch]->SetXTitle(xAxisTitle);
- histo[cath][ch]->SetYTitle(yAxisTitle);
- histo[cath][ch]->GetXaxis()->SetNdivisions(fgkNchambers);
- }
- else {
- sprintf(histoName, "%sSlatEffChamber%i", cathCode[cath], 11+ch);
- sprintf(histoTitle, "Chamber %i: slat efficiency %s", 11+ch, cathCode[cath]);
- histo[cath][ch] = new TH1F(histoName, histoTitle, fgkNslats, 0-0.5, fgkNslats-0.5);
- histo[cath][ch]->SetXTitle("slat");
- histo[cath][ch]->SetYTitle(yAxisTitle);
- histo[cath][ch]->GetXaxis()->SetNdivisions(fgkNslats);
-
- sprintf(histoName, "%sBoardEffChamber%i", cathCode[cath], 11+ch);
- sprintf(histoTitle, "Chamber %i: board efficiency %s", 11+ch, cathCode[cath]);
- histoBoard[cath][ch] = new TH1F(histoName, histoTitle, fgkNboards, 1-0.5, fgkNboards+1.-0.5);
- histoBoard[cath][ch]->SetXTitle("boards");
- histoBoard[cath][ch]->SetYTitle(yAxisTitle);
- histoBoard[cath][ch]->GetXaxis()->SetNdivisions(fgkNboards);
-
- // ADDED for check
- for(Int_t hType=0; hType<numOfHistoTypes; hType++){
- sprintf(histoName, "%sSlat%s%i", cathCode[cath], histoTypeName[hType], 11+ch);
- sprintf(histoTitle, "Chamber %i: slat %s %s", 11+ch, histoTypeTitle[hType], cathCode[cath]);
- histoCheckSlat[cath][ch][hType] = new TH1F(histoName, histoTitle, fgkNslats, 0-0.5, fgkNslats-0.5);
- histoCheckSlat[cath][ch][hType]->SetXTitle("slat");
- histoCheckSlat[cath][ch][hType]->SetYTitle(yAxisTitle);
- histoCheckSlat[cath][ch][hType]->GetXaxis()->SetNdivisions(fgkNslats);
-
- sprintf(histoName, "%sBoard%s%i", cathCode[cath], histoTypeName[hType], 11+ch);
- sprintf(histoTitle, "Chamber %i: board %s %s", 11+ch, histoTypeTitle[hType], cathCode[cath]);
- histoCheckBoard[cath][ch][hType] = new TH1F(histoName, histoTitle, fgkNboards, 1-0.5, fgkNboards+1.-0.5);
- histoCheckBoard[cath][ch][hType]->SetXTitle("boards");
- histoCheckBoard[cath][ch][hType]->SetYTitle(yAxisTitle);
- histoCheckBoard[cath][ch][hType]->GetXaxis()->SetNdivisions(fgkNboards);
- }
- // end ADDED for check
- }
- }
+ //
+ /// Gets lists of histograms containing number of 4/4 and 3/4
+ /// for further efficiency calculations.
+ //
+
+ char *cathCode[fgkNcathodes] = {"bendPlane", "nonBendPlane"};
+
+ char *yAxisTitle = "counts";
+
+ const Int_t kNumOfBoards = AliMpConstants::NofLocalBoards();
+
+ enum {kAllChEff, kChNonEff, kNumOfHistoTypes};
+ char *histoTypeName[kNumOfHistoTypes] = {"CountInCh", "NonCountInCh"};
+ char *histoTypeTitle[kNumOfHistoTypes] = {"counted", "non counted"};
+ TH1F *histoCheckChamber[fgkNcathodes][kNumOfHistoTypes];
+ TH1F *histoCheckSlat[fgkNplanes][kNumOfHistoTypes];
+ TH1F *histoCheckBoard[fgkNplanes][kNumOfHistoTypes];
+
+ char histoName[40];
+ char histoTitle[90];
+
+ for(Int_t cath=0; cath<fgkNcathodes; cath++){
+ for(Int_t hType=0; hType<kNumOfHistoTypes; hType++){
+ sprintf(histoName, "%sChamber%s", cathCode[cath], histoTypeName[hType]);
+ sprintf(histoTitle, "%s %s", histoTypeTitle[hType], cathCode[cath]);
+ histoCheckChamber[cath][hType] = new TH1F(histoName, histoTitle, fgkNchambers, 11-0.5, 11+fgkNchambers-0.5);
+ histoCheckChamber[cath][hType]->SetXTitle("chamber");
+ histoCheckChamber[cath][hType]->SetYTitle(yAxisTitle);
+ histoCheckChamber[cath][hType]->GetXaxis()->SetNdivisions(fgkNchambers);
}
-
- Float_t efficiency, efficiencyError;
- Int_t bin;
-
- for(Int_t cath=0; cath<fgkNcathodes; cath++){
- for(Int_t ch=0; ch<fgkNchambers; ch++){
- for(Int_t slat=0; slat<fgkNslats; slat++){
- CalculateEfficiency(fHitPerSlat[ch][cath][slat], fHitPerSlat[ch][cath][slat]+fInefficientSlat[ch][cath][slat], efficiency, efficiencyError, kFALSE);
- bin = histo[cath][ch]->FindBin(slat);
- histo[cath][ch]->SetBinContent(bin, efficiency);
- histo[cath][ch]->SetBinError(bin, efficiencyError);
-
- // ADDED for check
- histoCheckSlat[cath][ch][allChEff]->SetBinContent(bin, fHitPerSlat[ch][cath][slat]);
- histoCheckSlat[cath][ch][chNonEff]->SetBinContent(bin, fInefficientSlat[ch][cath][slat]);
- }
- CalculateEfficiency(fTrigger44[cath], fTrigger34[ch][cath]+fTrigger44[cath], efficiency, efficiencyError, kFALSE);
- bin = histo[cath][ch]->FindBin(11+ch);
- histo[cath][kChamberEff]->SetBinContent(bin, efficiency);
- histo[cath][kChamberEff]->SetBinError(bin, efficiencyError);
-
- for(Int_t board=0; board<fgkNboards; board++){
- CalculateEfficiency(fHitPerBoard[ch][cath][board], fHitPerBoard[ch][cath][board]+fInefficientBoard[ch][cath][board], efficiency, efficiencyError, kFALSE);
- bin = histoBoard[cath][ch]->FindBin(board+1);
- histoBoard[cath][ch]->SetBinContent(bin, efficiency);
- histoBoard[cath][ch]->SetBinError(bin, efficiencyError);
-
- // ADDED for check
- histoCheckBoard[cath][ch][allChEff]->SetBinContent(bin, fHitPerBoard[ch][cath][board]);
- histoCheckBoard[cath][ch][chNonEff]->SetBinContent(bin, fInefficientBoard[ch][cath][board]);
- }
- }
+
+ for(Int_t ch=0; ch<fgkNchambers; ch++){
+ Int_t chCath = fgkNchambers*cath + ch;
+ for(Int_t hType=0; hType<kNumOfHistoTypes; hType++){
+ sprintf(histoName, "%sSlat%s%i", cathCode[cath], histoTypeName[hType], 11+ch);
+ sprintf(histoTitle, "Chamber %i: slat %s %s", 11+ch, histoTypeTitle[hType], cathCode[cath]);
+ histoCheckSlat[chCath][hType] = new TH1F(histoName, histoTitle, fgkNslats, 0-0.5, fgkNslats-0.5);
+ histoCheckSlat[chCath][hType]->SetXTitle("slat");
+ histoCheckSlat[chCath][hType]->SetYTitle(yAxisTitle);
+ histoCheckSlat[chCath][hType]->GetXaxis()->SetNdivisions(fgkNslats);
+
+ sprintf(histoName, "%sBoard%s%i", cathCode[cath], histoTypeName[hType], 11+ch);
+ sprintf(histoTitle, "Chamber %i: board %s %s", 11+ch, histoTypeTitle[hType], cathCode[cath]);
+ histoCheckBoard[chCath][hType] = new TH1F(histoName, histoTitle, kNumOfBoards, 1-0.5, kNumOfBoards+1.-0.5);
+ histoCheckBoard[chCath][hType]->SetXTitle("boards");
+ histoCheckBoard[chCath][hType]->SetYTitle(yAxisTitle);
+ histoCheckBoard[chCath][hType]->GetXaxis()->SetNdivisions(kNumOfBoards);
+ }
}
+ }
-// write all histos
- outputHistoFile->cd();
- dir->GetList()->Write();
- outputHistoFile->Close();
-}
-
-
-//_____________________________________________________________________________
-void AliMUONTriggerChamberEff::WriteEfficiencyMapTxt(const char* outputDir)
-{
- //
- /// Writes the calculated efficiency in the text file efficiencyCells.dat
- ///
- /// The file can be further put in $ALICE_ROOT/MUON/data
- /// and used to run simulations with measured trigger chamber efficiencies.
- //
+ Int_t bin;
- Int_t effOutWidth=4;
-
- Float_t efficiency, efficiencyError;
+ for(Int_t cath=0; cath<fgkNcathodes; cath++){
+ for(Int_t ch=0; ch<fgkNchambers; ch++){
+ Int_t chCath = fgkNchambers*cath + ch;
+ for(Int_t slat=0; slat<fgkNslats; slat++){
+ bin = histoCheckSlat[chCath][kAllChEff]->FindBin(slat);
+ histoCheckSlat[chCath][kAllChEff]->SetBinContent(bin, fHitPerSlat[chCath][slat]);
+ histoCheckSlat[chCath][kChNonEff]->SetBinContent(bin, fInefficientSlat[chCath][slat]);
+ }
+ bin = histoCheckChamber[cath][kAllChEff]->FindBin(11+ch);
+ histoCheckChamber[cath][kAllChEff]->SetBinContent(bin, fTrigger44[cath]);
+ histoCheckChamber[cath][kChNonEff]->SetBinContent(bin, fTrigger34[chCath]);
+
+ for(Int_t board=0; board<kNumOfBoards; board++){
+ bin = histoCheckBoard[chCath][kAllChEff]->FindBin(board+1);
+ histoCheckBoard[chCath][kAllChEff]->SetBinContent(bin, fHitPerBoard[chCath][board]);
+ histoCheckBoard[chCath][kChNonEff]->SetBinContent(bin, fInefficientBoard[chCath][board]);
+ }
+ }
+ }
- Int_t aCapo[] = {16, 38, 60, 76, 92, 108, 117, 133, 155, 177, 193, 209, 225, 234};
+ for(Int_t cath=0; cath<fgkNcathodes; cath++){
+ countList.Add(histoCheckChamber[cath][kAllChEff]);
+ noCountList.Add(histoCheckChamber[cath][kChNonEff]);
+ }
- char filename[70];
- sprintf(filename, "%s/efficiencyCells.dat", outputDir);
- ofstream outFile(filename);
- outFile << "localBoards" << endl;
+ for(Int_t cath=0; cath<fgkNcathodes; cath++){
for(Int_t ch=0; ch<fgkNchambers; ch++){
- //Print information
- outFile << "\n\ndetElemId:\t" << 11+ch;
- outFile << "00";
- for(Int_t cath=0; cath<fgkNcathodes; cath++){
- outFile << "\n cathode:\t" << cath << endl;
- Int_t currLine=0;
- for(Int_t board=0; board<fgkNboards; board++){
+ Int_t chCath = fgkNchambers*cath + ch;
+ countList.Add(histoCheckSlat[chCath][kAllChEff]);
+ noCountList.Add(histoCheckSlat[chCath][kChNonEff]);
+ }
+ }
- if(board==aCapo[currLine]){
- outFile << endl;
- currLine++;
- }
- CalculateEfficiency(fHitPerBoard[ch][cath][board], fHitPerBoard[ch][cath][board]+fInefficientBoard[ch][cath][board], efficiency, efficiencyError, kFALSE);
- outFile << " " << setw(effOutWidth) << efficiency;
- }// loop on boards
- outFile << endl;
- }// loop on cathodes
- }// loop on chambers
+ for(Int_t cath=0; cath<fgkNcathodes; cath++){
+ for(Int_t ch=0; ch<fgkNchambers; ch++){
+ Int_t chCath = fgkNchambers*cath + ch;
+ countList.Add(histoCheckBoard[chCath][kAllChEff]);
+ noCountList.Add(histoCheckBoard[chCath][kChNonEff]);
+ }
+ }
}
while ( ( track = static_cast<AliMUONTrack*>(next()) ) )
{
- trackParam = *((AliMUONTrackParam*) (track->GetTrackParamAtHit()->Last()));
+ trackParam = *((AliMUONTrackParam*) (track->GetTrackParamAtCluster()->Last()));
AliMUONTrackExtrap::ExtrapToZ(&trackParam, AliMUONConstants::DefaultChamberZ(10)); // extrap to 1st trigger chamber
xTrack = trackParam.GetNonBendingCoor();
//_____________________________________________________________________________
void AliMUONTriggerChamberEff::SaveInESDFile()
{
- //
- /// Store AliMUONTriggerChamberEff in esd file
- //
- TDirectory *dir = gDirectory;
- TFile *logFile = 0x0;
- TSeqCollection *list = gROOT->GetListOfFiles();
- Int_t n = list->GetEntries();
- for(Int_t i=0; i<n; i++) {
- logFile = (TFile*)list->At(i);
- if (strstr(logFile->GetName(), "AliESDs.root")) break;
+ //
+ /// Store AliMUONTriggerChamberEff in esd file
+ //
+ TList countHistoList, noCountHistoList, firedPads;
+ for(Int_t cath=0; cath<fgkNcathodes; cath++){
+ firedPads.Add(fPadFired[cath]->Clone());
+ }
+ TFile *prova = new TFile("prova.root", "recreate");
+ prova->cd();
+ firedPads.Write();
+ prova->Close();
+
+ GetEfficiencyHistos(countHistoList, noCountHistoList);
+ AliMUONTriggerEfficiencyCells *effMap =
+ new AliMUONTriggerEfficiencyCells(&countHistoList, &noCountHistoList);
+ effMap->SetFiredStrips(&firedPads);
+
+ TDirectory *dir = gDirectory;
+
+ TFile *logFile = 0x0;
+ Bool_t reopenFile = kFALSE;
+ Char_t *esdFileName = "AliESDs.root";
+
+ TSeqCollection *list = gROOT->GetListOfFiles();
+ Int_t n = list->GetEntries();
+ for(Int_t i=0; i<n; i++) {
+ logFile = (TFile*)list->At(i);
+ if (strstr(logFile->GetName(), esdFileName)) break;
+ logFile = 0x0;
+ }
+
+ if(!logFile) {
+ AliWarning(Form("%s already stored on disk. Re-opening in update mode.",esdFileName));
+ logFile = new TFile(esdFileName, "update");
+ reopenFile = kTRUE;
+ }
+
+ if(logFile){
+ logFile->cd();
+ TTree *esdTree = (TTree*)logFile->Get("esdTree;1");
+ if(esdTree){
+ if(!esdTree->GetUserInfo()->FindObject("AliMUONTriggerEfficiencyCells")){
+ AliInfo(Form("Adding AliMUONTriggerEfficiencyCells in %s",esdTree->GetName()));
+ esdTree->GetUserInfo()->Add(effMap);
+ esdTree->Write(esdTree->GetName(),TObject::kOverwrite);
+ }
}
- if(logFile){
- TTree *esdTree = (TTree*)logFile->Get("esdTree");
- if(esdTree){
- if(!esdTree->GetUserInfo()->FindObject("AliMUONTriggerChamberEff")){
- AliInfo(Form("Adding AliMUONTrigChamberEff in %s",logFile->GetName()));
- esdTree->GetUserInfo()->Add(this->Clone());
- esdTree->Write("",TObject::kOverwrite);
- }
- }
+ if(reopenFile){
+ logFile->Close();
}
- dir->cd();
+ }
+ dir->cd();
+}
+
+
+//_____________________________________________________________________________
+void AliMUONTriggerChamberEff::CheckConstants() const
+{
+/// Check consistence of redefined constants
+
+ assert(fgkNcathodes == AliMpConstants::NofCathodes());
+ assert(fgkNchambers == AliMpConstants::NofTriggerChambers());
+ assert(fgkNplanes == AliMpConstants::NofTriggerChambers() * fgkNcathodes);
}