StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StEEmcQAMaker.cxx
1 #include "StEEmcQAMaker.h"
2 ClassImp(StEEmcQAMaker);
3 
4 #include "TH1F.h"
5 #include "TH2F.h"
6 #include "TString.h"
7 
8 #include "StMuDSTMaker/COMMON/StMuDstMaker.h"
9 #include "StMuDSTMaker/COMMON/StMuDst.h"
10 #include "StMuDSTMaker/COMMON/StMuEvent.h"
11 #include "StMuDSTMaker/COMMON/StMuPrimaryVertex.h"
12 #include "StMuDSTMaker/COMMON/StMuTriggerIdCollection.h"
13 
14 #include "StEEmcPool/StMaxStripPi0/StEEmcA2EMaker.h"
15 
16 // ----------------------------------------------------------------------------
17 StEEmcQAMaker::StEEmcQAMaker( const Char_t *name ) : StMaker(name)
18 {
19  nVertexMin = 1;
20  nVertexMax = 999;
21  zVertexMin = -150;
22  zVertexMax = +150;
23  mSamplingFractionT=0.04;
24  mSamplingFractionP=0.007;
25  mSamplingFractionQ=0.007;
26  mSamplingFractionR=0.007;
27  mSamplingFractionU=0.007;
28  mSamplingFractionV=0.007;
29 }
30 
31 // ----------------------------------------------------------------------------
32 Int_t StEEmcQAMaker::Init()
33 {
34 
35 
36  hEventCounter = new TH1F("hEventCounter","Event counts",10,0.,10.);
37  hEventCounter -> GetXaxis() -> SetBinLabel(1,"raw event");
38  hEventCounter -> GetXaxis() -> SetBinLabel(2,"triggered");
39  hEventCounter -> GetXaxis() -> SetBinLabel(3,"|vertex|<cut");
40  hEventCounter -> GetXaxis() -> SetBinLabel(4,"track cuts");
41  hEventCounter -> GetXaxis() -> SetBinLabel(5,"eemc response");
42 
43 
44  hFrequencyT=new TH2F("hFrequencyT","Tower frequency",60,0.,60.,12,0.,12.);
45  hFrequencyP=new TH2F("hFrequencyP","Pre1 frequency",60,0.,60.,12,0.,12.);
46  hFrequencyQ=new TH2F("hFrequencyQ","Pre2 frequency",60,0.,60.,12,0.,12.);
47  hFrequencyR=new TH2F("hFrequencyR","Post frequency",60,0.,60.,12,0.,12.);
48 
49  for ( UInt_t trig=0;trig<mTriggerList.size();trig++ )
50  {
51  TString hname="hTrigId";hname+=mTriggerList[trig];
52  TString htitle="Triggers analysed per sector [0,12)";
53  hTriggers.push_back(new TH1F(hname,htitle,12,0.,12.));
54  }
55  // UInt_t trig=mTriggerList.size();
56  hTriggers.push_back(new TH1F("hTrigOr","Any trigger in trigger list [0,12)",12,0.,12.));
57 
58 
59 
60  const Char_t *secname[]={
61  "[0]","[1]","[2]","[3]","[4]","[5]","[6]","[7]","[8]","[9]",
62  "[10]","[11]","Full","Cut"};
63 
64 
65 
66  for ( Int_t sec=0;sec<14;sec++ )
67  {
68 
69  TString hname="hEnergyDeposit";
70  TString htitle="EM Energy [GeV] summed over towers in sector ";
71 
72  htitle+=secname[sec];
73  hEnergyDepositT.push_back(new TH1F(hname+"T"+secname[sec],htitle,60,0.,60.));
74  htitle="Energy deposit [MeV] summed over towers in sector ";
75  hEnergyDepositP.push_back(new TH1F(hname+"P"+secname[sec],htitle,50,0.,200.));
76  hEnergyDepositQ.push_back(new TH1F(hname+"Q"+secname[sec],htitle,50,0.,200.));
77  hEnergyDepositR.push_back(new TH1F(hname+"R"+secname[sec],htitle,50,0.,200.));
78  htitle.ReplaceAll("towers","smd strips");
79  hEnergyDepositU.push_back(new TH1F(hname+"U"+secname[sec],htitle,50,0.,400.));
80  hEnergyDepositV.push_back(new TH1F(hname+"V"+secname[sec],htitle,50,0.,400.));
81 
82 
83  hname.ReplaceAll("EnergyDeposit","Multiplicity");
84  htitle="Sector multiplicity ";htitle+=secname[sec];
85 
86  hMultiplicityT.push_back(new TH1F(hname+"T"+secname[sec],htitle,60,0.,60.));
87  hMultiplicityP.push_back(new TH1F(hname+"P"+secname[sec],htitle,60,0.,60.));
88  hMultiplicityQ.push_back(new TH1F(hname+"Q"+secname[sec],htitle,60,0.,60.));
89  hMultiplicityR.push_back(new TH1F(hname+"R"+secname[sec],htitle,60,0.,60.));
90  hMultiplicityU.push_back(new TH1F(hname+"U"+secname[sec],htitle,60,0.,60.));
91  hMultiplicityV.push_back(new TH1F(hname+"V"+secname[sec],htitle,60,0.,60.));
92 
93 
94  hname="hAdc";
95  htitle="ADC-ped in ";htitle+=secname[sec];
96 
97  hAdcT.push_back(new TH1F(hname+"T"+secname[sec],htitle,512,0.,512.));
98  hAdcP.push_back(new TH1F(hname+"P"+secname[sec],htitle,512,0.,512.));
99  hAdcQ.push_back(new TH1F(hname+"Q"+secname[sec],htitle,512,0.,512.));
100  hAdcR.push_back(new TH1F(hname+"R"+secname[sec],htitle,512,0.,512.));
101  hAdcU.push_back(new TH1F(hname+"U"+secname[sec],htitle,512,0.,512.));
102  hAdcV.push_back(new TH1F(hname+"V"+secname[sec],htitle,512,0.,512.));
103 
104 
105  hname="hNglobal";hname+=secname[sec];
106  hNglobal.push_back(new TH1F(hname,"Number of global tracks",50,0.,50.));
107  hname="hNprimary";hname+=secname[sec];
108  hNprimary.push_back(new TH1F(hname,"Number of primary tracks",50,0.,50.));
109  hname="hNvertex";hname+=secname[sec];
110  hNvertex.push_back(new TH1F(hname,"Number of primary vertices",10,0.,10.));
111  hname="hZvertex";hname+=secname[sec];
112  hZvertex.push_back(new TH1F(hname,"Z of 1st primary vertex",200,-200.,200.));
113  hname="hZvertexErr";hname+=secname[sec];
114  hZvertexErr.push_back(new TH1F(hname,"Z err of 1st primary vertex",200,-200.,200.));
115  hname="hRankVertex";hname+=secname[sec];
116  hRankVertex.push_back(new TH1F(hname,"Ranking of 1st primary vertex",100,0.,100.));
117  hname="hNtrackVertex";hname+=secname[sec];
118  hNtrackVertex.push_back(new TH1F(hname,"Number of tracks used 1st prim vert",25,0.,25.));
119  hname="hNtrackVertexEE";hname+=secname[sec];
120  hNtrackVertexEE.push_back(new TH1F(hname,"Number of tracks used 1st prim vert macthed to eemc",25,0.,25.));
121  hname="hPTsumVertex";hname+=secname[sec];
122  hPTsumVertex.push_back(new TH1F(hname,"Scalar pT sum of tracks used 1st prim vertex [GeV]",100,0.,100.));
123 
124  }
125 
126 
127  return StMaker::Init();
128 
129 }
130 
131 // ----------------------------------------------------------------------------
132 Int_t StEEmcQAMaker::Make()
133 {
134 
136  hEventCounter -> Fill( 0 );
137 
139  if ( !CheckTriggers() ) return kStOK;
140  hEventCounter -> Fill( 1 );
141 
143  if ( !CheckVertex() ) return kStOK;
144  hEventCounter -> Fill( 2 );
145 
147  if ( !CheckTracks() ) return kStOK;
148  hEventCounter -> Fill( 3 );
149 
151  if ( !EEmcResponse() ) return kStOK;
152  hEventCounter -> Fill ( 4 );
153 
154 
155  return kStOK;
156 }
157 
158 // ----------------------------------------------------------------------------
159 void StEEmcQAMaker::Clear(Option_t *opts)
160 {
161 
162 }
163 // ----------------------------------------------------------------------------
164 void StEEmcQAMaker::analysis(const Char_t *name)
165 {
166  mEEanalysis=(StEEmcA2EMaker *)GetMaker(name);
167  assert(mEEanalysis);
168 }
169 // ----------------------------------------------------------------------------
170 void StEEmcQAMaker::mudst(const Char_t *name)
171 {
172  mMuDst=(StMuDstMaker*)GetMaker(name);
173  assert(mMuDst);
174 }
175 
176 
177 
178 
179 
180 
181 // ----------------------------------------------------------------------------
183 {
184 
186  StMuEvent *event = mMuDst -> muDst() -> event();
187  assert(event);
188 
189  mSectorTrigger = -1;
190 
192  StMuTriggerIdCollection tic = event -> triggerIdCollection();
193  StTriggerId l1trig = tic.l1();
194 
197  if ( ht.fail() ) return false;
198 
200  Bool_t go=false;
201  if ( mTriggerList.size() == 0 ) go = true; // no triggers requested
202  for ( UInt_t i=0;i<mTriggerList.size();i++ )
203  {
204  Int_t myId = mTriggerList[i];
205  if ( l1trig.isTrigger( myId ) ) {
206  go=true;
207  hTriggers[i] -> Fill ( ht.sector() );
208  mSectorTrigger = ht.sector();
209  }
210  }
211  if ( go ) hTriggers[ mTriggerList.size() ] -> Fill( ht.sector() );
212 
213  return go;
214 }
215 
216 
217 
218 
219 
220 
221 // ----------------------------------------------------------------------------
223 {
224 
225 
226  StMuEvent *event = mMuDst -> muDst() -> event();
227  assert(event);
228  Bool_t go = false;
229 
231  if ( mSectorTrigger < 0 ) return false;
232 
235  if ( ht.fail() ) return false;
236 
237 
238  Int_t numberOfVertices=mMuDst -> muDst() -> numberOfPrimaryVertices();
239  hNvertex[ mSectorTrigger ] -> Fill( numberOfVertices );
240  hNvertex[ 12 ] -> Fill( numberOfVertices );
241  if ( numberOfVertices < nVertexMin ||
242  numberOfVertices > nVertexMax ) return false;
243  hNvertex[ 13 ] -> Fill( numberOfVertices );
244 
247  if ( !numberOfVertices ) return true;
248 
250  StMuPrimaryVertex *vertex = mMuDst -> muDst() -> primaryVertex(0);
251  Float_t zvertex=vertex->position().z();
252  hZvertex[ mSectorTrigger ] -> Fill ( zvertex );
253  hZvertex[ 12 ] -> Fill( zvertex );
254  if ( zvertex < zVertexMin || zvertex > zVertexMax ) return false;
255  hZvertex[ 13 ] -> Fill( zvertex );
256 
257 
258  Float_t ezvertex = vertex->posError().z();
259  hZvertexErr[ mSectorTrigger ] -> Fill( ezvertex );
260  hZvertexErr[ 12 ] -> Fill( ezvertex );
261 
262 
264  Float_t rank = vertex -> ranking();
265  hRankVertex[ mSectorTrigger ] -> Fill ( rank );
266  hRankVertex[ 12 ] -> Fill ( rank );
267 
268 
270  Int_t ntrack = vertex -> nTracksUsed();
271  hNtrackVertex[ mSectorTrigger ] -> Fill( ntrack );
272  hNtrackVertex[ 12 ] -> Fill( ntrack );
273 
274 
275  ntrack = vertex -> nEEMCMatch();
276  hNtrackVertexEE[ mSectorTrigger ] -> Fill( ntrack );
277  hNtrackVertexEE[ 12 ] -> Fill( ntrack );
278 
279 
281  Float_t ptsum = vertex -> sumTrackPt();
282  hPTsumVertex[ mSectorTrigger ] -> Fill( ptsum );
283  hPTsumVertex[ 12 ] -> Fill( ptsum );
284 
285  return go;
286 }
287 
288 
289 // ----------------------------------------------------------------------------
291 {
292 
295  if ( ht.fail() ) return false;
296 
297  if ( mSectorTrigger < 0 ) return false;
298 
300  Int_t nGlobal=mMuDst->muDst()->numberOfGlobalTracks();
301  hNglobal[ mSectorTrigger ] -> Fill( nGlobal );
302  hNglobal[ 12 ] -> Fill( nGlobal );
303 
305  Int_t nPrimary=mMuDst->muDst()->numberOfPrimaryTracks();
306  hNprimary[ mSectorTrigger ] -> Fill( nPrimary );
307  hNprimary[ 12 ] -> Fill( nPrimary );
308 
309  return true;
310 }
311 
312 
313 
314 
315 
316 
317 // ----------------------------------------------------------------------------
319 {
320 
321  Int_t mysector = mSectorTrigger;
322 
325  if ( ht.fail() ) return false;
326 
327  if ( mysector < 0 ) return false;
328 
329  // Int_t ht_sec = ht.sector();
330  Int_t ht_phi = ht.phibin();
331  Int_t ht_eta = ht.etabin();
332 
334  hFrequencyT -> Fill( ht_phi, ht_eta );
335 
336  StEEmcTower pre1 = mEEanalysis->hightower(1);
337  StEEmcTower pre2 = mEEanalysis->hightower(2);
338  StEEmcTower post = mEEanalysis->hightower(3);
339  hFrequencyP -> Fill ( pre1.phibin(), pre1.etabin() );
340  hFrequencyQ -> Fill ( pre2.phibin(), pre2.etabin() );
341  hFrequencyR -> Fill ( post.phibin(), post.etabin() );
342 
344  Float_t energy_deposit[6];
345  for ( Int_t i=0;i<6;i++ )
346  {
347  energy_deposit[i] = mEEanalysis->energy( mysector, i );
348  }
350  // energy_deposit[0] *= mSamplingFractionT * 1000.0;
351  for ( Int_t i=1;i<6;i++ )
352  energy_deposit[i] *= 1000.0;
353 
354  hEnergyDepositT[mysector]->Fill( energy_deposit[0] );
355  hEnergyDepositP[mysector]->Fill( energy_deposit[1] );
356  hEnergyDepositQ[mysector]->Fill( energy_deposit[2] );
357  hEnergyDepositR[mysector]->Fill( energy_deposit[3] );
358  hEnergyDepositU[mysector]->Fill( energy_deposit[4] );
359  hEnergyDepositV[mysector]->Fill( energy_deposit[5] );
360 
361  hMultiplicityT[mysector]->Fill( mEEanalysis->numberOfHits(mysector,0) );
362  hMultiplicityP[mysector]->Fill( mEEanalysis->numberOfHits(mysector,1) );
363  hMultiplicityQ[mysector]->Fill( mEEanalysis->numberOfHits(mysector,2) );
364  hMultiplicityR[mysector]->Fill( mEEanalysis->numberOfHits(mysector,3) );
365  hMultiplicityU[mysector]->Fill( mEEanalysis->numberOfHits(mysector,4) );
366  hMultiplicityV[mysector]->Fill( mEEanalysis->numberOfHits(mysector,5) );
367 
368  for ( Int_t sub=0;sub<5; sub++ )
369  for ( Int_t eta=0;eta<12;eta++ )
370  {
371  StEEmcTower t=mEEanalysis->tower(mysector,sub,eta,0);
372  if ( t.adc()>0. && !t.fail() ) hAdcT[ mysector ] -> Fill ( t.adc() );
373  t=mEEanalysis->tower(mysector,sub,eta,1);
374  if ( t.adc()>0. && !t.fail() ) hAdcP[ mysector ] -> Fill ( t.adc() );
375  t=mEEanalysis->tower(mysector,sub,eta,2);
376  if ( t.adc()>0. && !t.fail() ) hAdcQ[ mysector ] -> Fill ( t.adc() );
377  t=mEEanalysis->tower(mysector,sub,eta,3);
378  if ( t.adc()>0. && !t.fail() ) hAdcR[ mysector ] -> Fill ( t.adc() );
379  }
380  for (Int_t hit=0;hit<mEEanalysis->numberOfHitStrips(mysector,0);hit++ )
381  {
382  StEEmcStrip strip=mEEanalysis->hitstrip(mysector,0,hit);
383  if ( strip.fail() || strip.energy()<=0. ) continue;
384  hAdcU[mysector]->Fill( strip.adc() );
385  }
386 
387  for (Int_t hit=0;hit<mEEanalysis->numberOfHitStrips(mysector,1);hit++ )
388  {
389  StEEmcStrip strip=mEEanalysis->hitstrip(mysector,1,hit);
390  if ( strip.fail() || strip.energy()<=0. ) continue;
391  hAdcV[mysector]->Fill( strip.adc() );
392  }
393 
394 
395  return true;
396 }
Float_t zVertexMax
Definition: StEEmcQAMaker.h:33
std::vector< TH1F * > hZvertexErr
Error on z vertex.
std::vector< Int_t > mTriggerList
List of triggers to process.
Definition: StEEmcQAMaker.h:51
std::vector< TH1F * > hAdcT
ADC.
EEmc ADC –&gt; energy maker.
TH1F * hEventCounter
Histogram for counting events.
Definition: StEEmcQAMaker.h:59
Bool_t CheckTracks()
std::vector< TH1F * > hZvertex
Z vertex.
std::vector< TH1F * > hMultiplicityT
[MeV]
Definition: StEEmcQAMaker.h:93
std::vector< TH1F * > hMultiplicityU
Multiplicity in layer.
StMuDst * muDst()
Definition: StMuDstMaker.h:425
void mudst(const Char_t *name)
sets pointer to the muDst maker
std::vector< TH1F * > hAdcR
ADC.
std::vector< TH1F * > hAdcV
ADC.
std::vector< TH1F * > hEnergyDepositU
Energy deposited in layer.
Definition: StEEmcQAMaker.h:88
Float_t mSamplingFractionU
SMD sampling fraction.
Definition: StEEmcQAMaker.h:42
std::vector< TH1F * > hEnergyDepositP
Energy deposited in layer.
Definition: StEEmcQAMaker.h:82
std::vector< TH1F * > hAdcP
ADC.
std::vector< TH1F * > hAdcQ
ADC.
Float_t zVertexMin
Definition: StEEmcQAMaker.h:32
std::vector< TH1F * > hEnergyDepositR
Energy deposited in layer.
Definition: StEEmcQAMaker.h:86
void analysis(const Char_t *name)
sets pointer to adc–&gt;energy maker
Int_t mSectorTrigger
Definition: StEEmcQAMaker.h:68
StEEmcStrip & hitstrip(Int_t sec, Int_t pl, Int_t hit)
Int_t numberOfHitStrips(Int_t sector, Int_t plane) const
std::vector< TH1F * > hNtrackVertexEE
Number of tracks matched to eemc and vertex.
std::vector< TH1F * > hMultiplicityV
Multiplicity in layer.
TH2F * hFrequencyQ
Frequency pre2 is highest on EEMC.
Definition: StEEmcQAMaker.h:75
Int_t etabin() const
Returns the etabin of this tower, pre- or postshower element.
Definition: StEEmcTower.h:45
Bool_t EEmcResponse()
TH2F * hFrequencyR
Frequency post is highest on EEMC.
Definition: StEEmcQAMaker.h:77
void fail(unsigned f)
Set a fail bit for this element.
Definition: StEEmcElement.h:25
StMuDstMaker * mMuDst
MuDst.
Definition: StEEmcQAMaker.h:49
std::vector< TH1F * > hNtrackVertex
Number of tracks matched to vertex.
Bool_t CheckTriggers()
StEEmcA2EMaker * mEEanalysis
ADC –&gt; Energy.
Definition: StEEmcQAMaker.h:47
std::vector< TH1F * > hPTsumVertex
Scalar sum of PT of tracks associated with vertex.
std::vector< TH1F * > hEnergyDepositT
Energy deposited in layer.
Definition: StEEmcQAMaker.h:80
Bool_t CheckVertex()
Float_t energy(Int_t sector, Int_t layer) const
std::vector< TH1F * > hMultiplicityP
Multiplicity in layer.
Definition: StEEmcQAMaker.h:95
std::vector< TH1F * > hTriggers
Histograms for counting triggers (one per trigger ID)
Definition: StEEmcQAMaker.h:62
TH2F * hFrequencyT
Frequency tower is highest on EEMC.
Definition: StEEmcQAMaker.h:71
Base class for representing tower, preshower and postshower elements.
Definition: StEEmcTower.h:11
StEEmcTower & hightower(Int_t layer=0)
std::vector< TH1F * > hAdcU
ADC.
TH2F * hFrequencyP
Frequency pre1 is highest on EEMC.
Definition: StEEmcQAMaker.h:73
Int_t sector() const
Returns sector of this tower, pre- or postshower element.
Definition: StEEmcTower.h:41
std::vector< TH1F * > hEnergyDepositQ
Energy deposited in layer.
Definition: StEEmcQAMaker.h:84
Definition: Stypes.h:40
std::vector< TH1F * > hNglobal
Number of global tracks.
Example of QA histograming using the StEEmcA2EMaker.
Definition: StEEmcQAMaker.h:12
Int_t phibin() const
Returns the phibin of this tower.
Definition: StEEmcTower.h:47
void adc(Float_t a)
Set the pedestal-subtracted ADC for this element.
Definition: StEEmcElement.h:19
std::vector< TH1F * > hMultiplicityR
Multiplicity in layer.
Definition: StEEmcQAMaker.h:99
std::vector< TH1F * > hMultiplicityQ
Multiplicity in layer.
Definition: StEEmcQAMaker.h:97
std::vector< TH1F * > hEnergyDepositV
Energy deposited in layer.
Definition: StEEmcQAMaker.h:90
virtual Int_t Make()
Process one event.
StEEmcTower & tower(Int_t index, Int_t layer=0)
std::vector< TH1F * > hNprimary
Number of primary tracks.
virtual Int_t Init()
Initialize the maker.
void energy(Float_t e)
Set the energy (adc-ped+0.5)/gain for this element.
Definition: StEEmcElement.h:21
std::vector< TH1F * > hNvertex
Number of vertices.
std::vector< TH1F * > hRankVertex
Rank of vertex.
Base class for describing an endcap SMD strip.
Definition: StEEmcStrip.h:8
Collection of trigger ids as stored in MuDst.
void Clear(Option_t *opts="")
User defined functions.
Float_t mSamplingFractionT
Tower sampling fraction.
Definition: StEEmcQAMaker.h:40
Int_t nVertexMax
Cuts on primary vertex (see constructor for defaults)
Definition: StEEmcQAMaker.h:30
Float_t mSamplingFractionV
SMD sampling fraction.
Definition: StEEmcQAMaker.h:44
Int_t numberOfHits(Int_t sector, Int_t layer) const