24 class StFgtCosmicMaker;
25 class StFgtCorAdcMaker;
29 StFgtCosmicMaker *cosmicMkr = 0;
30 StFgtCorAdcMaker *adcCorrector = 0;
35 Int_t makeADCplot(
const Char_t *filename =
"testfile.sfs",
36 const Char_t *pedfilename =
"testfile.Ped.txt",
39 Char_t plotVsStrip =
'c',
41 const Char_t *runname =
"testrun",
42 const Char_t *quadname =
"010",
49 Short_t timeBinMask = (1<<timeBin);
51 cout <<
"Constructing the chain" << endl;
52 analysisChain =
new StChain(
"eemcAnalysisChain");
54 cout <<
"Constructing the cosmic maker" << endl;
55 cosmicMkr =
new StFgtCosmicMaker(
"cosmicMaker", filename );
56 cosmicMkr->setNumDiscs( numDiscs );
58 cout <<
"Constructing the ADC corrector" << endl;
62 adcCorrector =
new StFgtCorAdcMaker(
"adcCorrector",
"cosmicMaker" );
63 adcCorrector->setPedReaderFile( pedfilename );
64 adcCorrector->setTimeBinMask( timeBinMask );
65 adcCorrector->setAbsThres( -10000 );
66 adcCorrector->setRelThres( 0 );
67 adcCorrector->doSubtrPeds( subtrPeds );
68 adcCorrector->doRemoveOtherTimeBins( 1 );
70 cout <<
"Constructing the QA maker" << endl;
73 Int_t binFactorX = 8, binFactorY = 32;
74 Float_t sansPedYmax = 1024;
75 Float_t sansPedYmin = -512;
76 Int_t sansPedYbins = 4096/binFactorY;
78 if( plotVsStrip ==
'R' || plotVsStrip ==
'r' )
80 else if ( plotVsStrip ==
'P' )
87 adcPlotter->setTimeBin( timeBin );
88 adcPlotter->setFilenameBase(
"" );
89 adcPlotter->setToPlotVsStrip( plotVsStrip );
90 adcPlotter->setToSubtrPeds( 0 );
91 adcPlotter->setBinFactors( binFactorX, binFactorY );
93 adcPlotter->setYbins( sansPedYbins );
94 adcPlotter->setYrange( sansPedYmin, sansPedYmax );
97 cout <<
"Initializing" << endl;
98 ierr = analysisChain->Init();
99 cout <<
"\t done initializing" << endl;
102 cout <<
"Error initializing" << endl;
109 cout <<
"Looping over events..." << endl;
110 for(
int i=0; i<nevents && !ierr; ++i ){
112 if( (i+1)%1000 == 1 )
113 cout <<
"event number " << i << endl;
116 analysisChain->
Clear();
119 ierr = analysisChain->
Make();
121 if( cosmicMkr->atEOF() )
125 cout <<
"Making plots..." << endl;
128 TH2F* hAdc = adcPlotter->getHist();
130 gROOT->SetStyle(
"Plain");
131 gStyle->SetOptStat(0);
132 gStyle->SetEndErrorSize(0);
133 gStyle->SetTitleBorderSize(0);
134 gStyle->SetTitleTextColor(kRed);
138 if( plotVsStrip ==
'R' || plotVsStrip ==
'r' || plotVsStrip ==
'P' ){
143 gROOT->SetStyle(
"Plain");
144 TCanvas *can =
new TCanvas(
"fgtQAcan",
"Fgt Cosmic QA", width, height );
146 gStyle->SetOptStat(0);
147 gStyle->SetPalette(1);
153 hAdc->SetMaximum( subtrPeds ? 100 : 200 );
156 cout <<
"ready to save" << endl;
158 std::string fileOut =
"fgtCQA.ADCplot.";
164 cout <<
"\tsaving to '" << fileOut <<
"'" << endl;
165 can->Print( fileOut.data() );
167 TFile *f =
new TFile (
"testfile.root",
"RECREATE");
174 cout <<
"finish" << endl;
177 cout <<
"all done" << endl;
186 gSystem->Load(
"libPhysics");
187 gSystem->Load(
"St_base");
188 gSystem->Load(
"StChain");
189 gSystem->Load(
"StEvent");
190 cout <<
"loaded StEvent library" << endl;
192 gSystem->Load(
"StFgtUtil");
193 gSystem->Load(
"StFgtRawMaker");
194 gSystem->Load(
"RTS");
195 gSystem->Load(
"StFgtPedMaker");
196 gSystem->Load(
"StFgtQaMakers");
197 gSystem->Load(
"StFgtCorAdcMaker");
virtual void Clear(Option_t *option="")
User defined functions.