1 void SpinAnalysisTreeReaderMIT(
const long nevents = 20) {
8 reader->selectDataset(
"StSpinTree/datasets/run6_mit.dataset");
12 reader->connectJets =
true;
13 reader->connectNeutralJets =
false;
14 reader->connectChargedPions =
true;
15 reader->connectBemcPions =
true;
16 reader->connectBemcElectrons =
true;
17 reader->connectEemcPions =
false;
21 reader->selectRun(7132007);
25 reader->selectTrigger(137221);
26 reader->selectTrigger(137222);
27 reader->selectTrigger(137611);
28 reader->selectTrigger(137622);
29 reader->selectTrigger(5);
32 reader->requireDidFire =
true;
33 reader->requireShouldFire =
true;
37 long entries = reader->GetEntries();
38 if(entries > nevents) entries = nevents;
39 for(
int i=0; i<entries; i++) {
43 int runId = ev->runId();
44 int eventId = ev->eventId();
46 printf(
"----------------Reading Event %d of %d----------------\n",i+1,entries);
47 printf(
"basics: Run = %d, Event = %d\n",runId,eventId);
50 TClonesArray *trigs = ev->triggers();
51 for(
int j=0; j<trigs->GetEntries(); j++) {
53 int trigId = aTrig->trigId();
54 bool didFire = aTrig->didFire();
55 int shouldFire = aTrig->shouldFire();
59 printf(
"ERROR LOADING TRIGGER HEADER FOR %d\n",trigId);
62 float prescale = header->prescale;
64 printf(
"trigger = %6d prescale = %8.1f didFire = %d shouldFire =% d\n",trigId,prescale,didFire,shouldFire);
68 int nVertices = ev->vertices()->GetEntries();
71 printf(
"nVertices = %d position of best = %f\n",nVertices,bestVert->position()[2]);
73 else if(nVertices == 0){
74 printf(
"no vertices found in this event\n");
77 printf(
"ERROR LOADING BEST VERTEX IN THIS EVENT\n");
83 printf(
"nJets = %d\n",reader->nJets());
84 for(
int j=0; j<reader->nJets(); j++) {
85 StJet* aJet = reader->jet(j);
87 if(bestVert) printf(
"jet pt=%7.4f jet eta=% 1.4f det eta=% 1.4f E_neu/E_tot=%1.4f\n",aJet->
jetPt,aJet->
jetEta,aJet->detEta(bestVert->position()[2]),R);
88 else printf(
"jet pt=%7.4f jet eta=% 1.4f no vertex E_neu/E_tot=%1.4f\n",aJet->
jetPt,aJet->
jetEta,R);
92 printf(
"nChargedPions = %d\n",reader->nChargedPions());
93 for(
int j=0; j<reader->nChargedPions(); j++) {
95 printf(
"pt=%7.4f eta=% 1.4f nSigmaPion=% 1.4f\n",aPion->
pt(),aPion->
eta(),aPion->
nSigmaPion());
99 printf(
"nNeutralPions = %d\n",reader->nBemcPions());
100 for(
int j=0; j<reader->nBemcPions(); j++) {
102 printf(
"neutral pion mass=%f pt=%f eta=%f\n",aPi0->Mass(),aPi0->Pt(),aPi0->Eta());
105 cout <<
"-----------------------------------------------------" << endl;
111 void LoadSpinTreeLibs() {
112 gSystem->Load(
"StarSpinAnalyses");
float nSigmaPion() const
Returns Craig's distance to the calculated dE/dx band for pions in units of sigma.
float jetPt
Pt (stored for convenience when drawing TTree)
float jetEta
Eta (stored for convenience when drawing TTree)
float pt() const
Returns pT at point of dca to primary vertex.
float eta() const
Returns pseudo rapidity at point of dca to primary vertex.
float btowEtSum
The summed Et from Barrel towers.