* \verbinclude Altro/Altro.C.log
*
*/
+
/////////////////////////////////////////////////////////////////////////////////////////////////////
// Class for emulation of the ALTRO chip (Altro digital Chain) in C++ //
// Author: Roland Bramm //
fConfiguredAltro(0), // ConfiguredAltro
fConfiguredBSL1(0), // ConfiguredBSL1
fConfiguredTCF(0), // ConfiguredTCF
+ fConfiguredTCFraw(0), // ConfiguredTCF
fConfiguredBSL2(0), // ConfiguredBSL2
fConfiguredZSU(0), // ConfiguredZSU
fBSL1mode(0), // BSL1mode
fReader(0), // for Altro Emulation on Raw Reader
fDecoder(0),
- fDDLFolderName("/tmp/"),
- fOutputDateFileName("/tmp/tmp.date"),
- fOutputRootFileName("/tmp/tmp.root"),
+ fRunNumber(0),
+ fDDLFolderName("./"),
+ fOutputDateFileName("./tmpRaw.date"),
+ fOutputRootFileName("./tmpRaw.root"),
fIsRandom(kTRUE),
fChannels(0),
fCDHs(0),
//
// Constructor of Altro Class
//
- /*
- ftimebins = timebins;
-
- fChannelShort_T = Channel;
-
- fOnBSL1 = 0;
- fOnTCF = 0;
- fOnBSL2 = 0;
- fOnClip = 0;
- fOnZSU = 0;
-
- fConfiguredAltro = 0;
- fConfiguredBSL1 = 0;
- fConfiguredTCF = 0;
- fConfiguredBSL2 = 0;
- fConfiguredZSU = 0;
- */
-}
-
-
-AliTPCAltroEmulator::AliTPCAltroEmulator(const AliTPCAltroEmulator &altro):
- TNamed(),
- ftimebins(altro.ftimebins),
-// fChannelIn(Channel),
- fChannelShort(altro.fChannelShort),
- fADCkeep(0),
- fOnBSL1(0),
- fOnTCF(0),
- fOnBSL2(0),
- fOnClip(0),
- fOnZSU(0),
-
- fConfiguredAltro(0), // ConfiguredAltro
- fConfiguredBSL1(0), // ConfiguredBSL1
- fConfiguredTCF(0), // ConfiguredTCF
- fConfiguredBSL2(0), // ConfiguredBSL2
- fConfiguredZSU(0), // ConfiguredZSU
- fBSL1mode(0), // BSL1mode
- fBSL1ValuePeDestal(0), // BSL1ValuePeDestal
- fBSL1PedestalMem(0), // BSL1PedestalMem
- fBSL1polarity(0), // BSL1polarity
-
- fTCFK1(0), // K1
- fTCFK2(0), // K2
- fTCFK3(0), // K3
- fTCFL1(0), // L1
- fTCFL2(0), // L2
- fTCFL3(0), // L3
- fTCFK1Int(0), // K1Int
- fTCFK2Int(0), // K2Int
- fTCFK3Int(0), // K3Int
- fTCFL1Int(0), // L1Int
- fTCFL2Int(0), // L2Int
- fTCFL3Int(0), // L3Int
-
- fBSL2HighThreshold(0), // BSL2HighThreshold
- fBSL2LowThreshold(0), // BSL2LowThreshold
- fBSL2Offset(0), // BSL2Offset
- fBSL2Presamples(0), // BSL2Presamples(0),
- fBSL2Postsamples(0), // BSL2Postsamples
-
- fZSUThreshold(0), // ZSUThreshold
-
- fZSUMinSamplesaboveThreshold(0), // ZSUMinSamplesaboveThreshold
- fZSUPresamples(0), // ZSUPresamples
- fZSUPostsamples(0), // ZSUPostsamples
+ fADCkeep = new Short_t[1024];
- fReader(0), // for Altro Emulation on Raw Reader
- fDecoder(0),
- fDDLFolderName("/tmp/"),
- fOutputDateFileName("/tmp/tmp.date"),
- fOutputRootFileName("/tmp/tmp.root"),
- fIsRandom(kTRUE),
- fChannels(0),
- fCDHs(0),
- fADCs(0),
- fTrailers(0),
- fRawData(0) {
- //
- // copy constructor of Altro Class
- //
+ fTCFK1IntROC[0]=0; fTCFK1IntROC[1]=0; // dummy defaults
+ fTCFK2IntROC[0]=0; fTCFK2IntROC[1]=0; // dummy defaults
+ fTCFK3IntROC[0]=0; fTCFK3IntROC[1]=0; // dummy defaults
+ fTCFL1IntROC[0]=0; fTCFL1IntROC[1]=0; // dummy defaults
+ fTCFL2IntROC[0]=0; fTCFL2IntROC[1]=0; // dummy defaults
+ fTCFL3IntROC[0]=0; fTCFL3IntROC[1]=0; // dummy defaults
}
+
/** @brief Destructor of Altro Class
*
* Destructor of Altro Class\n
// Destructor of Altro Class
//
- if(fConfiguredZSU == 1)
- delete fADCkeep;
+ // if(fConfiguredZSU == 1)
+ delete[] fADCkeep;
delete[] fChannels;
delete[] fCDHs ;
}
-//_____________________________________________________________________________
-AliTPCAltroEmulator& AliTPCAltroEmulator::operator = (const AliTPCAltroEmulator &source)
-{
- //
- // AliTPCAltroEmulator assignment operator
- //
-
- if (&source == this) return *this;
- new (this) AliTPCAltroEmulator(source);
-
- return *this;
-
-}
-
-
/** @brief Configures which modules of the Altro should be on.
*
//
// Configures the Base Line Correction 1 (BSL1) Module
//
- fBSL1mode = InRange(mode,0,10,"AliTPCAltroEmulator::ConfigBaselineCorrection1","mode");
+ fBSL1mode = InRange(mode,0,16,"AliTPCAltroEmulator::ConfigBaselineCorrection1","mode");
fBSL1ValuePeDestal = InRange(ValuePeDestal,0,1023,"AliTPCAltroEmulator::BaselineCorrection1","ValuePeDestal");
fBSL1PedestalMem = PedestalMem;
fBSL1polarity = InRange(polarity,0,1,"AliTPCAltroEmulator::BaselineCorrection1","polarity");
fTCFL3Int = InRange(L3,0,65535,"AliTPCAltroEmulator::ConfigTailCancellationFilter","L3");
fConfiguredTCF = 1;
}
+void AliTPCAltroEmulator::ConfigTailCancellationFilterForRAWfiles(const Int_t *K1, const Int_t *K2, const Int_t *K3,
+ const Int_t *L1, const Int_t *L2, const Int_t *L3){
+ //
+ // Configures the Tail Cancellation Filter (TCF) Module - Different settings for IROC and OROC
+ //
+ // conf from Int_t to fp: (int)*(pow(2,-16)-1)
+ // backway: (Float_t)*(pow(2,16)-1)
+
+ // IROC
+ fTCFK1IntROC[0] = InRange(K1[0],0,65535,"AliTPCAltroEmulator::ConfigTailCancellationFilter","K1[0]");
+ fTCFK2IntROC[0] = InRange(K2[0],0,65535,"AliTPCAltroEmulator::ConfigTailCancellationFilter","K2[0]");
+ fTCFK3IntROC[0] = InRange(K3[0],0,65535,"AliTPCAltroEmulator::ConfigTailCancellationFilter","K3[0]");
+ fTCFL1IntROC[0] = InRange(L1[0],0,65535,"AliTPCAltroEmulator::ConfigTailCancellationFilter","L1[0]");
+ fTCFL2IntROC[0] = InRange(L2[0],0,65535,"AliTPCAltroEmulator::ConfigTailCancellationFilter","L2[0]");
+ fTCFL3IntROC[0] = InRange(L3[0],0,65535,"AliTPCAltroEmulator::ConfigTailCancellationFilter","L3[0]");
+ // OROC
+ fTCFK1IntROC[1] = InRange(K1[1],0,65535,"AliTPCAltroEmulator::ConfigTailCancellationFilter","K1[1]");
+ fTCFK2IntROC[1] = InRange(K2[1],0,65535,"AliTPCAltroEmulator::ConfigTailCancellationFilter","K2[1]");
+ fTCFK3IntROC[1] = InRange(K3[1],0,65535,"AliTPCAltroEmulator::ConfigTailCancellationFilter","K3[1]");
+ fTCFL1IntROC[1] = InRange(L1[1],0,65535,"AliTPCAltroEmulator::ConfigTailCancellationFilter","L1[1]");
+ fTCFL2IntROC[1] = InRange(L2[1],0,65535,"AliTPCAltroEmulator::ConfigTailCancellationFilter","L2[1]");
+ fTCFL3IntROC[1] = InRange(L3[1],0,65535,"AliTPCAltroEmulator::ConfigTailCancellationFilter","L3[1]");
+
+
+ fConfiguredTCFraw = 1;
+}
+
/** @brief Configures the Moving Average Filter (BSL2) Module
*
fZSUMinSamplesaboveThreshold = InRange(MinSamplesaboveThreshold,1,3,"AliTPCAltroEmulator::BaselineCorrection1","MinSamplesaboveThreshold");
fZSUPresamples = InRange(Presamples,0,3,"AliTPCAltroEmulator::BaselineCorrection1","Presamples");
fZSUPostsamples = InRange(Postsamples,0,7,"AliTPCAltroEmulator::BaselineCorrection1","Postsamples");
- fADCkeep = (Short_t *)calloc(sizeof(short),ftimebins);
for(Int_t i = 0; i < ftimebins; i++){
fADCkeep[i] = 0;
* Runs the emulation of all configured Modules. This changes then the content of the
* input Array
*/
-void AliTPCAltroEmulator::RunEmulation(){
+void AliTPCAltroEmulator::RunEmulation(Int_t roc){
//
// Runs the emulation of all configured Modules.
//
-
if (!fChannelShort) {
printf("ERROR cant run Altro Emulation: Channel input not set.\nUse for example: SetChannelData(Int_t timebins, Short_t* Channel)\n");
return;
//cout << "AliTPCAltroEmulator::RunEmulation | start TCF on: " << fOnTCF << " configures: " << fConfiguredTCF << endl;
if(fOnTCF == 1){
- if(fConfiguredTCF == 1){
- TailCancellationFilterFixedPoint(fTCFK1Int, fTCFK2Int, fTCFK3Int, fTCFL1Int, fTCFL2Int, fTCFL3Int);
- }else{
- cout << "ERROR cant run Tail Cancellation Filter because not configured" << endl;
- return;
+ if (roc==-1) { // use one set of TCF params
+ if(fConfiguredTCF == 1){
+ TailCancellationFilterFixedPoint(fTCFK1Int, fTCFK2Int, fTCFK3Int, fTCFL1Int, fTCFL2Int, fTCFL3Int);
+ }else{
+ cout << "ERROR cant run Tail Cancellation Filter because not configured" << endl;
+ return;
+ }
+ } else { // use different TCF params for IROC and OROC
+ if(fConfiguredTCFraw == 1){
+ if (roc==0) //IROC
+ TailCancellationFilterFixedPoint(fTCFK1IntROC[0], fTCFK2IntROC[0], fTCFK3IntROC[0],
+ fTCFL1IntROC[0], fTCFL2IntROC[0], fTCFL3IntROC[0]);
+ else if (roc==1) // OROC
+ TailCancellationFilterFixedPoint(fTCFK1IntROC[1], fTCFK2IntROC[1], fTCFK3IntROC[1],
+ fTCFL1IntROC[1], fTCFL2IntROC[1], fTCFL3IntROC[1]);
+ else
+ cout << "ERROR cant run Tail Cancellation Filter because TCF settings for ROC not found" << endl;
+ } else {
+ cout << "ERROR cant run Tail Cancellation Filter because not configured (for RAW data files!)" << endl;
+ return;
+ }
+
}
}
//VPD == 0 !!
Int_t fixedPeDestal = 0;
-
+
+ // take first and last bins to calculate a mean pedestal value
+ Int_t window = 3;
+ Int_t meanPeDestal = 0;
+ if (mode == kDINxMPD && ftimebins>=6) {
+ for(Int_t i = 0; i < window; i++) {
+ meanPeDestal += fChannelShort[i];
+ meanPeDestal += fChannelShort[ftimebins-1-i];
+ }
+ meanPeDestal /= (window*2);
+ }
+
if(polarity ==1){
for(Int_t i = 0; i < ftimebins; i++){
fChannelShort[i] = 1023 - fChannelShort[i];
for(Int_t i = 0; i < ftimebins; i++)
fChannelShort[i] = PedestalMem[i] - fixedPeDestal;
break;
+ case kDINxMPD:
+ for(Int_t i = 0; i < ftimebins; i++)
+ fChannelShort[i] = fChannelShort[i] - meanPeDestal;
+ break;
}
}
Int_t AliTPCAltroEmulator::Multiply36(Int_t P, Int_t N){
//
- // multiply function to emulate the 36 bit fixed poInt_t multiplication of the Altro.
+ // multiply function to emulate the 36 bit fixed point multiplication of the Altro.
//
long long retval =0;
long long temp = 0;
Int_t dout = 0;
Int_t din = 0;
Int_t bit = 0;
+
+ // printf("%5d %5d %5d %5d %5d %5d\n",K1,K2,K3,L1,L2,L3);
+
for(Int_t i = 0; i < ftimebins; i++){
din = fChannelShort[i];
// implement if no BC2 clipping has to run
//
for(Int_t i = 0; i < ftimebins; i++){
- if(fChannelShort[i] < 0)
- fChannelShort[i] = 0;
+ if(fChannelShort[i] < -1)
+ fChannelShort[i] = -1;
}
}
//TODO: Implement "Altro zsu merging"
//Int_t Postsamplecounter = 0;
//Int_t setPostsample = 0;
+
for(Int_t i = 0; i < ftimebins; i++){
- if(fChannelShort[i] >= Threshold){
+ if(fChannelShort[i] >= Threshold)
fADCkeep[i] = 1;
- }
+ else
+ fADCkeep[i] = 0;
}
Int_t startofclustersequence = -1;
for(Int_t i = 0; i < ftimebins; i++){
if( !GetKeepChannel(i) ) {
- SetElement(fChannelShort,i+1,-1); // set non relevant data to -1
+ SetElement(fChannelShort,i,-1); // set non relevant data to -1
}
}
char out[255];
Int_t retval;
if(parameter > High){
- sprintf(out,"Error | %s | Parameter %s is to big, has to be %d <= %s <= %d, is %d, now set to %d",Module,ParameterName,Low,ParameterName,High,parameter,High);
+ snprintf(out,255,"Error | %s | Parameter %s is to big, has to be %d <= %s <= %d, is %d, now set to %d",Module,ParameterName,Low,ParameterName,High,parameter,High);
cout << out << endl;
retval = High;
}else if(parameter < Low){
- sprintf(out,"Error | %s | Parameter %s is to small, has to be %d <= %s <= %d, is %d, now set to %d",Module,ParameterName,Low,ParameterName,High,parameter,Low);
+ snprintf(out,255,"Error | %s | Parameter %s is to small, has to be %d <= %s <= %d, is %d, now set to %d",Module,ParameterName,Low,ParameterName,High,parameter,Low);
cout << out << endl;
retval = Low;
}else{
FILE *file=fopen(Form("%s/raw%d/TPC_%03d.ddl",
fDDLFolderName.Data(),ievent,768+ddlID),
"wb");
- if (!file) return kFALSE;
- Int_t i32;
- // write CDH (first word to be altered later)
- for (i32=0;i32<8;++i32)
- fRawData[i32]=cdhDDL[i32];
-
- // process payload
- for (Int_t hwaddr=0;hwaddr<4096;++hwaddr) if (channelsDDL[hwaddr]) {
- Short_t *adcsChannel=adcsDDL+hwaddr*1024;
- // merge custers
- // TODO: acqusition window
- for (Int_t it=0;it<1024-3;++it) {
- if (adcsChannel[it]>=0&&adcsChannel[it+3]>=0) {
- if (adcsChannel[it+1]<0) {
- // printf("merge");
- adcsChannel[it+1]=0;
- }
- if (adcsChannel[it+2]<0) {
- // printf("merge");
- adcsChannel[it+2]=0;
+ if (!file) {
+ return kFALSE;
+ } else {
+ Int_t i32;
+ // write CDH (first word to be altered later)
+ for (i32=0;i32<8;++i32)
+ fRawData[i32]=cdhDDL[i32];
+
+ // process payload
+ for (Int_t hwaddr=0;hwaddr<4096;++hwaddr) if (channelsDDL[hwaddr]) {
+ Short_t *adcsChannel=adcsDDL+hwaddr*1024;
+ // merge custers
+ // TODO: acqusition window
+ for (Int_t it=0;it<1024-3;++it) {
+ if (adcsChannel[it]>=0&&adcsChannel[it+3]>=0) {
+ if (adcsChannel[it+1]<0) {
+ // printf("merge");
+ adcsChannel[it+1]=0;
+ }
+ if (adcsChannel[it+2]<0) {
+ // printf("merge");
+ adcsChannel[it+2]=0;
+ }
}
}
- }
- Int_t i10=3;
- Int_t icw=0;
- Int_t its=1;
- Int_t cw =0;
- Int_t ts =0;
- for (Int_t it=1023;it>=0;--it) {
- Short_t w10=adcsChannel[it];
- if (w10>=0) {
- if (cw<0) {
- icw=i10++;
- its=i10++;
- cw =0 ;
- ts=it ;
+ Int_t i10=3;
+ Int_t icw=0;
+ Int_t its=1;
+ Int_t cw =0;
+ Int_t ts =0;
+ for (Int_t it=1023;it>=0;--it) {
+ Short_t w10=adcsChannel[it];
+ if (w10>=0) {
+ if (cw<0) {
+ icw=i10++;
+ its=i10++;
+ cw =0 ;
+ ts=it ;
+ }
+ fRawData[i32+i10/3]|=w10<<(10*(2-i10%3));
+ ++i10;
+ ++cw;
}
- fRawData[i32+i10/3]|=w10<<(10*(2-i10%3));
- ++i10;
- ++cw;
- }
- else {
- if (cw>=0) {
- cw+=2;
- fRawData[i32+icw/3]|=cw <<(10*(2-icw%3));
- fRawData[i32+its/3]|=ts <<(10*(2-its%3));
- cw=-1;
+ else {
+ if (cw>=0) {
+ cw+=2;
+ fRawData[i32+icw/3]|=cw <<(10*(2-icw%3));
+ fRawData[i32+its/3]|=ts <<(10*(2-its%3));
+ cw=-1;
+ }
}
}
+ fRawData[i32]=0x1<<30|(i10-3)<<16|hwaddr;
+ i32+=(i10+2)/3;
+
+ // clean up
+ for (Int_t i=0;i<1024;++i) adcsChannel[i]=-1;
+ channelsDDL[hwaddr]=kFALSE;
}
- fRawData[i32]=0x1<<30|(i10-3)<<16|hwaddr;
- i32+=(i10+2)/3;
+
+ // write RCU trailer
+ fRawData[i32]=0x2<<30|(i32-8);i32++;
+ for (Int_t i=0;i<8;++i)
+ fRawData[i32++]=trailerDDL[i];
+
+ // write first word of CDH
+ fRawData[0]=i32*4;
+
+ Int_t nwritten=fwrite(fRawData,sizeof(UInt_t),i32,file);
+ fclose(file);
+ if (nwritten!=i32) return kFALSE;
+
// clean up
- for (Int_t i=0;i<1024;++i) adcsChannel[i]=-1;
- channelsDDL[hwaddr]=kFALSE;
+ do {fRawData[--i32]=0;} while (i32>0);
}
-
- // write RCU trailer
- fRawData[i32]=0x2<<30|(i32-8);i32++;
- for (Int_t i=0;i<8;++i)
- fRawData[i32++]=trailerDDL[i];
-
- // write first word of CDH
- fRawData[0]=i32*4;
-
- Int_t nwritten=fwrite(fRawData,sizeof(UInt_t),i32,file);
- if (nwritten!=i32) return kFALSE;
-
- // clean up
- do {fRawData[--i32]=0;} while (i32>0);
-
- fclose(file);
}
return kTRUE;
}
char command[100];
FILE *pipe;
- if (fReader->GetRunNumber()>0)
+
+ printf(" RAW to DATE CONVERSION: Run Number %d\n",fRunNumber);
+
+ if (fRunNumber>0)
pipe=gSystem->OpenPipe(Form("dateStream -c -s -D -o %s -C -# %d -run %d",
fOutputDateFileName.Data(),
nevents,
- fReader->GetRunNumber()),
+ fRunNumber),
"w");
else
pipe=gSystem->OpenPipe(Form("dateStream -c -s -D -o %s -C -# %d",
fprintf(stderr,"error: cannot execute command: %s",command);
return kFALSE;
}
-
+
for (Int_t ievent=0;ievent<nevents;++ievent) {
UInt_t detectorPattern = 0xFFFFFFFF;
fprintf(pipe, "GDC DetectorPattern %u\n", detectorPattern);
// from $ALICE_ROOT/STEER/AliSimulation.cxx
+ printf(" DATE to ROOT CONVERSION: Run Number %d\n",fRunNumber);
+
// ALIMDC setup
const Int_t kDBSize = 2000000000; //2GB
const Int_t kTagDBSize = 1000000000;
InitBuffers();
- TH1F hisO("DINO","DINO",1014,0,1014);
- TH1F his("DIN","DIN",1014,0,1014);
- TCanvas c1("c1","c1");
Int_t chanCount=0;
+ TH1F hisO("DINO","DINO",1024,0,1024);
+ TH1F his("DIN","DIN",1024,0,1024);
his.GetYaxis()->SetRangeUser(-20,90);
- Short_t *data = new Short_t[1014];
-
+ Short_t *data = new Short_t[1024];
+ TCanvas *c1 =0;
+ if (plotFlag) {
+ c1 = new TCanvas("c1","c1");
+ c1->SetGridx(); c1->SetGridy();
+ }
// event loop
Int_t ievent=0;
while (fReader->NextEvent()) {
+ if (fReader->GetRunNumber()>0) fRunNumber=fReader->GetRunNumber();
gSystem->Exec(Form("mkdir -p %s/raw%d/",fDDLFolderName.Data(),ievent));
GDC2DDLs(const_cast<AliRawVEvent*>(fReader->GetEvent()),ievent);
Int_t ddlC =0;
while (fDecoder->NextDDL()) {
Int_t ddlID=fDecoder->GetDDLNumber();
- printf("ddl: %d (%d)\n",ddlID,ddlC++);
+ printf("ddl: %d (%d/216)\n",ddlID,++ddlC);
- Bool_t *channelsDDL=fChannels+ddlID*4096 ;
- Short_t *adcsDDL =fADCs +ddlID*4096*1024;
- UInt_t *cdhDDL =fCDHs +ddlID*8 ;
- UInt_t *trailerDDL =fTrailers+ddlID*9 ;
+ Bool_t *channelsDDL=fChannels+ddlID*4096 ;
+ Short_t *adcsDDL =fADCs +ddlID*4096*1024 ;
+ UInt_t *cdhDDL =fCDHs +ddlID*8 ;
+ UInt_t *trailerDDL =fTrailers+ddlID*9 ;
// CDH
for (Int_t i=0;i<8;++i)
- // just to show how ugly it is...
- cdhDDL[i]=reinterpret_cast<UInt_t*>(const_cast<AliRawDataHeader*>(fReader->GetDataHeader()))[i];
+ // just to show how ugly it is...
+ cdhDDL[i]=reinterpret_cast<UInt_t*>(const_cast<AliRawDataHeader*>(fReader->GetDataHeader()))[i];
// PAYLOAD
while (fDecoder->NextChannel()) {
Int_t hwaddr=fDecoder->GetHWAddress();
+ Int_t sector=fDecoder->GetSector();
+ Int_t row=fDecoder->GetRow();
+ Int_t pad=fDecoder->GetPad();
Short_t *adcsChannel=adcsDDL+hwaddr*1024;
while (fDecoder->NextBunch()) {
UInt_t ts =fDecoder->GetStartTimeBin();
Short_t s=signals[ci];
Int_t t=ts-ci;
// TODO aqcuisition window
- if (20<=t&&t<=1014) {
+ if (0<=t&&t<(1024-3)) {
channelsDDL[hwaddr]=kTRUE;
if (adcsChannel[t]<0)
adcsChannel[t]=s;
}
}
-
- if (1) {
-
- // search start of aquisition
- Int_t t0 = 0; while (adcsChannel[t0]==-1) t0++;
- // search end of aquisition
- Int_t tE = 1014; while (adcsChannel[tE]==-1) tE--;
- // printf("S:%d E:%d\n",t0,tE);
+ // search start of aquisition
+ Int_t t0 = 0; while (adcsChannel[t0]==-1) t0++;
+ // search end of aquisition
+ Int_t tE = 1024; while (adcsChannel[tE]==-1) tE--;
- // SR TEST:
- // channel is complete - Perform Altro Emulation
- if (plotFlag && !(chanCount%1000)) {
- for (Int_t t=0; t<1014; t++) {
- his.SetBinContent(t+1,adcsChannel[t]);
- }
- his.SetStats(0); his.GetXaxis()->SetTitle("timebin");
- his.DrawCopy();
+ // channel is complete - Perform Altro Emulation
+ if (plotFlag!=0 && !(chanCount%plotFlag) ) {
+ for (Int_t t=0; t<1024; t++) {
+ his.SetBinContent(t+1,adcsChannel[t]);
}
- // FEED THE ALTRO EMULATOR WITH CLEAN SIGNAL (not aquisition window ghosts)
- Int_t timebins = tE-t0;
-
- for (Int_t t=t0;t<(t0+timebins);t++)
- data[t-t0]=adcsChannel[t];
- //SetChannelData(timebins, adcsChannel);//data);
- SetChannelData(timebins,data);
- RunEmulation(); // emulation on single channel
- for (Int_t t=t0;t<(t0+timebins);t++)
- adcsChannel[t]=data[t-t0];
+ his.SetTitle(Form("sig_sec%d_row%d_pad%d",sector,row,pad));
+ his.SetStats(0); his.GetXaxis()->SetTitle("timebin");
+ his.DrawCopy();
+ }
+
+ // FEED THE ALTRO EMULATOR WITH CLEAN SIGNAL (no aquisition-window ghosts)
+ Int_t timebins = tE-t0+1;
+ for (Int_t t=t0;t<(t0+timebins);t++)
+ data[t-t0]=adcsChannel[t];
+ SetChannelData(timebins,data);
+
+ Int_t roc = (sector%36)>=18; // 0 for IROC, 1 for OROC
+ RunEmulation(roc);
+ for (Int_t t=t0;t<(t0+timebins);t++)
+ adcsChannel[t]=data[t-t0];
- // SR TEST:
- if (plotFlag && !(chanCount%1000) ) {
- for (Int_t t=0; t<1014; t++)
- hisO.SetBinContent(t+1,adcsChannel[t]);
- hisO.SetStats(0); hisO.SetLineColor(2);
- hisO.DrawCopy("same");
+ if (plotFlag!=0 && !(chanCount%plotFlag) ) {
+ for (Int_t t=0; t<1024; t++)
+ hisO.SetBinContent(t+1,adcsChannel[t]);
+ hisO.SetStats(0); hisO.SetLineColor(2);
+ hisO.DrawCopy("same");
- c1.SaveAs(Form("/tmp/chanCount_%07d.png",chanCount));
+ c1->SaveAs(Form("%s/sig_sec%02d_row%02d_pad%03d_%s_%d%d%d%d%d.png",
+ fDDLFolderName.Data(),sector,row,pad,
+ fOutputRootFileName.Data(),
+ fOnBSL1,fOnTCF,fOnBSL2,fOnClip,fOnZSU));
- his.Reset();
- hisO.Reset();
+ his.Reset();
+ hisO.Reset();
- }
- chanCount++;
}
+ chanCount++;
}
UChar_t *rcuTrailer;
fDecoder->GetRCUTrailerData(rcuTrailer);
for (Int_t i=0;i<= /* (!) */ fDecoder->GetRCUTrailerSize()/4;++i)
- trailerDDL[i]=reinterpret_cast<UInt_t*>(rcuTrailer)[i]; // again: UGLY!
+ trailerDDL[i]=reinterpret_cast<UInt_t*>(rcuTrailer)[i]; // again: UGLY!
}
- WriteEvent(ievent++);
+ if (ddlC>0) WriteEvent(ievent++);
}
- delete data; // free space
+ delete[] data; // free space
// convert to date and back
ConvertRawFilesToDate(ievent);