13 unsigned char clusterEt;
14 unsigned char seedEtaBin;
15 unsigned char seedPhiBin;
17 unsigned char trigger;
18 unsigned char dum1,dum2,dum3;
22 void electron_histogram_maker(
const char* file_list=
"ctest.list",
const char* skimfile=
"electronskimfile.root")
24 gROOT->Macro(
"LoadLogger.C");
25 gROOT->Macro(
"loadMuDst.C");
26 gSystem->Load(
"StTpcDb");
27 gSystem->Load(
"StDaqLib");
28 gSystem->Load(
"StDetectorDbMaker");
29 gSystem->Load(
"St_db_Maker");
30 gSystem->Load(
"StDbUtilities");
31 gSystem->Load(
"StEmcRawMaker");
32 gSystem->Load(
"StMcEvent");
33 gSystem->Load(
"StMcEventMaker");
34 gSystem->Load(
"StEmcSimulatorMaker");
35 gSystem->Load(
"StEmcADCtoEMaker");
36 gSystem->Load(
"StEpcMaker");
37 gSystem->Load(
"StDbBroker");
38 gSystem->Load(
"StEmcUtil");
39 gSystem->Load(
"StAssociationMaker");
41 gSystem->Load(
"StTriggerUtilities");
42 gSystem->Load(
"StEmcOfflineCalibrationMaker");
43 cout<<
"input filelist: "<<file_list<<endl;
44 cout<<
"skimmed tree: "<<skimfile<<endl;
48 TChain* calib_tree =
new TChain(
"calibTree");
49 ifstream filelist(file_list);
52 if(!filelist.good())
break;
54 calib_tree->Add(file);
57 StEmcGeom* geom = StEmcGeom::instance(
"bemc");
60 vector<unsigned int> htTriggers;
61 htTriggers.push_back(240530);
62 htTriggers.push_back(240530);
63 htTriggers.push_back(240550);
64 htTriggers.push_back(240560);
65 htTriggers.push_back(240570);
78 calib_tree->SetBranchAddress(
"event_branch",&myEvent);
83 TFile* skim_file =
new TFile(skimfile,
"RECREATE");
84 TTree *electron_tree =
new TTree(
"skimTree",
"electron tracks");
85 electron_tree->Branch(
"clusters",&cluster);
87 TH2F* dEdxvsp =
new TH2F(
"dEdxvsp",
"",100,0.0,10.0,100,0.0,1e-5);
90 set<int> track_towers;
91 set<int> excluded_towers;
93 unsigned int nAccept = 0;
94 unsigned int nGoodEvents = 0;
95 unsigned int nentries = calib_tree->GetEntries();
104 for(
unsigned int i=0; i<nentries; i++){
105 if(i%1000000 == 0) cout<<
"processing "<<i<<
" of "<<nentries<<endl;
107 calib_tree->GetEntry(i);
110 if(TMath::Abs(myEvent->vz[0]) > 60.)
continue;
115 const int BEMCW_off=20;
120 float trigeta = -999;
121 float trigphi = -999;
136 for(
unsigned int h = 0; h < myEvent->triggerIds.size(); h++){
138 for(
unsigned int f = 0; f < htTriggers.size(); f++){
139 if(htTriggers[f] == myEvent->triggerIds[h])isht = 1;
148 track_towers.clear();
149 excluded_towers.clear();
151 for(
int j=0; j<myEvent->tracks->GetEntries(); j++){
153 int id = track->tower_id[0];
155 if(track_towers.find(
id) != track_towers.end()){
156 excluded_towers.insert(
id);
159 track_towers.insert(
id);
164 for(
int j=0; j<myEvent->tracks->GetEntries(); j++){
166 dEdxvsp->Fill(track->p,track->dEdx);
167 if(j==0) nGoodEvents++;
169 double dR = TMath::Sqrt(track->deta*track->deta + track->dphi*track->dphi);
172 float squarefid = 0.03/TMath::Sqrt(2.0);
175 if(track->p < 1.5)
continue;
176 if(track->p > 20.)
continue;
178 if(track->tower_status[0] != 1)
continue;
181 if(track->nHits < 10)
continue;
185 if(excluded_towers.find(track->tower_id[0]) != excluded_towers.end())
continue;
187 if((track->tower_adc[0] - track->tower_pedestal[0]) < 1.5 * track->tower_pedestal_rms[0])
continue;
190 if(track->dEdx < 3.0e-6)
continue;
197 cluster->centralTrack = *track;
200 geom->getEtaPhi(track->tower_id[0],toweta,towphi);
214 track->htTrig = yht + tr;
215 track->nonhtTrig = nht;
218 for (
int k = 1; k < 9; k++)
220 if(track_towers.find(track->tower_id[k]) != track_towers.end())
222 for(
int q = 0; q < myEvent->tracks->GetEntries(); q++)
226 if(dumtrack->tower_id[0] == track->tower_id[k])
228 cluster->addTrack(dumtrack);
236 electron_tree->Fill();
244 cout<<
"found "<<nGoodEvents<<
" events with at least one good track"<<endl;
245 cout<<
"accepted "<<nAccept<<
" electrons"<<endl;