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

Add NEDAWatchers.C to inspect data:ranc0 frames


git-svn-id: svn+ssh://anonsvn.in2p3.fr/agata/gammaware/trunk@2244 c3abf467-7ff2-0310-b516-c5fb849bdde0
parent 03f152bb
......@@ -209,6 +209,8 @@ void KeyWatcher::Exec(Option_t * /*option*/)
return;
}
// cout<<fTimestamp<<endl;
if(FirstTimeStamp==0)
{
TTask *FD = ((TTask*)gROOT->GetListOfTasks()->FindObject("FD"));
......@@ -277,10 +279,10 @@ void KeyWatcher::Exec(Option_t * /*option*/)
if(fTimestamp<LastTimeStamp)
{
if(TMath::Abs(((double)fTimestamp-(double)FirstTimeStamp)*10*1e-9 < 1.))
if(0)//TMath::Abs(((double)fTimestamp-(double)FirstTimeStamp)*10*1e-9 < 1.))
{
// Print();
// ResetStats();
// Print();
// ResetStats();
}
else
{
......@@ -308,7 +310,19 @@ void KeyWatcher::Exec(Option_t * /*option*/)
if(fTimestamp < LastGoodTimeStamp)
{
// fBashColor->SetWarningOut();
// cout<<GetName()<<endl;
// cout<<"Warning, timestamp not good !!!"<<endl;
// fBashColor->ResetColor();
// cout<<"Last time stamp seen : "<<LastTimeStamp<<" ==> "<<fLastFillSec<<" s"<<endl;
// cout<<"Current time stamp : "<<fTimestamp<<" ==> "<<TSinSec<<" s"<<endl;
// cout<<"LastGoodTimeStamp = "<<LastGoodTimeStamp<<endl<<endl;
// cout<<"shift of "<<((double)fTimestamp-(double)LastGoodTimeStamp)*10*1e-9<<" s"<<endl;
fNRepeatedEvts++;
// cin.get();
}
fLastFillSec = TSinSec;
......@@ -386,7 +400,7 @@ void KeyWatcher::Exec(Option_t * /*option*/)
else
{
fHistMessageType->Fill(SubMess,1);
if(SubMess=="event:data:psa")
if(SubMess.BeginsWith("event:"))
{
UInt_t sublength, subcurrent, subeventnumber, submessage; ULong64_t subtimestamp; TString SubSubMess;
......@@ -430,16 +444,14 @@ void KeyWatcher::Exec(Option_t * /*option*/)
{
TimeAGATA = timestamp;
IsAGATA = true;
// double DTEvent = (timestamp-fTimestamp)*10;
// fHistDTEvent->Fill(-DTEvent);
}
}
if(SubMess=="data:ranc0" && MessageType=="event:data")
if((SubMess=="data:ranc0" || SubMess=="event:data:ranc0") && MessageType=="event:data")
{
TimeAnc0 = timestamp;
IsAnc0 = true;
}
if(SubMess=="data:ranc1" && MessageType=="event:data")
if((SubMess=="data:ranc1" || SubMess=="event:data:ranc1") && MessageType=="event:data")
{
TimeAnc1 = timestamp;
IsAnc1 = true;
......
/***************************************************************************
* Copyright (C) 2010 by Olivier Stezowski *
* stezow(AT)ipnl.in2p3.fr *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "iomanip"
#include "NEDAWatchers.h"
#include "AgataKeyFactory.h"
#include "DFAgent.h"
#include "TH3.h"
#include "TH2.h"
#include "TH1.h"
using namespace ADF;
NEDAWatchers::NEDAWatchers(const char *name, const char *title, TDirectory *sp_dir, TDirectory *tag_dir) :
WatcherWithTag(name,title,sp_dir,tag_dir),
fBashColor(new BashColor()),
fMFMFrame(new MFMNedaFrame()),
fFrame(0x0)
{
memset(fStatPerBoard, 0, sizeof(UInt_t)*MaxNEDA*(MaxChannel+1));
}
Bool_t NEDAWatchers::SetTrigger( ADF::DFTrigger *trigger )
{
if ( !Watcher::GetFromTrigger(trigger, "data:ranc0", fFrame) ) {
std::cout << "Cannot get data:ranc0, check your ADF.conf file " << std::endl;
return false;
}
return fFrame != 0x0;
}
MFMNedaFrame *NEDAWatchers::GetMFM()
{
// cannot read the data
if( fFrame->GetFrame()->Read() == 0 ) {
return 0x0;
}
// return the data interface for that frame
fMFMFrame->SetAttributs(((ADF::RawFrame *)fFrame->GetFrame())->RawBuffer().Address());
return fMFMFrame;
}
void NEDAWatchers::Exec(Option_t * /*option*/)
{
if ( fFrame == 0x0 || !fFrame->IsValid() ) {
SetLastExecStatus(1u);
return;
}
MFMNedaFrame *mfmframe = GetMFM();
fADFTimestamp = ((AgataKey *)fFrame->GetFrame()->GetKey())->GetTimeStamp();
fMFMTimestamp = mfmframe->GetTimeStamp();
fBoardID = mfmframe->GetBoardId();
fChannelID = mfmframe->GetChannelId();
fStatPerBoard[fBoardID][MaxChannel]++;
fStatPerBoard[fBoardID][fChannelID]++;
fNEvts++;
if(fADFTimestamp != fMFMTimestamp)
{
fBashColor->SetWarningOut();
cout<<"ADF and MFM timestamps not equal !"<<endl;
cout<<"ADF : "<<fADFTimestamp<<endl;
cout<<"MFM : "<<fMFMTimestamp<<endl;
cout<<"Board id : "<<mfmframe->GetBoardId()<<" ; Channel id : "<<mfmframe->GetChannelId()<<endl;
fBashColor->ResetColor();
}
fLastADFTimestamp = fADFTimestamp;
}
void NEDAWatchers::Print(const char * /* option */ ) const
{
std::cout<<std::endl;
int size = 3 + 3 + ((TString)GetName()).Length() + 5 + ((TString)GetTitle()).Length() + 3 + 3;
for(int i=0; i<size ; i++) std::cout<<"*";
std::cout<<std::endl;
std::cout<<"*** "<<GetName()<<" --- "<<GetTitle()<<" ***"<<std::endl;
for(int i=0; i<size ; i++) std::cout<<"*";
std::cout<<std::endl;
std::cout<<"Number of treated events : "<<fNEvts<<std::endl;
cout<<"Stat per board (and \% per channel):"<<endl;
for(int ib=0 ; ib<MaxNEDA ; ib++)
{
if(fStatPerBoard[ib][MaxChannel]>0)
{
cout<<"Board id "<<ib<<" : "<<fStatPerBoard[ib][MaxChannel]<<" (";
for(int ich=0 ; ich<MaxChannel-1 ; ich++)
cout<<Form("%5.1f ; ",(double)fStatPerBoard[ib][ich]/fStatPerBoard[ib][MaxChannel]*100.);
cout<<Form("%5.1f )",(double)fStatPerBoard[ib][MaxChannel-1]/fStatPerBoard[ib][MaxChannel]*100.)<<endl;
}
}
fBashColor->ResetColor();
}
NEDASpectra::NEDASpectra(const char *name, const char *title, TDirectory *sp_dir, TDirectory *tag_dir):
NEDAWatchers(name,title,sp_dir,tag_dir)
{
fBoardxChannel = MakeTH2<TH2F>("BC","Crystal Fold distributions",256,-0.5,255.5,16,-0.5,15.5);
}
void NEDASpectra::Exec(Option_t * /*option*/)
{
NEDAWatchers::Exec();
fBoardxChannel->Fill(fBoardID,fChannelID);
}
ClassImp(NEDAWatchers)
ClassImp(NEDASpectra)
/***************************************************************************
* Copyright (C) 2010 by Olivier Stezowski *
* stezow(AT)ipnl.in2p3.fr *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef _NEDAWatchers
#define _NEDAWatchers
// Watcher definition
#include "Watchers.h"
#include "TTreeWatchers.h"
#include "BashColor.h"
// ADF definitions
#include "AgataRawFrame.h"
// ROOT definitions
#include "Rtypes.h"
// MFM
#include "MFMNedaFrame.h"
class TH1F;
class TH2F;
class TH3F;
using namespace ADF;
using namespace Gw;
//! Base Watcher working for any event:data:ranc0
/*!
*/
class NEDAWatchers : public WatcherWithTag
{
static const Int_t MaxNEDA = 196;
static const Int_t MaxChannel = 16;
protected:
BashColor *fBashColor;
protected:
//! main frame i.e. data:ranc0
SharedFP *fFrame = 0x0;
//! current data:ranc0 frame to help decoding one by one
MFMNedaFrame *fMFMFrame = 0x0;
protected:
//! number of sub Frames extracted from the current event
MFMNedaFrame *GetMFM();
protected:
ULong64_t fADFTimestamp;
ULong64_t fLastADFTimestamp = 0;
ULong64_t fMFMTimestamp;
Int_t fBoardID;
Int_t fChannelID;
UInt_t fNEvts = 0;
UInt_t fStatPerBoard[MaxNEDA][MaxChannel+1];
public:
NEDAWatchers(const char *name, const char *title, TDirectory *sp_dir = 0x0, TDirectory *tag_dir = 0x0);
virtual ~NEDAWatchers()
{
if (fMFMFrame)
delete fMFMFrame;
fMFMFrame = 0x0;
}
//! Set the trigger attached to this watcher
/*!
look in the list of input Frame one called Agata data:tracked
*/
virtual Bool_t SetTrigger( ADF::DFTrigger */*trigger*/ = 0x0 );
//! watch the current frame
virtual void Exec(Option_t *option="");
virtual void Print(const char *option="") const; //*MENU*
ClassDef(NEDAWatchers,0)
};
class NEDASpectra : public NEDAWatchers
{
private:
TH1 *fBoardxChannel; //! Board versus channel
public:
NEDASpectra(const char *name, const char *title, TDirectory *sp_dir = 0x0, TDirectory *tag_dir = 0x0);
virtual ~NEDASpectra()
{;}
//! watch the current frame
virtual void Exec(Option_t *option="");
ClassDef(NEDASpectra,0)
};
#endif
......@@ -354,6 +354,7 @@ void LoadWatchers_ANCILLARIES()
gROOT->ProcessLine(tmp.Data());
}
LoadClass(Form("DefaultWatchers/%s/NEDAWatchers.C",CAMPAIGN.Data()));
LoadClass(Form("DefaultWatchers/%s/EventNEDAWatchers.C",CAMPAIGN.Data()));
LoadClass(Form("DefaultWatchers/%s/EventDIAMANTWatchers.C",CAMPAIGN.Data()));
......
......@@ -39,6 +39,7 @@
#include "MetaWatchers.h"
#ifdef WITH_MFM
#include "NEDAWatchers.h"
#include "EventNEDAWatchers.h"
#include "EventDIAMANTWatchers.h"
......@@ -256,6 +257,21 @@ Bool_t SetupWatchers(const char *df_type, FrameDispatcher *fd, const char *ext =
}
#ifdef WITH_MFM
if ( DFtype.Contains("NEDA") ) {
// define WatcherClient for a specific trigger
// it defines a trigger on an ancilary frame
AgataFrameTrigger *trig =
AgataFrameTrigger::Build("NEDA", "data:ranc0");
fd->SetTrigger(trig);
fd->Add<KeyWatcher>("NEDA_Keys","AgataKeys Watcher for the ancilary level");
fd->Add<NEDASpectra>("NEDASpectra","check contents of MFM frames");
ok = true;
}
if ( DFtype.Contains("NEDAB") ) {
// define WatcherClient for a specific trigger
......
......@@ -93,16 +93,16 @@ echo "********************************************"
more RootAFP.conf.temp
echo
#if [[ ${EntryPoint} != "" ]]
#then
# if [[ " ADF CRYSTAL CCRYSTAL PSA RANC0 EB MERGER TRACKING " =~ " ${EntryPoint} " ]]
# then
# echo "ADF entry point: ${EntryPoint}"
# else
# echo "${EntryPoint} is not a correct ADF entry point, possible choices are: ADF CRYSTAL CCRYSTAL PSA RANC0 EB MERGER TRACKING"
# exit 2
# fi
#fi
if [[ ${EntryPoint} != "" ]]
then
if [[ " ADF CRYSTAL CCRYSTAL PSA NEDA NEDAB EB MERGER TRACKING " =~ " ${EntryPoint} " ]]
then
echo "ADF entry point: ${EntryPoint}"
else
echo "${EntryPoint} is not a correct ADF entry point, possible choices are: ADF CRYSTAL CCRYSTAL PSA NEDA NEDAB EB MERGER TRACKING"
exit 2
fi
fi
if [ ${Batch} == "1" ]
then
......
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