Skip to content

Commit

Permalink
Merge pull request eudaq#20 from HGCDAQ/ahcal-in-onlinemon
Browse files Browse the repository at this point in the history
Ahcal hitmaps in onlinemon
  • Loading branch information
andreypz committed Jun 26, 2017
2 parents 7235d99 + 8542e98 commit 52e5441
Show file tree
Hide file tree
Showing 19 changed files with 787 additions and 156 deletions.
4 changes: 4 additions & 0 deletions STARTRUN
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ elif [[ $1 == "rpi" ]]; then
script=./producers/cmshgcal/STARTRUN_RPI
elif [[ $1 == "cmshgcal" ]]; then
script=./producers/cmshgcal/STARTRUN
elif [[ $1 == "ahcal" ]]; then
script=./producers/calice/runscripts/STARTRUN_AHCAL
elif [[ $1 == "all" ]]; then
script=./producers/cmshgcal/STARTRUN_ALL
else
# default
script=./sandbox/STARTRUN
Expand Down
4 changes: 4 additions & 0 deletions main/lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ if (BUILD_cmshgcal)
list(APPEND plugins_sources ${PROJECT_SOURCE_DIR}/producers/cmshgcal/src/HexaBoardConverterPlugin.cc)
endif()

if (BUILD_calice)
list(APPEND plugins_sources ${PROJECT_SOURCE_DIR}/producers/calice/src/CaliceGenericConverterPlugin.cc)
endif()

ADD_LIBRARY( ${PROJECT_NAME} SHARED ${library_sources} ${plugins_sources})

if (PROTOBUF_FOUND AND GEN_proto)
Expand Down
4 changes: 0 additions & 4 deletions producers/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ option(BUILD_allproducer "Build all producers?" OFF)
# with this option set to "ON" they are built anyway
option(IGNORE_KNOWN_ISSUES "Ignore known compilation issues of producer executables and configure them anyway?" OFF)


optional_add_subdirectory(ipbusTest)
#optional_add_subdirectory(cmshgcal)

optional_add_subdirectory(altro)
optional_add_subdirectory(altroUSB)
optional_add_subdirectory(depfet)
Expand Down
2 changes: 1 addition & 1 deletion producers/calice/runscripts/STARTRUN_AHCAL
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

source ~/opt/root/6.08.04/build/bin/thisroot.sh
#source ~/opt/root/6.08.04/build/bin/thisroot.sh

#source build_env.sh

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include <string>
#include <iostream>
#include <typeinfo> // for the std::bad_cast
#include <memory> // for std::unique_ptr

#include "eudaq/DataConverterPlugin.hh"
#include "eudaq/StandardEvent.hh"
Expand Down
146 changes: 146 additions & 0 deletions producers/cmshgcal/STARTRUN_ALL
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
#!/bin/bash

# ----------
# This starter script should run all producers at once:
# HGCAL (RPI or IPBUS), AHCAL, WireChamber, etc
#-----------

export RCPORT=44000
[ "$1" != "" ] && RCPORT=$1

export HOSTIP=127.0.0.1
export TLUIP=127.0.0.1
export HOSTNAME=127.0.0.1


dt=`date +"%y_%b_%d_%Hh%Mm"`
echo $dt
if [ -f './data/runnumber.dat' ]; then
RUNNUM=$(cat './data/runnumber.dat')
else
RUNNUM=0
fi

NEWRUNNUM=$((RUNNUM+1))
echo 'Last Run number: ' $RUNNUM 'New Run number:' $NEWRUNNUM


cd `dirname $0`
if [ -z "$LD_LIBRARY_PATH" ]; then
export LD_LIBRARY_PATH="`pwd`/lib"

else
export LD_LIBRARY_PATH="`pwd`/lib:$LD_LIBRARY_PATH"
fi

if [ ! -d ./data ]; then
mkdir -p ./data;
fi
if [ ! -d ./logs ]; then
mkdir -p ./logs;
fi
if [ ! -d ./data_root ]; then
mkdir -p ./data_root;
fi
if [ ! -d ./snapshots ]; then
mkdir -p ./snapshots;
fi

mkdir -p ./snapshots/run$NEWRUNNUM/;


printf '\033[1;32;48m \t STARTING DAQ LOCALLY\033[0m \n'
echo $(date)
printf '\033[22;33m\t Cleaning up first... \033[0m \n'

if [ -f KILLRUN.local ]
then
sh KILLRUN.local
else
sh KILLRUN
fi

printf '\033[22;31m\t End of killall \033[0m \n'

sleep 1

######################################################################
if [ -n "`ls data/run*.raw`" ]
then
printf '\033[22;33m\t Making sure all data files are properly writeprotected \033[0m \n'
chmod a=rw data/run*.raw
printf '\033[22;32m\t ...Done!\033[0m \n'
fi

cd bin
#=====================================================================
printf '\033[22;33m\t Starting Subprocesses \033[0m \n'
#=====================================================================
######################################################################
# euRun
###############
printf '\033[22;33m\t RunControl \033[0m \n'
./euRun.exe -x 0 -y 0 -w 650 -g 550 -a tcp://$RCPORT &
sleep 1
######################################################################
# euLog
###############
printf '\033[22;33m\t Logger \033[0m \n'
./euLog.exe -x 0 -y 550 -w 1500 -g 450 -r tcp://$HOSTIP:44000 &
sleep 2

######################################################################
# DataCollector
###############
printf '\033[22;33m\t TestDataCollector \033[0m \n'
#xterm -sb -sl 1000 -geom 80x10-480-900 -fn fixed -T "Data Collector" -e './TestDataCollector.exe -r tcp://$HOSTIP:$RCPORT' &
flog="../logs/Run${NEWRUNNUM}_DataCollector_$dt.log"
nohup ./TestDataCollector.exe -r tcp://$HOSTIP:$RCPORT > $flog 2>&1 &
printf "The logs from the DataCollector are in $flog file. \n"

sleep 2


######################################################################
# cnshgcal RpiProducer
###############
printf '\033[22;33m\t cms hgcal *Rpi* Producer \033[0m \n'
xterm -sb -sl 1000 -geom 80x600-280-900 -fn fixed -T "RPI Producer" -e './RpiProducer.exe -r tcp://$HOSTIP:$RCPORT' &
#flog="../logs/Run${NEWRUNNUM}_HGCalProducer_$dt.log"
#nohup ./HGCalProducer.exe -r tcp://$HOSTIP:$RCPORT > $flog 2>&1 &
#printf "The logs from the HGCalProducer are in $flog file. \n"

sleep 1

#######################################################################
# AHCAL producer
####################
printf '\033[22;33m\t caliceProducer-scintillator \033[0m \n'
xterm -sb -sl 1000000 -geom 160x10-480-900 -fn fixed -T "CALICE AHCAL" -e "./AHCALProducer.exe -n CaliceSc -r tcp://$TLUIP:$RCPORT && read || read" &
#./AHCALProducer.exe -n CaliceSc -r tcp://$TLUIP:$RCPORT

sleep 2


#####################################################################
if [ -f "HgcOnlineMon.exe" ]
then
printf '\033[22;33m\t HGC Online Monitor \033[0m \n'
flog="../logs/Run${NEWRUNNUM}_HgcOnlineMon_$dt.log"
config_file="../producers/cmshgcal/conf/OnlineMon.conf"
./HgcOnlineMon.exe -u 100 -rf -rs -sc 2 -c $config_file -tc 0 -r tcp://$HOSTIP:$RCPORT
#nohup ./HgcOnlineMon.exe -u 100 -rf -rs -sc 2 -c $config_file -tc 0 -r tcp://$HOSTIP:$RCPORT > $flog 2>&1 &
printf "The logs from the Online Monitor are in $flog file. \n"

else
printf '\033[22;31m\t Online monitor not found! \033[0m \n'
echo 'Configure EUDAQ with the CMake option "-D BUILD_onlinemon=ON" and re-run "make install" to install.'
fi
#####################################################################


printf ' \n'
printf ' \n'
printf ' \n'
printf '\033[1;32;48m\t ...Done!\033[0m \n'
printf '\033[1;32;48mSTART OF DAQ COMPLETE\033[0m \n'
7 changes: 6 additions & 1 deletion producers/cmshgcal/STARTRUN_RPI
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,15 @@ else
export LD_LIBRARY_PATH="`pwd`/lib:$LD_LIBRARY_PATH"
fi

if [ ! -d ./data ]; then
mkdir -p ./data;
fi
if [ ! -d ./logs ]; then
mkdir -p ./logs;
fi
if [ ! -d ./data_root ]; then
mkdir -p ./data_root;
fi

if [ ! -d ./snapshots ]; then
mkdir -p ./snapshots;
fi
Expand Down
82 changes: 82 additions & 0 deletions producers/cmshgcal/conf/AllInOneProducer.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
[RunControl]
RunSizeLimit = 500

[DataCollector]
FilePattern = "../data/run$6R$X"

[LogCollector]
SaveLevel = EXTRA
PrintLevel = DEBUG


[Producer.RPI]
RPI_1_IP = '127.0.0.1'
# svhgcal01:
#RPI_1_IP = '128.141.151.253'
# Main RPI on the ReadOut board::
#RPI_1_IP = '192.168.222.3'
# Spare RPI:
#RPI_1_IP = '192.168.222.99'

# Other addresses for tests:
#RPI_1_IP = '128.141.196.154'
#RPI_1_IP = '128.141.196.225'
#RPI_1_IP = '128.141.149.196'

# These should not be changed:
portTCP = '55511'
portUDP = '55512'




[Producer.CaliceSc]
#FileLEDsettings ="F:\\LEDEUDAQ\\LED1.ini"
FileMode = 0
WaitMillisecForFile = 3000
# waitsecondsForQueuedEvents: Sleeping time (in seconds) after clicking stop: needed to read all the events stored in the Labview data queue
waitsecondsForQueuedEvents = 3
Port = 5622
IPAddress = "192.168.1.11"
Reader = "Scintillator"
WriteRawOutput = 1
#RawFileName = "../data/Run_%05d"
RawFileName = "../data/rawAHCAL_%05d"
WriteRawFileNameTimestamp = 0
ColoredTerminalMessages = 1

#LdaTrigidOffset to compensate differences between TLU (or other trigger number source) and LDA. Eudaq Event counting starts from this number and will be always subtracted from the eudaq event triggerid.
LdaTrigidOffset = 1
#LdaTrigidStartsFrom: The first expected raw triggerID from LDA in the data stream in case it is not 0. It suppresses error warning for the first event. When set higher then the first event, triggers below the provided number are ignored!
LdaTrigidStartsFrom = 1
#GenerateTriggerIDFrom sets from which triggerID number should be data generated (and filled with dummy triggers if necessary). Only works when insert_dummy_packets is enabled and in selected event building modes
GenerateTriggerIDFrom = 0
#InsertDummyPackets: 1=inserts dummy packets to keep correct sequence of TrigIDs or ReadOutCycles; 0=do not insert anything
InsertDummyPackets = 1

#When RedirectInputFromFile is set, an existing raw raw data file is used as a fake input from detector
#RedirectInputFromFile="/home/calice/Desktop/EUDAQ2-testbeam2017February/data/detector_45015.raw"
RedirectInputFromFile="../data/ahcal/detector_45131.raw"
#EventBuildingMode selects what event building will be used and
#EventBuildingMode = "ROC"
#EventBuildingMode = "TRIGGERID"
#EventBuildingMode = "BUILD_BXID_ALL"
EventBuildingMode = "BUILD_BXID_VALIDATED"

#EventNumberingPreference chooses a main numbering method, when both are available (especially in BUILD_BXID_VALIDATE and TRIGGERID event building mode)
EventNumberingPreference = "TRIGGERID"
#EventNumberingPreference = "TIMESTAMP"

#IgnoreLdaTimestamps ignores timestamp in the LDA data stream
IgnoreLdaTimestamps = 0

#DebugKeepBuffered: 1=keep events in producer buffer and don't send the data to data collector. 0=pass packets normally
DebugKeepBuffered = 0

#AHCALBXID0offset = offset from start acquisition Timestamp to BXID0 (in 25ns steps). Varies with AHCAL powerpulsing setting and DIF firmware
AHCALBXID0Offset = 2123
#AHCALBXID0Offset = 61415 #powerpulsing
#AHCALBXIDWidth = length of the bxid in 25 ns steps. 4us=160, 200ns=8
AHCALBXIDWidth = 160


2 changes: 1 addition & 1 deletion producers/cmshgcal/conf/OnlineMon.conf
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[General]
DqmColorMap = 56
DqmColorMap = 54
6 changes: 4 additions & 2 deletions producers/cmshgcal/onlinemon/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,17 @@ SET (HgcOnlineMon_SOURCES
src/OnlineMon.cxx
src/OnlineMonWindow.cc
src/BaseCollection.cc
src/HexagonCollection.cc
src/HexagonHistos.cc
src/AhcalCollection.cc
src/AhcalHistos.cc
src/CheckEOF.cc
src/CorrelationCollection.cc
src/CorrelationHistos.cc
src/EUDAQMonitorCollection.cc
src/EUDAQMonitorHistos.cc
src/EventSanityChecker.cc
src/GraphWindow.cc
src/HexagonCollection.cc
src/HexagonHistos.cc
src/HitmapCollection.cc
src/HitmapHistos.cc
src/MonitorPerformanceCollection.cc
Expand Down
53 changes: 53 additions & 0 deletions producers/cmshgcal/onlinemon/include/AhcalCollection.hh
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// -*- mode: c -*-

#ifndef AHCALCOLLECTION_HH_
#define AHCALCOLLECTION_HH_
// ROOT Includes
#include <RQ_OBJECT.h>
#include <TH2I.h>
#include <TFile.h>

// STL includes
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <iostream>

#include "eudaq/StandardEvent.hh"

// Project Includes
#include "SimpleStandardEvent.hh"
#include "AhcalHistos.hh"
#include "BaseCollection.hh"

class AhcalCollection : public BaseCollection {
RQ_OBJECT("AhcalCollection")
protected:
bool isOnePlaneRegistered;
std::map<eudaq::StandardPlane, AhcalHistos *> _map;
bool isPlaneRegistered(eudaq::StandardPlane p);
void fillHistograms(const eudaq::StandardPlane &plane);

public:
void registerPlane(const eudaq::StandardPlane &p);
void bookHistograms(const eudaq::StandardEvent &ev);
void setRootMonitor(RootMonitor *mon) { _mon = mon; }
AhcalCollection() : BaseCollection() {
std::cout << " Initialising Ahcal Collection" << std::endl;
isOnePlaneRegistered = false;
CollectionType = AHCAL_COLLECTION_TYPE;
}
void Fill(const SimpleStandardEvent &simpev) { ; };
void Fill(const eudaq::StandardEvent &ev);
AhcalHistos *getAhcalHistos(std::string sensor, int id);
void Reset();
virtual void Write(TFile *file);
virtual void Calculate(const unsigned int currentEventNumber);
};

#ifdef __CINT__
#pragma link C++ class AhcalCollection - ;
#endif

#endif /* AHCALCOLLECTION_HH_ */
Loading

0 comments on commit 52e5441

Please sign in to comment.