]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TOF/AliTOFTrigger.cxx
CreateCTTMMatrix call: moved from CreateLTMMatrixFromDigits to CreateLTMMatrix (F...
[u/mrichter/AliRoot.git] / TOF / AliTOFTrigger.cxx
index df5e183798ee883f69add41a417290c077b55514..30137d4de7510306c948ec856ca2cbf364d0e6e0 100644 (file)
@@ -33,6 +33,7 @@
 
 #include <TClonesArray.h>
 #include <TTree.h>
+#include <TMath.h>
 
 #include "AliLoader.h"
 #include "AliLog.h"
@@ -54,6 +55,8 @@
 
 extern AliRun* gAlice;
 
+AliTOFGeometry* AliTOFTrigger::fgTofGeo = NULL; // TOF geometry needed to get the minimial arrival time for each channel
+
 //-------------------------------------------------------------------------
 ClassImp(AliTOFTrigger)
 
@@ -76,7 +79,10 @@ ClassImp(AliTOFTrigger)
     fNCrateOn(0),
     fNMaxipadOn(0),
     fNMaxipadOnAll(0),
-    fTOFTrigMask(0)
+    fTOFTrigMask(0),
+    fStartTimeHit(0.0),
+    fTimeWidthTrigger(25.0)
+
 {
   //main ctor
   for (Int_t i=0;i<kNCTTM;i++) fLTMarray[i] = kFALSE;
@@ -106,7 +112,7 @@ ClassImp(AliTOFTrigger)
 
 //----------------------------------------------------------------------
 
-AliTOFTrigger::AliTOFTrigger(Int_t HighMultTh, Int_t ppMBTh, Int_t MultiMuonTh, Int_t UPTh, Float_t deltaminpsi, Float_t deltamaxpsi, Float_t deltaminro, Float_t deltamaxro, Int_t stripWindow) :
+AliTOFTrigger::AliTOFTrigger(Int_t HighMultTh, Int_t ppMBTh, Int_t MultiMuonTh, Int_t UPTh, Float_t deltaminpsi, Float_t deltamaxpsi, Float_t deltaminro, Float_t deltamaxro, Int_t stripWindow,Float_t startTimeWindow,Float_t widthTimeWindow) :
   AliTriggerDetector(),
   fHighMultTh(HighMultTh),
   fppMBTh(ppMBTh),
@@ -124,7 +130,9 @@ AliTOFTrigger::AliTOFTrigger(Int_t HighMultTh, Int_t ppMBTh, Int_t MultiMuonTh,
   fNCrateOn(0),
   fNMaxipadOn(0),
   fNMaxipadOnAll(0),
-  fTOFTrigMask(0)
+  fTOFTrigMask(0),
+  fStartTimeHit(startTimeWindow),
+  fTimeWidthTrigger(widthTimeWindow)
 {
   //ctor with thresholds for triggers
   for (Int_t i=0;i<kNCTTM;i++) fLTMarray[i] = kFALSE;
@@ -212,13 +220,14 @@ void AliTOFTrigger::CreateInputs()
   // Do not create inputs again!!
   if( fInputs.GetEntriesFast() > 0 ) return;
 
-  LoadActiveMask();
+  //LoadActiveMask();
 
   fInputs.AddLast(new AliTriggerInput("TOF_Cosmic_MultiMuon_L0","TOF",0));
   fInputs.AddLast(new AliTriggerInput("0OIN","TOF",0)); // was "TOF_pp_MB_L0"
   fInputs.AddLast(new AliTriggerInput("0OM2","TOF",0)); // was "TOF_PbPb_MB2_L0"
   fInputs.AddLast(new AliTriggerInput("0OM3","TOF",0)); // was "TOF_PbPb_MB3_L0"
   fInputs.AddLast(new AliTriggerInput("0OUP","TOF",0)); // was "TOF_UltraPer_Coll_L0"
+  fInputs.AddLast(new AliTriggerInput("0OMU","TOF",0)); // new trigger (150 < DeltaPhi < 180) and 2 <= N_pad <= 6
 
   fInputs.AddLast(new AliTriggerInput("0OHM","TOF",0)); // was "TOF_High_Mult_L0"
   fInputs.AddLast(new AliTriggerInput("TOF_Jet_L1","TOF",0));
@@ -234,6 +243,7 @@ void AliTOFTrigger::Trigger() {
   fSel4=0;
 
   CreateLTMMatrix();
+
   Int_t nchonFront = 0;
   Int_t nchonBack = 0;
   Int_t nchonTot = 0;
@@ -422,8 +432,15 @@ void AliTOFTrigger::Trigger() {
                          //printf("trigger On with AntiDeSlot \n");
                      } 
                      
-                 } 
-                 
+                     if(nchonTot >= 2 && nchonTot <= 6){
+                       if(DeSlots >= 15 && DeSlots <= 18){
+                         SetInput("0OMU");
+                       }
+                       else if(AntiDeSlots >= 15 && AntiDeSlots <= 18){
+                         SetInput("0OMU");
+                       }       
+                     }               
+                 }
              }    
          }
       }
@@ -435,6 +452,7 @@ void AliTOFTrigger::CreateLTMMatrix() {
   //creating LTMMatrix
   //initialization
   CreateLTMMatrixFromDigits();
+  CreateCTTMMatrix();
 }
 
 //-------------------------------------------------------------------------
@@ -489,6 +507,9 @@ void AliTOFTrigger::CreateLTMMatrixFromDigits() {
   //                                   3 -> padz
   //                                   4 -> padx
 
+  if(! fgTofGeo) fgTofGeo = new AliTOFGeometry();
+
+
   for (Int_t i=0;i<ndigits;i++){
     AliTOFdigit * digit = (AliTOFdigit*)tofDigits->UncheckedAt(i);
     detind[0] = digit->GetSector();
@@ -500,14 +521,25 @@ void AliTOFTrigger::CreateLTMMatrixFromDigits() {
     Int_t indexLTM[2] = {-1,-1};
     GetLTMIndex(detind,indexLTM);
 
-    fLTMmatrix[indexLTM[0]][indexLTM[1]] = kTRUE;
+    //Float_t timedigit = digit->GetTdc()*AliTOFGeometry::TdcBinWidth()*1E-3; // decalibrated time digit in ns
+    Float_t timedigit = digit->GetTdcND()*AliTOFGeometry::TdcBinWidth()*1E-3; // time digit in ns
+
+    Float_t pos[3];
+    fgTofGeo->GetPosPar(detind, pos);
+    Float_t length = 0.;
+    for (Int_t ic = 0; ic < 3; ic++) length += pos[ic] * pos[ic];
+    length = TMath::Sqrt(length);
+    timedigit -= length * 0.0333564095198152043; // subtract the minimal time in ns for the current channel
+
+    if(timedigit > fStartTimeHit - 0.5 && timedigit < fStartTimeHit + fTimeWidthTrigger - 0.5)
+      fLTMmatrix[indexLTM[0]][indexLTM[1]] = kTRUE;
+
 //    fLTMarray[indexLTM[0]%36] = kTRUE; //dimensione MAX array 36 = kNCTTM 
-    }
+  }
 
 
   tofLoader->UnloadDigits();
   //   rl->UnloadgAlice();
-  CreateCTTMMatrix();
 
 }
 
@@ -953,6 +985,9 @@ void AliTOFTrigger::CreateCTTMMatrix() {
   //
   // Create CTTM bit map
   //
+
+  LoadActiveMask();
+
     Int_t fromTriggertoDCS[72] = {0,1,4,5,8,9,12,13,16,17,20,21,24,25,28,29,32,33,36,37,40,41,44,45,48,49,52,53,56,57,60,61,64,65,68,69,3,
                                  2,7,6,11,10,15,14,19,18,23,22,27,26,31,30,35,34,39,38,43,42,47,46,51,50,55,54,59,58,63,62,67,66,71,70};