]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONRawWriter.cxx
macro and flowevent maker to run part of the code in root
[u/mrichter/AliRoot.git] / MUON / AliMUONRawWriter.cxx
index 532b63b0b8cf0cae6b0f9d8d79968f88758d6b4c..12cbfa46e180ff26887647de178663cbe1e9c0bd 100644 (file)
@@ -164,7 +164,7 @@ Int_t AliMUONRawWriter::Digits2Raw(AliMUONVDigitStore* digitStore,
   {
     AliCodeTimerAuto("for Tracker")
 
-    AliMpExMap busPatchMap(true);
+    AliMpExMap busPatchMap;
 
     Int_t nDDLs = AliDAQ::NumberOfDdls("MUONTRK");
     
@@ -235,8 +235,11 @@ AliMUONRawWriter::Digits2BusPatchMap(const AliMUONVDigitStore& digitStore,
   UChar_t channelId = 0;
   UShort_t charge = 0;
   Int_t busPatchId = 0;
+  Int_t currentBusPatchId = -1;
   UInt_t word;
   
+  AliMUONBusStruct* busStruct(0x0);
+  
   TIter next(digitStore.CreateTrackerIterator());
   AliMUONVDigit* digit;
   
@@ -281,9 +284,13 @@ AliMUONRawWriter::Digits2BusPatchMap(const AliMUONVDigitStore& digitStore,
       parity ^=  ((word >> i) & 0x1);
     }
     AliBitPacking::PackWord((UInt_t)parity,word,31,31);
-    
-    AliMUONBusStruct* busStruct = 
-      static_cast<AliMUONBusStruct*>(busPatchMap.GetValue(busPatchId));
+
+    if ( currentBusPatchId != busPatchId ) 
+    {
+      busStruct = 
+        static_cast<AliMUONBusStruct*>(busPatchMap.GetValue(busPatchId));
+      currentBusPatchId = busPatchId;
+    }
     
     if (!busStruct)
     {
@@ -463,6 +470,7 @@ Int_t AliMUONRawWriter::WriteTriggerDDL(const AliMUONVTriggerStore& triggerStore
   }
   
   Int_t gloTrigResp = gloTrg->GetGlobalResponse();
+  UInt_t *gloTrigInput = gloTrg->GetGlobalInput();
 
   UInt_t word;
   Int_t* buffer = 0;
@@ -532,10 +540,14 @@ Int_t AliMUONRawWriter::WriteTriggerDDL(const AliMUONVTriggerStore& triggerStore
     index += kDarcHeaderLength;
 
     // no global input for the moment....
-    if (iDDL == 0)
-     fDarcHeader->SetGlobalOutput(gloTrigResp);
-    else 
-     fDarcHeader->SetGlobalOutput(0);
+    if (iDDL == 0) {
+      fDarcHeader->SetGlobalOutput(gloTrigResp);
+      for (Int_t ii = 0; ii < 4; ii++) {
+       fDarcHeader->SetGlobalInput(gloTrigInput[ii],ii);
+      }
+    } else {
+      fDarcHeader->SetGlobalOutput(0);
+    }
 
     if (fScalerEvent) {
       // 6 DARC scaler words
@@ -587,9 +599,9 @@ Int_t AliMUONRawWriter::WriteTriggerDDL(const AliMUONVTriggerStore& triggerStore
       // fill darc word, not darc status for the moment (empty)
       //see  AliMUONRegHeader.h for details
       AliBitPacking::PackWord((UInt_t)eventPhys,word,31,31); 
-      AliBitPacking::PackWord((UInt_t)serialNb,word,19,24); 
-      AliBitPacking::PackWord((UInt_t)version,word,7,14);
-      AliBitPacking::PackWord((UInt_t)iReg,word,15,18);
+      AliBitPacking::PackWord((UInt_t)serialNb,word,20,25); 
+      AliBitPacking::PackWord((UInt_t)version,word,8,15);
+      AliBitPacking::PackWord((UInt_t)crate->GetId(),word,16,19);
       AliBitPacking::PackWord((UInt_t)regOut,word,0,7); 
       fRegHeader->SetWord(word);