]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Method to account crossing thresold by time signal added
authorschutz <schutz@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 26 Sep 2001 17:16:28 +0000 (17:16 +0000)
committerschutz <schutz@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 26 Sep 2001 17:16:28 +0000 (17:16 +0000)
PHOS/AliPHOSDigitizer.cxx
PHOS/AliPHOSDigitizer.h
PHOS/AliPHOSTick.cxx [new file with mode: 0644]
PHOS/AliPHOSTick.h [new file with mode: 0644]
PHOS/Makefile
PHOS/PHOSLinkDef.h

index 52bdc743eb5287b4a25cefccc103c0f88688eaf7..8dfe5eaee2b221249c54fbcbaad3eb195be07930 100644 (file)
@@ -76,6 +76,7 @@
 #include "AliPHOSDigitizer.h"
 #include "AliPHOSSDigitizer.h"
 #include "AliPHOSGeometry.h"
+#include "AliPHOSTick.h"
 
 ClassImp(AliPHOSDigitizer)
 
@@ -90,9 +91,11 @@ 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
 }
 
@@ -109,6 +112,8 @@ AliPHOSDigitizer::AliPHOSDigitizer(const char *headerFile,const char * name)
   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() ;
@@ -208,15 +213,15 @@ void AliPHOSDigitizer::Digitize(const Int_t event)
     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) ; 
@@ -225,9 +230,16 @@ void AliPHOSDigitizer::Digitize(const Int_t event)
     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]) ;   
@@ -240,22 +252,25 @@ void AliPHOSDigitizer::Digitize(const Int_t event)
          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() ;
@@ -264,6 +279,8 @@ void AliPHOSDigitizer::Digitize(const Int_t event)
     }
   }
   
+  ticks->Delete() ;
+  delete ticks ;
 
 
   //Now CPV digits (different noise and no timing)
@@ -302,8 +319,6 @@ void AliPHOSDigitizer::Digitize(const Int_t event)
       
     }
   }
-  delete energies ;
-  delete times ;
   delete sdigArray ; //We should not delete its contents
   
   
@@ -430,17 +445,23 @@ void AliPHOSDigitizer::Exec(Option_t *option)
 }
 
 //____________________________________________________________________________ 
-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()
index 6cbdacb729b680293f3b7ad926197b61a3677663..68eb24954c7ad43f1a53ac146b55a735a4023f74 100644 (file)
@@ -69,7 +69,7 @@ private:
   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:
diff --git a/PHOS/AliPHOSTick.cxx b/PHOS/AliPHOSTick.cxx
new file mode 100644 (file)
index 0000000..fe36a2c
--- /dev/null
@@ -0,0 +1,76 @@
+/**************************************************************************
+ * 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 ;
+  
+}
diff --git a/PHOS/AliPHOSTick.h b/PHOS/AliPHOSTick.h
new file mode 100644 (file)
index 0000000..bc77111
--- /dev/null
@@ -0,0 +1,49 @@
+#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
index 817fa9648dcfa73fc82582b17aa7377080fcd087..05932686ed45c2cbeaf3412b077415157e2bf1ed 100644 (file)
@@ -12,7 +12,7 @@ PACKAGE = PHOS
 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 \
@@ -26,8 +26,9 @@ SRCS          =  AliPHOS.cxx AliPHOSv0.cxx AliPHOSv1.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
index f502fe504fcf0779ad40bc318aa764c1d4f719fe..459f79f55bf044adb6e43781e9b0b6e45ed9706e 100644 (file)
@@ -43,4 +43,5 @@
 #pragma link C++ class AliPHOSQAChecker+;
 #pragma link C++ class AliPHOSQAMeanChecker+;
 #pragma link C++ class AliPHOSQAAlarm+;
+#pragma link C++ class AliPHOSTick+;
 #endif