--- /dev/null
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+
+
+//Root includes
+#include <TObjArray.h>
+#include <TH1F.h>
+#include <TString.h>
+#include <TMath.h>
+#include <TF1.h>
+#include <TRandom.h>
+#include <TDirectory.h>
+#include <TFile.h>
+#include "TTreeStream.h"
+
+//AliRoot includes
+#include "AliRawReader.h"
+#include "AliPMDRawStream.h"
+#include "AliPMDddldata.h"
+
+//header file
+#include "AliPMDCalibPedestal.h"
+
+
+ClassImp(AliPMDCalibPedestal)
+
+
+AliPMDCalibPedestal::AliPMDCalibPedestal() :
+ TObject()
+{
+ //
+ // default constructor
+ //
+
+ for (int i = 0; i < 2; i++)
+ {
+ for (int j = 0; j < 24; j++)
+ {
+ for (int k = 0; k < 96; k++)
+ {
+ for (int l = 0; l < 96; l++)
+ {
+
+ fPedHisto[i][j][k][l] = new TH1F("","",300,0.,300.);
+ }
+ }
+ }
+ }
+
+
+}
+//_____________________________________________________________________
+AliPMDCalibPedestal::AliPMDCalibPedestal(const AliPMDCalibPedestal &ped) :
+ TObject(ped)
+{
+ //
+ // copy constructor
+ //
+ for (int i = 0; i < 2; i++)
+ {
+ for (int j = 0; j < 24; j++)
+ {
+ for (int k = 0; k < 96; k++)
+ {
+ for (int l = 0; l < 96; l++)
+ {
+
+ fPedHisto[i][j][k][l] = ped.fPedHisto[i][j][k][l];
+ }
+ }
+ }
+ }
+
+}
+//_____________________________________________________________________
+AliPMDCalibPedestal& AliPMDCalibPedestal::operator = (const AliPMDCalibPedestal &source)
+{
+ //
+ // assignment operator
+ //
+ if (&source == this) return *this;
+ new (this) AliPMDCalibPedestal(source);
+
+ return *this;
+}
+//_____________________________________________________________________
+AliPMDCalibPedestal::~AliPMDCalibPedestal()
+{
+ //
+ // destructor
+ //
+ delete fPedHisto;
+}
+//_____________________________________________________________________
+Bool_t AliPMDCalibPedestal::ProcessEvent(AliRawReader *rawReader)
+{
+ //
+ // Event processing loop - AliRawReader
+ //
+ AliPMDRawStream rawStream(rawReader);
+
+ TObjArray pmdddlcont;
+ Bool_t streamout = kTRUE;
+
+ for (Int_t iddl = 0; iddl < 6; iddl++)
+ {
+
+ rawReader->Select("PMD", iddl, iddl);
+ //cout << reader.GetDataSize() << endl;
+ streamout = rawStream.DdlData(iddl, &pmdddlcont);
+ Int_t ientries = pmdddlcont.GetEntries();
+ for (Int_t ient = 0; ient < ientries; ient++)
+ {
+ AliPMDddldata *pmdddl = (AliPMDddldata*)pmdddlcont.UncheckedAt(ient);
+
+ Int_t det = pmdddl->GetDetector();
+ Int_t smn = pmdddl->GetSMN();
+ //Int_t mcm = pmdddl->GetMCM();
+ //Int_t chno = pmdddl->GetChannel();
+ Int_t row = pmdddl->GetRow();
+ Int_t col = pmdddl->GetColumn();
+ Int_t sig = pmdddl->GetSignal();
+
+ fPedHisto[det][smn][row][col]->Fill((Float_t) sig);
+
+ }
+ pmdddlcont.Clear();
+ }
+ return streamout;
+}
+//_____________________________________________________________________
+
+void AliPMDCalibPedestal::Analyse()
+{
+ //
+ // Calculate pedestal Mean and RMS
+ //
+ for (int i = 0; i < 2; i++)
+ {
+ for (int j = 0; j < 24; j++)
+ {
+ for (int k = 0; k < 96; k++)
+ {
+ for (int l = 0; l < 96; l++)
+ {
+
+ Float_t mean = fPedHisto[i][j][k][l]->GetMean();
+ Float_t rms = fPedHisto[i][j][k][l]->GetRMS();
+ }
+ }
+ }
+ }
+}
+//_____________________________________________________________________
--- /dev/null
+#ifndef ALIPMDCALIBPEDESTAL_H
+#define ALIPMDCALIBPEDESTAL_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+#include "TObject.h"
+
+class TH1F;
+class AliRawReader;
+
+class AliPMDCalibPedestal : public TObject {
+
+public:
+ AliPMDCalibPedestal();
+ AliPMDCalibPedestal(const AliPMDCalibPedestal &ped);
+ AliPMDCalibPedestal& operator = (const AliPMDCalibPedestal &source);
+ virtual ~AliPMDCalibPedestal();
+
+ Bool_t ProcessEvent(AliRawReader *rawReader);
+ void Analyse();
+
+private:
+
+ TH1F *fPedHisto[2][24][96][96];
+
+
+ ClassDef(AliPMDCalibPedestal,1)
+};
+
+
+
+#endif
+
--- /dev/null
+/*
+
+DAcase2.c
+
+This program connects to the DAQ data source passed as argument
+and populates local "./result.txt" file with the ids of events received
+during the run.
+
+The program exits when being asked to shut down (daqDA_checkshutdown)
+or End of Run event.
+
+Messages on stdout are exported to DAQ log system.
+
+contact: alice-datesupport@cern.ch
+
+*/
+extern "C" {
+#include <daqDA.h>
+}
+
+#include "event.h"
+#include "monitor.h"
+//#include "daqDA.h"
+
+#include <Riostream.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+//AliRoot
+#include "AliRawReaderDate.h"
+#include "AliPMDCalibPedestal.h"
+
+//ROOT
+#include "TFile.h"
+#include "TH1F.h"
+#include "TBenchmark.h"
+
+
+/* Main routine
+ Arguments:
+ 1- monitoring data source
+*/
+int main(int argc, char **argv) {
+
+ AliPMDCalibPedestal calibped;
+
+ TH1F::AddDirectory(0);
+
+
+ // decoding the events
+
+ int status;
+
+ if (argc!=2) {
+ printf("Wrong number of arguments\n");
+ return -1;
+ }
+
+ /* open result file */
+ FILE *fp=NULL;
+ fp=fopen("./result.txt","a");
+ if (fp==NULL) {
+ printf("Failed to open file\n");
+ return -1;
+ }
+
+ /* define data source : this is argument 1 */
+ status=monitorSetDataSource( argv[1] );
+ if (status!=0) {
+ printf("monitorSetDataSource() failed : %s\n",monitorDecodeError(status));
+ return -1;
+ }
+
+ /* declare monitoring program */
+ status=monitorDeclareMp( __FILE__ );
+ if (status!=0) {
+ printf("monitorDeclareMp() failed : %s\n",monitorDecodeError(status));
+ return -1;
+ }
+
+ /* define wait event timeout - 1s max */
+ monitorSetNowait();
+ monitorSetNoWaitNetworkTimeout(1000);
+
+ /* log start of process */
+ printf("DA example case2 monitoring program started\n");
+
+ /* init some counters */
+ int nevents_physics=0;
+ int nevents_total=0;
+
+ struct eventHeaderStruct *event;
+ eventTypeType eventT;
+ Int_t iev=0;
+
+ /* main loop (infinite) */
+ for(;;) {
+
+ /* check shutdown condition */
+ if (daqDA_checkShutdown()) {break;}
+
+ /* get next event (blocking call until timeout) */
+ status=monitorGetEventDynamic((void **)&event);
+ if (status==MON_ERR_EOF) {
+ printf ("End of File detected\n");
+ break; /* end of monitoring file has been reached */
+ }
+
+ if (status!=0) {
+ printf("monitorGetEventDynamic() failed : %s\n",monitorDecodeError(status));
+ break;
+ }
+
+ /* retry if got no event */
+ if (event==NULL) {
+ continue;
+ }
+
+ iev++;
+
+ /* use event - here, just write event id to result file */
+ eventT=event->eventType;
+ switch (event->eventType){
+
+ /* START OF RUN */
+ case START_OF_RUN:
+ break;
+ /* END START OF RUN */
+
+ /* END OF RUN */
+ case END_OF_RUN:
+ break;
+
+ case PHYSICS_EVENT:
+ printf(" event number = %i \n",iev);
+ AliRawReader *rawReader = new AliRawReaderDate((void*)event);
+ calibped.ProcessEvent(rawReader);
+
+ delete rawReader;
+ rawReader = 0x0;
+
+ }
+
+ /* free resources */
+ free(event);
+
+ /* exit when last event received, no need to wait for TERM signal */
+ if (eventT==END_OF_RUN) {
+ printf("EOR event detected\n");
+ calibped.Analyse();
+
+
+
+ break;
+ }
+ }
+
+ //write the Run level file
+ TFile * fileRun = new TFile ("outPMDdaRun.root","RECREATE");
+ TBenchmark *bench = new TBenchmark();
+ bench->Start("PMD");
+ bench->Stop("PMD");
+ bench->Print("PMD");
+ fileRun->Close();
+
+ /* write report */
+ fprintf(fp,"Run #%s, received %d physics events out of %d\n",getenv("DATE_RUN_NUMBER"),nevents_physics,nevents_total);
+
+ /* close result file */
+ fclose(fp);
+
+
+ return status;
+}
#pragma link C++ class AliPMDClusterFinder+;
#pragma link C++ class AliPMDtracker+;
#pragma link C++ class AliPMDReconstructor+;
+#pragma link C++ class AliPMDCalibPedestal+;
#endif
#-*- Mode: Makefile -*-
# $Id$
-SRCS:= AliPMDRecPoint.cxx AliPMDUtility.cxx AliPMDrecpoint1.cxx AliPMDrechit.cxx AliPMDcluster.cxx AliPMDClusteringV1.cxx AliPMDClusteringV2.cxx AliPMDclupid.cxx AliPMDEmpDiscriminator.cxx AliPMDClusterFinder.cxx AliPMDtracker.cxx AliPMDReconstructor.cxx AliPMDcludata.cxx
+SRCS:= AliPMDRecPoint.cxx AliPMDUtility.cxx AliPMDrecpoint1.cxx AliPMDrechit.cxx AliPMDcluster.cxx AliPMDClusteringV1.cxx AliPMDClusteringV2.cxx AliPMDclupid.cxx AliPMDEmpDiscriminator.cxx AliPMDClusterFinder.cxx AliPMDtracker.cxx AliPMDReconstructor.cxx AliPMDcludata.cxx AliPMDCalibPedestal.cxx
HDRS:= $(SRCS:.cxx=.h) AliPMDClustering.h AliPMDDiscriminator.h AliPMDcludata.h