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");
79 Int_t maxNEvents=10; // maximum number of events to be analyzed
80 const Int_t kTotDDL=24;
81 const Int_t kModPerDDL=12;
83 AliITSOnlineSDDInjectors **injan=new AliITSOnlineSDDInjectors*[kTotDDL*kModPerDDL*kSides];
84 TH2F **histo=new TH2F*[kTotDDL*kModPerDDL*kSides];
85 Int_t nWrittenEv[kTotDDL*kModPerDDL*kSides];
86 Bool_t isFilled[kTotDDL*kModPerDDL*kSides];
89 for(Int_t iddl=0; iddl<kTotDDL;iddl++){
90 for(Int_t imod=0; imod<kModPerDDL;imod++){
91 for(Int_t isid=0;isid<kSides;isid++){
92 Int_t index=kSides*(kModPerDDL*iddl+imod)+isid;
93 injan[index]=new AliITSOnlineSDDInjectors(iddl,imod,isid);
94 sprintf(hisnam,"h%02dc%02ds%d",iddl,imod,isid);
95 histo[index]=new TH2F(hisnam,"",256,-0.5,255.5,256,-0.5,255.5);
102 /* report progress */
103 daqDA_progressReport(10);
105 /* read the data files */
107 for (n=1;n<argc;n++) {
109 status=monitorSetDataSource( argv[n] );
111 printf("monitorSetDataSource() failed : %s\n",monitorDecodeError(status));
115 /* report progress */
116 /* in this example, indexed on the number of files */
117 // Progress report inside the event loop as well?
118 daqDA_progressReport(10+80*n/argc);
122 struct eventHeaderStruct *event;
123 eventTypeType eventT;
126 status=monitorGetEventDynamic((void **)&event);
127 if (status==MON_ERR_EOF) break; /* end of monitoring file has been reached */
129 printf("monitorGetEventDynamic() failed : %s\n",monitorDecodeError(status));
133 /* retry if got no event */
139 if(iev>maxNEvents) break;
141 /* use event - here, just write event id to result file */
142 eventT=event->eventType;
143 switch (event->eventType){
153 // case PHYSICS_EVENT: // comment this line for test raw data
154 // break; // comment this line for test raw data
156 case CALIBRATION_EVENT:
157 break; // uncomment this line for test raw data
158 case PHYSICS_EVENT: // uncomment this line for test raw data
159 printf(" event number = %i \n",iev);
160 AliRawReader *rawReader = new AliRawReaderDate((void*)event);
161 rawReader->SelectEquipment(17,eqOffset+1,eqOffset+DDLrange);
163 UInt_t timeSt=rawReader->GetTimestamp();
164 //UInt_t timeSt=iev*5000+12; // fake timestamp for test
166 while(rawReader->ReadHeader()){
167 const UInt_t *subev = rawReader->GetSubEventAttributes();
168 if(subev[0]==0 && subev[1]==0 && subev[2]==0) evtyp=1;
172 for(Int_t iddl=0; iddl<kTotDDL;iddl++){
173 for(Int_t imod=0; imod<kModPerDDL;imod++){
174 for(Int_t isid=0;isid<kSides;isid++){
175 Int_t index=kSides*(kModPerDDL*iddl+imod)+isid;
176 histo[index]->Reset();
180 AliITSRawStreamSDD s(rawReader);
183 Int_t iDDL=rawReader->GetDDLID();
184 Int_t iCarlos=s.GetCarlosId();
185 if(iDDL>=0 && iDDL<kTotDDL && s.IsCompletedModule()==kFALSE){
186 Int_t index=kSides*(kModPerDDL*iDDL+iCarlos)+s.GetChannel();
187 histo[index]->Fill(s.GetCoord2(),s.GetCoord1(),s.GetSignal());
192 for(Int_t iddl=0; iddl<kTotDDL;iddl++){
193 for(Int_t imod=0; imod<kModPerDDL;imod++){
194 for(Int_t isid=0;isid<kSides;isid++){
195 Int_t index=kSides*(kModPerDDL*iddl+imod)+isid;
197 injan[index]->Reset();
198 injan[index]->AnalyzeEvent(histo[index]);
199 injan[index]->WriteToASCII(iev,timeSt,nWrittenEv[index]);
212 Char_t filnam[100],command[120];
213 for(Int_t iddl=0; iddl<kTotDDL;iddl++){
214 for(Int_t imod=0; imod<kModPerDDL;imod++){
215 for(Int_t isid=0;isid<kSides;isid++){
216 Int_t index=kSides*(kModPerDDL*iddl+imod)+isid;
217 if(nWrittenEv[index]>0){
218 sprintf(filnam,"SDDinj_ddl%02dc%02d_sid%d.data",iddl,imod,isid);
219 sprintf(command,"tar -rf SDDinj_LDC.tar %s",filnam);
220 gSystem->Exec(command);
227 printf("Run #%s, received %d injector events\n",getenv("DATE_RUN_NUMBER"),iev);
229 /* report progress */
230 daqDA_progressReport(90);
233 status=daqDA_FES_storeFile("./SDDinj_LDC1.tar","SDD_Calib");
235 /* report progress */
236 daqDA_progressReport(100);