With this commit the VZERO trigger simulation is recovered. 1. The main change in...
authorcvetan <cvetan@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 4 Jun 2010 14:50:41 +0000 (14:50 +0000)
committercvetan <cvetan@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 4 Jun 2010 14:50:41 +0000 (14:50 +0000)
OCDB/VZERO/Trigger/Data/Run0_999999999_v0_s0.root
VZERO/AliVZEROCalibData.cxx
VZERO/AliVZEROCalibData.h
VZERO/AliVZEROConst.h
VZERO/AliVZERODigitizer.cxx
VZERO/AliVZEROLogicalSignal.cxx
VZERO/AliVZEROTrigger.cxx
VZERO/AliVZEROTriggerSimulator.cxx
VZERO/MakeVZEROTriggerEntry.C [new file with mode: 0644]

index aaa0956..8a5e15e 100644 (file)
Binary files a/OCDB/VZERO/Trigger/Data/Run0_999999999_v0_s0.root and b/OCDB/VZERO/Trigger/Data/Run0_999999999_v0_s0.root differ
index 5499a41..053dd15 100644 (file)
@@ -612,3 +612,13 @@ Int_t AliVZEROCalibData::GetBoardNumber(Int_t channel)
   AliErrorClass(Form("Wrong channel index: %d",channel));
   return -1;
 }
+
+Int_t AliVZEROCalibData::GetFEEChannelNumber(Int_t channel)
+{
+  // Get FEE channel number
+  // from offline channel index
+  if (channel >= 0 && channel < 64) return (7 - (channel % 8));
+
+  AliErrorClass(Form("Wrong channel index: %d",channel));
+  return -1;
+}
index cfa209a..ab3b2fa 100644 (file)
@@ -108,6 +108,7 @@ class AliVZEROCalibData: public TNamed {
 
   static Int_t GetOfflineChannelNumber(Int_t board, Int_t channel);
   static Int_t GetBoardNumber(Int_t channel);
+  static Int_t GetFEEChannelNumber(Int_t channel);
 
  protected:
   Float_t  fPedestal[128];     // Mean pedestal values
index f706ffc..9f2fd90 100644 (file)
@@ -6,7 +6,7 @@
 const Float_t kIntTimeRes = 0.39; // intrinsic time resolution of the scintillator
 const Float_t kV0CDelayCables = 8.1; // delay cables on the C side (in ns)
 const Float_t kV0Offset = 1461.4; // general V0 offset between the TDCs and the trigger
-const Float_t kADCTimeOffset = -189.0; // ADC sampling clock offset (in ns)
+const Float_t kClockOffset = 62.0; // Sampling clock offset (in ns)
 const Int_t   kNClocks = 21; // Number of ADC clocks that are read out
 const Float_t kChargePerADC = 0.6e-12; // Charge per ADC
 const Int_t   kMinTDCWidth = 13; // minimum signal width measured by TDC
index d9801c7..227abe1 100644 (file)
@@ -322,8 +322,8 @@ void AliVZERODigitizer::Exec(Option_t* /*option*/)
           Int_t nPhE;
           Float_t prob = lightYieldCorr[pmt]*fPhotoCathodeEfficiency; // Optical losses included!
           if (nPhot > 100)
-            nPhE =gRandom->Gaus(prob*Float_t(nPhot)+0.5,
-                                sqrt(Float_t(nPhot)*prob*(1.-prob)));
+            nPhE = (Int_t)gRandom->Gaus(prob*Float_t(nPhot)+0.5,
+                                        sqrt(Float_t(nPhot)*prob*(1.-prob)));
           else
             nPhE = gRandom->Binomial(nPhot,prob);
           Float_t charge = TMath::Qe()*fPmGain[pmt]*fBinSize[pmt]/integral;
@@ -363,8 +363,8 @@ void AliVZERODigitizer::Exec(Option_t* /*option*/)
          }
        }
       }
-      Float_t tadc = t - kADCTimeOffset;
-      Int_t clock = kNClocks - Int_t(tadc/25.0) - 1;
+      Float_t tadc = t - kClockOffset - fCalibData->GetTimeOffset(ipmt);
+      Int_t clock = kNClocks/2 - Int_t(tadc/25.0);
       if (clock >= 0 && clock < kNClocks)
        fAdc[ipmt][clock] += fTime[ipmt][iBin]/kChargePerADC;
     }
index a854356..60dc489 100644 (file)
@@ -60,8 +60,8 @@ AliVZEROLogicalSignal::AliVZEROLogicalSignal(UShort_t profilClock, UInt_t delay)
        }\r
        if(!down) fStop = 25.;\r
        \r
-       fStart += delay*10.e-3; // Add 10 ps par register unit\r
-       fStop  += delay*10.e-3; \r
+       fStart += delay*10.e-2; // Add 10 ps par register unit\r
+       fStop  += delay*10.e-2; \r
 }\r
 //_____________________________________________________________________________\r
 AliVZEROLogicalSignal::AliVZEROLogicalSignal(const AliVZEROLogicalSignal &signal) : \r
index c06b1f8..8f6041b 100644 (file)
@@ -83,7 +83,7 @@ void AliVZEROTrigger::Trigger()
                AliError("Can not get VZERO loader");
                return;
        }
-       loader->LoadDigits("READ");
+       loader->LoadDigits("update");
        TTree* vzeroDigitsTree = loader->TreeD();
 
        if (!vzeroDigitsTree) {
@@ -96,8 +96,12 @@ void AliVZEROTrigger::Trigger()
 
        AliVZEROTriggerSimulator * triggerSimulator = new AliVZEROTriggerSimulator(vzeroDigitsTree,vzeroDigits);
        
+
        triggerSimulator->Run();
        
+       loader->WriteDigits("OVERWRITE");  
+       loader->UnloadDigits();     
+
        if(triggerSimulator->GetBBAandBBC())    SetInput( "VZERO_BBA_AND_BBC" );
        if(triggerSimulator->GetBBAorBBC())             SetInput( "VZERO_BBA_OR_BBC" );
        if(triggerSimulator->GetBGAandBBC())    SetInput( "VZERO_BGA_AND_BBC" );
index 878727f..3f0880b 100644 (file)
@@ -22,6 +22,7 @@
 \r
 #include <TTree.h>\r
 #include <TClonesArray.h>\r
+#include <TParameter.h>\r
 \r
 #include "AliLog.h"\r
 #include "AliCDBManager.h"\r
@@ -32,6 +33,8 @@
 #include "AliVZEROLogicalSignal.h"\r
 #include "AliVZEROTriggerSimulator.h"\r
 #include "AliVZEROdigit.h"\r
+#include "AliVZEROCalibData.h"\r
+#include "AliVZEROConst.h"\r
 \r
 ClassImp(AliVZEROTriggerSimulator)\r
 \r
@@ -153,11 +156,11 @@ void AliVZEROTriggerSimulator::Run() {
                        \r
                        Int_t integrator = digit->Integrator();\r
                        Int_t pmNumber   = digit->PMNumber();\r
-                       Int_t board   = pmNumber / 8;\r
-                       Int_t channel = pmNumber % 8;\r
+                       Int_t board   = AliVZEROCalibData::GetBoardNumber(pmNumber);\r
+                       Int_t channel = AliVZEROCalibData::GetFEEChannelNumber(pmNumber);\r
                        \r
                        if(fTriggerData->GetEnableCharge(board,channel)) {\r
-                               fCharges[pmNumber] = digit->ADC();\r
+                               fCharges[pmNumber] = digit->ChargeADC(AliVZEROdigit::kNClocks/2);\r
                                if(fTriggerData->GetPedestalSubtraction(board)) {\r
                                        if(fCharges[pmNumber]>=(Float_t) fTriggerData->GetPedestalCut(integrator,board,channel)){ \r
                                                fCharges[pmNumber] -= (Float_t) fTriggerData->GetPedestal(integrator,board,channel);\r
@@ -169,10 +172,17 @@ void AliVZEROTriggerSimulator::Run() {
                                fCharges[pmNumber] = 0.;\r
                        }\r
                        \r
-                       Float_t time = digit->Time(); \r
-                       time += fTriggerData->GetDelayHit(board,channel);\r
-                       \r
-                       //AliInfo(Form(" PM nb : %d ; ADC= %d ; TDC= %f  Enable Time %d charge %d",pmNumber,digit->ADC(),time,fTriggerData->GetEnableTiming(board,channel),fTriggerData->GetEnableCharge(board,channel)));\r
+                       Float_t time = digit->Time();\r
+                       time -= kClockOffset;\r
+\r
+                       AliDebug(10,Form(" Digit: %f %d %d %d %d %d %d %d %d",digit->Time(),\r
+                                        digit->ChargeADC(8),digit->ChargeADC(9),digit->ChargeADC(10),\r
+                                        digit->ChargeADC(11),digit->ChargeADC(12),digit->ChargeADC(13),\r
+                                        digit->ChargeADC(14),digit->ChargeADC(15)));\r
+                       AliDebug(10,Form(" PM nb : %d ; ADC= %f ; TDC= %f(%f)  Enable Time %d charge %d inCoin %d charge %f",\r
+                                        pmNumber,digit->ADC(),time,digit->Time(),\r
+                                        fTriggerData->GetEnableTiming(board,channel),fTriggerData->GetEnableCharge(board,channel),\r
+                                        fBBGate[board]->IsInCoincidence(time),fCharges[pmNumber]));\r
                        fBBFlags[pmNumber] = fTriggerData->GetEnableTiming(board,channel) && fBBGate[board]->IsInCoincidence(time);\r
                        fBGFlags[pmNumber] = fTriggerData->GetEnableTiming(board,channel) && fBGGate[board]->IsInCoincidence(time);\r
                        \r
@@ -185,19 +195,33 @@ void AliVZEROTriggerSimulator::Run() {
        Int_t nBGflagsV0C = 0;\r
        Float_t chargeV0A   = 0.;\r
        Float_t chargeV0C   = 0.;\r
+       Int_t aBBflagsV0A = 0;\r
+       Int_t aBBflagsV0C = 0;\r
+       Int_t aBGflagsV0A = 0;\r
+       Int_t aBGflagsV0C = 0;\r
 \r
        for(int i=0;i<64;i++) {\r
                if(i<32) {\r
                        nBBflagsV0C += fBBFlags[i]; \r
                        nBGflagsV0C += fBGFlags[i];\r
                        chargeV0C += fCharges[i];\r
+                       if (fBBFlags[i]) aBBflagsV0C |= (1 << i);\r
+                       if (fBGFlags[i]) aBGflagsV0C |= (1 << i);\r
                } else {\r
                        nBBflagsV0A += fBBFlags[i]; \r
                        nBGflagsV0A += fBGFlags[i];\r
                        chargeV0A += fCharges[i];\r
+                       if (fBBFlags[i]) aBBflagsV0A |= (1 << (i-32));\r
+                       if (fBGFlags[i]) aBGflagsV0A |= (1 << (i-32));\r
                }\r
                //AliInfo(Form("Ch %d BB=%d BG=%d",i,fBBFlags[i],fBGFlags[i] )); \r
        }\r
+\r
+       // Store the BB and BG flags in the digits tree (user info)\r
+       fDigitsTree->GetUserInfo()->Add(new TParameter<int>("BBflagsV0A",aBBflagsV0A));\r
+       fDigitsTree->GetUserInfo()->Add(new TParameter<int>("BBflagsV0C",aBBflagsV0C));\r
+       fDigitsTree->GetUserInfo()->Add(new TParameter<int>("BGflagsV0A",aBGflagsV0A));\r
+       fDigitsTree->GetUserInfo()->Add(new TParameter<int>("BGflagsV0C",aBGflagsV0C));\r
        \r
        // BBA\r
        if(nBBflagsV0A>=fTriggerData->GetBBAThreshold())  SetBBA();\r
diff --git a/VZERO/MakeVZEROTriggerEntry.C b/VZERO/MakeVZEROTriggerEntry.C
new file mode 100644 (file)
index 0000000..ba15c6a
--- /dev/null
@@ -0,0 +1,24 @@
+void MakeVZEROTriggerEntry(Int_t run,const char *inputCDB = "raw://"){
+
+  AliCDBManager *man = AliCDBManager::Instance();
+
+  man->SetDefaultStorage(inputCDB);
+  man->SetRun(run);
+
+  AliCDBEntry *entry = man->Get("VZERO/Trigger/Data");
+  AliVZEROTriggerData *trigdata = (AliVZEROTriggerData*)entry->GetObject();
+  entry->SetObject(NULL);
+  entry->SetOwner(kTRUE);
+
+  AliCDBMetaData *md= new AliCDBMetaData(); // metaData describing the object
+  md->SetResponsible("Brigitte Cheynis");
+  md->SetBeamPeriod(0);
+  md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
+  md->SetComment("VZERO Trigger Conditions Data from RAW OCDB");
+  AliCDBId id("VZERO/Trigger/Data",0,AliCDBRunRange::Infinity());
+
+  man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
+  AliCDBStorage *storLoc = man->GetDefaultStorage();
+  storLoc->Put(trigdata, id, md);
+
+}