ClassImp(MUONChamber)
//______________________________________________________________________
-MUONChamber::MUONChamber(const Text_t* n, const Text_t* t) :
+MUONChamber::MUONChamber(Int_t id, const Text_t* n, const Text_t* t) :
Reve::RenderElement(fFrameColor),
TNamed(n,t),
fMUONData(0),
fChamberID(0),
fQuadSet1(n,t),
fQuadSet2(n,t),
+fPointSet1(n),
+fPointSet2(n),
fThreshold(0),
-fMaxVal(1024)
+fMaxVal(4096),
+fClusterSize(5),
+fHitSize(5)
{
//
// constructor
//
+ Char_t name[256];
+ if (id < 10) {
+ sprintf(name,"Chamber %02d (trac)",id);
+ } else {
+ sprintf(name,"Chamber %02d (trig)",id);
+ }
+ SetName(name);
+
ComputeBBox();
}
BBoxInit();
#endif
- fBBox[0] = -300.0;
- fBBox[1] = +300.0;
- fBBox[2] = -300.0;
- fBBox[3] = +300.0;
+ fBBox[0] = - 400.0;
+ fBBox[1] = + 400.0;
+ fBBox[2] = - 400.0;
+ fBBox[3] = + 400.0;
fBBox[4] = -1800.0;
- fBBox[5] = -500.0;
+ fBBox[5] = + 500.0;
Float_t* b1 = fQuadSet1.AssertBBox();
for(Int_t i=0; i<6; ++i) { b1[i] = fBBox[i]; }
Float_t* b2 = fQuadSet2.AssertBBox();
for(Int_t i=0; i<6; ++i) { b2[i] = fBBox[i]; }
+ Float_t* b3 = fPointSet1.AssertBBox();
+ for(Int_t i=0; i<6; ++i) { b3[i] = fBBox[i]; }
+ Float_t* b4 = fPointSet2.AssertBBox();
+ for(Int_t i=0; i<6; ++i) { b4[i] = fBBox[i]; }
}
}
+//______________________________________________________________________
+void MUONChamber::SetClusterSize(Int_t size)
+{
+ //
+ // cluster point size
+ //
+
+ fClusterSize = TMath::Max(1, size);
+ IncRTS();
+
+}
+
+//______________________________________________________________________
+void MUONChamber::SetHitSize(Int_t size)
+{
+ //
+ // hit point size
+ //
+
+ fHitSize = TMath::Max(1, size);
+ IncRTS();
+
+}
+
//______________________________________________________________________
void MUONChamber::SetupColor(Int_t val, UChar_t* pixel) const
{
fQuadSet1.Quads().clear();
fQuadSet2.Quads().clear();
+ fPointSet1.Reset();
+ fPointSet2.Reset();
MUONChamberData* data = GetChamberData();
Float_t *buffer;
- Float_t x0, y0, x1, y1, z;
- Int_t charge, cathode;
+ Float_t x0, y0, x1, y1, z, clsq;
+ Int_t charge, cathode, nDigits, nClusters, nHits, oldSize, ic1, ic2;
+ Double_t clsX, clsY, clsZ;
+ Float_t hitX, hitY, hitZ;
+
if (data != 0) {
SetupColorArray();
- Int_t ndigits = data->GetNDigits();
+ // digits
+
+ nDigits = data->GetNDigits();
- for (Int_t id = 0; id < ndigits; id++) {
+ for (Int_t id = 0; id < nDigits; id++) {
buffer = data->GetDigitBuffer(id);
charge = (Int_t)buffer[5];
cathode = (Int_t)buffer[6];
+ if (charge <= fThreshold) continue;
+
if (cathode == 0) {
fQuadSet1.Quads().push_back(Reve::Quad());
} // end digits loop
- }
+ // clusters
+
+ nClusters = data->GetNClusters()/2; // only one cathode plane
+ oldSize = fPointSet1.GrowFor(nClusters);
+ ic1 = ic2 = 0;
+ for (Int_t ic = 0; ic < (nClusters*2); ic++) {
+
+ buffer = data->GetClusterBuffer(ic);
+
+ clsX = (Double_t)buffer[0];
+ clsY = (Double_t)buffer[1];
+ clsZ = (Double_t)buffer[2];
+ clsq = buffer[3];
+ cathode = (Int_t)buffer[4];
+
+ if (cathode == 0) {
+ fPointSet1.SetPoint(ic1,clsX,clsY,clsZ);
+ ic1++;
+ }
+
+ } // end clusters loop
+
+ // hits
+
+ nHits = data->GetNHits();
+ oldSize = fPointSet2.GrowFor(nHits);
+ for (Int_t ih = 0; ih < nHits; ih++) {
+ buffer = data->GetHitBuffer(ih);
+ hitX = buffer[0];
+ hitY = buffer[1];
+ hitZ = buffer[2];
+ fPointSet2.SetPoint(ih,hitX,hitY,hitZ);
+ }
+
+ } // end data
}
#include <Reve/RenderElement.h>
#include <Reve/QuadSet.h>
+#include <Reve/PointSet.h>
#include <TNamed.h>
#include <TAtt3D.h>
Int_t fChamberID; // number of the chamber, 0 to 13
Reve::OldQuadSet fQuadSet1; // 1st cathode plane digits
Reve::OldQuadSet fQuadSet2; // 2nd cathode plane digits
+ Reve::PointSet fPointSet1; // reconstructed points (1st cathode)
+ Reve::PointSet fPointSet2; // simulation hits
Short_t fThreshold; // digit amplitude threshold
Int_t fMaxVal; // digit amplitude maximum value
+ Int_t fClusterSize; // cluster point size
+ Int_t fHitSize; // hit point size
void SetupColor(Int_t val, UChar_t* pix) const;
mutable UChar_t* fColorArray;
- void ClearColorArray();
- void SetupColorArray() const;
+ void ClearColorArray();
+ void SetupColorArray() const;
UChar_t* ColorFromArray(Int_t val) const;
void ColorFromArray(Int_t val, UChar_t* pix) const;
Int_t ColorIndex(Int_t val) const;
public:
- MUONChamber(const Text_t* n = "MUONChamber", const Text_t* t = 0);
+ MUONChamber(Int_t id, const Text_t* n = "MUONChamber", const Text_t* t = 0);
virtual ~MUONChamber();
- virtual void ComputeBBox();
- virtual void Paint(Option_t* option = "");
+ virtual void ComputeBBox();
+ virtual void Paint(Option_t* option = "");
virtual UInt_t IncRTS() { return ++fRTS; };
virtual Bool_t CanEditMainColor() { return kTRUE; }
MUONData* GetData() const { return fMUONData; };
MUONChamberData* GetChamberData() const;
Int_t GetID() const { return fChamberID; };
- void SetThreshold(Short_t t);
- void SetMaxVal(Int_t mv);
+ void SetThreshold(Short_t t);
+ void SetMaxVal(Int_t mv);
+ void SetClusterSize(Int_t size);
+ void SetHitSize(Int_t size);
ClassDef(MUONChamber,1); // Visualisation of the MUON chambers
#include "MUONChamberData.h"
#include <AliMUONSegmentation.h>
-#include <AliMUONConstants.h>
#include <AliMUONGeometryTransformer.h>
#include <AliMUONSegFactory.h>
#include <mapping/AliMpDEIterator.h>
#include <TMath.h>
#include <TVector2.h>
+#include <Riostream.h>
+
#include "Alieve/EventAlieve.h"
///////////////////////////////////////////////////////////////////////////////
fChamberID = chamber;
fNDetElem = 0;
fNDigits = 0;
+ fNClusters = 0;
+ fNHits = 0;
+
for (Int_t i = 0; i < 26; i++) {
for (Int_t j = 0; j < 4; j++) {
fFrameCoord[i][j] = 0.0;
for (Int_t i = 0; i < 7*4096; i++) {
fDigitBuffer[i] = 0.0;
}
+ for (Int_t i = 0; i < 5*128; i++) {
+ fClusterBuffer[i] = 0.0;
+ }
+ for (Int_t i = 0; i < 3*128; i++) {
+ fHitBuffer[i] = 0.0;
+ }
for (Int_t i = 0; i < 3; i++) {
fChamberBox[i*2 ] = +9999;
// release the chamber data
//
+ fNDigits = 0;
+ fNClusters = 0;
+ fNHits = 0;
+
return;
}
fDigitBuffer[fNDigits+6] = cathode;
fNDigits += 7;
+ /*
+ if ((fChamberID < 10 && charge > 5) || fChamberID >= 10) {
+ cout << "dig " << fChamberID << " cath " << cathode << " z " << gloP[2] << endl;
+ }
+ */
+}
+
+//______________________________________________________________________
+void MUONChamberData::RegisterCluster(Int_t /*detElemId*/, Int_t cathode, Float_t clsX, Float_t clsY, Float_t clsZ, Float_t charge)
+{
+ //
+ // add a reconstructed point (cluster) to this chamber
+ //
+ // identical clusters are registered for both cathode planes ...
+ //
+
+ fClusterBuffer[fNClusters ] = clsX;
+ fClusterBuffer[fNClusters+1] = clsY;
+ fClusterBuffer[fNClusters+2] = clsZ;
+ fClusterBuffer[fNClusters+3] = charge;
+ fClusterBuffer[fNClusters+4] = cathode;
+
+ fNClusters += 5;
+
+ //cout << "cls " << fChamberID << " cath " << cathode << " z " << clsZ << endl;
+
+}
+
+//______________________________________________________________________
+void MUONChamberData::RegisterHit(Int_t /*detElemId*/, Float_t hitX, Float_t hitY, Float_t hitZ)
+{
+ //
+ // add a simulation hit to this chamber
+ //
+
+ fHitBuffer[fNHits ] = hitX;
+ fHitBuffer[fNHits+1] = hitY;
+ fHitBuffer[fNHits+2] = hitZ;
+
+ //cout << "hit " << fChamberID << " z " << hitZ << endl;
+
+ fNHits += 3;
}
Float_t fFrameCoord[26][5]; // detector elements frames
Int_t fNDetElem; // number of detector elements
Int_t fNDigits; // number of found digits (times 7)
+ Int_t fNClusters; // number of found rec points
+ Int_t fNHits; // number of simulation hits
Float_t fDigitBuffer[7*4096]; // digits coordinates, etc.
+ Float_t fClusterBuffer[5*128]; // cluster coordinates, etc.
+ Float_t fHitBuffer[3*128]; // hits coordinates
Float_t fChamberBox[6]; // chamber envelope box
public:
void DropData();
void Init(Int_t chamber);
+
void RegisterDigit(Int_t detElemId, Int_t cathode, Int_t ix, Int_t iy, Int_t charge);
+ void RegisterCluster(Int_t detElemId, Int_t cathode, Float_t x, Float_t y, Float_t z, Float_t charge);
+ void RegisterHit(Int_t detElemId, Float_t x, Float_t y, Float_t z);
+
Float_t* GetFrameCoord(Int_t detElemId) { return fFrameCoord[detElemId]; };
- Int_t GetNDetElem() { return fNDetElem; };
- Int_t GetNDigits() { return fNDigits/7; };
- Float_t* GetDigitBuffer(Int_t pos) { return &fDigitBuffer[7*pos]; };
+
+ Int_t GetNDetElem() { return fNDetElem; };
+ Int_t GetNDigits() { return fNDigits/7; };
+ Int_t GetNClusters() { return fNClusters/5; };
+ Int_t GetNHits() { return fNHits/3; };
+
+ Float_t* GetDigitBuffer(Int_t pos) { return &fDigitBuffer[7*pos]; };
+ Float_t* GetClusterBuffer(Int_t pos) { return &fClusterBuffer[5*pos]; };
+ Float_t* GetHitBuffer(Int_t pos) { return &fHitBuffer[3*pos]; };
+
Float_t* GetChamberBox() { return &fChamberBox[0]; };
ClassDef(MUONChamberData,1); // class with data for one chamber
#include <Alieve/MUONChamber.h>
+#include <Reve/RGValuators.h>
+
#include <TVirtualPad.h>
#include <TColor.h>
Int_t width, Int_t height,
UInt_t options, Pixel_t back) :
TGedFrame(p, width, height, options | kVerticalFrame, back),
- fM(0)
+ fM(0),
+ fThreshold(0),
+ fMaxVal(0),
+ fClusterSize(0)
{
//
// constructor
MakeTitle("MUONChamber");
+ Int_t labelW = 60;
+
+ fThreshold = new RGValuator(this, "ADC min", 200, 0);
+ fThreshold->SetNELength(4);
+ fThreshold->SetLabelWidth(labelW);
+ fThreshold->Build();
+ fThreshold->GetSlider()->SetWidth(120);
+ fThreshold->SetLimits(0,4096);
+ fThreshold->Connect("ValueSet(Double_t)",
+ "Alieve::MUONChamberEditor", this, "DoThreshold()");
+ AddFrame(fThreshold, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1));
+
+ fMaxVal = new RGValuator(this,"ADC max", 200, 0);
+ fMaxVal->SetNELength(4);
+ fMaxVal->SetLabelWidth(labelW);
+ fMaxVal->Build();
+ fMaxVal->GetSlider()->SetWidth(120);
+ fMaxVal->SetLimits(0, 4096);
+ fMaxVal->Connect("ValueSet(Double_t)",
+ "Alieve::MUONChamberEditor", this, "DoMaxVal()");
+ AddFrame(fMaxVal, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1));
+
+ fClusterSize = new RGValuator(this,"Cls size", 200, 0);
+ fClusterSize->SetLabelWidth(labelW);
+ fClusterSize->SetShowSlider(kFALSE);
+ fClusterSize->SetNELength(4);
+ fClusterSize->Build();
+ fClusterSize->SetLimits(0, 24);
+ fClusterSize->SetToolTip("Size of displayed clusters");
+ fClusterSize->Connect("ValueSet(Double_t)",
+ "Alieve::MUONChamberEditor", this, "DoClusterSize()");
+ AddFrame(fClusterSize, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1));
+
+ fHitSize = new RGValuator(this,"Hit size", 200, 0);
+ fHitSize->SetLabelWidth(labelW);
+ fHitSize->SetShowSlider(kFALSE);
+ fHitSize->SetNELength(4);
+ fHitSize->Build();
+ fHitSize->SetLimits(0, 24);
+ fHitSize->SetToolTip("Size of displayed clusters");
+ fHitSize->Connect("ValueSet(Double_t)",
+ "Alieve::MUONChamberEditor", this, "DoHitSize()");
+ AddFrame(fHitSize, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1));
+
}
//______________________________________________________________________
fM = dynamic_cast<MUONChamber*>(obj);
+ fThreshold->SetValue(fM->fThreshold);
+ fMaxVal->SetValue(fM->fMaxVal);
+ fClusterSize->SetValue(fM->fClusterSize);
+ fHitSize->SetValue(fM->fHitSize);
+
+}
+
+//______________________________________________________________________
+void MUONChamberEditor::DoThreshold()
+{
+ //
+ // set digit minimum amplitude
+ //
+
+ fM->SetThreshold((Short_t) fThreshold->GetValue());
+ fThreshold->SetValue(fM->fThreshold);
+ Update();
+
+}
+
+//______________________________________________________________________
+void MUONChamberEditor::DoMaxVal()
+{
+ //
+ // set digit maximum amplitude
+ //
+
+ fM->SetMaxVal((Int_t) fMaxVal->GetValue());
+ fMaxVal->SetValue(fM->fMaxVal);
+ Update();
+
+}
+
+//______________________________________________________________________
+void MUONChamberEditor::DoClusterSize()
+{
+ //
+ // set the cluster point size
+ //
+
+ fM->SetClusterSize((Int_t) fClusterSize->GetValue());
+ fClusterSize->SetValue(fM->fClusterSize);
+ Update();
+
+}
+
+//______________________________________________________________________
+void MUONChamberEditor::DoHitSize()
+{
+ //
+ // set the hit point size
+ //
+
+ fM->SetHitSize((Int_t) fHitSize->GetValue());
+ fHitSize->SetValue(fM->fHitSize);
+ Update();
+
}
class TGDoubleHSlider;
class TGHSlider;
+namespace Reve {
+
+class RGValuator;
+
+}
+
namespace Alieve {
class MUONChamber;
MUONChamber* fM; // fModel dynamic-casted to MUONChamberEditor
+ Reve::RGValuator *fThreshold; // digit ADC min
+ Reve::RGValuator *fMaxVal; // digit ADC max
+ Reve::RGValuator *fClusterSize; // cluster point size
+ Reve::RGValuator *fHitSize; // hit point size
+
public:
- MUONChamberEditor(const TGWindow* p,
+ MUONChamberEditor(const TGWindow* p = 0,
Int_t width = 170, Int_t height = 30,
UInt_t options = kChildFrame,
Pixel_t back = GetDefaultFrameBackground());
- ~MUONChamberEditor();
+ virtual ~MUONChamberEditor();
virtual void SetModel(TObject* obj);
+ void DoThreshold();
+ void DoMaxVal();
+ void DoClusterSize();
+ void DoHitSize();
+
ClassDef(MUONChamberEditor, 0); // Editor for MUONChamber
};
/* $Id$ */
+#include <Riostream.h>
+
#include <TMath.h>
#include "MUONChamberGL.h"
if(hasData) {
DrawQuads();
+ DrawPoints();
}
}
+//______________________________________________________________________
+void MUONChamberGL::DrawPoints() const
+{
+ //
+ // draw the clusters as GL_QUADS
+ //
+
+ Float_t x, y, z;
+
+ glDisable(GL_LIGHTING);
+ glLineWidth(1.0);
+
+ glColor3f(1.0,1.0,1.0);
+
+ glBegin(GL_LINES);
+
+ // clusters
+
+ Int_t clsSize = fChamber->fClusterSize;
+
+ if (clsSize > 1) {
+
+ for (Int_t i = 0; i < fChamber->fPointSet1.GetN(); i++) {
+
+ fChamber->fPointSet1.GetPoint(i,x,y,z);
+
+ glVertex3f(x-clsSize,y+clsSize,z);
+ glVertex3f(x+clsSize,y-clsSize,z);
+
+ glVertex3f(x-clsSize,y-clsSize,z);
+ glVertex3f(x+clsSize,y+clsSize,z);
+
+ }
+
+ }
+
+ // hits
+
+ Int_t hitSize = fChamber->fHitSize;
+
+ if (hitSize > 1) {
+
+ for (Int_t i = 0; i < fChamber->fPointSet2.GetN(); i++) {
+
+ fChamber->fPointSet2.GetPoint(i,x,y,z);
+
+ glVertex3f(x-hitSize,y,z);
+ glVertex3f(x+hitSize,y,z);
+
+ glVertex3f(x,y-hitSize,z);
+ glVertex3f(x,y+hitSize,z);
+
+ }
+
+ }
+
+ glEnd();
+
+}
+
//______________________________________________________________________
void MUONChamberGL::DrawChamberFrame() const
{
virtual void DirectDraw(const TGLDrawFlags & flags) const;
void DrawChamberFrame() const;
void DrawQuads() const;
+ void DrawPoints() const;
MUONChamber* fChamber; // fModel dynamic-casted to MUONChamberGL
mutable UInt_t fRTS; // render time stamp
#include <AliLog.h>
+#include <AliMUONHit.h>
+#include <AliMUONRawCluster.h>
#include <AliMUONDigit.h>
#include <AliMUONRawStreamTracker.h>
#include <AliMUONRawStreamTrigger.h>
//______________________________________________________________________
MUONData::MUONData() :
- fChambers(14)
+ fChambers(14),
+ fNTrackList(0)
{
//
// Constructor
//
+ for (Int_t i = 0; i < 100; i++) {
+ fTrackList[i] = -1;
+ }
+
CreateAllChambers();
}
}
+//______________________________________________________________________
+void MUONData::Reset()
+{
+ //
+ // Reset data
+ //
+
+ //DropAllChambers();
+
+ fNTrackList = 0;
+ for (Int_t i = 0; i < 100; i++) {
+ fTrackList[i] = -1;
+ }
+
+}
+
//______________________________________________________________________
MUONData::MUONData(const MUONData &mdata) :
TObject(mdata),
}
+//______________________________________________________________________
+void MUONData::RegisterTrack(Int_t track)
+{
+ //
+ // register (in a list) a track with hits in the chambers
+ //
+
+ if (fNTrackList >= 100) {
+ cout << "Maximum of registered tracks reached..." << endl;
+ return;
+ }
+
+ Bool_t inList = kFALSE;
+ for (Int_t i = 0; i < fNTrackList; i++) {
+ if (track == fTrackList[i]) {
+ inList = kTRUE;
+ break;
+ }
+ }
+ if (!inList) {
+ fTrackList[fNTrackList] = track;
+ fNTrackList++;
+ }
+
+}
+
//______________________________________________________________________
void MUONData::LoadDigits(TTree* tree)
{
detElemId = mdig->DetElemId();
charge = (Int_t)mdig->Signal();
- if (c > 9) {
- //printf("cha %d deid %d cath %1d ix %d iy %d q %d \n",c,detElemId,cathode,ix,iy,charge);
- }
-
fChambers[c]->RegisterDigit(detElemId,cathode,ix,iy,charge);
-
+
} // end digits loop
}
}
//______________________________________________________________________
-void MUONData::LoadRecPoints(TTree* /*tree*/)
+void MUONData::LoadRecPoints(TTree* tree)
{
//
// load reconstructed points from the TreeR
// load local trigger information
//
+ Char_t branchname[30];
+ TClonesArray *clusters = 0;
+ Int_t nclusters;
+ AliMUONRawCluster *mcls;
+ Int_t detElemId;
+ Float_t clsX, clsY, clsZ, charge;
+
+ for (Int_t c = 0; c < 10; ++c) {
+
+ if (fChambers[c] == 0) continue;
+ sprintf(branchname,"MUONRawClusters%d",c+1);
+ tree->SetBranchAddress(branchname,&clusters);
+ tree->GetEntry(0);
+
+ nclusters = clusters->GetEntriesFast();
+
+ for (Int_t ic = 0; ic < nclusters; ic++) {
+ mcls = (AliMUONRawCluster*)clusters->UncheckedAt(ic);
+
+ detElemId = mcls->GetDetElemId();
+ for (Int_t icath = 0; icath < 2; icath++) {
+ clsX = mcls->GetX(icath);
+ clsY = mcls->GetY(icath);
+ clsZ = mcls->GetZ(icath);
+ charge = mcls->GetCharge(icath);
+
+ fChambers[c]->RegisterCluster(detElemId,icath,clsX,clsY,clsZ,charge);
+ }
+
+ }
+
+ }
+
+}
+
+//______________________________________________________________________
+void MUONData::LoadHits(TTree* tree)
+{
+ //
+ // load simulation hits from the TreeH
+ //
+
+ TClonesArray *hits = 0;
+ AliMUONHit *mhit;
+ Int_t cha, detElemId, nhits, ntracks;
+ Float_t hitX, hitY, hitZ;
+
+ ntracks = tree->GetEntries();
+ tree->SetBranchAddress("MUONHits",&hits);
+
+ for (Int_t it = 0; it < ntracks; it++) {
+
+ tree->GetEvent(it);
+ nhits = hits->GetEntriesFast();
+
+ for (Int_t ih = 0; ih < nhits; ih++) {
+
+ mhit = (AliMUONHit*)hits->UncheckedAt(ih);
+ hitX = mhit->X();
+ hitY = mhit->Y();
+ hitZ = mhit->Z();
+ detElemId = mhit->DetElemId();
+ cha = mhit->Chamber();
+
+ RegisterTrack(mhit->GetTrack());
+
+ fChambers[cha-1]->RegisterHit(detElemId,hitX,hitY,hitZ);
+
+ }
+ }
+
}
//______________________________________________________________________
}
+//______________________________________________________________________
+Int_t MUONData::GetTrack(Int_t index)
+{
+ //
+ // return track stack number for "index"-th track with hits in the chambers
+ //
+
+ if (index < 100) {
+ return fTrackList[index];
+ } else {
+ return -1;
+ }
+
+}
+
//______________________________________________________________________
MUONChamberData* MUONData::GetChamberData(Int_t chamber)
{
void GetTriggerChamber(AliMUONLocalStruct* localStruct,
Int_t& xyPattern, Int_t& iChamber, Int_t& iCath,
Int_t iCase);
+
+ Int_t fNTrackList; // number of MC tracks which have hits
+ Int_t fTrackList[100]; // list of MC tracks which have hits
+
public:
MUONData();
MUONData(const MUONData&);
MUONData& operator=(const MUONData&);
+ void Reset();
+
void LoadDigits(TTree* tree);
void LoadRecPoints(TTree* tree);
+ void LoadHits(TTree* tree);
void LoadRaw(TString fileName);
void LoadRawTracker();
void LoadRawTrigger();
void DropAllChambers();
void DeleteAllChambers();
+ void RegisterTrack(Int_t track);
+ Int_t GetNTrackList() { return fNTrackList; }
+ Int_t GetTrack(Int_t index);
+
MUONChamberData* GetChamberData(Int_t chamber);
ClassDef(MUONData,1); // Manages MUON data for one event
#include "MUONTrack.h"
+#include <Alieve/EventAlieve.h>
+
#include <AliMagF.h>
+#include <AliMagFMaps.h>
#include <AliLog.h>
+#include <AliESDMuonTrack.h>
+#include <AliTrackReference.h>
+#include <AliESD.h>
+#include <AliRunLoader.h>
+#include <AliRun.h>
#include <AliMUONTrack.h>
+#include <AliMUONTriggerTrack.h>
#include <AliMUONTrackParam.h>
#include <AliMUONConstants.h>
#include <TMatrixD.h>
#include <TStyle.h>
#include <TROOT.h>
+#include <TParticle.h>
+#include <TParticlePDG.h>
+
+#include <Riostream.h>
using namespace Reve;
using namespace Alieve;
ClassImp(MUONTrack)
+AliMagF* MUONTrack::fFieldMap = 0;
+
//______________________________________________________________________
MUONTrack::MUONTrack(Reve::RecTrack* t, TrackRnrStyle* rs) :
Reve::Track(t,rs),
- fFieldMap(0),
fTrack(0),
- fCount(0)
+ fPart(0),
+ fCount(0),
+ fIsMUONTrack(kFALSE),
+ fIsMUONTriggerTrack(kFALSE),
+ fIsESDTrack(kFALSE),
+ fIsMCTrack(kFALSE),
+ fIsRefTrack(kFALSE)
{
//
// constructor
//
+ fFieldMap = Alieve::Event::AssertMagField();
+
}
//______________________________________________________________________
// destructor
//
+ if (fIsRefTrack || fIsESDTrack) delete fTrack;
+ if (fIsMCTrack) delete fPart;
+
+}
+
+//______________________________________________________________________
+void MUONTrack::PrintMCTrackInfo()
+{
+ //
+ // information about the MC particle
+ //
+
+ Float_t pt, p;
+
+ if (!fPart) {
+ cout << " ! no particle ..." << endl;
+ return;
+ }
+
+ cout << endl;
+ cout << " MC track parameters at vertex" << endl;
+ cout << " -------------------------------------------------------------------------------------" << endl;
+ cout << " PDG code Vx Vy Vz Px Py Pz " << endl;
+
+ cout << " " <<
+ setw(8) << setprecision(0) <<
+ fPart->GetPdgCode() << " " <<
+ setw(8) << setprecision(3) <<
+ fPart->Vx() << " " <<
+ setw(8) << setprecision(3) <<
+ fPart->Vy() << " " <<
+ setw(8) << setprecision(3) <<
+ fPart->Vz() << " " <<
+ setw(8) << setprecision(3) <<
+ fPart->Px() << " " <<
+ setw(8) << setprecision(3) <<
+ fPart->Py() << " " <<
+ setw(8) << setprecision(4) <<
+ fPart->Pz() << " " <<
+
+ endl;
+
+ pt = TMath::Sqrt(fPart->Px()*fPart->Px()+fPart->Py()*fPart->Py());
+ p = TMath::Sqrt(fPart->Px()*fPart->Px()+fPart->Py()*fPart->Py()+fPart->Pz()*fPart->Pz());
+
+ cout << endl;
+ cout << " Pt = " <<
+ setw(8) << setprecision(3) <<
+ pt << " GeV/c" << endl;
+
+ cout << " P = " <<
+ setw(8) << setprecision(4) <<
+ p << " GeV/c" << endl;
+
+}
+
+//______________________________________________________________________
+void MUONTrack::PrintMUONTrackInfo()
+{
+ //
+ // information about the reconstructed/reference track; at hits and at vertex
+ //
+
+ Double_t RADDEG = 180.0/TMath::Pi();
+
+ Int_t nparam;
+ Float_t pt, bc, nbc, zc;
+ AliMUONTrackParam *mtp;
+ TClonesArray *trackParamAtHit;
+
+ if (!fTrack) {
+ cout << " ! no reconstructed track ..." << endl;
+ return;
+ }
+
+ if (fIsMUONTrack) {
+ cout << endl;
+ cout << " Track number " << fLabel << endl;
+ cout << " ---------------------------------------------------------------------------------------------------------------------------------" << endl;
+ cout << endl;
+ cout << " Number of clusters " << fTrack->GetNTrackHits() << endl;
+ cout << " Match to trigger " << fTrack->GetMatchTrigger() << endl;
+ if (fTrack->GetMatchTrigger()) {
+ cout << " Chi2 tracking-trigger " << fTrack->GetChi2MatchTrigger() << endl;
+ cout << " Local trigger number " << fTrack->GetLoTrgNum() << endl;
+ }
+ }
+
+ if (fIsRefTrack) {
+ cout << endl;
+ cout << " Track reference number " << fLabel << endl;
+ cout << " ---------------------------------------------------------------------------------------------------------------------------------" << endl;
+ cout << endl;
+ cout << " Number of clusters " << fTrack->GetNTrackHits() << endl;
+ }
+
+ trackParamAtHit = fTrack->GetTrackParamAtHit();
+ nparam = trackParamAtHit->GetEntries();
+
+ cout << endl;
+ cout << " TrackParamAtHit entries " << nparam << "" << endl;
+ cout << " ---------------------------------------------------------------------------------------------------------------------------------" << endl;
+ cout << " Number InvBendMom BendSlope NonBendSlope BendCoord NonBendCoord Z Px Py Pz P" << endl;
+
+ for (Int_t i = 0; i < nparam; i++) {
+
+ mtp = (AliMUONTrackParam*)trackParamAtHit->At(i);
+
+ cout <<
+ setw(9)<< setprecision(3) <<
+ i << " " <<
+
+ setw(8) << setprecision(3) <<
+ mtp->GetInverseBendingMomentum() << " " <<
+
+ setw(8) << setprecision(3) <<
+ mtp->GetBendingSlope()*RADDEG << " " <<
+
+ setw(8) << setprecision(3) <<
+ mtp->GetNonBendingSlope()*RADDEG << " " <<
+
+ setw(8) << setprecision(4) <<
+ mtp->GetBendingCoor() << " " <<
+
+ setw(8) << setprecision(4) <<
+ mtp->GetNonBendingCoor() << " " <<
+
+ setw(10) << setprecision(6) <<
+ mtp->GetZ() << " " <<
+
+ setw(8) << setprecision(4) <<
+ mtp->Px() << " " <<
+
+ setw(8) << setprecision(4) <<
+ mtp->Py() << " " <<
+
+ setw(8) << setprecision(4) <<
+ mtp->Pz() << " " <<
+
+ setw(8) << setprecision(4) <<
+ mtp->P() << " " <<
+
+ endl;
+
+ }
+
+ cout << endl;
+ cout << " Track parameters at vertex" << endl;
+ cout << " --------------------------------------------------------------------------------------------------------------------" << endl;
+ cout << " InvBendMom BendSlope NonBendSlope BendCoord NonBendCoord Z Px Py Pz P" << endl;
+
+ mtp = (AliMUONTrackParam*)fTrack->GetTrackParamAtVertex();
+
+ bc = mtp->GetBendingCoor();
+ nbc = mtp->GetNonBendingCoor();
+ zc = mtp->GetZ();
+ if (bc < 0.001) bc = 0.0;
+ if (nbc < 0.001) nbc = 0.0;
+ if (zc < 0.001) zc = 0.0;
+
+ cout << " " <<
+ setw(8) << setprecision(3) <<
+ mtp->GetInverseBendingMomentum() << " " <<
+
+ setw(8) << setprecision(3) <<
+ mtp->GetBendingSlope()*RADDEG << " " <<
+
+ setw(8) << setprecision(3) <<
+ mtp->GetNonBendingSlope()*RADDEG << " " <<
+
+ setw(8) << setprecision(4) <<
+ bc << " " <<
+
+ setw(8) << setprecision(4) <<
+ nbc << " " <<
+
+ setw(10) << setprecision(6) <<
+ zc << " " <<
+
+ setw(8) << setprecision(4) <<
+ mtp->Px() << " " <<
+
+ setw(8) << setprecision(4) <<
+ mtp->Py() << " " <<
+
+ setw(8) << setprecision(4) <<
+ mtp->Pz() << " " <<
+
+ setw(8) << setprecision(4) <<
+ mtp->P() << " " <<
+
+ endl;
+
+ pt = TMath::Sqrt(mtp->Px()*mtp->Px()+mtp->Py()*mtp->Py());
+
+ cout << endl;
+ cout << " Pt = " <<
+ setw(8) << setprecision(3) <<
+ pt << " GeV/c" << endl;
+
+}
+
+//______________________________________________________________________
+void MUONTrack::PrintMUONTriggerTrackInfo()
+{
+ //
+ // information about the trigger track
+ //
+
+ // Double_t RADDEG = 180.0/TMath::Pi();
+
+}
+
+//______________________________________________________________________
+void MUONTrack::PrintESDTrackInfo()
+{
+ //
+ // information about the reconstructed ESD track at vertex
+ //
+
+ Double_t RADDEG = 180.0/TMath::Pi();
+ Float_t pt;
+
+ AliMUONTrackParam *mtp = (AliMUONTrackParam*)fTrack->GetTrackParamAtVertex();
+
+ cout << endl;
+ cout << " ESD muon track " << endl;
+ cout << " -----------------------------------------------------------------------------------------------------------" << endl;
+ cout << " InvBendMom BendSlope NonBendSlope BendCoord NonBendCoord Z Px Py Pz" << endl;
+
+ cout << " " <<
+
+ setw(8) << setprecision(4) <<
+ mtp->GetInverseBendingMomentum() << " " <<
+
+ setw(8) << setprecision(3) <<
+ mtp->GetBendingSlope()*RADDEG << " " <<
+
+ setw(8) << setprecision(3) <<
+ mtp->GetNonBendingSlope()*RADDEG << " " <<
+
+ setw(8) << setprecision(4) <<
+ mtp->GetBendingCoor() << " " <<
+
+ setw(8) << setprecision(4) <<
+ mtp->GetNonBendingCoor() << " " <<
+
+ setw(10) << setprecision(6) <<
+ mtp->GetZ() << " " <<
+
+ setw(8) << setprecision(3) <<
+ mtp->Px() << " " <<
+
+ setw(8) << setprecision(3) <<
+ mtp->Py() << " " <<
+
+ setw(8) << setprecision(3) <<
+ mtp->Pz() << " " <<
+
+ endl;
+
+ pt = TMath::Sqrt(mtp->Px()*mtp->Px()+mtp->Py()*mtp->Py());
+
+ cout << endl;
+ cout << " Pt = " <<
+ setw(8) << setprecision(3) <<
+ pt << " GeV/c" << endl;
+
+ cout << " P = " <<
+ setw(8) << setprecision(4) <<
+ mtp->P() << " GeV/c" << endl;
+
+ AliESD* esd = Alieve::Event::AssertESD();
+
+ Double_t spdVertexX = 0;
+ Double_t spdVertexY = 0;
+ Double_t spdVertexZ = 0;
+ Double_t esdVertexX = 0;
+ Double_t esdVertexY = 0;
+ Double_t esdVertexZ = 0;
+
+ AliESDVertex* spdVertex = (AliESDVertex*) esd->GetVertex();
+ if (spdVertex->GetNContributors()) {
+ spdVertexZ = spdVertex->GetZv();
+ spdVertexY = spdVertex->GetYv();
+ spdVertexX = spdVertex->GetXv();
+ }
+
+ AliESDVertex* esdVertex = (AliESDVertex*) esd->GetPrimaryVertex();
+ if (esdVertex->GetNContributors()) {
+ esdVertexZ = esdVertex->GetZv();
+ esdVertexY = esdVertex->GetYv();
+ esdVertexX = esdVertex->GetXv();
+ }
+
+ Float_t t0v = esd->GetT0zVertex();
+
+ cout << endl;
+ cout << endl;
+ cout << "External vertex SPD: " <<
+ setw(3) <<
+ spdVertex->GetNContributors() << " " <<
+ setw(8) << setprecision(3) <<
+ spdVertexX << " " <<
+ spdVertexY << " " <<
+ spdVertexZ << " " << endl;
+ cout << "External vertex ESD: " <<
+ setw(3) <<
+ esdVertex->GetNContributors() << " " <<
+ setw(8) << setprecision(3) <<
+ esdVertexX << " " <<
+ esdVertexY << " " <<
+ esdVertexZ << " " << endl;
+ cout << "External vertex T0: " <<
+ setw(8) << setprecision(3) <<
+ t0v << " " << endl;
+
}
//______________________________________________________________________
// MENU function
//
- Reve::LoadMacro("MUON_track_info.C");
- gROOT->ProcessLine(Form("MUON_track_info(%d);", fLabel));
+ if (fIsMCTrack) {
+ PrintMCTrackInfo();
+ }
+
+ if (fIsMUONTrack || fIsRefTrack) {
+ PrintMUONTrackInfo();
+ }
+
+ if (fIsESDTrack) {
+ PrintESDTrackInfo();
+ }
+
+ if (fIsMUONTriggerTrack) {
+ PrintMUONTriggerTrackInfo();
+ }
+
+ cout << endl;
+ cout << endl;
+ cout << endl;
+ cout << " (slopes [deg], coord [cm], p [GeV/c])" << endl;
}
// MENU function
//
- Reve::LoadMacro("MUON_trigger_info.C");
- gROOT->ProcessLine(Form("MUON_trigger_info(%d);", fLabel));
+ if (fIsMUONTrack) {
+ Reve::LoadMacro("MUON_trigger_info.C");
+ gROOT->ProcessLine(Form("MUON_trigger_info(%d);", fLabel));
+ }
+ if (fIsRefTrack) {
+ cout << "This is a reference track!" << endl;
+ }
+ if (fIsMCTrack) {
+ cout << "This is a Monte-Carlo track!" << endl;
+ }
+ if (fIsESDTrack) {
+
+ AliESD* esd = Alieve::Event::AssertESD();
+ ULong64_t triggerMask = esd->GetTriggerMask();
+
+ cout << endl;
+ cout << ">>>>>#########################################################################################################################" << endl;
+ cout << endl;
+
+ cout << " ESD track trigger info" << endl;
+ cout << " -----------------------------------------------------" << endl;
+ cout << endl;
+
+ cout << " Match to trigger " << fTrack->GetMatchTrigger() << endl;
+ cout << endl;
+ cout << " ESD trigger mask = " << triggerMask << endl;
+
+ cout << endl;
+ cout << "#########################################################################################################################<<<<<" << endl;
+ cout << endl;
+
+ }
}
//______________________________________________________________________
-void MUONTrack::MakeTrack(AliMUONTrack *mtrack, AliMagF *fmap)
+void MUONTrack::MakeMUONTrack(AliMUONTrack *mtrack)
{
//
// builds the track with dipole field
//
- fTrack = mtrack;
- fFieldMap = fmap;
+ if (!fIsRefTrack) {
+ fIsMUONTrack = kTRUE;
+ fTrack = mtrack;
+ }
+
+ if (fIsRefTrack) {
+ fTrack = new AliMUONTrack(*mtrack);
+ }
Double_t xv, yv;
Float_t ax, bx, ay, by;
- Float_t xr[20], yr[20], zr[20];
- Float_t xrc[20], yrc[20], zrc[20];
+ Float_t xr[28], yr[28], zr[28];
+ Float_t xrc[28], yrc[28], zrc[28];
char form[1000];
TMatrixD smatrix(2,2);
// middle z between the two detector planes of the trigger chambers
Float_t zg[4] = { -1603.5, -1620.5, -1703.5, -1720.5 };
- AliMUONTrackParam *mtp = (AliMUONTrackParam*)mtrack->GetTrackParamAtVertex();
+ AliMUONTrackParam *mtp = mtrack->GetTrackParamAtVertex();
Float_t pt = TMath::Sqrt(mtp->Px()*mtp->Px()+mtp->Py()*mtp->Py());
-
- //PH The line below is replaced waiting for a fix in Root
- //PH which permits to use variable siza arguments in CINT
- //PH on some platforms (alphalinuxgcc, solariscc5, etc.)
- if (mtrack->GetMatchTrigger()) {
- //PH track->SetName(Form("MUONTrack %2d (MT)", fLabel));
- sprintf(form,"MUONTrack %2d (MT)", fLabel);
- SetName(form);
- SetLineStyle(1);
- //SetLineColor(2);
- SetLineColor(ColorIndex(pt));
- } else {
- //PH track->SetName(Form("MUONTrack %2d ", fLabel));
- sprintf(form,"MUONTrack %2d ", fLabel);
- SetName(form);
- SetLineStyle(2);
- //SetLineColor(2);
- SetLineColor(ColorIndex(pt));
+ Float_t pv[3];
+ pv[0] = mtp->Px();
+ pv[1] = mtp->Py();
+ pv[2] = mtp->Pz();
+ fP.Set(pv);
+
+ if (fIsMUONTrack) {
+ //PH The line below is replaced waiting for a fix in Root
+ //PH which permits to use variable siza arguments in CINT
+ //PH on some platforms (alphalinuxgcc, solariscc5, etc.)
+ if (mtrack->GetMatchTrigger()) {
+ //PH track->SetName(Form("MUONTrack %2d (MT)", fLabel));
+ sprintf(form,"MUONTrack %2d (MT)", fLabel);
+ SetName(form);
+ SetLineStyle(1);
+ SetLineColor(ColorIndex(pt));
+ } else {
+ //PH track->SetName(Form("MUONTrack %2d ", fLabel));
+ sprintf(form,"MUONTrack %2d ", fLabel);
+ SetName(form);
+ SetLineStyle(1);
+ SetLineColor(ColorIndex(pt));
+ }
}
AliMUONTrackParam *trackParam = mtrack->GetTrackParamAtVertex();
yRec0 = trackParam->GetBendingCoor();
zRec0 = trackParam->GetZ();
- SetPoint(fCount,xRec0,yRec0,zRec0);
- fCount++;
+ if (fIsMUONTrack) {
+ SetPoint(fCount,xRec0,yRec0,zRec0);
+ fCount++;
+ }
- for (Int_t i = 0; i < 20; i++) xr[i]=yr[i]=zr[i]=0.0;
+ for (Int_t i = 0; i < 28; i++) xr[i]=yr[i]=zr[i]=0.0;
Int_t nTrackHits = mtrack->GetNTrackHits();
- Bool_t hitChamber[10] = {kFALSE};
-
+ Bool_t hitChamber[14] = {kFALSE};
+ Int_t iCha;
TClonesArray* trackParamAtHit = mtrack->GetTrackParamAtHit();
for (Int_t iHit = 0; iHit < nTrackHits; iHit++){
yRec = trackParam->GetBendingCoor();
zRec = trackParam->GetZ();
- //printf("Hit %d x %f y %f z %f \n",iHit,xRec,yRec,zRec);
+ iCha = AliMUONConstants::ChamberNumber(zRec);
+ //printf("Hit %d x %f y %f z %f c %2d \n",iHit,xRec,yRec,zRec,iCha);
xr[iHit] = xRec;
yr[iHit] = yRec;
zr[iHit] = zRec;
-
- hitChamber[AliMUONConstants::ChamberNumber(zRec)] = kTRUE;
+
+ hitChamber[iCha] = kTRUE;
}
Int_t crntCha, lastHitSt12, firstHitSt3, lastHitSt3, firstHitSt45;
+ if (fIsMUONTrack) nTrackHits = 10;
+
lastHitSt12 = -1;
firstHitSt3 = -1;
lastHitSt3 = -1;
fCount++;
}
}
+
+ if (!fIsMUONTrack) return;
Int_t nrc = 0;
if (mtrack->GetMatchTrigger() && 1) {
}
+//______________________________________________________________________
+void MUONTrack::MakeMUONTriggerTrack(AliMUONTriggerTrack *mtrack)
+{
+ //
+ // builds the trigger track from one point and direction
+ //
+
+ Float_t x1 = mtrack->GetX11();
+ Float_t y1 = mtrack->GetY11();
+ Float_t thex = mtrack->GetThetax();
+ Float_t they = mtrack->GetThetay();
+
+ Float_t z11 = -1600.0;
+ Float_t z22 = -1724.0;
+ Float_t dz = z22-z11;
+
+ Float_t x2 = x1 + dz*TMath::Tan(thex);
+ Float_t y2 = y1 + dz*TMath::Tan(they);
+
+ SetPoint(fCount,x1,y1,z11); fCount++;
+ SetPoint(fCount,x2,y2,z22); fCount++;
+
+ char form[1000];
+
+ sprintf(form,"MUONTriggerTrack %2d",mtrack->GetLoTrgNum());
+ SetName(form);
+ SetLineStyle(1);
+
+}
+
+//______________________________________________________________________
+void MUONTrack::MakeESDTrack(AliESDMuonTrack *mtrack)
+{
+ //
+ // builds the track with dipole field starting from the TParticle
+ //
+
+ fIsESDTrack = kTRUE;
+
+ fTrack = new AliMUONTrack();
+ AliMUONTrackParam trackParam;
+ trackParam.GetParamFrom(*mtrack);
+ fTrack->SetTrackParamAtVertex(&trackParam);
+ fTrack->SetMatchTrigger(mtrack->GetMatchTrigger());
+
+ char form[1000];
+ sprintf(form,"ESDTrack %2d ", fLabel);
+ SetName(form);
+ SetLineStyle(3);
+ SetLineColor(0);
+
+ Double_t vect[7], vout[7];
+ Double_t step = 1.0;
+
+ Int_t charge = (Int_t)TMath::Sign(1.0,trackParam.GetInverseBendingMomentum());
+ Float_t pv[3];
+ pv[0] = trackParam.Px();
+ pv[1] = trackParam.Py();
+ pv[2] = trackParam.Pz();
+ fP.Set(pv);
+
+ vect[0] = trackParam.GetNonBendingCoor();
+ vect[1] = trackParam.GetBendingCoor();
+ vect[2] = trackParam.GetZ();
+ vect[3] = trackParam.Px()/trackParam.P();
+ vect[4] = trackParam.Py()/trackParam.P();
+ vect[5] = trackParam.Pz()/trackParam.P();
+ vect[6] = trackParam.P();
+
+ //cout << "vertex " << vect[0] << " " << vect[1] << " " << vect[2] << " " << endl;
+
+ Double_t zMax = -1750.0;
+ Double_t rMax = 350.0;
+ Double_t r = 0.0;
+
+ Int_t nSteps = 0;
+ while ((vect[2] > zMax) && (nSteps < 10000) && (r < rMax)) {
+ nSteps++;
+ OneStepRungekutta(charge, step, vect, vout);
+ SetPoint(fCount,vout[0],vout[1],vout[2]);
+ fCount++;
+ for (Int_t i = 0; i < 7; i++) {
+ vect[i] = vout[i];
+ }
+ r = TMath::Sqrt(vect[0]*vect[0]+vect[1]*vect[1]);
+ }
+
+}
+
+//______________________________________________________________________
+void MUONTrack::MakeMCTrack(TParticle *part)
+{
+ //
+ // builds the track with dipole field starting from the TParticle
+ //
+
+ fIsMCTrack = kTRUE;
+
+ fPart = new TParticle(*part);
+
+ char form[1000];
+ sprintf(form,"MCTrack %2d ", fLabel);
+ SetName(form);
+ SetLineStyle(2);
+ SetLineColor(8);
+
+ Double_t vect[7], vout[7];
+ Double_t step = 1.0;
+
+ Float_t pv[3];
+ pv[0] = fPart->Px();
+ pv[1] = fPart->Py();
+ pv[2] = fPart->Pz();
+ fP.Set(pv);
+
+ vect[0] = fPart->Vx();
+ vect[1] = fPart->Vy();
+ vect[2] = fPart->Vz();
+ vect[3] = fPart->Px()/fPart->P();
+ vect[4] = fPart->Py()/fPart->P();
+ vect[5] = fPart->Pz()/fPart->P();
+ vect[6] = fPart->P();
+
+ TParticlePDG *ppdg = fPart->GetPDG(1);
+ Int_t charge = (Int_t)(ppdg->Charge()/3.0);
+
+ Double_t zMax = -1750.0;
+ Double_t rMax = 350.0;
+ Double_t r = 0.0;
+
+ Int_t nSteps = 0;
+ while ((vect[2] > zMax) && (nSteps < 10000) && (r < rMax)) {
+ nSteps++;
+ OneStepRungekutta(charge, step, vect, vout);
+ SetPoint(fCount,vout[0],vout[1],vout[2]);
+ fCount++;
+ for (Int_t i = 0; i < 7; i++) {
+ vect[i] = vout[i];
+ }
+ r = TMath::Sqrt(vect[0]*vect[0]+vect[1]*vect[1]);
+ }
+
+}
+
+//______________________________________________________________________
+void MUONTrack::MakeRefTrack(AliMUONTrack *mtrack)
+{
+ //
+ // builds the track with dipole field starting from the TParticle
+ //
+
+ fIsRefTrack = kTRUE;
+
+ char form[1000];
+ sprintf(form,"RefTrack %2d ", fLabel);
+ SetName(form);
+ SetLineStyle(2);
+ SetLineColor(0);
+
+ MakeMUONTrack(mtrack);
+
+}
+
//______________________________________________________________________
void MUONTrack::Propagate(Float_t *xr, Float_t *yr, Float_t *zr, Int_t i1, Int_t i2)
{
Double_t zMax;
if (i2 == 9999) {
- //zMax = -1750.0;
- zMax = zr[i1]+2.0;
+ zMax = zr[i1]+1.5*step;
} else {
- zMax = zr[i2]+2.0;
+ zMax = zr[i2]+1.5*step;
}
AliMUONTrackParam *trackParam = fTrack->GetTrackParamAtVertex();
while ((vect[2] > zMax) && (nSteps < 10000)) {
nSteps++;
OneStepRungekutta(charge, step, vect, vout);
- //printf("%f %f %f \n",vect[0],vect[1],vect[2]);
SetPoint(fCount,vout[0],vout[1],vout[2]);
fCount++;
for (Int_t i = 0; i < 7; i++) {
x[0] = position[0]; x[1] = position[1]; x[2] = position[2];
- if (fFieldMap) fFieldMap->Field(x,b);
+ if (fFieldMap) {
+ fFieldMap->Field(x,b);
+ }
else {
- //AliWarning("No field map");
+ AliWarning("No field map");
field[0] = field[1] = field[2] = 0.0;
return;
}
#include <Reve/Track.h>
class AliMUONTrack;
+class AliMUONTriggerTrack;
class AliMagF;
+class AliESDMuonTrack;
+class AliTrackReference;
+
+class TParticle;
namespace Reve {
MUONTrack(Reve::RecTrack* t, Reve::TrackRnrStyle* rs);
virtual ~MUONTrack();
- void MakeTrack(AliMUONTrack *mtrack, AliMagF *fmap);
+ virtual void MakeTrack(Bool_t /*recurse*/=kFALSE) {}
+
+ void MakeMUONTrack(AliMUONTrack *mtrack);
+ void MakeMUONTriggerTrack(AliMUONTriggerTrack *mtrack);
+ void MakeESDTrack(AliESDMuonTrack *mtrack);
+ void MakeMCTrack(TParticle *part);
+ void MakeRefTrack(AliMUONTrack *mtrack);
void GetField(Double_t *position, Double_t *field);
void Propagate(Float_t *xr, Float_t *yr, Float_t *zr, Int_t i1, Int_t i2);
void OneStepRungekutta(Double_t charge, Double_t step,
Double_t* vect, Double_t* vout);
Int_t ColorIndex(Float_t val);
+ Bool_t IsMUONTrack() { return fIsMUONTrack; };
+ Bool_t IsMUONTriggerTrack() { return fIsMUONTrack; };
+ Bool_t IsESDTrack() { return fIsESDTrack; };
+ Bool_t IsMCTrack() { return fIsMCTrack; };
+ Bool_t IsRefTrack() { return fIsRefTrack; };
+
+ void PrintMCTrackInfo();
+ void PrintMUONTrackInfo();
+ void PrintMUONTriggerTrackInfo();
+ void PrintESDTrackInfo();
+
void MUONTrackInfo(); // *MENU*
void MUONTriggerInfo(); // *MENU*
private:
- AliMagF *fFieldMap; // pointer to the magnetic field map
AliMUONTrack *fTrack; // pointer to the MUON track
+ TParticle *fPart; // pointer to the MC particle
Int_t fCount; // track points counter
+ Bool_t fIsMUONTrack; // track from MUON.Tracks.root
+ Bool_t fIsMUONTriggerTrack; // trigger track from MUON.Tracks.root
+ Bool_t fIsESDTrack; // track from AliESDs.root
+ Bool_t fIsMCTrack; // track from Kinematics.root
+ Bool_t fIsRefTrack; // track from TrackRefs.root
+
+ static AliMagF *fFieldMap; // pointer to the magnetic field map
ClassDef(MUONTrack, 1); // Produce Reve:Track from AliMUONTrack
TTree* dt = 0;
TTree* ct = 0;
+ TTree* ht = 0;
if (Alieve::gEvent == 0) {
printf("No alieve event: use alieve_init(...) \n");
g_fromRaw = fromRaw;
TString dataPath = TString(Alieve::gEvent->GetTitle());
- dataPath.Append("/raw.root");
+ dataPath.Append("/rawmuon.root");
AliRunLoader* rl = Alieve::Event::AssertRunLoader();
g_muon_data = new Alieve::MUONData;
-
+
if (!fromRaw) {
rl->LoadDigits("MUON");
dt = rl->GetTreeD("MUON", false);
if (dt == 0) {
cout << "No digits produced!" << endl;
} else {
- cout << "Display aliroot digits!" << endl;
+ cout << "With aliroot digits!" << endl;
g_muon_data->LoadDigits(dt);
}
} else {
if (gSystem->AccessPathName(dataPath.Data(),kFileExists)) {
cout << "No raw data produced!" << endl;
} else {
- cout << "Display raw digits!" << endl;
+ cout << "With raw digits!" << endl;
g_muon_data->LoadRaw(dataPath.Data());
}
}
-
+
rl->LoadRecPoints("MUON");
ct = rl->GetTreeR("MUON", false);
g_muon_data->LoadRecPoints(ct);
-
+
+ rl->LoadHits("MUON");
+ ht = rl->GetTreeH("MUON", false);
+ g_muon_data->LoadHits(ht);
+
g_muon_last_event = Alieve::gEvent;
g_currentEvent = g_muon_last_event->GetEventId();
gStyle->SetPalette(1, 0);
gReve->DisableRedraw();
-
+
Reve::RenderElementList* l = new Reve::RenderElementList("MUONChambers");
l->SetTitle("MUON chambers");
l->SetMainColor(Color_t(2));
gReve->AddRenderElement(l);
-
+
for (Int_t ic = 0; ic < 14; ic++) {
- Alieve::MUONChamber* mucha = new Alieve::MUONChamber();
+ Alieve::MUONChamber* mucha = new Alieve::MUONChamber(ic);
mucha->SetFrameColor(2);
mucha->SetChamberID(ic);
+
mucha->SetDataSource(g_muon_data);
gReve->AddRenderElement(l,mucha);
}
- if (showTracks) MUON_tracks();
+ if (showTracks) {
+ MUON_tracks();
+ MUON_trigger_tracks();
+ MUON_ESD_tracks();
+ MUON_Ref_tracks();
+ MUON_MC_tracks();
+ }
gReve->EnableRedraw();
gReve->Redraw3D(kTRUE);
+
/*
TGLViewer* view = dynamic_cast<TGLViewer*>(gReve->GetGLCanvas()->GetViewer3D());
view->ResetCamerasAfterNextUpdate();
rl->LoadTracks("MUON");
TTree* tt = rl->GetTreeT("MUON", false);
- AliMagF* mag_field = Alieve::Event::AssertMagField();
-
TClonesArray *tracks = 0;
tt->SetBranchAddress("MUONTrack",&tracks);
tt->GetEntry(0);
Reve::TrackList* lt = new Reve::TrackList("M-Tracks");
lt->SetMainColor(Color_t(6));
-
+ //lt->SetMUON();
+
gReve->AddRenderElement(lt);
TMatrixD smatrix(2,2);
mt = (AliMUONTrack*) tracks->At(n);
- //printf("Match trigger %d \n",mt->GetMatchTrigger());
-
rt.label = n;
Alieve::MUONTrack* track = new Alieve::MUONTrack(&rt, lt->GetRnrStyle());
- track->MakeTrack(mt, mag_field);
+ track->MakeMUONTrack(mt);
gReve->AddRenderElement(lt, track);
- continue;
+ }
- /* old tracks display */
+}
- Reve::Track* rtrack = new Reve::Track(&rt, lt->GetRnrStyle());
+//_____________________________________________________________________________
+void MUON_trigger_tracks() {
- //PH The line below is replaced waiting for a fix in Root
- //PH which permits to use variable siza arguments in CINT
- //PH on some platforms (alphalinuxgcc, solariscc5, etc.)
- char form[1000];
- if (mt->GetMatchTrigger()) {
- //PH track->SetName(Form("MUONTrack %2d (MT)", rt.label));
- sprintf(form,"MUONTrack %2d (MT)", rt.label);
- rtrack->SetName(form);
- rtrack->SetLineStyle(1);
- rtrack->SetLineColor(4);
- } else {
- //PH track->SetName(Form("MUONTrack %2d ", rt.label));
- sprintf(form,"MUONTrack %2d ", rt.label);
- rtrack->SetName(form);
- rtrack->SetLineStyle(2);
- rtrack->SetLineColor(4);
- }
+ AliRunLoader* rl = Alieve::Event::AssertRunLoader();
+ rl->LoadTracks("MUON");
+ TTree* tt = rl->GetTreeT("MUON", false);
- AliMUONTrackParam *trackParam = mt->GetTrackParamAtVertex();
- xRec0 = trackParam->GetNonBendingCoor();
- yRec0 = trackParam->GetBendingCoor();
- zRec0 = trackParam->GetZ();
+ TClonesArray *tracks = 0;
+ tt->SetBranchAddress("MUONTriggerTrack",&tracks);
+ tt->GetEntry(0);
- rtrack->SetPoint(count,xRec0,yRec0,zRec0);
- count++;
-
- Float_t xr[20], yr[20], zr[20];
- for (Int_t i = 0; i < 10; i++) xr[i]=yr[i]=zr[i]=0.0;
-
- Int_t nTrackHits = mt->GetNTrackHits();
- //printf("Nhits = %d \n",nTrackHits);
- TClonesArray* trackParamAtHit;
- for (Int_t iHit = 0; iHit < nTrackHits; iHit++){
- trackParamAtHit = mt->GetTrackParamAtHit();
- trackParam = (AliMUONTrackParam*) trackParamAtHit->At(iHit);
- xRec = trackParam->GetNonBendingCoor();
- yRec = trackParam->GetBendingCoor();
- zRec = trackParam->GetZ();
-
- //printf("Hit %d x %f y %f z %f \n",iHit,xRec,yRec,zRec);
-
- xr[iHit] = xRec;
- yr[iHit] = yRec;
- zr[iHit] = zRec;
-
- rtrack->SetPoint(count,xRec,yRec,zRec);
- count++;
+ Int_t ntracks = tracks->GetEntriesFast();
+ //printf("Found %d tracks. \n",ntracks);
+
+ Reve::TrackList* lt = new Reve::TrackList("MT-Tracks");
+ lt->SetMainColor(Color_t(4));
+ //lt->SetMUON();
+
+ gReve->AddRenderElement(lt);
+
+ TMatrixD smatrix(2,2);
+ TMatrixD sums(2,1);
+ TMatrixD res(2,1);
+
+ Float_t xRec, xRec0;
+ Float_t yRec, yRec0;
+ Float_t zRec, zRec0;
+
+ Float_t zg[4] = { -1603.5, -1620.5, -1703.5, -1720.5 };
+
+ AliMUONTriggerTrack *mt;
+ Reve::RecTrack rt;
+ Int_t count;
+ for (Int_t n = 0; n < ntracks; n++) {
- }
+ count = 0;
- Float_t xrc[20], yrc[20], zrc[20];
- Int_t nrc = 0;
- if (mt->GetMatchTrigger() && 1) {
-
- for (Int_t i = 0; i < nTrackHits; i++) {
- if (TMath::Abs(zr[i]) > 1000.0) {
- //printf("Hit %d x %f y %f z %f \n",iHit,xr[i],yr[i],zr[i]);
- xrc[nrc] = xr[i];
- yrc[nrc] = yr[i];
- zrc[nrc] = zr[i];
- nrc++;
- }
- }
+ mt = (AliMUONTriggerTrack*) tracks->At(n);
- Double_t xv, yv;
- Float_t ax, bx, ay, by;
-
- if (nrc < 2) continue;
-
- // fit x-z
- smatrix.Zero();
- sums.Zero();
- for (Int_t i = 0; i < nrc; i++) {
- xv = (Double_t)zrc[i];
- yv = (Double_t)xrc[i];
- //printf("x-z: xv %f yv %f \n",xv,yv);
- smatrix(0,0) += 1.0;
- smatrix(1,1) += xv*xv;
- smatrix(0,1) += xv;
- smatrix(1,0) += xv;
- sums(0,0) += yv;
- sums(1,0) += xv*yv;
- }
- res = smatrix.Invert() * sums;
- ax = res(0,0);
- bx = res(1,0);
-
- // fit y-z
- smatrix.Zero();
- sums.Zero();
- for (Int_t i = 0; i < nrc; i++) {
- xv = (Double_t)zrc[i];
- yv = (Double_t)yrc[i];
- //printf("y-z: xv %f yv %f \n",xv,yv);
- smatrix(0,0) += 1.0;
- smatrix(1,1) += xv*xv;
- smatrix(0,1) += xv;
- smatrix(1,0) += xv;
- sums(0,0) += yv;
- sums(1,0) += xv*yv;
- }
- res = smatrix.Invert() * sums;
- ay = res(0,0);
- by = res(1,0);
+ rt.label = n;
- Float_t xtc, ytc, ztc;
- for (Int_t ii = 0; ii < 4; ii++) {
+ Alieve::MUONTrack* track = new Alieve::MUONTrack(&rt, lt->GetRnrStyle());
- ztc = zg[ii];
- ytc = ay+by*zg[ii];
- xtc = ax+bx*zg[ii];
+ track->MakeMUONTriggerTrack(mt);
- //printf("tc: x %f y %f z %f \n",xtc,ytc,ztc);
+ gReve->AddRenderElement(lt, track);
- rtrack->SetPoint(count,xtc,ytc,ztc);
- count++;
+ }
- }
+}
- } // end match trigger
+//_____________________________________________________________________________
+void MUON_ESD_tracks() {
+
+ AliESD* esd = Alieve::Event::AssertESD();
- gReve->AddRenderElement(lt, rtrack);
+ Reve::TrackList* lt = new Reve::TrackList("ESD-Tracks");
+ lt->SetMainColor(Color_t(6));
+ //lt->SetMUON();
- } // end track loop
+ gReve->AddRenderElement(lt);
+
+ AliESDMuonTrack *mt;
+ Reve::RecTrack rt;
+ Int_t nMuonTracks = esd->GetNumberOfMuonTracks();
+ for (Int_t n = 0; n < nMuonTracks; n++) {
+
+ mt = esd->GetMuonTrack(n);
+
+ rt.label = n;
+
+ Alieve::MUONTrack* track = new Alieve::MUONTrack(&rt, lt->GetRnrStyle());
+
+ track->MakeESDTrack(mt);
+
+ gReve->AddRenderElement(lt, track);
+
+ }
+
+}
+
+//_____________________________________________________________________________
+void MUON_Ref_tracks() {
+
+ AliRunLoader* rl = Alieve::Event::AssertRunLoader();
+
+ AliLoader * ml = rl->GetLoader("MUONLoader");
+ AliMUONData * mdata = new AliMUONData(ml,"MUON","MUON");
+
+ rl->LoadKinematics("READ");
+ rl->LoadTrackRefs("READ");
+
+ AliMUONRecoCheck rc(rl,mdata);
+
+ rc.ResetTracks();
+ rc.MakeTrackRef();
+
+ Reve::TrackList* lt = new Reve::TrackList("Ref-Tracks");
+ lt->SetMainColor(Color_t(6));
+ //lt->SetMUON();
+
+ gReve->AddRenderElement(lt);
+
+ AliMUONTrack *mt;
+ Reve::RecTrack rt;
+ TClonesArray * trackRefArray = rc.GetMuonTrackRef();
+ Int_t nTrackRef = trackRefArray->GetEntriesFast();
+
+ for (Int_t i = 0; i < nTrackRef; i++) {
+
+ mt = (AliMUONTrack *)trackRefArray->At(i);
+
+ rt.label = i;
+
+ Alieve::MUONTrack* track = new Alieve::MUONTrack(&rt, lt->GetRnrStyle());
+
+ track->MakeRefTrack(mt);
+
+ gReve->AddRenderElement(lt, track);
+
+ }
+
+}
+
+//_____________________________________________________________________________
+void MUON_MC_tracks() {
+
+ Double_t RADDEG = 180.0/TMath::Pi();
+
+ AliRunLoader* rl = Alieve::Event::AssertRunLoader();
+ rl->LoadKinematics();
+ AliStack* stack = rl->Stack();
+
+ Int_t nPrimary = stack->GetNprimary();
+ Int_t nTracks = stack->GetNtrack();
+
+ Reve::TrackList* lt = new Reve::TrackList("MC-Tracks");
+ lt->SetMainColor(Color_t(6));
+ //lt->SetMUON();
+
+ gReve->AddRenderElement(lt);
+
+ Int_t pdgCode;
+ TParticle *part;
+ Reve::RecTrack rt;
+
+ Int_t nHitTracks = g_muon_data->GetNTrackList();
+ Int_t index;
+ for (Int_t i = 0; i < nHitTracks; i++) {
+
+ index = g_muon_data->GetTrack(i);
+ if (index >= nTracks) {
+ cout << "Hit track index larger than number in stack!" << endl;
+ continue;
+ }
+
+ part = stack->Particle(index);
+ if (part->P() < 0.001) continue; // skip momenta < 1.0 MeV/c
+ rt.label = i;
+
+ Alieve::MUONTrack* track = new Alieve::MUONTrack(&rt, lt->GetRnrStyle());
+
+ track->MakeMCTrack(part);
+
+ gReve->AddRenderElement(lt, track);
+
+ }
}