2 - Contact: - prino@to.infn.it
6 - Number of events needed: 100
7 - Input Files: - SDDbase_step1_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=10; // maximum number of events to be analyzed
80 const Int_t nSDDmodules=12; // temp for test raw data
81 AliITSOnlineSDDTP **tpan=new AliITSOnlineSDDTP*[2*nSDDmodules];
82 TH2F **histo=new TH2F*[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,411.);
89 sprintf(hisnam,"his%03ds%d",imod,isid);
90 histo[index]=new TH2F(hisnam,"",256,-0.5,255.5,256,-0.5,255.5);
95 daqDA_progressReport(10);
97 /* read the data files */
99 for (n=1;n<argc;n++) {
101 status=monitorSetDataSource( argv[n] );
103 printf("monitorSetDataSource() failed : %s\n",monitorDecodeError(status));
107 /* report progress */
108 /* in this example, indexed on the number of files */
109 // Progress report inside the event loop as well?
110 daqDA_progressReport(10+80*n/argc);
114 struct eventHeaderStruct *event;
115 eventTypeType eventT;
118 status=monitorGetEventDynamic((void **)&event);
119 if (status==MON_ERR_EOF) break; /* end of monitoring file has been reached */
121 printf("monitorGetEventDynamic() failed : %s\n",monitorDecodeError(status));
125 /* retry if got no event */
131 if(iev>maxNEvents) break;
133 /* use event - here, just write event id to result file */
134 eventT=event->eventType;
135 switch (event->eventType){
145 // case PHYSICS_EVENT: // comment this line for test raw data
146 // break; // comment this line for test raw data
148 case CALIBRATION_EVENT:
149 break; // uncomment this line for test raw data
150 case PHYSICS_EVENT: // uncomment this line for test raw data
151 printf(" event number = %i \n",iev);
152 AliRawReader *rawReader = new AliRawReaderDate((void*)event);
153 rawReader->SelectEquipment(17,eqOffset+1,eqOffset+DDLrange);
156 while(rawReader->ReadHeader()){
157 const UInt_t *subev = rawReader->GetSubEventAttributes();
158 if(subev[0]==0 && subev[1]==0 && subev[2]==0) evtyp=1;
162 for(Int_t imod=0; imod<nSDDmodules;imod++){
163 for(Int_t isid=0; isid<2;isid++){
164 Int_t index=2*imod+isid;
165 histo[index]->Reset();
168 AliITSRawStreamSDD s(rawReader);
171 Int_t iddl=rawReader->GetDDLID();
172 iddl=0; // temporary for test raw data
173 Int_t isddmod=s.GetModuleNumber(iddl,s.GetCarlosId());
174 isddmod-=240; // to have SDD modules from 0 to 259
175 isddmod=s.GetCarlosId(); // temporary for test raw data
176 if(isddmod<nSDDmodules&&s.IsCompletedModule()==kFALSE){
177 Int_t index=2*isddmod+s.GetChannel();
178 histo[index]->Fill(s.GetCoord2(),s.GetCoord1(),s.GetSignal());
182 for(Int_t imod=0; imod<nSDDmodules;imod++){
183 for(Int_t isid=0; isid<2;isid++){
184 Int_t index=2*imod+isid;
185 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;
201 tpan[index]->ValidateAnodes();
202 tpan[index]->WriteToASCII();
203 tpan[index]->WriteToROOT(fh);
204 sprintf(filnam,"SDDbase_mod%03d_sid%d.data",imod,isid);
205 sprintf(command,"tar -rf SDDbase_LDC1.tar %s",filnam);
206 gSystem->Exec(command);
212 printf("Run #%s, received %d calibration events\n",getenv("DATE_RUN_NUMBER"),iev);
214 /* report progress */
215 daqDA_progressReport(90);
223 status=daqDA_FES_storeFile("./SDDbase_LDC1.tar","SDD_Calib");
225 /* report progress */
226 daqDA_progressReport(100);