40 class StFgtCosmicMaker;
47 StFgtCosmicMaker *cosmicMkr = 0;
61 Int_t simpleFgtCosmicQA(
const Char_t *filename =
"testfile.sfs",
62 const Char_t *pedfilename =
"testfile.Ped.txt",
65 const Char_t *runname =
"testrun",
66 const Char_t *quadname =
"010",
73 cout <<
"Constructing the ped plotter" << endl;
75 pedPlotterC->setReadFromFile( pedfilename );
76 pedPlotterC->setTimeBinMask( 1<<timeBin );
77 pedPlotterC->setPlotVsStrip(
'c' );
78 pedPlotterC->setDisc( disc );
79 pedPlotterC->setQuad( quad );
80 pedPlotterC->setQuadName( quadname );
83 pedPlotterR->setReadFromFile( pedfilename );
84 pedPlotterR->setTimeBinMask( 1<<timeBin );
85 pedPlotterR->setPlotVsStrip(
'R' );
86 pedPlotterR->setDisc( disc );
87 pedPlotterR->setQuad( quad );
88 pedPlotterR->setQuadName( quadname );
91 pedPlotterP->setReadFromFile( pedfilename );
92 pedPlotterP->setTimeBinMask( 1<<timeBin );
93 pedPlotterP->setPlotVsStrip(
'P' );
94 pedPlotterP->setDisc( disc );
95 pedPlotterP->setQuad( quad );
96 pedPlotterP->setQuadName( quadname );
98 cout <<
"making the graphs" << endl;
99 ierr = pedPlotterR->makePlots();
100 ierr &= pedPlotterP->makePlots();
101 ierr &= pedPlotterC->makePlots();
107 cout <<
"Constructing the chain" << endl;
108 analysisChain =
new StChain(
"eemcAnalysisChain");
110 cout <<
"Constructing the cosmic maker" << endl;
111 cosmicMkr =
new StFgtCosmicMaker(
"cosmicMaker", filename );
112 cout <<
"constructing raw maker" <<endl;
114 cout <<
"done" <<endl;
115 cosmicMkr->setNumDiscs( numDiscs );
120 cout <<
"Constructing the QA makers" << endl;
122 Float_t sansPedYmax = 512;
123 Float_t sansPedYmin = -512;
124 Int_t sansPedYbins = (sansPedYmax-sansPedYmin)/8;
127 Int_t binFactorXc = 8, binFactorXr = 2, binFactorXp = 4, binFactorY = 32;
130 adcVsChan->setTimeBin( timeBin );
131 adcVsChan->setFilenameBase(
"" );
132 adcVsChan->setToPlotVsStrip(
'c' );
133 adcVsChan->setToSubtrPeds( 0 );
134 adcVsChan->setBinFactors( binFactorXc, binFactorY );
137 adcVsR->setTimeBin( timeBin );
138 adcVsR->setFilenameBase(
"" );
139 adcVsR->setToPlotVsStrip(
'R' );
140 adcVsR->setToSubtrPeds( 0 );
141 adcVsR->setBinFactors( binFactorXr, binFactorY );
144 adcVsPhi->setTimeBin( timeBin );
145 adcVsPhi->setFilenameBase(
"" );
146 adcVsPhi->setToPlotVsStrip(
'P' );
147 adcVsPhi->setToSubtrPeds( 0 );
148 adcVsPhi->setBinFactors( binFactorXp, binFactorY );
150 adcSansPedVsChan =
new StFgtQaAdcVsChannel(
"fgtQaAdc_4",
"cosmicMaker", disc, quad, quadname );
151 adcSansPedVsChan->setTimeBin( timeBin );
152 adcSansPedVsChan->setFilenameBase(
"" );
153 adcSansPedVsChan->setToPlotVsStrip(
'c' );
154 adcSansPedVsChan->setToSubtrPeds( 1 );
155 adcSansPedVsChan->setPedReaderFile( pedfilename );
157 adcSansPedVsChan->setYbins( sansPedYbins );
158 adcSansPedVsChan->setYrange( sansPedYmin, sansPedYmax );
159 adcSansPedVsChan->setBinFactors( binFactorXc, 1 );
161 adcSansPedVsR =
new StFgtQaAdcVsChannel(
"fgtQaAdc_5",
"cosmicMaker", disc, quad, quadname );
162 adcSansPedVsR->setTimeBin( timeBin );
163 adcSansPedVsR->setFilenameBase(
"" );
164 adcSansPedVsR->setToPlotVsStrip(
'R' );
165 adcSansPedVsR->setToSubtrPeds( 1 );
166 adcSansPedVsR->setPedReaderFile( pedfilename );
168 adcSansPedVsR->setYbins( sansPedYbins );
169 adcSansPedVsR->setYrange( sansPedYmin, sansPedYmax );
170 adcSansPedVsR->setBinFactors( binFactorXr, 1 );
172 adcSansPedVsPhi =
new StFgtQaAdcVsChannel(
"fgtQaAdc_6",
"cosmicMaker", disc, quad, quadname );
173 adcSansPedVsPhi->setTimeBin( timeBin );
174 adcSansPedVsPhi->setFilenameBase(
"" );
175 adcSansPedVsPhi->setToPlotVsStrip(
'P' );
176 adcSansPedVsPhi->setToSubtrPeds( 1 );
177 adcSansPedVsPhi->setPedReaderFile( pedfilename );
179 adcSansPedVsPhi->setYbins( sansPedYbins );
180 adcSansPedVsPhi->setYrange( sansPedYmin, sansPedYmax );
181 adcSansPedVsPhi->setBinFactors( binFactorXp, 1 );
183 cout <<
"Initializing" << endl;
184 ierr = analysisChain->Init();
185 cout <<
"\t done initializing" << endl;
188 cout <<
"Error initializing" << endl;
195 cout <<
"Looping over events..." << endl;
196 for(
int i=0; i<nevents && !ierr; ++i ){
199 cout <<
"event number " << i << endl;
202 analysisChain->
Clear();
205 ierr = analysisChain->
Make();
207 if( cosmicMkr->atEOF() )
211 cout <<
"Making plots..." << endl;
214 TH2F* hAdcVsChan = adcVsChan->getHist();
215 TH2F* hAdcVsR = adcVsR->getHist();
216 TH2F* hAdcVsPhi = adcVsPhi->getHist();
217 TH2F* hAdcSansPedVsChan = adcSansPedVsChan->getHist();
218 TH2F* hAdcSansPedVsR = adcSansPedVsR->getHist();
219 TH2F* hAdcSansPedVsPhi = adcSansPedVsPhi->getHist();
224 gROOT->SetStyle(
"Plain");
225 gStyle->SetOptStat(0);
226 gStyle->SetEndErrorSize(0);
227 gStyle->SetTitleBorderSize(0);
228 gStyle->SetTitleTextColor(kRed);
230 Float_t maxY = pedPlotterC->getMaxY()*1.05;
232 TH2F *histC =
new TH2F (
"histC",
"", 1, 0, 1280, 1, 0, maxY );
233 TH2F *histR =
new TH2F (
"histR",
"", 1, 10, 40, 1, 0, maxY );
234 TH2F *histP =
new TH2F (
"histP",
"", 1, 0, 1.571, 1, 0, maxY );
236 TH2F* hAdcArray[9] = { hAdcVsChan, hAdcVsR, hAdcVsPhi,
238 hAdcSansPedVsChan, hAdcSansPedVsR, hAdcSansPedVsPhi };
240 TGraphErrors* grArray[3] = { 0, 0, 0 };
241 grArray[0] = pedPlotterC->getGraph( timeBin );
242 grArray[1] = pedPlotterR->getGraph( timeBin );
243 grArray[2] = pedPlotterP->getGraph( timeBin );
245 gROOT->SetStyle(
"Plain");
246 TCanvas *can =
new TCanvas(
"fgtQAcan",
"fgtQAcan", 1800, 1200 );
248 gStyle->SetOptStat(0);
249 gStyle->SetPalette(1);
252 for( Int_t i=0; i<9; ++i ){
254 gPad->SetRightMargin( 0.02 );
255 gPad->SetLeftMargin( 0.13 );
257 hAdcArray[i]->GetYaxis()->SetTitleOffset( 1.55 );
260 hAdcArray[i]->SetMaximum( 200 );
261 hAdcArray[i]->Draw(
"COLZ");
263 hAdcArray[i]->SetTitle( grArray[i-3]->GetTitle() );
264 hAdcArray[i]->Draw(
"H");
265 grArray[i-3]->SetLineColor( kBlue );
266 grArray[i-3]->Draw(
"PE same");
268 hAdcArray[i]->SetMaximum( 100 );
269 hAdcArray[i]->Draw(
"COLZ");
273 cout <<
"ready to save" << endl;
275 std::string fileOut =
"simpleFgtCosmicQA.";
282 cout <<
"\tsaving to '" << fileOut <<
"'" << endl;
283 can->Print( fileOut.data() );
288 cout <<
"finish" << endl;
291 cout <<
"all done" << endl;
300 gSystem->Load(
"libPhysics");
301 gSystem->Load(
"St_base");
302 gSystem->Load(
"StChain");
303 gSystem->Load(
"StEvent");
304 cout <<
"loaded StEvent library" << endl;
306 gSystem->Load(
"StFgtUtil");
307 gSystem->Load(
"StFgtRawMaker");
308 gSystem->Load(
"RTS");
309 gSystem->Load(
"StFgtPedMaker");
310 gSystem->Load(
"StFgtQaMakers");
311 gSystem->Load(
"StFgtPedPlotter");
virtual void Clear(Option_t *option="")
User defined functions.