2 - Contact: - prino@to.infn.it
3 - Link: - http://www.to.infn.it/~prino/alice/RawData/run11173.date
4 - Run Type: - PULSER_RUN
6 - Number of events needed: 100
7 - Input Files: - SDDbase_step2_mod*_sid*.data
8 - Output Files: - SDDbase_mod*_sid*.data
12 //////////////////////////////////////////////////////////////////////////////
13 // Detector Algorithm for analysis of SDD test pulse runs. //
15 // Produces ASCII and ROOT output files with: //
16 // 1. anode quality bit //
17 // 1. Baseline values //
19 // 3. Common mode coefficients //
20 // 4. Noise corrected for common mode //
22 // Files are written to FXS //
24 // Author: F. Prino (prino@to.infn.it) //
26 //////////////////////////////////////////////////////////////////////////////
46 #include <TPluginManager.h>
49 #include "AliRawReaderDate.h"
50 #include "AliITSOnlineSDDTP.h"
51 #include "AliITSRawStreamSDD.h"
53 Arguments: list of DATE raw data files
55 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 TP 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=15; // maximum number of events to be analyzed
80 const Int_t nSDDmodules=260; // temp for test raw data
81 AliITSOnlineSDDTP **tpan=new AliITSOnlineSDDTP*[2*nSDDmodules];
82 TH2F **histo=new TH2F*[2*nSDDmodules];
83 Bool_t isFilled[2*nSDDmodules];
85 for(Int_t imod=0; imod<nSDDmodules;imod++){
86 for(Int_t isid=0;isid<2;isid++){
87 Int_t index=2*imod+isid;
88 tpan[index]=new AliITSOnlineSDDTP(imod,isid,100.);
89 sprintf(hisnam,"his%03ds%d",imod,isid);
90 histo[index]=new TH2F(hisnam,"",256,-0.5,255.5,256,-0.5,255.5);
96 daqDA_progressReport(10);
97 Int_t iev=0,iAnalyzedEv=0;
98 /* read the data files */
100 for (n=1;n<argc;n++) {
102 status=monitorSetDataSource( argv[n] );
104 printf("monitorSetDataSource() failed : %s\n",monitorDecodeError(status));
108 /* report progress */
109 /* in this example, indexed on the number of files */
110 // Progress report inside the event loop as well?
111 daqDA_progressReport(10+80*n/argc);
115 struct eventHeaderStruct *event;
116 eventTypeType eventT;
119 status=monitorGetEventDynamic((void **)&event);
120 if (status==MON_ERR_EOF) break; /* end of monitoring file has been reached */
122 printf("monitorGetEventDynamic() failed : %s\n",monitorDecodeError(status));
126 /* retry if got no event */
131 if(iAnalyzedEv>=maxNEvents) break;
134 /* use event - here, just write event id to result file */
135 eventT=event->eventType;
136 switch (event->eventType){
146 // case PHYSICS_EVENT: // comment this line for test raw data
147 // break; // comment this line for test raw data
149 case CALIBRATION_EVENT:
150 break; // uncomment this line for test raw data
151 case PHYSICS_EVENT: // uncomment this line for test raw data
152 printf(" event number = %i \n",iev);
153 AliRawReader *rawReader = new AliRawReaderDate((void*)event);
154 rawReader->SelectEquipment(17,eqOffset+1,eqOffset+DDLrange);
157 while(rawReader->ReadHeader()){
158 const UInt_t *subev = rawReader->GetSubEventAttributes();
159 if(subev[0]==0 && subev[1]==0 && subev[2]==0) evtyp=1;
163 for(Int_t imod=0; imod<nSDDmodules;imod++){
164 for(Int_t isid=0; isid<2;isid++){
165 Int_t index=2*imod+isid;
166 histo[index]->Reset();
169 AliITSRawStreamSDD s(rawReader);
172 Int_t isddmod=s.GetModuleID();//Number(iddl,s.GetCarlosId());
173 isddmod-=240; // to have SDD modules from 0 to 259
174 if(isddmod>0 && isddmod<nSDDmodules && s.IsCompletedModule()==kFALSE){
175 Int_t index=2*isddmod+s.GetChannel();
176 histo[index]->Fill(s.GetCoord2(),s.GetCoord1(),s.GetSignal());
181 for(Int_t imod=0; imod<nSDDmodules;imod++){
182 for(Int_t isid=0; isid<2;isid++){
183 Int_t index=2*imod+isid;
184 if(isFilled[index]) tpan[index]->AddEvent(histo[index]);
196 TFile *fh=new TFile("SDDgainHistos.root","RECREATE");
197 Char_t filnam[100],command[120];
198 for(Int_t imod=0; imod<nSDDmodules;imod++){
199 for(Int_t isid=0; isid<2;isid++){
200 Int_t index=2*imod+isid;
202 tpan[index]->ValidateAnodes();
203 tpan[index]->WriteToASCII();
204 tpan[index]->WriteToROOT(fh);
205 sprintf(filnam,"SDDbase_mod%03d_sid%d.data",imod,isid);
206 sprintf(command,"tar -rf SDDbase_LDC.tar %s",filnam);
207 gSystem->Exec(command);
214 printf("Run #%s, received %d calibration events\n",getenv("DATE_RUN_NUMBER"),iAnalyzedEv);
216 /* report progress */
217 daqDA_progressReport(90);
225 status=daqDA_FES_storeFile("./SDDbase_LDC.tar","SDD_Calib");
227 /* report progress */
228 daqDA_progressReport(100);