Commit 19886d85 authored by J.Dudouet [IPNL/CSNSM]'s avatar J.Dudouet [IPNL/CSNSM]
Browse files

GuiBuildTree : Add vertex

ADTree : bug correction for empty gamma rays
EventDIAMANTWatchers : add LookUpTable
EventNEDAWatchers : add LookUpTable


git-svn-id: svn+ssh://anonsvn.in2p3.fr/agata/gammaware/trunk@2258 c3abf467-7ff2-0310-b516-c5fb849bdde0
parent c9bb0551
......@@ -32,6 +32,8 @@
#include "EventDIAMANTWatchers.h"
#endif
#include "MetaWatchers.h"
using namespace std;
GuiBuildTree::GuiBuildTree(const TGWindow *p, UInt_t w, UInt_t h) :
......@@ -113,6 +115,33 @@ GuiBuildTree::GuiBuildTree(const TGWindow *p, UInt_t w, UInt_t h) :
fNEVAMOSMode->SetState(false);
fHorizontalFrame = new TGCompositeFrame(fTreeReaderTab, 60, 20, kHorizontalFrame);
fTreeReaderTab->AddFrame(fHorizontalFrame,new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX, 0, 0, 5, 0));
fHorizontalFrame->AddFrame(new TGLabel(fHorizontalFrame, "Use vertex : "),new TGLayoutHints(kLHintsTop | kLHintsLeft, 10, 5, 8, 0));
fUseVertexButton = new TGCheckButton(fHorizontalFrame, "", -4500);
fUseVertexButton->Connect("Clicked()","GuiBuildTree", this, "HandleButtons()");
fUseVertexButton->SetState(kButtonUp);
fUseVertex=false;
fHorizontalFrame->AddFrame(fUseVertexButton, new TGLayoutHints(kLHintsTop | kLHintsLeft,5,0,8,0));
fHorizontalFrame->AddFrame(new TGLabel(fHorizontalFrame, "position : "),new TGLayoutHints(kLHintsTop | kLHintsLeft, 10, 5, 8, 0));
fVertexPosEntry = new TGTextEntry(fHorizontalFrame, "0.,0.,0. ");
fVertexPosEntry->Connect("TextChanged(const char *)", "GuiBuildTree", this, "Update()");
fVertexPosEntry->SetToolTipText("Vertex position : px,py,pz");
fVertexPosEntry->SetState(false);
fHorizontalFrame->AddFrame(fVertexPosEntry, new TGLayoutHints(kLHintsTop | kLHintsLeft,5,0,8,0));
fHorizontalFrame->AddFrame(new TGLabel(fHorizontalFrame, "direction : "),new TGLayoutHints(kLHintsTop | kLHintsLeft, 10, 5, 8, 0));
fVertexDirEntry = new TGTextEntry(fHorizontalFrame, "0.,0.,1. ");
fVertexDirEntry->Connect("TextChanged(const char *)", "GuiBuildTree", this, "Update()");
fVertexDirEntry->SetToolTipText("Vertex direction : dx,dy,dz");
fVertexDirEntry->SetState(false);
fHorizontalFrame->AddFrame(fVertexDirEntry, new TGLayoutHints(kLHintsTop | kLHintsLeft,5,0,8,0));
fHorizontalFrame->AddFrame(new TGLabel(fHorizontalFrame, "beta : "),new TGLayoutHints(kLHintsTop | kLHintsLeft, 10, 5, 8, 0));
fVertexBetaNE = new TGNumberEntry(fHorizontalFrame, 0.02, 8,-1, TGNumberFormat::kNESReal);
fVertexBetaNE->Connect("ValueSet(Long_t)", "GuiBuildTree", this, "Update()");
fVertexBetaNE->SetState(false);
fHorizontalFrame->AddFrame(fVertexBetaNE,new TGLayoutHints(kLHintsTop | kLHintsLeft,0,0,5,5));
fHorizontalFrame = new TGCompositeFrame(fTreeReaderTab, 60, 20, kHorizontalFrame);
fTreeReaderTab->AddFrame(fHorizontalFrame,new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX, 0, 0, 5, 0));
fHorizontalFrame->AddFrame(new TGLabel(fHorizontalFrame, "Use Tracking : "),new TGLayoutHints(kLHintsTop | kLHintsLeft, 10, 5, 8, 0));
......@@ -384,6 +413,10 @@ void GuiBuildTree::PrintConfig()
}
else
PrintInListBox(fResumeBox,"Vamos not used",kError);
if(fUseVertex)
{
PrintInListBox(fResumeBox,Form("Vertex used using pos(%f,%f,%f), dir(%f,%f,%f), beta = %f",fVertexPos[0],fVertexPos[1],fVertexPos[2],fVertexDir[0],fVertexDir[1],fVertexDir[2],fVertexBeta),kPrint);
}
if(fUseTracking)
{
if(fTriggerName.Contains("data:tracked"))
......@@ -544,8 +577,17 @@ void GuiBuildTree::ProcessRun(int RunIndex)
if(fUseTracking)
{
if(fUseVertex)
{
VertexInterface *vertex = VertexBuilder::theCurrentVertexBuilder()->GetVertex();
vertex->SetPosition (fVertexPos[0], fVertexPos[1], fVertexPos[2]);
vertex->SetDirection(fVertexDir[0], fVertexDir[1], fVertexDir[2]);
vertex->SetBeta(fVertexBeta);
}
ADTrackTree *trackw = rootmaster->Add<ADTrackTree>("TrackTree","Branch on track");
trackw->SetAgataOffset(fAGATAOffset);
}
if(fUsePSAHits)
......@@ -659,6 +701,18 @@ void GuiBuildTree::Update()
Int_t RunMin = fRunMin->GetIntNumber();
Int_t RunMax = fRunMax->GetIntNumber();
TString tmp = fVertexPosEntry->GetText();
TObjArray *arr = tmp.Tokenize(",");
fVertexPos[0] = ((TString)arr->At(0)->GetName()).Atof();
fVertexPos[1] = ((TString)arr->At(1)->GetName()).Atof();
fVertexPos[2] = ((TString)arr->At(2)->GetName()).Atof();
delete arr;
arr = tmp.Tokenize(",");
fVertexDir[0] = ((TString)arr->At(0)->GetName()).Atof();
fVertexDir[1] = ((TString)arr->At(1)->GetName()).Atof();
fVertexDir[2] = ((TString)arr->At(2)->GetName()).Atof();
delete arr;
fVertexBeta = fVertexBetaNE->GetNumber();
if( gTQSender == fRunMin && RunMax<RunMin)
{
......@@ -792,7 +846,7 @@ void GuiBuildTree::Update()
if(fname.BeginsWith(fPatternOfROOTFiles) && fname.EndsWith(".root"))
{
fRootTreeBox->AddEntry(fname,-1);
fRootTreeBox->AddEntry(fname,-1);
}
}
}
......@@ -838,6 +892,13 @@ void GuiBuildTree::HandleButtons(Int_t id)
if(id==-4000) //Use vertexbuilder
fUseVertexBuilder = btn->IsOn();
if(id==-4500) //Use vertexbuilder
{
fUseVertex = btn->IsOn();
fVertexPosEntry->SetState((EButtonState)fUseVertex);
fVertexDirEntry->SetState((EButtonState)fUseVertex);
fVertexBetaNE->SetState((EButtonState)fUseVertex);
}
if(id==-5000) //Use Tracking
{
fUseTracking = btn->IsOn();
......@@ -856,6 +917,10 @@ void GuiBuildTree::DisableEntries()
fUseVAMOSButton->SetState(kButtonDisabled);
fNEVAMOSMode->SetState(false);
fUseVertexBuilderButton->SetState(kButtonDisabled);
fUseVertexButton->SetState(kButtonDisabled);
fVertexPosEntry->SetState(false);
fVertexDirEntry->SetState(false);
fVertexBetaNE->SetState(false);
fUseTrackingButton->SetState(kButtonDisabled);
fNEAGATAOffset->SetState(false);
fUsePSAHitsButton->SetState(kButtonDisabled);
......@@ -903,6 +968,11 @@ void GuiBuildTree::EnableEntries()
if(fUseVAMOS==false)
fUseVertexBuilderButton->SetState(kButtonDisabled);
fUseVertexButton->SetState((EButtonState)fUseVertex);
fVertexPosEntry->SetState(fUseVertex);
fVertexDirEntry->SetState(fUseVertex);
fVertexBetaNE->SetState(fUseVertex);
fUseTrackingButton->SetState((EButtonState)fUseTracking);
fUsePSAHitsButton->SetState((EButtonState)fUsePSAHits);
fUseNEDAButton->SetState((EButtonState)fUseNEDA);
......@@ -916,6 +986,10 @@ void GuiBuildTree::SaveConfig()
outputfile<<fUseVAMOS<<endl;
outputfile<<fVAMOSMode<<endl;
outputfile<<fUseVertexBuilder<<endl;
outputfile<<fUseVertex<<endl;
outputfile<<fVertexPosEntry->GetText()<<endl;
outputfile<<fVertexDirEntry->GetText()<<endl;
outputfile<<fVertexBeta<<endl;
outputfile<<fUseTracking<<endl;
outputfile<<fAGATAOffset<<endl;
outputfile<<fUsePSAHits<<endl;
......@@ -951,6 +1025,19 @@ void GuiBuildTree::LoadConfig()
if(fUseVAMOS==false)
fUseVertexBuilderButton->SetState(kButtonDisabled);
getline(outputfile,line);fUseVertex = atoi(line.c_str());
getline(outputfile,line);fVertexPosEntry->SetTitle(line.c_str());
getline(outputfile,line);fVertexDirEntry->SetTitle(line.c_str());
getline(outputfile,line);fVertexBetaNE->SetNumber(atof(line.c_str()));
if(fUseVertex)
{
fUseVertexButton->SetState(kButtonDown);
fVertexPosEntry->SetState(true);
fVertexDirEntry->SetState(true);
fVertexBetaNE->SetState(true);
}
getline(outputfile,line);fUseTracking = atoi(line.c_str());
if(fUseTracking==false)
{
......
......@@ -90,6 +90,8 @@ class GuiBuildTree : public TGMainFrame
TGTextEntry *fADFPatt;
TGTextEntry *fTETrigger;
TGTextEntry *fVertexPosEntry;
TGTextEntry *fVertexDirEntry;
TGTextEntry *fTEPathToOut;
TGTextEntry *fTEPatternOfROOTFiles;
......@@ -102,6 +104,8 @@ class GuiBuildTree : public TGMainFrame
TGCheckButton *fUseVAMOSButton;
TGCheckButton *fUseVertexBuilderButton;
TGCheckButton *fUseTrackingButton;
TGCheckButton *fUseVertexButton;
TGCheckButton *fUsePSAHitsButton;
TGCheckButton *fUseNEDAButton;
TGCheckButton *fUseDIAMANTButton;
......@@ -111,6 +115,8 @@ class GuiBuildTree : public TGMainFrame
TGNumberEntry *fNEVAMOSMode;
TGNumberEntry *fNEAGATAOffset;
TGNumberEntry *fVertexBetaNE;
bool fShowAllADF;
......@@ -136,6 +142,7 @@ class GuiBuildTree : public TGMainFrame
bool fUseVertexBuilder;
int fVAMOSMode;
bool fUseTracking;
bool fUseVertex;
bool fUsePSAHits;
float fAGATAOffset;
......@@ -147,6 +154,10 @@ class GuiBuildTree : public TGMainFrame
vector< TString > fListOfRunsFolderName;
vector< vector < TString > >fListOfRunsToProcessPath;
Float_t fVertexPos[3];
Float_t fVertexDir[3];
Float_t fVertexBeta;
TString fCurrentFileName;
TGHProgressBar *fProgressBar;
......
......@@ -158,6 +158,9 @@ void ADTrackTree::Exec(Option_t * /*option*/)
for (UShort_t i = 0u; i < nbTrack; i++) {
const TrackedHit *gamma1 = data->GetGamma(i);
if(gamma1->GetNbHits()==0)
continue;
const Hit *hit1 = gamma1->GetHit();
Double_t x = gamma1->GetX() - px;
......
......@@ -23,9 +23,6 @@
#include "AgataKeyFactory.h"
#include "DFAgent.h"
#include "TH3.h"
#include "TH2.h"
#include "TH1.h"
using namespace ADF;
......@@ -68,6 +65,42 @@ UInt_t EventDIAMANTWatchers::GetNbSubFrame()
return 0u;
}
void EventDIAMANTWatchers::LoadLUT()
{
ifstream file("diamant_id_lookup");
string line;
TString Buffer;
if(!file)
{
fBashColor->SetWarningOut();
cout<<"DIAMANT look up table (diamant_id_lookup) not found !"<<endl;
fBashColor->ResetColor();
}
while(file)
{
getline(file,line);
Buffer=line;
if(Buffer.BeginsWith("#"))
continue;
Buffer.ReplaceAll("\t"," ");
TObjArray *arr = Buffer.Tokenize(" ");
if(arr->GetEntries() != 3)
continue;
Int_t BoardID = ((TString)arr->At(1)->GetName()).Atoi();
Int_t ChannelID = ((TString)arr->At(2)->GetName()).Atoi();
Int_t ID = ((TString)arr->At(0)->GetName()).Atoi();
fLookUpTable[BoardID*100+ChannelID] = ID;
}
}
MFMDiamantFrame *EventDIAMANTWatchers::GetMFM(UInt_t which)
{
// does not exist
......@@ -116,6 +149,7 @@ void EventDIAMANTWatchers::Exec(Option_t * /*option*/)
memset(BoardId ,0,sizeof(UShort_t)*MaxDIAMANT);
memset(ChannelId,0,sizeof(UShort_t)*MaxDIAMANT);
memset(DIAMANTId,0,sizeof(UShort_t)*MaxDIAMANT);
memset(Status1,0,sizeof(Int_t)*MaxDIAMANT);
memset(Status2,0,sizeof(Int_t)*MaxDIAMANT);
......@@ -148,6 +182,8 @@ void EventDIAMANTWatchers::Exec(Option_t * /*option*/)
BoardId[i] = mfmframe->GetBoardId();
ChannelId[i] = mfmframe->GetTGCristalId() ;
DIAMANTId[i] = fLookUpTable[BoardId[i]*100+ChannelId[i]];
Status1[i] = mfmframe->GetStatus(0);
Status2[i] = mfmframe->GetStatus(1);
Energy[i] = mfmframe->GetEnergy()/512.;
......@@ -246,8 +282,14 @@ void EventDIAMANTSpectra::Exec(Option_t * /*option*/)
continue;
}
fBoardxChannel->Fill(mfmframe->GetBoardId(),mfmframe->GetTGCristalId());
fBoardxChannel->Fill(BoardId[i],ChannelId[i]);
if(fMapOfPIDvsE[BoardId[i]*100+ChannelId[i]] == nullptr)
{
fMapOfPIDvsE[BoardId[i]*100+ChannelId[i]] = MakeTH2<TH2F>(Form("PIDvsE_B%d_Ch%d",BoardId[i],ChannelId[i]),Form("PIDvsE_B%d_Ch%d",BoardId[i],ChannelId[i]),500,0,1000.,500,0,1.);
}
fMapOfPIDvsE[BoardId[i]*100+ChannelId[i]]->Fill(Energy[i],PID[i]);
}
}
......@@ -271,6 +313,7 @@ void EventDIAMANTTree::SetBranches()
GetTree()->Branch("nbDIAMANT", &nbDIAMANT, "nbDIAMANT/I");
GetTree()->Branch("DIAMANTBoard", BoardId, "DIAMANTBoard[nbDIAMANT]/s" );
GetTree()->Branch("DIAMANTChannel", ChannelId, "DIAMANTChannel[nbDIAMANT]/s" );
GetTree()->Branch("DIAMANTId", DIAMANTId, "DIAMANTId[nbDIAMANT]/s" );
GetTree()->Branch("DIAMANT_Stat1" ,Status1, "DIAMANT_Stat1[nbDIAMANT]/I" );
GetTree()->Branch("DIAMANT_Stat2" ,Status2, "DIAMANT_Stat2[nbDIAMANT]/I" );
......
......@@ -35,10 +35,8 @@
// MFM
#include "MFMDiamantFrame.h"
class TH1F;
class TH2F;
class TH3F;
#include "TH1.h"
#include "TH2.h"
using namespace ADF;
using namespace Gw;
......@@ -70,7 +68,7 @@ protected:
protected:
Int_t nbDIAMANT;
UShort_t BoardId[MaxDIAMANT], ChannelId[MaxDIAMANT];
UShort_t BoardId[MaxDIAMANT], ChannelId[MaxDIAMANT], DIAMANTId[MaxDIAMANT];
UInt_t Status1[MaxDIAMANT], Status2[MaxDIAMANT];
Float_t Energy[MaxDIAMANT], Top[MaxDIAMANT], PID[MaxDIAMANT];
ULong64_t TSHit[MaxDIAMANT];
......@@ -79,6 +77,7 @@ protected:
protected:
UInt_t fNEvts = 0;
map< Int_t, vector<Int_t> > fStatPerBoard;
map< Int_t, Int_t > fLookUpTable;
public:
EventDIAMANTWatchers(const char *name, const char *title, TDirectory *sp_dir = 0x0, TDirectory *tag_dir = 0x0) :
......@@ -88,7 +87,9 @@ public:
fMFMFrame(new MFMDiamantFrame()),
fFrame(0x0),
fNEvts(0)
{;}
{
LoadLUT();
}
virtual ~EventDIAMANTWatchers()
{
if (fMFMFrame)
......@@ -99,6 +100,8 @@ public:
fSubFrame = 0x0;
}
void LoadLUT();
//! watch the current frame
virtual void Exec(Option_t *option="");
......@@ -119,6 +122,7 @@ class EventDIAMANTSpectra : public EventDIAMANTWatchers
private:
TH1 *fFold; //! Crystal fold
TH1 *fBoardxChannel; //! Board versus channel
map< Int_t, TH1* > fMapOfPIDvsE;
public:
EventDIAMANTSpectra(const char *name, const char *title, TDirectory *sp_dir = 0x0, TDirectory *tag_dir = 0x0);
......
......@@ -67,6 +67,42 @@ UInt_t EventNEDAWatchers::GetNbSubFrame()
return 0u;
}
void EventNEDAWatchers::LoadLUT()
{
ifstream file("neda_id_lookup");
string line;
TString Buffer;
if(!file)
{
fBashColor->SetWarningOut();
cout<<"NEDA look up table (neda_id_lookup) not found !"<<endl;
fBashColor->ResetColor();
}
while(file)
{
getline(file,line);
Buffer=line;
if(Buffer.BeginsWith("#"))
continue;
Buffer.ReplaceAll("\t"," ");
TObjArray *arr = Buffer.Tokenize(" ");
if(arr->GetEntries() != 3)
continue;
Int_t BoardID = ((TString)arr->At(1)->GetName()).Atoi();
Int_t ChannelID = ((TString)arr->At(2)->GetName()).Atoi();
Int_t ID = ((TString)arr->At(0)->GetName()).Atoi();
fLookUpTable[BoardID*100+ChannelID] = ID;
}
}
MFMNedaCompFrame *EventNEDAWatchers::GetMFM(UInt_t which)
{
// does not exist
......@@ -114,6 +150,7 @@ void EventNEDAWatchers::Exec(Option_t * /*option*/)
memset(BoardId,0,sizeof(UShort_t)*MaxNEDA);
memset(ChannelId,0,sizeof(UShort_t)*MaxNEDA);
memset(NEDAId,0,sizeof(UShort_t)*MaxNEDA);
memset(NEDATdc,0,sizeof(UShort_t)*MaxNEDA);
memset(NEDAFast,0,sizeof(UShort_t)*MaxNEDA);
......@@ -146,6 +183,7 @@ void EventNEDAWatchers::Exec(Option_t * /*option*/)
BoardId[i] = mfmframe->GetBoardId();
ChannelId[i] = mfmframe->GetChannelId() ;
NEDAId[i] = fLookUpTable[BoardId[i]*100+ChannelId[i]];
if(fStatPerBoard[BoardId[i]].size() == 0)
{
......@@ -268,6 +306,7 @@ void EventNEDATree::SetBranches()
GetTree()->Branch("nbNEDA", &nbNEDA, "nbNEDA/I");
GetTree()->Branch("NEDABoard", BoardId, "BoardId[nbNEDA]/s" );
GetTree()->Branch("NEDAChannel", ChannelId, "ChannelId[nbNEDA]/s" );
GetTree()->Branch("NEDAId", NEDAId, "NEDAId[nbNEDA]/s" );
GetTree()->Branch("NEDATdc", NEDATdc, "NEDATdc[nbNEDA]/s" );
GetTree()->Branch("NEDAFast", NEDAFast, "NEDAFast[nbNEDA]/s" );
......
......@@ -70,7 +70,7 @@ protected:
protected:
Int_t nbNEDA;
UShort_t BoardId[MaxNEDA], ChannelId[MaxNEDA];
UShort_t BoardId[MaxNEDA], ChannelId[MaxNEDA], NEDAId[MaxNEDA];
UShort_t NEDATdc[MaxNEDA], NEDAFast[MaxNEDA], NEDASlow[MaxNEDA] ,NEDAZco[MaxNEDA];
ULong64_t TSHit[MaxNEDA];
ULong64_t fTimestamp;
......@@ -79,6 +79,9 @@ protected:
UInt_t fNEvts = 0;
map< Int_t, vector<Int_t> > fStatPerBoard;
map< Int_t, Int_t > fLookUpTable;
public:
EventNEDAWatchers(const char *name, const char *title, TDirectory *sp_dir = 0x0, TDirectory *tag_dir = 0x0) :
WatcherWithTag(name,title,sp_dir,tag_dir),
......@@ -87,7 +90,9 @@ public:
fMFMFrame(new MFMNedaCompFrame()),
fFrame(0x0),
fNEvts(0)
{;}
{
LoadLUT();
}
virtual ~EventNEDAWatchers()
{
if (fMFMFrame)
......@@ -103,6 +108,7 @@ public:
virtual void Print(const char *option="") const; //*MENU*
void LoadLUT();
//! Set the trigger attached to this watcher
/*!
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment