CMS 3D CMS Logo

RootNeutronWriter.cc
Go to the documentation of this file.
3 
4 using namespace std;
5 #include <iostream>
6 RootNeutronWriter::RootNeutronWriter(const string& fileName) { theFile = new TFile(fileName.c_str(), "update"); }
7 
9  for (std::map<int, RootChamberWriter>::iterator mapItr = theChamberWriters.begin(); mapItr != theChamberWriters.end();
10  ++mapItr) {
11  mapItr->second.tree()->Print();
12  // the tree will remember which file it's from
13  theFile = mapItr->second.tree()->GetCurrentFile();
14  }
15  theFile->Write();
16  // theFile->Close();
17 }
18 
19 void RootNeutronWriter::initialize(int chamberType) {
20  ostringstream treeName;
21  treeName << "ChamberType" << chamberType;
22  theChamberWriters[chamberType] = RootChamberWriter(treeName.str());
23 }
24 
26  std::map<int, RootChamberWriter>::iterator mapItr = theChamberWriters.find(chamberType);
27  if (mapItr != theChamberWriters.end()) {
28  return mapItr->second;
29  } else {
30  throw cms::Exception("NeutronWriter") << "It's dangerous to create ROOT chamber "
31  << "writers during processing. The global file may change";
32 
33  // make a new one
34  initialize(chamberType);
35  return theChamberWriters[chamberType];
36  }
37 }
38 
40  std::cout << "ROOTNEUTRONWRITER " << chamberType << " HITS SIZE " << hits.size() << std::endl;
41  chamberWriter(chamberType).write(hits);
42 }
MessageLogger.h
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
gather_cfg.cout
cout
Definition: gather_cfg.py:144
RootNeutronWriter::writeCluster
void writeCluster(int chamberType, const edm::PSimHitContainer &hits) override
writes out a list of SimHits.
Definition: RootNeutronWriter.cc:39
RootNeutronWriter::RootNeutronWriter
RootNeutronWriter(const std::string &fileName)
Definition: RootNeutronWriter.cc:6
MillePedeFileConverter_cfg.fileName
fileName
Definition: MillePedeFileConverter_cfg.py:32
RootNeutronWriter::initialize
void initialize(int detType) override
Definition: RootNeutronWriter.cc:19
RootNeutronWriter::chamberWriter
RootChamberWriter & chamberWriter(int chamberType)
Definition: RootNeutronWriter.cc:25
interactiveExample.theFile
theFile
Definition: interactiveExample.py:17
RootChamberWriter
Definition: RootChamberWriter.h:8
std
Definition: JetResolutionObject.h:76
Exception
Definition: hltDiff.cc:245
initialize
static AlgebraicMatrix initialize()
Definition: BeamSpotTransientTrackingRecHit.cc:24
RootNeutronWriter.h
edm::PSimHitContainer
std::vector< PSimHit > PSimHitContainer
Definition: PSimHitContainer.h:11
RootNeutronWriter::~RootNeutronWriter
~RootNeutronWriter() override
Definition: RootNeutronWriter.cc:8