]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/MUONRawStreamTrigger.C
- Reshape the architecture of the Kalman tracking to make it more modular
[u/mrichter/AliRoot.git] / MUON / MUONRawStreamTrigger.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 #include "AliRawReaderFile.h"
26 #include "AliRawReaderRoot.h"
27
28 // MUON includes
29 #include "AliMUONRawStreamTrigger.h"
30 #include "AliMUONDarcHeader.h"
31 #include "AliMUONRegHeader.h"
32 #include "AliMUONLocalStruct.h"
33 #include "AliMUONDDLTrigger.h"
34 #include "AliMpTriggerCrate.h"
35 #include "AliMpDDLStore.h"
36 #endif
37
38 // Macro to read rawdata for trigger
39 // Ch. Finck, Subatech, April. 2006
40 //
41 // This macro is interface with AliRawReader for RAW
42 // The different stucture of the patload are readout and stored in TClonesArray
43 // with AliMUONRawStreamTrigger classe.
44 // The macro just simpy read again the TClonesArray contents.
45 // The parameter of each structure could be seen in the container classes
46 // AliMUONDarcHeader, AliMUONRegHeader, AliMUONLocalStruct.
47 // The class AliMUONDDLTrigger manages the structure containers.
48 // The number of structures in the rawdata file could be set.
49
50 void MUONRawStreamTrigger(Int_t maxEvent = 1, Int_t minDDL = 0, Int_t maxDDL = 1, TString fileName = "./")
51 {
52    AliRawReader* rawReader = 0x0;
53
54    if (fileName.EndsWith("/")) {
55      rawReader = new AliRawReaderFile(fileName);// DDL files
56    } else if (fileName.EndsWith(".root")) {
57      rawReader = new AliRawReaderRoot(fileName);
58    } else if (!fileName.IsNull()) {
59      rawReader = new AliRawReaderDate(fileName);// DATE file
60    }
61
62    // raw stream
63    AliMUONRawStreamTrigger* rawStream   = new AliMUONRawStreamTrigger(rawReader);
64
65    // set the number of DDL reg & local that are PRESENT in the rawdata file
66    // it's NOT the number to be read.
67    // default wise set to 2, 8, 16 respectively.
68    //    rawStream->SetMaxDDL(xx);
69    rawStream->SetMaxReg(2);
70    //    rawStream->SetMaxLoc(xx);
71
72    // containers
73    AliMUONDDLTrigger*       ddlTrigger  = 0x0;
74    AliMUONDarcHeader*       darcHeader  = 0x0;
75    AliMUONRegHeader*        regHeader   = 0x0;
76    AliMUONLocalStruct*      localStruct = 0x0;
77
78
79    // Loop over events  
80    Int_t iEvent = 0;
81
82    while (rawReader->NextEvent()) {
83
84      if (iEvent == maxEvent)
85        break;
86
87      printf("Event %d\n",iEvent++);
88
89      // read DDL while < 2 DDL
90      while(rawStream->NextDDL()) {
91
92       if (rawStream->GetDDL() < minDDL || rawStream->GetDDL() > maxDDL)
93          continue;
94
95        printf("\niDDL %d\n", rawStream->GetDDL());
96
97        ddlTrigger = rawStream->GetDDLTrigger();
98        darcHeader = ddlTrigger->GetDarcHeader();
99
100        printf("Global output %x\n", (Int_t)darcHeader->GetGlobalOutput());
101
102        // loop over regional structures
103        Int_t nReg = darcHeader->GetRegHeaderEntries();
104        for(Int_t iReg = 0; iReg < nReg ;iReg++){   //REG loop
105
106          printf("RegionalId %d\n", iReg);
107
108          regHeader =  darcHeader->GetRegHeaderEntry(iReg);
109          //  printf("Reg length %d\n",regHeader->GetHeaderLength());
110
111          // crate info  
112          AliMpTriggerCrate* crate = AliMpDDLStore::Instance()->
113                                     GetTriggerCrate(rawStream->GetDDL(), iReg);
114
115          // loop over local structures
116          Int_t nLocal = regHeader->GetLocalEntries();
117          for(Int_t iLocal = 0; iLocal < nLocal; iLocal++) {  
118
119            localStruct = regHeader->GetLocalEntry(iLocal);
120
121            Int_t iLocCard = crate->GetLocalBoardId(localStruct->GetId());
122
123            if ( !iLocCard ) continue; // empty slot
124
125            // check if trigger 
126            if (localStruct->GetTriggerX() 
127                || localStruct->GetTriggerY()) { // no empty data
128
129
130                printf("LocalId %d\n", localStruct->GetId());
131
132                Int_t loStripX  = (Int_t)localStruct->GetXPos();
133                Int_t loStripY  = (Int_t)localStruct->GetYPos();
134                Int_t loDev     = (Int_t)localStruct->GetXDev();
135             
136              printf("iLocCard: %d, XPos: %d, YPos: %d Dev: %d\n", iLocCard, loStripX, loStripY, loDev);
137            }
138          } // iLocal
139        } // iReg
140      } // NextDDL
141    }// NextEvent
142
143    delete rawReader;
144    delete rawStream;
145 }