2 - Contact: - prino@to.infn.it
6 - Number of events needed:
8 - Output Files: - SDDinj_mod*_sid*.data
13 //////////////////////////////////////////////////////////////////////////////
14 // Detector Algorithm for analysis of SDD injector events. //
16 // Produces ASCII output files with: //
18 // 2. event timestamp //
19 // 3. Fit parameters of drift vel. vs. anode //
20 // Tar Files are written to FXS //
22 // Author: F. Prino (prino@to.infn.it) //
24 //////////////////////////////////////////////////////////////////////////////
44 #include <TPluginManager.h>
48 #include "AliRawReaderDate.h"
49 #include "AliITSOnlineSDDInjectors.h"
50 #include "AliITSRawStreamSDD.h"
52 Arguments: list of DATE raw data files
54 int main(int argc, char **argv) {
59 // line added to solve IO problems
60 gROOT->GetPluginManager()->AddHandler("TVirtualStreamerInfo",
66 /* log start of process */
67 printf("ITS SDD INJ algorithm program started\n");
70 /* check that we got some arguments = list of files */
72 printf("Wrong number of arguments\n");
79 Int_t maxNEvents=10; // maximum number of events to be analyzed
80 const Int_t nSDDmodules=12; // temp for test raw data
81 AliITSOnlineSDDInjectors **injan=new AliITSOnlineSDDInjectors*[2*nSDDmodules];
82 TH2F **histo=new TH2F*[2*nSDDmodules];
83 Int_t nWrittenEv[2*nSDDmodules];
86 for(Int_t imod=0; imod<nSDDmodules;imod++){
87 for(Int_t isid=0;isid<2;isid++){
88 Int_t index=2*imod+isid;
89 injan[index]=new AliITSOnlineSDDInjectors(imod,isid);
90 sprintf(hisnam,"his%03ds%d",imod,isid);
91 histo[index]=new TH2F(hisnam,"",256,-0.5,255.5,256,-0.5,255.5);
97 daqDA_progressReport(10);
99 /* read the data files */
101 for (n=1;n<argc;n++) {
103 status=monitorSetDataSource( argv[n] );
105 printf("monitorSetDataSource() failed : %s\n",monitorDecodeError(status));
109 /* report progress */
110 /* in this example, indexed on the number of files */
111 // Progress report inside the event loop as well?
112 daqDA_progressReport(10+80*n/argc);
116 struct eventHeaderStruct *event;
117 eventTypeType eventT;
120 status=monitorGetEventDynamic((void **)&event);
121 if (status==MON_ERR_EOF) break; /* end of monitoring file has been reached */
123 printf("monitorGetEventDynamic() failed : %s\n",monitorDecodeError(status));
127 /* retry if got no event */
133 if(iev>maxNEvents) break;
135 /* use event - here, just write event id to result file */
136 eventT=event->eventType;
137 switch (event->eventType){
147 // case PHYSICS_EVENT: // comment this line for test raw data
148 // break; // comment this line for test raw data
150 case CALIBRATION_EVENT:
151 break; // uncomment this line for test raw data
152 case PHYSICS_EVENT: // uncomment this line for test raw data
153 printf(" event number = %i \n",iev);
154 AliRawReader *rawReader = new AliRawReaderDate((void*)event);
155 rawReader->SelectEquipment(17,eqOffset+1,eqOffset+DDLrange);
157 UInt_t timeSt=rawReader->GetTimestamp();
158 //UInt_t timeSt=iev*5000+12; // fake timestamp for test
160 while(rawReader->ReadHeader()){
161 const UInt_t *subev = rawReader->GetSubEventAttributes();
162 if(subev[0]==0 && subev[1]==0 && subev[2]==0) evtyp=1;
166 for(Int_t imod=0; imod<nSDDmodules;imod++){
167 for(Int_t isid=0; isid<2;isid++){
168 Int_t index=2*imod+isid;
169 histo[index]->Reset();
172 AliITSRawStreamSDD s(rawReader);
175 Int_t iddl=rawReader->GetDDLID();
176 iddl=0; // temporary for test raw data
177 Int_t isddmod=s.GetModuleNumber(iddl,s.GetCarlosId());
178 isddmod-=240; // to have SDD modules from 0 to 259
179 isddmod=s.GetCarlosId(); // temporary for test raw data
180 if(isddmod<nSDDmodules&&s.IsCompletedModule()==kFALSE){
181 Int_t index=2*isddmod+s.GetChannel();
182 histo[index]->Fill(s.GetCoord2(),s.GetCoord1(),s.GetSignal());
186 for(Int_t imod=0; imod<nSDDmodules;imod++){
187 for(Int_t isid=0; isid<2;isid++){
188 Int_t index=2*imod+isid;
189 injan[index]->Reset();
190 injan[index]->AnalyzeEvent(histo[index]);
191 injan[index]->WriteToASCII(iev,timeSt,nWrittenEv[index]);
203 Char_t filnam[100],command[120];
204 for(Int_t imod=0; imod<nSDDmodules;imod++){
205 for(Int_t isid=0; isid<2;isid++){
206 sprintf(filnam,"SDDinj_mod%03d_sid%d.data",imod,isid);
207 sprintf(command,"tar -rf SDDinj_LDC1.tar %s",filnam);
208 gSystem->Exec(command);
213 printf("Run #%s, received %d injector events\n",getenv("DATE_RUN_NUMBER"),iev);
215 /* report progress */
216 daqDA_progressReport(90);
219 status=daqDA_FES_storeFile("./SDDinj_LDC1.tar","SDD_Calib");
221 /* report progress */
222 daqDA_progressReport(100);