#include "AliPHOSDigitizer.h"
#include "AliPHOSSDigitizer.h"
#include "AliPHOSGeometry.h"
+#include "AliPHOSTick.h"
ClassImp(AliPHOSDigitizer)
fCPVNoise = 0.01;
fCPVDigitThreshold = 0.09 ;
fTimeResolution = 1.0e-9 ;
+ fTimeSignalLength = 1.0e-9 ;
fDigitsInRun = 0 ;
fPedestal = 0.; // Calibration parameters
fSlope = 10000000. ;
+ fTimeThreshold = 0.001*fSlope ; //Means 1 MeV in terms of SDigits amplitude
fARD = 0 ; // We work in the standalong mode
}
fDigitsInRun = 0 ;
fPedestal = 0.; // Calibration parameters
fSlope = 10000000. ;
+ fTimeSignalLength = 1.0e-9 ;
+ fTimeThreshold = 0.001*fSlope ; //Means 1 MeV in terms of SDigits amplitude
fARD = 0 ; // We work in the standalong mode
Init() ;
Int_t curNext = ((AliPHOSDigit *)sdigits->At(0))->GetId() ;
if(curNext < nextSig) nextSig = curNext ;
}
-
- TArrayF * energies = new TArrayF(input);
- TArrayF * times = new TArrayF(input) ;
+
TArrayI index(input) ;
index.Reset() ; //Set all indexes to zero
AliPHOSDigit * digit ;
AliPHOSDigit * curSDigit ;
+ TClonesArray * ticks = new TClonesArray("AliPHOSTick",1000) ;
+
//Put Noise contribution
for(absID = 1; absID <= nEMC; absID++){
Float_t noise = gRandom->Gaus(0., fPinNoise) ;
if(absID==nextSig){
//Add SDigits from all inputs
digit = (AliPHOSDigit *) digits->At(absID-1) ;
+
+ ticks->Clear() ;
Int_t contrib = 0 ;
- energies[contrib] = digit->GetAmp() ;
- times[contrib] = digit->GetTime() ;
+ Float_t a = digit->GetAmp() ;
+ Float_t b = TMath::Abs( a /fTimeSignalLength) ;
+ //Mark the beginnign of the signal
+ new((*ticks)[contrib++]) AliPHOSTick(digit->GetTime(),0, b);
+ //Mark the end of the ignal
+ new((*ticks)[contrib++]) AliPHOSTick(digit->GetTime()+fTimeSignalLength, -a, -b);
+
//loop over inputs
for(i=0; i<input; i++){
curSDigit = (AliPHOSDigit*)((TClonesArray *)sdigArray->At(i))->At(index[i]) ;
else
primaryoffset = 10000000*i ;
curSDigit->ShiftPrimary(primaryoffset) ;
+
+ a = curSDigit->GetAmp() ;
+ b = a /fTimeSignalLength ;
+ new((*ticks)[contrib++]) AliPHOSTick(curSDigit->GetTime(),0, b);
+ new((*ticks)[contrib++]) AliPHOSTick(curSDigit->GetTime()+fTimeSignalLength, -a, -b);
*digit = *digit + *curSDigit ; //add energies
- energies[contrib] = curSDigit->GetAmp() ;
- times[contrib] = curSDigit->GetTime() ;
- contrib++ ;
+
index[i]++ ;
curSDigit = (AliPHOSDigit*)((TClonesArray *)sdigArray->At(i))->At(index[i]) ;
}
}
//calculate and set time
- Float_t time = FrontEdgeTime(energies, times) ;
+ Float_t time = FrontEdgeTime(ticks) ;
digit->SetTime(time) ;
- energies->Reset() ;
- times->Reset() ;
+
//Find next signal module
+ nextSig = 200000 ;
for(i=0; i<input; i++){
sdigits = ((TClonesArray *)sdigArray->At(i)) ;
Int_t curNext = ((AliPHOSDigit *) sdigits->At(index[i]))->GetId() ;
}
}
+ ticks->Delete() ;
+ delete ticks ;
//Now CPV digits (different noise and no timing)
}
}
- delete energies ;
- delete times ;
delete sdigArray ; //We should not delete its contents
}
//____________________________________________________________________________
-Float_t AliPHOSDigitizer::FrontEdgeTime(TArrayF * energies, TArrayF * times)
+Float_t AliPHOSDigitizer::FrontEdgeTime(TClonesArray * ticks)
{ //
- Float_t curtime = times->At(0) ;
- Float_t time = curtime ;
- Int_t i = 1 ;
- while(curtime){
- if(time > curtime) time = curtime ;
- curtime = times->At(i++) ;
+ ticks->Sort() ; //Sort in accordance with times of ticks
+ TIter it(ticks) ;
+ AliPHOSTick * ctick = (AliPHOSTick *) it.Next() ;
+ Float_t time = ctick->CrossingTime(fTimeThreshold) ;
+
+ AliPHOSTick * t ;
+ while((t=(AliPHOSTick*) it.Next())){
+ if(t->GetTime() < time) //This tick starts before crossing
+ *ctick+=*t ;
+ else
+ return time ;
+
+ time = ctick->CrossingTime(fTimeThreshold) ;
}
return time ;
-
}
//____________________________________________________________________________
Bool_t AliPHOSDigitizer::Init()
void PrintDigits(Option_t * option) ;
void WriteDigits(Int_t evt) ; // Writes Digits for particular event
Float_t TimeOfNoise(void) ; // Calculate time signal generated by noise
- Float_t FrontEdgeTime(TArrayF *energies, TArrayF * times) ;
+ Float_t FrontEdgeTime(TClonesArray * ticks) ;
Int_t DigitizeEnergy(Int_t amp, Int_t absId) ;
//Calculate the time of crossing of the threshold by front edge
private:
--- /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$ */
+
+//_________________________________________________________________________
+// Auxiliary class to help calculate the time of crossing
+// of the threshold by the front edge of the time signal
+//
+//*-- Author : Dmitri Peressounko (SUBATECH)
+//////////////////////////////////////////////////////////////////////////////
+
+// --- ROOT system ---
+
+// --- Standard library ---
+
+// --- AliRoot header files ---
+#include "AliPHOSTick.h"
+
+ClassImp(AliPHOSTick)
+
+
+//____________________________________________________________________________
+ AliPHOSTick::AliPHOSTick():TObject()
+{
+ fTime = 0;
+ fA = 0;
+ fB = 0 ;
+}
+
+//____________________________________________________________________________
+AliPHOSTick::AliPHOSTick(Float_t time, Float_t a, Float_t slope):TObject()
+{
+ fTime = time;
+ fA = a;
+ fB = slope ;
+}
+//____________________________________________________________________________
+Int_t AliPHOSTick::Compare(const TObject * obj) const {
+ if(obj->InheritsFrom("AliPHOSTick")){
+ AliPHOSTick * tick = (AliPHOSTick *) obj ;
+ if(fTime < tick->fTime)
+ return -1 ;
+ else
+ if(fTime == tick->fTime)
+ return 0 ;
+ else
+ return 1 ;
+ }
+ else
+ return 1 ;
+}
+//____________________________________________________________________________
+void AliPHOSTick::operator+=(AliPHOSTick const & tick)
+{
+ // Adds the amplitude of digits and completes the list of primary particles
+ // if amplitude is larger than
+
+ fA = fA + fB*(tick.fTime - fTime) + tick.fA ;
+ fB = fB + tick.fB ;
+ if(tick.fTime > fTime)
+ fTime = tick.fTime ;
+
+}
--- /dev/null
+#ifndef ALIPHOSTICK_H
+#define ALIPHOSTICK_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+/* $Id$ */
+
+//_________________________________________________________________________
+// Class for PHOS time digitization
+//
+//*-- Author: Dmitri Peressounko (SUBATECH)
+
+
+// --- ROOT system ---
+#include "TObject.h"
+// --- Standard library ---
+
+// --- AliRoot header files ---
+
+class AliPHOSTick: public TObject {
+
+public:
+ AliPHOSTick() ;
+ AliPHOSTick(Float_t time, Float_t a, Float_t slope) ;
+ virtual ~AliPHOSTick(){}
+
+ Int_t Compare(const TObject * obj) const ;
+ Bool_t IsSortable() const { return kTRUE ; }
+
+ Float_t CrossingTime(Float_t threshold) const
+ //Calculates time, when rizing front of the signal crosses
+ {if(fB) return fTime + (threshold - fA)/fB ;
+ else return 1. ;} //return very big time
+
+ Float_t GetTime(void){return fTime ;}
+
+ void operator+=(AliPHOSTick const &rValue) ;
+
+
+private:
+ Float_t fTime ; //!time of the beginning of this tick
+ Float_t fA ; //!constant
+ Float_t fB ; //!slope
+
+ ClassDef(AliPHOSTick,1) // description
+
+};
+
+#endif // AliPHOSTICK_H
SRCS = AliPHOS.cxx AliPHOSv0.cxx AliPHOSv1.cxx \
AliPHOSvFast.cxx AliPHOSvImpacts.cxx \
AliPHOSImpact.cxx \
- AliPHOSHit.cxx \
+ AliPHOSHit.cxx AliPHOSTick.cxx\
AliPHOSGeometry.cxx \
AliPHOSEMCAGeometry.cxx \
AliPHOSCPVGeometry.cxx AliPHOSCPVBaseGeometry.cxx \
AliPHOSTrackSegmentMaker.cxx AliPHOSTrackSegmentMakerv1.cxx \
AliPHOSRecParticle.cxx AliPHOSPID.cxx AliPHOSPIDv1.cxx \
AliPHOSAnalyze.cxx AliPHOSFastRecParticle.cxx \
- AliPHOSGetter.cxx \
- AliPHOSQAVirtualCheckable.cxx AliPHOSQAIntCheckable.cxx AliPHOSQAFloatCheckable.cxx\
+ AliPHOSGetter.cxx AliPHOSTick.cxx \
+ AliPHOSQAVirtualCheckable.cxx AliPHOSQAIntCheckable.cxx \
+ AliPHOSQAFloatCheckable.cxx\
AliPHOSQAObjectCheckable.cxx AliPHOSQAChecker.cxx AliPHOSQAMeanChecker.cxx AliPHOSQAAlarm.cxx
# C++ Headers
#pragma link C++ class AliPHOSQAChecker+;
#pragma link C++ class AliPHOSQAMeanChecker+;
#pragma link C++ class AliPHOSQAAlarm+;
+#pragma link C++ class AliPHOSTick+;
#endif