#include <TGTab.h>
#include <TRootEmbeddedCanvas.h>
#include <TBox.h>
-#include <TClonesArray.h>
#include <TPave.h>
#include <TPaveText.h>
#include <TStyle.h>
#include <TObjArray.h>
-#include "AliRun.h"
+#include "AliLoader.h"
+#include "AliRunLoader.h"
-#include "AliMUON.h"
#include "AliMUONVDigit.h"
#include "AliMpSegmentation.h"
#include "AliMpVSegmentation.h"
#include "AliMUONGeometryTransformer.h"
+#include "AliMUONMCDataInterface.h"
#include "AliMUONTriggerGUIboard.h"
#include "AliMUONTriggerGUIdimap.h"
-#include "AliMUONVDigitStore.h"
+#include "AliMUONDigitStoreV1.h"
+
+#include <cstdio>
/// \cond CLASSIMP
ClassImp(AliMUONTriggerGUIdimap)
/// \endcond
//__________________________________________________________________________
-AliMUONTriggerGUIdimap::AliMUONTriggerGUIdimap(AliLoader *loader, TObjArray *boards, const TGWindow *p, const TGWindow *main, UInt_t w, UInt_t h)
+AliMUONTriggerGUIdimap::AliMUONTriggerGUIdimap(TObjArray *boards, const TGWindow *p, const TGWindow *main, UInt_t w, UInt_t h)
: TGFrame(0),
fMain(0),
fLoader(0),
+ fMCDataInterface(0),
+ fRawDigitStore(0),
fBoards(0),
fIsOn(0)
{
/// frame constructor
- fLoader = loader;
fIsOn = kTRUE;
fBoards = boards;
fMain->MapWindow();
- DrawMaps(11);
- DrawMaps(12);
- DrawMaps(13);
- DrawMaps(14);
-
}
//__________________________________________________________________________
}
+//__________________________________________________________________________
+void AliMUONTriggerGUIdimap::DrawAllMaps()
+{
+ /// draw maps
+
+ if (fLoader == 0x0) {
+ //return;
+ }
+ if (fMCDataInterface == 0x0) {
+ //return;
+ }
+
+ DrawMaps(11);
+ DrawMaps(12);
+ DrawMaps(13);
+ DrawMaps(14);
+
+}
+
//__________________________________________________________________________
void AliMUONTriggerGUIdimap::DrawMaps(Int_t chamber)
{
/// draw the digits map for chamber-
- TString mapspath = gSystem->Getenv("ALICE_ROOT");
- mapspath.Append("/MUON/data");
+ Bool_t drawDigits = kTRUE;
+ Bool_t drawDigitsRaw = kTRUE;
+ if (fLoader == 0x0) {
+ drawDigits = kFALSE;
+ }
+ if (fRawDigitStore == 0x0) {
+ drawDigitsRaw = kFALSE;
+ }
+
+ AliMUONTriggerGUIboard *board;
TCanvas *canvas = fEc[chamber-11]->GetCanvas();
canvas->cd();
canvas->Clear();
- AliMpPad mpad;
-
- AliRunLoader *runLoader = fLoader->GetRunLoader();
- gAlice = runLoader->GetAliRun();
- AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
- const AliMUONGeometryTransformer* kGeomTransformer = pMUON->GetGeometryTransformer();
-
- fLoader->LoadDigits("READ");
- TTree* treeD = fLoader->TreeD();
- AliMUONVDigitStore* digitStore = AliMUONVDigitStore::Create(*treeD);
-
TPaveText *label;
TBox *boxd;
- Char_t fntxt[6], name[8], cln[2];
+ Char_t cln[4]; // must be 4 long - room for terminating '\0'
Int_t detElemId, cathode, ix, iy, charge, color;
- Int_t side, col, line, nbx;
Int_t holdS, holdL, holdC;
- Float_t xCenter, yCenter, zCenter, xWidth, yWidth, holdXC, holdYC;
+ Float_t xCenter, yCenter, xWidth, yWidth, holdXC, holdYC;
Float_t xMin, xMax, yMin, yMax;
Float_t ptx1, ptx2, pty1, pty2;
Float_t xpmin, xpmax, ypmin, ypmax;
// draw the boards
- sprintf(fntxt,"%s/guimapp%2d.txt",mapspath.Data(),chamber);
- FILE *ftxt = fopen(fntxt,"r");
-
for (Int_t ib = 0; ib < kNBoards; ib++) {
- fscanf(ftxt,"%d %d %d %d %f %f %f %f %f %s \n",
- &side,&col,&line,&nbx,
- &xCenter,&yCenter,&xWidth,&yWidth,&zCenter,
- &name[0]);
+ board = (AliMUONTriggerGUIboard*)fBoards->At(ib);
- //printf("%d %d %d %d %f %f %f %f %f %s \n",side,col,line,nbx,xCenter,yCenter,xWidth,yWidth,zCenter,name);
+ holdS = board->GetSide();
+ holdC = board->GetCol();
+ holdL = board->GetLine();
- holdS = side;
- holdC = col;
- holdL = line;
+ xCenter = board->GetXCenter(chamber-11);
+ yCenter = board->GetYCenter(chamber-11);
+ xWidth = board->GetXWidth(chamber-11);
+ yWidth = board->GetYWidth(chamber-11);
holdXC = xCenter;
holdYC = yCenter;
if (holdL == 9) {
- sprintf(cln,"C%1d",holdC);
+ snprintf(cln,4,"C%1d",holdC);
ptx1 = holdXC - lWidth;
ptx2 = holdXC + lWidth;
}
if (holdL == 1) {
- sprintf(cln,"C%1d",holdC);
+ snprintf(cln,4,"C%1d",holdC);
ptx1 = holdXC - lWidth;
ptx2 = holdXC + lWidth;
}
if (holdS == 0 && holdC == 7) {
- sprintf(cln,"L%1d",holdL);
+ snprintf(cln,4,"L%1d",holdL);
ptx1 = -1.07*frameXmax - lWidth;
ptx2 = -1.07*frameXmax + lWidth;
}
if (holdS == 1 && holdC == 7) {
- sprintf(cln,"L%1d",holdL);
+ snprintf(cln,4,"L%1d",holdL);
ptx1 = +1.07*frameXmax - lWidth;
ptx2 = +1.07*frameXmax + lWidth;
}
- fclose(ftxt);
-
// draw digits set from the board GUI
- AliMUONTriggerGUIboard *board;
Int_t imt = chamber -11;
Int_t nStripX, nStripY;
TBox *box;
}
- // draw the digits
+ // draw the digits from galice
- TIter next(digitStore->CreateIterator());
- AliMUONVDigit* mdig;
-
- while ( ( mdig = static_cast<AliMUONVDigit*>(next()) ) )
- {
- cathode = mdig->Cathode()+1;
-
- ix=mdig->PadX();
- iy=mdig->PadY();
- detElemId=mdig->DetElemId();
- charge = (Int_t)mdig->Charge();
- color = 261+5*(charge-1);
- if (color > 282) color = 282;
+ if (drawDigits || drawDigitsRaw) {
+
+ AliMUONGeometryTransformer transformer;
+ transformer.LoadGeometryData("transform.dat");
- const AliMpVSegmentation* seg2 = AliMpSegmentation::Instance()->GetMpSegmentation(detElemId,AliMp::GetCathodType(cathode-1));
+ AliMUONVDigitStore *digitStore = 0x0;
- mpad = seg2->PadByIndices(AliMpIntPair(ix,iy),kTRUE);
+ if (drawDigits) {
+ AliRunLoader *runLoader = fLoader->GetRunLoader();
+ digitStore = fMCDataInterface->DigitStore(runLoader->GetEventNumber());
+ }
+ if (drawDigitsRaw) {
+ digitStore = fRawDigitStore;
+ }
- // get the pad position and dimensions
- Float_t xlocal1 = mpad.Position().X();
- Float_t ylocal1 = mpad.Position().Y();
- Float_t xlocal2 = mpad.Dimensions().X();
- Float_t ylocal2 = mpad.Dimensions().Y();
+ TIter next(digitStore->CreateIterator());
+ AliMUONVDigit* mdig;
- kGeomTransformer->Local2Global(detElemId, xlocal1, ylocal1, 0, xg1, yg1, zg1);
- // (no transformation for pad dimensions)
- xg2 = xlocal2;
- yg2 = ylocal2;
-
- // transform in the monitor coordinate system
- //xpmin = -(xg1+xg2);
- //xpmax = -(xg1-xg2);
- //ypmin = -(yg2-yg1);
- //ypmax = +(yg2+yg1);
- // ALICE SC
- xpmin = +(xg1-xg2);
- xpmax = +(xg1+xg2);
- ypmin = -(yg2-yg1);
- ypmax = +(yg2+yg1);
-
- boxd = new TBox(xpmin,ypmin,xpmax,ypmax);
- boxd->SetBit(kCannotPick);
- boxd->SetFillStyle(1001);
- boxd->SetFillColor(2);
- boxd->Draw();
+ while ( ( mdig = static_cast<AliMUONVDigit*>(next()) ) ) {
+
+ cathode = mdig->Cathode()+1;
+
+ ix=mdig->PadX();
+ iy=mdig->PadY();
+ detElemId=mdig->DetElemId();
+ charge = (Int_t)mdig->Charge();
+ color = 261+5*(charge-1);
+ if (color > 282) color = 282;
+
+ if (detElemId/100 != chamber) continue;
+
+ const AliMpVSegmentation* seg2 = AliMpSegmentation::Instance()->GetMpSegmentation(detElemId,AliMp::GetCathodType(cathode-1));
+
+ AliMpPad mpad = seg2->PadByIndices(ix,iy,kTRUE);
+
+ // get the pad position and dimensions
+ Float_t xlocal1 = mpad.GetPositionX();
+ Float_t ylocal1 = mpad.GetPositionY();
+ Float_t xlocal2 = mpad.GetDimensionX();
+ Float_t ylocal2 = mpad.GetDimensionY();
+
+ transformer.Local2Global(detElemId, xlocal1, ylocal1, 0, xg1, yg1, zg1);
+ // (no transformation for pad dimensions)
+ xg2 = xlocal2;
+ yg2 = ylocal2;
+
+ // transform in the monitor coordinate system
+ // ALICE SC
+ xpmin = +(xg1-xg2);
+ xpmax = +(xg1+xg2);
+ ypmin = -(yg2-yg1);
+ ypmax = +(yg2+yg1);
+
+ boxd = new TBox(xpmin,ypmin,xpmax,ypmax);
+ boxd->SetBit(kCannotPick);
+ boxd->SetFillStyle(1001);
+ boxd->SetFillColor(2);
+ boxd->Draw();
+
+ } // end digits loop
- } // end digits loop
-
- delete digitStore;
+ } // end draw digits
+
canvas->Modified();
canvas->Update();