2 - Contact: - prino@to.infn.it
6 - Number of events needed:
8 - Output Files: - SDDinj_ddl*c*_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");
77 Int_t maxNEvents=10; // maximum number of events to be analyzed
78 const Int_t kTotDDL=24;
79 const Int_t kModPerDDL=12;
81 AliITSOnlineSDDInjectors **injan=new AliITSOnlineSDDInjectors*[kTotDDL*kModPerDDL*kSides];
82 TH2F **histo=new TH2F*[kTotDDL*kModPerDDL*kSides];
83 Int_t nWrittenEv[kTotDDL*kModPerDDL*kSides];
84 Bool_t isFilled[kTotDDL*kModPerDDL*kSides];
87 for(Int_t iddl=0; iddl<kTotDDL;iddl++){
88 for(Int_t imod=0; imod<kModPerDDL;imod++){
89 for(Int_t isid=0;isid<kSides;isid++){
90 Int_t index=kSides*(kModPerDDL*iddl+imod)+isid;
91 injan[index]=new AliITSOnlineSDDInjectors(iddl,imod,isid);
92 sprintf(hisnam,"h%02dc%02ds%d",iddl,imod,isid);
93 histo[index]=new TH2F(hisnam,"",256,-0.5,255.5,256,-0.5,255.5);
100 /* report progress */
101 daqDA_progressReport(10);
103 /* read the data files */
105 for (n=1;n<argc;n++) {
107 status=monitorSetDataSource( argv[n] );
109 printf("monitorSetDataSource() failed : %s\n",monitorDecodeError(status));
113 /* report progress */
114 /* in this example, indexed on the number of files */
115 // Progress report inside the event loop as well?
116 daqDA_progressReport(10+80*n/argc);
120 struct eventHeaderStruct *event;
121 eventTypeType eventT;
124 status=monitorGetEventDynamic((void **)&event);
125 if (status==MON_ERR_EOF) break; /* end of monitoring file has been reached */
127 printf("monitorGetEventDynamic() failed : %s\n",monitorDecodeError(status));
131 /* retry if got no event */
137 if(iev>maxNEvents) break;
139 /* use event - here, just write event id to result file */
140 eventT=event->eventType;
141 switch (event->eventType){
151 // case PHYSICS_EVENT: // comment this line for test raw data
152 // break; // comment this line for test raw data
154 case CALIBRATION_EVENT:
155 break; // uncomment this line for test raw data
156 case PHYSICS_EVENT: // uncomment this line for test raw data
157 printf(" event number = %i \n",iev);
158 AliRawReader *rawReader = new AliRawReaderDate((void*)event);
160 UInt_t timeSt=rawReader->GetTimestamp();
161 //UInt_t timeSt=iev*5000+12; // fake timestamp for test
163 while(rawReader->ReadHeader()){
164 const UInt_t *subev = rawReader->GetSubEventAttributes();
165 if(subev[0]==0 && subev[1]==0 && subev[2]==0) evtyp=1;
169 for(Int_t iddl=0; iddl<kTotDDL;iddl++){
170 for(Int_t imod=0; imod<kModPerDDL;imod++){
171 for(Int_t isid=0;isid<kSides;isid++){
172 Int_t index=kSides*(kModPerDDL*iddl+imod)+isid;
173 histo[index]->Reset();
177 AliITSRawStreamSDD s(rawReader);
180 Int_t iDDL=rawReader->GetDDLID();
181 Int_t iCarlos=s.GetCarlosId();
182 if(s.IsCompletedModule()) continue;
183 if(s.IsCompletedDDL()) continue;
184 if(iDDL>=0 && iDDL<kTotDDL){
185 Int_t index=kSides*(kModPerDDL*iDDL+iCarlos)+s.GetChannel();
186 histo[index]->Fill(s.GetCoord2(),s.GetCoord1(),s.GetSignal());
191 for(Int_t iddl=0; iddl<kTotDDL;iddl++){
192 for(Int_t imod=0; imod<kModPerDDL;imod++){
193 for(Int_t isid=0;isid<kSides;isid++){
194 Int_t index=kSides*(kModPerDDL*iddl+imod)+isid;
196 injan[index]->Reset();
197 injan[index]->AnalyzeEvent(histo[index]);
198 injan[index]->WriteToASCII(iev,timeSt,nWrittenEv[index]);
211 Char_t filnam[100],command[120];
212 for(Int_t iddl=0; iddl<kTotDDL;iddl++){
213 for(Int_t imod=0; imod<kModPerDDL;imod++){
214 for(Int_t isid=0;isid<kSides;isid++){
215 Int_t index=kSides*(kModPerDDL*iddl+imod)+isid;
216 if(nWrittenEv[index]>0){
217 sprintf(filnam,"SDDinj_ddl%02dc%02d_sid%d.data",iddl,imod,isid);
218 sprintf(command,"tar -rf SDDinj_LDC.tar %s",filnam);
219 gSystem->Exec(command);
226 printf("Run #%s, received %d injector events\n",getenv("DATE_RUN_NUMBER"),iev);
228 /* report progress */
229 daqDA_progressReport(90);
232 status=daqDA_FES_storeFile("./SDDinj_LDC.tar","SDD_Injec");
234 /* report progress */
235 daqDA_progressReport(100);