Commit 8762aea3 authored by Vratislav Chudoba's avatar Vratislav Chudoba

Initial commit

parents
# =============================================================================
cmake_minimum_required(VERSION 3.5)
# Give your project a name
project(go4_5H_processor)
# Switch in on for more verbose make output
# set(CMAKE_VERBOSE_MAKEFILE ON)
# =============================================================================
# External packages
# See: https://root.cern.ch/how/integrate-root-my-project-cmake
# ROOT
list(APPEND CMAKE_PREFIX_PATH $ENV{ROOTSYS})
find_package(ROOT REQUIRED)
# Define useful ROOT functions and macros (e.g. ROOT_GENERATE_DICTIONARY)
include(${ROOT_USE_FILE})
# Go4
if (DEFINED ENV{GO4SYS})
message("Go4 found at $ENV{GO4SYS}")
include_directories($ENV{GO4SYS}/include)
link_directories($ENV{GO4SYS}/lib)
else()
message(FATAL_ERROR "Go4 not found! Please, run go4login or define the GO4SYS env. variable.")
endif()
# =============================================================================
#if (CMAKE_COMPILER_IS_GNUCXX)
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -Wall -Wextra -Wpedantic")
# # -std=c++11
#endif()
# =============================================================================
add_subdirectory(src)
#!/bin/bash
./doclean.sh
if [ ! -d "build" ]; then
mkdir build
fi
cd build
cmake ../
make -j
cd -
#cp -v build/src/*.so .
#cp -v build/src/*.pcm .
#cp -v build/src/*.rootmap .
ln -s build/src/libUserAnalysis.so
ln -s build/src/libUserAnalysis_rdict.pcm
ln -s build/src/libUserAnalysis.rootmap
echo -e "\e[1m\e[32mCompilation finished.\e[0m"
#!/bin/bash
#rm -fv libUserAnalysis.so libUserAnalysis_rdict.pcm libUserAnalysis.rootmap
unlink libUserAnalysis.so
unlink libUserAnalysis_rdict.pcm
unlink libUserAnalysis.rootmap
rm -fv out.txt err.txt
rm -fv summary.txt
rm -fv Go4AnalysisASF.root
if [ -d "build" ]; then
rm -rf build/*
fi
echo -e "\e[1m\e[32mCleanup finished.\e[0m"
#!/bin/bash
# Order matters!
#SOFTDIR=/home/evovch/soft
#export ERSYS=${SOFTDIR}/er
#export ERBUILD=${SOFTDIR}/er_build
#cd ${ERBUILD}/
#. ./config.sh
#cd -
#cd ${SOFTDIR}/go4-5.3.0_fairsoftroot/
#. ./go4login
#cd -
#cd ${SOFTDIR}/FairSoft_install/bin/
#. ./thisroot.sh
#cd -
void rcall(const char* name)
{
TNeDet1 *pDet
= (TNeDet1*)(TGo4Analysis::Instance())->GetParameter(name);
if(!pDet)
{
printf("OBJECT: %s WAS NOT FOUND \n",name);
return;
}
TString fname(name);
fname.ToLower();
fname += ".cal";
pDet->Read(fname.Data());
}
{
TString myGO4SYS = gSystem->Getenv("GO4SYS");
if (myGO4SYS == "") {
cerr << "GO4SYS environment variable not defined. "
<< "Please run go4login or define GO4SYS manually. " << endl
<< "Only $GO4SYS/include path will be passed to the ROOT interpreter."
<< endl;
return;
}
gInterpreter->AddIncludePath(myGO4SYS + "/include/");
}
#!/bin/bash
#INPUTFILE=/home/evovch/Downloads/FLNR_data/h5_14_0001.lmd
#INPUTFILE=/home/vratik/data/exp1804/h5_12_0001.lmd
INPUTFILE=/home/vratik/data/exp1804/h5_14_09.lml
rm -fv output.root
rm -fv Go4AnalysisASF.root
rm -fv out.txt err.txt
echo -e "\e[1m\e[32mAnalysis started.\e[0m"
#TODO check that GO4SYS is declared
#${GO4SYS}/bin/go4analysis -v -lib libUserAnalysis.so -number 100000 -asf Go4AnalysisASF.root -file ${INPUTFILE} > out.txt 2> err.txt
${GO4SYS}/bin/go4analysis -v -lib libUserAnalysis.so -asf Go4AnalysisASF.root -file ${INPUTFILE} > out.txt 2> err.txt
# -number 1000
echo -e "\e[1m\e[32mAnalysis finished.\e[0m"
#!/bin/bash
if [ -z ${PATH+x} ]; then echo "PATH is unset";
else echo "PATH is set to:"; echo $'\t'"${PATH//:/$'\n\t'}"; fi
if [ -z ${ROOTSYS+x} ]; then echo "ROOTSYS is unset";
else echo "ROOTSYS is set to '$ROOTSYS'"; fi
if [ -z ${SIMPATH+x} ]; then echo "SIMPATH is unset";
else echo "SIMPATH is set to '$SIMPATH'"; fi
if [ -z ${FAIRROOTPATH+x} ]; then echo "FAIRROOTPATH is unset";
else echo "FAIRROOTPATH is set to '$FAIRROOTPATH'"; fi
if [ -z ${LD_LIBRARY_PATH+x} ]; then echo "LD_LIBRARY_PATH is unset";
else echo "LD_LIBRARY_PATH is set to:"; echo $'\t'"${LD_LIBRARY_PATH//:/$'\n\t'}"; fi
if [ -z ${GO4SYS+x} ]; then echo "GO4SYS is unset";
else echo "GO4SYS is set to '$GO4SYS'"; fi
# =============================================================================
# ROOT dictionary
# Normally this is not needed, but rootcling cannot see these files
# if the current source directory (which is 'PROJECTBASEDIR/src' in our case)
# is not added to the include_directories list.
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
set(ROOTCLING_HEADERS TNeAnalysis.h
TNeDet16.h
TNeEvent.h
TNeMParms.h
TNeProc.h
TNeSel.h
)
ROOT_GENERATE_DICTIONARY(G__UserAnalysis ${ROOTCLING_HEADERS} LINKDEF NeLinkDef.h)
# =============================================================================
set(SOURCE_LIB G__UserAnalysis.cxx
TNeAnalysis.cxx
TNeDet16.cxx
TNeEvent.cxx
TNeMParms.cxx
TNeProc.cxx
TNeSel.cxx
)
add_library(UserAnalysis SHARED ${SOURCE_LIB})
target_link_libraries(UserAnalysis Go4Analysis)
#ifdef __CINT__
#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;
#pragma link C++ class TNeAnalysis+;
#pragma link C++ class TNeDet16+;
#pragma link C++ class TNeEvent+;
#pragma link C++ class TNeMParms+;
#pragma link C++ class TNeProc+;
#pragma link C++ class TNeSel+;
#endif
//===================================================================
//== TNeAnalysis.cxx: exp0211
//== Version: 2011-02-01
//===================================================================
#include "TNeAnalysis.h"
#include <stdlib.h>
#include "Riostream.h"
#include "Go4EventServer.h"
#include "TGo4StepFactory.h"
#include "TGo4AnalysisStep.h"
#include "TNeDet16.h"
//#include "TNeH1Parms.h"
//#include "TNeH2Parms.h"
#include "TNeMParms.h"
#include "TNeSel.h"
#include "TGo4Version.h"
#include "TGo4MbsEventServer.h"
//***********************************************************
TNeAnalysis::TNeAnalysis()
:fMbsEvent(0)
,fEvents(0)
,fLastEvent(0)
,pSQX_L_EC(0)
,pSQY_L_EC(0)
,pSQX_R_EC(0)
,pSQY_R_EC(0)
,pANR_EC(0)
,pANS_EC(0)
,pCsI_L_EC(0)
,pCsI_R_EC(0)
,pSQ20_EC(0)
,pMTracks(0)
{
}
//***********************************************************
// this constructor is called by go4analysis executable
TNeAnalysis::TNeAnalysis(int argc, char** argv)
:TGo4Analysis(argc, argv)
,fMbsEvent(0)
,fEvents(0)
,fLastEvent(0)
,pSQX_L_EC(0)
,pSQY_L_EC(0)
,pSQX_R_EC(0)
,pSQY_R_EC(0)
,pANR_EC(0)
,pANS_EC(0)
,pCsI_L_EC(0)
,pCsI_R_EC(0)
,pSQ20_EC(0)
,pMTracks(0)
{
cout << "**** Create TNeAnalysis name: " << argv[0] << endl;
if (!TGo4Version::CheckVersion(__GO4BUILDVERSION__)) {
cout << "**** Go4 version mismatch" << endl;
exit(-1);
}
TGo4StepFactory* factory = new TGo4StepFactory("Factory");
factory->DefEventProcessor("NeProc","TNeProc");// object name, class name
factory->DefOutputEvent("NeEvent","TNeEvent"); // object name, class name
// TGo4EventSourceParameter* sourcepar = new TGo4MbsEventServerParameter("rio3");
TGo4EventSourceParameter* sourcepar = new TGo4MbsStreamParameter("lipc-1");
//TGo4EventSourceParameter* sourcepar = new TGo4MbsTransportParameter("rio3");
// TGo4EventSourceParameter* sourcepar =
// new TGo4MbsFileParameter("/LynxOS/RIO3_3.1/mbsusr/user1/mbsrun/flnr/wrk3a/aa*.lmd");
TGo4FileStoreParameter* storepar = new TGo4FileStoreParameter("output.root");
storepar->SetOverwriteMode(kTRUE);
TGo4AnalysisStep* step = new TGo4AnalysisStep("Analysis", factory, sourcepar, storepar);
step->SetSourceEnabled(kTRUE);
step->SetStoreEnabled(kTRUE);
step->SetProcessEnabled(kTRUE);
step->SetErrorStopEnabled(kTRUE);
// Now the first analysis step is set up.
// Other steps could be created here
AddAnalysisStep(step);
// uncomment following line to define custom passwords for analysis server
// DefineServerPasswords("Neadmin", "Nectrl", "Neview");
DefineServerPasswords("Acu0La0", "Acu0La0", "go4view");
//////////////// Parameter //////////////////////////
// At this point, autosave file has not yet been read!
// Therefore parameter values set here will be overwritten
// if an autosave file is there.
pSQX_L_EC = new TNeDet16("SQX_L_EC");
AddParameter(pSQX_L_EC);
pSQY_L_EC = new TNeDet16("SQY_L_EC");
AddParameter(pSQY_L_EC);
pSQX_R_EC = new TNeDet16("SQX_R_EC");
AddParameter(pSQX_R_EC);
pSQY_R_EC = new TNeDet16("SQY_R_EC");
AddParameter(pSQY_R_EC);
pANR_EC = new TNeDet16("ANR_EC");
AddParameter(pANR_EC);
pANS_EC = new TNeDet16("ANS_EC");
AddParameter(pANS_EC);
pCsI_L_EC = new TNeDet16("CsI_L_EC");
AddParameter(pCsI_L_EC);
pCsI_R_EC = new TNeDet16("CsI_R_EC");
AddParameter(pCsI_R_EC);
pSQ20_EC = new TNeDet16("SQ20_EC");
AddParameter(pSQ20_EC);
pMTracks = new TNeMParms("MTRACKS");
AddParameter(pMTracks);
}
//***********************************************************
TNeAnalysis::~TNeAnalysis()
{
cout << "**** TNeAnalysis: Delete instance" << endl;
}
//-----------------------------------------------------------
Int_t TNeAnalysis::UserPreLoop()
{
// all this is optional:
cout << "**** TNeAnalysis: PreLoop" << endl;
// get pointer to input event (used in postloop and event function):
fMbsEvent = dynamic_cast<TGo4MbsEvent*> (GetInputEvent("Analysis")); // of step "Analysis"
if(fMbsEvent) {
// fileheader structure (lmd file only):
s_filhe* fileheader=fMbsEvent->GetMbsSourceHeader();
if(fileheader)
{
cout <<"\nInput file: "<<fileheader->filhe_file << endl;
cout <<"Tapelabel:\t" << fileheader->filhe_label<<endl;
cout <<"UserName:\t" << fileheader->filhe_user<<endl;
cout <<"RunID:\t" << fileheader->filhe_run<<endl;
cout <<"Explanation: "<<fileheader->filhe_exp <<endl;
cout <<"Comments: "<<endl;
Int_t numlines=fileheader->filhe_lines;
for(Int_t i=0; i<numlines;++i)
{
cout<<"\t"<<fileheader->s_strings[i].string << endl;
}
}
}
fEvents=0; // event counter
fLastEvent=0; // number of last event processed
pSQX_L_EC->ReadData();
pSQY_L_EC->ReadData();
pSQX_R_EC->ReadData();
pSQY_R_EC->ReadData();
pANR_EC->ReadData();
pANS_EC->ReadData();
pCsI_L_EC->ReadData();
pCsI_R_EC->ReadData();
pSQ20_EC->ReadData();
return 0;
}
//-----------------------------------------------------------
Int_t TNeAnalysis::UserPostLoop()
{
// all this is optional:
cout << "**** TNeAnalysis: PostLoop" << endl;
cout << "Last event #: " << fLastEvent << " Total events: " << fEvents << endl;
fMbsEvent = 0; // reset to avoid invalid pointer if analysis is changed in between
fEvents=0;
return 0;
}
//-----------------------------------------------------------
Int_t TNeAnalysis::UserEventFunc()
{
// all this is optional:
// This function is called once for each event after all steps.
if(fMbsEvent) {
fEvents++;
fLastEvent=fMbsEvent->GetCount();
}
if(fEvents == 1 || IsNewInputFile()) {
cout << "First event #: " << fLastEvent << endl;
SetNewInputFile(kFALSE); // we have to reset the newfile flag
}
return 0;
}
//===================================================================
//== TNeAnalysis.h: exp1210
//== Version: 2010-11-12
//===================================================================
#ifndef TNeANALYSIS_H
#define TNeANALYSIS_H
#include "TGo4Analysis.h"
#include "TGo4WinCond.h"
class TGo4MbsEvent;
class TNeDet16;
class TNeMParms;
class TNeSel;
class TNeAnalysis : public TGo4Analysis
{
private:
TGo4MbsEvent* fMbsEvent;
Int_t fEvents;
Int_t fLastEvent;
public:
TNeAnalysis();
TNeAnalysis(int argc, char** argv);
virtual ~TNeAnalysis() ;
virtual Int_t UserPreLoop();
virtual Int_t UserEventFunc();
virtual Int_t UserPostLoop();
TNeDet16* pSQX_L_EC;
TNeDet16* pSQY_L_EC;
TNeDet16* pSQX_R_EC;
TNeDet16* pSQY_R_EC;
TNeDet16* pANR_EC;
TNeDet16* pANS_EC;
TNeDet16* pCsI_L_EC;
TNeDet16* pCsI_R_EC;
TNeDet16* pSQ20_EC;
TNeMParms* pMTracks;
ClassDef(TNeAnalysis,1)
};
#endif //TANALYSIS_H
//===================================================================
//== TNeDet16.cpp: exp0211
//== Version: 2011-02-01
//===================================================================
#include "TNeDet16.h"
#include <stdio.h>
#include "Riostream.h"
using std::cout;
using std::endl;
const int mchan = 16;
const int m = 3;
//***********************************************************
TNeDet16::TNeDet16(const char* name)
:TGo4Parameter(name)
,kread(0)
,n(2)
,nchan(mchan)
{
for(int i = 0; i < mchan; ++i)
{
a[i][0] = 0.;
a[i][1] = 1.;
a[i][2] = 0.;
}
} //----------------------------------------------------------------
TNeDet16::~TNeDet16()
{
} //-----------------------------------------------------------------
Bool_t TNeDet16::UpdateFrom(TGo4Parameter *source)
{
cout << "**** TNeDet1 " << GetName()
<< " updated from auto save file" << endl;
TNeDet16 * from = dynamic_cast<TNeDet16 *>(source);
if(from==0)
{
cout << "Wrong parameter class: "
<< source->ClassName() << endl;
return kFALSE;
}
kread = from->kread;
switch(kread)
{
case 1:
kread = 0;
from->kread = 0;
ReadData();
from->n = n;
from->nchan = nchan;
for(int i = 0; i < mchan; ++i)
{
from->a[i][0] = a[i][0];
from->a[i][1] = a[i][1];
from->a[i][2] = a[i][2];
}
break;
default:
n = from->n;
nchan = from->n;
for(int i =0; i < mchan; ++i)
{
a[i][0] = from->a[i][0];
a[i][1] = from->a[i][1];
a[i][2] = from->a[i][2];
}
}
return kTRUE;
} //-----------------------------------------------------------------
void TNeDet16::ReadData()
{
TString xname = GetName();
xname.ToLower();
xname += ".clb";
FILE* F = fopen(xname.Data(),"rt");
if(!F)
{
printf("\n\n!!! FILE: %s WAS NOT FOUND\n\n"
,xname.Data());
return;
}
fscanf(F,"%d%d",&n,&nchan);
for(int i=0; i<nchan; i++)
{
fscanf(F,"%lf%lf%lf",&a[i][0],&a[i][1],&a[i][2]);
}
printf("\n\nREAD DATA FROM FILE: %s\n\n",xname.Data());
fclose(F);
return;
} //-----------------------------------------------------------------
double TNeDet16::Energy(double value, int chan)
{
double res = a[chan][n-1];
for(int i = n-2; i >= 0 ; --i)
{
res = res * value + a[chan][i];
}
return res;
} //-----------------------------------------------------------------
//===================================================================
//== TNeDet1.h: exp0211
//== Version: 2011-02-01
//===================================================================
#ifndef TNeDet16_H
#define TNeDet16_H
#include "TGo4Parameter.h"
class TNeDet16 : public TGo4Parameter
{
public:
TNeDet16(const char* name = 0);
virtual ~TNeDet16();
virtual Bool_t UpdateFrom(TGo4Parameter *);
void ReadData();
double Energy(double value, int chan);
int kread;
int n;
int nchan;
double a[32][3];
ClassDef(TNeDet16,1)
};
#endif
//===================================================================
//== TNeEvent.cxx:
//== Version:
//===================================================================
#include "TNeEvent.h"
#include "Riostream.h"
using std::cout;
using std::endl;
TNeEvent::TNeEvent()
:TGo4EventElement()
{
cout << "**** TNeEvent: Create instance" << endl;
} //-------------------------------------------------------------------
TNeEvent::TNeEvent(const char* name)
:TGo4EventElement(name)
{
cout << "**** TNeEvent: Create instance " << name << endl;
} //-------------------------------------------------------------------
TNeEvent::~TNeEvent()
{
cout << "**** TNeEvent: Delete instance " << endl;
} //-------------------------------------------------------------------
void TNeEvent::Clear(Option_t *t)
{
//==================================================================
//== all members should be cleared.
//== memset(fRawData,0, sizeof(fRawData));
//==================================================================
memset(CsI_L, 0, sizeof(CsI_L));
memset(CsI_R, 0, sizeof(CsI_R));
memset(tCsI_L, 0, sizeof(tCsI_L));
memset(tCsI_R, 0, sizeof(tCsI_R));
memset(SQX_L, 0, sizeof(SQX_L));
memset(tSQX_L, 0, sizeof(tSQX_L));
memset(SQY_L, 0, sizeof(SQY_L));
memset(tSQY_L, 0, sizeof(tSQY_L));
memset(SQX_R, 0, sizeof(SQX_R));
memset(tSQX_R, 0, sizeof(tSQX_R));
memset(SQY_R, 0, sizeof(SQY_R));
memset(SQ20, 0, sizeof(SQ20));
memset(tSQ20, 0, sizeof(tSQ20));
memset(SQY_R, 0, sizeof(SQY_R));
memset(tSQY_R, 0, sizeof(tSQY_R));
memset(ANR, 0, sizeof(ANR));
memset(ANS, 0, sizeof(ANS));
memset(F3, 0, sizeof(F3));
memset(tF3, 0, sizeof(tF3));
memset(F5, 0, sizeof(F5));
memset(tF5, 0, sizeof(tF5));
memset(F6, 0, sizeof(F6));
memset(tF6, 0, sizeof(tF6));
memset(tMWPC, 0, sizeof(tMWPC));
/*
memset(ADC, 0, sizeof(ADC));
memset(TDC, 0, sizeof(TDC));
memset(mQDC, 0, sizeof(mQDC));
memset(mTDC, 0, sizeof(mTDC));
*/
memset(neutAmp, 0, sizeof(neutAmp));
memset(neutTAC, 0, sizeof(neutTAC));
memset(neutTDC, 0, sizeof(neutTDC));
nevent = 0;
trigger = 0;
subevents = 0;
evsize = 0;
// time = 0;
} //-------------------------------------------------------------------
//===================================================================
//== TNeEvent.h:
//== Version:
//===================================================================
#ifndef TNeEVENT_H
#define TNeEVENT_H
#include "TGo4EventElement.h"
class TNeEvent : public TGo4EventElement
{
public:
TNeEvent();
TNeEvent(const char* name);
virtual ~TNeEvent();
/** Method called by the framework to clear the event element. */
void Clear(Option_t *t="");
unsigned short CsI_L[16];
unsigned short tCsI_L[16];
unsigned short CsI_R[16];
unsigned short tCsI_R[16];
unsigned short SQX_L[32];
unsigned short tSQX_L[32];
unsigned short SQY_L[16];
unsigned short tSQY_L[16];
unsigned short SQX_R[32];
unsigned short tSQX_R[32];
unsigned short SQY_R[16];
unsigned short SQ20[16];
unsigned short tSQ20[16];
unsigned short tSQY_R[16];
unsigned short ANR[16];
unsigned short ANS[16];
unsigned short neutAmp[32];
unsigned short neutTAC[32];
unsigned short neutTDC[32];
unsigned short F3[4];
unsigned short tF3[4];
unsigned short F5[4];
unsigned short tF5[4];
unsigned short F6[4];
unsigned short tF6[4];
unsigned short tMWPC[4];
unsigned int scaler[16];
unsigned int mtime;
/* unsigned short ADC[32];
unsigned short TDC[32];
unsigned short mQDC[32];
unsigned short mTDC[32];
*/
//WIRES
unsigned short nx1, ny1, nx2, ny2; // wires
unsigned short x1[32],y1[32],x2[32],y2[32]; // wires
unsigned int rx1, rx2, ry1, ry2;
int nevent;
int trigger;
int subevents;
int evsize;
// unsigned int time;
ClassDef(TNeEvent,1)
};
#endif //TEVENT_H
//===================================================================
//== TNe1HParms.cpp: exp1210
//== Version: 2010-11-26
//===================================================================
#include "TNeMParms.h"
#include "Riostream.h"
using std::cout;
using std::endl;
//const int mchan = 32;
//const int m = 3;
//***********************************************************
TNeMParms::TNeMParms(const char* name)
:TGo4Parameter(name),
fill(kTRUE)
{
} //----------------------------------------------------------------
TNeMParms::~TNeMParms()
{
} //-----------------------------------------------------------------
Bool_t TNeMParms::UpdateFrom(TGo4Parameter *source)
{
cout << "**** TNeHParm " << GetName()
<< " updated from auto save file" << endl;
TNeMParms * from = dynamic_cast<TNeMParms *>(source);
if(from==0)
{
cout << "Wrong parameter class: "
<< source->ClassName() << endl;
return kFALSE;
}
fill = from->fill;
mtracksx = from->mtracksx;
mtracksy = from->mtracksy;
return kTRUE;
} //-----------------------------------------------------------------
//===================================================================
//== TNeMParms.h: exp1210
//== Version: 2010-11-1226
//===================================================================
#ifndef TNeMPARMS_H
#define TNeMPARMS_H
#include "TGo4Parameter.h"
class TNeMParms : public TGo4Parameter
{
public:
TNeMParms(const char* name = 0);
virtual ~TNeMParms();
virtual Bool_t UpdateFrom(TGo4Parameter *);
Bool_t fill;
int mtracksx,mtracksy;
ClassDef(TNeMParms,1)
};
#endif
//===================================================================
//== EXPERIMENT A-2
//== VERSION: 24.11.2017
//===================================================================
#include "TNeProc.h"
#include <stdint.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include "Riostream.h"
using std::cout;
using std::endl;
#include "TH1.h"
#include "TH2.h"
#include "TROOT.h"
#include "TCutG.h"
#include "TGo4WinCond.h"
#include "TGo4PolyCond.h"
#include "TGo4CondArray.h"
#include "TGo4Picture.h"
#include "TGo4MbsEvent.h"
#include "snprintf.h"
#include "TNeEvent.h"
#include "TNeDet16.h"
#include "TNeAnalysis.h"
#include "TRandom.h"
#include "TNeMParms.h"
//#include "TNeSel.h"
long TNeProc::bit[32] =
{0x00000001, 0x00000002, 0x00000004, 0x00000008
,0x00000010, 0x00000020, 0x00000040, 0x00000080
,0x00000100, 0x00000200, 0x00000400, 0x00000800
,0x00001000, 0x00002000, 0x00004000, 0x00008000
,0x00010000, 0x00020000, 0x00040000, 0x00080000
,0x00100000, 0x00200000, 0x00400000, 0x00800000
,0x01000000, 0x02000000, 0x04000000, 0x08000000
,0x10000000, 0x20000000, 0x40000000, 0x80000000};
TNeProc::TNeProc() : TGo4EventProcessor()
{
int i;
cout << "**** TNeProc: Create instance " << endl;
fTrigger = NULL;
fSubEvents = NULL;
fEventsSizes = NULL;
for(i = 0; i < 4; ++i)
{
d1F3[i] = NULL;
d1tF3[i] = NULL;
d1F5[i] = NULL;
d1tF5[i] = NULL;
d1F6[i] = NULL;
d1tF6[i] = NULL;
d1tMWPC[i] = NULL;
}
d1ESQX_L = NULL;
d1ESQX_R = NULL;
//
for(i = 0; i < 16; ++i)
{
d1CsI_L[i] = NULL;
d1tCsI_L[i] = NULL;
d1CsI_R[i] = NULL;
d1tCsI_R[i] = NULL;
d1SQ20[i] = NULL;
d1tSQ20[i] = NULL;
d1SQY_L[i] = NULL;
d1tSQY_L[i] = NULL;
d1SQY_R[i] = NULL;
d1tSQY_R[i] = NULL;
d1ANR[i] = NULL;
d1ANS[i] = NULL;
d2dE_E_L[i] = NULL;
d2dE_E_R[i] = NULL;
d2dE_E_L_c[i] = NULL;
d2dE_E_R_c[i] = NULL;
}
//
for(i = 0; i < 32; ++i)
{
d1SQX_L[i] = NULL;
d1tSQX_L[i] = NULL;
d1SQX_R[i] = NULL;
d1tSQX_R[i] = NULL;
d1neutAmp[i] = NULL;
d1neutTAC[i] = NULL;
d1neutTDC[i] = NULL;
d2Ngamma[i] = NULL;
}
d2tF3aF3_L = NULL;
d2tF3aF3_R = NULL;
d2tF3aF3_U = NULL;
d2tF3aF3_D = NULL;
d1ToF = NULL;
d1ToF = NULL;
d1aF3 = NULL;
d2ToFaF3 = NULL;
} //-------------------------------------------------------------------
TNeProc::~TNeProc()
{
cout << "**** TNeProc: Delete instance " << endl;
} //-------------------------------------------------------------------
TNeProc::TNeProc(const char* name) : TGo4EventProcessor(name)
{
cout << "**** TNeProc: Create instance " << name << endl;
fTrigger = MakeTH1('I', "Trigger", "Values of trigger", 16, 0., 15.);
fSubEvents = MakeTH1('I', "SubEvents", "Number of subevents", 16, 0., 15.);
fEventsSizes = MakeTH1('I', "EventSizes", "Size of each event", 1024, 0., 1023.);
int i;
for (i = 0; i < 16; ++i)
{
d1CsI_L[i] = MakeTH1('I', Form("Left_telescope/CsI_L/raw/CsI_L_%2.2d",i)
, Form("CsI left raw %2.2d",i), 8192, 0., 8191.);
d1tCsI_L[i] = MakeTH1('I', Form("Left_telescope/CsI_L/tdc/tCsI_L_%2.2d",i)
, Form("CsI left tdc %2.2d",i), 4096, 0., 4095.);
d1CsI_R[i] = MakeTH1('I', Form("Right_telescope/CsI_R/raw/CsI_R_%2.2d",i)
, Form("CsI right CH %2.2d",i), 8192, 0., 8191.);
d1tCsI_R[i] = MakeTH1('I', Form("Right_telescope/CsI_R/tdc/tCsI_R_%2.2d",i)
, Form("CsI right tdc %2.2d",i), 4096, 0., 4095.);
d1SQY_L[i] = MakeTH1('I', Form("Left_telescope/SQY_L/raw/SQY_L_%2.2d",i)
, Form("Square left DSSD Y stripes CH %2.2d",i), 4096, 0., 4095.);
d1tSQY_L[i] = MakeTH1('I', Form("Left_telescope/SQY_L/tdc/tSQY_L_%2.2d",i)
, Form("Square left DSSD Y tdc %2.2d",i), 4096, 0., 4095.);
d1SQ20[i] = MakeTH1('I', Form("Left_telescope/SQ20/raw/SQ20_%2.2d",i)
, Form("Square left 20mkm X stripes CH %2.2d",i), 4096, 0., 4095.);
d1tSQ20[i] = MakeTH1('I', Form("Left_telescope/SQ20/tdc/tSQ20_%2.2d",i)
, Form("Square left 20mkm X tdc %2.2d",i), 4096, 0., 4095.);
d1SQY_R[i] = MakeTH1('I', Form("Right_telescope/SQY_R/raw/SQY_R_%2.2d",i)
, Form("Square right DSSD Y stripes CH %2.2d",i), 4096, 0., 4095.);
d1tSQY_R[i] = MakeTH1('I', Form("Right_telescope/SQY_R/tdc/tSQY_R_%2.2d",i)
, Form("Square right DSSD Y tdc %2.2d",i), 4096, 0., 4095.);
d1ANR[i] = MakeTH1('I', Form("Annular_telescope/ANR/ANR_%2.2d",i)
, Form("Annular DSSD rings side CH %2.2d",i), 4096, 0., 4095.);
d1ANS[i] = MakeTH1('I', Form("Annular_telescope/ANS/ANS_%2.2d",i)
, Form("Annular DSSD sectors side CH %2.2d",i), 4096, 0., 4095.);
}
//
d1ESQX_L = MakeTH1('D', "2D/ESQX_L", " energy (MeV)", 1000,0,80,"ESQX_L");
d1ESQX_R = MakeTH1('D', "2D/ESQX_R", " energy (MeV)", 1000,0,80,"ESQX_R");
//
d2SQXSQY_L_D = MakeTH2('I', "2D/SQXSQY_L_D", "SQX_L vs SQY_L", 32,0,32,16,0,16,"SQX_L","SQY_L");
d1nSQY_L = MakeTH1('I', "2D/nSQY_L", "number of strip SQY_L", 16,0,16,"SQY_L");
d1nSQ20 = MakeTH1('I', "2D/nSQ20", "number of strip SQ20", 16,0,16,"SQ20");
d1nSQX_L = MakeTH1('I', "2D/nSQX_L", "number of strip SQX_L", 32,0,32,"SQX_L");
d1mSQY_L = MakeTH1('I', "2D/mSQY_L", "mult of strip SQY_L", 16,0,16,"mSQY_L");
d1mSQX_L = MakeTH1('I', "2D/mSQX_L", "mult of strip SQX_L", 32,0,32,"mSQX_L");
d2SQXSQY_R_D = MakeTH2('I', "2D/SQXSQY_R_D", "SQX_R vs SQY_R", 32,0,32,16,0,16,"SQX_R","SQY_R");
d1nSQY_R = MakeTH1('I', "2D/nSQY_R", "number of strip SQY_R", 16,0,16,"SQY_R");
d1nSQX_R = MakeTH1('I', "2D/nSQX_R", "number of strip SQX_R", 32,0,32,"SQX_R");
d1mSQY_R = MakeTH1('I', "2D/mSQY_R", "mult of strip SQY_R", 16,0,16,"mSQY_R");
d1mSQX_R = MakeTH1('I', "2D/mSQX_R", "mult of strip SQX_R", 32,0,32,"mSQX_R");
//
for (i = 0; i < 32; ++i)
{
d1SQX_L[i] = MakeTH1('I', Form("Left_telescope/SQX_L/raw/SQX_L_%2.2d",i)
, Form("Square left DSSD X stripes CH %2.2d",i), 4096, 0., 4095.);
d1tSQX_L[i] = MakeTH1('I', Form("Left_telescope/SQX_L/tdc/tSQX_L_%2.2d",i)
, Form("Square left DSSD X tdc %2.2d",i), 4096, 0., 4095.);
d1SQX_R[i] = MakeTH1('I', Form("Right_telescope/SQX_R/raw/SQX_R_%2.2d",i)
, Form("Square right DSSD X stripes CH %2.2d",i), 4096, 0., 4095.);
d1tSQX_R[i] = MakeTH1('I', Form("Right_telescope/SQX_R/tdc/tSQX_R_%2.2d",i)
, Form("Square right DSSD X tdc %2.2d",i), 4096, 0., 4095.);
d1neutAmp[i] = MakeTH1('I', Form("Neutrons/Amp/Amp_%2.2d",i)
, Form("Neutrons Amp CH %2.2d",i), 4096, 0., 4095.);
d1neutTAC[i] = MakeTH1('I', Form("Neutrons/TAC/TAC_%2.2d",i)
, Form("Neutrons TAC CH %2.2d",i), 4096, 0., 4095.);
d1neutTDC[i] = MakeTH1('I', Form("Neutrons/time/time_%2.2d",i)
, Form("Neutrons time CH %2.2d",i), 4999, 0., 5000.);
d2Ngamma[i] = MakeTH2('I', Form("Neutrons/Ng/Ng_%2.2d",i)
, Form("N gamma %2.2d",i), 400, 0., 4095., 400, 0., 4095.,"Amp","TAC");
}
//
d1F3[0] = MakeTH1('I',"F3/QDC/F3_QDC_L","F3 QDC left", 4096, 0., 4095.);
d1F3[1] = MakeTH1('I',"F3/QDC/F3_QDC_R","F3 QDC right", 4096, 0., 4095.);
d1F3[2] = MakeTH1('I',"F3/QDC/F3_QDC_U","F3 QDC up", 4096, 0., 4095.);
d1F3[3] = MakeTH1('I',"F3/QDC/F3_QDC_D","F3 QDC down", 4096, 0., 4095.);
d1tF3[0] = MakeTH1('I',"F3/TDC/tF3_TDC_L","F3 TDC left", 6400, 0., 6399.);
d1tF3[1] = MakeTH1('I',"F3/TDC/tF3_TDC_R","F3 TDC right", 6400, 0., 6399.);
d1tF3[2] = MakeTH1('I',"F3/TDC/tF3_TDC_U","F3 TDC up", 6400, 0., 6399.);
d1tF3[3] = MakeTH1('I',"F3/TDC/tF3_TDC_D","F3 TDC down", 6400, 0., 6399.);
//
d1F5[0] = MakeTH1('I',"F5/QDC/F5_QDC_L","F5 QDC left", 4096, 0., 4095.);
d1F5[1] = MakeTH1('I',"F5/QDC/F5_QDC_R","F5 QDC right", 4096, 0., 4095.);
d1F5[2] = MakeTH1('I',"F5/QDC/F5_QDC_U","F5 QDC up", 4096, 0., 4095.);
d1F5[3] = MakeTH1('I',"F5/QDC/F5_QDC_D","F5 QDC down", 4096, 0., 4095.);
d1tF5[0] = MakeTH1('I',"F5/TDC/tF5_TDC_L","F5 TDC left", 6400, 0., 6399.);
d1tF5[1] = MakeTH1('I',"F5/TDC/tF5_TDC_R","F5 TDC right", 6400, 0., 6399.);
d1tF5[2] = MakeTH1('I',"F5/TDC/tF5_TDC_U","F5 TDC up", 6400, 0., 6399.);
d1tF5[3] = MakeTH1('I',"F5/TDC/tF5_TDC_D","F5 TDC down", 6400, 0., 6399.);
//
d1F6[0] = MakeTH1('I',"F6/QDC/F6_QDC_L","F6 QDC left", 4096, 0., 4095.);
d1F6[1] = MakeTH1('I',"F6/QDC/F6_QDC_R","F6 QDC right", 4096, 0., 4095.);
d1F6[2] = MakeTH1('I',"F6/QDC/F6_QDC_U","F6 QDC up", 4096, 0., 4095.);
d1F6[3] = MakeTH1('I',"F6/QDC/F6_QDC_D","F6 QDC down", 4096, 0., 4095.);
d1tF6[0] = MakeTH1('I',"F6/TDC/tF6_TDC_L","F6 TDC left", 6400, 0., 6399.);
d1tF6[1] = MakeTH1('I',"F6/TDC/tF6_TDC_R","F6 TDC right", 6400, 0., 6399.);
d1tF6[2] = MakeTH1('I',"F6/TDC/tF6_TDC_U","F6 TDC up", 6400, 0., 6399.);
d1tF6[3] = MakeTH1('I',"F6/TDC/tF6_TDC_D","F6 TDC down", 6400, 0., 6399.);
d1tMWPC[0] = MakeTH1('I',"tMWPC/tX1","MWPC TDC X1", 6400, 0., 6399.);
d1tMWPC[1] = MakeTH1('I',"tMWPC/tY1","MWPC TDC Y1", 6400, 0., 6399.);
d1tMWPC[2] = MakeTH1('I',"tMWPC/tX2","MWPC TDC X2", 6400, 0., 6399.);
d1tMWPC[3] = MakeTH1('I',"tMWPC/tY2","MWPC TDC Y2", 6400, 0., 6399.);
//
d1ToF = MakeTH1('D', "ToF/ToF", " time of flight (ns)", 2000,-10.,190.,"ToF");
d1aF3 = MakeTH1('D', "ToF/aF3", " amp of F3", 4000,0.,4000.,"amp f3");
d2ToFaF3 = MakeTH2('D', "ToF/ToFaF3", "ToF vs aF3", 400,40.,190.,400,0.,4000.,"ToF","aF3");
d1aF5 = MakeTH1('D', "ToF/aF5", " amp of F3", 4000,0.,400.,"amp f3");
d2ToFaF5 = MakeTH2('D', "ToF/ToFaF5", "ToF vs aF5", 400,40.,190.,400,0.,4000.,"ToF","aF5");
d2tF3aF3_L = MakeTH2('I', "2D/tF3aF3_L", "tdcF3 left vs qdcF3 left", 200,0.,4000.,200,0.,4000.,"tdc","qdc");
d2tF3aF3_R = MakeTH2('I', "2D/tF3aF3_R", "tdcF3 right vs qdcF3 right", 200,0.,4000.,200,0.,4000.,"tdc","qdc");
d2tF3aF3_U = MakeTH2('I', "2D/tF3aF3_U", "tdcF3 up vs qdcF3 up", 200,0.,4000.,200,0.,4000.,"tdc","qdc");
d2tF3aF3_D = MakeTH2('I', "2D/tF3aF3_D", "tdcF3 down vs qdcF3 down", 200,0.,4000.,200,0.,4000.,"tdc","qdc");
d2SQ20_SQY_L = MakeTH2('D', "2D/dE_E/Left/20um_1mm", "20um vs 1mm" , 400,0.,100.,400,0.0,20.,"SQY_L","Si_20um");
//CALIBRATED
for (i = 0; i < 16; ++i)
{
d1SQY_L_C[i] = MakeTH1('D', Form("Left_telescope/SQY_L_C/SQY_L_C_%2.2d",i)
, Form("Square left DSSD Y CALIBRATED stripes CH %2.2d",i), 4000, 0., 100.);
d1SQ20_C[i] = MakeTH1('D', Form("Left_telescope/SQ20_C/SQ20_C_%2.2d",i)
, Form("Square left 20mkm Y CALIBRATED stripes CH %2.2d",i), 4000, 0., 100.);
d1SQY_R_C[i] = MakeTH1('D', Form("Right_telescope/SQY_R_C/SQY_R_C_%2.2d",i)
, Form("Square right DSSD Y CALIBRATED stripes CH %2.2d",i), 4000, 0., 100.);
d1ANR_C[i] = MakeTH1('D', Form("Annular_telescope/ANR/ANR_C_%2.2d",i)
, Form("Annular DSSD CALIBRATED rings side CH %2.2d",i), 2000, 0., 50.);
d1ANS_C[i] = MakeTH1('D', Form("Annular_telescope/ANS/ANS_C_%2.2d",i)
, Form("Annular DSSD CALIBRATED sectors side CH %2.2d",i), 2000, 0., 50.);
d1CsI_L_C[i] = MakeTH1('D', Form("Left_telescope/CsI_L_C/CsI_L_C_%2.2d",i)
, Form("Square LEFT CsI CALIBRATED crystal CH %2.2d",i), 8000, 0., 240.);
d1CsI_R_C[i] = MakeTH1('D', Form("Right_telescope/CsI_R_C/CsI_R_C_%2.2d",i)
, Form("Square RIGHT CsI CALIBRATED crystal CH %2.2d",i), 8000, 0., 240.);
d2dE_E_L[i] = MakeTH2('D', Form("2D/dE_E/Left/Left_%2.2d",i), Form("dE_L vs E_L %2.2d",i), 400,0,240.,400,0.0,100.,"CsI_L","Silicon_L");
d2dE_E_R[i] = MakeTH2('D', Form("2D/dE_E/Right/Right_%2.2d",i), Form("dE_R vs E_R %2.2d",i), 400,0,240.,400,0.0,100.,"CsI_R","Silicon_R");
d2dE_E_L_c[i] = MakeTH2('D', Form("2D/dE_E/Left_c/Left_c_%2.2d",i), Form("dE_L vs E_L trig %2.2d",i), 400,0,240.,400,0.0,100.,"CsI_L","Silicon_L");
d2dE_E_R_c[i] = MakeTH2('D', Form("2D/dE_E/Right_c/Right_c_%2.2d",i), Form("dE_R vs E_R trig %2.2d",i), 400,0,240.,400,0.0,100.,"CsI_R","Silicon_R");
}
for (i = 0; i < 32; ++i)
{
d1SQX_L_C[i] = MakeTH1('D', Form("Left_telescope/SQX_L_C/SQX_L_C_%2.2d",i)
, Form("Square left DSSD X CALIBRATED stripes CH %2.2d",i), 4000, 0., 100.);
d1SQX_R_C[i] = MakeTH1('D', Form("Right_telescope/SQX_R_C/SQX_R_C_%2.2d",i)
, Form("Square right DSSD X CALIBRATED stripes CH %2.2d",i), 4000, 0., 100.);
}
//MWPC
d1X1 = MakeTH1('I', "WIRES/X1","WIRES X1",32,0.,32.);
d1Y1 = MakeTH1('I', "WIRES/Y1","WIRES Y1",32,0.,32.);
d1X2 = MakeTH1('I', "WIRES/X2","WIRES X2",32,0.,32.);
d1Y2 = MakeTH1('I', "WIRES/Y2","WIRES Y2",32,0.,32.);
d1NX1 = MakeTH1('I', "WIRES/NX1","WIRES X1",32,0.,32.);
d1NY1 = MakeTH1('I', "WIRES/NY1","WIRES Y1",32,0.,32.);
d1NX2 = MakeTH1('I', "WIRES/NX2","WIRES X2",32,0.,32.);
d1NY2 = MakeTH1('I', "WIRES/NY2","WIRES Y2",32,0.,32.);
d2XY1 = MakeTH2('I', "WIRES/XY1", "WIRES 1 Y1 vs X1", 32,0.,32.,32,0.,32.,"X1","Y1");
d2XY2 = MakeTH2('I', "WIRES/XY2", "WIRES 2 Y2 vs X2", 32,0.,32.,32,0.,32.,"X2","Y2");
d1CX1 = MakeTH1('I', "WIRES/CX1","CLASTERS X1",32,0.,32.);
d1CY1 = MakeTH1('I', "WIRES/CY1","CLASTERS Y1",32,0.,32.);
d1CX2 = MakeTH1('I', "WIRES/CX2","CLASTERS X2",32,0.,32.);
d1CY2 = MakeTH1('I', "WIRES/CY2","CLASTERS Y2",32,0.,32.);
//------------------------------------------------------------
cout << "**** TNeProc: Pictures" << endl;
dx1=0.25;
dx2=-0.05;
dy1=-0.3;
dy2=-0.15;
dtx=0;
dty=0;
pxa0 = -95.;
pxa1 = -90.;
pxa2 = -30.;
pxa3 = 0.;
pxa4 = 5.;
pya1 = 4.;
pya2 = 4.;
pya3 = 2.2;
ntrackx = 100;
ntracky = 100;
fLWAX1 = new TLine(pxa1, -0.5*pya1+dx1, pxa1, 0.5*pya1+dx1);
fLWAX2 = new TLine(pxa2, -0.5*pya2+dx2, pxa2, 0.5*pya2+dx2);
fLWAX3 = new TLine(pxa3, -0.5*pya3+dtx, pxa3, 0.5*pya3+dtx);
fLWAX1->SetLineWidth(5);
fLWAX2->SetLineWidth(5);
fLWAX3->SetLineWidth(5);
fTracksX = new TGraph(ntrackx*3);
fTracksX->SetName("Tracks X");
for(i = 0; i < fTracksX->GetN(); ++i)
fTracksX->SetPoint(i,pxa1,0.);
fTracksX->SetLineColor(3);
AddObject(fTracksX);
fPTrackX = new TGo4Picture("PTrackX","Tracking X wires");
fPTrackX->AddGraph(fTracksX,"AL");
fPTrackX->AddSpecialObject(fLWAX1,"SAME");
fPTrackX->AddSpecialObject(fLWAX2,"SAME");
fPTrackX->AddSpecialObject(fLWAX3,"SAME");
fPTrackX->SetAutoScale(false);
fPTrackX->SetRangeX(pxa0,pxa4);
fPTrackX->SetRangeY(-0.5*(pya1+1.),0.5*(pya1+1.));
fPTrackX->SetLegendDraw(false);
fPTrackX->SetHisStats(false);
AddPicture(fPTrackX);
itrackAX = 0;
pxb0 = -95.;
pxb1 = -90.;
pxb2 = -30.;
pxb3 = 0.;
pxb4 = 5.;
pyb1 = 4.;
pyb2 = 4.;
pyb3 = 2.;
fLWBX1 = new TLine(pxb1, -0.5*pyb1+dy1, pxb1, 0.5*pyb1+dy1);
fLWBX2 = new TLine(pxb2, -0.5*pyb2+dy2, pxb2, 0.5*pyb2+dy2);
fLWBX3 = new TLine(pxb3, -0.5*pyb3+dty, pxb3, 0.5*pyb3+dty);
fLWBX1->SetLineWidth(5);
fLWBX2->SetLineWidth(5);
fLWBX3->SetLineWidth(5);
fTracksY = new TGraph(ntracky*3);
fTracksY->SetName("Tracks Y");
for(i = 0; i < fTracksY->GetN(); ++i)
fTracksY->SetPoint(i,pxb1,0.);
fTracksY->SetLineColor(3);
AddObject(fTracksY);
fPTrackY = new TGo4Picture("PTrackY","Tracking Y wires");
fPTrackY->AddGraph(fTracksY,"AL");
fPTrackY->AddSpecialObject(fLWBX1,"SAME");
fPTrackY->AddSpecialObject(fLWBX2,"SAME");
fPTrackY->AddSpecialObject(fLWBX3,"SAME");
fPTrackY->SetAutoScale(false);
fPTrackY->SetRangeX(pxb0,pxb4);
fPTrackY->SetRangeY(-0.5*(pyb1+1.),0.5*(pyb1+1.));
fPTrackY->SetLegendDraw(false);
fPTrackY->SetHisStats(false);
AddPicture(fPTrackY);
itrackBX = 0;
}//------------------------------------------------------------
Bool_t TNeProc::BuildEvent(TGo4EventElement* target)
{
// called by framework from TNeEvent to fill it
TGo4Analysis *go4 = TGo4Analysis::Instance();
TNeEvent* NeEvent = (TNeEvent*) target;
TGo4MbsSubEvent* psubevt;
TGo4MbsEvent* fInput = (TGo4MbsEvent* ) GetInputEvent();
if(fInput == 0)
{
cout << "AnlProc: no input event !"<< endl;
return kFALSE;
}
bool dooutput = false;
double value1, value2;
double EsqxL,EsqyL,EsqxR,EsqyR,EanS,EanR, Esq20;
int num = 0, sz = 0;
int i, n, geo, typ, header,caen_header, module_id=0, crate=-1, cnt, chnl, evnt, trigger_mTDC, ch, iSQX_L, iSQY_L, iSQ20, nSQX_L, nSQY_L, nSQ20, iSQX_R, iSQY_R, nSQX_R, nSQY_R;
int nCsI_L,nCsI_R;
#include "idCsI_L.c"
#include "idCsI_R.c"
bool m_bool= false, c_bool = false;
uint16_t MSB, LSB;
uint32_t MSBLSB, adc;
uint32_t *idata;
double af3=0., af5=0., tf3=0., tf5=0., ToF=0.;
fInput->ResetIterator();
while((psubevt = fInput->NextSubEvent()) != 0)
{
num++;
sz += psubevt->GetIntLen();
idata = (uint32_t*) psubevt->GetDataField();
n = -1;
while(++n < psubevt->GetIntLen())
{
header = idata[n] >> 24;
caen_header = header & 0x7;
if (dooutput)
printf("Raw data = %x\n", idata[n]);
switch (psubevt->GetProcid())
{
case 100: //VME_0, see setup.usf
if (header==0x40)
m_bool=true; //MESYTEC header flag
else if (caen_header == 2)
c_bool=true; //CAEN header flag
else if ((idata[n]==0xaffeaffe) || (idata[n]== 0x06000000) || (idata[n]== 0x05000000))
{
c_bool=false;
m_bool=false;
}
if (m_bool) //in case of MESYTEC data
{
typ=idata[n] >> 30;
switch(typ)
{
case 1: //MESYTEC header
module_id = (idata[n] >> 16) & 0xff;
if (dooutput)
printf("Mesytec Module ID %d\n", module_id);
break;
case 0: //MESYTEC data
if(idata[n] >> 24!=0x04) break;
switch (module_id)
{
case 5: //mADC: SQX left
chnl= (idata[n] >> 16)&0x1f;
adc = idata[n] & 0xfff; //only 12 bits
NeEvent->SQX_L[chnl] = adc;
break;
case 6: //MADC: SQX right
chnl= (idata[n] >> 16)&0x1f;
adc = idata[n] & 0xfff; //only 12 bits
NeEvent->SQX_R[chnl] = adc;
break;
case 7: //mADC: SQY left and right
chnl= (idata[n] >> 16)&0x1f;
adc = idata[n] & 0xfff; //only 13 bits
if(chnl<16)
{
NeEvent->SQY_L[chnl] = adc;
}
else
{
NeEvent->SQY_R[chnl-16] = adc;
}
break;
case 8: //mADC: CsI left and right
chnl= (idata[n] >> 16)&0x1f;
adc = idata[n] & 0x1fff; //only 13 bits
if(chnl<16)
{
NeEvent->CsI_L[chnl] = adc;
}
else
{
NeEvent->CsI_R[chnl-16] = adc;
}
break;
case 9: //mADC:
chnl= (idata[n] >> 16)&0x1f;
adc = idata[n] & 0xfff; //only 13 bits
if(chnl<16)
{
NeEvent->SQ20[chnl] = adc;
}
break;
case 10: //mQDC:
chnl= (idata[n] >> 16) & 0x1f;
adc = idata[n] & 0xfff; //only 12 bits
if(chnl<4) NeEvent->F3[chnl] = adc;
else if(chnl<8) NeEvent->F5[chnl-4] = adc;
else if(chnl<12) NeEvent->F6[chnl-8] = adc;
break;
case 11: //mTDC:
if ((idata[n] >> 16) & 0x20) break; //T bit analysis
chnl= (idata[n] >> 16) & 0x1f;
adc = idata[n] & 0x1fff; //only 13 bits
if(chnl<4) NeEvent->tF3[chnl] = adc;
else if(chnl<8) NeEvent->tF5[chnl-4] = adc;
else if(chnl<12) NeEvent->tF6[chnl-8] = adc;
else if(chnl<16) NeEvent->tMWPC[chnl-12] = adc;
break;
case 12: //mTDC:
if ((idata[n] >> 16) & 0x20) break; //T bit analysis
chnl= (idata[n] >> 16) & 0x1f;
adc = idata[n] & 0xfff; //only 12 bits
if(chnl<16) NeEvent->tSQ20[chnl] = adc;
break;
}
break;
case 3: //MESYTEC footer
m_bool=false;
break;
default:
printf("ERROR !!!!!! Unknown MESYTEC typ %d\n", typ);
printf("Data = %x\n", idata[n]);
break;
}
}
else if (c_bool) //in case of CAEN data
{
typ = (idata[n] >> 24) & 0x7;
geo = idata[n] >> 27;
if (dooutput)
printf("CAEN geo %d\n", geo);
switch(typ)
{
case 2: //CAEN header
crate = (idata[n] >> 16) & 0xff;
cnt = (idata[n] >> 8) & 0x1f;
if (geo==30)
NeEvent->mtime=idata[n++];//machine time
if (dooutput)
printf("Header: geo:%d crate:%d cnt = %d\n", geo, crate, cnt);
break;
case 0: //CAEN data
adc = idata[n] & 0xfff;
chnl = (idata[n] >> 16) & 0x1f;
//printf("DATA: geo:%d Channel = %d\n", geo, chnl);
switch(geo)
{
case 0: //scaler v560
//for(i = 0; i < 16; ++i)
// NeEvent->scaler[i]=idata[n++];
break;
case 1: //TDC
NeEvent->tSQX_L[chnl] = adc;
break;
case 2: //TDC
NeEvent->tSQX_R[chnl] = adc;
break;
case 3: // TDC tSQY left and right
if(chnl<16)
{
NeEvent->tSQY_L[chnl] = adc;
}
else
{
NeEvent->tSQY_R[chnl-16] = adc;
}
break;
case 4: // CsI left & right tdc's
if(chnl<16)
{
NeEvent->tCsI_L[chnl] = adc;
}
else
{
NeEvent->tCsI_R[chnl-16] = adc;
}
break;
}
// printf(" Data: geo:%d chnl:%d adc:%d\n", geo, chnl, adc);
break;
case 4: //CAEN footer
c_bool = false;
evnt = idata[n] & 0xffffff;
if (dooutput)
printf(" Event: geo:%d number:%d\n", geo, evnt);
break;
case 6: //CAEN no valid data
c_bool = false;
if (dooutput)
printf("!!!No valid data from CAEN!!!");
break;
default:
printf("ERROR !!!!!! Uncknown CAEN typ %d\n", typ);
printf("Data = %x\n", idata[n]);
break;
}
}
break; //end of VME_0
case 101: // CAMAC through VME_0, see setup.usf
geo = idata[n] >> 27;
switch(geo)
{
case 20:
NeEvent->nx1 = 0;
adc = idata[++n];
LSB=adc;
//printf("First word from MWPC X1= %x\n", adc);
for(i = 0; i < 16; ++i)
if((adc & bit[i]) > 0) NeEvent->x1[NeEvent->nx1++] = i;
adc = idata[++n];
MSB=adc;
MSBLSB= MSB << 16 | LSB;
//printf("Second word from MWPC X1= %x\n", adc);
for(i = 0; i < 16; ++i)
if((adc & bit[i]) > 0) NeEvent->x1[NeEvent->nx1++] = i+16;
adc = idata[++n];//pass throug footer
//printf("Third word from MWPC X1= %x\n", adc);
NeEvent->rx1=MSBLSB;
break;
case 21:
NeEvent->ny1 = 0;
adc = idata[++n];
LSB=adc;
//printf("First word from MWPC Y1 = %x\n", adc);
for(i = 0; i < 16; ++i)
if((adc & bit[i]) > 0) NeEvent->y1[NeEvent->ny1++] = i;
adc = idata[++n];
MSB=adc;
MSBLSB= MSB << 16 | LSB;
//printf("Second word from MWPC Y1 = %x\n", adc);
for(i = 0; i < 16; ++i)
if((adc & bit[i]) > 0) NeEvent->y1[NeEvent->ny1++] = i+16;
adc = idata[++n];//pass through footer
//printf("Third word from MWPC Y1 = %x\n", adc);
NeEvent->ry1=MSBLSB;
break;
case 22:
NeEvent->nx2 = 0;
adc = idata[++n];
LSB=adc;
//printf("First word from MWPC X2 = %x\n", adc);
for(i = 0; i < 16; ++i)
if((adc & bit[i]) > 0) NeEvent->x2[NeEvent->nx2++] = i;
adc = idata[++n];
MSB=adc;
MSBLSB= MSB << 16 | LSB;
//printf("Second word from MWPC X2 = %x\n", adc);
for(i = 0; i < 16; ++i)
if((adc & bit[i]) > 0) NeEvent->x2[NeEvent->nx2++] = i+16;
adc = idata[++n];//pass through footer
//printf("Third word from MWPC X2 = %x\n", adc);
NeEvent->rx2=MSBLSB;
break;
case 23:
NeEvent->ny2 = 0;
adc = idata[++n];
LSB=adc;
//printf("First word from MWPC Y2 = %x\n", adc);
for(i = 0; i < 16; ++i)
if((adc & bit[i]) > 0) NeEvent->y2[NeEvent->ny2++] = i;
adc = idata[++n];
MSB=adc;
MSBLSB= MSB << 16 | LSB;
//printf("Second word from MWPC Y2 = %x\n", adc);
for(i = 0; i < 16; ++i)
if((adc & bit[i]) > 0) NeEvent->y2[NeEvent->ny2++] = i+16;
adc = idata[++n];//pass throug footer
//printf("Third word from MWPC Y2 = %x\n", adc);
NeEvent->rx2=MSBLSB;
break;
}
break; // end of CAMAC
case 200: // VME_1, see setup.usf
if (header==0x40)
m_bool=true; //MESYTEC header flag
else if (caen_header == 2)
c_bool=true; //CAEN header flag
else if ((idata[n]==0xaffeaffe) || (idata[n]== 0x06000000) || (idata[n]== 0x05000000))
{
c_bool=false;
m_bool=false;
}
if (m_bool) //in case of MESYTEC data
{
typ=idata[n] >> 30;
switch(typ)
{
case 1: //MESYTEC header
module_id = (idata[n] >> 16) & 0xff;
break;
case 0: //MESYTEC data
if(idata[n] >> 24!=0x04) break;
switch (module_id)
{
case 2: //mADC:
chnl= (idata[n] >> 16)&0x1f;
adc = idata[n] & 0x1fff; //only 13 bits
NeEvent->neutTDC[chnl] = adc;
break;
}
break;
case 3: //MESYTEC footer
m_bool=false;
break;
default:
printf("ERROR !!!!!! Uncknown MESYTEC typ %d\n", typ);
printf("Data = %x\n", idata[n]);
break;
}
}
else if (c_bool) //in case of CAEN data
{
typ = (idata[n] >> 24) & 0x7;
geo = idata[n] >> 27;
switch(typ)
{
case 2: //CAEN header
crate = (idata[n] >> 16) & 0xff;
cnt = (idata[n] >> 8) & 0x1f;
if (dooutput)
printf("Header: geo:%d crate:%d cnt = %d\n", geo, crate, cnt);
break;
case 0: //CAEN data
adc = idata[n] & 0xfff;
chnl = (idata[n] >> 16) & 0x1f;
switch(geo)
{
case 0: //ADC
if (chnl%2==0){
ch = chnl/2;
NeEvent->neutAmp[ch] = adc;
}
else {
ch = chnl/2;
NeEvent->neutTAC[ch] = adc;
}
break;
case 1: //ADC
if (chnl%2==0){
ch = chnl/2;
NeEvent->neutAmp[ch+16] = adc;
}
else {
ch = chnl/2;
NeEvent->neutTAC[ch+16] = adc;
}
break;
}
// printf(" Data: geo:%d chnl:%d adc:%d\n", geo, chnl, adc);
break;
case 4: //CAEN footer
c_bool = false;
evnt = idata[n] & 0xffffff;
if (dooutput)
printf(" Event: geo:%d number:%d\n", geo, evnt);
break;
case 6: //CAEN no valid data
c_bool = false;
if (dooutput)
printf("!!!No valid data from CAEN!!!");
break;
default:
printf("ERROR !!!!!! Uncknown CAEN typ %d\n", typ);
printf("Data = %x\n", idata[n]);
break;
}
}
break; //end of VME_1
} //end of GetProcID
} //end of GetIntLen
} //end of NextSubEvent
NeEvent->nevent = fInput->GetCount();
NeEvent->trigger = fInput->GetTrigger();
NeEvent->subevents = num;
NeEvent->evsize = sz;
fTrigger->Fill(NeEvent->trigger);
fSubEvents->Fill(num);
fEventsSizes->Fill(sz);
//
for (n=0; n<4; ++n)
// if(NeEvent->trigger == 2)
{
if(NeEvent->F3[n] > 0) d1F3[n]->Fill(NeEvent->F3[n]);
if(NeEvent->F5[n] > 0) d1F5[n]->Fill(NeEvent->F5[n]);
if(NeEvent->F6[n] > 0) d1F6[n]->Fill(NeEvent->F6[n]);
if(NeEvent->tF3[n] > 0) d1tF3[n]->Fill(NeEvent->tF3[n]);
if(NeEvent->tF5[n] > 0) d1tF5[n]->Fill(NeEvent->tF5[n]);
if(NeEvent->tF6[n] > 0) d1tF6[n]->Fill(NeEvent->tF6[n]);
if(NeEvent->tMWPC[n] > 0) d1tMWPC[n]->Fill(NeEvent->tMWPC[n]);
}
//
if(NeEvent->tF3[0] > 0 && NeEvent->F3[0] > 0) d2tF3aF3_L->Fill(NeEvent->tF3[0],NeEvent->F3[0]);
if(NeEvent->tF3[1] > 0 && NeEvent->F3[1] > 0) d2tF3aF3_R->Fill(NeEvent->tF3[1],NeEvent->F3[1]);
if(NeEvent->tF3[2] > 0 && NeEvent->F3[2] > 0) d2tF3aF3_U->Fill(NeEvent->tF3[2],NeEvent->F3[2]);
if(NeEvent->tF3[3] > 0 && NeEvent->F3[3] > 0) d2tF3aF3_D->Fill(NeEvent->tF3[3],NeEvent->F3[3]);
//
if(NeEvent->F3[0]>0&&NeEvent->F3[1]>0&&NeEvent->F3[2]>0&&NeEvent->F3[3]>0)
af3 = (NeEvent->F3[0]+NeEvent->F3[1]+NeEvent->F3[2]+NeEvent->F3[3]+4.*gRandom->Uniform())/4.;
if(NeEvent->F5[0]>0&&NeEvent->F5[1]>0&&NeEvent->F5[2]>0&&NeEvent->F5[3]>0)
af5 = (NeEvent->F5[0]+NeEvent->F5[1]+NeEvent->F5[2]+NeEvent->F5[3]+4.*gRandom->Uniform())/4.;
if(NeEvent->tF3[0]>0&&NeEvent->tF3[1]>0&&NeEvent->tF3[2]>0&&NeEvent->tF3[3]>0)
tf3 = (NeEvent->tF3[0]+NeEvent->tF3[1]+NeEvent->tF3[2]+NeEvent->tF3[3]+4.*gRandom->Uniform())/4.;
if(NeEvent->tF5[0]>0&&NeEvent->tF5[1]>0&&NeEvent->tF5[2]>0&&NeEvent->tF5[3]>0)
tf5 = (NeEvent->tF5[0]+NeEvent->tF5[1]+NeEvent->tF5[2]+NeEvent->tF5[3]+4.*gRandom->Uniform())/4.;
//
ToF = (tf5 - tf3)*0.125+89.165;
if(af3*af5*tf3*tf5!=0)
{
if(NeEvent->trigger == 1)
{
d1ToF->Fill(ToF);
d1aF3->Fill(af3);
d2ToFaF3->Fill(ToF,af3);
d1aF5->Fill(af5);
d2ToFaF5->Fill(ToF,af5);
}
}
//
for (n=0; n<16; ++n)
{
if(NeEvent->CsI_L[n] > 0 )
d1CsI_L[n]->Fill(NeEvent->CsI_L[n]);
// if(NeEvent->CsI_R[n] > 0 && ToF> 172 && ToF<176 && NeEvent->trigger == 1)
// d1CsI_R[n]->Fill(NeEvent->CsI_R[n]);
if(NeEvent->CsI_R[n] > 0 )
d1CsI_R[n]->Fill(NeEvent->CsI_R[n]);
if(NeEvent->tCsI_L[n] > 0)
d1tCsI_L[n]->Fill(NeEvent->tCsI_L[n]);
if(NeEvent->tCsI_R[n] > 0)
d1tCsI_R[n]->Fill(NeEvent->tCsI_R[n]);
if(NeEvent->SQY_L[n] > 0)
d1SQY_L[n]->Fill(NeEvent->SQY_L[n]);
if(NeEvent->tSQY_L[n] > 0)
d1tSQY_L[n]->Fill(NeEvent->tSQY_L[n]);
if(NeEvent->SQ20[n] > 0)
d1SQ20[n]->Fill(NeEvent->SQ20[n]);
if(NeEvent->tSQ20[n] > 0)
d1tSQ20[n]->Fill(NeEvent->tSQ20[n]);
if(NeEvent->SQY_R[n] > 0)
d1SQY_R[n]->Fill(NeEvent->SQY_R[n]);
if(NeEvent->tSQY_R[n] > 0)
d1tSQY_R[n]->Fill(NeEvent->tSQY_R[n]);
if(NeEvent->ANR[n] > 0)
d1ANR[n]->Fill(NeEvent->ANR[n]);
if(NeEvent->ANS[n] > 0)
d1ANS[n]->Fill(NeEvent->ANS[n]);
}
for (n=0; n<32; ++n)
{
if(NeEvent->SQX_L[n] > 0)
d1SQX_L[n]->Fill(NeEvent->SQX_L[n]);
if(NeEvent->tSQX_L[n] > 0)
d1tSQX_L[n]->Fill(NeEvent->tSQX_L[n]);
if(NeEvent->SQX_R[n] > 0)
d1SQX_R[n]->Fill(NeEvent->SQX_R[n]);
if(NeEvent->tSQX_R[n] > 0)
d1tSQX_R[n]->Fill(NeEvent->tSQX_R[n]);
if(NeEvent->neutAmp[n] > 0)
d1neutAmp[n]->Fill(NeEvent->neutAmp[n]);
if(NeEvent->neutTAC[n] > 0)
d1neutTAC[n]->Fill(NeEvent->neutTAC[n]);
if(NeEvent->neutTDC[n] > 0)
d1neutTDC[n]->Fill(NeEvent->neutTDC[n]);
if(NeEvent->neutAmp[n] > 0 && NeEvent->neutTAC[n] > 0)
d2Ngamma[n]->Fill(NeEvent->neutAmp[n],NeEvent->neutTAC[n]);
}
//CALIBRATED
nSQX_L = 0;
nSQY_L = 0;
nSQX_R = 0;
nSQY_R = 0;
nCsI_L = 0;
nCsI_R = 0;
nSQ20 = 0;
iSQX_L =0,iSQX_R =0,iSQY_L =0,iSQY_R =0, iSQ20 =0;
EsqxL = 0.,EsqyL = 0.,EsqxR = 0.,EsqyR = 0.,EanS = 0.,EanR = 0., Esq20 = 0.;
for (n=0; n<16; ++n)
{
if(NeEvent->SQY_L[n] > 0)
{
value1 = (double)NeEvent->SQY_L[n] + gRandom->Uniform();
value2 = ((TNeAnalysis*)go4)->pSQY_L_EC->Energy(value1, n);
if(NeEvent->tSQY_L[n] > 100)
{
d1SQY_L_C[n]->Fill(value2);
nSQY_L++;
iSQY_L = n;
d1nSQY_L->Fill(iSQY_L);
EsqyL = value2;
}
}
/* if(NeEvent->SQ20[n] > 80)
{
if(NeEvent->tSQ20[n] > 100)
{
nSQ20++;
iSQ20 = n;
Esq20 = (double)NeEvent->SQ20[n];
}
}*/
if(NeEvent->SQ20[n] > 0)
{
value1 = (double)NeEvent->SQ20[n] + gRandom->Uniform();
value2 = ((TNeAnalysis*)go4)->pSQ20_EC->Energy(value1, n);
if(NeEvent->tSQ20[n] > 100)
{
d1SQ20_C[n]->Fill(value2);
nSQ20++;
iSQ20 = n;
d1nSQ20->Fill(iSQ20);
Esq20 = value2;
}
}
if(NeEvent->SQY_R[n] > 0)
{
value1 = (double)NeEvent->SQY_R[n] + gRandom->Uniform();
value2 = ((TNeAnalysis*)go4)->pSQY_R_EC->Energy(value1, n);
// if(NeEvent->tSQY_R[n] > 100)
if(NeEvent->SQY_R[n] > 100)
{
d1SQY_R_C[n]->Fill(value2);
nSQY_R++;
iSQY_R = n;
d1nSQY_R->Fill(iSQY_R);
EsqyR = value2;
}
}
if(NeEvent->ANR[n] > 0)
{
value1 = (double)NeEvent->ANR[n] + gRandom->Uniform();
value2 = ((TNeAnalysis*)go4)->pANR_EC->Energy(value1, n);
d1ANR_C[n]->Fill(value2);
}
if(NeEvent->ANS[n] > 0)
{
value1 = (double)NeEvent->ANS[n] + gRandom->Uniform();
value2 = ((TNeAnalysis*)go4)->pANS_EC->Energy(value1, n);
d1ANS_C[n]->Fill(value2);
}
if(NeEvent->CsI_L[n] > 0)
{
value1 = (double)NeEvent->CsI_L[n] + gRandom->Uniform();
value2 = ((TNeAnalysis*)go4)->pCsI_L_EC->Energy(value1, n);
CsI_L_calib_cont[n]=value2;
if(NeEvent->tCsI_L[n] > 100) d1CsI_L_C[n]->Fill(value2);
if(value2 > 5.0)
{
nCsI_L++;
}
}
if(NeEvent->CsI_R[n] > 0)
{
value1 = (double)NeEvent->CsI_R[n] + gRandom->Uniform();
value2 = ((TNeAnalysis*)go4)->pCsI_R_EC->Energy(value1, n);
CsI_R_calib_cont[n]=value2;
if(NeEvent->tCsI_R[n] > 100) d1CsI_R_C[n]->Fill(value2);
if(value2 > 5.0)
{
nCsI_R++;
}
}
}
for (n=0; n<32; ++n)
{
if(NeEvent->SQX_L[n] > 0)
{
value1 = (double)NeEvent->SQX_L[n] + gRandom->Uniform();
value2 = ((TNeAnalysis*)go4)->pSQX_L_EC->Energy(value1, n);
if(NeEvent->tSQX_L[n] > 100)
{
d1SQX_L_C[n]->Fill(value2);
nSQX_L++;
iSQX_L = n;
d1nSQX_L->Fill(iSQX_L);
EsqxL = value2;
}
}
if(NeEvent->SQX_R[n] > 0)
{
value1 = (double)NeEvent->SQX_R[n] + gRandom->Uniform();
value2 = ((TNeAnalysis*)go4)->pSQX_R_EC->Energy(value1, n);
if(NeEvent->tSQX_R[n] > 100)
{
d1SQX_R_C[n]->Fill(value2);
nSQX_R++;
iSQX_R = n;
d1nSQX_R->Fill(iSQX_R);
EsqxR = value2;
}
}
}
/* for (n=0; n<16; ++n)
{
if(NeEvent->CsI_R[n] > 0 && EsqxL<20 && NeEvent->trigger == 3)
d1CsI_R[n]->Fill(NeEvent->CsI_R[n]);
}*/
// if(ToF>23&&ToF<29&&af5>350&&af5<850)//he6 condition
// if(ToF>35&&ToF<55)//he6 condition
// {
if(nSQX_L == 1 && nSQY_L == 1)
{
d2SQXSQY_L_D->Fill(iSQX_L, iSQY_L);
}
if(nSQX_R == 1 && nSQY_R == 1)
{
d2SQXSQY_R_D->Fill(iSQX_R, iSQY_R);
}
//
if(nSQY_L > 0 && nSQY_L <16) d1mSQY_L->Fill(nSQY_L);
if(nSQX_L > 0 && nSQX_L <32) d1mSQX_L->Fill(nSQX_L);
if(nSQY_R > 0 && nSQY_R <16) d1mSQY_R->Fill(nSQY_R);
if(nSQX_R > 0 && nSQX_R <32) d1mSQX_R->Fill(nSQX_R);
//
if(nSQX_L == 1) d1ESQX_L->Fill(EsqxL);
if(nSQX_R == 1) d1ESQX_R->Fill(EsqxR);
/* for(i=0; i<16; ++i)
{
if(nSQX_L == 1) d2dE_E_L[i]->Fill(CsI_L_calib_cont[i], EsqxL);
if(nSQX_R == 1) d2dE_E_R[i]->Fill(CsI_R_calib_cont[i], EsqxR);
//
if(nSQX_L == 1 && EsqxR > 2.0 && nSQX_R == 1) d2dE_E_L_c[i]->Fill(CsI_L_calib_cont[i], EsqxL);
// if(nSQX_R == 1 && EsqxL > 2.0 && nSQX_L == 1) d2dE_E_R_c[i]->Fill(CsI_R_calib_cont[i], EsqxR);
}
*/
if(nSQY_L == 1 && nSQ20 == 1)
d2SQ20_SQY_L ->Fill(EsqyL,Esq20);
// if(ToF> 165 && ToF<185 && NeEvent->trigger ==3)
// {
if(nSQX_L == 1 && nSQY_L == 1)
{
d2dE_E_L[idCsI_L[iSQY_L][iSQX_L]]->Fill(CsI_L_calib_cont[idCsI_L[iSQY_L][iSQX_L]], EsqxL);
}
if(nSQX_R == 1 && nSQY_R == 1)
{
d2dE_E_R[idCsI_R[iSQY_R][iSQX_R]]->Fill(CsI_R_calib_cont[idCsI_R[iSQY_R][iSQX_R]], EsqxR);
}
if(nSQX_L == 1 && nSQY_L == 1 && nSQX_R == 1 && nSQY_R == 1)
{
d2dE_E_L_c[idCsI_L[iSQY_L][iSQX_L]]->Fill(CsI_L_calib_cont[idCsI_L[iSQY_L][iSQX_L]], EsqxL);
}
if(nSQX_R == 1 && nSQY_R == 1 && nSQX_L == 1 && nSQY_L == 1 && nSQ20 == 1 && Esq20>2 && Esq20 <8 && EsqyL < 15)
{
d2dE_E_R_c[idCsI_R[iSQY_R][iSQX_R]]->Fill(CsI_R_calib_cont[idCsI_R[iSQY_R][iSQX_R]], EsqxR);
}
// }
//---------------------start of MWPC----------------------------------------
// if(NeEvent->trigger == 1 && ToF > 165 && ToF <185)
// {
for(i = 0; i < NeEvent->nx1; ++i) d1X1->Fill(NeEvent->x1[i]);
for(i = 0; i < NeEvent->ny1; ++i) d1Y1->Fill(NeEvent->y1[i]);
for(i = 0; i < NeEvent->nx2; ++i) d1X2->Fill(NeEvent->x2[i]);
for(i = 0; i < NeEvent->ny2; ++i) d1Y2->Fill(NeEvent->y2[i]);
// }
if(NeEvent->nx1 > 0) d1NX1->Fill(NeEvent->nx1);
if(NeEvent->ny1 > 0) d1NY1->Fill(NeEvent->ny1);
if(NeEvent->nx2 > 0) d1NX2->Fill(NeEvent->nx2);
if(NeEvent->ny2 > 0) d1NY2->Fill(NeEvent->ny2);
if(NeEvent->nx1 > 0)
d1CX1->Fill(GetClasters(NeEvent->nx1, NeEvent->x1));
if(NeEvent->ny1 > 0)
d1CY1->Fill(GetClasters(NeEvent->ny1, NeEvent->y1));
if(NeEvent->nx2 > 0)
d1CX2->Fill(GetClasters(NeEvent->nx2, NeEvent->x2));
if(NeEvent->ny2 > 0)
d1CY2->Fill(GetClasters(NeEvent->ny2, NeEvent->y2));
//
if(NeEvent->nx1 > 0 && NeEvent->ny1 > 0 && (GetClasters(NeEvent->nx1, NeEvent->x1)) == 1 && (GetClasters(NeEvent->ny1, NeEvent->y1)) == 1 && NeEvent->trigger == 1)
{
d2XY1->Fill(NeEvent->x1[0],NeEvent->y1[0]);
}
if(NeEvent->nx2 > 0 && NeEvent->ny2 > 0 && (GetClasters(NeEvent->nx2, NeEvent->x2)) == 1 && (GetClasters(NeEvent->ny2, NeEvent->y2)) == 1 && NeEvent->trigger == 1)
{
d2XY2->Fill(NeEvent->x2[0],NeEvent->y2[0]);
}
/* if(NeEvent->nx1 == 1 && NeEvent->ny1 == 1 && NeEvent->trigger == 1)
{
d2XY1->Fill(NeEvent->x1[0],NeEvent->y1[0]);
}
if(NeEvent->nx2 == 1 && NeEvent->ny2 == 1 && NeEvent->trigger == 1)
{
d2XY2->Fill(NeEvent->x2[0],NeEvent->y2[0]);
}
*/
//---Pictures---
/*
if(NeEvent->nx1 == 1 && NeEvent->nx2 == 1)
{
ya1 = -0.5*pya1 + dx1 + (pya1 / 32.)*NeEvent->x1[0];
ya2 = -0.5*pya2 + dx2 + (pya2 / 32.)*NeEvent->x2[0];
ya3 = ya1 + dtx + (ya2 - ya1) * (pxa3 - pxa1) / (pxa2 - pxa1);
if(ya3 > -0.5*pya1 && ya3 < 0.5*pya1)
{
if(((TNeAnalysis*)go4)->pMTracks->mtracksx != ntrackx)
{
ntrackx = ((TNeAnalysis*)go4)->pMTracks->mtracksx;
fTracksX->Set(3*ntrackx);
itrackAX = 0;
for(i = 0; i < fTracksX->GetN(); ++i)
fTracksX->SetPoint(i,pxb1,0.);
}
if(itrackAX == fTracksX->GetN()) itrackAX = 0;
fTracksX->SetPoint(itrackAX++,pxa1,ya1);
fTracksX->SetPoint(itrackAX++,pxa3,ya3);
fTracksX->SetPoint(itrackAX++,pxa1,ya1);
}
}
if(NeEvent->ny1 == 1 && NeEvent->ny2 == 1)
{
yb1 = -0.5*pyb1 + dy1+ (pyb1 / 32.)*NeEvent->y1[0];
yb2 = -0.5*pyb2 + dy2+ (pyb2 / 32.)*NeEvent->y2[0];
yb3 = yb1 + dty + (yb2 - yb1) * (pxb3 - pxb1) / (pxb2 - pxb1);
if(yb3 > -0.5*pyb1 && yb3 < 0.5*pyb1)
{
if(((TNeAnalysis*)go4)->pMTracks->mtracksy != ntracky)
{
ntracky = ((TNeAnalysis*)go4)->pMTracks->mtracksy;
fTracksY->Set(3*ntracky);
itrackBX = 0;
for(i = 0; i < fTracksY->GetN(); ++i)
fTracksY->SetPoint(i,pxb1,0.);
}
if(itrackBX == fTracksY->GetN()) itrackBX = 0;
fTracksY->SetPoint(itrackBX++,pxb1,yb1);
fTracksY->SetPoint(itrackBX++,pxb3,yb3);
fTracksY->SetPoint(itrackBX++,pxb1,yb1);
}
}
if(NeEvent->nx1 == 1 && NeEvent->nx2 == 1 && NeEvent->ny1 == 1 && NeEvent->ny2 == 1 )
{
d2Target->Fill(ya3,yb3);
}*/
//--------------------end of MWPC----------------------------------------
NeEvent->SetValid(kTRUE); // to store
return kTRUE;
} //-------------------------------------------------------------------
double TNeProc::GetClasters(unsigned short n, unsigned short *x)
{
int i;
double clasters = 1;
if(n == 0) clasters = 0.;
else if(n > 1)
{
for(i = 1; i < n; ++i)
{
if(abs(x[i] - x[i-1]) > 1) clasters += 1.;
}
}
return clasters;
} //--------------------------------------------------------------------
#ifndef TUNPACKPROCESSOR_H
#define TUNPACKPROCESSOR_H
#include <TLine.h>
#include <TGraph.h>
#include <TGraphErrors.h>
#include "TGo4EventProcessor.h"
//class TNeParam;
extern int otl;
class TNeProc : public TGo4EventProcessor
{
public:
TNeProc() ;
TNeProc(const char* name);
virtual ~TNeProc() ;
Bool_t BuildEvent(TGo4EventElement* target); // event processing function
double GetClasters(unsigned short n, unsigned short *x);
static long bit[32];
private:
TH1 *fTrigger;
TH1 *fSubEvents;
TH1 *fEventsSizes;
// RAW
// CsI
TH1 *d1CsI_L[16];
TH1 *d1CsI_R[16];
TH1 *d1tCsI_L[16];
TH1 *d1tCsI_R[16];
// Si LEFT
TH1 *d1SQX_L[32];
TH1 *d1SQY_L[16];
TH1 *d1tSQX_L[32];
TH1 *d1tSQY_L[16];
TH1 *d1SQ20[16];
TH1 *d1tSQ20[16];
// Si RIGHT
TH1 *d1SQX_R[32];
TH1 *d1SQY_R[16];
TH1 *d1tSQX_R[32];
TH1 *d1tSQY_R[16];
// ToF + MWPC + ANNULAR
TH1 *d1ANR[16];
TH1 *d1ANS[16];
TH1 *d1F3[4];
TH1 *d1tF3[4];
TH1 *d1F5[4];
TH1 *d1tF5[4];
TH1 *d1F6[4];
TH1 *d1tF6[4];
TH1 *d1tMWPC[4];
//
//
TH1 *d1ToF;
TH1 *d1aF3;
TH2 *d2ToFaF3;
TH1 *d1aF5;
TH2 *d2ToFaF5;
//
TH2 *d2tF3aF3_L;
TH2 *d2tF3aF3_R;
TH2 *d2tF3aF3_U;
TH2 *d2tF3aF3_D;
TH2 *d2SQXSQY_L_D;
TH1 *d1nSQX_L;
TH1 *d1nSQY_L;
TH1 *d1mSQX_L;
TH1 *d1mSQY_L;
TH1 *d1nSQ20;
TH2 *d2SQXSQY_R_D;
TH1 *d1nSQX_R;
TH1 *d1nSQY_R;
TH1 *d1mSQX_R;
TH1 *d1mSQY_R;
TH2 *d2dE_E_L[16];
TH2 *d2dE_E_R[16];
//
TH2 *d2dE_E_L_c[16];
TH2 *d2dE_E_R_c[16];
//
TH2 *d2SQ20_SQY_L;
//CALIBRATED
TH1 *d1ESQX_L;
TH1 *d1ESQX_R;
TH1 *d1SQX_L_C[32];
TH1 *d1SQY_L_C[16];
TH1 *d1SQX_R_C[32];
TH1 *d1SQY_R_C[16];
TH1 *d1ANR_C[16];
TH1 *d1ANS_C[16];
TH1 *d1CsI_L_C[16];
TH1 *d1CsI_R_C[16];
TH1 *d1SQ20_C[16];
//neutrons
TH1 *d1neutAmp[32];
TH1 *d1neutTAC[32];
TH1 *d1neutTDC[32];
TH2 *d2Ngamma[32];
//WIRES
TH1 *d1X1;
TH1 *d1Y1;
TH1 *d1X2;
TH1 *d1Y2;
TH1 *d1NX1;
TH1 *d1NY1;
TH1 *d1NX2;
TH1 *d1NY2;
TH2 *d2XY1;
TH2 *d2XY2;
TH1 *d1CX1;
TH1 *d1CY1;
TH1 *d1CX2;
TH1 *d1CY2;
TH2 *d2Target;
TGo4Picture *fPTrackX;
TGraph *fTracksX;
TLine *fLWAX1;
TLine *fLWAX2;
TLine *fLWAX3;
TGo4Picture *fPTrackY;
TGraph *fTracksY;
TLine *fLWBX1;
TLine *fLWBX2;
TLine *fLWBX3;
int ntrackx,ntracky;
int itrackAX;
int itrackBX;
double a,dx,dx1,dx2,dy1,dy2,dtx,dty;
double pxa0, pxa1, pxa2, pxa3, pxa4;
double CsI_L_calib_cont[16], CsI_R_calib_cont[16];
double pxb0, pxb1, pxb2, pxb3, pxb4;
double pya1, pya2, pya3;
double pyb1, pyb2, pyb3;
double ya1, ya2, ya3;
double yb1, yb2, yb3;
ClassDef(TNeProc,1)
};
#endif //TUNPACKPROCESSOR_H
//===================================================================
//== TNeSel.cxx: exp0211
//== Version: 2011-03-01
//===================================================================
#include "TNeSel.h"
#include "Riostream.h"
using std::cout;
using std::endl;
//***********************************************************
TNeSel::TNeSel(const char* name)
:TGo4Parameter(name)
,lval(0.)
,uval(4096.)
{
;
} //----------------------------------------------------------------
TNeSel::~TNeSel()
{
} //-----------------------------------------------------------------
Bool_t TNeSel::UpdateFrom(TGo4Parameter *source)
{
cout << "**** TNeDet1 " << GetName()
<< " updated from auto save file" << endl;
TNeSel * from = dynamic_cast<TNeSel *>(source);
if(from==0)
{
cout << "Wrong parameter class: "
<< source->ClassName() << endl;
return kFALSE;
}
lval = from->lval;
uval = from->uval;
return kTRUE;
} //-----------------------------------------------------------------
int TNeSel::CheckValue(double val)
{
if(val > lval && val < uval) return 1;
return 0;
} //-----------------------------------------------------------------
//===================================================================
//== TNeSel.h: exp0211
//== Version: 2011-03-01
//===================================================================
#ifndef TNeSEL_H
#define TNeSEL_H
#include "TGo4Parameter.h"
class TNeSel : public TGo4Parameter
{
public:
TNeSel(const char* name = 0);
virtual ~TNeSel();
virtual Bool_t UpdateFrom(TGo4Parameter *);
int CheckValue(double val);
double lval;
double uval;
ClassDef(TNeSel,1)
};
#endif
int idCsI_L[16][32] = {
{ 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0},
{ 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0},
{ 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0},
{ 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0},
{ 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4},
{ 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4},
{ 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4},
{ 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4},
{ 11,11,11,11,11,11,11,11,10,10,10,10,10,10,10,10, 9, 9, 9, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8, 8, 8, 8},
{ 11,11,11,11,11,11,11,11,10,10,10,10,10,10,10,10, 9, 9, 9, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8, 8, 8, 8},
{ 11,11,11,11,11,11,11,11,10,10,10,10,10,10,10,10, 9, 9, 9, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8, 8, 8, 8},
{ 11,11,11,11,11,11,11,11,10,10,10,10,10,10,10,10, 9, 9, 9, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8, 8, 8, 8},
{ 15,15,15,15,15,15,15,15,14,14,14,14,14,14,14,14,13,13,13,13,13,13,13,13,12,12,12,12,12,12,12,12},
{ 15,15,15,15,15,15,15,15,14,14,14,14,14,14,14,14,13,13,13,13,13,13,13,13,12,12,12,12,12,12,12,12},
{ 15,15,15,15,15,15,15,15,14,14,14,14,14,14,14,14,13,13,13,13,13,13,13,13,12,12,12,12,12,12,12,12},
{ 15,15,15,15,15,15,15,15,14,14,14,14,14,14,14,14,13,13,13,13,13,13,13,13,12,12,12,12,12,12,12,12}};
int idCsI_R[16][32] = {
{ 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3},
{ 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3},
{ 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3},
{ 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3},
{ 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7},
{ 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7},
{ 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7},
{ 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7},
{ 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10,10,10,10,10,10,11,11,11,11,11,11,11,11},
{ 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10,10,10,10,10,10,11,11,11,11,11,11,11,11},
{ 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10,10,10,10,10,10,11,11,11,11,11,11,11,11},
{ 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10,10,10,10,10,10,11,11,11,11,11,11,11,11},
{ 12,12,12,12,12,12,12,12,13,13,13,13,13,13,13,13,14,14,14,14,14,14,14,14,15,15,15,15,15,15,15,15},
{ 12,12,12,12,12,12,12,12,13,13,13,13,13,13,13,13,14,14,14,14,14,14,14,14,15,15,15,15,15,15,15,15},
{ 12,12,12,12,12,12,12,12,13,13,13,13,13,13,13,13,14,14,14,14,14,14,14,14,15,15,15,15,15,15,15,15},
{ 12,12,12,12,12,12,12,12,13,13,13,13,13,13,13,13,14,14,14,14,14,14,14,14,15,15,15,15,15,15,15,15} };
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