79 if (!
tfile.isAvailable())
81 <<
"please add it to config file";
85 for (
int i = 0;
i < 4;
i++) {
86 sprintf(
name,
"Hits%d",
i);
87 sprintf(
title,
"Number of hits (%s)",
types[
i].c_str());
90 meNHit_[
i]->GetYaxis()->SetTitle(
"Events");
91 sprintf(
name,
"E1T0%d",
i);
92 sprintf(
title,
"E1 (Loss %s) in GeV",
types[
i].c_str());
95 meE1T0_[
i]->GetYaxis()->SetTitle(
"Events");
96 sprintf(
name,
"E9T0%d",
i);
97 sprintf(
title,
"E9 (Loss %s) in GeV",
types[
i].c_str());
100 meE9T0_[
i]->GetYaxis()->SetTitle(
"Events");
101 sprintf(
name,
"E1T1%d",
i);
102 sprintf(
title,
"E1 (Loss %s with t < 400 ns) in GeV",
types[
i].c_str());
105 meE1T1_[
i]->GetYaxis()->SetTitle(
"Events");
106 sprintf(
name,
"E9T1%d",
i);
107 sprintf(
title,
"E9 (Loss %s with t < 400 ns) in GeV",
types[
i].c_str());
110 meE9T1_[
i]->GetYaxis()->SetTitle(
"Events");
112 sprintf(
name,
"PDGType");
113 sprintf(
title,
"PDG ID of first level secondary");
116 mType_->GetYaxis()->SetTitle(
"Tracks");
123 desc.add<
double>(
"energyMax", 2.0);
124 descriptions.
add(
"xtalDedxAnalysis",
desc);
129 edm::LogVerbatim(
"CherenkovAnalysis") <<
"XtalDedxAnalysis::Run = " <<
e.id().run() <<
" Event = " <<
e.id().event();
131 std::vector<PCaloHit> caloHits;
135 std::vector<SimTrack> theSimTracks;
139 std::vector<SimVertex> theSimVertex;
144 caloHits.insert(caloHits.end(), pCaloHits->begin(), pCaloHits->end());
146 edm::LogVerbatim(
"CherenkovAnalysis") <<
"XtalDedxAnalysis: Hit buffer " << caloHits.size();
155 edm::SimTrackContainer::const_iterator simTrkItr;
156 int nHit =
hits.size();
157 double e10[4], e90[4], e11[4], e91[4],
hit[4];
158 for (
int i = 0;
i < 4;
i++)
159 e10[
i] = e90[
i] = e11[
i] = e91[
i] =
hit[
i] = 0;
160 for (
int i = 0;
i < nHit;
i++) {
163 unsigned int id_ =
hits[
i].id();
164 int trackID =
hits[
i].geantTrackId();
166 for (simTrkItr = SimTk->begin(); simTrkItr != SimTk->end(); simTrkItr++) {
167 if (trackID == (
int)(simTrkItr->trackId())) {
168 int thePID = simTrkItr->type();
171 else if (thePID != -13 && thePID != 13)
194 <<
" time " <<
time <<
" track " << trackID <<
" type " <<
type;
197 for (
int i = 0;
i < 4;
i++) {
199 edm::LogVerbatim(
"CherenkovAnalysis") <<
"XtalDedxAnalysis:Type(" <<
i <<
") Hit " <<
hit[
i] <<
" E10 " << e10[
i]
200 <<
" E11 " << e11[
i] <<
" E90 " << e90[
i] <<
" E91 " << e91[
i];
210 int nvtx = 0, ntrk = 0, k1 = 0;
211 edm::SimVertexContainer::const_iterator simVtxItr;
212 for (simTrkItr = SimTk->begin(); simTrkItr != SimTk->end(); simTrkItr++)
214 for (simVtxItr = SimVtx->begin(); simVtxItr != SimVtx->end(); simVtxItr++)
217 edm::LogVerbatim(
"CherenkovAnalysis") <<
"XtalDedxAnalysis: " << ntrk <<
" tracks and " << nvtx <<
" vertices";
219 for (simTrkItr = SimTk->begin(); simTrkItr != SimTk->end(); simTrkItr++, ++k1) {
221 edm::LogVerbatim(
"CherenkovAnalysis") <<
"Track " << k1 <<
" PDGId " << simTrkItr->type() <<
" Vertex ID "
222 << simTrkItr->vertIndex() <<
" Generator " << simTrkItr->noGenpart();
224 if (simTrkItr->noGenpart()) {
225 int vertIndex = simTrkItr->vertIndex();
226 if (vertIndex >= 0 && vertIndex < nvtx) {
227 simVtxItr = SimVtx->begin();
228 for (
int iv = 0;
iv < vertIndex;
iv++)
230 int parent = simVtxItr->parentIndex(), k2 = 0;
231 for (edm::SimTrackContainer::const_iterator trkItr = SimTk->begin(); trkItr != SimTk->end(); trkItr++, ++k2) {
233 edm::LogVerbatim(
"CherenkovAnalysis") <<
"XtalDedxAnalysis::Track " << k2 <<
" ID " << trkItr->trackId()
234 <<
" (" <<
parent <<
") Generator " << trkItr->noGenpart();
236 if ((
int)trkItr->trackId() ==
parent) {
237 if (!trkItr->noGenpart()) {
239 edm::LogVerbatim(
"CherenkovAnalysis") <<
"XtalDedxAnalysis::Track found with ID " << simTrkItr->type();
241 mType_->Fill(simTrkItr->type());