]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/MUONDateStreamTrigger.C
Adding calibration library and updating the loadlib*.C macros (Laurent)
[u/mrichter/AliRoot.git] / MUON / MUONDateStreamTrigger.C
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 //
17 // Macro for reading tracker raw data
18 // Ch. Finck, Subatech Febuary
19 //
20
21 #if !defined(__CINT__) || defined(__MAKECINT__)
22
23 // RAW includes
24 #include "AliRawReaderDate.h"
25
26 // MUON includes
27 #include "AliMUONRawStreamTrigger.h"
28 #include "AliMUONDarcHeader.h"
29 #include "AliMUONRegHeader.h"
30 #include "AliMUONLocalStruct.h"
31 #include "AliMUONDDLTrigger.h"
32
33 #endif
34
35 // Macro to read rawdata Date File for trigger
36 // Ch. Finck, Subatech, June. 2006
37 //
38 // This macro is interface with AliRawReader and DATE for RAW
39 // The different stucture of the patload are readout and stored in TClonesArray
40 // with AliMUONRawStreamTrigger classe.
41 // The decoding of the payload is done by AliMUONPayLoadTrigger class
42 // The macro just simpy read again the TClonesArray contents.
43 // The parameter of each structure could be seen in the container classes
44 // AliMUONDarcHeader, AliMUONRegHeader, AliMUONLocalStruct.
45 // The class AliMUONDDLTrigger manages the structure containers.
46 // The number of structures in the rawdata file could be set.
47
48 void MUONDateStreamTrigger(Int_t maxEvent = 1000, Int_t minDDL = 0, Int_t maxDDL = 1, TString fileName = "raw.root.date", Int_t eventType = 7 )
49 {
50   // eventType = 7 for DATE file generated from AliRoot
51   // eventType = 0 for DATE file from Nantes test bench
52    AliRawReader* rawReader = new AliRawReaderDate(fileName,eventType);// DATE file
53    
54
55    // raw stream
56    AliMUONRawStreamTrigger* rawStream   = new AliMUONRawStreamTrigger(rawReader);
57
58    // set the number of DDL reg & local that are PRESENT in the rawdata file
59    // it's NOT the number to be read.
60    // default wise set to 2, 8, 16 respectively for AliRoot
61    // else see below
62    rawStream->SetMaxDDL(1);
63    rawStream->SetMaxReg(1);
64    rawStream->SetMaxLoc(16);
65
66    // containers
67    AliMUONDDLTrigger*       ddlTrigger  = 0x0;
68    AliMUONDarcHeader*       darcHeader  = 0x0;
69    AliMUONRegHeader*        regHeader   = 0x0;
70    AliMUONLocalStruct*      localStruct = 0x0;
71
72    // Loop over events  
73    Int_t iEvent = 0;
74
75    do {
76
77      if (iEvent == maxEvent)
78        break;
79
80      printf("Event %d\n",iEvent++);
81
82      // read DDL while < 2 DDL
83      while(rawStream->NextDDL()) {
84
85       if (rawStream->GetDDL() < minDDL || rawStream->GetDDL() > maxDDL)
86          continue;
87
88        printf("\niDDL %d\n", rawStream->GetDDL());
89
90        ddlTrigger = rawStream->GetDDLTrigger();
91        darcHeader = ddlTrigger->GetDarcHeader();
92
93        printf("Global output %x\n", (Int_t)darcHeader->GetGlobalOutput());
94
95        // loop over regional structures
96        Int_t nReg = darcHeader->GetRegHeaderEntries();
97        for(Int_t iReg = 0; iReg < nReg ;iReg++){   //REG loop
98
99          printf("RegionalId %d\n", iReg);
100
101          regHeader =  darcHeader->GetRegHeaderEntry(iReg);
102 //       printf("Serial number %d\n",regHeader->GetSerialNb());
103
104          // loop over local structures
105          Int_t nLocal = regHeader->GetLocalEntries();
106          for(Int_t iLocal = 0; iLocal < nLocal; iLocal++) {  
107
108            localStruct = regHeader->GetLocalEntry(iLocal);
109
110            // check if trigger 
111            //      if (localStruct->GetTriggerY() == 0) { // no empty data
112
113              printf("LocalId %d\n", localStruct->GetId());
114
115              Int_t loId      = (Int_t)localStruct->GetId();
116              Int_t loDec     = (Int_t)localStruct->GetDec();
117              Int_t loStripX  = (Int_t)localStruct->GetXPos();
118              Int_t loStripY  = (Int_t)localStruct->GetYPos();
119              Int_t loDev     = (Int_t)localStruct->GetXDev();
120             
121              printf("Id: %d, Dec: %d\n", loId, loDec);
122              printf("XPos: %d, YPos: %d Dev: %d\n", loStripX, loStripY, loDev);
123              //}
124          } // iLocal
125        } // iReg
126      } // NextDDL
127    }   while (rawReader->NextEvent());
128
129    delete rawReader;
130    delete rawStream;
131 }