16 #include "StEEmcPi0Analysis.h"
17 #include "StEEmcMixMaker.h"
18 #include "StEEmcPool/StEEmcPointMaker/StEEmcPointMaker.h"
26 #include "StEEmcPool/StEEmcPointMaker/EEmcSectorFit.h"
27 #include "StEEmcUtil/StEEmcSmd/EEmcSmdGeom.h"
28 #include "StEEmcUtil/EEmcGeom/EEmcGeomSimple.h"
29 #include "StEEmcPool/StRFEmcTrigger/StRFEmcTrigMaker.h"
30 #include "StEEmcPool/StEEmcA2EMaker/StEEmcA2EMaker.h"
39 mTrigSimThreshold = 0;
52 mBackgrounds[ kAny ] =
new SpinHistos(
"AnyB",
"combinatoric spectra, unsorted");
62 hEventCounter=
new TH1F(
"hEventCounter",
"Event counts",10,0.,10.);
69 hPairCounter =
new TH1F(
"hPairCounter",
"Pair counts",10,0.,10.);
70 hFillPatternI =
new TH1F(
"hFillPatternI",
"Intended fill pattern:bunch X-ing @ STAR IP:n runs",120,0.,120.);
71 hSpin4 =
new TH1F(
"hSpin4",
"Spin 4:spin4 state",11,0.,11.);
72 hSpin4mb =
new TH1F(
"hSpin4mb",
"Spin 4:spin4 state",11,0.,11.);
73 hBx7 =
new TH1F(
"hBx7",
"7-bit bunch crossing:bx7",120,0.,120.);
74 hBx48 =
new TH1F(
"hBx48",
"48-bit bunch crossing:bx48",120,0.,120.);
75 hBx7diffBx48 =
new TH2F(
"hBx7diffBx48",
"bx1=(bx7-off7)%120, bx2=(bx48-off48)%120;bx7;bx1-bx2",120,0.,120.,21,-10.5,10.5);
76 hBxStar =
new TH1F(
"hBxStar",
"Beam x-ing at STAR IP;star bunch x-ing",120,0.,120.);
77 hBxStarPi0 =
new TH1F(
"hBxStarPi0",
"Beam x-ing at STAR IP with pi0 detected;star bunch x-ing",120,0.,120.);
79 hMassBx=
new TH2F(
"hMassBx",
"Beam x-ing vs Mass;M [GeV];STAR bunch xing",120,0.,1.2,120,0.,120.);
80 hZvertBx=
new TH2F(
"hZvertBx",
"Beam x-ing vs Z vertex [0.1,0.18]",150,-150.,150.,120,0.,120.);
81 hZggBx=
new TH2F(
"hZggBx",
"Beam x-ing vs Zgg",100,0.,1.,120,0.,120.);
82 hEtaBx=
new TH2F(
"hEtaBx",
"Beam x-ing vs eta",120,0.8,2.2,120,0.,120.);
85 mRealTree=
new TTree(
"mRealTree",
"Real Events");
86 mRealTree->Branch(
"MixEvent",
"StEEmcMixEvent",&mRealEvent);
87 mMixedTree=
new TTree(
"mMixedTree",
"Mixed Events");
88 mMixedTree->Branch(
"MixEvent",
"StEEmcMixEvent",&mMixedEvent);
90 AddObj( mRealTree,
".hist" );
91 AddObj( mMixedTree,
".hist" );
93 return StMaker::Init();
100 Info(
"InitRun",
"run number = %d",run);
102 for(
int bx=0;bx<120;bx++){
103 Bool_t isFilled=(spin8bits[bx] & 0x11)==0x11;
109 return StMaker::InitRun(run);
126 mRealEvent -> setSpin4( spin4 );
128 mMixedEvent -> setSpin4( spin4 );
130 for ( Int_t ii=0;ii<720;ii++ ) {
132 if ( tower.
fail() )
continue;
133 mRealEvent->
mADC[ii]=(60./4096.)*tower.
adc();
134 mRealEvent->mStat[ii]=tower.
stat();
142 static Int_t mymap[]={0,0,0,0,0,1,2,0,0,3,4};
145 mRealEvent -> mTotalEnergyT =
mEEanalysis -> energy(0);
146 mRealEvent -> mTotalEnergyP =
mEEanalysis -> energy(1);
147 mRealEvent -> mTotalEnergyQ =
mEEanalysis -> energy(2);
148 mRealEvent -> mTotalEnergyR =
mEEanalysis -> energy(3);
149 mRealEvent -> mTotalEnergyU =
mEEanalysis -> energy(4);
150 mRealEvent -> mTotalEnergyV =
mEEanalysis -> energy(5);
158 if ( !
accept( pair ) )
continue;
160 mRealEvent -> addPair( pair );
162 std::cout <<
"spin4=" << spin4 <<
" ";
182 Float_t mMinEnergy = 0.1;
184 for ( Int_t j=0;j<720;j++ ) used[j]=
false;
190 used[tow.
index()]=
true;
192 for ( UInt_t j=0;j<hits.size();j++ )
195 if ( used[ tow.
index() ] )
continue;
196 if ( tow.
energy() < mMinEnergy )
continue;
199 used[tow.
index()]=
true;
208 mMinEnergy=0.1/1000.0;
209 for ( Int_t j=0;j<720;j++ ) used[j]=
false;
210 Int_t ind=p1.
tower(0).index();
216 used[tow.
index()]=
true;
218 for ( UInt_t j=0;j<hits.size();j++ )
221 if ( used[ tow.
index() ] )
continue;
222 if ( tow.
energy() < mMinEnergy )
continue;
225 used[tow.
index()]=
true;
237 std::cout <<
"Problem detected, spin sorting disabled" << std::endl;
243 if ( mymap[spin4] ) {
248 if ( pair.
mass()>0.1 && pair.
mass() < 0.18 ) {
263 if ( !
accept( pair,
false ) )
continue;
264 mBackgrounds[ kAny ] -> Fill( pair );
265 mMixedEvent -> addPair( pair );
311 static const Int_t maxPerCluster = 2;
312 static const Float_t minTowerFrac = 0.;
316 Bool_t towers[720];
for (Int_t i=0;i<720;i++ ) towers[i]=
false;
324 towers[ t1.
index() ] =
true;
325 towers[ t2.
index() ] =
true;
329 towers[ mytow.
index() ] =
true;
330 Etowers += mytow.
energy();
334 if ( !towers[mytow.
index()] ) Etowers += mytow.
energy();
335 towers[ mytow.
index() ] =
true;
350 if ( towers[ t.
index() ] ) count++;
353 Float_t Epoints = pair.
energy();
355 return ( count <= maxPerCluster && Epoints > minTowerFrac * Etowers );
368 Bool_t good_trigger =
false;
385 go = l1trig.isTrigger( (*iter) );
397 good_trigger =
mTrigSim -> getEEMCtrigHT( mTrigSimThreshold );
398 good_trigger &=
mTrigSim -> getBBCtrig();
422 if ( !t.
fail() && t.
et() > ht.
et() ) {
424 if ( ht.
et()>=mCuts->tower_et_cut &&
428 if ( ht.
et() < mCuts->tower_et_cut ) {
429 good_trigger =
false;
440 if ( vert.z() < mCuts->z_vertex_min) {
444 if ( vert.z() > mCuts->z_vertex_max ) {
469 if ( tower1.
adc() < mCuts->adc_cut &&
470 tower2.
adc() < mCuts->adc_cut )
return false;
482 Float_t et1 = (tower1.
energy()*d1).Perp();
483 Float_t et2 = (tower2.
energy()*d2).Perp();
485 if ( et1 < mCuts->tower_et_cut &&
486 et2 < mCuts->tower_et_cut )
return false;
513 if ( eta < mCuts->eta_min || eta > mCuts->eta_max )
return false;
536 Int_t bx48 = trig->bunchCrossingId();
537 Int_t bx7 = trig->bunchCrossingId7bit( mRunNumber );
542 mRealEvent->bx48 = bx48;
543 mRealEvent->bx7 = bx7;
544 mRealEvent->bxStar = bxStar;
546 mMixedEvent->bx48=bx48;
547 mMixedEvent->bx7 =bx7;
548 mMixedEvent->bxStar=bxStar;
552 if ( bx7 == 0 || bx7 == 119 )
return -1;
553 if ( bx7 == 14 || bx7 == 54 )
return -1;
562 if (
mSpinDb -> isMaskedUsingBX48(bx48) )
return -1;
563 if (
mSpinDb->offsetBX48minusBX7(bx48,bx7)!=0 ) std::cout <<
"BUNCH CROSSINGS INCONSISTENT" << std::endl;
568 if (
mSpinDb->offsetBX48minusBX7(bx48,bx7)!=0 )
578 if ( l1trig.isTrigger(96011) )
hSpin4mb -> Fill(spin4);
587 mRealEvent ->
Clear();
588 mMixedEvent ->
Clear();
SpinHistos * mHistograms[100]
Spin-sorted pi0 histograms.
StSpinDbMaker * mSpinDb
pointer to the spin database
Bool_t twoBodyCut(StEEmcPair &p)
Int_t numberOfNeighbors() const
get the number of neighboring towers
EEmc ADC –> energy maker.
Base class for representing EEMC points.
void stat(unsigned s)
Set a status bit for this element.
Bool_t accept(StMuDst *mu)
method to cut events
void add(const StEEmcTower &t, Float_t weight=1.0)
StEEmcTower & hittower(Int_t hit, Int_t layer)
StRFEmcTrigMaker * mTrigSim
Trigger simulation for MC.
void energy(Float_t e, Int_t layer=0)
Set the energy of this point.
A maker for creating pi0 histograms.
void analysis(const Char_t *name)
specifies the name of the analysis maker
Int_t sector() const
Returns the sector.
StEEmcTowerVec_t & towers(Int_t layer=0)
void neighbor(StEEmcTower *n)
add a tower to list of neighbors
StEEmcPoint point(Int_t ipoint)
Return a specified point.
Int_t numberOfCandidates()
returns the number of candidates
Int_t numberOfHitStrips(Int_t sector, Int_t plane) const
void print() const
Prints a one-line summary of the pair.
int spin4usingBX48(int bx48)
8bit spin information
const TVector3 & momentum() const
Returns momentum of pair.
Int_t Init()
initializes the maker
StEEmcPair mixedCandidate(Int_t m)
Returns the specified mixed candidate pair.
const TVector3 & vertex() const
Returns vertex of pair.
Class for building points from smd clusters.
Int_t Make()
processes a single event
Int_t numberOfHitTowers(Int_t layer) const
Int_t etabin() const
Returns the etabin of this tower, pre- or postshower element.
void fail(unsigned f)
Set a fail bit for this element.
const StEEmcPoint & point(Int_t index) const
Int_t subsector() const
Returns subsector of this tower, pre- or postshower element.
Int_t numberOfMixedCandidates()
returns the number of mixed-background candidates
Int_t numberOfPoints()
Return number of points.
Int_t InitRun(Int_t)
init run
Base class for representing tower, preshower and postshower elements.
EEmcGeomSimple * mEEgeom
EEMC tower geometry.
void mudst(const Char_t *name)
specifies the name of the mudst maker
void points(const Char_t *name)
specifies the name of the point maker
StEEmcPi0Analysis(const Char_t *name)
constructor
void print(int level=0)
vs. STAR==yellow bXing
Bool_t isNeighbor(const StEEmcTower &tower) const
Returns true if tower is adjacent to any tower in the cluster.
Float_t zgg() const
Returns energy-sharing of pair.
StEEmcPointMaker * mEEpoints
pointer to the point maker
StMuDstMaker * mMuDst
pointer to mudst
Int_t getSpinState(StMuDst *mu, Int_t &bxs)
method to retrieve 4bit spin state
Int_t sector() const
Returns sector of this tower, pre- or postshower element.
TH1F * hEventCounter
histogram to keep track of where events get cut
int BXyellowUsingBX48(int bx48)
4bit spin information
static StMuEvent * event()
returns pointer to current StMuEvent (class holding the event wise information, e.g. event number, run number)
Float_t energy() const
Returns energy of pair.
Int_t numberOfTowers() const
Get the number of towers in cluster.
void Clear(Option_t *opts="")
clears the maker
std::vector< Int_t > mTriggerList
void tower(const StEEmcTower &t, Float_t w=1.)
Add a tower with specified weight to the point.
void adc(Float_t a)
Set the pedestal-subtracted ADC for this element.
TH1F * hPairCounter
histogram to keep track of where candidates get cut
void mixer(const Char_t *name)
StEEmcMixMaker * mEEmixer
Pointer to the pi0 mixer.
A base class for describing clusters of EEMC towers.
Float_t mass() const
Returns invariant mass of pair.
StEEmcTower & tower(Int_t index, Int_t layer=0)
A class for mixing pi0 candidates.
const int * getSpin8bits()
experts only
void spin(const Char_t *name)
specifies the name of the spin db maker
StEEmcA2EMaker * mEEanalysis
pointer to analysis maker
StEEmcPair candidate(Int_t c)
Return a specified candidate pair.
void energy(Float_t e)
Set the energy (adc-ped+0.5)/gain for this element.
A class to represent pairs of points.
Collection of trigger ids as stored in MuDst.
Spin sorted pi0 histograms.