Changes to compile with Root6 on macosx64
[u/mrichter/AliRoot.git] / STEER / STEER / AliTriggerRunScalers.h
CommitLineData
d7dd8a54 1#ifndef ALITRIGGERRUNSCALERS_H
2#define ALITRIGGERRUNSCALERS_H
3
4/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 * See cxx source for full Copyright notice */
6
7/* $Id: AliTriggerRunScalers.h 22322 2007-11-22 11:43:14Z cvetan $ */
8
9///////////////////////////////////////////////////////////////////////////////
10//
11// Class to define a collection scalers per Run
12//
13//
14//
15//////////////////////////////////////////////////////////////////////////////
16class TObject;
7f66b913 17class TGraphErrors;
d7dd8a54 18class AliTimeStamp;
6441c2a8 19class AliTriggerScalersESD;
d7dd8a54 20class AliTriggerScalersRecord;
6441c2a8 21class AliTriggerScalersRecordESD;
7f66b913 22class AliTriggerConfiguration;
d7dd8a54 23
24#include "TArrayC.h"
25
26class AliTriggerRunScalers : public TObject {
27
28public:
29 AliTriggerRunScalers();
7eaf72df 30 virtual ~AliTriggerRunScalers();
d7dd8a54 31 // Getters
32 Short_t GetVersion() const { return fVersion; }
33 ULong_t GetRunNumber() const { return fRunNumber; }
34 UChar_t GetNumClasses() const { return fnClasses; }
35 Char_t GetClass( Int_t i ) const { return fClassIndex[i]; }
033d0f8e 36 const TObjArray* GetScalersRecords() const { return &fScalersRecord; }
6441c2a8 37 const TObjArray* GetScalersRecordsESD() const { return &fScalersRecordESD; }
033d0f8e 38 AliTriggerScalersRecord* GetScalersRecord( Int_t index ) const { return (AliTriggerScalersRecord*)fScalersRecord.At(index); }
39 Int_t FindNearestScalersRecord( const AliTimeStamp *stamp ) const;
6441c2a8 40 AliTriggerScalersESD* GetScalersForEventClass(const AliTimeStamp* stamp,const Int_t classIndex) const;
7f66b913 41 const AliTriggerScalersRecordESD* GetScalersDeltaForEvent(const AliTimeStamp* stamp) const;
42 const AliTriggerScalersRecordESD* GetScalersDeltaForRun() const;
43
6441c2a8 44 // Analysis
74135182 45 Int_t ConsistencyCheck(Int_t position,Bool_t correctOverflow, UInt_t** overflow);
6441c2a8 46 Int_t CorrectScalersOverflow();
a93ccff3 47 Int_t CheckRunScalers(){return (fScalersRecord.GetEntriesFast()==fScalersRecordESD.GetEntriesFast());}
d7dd8a54 48 // Setters
49 void SetVersion( Short_t ver ) { fVersion = ver; }
50 void SetRunNumber( ULong_t run ) { fRunNumber = run; }
51 void SetNumClasses( UChar_t nclass ) { fnClasses = nclass; fClassIndex.Set(nclass); }
52 void SetClass( UChar_t i, UChar_t index ) { fClassIndex[i]=index; }
53 void AddTriggerScalers( AliTriggerScalersRecord* scal );
54 virtual void Print( const Option_t* opt ="" ) const;
bf7443cc 55 AliTriggerRunScalers( const AliTriggerRunScalers &run );
56 AliTriggerRunScalers& operator=(const AliTriggerRunScalers& run);
d7dd8a54 57
7f66b913 58static AliTriggerRunScalers* ReadScalers( TString & filename );
eaf06408 59 static Bool_t CalculateMu(Double_t &mu, Double_t &errmu, ULong64_t countsB, ULong64_t countsAC, UShort_t nB, UShort_t nAC, UInt_t orbits, Bool_t bkgCorr=kTRUE, Double_t triggerEff=1., Double_t errorEff=0.);
60 static Bool_t CalculateMu(Double_t &mu, Double_t &errmu, ULong64_t countsB, ULong64_t countsAC, ULong64_t beamB, UShort_t nB, UShort_t nAC, Bool_t bkgCorr=kTRUE, Double_t triggerEff=1., Double_t errorEff=0.);
61 static ULong64_t GetDeltaScaler(const AliTriggerScalersRecordESD* scalRec1, const AliTriggerScalersRecordESD* scalRec2, Int_t classIndex, TString level);
7f66b913 62 static Double_t GetDeltaTime(const AliTriggerScalersRecordESD* scalRec1, const AliTriggerScalersRecordESD* scalRec2);
63 static UInt_t GetDeltaOrbits(const AliTriggerScalersRecordESD* scalRec1, const AliTriggerScalersRecordESD* scalRec2);
eaf06408 64 static Bool_t GetScalerRate(Double_t &rate, Double_t &error, const AliTriggerScalersRecordESD* scalRec1, const AliTriggerScalersRecordESD* scalRec2, Int_t classIndex, TString level);
65 static Bool_t GetScalerRatePerBC(Double_t &rate, Double_t &error, const AliTriggerScalersRecordESD* scalRec1, const AliTriggerScalersRecordESD* scalRec2, AliTriggerConfiguration* cfg, Int_t classIndex, TString level);
66 static Bool_t GetClassL2L0(Double_t &l2l0, Double_t &error, const AliTriggerScalersRecordESD* scalRec1, const AliTriggerScalersRecordESD* scalRec2, Int_t classIndex);
67 static Bool_t GetMuFromClassScaler(Double_t &mu, Double_t &errmu, const char* className, const AliTriggerScalersRecordESD* scalRec1, const AliTriggerScalersRecordESD* scalRec2, AliTriggerConfiguration* cfg, Bool_t colBCsFromFillScheme=kTRUE, Bool_t bkgCorr=kTRUE, Double_t triggerEff=1., Double_t errorEff=0.);
68 ULong64_t GetDeltaScalerForRun(Int_t classIndex, TString level);
69 Bool_t GetScalerRateForRun(Double_t &rate, Double_t &error, Int_t classIndex, TString level);
70 Bool_t GetClassL2L0ForRun(Double_t &l2l0, Double_t &error, Int_t classIndex);
71 TGraphErrors* GetGraphScalerRate(const char* className, TString level, AliTriggerConfiguration* cfg);
7f66b913 72 TGraphErrors* GetGraphScalerL2L0Ratio(const char* className, AliTriggerConfiguration* cfg);
eaf06408 73 TGraphErrors* GetGraphMu(AliTriggerConfiguration* cfg, const char* className, Bool_t colBCsFromFillScheme=kTRUE, Bool_t bkgCorr=kTRUE, Double_t triggerEff=1., Double_t errorEff=0.);
7f66b913 74
d7dd8a54 75private:
76 Short_t fVersion; // Version
77 ULong_t fRunNumber; // Run number
78 UChar_t fnClasses; // Number of trigger classes
79 TArrayC fClassIndex; // list of classes used in this partition
80 TObjArray fScalersRecord; // Array of records (AliTriggerScalersRecord)
bf7443cc 81 TObjArray fScalersRecordESD; // Array of records with 64bit scalers (AliTriggerScalersRecordESD)
82
d7dd8a54 83
d7dd8a54 84
7f66b913 85 ClassDef( AliTriggerRunScalers, 4 ) // Define a Run Trigger Scalers (Scalers)
d7dd8a54 86};
87
88#endif