StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StEEmcQAMaker.cxx
1 
13 #include "StEEmcQAMaker.h"
14 ClassImp(StEEmcQAMaker);
15 
16 #include "TH1F.h"
17 #include "TH2F.h"
18 #include "TString.h"
19 
20 #include "StMuDSTMaker/COMMON/StMuDstMaker.h"
21 #include "StMuDSTMaker/COMMON/StMuDst.h"
22 #include "StMuDSTMaker/COMMON/StMuEvent.h"
23 #include "StMuDSTMaker/COMMON/StMuPrimaryVertex.h"
24 #include "StMuDSTMaker/COMMON/StMuTriggerIdCollection.h"
25 
26 #include "StEEmcA2EMaker.h"
27 
28 // ----------------------------------------------------------------------------
29 StEEmcQAMaker::StEEmcQAMaker( const Char_t *name ) : StMaker(name)
30 {
31  nVertexMin = 1;
32  nVertexMax = 999;
33  zVertexMin = -150;
34  zVertexMax = +150;
35  mSamplingFractionT=0.04;
36  mSamplingFractionU=0.007;
37  mSamplingFractionV=0.007;
38  mSoftTrig = 0.;
39 }
40 
41 // ----------------------------------------------------------------------------
43 {
44  hEventCounter = new TH1F("hEventCounter","Event counts",10,0.,10.);
45  hEventCounter -> GetXaxis() -> SetBinLabel(1,"raw event");
46  hEventCounter -> GetXaxis() -> SetBinLabel(2,"triggered");
47  hEventCounter -> GetXaxis() -> SetBinLabel(3,"|vertex|<cut");
48  hEventCounter -> GetXaxis() -> SetBinLabel(4,"track cuts");
49  hEventCounter -> GetXaxis() -> SetBinLabel(5,"eemc response");
50 
51 
52  hFrequencyT=new TH2F("hFrequencyT","Tower frequency",60,0.,60.,12,0.,12.);
53  hFrequencyP=new TH2F("hFrequencyP","Pre1 frequency",60,0.,60.,12,0.,12.);
54  hFrequencyQ=new TH2F("hFrequencyQ","Pre2 frequency",60,0.,60.,12,0.,12.);
55  hFrequencyR=new TH2F("hFrequencyR","Post frequency",60,0.,60.,12,0.,12.);
56 
57  for ( UInt_t trig=0;trig<mTriggerList.size();trig++ )
58  {
59  TString hname="hTrigId";hname+=mTriggerList[trig];
60  TString htitle="Triggers analysed per sector [0,12)";
61  hTriggers.push_back(new TH1F(hname,htitle,12,0.,12.));
62 
63  hTriggersHard.push_back(new TH1F(hname+"hard",htitle,12,0.,12.));
64  }
65  // UInt_t trig=mTriggerList.size();
66  hTriggers.push_back(new TH1F("hTrigOr","Any trigger in trigger list [0,12)",12,0.,12.));
67 
68 
69 
70  const Char_t *secname[]={
71  "[0]","[1]","[2]","[3]","[4]","[5]","[6]","[7]","[8]","[9]",
72  "[10]","[11]","Full","Cut"};
73 
74 
75 
76  for ( Int_t sec=0;sec<14;sec++ )
77  {
78 
79  TString hname="hEnergyDeposit";
80  TString htitle="EM Energy [GeV] summed over towers in sector ";
81 
82  htitle+=secname[sec];
83  hEnergyDepositT.push_back(new TH1F(hname+"T"+secname[sec],htitle,60,0.,60.));
84  htitle="Energy deposit [MeV] summed over towers in sector ";
85  hEnergyDepositP.push_back(new TH1F(hname+"P"+secname[sec],htitle,50,0.,200.));
86  hEnergyDepositQ.push_back(new TH1F(hname+"Q"+secname[sec],htitle,50,0.,200.));
87  hEnergyDepositR.push_back(new TH1F(hname+"R"+secname[sec],htitle,50,0.,200.));
88  htitle.ReplaceAll("towers","smd strips");
89  hEnergyDepositU.push_back(new TH1F(hname+"U"+secname[sec],htitle,50,0.,400.));
90  hEnergyDepositV.push_back(new TH1F(hname+"V"+secname[sec],htitle,50,0.,400.));
91 
92 
93  hname.ReplaceAll("EnergyDeposit","Multiplicity");
94  htitle="Sector multiplicity ";htitle+=secname[sec];
95 
96  hMultiplicityT.push_back(new TH1F(hname+"T"+secname[sec],htitle,60,0.,60.));
97  hMultiplicityP.push_back(new TH1F(hname+"P"+secname[sec],htitle,60,0.,60.));
98  hMultiplicityQ.push_back(new TH1F(hname+"Q"+secname[sec],htitle,60,0.,60.));
99  hMultiplicityR.push_back(new TH1F(hname+"R"+secname[sec],htitle,60,0.,60.));
100  hMultiplicityU.push_back(new TH1F(hname+"U"+secname[sec],htitle,60,0.,60.));
101  hMultiplicityV.push_back(new TH1F(hname+"V"+secname[sec],htitle,60,0.,60.));
102 
103 
104  hname="hAdc";
105  htitle="ADC-ped in ";htitle+=secname[sec];
106 
107  hAdcT.push_back(new TH1F(hname+"T"+secname[sec],htitle,512,0.,512.));
108  hAdcP.push_back(new TH1F(hname+"P"+secname[sec],htitle,512,0.,512.));
109  hAdcQ.push_back(new TH1F(hname+"Q"+secname[sec],htitle,512,0.,512.));
110  hAdcR.push_back(new TH1F(hname+"R"+secname[sec],htitle,512,0.,512.));
111  hAdcU.push_back(new TH1F(hname+"U"+secname[sec],htitle,512,0.,512.));
112  hAdcV.push_back(new TH1F(hname+"V"+secname[sec],htitle,512,0.,512.));
113 
114 
115  hname="hNglobal";hname+=secname[sec];
116  hNglobal.push_back(new TH1F(hname,"Number of global tracks",50,0.,50.));
117  hname="hNprimary";hname+=secname[sec];
118  hNprimary.push_back(new TH1F(hname,"Number of primary tracks",50,0.,50.));
119  hname="hNvertex";hname+=secname[sec];
120  hNvertex.push_back(new TH1F(hname,"Number of primary vertices",10,0.,10.));
121  hname="hZvertex";hname+=secname[sec];
122  hZvertex.push_back(new TH1F(hname,"Z of 1st primary vertex",200,-200.,200.));
123  hname="hZvertexErr";hname+=secname[sec];
124  hZvertexErr.push_back(new TH1F(hname,"Z err of 1st primary vertex",200,-200.,200.));
125  hname="hRankVertex";hname+=secname[sec];
126  hRankVertex.push_back(new TH1F(hname,"Ranking of 1st primary vertex",100,0.,100.));
127  hname="hNtrackVertex";hname+=secname[sec];
128  hNtrackVertex.push_back(new TH1F(hname,"Number of tracks used 1st prim vert",25,0.,25.));
129  hname="hNtrackVertexEE";hname+=secname[sec];
130  hNtrackVertexEE.push_back(new TH1F(hname,"Number of tracks used 1st prim vert macthed to eemc",25,0.,25.));
131  hname="hPTsumVertex";hname+=secname[sec];
132  hPTsumVertex.push_back(new TH1F(hname,"Scalar pT sum of tracks used 1st prim vertex [GeV]",100,0.,100.));
133 
134  }
135 
136 
137  return StMaker::Init();
138 }
139 
140 // ----------------------------------------------------------------------------
142 {
143 
145  hEventCounter -> Fill( 0 );
146 
148  if ( !CheckTriggers() ) return kStOK;
149  hEventCounter -> Fill( 1 );
150 
152  if ( !CheckVertex() ) return kStOK;
153  hEventCounter -> Fill( 2 );
154 
156  if ( !CheckTracks() ) return kStOK;
157  hEventCounter -> Fill( 3 );
158 
160  if ( !EEmcResponse() ) return kStOK;
161  hEventCounter -> Fill ( 4 );
162 
163 
164  return StMaker::Make();
165 }
166 
167 // ----------------------------------------------------------------------------
168 void StEEmcQAMaker::analysis(const Char_t *name)
169 {
170  mEEanalysis=(StEEmcA2EMaker *)GetMaker(name);
171  assert(mEEanalysis);
172 }
173 
174 // ----------------------------------------------------------------------------
175 void StEEmcQAMaker::mudst(const Char_t *name)
176 {
177  mMuDst=(StMuDstMaker*)GetMaker(name);
178  assert(mMuDst);
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 
196  /*
197  StEEmcTower ht = mEEanalysis->hightower();
198  if ( ht.fail() ) return false;
199  */
200  StEEmcTower ht;
201  Bool_t got_ht = false;
202  for ( Int_t i=0;i<mEEanalysis->numberOfHitTowers(0);i++ )
203  {
204  StEEmcTower tow=mEEanalysis->hittower(i,0);
205  if ( tow.et() > ht.et() && !(tow.fail()) )
206  {
207  ht=tow;
208  got_ht = true;
209  }
210  }
211  if ( !got_ht ) return false;
212 
214  Bool_t go=false;
215 
216  if ( mTriggerList.size() == 0 ) go = true; // no triggers requested
217  for ( UInt_t i=0;i<mTriggerList.size();i++ )
218  {
219  Int_t myId = mTriggerList[i];
220  if ( l1trig.isTrigger( myId ) && ht.et() > mSoftTrig ) {
221  go=true;
222  hTriggers[i] -> Fill ( ht.sector() );
223  mSectorTrigger = ht.sector();
224  }
225  if ( l1trig.isTrigger( myId ) ) {
226  hTriggersHard[i]->Fill( ht.sector() );
227  }
228  }
229  if ( go ) hTriggers[ mTriggerList.size() ] -> Fill( ht.sector() );
230 
231  return go;
232 }
233 
234 
235 
236 
237 
238 
239 // ----------------------------------------------------------------------------
241 {
242 
243 
244  StMuEvent *event = mMuDst -> muDst() -> event();
245  assert(event);
246  Bool_t go = false;
247 
249  if ( mSectorTrigger < 0 ) return false;
250 
253  if ( ht.fail() ) return false;
254 
255 
256  Int_t numberOfVertices=mMuDst -> muDst() -> numberOfPrimaryVertices();
257  hNvertex[ mSectorTrigger ] -> Fill( numberOfVertices );
258  hNvertex[ 12 ] -> Fill( numberOfVertices );
259  if ( numberOfVertices < nVertexMin ||
260  numberOfVertices > nVertexMax ) return false;
261  hNvertex[ 13 ] -> Fill( numberOfVertices );
262 
265  if ( !numberOfVertices ) return true;
266 
268  StMuPrimaryVertex *vertex = mMuDst -> muDst() -> primaryVertex(0);
269  Float_t zvertex=vertex->position().z();
270  hZvertex[ mSectorTrigger ] -> Fill ( zvertex );
271  hZvertex[ 12 ] -> Fill( zvertex );
272  if ( zvertex < zVertexMin || zvertex > zVertexMax ) return false;
273  hZvertex[ 13 ] -> Fill( zvertex );
274 
275 
276  Float_t ezvertex = vertex->posError().z();
277  hZvertexErr[ mSectorTrigger ] -> Fill( ezvertex );
278  hZvertexErr[ 12 ] -> Fill( ezvertex );
279 
280 
282  Float_t rank = vertex -> ranking();
283  hRankVertex[ mSectorTrigger ] -> Fill ( rank );
284  hRankVertex[ 12 ] -> Fill ( rank );
285 
286 
288  Int_t ntrack = vertex -> nTracksUsed();
289  hNtrackVertex[ mSectorTrigger ] -> Fill( ntrack );
290  hNtrackVertex[ 12 ] -> Fill( ntrack );
291 
292 
293  ntrack = vertex -> nEEMCMatch();
294  hNtrackVertexEE[ mSectorTrigger ] -> Fill( ntrack );
295  hNtrackVertexEE[ 12 ] -> Fill( ntrack );
296 
297 
299  Float_t ptsum = vertex -> sumTrackPt();
300  hPTsumVertex[ mSectorTrigger ] -> Fill( ptsum );
301  hPTsumVertex[ 12 ] -> Fill( ptsum );
302 
303  return go;
304 }
305 
306 
307 // ----------------------------------------------------------------------------
309 {
310 
313  if ( ht.fail() ) return false;
314 
315  if ( mSectorTrigger < 0 ) return false;
316 
318  Int_t nGlobal=mMuDst->muDst()->numberOfGlobalTracks();
319  hNglobal[ mSectorTrigger ] -> Fill( nGlobal );
320  hNglobal[ 12 ] -> Fill( nGlobal );
321 
323  Int_t nPrimary=mMuDst->muDst()->numberOfPrimaryTracks();
324  hNprimary[ mSectorTrigger ] -> Fill( nPrimary );
325  hNprimary[ 12 ] -> Fill( nPrimary );
326 
327  return true;
328 }
329 
330 
331 
332 
333 
334 
335 // ----------------------------------------------------------------------------
337 {
338 
339  Int_t mysector = mSectorTrigger;
340 
343  if ( ht.fail() ) return false;
344 
345  if ( mysector < 0 ) return false;
346 
347  // Int_t ht_sec = ht.sector();
348  Int_t ht_phi = ht.phibin();
349  Int_t ht_eta = ht.etabin();
350 
352  hFrequencyT -> Fill( ht_phi, ht_eta );
353 
354  StEEmcTower pre1 = mEEanalysis->hightower(1);
355  StEEmcTower pre2 = mEEanalysis->hightower(2);
356  StEEmcTower post = mEEanalysis->hightower(3);
357  hFrequencyP -> Fill ( pre1.phibin(), pre1.etabin() );
358  hFrequencyQ -> Fill ( pre2.phibin(), pre2.etabin() );
359  hFrequencyR -> Fill ( post.phibin(), post.etabin() );
360 
362  Float_t energy_deposit[6];
363  for ( Int_t i=0;i<6;i++ )
364  {
365  energy_deposit[i] = mEEanalysis->energy( mysector, i );
366  }
368  // energy_deposit[0] *= mSamplingFractionT * 1000.0;
369  for ( Int_t i=1;i<6;i++ )
370  energy_deposit[i] *= 1000.0;
371 
372  hEnergyDepositT[mysector]->Fill( energy_deposit[0] );
373  hEnergyDepositP[mysector]->Fill( energy_deposit[1] );
374  hEnergyDepositQ[mysector]->Fill( energy_deposit[2] );
375  hEnergyDepositR[mysector]->Fill( energy_deposit[3] );
376  hEnergyDepositU[mysector]->Fill( energy_deposit[4] );
377  hEnergyDepositV[mysector]->Fill( energy_deposit[5] );
378 
379  hMultiplicityT[mysector]->Fill( mEEanalysis->numberOfHits(mysector,0) );
380  hMultiplicityP[mysector]->Fill( mEEanalysis->numberOfHits(mysector,1) );
381  hMultiplicityQ[mysector]->Fill( mEEanalysis->numberOfHits(mysector,2) );
382  hMultiplicityR[mysector]->Fill( mEEanalysis->numberOfHits(mysector,3) );
383  hMultiplicityU[mysector]->Fill( mEEanalysis->numberOfHits(mysector,4) );
384  hMultiplicityV[mysector]->Fill( mEEanalysis->numberOfHits(mysector,5) );
385 
386  for ( Int_t sub=0;sub<5; sub++ )
387  for ( Int_t eta=0;eta<12;eta++ )
388  {
389  StEEmcTower t=mEEanalysis->tower(mysector,sub,eta,0);
390  if ( t.adc()>0. && !t.fail() ) hAdcT[ mysector ] -> Fill ( t.adc() );
391  t=mEEanalysis->tower(mysector,sub,eta,1);
392  if ( t.adc()>0. && !t.fail() ) hAdcP[ mysector ] -> Fill ( t.adc() );
393  t=mEEanalysis->tower(mysector,sub,eta,2);
394  if ( t.adc()>0. && !t.fail() ) hAdcQ[ mysector ] -> Fill ( t.adc() );
395  t=mEEanalysis->tower(mysector,sub,eta,3);
396  if ( t.adc()>0. && !t.fail() ) hAdcR[ mysector ] -> Fill ( t.adc() );
397  }
398  for (Int_t hit=0;hit<mEEanalysis->numberOfHitStrips(mysector,0);hit++ )
399  {
400  StEEmcStrip strip=mEEanalysis->hitstrip(mysector,0,hit);
401  if ( strip.fail() || strip.energy()<=0. ) continue;
402  hAdcU[mysector]->Fill( strip.adc() );
403  }
404 
405  for (Int_t hit=0;hit<mEEanalysis->numberOfHitStrips(mysector,1);hit++ )
406  {
407  StEEmcStrip strip=mEEanalysis->hitstrip(mysector,1,hit);
408  if ( strip.fail() || strip.energy()<=0. ) continue;
409  hAdcV[mysector]->Fill( strip.adc() );
410  }
411 
412 
413  return true;
414 }
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
StEEmcTower & hittower(Int_t hit, Int_t layer)
std::vector< TH1F * > hAdcR
ADC.
std::vector< TH1F * > hAdcV
ADC.
std::vector< TH1F * > hEnergyDepositU
Energy deposited in layer.
Definition: StEEmcQAMaker.h:88
std::vector< TH1F * > hEnergyDepositP
Energy deposited in layer.
Definition: StEEmcQAMaker.h:82
std::vector< TH1F * > hAdcP
ADC.
std::vector< TH1F * > hAdcQ
ADC.
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 numberOfHitTowers(Int_t layer) const
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
virtual Int_t Make()
Definition: StMaker.cxx:898
Float_t mSoftTrig
Software trigger threshold.
Definition: StEEmcQAMaker.h:66
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 et(Float_t e)
Definition: StEEmcTower.h:34
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.
Int_t nVertexMax
Cuts on primary vertex (see constructor for defaults)
Definition: StEEmcQAMaker.h:30
Int_t numberOfHits(Int_t sector, Int_t layer) const