+/*
+- Contact: - prino@to.infn.it
+- Link: - http://www.to.infn.it/~prino/alice/RawData/run11161.date
+- Run Type: - PEDESTAL_RUN
+- DA Type: - LDC
+- Number of events needed: 100
+- Input Files: -
+- Output Files: - SDDbase_step1_ddl*c*_sid*.data SDDbase_step2_ddl*c*_sid*.data
+- Trigger types used:
+*/
+
+
//////////////////////////////////////////////////////////////////////////////
// Detector Algorithm for analysis of SDD baseline runs. //
// //
#include <TFile.h>
#include <TH1F.h>
#include <TH2F.h>
+#include <TROOT.h>
+#include <TPluginManager.h>
// AliRoot includes
#include "AliRawReaderDate.h"
int status = 0;
+ // line added to solve IO problems
+ gROOT->GetPluginManager()->AddHandler("TVirtualStreamerInfo",
+ "*",
+ "TStreamerInfo",
+ "RIO",
+ "TStreamerInfo()");
/* log start of process */
- printf("ITS SDD TP algorithm program started\n");
+ printf("ITS SDD BASELINE+NOISE algorithm program started\n");
/* check that we got some arguments = list of files */
}
- // Loop over modules has to be added
- const Int_t nSDDmodules=12;
- AliITSOnlineSDDBase **base=new AliITSOnlineSDDBase*[2*nSDDmodules];
- AliITSOnlineSDDCMN **corr=new AliITSOnlineSDDCMN*[2*nSDDmodules];
- TH2F **histo=new TH2F*[2*nSDDmodules];
+ Int_t eqOffset = 256;
+ Int_t DDLrange = 24;
+ Int_t maxNEvents=18; // maximum number of events to be analyzed
+ const Int_t kTotDDL=24;
+ const Int_t kModPerDDL=12;
+ const Int_t kSides=2;
+ AliITSOnlineSDDBase **base=new AliITSOnlineSDDBase*[kTotDDL*kModPerDDL*kSides];
+ AliITSOnlineSDDCMN **corr=new AliITSOnlineSDDCMN*[kTotDDL*kModPerDDL*kSides];
+ TH2F **histo=new TH2F*[kTotDDL*kModPerDDL*kSides];
Char_t hisnam[20];
- for(Int_t imod=0; imod<nSDDmodules;imod++){
- for(Int_t isid=0;isid<2;isid++){
- Int_t index=2*imod+isid;
- base[index]=new AliITSOnlineSDDBase(imod,isid);
- corr[index]=new AliITSOnlineSDDCMN(imod,isid);
- sprintf(hisnam,"his%03ds%d",imod,isid);
- histo[index]=new TH2F(hisnam,"",256,-0.5,255.5,256,-0.5,255.5);
+ for(Int_t iddl=0; iddl<kTotDDL;iddl++){
+ for(Int_t imod=0; imod<kModPerDDL;imod++){
+ for(Int_t isid=0;isid<kSides;isid++){
+ Int_t index=kSides*(kModPerDDL*iddl+imod)+isid;
+ base[index]=new AliITSOnlineSDDBase(iddl,imod,isid);
+ sprintf(hisnam,"h%02dc%02ds%d",iddl,imod,isid);
+ histo[index]=new TH2F(hisnam,"",256,-0.5,255.5,256,-0.5,255.5);
+ }
}
}
/* report progress */
- daqDA_progressReport(10);
+ daqDA_progressReport(8);
Int_t iev;
for(Int_t iStep=0;iStep<2;iStep++){
- /* init some counters */
printf("Start Analysis Step %d\n",iStep);
iev=0;
if(iStep==1){
- for(Int_t imod=0; imod<nSDDmodules;imod++){
- for(Int_t isid=0;isid<2;isid++){
- Int_t index=2*imod+isid;
- corr[index]->Reset();
+ for(Int_t iddl=0; iddl<kTotDDL;iddl++){
+ for(Int_t imod=0; imod<kModPerDDL;imod++){
+ for(Int_t isid=0;isid<kSides;isid++){
+ Int_t index=kSides*(kModPerDDL*iddl+imod)+isid;
+ corr[index]=new AliITSOnlineSDDCMN(iddl,imod,isid);
+ }
}
}
}
/* report progress */
/* in this example, indexed on the number of files */
// Progress report inside the event loop as well?
- daqDA_progressReport(10+80*n/argc);
+ daqDA_progressReport(10+40*iStep*n/argc);
/* read the file */
for(;;) {
}
iev++;
- if(iev>10) break;
+ if(iev>maxNEvents) break;
/* use event - here, just write event id to result file */
eventT=event->eventType;
case END_OF_RUN:
break;
- // case PHYSICS_EVENT:
- // break;
+ // case PHYSICS_EVENT: // comment this line for test raw data
+ // break; // comment this line for test raw data
+
case CALIBRATION_EVENT:
- // for test raw data
- case PHYSICS_EVENT:
+ break; // uncomment this line for test raw data
+ case PHYSICS_EVENT: // uncomment this line for test raw data
printf(" event number = %i \n",iev);
AliRawReader *rawReader = new AliRawReaderDate((void*)event);
- rawReader->RequireHeader(kFALSE);
+ rawReader->SelectEquipment(17,eqOffset+1,eqOffset+DDLrange);
- // temp for test raw data
- rawReader->SelectEquipment(17,101,101);
Int_t evtyp=0;
while(rawReader->ReadHeader()){
}
rawReader->Reset();
- for(Int_t imod=0; imod<nSDDmodules;imod++){
- for(Int_t isid=0; isid<2;isid++){
- Int_t index=2*imod+isid;
- histo[index]->Reset();
+ for(Int_t iddl=0; iddl<kTotDDL;iddl++){
+ for(Int_t imod=0; imod<kModPerDDL;imod++){
+ for(Int_t isid=0;isid<kSides;isid++){
+ Int_t index=kSides*(kModPerDDL*iddl+imod)+isid;
+ histo[index]->Reset();
+ }
}
}
AliITSRawStreamSDD s(rawReader);
- // temp for test raw data
- rawReader->SelectEquipment(17,101,101);
while(s.Next()){
- // calculation of module etc.
- if(s.GetCarlosId()<nSDDmodules){
- Int_t index=2*s.GetCarlosId()+s.GetChannel();
+ Int_t iDDL=rawReader->GetDDLID();
+ Int_t iCarlos=s.GetCarlosId();
+ if(iDDL>=0 && iDDL<kTotDDL && s.IsCompletedModule()==kFALSE){
+ Int_t index=kSides*(kModPerDDL*iDDL+iCarlos)+s.GetChannel();
histo[index]->Fill(s.GetCoord2(),s.GetCoord1(),s.GetSignal());
}
}
delete rawReader;
- for(Int_t imod=0; imod<nSDDmodules;imod++){
- for(Int_t isid=0; isid<2;isid++){
- Int_t index=2*imod+isid;
- if(iStep==0) base[index]->AddEvent(histo[index]);
- if(iStep==1) corr[index]->AddEvent(histo[index]);
+ for(Int_t iddl=0; iddl<kTotDDL;iddl++){
+ for(Int_t imod=0; imod<kModPerDDL;imod++){
+ for(Int_t isid=0;isid<kSides;isid++){
+ Int_t index=kSides*(kModPerDDL*iddl+imod)+isid;
+ if(iStep==0) base[index]->AddEvent(histo[index]);
+ if(iStep==1) corr[index]->AddEvent(histo[index]);
+ }
}
}
free(event);
}
}
-
}
-
- for(Int_t imod=0; imod<nSDDmodules;imod++){
- for(Int_t isid=0; isid<2;isid++){
- Int_t index=2*imod+isid;
- if(iStep==0){
- base[index]->ValidateAnodes();
- base[index]->WriteToASCII();
- }
- if(iStep==1){
- corr[index]->ValidateAnodes();
- corr[index]->WriteToASCII();
+
+ if(iStep==0){
+ for(Int_t iddl=0; iddl<kTotDDL;iddl++){
+ for(Int_t imod=0; imod<kModPerDDL;imod++){
+ for(Int_t isid=0;isid<kSides;isid++){
+ Int_t index=kSides*(kModPerDDL*iddl+imod)+isid;
+ base[index]->ValidateAnodes();
+ base[index]->WriteToASCII();
+ }
}
- }
- }
+ }
+ }
}
/* write report */
- TFile *fh=new TFile("histos.root","RECREATE");
- for(Int_t imod=0; imod<nSDDmodules;imod++){
- for(Int_t isid=0; isid<2;isid++){
- Int_t index=2*imod+isid;
- corr[index]->WriteToROOT(fh);
+ TFile *fh=new TFile("SDDbaseHistos.root","RECREATE");
+ for(Int_t iddl=0; iddl<kTotDDL;iddl++){
+ for(Int_t imod=0; imod<kModPerDDL;imod++){
+ for(Int_t isid=0;isid<kSides;isid++){
+ Int_t index=kSides*(kModPerDDL*iddl+imod)+isid;
+ corr[index]->ValidateAnodes();
+ corr[index]->WriteToASCII();
+ corr[index]->WriteToROOT(fh);
+ }
}
}
fh->Close();
-
- // Example how to store the output file ot DAQ FXS
- // status=daqDA_FES_storeFile("./result.txt","DAcase1_results");
-
/* report progress */
daqDA_progressReport(100);