32 hOutputFile =
new TFile( fOutputFileName.c_str(),
"RECREATE" ) ;
33 myTree =
new TTree(
"RecJet",
"RecJet Tree");
34 myTree->Branch(
"mydet", &mydet,
"mydet/I");
35 myTree->Branch(
"mysubd", &mysubd,
"mysubd/I");
36 myTree->Branch(
"depth", &depth,
"depth/I");
37 myTree->Branch(
"ieta", &ieta,
"ieta/I");
38 myTree->Branch(
"iphi", &iphi,
"iphi/I");
39 myTree->Branch(
"eta", &
eta,
"eta/F");
40 myTree->Branch(
"phi", &
phi,
"phi/F");
41 myTree->Branch(
"mom1", &mom1,
"mom1/F");
42 myTree->Branch(
"mom2", &mom2,
"mom2/F");
43 myTree->Branch(
"mom3", &mom3,
"mom3/F");
44 myTree->Branch(
"mom4", &mom4,
"mom4/F");
50 void MinBias::endJob()
53 const std::vector<DetId>& did = geo->getSubdetectorGeometry(
DetId::Hcal, 1 )->getValidDetIds() ;
55 for(std::vector<DetId>::const_iterator
id=did.begin();
id != did.end();
id++)
59 mydet = ((*id).rawId()>>28)&0xF;
60 mysubd = ((*id).rawId()>>25)&0x7;
66 if ( theFillDetMap0[*
id] > 0. )
68 mom1 = theFillDetMap1[*id]/theFillDetMap0[*id];
69 mom2 = theFillDetMap2[*id]/theFillDetMap0[*id]-(mom1*mom1);
70 mom3 = theFillDetMap3[*id]/theFillDetMap0[*id]-3.*mom1*theFillDetMap2[*id]/theFillDetMap0[*id]+
72 mom4 = (theFillDetMap4[*id]-4.*mom1*theFillDetMap3[*id]+6.*
pow(mom1,2)*theFillDetMap2[*id])/theFillDetMap0[*
id]-3.*
pow(mom1,4);
76 mom1 = 0.; mom2 = 0.; mom3 = 0.; mom4 = 0.;
78 std::cout<<
" Detector "<<(*id).rawId()<<
" mydet "<<mydet<<
" "<<mysubd<<
" "<<depth<<
" "<<
80 std::cout<<
" Energy "<<mom1<<
" "<<mom2<<std::endl;
85 std::cout<<
" The number of CaloDet records "<<did.size()<<std::endl;
86 std::cout<<
" The number of Hcal records "<<i<<std::endl;
89 std::cout <<
"===== Start writing user histograms =====" << std::endl;
90 hOutputFile->SetCompressionLevel(2);
93 hOutputFile->Close() ;
94 std::cout <<
"===== End writing user histograms =======" << std::endl;
112 std::vector<DetId> did = geo->getValidDetIds();
114 for(std::vector<DetId>::const_iterator
id=did.begin();
id != did.end();
id++)
117 theFillDetMap0[*id] = 0.;
118 theFillDetMap1[*id] = 0.;
119 theFillDetMap2[*id] = 0.;
120 theFillDetMap3[*id] = 0.;
121 theFillDetMap4[*id] = 0.;
128 if (!hbheLabel_.empty()) {
133 if (!allowMissingInputs_) {
138 hbheItr != (*hbhe).end(); ++hbheItr)
141 if( (*hbheItr).energy() > 0. )
std::cout<<
" Energy = "<<(*hbheItr).energy()<<std::endl;
142 theFillDetMap0[id] = theFillDetMap0[id]+ 1.;
143 theFillDetMap1[id] = theFillDetMap1[id]+(*hbheItr).energy();
144 theFillDetMap2[id] = theFillDetMap2[id]+
pow((*hbheItr).energy(),2);
145 theFillDetMap3[id] = theFillDetMap3[id]+
pow((*hbheItr).energy(),3);
146 theFillDetMap4[id] = theFillDetMap4[id]+
pow((*hbheItr).energy(),4);
151 if (!hoLabel_.empty()) {
156 if (!allowMissingInputs_) {
161 hoItr != (*ho).end(); ++hoItr)
164 theFillDetMap0[id] = theFillDetMap0[id]+ 1.;
165 theFillDetMap1[id] = theFillDetMap1[id]+(*hoItr).energy();
166 theFillDetMap2[id] = theFillDetMap2[id]+
pow((*hoItr).energy(),2);
167 theFillDetMap3[id] = theFillDetMap3[id]+
pow((*hoItr).energy(),3);
168 theFillDetMap4[id] = theFillDetMap4[id]+
pow((*hoItr).energy(),4);
173 if (!hfLabel_.empty()) {
178 if (!allowMissingInputs_) {
183 hfItr != (*hf).end(); ++hfItr)
186 theFillDetMap0[id] = theFillDetMap0[id]+ 1.;
187 theFillDetMap1[id] = theFillDetMap1[id]+(*hfItr).energy();
188 theFillDetMap2[id] = theFillDetMap2[id]+
pow((*hfItr).energy(),2);
189 theFillDetMap3[id] = theFillDetMap3[id]+
pow((*hfItr).energy(),3);
190 theFillDetMap4[id] = theFillDetMap4[id]+
pow((*hfItr).energy(),4);
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
HcalSubdetector subdet() const
get the subdetector
Geom::Phi< T > phi() const
std::vector< HBHERecHit >::const_iterator const_iterator
int depth() const
get the tower depth
int ieta() const
get the cell ieta
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
int iphi() const
get the cell iphi
T const * product() const
Power< A, B >::type pow(const A &a, const B &b)