--- /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. *
+ **************************************************************************/
+
+/* $Id: */
+
+//____________________________________________________________________
+//
+// START - T0.
+//
+// This class is a singleton that handles various parameters of
+// the START detectors.
+// Eventually, this class will use the Conditions DB to get the
+// various parameters, which code can then request from here.
+//
+#include "AliLog.h"
+#include "AliSTARTParameters.h"
+#include "AliSTARTCalibData.h"
+#include "AliSTARTAlignData.h"
+#include <AliCDBManager.h>
+#include <AliCDBEntry.h>
+#include <AliCDBStorage.h>
+#include <Riostream.h>
+
+AliSTARTAlignData* AliSTARTParameters::fgAlignData = 0;
+AliSTARTCalibData* AliSTARTParameters::fgCalibData = 0;
+//====================================================================
+ClassImp(AliSTARTParameters)
+#if 0
+ ; // This is here to keep Emacs for indenting the next line
+#endif
+
+//____________________________________________________________________
+AliSTARTParameters* AliSTARTParameters::fgInstance = 0;
+//____________________________________________________________________
+AliSTARTParameters*
+AliSTARTParameters::Instance()
+{
+ // Get static instance
+ if (!fgInstance) fgInstance = new AliSTARTParameters;
+ return fgInstance;
+}
+
+//____________________________________________________________________
+AliSTARTParameters::AliSTARTParameters()
+ : fIsInit(kFALSE)
+{
+ // Default constructor
+ for (Int_t ipmt=0; ipmt<24; ipmt++)
+ {
+ SetTimeDelayCablesCFD(ipmt);
+ SetTimeDelayCablesLED(ipmt);
+ SetTimeDelayElectronicCFD(ipmt);
+ SetTimeDelayElectronicLED(ipmt);
+ SetTimeDelayPMT(ipmt);
+ SetVariableDelayLine(ipmt);
+ SetSlewingLED(ipmt);
+ SetPh2Mip();
+ SetChannelWidth();
+ SetmV2channel();
+ SetGain();
+ SetQTmin();
+ SetQTmax();
+ SetPMTeff(ipmt);
+ }
+ SetZposition();
+
+}
+
+//__________________________________________________________________
+void
+AliSTARTParameters::Init()
+{
+ // Initialize the parameters manager. We need to get stuff from the
+ // CDB here.
+ // if (fIsInit) return;
+
+ AliCDBManager* cdb = AliCDBManager::Instance();
+ cout<<" AliSTARTParameters::Init() CDB "<<cdb<<endl;
+ AliCDBStorage *stor = cdb->GetStorage("local://DBLocal");
+ fCalibentry = stor->Get("START/Calib/Gain_TimeDelay_Slewing_Walk",1);
+ if (fCalibentry){
+ fgCalibData = (AliSTARTCalibData*)fCalibentry->GetObject();
+ cout<<" got calibdata "<<endl;
+ }
+ fAlignentry = stor-> Get("START/Align/Positions",1);
+ if (fAlignentry){
+ fgAlignData = (AliSTARTAlignData*) fAlignentry->GetObject();
+ cout<<" got align data "<<endl;
+ }
+ cout<<" in INT :: calib "<<fCalibentry<<" align "<<fAlignentry<<endl;
+
+ fIsInit = kTRUE;
+}
+
+
+//__________________________________________________________________
+Float_t
+AliSTARTParameters::GetGain(Int_t ipmt) const
+{
+ // Returns the calibrated gain for each PMT
+ //
+
+ if (!fCalibentry)
+ return fFixedGain;
+
+ return fgCalibData->GetGain(ipmt);
+}
+
+//__________________________________________________________________
+Float_t
+AliSTARTParameters::GetTimeDelayLED(Int_t ipmt)
+{
+ // return time delay for LED channel
+ //
+ if (!fCalibentry) {
+ fTimeDelayLED = fTimeDelayCablesLED[ipmt] + fTimeDelayElectronicLED[ipmt] + fTimeDelayPMT[ipmt];
+ return fTimeDelayLED;
+ }
+ return fgCalibData ->GetTimeDelayLED(ipmt);
+}
+//__________________________________________________________________
+Float_t
+AliSTARTParameters::GetTimeDelayCFD(Int_t ipmt)
+{
+ // return time delay for CFD channel
+ //
+ if (!fCalibentry)
+ {
+ fTimeDelayCFD = fTimeDelayCablesCFD[ipmt] + fTimeDelayElectronicCFD[ipmt] + fTimeDelayPMT[ipmt] + fVariableDelayLine[ipmt];
+ return fTimeDelayCFD;
+ }
+
+ return fgCalibData->GetTimeDelayCFD(ipmt);
+}
+
+//__________________________________________________________________
+
+void
+AliSTARTParameters::SetSlewingLED(Int_t ipmt)
+{
+ // Set Slweing Correction for LED channel
+
+ Float_t mv[23] = {25, 30,40,60, 80,100,150,200,250,300,400,500,600,800,1000,1500, 2000, 3000, 4000, 5500, 6000, 7000,8000};
+ Float_t y[23] = {5044, 4719, 3835, 3224, 2847, 2691,2327, 1937, 1781, 1560, 1456 ,1339, 1163.5, 1027, 819, 650, 520, 370.5, 234, 156, 78, 0};
+
+ TGraph* gr = new TGraph(23,mv,y);
+ fSlewingLED.AddAtAndExpand(gr,ipmt);
+ }
+//__________________________________________________________________
+void
+AliSTARTParameters::SetPMTeff(Int_t ipmt)
+{
+ Float_t lambda[50];
+ Float_t eff[50 ] = {0, 0, 0.23619, 0.202909, 0.177913,
+ 0.175667, 0.17856, 0.190769, 0.206667, 0.230286,
+ 0.252276, 0.256267,0.26, 0.27125, 0.281818,
+ 0.288118, 0.294057,0.296222, 0.301622, 0.290421,
+ 0.276615, 0.2666, 0.248, 0.23619, 0.227814,
+ 0.219818, 0.206667,0.194087, 0.184681, 0.167917,
+ 0.154367, 0.1364, 0.109412, 0.0834615,0.0725283,
+ 0.0642963,0.05861, 0.0465, 0.0413333,0.032069,
+ 0.0252203,0.02066, 0.016262, 0.012, 0.00590476,
+ 0.003875, 0.00190, 0, 0, 0 } ;
+ for (Int_t i=0; i<50; i++) lambda[i]=200+10*i;
+
+ TGraph* gr = new TGraph(50,lambda,eff);
+ fPMTeff.AddAtAndExpand(gr,ipmt);
+}
--- /dev/null
+#ifndef ALISTARTPARAMETERS_H
+#define ALISTARTPARAMETERS_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights
+ * reserved.
+ *
+ * Latest changes by Christian Holm Christensen <cholm@nbi.dk>
+ *
+ * See cxx source for full Copyright notice
+ */
+
+//____________________________________________________________________
+//
+// Singleton class to handle various parameters of the
+// START - T0
+// Should get data fromm Conditions DB.
+//
+# include <TNamed.h>
+# include <TF1.h>
+# include <TGraph.h>
+#include <TObjArray.h>
+class AliSTARTCalibData;
+class AliSTARTAlignData;
+class AliCDBEntry;
+
+class AliSTARTParameters : public TNamed
+{
+public:
+ static AliSTARTParameters* Instance();
+
+ void Init();
+ // Set various `Fixed' parameters
+ void SetPh2Mip(Int_t r=500) { fPh2Mip = r; }
+ void SetChannelWidth(Int_t s=25) { fChannelWidth = s;}
+ void SetmV2channel(Int_t size=320) { fmV2Channel = size; }
+ void SetQTmin(Int_t qt=13) {fQTmin = qt;}
+ void SetQTmax(Int_t qt=125) {fQTmax = qt;}
+ void SetGain(Int_t size=50) { fFixedGain = size; }
+ void SetZposition( Float_t valueC=69.7, Float_t valueA=373) {
+ fSTARTzPosition[0]=valueC, fSTARTzPosition[1]=valueA;}
+ void SetPMTeff(Int_t ipmt);
+
+ // Set various variable parameter defaults
+ void SetTimeDelayCablesCFD(Int_t ipmt,Float_t r=150)
+ { fTimeDelayCablesCFD[ipmt] = r;}
+ void SetTimeDelayCablesLED(Int_t ipmt,Float_t r=150)
+ { fTimeDelayCablesLED[ipmt] = r;}
+ void SetTimeDelayPMT(Int_t ipmt,Float_t r=5)
+ { fTimeDelayPMT[ipmt] = r;}
+ void SetTimeDelayElectronicCFD(Int_t ipmt,Float_t r=8)
+ { fTimeDelayElectronicCFD[ipmt] = r;}
+ void SetTimeDelayElectronicLED(Int_t ipmt,Float_t r=10)
+ { fTimeDelayElectronicLED[ipmt] = r;}
+ void SetVariableDelayLine(Int_t ipmt, Int_t v=0)
+ { fVariableDelayLine[ipmt] = v;}
+ void SetSlewingLED(Int_t ipmt);
+
+
+ // Get `Fixed' various parameters
+ Int_t GetPh2Mip() const { return fPh2Mip; }
+ Int_t GetChannelWidth() const { return fChannelWidth; }
+ Int_t GetmV2channel() const { return fmV2Channel; }
+ Int_t GetQTmin() const {return fQTmin;}
+ Int_t GetQTmax() const {return fQTmax;}
+ Float_t GetGain(Int_t ipmt) const;
+ Float_t GetZposition(Int_t i) const {return fSTARTzPosition[i];}
+ TGraph * GetPMTeff(Int_t ipmt) const
+ {return (TGraph*)fPMTeff.At(ipmt);}
+ Float_t GetpmtEFF(Int_t ipmt, Float_t lambda) const
+ {return((TGraph*)fPMTeff.At(ipmt))->Eval(lambda);}
+
+ Float_t GetTimeDelayCablesCFD(Int_t ipmt) const
+ {return fTimeDelayCablesCFD[ipmt]; }
+ Float_t GetTimeDelayCablesLED(Int_t ipmt) const
+ {return fTimeDelayCablesLED[ipmt]; } ;
+
+ Float_t GetTimeDelayElectronicLED(Int_t ipmt) const
+ {return fTimeDelayElectronicLED[ipmt]; } ;
+ Float_t GetTimeDelayElectronicCFD(Int_t ipmt) const
+ {return fTimeDelayElectronicCFD[ipmt]; } ;
+ Int_t GetVariableDelayLine(Int_t ipmt) const
+ {return fVariableDelayLine[ipmt];}
+
+ Float_t GetSlewingLED(Int_t ipmt, Float_t mv) const
+ {return((TGraph*)fSlewingLED.At(ipmt))->Eval(mv);}
+ TGraph * GetSlew(Int_t ipmt) const
+ {return (TGraph*)fSlewingLED.At(ipmt);}
+
+ Float_t GetTimeDelayCFD(Int_t ipmt);
+ Float_t GetTimeDelayLED(Int_t ipmt);
+
+protected:
+ AliSTARTParameters();
+ virtual ~AliSTARTParameters() {}
+ static AliSTARTParameters* fgInstance; // Static singleton instance
+
+ Bool_t fIsInit;
+ Float_t fSTARTzPosition[2] ; // z-position of the two STARTs
+ Int_t fPh2Mip; // # photoelectrons per MIP in radiator
+ Int_t fChannelWidth; // channel width in ns
+ Int_t fmV2Channel; // ADC mv 2 channel # (200000ps/(25*25).
+ Int_t fQTmin; //min time for QTC
+ Int_t fQTmax; //max time fro QTC
+ Int_t fFixedGain; //
+ Float_t fTimeDelayCablesCFD[24]; //! time delay in cables
+ Float_t fTimeDelayCablesLED[24]; //! time delay in cables
+ Float_t fTimeDelayElectronicCFD[24]; //! time delay in electronic
+ Float_t fTimeDelayElectronicLED[24]; //! time delay in electronic
+ Float_t fTimeDelayPMT[24]; //! time delay in PMT
+ Int_t fVariableDelayLine[24]; //time delay in VDL for trigger equvalizing
+ TObjArray fSlewingLED; //array of slewing correction for each PMT
+ TObjArray fPMTeff; //array PMT registration efficiency
+
+ Float_t fTimeDelayLED; // sum time delay for LED channel
+ Float_t fTimeDelayCFD; // sum time delay for CFD channel
+
+ static AliSTARTAlignData * fgAlignData; // singleton for Calibration data
+ static AliSTARTCalibData * fgCalibData; // singleton for Calibration data
+
+ AliCDBEntry* fAlignentry ; //pointer to START align object
+ AliCDBEntry* fCalibentry ; // pointer to START calibration object
+
+ ClassDef(AliSTARTParameters,1)
+};
+
+#endif
+//____________________________________________________________________
+
--- /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. *
+ **************************************************************************/
+
+/* $Id$ */
+
+#include "AliLog.h"
+#include "AliRun.h"
+#include "AliRunLoader.h"
+#include "AliTriggerInput.h"
+
+#include "AliSTART.h"
+#include "AliSTARTLoader.h"
+#include "AliSTARTdigit.h"
+#include "AliSTARTTrigger.h"
+
+//----------------------------------------------------------------------
+ClassImp(AliSTARTTrigger)
+
+//----------------------------------------------------------------------
+AliSTARTTrigger::AliSTARTTrigger()
+ : AliTriggerDetector()
+{
+ SetName("START");
+ CreateInputs();
+}
+
+//----------------------------------------------------------------------
+void AliSTARTTrigger::CreateInputs()
+{
+ // inputs
+
+ // Do not create inputs again!!
+ if( fInputs.GetEntriesFast() > 0 ) return;
+
+ fInputs.AddLast( new AliTriggerInput( "START_A_L0", "Signal on T0-A", 0x01 ) );
+ fInputs.AddLast( new AliTriggerInput( "START_C_L0", "Signal on T0-C", 0x02 ) );
+ fInputs.AddLast( new AliTriggerInput( "START_Vertex_L0", " Vertex T0-C&T0-A ", 0x04 ) );
+ fInputs.AddLast( new AliTriggerInput( "START_Centr_L0", "Centrality central", 0x08 ) );
+ fInputs.AddLast( new AliTriggerInput( "START_SemiCentral_L0", "Centrality semicentral", 0x08 ) );
+}
+
+//----------------------------------------------------------------------
+void AliSTARTTrigger::Trigger()
+{
+
+ AliRunLoader* runLoader = gAlice->GetRunLoader();
+ AliLoader * fSTARTLoader = runLoader->GetLoader("STARTLoader");
+ // AliSTARTdigit *fDigits;
+ fSTARTLoader->LoadDigits("READ");
+ // Creating START data container
+ Int_t idebug = 1;
+ TTree* treeD = fSTARTLoader->TreeD();
+ if (!treeD) {
+ AliError("no digits tree");
+ return;
+ }
+
+ TBranch *brDigits = treeD->GetBranch("START");
+ if (brDigits) {
+ brDigits->SetAddress(&fDigits);
+ }else{
+ AliError("Branch START DIGIT not found");
+ exit(111);
+ }
+ brDigits->GetEntry(0);
+ Int_t besttimeright = fDigits->BestTimeRight();
+ Int_t besttimeleft = fDigits->BestTimeLeft();
+ Int_t timeDiff = besttimeright-besttimeleft;
+ Int_t meanTime = (besttimeright+besttimeleft)/2;
+ Int_t sumMult= fDigits->SumMult();
+ cout<<besttimeright<<" "<<besttimeleft<<" "<< timeDiff<<" "<<meanTime<<endl;
+
+ Int_t trigg[4];
+ if (besttimeright<1000) trigg[0]=1;
+ if (besttimeleft<1000) trigg[1]=1;
+ if (timeDiff<5) trigg[2]=1;
+ if (sumMult>2300) trigg[3]=1;
+ if (sumMult>1800) trigg[4]=1;
+
+
+ if( trigg[0] ) SetInput("START_T0A_L0");
+ if( trigg[1] ) SetInput("START_T0C_L0");
+ if( trigg[2] ) SetInput("START_T0vertex_L0");
+ if( trigg[3] ) SetInput("START_T0Centr_L0");
+ if( trigg[4] ) SetInput("START_T0SemiCentral_L0");
+ cout<<" Trigger "<<trigg[0]<<" "<<trigg[1]<<endl;
+
+}
--- /dev/null
+#ifndef ALISTARTTRIGGER_H
+#define ALISTARTTRIGGER_H
+
+/// \ingroup sim
+/// \class AliSTARTTrigger
+/// \brief START trigger class
+///
+/////////////////////////////////////////////////
+/// START Trigger Detector Class //
+/////////////////////////////////////////////////
+
+#include "AliTriggerDetector.h"
+class AliSTART;
+
+class AliSTARTTrigger : public AliTriggerDetector
+{
+ public:
+ AliSTARTTrigger(); // constructor
+ virtual ~AliSTARTTrigger(){} // destructor
+ virtual void CreateInputs();
+ virtual void Trigger();
+
+ private:
+
+ AliSTART *fSTART; //!
+ AliSTARTdigit *fDigits ; //! digits
+
+
+ ClassDef(AliSTARTTrigger,1) // START Trigger Detector class
+};
+#endif
+
+
+
+
+
+
+
+