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

correct initialization of variables, add LUT in DiamantWatchers and NedaWatchers


git-svn-id: svn+ssh://anonsvn.in2p3.fr/agata/gammaware/trunk@2261 c3abf467-7ff2-0310-b516-c5fb849bdde0
parent 984f5273
......@@ -348,6 +348,7 @@ void ADHitTree::Exec(Option_t * /*option*/)
nbHits =0;
nbCores =0;
fTimestamp =0;
for(int i=0; i<MaxCore ; i++) {//empty array coreE0 coreE1
coreE0[i]=-1;
coreE1[i]=-1;
......
......@@ -37,7 +37,7 @@ DIAMANTWatchers::DIAMANTWatchers(const char *name, const char *title, TDirector
fMFMFrame(new MFMDiamantFrame()),
fFrame(0x0)
{
LoadLUT();
}
Bool_t DIAMANTWatchers::SetTrigger( ADF::DFTrigger *trigger )
......@@ -62,21 +62,48 @@ MFMDiamantFrame *DIAMANTWatchers::GetMFM()
return fMFMFrame;
}
void DIAMANTWatchers::Exec(Option_t * /*option*/)
void DIAMANTWatchers::LoadLUT()
{
if ( fFrame == 0x0 || !fFrame->IsValid() ) {
SetLastExecStatus(1u);
return;
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();
}
MFMDiamantFrame *mfmframe = GetMFM();
if ( mfmframe == 0x0 ){
std::cout << "BUG" << std::endl;
return;
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;
}
}
void DIAMANTWatchers::Exec(Option_t * /*option*/)
{
fBoardID = 0;
fChannelID = 0;
DIAMANTId = 0;
fStatus1 = 0;
fStatus2 = 0;
......@@ -84,12 +111,26 @@ void DIAMANTWatchers::Exec(Option_t * /*option*/)
fTop = 0;
fPID = 0.;
fADFTimestamp = 0;
if ( fFrame == 0x0 || !fFrame->IsValid() ) {
SetLastExecStatus(1u);
return;
}
MFMDiamantFrame *mfmframe = GetMFM();
if ( mfmframe == 0x0 ){
std::cout << "BUG" << std::endl;
return;
}
fADFTimestamp = ((AgataKey *)fFrame->GetFrame()->GetKey())->GetTimeStamp();
fMFMTimestamp = mfmframe->GetTimeStamp();
fBoardID = mfmframe->GetBoardId();
fChannelID = mfmframe->GetTGCristalId();
DIAMANTId = fLookUpTable[fBoardID*100+fChannelID];
fStatus1 = mfmframe->GetStatus(0);
fStatus2 = mfmframe->GetStatus(0);
......@@ -218,6 +259,7 @@ void DIAMANTTree::SetBranches()
{
GetTree()->Branch("DIAMANTBoard", &fBoardID, "BoardId/s" );
GetTree()->Branch("DIAMANTChannel", &fChannelID, "ChannelId/s" );
GetTree()->Branch("DIAMANTId", &DIAMANTId, "DIAMANTId/s" );
GetTree()->Branch("Status1", &fStatus1, "Status1/I" );
GetTree()->Branch("Status2", &fStatus2, "Status2/I" );
......
......@@ -72,8 +72,7 @@ protected:
ULong64_t fLastADFTimestamp = 0;
ULong64_t fMFMTimestamp;
Int_t fBoardID;
Int_t fChannelID;
UShort_t fBoardID, fChannelID, DIAMANTId;
UInt_t fStatus1, fStatus2;
Float_t fEnergy, fTop, fPID;
......@@ -81,6 +80,8 @@ protected:
UInt_t fNEvts = 0;
map< Int_t, vector<Int_t> > fStatPerBoard;
map< Int_t, Int_t > fLookUpTable;
public:
DIAMANTWatchers(const char *name, const char *title, TDirectory *sp_dir = 0x0, TDirectory *tag_dir = 0x0);
virtual ~DIAMANTWatchers()
......@@ -96,6 +97,8 @@ public:
*/
virtual Bool_t SetTrigger( ADF::DFTrigger */*trigger*/ = 0x0 );
void LoadLUT();
//! watch the current frame
virtual void Exec(Option_t *option="");
......@@ -130,6 +133,7 @@ public:
DIAMANTTree(const char *name, const char *title, TTree *tree = 0x0);
virtual ~DIAMANTTree();
//! watch the current frame
virtual void Exec(Option_t *option="");
......
......@@ -143,7 +143,10 @@ void EventDIAMANTWatchers::Exec(Option_t * /*option*/)
{
// be sure the frame has been set properly
if ( fFrame == 0x0 || !fFrame->IsValid() ) {
// cout << "non valid frame" << endl;
nbDIAMANT = 0;
fTimestamp = 0;
return;
}
......
......@@ -144,7 +144,10 @@ void EventNEDAWatchers::Exec(Option_t * /*option*/)
{
// be sure the frame has been set properly
if ( fFrame == 0x0 || !fFrame->IsValid() ) {
// cout << "non valid frame" << endl;
nbNEDA = 0;
fTimestamp = 0;
return;
}
......
......@@ -175,7 +175,43 @@ NEDATree::NEDATree(const char *name, const char *title, TTree *tree) :
SetBranches();
}
// create spetra
LoadLUT();
}
void NEDATree::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;
}
}
NEDATree::~NEDATree()
......@@ -186,6 +222,7 @@ void NEDATree::SetBranches()
{
GetTree()->Branch("NEDABoard", &BoardId, "BoardId/s" );
GetTree()->Branch("NEDAChannel", &ChannelId, "ChannelId/s" );
GetTree()->Branch("NEDAId", &NEDAId, "NEDAId/s" );
GetTree()->Branch("NEDATdc", &NEDATdc, "NEDATdc/s" );
GetTree()->Branch("NEDAFast", &NEDAFast, "NEDAFast/s" );
......@@ -197,18 +234,20 @@ void NEDATree::SetBranches()
void NEDATree::Exec(Option_t * /*option*/)
{
if ( fFrame == 0x0 || !fFrame->IsValid() ) {
SetLastExecStatus(1u);
return;
}
BoardId = 0;
ChannelId = 0;
NEDAId = 0;
NEDATdc = 0;
NEDAFast = 0;
NEDASlow = 0;
NEDAZco = 0;
fTimestamp = 0;
if ( fFrame == 0x0 || !fFrame->IsValid() ) {
SetLastExecStatus(1u);
return;
}
fTimestamp = ((AgataKey *)fFrame->GetFrame()->GetKey())->GetTimeStamp();
......@@ -220,6 +259,7 @@ void NEDATree::Exec(Option_t * /*option*/)
BoardId = mfmframe->GetBoardId();
ChannelId = mfmframe->GetChannelId() ;
NEDAId = fLookUpTable[BoardId*100+ChannelId];
NEDATdc = mfmframe->GetTdcCorValue();
NEDAFast = mfmframe->GetFastIntegral();
......
......@@ -122,10 +122,12 @@ class NEDATree : public NEDAWatchers, public TTreeBuilder
{
private:
UShort_t BoardId, ChannelId;
UShort_t BoardId, ChannelId, NEDAId;
UShort_t NEDATdc, NEDAFast, NEDASlow ,NEDAZco;
ULong64_t fTimestamp;
map< Int_t, Int_t > fLookUpTable;
protected:
virtual void SetBranches();
......@@ -133,6 +135,8 @@ public:
NEDATree(const char *name, const char *title, TTree *tree = 0x0);
virtual ~NEDATree();
void LoadLUT();
//! watch the current frame
virtual void Exec(Option_t *option="");
......
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