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_step1_ddl*c*_sid*.data
8 - Output Files: - SDDbase_ddl*c*_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 TEST-PULSE 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=15; // maximum number of events to be analyzed
78 const Int_t kTotDDL=24;
79 const Int_t kModPerDDL=12;
82 AliITSOnlineSDDTP **tpan=new AliITSOnlineSDDTP*[kTotDDL*kModPerDDL*kSides];
83 TH2F **histo=new TH2F*[kTotDDL*kModPerDDL*kSides];
84 Bool_t isFilled[kTotDDL*kModPerDDL*kSides];
86 for(Int_t iddl=0; iddl<kTotDDL;iddl++){
87 for(Int_t imod=0; imod<kModPerDDL;imod++){
88 for(Int_t isid=0;isid<kSides;isid++){
89 Int_t index=kSides*(kModPerDDL*iddl+imod)+isid;
90 tpan[index]=new AliITSOnlineSDDTP(iddl,imod,isid,100.);
91 sprintf(hisnam,"h%02dc%02ds%d",iddl,imod,isid);
92 histo[index]=new TH2F(hisnam,"",256,-0.5,255.5,256,-0.5,255.5);
99 daqDA_progressReport(10);
100 Int_t iev=0,iAnalyzedEv=0;
101 /* read the data files */
103 for (n=1;n<argc;n++) {
105 status=monitorSetDataSource( argv[n] );
107 printf("monitorSetDataSource() failed : %s\n",monitorDecodeError(status));
111 /* report progress */
112 /* in this example, indexed on the number of files */
113 // Progress report inside the event loop as well?
114 daqDA_progressReport(10+80*n/argc);
118 struct eventHeaderStruct *event;
119 eventTypeType eventT;
122 status=monitorGetEventDynamic((void **)&event);
123 if (status==MON_ERR_EOF) break; /* end of monitoring file has been reached */
125 printf("monitorGetEventDynamic() failed : %s\n",monitorDecodeError(status));
129 /* retry if got no event */
134 if(iAnalyzedEv>=maxNEvents) break;
137 /* use event - here, just write event id to result file */
138 eventT=event->eventType;
139 switch (event->eventType){
149 // case PHYSICS_EVENT: // comment this line for test raw data
150 // break; // comment this line for test raw data
152 case CALIBRATION_EVENT:
153 break; // uncomment this line for test raw data
154 case PHYSICS_EVENT: // uncomment this line for test raw data
155 printf(" event number = %i \n",iev);
156 AliRawReader *rawReader = new AliRawReaderDate((void*)event);
159 while(rawReader->ReadHeader()){
160 const UInt_t *subev = rawReader->GetSubEventAttributes();
161 if(subev[0]==0 && subev[1]==0 && subev[2]==0) evtyp=1;
165 for(Int_t iddl=0; iddl<kTotDDL;iddl++){
166 for(Int_t imod=0; imod<kModPerDDL;imod++){
167 for(Int_t isid=0;isid<kSides;isid++){
168 Int_t index=kSides*(kModPerDDL*iddl+imod)+isid;
169 histo[index]->Reset();
173 AliITSRawStreamSDD s(rawReader);
176 Int_t iDDL=rawReader->GetDDLID();
177 Int_t iCarlos=s.GetCarlosId();
178 if(s.IsCompletedModule()) continue;
179 if(s.IsCompletedDDL()) continue;
180 if(iDDL>=0 && iDDL<kTotDDL){
181 Int_t index=kSides*(kModPerDDL*iDDL+iCarlos)+s.GetChannel();
182 histo[index]->Fill(s.GetCoord2(),s.GetCoord1(),s.GetSignal());
187 for(Int_t iddl=0; iddl<kTotDDL;iddl++){
188 for(Int_t imod=0; imod<kModPerDDL;imod++){
189 for(Int_t isid=0;isid<kSides;isid++){
190 Int_t index=kSides*(kModPerDDL*iddl+imod)+isid;
191 if(isFilled[index]) tpan[index]->AddEvent(histo[index]);
204 TFile *fh=new TFile("SDDgainHistos.root","RECREATE");
205 Char_t filnam[100],command[120];
206 for(Int_t iddl=0; iddl<kTotDDL;iddl++){
207 for(Int_t imod=0; imod<kModPerDDL;imod++){
208 for(Int_t isid=0;isid<kSides;isid++){
209 Int_t index=kSides*(kModPerDDL*iddl+imod)+isid;
211 tpan[index]->ValidateAnodes();
212 tpan[index]->WriteToASCII();
213 tpan[index]->WriteToROOT(fh);
214 sprintf(filnam,"SDDbase_ddl%02dc%02d_sid%d.data",iddl,imod,isid);
215 sprintf(command,"tar -rf SDDbase_LDC.tar %s",filnam);
216 gSystem->Exec(command);
224 printf("Run #%s, received %d calibration events\n",getenv("DATE_RUN_NUMBER"),iAnalyzedEv);
226 /* report progress */
227 daqDA_progressReport(90);
235 status=daqDA_FES_storeFile("./SDDbase_LDC.tar","SDD_Calib");
237 /* report progress */
238 daqDA_progressReport(100);